/* ═══════════════════════════════════════════════════════════════════════════
   The Prospector — Design System
   Default: Light (modern, clean, Linear/Vercel-inspired)
   Dark override: [data-theme="dark"] — tactical intelligence palette
   Fonts: Clash Display (display), Plus Jakarta Sans (body), JetBrains Mono (code)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Tokens — Light (default) ────────────────────────────────────────────── */
:root {
    /* Backgrounds — clean slate with white surfaces */
    --bg-deep:        #f1f5f9;
    --bg:             #f8fafc;
    --surface:        #ffffff;
    --surface-hover:  #f8fafc;
    --surface-raised: #ffffff;
    --surface-glass:  rgba(255, 255, 255, 0.85);

    /* Primary Accent — teal-600 (passes WCAG AA on white) */
    --accent:         #0d9488;
    --accent-hover:   #0f766e;
    --accent-muted:   rgba(13, 148, 136, 0.08);
    --accent-border:  rgba(13, 148, 136, 0.25);
    --accent-glow:    0 0 24px rgba(13, 148, 136, 0.12);
    --text-on-accent: #ffffff;

    /* Secondary Accent — amber-600 */
    --gold:           #d97706;
    --gold-muted:     rgba(217, 119, 6, 0.08);

    /* Status — 600-range hues for contrast on white */
    --success:        #059669;
    --success-bg:     rgba(5, 150, 105, 0.08);
    --success-border: rgba(5, 150, 105, 0.22);
    --warning:        #d97706;
    --warning-bg:     rgba(217, 119, 6, 0.08);
    --warning-border: rgba(217, 119, 6, 0.22);
    --error:          #dc2626;
    --error-bg:       rgba(220, 38, 38, 0.06);
    --error-border:   rgba(220, 38, 38, 0.22);
    --info:           #2563eb;
    --info-bg:        rgba(37, 99, 235, 0.06);
    --info-border:    rgba(37, 99, 235, 0.22);

    /* Text — slate hierarchy */
    --text:           #0f172a;
    --text-primary:   #0f172a;
    --text-secondary: #475569;
    --text-tertiary:  #94a3b8;
    --text-accent:    #0d9488;

    /* Borders — thin, crisp */
    --border:         rgba(15, 23, 42, 0.08);
    --border-visible: rgba(15, 23, 42, 0.12);
    --border-hover:   rgba(13, 148, 136, 0.30);

    /* Layout */
    --radius-sm: 6px;
    --radius:    10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    /* Shadows — soft, layered */
    --shadow-sm:   0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow:      0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-lg:   0 12px 30px rgba(15, 23, 42, 0.12), 0 4px 10px rgba(15, 23, 42, 0.06);
    --shadow-glow: 0 0 28px rgba(13, 148, 136, 0.10);

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --duration: 0.2s;
}

/* ── Tokens — Dark override ──────────────────────────────────────────────── */
[data-theme="dark"] {
    --bg-deep:        #020617;
    --bg:             #0b1021;
    --surface:        #111a2e;
    --surface-hover:  #162038;
    --surface-raised: #1a2642;
    --surface-glass:  rgba(17, 26, 46, 0.80);

    --accent:         #2dd4bf;
    --accent-hover:   #5eead4;
    --accent-muted:   rgba(45, 212, 191, 0.10);
    --accent-border:  rgba(45, 212, 191, 0.28);
    --accent-glow:    0 0 24px rgba(45, 212, 191, 0.15);
    --text-on-accent: #0b1021;

    --gold:           #fbbf24;
    --gold-muted:     rgba(251, 191, 36, 0.10);

    --success:        #34d399;
    --success-bg:     rgba(52, 211, 153, 0.10);
    --success-border: rgba(52, 211, 153, 0.28);
    --warning:        #fbbf24;
    --warning-bg:     rgba(251, 191, 36, 0.10);
    --warning-border: rgba(251, 191, 36, 0.28);
    --error:          #f87171;
    --error-bg:       rgba(248, 113, 113, 0.10);
    --error-border:   rgba(248, 113, 113, 0.28);
    --info:           #60a5fa;
    --info-bg:        rgba(96, 165, 250, 0.10);
    --info-border:    rgba(96, 165, 250, 0.28);

    --text:           #e2e8f0;
    --text-primary:   #e2e8f0;
    --text-secondary: #94a3b8;
    --text-tertiary:  #64748b;
    --text-accent:    #2dd4bf;

    --border:         rgba(255, 255, 255, 0.06);
    --border-visible: rgba(255, 255, 255, 0.10);
    --border-hover:   rgba(45, 212, 191, 0.25);

    --shadow-sm:   0 1px 3px rgba(0, 0, 0, 0.35);
    --shadow:      0 4px 12px rgba(0, 0, 0, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.03);
    --shadow-lg:   0 12px 40px rgba(0, 0, 0, 0.45);
    --shadow-glow: 0 0 30px rgba(45, 212, 191, 0.10);
}

:root:not([data-theme="dark"]) .navbar {
    background: rgba(248, 249, 251, 0.92);
}
:root:not([data-theme="dark"]) .navbar.admin-zone {
    border-bottom-color: #c49a20;
    box-shadow: 0 1px 0 #c49a20, 0 0 12px rgba(196, 154, 32, 0.08);
}

:root:not([data-theme="dark"]) .auth-page::before {
    background:
        radial-gradient(ellipse 600px 400px at 20% 30%, rgba(11, 184, 150, 0.06), transparent),
        radial-gradient(ellipse 500px 350px at 80% 70%, rgba(14, 230, 183, 0.04), transparent);
}

:root:not([data-theme="dark"]) .btn-primary {
    background: var(--accent);
    color: #ffffff;
}

:root:not([data-theme="dark"]) .btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

:root:not([data-theme="dark"]) .report-md code {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-accent);
}

:root:not([data-theme="dark"]) .report-md blockquote {
    background: rgba(11, 184, 150, 0.04);
}

:root:not([data-theme="dark"]) .report-md pre {
    background: #f1f5f9;
}

:root:not([data-theme="dark"]) .report-md tr:hover td {
    background: rgba(0, 0, 0, 0.02);
}

:root:not([data-theme="dark"]) .report-md summary:hover {
    background: rgba(0, 0, 0, 0.03);
}

:root:not([data-theme="dark"]) body::before {
    opacity: 0.008;
}

/* ── Theme Toggle ────────────────────────────────────────────────────────── */
.theme-toggle {
    background: none;
    border: 1px solid var(--border-visible);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.3rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    transition: all var(--duration) var(--ease-out);
    flex-shrink: 0;
}

.theme-toggle:hover {
    color: var(--accent);
    border-color: var(--accent-border);
    background: var(--accent-muted);
}

.theme-toggle svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    transition: transform 0.3s var(--ease-out);
}

