/* Agent 402 Design System — see docs/DESIGN_SYSTEM.md */

:root {
    /* Backgrounds */
    --bg-primary: #0a0a0f;
    --bg-secondary: #111118;
    --bg-card: #16161f;
    --bg-input: #1a1a25;
    --bg-hover: rgba(99, 102, 241, 0.04);

    /* Borders */
    --border: #2a2a3a;
    --border-focus: var(--accent);

    /* Text */
    --text-primary: #e0e0e8;
    --text-secondary: #8888a0;
    --text-muted: #555570;

    /* Accent */
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.15);

    /* Semantic */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Typography */
    --text-xs: 0.75rem;     /* 12px */
    --text-sm: 0.875rem;    /* 14px */
    --text-base: 1rem;      /* 16px */
    --text-lg: 1.25rem;     /* 20px */
    --text-xl: 1.5rem;      /* 24px */
    --text-2xl: 2rem;       /* 32px */

    /* Spacing */
    --space-1: 0.25rem;     /* 4px */
    --space-2: 0.5rem;      /* 8px */
    --space-3: 0.75rem;     /* 12px */
    --space-4: 1rem;        /* 16px */
    --space-5: 1.25rem;     /* 20px */
    --space-6: 1.5rem;      /* 24px */
    --space-8: 2rem;        /* 32px */
    --space-10: 2.5rem;     /* 40px */
}

/* Light theme overrides */
body.light {
    --bg-primary: #f8f9fb;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f3f4f6;
    --bg-hover: rgba(99, 102, 241, 0.06);
    --border: #e2e4e9;
    --border-focus: var(--accent);
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-glow: rgba(79, 70, 229, 0.12);
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #2563eb;
}

/* System preference: auto-apply light if user has no saved preference */
@media (prefers-color-scheme: light) {
    body:not(.dark):not(.light) {
        --bg-primary: #f8f9fb;
        --bg-secondary: #ffffff;
        --bg-card: #ffffff;
        --bg-input: #f3f4f6;
        --bg-hover: rgba(99, 102, 241, 0.06);
        --border: #e2e4e9;
        --border-focus: var(--accent);
        --text-primary: #111827;
        --text-secondary: #4b5563;
        --text-muted: #9ca3af;
        --accent: #4f46e5;
        --accent-hover: #4338ca;
        --accent-glow: rgba(79, 70, 229, 0.12);
        --success: #059669;
        --warning: #d97706;
        --danger: #dc2626;
        --info: #2563eb;
    }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: var(--text-base);
    line-height: 1.5;
    min-height: 100vh;
    transition: background-color 0.2s, color 0.2s;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* Layout */
.app-layout { display: flex; min-height: 100vh; }

/* ── Sidebar (V7-aligned, soft chromium) ─────────────── */
.sidebar {
    width: 232px;
    min-width: 232px;
    background:
        linear-gradient(
            180deg,
            rgba(255,255,255,0.025) 0%,
            transparent 22%,
            transparent 78%,
            rgba(0,0,0,0.10) 100%
        ),
        linear-gradient(
            90deg,
            var(--bg-secondary) 0%,
            var(--bg-secondary) 70%,
            rgba(99,102,241,0.025) 100%
        ),
        var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;       /* fallback */
    height: 100dvh;      /* honors mobile URL-bar shrink */
    overflow: hidden;
    flex-shrink: 0;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.04),
        inset -1px 0 0 rgba(255,255,255,0.015),
        2px 0 12px -8px rgba(0,0,0,0.4);
}
body.light .sidebar {
    background:
        linear-gradient(
            180deg,
            rgba(255,255,255,0.6) 0%,
            transparent 24%,
            transparent 80%,
            rgba(0,0,0,0.02) 100%
        ),
        var(--bg-secondary);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.6),
        2px 0 12px -10px rgba(0,0,0,0.06);
}

/* Brand row: Agent 402 | MARKETPLACE */
.sidebar-brand {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 18px 18px;
    text-decoration: none;
    color: var(--text-primary);
    border-bottom: 1px solid transparent;
    transition: background 0.15s ease;
}
.sidebar-brand:hover { background: var(--bg-hover); }
.sidebar-brand .brand-name {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.3px;
    line-height: 1;
    color: var(--text-primary);
}
.sidebar-brand .brand-name .brand-accent { color: var(--accent); }
.sidebar-brand .brand-product {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    text-transform: uppercase;
    padding-left: 10px;
    border-left: 1px solid var(--border);
}

/* Nav */
.sidebar-nav {
    flex: 1;
    min-height: 0;       /* allow flex shrink so overflow-y: auto kicks in */
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px 10px;
    scrollbar-width: none;
}

