/* Aleutian Pro Dashboard — maximalist dark theme (ui_14)
 * Dark by default. Light mode is an opt-in override on :root[data-theme="light"].
 * Brand palette from AleutianWebsite, extended with ambient glass + glow tokens.
 */

/* ========================================================================
 * 1. TOKENS
 * ====================================================================== */

:root {
    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-heading: 'Montserrat', sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    /* Brand — teal spectrum */
    --brand-lightest: #2CD7C7;
    --brand-light: #20B9B4;
    --brand-default: #1D9DA0;
    --brand-dark: #16858E;
    --brand-darker: #157483;

    /* Brand — deep navy */
    --brand-deep-light: #2C4A54;
    --brand-deep-default: #104855;
    --brand-deep-dark: #0C424E;
    --brand-deep-darker: #0D2F39;
    --brand-deep-darkest: #0F1923;

    /* Semantic (solid) */
    --green-500: #22C55E;
    --green-100: #DCFCE7;
    --yellow-100: #FEF3C7;
    --yellow-500: #EAB308;
    --yellow-600: #D97706;
    --red-100: #FEE2E2;
    --red-500: #EF4444;
    --gold-500: #F5B638;

    /* Radii */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.25rem;
    --radius-full: 9999px;

    /* Motion */
    --transition: all 0.2s ease-in-out;
    --ease-glass: cubic-bezier(0.22, 1, 0.36, 1);
}

/* -------- DARK (default) -------- */
:root,
:root[data-theme="dark"] {
    color-scheme: dark;

    --bg-base: #070C14;
    --bg-gradient-a: #0F1923;
    --bg-gradient-b: #0C424E;
    --bg-gradient-c: #0D2F39;

    --surface-glass: rgba(255, 255, 255, 0.045);
    --surface-glass-strong: rgba(255, 255, 255, 0.07);
    --surface-raised: rgba(20, 32, 46, 0.72);
    --surface-chip: rgba(255, 255, 255, 0.06);
    --surface-input: rgba(10, 18, 28, 0.6);

    --border-faint: rgba(255, 255, 255, 0.06);
    --border-soft: rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.18);
    --border-teal: rgba(44, 215, 199, 0.35);

    --text-primary: #E7EEF5;
    --text-secondary: #A6B4C5;
    --text-muted: #6C7B8F;
    --text-inverse: #0F1923;

    --mono-color: #A8F0E6;

    --glow-teal: 0 0 0 1px rgba(44, 215, 199, 0.35), 0 0 24px rgba(44, 215, 199, 0.22);
    --glow-teal-soft: 0 0 16px rgba(44, 215, 199, 0.15);
    --glow-gold: 0 0 0 1px rgba(245, 182, 56, 0.35), 0 0 22px rgba(245, 182, 56, 0.18);
    --glow-danger: 0 0 0 1px rgba(239, 68, 68, 0.40), 0 0 22px rgba(239, 68, 68, 0.22);

    --shadow-glass: 0 1px 0 rgba(255, 255, 255, 0.04) inset,
                    0 20px 40px -20px rgba(0, 0, 0, 0.6),
                    0 2px 6px rgba(0, 0, 0, 0.3);

    --scrollbar-thumb: rgba(255, 255, 255, 0.12);
}

/* -------- LIGHT (opt-in) -------- */
:root[data-theme="light"] {
    color-scheme: light;

    --bg-base: #F6F8FB;
    --bg-gradient-a: #F6F8FB;
    --bg-gradient-b: #EAF2F4;
    --bg-gradient-c: #F9FAFB;

    --surface-glass: rgba(255, 255, 255, 0.92);
    --surface-glass-strong: rgba(255, 255, 255, 1);
    --surface-raised: #FFFFFF;
    --surface-chip: #F3F4F6;
    --surface-input: #FFFFFF;

    --border-faint: rgba(15, 25, 35, 0.06);
    --border-soft: rgba(15, 25, 35, 0.10);
    --border-strong: rgba(15, 25, 35, 0.16);
    --border-teal: rgba(29, 157, 160, 0.35);

    --text-primary: #0F1923;
    --text-secondary: #4B5563;
    --text-muted: #6B7280;
    --text-inverse: #FFFFFF;

    --mono-color: #157483;

    --glow-teal: 0 0 0 1px rgba(29, 157, 160, 0.35), 0 0 18px rgba(29, 157, 160, 0.18);
    --glow-teal-soft: 0 0 12px rgba(29, 157, 160, 0.12);
    --glow-gold: 0 0 0 1px rgba(245, 182, 56, 0.40), 0 0 18px rgba(245, 182, 56, 0.14);
    --glow-danger: 0 0 0 1px rgba(239, 68, 68, 0.40), 0 0 16px rgba(239, 68, 68, 0.15);

    --shadow-glass: 0 1px 3px rgba(15, 25, 35, 0.08), 0 4px 12px rgba(15, 25, 35, 0.04);

    --scrollbar-thumb: rgba(15, 25, 35, 0.15);
}

/* ========================================================================
 * 2. BASE
 * ====================================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    color: var(--text-primary);
    background-color: var(--bg-base);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    position: relative;
    overflow-x: hidden;
}

/* Ambient animated radial shader on the background — soft, not noisy.
 * Two blurred orbs drifting; disabled under prefers-reduced-motion. */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(1200px 800px at 15% -10%, var(--bg-gradient-b), transparent 60%),
        radial-gradient(900px 700px at 110% 110%, var(--bg-gradient-c), transparent 65%),
        linear-gradient(180deg, var(--bg-gradient-a) 0%, var(--bg-base) 100%);
    animation: ambient-drift 28s ease-in-out infinite alternate;
    pointer-events: none;
}
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image: radial-gradient(rgba(255,255,255,0.035) 1px, transparent 1px);
    background-size: 22px 22px;
    opacity: 0.5;
    pointer-events: none;
}
:root[data-theme="light"] body::after { opacity: 0; }

@keyframes ambient-drift {
    0%   { background-position: 0% 0%, 100% 100%, 0 0; }
    100% { background-position: 10% 5%, 90% 95%, 0 0; }
}

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    color: var(--text-primary);
    font-weight: 900;
    letter-spacing: -0.01em;
}

a {
    color: var(--brand-lightest);
    text-decoration: none;
    transition: var(--transition);
}
a:hover { color: var(--brand-light); text-decoration: underline; }

code, .mono {
    font-family: var(--font-mono);
    font-size: 0.85em;
    color: var(--mono-color);
    background: var(--surface-chip);
    padding: 0.125rem 0.4rem;
    border-radius: 5px;
    border: 1px solid var(--border-faint);
    font-variant-ligatures: none;
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 10px; }
::-webkit-scrollbar-track { background: transparent; }

/* Selection */
::selection { background: rgba(44, 215, 199, 0.30); color: var(--text-primary); }

/* ========================================================================
 * 3. LOGIN PAGE
 * ====================================================================== */

.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    position: relative;
}
.login-card {
    background: var(--surface-glass);
    backdrop-filter: blur(22px) saturate(140%);
    -webkit-backdrop-filter: blur(22px) saturate(140%);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 3rem;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-glass);
    text-align: center;
}
.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}
.brand-mark {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--brand-light) 0%, var(--brand-default) 100%);
    color: var(--text-inverse);
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--glow-teal-soft);
}
.brand-wordmark {
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 1.5rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}
.login-title { font-size: 1.35rem; margin-bottom: 0.25rem; }
.login-subtitle { color: var(--text-secondary); margin-bottom: 2rem; font-size: 0.95rem; }
.login-error {
    background: rgba(239, 68, 68, 0.12);
    color: #FCA5A5;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    text-align: left;
}
.login-notice {
    background: rgba(234, 179, 8, 0.10);
    color: #FCD34D;
    border: 1px solid rgba(234, 179, 8, 0.3);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    text-align: left;
}
.btn-sso {
    width: 100%;
    padding: 0.9rem 1rem;
    font-size: 1rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--brand-default) 0%, var(--brand-dark) 100%);
    color: var(--text-inverse);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
    transition: var(--transition);
    box-shadow: var(--glow-teal-soft);
}
.btn-sso:hover {
    transform: translateY(-1px);
    box-shadow: var(--glow-teal);
    text-decoration: none;
    color: var(--text-inverse);
}
.login-help { margin-top: 1.5rem; font-size: 0.85rem; color: var(--text-muted); }
.login-devmode {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: #FCD34D;
    background: rgba(234, 179, 8, 0.10);
    border: 1px solid rgba(234, 179, 8, 0.25);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
}
.login-footer { margin-top: 2rem; color: var(--text-muted); font-size: 0.85rem; text-align: center; }

/* ========================================================================
 * 4. DASHBOARD SHELL
 * ====================================================================== */

.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar — always dark, even in light mode (like Linear) */
.sidebar {
    width: 260px;
    background: rgba(7, 12, 20, 0.72);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border-right: 1px solid var(--border-faint);
    color: var(--text-secondary);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
:root[data-theme="light"] .sidebar { background: rgba(15, 25, 35, 0.96); }

.sidebar-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-faint);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.sidebar-header .brand-mark { width: 2rem; height: 2rem; font-size: 1rem; }
.sidebar-header .brand-wordmark { color: #FFFFFF; font-size: 1.1rem; }
.sidebar-header .brand-suffix {
    color: var(--brand-lightest);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-left: auto;
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--border-teal);
    border-radius: var(--radius-full);
    box-shadow: var(--glow-teal-soft);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    overflow-y: auto;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    border-radius: var(--radius-sm);
    color: #A6B4C5;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.125rem;
    transition: var(--transition);
    position: relative;
}
.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #FFFFFF;
    text-decoration: none;
}
.sidebar-nav a.active {
    background: linear-gradient(90deg, rgba(29, 157, 160, 0.22), rgba(29, 157, 160, 0.05));
    color: #FFFFFF;
    box-shadow: inset 2px 0 0 var(--brand-lightest);
}
.sidebar-nav a.active::after {
    content: "";
    position: absolute;
    right: 0.6rem; top: 50%;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--brand-lightest);
    box-shadow: 0 0 10px var(--brand-lightest);
    transform: translateY(-50%);
}
.sidebar-nav a svg { flex-shrink: 0; opacity: 0.9; }

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-faint);
    font-size: 0.8rem;
}
.sidebar-user-email { color: #E7EEF5; font-weight: 600; }
.sidebar-user-company { color: #6C7B8F; font-size: 0.75rem; }
.sidebar-footer a {
    display: inline-block;
    margin-top: 0.5rem;
    color: var(--brand-lightest);
    font-size: 0.8rem;
}

/* Main area */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.topbar {
    background: var(--surface-glass);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border-bottom: 1px solid var(--border-faint);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-title {
    font-family: var(--font-heading);
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
}
.topbar-badges {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8rem;
}
.badge {
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    border: 1px solid var(--border-soft);
    background: var(--surface-chip);
    color: var(--text-secondary);
}
.badge-healthy {
    background: rgba(44, 215, 199, 0.10);
    color: var(--brand-lightest);
    border-color: var(--border-teal);
    box-shadow: var(--glow-teal-soft);
}
.badge-warn {
    background: rgba(234, 179, 8, 0.10);
    color: #FCD34D;
    border-color: rgba(234, 179, 8, 0.35);
}
.badge-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #FCA5A5;
    border-color: rgba(239, 68, 68, 0.35);
}
.badge-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
    box-shadow: 0 0 8px currentColor;
}

#dashboard-content {
    padding: 1.75rem;
    flex: 1;
}
.page-header { margin-bottom: 1.5rem; }
.page-header h1 {
    font-size: 1.65rem;
    margin-bottom: 0.25rem;
    background: linear-gradient(180deg, var(--text-primary) 0%, var(--text-secondary) 150%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.page-header p { color: var(--text-secondary); font-size: 0.9rem; }

/* ========================================================================
 * 5. GLASS CARDS
 * ====================================================================== */

.card {
    position: relative;
    background: var(--surface-glass);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-glass);
    transition: border-color 0.3s var(--ease-glass), box-shadow 0.3s var(--ease-glass), transform 0.3s var(--ease-glass);
}
.card:hover {
    border-color: var(--border-strong);
}
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}
.stat-value {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 900;
    color: var(--text-primary);
    margin-top: 0.35rem;
    letter-spacing: -0.02em;
    line-height: 1.1;
}
.stat-delta { font-size: 0.8rem; margin-top: 0.35rem; color: var(--text-secondary); }
.stat-delta.up { color: var(--brand-lightest); }
.stat-delta.down { color: #FCA5A5; }

/* ========================================================================
 * 6. FILTER BAR
 * ====================================================================== */

.filter-bar {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    background: var(--surface-glass);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
}
.filter-search,
.filter-bar select.filter-control {
    padding: 0.55rem 0.8rem;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    background: var(--surface-input);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: var(--font-sans);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.filter-search { flex: 1; min-width: 220px; }
.filter-search::placeholder { color: var(--text-muted); }
.filter-search:focus,
.filter-bar select.filter-control:focus {
    outline: none;
    border-color: var(--brand-light);
    box-shadow: var(--glow-teal-soft);
}
.filter-bar select.filter-control { cursor: pointer; }
.filter-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}
.filter-count {
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* ========================================================================
 * 7. SESSION TABLE
 * ====================================================================== */

.session-table-card { padding: 0; overflow: hidden; }
.session-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.session-table thead th {
    text-align: left;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 0.8rem 1rem;
    background: var(--surface-glass-strong);
    border-bottom: 1px solid var(--border-soft);
}
.session-table th.num, .session-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.session-table tbody td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-faint);
    color: var(--text-primary);
    vertical-align: middle;
}
.session-table tbody tr:last-child td { border-bottom: none; }
.session-row { cursor: pointer; transition: background 0.15s; }
.session-row:hover td { background: var(--surface-glass-strong); }
.session-row:hover .chain-ok { text-shadow: 0 0 10px currentColor; }