.theme-toggle:hover svg {
    transform: rotate(15deg);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon { display: none; }

/* Default (light): show moon icon (click → dark). Dark mode: show sun (click → light). */
:root .theme-toggle .icon-moon { display: block; }
:root .theme-toggle .icon-sun  { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ── What's new (release notes) ─────────────────────────────────────────── */
.whats-new-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.whats-new-btn {
    position: relative;
    /* Hidden by default; whats-new.js sets data-ready="true" when user has unseen releases */
    display: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-visible);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    transition: all 0.15s ease;
}
.whats-new-btn:hover {
    color: var(--accent);
    border-color: var(--accent-muted);
    transform: translateY(-1px);
}
.whats-new-btn svg { width: 16px; height: 16px; fill: currentColor; }
.whats-new-dot {
    position: absolute;
    top: 5px; right: 5px;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 2px var(--surface), 0 0 8px var(--accent);
    animation: whatsNewPulse 2.5s ease-in-out infinite;
    display: none;
}
.whats-new-btn[data-ready="true"] { display: inline-flex; }
.whats-new-btn[data-unseen="true"] .whats-new-dot { display: block; }
@keyframes whatsNewPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.55; transform: scale(0.85); }
}
@media (prefers-reduced-motion: reduce) {
    .whats-new-dot { animation: none; }
}

.whats-new-popover {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 360px;
    max-width: calc(100vw - 2rem);
    background: var(--surface);
    border: 1px solid var(--border-visible);
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.02) inset;
    backdrop-filter: blur(20px);
    z-index: 1000;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.whats-new-popover[data-open="true"] {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.whats-new-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    background: linear-gradient(180deg, rgba(14,230,183,0.04), transparent);
}
.whats-new-header h4 {
    font-family: 'Clash Display', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.01em;
}
.whats-new-close {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: color 0.15s, background 0.15s;
}
.whats-new-close:hover { color: var(--text-primary); background: var(--hover); }

.whats-new-body {
    padding: 0.75rem 1rem 1rem;
    max-height: 340px;
    overflow-y: auto;
}
.whats-new-version {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}
.whats-new-date {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    margin-left: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.whats-new-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0.25rem 0 0.625rem;
    line-height: 1.35;
}
.whats-new-highlights {
    list-style: none;
    padding: 0;
    margin: 0 0 0.75rem;
}
.whats-new-highlights li {
    position: relative;
    padding-left: 1rem;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}
.whats-new-highlights li::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 0.5rem;
    width: 5px; height: 5px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.7;
}
.whats-new-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg);
}
.whats-new-footer a {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 500;
    text-decoration: none;
    letter-spacing: 0.02em;
}
.whats-new-footer a:hover { text-decoration: underline; }
.whats-new-footer .btn-sm {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
}

/* Releases archive page */
.releases-page {
    max-width: 760px;
    margin: 2rem auto;
    padding: 0 1rem;
}
.releases-page h1 {
    font-family: 'Clash Display', sans-serif;
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}
.releases-page .subtitle {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: 2.5rem;
}
.release-entry {
    position: relative;
    padding: 1.5rem 0 2rem 1.5rem;
    border-left: 2px solid var(--border-visible);
    margin-left: 0.5rem;
}
.release-entry::before {
    content: "";
    position: absolute;
    left: -6px;
    top: 1.75rem;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--accent);
}
.release-entry.latest::before {
    background: var(--accent);
    box-shadow: 0 0 14px var(--accent);
}
.release-entry .meta {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.5rem;
}
.release-entry .version {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.125rem 0.5rem;
    border: 1px solid var(--accent-muted);
    border-radius: 100px;
}
.release-entry .date {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.release-entry h2 {
    font-family: 'Clash Display', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.75rem;
    line-height: 1.3;
    border: none;
    padding: 0;
}
.release-entry .highlights {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}
.release-entry .highlights li {
    position: relative;
    padding-left: 1.25rem;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}
.release-entry .highlights li::before {
    content: "▸";
    position: absolute;
    left: 0;
    color: var(--accent);
    font-size: 0.75rem;
    top: 0.2rem;
}
.release-entry details {
    margin-top: 0.75rem;
    border-top: 1px dashed var(--border-subtle);
    padding-top: 0.75rem;
}
.release-entry details summary {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.release-entry details summary:hover { color: var(--accent); }
.release-entry details summary::before {
    content: "▸ ";
    display: inline-block;
    transition: transform 0.15s;
}
.release-entry details[open] summary::before { transform: rotate(90deg); }
.release-entry details .body { padding-top: 0.75rem; }

/* ── Report feedback widget ─────────────────────────────────────────────── */
.feedback-cluster {
    position: relative;
    display: inline-flex;
    gap: 0.375rem;
    align-items: center;
}
.feedback-label {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    letter-spacing: 0.01em;
    font-weight: 500;
    margin-right: 0.125rem;
    user-select: none;
}
@media (max-width: 640px) {
    .feedback-label { display: none; }
}
.feedback-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border-visible);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    transition: all 0.15s;
    font-size: 0.95rem;
}
.feedback-btn:hover {
    border-color: var(--accent-muted);
    color: var(--text-primary);
    transform: translateY(-1px);
}
.feedback-btn[data-state="active-up"] {
    background: rgba(14,230,183,0.12);
    border-color: var(--accent);
    color: var(--accent);
}
.feedback-btn[data-state="active-down"] {
    background: rgba(240,96,96,0.12);
    border-color: var(--error);
    color: var(--error);
}
.feedback-btn[data-state="disabled"] {
    opacity: 0.5;
    cursor: not-allowed;
}

.feedback-popover {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 340px;
    max-width: calc(100vw - 2rem);
    background: var(--surface);
    border: 1px solid var(--border-visible);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.45);
    z-index: 900;
    padding: 1rem;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity 0.15s, transform 0.15s;
}
.feedback-popover[data-open="true"] {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.feedback-popover h5 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.625rem;
}
.feedback-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 0.75rem;
}
.feedback-tag {
    display: inline-flex;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg);
    border: 1px solid var(--border-visible);
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.12s;
}
.feedback-tag:hover {
    border-color: var(--accent-muted);
    color: var(--text-primary);
}
.feedback-tag[data-selected="true"] {
    background: var(--accent-muted);
    border-color: var(--accent);
    color: var(--accent);
}
.feedback-popover textarea {
    width: 100%;
    min-height: 70px;
    font-size: 0.8125rem;
    padding: 0.5rem 0.625rem;
    background: var(--bg);
    border: 1px solid var(--border-visible);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    resize: vertical;
    margin-bottom: 0.5rem;
}
.feedback-popover textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-muted);
}
.feedback-popover .actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    font-size: 0.9375rem;
    position: relative;
}

/* Subtle noise texture overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E") repeat;
    opacity: 0.015;
    pointer-events: none;
    z-index: -1;
}

a { color: var(--text-accent); text-decoration: none; transition: color var(--duration); }
a:hover { color: var(--accent-hover); }

::selection {
    background: var(--accent-muted);
    color: var(--text);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ── Layout ──────────────────────────────────────────────────────────────── */
.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* ── Navbar ──────────────────────────────────────────────────────────────── */
.navbar {
    background: rgba(11, 16, 33, 0.88);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    height: 56px;
}

.nav-brand {
    font-family: 'Clash Display', 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-logo {
    width: 28px;
    height: 28px;
    max-width: 28px;
    max-height: 28px;
    flex-shrink: 0;
    object-fit: contain;
}

.nav-brand:hover { color: var(--text); }

.nav-links {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.625rem 0.75rem;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    border-radius: var(--radius-sm);
    transition: all var(--duration) var(--ease-out);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-bottom: 2px solid transparent;
}

.nav-links a:hover {
    color: var(--text);
    background: var(--surface);
}

.nav-links a.active {
    color: var(--text-accent);
    background: var(--accent-muted);
    border-bottom-color: var(--accent);
}

/* Admin zone — subtle visual indicator when in /admin/* pages */
.navbar.admin-zone {
    border-bottom-color: var(--gold);
    box-shadow: 0 1px 0 var(--gold), 0 0 12px rgba(240, 192, 64, 0.08);
}
.navbar.admin-zone .nav-links a.active[data-nav="admin"] {
    color: var(--gold);
    background: var(--gold-muted);
    border-bottom-color: var(--gold);
}

/* ── Hamburger Menu (hidden on desktop) ────────────────────────────────── */
.hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}