/* Cross-product switcher (marketplace → Demand Intel). Sits at the top of
   the sidebar, above the in-app nav. Distinct gradient + ↗ icon so it
   reads as "leaves this app", not a regular nav item. Same V7 indigo→
   violet language as the intel-side switcher. */
.product-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 10px 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.10), rgba(168, 85, 247, 0.10));
    border: 1px solid rgba(99, 102, 241, 0.28);
    color: var(--text-primary);
    text-decoration: none;
    isolation: isolate;
    transition: transform 0.15s ease, border-color 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
}
.product-switch:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.22), rgba(168, 85, 247, 0.22));
    border-color: rgba(168, 85, 247, 0.65);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.30);
}
.product-switch-icon {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #6366f1 0%, #a78bfa 100%);
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.42),
                inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.product-switch-text { flex: 1; min-width: 0; }
.product-switch-title {
    font-size: 12.5px; font-weight: 600; letter-spacing: -0.1px;
    color: var(--text-primary);
    line-height: 1.2;
}
.product-switch-sub {
    font-size: 10.5px; color: var(--text-secondary); letter-spacing: -0.05px;
    margin-top: 3px;
    line-height: 1.4;
}
.product-switch-arrow {
    color: var(--text-secondary); flex-shrink: 0;
    transition: transform 0.2s ease, color 0.2s ease;
}
.product-switch:hover .product-switch-arrow {
    color: var(--accent);
    transform: translate(2px, -2px);
}

/* Sign in CTA — replaces the user pill for not-logged-in visitors so the
   sidebar still feels complete instead of empty at the bottom. Same V7
   indigo→violet language as the cross-product switcher. */
.signin-cta {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(168, 85, 247, 0.18));
    border: 1px solid rgba(99, 102, 241, 0.40);
    color: var(--text-primary);
    text-decoration: none;
    transition: transform 0.15s ease, border-color 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
}
.signin-cta:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.32), rgba(168, 85, 247, 0.32));
    border-color: rgba(168, 85, 247, 0.7);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.3);
}
.signin-cta-icon {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #6366f1 0%, #a78bfa 100%);
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.42),
                inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.signin-cta-text { flex: 1; min-width: 0; }
.signin-cta-title {
    display: block;
    font-size: 13px; font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -0.1px;
}
.signin-cta-sub {
    display: block;
    font-size: 10.5px; color: var(--text-secondary);
    margin-top: 3px; line-height: 1.4;
    letter-spacing: -0.05px;
}
.sidebar-nav::-webkit-scrollbar { display: none; }
.sidebar-nav .nav-section + .nav-section { margin-top: 12px; }
.sidebar-nav .nav-section-label {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 9.5px;
    letter-spacing: 1.3px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    padding: 4px 10px 8px;
    opacity: 0.85;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    margin-bottom: 2px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.1px;
    text-decoration: none;
    transition: background 0.14s ease, color 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease;
    border-left: none;
    position: relative;
}
.sidebar-nav a .nav-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.85;
    transition: opacity 0.14s ease;
}
.sidebar-nav a:hover {
    background: linear-gradient(180deg, rgba(255,255,255,0.025), transparent), var(--bg-hover);
    color: var(--text-primary);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}
.sidebar-nav a:hover .nav-icon { opacity: 1; }
.sidebar-nav a.active {
    background: linear-gradient(
        180deg,
        rgba(99,102,241,0.26) 0%,
        rgba(99,102,241,0.12) 60%,
        rgba(99,102,241,0.08) 100%
    );
    color: #c7d2fe;
    font-weight: 600;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.08),
        inset 0 -1px 0 rgba(0,0,0,0.18),
        0 1px 0 rgba(255,255,255,0.02);
}
body.light .sidebar-nav a.active {
    background: linear-gradient(
        180deg,
        rgba(79,70,229,0.16) 0%,
        rgba(79,70,229,0.08) 60%,
        rgba(79,70,229,0.05) 100%
    );
    color: var(--accent);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.7),
        inset 0 -1px 0 rgba(79,70,229,0.06),
        0 1px 1px rgba(79,70,229,0.04);
}
.sidebar-nav a.active .nav-icon { opacity: 1; color: var(--accent); }