/* Provider chips — colored dot + label */
.provider-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.6rem 0.2rem 0.5rem;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    font-family: var(--font-mono);
    background: var(--surface-chip);
    border: 1px solid var(--border-faint);
    color: var(--text-secondary);
}
.provider-tag::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 6px currentColor;
}
.provider-openai    { color: #10B981; }
.provider-anthropic { color: #C68B5C; }
.provider-gemini    { color: #EAB308; }
.provider-azure     { color: #3B82F6; }

.truncate { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pii-dot { color: var(--red-500); font-size: 1rem; text-shadow: 0 0 10px var(--red-500); }
.pii-none { color: var(--text-muted); }
.chain-ok {
    color: var(--brand-lightest);
    font-weight: 700;
    text-shadow: 0 0 8px rgba(44, 215, 199, 0.6);
}
.chain-bad {
    color: #FCA5A5;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}
.empty-state { text-align: center; color: var(--text-muted); padding: 3rem 1rem; }

/* Fresh-entry shimmer — subtle sweep to announce new rows (ui_11 hook) */
@keyframes fresh-shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.fresh {
    background-image: linear-gradient(90deg, transparent 0%, rgba(44, 215, 199, 0.10) 50%, transparent 100%);
    background-size: 200% 100%;
    animation: fresh-shimmer 2s ease-out 1;
}

/* ========================================================================
 * 8. SESSION DETAIL
 * ====================================================================== */

.detail-header .back-link {
    display: inline-block;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}
.detail-header h1 { font-size: 1.35rem; }
.detail-header h1 code {
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--brand-lightest);
    background: transparent;
    border: none;
    padding: 0;
    text-shadow: 0 0 10px rgba(44, 215, 199, 0.3);
}
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.25rem;
}
@media (max-width: 960px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-main { display: flex; flex-direction: column; gap: 1rem; }
.detail-side { display: flex; flex-direction: column; gap: 1rem; }

.card-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.85rem;
}

.conv { display: flex; flex-direction: column; gap: 0.5rem; }
.conv-msg {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 0.75rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border-faint);
}
.conv-msg:last-child { border-bottom: none; }
.conv-role {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding-top: 0.15rem;
}
.conv-user .conv-role { color: var(--brand-lightest); }
.conv-assistant .conv-role { color: var(--brand-light); }
.conv-body { font-size: 0.93rem; color: var(--text-primary); line-height: 1.65; }

.pii-list { list-style: none; font-size: 0.9rem; }
.pii-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-faint);
    color: var(--text-primary);
}
.pii-list li:last-child { border-bottom: none; }
.pii-cat {
    display: inline-block;
    background: rgba(239, 68, 68, 0.12);
    color: #FCA5A5;
    border: 1px solid rgba(239, 68, 68, 0.3);
    font-weight: 600;
    font-size: 0.72rem;
    padding: 0.15rem 0.55rem;
    border-radius: var(--radius-full);
    margin-right: 0.5rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.kv { display: grid; grid-template-columns: 110px 1fr; gap: 0.55rem 0.75rem; font-size: 0.85rem; }
.kv dt {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.kv dd {
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    word-break: break-all;
}
.kv dd code { background: transparent; border: none; padding: 0; font-size: inherit; color: var(--mono-color); }
.kv dd .badge { font-family: var(--font-sans); font-size: 0.72rem; }

/* ========================================================================
 * 9. VERIFICATION
 * ====================================================================== */

.verify-card {
    border: 1px solid var(--border-teal);
    box-shadow: var(--shadow-glass), var(--glow-teal-soft);
    position: relative;
    overflow: hidden;
}
.verify-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--brand-lightest), transparent);
    opacity: 0.6;
}
.verify-intro { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.85rem; }

.btn-primary {
    background: linear-gradient(135deg, var(--brand-default) 0%, var(--brand-dark) 100%);
    color: var(--text-inverse);
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.65rem 1.3rem;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--glow-teal-soft);
    letter-spacing: 0.01em;
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--glow-teal);
}
.btn-primary:active { transform: translateY(0); }

.htmx-indicator { display: none; margin-left: 0.5rem; color: var(--text-muted); font-size: 0.85rem; }
.htmx-request .htmx-indicator { display: inline; }

.verify-success, .verify-failure {
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 0.85rem;
    animation: verify-pulse 1.8s var(--ease-glass) 1;
}
.verify-success {
    background: rgba(44, 215, 199, 0.10);
    color: var(--brand-lightest);
    border: 1px solid var(--border-teal);
    box-shadow: var(--glow-teal);
}
.verify-failure {
    background: rgba(239, 68, 68, 0.12);
    color: #FCA5A5;
    border: 1px solid rgba(239, 68, 68, 0.35);
    box-shadow: var(--glow-danger);
}
.verify-badge { font-size: 1.65rem; font-weight: 900; }
.verify-title { font-weight: 700; font-size: 0.95rem; }
.verify-subtitle {
    font-size: 0.78rem;
    opacity: 0.85;
    margin-top: 0.15rem;
    font-family: var(--font-mono);
}

@keyframes verify-pulse {
    0%   { box-shadow: 0 0 0 1px var(--border-teal), 0 0 0 rgba(44, 215, 199, 0); }
    50%  { box-shadow: 0 0 0 1px var(--border-teal), 0 0 40px rgba(44, 215, 199, 0.45); }
    100% { box-shadow: var(--glow-teal); }
}

.verify-howto { margin-top: 1rem; font-size: 0.85rem; color: var(--text-secondary); }
.verify-howto summary { cursor: pointer; color: var(--brand-lightest); font-weight: 600; }
.verify-howto pre {
    background: var(--bg-base);
    color: var(--brand-lightest);
    padding: 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-faint);
    overflow-x: auto;
    font-size: 0.8rem;
    margin: 0.5rem 0;
    font-family: var(--font-mono);
}
.download-link {
    display: inline-block;
    margin-right: 0.5rem;
    margin-top: 0.35rem;
    padding: 0.3rem 0.65rem;
    font-size: 0.78rem;
    font-family: var(--font-mono);
    background: var(--surface-chip);
    border: 1px solid var(--border-faint);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    transition: var(--transition);
}
.download-link:hover {
    border-color: var(--border-teal);
    color: var(--brand-lightest);
    text-decoration: none;
}

/* ========================================================================
 * 10. RESPONSIVE
 * ====================================================================== */

@media (max-width: 768px) {
    .sidebar {
        position: fixed; left: -260px; top: 0; bottom: 0;
        height: 100vh;
        z-index: 100;
        transition: left 0.2s var(--ease-glass);
    }
    .sidebar.open { left: 0; }
    .topbar { padding-left: 3.5rem; }
    .hamburger {
        position: fixed; top: 0.75rem; left: 0.75rem; z-index: 101;
        background: var(--surface-glass);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border: 1px solid var(--border-soft);
        border-radius: var(--radius-sm);
        padding: 0.5rem;
        color: var(--text-primary);
        cursor: pointer;
    }
}
@media (min-width: 769px) { .hamburger { display: none; } }

/* ========================================================================
 * 11. MOTION PREFERENCES
 * ====================================================================== */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
    body::before { animation: none !important; }
}

/* ========================================================================
 * 12. VERIFY HERO (ui_18)
 * ====================================================================== */

.verify-hero {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1.5rem;
    align-items: center;
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.5rem;
    background: var(--surface-glass);
    backdrop-filter: blur(22px) saturate(150%);
    -webkit-backdrop-filter: blur(22px) saturate(150%);
    border: 1px solid var(--border-teal);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glass), var(--glow-teal-soft);
    overflow: hidden;
}
.verify-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(600px 200px at 0% 0%, rgba(44, 215, 199, 0.18), transparent 60%),
        radial-gradient(400px 200px at 100% 100%, rgba(29, 157, 160, 0.12), transparent 60%);
    pointer-events: none;
    z-index: 0;
}
.verify-hero::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--brand-lightest), transparent);
    opacity: 0.6;
}
.verify-hero-main { position: relative; z-index: 1; min-width: 0; }
.verify-hero-action { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; }

.verify-hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--brand-lightest);
    padding: 0.3rem 0.7rem;
    background: rgba(44, 215, 199, 0.08);
    border: 1px solid var(--border-teal);
    border-radius: var(--radius-full);
    margin-bottom: 0.75rem;
    text-shadow: 0 0 12px rgba(44, 215, 199, 0.4);
}
.verify-hero-eyebrow-fail {
    color: #FCA5A5;
    background: rgba(239, 68, 68, 0.10);
    border-color: rgba(239, 68, 68, 0.35);
    text-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
}
.verify-hero-badge {
    font-size: 1rem;
    line-height: 1;
    font-weight: 900;
}

.verify-hero-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    line-height: 1.25;
    margin: 0 0 0.35rem 0;
    background: linear-gradient(180deg, var(--text-primary) 0%, var(--text-secondary) 160%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.verify-hero-title code {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    color: var(--brand-lightest);
    background: transparent;
    border: none;
    padding: 0;
    -webkit-text-fill-color: var(--brand-lightest);
    text-shadow: 0 0 12px rgba(44, 215, 199, 0.3);
}
.verify-hero-sub {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}
.verify-hero-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}
.verify-hero-hint kbd {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 0.1rem 0.35rem;
    background: var(--surface-chip);
    border: 1px solid var(--border-soft);
    border-bottom-width: 2px;
    border-radius: 4px;
    color: var(--text-primary);
}
.verify-hero-spinner {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--brand-lightest);
    letter-spacing: 0.08em;
}