.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    margin: 5px 0;
    transition: transform var(--duration) var(--ease-out), opacity var(--duration) var(--ease-out);
    border-radius: 2px;
}

.hamburger.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.open span:nth-child(2) {
    opacity: 0;
}

.hamburger.open span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ── Auth Pages ──────────────────────────────────────────────────────────── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Animated gradient mesh background — teal/navy tones */
.auth-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 600px 400px at 20% 30%, rgba(14, 230, 183, 0.08), transparent),
        radial-gradient(ellipse 500px 350px at 80% 70%, rgba(78, 168, 222, 0.06), transparent),
        radial-gradient(ellipse 400px 300px at 50% 50%, rgba(14, 230, 183, 0.04), transparent);
    animation: meshDrift 20s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes meshDrift {
    0%   { transform: translate(0, 0) scale(1); }
    50%  { transform: translate(-2%, 1%) scale(1.02); }
    100% { transform: translate(1%, -1%) scale(0.99); }
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface-glass);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border: 1px solid var(--border-visible);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    position: relative;
    z-index: 1;
    animation: authEnter 0.5s var(--ease-out) both;
}

@keyframes authEnter {
    from { opacity: 0; transform: translateY(12px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 1.75rem;
}

.auth-brand-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.auth-brand-icon svg,
.auth-brand-icon img {
    width: 40px;
    height: 40px;
}

.auth-brand-text {
    font-family: 'Clash Display', 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text);
    letter-spacing: -0.02em;
}

.auth-header {
    margin-bottom: 1.5rem;
}

.auth-header h1 {
    font-family: 'Clash Display', 'Plus Jakarta Sans', sans-serif;
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    margin-bottom: 0.375rem;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.auth-links {
    text-align: center;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.auth-links a {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    transition: color var(--duration);
}

.auth-links a:hover { color: var(--text-accent); }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 1.125rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
    letter-spacing: 0.01em;
}

.form-group small {
    color: var(--text-tertiary);
    font-size: 0.75rem;
    margin-top: 0.25rem;
    display: block;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-visible);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--text);
    background: var(--bg);
    transition: all var(--duration) var(--ease-out);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-tertiary);
}

.form-group input:hover,
.form-group select:hover {
    border-color: var(--border-hover);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-muted), var(--accent-glow);
    background: var(--surface);
}

.form-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.flex-grow { flex: 1; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    white-space: nowrap;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.375rem 0;
    transition: color var(--duration);
}

.checkbox-label:hover { color: var(--text); }

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5625rem 1.125rem;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--duration) var(--ease-out);
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: 0.005em;
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary {
    background: var(--accent);
    color: var(--text-on-accent);
    border: 1px solid var(--border-visible);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    box-shadow: var(--accent-glow), var(--shadow-sm);
    transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-visible);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: var(--surface);
    border-color: var(--border-hover);
    color: var(--accent);
}

.btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
    min-height: 36px;
}

.btn-full { width: 100%; }

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-tertiary);
    transition: color var(--duration);
    line-height: 1;
    padding: 0.25rem;
}

.btn-close:hover { color: var(--text); }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
#alert-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.8125rem;
    font-weight: 500;
    border: 1px solid;
    animation: alertSlideIn 0.35s var(--ease-out) both;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.alert::before {
    content: '';
    width: 18px;
    height: 18px;
    border-radius: 50%;
    flex-shrink: 0;
    display: block;
}

.alert-error {
    background: var(--error-bg);
    color: var(--error);
    border-color: var(--error-border);
}

.alert-error::before {
    background: radial-gradient(circle, var(--error) 40%, transparent 40%);
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border-color: var(--success-border);
}

.alert-success::before {
    background: radial-gradient(circle, var(--success) 40%, transparent 40%);
}

@keyframes alertSlideIn {
    from { transform: translateX(100%) translateX(1rem); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

.alert-exit {
    animation: alertSlideOut 0.3s var(--ease-out) forwards;
}

@keyframes alertSlideOut {
    to { transform: translateX(100%) translateX(1rem); opacity: 0; }
}

/* ── Dashboard ───────────────────────────────────────────────────────────── */
.dashboard {
    max-width: 860px;
    margin: 0 auto;
}

.scan-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
    transition: border-color var(--duration) var(--ease-out);
}

/* Subtle accent line at top — gradient from teal to transparent */
.scan-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), rgba(14, 230, 183, 0.3), transparent);
}

.scan-section:hover {
    border-color: var(--border-hover);
}

.section-title {
    font-family: 'Clash Display', 'Plus Jakarta Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 1rem;
}

.scan-section h2 {
    font-family: 'Clash Display', 'Plus Jakarta Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 1rem;
}

.scan-form .form-group {
    margin-bottom: 0;
}

.scan-form .form-group input {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.875rem;
    letter-spacing: -0.01em;
}

.history-section {
    margin-bottom: 2rem;
}

.history-section h2 {
    font-family: 'Clash Display', 'Plus Jakarta Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 1rem;
}

/* ── Compact dashboard hero ─────────────────────────────────────── */
/* Desktop: input + Scan on one row, options visible inline below.    */
/* Mobile: same hero row; options hidden behind "⋯ more options".      */
.scan-hero-row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}
.scan-hero-row input[type="text"] {
    flex: 1;
    min-width: 0;
}
.scan-hero-row .btn { flex-shrink: 0; }
.scan-more-btn { display: none; }
.scan-more {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

@media (max-width: 768px) {
    .scan-more-btn {
        display: inline-block;
        background: transparent;
        border: none;
        color: var(--text-secondary);
        font-size: 0.8rem;
        cursor: pointer;
        padding: 0.45rem 0;
        margin-top: 0.4rem;
        font-family: inherit;
    }
    .scan-more-btn:hover { color: var(--accent); }
    .scan-more {
        display: none;
        margin-top: 0.25rem;
    }
    .scan-more.open {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        padding: 0.75rem;
        background: var(--bg);
        border: 1px solid var(--border);
        border-radius: 8px;
    }
    .scan-section {
        padding: 0.9rem 1rem !important;
        margin-bottom: 0.75rem !important;
    }
    .scan-section h2,
    .history-section h2 {
        font-size: 0.75rem;
        margin-bottom: 0.6rem;
    }
    .history-section { margin-bottom: 1rem; }
}

.scans-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.scan-item-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.scan-item-row .scan-item {
    flex: 1;
}

/* Team filter dropdown */
.team-filter-menu { position:absolute; right:0; top:calc(100% + 4px); z-index:50;
    background:var(--surface-raised); border:1px solid var(--border-visible); border-radius:var(--radius);
    min-width:240px; max-height:320px; overflow-y:auto; box-shadow:var(--shadow-lg); }
.team-filter-options label { display:flex; align-items:center; gap:0.5rem;
    padding:0.35rem 0.75rem; cursor:pointer; font-size:0.85rem; }
.team-filter-options label:hover { background:var(--surface-hover); }

/* Filter pills */
.filter-pill {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.3rem 0.8rem;
    border-radius: 24px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all var(--duration) var(--ease-out);
}

.filter-pill:hover {
    border-color: var(--accent-border);
    color: var(--accent);
}

.filter-pill.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--text-on-accent);
    font-weight: 600;
}