/* Footer (user card + theme) */
.sidebar-footer {
    border-top: 1px solid var(--border);
    padding: 10px 12px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sidebar-footer .theme-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 2px 0;
}
.sidebar-footer .theme-label {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 10px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}
.sidebar-footer .user-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    min-width: 0;
}
.sidebar-footer .user-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.sidebar-footer .user-display {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    cursor: default;
}
.sidebar-footer .user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #a78bfa, #60a5fa);
    color: #0a0b0d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10.5px;
    font-weight: 700;
    flex-shrink: 0;
}
.sidebar-footer .user-name {
    font-size: 12px;
    color: var(--text-primary);
    letter-spacing: -0.1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.sidebar-footer .signout-btn {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: transparent;
    transition: background 0.15s ease, color 0.15s ease;
    text-decoration: none;
}
.sidebar-footer .signout-btn:hover {
    background: rgba(239,68,68,0.1);
    color: var(--danger);
}
.sidebar-footer .signout-btn svg {
    width: 14px;
    height: 14px;
    display: block;
}
.sidebar-footer .sidebar-wallet {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 10.5px;
    letter-spacing: 0.2px;
    color: var(--text-muted);
    padding-left: 36px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
    min-height: 14px;
}
.sidebar-footer .sidebar-wallet a { color: var(--accent); text-decoration: none; }
.sidebar-footer .sidebar-wallet a:hover { color: var(--accent-hover); }
/* Hide the legacy text "Sign out" link if the icon button is used */
.sidebar-footer .user-signout-text { display: none; }
.main-content { flex: 1; padding: 2rem; overflow-y: auto; }
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}
.page-title { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.4px; }
.page-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 4px;
    letter-spacing: -0.05px;
}
.page-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.page-actions-link {
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    margin-left: 0.25rem;
    transition: color 0.12s ease;
}
.page-actions-link:hover { color: var(--text-primary); }

/* ── Two-column pair (Inspiration + Quickstart) ─────── */
.dash-pair {
    display: grid;
    grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: stretch;
}
.dash-pair > .card { margin-bottom: 0; }
@media (max-width: 980px) {
    .dash-pair { grid-template-columns: 1fr; }
}

/* ── Quickstart card ─────────────────────────────────── */
.quickstart {
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1.5rem 1.25rem;
}
.quickstart-header { margin-bottom: 1.1rem; }
.quickstart-eyebrow {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 10px;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 6px;
}
.quickstart-title {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    margin-bottom: 6px;
}
.quickstart-sub {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.5;
}
.quickstart-list {
    list-style: none;
    margin: 0 0 1.1rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1;
}
.quickstart-list li {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    color: var(--text-secondary);
}
.quickstart-list li:last-child { border-bottom: none; }
.quickstart-num {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 11px;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    flex-shrink: 0;
    width: 22px;
}
.quickstart-text { letter-spacing: -0.1px; }
.quickstart-cta {
    width: 100%;
    justify-content: center;
    margin-top: auto;
}

/* ── Cards (chromium) ──────────────────────────────────
   Universal "panel" treatment: vertical sheen, inner top
   highlight, inner bottom shadow, soft outer drop. Cascades
   to every page (agents, settings, register, etc.). */
.card {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.018) 0%, transparent 14%),
        var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.045),
        inset 0 -1px 0 rgba(0,0,0,0.10),
        0 1px 2px rgba(0,0,0,0.18),
        0 6px 16px -8px rgba(0,0,0,0.24);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
    position: relative;
}
body.light .card {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.6) 0%, transparent 12%),
        var(--bg-card);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.55),
        inset 0 -1px 0 rgba(15,23,42,0.025),
        0 1px 2px rgba(15,23,42,0.04),
        0 6px 16px -8px rgba(15,23,42,0.10);
}
.card-header { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; }

/* Interactive cards (clickable rows, dash pair items) get a
   light hover lift to echo the button language. */
.dash-pair > .card:hover,
.card.card-interactive:hover {
    border-color: rgba(99,102,241,0.32);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.06),
        inset 0 -1px 0 rgba(0,0,0,0.10),
        0 2px 4px rgba(0,0,0,0.20),
        0 14px 28px -14px rgba(99,102,241,0.32);
}
body.light .dash-pair > .card:hover,
body.light .card.card-interactive:hover {
    border-color: rgba(79,70,229,0.32);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.7),
        inset 0 -1px 0 rgba(15,23,42,0.025),
        0 2px 4px rgba(15,23,42,0.06),
        0 14px 28px -14px rgba(79,70,229,0.20);
}

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.018) 0%, transparent 14%),
        var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.045),
        inset 0 -1px 0 rgba(0,0,0,0.10),
        0 1px 2px rgba(0,0,0,0.18),
        0 6px 16px -8px rgba(0,0,0,0.24);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.stat-card:hover {
    border-color: rgba(99,102,241,0.28);
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.06),
        inset 0 -1px 0 rgba(0,0,0,0.10),
        0 2px 4px rgba(0,0,0,0.22),
        0 12px 24px -12px rgba(99,102,241,0.30);
}
body.light .stat-card {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.6) 0%, transparent 12%),
        var(--bg-card);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.55),
        inset 0 -1px 0 rgba(15,23,42,0.025),
        0 1px 2px rgba(15,23,42,0.04),
        0 6px 16px -8px rgba(15,23,42,0.10);
}
body.light .stat-card:hover {
    border-color: rgba(79,70,229,0.28);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.7),
        0 2px 4px rgba(15,23,42,0.06),
        0 12px 24px -12px rgba(79,70,229,0.18);
}
.stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 1.75rem; font-weight: 700; margin-top: 0.25rem; }
.stat-value.success { color: var(--success); }
.stat-value.accent { color: var(--accent); }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead th {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}
tbody tr:hover { background: rgba(99,102,241,0.04); }