/* Success / failure tinting of the hero container */
.verify-hero-success {
    animation: verify-pulse 1.8s var(--ease-glass) 1;
}
.verify-hero-failure {
    border-color: rgba(239, 68, 68, 0.45);
    box-shadow: var(--shadow-glass), var(--glow-danger);
}
.verify-hero-failure::before {
    background:
        radial-gradient(600px 200px at 0% 0%, rgba(239, 68, 68, 0.18), transparent 60%),
        radial-gradient(400px 200px at 100% 100%, rgba(239, 68, 68, 0.10), transparent 60%);
}
.verify-hero-failure::after {
    background: linear-gradient(90deg, transparent, #FCA5A5, transparent);
}

@media (max-width: 720px) {
    .verify-hero { grid-template-columns: 1fr; }
    .verify-hero-action { align-items: flex-start; }
    .verify-hero-title { font-size: 1.2rem; }
}

/* ========================================================================
 * 13. COMMAND PALETTE (ui_13)
 * ====================================================================== */

.palette-root {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 12vh;
}
.palette-root.open { display: flex; animation: palette-fade 0.15s var(--ease-glass) 1; }
@keyframes palette-fade { from { opacity: 0; } to { opacity: 1; } }

.palette-scrim {
    position: absolute;
    inset: 0;
    background: rgba(3, 7, 14, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.palette-modal {
    position: relative;
    width: min(640px, 92vw);
    max-height: 60vh;
    background: var(--surface-glass);
    backdrop-filter: blur(28px) saturate(160%);
    -webkit-backdrop-filter: blur(28px) saturate(160%);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.6),
                0 0 0 1px var(--border-teal),
                0 0 40px rgba(44, 215, 199, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: palette-slide 0.18s var(--ease-glass) 1;
}
:root[data-theme="light"] .palette-modal {
    background: rgba(255, 255, 255, 0.98);
}
@keyframes palette-slide {
    from { opacity: 0; transform: translateY(-12px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.palette-input-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border-faint);
}
.palette-kbd {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--brand-lightest);
    background: rgba(44, 215, 199, 0.10);
    border: 1px solid var(--border-teal);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    letter-spacing: 0.05em;
}
.palette-input {
    flex: 1;
    font-size: 1rem;
    font-family: var(--font-sans);
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
}
.palette-input::placeholder { color: var(--text-muted); }
.palette-close {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    background: var(--surface-chip);
    border: 1px solid var(--border-soft);
    border-bottom-width: 2px;
    border-radius: 4px;
    padding: 0.2rem 0.45rem;
    cursor: pointer;
}

.palette-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.4rem;
}
.palette-group {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0.75rem 0.85rem 0.35rem;
}
.palette-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 0.5rem 1rem;
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.1s;
}
.palette-row:hover { background: var(--surface-glass-strong); }
.palette-row.active {
    background: rgba(44, 215, 199, 0.10);
    box-shadow: inset 2px 0 0 var(--brand-lightest);
}
.palette-row.active .palette-row-enter { opacity: 1; color: var(--brand-lightest); }
.palette-row-label {
    font-size: 0.93rem;
    color: var(--text-primary);
    font-weight: 500;
    grid-column: 1;
}
.palette-row-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    grid-column: 1;
}
.palette-row-enter {
    grid-row: 1 / span 2;
    grid-column: 2;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-muted);
    opacity: 0.4;
}
.palette-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.palette-footer {
    display: flex;
    gap: 1.25rem;
    padding: 0.6rem 1rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    border-top: 1px solid var(--border-faint);
    background: var(--surface-glass);
}
.palette-footer kbd {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    padding: 0.05rem 0.32rem;
    background: var(--surface-chip);
    border: 1px solid var(--border-soft);
    border-bottom-width: 2px;
    border-radius: 3px;
    color: var(--text-secondary);
    margin-right: 0.2rem;
}

/* Toast */
.palette-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translate(-50%, 2rem);
    padding: 0.65rem 1rem;
    background: var(--surface-glass);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border: 1px solid var(--border-teal);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: var(--font-mono);
    box-shadow: var(--glow-teal-soft);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s var(--ease-glass), transform 0.2s var(--ease-glass);
    z-index: 1100;
}
.palette-toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ========================================================================
 * 14. LIVE FEED (ui_11)
 * ====================================================================== */

.live-feed {
    margin-bottom: 1.5rem;
    padding: 1rem 1.1rem;
    position: relative;
}
.live-feed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--border-faint);
    flex-wrap: wrap;
    gap: 0.5rem;
}
.live-feed-title {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--brand-lightest);
}
.live-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--brand-lightest);
    box-shadow: 0 0 10px var(--brand-lightest);
    animation: live-pulse 1.5s ease-in-out infinite;
}
@keyframes live-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.55; transform: scale(1.3); }
}
.live-feed-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
}
.live-feed-meta code {
    font-size: 0.7rem;
    padding: 0.08rem 0.35rem;
}

.live-feed-rows {
    display: flex;
    flex-direction: column;
    gap: 0;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    max-height: 420px;
    overflow-y: auto;
    margin-right: -0.4rem;
    padding-right: 0.4rem;
}
.live-feed-empty {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 0.75rem 0.25rem;
    display: block;
}
.live-feed-rows:not(:empty) + .live-feed-empty { display: none; }

.feed-row {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 0.75rem;
    padding: 0.5rem 0.25rem;
    border-bottom: 1px dashed var(--border-faint);
    color: var(--text-primary);
    align-items: center;
}
.feed-row:last-child { border-bottom: none; }

.feed-time {
    color: var(--text-muted);
    font-size: 0.72rem;
    letter-spacing: 0.05em;
}
.feed-body {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.55rem;
    min-width: 0;
}
.feed-arrow {
    color: var(--text-muted);
    font-size: 0.85rem;
}
.feed-mono {
    color: var(--mono-color);
    font-family: var(--font-mono);
    font-size: 0.82rem;
}
.feed-user {
    color: var(--text-secondary);
    font-size: 0.8rem;
}
.feed-chain {
    color: var(--brand-lightest);
    font-weight: 600;
    text-shadow: 0 0 8px rgba(44, 215, 199, 0.35);
}
.feed-lat {
    color: var(--text-muted);
    font-size: 0.76rem;
}
.feed-sub {
    color: var(--text-muted);
    font-size: 0.76rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.feed-label {
    color: var(--text-primary);
    font-size: 0.85rem;
}

.feed-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.12rem 0.5rem;
    border-radius: var(--radius-full);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border: 1px solid var(--border-soft);
    background: var(--surface-chip);
    color: var(--text-secondary);
}
.feed-badge-signed, .feed-badge-verify {
    color: var(--brand-lightest);
    background: rgba(44, 215, 199, 0.10);
    border-color: var(--border-teal);
    box-shadow: 0 0 10px rgba(44, 215, 199, 0.15);
}
.feed-badge-pii {
    color: #FCA5A5;
    background: rgba(239, 68, 68, 0.10);
    border-color: rgba(239, 68, 68, 0.35);
}
.feed-badge-anchor {
    color: #FCD34D;
    background: rgba(245, 182, 56, 0.10);
    border-color: rgba(245, 182, 56, 0.35);
}

/* Fade-in on insert — subtle slide-down + teal sweep.
 * Disabled under prefers-reduced-motion (inherits global rule). */
@keyframes feed-enter {
    0%   { opacity: 0; transform: translateY(-8px); background: rgba(44, 215, 199, 0.12); }
    60%  { opacity: 1; transform: translateY(0);     background: rgba(44, 215, 199, 0.06); }
    100% { opacity: 1; transform: translateY(0);     background: transparent; }
}
.feed-row.feed-enter { animation: feed-enter 1.1s var(--ease-glass) 1; }
.feed-row.feed-enter .feed-chain { text-shadow: 0 0 14px var(--brand-lightest); }

/* ========================================================================
 * 15. CHAIN GRAPH (ui_16)
 * ====================================================================== */

.chain-graph {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
}
.chain-node {
    display: grid;
    grid-template-columns: 32px 1fr;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.55rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-faint);
    background: var(--surface-chip);
    transition: border-color 0.2s, box-shadow 0.2s;
    cursor: default;
}
.chain-node-bullet {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-soft);
    color: var(--text-muted);
}
.chain-node-main { min-width: 0; }
.chain-node-pos {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}
.chain-node-hash {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    word-break: break-all;
}

.chain-node-ok .chain-node-bullet {
    color: var(--brand-lightest);
    border-color: var(--border-teal);
    background: rgba(44, 215, 199, 0.10);
}
.chain-node-bad .chain-node-bullet {
    color: #FCA5A5;
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.10);
}

.chain-node-current {
    border-color: var(--border-teal);
    box-shadow: var(--glow-teal-soft);
    background: rgba(44, 215, 199, 0.08);
}
.chain-node-current .chain-node-bullet {
    box-shadow: 0 0 14px rgba(44, 215, 199, 0.6);
}
.chain-node-current .chain-node-pos { color: var(--brand-lightest); }

.chain-node-anchor {
    border-color: rgba(245, 182, 56, 0.35);
    background: rgba(245, 182, 56, 0.06);
}
.chain-node-anchor .chain-node-bullet {
    color: var(--gold-500);
    border-color: rgba(245, 182, 56, 0.45);
    background: rgba(245, 182, 56, 0.08);
    box-shadow: 0 0 10px rgba(245, 182, 56, 0.3);
}
.chain-node-anchor .chain-node-pos { color: var(--gold-500); }

.chain-link {
    display: flex;
    justify-content: flex-start;
    padding-left: 8px;
    height: 20px;
    color: var(--border-strong);
    opacity: 0.6;
}

/* Compact one-line variant for feed rows */
.chain-compact {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
}
.chain-compact-node {
    padding: 0.08rem 0.4rem;
    border-radius: var(--radius-sm);
    background: var(--surface-chip);
    border: 1px solid var(--border-faint);
    color: var(--text-secondary);
}
.chain-compact-node.is-current {
    color: var(--brand-lightest);
    border-color: var(--border-teal);
    box-shadow: 0 0 6px rgba(44, 215, 199, 0.3);
}
.chain-compact-sep { color: var(--text-muted); opacity: 0.6; }
.chain-compact-anchor {
    padding: 0.08rem 0.4rem;
    border-radius: var(--radius-sm);
    background: rgba(245, 182, 56, 0.10);
    border: 1px solid rgba(245, 182, 56, 0.35);
    color: var(--gold-500);
}

/* ========================================================================
 * 16. PROOF ARTIFACT PAGE (ui_15)
 * ====================================================================== */

.proof-page { padding: 2rem 1rem 4rem; }
.proof-shell {
    max-width: 1080px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.proof-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.25rem 0.75rem;
    border-bottom: 1px solid var(--border-faint);
    flex-wrap: wrap;
    gap: 1rem;
}
.proof-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.proof-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    color: var(--brand-lightest);
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(44, 215, 199, 0.35);
}
.proof-entry-id { color: var(--text-secondary); font-size: 0.9rem; }
.proof-entry-id code {
    font-size: 0.9rem;
    color: var(--brand-lightest);
    background: transparent;
    border: none;
    padding: 0;
    text-shadow: 0 0 10px rgba(44, 215, 199, 0.3);
}

.proof-hero {
    text-align: center;
    padding: 2.5rem 1.5rem;
    position: relative;
    overflow: hidden;
}
.proof-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(600px 400px at 50% 0%, rgba(44, 215, 199, 0.18), transparent 60%);
    pointer-events: none;
}
.proof-seal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 128px; height: 128px;
    margin-bottom: 1.25rem;
    border-radius: 50%;
    position: relative;
    animation: proof-seal-pulse 2.2s ease-in-out infinite;
}
.proof-seal-ok {
    color: var(--brand-lightest);
    background: radial-gradient(circle, rgba(44, 215, 199, 0.22) 0%, rgba(44, 215, 199, 0.04) 70%);
    box-shadow: 0 0 0 1px var(--border-teal), 0 0 60px rgba(44, 215, 199, 0.35);
}
.proof-seal-bad {
    color: #FCA5A5;
    background: radial-gradient(circle, rgba(239, 68, 68, 0.22) 0%, rgba(239, 68, 68, 0.04) 70%);
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.4), 0 0 60px rgba(239, 68, 68, 0.35);
}
@keyframes proof-seal-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.04); }
}
.proof-title {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
    background: linear-gradient(180deg, var(--text-primary) 0%, var(--text-secondary) 150%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    position: relative;
}
.proof-sub {
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    position: relative;
}

.proof-grid {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 1.25rem;
}
@media (max-width: 860px) { .proof-grid { grid-template-columns: 1fr; } }

.proof-kv dt { text-transform: uppercase; font-size: 0.72rem; letter-spacing: 0.1em; }
.proof-kv dd { font-size: 0.8rem; }
.proof-hash {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    word-break: break-all;
    color: var(--mono-color);
    display: inline-block;
    max-width: 100%;
}

.proof-downloads {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border-faint);
}
.proof-actions { margin-top: 1rem; display: flex; gap: 0.75rem; }

.proof-sdk-intro {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}
.proof-sdk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.85rem;
}
.proof-sdk-card {
    border: 1px solid var(--border-faint);
    border-radius: var(--radius-md);
    background: var(--bg-base);
    overflow: hidden;
}
.proof-sdk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-faint);
    background: var(--surface-glass-strong);
}
.proof-sdk-lang {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--brand-lightest);
}
.proof-copy-btn {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border-soft);
    border-radius: 4px;
    padding: 0.15rem 0.5rem;
    cursor: pointer;
    transition: var(--transition);
}
.proof-copy-btn:hover { color: var(--brand-lightest); border-color: var(--border-teal); }
.proof-copy-btn.is-copied { color: var(--brand-lightest); border-color: var(--border-teal); }
.proof-sdk-card pre {
    margin: 0;
    padding: 0.9rem;
    font-family: var(--font-mono);
    font-size: 0.76rem;
    color: var(--text-primary);
    overflow-x: auto;
    line-height: 1.55;
}
.proof-sdk-card pre code { background: transparent; border: none; padding: 0; font-size: inherit; color: inherit; }