.filter-pills {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.scan-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    transition: all var(--duration) var(--ease-out);
}

.scan-item:hover {
    background: var(--surface-hover);
    border-color: var(--border-hover);
    transform: translateX(3px);
    box-shadow: var(--shadow-glow);
}

.scan-domain {
    font-weight: 600;
    font-size: 0.875rem;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: -0.01em;
    color: var(--text);
}

.scan-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.75rem;
}

.scan-date {
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
}

.btn-delete {
    background: none;
    border: 1px solid transparent;
    color: var(--text-tertiary);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: all var(--duration);
    flex-shrink: 0;
    opacity: 0;
}

.scan-item-row:hover .btn-delete {
    opacity: 1;
}

.btn-delete:hover {
    color: var(--error);
    border-color: var(--error-border);
    background: var(--error-bg);
    opacity: 1;
}

/* ── Status Badges ───────────────────────────────────────────────────────── */
.status {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.175rem 0.625rem;
    border-radius: 100px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid;
}

.status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: block;
}

.status-pending {
    background: var(--warning-bg);
    color: var(--warning);
    border-color: var(--warning-border);
}
.status-pending::before { background: var(--warning); }

.status-running {
    background: var(--info-bg);
    color: var(--info);
    border-color: var(--info-border);
}
.status-running::before {
    background: var(--info);
    animation: statusPulse 1.5s ease-in-out infinite;
}

.status-completed {
    background: var(--success-bg);
    color: var(--success);
    border-color: var(--success-border);
}
.status-completed::before { background: var(--success); }

.status-failed {
    background: var(--error-bg);
    color: var(--error);
    border-color: var(--error-border);
}
.status-failed::before { background: var(--error); }

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 100px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-admin { background: rgba(78, 168, 222, 0.12); color: #4ea8de; }
.badge-analyst { background: var(--info-bg); color: var(--info); }
.badge-active { background: var(--success-bg); color: var(--success); }
.badge-inactive { background: rgba(90, 102, 128, 0.12); color: var(--text-tertiary); }

/* ── Scan Result ─────────────────────────────────────────────────────────── */
.scan-result {
    max-width: 920px;
    margin: 0 auto;
}

.scan-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
}

.scan-domain-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

/* ── Floating Action Bar ─────────────────────────────────────────────────── */
.floating-actions {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface-glass);
    border: 1px solid var(--border-visible);
    border-radius: 14px;
    padding: 0.4rem 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
}

.fab-btn {
    background: none;
    border: 1px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.4rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration) var(--ease-out);
}

.fab-btn:hover {
    color: var(--accent);
    background: var(--accent-muted);
    border-color: var(--accent-border);
}

.fab-btn svg {
    flex-shrink: 0;
}

.fab-select {
    background: var(--bg);
    border: 1px solid var(--border-visible);
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-family: inherit;
    padding: 0.3rem 0.4rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    max-width: 90px;
    transition: all var(--duration);
}

.fab-select:focus {
    outline: none;
    border-color: var(--accent);
    color: var(--text);
}

.fab-separator {
    width: 1px;
    height: 20px;
    background: var(--border-visible);
    margin: 0 0.15rem;
    flex-shrink: 0;
}

.fab-secondary {
    display: inline-flex;
    gap: 0.3rem;
    align-items: center;
}
.fab-show-mobile { display: none; }
.fab-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-out;
    z-index: 90;
}
.fab-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

/* ── Report section jumper (floating side rail) ─────────────────── */
/* Desktop: labeled rail on right, vertically centered.               */
/* Mobile: minimal dots at right edge + floating label bubble for active. */
.section-jumper {
    position: fixed;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.2rem;
    padding: 0.45rem 0.5rem;
    background: var(--surface-glass);
    border: 1px solid var(--border-visible);
    border-radius: 14px;
    box-shadow: 0 6px 22px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(12px) saturate(160%);
    -webkit-backdrop-filter: blur(12px) saturate(160%);
    z-index: 30;
    max-height: calc(100vh - 10rem);
    overflow-y: auto;
    scrollbar-width: none;
}
.section-jumper::-webkit-scrollbar { display: none; }
.section-jumper:empty { display: none; }

.jumper-chip {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.35rem 0.7rem 0.35rem 0.5rem;
    font-size: 0.78rem;
    font-weight: 500;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-secondary);
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    position: relative;
}
.jumper-chip::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-tertiary);
    flex-shrink: 0;
    transition: background 0.15s, transform 0.15s;
}
.jumper-chip:hover {
    background: var(--bg);
    color: var(--text);
}
.jumper-chip.active {
    background: var(--accent-muted);
    color: var(--accent);
}
.jumper-chip.active::before {
    background: var(--accent);
    transform: scale(1.25);
}