/* ── Buttons (chromium / glassy) ──────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 1.05rem;
    border-radius: 9px;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: -0.1px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    user-select: none;
    transition:
        background 0.14s ease,
        border-color 0.14s ease,
        color 0.14s ease,
        transform 0.14s ease,
        box-shadow 0.14s ease;
    position: relative;
}
.btn:active { transform: translateY(0); }

/* Primary */
.btn-primary {
    background: linear-gradient(180deg, #818cf8 0%, var(--accent) 100%);
    color: #ffffff;
    border-color: rgba(99,102,241,0.55);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.20),
        inset 0 -1px 0 rgba(0,0,0,0.22),
        0 1px 2px rgba(99,102,241,0.20),
        0 4px 12px -4px rgba(99,102,241,0.45);
}
.btn-primary:hover {
    background: linear-gradient(180deg, #a5b4fc 0%, #818cf8 100%);
    color: #ffffff;
    transform: translateY(-1px);
    border-color: rgba(129,140,248,0.7);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.24),
        inset 0 -1px 0 rgba(0,0,0,0.22),
        0 2px 4px rgba(99,102,241,0.28),
        0 10px 22px -6px rgba(99,102,241,0.55);
}
.btn-primary:active {
    transform: translateY(0);
    box-shadow:
        inset 0 1px 2px rgba(0,0,0,0.18),
        inset 0 -1px 0 rgba(255,255,255,0.06),
        0 1px 2px rgba(99,102,241,0.20);
}
body.light .btn-primary {
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.45),
        inset 0 -1px 0 rgba(0,0,0,0.10),
        0 1px 2px rgba(79,70,229,0.18),
        0 4px 12px -4px rgba(79,70,229,0.35);
}

/* Secondary (glassy slate) */
.btn-secondary {
    background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-input) 100%);
    color: var(--text-primary);
    border-color: var(--border);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.05),
        inset 0 -1px 0 rgba(0,0,0,0.14),
        0 1px 2px rgba(0,0,0,0.18);
}
.btn-secondary:hover {
    background: linear-gradient(180deg, var(--bg-card) 0%, var(--border) 100%);
    color: var(--text-primary);
    border-color: rgba(99,102,241,0.45);
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.07),
        inset 0 -1px 0 rgba(0,0,0,0.14),
        0 4px 12px -3px rgba(0,0,0,0.30);
}
.btn-secondary:active {
    transform: translateY(0);
    box-shadow:
        inset 0 1px 2px rgba(0,0,0,0.18),
        0 1px 2px rgba(0,0,0,0.18);
}
body.light .btn-secondary {
    background: linear-gradient(180deg, #ffffff 0%, var(--bg-input) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.7),
        inset 0 -1px 0 rgba(0,0,0,0.04),
        0 1px 2px rgba(15,23,42,0.06);
}
body.light .btn-secondary:hover {
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.8),
        inset 0 -1px 0 rgba(0,0,0,0.04),
        0 4px 12px -3px rgba(15,23,42,0.10);
}

/* Ghost (text + soft hover plate) */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
    box-shadow: none;
}
.btn-ghost:hover {
    color: var(--text-primary);
    background: linear-gradient(180deg, var(--bg-hover), transparent);
    border-color: var(--border);
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.04),
        0 2px 8px -2px rgba(0,0,0,0.18);
}
.btn-ghost:active {
    transform: translateY(0);
    box-shadow: none;
}

/* Danger */
.btn-danger {
    background: linear-gradient(180deg, #f87171 0%, var(--danger) 100%);
    color: #ffffff;
    border-color: rgba(239,68,68,0.55);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.18),
        inset 0 -1px 0 rgba(0,0,0,0.22),
        0 1px 2px rgba(239,68,68,0.20),
        0 4px 12px -4px rgba(239,68,68,0.40);
}
.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.22),
        inset 0 -1px 0 rgba(0,0,0,0.22),
        0 2px 4px rgba(239,68,68,0.28),
        0 10px 22px -6px rgba(239,68,68,0.55);
}