.proof-pubkey-pem {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    padding: 0.85rem;
    background: var(--bg-base);
    border: 1px solid var(--border-faint);
    border-radius: var(--radius-sm);
    color: var(--brand-lightest);
    white-space: pre-wrap;
    word-break: break-all;
    margin-top: 0.5rem;
}

.proof-footer {
    padding-top: 1rem;
    margin-top: 0.5rem;
    border-top: 1px solid var(--border-faint);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.proof-footer-brand {
    margin-top: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
}

/* ============================================================
   17 — Sparkline watermarks (ui_17)
   Low-opacity SVG polyline sitting behind stat-card values.
   Opacity ramps up on hover for gentle reveal. Motion reduced
   when the user prefers that.
   ============================================================ */

.stat-card {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.spark-bg {
    position: absolute;
    inset: auto 0 0 0;
    height: 60%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.22;
    transition: opacity 260ms ease;
}

.stat-card:hover .spark-bg {
    opacity: 0.42;
}

.stat-card .spark-bg .spark {
    width: 100%;
    height: 100%;
    display: block;
}

.stat-card .stat-label,
.stat-card .stat-value,
.stat-card .stat-delta {
    position: relative;
    z-index: 1;
}

.spark-bg .spark {
    animation: spark-draw 900ms ease-out 1;
}

@keyframes spark-draw {
    from { transform: translateY(8px); opacity: 0; }
    to   { transform: translateY(0);   opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .spark-bg .spark { animation: none; }
    .stat-card:hover .spark-bg { opacity: 0.3; }
}

/* ============================================================
   18 — Split-pane sessions (ui_12)
   Left: scrollable list of session rows. Right: peek pane
   reusing the session_detail partial. Mobile collapses to a
   single stacked list (peek below).
   ============================================================ */

.sessions-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.sessions-kbd-hint {
    color: var(--text-secondary);
    font-size: 0.82rem;
    letter-spacing: 0.02em;
}
.sessions-kbd-hint kbd {
    background: var(--surface-3, rgba(255,255,255,0.08));
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.12));
    border-radius: 0.35rem;
    padding: 0.1rem 0.4rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-primary);
    margin: 0 0.1rem;
}

.sessions-split {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 1rem;
    align-items: start;
    margin-top: 1rem;
}

.sessions-list-pane,
.sessions-peek-pane {
    min-width: 0;
}

.session-list-card {
    padding: 0;
    overflow: hidden;
}

.session-rows {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: calc(100vh - 16rem);
    overflow-y: auto;
}
.session-rows:focus { outline: none; }

.session-row-item {
    display: grid;
    grid-template-rows: auto auto auto;
    gap: 0.25rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.08));
    cursor: pointer;
    transition: background 140ms ease, box-shadow 140ms ease;
    position: relative;
}
.session-row-item:hover {
    background: color-mix(in srgb, var(--accent-teal, #5BE0C9) 6%, transparent);
}
.session-row-item.is-active {
    background: color-mix(in srgb, var(--accent-teal, #5BE0C9) 12%, transparent);
    box-shadow: inset 3px 0 0 var(--accent-teal, #5BE0C9);
}
.session-row-item .row-top {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.85rem;
}
.session-row-item .row-model {
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.8rem;
}
.session-row-item .row-time {
    margin-left: auto;
    color: var(--text-tertiary, var(--text-secondary));
    font-size: 0.78rem;
}
.session-row-item .row-mid {
    display: flex; justify-content: space-between;
    color: var(--text-secondary);
    font-size: 0.82rem;
}
.session-row-item .row-bot {
    display: flex; align-items: center; gap: 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--text-tertiary, var(--text-secondary));
}
.session-row-item .row-pii {
    background: rgba(242, 107, 107, 0.15);
    color: #F26B6B;
    padding: 0.05rem 0.4rem;
    border-radius: 0.3rem;
    font-weight: 600;
    letter-spacing: 0.06em;
}

.sessions-peek-pane {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}
.session-peek-body {
    min-height: 20rem;
}
.session-peek-body .page-header {
    padding-bottom: 0.5rem;
}
.session-peek-body .detail-grid {
    grid-template-columns: 1fr; /* stack inside peek */
}

.peek-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-secondary);
}
.peek-empty-mark {
    font-size: 2.5rem;
    opacity: 0.4;
    margin-bottom: 0.5rem;
}
.peek-empty h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}
.peek-empty kbd {
    background: var(--surface-3, rgba(255,255,255,0.08));
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.12));
    border-radius: 0.3rem;
    padding: 0.05rem 0.35rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-primary);
}

@media (max-width: 900px) {
    .sessions-split {
        grid-template-columns: 1fr;
    }
    .sessions-peek-pane {
        position: static;
        max-height: none;
    }
    .session-rows {
        max-height: none;
    }
}

/* ============================================================
   19 — Usage analytics (ui_4)
   Inline SVG charts + cost table. No external charting library.
   ============================================================ */

