/* Dashboard styling */
:root {
    /* Dark theme (default) */
    --bg-start: #0a1020;
    --bg-end: #0a1327;
    --panel: #111a2b;
    --card: #0e1726;
    --text: #e6eefc;
    --muted: #98a6bd;
    --brand: #4c8bf5;
    --accent: #5dd4a1;
    --warn: #f5c04c;
    --border: #1e2a42;
    --header-bg: rgba(10, 16, 32, 0.7);
    --hover-bg: rgba(255, 255, 255, 0.06);
    --chip-bg: rgba(255, 255, 255, 0.06);
}

/* Respect system preference when no explicit theme is set */
@media (prefers-color-scheme: light) {
    :root:not([data-theme]) {
        --bg-start: #f6f8fc;
        --bg-end: #eef2f9;
        --panel: #ffffff;
        --card: #ffffff;
        --text: #0f172a;
        --muted: #4b5563;
        --brand: #3b82f6;
        --accent: #059669;
        --warn: #b45309;
        --border: #e5e7eb;
    --header-bg: rgba(255, 255, 255, 0.8);
    --hover-bg: rgba(0, 0, 0, 0.05);
    --chip-bg: rgba(0, 0, 0, 0.04);
    }
}

/* Explicit light theme */
:root[data-theme="light"],
html[data-theme="light"] {
    --bg-start: #f6f8fc;
    --bg-end: #eef2f9;
    --panel: #ffffff;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #4b5563;
    --brand: #3b82f6;
    --accent: #059669;
    --warn: #b45309;
    --border: #e5e7eb;
    --header-bg: rgba(255, 255, 255, 0.8);
    --hover-bg: rgba(0, 0, 0, 0.05);
    --chip-bg: rgba(0, 0, 0, 0.04);
}

/* Explicit dark theme */
:root[data-theme="dark"],
html[data-theme="dark"] {
    --bg-start: #0a1020;
    --bg-end: #0a1327;
    --panel: #111a2b;
    --card: #0e1726;
    --text: #e6eefc;
    --muted: #98a6bd;
    --brand: #4c8bf5;
    --accent: #5dd4a1;
    --warn: #f5c04c;
    --border: #1e2a42;
    --header-bg: rgba(10, 16, 32, 0.7);
    --hover-bg: rgba(255, 255, 255, 0.06);
    --chip-bg: rgba(255, 255, 255, 0.06);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
    background: linear-gradient(180deg, var(--bg-start) 0%, var(--bg-end) 100%);
    color: var(--text);
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--header-bg);
    backdrop-filter: blur(6px);
    position: sticky;
    top: 0;
    z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
    width: 36px; height: 36px; border-radius: 8px;
    background: linear-gradient(135deg, var(--brand), #7aa6f7);
    display: grid; place-items: center; font-weight: 800; color: white;
}
.title-group h1 { font-size: 18px; margin: 0; }
.title-group .subtitle { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.env-badge { border: 1px solid var(--border); padding: 6px 10px; border-radius: 999px; color: var(--text); font-size: 12px; background: var(--chip-bg); font-weight: 600; }

.theme-toggle {
    margin-left: 8px;
    border: 1px solid var(--border);
    background: var(--chip-bg);
    color: var(--text);
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    cursor: pointer;
    font-weight: 600;
}
.theme-toggle:hover { background: var(--hover-bg); }
.theme-toggle:hover { background: var(--hover-bg); }

.container { max-width: 1200px; margin: 0 auto; padding: 24px; }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.25);
}
.card-title { color: var(--muted); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.card-metric { font-size: 28px; font-weight: 800; margin-top: 6px; }
.card-foot { color: var(--muted); font-size: 12px; margin-top: 10px; }
.success-text { color: var(--accent); }
.warn-text { color: var(--warn); }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 24px; }
.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
}
.panel h2 { margin: 0 0 12px; font-size: 16px; }
.span-2 { grid-column: span 2; }

.comment-list { max-height: 320px; overflow: auto; border-top: 1px solid var(--border); }
.comment-list ul { list-style: none; margin: 0; padding: 0; }
.comment-list li {
    padding: 10px 12px; border-bottom: 1px solid var(--border);
    color: var(--text);
}
.comment-list li:hover { background: rgba(255,255,255,0.03); }

@media (max-width: 960px) {
    .cards { grid-template-columns: repeat(2, 1fr); }
    .grid { grid-template-columns: 1fr; }
    .span-2 { grid-column: span 1; }
}