.btn-sm { padding: 0.32rem 0.8rem; font-size: 0.8rem; border-radius: 7px; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 0.375rem; }
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    color: var(--text-primary);
    font-size: 0.875rem;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(99,102,241,0.2);
}
.form-textarea { min-height: 80px; resize: vertical; }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 500;
}
.badge-success { background: rgba(16,185,129,0.15); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-danger { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-info { background: rgba(59,130,246,0.15); color: var(--info); }
.badge-muted { background: rgba(85,85,112,0.15); color: var(--text-muted); }

/* Wizard steps */
.wizard-steps {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
}
.wizard-step {
    flex: 1;
    text-align: center;
    padding: 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.wizard-step.active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(99,102,241,0.08);
}
.wizard-step.completed {
    border-color: var(--success);
    color: var(--success);
    background: rgba(16,185,129,0.08);
}
.step-panel { display: none; }
.step-panel.active { display: block; }

/* Code block */
.code-block {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    padding: 1rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
    overflow-x: auto;
    white-space: pre;
    color: var(--text-secondary);
}

/* Monospace variant of .form-textarea for editing JSON / JSON Schema.
   Added in Wave E.1 v3 A2 for the "Edit advanced" schema editor. */
.code-textarea {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
    line-height: 1.4;
}

/* TOS acceptance row in the agent registration wizard Step 4 confirm.
   Added in Wave E.1 v3 A3 (audit doc §3.4). Inline-flex row pairing a
   checkbox with the Publisher TOS attestation copy. */
.tos-row {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    background: var(--bg-input);
    margin-top: var(--space-4);
}
.tos-row input[type="checkbox"] {
    margin-top: 0.2rem;
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    cursor: pointer;
}
.tos-row label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.5;
    cursor: pointer;
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}
.alert-success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); color: var(--success); }
.alert-danger { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: var(--danger); }
.alert-info { background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.3); color: var(--info); }
.alert-warning { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); color: var(--warning); }

/* Health indicator */
.health-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.375rem;
}
.health-dot.healthy { background: var(--success); }
.health-dot.degraded { background: var(--warning); }
.health-dot.unhealthy { background: var(--danger); }
.health-dot.unknown { background: var(--text-muted); }

/* Login page */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
}
.login-title { text-align: center; font-size: 1.25rem; font-weight: 600; margin-bottom: 1.5rem; }
.login-subtitle { text-align: center; color: var(--text-muted); font-size: 0.85rem; margin-bottom: 2rem; }
.login-toggle { text-align: center; margin-top: 1rem; font-size: 0.85rem; color: var(--text-muted); }
.login-toggle a { cursor: pointer; }

/* Truncate */
.truncate { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Compliance sections */
.compliance-section { margin-bottom: 2rem; }
.compliance-section h3 { font-size: 1rem; margin-bottom: 0.5rem; color: var(--accent); }
.compliance-section p, .compliance-section li { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.7; }

/* Theme toggle switch */
.theme-switch {
    position: relative;
    width: 48px;
    height: 26px;
    background: #3b3b52;
    border-radius: 13px;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.1);
    padding: 0;
    transition: background 0.25s, border-color 0.25s, box-shadow 0.25s;
    flex-shrink: 0;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}
.theme-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #e8e8f0;
    border-radius: 50%;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 0 1px rgba(0,0,0,0.2);
}
.theme-switch:hover {
    background: #4a4a62;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.3), 0 0 0 3px rgba(99,102,241,0.15);
}
.theme-switch:focus-visible {
    outline: none;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.3), 0 0 0 3px rgba(99,102,241,0.4);
}

/* Light mode: accent track, white thumb */
body.light .theme-switch {
    background: var(--accent);
    border-color: rgba(0,0,0,0.08);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.15);
}
body.light .theme-switch::after {
    transform: translateX(22px);
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2), 0 0 1px rgba(0,0,0,0.1);
}
body.light .theme-switch:hover {
    background: var(--accent-hover);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.15), 0 0 0 3px rgba(79,70,229,0.2);
}

@media (prefers-color-scheme: light) {
    body:not(.dark):not(.light) .theme-switch {
        background: var(--accent);
        border-color: rgba(0,0,0,0.08);
        box-shadow: inset 0 1px 2px rgba(0,0,0,0.15);
    }
    body:not(.dark):not(.light) .theme-switch::after {
        transform: translateX(22px);
        background: #ffffff;
        box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    }
}

/* Validation error states */
.form-input.field-error,
.form-select.field-error,
.form-textarea.field-error {
    border-color: var(--danger);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}