@media (max-width: 768px) {
    /* Container = continuous scrubber column; drag over dots to fast-scroll the page. */
    .section-jumper {
        right: 0.5rem;
        padding: 0.2rem 0.35rem;
        gap: 0.15rem;
        background: transparent;
        border: none;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        /* container captures touches for scrubber; chips are the only hit points */
        touch-action: none;  /* browser won't try to scroll when finger is on the rail */
    }
    .jumper-chip {
        padding: 0.45rem 0.35rem;  /* big touch target for drag scrub */
        gap: 0;
        font-size: 0;
        color: transparent;
        background: transparent;
        border-radius: 50%;
        -webkit-touch-callout: none;  /* no iOS link-preview on long-press */
        -webkit-user-select: none;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
    .jumper-chip::before {
        width: 8px;
        height: 8px;
        /* halo around dot so it stays visible on any content background */
        box-shadow:
            0 0 0 3px var(--surface),
            0 0 0 4px var(--border);
    }
    .jumper-chip.active {
        background: transparent;
    }
    .jumper-chip.active::before {
        background: var(--accent);
        box-shadow:
            0 0 0 3px var(--surface),
            0 0 0 4px var(--accent-border);
        transform: scale(1.3);
    }
    /* Active chip: floating label bubble to the LEFT of the dot */
    .jumper-chip.active::after {
        content: attr(data-label-text);
        order: -1;
        margin-right: 0.55rem;
        background: var(--surface);
        color: var(--accent);
        font-size: 0.7rem;
        font-weight: 600;
        padding: 0.3rem 0.65rem;
        border-radius: 12px;
        white-space: nowrap;
        box-shadow: 0 2px 12px rgba(15, 23, 42, 0.12);
        border: 1px solid var(--accent-border);
    }
    /* Rail is minimal — only small reserve for dot halo */
    .scan-result #report-content,
    .scan-result #report-container > h1:first-child,
    .scan-result .scan-section {
        padding-right: 1rem;
    }

    /* Mobile: full-width bar docked to the bottom, everything inline */
    .floating-actions {
        bottom: 0;
        left: 0;
        right: 0;
        transform: none;
        border-radius: 14px 14px 0 0;
        border-bottom: none;
        padding: 0.4rem 0.35rem calc(0.4rem + env(safe-area-inset-bottom)) 0.35rem;
        gap: 0.15rem;
        justify-content: space-between;
        box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
    }
    .floating-actions .fab-btn {
        padding: 0.35rem;
    }
    .fab-show-mobile { display: none; }
    .fab-sep-hide-mobile { display: none; }
    .fab-secondary {
        display: inline-flex;
        position: static;
        visibility: visible;
        bottom: auto;
        left: auto;
        right: auto;
        flex-direction: row;
        align-items: center;
        gap: 0.25rem;
        flex: 1;
        min-width: 0;
        justify-content: center;
        background: transparent;
        box-shadow: none;
        padding: 0;
        border-radius: 0;
    }
    .fab-secondary::before { display: none; }
    .fab-secondary .fab-select {
        max-width: none;
        font-size: 0.7rem;
        padding: 0.3rem 0.2rem;
        min-width: 0;
        flex: 1 1 auto;
        -webkit-appearance: none;
        appearance: none;
        background-image: none;
        text-overflow: ellipsis;
    }
    .fab-backdrop { display: none; }

    /* ── Report markdown tables → card-per-row on mobile ─────────────── */
    #report-content .table-wrapper,
    .report-md .table-wrapper {
        overflow-x: visible;
    }
    #report-content table,
    .report-md table {
        border: 0;
        background: transparent;
        display: block;
        min-width: 0;
        width: 100%;
    }
    #report-content thead,
    .report-md thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
    }
    #report-content tbody,
    .report-md tbody {
        display: block;
    }
    #report-content tbody tr,
    .report-md tbody tr {
        display: block;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 10px;
        padding: 0.6rem 0.85rem;
        margin-bottom: 0.6rem;
    }
    #report-content tbody td,
    .report-md tbody td {
        display: block;
        padding: 0.3rem 0 !important;
        border: 0 !important;
        font-size: 0.85rem;
        word-break: break-word;
        overflow-wrap: break-word;
        white-space: normal;
    }
    /* We don't know column headers (markdown-generated) — compute via JS */
    #report-content tbody td[data-th]::before,
    .report-md tbody td[data-th]::before {
        display: block;
        content: attr(data-th);
        font-weight: 600;
        color: var(--text-secondary);
        font-size: 0.68rem;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        margin-bottom: 0.2rem;
    }
}

.report-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

/* ── Loading / Spinner ───────────────────────────────────────────────────── */
.scan-loading-container {
    text-align: center;
    padding: 4rem 2rem;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--border-visible);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1.5rem;
}

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

#scan-progress-text,
.scan-progress-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.text-center { text-align: center; }
.text-muted  { color: var(--text-secondary); }
.text-error  { color: var(--error); }

/* ── Report Markdown ─────────────────────────────────────────────────────── */
.report-md {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 2rem 2.5rem;
    border-radius: var(--radius-lg);
    overflow-x: auto;
    font-size: 0.95rem;
    line-height: 1.75;
    color: var(--text);
}

.report-md h1 {
    font-family: 'Clash Display', 'Plus Jakarta Sans', sans-serif;
    font-size: 1.6rem;
    font-weight: 600;
    margin: 2rem 0 1rem;
    padding-bottom: 0.625rem;
    border-bottom: 2px solid transparent;
    border-image: linear-gradient(90deg, var(--accent), rgba(14, 230, 183, 0.2), transparent) 1;
    letter-spacing: -0.02em;
    color: var(--text);
}

.report-md h1:first-child { margin-top: 0; }

.report-md h2 {
    font-family: 'Clash Display', 'Plus Jakarta Sans', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 2.5rem 0 0.75rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--border);
    color: var(--text-accent);
    letter-spacing: -0.02em;
}

.report-md h2:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.report-md h3 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    margin: 1.5rem 0 0.5rem;
    color: var(--text);
}

.report-md h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 1rem 0 0.375rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.report-md p { margin-bottom: 0.75rem; }

.report-md ul, .report-md ol {
    padding-left: 1.5rem;
    margin-bottom: 0.75rem;
}

.report-md li {
    margin-bottom: 0.25rem;
    color: var(--text);
}

.report-md li::marker {
    color: var(--text-tertiary);
}

.report-md strong { color: var(--text); font-weight: 600; }
.report-md em { color: var(--text-secondary); }

.report-md code {
    font-family: 'JetBrains Mono', monospace;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.8125rem;
    color: var(--text-accent);
}

.report-md pre {
    background: var(--bg-deep);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    overflow-x: auto;
    margin: 0.75rem 0;
    position: relative;
}

/* Subtle teal top-left line on code blocks */
.report-md pre::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, var(--accent), transparent);
    border-radius: 3px 0 0 3px;
}

.report-md pre code {
    background: none;
    border: none;
    padding: 0;
    color: var(--text);
    font-size: 0.8125rem;
}

.report-md blockquote {
    border-left: 3px solid var(--accent);
    padding: 0.5rem 0 0.5rem 1rem;
    color: var(--text-secondary);
    margin: 0.75rem 0;
    background: var(--accent-muted);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.report-md hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}

.report-md a {
    color: var(--text-accent);
    text-decoration: underline;
    text-decoration-color: var(--accent-border);
    text-underline-offset: 2px;
}

.report-md a:hover {
    color: var(--accent-hover);
    text-decoration-color: var(--accent-hover);
}

/* Report tables */
.report-md .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 1rem 0;
    border-radius: var(--radius);
}

.report-md table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
    font-size: 0.8125rem;
    border: 1px solid var(--border-visible);
    border-radius: var(--radius);
    overflow: hidden;
    min-width: 500px;
}

.report-md th {
    background: var(--surface-raised);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    padding: 0.625rem 0.875rem;
    text-align: left;
    border-bottom: 2px solid var(--accent-muted);
}

.report-md td {
    padding: 0.5rem 0.875rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: top;
}

.report-md tr:last-child td { border-bottom: none; }

.report-md tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.01);
}

.report-md tr:hover td {
    background: var(--surface-hover);
}

/* Collapsible details in report */
.report-md details {
    margin: 0.75rem 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color var(--duration);
}

.report-md details:hover {
    border-color: var(--border-hover);
}

.report-md summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-accent);
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.02);
    transition: background var(--duration);
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.report-md summary::-webkit-details-marker { display: none; }
.report-md summary::marker { display: none; content: ''; }

.report-md summary::before {
    content: '';
    width: 0;
    height: 0;
    border-left: 5px solid var(--text-tertiary);
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    transition: transform var(--duration) var(--ease-out);
    flex-shrink: 0;
}

.report-md details[open] summary::before {
    transform: rotate(90deg);
}

.report-md summary:hover { background: rgba(14, 230, 183, 0.04); }

.report-md details > *:not(summary) {
    padding: 0 1rem;
}

.report-md details > *:not(summary):last-child {
    padding-bottom: 1rem;
}

/* ── Admin Panel ─────────────────────────────────────────────────────────── */
.admin-panel {
    max-width: 1000px;
    margin: 0 auto;
}

/* ── Admin subnav — horizontal bar with 5 logical groups ───────────── */
.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 1.25rem;
    align-items: center;
}

.admin-nav-scroll {
    display: contents;
}

.admin-nav-back {
    opacity: 0.7;
    margin-right: 0.4rem;
}

