body { background-color: #0f111a; color: #fff; font-family: 'Inter', system-ui, -apple-system, sans-serif; }
#services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    align-items: start;
}

#services-grid > div {
    align-self: start;
}

.card { 
    background-color: #1a1d29; 
    border: 1px solid #2d3245; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.3); 
    transition: transform 0.2s ease-out; 
    align-self: start; 
    overflow: hidden;
}

.expanded { 
    border-top: 1px solid #3b82f6 !important; 
    background-color: #1e2230; 
}
.status-down { color: #f87171; }
.small-status { font-size: 0.75rem; opacity: 0.8; }

.service-row {
    display: grid;
    grid-template-columns: 55px 65px 1fr 85px;
    gap: 8px;
    align-items: start;
    font-size: 0.85rem;
    margin-bottom: 10px;
}

.label-box { font-weight: 600; font-size: 0.65rem; margin-top: 4px; }
.hash-container { display: flex; flex-direction: column; }
.hash-tag { font-family: monospace; font-weight: bold; font-size: 0.85rem; color: #fff; text-decoration: none; display: inline-block; }
.hash-tag:hover { text-decoration: underline; }
.image-id-small { font-family: monospace; font-size: 0.65rem; color: #666; cursor: pointer; display: flex; align-items: center; border-radius: 3px; padding: 1px 4px; margin-left: -4px; transition: all 0.2s; }
.image-id-small:hover { color: #aaa; background: rgba(255,255,255,0.05); }

.build-age { font-size: 0.7rem; opacity: 0.5; font-style: italic; margin-top: 4px; }

/* Environment Badges - Now Neutral */
.badge-prod { background-color: rgba(255, 255, 255, 0.05); color: #fff; border: 1px solid rgba(255, 255, 255, 0.2); padding: 1px 4px; border-radius: 3px; text-decoration: none; font-weight: bold; }
.badge-staging { background-color: rgba(255, 255, 255, 0.05); color: #aaa; border: 1px solid rgba(255, 255, 255, 0.1); padding: 1px 4px; border-radius: 3px; text-decoration: none; }
.bg-purple-subtle { background-color: rgba(168, 85, 247, 0.1) !important; }
.text-purple { color: #a855f7 !important; }
.border-purple-subtle { border-color: rgba(168, 85, 247, 0.4) !important; }

/* Slot Names - Muted */
.text-blue, .text-green { color: #888 !important; text-decoration: none; margin-top: 4px; font-weight: normal !important; }
.text-blue:hover, .text-green:hover { color: #fff !important; text-decoration: underline; }

/* Sync Status - Traffic Lights */
.sync-indicator { font-size: 0.7rem; padding: 2px 8px; border-radius: 20px; font-weight: 600; }
.sync-match { background: rgba(34, 197, 94, 0.1); color: #22c55e; border: 1px solid rgba(34, 197, 94, 0.4); } /* Synced = Green */
.sync-mismatch { background: rgba(59, 130, 246, 0.1); color: #3b82f6; border: 1px solid rgba(59, 130, 246, 0.4); } /* Out of sync = Blue */
.sync-stag-only { background: rgba(245, 158, 11, 0.1); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.4); } /* Only Staging = Yellow */
.sync-none { background: rgba(239, 68, 68, 0.1); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.4); } /* Missing = Red */
.sync-prod-only { background: rgba(245, 158, 11, 0.1); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.4); } /* Only Prod = Yellow */

.hash-match { color: #888 !important; } /* Good = Neutral */
.hash-mismatch { color: #3b82f6 !important; } /* Warning = Blue */

pre { background: rgba(0,0,0,0.3); padding: 10px; border-radius: 6px; color: #555; font-size: 0.7rem; position: relative; border: 1px solid #222; white-space: pre-wrap; word-break: break-all; margin-bottom: 8px; font-family: monospace; transition: all 0.2s ease-in-out; }
pre:hover { background: rgba(255, 255, 255, 0.05); color: #fff; border-color: #444; }

pre.ssh-cmd { transition: all 0.2s ease-in-out; }
pre.ssh-cmd:hover { background: rgba(59, 130, 246, 0.12) !important; color: #fff !important; border-color: rgba(59, 130, 246, 0.5) !important; box-shadow: 0 0 15px rgba(0, 0, 0, 0.3); }
.cmd-comment { color: #555; font-style: italic; display: block; margin-bottom: 4px; }
pre.ssh-cmd:hover .cmd-comment { color: rgba(255, 255, 255, 0.4); }
.copy-btn { position: absolute; right: 8px; top: 8px; padding: 2px 8px; opacity: 0.3; }
.copy-btn:hover { opacity: 1; }

.cmd-section { border-top: 1px solid #242838; margin-top: 12px; padding-top: 12px; }

.build-badge { font-size: 0.6rem; padding: 1px 4px; border-radius: 3px; font-weight: bold; text-decoration: none; }
.build-progress { color: #3b82f6; border: 1px solid #3b82f6; }
.build-success { color: #22c55e; border: 1px solid rgba(34, 197, 94, 0.2); background: rgba(34, 197, 94, 0.05); } /* Good = Green */
.build-failure { color: #f87171; border: 1px solid #f87171; background: rgba(248, 113, 113, 0.1); } /* Error = Red */

.repo-link { font-size: 0.75rem; color: #666; text-decoration: none; }
.repo-link:hover { color: #fff; text-decoration: underline; }
.service-title-link { color: inherit; text-decoration: none; }
.service-title-link:hover { color: #fff; text-decoration: underline; }

.version-tag { position: fixed; bottom: 10px; right: 10px; font-size: 0.6rem; color: #333; pointer-events: none; }

.spin { animation: spin 2s linear infinite; display: inline-block; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.ls-1 { letter-spacing: 0.1rem; opacity: 0.6; }

/* Sortable styles */
.drag-handle, .section-drag-handle { cursor: grab; color: #444; transition: color 0.2s; font-size: 1.1rem; vertical-align: middle; }
.drag-handle:hover, .section-drag-handle:hover { color: #888; opacity: 1 !important; }
.drag-handle:active, .section-drag-handle:active { cursor: grabbing; }
.section-drag-handle { opacity: 0.4; margin-right: 10px; }
.sortable-ghost { opacity: 0.3; background: #3b82f6 !important; }
.sortable-chosen { border: 1px solid #3b82f6 !important; }

/* Collapsible Logic */
.card-management-ui { display: none; }
.expanded { 
    background-color: #1e2230; 
}
.expanded .card-management-ui { display: block; }
.expanded .collapsed-overview { display: none; }

/* Card Status Borders */
.card.card-status-green { border: 1px solid #22c55e !important; border-left-width: 4px !important; border-top-color: #22c55e !important; }
.card.card-status-blue { border: 1px solid #3b82f6 !important; border-left-width: 4px !important; border-top-color: #3b82f6 !important; }
.card.card-status-yellow { border: 1px solid #f59e0b !important; border-left-width: 4px !important; border-top-color: #f59e0b !important; }
.card.card-status-red { border: 1px solid #ef4444 !important; border-left-width: 4px !important; border-top-color: #ef4444 !important; }
.card.card-status-purple { border: 1px solid #a855f7 !important; border-left-width: 4px !important; border-top-color: #a855f7 !important; }
.card.card-status-default { border: 1px solid #2d3245 !important; border-left-width: 4px !important; }

.collapsed-overview { display: flex; align-items: center; gap: 12px; font-size: 0.8rem; margin-top: 8px; cursor: pointer; }
.clickable-header { cursor: pointer; }
.expand-toggle { cursor: pointer; color: #444; font-size: 1.1rem; transition: all 0.2s; position: relative; z-index: 10; }
.expand-toggle:hover { color: #fff; }

/* Hide toggles on mobile ONLY if desired, but here we want them always available */
@media (max-width: 576px) {
    .service-row { grid-template-columns: 45px 55px 1fr; gap: 5px; }
    .hash-tag { font-size: 0.75rem; }
}

/* External Monitors */
#external-monitors .card {
    transition: all 0.2s ease-in-out;
    border: 1px solid rgba(255,255,255,0.05) !important;
}

#external-monitors .card:hover {
    border-color: rgba(255,255,255,0.1) !important;
}

#external-monitors .card.expanded {
    /* Reveal details */
}

.uptime-sparkline {
    height: 40px;
    width: 100%;
    margin-top: 10px;
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
    padding: 4px;
    display: flex;
    align-items: flex-end;
    gap: 1px;
}

.sparkline-bar {
    flex: 1;
    min-width: 2px;
    height: 100%;
    border-radius: 1px;
}

.sparkline-bar.up { background-color: #22c55e; }
.sparkline-bar.down { background-color: #ef4444; }
.sparkline-bar.empty { background-color: transparent; }

.monitor-history-stats {
    font-size: 0.7rem;
    color: #666;
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
}

.monitor-expand-toggle {
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.monitor-expand-toggle:hover {
    opacity: 1;
}

.monitor-details {
    display: none;
    border-top: 1px solid rgba(255,255,255,0.05);
    margin-top: 10px;
    padding-top: 10px;
}

.card.expanded .monitor-details {
    display: block;
}