.usage-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.period-selector {
    display: inline-flex;
    background: var(--surface-2, rgba(255,255,255,0.05));
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.1));
    border-radius: 0.6rem;
    padding: 0.2rem;
    gap: 0.2rem;
}
.period-btn {
    padding: 0.4rem 0.85rem;
    border-radius: 0.45rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 140ms ease;
}
.period-btn:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.05);
}
.period-btn.is-active {
    background: color-mix(in srgb, var(--accent-teal, #5BE0C9) 18%, transparent);
    color: var(--text-primary);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-teal, #5BE0C9) 40%, transparent);
}

.card-title-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}
.card-sub {
    color: var(--text-tertiary, var(--text-secondary));
    font-size: 0.82rem;
    letter-spacing: 0.02em;
}

.usage-volume-card .chart-frame {
    width: 100%;
    min-height: 260px;
}
.chart-frame {
    width: 100%;
    overflow-x: auto;
}
.chart-frame .chart {
    width: 100%;
    height: auto;
    display: block;
}
.chart-frame-donut {
    display: flex;
    justify-content: center;
}

.chart-grid {
    stroke: var(--border-subtle, rgba(255,255,255,0.08));
    stroke-dasharray: 2 4;
}
.chart-axis {
    fill: var(--text-tertiary, var(--text-secondary));
    font-family: var(--font-mono);
    font-size: 10px;
}
.chart-legend {
    fill: var(--text-secondary);
    font-size: 11px;
}
.chart-line {
    filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent-teal, #5BE0C9) 20%, transparent));
}
.chart-center {
    fill: var(--text-primary);
    font-size: 22px;
    font-weight: 700;
    font-family: var(--font-mono);
}
.chart-center-sub {
    fill: var(--text-tertiary, var(--text-secondary));
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.chart-barlabel {
    fill: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 12px;
}
.chart-barvalue {
    fill: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 11px;
}
.chart-bar-track {
    fill: var(--surface-2, rgba(255,255,255,0.05));
}

.usage-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
    margin: 1rem 0;
}
@media (max-width: 1200px) {
    .usage-grid { grid-template-columns: 1fr; }
}

.usage-cost-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.usage-cost-table th,
.usage-cost-table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.08));
    text-align: left;
}
.usage-cost-table th {
    color: var(--text-tertiary, var(--text-secondary));
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 0.72rem;
}
.usage-cost-table td.num,
.usage-cost-table th.num { text-align: right; font-family: var(--font-mono); }
.usage-total-row td {
    background: color-mix(in srgb, var(--accent-teal, #5BE0C9) 6%, transparent);
}
.usage-disclaimer {
    color: var(--text-tertiary, var(--text-secondary));
    font-size: 0.8rem;
    margin-top: 0.75rem;
}

/* ============================================================
   20 — PII alerts (ui_5) / Compliance (ui_6) / API keys (ui_7) /
        Settings (ui_8)
   Shared chips, drawers, tabs.
   ============================================================ */

/* PII */
.pii-cat-chip {
    display: inline-block;
    padding: 0.08rem 0.5rem;
    margin-right: 0.3rem;
    margin-top: 0.25rem;
    border-radius: 0.3rem;
    background: rgba(255,255,255,0.06);
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-family: var(--font-mono);
}
.pii-cat-tag {
    display: inline-block;
    padding: 0.05rem 0.4rem;
    margin-right: 0.2rem;
    border-radius: 0.3rem;
    background: rgba(242, 107, 107, 0.15);
    color: #F26B6B;
    font-size: 0.7rem;
    font-family: var(--font-mono);
    font-weight: 600;
}
.pii-action { font-weight: 600; font-size: 0.8rem; }
.pii-action.pii-blocked { color: #F26B6B; }
.pii-action.pii-flagged { color: #F2C36B; }
.pii-context { max-width: 24rem; color: var(--text-secondary); font-size: 0.82rem; }

/* Compliance */
.compliance-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.framework-tag {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 0.3rem;
    background: color-mix(in srgb, var(--accent-teal, #5BE0C9) 10%, transparent);
    color: var(--accent-teal, #5BE0C9);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}
.report-status { font-size: 0.82rem; font-weight: 500; }
.report-ready { color: #6BE38C; }
.report-error { color: #F26B6B; }
.report-generating { color: #F2C36B; display: inline-flex; align-items: center; gap: 0.35rem; }
.spinner-mini {
    width: 10px; height: 10px;
    border: 2px solid rgba(242, 195, 107, 0.35);
    border-top-color: #F2C36B;
    border-radius: 50%;
    display: inline-block;
    animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.report-actions { display: flex; gap: 0.5rem; }
.report-drawer {
    margin-top: 0.75rem;
    max-height: 0;
    overflow: hidden;
    padding: 0 1rem;
    opacity: 0;
    transition: all 260ms ease;
}
.report-drawer.open {
    max-height: 30rem;
    padding: 1rem;
    opacity: 1;
    margin-bottom: 1rem;
}
.report-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 1rem;
    align-items: end;
}
.report-form label { display: grid; gap: 0.35rem; font-size: 0.82rem; color: var(--text-secondary); }
.report-form select, .report-form input[type="text"], .report-form input[type="email"], .report-form input[type="number"] {
    background: var(--surface-2, rgba(255,255,255,0.05));
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.12));
    color: var(--text-primary);
    border-radius: 0.45rem;
    padding: 0.5rem 0.6rem;
    font-size: 0.9rem;
}
.form-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.form-hint { color: var(--text-tertiary, var(--text-secondary)); font-size: 0.8rem; }

.compliance-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 1rem;
    margin: 0.75rem 0;
}
.preview-tile {
    background: var(--surface-2, rgba(255,255,255,0.05));
    border-radius: 0.6rem;
    padding: 0.9rem 1rem;
}
.preview-tile-label { font-size: 0.72rem; color: var(--text-tertiary, var(--text-secondary)); letter-spacing: 0.08em; text-transform: uppercase; }
.preview-tile-value { font-size: 1.5rem; font-weight: 700; margin-top: 0.3rem; font-family: var(--font-mono); }
.preview-tile-sub { font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.2rem; }
.compliance-preview-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; flex-wrap: wrap; }
.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.2));
    color: var(--text-primary);
    padding: 0.5rem 0.95rem;
    border-radius: 0.5rem;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.9rem;
}

/* API keys */
.apikeys-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.apikey-summary { display: flex; gap: 0.5rem; margin: 0.5rem 0 1rem; }
.badge-revoked { background: rgba(242, 107, 107, 0.15); color: #F26B6B; }
.scope-tag {
    display: inline-block;
    padding: 0.08rem 0.45rem;
    border-radius: 0.3rem;
    font-size: 0.72rem;
    font-family: var(--font-mono);
    background: rgba(255,255,255,0.06);
    color: var(--text-secondary);
}
.scope-tag.scope-full { background: color-mix(in srgb, var(--accent-teal, #5BE0C9) 14%, transparent); color: var(--accent-teal, #5BE0C9); }
.apikey-status { font-size: 0.82rem; font-weight: 600; }
.apikey-status.active  { color: #6BE38C; }
.apikey-status.expired { color: var(--text-tertiary, var(--text-secondary)); }
.apikey-status.revoked { color: #F26B6B; }
.row-sub { color: var(--text-tertiary, var(--text-secondary)); font-size: 0.72rem; }
.row-icon-btn {
    background: transparent;
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.12));
    color: var(--text-secondary);
    border-radius: 0.4rem;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    margin-right: 0.3rem;
    font-size: 0.9rem;
}
.row-icon-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.06); }
.row-icon-btn.row-danger:hover { color: #F26B6B; border-color: rgba(242, 107, 107, 0.4); }
.apikey-row.apikey-Revoked { opacity: 0.55; }

/* Settings */
.settings-tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.1));
    margin-bottom: 1rem;
    overflow-x: auto;
}
.settings-tab {
    padding: 0.65rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.92rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 140ms ease;
    white-space: nowrap;
}
.settings-tab:hover { color: var(--text-primary); }
.settings-tab.is-active {
    color: var(--text-primary);
    border-bottom-color: var(--accent-teal, #5BE0C9);
}
.settings-panel { padding: 1.25rem 1.5rem; }
.settings-intro { color: var(--text-secondary); font-size: 0.88rem; margin-bottom: 1rem; }
.settings-field {
    display: grid;
    gap: 0.4rem;
    margin-bottom: 1.25rem;
}
.settings-field.settings-check {
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0.5rem;
}
.settings-label { color: var(--text-tertiary, var(--text-secondary)); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; }
.settings-sub { color: var(--text-secondary); font-size: 0.85rem; }
.settings-hint { color: var(--text-tertiary, var(--text-secondary)); font-size: 0.82rem; margin-top: 0.75rem; }
.settings-input {
    background: var(--surface-2, rgba(255,255,255,0.05));
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.12));
    border-radius: 0.45rem;
    padding: 0.5rem 0.6rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    width: 100%;
    max-width: 32rem;
}
.settings-mono { font-family: var(--font-mono); font-size: 0.82rem; }
.settings-num { width: 6rem; }

.retention-pills { display: inline-flex; gap: 0.3rem; flex-wrap: wrap; }
.retention-pill {
    padding: 0.3rem 0.75rem;
    border-radius: 0.5rem;
    background: var(--surface-2, rgba(255,255,255,0.05));
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-family: var(--font-mono);
    border: 1px solid transparent;
}
.retention-pill.is-active {
    background: color-mix(in srgb, var(--accent-teal, #5BE0C9) 14%, transparent);
    color: var(--text-primary);
    border-color: color-mix(in srgb, var(--accent-teal, #5BE0C9) 40%, transparent);
}

.email-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.email-chip {
    padding: 0.2rem 0.55rem;
    border-radius: 0.4rem;
    background: var(--surface-2, rgba(255,255,255,0.05));
    color: var(--text-primary);
    font-size: 0.82rem;
}

.pii-toggles { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pii-toggle {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    border-radius: 0.45rem;
    background: var(--surface-2, rgba(255,255,255,0.05));
    color: var(--text-secondary);
    font-size: 0.82rem;
    cursor: default;
}
.pii-toggle.on { color: var(--text-primary); background: color-mix(in srgb, var(--accent-teal, #5BE0C9) 10%, transparent); }
.pii-toggle input { accent-color: var(--accent-teal, #5BE0C9); }
.regex-list { margin: 0; padding-left: 1rem; color: var(--text-secondary); font-size: 0.88rem; }

/* ============================================================================
 * Pipeline Flow (ticket dashboard_flow_02)
 * Visual contract: docs/designs/flow_dashboard_mockup.html
 * Tokens marked NEW are the only additions to the global token table.
 * ============================================================================ */

:root {
    /* NEW: Pipeline Flow state palette (rule A.4 / A.5)
     * Each state pairs a color with a unique glyph; the renderer
     * uses the glyph as content (not background-image) so meaning
     * survives monochrome / printout / screen-reader fallback. */
    --state-nominal:  var(--brand-lightest);   /* ● teal */
    --state-elevated: var(--brand-deep-light); /* ◆ slate */
    --state-degraded: var(--gold-500);         /* ▲ gold */
    --state-down:     #7C2D92;                 /* ■ purple (NEW) */
    --glow-nominal:   rgba(44, 215, 199, 0.18);
    --glow-elevated:  rgba(44, 74, 84, 0.45);
    --glow-degraded:  rgba(245, 182, 56, 0.22);
    --glow-down:      rgba(124, 45, 146, 0.30);
}

.flow-page { display: flex; flex-direction: column; gap: 1.25rem; }

.flow-page .page-header {
    display: flex; justify-content: space-between; align-items: baseline;
}
.flow-page .page-header h1 { font-size: 1.75rem; }
.flow-page .tenant-tag {
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 0.85rem; color: var(--brand-lightest);
    background: rgba(44, 215, 199, 0.08);
    padding: 0.25rem 0.6rem; border-radius: var(--radius-sm, 0.5rem);
    border: 1px solid rgba(44, 215, 199, 0.18);
    margin-left: 0.5rem;
}

/* C.1 stale-data indicator */
.flow-page .last-update {
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 0.8rem; color: rgba(230, 242, 242, 0.55);
    transition: color 0.2s ease, background 0.2s ease;
    padding: 0.25rem 0.5rem; border-radius: var(--radius-sm, 0.5rem);
}
.flow-page .last-update.is-stale {
    color: var(--gold-500); background: rgba(245, 182, 56, 0.08);
    animation: flow-stale-pulse 1.6s ease-in-out infinite;
}
@keyframes flow-stale-pulse {
    0%, 100% { opacity: 0.7; }
    50%      { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .flow-page .last-update.is-stale { animation: none; }
}

/* C.3 first-time-user banner */
.first-time-banner {
    display: flex; flex-direction: column; gap: 0.85rem;
    padding: 1.5rem 1.75rem;
    background:
        linear-gradient(180deg, rgba(44, 215, 199, 0.10), rgba(44, 215, 199, 0.04)),
        rgba(15, 25, 35, 0.65);
    border: 1px solid rgba(44, 215, 199, 0.25);
    border-left: 4px solid var(--brand-lightest);
    border-radius: var(--radius-lg, 1rem);
    backdrop-filter: blur(8px);
}
.first-time-banner.is-hidden { display: none; }
.first-time-banner h3 { font-size: 1.05rem; color: #F5FBFB; font-weight: 700; }
.first-time-banner p { font-size: 0.85rem; color: rgba(230, 242, 242, 0.85); }
.first-time-banner pre {
    background: rgba(15, 25, 35, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm, 0.5rem);
    padding: 0.85rem 1rem;
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 0.78rem; color: var(--brand-lightest);
    overflow-x: auto; white-space: pre; margin: 0; position: relative;
}
.first-time-banner .copy-btn {
    position: absolute; top: 0.5rem; right: 0.5rem;
    background: rgba(44, 215, 199, 0.10);
    border: 1px solid rgba(44, 215, 199, 0.25);
    color: var(--brand-lightest);
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 0.7rem; padding: 0.25rem 0.6rem;
    border-radius: var(--radius-sm, 0.5rem); cursor: pointer;
}
.first-time-banner .actions { display: flex; gap: 0.85rem; }
.first-time-banner .actions a {
    font-size: 0.8rem; color: var(--brand-lightest); text-decoration: none;
    padding: 0.45rem 0.95rem;
    border-radius: var(--radius-sm, 0.5rem);
    border: 1px solid rgba(44, 215, 199, 0.25);
    background: rgba(44, 215, 199, 0.06);
}
.first-time-banner .actions a:hover {
    background: rgba(44, 215, 199, 0.14);
    border-color: rgba(44, 215, 199, 0.45);
}

/* Platform-status banner (filled by dashboard_flow_05; class hooks ready) */
.platform-banner {
    display: flex; align-items: center; gap: 1rem;
    padding: 0.85rem 1.1rem;
    background:
        linear-gradient(180deg, rgba(124, 45, 146, 0.14), rgba(124, 45, 146, 0.06)),
        rgba(15, 25, 35, 0.65);
    border: 1px solid rgba(124, 45, 146, 0.35);
    border-left: 4px solid var(--state-down);
    border-radius: var(--radius-md, 0.75rem);
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 20px var(--glow-down);
}
.platform-banner.is-hidden { display: none; }
.platform-banner.is-info {
    background:
        linear-gradient(180deg, rgba(44, 74, 84, 0.55), rgba(44, 74, 84, 0.30)),
        rgba(15, 25, 35, 0.65);
    border-color: rgba(44, 74, 84, 0.55);
    border-left-color: var(--state-elevated);
    box-shadow: 0 4px 20px var(--glow-elevated);
}
.platform-banner .glyph {
    font-size: 1.4rem; line-height: 1;
    color: var(--state-down);
    font-family: var(--font-mono, ui-monospace, monospace);
}
.platform-banner.is-info .glyph { color: var(--state-elevated); }
.platform-banner .body { flex: 1; display: flex; flex-direction: column; gap: 0.15rem; }
.platform-banner .title {
    font-weight: 600; font-size: 0.92rem;
    color: #F5FBFB; letter-spacing: -0.005em;
}
.platform-banner .detail { font-size: 0.82rem; color: rgba(230, 242, 242, 0.7); }
.platform-banner .detail .scope-tag {
    font-family: var(--font-mono, ui-monospace, monospace); font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.06);
    padding: 0.08rem 0.4rem; border-radius: var(--radius-sm, 0.4rem);
    margin: 0 0.25rem; color: rgba(230, 242, 242, 0.85);
}
.platform-banner .meta {
    font-family: var(--font-mono, ui-monospace, monospace); font-size: 0.75rem;
    color: rgba(230, 242, 242, 0.5); text-align: right; flex-shrink: 0;
}
.platform-banner a.status-link {
    color: var(--brand-lightest, #C0F1EB); text-decoration: none;
    font-size: 0.78rem;
    border-bottom: 1px dotted rgba(44, 215, 199, 0.4);
}
.platform-banner a.status-link:hover { border-bottom-style: solid; }

/* Recent incidents panel — ticket dashboard_flow_05e + 05f */
.incidents {
    background:
        linear-gradient(180deg, rgba(16, 72, 85, 0.30), rgba(13, 47, 57, 0.55)),
        rgba(15, 25, 35, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-lg, 1rem);
    padding: 1.25rem 1.5rem; margin-bottom: 1.5rem;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
}
.incidents header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 0.85rem; gap: 0.5rem; flex-wrap: wrap;
}
.incidents header h2 {
    font-size: 0.78rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.10em;
    color: rgba(230, 242, 242, 0.78);
}
.incidents header .source-badge {
    font-family: var(--font-mono, ui-monospace, monospace); font-size: 0.7rem;
    color: rgba(230, 242, 242, 0.55);
    background: rgba(255, 255, 255, 0.04);
    padding: 0.15rem 0.55rem;
    border-radius: var(--radius-sm, 0.4rem);
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.incidents header .source-badge.is-approx {
    color: var(--gold-500, #F5B638);
    border-color: rgba(245, 182, 56, 0.35);
    background: rgba(245, 182, 56, 0.06);
}
.incidents header .query-timeout-flag {
    font-family: var(--font-mono, ui-monospace, monospace); font-size: 0.7rem;
    color: var(--gold-500, #F5B638);
    background: rgba(245, 182, 56, 0.06);
    border: 1px solid rgba(245, 182, 56, 0.35);
    padding: 0.15rem 0.55rem;
    border-radius: var(--radius-sm, 0.4rem);
    margin-left: 0.5rem;
}
.incidents header .out-of-window {
    font-family: var(--font-mono, ui-monospace, monospace); font-size: 0.7rem;
    color: rgba(230, 242, 242, 0.55); margin-left: 0.5rem;
}
.incidents header .out-of-window a {
    color: var(--brand-lightest, #C0F1EB);
    border-bottom: 1px dotted rgba(44, 215, 199, 0.4);
    text-decoration: none;
}
.incidents ul {
    list-style: none; display: flex; flex-direction: column;
    gap: 0.4rem; margin: 0; padding: 0;
}
.incidents li {
    display: grid;
    grid-template-columns: 16px 100px 1fr max-content max-content;
    gap: 0.85rem; align-items: center;
    padding: 0.5rem; border-radius: var(--radius-sm, 0.4rem);
    font-size: 0.83rem; transition: background 0.2s ease;
}
.incidents li:hover { background: rgba(255, 255, 255, 0.03); }
.incidents li .glyph {
    font-family: var(--font-mono, ui-monospace, monospace); text-align: center;
}
.incidents li.sev-degraded .glyph { color: var(--state-degraded); }
.incidents li.sev-elevated .glyph { color: var(--state-elevated); }
.incidents li.sev-down     .glyph { color: var(--state-down); }
.incidents li.sev-nominal  .glyph { color: var(--state-nominal); }
.incidents li .when {
    font-family: var(--font-mono, ui-monospace, monospace);
    color: rgba(230, 242, 242, 0.55); font-size: 0.78rem;
}
.incidents li .desc { color: #E6F2F2; }
.incidents li .duration {
    font-family: var(--font-mono, ui-monospace, monospace);
    color: rgba(230, 242, 242, 0.55); font-size: 0.78rem;
}
.incidents li a {
    color: var(--brand-lightest, #C0F1EB); font-size: 0.78rem;
    text-decoration: none;
    border-bottom: 1px dotted rgba(44, 215, 199, 0.4);
}
.incidents li a:hover { border-bottom-style: solid; }
.incidents .empty {
    text-align: center; padding: 1.5rem 0;
    color: rgba(230, 242, 242, 0.40);
    font-family: var(--font-mono, ui-monospace, monospace); font-size: 0.82rem;
}

/* Causality hints (ticket dashboard_flow_08). Subtle styling —
   should not dominate the KPIs, but must be readable. */
.causality-hint {
    font-size: 0.78rem; font-style: italic;
    color: rgba(192, 241, 235, 0.65);
    margin: 0.25rem 0;
    padding: 0.15rem 0;
}
.causality-hint a {
    color: var(--brand-lightest, #C0F1EB);
    text-decoration: none;
    border-bottom: 1px dotted rgba(44, 215, 199, 0.4);
}
.causality-hint a:hover, .causality-hint a:focus {
    border-bottom-style: solid; outline: none;
}

/* Brief target-card highlight when a causality link jumps to it. */
@keyframes causality-jump-flash {
    0%   { box-shadow: 0 0 0 0 rgba(44, 215, 199, 0.0); }
    50%  { box-shadow: 0 0 0 4px rgba(44, 215, 199, 0.45); }
    100% { box-shadow: 0 0 0 0 rgba(44, 215, 199, 0.0); }
}
.flow-card.is-causality-target {
    animation: causality-jump-flash 1.2s ease-out 1;
}
@media (prefers-reduced-motion: reduce) {
    .flow-card.is-causality-target {
        animation: none;
        outline: 2px solid rgba(44, 215, 199, 0.45);
    }
}

/* Topology edge — gold pulse when a causality hint correlates the
   two adjacent steps. Slower than throughput animation; pulses like
   a heartbeat. */
@keyframes topology-edge-causality-pulse {
    0%, 100% { opacity: 0.45; }
    50%      { opacity: 1.00; }
}
.topology .edge.is-causality {
    stroke: var(--gold-500, #F5B638);
    stroke-width: 2;
    animation: topology-edge-causality-pulse 2.4s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
    .topology .edge.is-causality { animation: none; opacity: 0.85; }
}

/* Drill-down modal (ticket dashboard_flow_07b/07c). Hidden by default;
   flow.js inserts/removes the modal nodes on open/close. */
.flow-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    z-index: 9000;
    animation: flow-modal-fade-in 200ms ease-out;
}
.flow-modal {
    position: fixed;
    top: 50%; left: 50%; transform: translate(-50%, -50%);
    background:
        linear-gradient(180deg, rgba(16, 72, 85, 0.45), rgba(13, 47, 57, 0.65)),
        rgba(15, 25, 35, 0.95);
    border: 1px solid rgba(44, 215, 199, 0.18);
    border-radius: var(--radius-lg, 1rem);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    width: min(800px, 92vw);
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.5rem;
    z-index: 9001;
    color: #E6F2F2;
    animation: flow-modal-scale-in 200ms ease-out;
}
@keyframes flow-modal-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes flow-modal-scale-in {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.96); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1.0); }
}
@media (prefers-reduced-motion: reduce) {
    .flow-modal-overlay, .flow-modal { animation: none; }
}
.flow-modal-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1rem;
}
.flow-modal-header h2 {
    font-size: 1rem; font-weight: 600; letter-spacing: -0.005em;
    margin: 0;
}
.flow-modal-close, .flow-modal-close-text {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.10);
    color: rgba(230, 242, 242, 0.75);
    border-radius: var(--radius-sm, 0.4rem);
    padding: 0.3rem 0.7rem; cursor: pointer;
    font-family: var(--font-mono, ui-monospace, monospace);
    transition: all 0.15s ease;
}
.flow-modal-close:hover, .flow-modal-close-text:hover,
.flow-modal-close:focus, .flow-modal-close-text:focus {
    border-color: rgba(44, 215, 199, 0.45);
    color: var(--brand-lightest, #C0F1EB);
    outline: none;
}
.flow-modal-tabs {
    display: flex; gap: 0.4rem; margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 0.5rem;
}
.flow-modal-tabs button {
    background: transparent; color: rgba(230, 242, 242, 0.6);
    border: 1px solid transparent;
    border-radius: var(--radius-sm, 0.4rem);
    padding: 0.3rem 0.85rem; cursor: pointer;
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 0.8rem;
    transition: all 0.15s ease;
}
.flow-modal-tabs button:hover {
    color: var(--brand-lightest, #C0F1EB);
}
.flow-modal-tabs button[aria-selected="true"] {
    background: rgba(44, 215, 199, 0.10);
    border-color: rgba(44, 215, 199, 0.35);
    color: var(--brand-lightest, #C0F1EB);
}
.flow-modal-tabs button:focus-visible {
    outline: 2px solid rgba(44, 215, 199, 0.55);
    outline-offset: 2px;
}
.flow-modal-chart {
    background: rgba(0, 0, 0, 0.20);
    border-radius: var(--radius-md, 0.75rem);
    padding: 0.75rem;
    margin-bottom: 1rem; min-height: 200px;
}
.flow-modal-chart svg { width: 100%; height: 200px; display: block; }
.flow-modal-chart .chart-line {
    stroke: var(--brand-lightest, #C0F1EB);
    stroke-width: 1.5;
    fill: none;
}
.flow-modal-chart.is-loading {
    opacity: 0.55;
    background-image: linear-gradient(90deg, transparent, rgba(44,215,199,0.08), transparent);
    background-size: 200% 100%;
    animation: flow-modal-loading 1.2s linear infinite;
}
@keyframes flow-modal-loading {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
    .flow-modal-chart.is-loading { animation: none; }
}
.flow-modal-summary {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem;
    margin-bottom: 1.25rem;
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 0.85rem;
}
.flow-modal-summary span { display: flex; flex-direction: column; gap: 0.15rem; }
.flow-modal-summary strong {
    font-weight: 500; font-size: 0.7rem;
    color: rgba(230, 242, 242, 0.55);
    text-transform: uppercase; letter-spacing: 0.08em;
}
.flow-modal-related {
    margin-bottom: 1.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.flow-modal-related h3 {
    font-size: 0.7rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.10em;
    color: rgba(230, 242, 242, 0.55);
    margin: 0 0 0.5rem 0;
}
.flow-modal-related ul { list-style: none; padding: 0; margin: 0; }
.flow-modal-related li {
    display: flex; justify-content: space-between;
    padding: 0.35rem 0;
    font-family: var(--font-mono, ui-monospace, monospace); font-size: 0.83rem;
}
.flow-modal-related li .rel-current {
    color: rgba(230, 242, 242, 0.7);
}
.flow-modal-footer {
    display: flex; justify-content: space-between; align-items: center;
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.flow-modal-admin-link {
    color: var(--brand-lightest, #C0F1EB);
    text-decoration: none;
    border-bottom: 1px dotted rgba(44, 215, 199, 0.4);
    font-size: 0.85rem;
}
.flow-modal-admin-link:hover { border-bottom-style: solid; }

/* Mobile modal — full-screen takeover on phones. */
@media (max-width: 720px) {
    .flow-modal {
        top: 0; left: 0;
        transform: none;
        width: 100vw; max-height: 100vh;
        height: 100vh;
        border-radius: 0;
        padding: 1rem;
    }
    .flow-modal-summary {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile incidents panel — stack rows below 720px (ticket 06).
   The 5-column grid (glyph / when / desc / duration / monitoring)
   doesn't survive narrow viewports; collapse to: glyph+when row,
   desc row, duration+monitoring row. */
@media (max-width: 720px) {
    .incidents header { flex-direction: column; align-items: flex-start; }
    .incidents li {
        grid-template-columns: 16px max-content;
        grid-template-rows: auto auto auto;
        column-gap: 0.5rem; row-gap: 0.25rem;
    }
    .incidents li .glyph    { grid-column: 1; grid-row: 1; }
    .incidents li .when     { grid-column: 2; grid-row: 1; }
    .incidents li .desc     { grid-column: 1 / -1; grid-row: 2; }
    .incidents li .duration { grid-column: 1; grid-row: 3; justify-self: start; }
    .incidents li a,
    .incidents li .monitoring-placeholder {
        grid-column: 2; grid-row: 3; justify-self: end;
    }
}

/* Mobile topology — below 720px, stack the 7 nodes vertically with
   downward arrows and hide the cross-row "Sign → Chain" detour
   (ticket 06 open question 1: vertical stacking is the load-bearing
   shape for narrow viewports). The desktop SVG layout doesn't fit
   a phone, so we render an alternative element-based layout. */
@media (max-width: 720px) {
    .topology svg.topology-graph { display: none; }
    .topology .topology-mobile {
        display: flex;
        flex-direction: column;
        gap: 0.6rem;
        padding: 0.5rem 0;
    }
    .topology .topology-mobile .node {
        background: rgba(15, 25, 35, 0.65);
        border: 1px solid rgba(255, 255, 255, 0.06);
        border-radius: var(--radius-md, 0.75rem);
        padding: 0.6rem 0.85rem;
        display: flex; align-items: center; justify-content: space-between;
        font-family: var(--font-mono, ui-monospace, monospace);
        font-size: 0.85rem;
    }
    .topology .topology-mobile .node.state-nominal  { border-left: 3px solid var(--state-nominal); }
    .topology .topology-mobile .node.state-elevated { border-left: 3px solid var(--state-elevated); }
    .topology .topology-mobile .node.state-degraded { border-left: 3px solid var(--state-degraded); }
    .topology .topology-mobile .node.state-down     { border-left: 3px solid var(--state-down); }
    .topology .topology-mobile .arrow {
        text-align: center;
        color: rgba(230, 242, 242, 0.35);
        font-size: 1rem; line-height: 1;
    }
}
@media (min-width: 721px) {
    .topology .topology-mobile { display: none; }
}

/* Deep-link pulse — ?incident=<id> highlights matching row for 2s */
@keyframes incidentDeepLinkPulse {
    0%   { background: rgba(44, 215, 199, 0.00); }
    25%  { background: rgba(44, 215, 199, 0.18); }
    100% { background: rgba(44, 215, 199, 0.00); }
}
.incidents li.is-deep-linked { animation: incidentDeepLinkPulse 2s ease-out 1; }
@media (prefers-reduced-motion: reduce) {
    .incidents li.is-deep-linked {
        animation: none;
        outline: 1px solid rgba(44, 215, 199, 0.45);
    }
}

/* Live state region — placeholder for ticket 03/04 SVG + cards */
.flow-live {
    min-height: 380px;
    background:
        linear-gradient(180deg, rgba(16, 72, 85, 0.30), rgba(13, 47, 57, 0.55)),
        rgba(15, 25, 35, 0.65);
    border: 1px solid rgba(44, 215, 199, 0.10);
    border-radius: var(--radius-xl, 1.25rem);
    padding: 1.75rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}
.flow-live .flow-loading {
    color: rgba(230, 242, 242, 0.45);
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 0.85rem; text-align: center; padding: 4rem 0;
}

/* Scaffolding for cards (ticket 04 fills these in) */
.cards-grid {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 1rem;
}
@media (max-width: 1280px) { .cards-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 820px)  { .cards-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px)  { .cards-grid { grid-template-columns: 1fr; } }

.flow-card {
    position: relative;
    background:
        linear-gradient(180deg, rgba(16, 72, 85, 0.35), rgba(13, 47, 57, 0.55)),
        rgba(15, 25, 35, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-lg, 1rem);
    padding: 1.1rem; overflow: hidden;
    backdrop-filter: blur(8px);
    transition: transform 0.2s ease;
    display: flex; flex-direction: column; gap: 0.75rem; min-height: 240px;
}
.flow-card:hover { transform: translateY(-2px); }
.flow-card.state-nominal  { border-left: 3px solid var(--state-nominal);  box-shadow: 0 4px 20px var(--glow-nominal); }
.flow-card.state-elevated { border-left: 3px solid var(--state-elevated); box-shadow: 0 4px 20px var(--glow-elevated); }
.flow-card.state-degraded { border-left: 3px solid var(--state-degraded); box-shadow: 0 4px 20px var(--glow-degraded); }
.flow-card.state-down     { border-left: 3px solid var(--state-down);     box-shadow: 0 4px 20px var(--glow-down); }

/* C.4 state-change flash — animates on transition */
.flow-card.state-just-changed { animation: flow-state-flash 0.6s ease-out; }
@keyframes flow-state-flash {
    0%   { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.30); }
    100% { box-shadow: 0 0 0 8px rgba(255, 255, 255, 0); }
}
@media (prefers-reduced-motion: reduce) {
    .flow-card.state-just-changed { animation: none; }
}

/* C.2 tooltip-trigger (the "?" button next to KPI labels) */
.tooltip-trigger {
    display: inline-flex; align-items: center; justify-content: center;
    width: 14px; height: 14px; border-radius: 50%;
    border: 1px solid rgba(230, 242, 242, 0.25);
    font-size: 9px; color: rgba(230, 242, 242, 0.55);
    font-family: var(--font-mono, ui-monospace, monospace);
    margin-left: 0.35rem; cursor: help; position: relative;
    background: transparent; padding: 0;
    transition: all 0.2s ease;
}
.tooltip-trigger:hover, .tooltip-trigger:focus {
    background: rgba(44, 215, 199, 0.15);
    border-color: rgba(44, 215, 199, 0.45);
    color: var(--brand-lightest); outline: none;
}
.tooltip-trigger::after {
    content: attr(data-tooltip);
    position: absolute; bottom: calc(100% + 8px); left: 50%;
    transform: translateX(-50%);
    background: var(--brand-deep-darkest, #0F1923);
    color: #E6F2F2; padding: 0.55rem 0.75rem;
    border-radius: var(--radius-sm, 0.5rem);
    border: 1px solid rgba(44, 215, 199, 0.22);
    font-size: 0.74rem; font-family: var(--font-sans, system-ui);
    width: 220px; white-space: normal; text-align: left; line-height: 1.45;
    opacity: 0; pointer-events: none;
    transition: opacity 0.15s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); z-index: 100;
}
.tooltip-trigger:hover::after, .tooltip-trigger:focus::after { opacity: 1; }

/* C.6 SR fallback */
.topology-sr-fallback {
    padding: 0.5rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.topology-sr-fallback summary {
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 0.75rem; color: rgba(230, 242, 242, 0.55);
    cursor: pointer; list-style: none;
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.25rem 0.5rem; border-radius: var(--radius-sm, 0.5rem);
}
.topology-sr-fallback summary::-webkit-details-marker { display: none; }
.topology-sr-fallback summary::before {
    content: '▶'; font-size: 0.65rem; color: var(--brand-lightest);
    transition: transform 0.2s ease;
}
.topology-sr-fallback[open] summary::before { transform: rotate(90deg); }
.topology-sr-fallback ul {
    list-style: none; padding: 0.85rem 0 0 1.25rem; margin: 0;
    display: flex; flex-direction: column; gap: 0.35rem;
}
.topology-sr-fallback li {
    font-size: 0.82rem; color: rgba(230, 242, 242, 0.85);
    padding-left: 1.25rem; position: relative; line-height: 1.4;
}

/* Palette key (ticket 06 expands; ticket 02 ships the legend) */
.palette-key {
    background: rgba(15, 25, 35, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-lg, 1rem);
    padding: 1.25rem 1.5rem;
}
.palette-key header h2 {
    font-size: 0.78rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.10em;
    color: rgba(230, 242, 242, 0.78);
}
.palette-key .grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem;
    margin-top: 0.85rem;
}
@media (max-width: 720px) { .palette-key .grid { grid-template-columns: 1fr 1fr; } }
.palette-key .swatch-card {
    display: flex; gap: 0.85rem;
    padding: 0.75rem 0.85rem;
    border-radius: var(--radius-md, 0.75rem);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
}
.palette-key .chip {
    flex-shrink: 0; width: 44px; height: 44px;
    border-radius: var(--radius-md, 0.75rem);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    font-family: var(--font-mono, ui-monospace, monospace);
    color: var(--brand-deep-darkest, #0F1923); font-weight: 700;
}
.palette-key .chip.nominal  { background: var(--state-nominal); }
.palette-key .chip.elevated { background: var(--state-elevated); color: #F5FBFB; }
.palette-key .chip.degraded { background: var(--state-degraded); }
.palette-key .chip.down     { background: var(--state-down); color: #F5FBFB; }
.palette-key .meta { display: flex; flex-direction: column; gap: 0.15rem; }
.palette-key .meta .name { font-weight: 600; font-size: 0.85rem; color: #F5FBFB; }
.palette-key .meta .meaning { font-size: 0.78rem; color: rgba(230, 242, 242, 0.70); }

/* ============================================================================
 * Pipeline Flow — Topology SVG (ticket dashboard_flow_03)
 * ============================================================================ */

.topology {
    position: relative;
    background:
        linear-gradient(180deg, rgba(16, 72, 85, 0.30), rgba(13, 47, 57, 0.55)),
        rgba(15, 25, 35, 0.65);
    border: 1px solid rgba(44, 215, 199, 0.10);
    border-radius: var(--radius-xl, 1.25rem);
    padding: 1.75rem 1.75rem 1.25rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}
.topology .topology-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1rem;
}
.topology .topology-header h2 {
    font-size: 0.85rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.08em;
    color: rgba(230, 242, 242, 0.55);
}
.topology .topology-header .legend {
    display: flex; gap: 1rem;
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 0.72rem; color: rgba(230, 242, 242, 0.55);
}
.topology .topology-header .legend span { display: inline-flex; align-items: center; gap: 0.3rem; }
.topology .topology-header .legend .swatch {
    display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 2px;
}
.topology svg { width: 100%; height: auto; display: block; }

.flow-node-body {
    fill: rgba(13, 47, 57, 0.85);
    stroke: rgba(44, 215, 199, 0.25); stroke-width: 1.5;
    transition: all 0.2s ease;
}
.flow-node-body.state-nominal  { stroke: var(--state-nominal);  filter: drop-shadow(0 0 8px var(--glow-nominal)); }
.flow-node-body.state-elevated { stroke: var(--state-elevated); }
.flow-node-body.state-degraded { stroke: var(--state-degraded); filter: drop-shadow(0 0 10px var(--glow-degraded)); }
.flow-node-body.state-down     { stroke: var(--state-down);     filter: drop-shadow(0 0 12px var(--glow-down)); }

.flow-node-label {
    fill: #F5FBFB;
    font-family: var(--font-heading, 'Montserrat', sans-serif);
    font-weight: 700; font-size: 13px; letter-spacing: 0.04em;
    text-anchor: middle;
}
.flow-node-rate {
    fill: rgba(230, 242, 242, 0.70);
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 11px; text-anchor: middle;
}
.flow-node-glyph {
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 14px; text-anchor: middle;
}
.flow-node-glyph.state-nominal  { fill: var(--state-nominal); }
.flow-node-glyph.state-elevated { fill: var(--state-elevated); }
.flow-node-glyph.state-degraded { fill: var(--state-degraded); }
.flow-node-glyph.state-down     { fill: var(--state-down); }

/* Click-to-card affordance */
.flow-node { cursor: pointer; }
.flow-node:focus-visible .flow-node-body {
    stroke-width: 2.5;
    outline: 2px solid var(--brand-lightest);
    outline-offset: 4px;
}

/* Edges */
.flow-edge {
    fill: none;
    stroke: rgba(44, 215, 199, 0.45);
    stroke-linecap: round;
}
.flow-edge.thick { stroke-width: 4; }
.flow-edge.med   { stroke-width: 2.5; }
.flow-edge.thin  { stroke-width: 1.5; opacity: 0.65; }

.flow-edge-anim {
    fill: none;
    stroke: var(--brand-lightest);
    stroke-width: 2;
    stroke-dasharray: 6 12;
    opacity: 0.85;
    animation: flow-dashflow 1.6s linear infinite;
}
.flow-edge-anim.fast { animation-duration: 0.9s; }
.flow-edge-anim.slow { animation-duration: 2.6s; }

@keyframes flow-dashflow {
    to { stroke-dashoffset: -36; }
}

/* A.6 — disable edge animation under reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .flow-edge-anim { animation: none; opacity: 0.45; }
}

.flow-arrowhead { fill: rgba(44, 215, 199, 0.65); }

/* Throughput strip */
.throughput-strip {
    margin-top: 1.25rem; padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: grid; grid-template-columns: max-content 1fr max-content;
    gap: 1.25rem; align-items: center;
}
.throughput-strip .label {
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 0.75rem; color: rgba(230, 242, 242, 0.55);
}
.throughput-strip .value {
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 1.05rem; color: var(--brand-lightest); font-weight: 500;
}
.throughput-strip svg { width: 100%; height: 32px; display: block; }
.throughput-strip .spark-line {
    fill: none; stroke: var(--brand-light); stroke-width: 1.5;
}

/* SR fallback list — populated server-side per ticket 03 */
.topology-sr-fallback li.sr-degraded .state-tag { color: var(--state-degraded); }
.topology-sr-fallback li.sr-elevated .state-tag { color: rgba(230, 242, 242, 0.65); }
.topology-sr-fallback li.sr-down .state-tag { color: var(--state-down); }
.topology-sr-fallback li.sr-nominal .state-tag { color: var(--brand-lightest); }

/* Card-target highlight pulse — fires when a topology node is clicked
   and the page scrolls to + briefly highlights the matching card. */
.flow-card.is-card-target {
    animation: flow-card-target-pulse 1.5s ease-out;
}
@keyframes flow-card-target-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(44, 215, 199, 0.55); }
    100% { box-shadow: 0 0 0 10px rgba(44, 215, 199, 0); }
}
@media (prefers-reduced-motion: reduce) {
    .flow-card.is-card-target { animation: none; }
}

/* ============================================================================
 * Pipeline Flow — Card content (ticket dashboard_flow_04)
 * Card container styling lives in the ticket-02 section above.
 * ============================================================================ */

.flow-card .card-head {
    display: flex; justify-content: space-between; align-items: center;
}
.flow-card .card-title {
    font-family: var(--font-heading, 'Montserrat', sans-serif);
    font-weight: 700; font-size: 0.78rem;
    text-transform: uppercase; letter-spacing: 0.10em;
    color: rgba(230, 242, 242, 0.78);
}
.flow-card .card-glyph {
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 1.05rem; line-height: 1;
}
.flow-card.state-nominal  .card-glyph { color: var(--state-nominal); }
.flow-card.state-elevated .card-glyph { color: var(--state-elevated); }
.flow-card.state-degraded .card-glyph { color: var(--state-degraded); }
.flow-card.state-down     .card-glyph { color: var(--state-down); }

.flow-card .primary-kpi {
    display: flex; align-items: baseline; gap: 0.45rem;
}
.flow-card .primary-kpi .value {
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 1.85rem; font-weight: 500;
    color: #F5FBFB; letter-spacing: -0.02em; line-height: 1;
}
.flow-card.state-down .primary-kpi .value { color: rgba(245, 251, 251, 0.45); }
.flow-card .primary-kpi .label {
    font-family: var(--font-sans, system-ui);
    font-size: 0.72rem; color: rgba(230, 242, 242, 0.50);
    margin-left: auto;
    text-transform: uppercase; letter-spacing: 0.06em;
}

.flow-card dl.secondary {
    display: grid; grid-template-columns: max-content 1fr;
    column-gap: 0.85rem; row-gap: 0.30rem;
    font-size: 0.78rem; margin: 0;
}
.flow-card dl.secondary dt {
    color: rgba(230, 242, 242, 0.50); font-weight: 400;
    display: flex; align-items: center;
}
.flow-card dl.secondary dd {
    font-family: var(--font-mono, ui-monospace, monospace);
    color: #E6F2F2; text-align: right; margin: 0;
}

/* Per-KPI accent colors (KPI.Accent populated by the deriver) */
.flow-card .accent-elevated { color: rgba(230, 242, 242, 0.80); }
.flow-card .accent-degraded { color: var(--state-degraded); }
.flow-card .accent-down     { color: var(--state-down); }
.flow-card .accent-nominal  { color: var(--state-nominal); }

/* Card hint paragraph — used by the Verify card's C.5 reassurance copy */
.flow-card .card-hint {
    font-size: 0.78rem; font-style: italic;
    color: rgba(230, 242, 242, 0.70);
    padding: 0.45rem 0.65rem;
    background: rgba(255, 255, 255, 0.03);
    border-left: 2px solid rgba(255, 255, 255, 0.10);
    border-radius: 0 var(--radius-sm, 0.5rem) var(--radius-sm, 0.5rem) 0;
    margin: 0;
    line-height: 1.45;
}

/* Sparkline */
.flow-card .card-spark {
    width: 100%; height: 36px;
    margin-top: auto; display: block;
}
.flow-card .card-spark .line { fill: none; stroke: var(--brand-light); stroke-width: 1.5; }
.flow-card .card-spark .area { fill: rgba(44, 215, 199, 0.10); stroke: none; }
.flow-card.state-degraded .card-spark .line { stroke: var(--state-degraded); }
.flow-card.state-degraded .card-spark .area { fill: rgba(245, 182, 56, 0.10); }
.flow-card.state-elevated .card-spark .line { stroke: rgba(230, 242, 242, 0.55); }
.flow-card.state-down     .card-spark .line { stroke: rgba(124, 45, 146, 0.45); stroke-dasharray: 3 4; }

/* Card footer */
.flow-card .card-foot {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.72rem;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding-top: 0.5rem;
    margin-top: 0.25rem;
}
.flow-card .card-foot .age {
    color: rgba(230, 242, 242, 0.40);
    font-family: var(--font-mono, ui-monospace, monospace);
}
.flow-card .card-foot a {
    color: var(--brand-lightest); text-decoration: none;
    border-bottom: 1px dotted rgba(44, 215, 199, 0.4);
}
.flow-card .card-foot a:hover { border-bottom-style: solid; }

/* ===== Team members surface (ui_invite_18..22) ============================ */

.members-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap;
}
.members-invite-toggle { padding: 0.5rem 1rem; font-weight: 600; }

/* Members table */
.members-table { width: 100%; border-collapse: collapse; }
.members-table th, .members-table td {
    text-align: left; padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.06));
    vertical-align: top;
}
.members-table thead th {
    font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--muted, rgba(255, 255, 255, 0.55)); font-weight: 600;
    border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.1));
}
.members-table tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
.members-table tbody tr:last-child td { border-bottom: none; }
.members-row.is-pending { opacity: 0.85; }
.members-row.is-self { background: rgba(44, 215, 199, 0.03); }

.members-row-name { font-weight: 500; }
.members-row-email { font-size: 0.85rem; margin-top: 0.15rem; }
.small { font-size: 0.8rem; }
.muted { color: var(--muted, rgba(255, 255, 255, 0.55)); }

.col-actions { text-align: right; width: 1%; white-space: nowrap; }

.badge-pending {
    background: rgba(255, 200, 80, 0.12);
    color: rgba(255, 220, 140, 0.95);
    border: 1px solid rgba(255, 200, 80, 0.25);
}

.members-empty { text-align: center; color: var(--muted); padding: 2rem; }

/* Invite side sheet */
.members-invite-sheet {
    position: fixed; top: 0; right: 0; height: 100vh; width: min(440px, 96vw);
    background: var(--panel, #11181f);
    box-shadow: -16px 0 40px rgba(0, 0, 0, 0.4);
    z-index: 50; padding: 1.5rem;
    overflow-y: auto;
    border-left: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    animation: sheet-slide-in 180ms ease-out;
}
@keyframes sheet-slide-in {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}
.members-invite-sheet-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1.25rem;
}
.members-invite-sheet-header h3 { margin: 0; }
.btn-icon {
    background: transparent; border: 0; color: var(--muted);
    font-size: 1.5rem; line-height: 1; cursor: pointer;
    width: 32px; height: 32px; border-radius: 6px;
}
.btn-icon:hover { background: rgba(255, 255, 255, 0.06); color: inherit; }

.members-invite-backdrop {
    position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5);
    z-index: 40; animation: fade-in 180ms ease-out;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
body.sheet-open { overflow: hidden; }

/* Vertical form fields */
.members-invite-form .form-field { margin-bottom: 1.25rem; }
.members-invite-form .form-field > label {
    display: block; font-weight: 600; font-size: 0.85rem;
    margin-bottom: 0.4rem; color: var(--fg, rgba(255, 255, 255, 0.92));
}
.members-invite-form input[type="email"] {
    width: 100%; padding: 0.55rem 0.75rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
    border-radius: 6px; color: inherit; font: inherit;
}
.members-invite-form input[type="email"]:focus {
    outline: none; border-color: var(--brand, #2cd7c7);
    box-shadow: 0 0 0 3px rgba(44, 215, 199, 0.15);
}
.form-hint { font-size: 0.8rem; color: var(--muted); margin: 0.4rem 0 0; }

/* Role radio cards */
.role-cards { display: flex; flex-direction: column; gap: 0.5rem; }
.role-card {
    display: flex; gap: 0.75rem; align-items: flex-start;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
    border-radius: 8px; cursor: pointer;
    transition: border-color 120ms ease, background 120ms ease;
}
.role-card:hover { border-color: rgba(44, 215, 199, 0.4); }
.role-card input[type="radio"] { margin-top: 0.2rem; accent-color: var(--brand, #2cd7c7); }
.role-card:has(input:checked) {
    border-color: var(--brand, #2cd7c7);
    background: rgba(44, 215, 199, 0.06);
}
.role-card-title { font-weight: 600; }
.role-card-desc { font-size: 0.85rem; color: var(--muted); margin-top: 0.1rem; }

/* Region chip group */
.chip-group { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border, rgba(255, 255, 255, 0.15));
    border-radius: 999px; cursor: pointer; user-select: none;
    transition: border-color 120ms ease, background 120ms ease;
    font-size: 0.9rem;
}
.chip:hover { border-color: rgba(44, 215, 199, 0.4); }
.chip input { accent-color: var(--brand, #2cd7c7); }
.chip:has(input:checked) {
    border-color: var(--brand, #2cd7c7);
    background: rgba(44, 215, 199, 0.1);
}

/* Form actions row */
.form-actions {
    display: flex; justify-content: flex-end; gap: 0.5rem;
    margin-top: 1.5rem; padding-top: 1rem;
    border-top: 1px solid var(--border, rgba(255, 255, 255, 0.08));
}
.btn-secondary {
    background: transparent; color: inherit;
    border: 1px solid var(--border, rgba(255, 255, 255, 0.18));
    padding: 0.5rem 1rem; border-radius: 6px; cursor: pointer; font: inherit;
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.04); }

/* Kebab dropdown */
.kebab { position: relative; display: inline-block; }
.kebab > summary {
    list-style: none; cursor: pointer; padding: 0.25rem 0.5rem;
    border-radius: 6px; color: var(--muted); font-size: 1.2rem;
    line-height: 1; user-select: none;
}
.kebab > summary::-webkit-details-marker { display: none; }
.kebab > summary:hover { background: rgba(255, 255, 255, 0.06); color: inherit; }
.kebab[open] > summary { background: rgba(255, 255, 255, 0.08); color: inherit; }
.kebab-menu {
    position: absolute; right: 0; top: calc(100% + 4px);
    min-width: 180px; padding: 0.3rem;
    background: var(--panel, #11181f);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    z-index: 10;
}
.kebab-item {
    display: block; width: 100%; text-align: left;
    background: transparent; border: 0; color: inherit;
    padding: 0.5rem 0.75rem; border-radius: 4px;
    cursor: pointer; font: inherit;
}
.kebab-item:hover { background: rgba(255, 255, 255, 0.06); }
.kebab-item-danger { color: rgba(255, 130, 130, 0.95); }
.kebab-item-danger:hover { background: rgba(255, 80, 80, 0.1); }

.members-invite-form textarea {
    width: 100%; padding: 0.55rem 0.75rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
    border-radius: 6px; color: inherit; font: inherit;
    resize: vertical; min-height: 70px;
}
.members-invite-form textarea:focus {
    outline: none; border-color: var(--brand, #2cd7c7);
    box-shadow: 0 0 0 3px rgba(44, 215, 199, 0.15);
}

/* Confirm modal */
.confirm-modal {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 100; display: flex; align-items: center; justify-content: center;
    animation: fade-in 140ms ease-out;
}
.confirm-modal-card {
    background: var(--panel, #11181f); padding: 1.5rem;
    border-radius: 10px; max-width: 460px; width: 92vw;
    border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.confirm-modal-card h3 { margin-top: 0; }
.confirm-modal-typebox { margin: 1rem 0; }
.confirm-modal-typebox label { display: block; font-size: 0.85rem; margin-bottom: 0.4rem; color: var(--muted); }
.confirm-modal-typebox strong { color: rgba(255, 130, 130, 0.95); font-family: 'IBM Plex Mono', monospace; }
.confirm-modal-typebox input {
    width: 100%; padding: 0.55rem 0.75rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.15));
    border-radius: 6px; color: inherit; font: inherit;
}
.btn-danger {
    background: rgba(255, 80, 80, 0.85); color: white;
    border: 0; padding: 0.5rem 1rem; border-radius: 6px;
    cursor: pointer; font: inherit; font-weight: 600;
}
.btn-danger:disabled {
    background: rgba(255, 80, 80, 0.2); color: rgba(255, 255, 255, 0.5);
    cursor: not-allowed;
}
.btn-danger:not(:disabled):hover { background: rgba(255, 100, 100, 0.95); }

/* hidden-attribute override — class selectors beat the UA [hidden] rule,
   so any element using display:flex/block as part of its layout must
   restore the hide explicitly. */
.confirm-modal[hidden],
.members-invite-sheet[hidden],
.members-invite-backdrop[hidden] { display: none !important; }

/* ─────────────────────────────────────────────────────────────────────
 * API-key create form + show-once secret reveal.
 *
 * Fixes three issues observed 2026-05-23:
 *  1. Double-submit creating two keys — `data-once-submit` + this
 *     spinner class give visible feedback on the first click.
 *  2. Copy-to-clipboard button looked like a raw browser default.
 *  3. The reveal block's typography clashed with the design system
 *     (heading was a different font, hint text wrapped weirdly,
 *     buttons were unstyled).
 * ─────────────────────────────────────────────────────────────────── */

.apikey-create-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0.25rem 0 1rem;
    line-height: 1.5;
}

.apikey-create-form .form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
}

.apikey-create-form button[type=submit] {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 9rem;
    justify-content: center;
}

.apikey-create-form button[type=submit][disabled],
.apikey-create-form button[type=submit][aria-busy="true"] {
    cursor: progress;
    opacity: 0.7;
}

.apikey-create-spinner {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: apikey-spin 0.7s linear infinite;
}
.apikey-create-form button[type=submit][disabled] .apikey-create-spinner,
.apikey-create-form button[type=submit][aria-busy="true"] .apikey-create-spinner,
.htmx-request .apikey-create-spinner { display: inline-block; }

@keyframes apikey-spin {
    to { transform: rotate(360deg); }
}

/* ── Show-once secret reveal (collect_key_reveal.html) ──────────── */

.key-reveal-modal {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: var(--bg-elevated, rgba(255,255,255,0.03));
    border: 1px solid var(--border-default, rgba(255,255,255,0.08));
    border-left: 3px solid var(--brand-default);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.key-reveal-modal h2 {
    /* Match the design system's section-title scale, not <h1>. */
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
    color: var(--text-default);
    letter-spacing: 0.01em;
}

.key-reveal-warning {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0;
}
.key-reveal-warning strong {
    color: var(--text-default);
    font-weight: 700;
}

.key-reveal-plaintext {
    display: block;
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 0.85rem;
    background: var(--bg-default, rgba(0,0,0,0.35));
    border: 1px solid var(--border-default, rgba(255,255,255,0.08));
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem;
    word-break: break-all;
    user-select: all;
    color: var(--text-default);
    line-height: 1.4;
}

.key-reveal-modal .form-actions,
.key-reveal-modal > form,
.key-reveal-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 0;
}

.key-reveal-copy-btn {
    background: var(--bg-elevated, rgba(255,255,255,0.05));
    color: var(--text-default);
    border: 1px solid var(--border-default, rgba(255,255,255,0.12));
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.95rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.key-reveal-copy-btn:hover {
    background: var(--bg-hover, rgba(255,255,255,0.08));
    border-color: var(--brand-default);
}
.key-reveal-copy-btn:active { transform: translateY(1px); }

.key-reveal-ack-form {
    display: inline-flex;
    margin: 0;
}

.key-reveal-ack-btn {
    background: linear-gradient(135deg, var(--brand-default) 0%, var(--brand-dark) 100%);
    color: var(--text-inverse);
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.5rem 1.1rem;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--glow-teal-soft);
}
.key-reveal-ack-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--glow-teal);
}