.admin-nav-group {
    display: inline-flex;
    gap: 0.3rem;
    flex-wrap: wrap;
    padding-right: 0.6rem;
    border-right: 1px solid var(--border);
}

.admin-nav-group:last-child {
    border-right: none;
    padding-right: 0;
}

@media (max-width: 768px) {
    .admin-nav {
        flex-wrap: nowrap;
        align-items: center;
        gap: 0.4rem;
    }
    .admin-nav-back {
        flex-shrink: 0;
        opacity: 1;
        margin-right: 0;
    }
    .admin-nav-scroll {
        display: flex;
        flex-wrap: nowrap;
        flex: 1;
        min-width: 0;
        gap: 0.45rem;
        align-items: center;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .admin-nav-scroll::-webkit-scrollbar { display: none; }
    .admin-nav-group {
        flex-wrap: nowrap;
        flex-shrink: 0;
    }
    .admin-nav-group .btn {
        flex-shrink: 0;
        scroll-snap-align: start;
    }
}

/* ── Kebab actions ──────────────────────────────────────────────── */
/* Desktop default: renders as inline button row (zero-regression).   */
/* Mobile (<768px): collapses to kebab dropdown. Same HTML everywhere. */
.kebab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.kebab-btn {
    display: none;  /* hidden on desktop — inline buttons shown instead */
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-visible);
    background: var(--surface);
    border-radius: 8px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    line-height: 1;
    color: var(--text-secondary);
    padding: 0;
}
.kebab-btn:hover {
    background: var(--bg);
    color: var(--text);
    border-color: var(--border-hover);
}
.kebab-menu {
    display: inline-flex;
    gap: 0.4rem;
    align-items: center;
}
.kebab-menu button {
    background: var(--surface);
    border: 1px solid var(--border-visible);
    color: var(--text-secondary);
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}
.kebab-menu button:hover {
    background: var(--bg);
    border-color: var(--border-hover);
    color: var(--text);
}
.kebab-menu .kebab-divider { display: none; }
.kebab-menu .kebab-danger {
    background: var(--error, #dc2626);
    color: #fff;
    border-color: var(--error, #dc2626);
    font-weight: 600;
}
.kebab-menu .kebab-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
    color: #fff;
}

@media (max-width: 768px) {
    .kebab { display: inline-block; }
    .kebab-btn { display: inline-flex; }
    .kebab-menu {
        display: none;
        position: absolute;
        top: calc(100% + 4px);
        right: 0;
        min-width: 160px;
        background: var(--surface);
        border: 1px solid var(--border-visible);
        border-radius: 10px;
        box-shadow: 0 8px 24px rgba(15, 23, 42, 0.10);
        padding: 4px;
        z-index: 50;
        flex-direction: column;
        gap: 0;
    }
    .kebab.open .kebab-menu { display: flex; }
    .kebab-menu button {
        display: block;
        width: 100%;
        text-align: left;
        background: transparent;
        border: none;
        padding: 9px 12px;
        font-size: 0.85rem;
        color: var(--text);
        border-radius: 6px;
        white-space: normal;
    }
    .kebab-menu button:hover { background: var(--bg); border: none; }
    .kebab-menu .kebab-divider {
        display: block;
        height: 1px;
        background: var(--border);
        margin: 4px 2px;
        border: none;
        padding: 0;
    }
    .kebab-menu .kebab-danger {
        margin-top: 2px;
    }
}

/* ── Responsive admin tables — card-per-row on mobile ───────────── */
/* Opt-in via class="admin-table" on the wrapper; desktop unchanged.  */
@media (max-width: 768px) {
    .admin-table {
        overflow-x: visible !important;
    }
    .admin-table > table,
    .admin-table .table {
        border: 0;
        background: transparent;
        border-radius: 0;
        overflow: visible;
    }
    .admin-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        white-space: nowrap;
    }
    .admin-table tbody tr {
        display: block;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 10px;
        margin-bottom: 0.75rem;
        padding: 0.5rem 0.9rem;
    }
    .admin-table tbody tr:hover td { background: transparent; }
    .admin-table tbody tr:nth-child(even) td { background: transparent; }
    .admin-table td {
        display: block;
        padding: 0.35rem 0 !important;
        border: 0 !important;
        font-size: 0.85rem;
        text-align: left;
        word-break: break-word;
    }
    .admin-table td::before {
        display: block;
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        font-size: 0.68rem;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        margin-bottom: 0.2rem;
    }
    .admin-table td[data-label=""]::before,
    .admin-table td:not([data-label])::before {
        display: none;
    }
    .admin-table td.actions,
    .admin-table td[data-label="Actions"] {
        display: flex;
        justify-content: flex-end;
        border-top: 1px solid var(--border) !important;
        margin-top: 0.5rem;
        padding-top: 0.6rem !important;
    }
    .admin-table td.actions::before,
    .admin-table td[data-label="Actions"]::before {
        display: none;
    }
    /* Override hide-mobile inside admin-table so all fields show in card mode */
    .admin-table .hide-mobile {
        display: block !important;
    }
    .admin-table td.actions.hide-mobile,
    .admin-table td[data-label="Actions"].hide-mobile {
        display: flex !important;
    }
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.admin-header h2 {
    font-family: 'Clash Display', 'Plus Jakarta Sans', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.search-bar {
    margin-bottom: 1rem;
}

.search-bar input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-visible);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--text);
    background: var(--bg);
    transition: all var(--duration);
}

.search-bar input::placeholder { color: var(--text-tertiary); }

.search-bar input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-muted);
}

/* ── Table ────────────────────────────────────────────────────────────────── */
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.table th,
.table td {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.8125rem;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--surface-raised);
    font-weight: 600;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    border-bottom: 2px solid var(--accent-muted);
}

.table tr:last-child td { border-bottom: none; }

.table tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.01);
}

.table tr:hover td { background: var(--surface-hover); }

.table .actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Compact table — denser rows, no outer card. Used by admin dashboard
   for log-like tables (error list, users, anomalies). */
.user-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.75rem;
    font-size: 0.85rem;
}
.user-table th,
.user-table td {
    padding: 0.55rem 0.7rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.user-table th {
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
}
.user-table tr:hover td { background: var(--surface-hover); }

.role-select {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-visible);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-family: inherit;
    color: var(--text);
    background: var(--bg);
    cursor: pointer;
}