.field-error-msg {
    font-size: var(--text-xs);
    color: var(--danger);
    margin-top: var(--space-1);
}

/* Utility classes (design system) */
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.helper-text { font-size: var(--text-xs); color: var(--text-muted); margin-top: var(--space-1); }
.section-desc { font-size: var(--text-sm); color: var(--text-secondary); margin-bottom: var(--space-4); }
.form-actions { display: flex; gap: var(--space-2); justify-content: flex-end; margin-top: var(--space-6); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }

/* Service form card (used in wizard step 2) */
.service-form-card {
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: var(--space-4);
    margin-bottom: var(--space-3);
}
.service-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
}
.service-form-header strong { font-size: var(--text-sm); }

/* ── Demand Intel widget ─────────────────────────────── */
.intel-widget {
    padding: 0;
    overflow: hidden;
}
.intel-widget-header {
    padding: 1.25rem 1.5rem 1.1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}
.intel-widget-headline { flex: 1; min-width: 0; }
.intel-widget-eyebrow {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 10px;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 6px;
}
.intel-widget-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}
.intel-widget-sub {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 4px;
    max-width: 520px;
    line-height: 1.5;
}
.intel-widget-slicer {
    display: flex;
    gap: 2px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2px;
    flex-shrink: 0;
}
.intel-widget-slicer button {
    padding: 5px 11px;
    font-size: 11.5px;
    font-weight: 500;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    letter-spacing: 0.2px;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}
.intel-widget-slicer button:hover { color: var(--text-primary); }
.intel-widget-slicer button.active {
    color: var(--text-primary);
    background: var(--bg-card);
    box-shadow: 0 1px 2px rgba(0,0,0,0.18);
}
body.light .intel-widget-slicer button.active {
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.intel-widget-rows { padding: 0.25rem 0; }
.intel-widget-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.95rem 1.5rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s ease;
}
.intel-widget-row:last-child { border-bottom: none; }
.intel-widget-row:hover { background: var(--bg-hover); }