.role-select:focus {
    outline: none;
    border-color: var(--accent);
}

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(6, 9, 17, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: modalFadeIn 0.2s var(--ease-out);
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal-content {
    background: var(--surface);
    border: 1px solid var(--border-visible);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    width: 100%;
    max-width: 460px;
    box-shadow: var(--shadow-lg);
    animation: modalSlideUp 0.3s var(--ease-out);
}

@keyframes modalSlideUp {
    from { transform: translateY(12px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.modal-header h3 {
    font-family: 'Clash Display', 'Plus Jakarta Sans', sans-serif;
    font-size: 1.125rem;
    font-weight: 700;
}

/* ── Pagination ──────────────────────────────────────────────────────────── */
.pagination {
    display: flex;
    gap: 0.25rem;
    justify-content: center;
    margin-top: 1.25rem;
}

/* ── Scan Filters ────────────────────────────────────────────────────────── */
.scan-filters {
    margin-bottom: 1rem;
}

.scan-filters .form-group input {
    background: var(--bg);
}

.scan-filters .role-select {
    background: var(--bg);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.8125rem;
}

.scan-filters-bar {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.scan-filters-search {
    flex: 1;
    min-width: 0;
}
.scan-filters-search input {
    width: 100%;
}
.scan-filters-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.filter-pills {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

@media (max-width: 768px) {
    .scan-filters-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.4rem;
    }
    .scan-filters-controls {
        display: flex;
        gap: 0.4rem;
        align-items: center;
    }
    .scan-filters-controls .role-select {
        flex: 1;
        min-width: 0;
    }
    .scan-filters-controls .team-filter {
        flex: 1;
    }
    .scan-filters-controls .team-filter .btn {
        width: 100%;
    }
    .filter-pills {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        margin-top: 0.5rem;
    }
    .filter-pills::-webkit-scrollbar { display: none; }
    .filter-pills .filter-pill { flex-shrink: 0; }
}

/* ── Module Status ───────────────────────────────────────────────────────── */
.module-status-bar {
    max-width: 800px;
    margin: 1rem auto;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
}

.module-status-bar h4 {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    font-family: 'Clash Display', 'Plus Jakarta Sans', sans-serif;
    font-weight: 600;
    color: var(--text);
}

.mod-status-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    border-radius: var(--radius-sm);
    transition: background var(--duration);
}

.mod-status-row:hover {
    background: var(--surface-hover);
}

.mod-status-row .mod-icon {
    width: 1.2em;
    text-align: center;
    flex-shrink: 0;
}

.mod-status-row .mod-detail {
    color: var(--text-tertiary);
    font-size: 0.8rem;
}

.btn-retry {
    background: var(--warning);
    color: var(--bg);
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all var(--duration) var(--ease-out);
}

.btn-retry:hover {
    background: #d4a520;
    box-shadow: 0 4px 12px rgba(240, 192, 64, 0.2);
}

.btn-retry:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Signal Excerpt Cards (Buying Signals) ───────────────────────────────── */
.signal-excerpt {
    position: relative;
    border-radius: var(--radius);
    padding: 0.85rem 1rem 0.75rem;
    margin: 0.5rem 0;
    transition: all 0.3s var(--ease-out);
}

/* ── AI Analysis — clean, branded, "generated" feel ──────────────────── */
.signal-enriched {
    border: 1px solid var(--accent-border);
    border-left: 3px solid var(--accent);
    background: linear-gradient(135deg, rgba(14, 230, 183, 0.06) 0%, rgba(78, 168, 222, 0.03) 100%);
    box-shadow: inset 0 1px 0 rgba(14, 230, 183, 0.06);
}

.signal-enriched:hover {
    background: linear-gradient(135deg, rgba(14, 230, 183, 0.09) 0%, rgba(78, 168, 222, 0.05) 100%);
    border-color: var(--accent);
}

.signal-enriched .signal-label {
    color: var(--accent);
    background: rgba(14, 230, 183, 0.10);
    border: 1px solid rgba(14, 230, 183, 0.15);
}

.signal-enriched .signal-text {
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--text);
}

/* ── Source Extract — verbatim "clipping" feel ────────────────────────── */
.signal-raw {
    border: 1px dashed rgba(240, 192, 64, 0.25);
    border-left: 3px solid var(--gold);
    background: rgba(240, 192, 64, 0.04);
    padding-left: 2.2rem;
}

.signal-raw::before {
    content: '\201C';
    position: absolute;
    top: 0.2rem;
    left: 0.55rem;
    font-size: 2.2rem;
    line-height: 1;
    font-family: Georgia, 'Times New Roman', serif;
    color: rgba(240, 192, 64, 0.35);
    pointer-events: none;
}

.signal-raw:hover {
    background: rgba(240, 192, 64, 0.06);
    border-color: rgba(240, 192, 64, 0.35);
}

.signal-raw .signal-label {
    color: var(--gold);
    background: rgba(240, 192, 64, 0.08);
    border: 1px solid rgba(240, 192, 64, 0.15);
}

.signal-raw .signal-text {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 0.84rem;
    line-height: 1.6;
    color: var(--text-secondary);
    font-style: italic;
}

/* ── Inner content types (enriched cards) ────────────────────────────── */
/* Document quote — verbatim from PDF/source */
.signal-doc-quote {
    font-family: Georgia, 'Times New Roman', serif;
    font-style: italic;
    font-size: 0.83rem;
    line-height: 1.55;
    color: var(--text-primary);
    border-left: 3px solid var(--gold);
    padding: 0.5rem 0.8rem;
    margin: 0.35rem 0;
    background: rgba(240, 192, 64, 0.08);
    border-radius: 0 4px 4px 0;
}

/* AI analysis line — LLM-generated insight */
.signal-ai-line {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--accent);
    padding: 0.25rem 0;
    margin: 0.15rem 0;
}

.signal-ai-line svg {
    flex-shrink: 0;
    margin-top: 0.2em;
    opacity: 0.7;
}

/* Page reference header */
.signal-page-ref {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 0.5rem;
    padding-top: 0.35rem;
    border-top: 1px solid var(--border);
}

.signal-page-ref:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

/* Source reference */
.signal-source-ref {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    margin-bottom: 0.4rem;
}

.signal-source-ref a {
    color: var(--text-secondary);
    text-decoration: underline;
    text-decoration-color: var(--border-visible);
}

/* ── Light theme — inner content ──────────────────────────────────────── */
:root:not([data-theme="dark"]) .signal-doc-quote {
    background: rgba(212, 165, 32, 0.07);
    border-left-color: var(--gold);
    color: var(--text-primary);
}

:root:not([data-theme="dark"]) .signal-ai-line {
    color: var(--accent);
}

/* Label — shared */
.signal-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-style: normal;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 0.5rem;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
}

.signal-label svg { flex-shrink: 0; }

/* Content — shared */
.signal-text p { margin-bottom: 0.35rem; }
.signal-text p:last-child { margin-bottom: 0; }

/* Truncation */
.signal-truncated .signal-text { max-height: 4.2em; overflow: hidden; }
.signal-expanded .signal-text { max-height: none; }

/* Fade overlay */
.signal-fade { display: none; }

.signal-truncated .signal-fade {
    display: block;
    position: absolute;
    bottom: 2rem;
    left: 0;
    right: 0;
    height: 2.5em;
    pointer-events: none;
}

.signal-enriched.signal-truncated .signal-fade {
    background: linear-gradient(transparent, rgba(14, 230, 183, 0.03) 50%, rgba(14, 230, 183, 0.06));
}

.signal-raw.signal-truncated .signal-fade {
    background: linear-gradient(transparent, rgba(240, 192, 64, 0.02) 50%, rgba(240, 192, 64, 0.04));
}

.signal-expanded .signal-fade { display: none; }

/* Toggle button */
.signal-toggle {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: none;
    border: none;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-style: normal;
    cursor: pointer;
    padding: 0.35rem 0;
    margin-top: 0.25rem;
    transition: color var(--duration);
}

.signal-enriched .signal-toggle { color: var(--text-accent); }
.signal-enriched .signal-toggle:hover { color: var(--accent-hover); }
.signal-raw .signal-toggle { color: var(--gold); }
.signal-raw .signal-toggle:hover { color: #d4a520; }
.signal-toggle svg { transition: transform 0.2s var(--ease-out); }

/* ── Light Theme — Signal Cards ─────────────────────────────────────────── */
:root:not([data-theme="dark"]) .signal-enriched {
    background: linear-gradient(135deg, rgba(11, 184, 150, 0.05) 0%, rgba(37, 99, 235, 0.02) 100%);
    border-color: rgba(11, 184, 150, 0.20);
}
:root:not([data-theme="dark"]) .signal-enriched:hover {
    background: linear-gradient(135deg, rgba(11, 184, 150, 0.08) 0%, rgba(37, 99, 235, 0.03) 100%);
}
:root:not([data-theme="dark"]) .signal-enriched .signal-label {
    background: rgba(11, 184, 150, 0.08);
    border-color: rgba(11, 184, 150, 0.15);
}
:root:not([data-theme="dark"]) .signal-raw {
    background: rgba(212, 165, 32, 0.04);
    border-color: rgba(212, 165, 32, 0.20);
}
:root:not([data-theme="dark"]) .signal-raw:hover {
    background: rgba(212, 165, 32, 0.06);
}
:root:not([data-theme="dark"]) .signal-raw::before {
    color: rgba(212, 165, 32, 0.30);
}
:root:not([data-theme="dark"]) .signal-raw .signal-label {
    background: rgba(212, 165, 32, 0.08);
    border-color: rgba(212, 165, 32, 0.15);
}
:root:not([data-theme="dark"]) .signal-enriched.signal-truncated .signal-fade {
    background: linear-gradient(transparent, rgba(11, 184, 150, 0.03) 50%, rgba(11, 184, 150, 0.05));
}
:root:not([data-theme="dark"]) .signal-raw.signal-truncated .signal-fade {
    background: linear-gradient(transparent, rgba(212, 165, 32, 0.02) 50%, rgba(212, 165, 32, 0.04));
}

/* ── Print — Signal Cards ───────────────────────────────────────────────── */
@media print {
    .signal-enriched { border: 1px solid #0a6b5a; border-left-width: 3px; padding: 0.5rem; background: #f0faf7; }
    .signal-raw { border: 1px dashed #c4a030; border-left: 3px solid #c4a030; padding: 0.5rem 0.5rem 0.5rem 2rem; background: #fffdf5; }
    .signal-raw::before { color: #c4a030; }
    .signal-truncated .signal-text { max-height: none; overflow: visible; }
    .signal-fade, .signal-toggle { display: none !important; }
}

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(14, 230, 183, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(14, 230, 183, 0.4);
}

/* ── General Animations ──────────────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Print Styles ────────────────────────────────────────────────────────── */
@media print {
    .navbar, .report-actions, #scan-status, #alert-container,
    #scan-loading, #scan-error, #clipboard-fallback,
    .module-status-bar, #module-status-section,
    #outreach-container, .floating-actions,
    .plays-section { display: none !important; }

    body { background: white; color: #1a1a1a; font-size: 11pt; }
    body::before { display: none; }
    .scan-result { max-width: 100%; margin: 0; }
    .report-md {
        box-shadow: none;
        border: none;
        padding: 0;
        background: white;
    }
    .report-md h1 { font-size: 18pt; color: #1a1a1a; border-image: none; border-color: #ddd; }
    .report-md h2 { font-size: 14pt; color: #0a6b5a; }
    .report-md h3 { font-size: 12pt; color: #333; }
    .report-md th { background: #f5f5f5; color: #333; }
    .report-md td { color: #333; }
    .report-md table { border-color: #ddd; }
    .report-md th, .report-md td { border-color: #ddd; }
    .report-md code { border-color: #ddd; color: #0a6b5a; background: #f5f5f5; }
    .report-md pre::before { display: none; }
    .report-md blockquote { color: #555; border-color: #0a6b5a; background: #f0faf7; }
    .report-md a { color: #333; text-decoration: none; }
    .report-md details { display: block; border: none; }
    .report-md details > summary { display: none; }
    .report-md details > *:not(summary) { display: block; padding: 0; }
    a { color: #333; text-decoration: none; }
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

/* Tablet breakpoint */
@media (max-width: 768px) {
    .admin-panel { padding: 0 0.5rem; }
    .modal-content { max-width: calc(100vw - 2rem) !important; margin: 1rem; }
    .hide-tablet { display: none !important; }
    /* Scrollbar: wider for touch */
    ::-webkit-scrollbar { width: 10px; height: 10px; }
}

@media (max-width: 640px) {
    .container { padding: 0.75rem; }
    .navbar { padding: 0 0.75rem; height: 48px; }
    .nav-brand { font-size: 0.95rem; }

    /* Hamburger visible on mobile */
    .hamburger { display: block; }

    /* Mobile dropdown nav */
    .nav-links {
        display: none;
        position: fixed;
        top: 48px;
        left: 0;
        right: 0;
        background: var(--surface);
        border-bottom: 1px solid var(--border-visible);
        flex-direction: column;
        padding: 0.75rem 1rem;
        gap: 0.25rem;
        box-shadow: var(--shadow-lg);
        z-index: 1000;
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links a {
        padding: 0.625rem 0.75rem;
        font-size: 0.875rem;
        border-radius: var(--radius-sm);
        width: 100%;
        letter-spacing: 0.02em;
    }

    .nav-links a:hover {
        background: var(--surface-hover);
    }

    .nav-links .theme-toggle {
        align-self: flex-start;
        margin-top: 0.25rem;
    }

    .auth-card { margin: 1rem 0.75rem; padding: 1.5rem; }
    .form-row { flex-direction: column; align-items: stretch; }
    .scan-item { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .scan-meta { width: 100%; justify-content: space-between; }
    .table { font-size: 0.75rem; overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-sm); }
    .table th, .table td { padding: 0.5rem 0.625rem; }
    .table .actions { flex-wrap: wrap; gap: 0.25rem; }
    .report-md { padding: 1.25rem; border-radius: var(--radius); }
    .report-actions { flex-wrap: wrap; }
    .modal-content { margin: 0.75rem; max-width: calc(100vw - 1.5rem) !important; }
    .hide-mobile { display: none !important; }
    .scan-section { padding: 1.25rem; border-radius: var(--radius); }
    .btn-delete { opacity: 1; }
    .filter-pill { font-size: 0.7rem; padding: 0.25rem 0.6rem; }
    .btn-sm { min-height: 44px; display: inline-flex; align-items: center; }
}

/* ── Mobile: iPhone Pro (393px) and similar ─────────────────────────────── */
@media (max-width: 480px) {
    /* Keep docked-to-bottom style from 768px override — don't re-float */
    .floating-actions {
        bottom: 0;
        left: 0;
        right: 0;
        transform: none;
        border-radius: 14px 14px 0 0;
        border-bottom: none;
        padding: 0.4rem 0.35rem calc(0.4rem + env(safe-area-inset-bottom)) 0.35rem;
        justify-content: space-between;
        gap: 0.15rem;
        box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
    }
    .floating-actions .fab-btn {
        padding: 0.45rem;
    }
    .report-md {
        padding: 0.75rem;
        font-size: 0.875rem;
    }
    .play-card-header { flex-wrap: wrap; gap: 0.3rem; }
    .play-badge { font-size: 0.65rem; }
    .plays-section { padding: 0 0.5rem; }
    /* Bottom padding so docked toolbar doesn't cover content (includes iOS safe-area) */
    .scan-result { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
}