.intel-widget-row-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.intel-widget-rank {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    min-width: 28px;
}
.intel-widget-row-cat {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 10px;
    letter-spacing: 0.6px;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
}
.intel-widget-row-cat::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 2px;
    background: var(--accent);
    margin-right: 6px;
}
.intel-widget-status {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 9.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 3px;
    letter-spacing: 0.7px;
    display: inline-block;
}
.intel-widget-status-unmet    { color: #ef4444; background: rgba(239,68,68,0.12); }
.intel-widget-status-weak     { color: #f59e0b; background: rgba(245,158,11,0.12); }
.intel-widget-status-emerging { color: #3b82f6; background: rgba(59,130,246,0.12); }
.intel-widget-row-score {
    margin-left: auto;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.3px;
    line-height: 1;
}

.intel-widget-row-title {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
    letter-spacing: -0.15px;
    line-height: 1.35;
    word-break: break-word;
}

.intel-widget-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.85rem;
    align-items: center;
}
.intel-widget-source {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 11px;
    color: var(--text-secondary);
    letter-spacing: 0.1px;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}
.intel-widget-source-arrow {
    font-size: 10px;
    color: var(--text-muted);
    margin-left: 2px;
    opacity: 0.85;
}

.intel-widget-row-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.1px;
    line-height: 1.5;
}
.intel-widget-meta-mult {
    color: var(--accent);
    font-weight: 700;
}

.intel-widget-empty,
.intel-widget-loading {
    padding: 2.25rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.55;
}
.intel-widget-empty-mark {
    font-size: 1.5rem;
    color: var(--accent);
    opacity: 0.7;
    margin-bottom: 0.6rem;
    line-height: 1;
}
.intel-widget-empty-title {
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-weight: 500;
    margin-bottom: 0.3rem;
    letter-spacing: -0.1px;
}
.intel-widget-empty-sub {
    font-size: 0.8125rem;
    color: var(--text-muted);
    max-width: 380px;
    margin: 0 auto;
}

.intel-widget-footer {
    padding: 0.85rem 1.5rem;
    background: var(--bg-input);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8125rem;
    color: var(--text-muted);
    gap: 1rem;
    flex-wrap: wrap;
}
.intel-widget-footer strong { color: var(--text-secondary); font-weight: 600; }
.intel-widget-footer a {
    color: var(--accent);
    font-weight: 500;
    text-decoration: none;
}
.intel-widget-footer a:hover { color: var(--accent-hover); }

@media (max-width: 600px) {
    .intel-widget-header { flex-direction: column; align-items: stretch; }
    .intel-widget-slicer { align-self: flex-start; }
    .intel-widget-row { padding: 0.85rem 1rem; }
}

/* ── Dashboard topbar (breadcrumb + actions) ─────────── */
.dash-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0 1.5rem 0;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 0.75rem;
}
.dash-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 11.5px;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    flex-wrap: wrap;
    min-width: 0;
}
.dash-breadcrumb-section {
    color: var(--accent);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 1.2px;
    font-size: 10.5px;
}
.dash-breadcrumb-sep { opacity: 0.5; }
.dash-breadcrumb-link {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.12s ease;
}
.dash-breadcrumb-link:hover { color: var(--text-primary); }
.dash-breadcrumb-cur {
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 320px;
}
.dash-page-intro {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    margin-top: -0.5rem;
    max-width: 720px;
    line-height: 1.55;
}
.dash-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ── Dashboard hero ──────────────────────────────────── */
.dash-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    gap: 1.5rem;
    padding: 1.75rem;
    margin-bottom: 2.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
}
.dash-hero::before {
    content: '';
    position: absolute;
    top: -200px;
    right: -150px;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(99,102,241,0.08), transparent 60%);
    pointer-events: none;
}
.dash-hero-left {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    position: relative;
    z-index: 1;
}
.dash-hero-headline {
    font-size: clamp(1.5rem, 2.6vw, 2.05rem);
    font-weight: 600;
    letter-spacing: -0.7px;
    line-height: 1.18;
    color: var(--text-primary);
    max-width: 660px;
    margin: 0;
}
/* Brand-palette gradient accents in the hero (premium read) */
.hero-accent {
    font-weight: 600;
    letter-spacing: inherit;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    /* Subtle glow under the gradient for the premium feel */
    filter: drop-shadow(0 1px 8px rgba(99,102,241,0.22));
}
.hero-accent-mint {
    background-image: linear-gradient(180deg, #e0e7ff 0%, #a5b4fc 45%, #818cf8 100%);
}
.hero-accent-peach {
    background-image: linear-gradient(180deg, #a5b4fc 0%, #6366f1 55%, #4f46e5 100%);
}
body.light .hero-accent {
    filter: drop-shadow(0 1px 6px rgba(79,70,229,0.18));
}
body.light .hero-accent-mint {
    background-image: linear-gradient(180deg, #818cf8 0%, #6366f1 55%, #4f46e5 100%);
}
body.light .hero-accent-peach {
    background-image: linear-gradient(180deg, #6366f1 0%, #4f46e5 55%, #4338ca 100%);
}

.dash-hero-sub {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 540px;
    margin: 0;
}
.dash-hero-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

/* Mini stats inside the hero */
.dash-hero-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    margin-top: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-input);
}
.hero-stat {
    padding: 0.85rem 1rem;
    border-right: 1px solid var(--border);
    min-width: 0;
}
.hero-stat:last-child { border-right: none; }
.hero-stat-label {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 9.5px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hero-stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.4px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
    flex-wrap: wrap;
}
.hero-stat-unit {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.4px;
    text-transform: uppercase;
}
.hero-stat-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.45rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Revenue card (right side of hero) */
.dash-hero-right {
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}
.rev-card {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.1rem 1.2rem 1.2rem;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 280px;
}
.rev-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.rev-card-eyebrow {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 9.5px;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}
.rev-card-eyebrow-unit { color: var(--accent); }
.rev-card-slicer {
    display: flex;
    gap: 1px;
    background: rgba(0,0,0,0.18);
    border-radius: 6px;
    padding: 2px;
}
body.light .rev-card-slicer { background: rgba(0,0,0,0.04); }
.rev-card-slicer button {
    padding: 3px 8px;
    font-size: 10px;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}
.rev-card-slicer button:hover { color: var(--text-primary); }
.rev-card-slicer button.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0,0,0,0.18);
}
body.light .rev-card-slicer button.active {
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.rev-card-amount {
    font-size: 2.25rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -1.2px;
    line-height: 1.05;
    margin-top: 1rem;
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    font-variant-numeric: tabular-nums;
}
.rev-card-amount-unit {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.rev-card-delta {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 0.4rem;
    letter-spacing: 0.2px;
}
.rev-card-delta-note { opacity: 0.7; margin-left: 0.4rem; }
.rev-card-chart {
    flex: 1;
    margin-top: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background:
        linear-gradient(180deg, transparent 70%, rgba(99,102,241,0.025)),
        var(--bg-card);
    position: relative;
    overflow: hidden;
    min-height: 130px;
}
.rev-card-chart-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to right, var(--border) 1px, transparent 1px),
        linear-gradient(to bottom, var(--border) 1px, transparent 1px);
    background-size: 40px 32px;
    opacity: 0.18;
}
.rev-card-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    text-align: center;
    padding: 1rem;
}
.rev-card-empty-title {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}
.rev-card-empty-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

@media (max-width: 980px) {
    .dash-hero { grid-template-columns: 1fr; padding: 1.25rem; }
    .dash-hero-stats { grid-template-columns: repeat(2, 1fr); }
    .hero-stat:nth-child(2) { border-right: none; }
    .hero-stat:nth-child(1), .hero-stat:nth-child(2) { border-bottom: 1px solid var(--border); }
}

/* ── Section headers (01 / FLEET, 02 / OPPORTUNITY) ──── */
.dash-section-header {
    display: flex;
    align-items: baseline;
    gap: 0.85rem;
    margin: 2rem 0 1rem;
    flex-wrap: wrap;
}
.dash-section-meta {
    display: inline-flex;
    align-items: baseline;
    gap: 0.4rem;
}
.dash-section-num {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    font-weight: 600;
}
.dash-section-tag {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 10.5px;
    color: var(--text-muted);
    letter-spacing: 1.4px;
    text-transform: uppercase;
    font-weight: 600;
}
.dash-section-title {
    font-family: 'Instrument Serif', 'Times New Roman', serif;
    font-style: italic;
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    line-height: 1.1;
    margin: 0;
}
.dash-section-status {
    margin-left: auto;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 10.5px;
    color: var(--text-muted);
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { padding: 1rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .dash-topbar-actions .btn { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
    .dash-hero-headline { font-size: 1.5rem; }
}

/* ── Wave E.5: identity-chain multi-select dropdown (MciMultiSelect) ──
   Premium chromium feel via design tokens; mirrors .wallet-dropdown-menu. */
.mci-ms { position: relative; display: block; }
.mci-ms-trigger {
    display: flex; align-items: center; justify-content: space-between; width: 100%;
    padding: 0.45rem 0.65rem; background: var(--bg-input); color: var(--text-primary);
    border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
    font-size: 0.9rem; transition: border-color 0.15s ease;
}
.mci-ms-trigger:hover { border-color: var(--accent); }
.mci-ms-open .mci-ms-trigger { border-color: var(--border-focus); }
.mci-ms-trigger-label { color: var(--text-muted); }
.mci-ms-has-selection .mci-ms-trigger-label { color: var(--text-primary); }
.mci-ms-chevron { color: var(--text-muted); transition: transform 0.15s ease; font-size: 0.7rem; }
.mci-ms-open .mci-ms-chevron { transform: rotate(180deg); }
.mci-ms-panel {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 2000;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16); padding: 0.35rem;
    display: flex; flex-direction: column; max-height: 256px;
}
/* The author display:flex above beats the UA [hidden]{display:none}, so the
   hidden attribute alone never hid the panel (#216). Restore it explicitly. */
.mci-ms-panel[hidden] { display: none; }
.mci-ms-panel.mci-ms-flip-up { top: auto; bottom: calc(100% + 4px); }
.mci-ms-search { margin-bottom: 0.3rem; padding: 0.4rem 0.55rem; font-size: 0.85rem; }
.mci-ms-list { overflow-y: auto; flex: 1 1 auto; }
.mci-ms-row {
    display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.45rem;
    border-radius: 5px; cursor: pointer; color: var(--text-primary); font-size: 0.86rem;
    margin: 0;
}
.mci-ms-row:hover { background: var(--bg-hover); }
.mci-ms-row.is-selected { background: var(--bg-hover); }
.mci-ms-check { accent-color: var(--accent); width: 14px; height: 14px; flex: 0 0 auto; }
.mci-ms-testnet { color: var(--text-muted); }
.mci-ms-empty { padding: 0.6rem 0.45rem; color: var(--text-muted); text-align: center; font-size: 0.85rem; }
.mci-ms-footer {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 0.3rem; padding-top: 0.4rem; border-top: 1px solid var(--border);
    font-size: 0.8rem;
}
.mci-ms-count { color: var(--text-muted); }
.mci-ms-actions { display: flex; gap: 0.5rem; }
.mci-ms-clear, .mci-ms-done {
    background: none; border: none; cursor: pointer; font-size: 0.8rem;
    font-weight: 600; padding: 0.15rem 0.35rem; border-radius: 4px;
}
.mci-ms-clear { color: var(--text-muted); }
.mci-ms-clear:hover { color: var(--text-primary); }
.mci-ms-done { color: var(--accent); }
.mci-ms-done:hover { color: var(--accent-hover); }
.mci-ms-loading, .mci-ms-error { color: var(--text-muted); font-size: 0.85rem; padding: 0.45rem 0.65rem; }
