/* ================================================================
   DucksCenter — Design System
   Warm white + orange glow + comic duck energy 🦆
   ================================================================ */

/* ── Google Fonts — loaded via HTML <link> ─────────────────────
   Add to every page <head>:
   <link href="https://fonts.googleapis.com/css2?family=Lilita+One&family=Inter:wght@400;500;600;700;800;900&display=swap" rel="stylesheet">
   ─────────────────────────────────────────────────────────────── */

/* ── Design Tokens ────────────────────────────────────────────── */
:root {
    --bg:             #fdf8f0;
    --bg-2:           #fff7ed;
    --surface:        rgba(255, 255, 255, 0.75);      /* glass base */
    --surface-solid:  #ffffff;
    --surface-hover:  rgba(255, 247, 237, 0.90);
    --surface-active: rgba(254, 243, 199, 0.80);
    --border:         rgba(253, 186, 116, 0.60);       /* warm translucent orange */
    --border-solid:   #fed7aa;
    --border-focus:   #f97316;

    --text:           #1c0a00;
    --text-muted:     #9a5209;
    --text-dim:       #d4b8a0;

    /* Brand orange */
    --accent:         #f97316;
    --accent-dark:    #ea580c;
    --accent-dim:     rgba(249, 115, 22, 0.12);
    --accent-glow:    0 0 30px rgba(249, 115, 22, 0.45), 0 0 80px rgba(249, 115, 22, 0.20);

    /* Income = green */
    --income:         #16a34a;
    --income-dark:    #15803d;
    --income-dim:     rgba(22, 163, 74, 0.12);
    --income-glow:    0 0 40px rgba(22, 163, 74, 0.55), 0 0 100px rgba(22, 163, 74, 0.25), 0 0 180px rgba(22, 163, 74, 0.10);
    --income-glass:   rgba(240, 253, 244, 0.88);

    /* Expense = red */
    --expense:        #dc2626;
    --expense-dark:   #b91c1c;
    --expense-dim:    rgba(220, 38, 38, 0.10);
    --expense-glow:   0 0 40px rgba(220, 38, 38, 0.45), 0 0 100px rgba(220, 38, 38, 0.20), 0 0 180px rgba(220, 38, 38, 0.08);
    --expense-glass:  rgba(255, 245, 245, 0.88);

    --warn:           #d97706;
    --warn-dim:       rgba(217, 119, 6, 0.12);

    --radius-sm:      8px;
    --radius:         12px;
    --radius-lg:      20px;
    --radius-xl:      28px;

    --shadow-sm:      0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow:         0 4px 20px rgba(249, 115, 22, 0.12);
    --shadow-lg:      0 8px 40px rgba(249, 115, 22, 0.16);
    --comic:          3px 4px 0 rgba(0, 0, 0, 0.08);

    --transition:         0.22s cubic-bezier(.4, 0, .2, 1);
    --transition-bounce:  0.38s cubic-bezier(.34, 1.56, .64, 1);

    --topbar-h: 36px;
    --nav-h: 66px;

    /* Glass drop zone effect */
    --glass-bg:       rgba(255, 255, 255, 0.65);
    --glass-border:   rgba(255, 255, 255, 0.80);
    --glass-blur:     16px;
    --glass-inner:    inset 0 1px 0 rgba(255, 255, 255, 0.90), inset 0 -1px 0 rgba(255, 255, 255, 0.30);
}

/* ── Reset ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    /* Soft colour blobs for the glass backdrop-filter to blur against */
    background-image:
        radial-gradient(ellipse 70% 50% at 15% 60%, rgba(249, 115, 22, 0.09) 0%, transparent 55%),
        radial-gradient(ellipse 50% 60% at 85% 25%, rgba(245, 158, 11, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 55% 85%, rgba(249, 115, 22, 0.06) 0%, transparent 50%);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; }

/* ── Scrollbar ────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-solid); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── Typography ───────────────────────────────────────────────── */
h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }
h4 { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); }

/* ── Top accent bar (sits above nav) ─────────────────────────── */
.top-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: linear-gradient(90deg, rgba(249,115,22,.13) 0%, rgba(249,115,22,.05) 60%, rgba(245,158,11,.08) 100%);
    border-bottom: 1.5px solid var(--border-solid);
    z-index: 101;
}

/* ── Navigation ───────────────────────────────────────────────── */
.nav {
    position: fixed;
    top: var(--topbar-h); left: 0; right: 0;
    height: var(--nav-h);
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 2px solid var(--border-solid);
    box-shadow: 0 2px 20px rgba(249, 115, 22, 0.10);
    z-index: 100;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 6px;
}

/* Comic-style brand text using Lilita One */
.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}
.nav-brand:hover { text-decoration: none; }

.nav-logo {
    height: 52px;
    width: auto;
    object-fit: contain;
}
.nav-logo-fallback { font-size: 2.2rem; line-height: 1; }

.nav-brand-name {
    font-family: 'Lilita One', 'Arial Black', cursive;
    font-size: 1.4rem;
    color: #f97316;
    paint-order: stroke fill;
    -webkit-text-stroke: 2px #1a1a1a;
    text-shadow:
        2px  3px 0 #1a1a1a,
       -1px -1px 0 #1a1a1a,
        1px -1px 0 #1a1a1a;
    letter-spacing: -.01em;
}

.nav-spacer { flex: 1; }

.nav-link {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 12px; border-radius: var(--radius-sm);
    font-size: .82rem; font-weight: 700;
    color: var(--text-muted);
    transition: all var(--transition);
    text-decoration: none;
    border: 1.5px solid transparent;
    white-space: nowrap;
}
.nav-link:hover { color: var(--accent-dark); background: var(--accent-dim); text-decoration: none; }
.nav-link.active {
    color: #fff; background: var(--accent);
    border-color: var(--accent-dark);
    box-shadow: var(--comic), 0 0 12px rgba(249, 115, 22, 0.35);
}

.nav-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 9px; background: var(--expense);
    color: #fff; font-size: .7rem; font-weight: 800;
}
.nav-badge:empty, .nav-badge[data-count="0"] { display: none; }

.nav-logout {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 12px; border-radius: var(--radius-sm);
    font-size: .82rem; font-weight: 700;
    color: var(--expense); background: none;
    border: 1.5px solid transparent; cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap; font-family: inherit;
}
.nav-logout:hover { color: #fff; background: var(--expense); border-color: var(--expense-dark); }

/* ── Page Wrapper ─────────────────────────────────────────────── */
.page { padding-top: calc(var(--topbar-h) + var(--nav-h) + 40px); padding-bottom: 64px; min-height: 100vh; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.page-header {
    margin-bottom: 32px;
    display: flex; align-items: flex-start;
    justify-content: space-between; flex-wrap: wrap; gap: 12px;
}
.page-header-text h1 { margin-bottom: 4px; }
.page-header-text p { color: var(--text-muted); font-size: .9rem; }

/* ── Glass Card ───────────────────────────────────────────────── */
.card {
    background: var(--surface);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--comic), var(--glass-inner);
}
.card-sm { padding: 16px; border-radius: var(--radius); }
.card-solid { background: var(--surface-solid); backdrop-filter: none; }

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px; padding: 10px 20px; border-radius: var(--radius);
    font-size: .875rem; font-weight: 700; cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--transition); text-decoration: none; white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
    background: var(--accent); color: #fff;
    border-color: var(--accent-dark);
    box-shadow: var(--comic);
}
.btn-primary:hover:not(:disabled) {
    background: var(--accent-dark); transform: translateY(-2px);
    box-shadow: 0 6px 0 rgba(0,0,0,.12), 0 0 20px rgba(249,115,22,.35);
}
.btn-primary:active:not(:disabled) { transform: translateY(1px); box-shadow: var(--comic); }

.btn-ghost {
    background: var(--surface); color: var(--text);
    border-color: var(--border-solid);
    box-shadow: var(--comic);
    backdrop-filter: blur(8px);
}
.btn-ghost:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--accent); }

.btn-danger { background: var(--expense-dim); color: var(--expense); border-color: rgba(220,38,38,.30); }
.btn-danger:hover:not(:disabled) { background: var(--expense); color: #fff; }

.btn-success {
    background: var(--accent); color: #fff;
    border-color: var(--accent-dark);
    box-shadow: 0 4px 0 var(--accent-dark);
    width: 100%; padding: 14px 20px; font-size: 1rem; border-radius: var(--radius);
}
.btn-success:hover:not(:disabled) {
    background: var(--accent-dark); transform: translateY(-2px);
    box-shadow: 0 6px 0 #c2410c, 0 0 24px rgba(249,115,22,.40);
}
.btn-success:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }

.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-sm { padding: 6px 12px; font-size: .8rem; border-radius: var(--radius-sm); }

/* ── Form Inputs ──────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block; font-size: .78rem; font-weight: 700;
    color: var(--text-muted); text-transform: uppercase;
    letter-spacing: .06em; margin-bottom: 8px;
}
.form-control {
    width: 100%; padding: 12px 16px;
    background: rgba(255, 255, 255, 0.85);
    border: 2px solid var(--border-solid);
    border-radius: var(--radius); color: var(--text);
    font-size: .95rem; font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}
.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(249,115,22,.15), 0 0 12px rgba(249,115,22,.20);
    background: #fff;
}
.form-control::placeholder { color: var(--text-dim); }

/* ── Login — Split Card ───────────────────────────────────────── */
.login-wrap {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    background:
        radial-gradient(ellipse 80% 60% at 20% 110%, rgba(249,115,22,.13) 0%, transparent 55%),
        radial-gradient(ellipse 60% 50% at 80% -10%, rgba(30,30,30,.07) 0%, transparent 50%),
        #f5f0e8;
}
.login-split-card {
    position: relative; width: 100%; max-width: 420px;
    border-radius: 24px; overflow: visible;
    box-shadow: 0 8px 48px rgba(0,0,0,.18), 0 0 0 1.5px rgba(0,0,0,.08);
}
.login-bg-ducks {
    position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(160deg, #fef9f2, #fdf0e0);
    clip-path: polygon(0 0, 0 100%, 100% 100%);
}
.login-bg-ghoul {
    position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(160deg, #f0f0f0, #e0e0e0);
    clip-path: polygon(0 0, 100% 0, 100% 100%);
}
.login-split-line {
    position: absolute; inset: 0; z-index: 1; pointer-events: none;
    background: linear-gradient(
        to bottom right,
        transparent calc(50% - 1px),
        rgba(255,255,255,.65) 50%,
        transparent calc(50% + 1px)
    );
}
.login-split-form {
    position: relative; z-index: 2;
    padding: 36px 40px 40px;
    background: rgba(255,255,255,.82);
    backdrop-filter: blur(20px);
    margin: 20px;
    border-radius: 16px;
    border: 1.5px solid rgba(255,255,255,.70);
}

/* Dual logo */
.login-dual-logo {
    width: 165px; height: 165px;
    position: relative; margin: 0 auto 22px;
    border-radius: 27px; overflow: hidden;
    box-shadow: 0 6px 28px rgba(0,0,0,.22), 0 0 0 2.5px rgba(0,0,0,.09);
}
.login-dual-ducks {
    position: absolute; inset: 0;
    background: linear-gradient(145deg, #fef3e2, #fde8c4);
    clip-path: polygon(0 0, 0 100%, 100% 100%);
    display: flex; align-items: center; justify-content: center;
}
.login-dual-ducks img {
    width: 93px; height: 93px; object-fit: contain;
    transform: translate(-21px, 21px);
}
.login-dual-ghoul {
    position: absolute; inset: 0;
    background: #111;
    clip-path: polygon(0 0, 100% 0, 100% 100%);
    display: flex; align-items: center; justify-content: center;
}
.login-dual-ghoul img {
    width: 90px; height: 90px; object-fit: contain;
    transform: translate(21px, -21px);
}
.login-dual-logo::after {
    content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none;
    background: linear-gradient(
        to bottom right,
        transparent calc(50% - 1.5px),
        rgba(255,255,255,.70) 50%,
        transparent calc(50% + 1.5px)
    );
}
.logo-fb-emoji { font-size: 2.8rem; display: block; line-height: 1; }
.login-dual-ducks .logo-fb-emoji { transform: translate(-21px, 21px); }
.login-dual-ghoul .logo-fb-emoji { transform: translate(21px, -21px); }

/* Title */
.login-split-title { text-align: center; margin-bottom: 24px; }
.login-split-title h1 {
    font-family: 'Lilita One', 'Arial Black', cursive;
    font-size: 1.7rem; color: #f97316;
    paint-order: stroke fill;
    -webkit-text-stroke: 2px #1a1a1a;
    text-shadow: 2px 3px 0 #1a1a1a;
    margin-bottom: 4px;
}
.login-split-title p { font-size: .82rem; color: var(--text-muted); font-weight: 600; }

.btn-login {
    width: 100%; padding: 14px;
    background: var(--accent); color: #fff;
    border: 2px solid var(--accent-dark);
    box-shadow: 0 4px 0 var(--accent-dark);
    border-radius: var(--radius); font-family: inherit;
    font-size: 1rem; font-weight: 800; cursor: pointer;
    transition: all var(--tb);
}
.btn-login:hover { background: var(--accent-dark); transform: translateY(-2px); box-shadow: 0 6px 0 #9a3412; }
.btn-login:active { transform: translateY(1px); box-shadow: 0 2px 0 var(--accent-dark); }
.btn-login:disabled { opacity: .55; pointer-events: none; }

.btn-contact {
    width: 100%; margin-top: 10px; padding: 10px;
    background: transparent;
    border: 1.5px solid var(--border-solid);
    border-radius: var(--radius); font-family: inherit;
    font-size: .82rem; font-weight: 700; color: var(--text-muted);
    cursor: pointer; transition: all var(--t);
    display: block; text-align: center; text-decoration: none;
}
.btn-contact:hover { border-color: var(--accent); color: var(--accent-dark); background: var(--accent-dim); }

.alert-error {
    background: var(--expense-dim); border: 1.5px solid rgba(220,38,38,.25);
    color: var(--expense); padding: 12px 16px; border-radius: var(--radius);
    font-size: .875rem; font-weight: 600; margin-bottom: 20px;
}
.alert-info {
    background: var(--accent-dim); border: 1.5px solid rgba(249,115,22,.25);
    color: var(--accent-dark); padding: 12px 16px; border-radius: var(--radius);
    font-size: .875rem; font-weight: 600; margin-bottom: 20px;
}
.alert-warn {
    background: var(--warn-dim); border: 1.5px solid rgba(217,119,6,.30);
    color: var(--warn); padding: 12px 16px; border-radius: var(--radius);
    font-size: .875rem; font-weight: 600; margin-bottom: 20px;
}
.alert-ok {
    background: var(--income-dim); border: 1.5px solid rgba(22,163,74,.25);
    color: var(--income-dark); padding: 12px 16px; border-radius: var(--radius);
    font-size: .875rem; font-weight: 600; margin-bottom: 20px;
}

/* ── Drop Zones — Glowing Glass ──────────────────────────────── */
.drop-zones { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 40px; }
.drop-zones-single { grid-template-columns: 1fr; max-width: 480px; margin-left: auto; margin-right: auto; }

.drop-zone {
    position: relative;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 52px 24px;
    text-align: center; cursor: pointer;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(150%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%);
    overflow: hidden;
    transition: all var(--transition-bounce);
    box-shadow: var(--glass-inner), 0 4px 20px rgba(0, 0, 0, 0.04);
}

/* Subtle inner shimmer layer */
.drop-zone::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.6) 0%, transparent 60%);
    border-radius: inherit;
    pointer-events: none;
}

.drop-zone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; z-index: 2; }
.drop-icon  { font-size: 3rem; margin-bottom: 12px; position: relative; z-index: 1; }
.drop-title { font-size: 1rem; font-weight: 800; margin-bottom: 4px; position: relative; z-index: 1; }
.drop-sub   { font-size: .8rem; color: var(--text-muted); position: relative; z-index: 1; }

/* Income drop zone — amber/golden glow */
.drop-zone.income {
    border-color: rgba(245, 158, 11, 0.35);
    box-shadow: var(--glass-inner), 0 0 20px rgba(245,158,11,.10);
}
.drop-zone.income .drop-icon { color: var(--income); }
.drop-zone.income .drop-title { color: var(--income-dark); }

.drop-zone.income:hover, .drop-zone.income.drag-over {
    transform: scale(1.03) translateY(-3px);
    border-color: rgba(245, 158, 11, 0.80);
    border-style: solid;
    background: var(--income-glass);
    box-shadow:
        var(--glass-inner),
        0 0 30px rgba(245,158,11,.55),
        0 0 80px rgba(245,158,11,.30),
        0 0 160px rgba(245,158,11,.12);
}

/* Expense drop zone — red glow */
.drop-zone.expense {
    border-color: rgba(220, 38, 38, 0.30);
    box-shadow: var(--glass-inner), 0 0 16px rgba(220,38,38,.06);
}
.drop-zone.expense .drop-icon { color: var(--expense); }
.drop-zone.expense .drop-title { color: var(--expense-dark); }

.drop-zone.expense:hover, .drop-zone.expense.drag-over {
    transform: scale(1.03) translateY(-3px);
    border-color: rgba(220, 38, 38, 0.75);
    border-style: solid;
    background: var(--expense-glass);
    box-shadow:
        var(--glass-inner),
        0 0 30px rgba(220,38,38,.45),
        0 0 80px rgba(220,38,38,.22),
        0 0 160px rgba(220,38,38,.08);
}

/* ── Progress Bar ─────────────────────────────────────────────── */
.upload-progress { display: none; margin-bottom: 24px; }
.upload-progress.visible { display: block; }

.upload-status-row {
    display: flex; justify-content: space-between; align-items: baseline;
    min-height: 1.1em; margin-bottom: 6px;
}
.upload-status {
    font-size: .8rem; color: var(--text-muted);
    transition: color .2s;
}
.upload-status.status-error { color: var(--expense); font-weight: 600; }
.upload-status.status-warn  { color: var(--warn); }
.upload-eta { font-size: .75rem; color: var(--text-muted); opacity: .65; }


.progress-label {
    display: flex; justify-content: space-between; align-items: center;
    font-size: .8rem; color: var(--text-muted); margin-bottom: 8px;
}
.progress-label .filename { font-weight: 700; color: var(--text); }

.progress-track {
    height: 10px;
    background: rgba(0,0,0,.06);
    border-radius: 5px;
    overflow: hidden;
    border: 1.5px solid var(--border-solid);
    box-shadow: inset 0 1px 3px rgba(0,0,0,.08);
}
.progress-bar {
    height: 100%; width: 0%;
    border-radius: 5px;
    transition: width .6s ease-out;
    position: relative;
    overflow: hidden;

    /* Flowing water gradient: blue → violet → cyan → blue */
    background: linear-gradient(
        90deg,
        #38bdf8,
        #818cf8,
        #06b6d4,
        #a78bfa,
        #38bdf8
    );
    background-size: 300% 100%;
    animation: water-flow 3s linear infinite;

    /* Soft glow */
    box-shadow: 0 0 10px rgba(56, 189, 248, .5), 0 0 20px rgba(129, 140, 248, .25);
}
.progress-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255,255,255,.15) 40%,
        rgba(255,255,255,.55) 50%,
        rgba(255,255,255,.15) 60%,
        transparent 100%
    );
    animation: water-glint 2s ease-in-out infinite;
    transform: translateX(-150%);
}

@keyframes water-flow {
    0%   { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}
@keyframes water-glint {
    0%   { transform: translateX(-150%); }
    70%  { transform: translateX(-150%); } /* pause before sweeping */
    100% { transform: translateX(250%); }
}

/* ── Recent Uploads ───────────────────────────────────────────── */
.upload-entry {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px;
    background: rgba(255,255,255,.80);
    backdrop-filter: blur(8px);
    border: 1.5px solid var(--border);
    border-radius: var(--radius); margin-bottom: 8px;
    box-shadow: var(--comic), var(--glass-inner);
    animation: slideInFade .4s var(--transition-bounce) both;
}
.upload-entry .ue-biz-icon { font-size: 1rem; flex-shrink: 0; opacity: .75; line-height: 1; display:flex; align-items:center; }
.upload-entry .ue-biz-icon img { height: 18px; width: auto; object-fit: contain; display: block; }
.upload-entry .ue-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.upload-entry.income  .ue-icon { background: var(--income-dim); }
.upload-entry.expense .ue-icon { background: var(--expense-dim); }
.upload-entry .ue-name  { font-weight: 600; font-size: .875rem; flex: 1; min-width: 0; }
.upload-entry .ue-name span { display: block; font-size: .75rem; color: var(--text-muted); font-weight: 400; }
.upload-entry .ue-amount { font-weight: 900; font-size: .9rem; }
.upload-entry.income  .ue-amount { color: var(--income-dark); }
.upload-entry.expense .ue-amount { color: var(--expense); }
.upload-entry .ue-retry-status:empty { display: none; }
.upload-entry .ue-retry-status.warn  { color: var(--warn); }
.upload-entry .ue-retry-status.error { color: var(--expense); }

.upload-entry.upload-entry-failed { background: var(--expense-dim); border-color: rgba(220,38,38,.25); }
.upload-entry.upload-entry-failed .ue-icon { background: rgba(220,38,38,.15); }
.upload-entry.upload-entry-failed .ue-name { color: var(--expense); }
.upload-entry.upload-entry-failed .ue-name .ue-error-reason { color: var(--expense); opacity: .8; }
.upload-entry.upload-entry-failed .ue-amount { color: var(--text-muted); }
.upload-entry.upload-entry-replaced-proforma { background: var(--income-dim); border-color: rgba(22,163,74,.25); }
.upload-entry.upload-entry-replaced-proforma .ue-icon { background: rgba(22,163,74,.15); }
.upload-entry.upload-entry-replaced-proforma .ue-name span { color: var(--income-dark); opacity: .85; }
.upload-entry.upload-entry-replaced-proforma .ue-amount { color: var(--income-dark); }
.upload-entry.upload-entry-replaced { background: var(--warn-dim); border-color: rgba(217,119,6,.25); }
.upload-entry.upload-entry-replaced .ue-icon { background: rgba(217,119,6,.15); }
.upload-entry.upload-entry-replaced .ue-name span { color: var(--warn); opacity: .85; }
.upload-entry.upload-entry-replaced .ue-amount { color: var(--text-muted); }

/* ── Review Cards ─────────────────────────────────────────────── */
.review-card {
    border: 1.5px solid var(--border); border-radius: var(--radius-lg);
    background: rgba(255,255,255,.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    margin-bottom: 24px; overflow: hidden;
    box-shadow: var(--comic), var(--glass-inner);
}

.review-card-inner { display: grid; grid-template-columns: 1fr 380px; min-height: 520px; }

.review-pdf-pane {
    border-right: 1.5px solid var(--border);
    background: linear-gradient(135deg, rgba(255,251,235,.95), rgba(254,243,199,.90));
    min-height: 520px; overflow: hidden; position: relative;
}
.review-pdf-pane iframe, .review-pdf-pane canvas { width: 100%; height: 100%; border: none; }
.pdf-loading {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); flex-direction: column; gap: 12px; font-size: .875rem;
}

.review-data-pane { padding: 28px; display: flex; flex-direction: column; gap: 0; overflow-y: auto; background: rgba(255,255,255,.95); }

.review-type-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 14px; border-radius: 99px;
    font-size: .75rem; font-weight: 800;
    text-transform: uppercase; letter-spacing: .06em;
    margin-bottom: 20px; width: fit-content; border: 2px solid transparent;
}
.review-type-badge.income  { background: var(--income-dim); color: var(--income-dark); border-color: rgba(245,158,11,.30); }
.review-type-badge.expense { background: var(--expense-dim); color: var(--expense); border-color: rgba(220,38,38,.20); }

.data-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    border: 1.5px solid var(--border-solid); border-radius: var(--radius);
    overflow: hidden; margin-bottom: 16px;
}
.data-cell { padding: 11px 15px; border-bottom: 1px solid var(--border-solid); }
.data-cell:nth-child(odd) { border-right: 1px solid var(--border-solid); }
.data-cell:last-child, .data-cell:nth-last-child(2):nth-child(odd) { border-bottom: none; }
.data-cell.full { grid-column: span 2; }
.data-cell.total { background: var(--income-dim); }
.review-card.expense .data-cell.total { background: var(--expense-dim); }
.review-card.expense .data-cell.total .value { color: var(--expense); }
.data-cell .label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 2px; }
.data-cell .value { font-size: .9rem; font-weight: 700; color: var(--text); }
.data-cell.total .value { font-size: 1.1rem; color: var(--accent-dark); font-weight: 900; }

.skonto-box.skonto-expired { opacity: .55; }

.skonto-box {
    background: var(--warn-dim); border: 1.5px solid rgba(217,119,6,.25);
    border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px;
    display: flex; align-items: flex-start; gap: 10px;
}
.skonto-box .skonto-icon { font-size: 1.3rem; flex-shrink: 0; }
.skonto-box .skonto-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; color: var(--warn); letter-spacing: .05em; }
.skonto-box .skonto-amount { font-size: 1rem; font-weight: 800; color: var(--text); margin-top: 2px; }
.skonto-box .skonto-sub { font-size: .75rem; color: var(--text-muted); }

/* ── Invoice line items ──────────────────────────────────────── */
.items-section { margin-bottom: 16px; border: 1.5px solid var(--border-solid); border-radius: var(--radius); overflow: hidden; }
.items-header { padding: 8px 12px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); background: rgba(0,0,0,.03); border-bottom: 1.5px solid var(--border-solid); }
.items-table { width: 100%; border-collapse: collapse; }
.items-table thead th { padding: 5px 10px; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); background: rgba(0,0,0,.025); border-bottom: 1.5px solid var(--border-solid); border-right: 1px solid var(--border-solid); }
.items-table thead th:last-child { border-right: none; }
.item-desc-row td { padding: 7px 10px 2px; font-size: .78rem; font-weight: 400; color: var(--text-muted); border-top: 1px solid var(--border-solid); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 0; }
.item-desc-row:first-child td { border-top: none; }
.item-nums-row td { padding: 2px 10px 7px; font-size: .8rem; border-right: 1px solid var(--border-solid); }
.item-nums-row td:last-child { border-right: none; }
.item-qty  { white-space: nowrap; text-align: right; color: var(--text-muted); }
.item-price { white-space: nowrap; text-align: right; color: var(--text-muted); }
.item-total { white-space: nowrap; text-align: right; color: var(--text); font-weight: 700; }

.paid-row { margin-bottom: 16px; }
.paid-row label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); display: block; margin-bottom: 8px; }

.currency-input-wrap { position: relative; display: flex; align-items: center; }
.currency-input-wrap .form-control { padding-right: 2rem; }
.currency-input-wrap .currency-symbol {
    position: absolute; right: .75rem;
    font-size: .875rem; color: var(--text-muted);
    pointer-events: none; user-select: none;
}

.review-actions { margin-top: auto; padding-top: 16px; }
.btn-reviewed {
    width: 100%; padding: 14px;
    background: var(--accent); color: #fff;
    border: 2px solid var(--accent-dark);
    box-shadow: 0 4px 0 var(--accent-dark), 0 0 20px rgba(249,115,22,.30);
    border-radius: var(--radius); font-size: .95rem; font-weight: 800;
    cursor: pointer; transition: all var(--transition-bounce);
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-reviewed:hover {
    background: var(--accent-dark); transform: translateY(-3px);
    box-shadow: 0 7px 0 #c2410c, 0 0 30px rgba(249,115,22,.45);
}
.btn-reviewed:active { transform: translateY(2px); box-shadow: none; }
.btn-reviewed.btn-reviewed-invalid {
    background: var(--expense); border-color: var(--expense-dark);
    box-shadow: 0 4px 0 var(--expense-dark), 0 0 20px rgba(220,38,38,.25);
}
.btn-reviewed.btn-reviewed-invalid:hover {
    background: var(--expense-dark);
    box-shadow: 0 7px 0 #991b1b, 0 0 30px rgba(220,38,38,.40);
}

@keyframes btnShake {
    0%,100% { transform: translateX(0); }
    15%      { transform: translateX(-7px) rotate(-1deg); }
    30%      { transform: translateX(7px)  rotate(1deg); }
    45%      { transform: translateX(-5px); }
    60%      { transform: translateX(5px); }
    75%      { transform: translateX(-3px); }
    90%      { transform: translateX(3px); }
}
.btn-shake, .input-shake { animation: btnShake .45s cubic-bezier(.36,.07,.19,.97) both; }
.input-shake { border-color: var(--expense) !important; outline: none; }

.review-card.invalid-parse {
    border-color: #1c1917;
}
.review-card.invalid-parse .review-data-pane { background: #f9d0d0; }
.review-card.invalid-parse .review-pdf-pane  { background: #fde8e8; }

/* Card collapse animation */
.review-card.collapsing {
    overflow: hidden;
    animation: cardCollapse .45s cubic-bezier(.55, 0, 1, .45) forwards;
}
@keyframes cardCollapse {
    0%   { opacity:1; transform:scale(1); max-height:800px; margin-bottom:24px; }
    40%  { opacity:.5; transform:scale(.98) translateY(4px); }
    100% { opacity:0; transform:scale(.92) translateY(16px); max-height:0; margin-bottom:0; padding:0; border-width:0; }
}

/* ── Archive ──────────────────────────────────────────────────── */
.month-group { margin-bottom: 14px; }
.month-header {
    display: flex; align-items: center; gap: 12px; padding: 16px 20px;
    background: rgba(255,255,255,.78); backdrop-filter: blur(10px);
    border: 1.5px solid var(--border); border-radius: var(--radius);
    cursor: pointer; transition: all var(--transition); user-select: none;
    box-shadow: var(--comic), var(--glass-inner);
}
.month-header:hover { background: var(--surface-hover); }
.month-header.open { border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom-color: transparent; box-shadow: var(--glass-inner); }
.month-chevron { margin-left: auto; transition: transform var(--transition); color: var(--text-muted); }
.month-header.open .month-chevron { transform: rotate(180deg); }
.month-name { font-weight: 800; font-size: 1rem; flex: 1; }
.month-stat { font-size: .78rem; padding: 4px 11px; border-radius: 99px; font-weight: 700; border: 1.5px solid transparent; }
.month-stat.income  { background: var(--income-dim); color: var(--income-dark); border-color: rgba(245,158,11,.30); }
.month-stat.expense { background: var(--expense-dim); color: var(--expense); border-color: rgba(220,38,38,.20); }


.archive-row {
    display: grid; grid-template-columns: 80px 1fr 100px 110px 90px 40px;
    align-items: center; gap: 12px; padding: 11px 20px;
    border-bottom: 1px solid var(--border); font-size: .875rem;
    transition: background var(--transition);
}
.archive-row:last-child { border-bottom: none; }
.archive-row:hover { background: var(--surface-hover); }
.archive-row .ar-date   { color: var(--text-muted); font-size: .8rem; }
.archive-row .ar-sender { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.archive-row .ar-num    { color: var(--text-muted); font-size: .78rem; }
.archive-row .ar-amount { font-weight: 800; text-align: right; }
.archive-row.income  .ar-amount { color: var(--income-dark); }
.archive-row.expense .ar-amount { color: var(--expense); }
.archive-row .ar-action { display: flex; justify-content: center; }

/* ── EÜR ──────────────────────────────────────────────────────── */
/* Summary stat cards */
.eur-summary-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-bottom: 24px; }
.eur-stat { background: var(--surface); border: 1.5px solid var(--border-solid); border-radius: var(--radius-lg); padding: 20px 24px; }
.eur-stat-label { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 6px; }
.eur-stat-value { font-size: 1.55rem; font-weight: 800; }
.eur-stat.income  .eur-stat-value { color: var(--income-dark); }
.eur-stat.expense .eur-stat-value { color: var(--expense); }
.eur-stat.profit.positive .eur-stat-value { color: var(--income-dark); }
.eur-stat.profit.negative .eur-stat-value { color: var(--expense); }

/* Card wrapper */
.eur-card { background: var(--surface); border: 1.5px solid var(--border-solid); border-radius: var(--radius-lg); padding: 24px; margin-bottom: 20px; }
.eur-card-title { font-size: .9rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 18px; }
.chart-card canvas { display: block; }

/* Year buttons */
.eur-year-btns { display: flex; gap: 6px; }

/* EÜR table */
.eur-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.eur-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); }
.eur-table td:last-child { text-align: right; width: 160px; }
.eur-table tbody tr:last-child td { border-bottom: none; }
.eur-amt { font-variant-numeric: tabular-nums; font-weight: 600; }
.eur-amt.income  { color: var(--income-dark); }
.eur-amt.expense { color: var(--expense); }

/* Table row variants */
.eur-biz-hdr td { font-weight: 700; font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); padding-top: 18px; border-bottom: 2px solid var(--border-solid); }
.eur-sub-total td { font-weight: 700; background: var(--surface-hover); }
.eur-main-row td { font-size: .95rem; }
.eur-result-row td { font-weight: 800; font-size: 1.05rem; border-top: 2px solid var(--border-solid); border-bottom: none; padding-top: 14px; }
.eur-section-hdr td { font-weight: 700; font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); padding-top: 6px; border-bottom: 1px solid var(--border-solid); }
.eur-tax-row td { color: var(--text-muted); font-size: .875rem; }
.eur-tax-result td { font-weight: 700; border-top: 1px solid var(--border-solid); }
.eur-spacer td { padding: 4px; border: none; }
.eur-total-hdr td { font-weight: 800; font-size: .95rem; border-top: 2px solid var(--border-solid); padding-top: 14px; }
.eur-info-row td { padding-bottom: 12px; }

/* Badges */
.eur-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 700; }
.eur-badge.klein { background: var(--warn-dim); color: var(--warn); }
.eur-badge.regel { background: var(--accent-dim); color: var(--accent-dark); }

/* Monthly table */
.eur-monthly thead th { text-align: left; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); padding: 8px; border-bottom: 2px solid var(--border-solid); }
.eur-monthly thead th:not(:first-child),
.eur-monthly td:not(:first-child) { text-align: right; }
.eur-monthly tfoot td { border-top: 2px solid var(--border-solid); padding-top: 12px; }

/* ── Performance ──────────────────────────────────────────────── */
.perf-view-toggle { display: flex; gap: 6px; }
.perf-canvas-wrap { overflow: hidden; }
.perf-table-wrap  { overflow-x: auto; }

.perf-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.perf-table th { background: var(--surface-hover); padding: 10px 12px; text-align: right; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); border-bottom: 2px solid var(--border-solid); white-space: nowrap; }
.perf-table th:first-child { text-align: left; }
.perf-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
.perf-table td:first-child { text-align: left; font-weight: 600; }
.perf-table tbody tr:last-child td { border-bottom: none; }
.perf-table tfoot td { background: var(--surface-hover); font-weight: 700; border-top: 2px solid var(--border-solid); border-bottom: none; }
.perf-delta { font-size: .75rem; padding-left: 2px !important; padding-right: 4px !important; }
.delta { display: inline-block; padding: 2px 6px; border-radius: 999px; font-weight: 700; font-size: .72rem; }
.delta-pos { background: var(--income-dim); color: var(--income-dark); }
.delta-neg { background: var(--expense-dim); color: var(--expense); }

.perf-legend { display: flex; flex-wrap: wrap; gap: 12px 20px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.perf-legend-item { display: flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--text-muted); }
.perf-legend-swatch { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.perf-legend-line { width: 20px; height: 3px; border-radius: 2px; flex-shrink: 0; }

/* Year / view buttons (shared with EÜR) */
.year-btn { display: inline-flex; align-items: center; padding: 6px 14px; border-radius: var(--radius); font-size: .82rem; font-weight: 600; border: 1.5px solid var(--border-solid); color: var(--text-muted); text-decoration: none; transition: all var(--transition); background: var(--surface); cursor: pointer; }
.year-btn:hover  { border-color: var(--accent); color: var(--accent-dark); }
.year-btn.active { background: var(--accent); color: #fff; border-color: var(--accent-dark); box-shadow: 0 3px 0 var(--accent-dim); }

/* Month export row */
.perf-month-exports { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 20px; }
.perf-month-exports-label { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.perf-month-export-group { display: flex; align-items: center; gap: 4px; }
.perf-month-export-name { font-size: .78rem; font-weight: 600; color: var(--text-muted); min-width: 24px; }

/* Month pills */
.perf-month-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.perf-month-pill {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
    padding: 10px 16px; border-radius: var(--radius-lg); cursor: pointer;
    background: var(--surface); border: 1.5px solid var(--border-solid);
    transition: all var(--transition); text-align: left;
}
.perf-month-pill:hover { border-color: var(--accent); background: var(--accent-dim); }
.perf-month-pill.active { border-color: var(--accent-dark); background: var(--accent-dim); box-shadow: 0 3px 0 var(--accent-dim); }
.pill-name { font-weight: 700; font-size: .85rem; color: var(--text); }
.pill-inc  { font-size: .72rem; color: var(--income-dark); font-weight: 600; }
.pill-exp  { font-size: .72rem; color: var(--expense); font-weight: 600; }

/* Month detail panel */
.perf-month-detail {
    overflow: hidden; max-height: 0;
    transition: max-height .4s cubic-bezier(.4,0,.2,1);
    margin-bottom: 0;
}
.perf-month-detail.open { max-height: 6000px; margin-bottom: 16px; }
.perf-detail-hdr {
    display: flex; align-items: center; gap: 12px; flex-wrap: nowrap;
    padding: 14px 20px; background: var(--surface);
    border: 1.5px solid var(--border-solid); border-bottom: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.perf-detail-title { font-weight: 800; font-size: .95rem; }
.perf-detail-summary { display: flex; gap: 10px; font-size: .85rem; font-weight: 600; flex-shrink: 1; min-width: 0; }
.perf-detail-body {
    background: var(--surface); border: 1.5px solid var(--border-solid); border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: 20px;
}
.perf-detail-body .income { color: var(--income-dark); }
.perf-detail-body .expense { color: var(--expense); }

/* Category breakdown */
.perf-cat-section { margin-bottom: 20px; }
.perf-cat-title { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px; }
.perf-cat-title.income  { color: var(--income-dark); }
.perf-cat-title.expense { color: var(--expense); }
.perf-cat-row { display: grid; grid-template-columns: 180px 1fr 110px; align-items: center; gap: 10px; margin-bottom: 6px; }
.perf-cat-name { font-size: .82rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.perf-cat-bar  { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.perf-cat-fill { display: block; height: 100%; border-radius: 4px; transition: width .4s ease; }
.perf-cat-fill.income  { background: var(--income-dark); }
.perf-cat-fill.expense { background: var(--expense); }
.perf-cat-amt  { font-size: .82rem; font-weight: 700; text-align: right; white-space: nowrap; }
.perf-cat-amt.income  { color: var(--income-dark); }
.perf-cat-amt.expense { color: var(--expense); }

.perf-inv-table-wrap { margin-top: 20px; overflow-x: auto; }
.perf-inv-table td:first-child { font-weight: 400; }
.perf-inv-row.income td:last-child  { color: var(--income-dark); }
.perf-inv-row.expense td:last-child { color: var(--expense); }

/* Print styles */
@media print {
    .nav, .page-header .perf-view-toggle, .btn-export, .perf-view-toggle { display: none !important; }
    .page { padding-top: 0; }
    .eur-card { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; }
    canvas { max-width: 100%; }
}

/* Export button */
.btn-export { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--radius); font-size: .82rem; font-weight: 600; border: 1.5px solid var(--border-solid); color: var(--text-muted); text-decoration: none; transition: all var(--transition); background: var(--surface); }
.btn-export:hover { border-color: var(--accent); color: var(--accent-dark); background: var(--accent-dim); }

/* ── Modal ────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.40);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    z-index: 200; display: flex; align-items: center; justify-content: center;
    padding: 24px; opacity: 0; transition: opacity var(--transition); pointer-events: none;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
    background: rgba(255,255,255,.92); backdrop-filter: blur(20px);
    border: 1.5px solid var(--border-solid); border-radius: var(--radius-xl);
    width: 100%; max-width: 900px; max-height: 90vh;
    display: flex; flex-direction: column;
    box-shadow: 8px 10px 0 rgba(0,0,0,.08), var(--glass-inner);
    transform: scale(.95) translateY(16px);
    transition: transform var(--transition-bounce);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1.5px solid var(--border-solid); flex-shrink: 0; }
.modal-body { flex: 1; overflow: hidden; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.4rem; line-height: 1; padding: 4px; border-radius: var(--radius-sm); transition: all var(--transition); }
.modal-close:hover { color: var(--expense); background: var(--expense-dim); }

/* ── Toasts ───────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 300; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
    background: rgba(255,255,255,.90); backdrop-filter: blur(12px);
    border: 1.5px solid var(--border-solid); border-radius: var(--radius);
    padding: 14px 18px; font-size: .875rem; font-weight: 600;
    box-shadow: 4px 4px 0 rgba(0,0,0,.07), 0 0 16px rgba(249,115,22,.10);
    max-width: 320px; pointer-events: auto;
    animation: toastIn .4s var(--transition-bounce) both;
    display: flex; align-items: center; gap: 10px;
}
.toast.success { border-left: 4px solid var(--accent); }
.toast.error   { border-left: 4px solid var(--expense); }
.toast.warn    { border-left: 4px solid var(--warn); }
.toast.leaving { animation: toastOut .3s ease forwards; }

@keyframes toastIn  { from{opacity:0;transform:translateY(12px) scale(.95)} to{opacity:1;transform:none} }
@keyframes toastOut { to{opacity:0;transform:translateX(16px);max-height:0;padding:0;margin:0;border:none} }

/* ── Misc animations ──────────────────────────────────────────── */
@keyframes slideInFade { from{opacity:0;transform:translateY(-8px) scale(.97)} to{opacity:1;transform:none} }

.spinner { width: 24px; height: 24px; border: 3px solid var(--border-solid); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Stat pills ───────────────────────────────────────────────── */
.stat-pills { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 32px; }
.stat-pill {
    flex: 1; min-width: 160px;
    background: rgba(255,255,255,.75); backdrop-filter: blur(10px);
    border: 1.5px solid var(--border); border-radius: var(--radius);
    padding: 18px 20px; box-shadow: var(--comic), var(--glass-inner);
}
.stat-pill .sp-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 4px; }
.stat-pill .sp-value { font-size: 1.5rem; font-weight: 900; }
.stat-pill.income  .sp-value { color: var(--income-dark); }
.stat-pill.expense .sp-value { color: var(--expense); }
.stat-pill.profit  .sp-value { color: var(--accent-dark); }

/* ── Empty state ──────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 64px 24px; color: var(--text-muted); }
.empty-state .es-icon { font-size: 3rem; margin-bottom: 16px; opacity: .5; }

/* ── Divider ──────────────────────────────────────────────────── */
.divider { height: 1.5px; background: var(--border-solid); margin: 24px 0; border-radius: 1px; }

/* ── Nav Separator ────────────────────────────────────────────── */
.nav-sep { width: 1px; height: 24px; background: var(--border-solid); margin: 0 4px; flex-shrink: 0; }

/* ── Business Switcher ────────────────────────────────────────── */
.biz-switcher { position: relative; }

.biz-btn {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 12px; border-radius: var(--radius);
    background: var(--accent-dim); border: 1.5px solid var(--border-solid);
    color: var(--text); font-size: .8rem; font-weight: 800;
    cursor: pointer; transition: all var(--transition); white-space: nowrap;
    font-family: inherit;
}
.biz-btn:hover { border-color: var(--accent); background: var(--accent-dim); }
.biz-btn-logo { width: 22px; height: 22px; object-fit: contain; border-radius: 3px; }
.biz-btn-fb   { font-size: 1.1rem; line-height: 1; }
.biz-btn-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.biz-btn-chevron { font-size: .75rem; opacity: .6; transition: transform var(--transition); }
.biz-btn[aria-expanded="true"] .biz-btn-chevron,
.biz-switcher:has(.biz-dropdown.open) .biz-btn-chevron { transform: rotate(180deg); }

.biz-dropdown {
    display: none; position: absolute; top: calc(100% + 6px); left: 0;
    min-width: 220px; background: var(--surface-solid);
    border: 1.5px solid var(--border-solid); border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0,0,0,.14), var(--glass-inner);
    z-index: 150; overflow: hidden;
    animation: slideInFade .18s ease both;
}
.biz-dropdown.open { display: block; }

.biz-opt-form { margin: 0; }
.biz-opt {
    width: 100%; display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; background: none; border: none;
    border-bottom: 1px solid var(--border);
    cursor: pointer; transition: background var(--transition);
    font-family: inherit; text-align: left;
}
.biz-opt:last-child { border-bottom: none; }
.biz-opt:hover { background: var(--surface-hover); }
.biz-opt.active { background: var(--accent-dim); }
.biz-opt-logo { width: 28px; height: 28px; object-fit: contain; border-radius: 4px; flex-shrink: 0; }
.biz-opt-fb   { font-size: 1.3rem; line-height: 1; width: 28px; text-align: center; flex-shrink: 0; }
.biz-opt-info { flex: 1; min-width: 0; }
.biz-opt-name { display: block; font-size: .82rem; font-weight: 800; color: var(--text); }
.biz-opt-sub  { display: block; font-size: .7rem; color: var(--text-muted); font-weight: 500; margin-top: 1px; }
.biz-check    { color: var(--accent); font-weight: 900; font-size: .9rem; flex-shrink: 0; }
.biz-divider  { height: 1px; background: var(--border-solid); margin: 0; }

/* ── Biz context badge (shown in page body for combined view) ─── */
.biz-context-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 99px; font-size: .75rem; font-weight: 700;
    background: var(--accent-dim); border: 1.5px solid var(--border-solid); color: var(--text-muted);
}
.biz-context-badge.reparse-badge {
    background: var(--warn-dim, rgba(251,191,36,.15)); border-color: rgba(251,191,36,.4); color: var(--warn);
}

/* ── Hamburger toggle (hidden on desktop) ─────────────────────── */
.nav-mobile-spacer { display: none; }
.nav-toggle {
    display: none;
    flex-direction: column; justify-content: center; align-items: center;
    gap: 5px; width: 40px; height: 40px;
    background: none; border: 1.5px solid var(--border-solid);
    border-radius: var(--radius-sm); cursor: pointer; padding: 0;
    flex-shrink: 0;
}
.nav-toggle-bar {
    display: block; width: 20px; height: 2px;
    background: var(--text-muted); border-radius: 2px;
    transition: transform .2s, opacity .2s;
}
.nav-open .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-open .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-open .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Desktop: .nav-menu is a flex row that grows to fill remaining nav space */
.nav-menu {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 900px) {
    .drop-zones { grid-template-columns: 1fr; }
    .review-card-inner { grid-template-columns: 1fr; }
    .review-pdf-pane { min-height: 280px; border-right: none; border-bottom: 1.5px solid var(--border); }
    .eur-grid { grid-template-columns: 1fr; }
    .archive-row { grid-template-columns: 1fr 1fr 80px 40px; }
    .archive-row .ar-date, .archive-row .ar-num { display: none; }
}
@media (max-width: 768px) {
    /* Nav becomes a wrapping bar — brand row + collapsible menu below */
    .nav {
        flex-wrap: wrap;
        height: auto;
        min-height: var(--nav-h);
        padding: 0 16px;
        gap: 0;
        align-items: center;
    }
    .nav-brand { height: var(--nav-h); flex-shrink: 0; }
    .nav-mobile-spacer { display: block; flex: 1; }
    .nav-toggle { display: flex; }

    /* Hide all menu content by default */
    .nav-menu {
        display: none;
        flex: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding: 8px 0 12px;
        border-top: 1.5px solid var(--border-solid);
    }
    /* Show menu when nav is open */
    .nav-open .nav-menu { display: flex; }

    /* Inside the drawer: links go full-width */
    .nav-menu .nav-link,
    .nav-menu .nav-logout {
        width: 100%; padding: 10px 14px;
        font-size: .9rem; border-radius: var(--radius-sm);
        justify-content: flex-start;
        border: none;
    }
    .nav-menu .nav-link.active { border: 1.5px solid var(--accent-dark); }
    .nav-menu .nav-spacer { display: none; }
    .nav-menu .nav-sep { display: none; }

    /* Business switcher full-width in drawer */
    .nav-menu .biz-switcher { width: 100%; margin-bottom: 4px; }
    .nav-menu .biz-btn {
        width: 100%; justify-content: flex-start;
        border-radius: var(--radius-sm); padding: 10px 14px;
    }
    .nav-menu .biz-dropdown { top: 100%; width: 100%; }

    .container { padding: 0 16px; }
    .login-card { padding: 28px 22px; }
    .data-grid { grid-template-columns: 1fr; }
    .data-cell:nth-child(odd) { border-right: none; }
    .data-cell { border-bottom: 1px solid var(--border-solid) !important; }
}
@media (max-width: 600px) {
    .container { padding: 0 12px; }
}

/* ── Flatpickr theme overrides ─────────────────────────────────── */
.flatpickr-calendar {
    border: 2px solid var(--border-solid);
    border-radius: var(--radius);
    box-shadow: var(--comic);
    font-family: inherit;
    font-size: .875rem;
}
.flatpickr-day.selected,
.flatpickr-day.selected:hover {
    background: var(--accent);
    border-color: var(--accent);
}
.flatpickr-day:hover {
    background: var(--accent-dim, rgba(249,115,22,.12));
}
.flatpickr-months .flatpickr-month,
.flatpickr-weekdays,
span.flatpickr-weekday {
    background: transparent;
    color: var(--text);
}
.flatpickr-current-month .numInputWrapper span { color: var(--text); }
.flatpickr-day.today { border-color: var(--accent); }

/* ── Archive ───────────────────────────────────────────────────── */
.archive-filter {
    display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap;
}
.archive-filter-btn {
    padding: 7px 18px; border-radius: 99px; font-size: .82rem; font-weight: 700;
    border: 1.5px solid var(--border-solid); color: var(--text-muted);
    background: var(--surface); text-decoration: none; transition: all var(--transition);
}
.archive-filter-btn:hover { border-color: var(--accent); color: var(--text); }
.archive-filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent-dark); }
.archive-filter-btn.income.active  { background: var(--income); border-color: var(--income-dark); }
.archive-filter-btn.expense.active { background: var(--expense); border-color: var(--expense-dark); }
.archive-filter-cat { margin-top: -16px; }
.archive-filter-btn.cat { cursor: pointer; font-size: .78rem; padding: 5px 14px; }
.archive-filter-btn.cat.active { background: var(--text-muted); border-color: var(--text-dim); color: #fff; }
.archive-filter-ebay { margin-top: -16px; align-items: center; }
.archive-filter-btn.ebay-toggle { cursor: pointer; font-size: .78rem; padding: 5px 14px; }
.archive-filter-btn.ebay-toggle.active { background: #b45309; border-color: #92400e; color: #fff; }
.archive-filter-btn.ebay-cat,
.archive-filter-btn.ebay-type { cursor: pointer; font-size: .78rem; padding: 5px 14px; }
.archive-filter-btn.ebay-cat.active  { background: #1d4ed8; border-color: #1e3a8a; color: #fff; }
.archive-filter-btn.ebay-type.active { background: var(--text-muted); border-color: var(--text-dim); color: #fff; }
.filter-sep { font-size: .7rem; color: var(--text-dim); font-weight: 600; padding: 0 2px; letter-spacing: .04em; text-transform: uppercase; }

.month-group { margin-bottom: 12px; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--comic); }

.month-hdr {
    width: 100%; display: flex; align-items: center; gap: 12px;
    padding: 14px 20px; cursor: pointer;
    background: rgba(255,255,255,.88); backdrop-filter: blur(8px);
    border: 1.5px solid var(--border-solid); border-radius: var(--radius-lg);
    font-family: inherit; font-size: .95rem; font-weight: 700; color: var(--text);
    transition: background var(--transition);
}
.month-group:has(.month-body:not([hidden])) .month-hdr {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom-color: var(--border);
}
.month-hdr:hover { background: var(--surface-hover); }
.month-chevron { font-size: .75rem; color: var(--text-muted); flex-shrink: 0; transition: transform var(--transition); }
.month-title { flex: 1; text-align: left; }
.month-totals { display: flex; gap: 16px; font-size: .82rem; }
.month-totals .income  { color: var(--income-dark); font-weight: 800; }
.month-totals .expense { color: var(--expense);     font-weight: 800; }

.month-body {
    background: rgba(255,255,255,.92);
    border: 1.5px solid var(--border-solid); border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    overflow: hidden; max-height: 0;
    transition: max-height .35s cubic-bezier(.4, 0, .2, 1);
}
.month-body.open { max-height: 99999px; }

.archive-row {
    display: grid;
    grid-template-columns: 36px 1fr 140px 110px 64px;
    align-items: center; gap: 12px;
    padding: 12px 20px; cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}
.archive-row:last-child { border-bottom: none; }
.archive-row:hover { background: var(--surface-hover); }

/* combined mode adds biz icon column */
.archive-row.has-biz { grid-template-columns: 24px 36px 1fr 140px 110px 64px; }

.ar-biz { font-size: .95rem; opacity: .75; display: flex; align-items: center; }
.ar-type { font-size: 1.1rem; text-align: center; }
.ar-name { font-weight: 600; font-size: .875rem; min-width: 0; }
.ar-name span { display: block; font-size: .75rem; color: var(--text-muted); font-weight: 400; }
.ar-cat-badge { display: inline-block; padding: 1px 6px; border-radius: 999px; font-size: .68rem; font-weight: 700; background: var(--accent-dim); color: var(--accent-dark); border: 1px solid var(--border-solid); margin-left: 4px; vertical-align: middle; }
.ar-date { font-size: .8rem; color: var(--text-muted); white-space: nowrap; display: flex; flex-direction: column; gap: 2px; }
.ar-date-inv  { color: var(--text); font-weight: 600; }
.ar-date-add  { font-size: .72rem; color: var(--text-dim); }
.ar-amount { font-weight: 800; font-size: .9rem; white-space: nowrap; text-align: right; }
.ar-amount.income  { color: var(--income-dark); }
.ar-amount.expense { color: var(--expense); }
.ar-view { text-align: right; }
.btn-view {
    display: inline-block; padding: 4px 10px; border-radius: 6px; font-size: .72rem;
    font-weight: 700; background: var(--accent-dim); color: var(--text-muted);
    border: 1px solid var(--border-solid); transition: all var(--transition); white-space: nowrap;
}
.archive-row:hover .btn-view { background: var(--accent); color: #fff; border-color: var(--accent-dark); }

/* ── Inline PDF expand ──────────────────────────────────────────── */
.ar-item { display: flex; flex-direction: column; }
.ar-pdf-expand {
    overflow: hidden; max-height: 0;
    transition: max-height .35s cubic-bezier(.4,0,.2,1);
    border-left: 1.5px solid var(--border-solid);
    border-right: 1.5px solid var(--border-solid);
}
.ar-pdf-expand.open { max-height: 640px; }
.ar-pdf-inner {
    position: relative; height: 580px;
    background: var(--surface);
}
.ar-pdf-inner .ar-pdf-loading {
    position: absolute; inset: 0; display: flex; align-items: center;
    justify-content: center; flex-direction: column; gap: 12px;
    color: var(--text-muted); font-size: .875rem;
}
.ar-pdf-inner iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: none; }
.ar-no-pdf {
    display: flex; align-items: center; justify-content: center;
    height: 100%; padding: 24px; text-align: center;
    color: var(--text-muted); font-size: .9rem; line-height: 1.6;
}
.ar-pdf-inner:has(.ar-no-pdf) { height: 100px; }


/* ── AI / Anthropic settings section ───────────────────────────── */
.ai-status-row   { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.ai-status-label { font-size: .875rem; color: var(--text-muted); }
.ai-status-badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: .8rem; font-weight: 700; }
.ai-status-ok    { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.ai-status-none  { background: #f1f5f9; color: var(--text-muted); border: 1px solid var(--border-solid); }
.ai-status-link  { background: var(--accent-dim); color: var(--accent-dark); border: 1px solid var(--border-solid); text-decoration: none; transition: opacity .15s; }
.ai-status-link:hover { opacity: .75; }
.ai-key-form     { margin-bottom: 0; }
.ai-key-row      { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ai-key-input    { flex: 1; min-width: 220px; max-width: 420px; font-family: 'Courier New', monospace; font-size: .875rem; }
.ai-key-result   { margin-top: 10px; padding: 8px 12px; border-radius: var(--radius-sm); font-size: .875rem; }
.ai-key-ok       { background: #dcfce7; color: #166534; }
.ai-key-err      { background: #fee2e2; color: #991b1b; }
.ai-reprocess-box       { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-solid); }
.ai-reprocess-title     { font-size: .95rem; font-weight: 700; margin-bottom: 6px; }
.ai-reprocess-desc      { font-size: .875rem; color: var(--text-muted); margin-bottom: 12px; }
.ai-reprocess-progress  { margin-bottom: 12px; }
.ai-reprocess-bar-wrap  { height: 6px; background: var(--border-solid); border-radius: 3px; margin-bottom: 6px; overflow: hidden; }
.ai-reprocess-bar       { height: 100%; background: var(--accent); border-radius: 3px; width: 0; transition: width .4s; }

/* ── Dev: budget simulation toggle ─────────────────────────────── */
.dev-sim-box {
    margin-top: 20px; padding: 14px 16px;
    border: 1.5px dashed rgba(217,119,6,.5);
    border-radius: var(--radius); background: rgba(217,119,6,.06);
}
.dev-sim-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.dev-badge {
    font-size: .65rem; font-weight: 800; letter-spacing: .08em;
    padding: 2px 6px; border-radius: 4px;
    background: var(--warn); color: #fff;
}
.dev-sim-title { font-size: .875rem; font-weight: 700; color: var(--warn); }
.dev-sim-desc  { font-size: .8rem; color: var(--text-muted); margin-bottom: 12px; }
.dev-sim-desc code { background: var(--surface-raised, rgba(255,255,255,.08));
    padding: 1px 5px; border-radius: 3px; font-size: .78rem; }

/* pill toggle */
.toggle-label  { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.toggle-input  { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track  {
    position: relative; width: 40px; height: 22px; flex-shrink: 0;
    background: var(--border-solid); border-radius: 11px;
    transition: background .2s;
}
.toggle-input:checked + .toggle-track { background: var(--warn); }
.toggle-thumb  {
    position: absolute; top: 3px; left: 3px;
    width: 16px; height: 16px; border-radius: 50%;
    background: #fff; transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.toggle-input:checked + .toggle-track .toggle-thumb { transform: translateX(18px); }
.toggle-text   { font-size: .85rem; color: var(--text-muted); }

/* ── Budget-exhausted review card ──────────────────────────────── */
.review-card.budget-exhausted { border-color: var(--warn); }
.review-card.replaced-proforma-card { border-color: var(--warn); }
.review-card.replaced-proforma-card .review-data-pane { background: rgba(254,243,199,.60); }
.review-card.replaced-proforma-card .review-pdf-pane  { background: rgba(255,247,237,.80); }
.budget-exhausted-pane {
    display: flex; flex-direction: column; gap: 20px;
    padding: 24px; justify-content: center;
}
.budget-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ── Inventory page ─────────────────────────────────────────────── */
.inv-filter-bar    { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.inv-filter-cats   { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.inv-cat-btn       { padding: 6px 14px; border-radius: 20px; border: 1.5px solid var(--border-solid);
                     background: none; font-size: .8rem; font-weight: 600; color: var(--text-muted);
                     cursor: pointer; transition: all var(--transition); }
.inv-cat-btn:hover { border-color: var(--accent); color: var(--accent); }
.inv-cat-btn.active { background: var(--accent); border-color: var(--accent-dark); color: #fff; }
.inv-cat-stock0   { border-style: dashed; }
.inv-search-wrap  { flex-shrink: 0; }
.inv-search       { width: 220px; }
.inv-loading, .inv-empty { text-align: center; padding: 48px 0; color: var(--text-muted); font-size: .9rem; }
.inv-group        { margin-bottom: 24px; }
.inv-group-header { display: flex; align-items: center; justify-content: space-between;
                    padding: 10px 16px; background: var(--surface-alt);
                    border: 1.5px solid var(--border-solid); border-radius: var(--radius) var(--radius) 0 0;
                    font-weight: 700; }
.inv-group-title  { font-size: .95rem; }
.inv-group-count  { font-size: .8rem; color: var(--text-muted); }
.inv-group-items  { border: 1.5px solid var(--border-solid); border-top: none;
                    border-radius: 0 0 var(--radius) var(--radius); }
.inv-item         { padding: 12px 16px; border-bottom: 1px solid var(--border-solid);
                    transition: background var(--transition); }
.inv-item:last-child { border-bottom: none; }
.inv-item:hover   { background: var(--surface-hover); }
.inv-item-main    { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.inv-item-desc    { font-weight: 600; font-size: .9rem; flex: 1; min-width: 140px; }
.inv-item-stock   { font-size: .85rem; white-space: nowrap; }
.inv-item-cost    { font-size: .8rem; color: var(--text-muted); white-space: nowrap; }
.inv-item-meta    { display: flex; gap: 16px; flex-wrap: wrap; font-size: .78rem; color: var(--text-muted); }
.inv-stock-zero .inv-item-stock { color: var(--expense); font-weight: 700; }
.inv-stock-low  .inv-item-stock { color: #f59e0b; font-weight: 700; }
.inv-item-details { margin-top: 8px; }
.inv-item-details summary { font-size: .8rem; color: var(--accent); cursor: pointer; user-select: none; }
.inv-item-details-body    { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.inv-summary-block        { background: var(--surface-alt); border-radius: var(--radius-sm);
                            padding: 8px 12px; font-size: .8rem; }
.inv-summary-label        { display: block; font-weight: 700; font-size: .75rem;
                            text-transform: uppercase; letter-spacing: .05em;
                            color: var(--text-muted); margin-bottom: 4px; }
.inv-summary-ebay         { border-left: 3px solid #f97316; }
.inv-pagination           { display: flex; align-items: center; justify-content: center;
                            gap: 12px; padding: 20px 0; }
.inv-page-btn             { padding: 7px 16px; border-radius: var(--radius-sm);
                            border: 1.5px solid var(--border-solid);
                            background: none; cursor: pointer; font-size: .875rem; font-weight: 600;
                            transition: all var(--transition); }
.inv-page-btn:hover       { border-color: var(--accent); color: var(--accent); }
.inv-page-info            { font-size: .875rem; color: var(--text-muted); }

/* ── eBay pages ─────────────────────────────────────────────────── */
.ebay-card { margin-bottom: 20px; }
.ebay-setup-card { margin-bottom: 20px; }
.ebay-setup-card h2 { font-size: 1rem; font-weight: 700; margin-bottom: 10px; }
.setup-list { margin: 10px 0 10px 20px; display: flex; flex-direction: column; gap: 4px; }
.setup-list li { font-size: .875rem; }
.setup-list code { background: var(--accent-dim); padding: 1px 5px; border-radius: 4px; font-size: .8rem; }
.ebay-status-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.ebay-status-info { display: flex; align-items: center; gap: 10px; }
.ebay-status-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.ebay-status-dot.connected    { background: #22c55e; box-shadow: 0 0 6px #22c55e88; }
.ebay-status-dot.disconnected { background: #ef4444; box-shadow: 0 0 6px #ef444488; }
.ebay-status-label { font-weight: 700; font-size: .95rem; }
.ebay-last-sync { margin-top: 10px; font-size: .8rem; color: var(--text-muted); }
.ebay-connect-btn, .ebay-reconnect-btn { white-space: nowrap; }
.card-title { font-size: .875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-muted); margin-bottom: 14px; }
.ebay-settings-form .form-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ebay-settings-form label { font-size: .875rem; font-weight: 600; }
.ebay-settings-form input[type="date"] { padding: 6px 10px; border: 1.5px solid var(--border-solid);
    border-radius: 6px; font-size: .875rem; background: var(--surface); color: var(--text); min-width: 160px; }
.form-hint { margin-top: 8px; font-size: .78rem; color: var(--text-muted); }
.form-success { margin-top: 6px; font-size: .8rem; color: #22c55e; font-weight: 600; }
.ebay-sync-hint { font-size: .875rem; color: var(--text-muted); margin-bottom: 14px; }
.ebay-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ebay-sync-result { margin-top: 14px; padding: 10px 14px; border-radius: 8px; font-size: .875rem; font-weight: 600; }
.sync-ok  { background: #14532d22; color: #22c55e; border: 1px solid #22c55e44; }
.sync-error { background: #7f1d1d22; color: #ef4444; border: 1px solid #ef444444; }
.flash { padding: 12px 16px; border-radius: 8px; font-weight: 600; font-size: .875rem; margin-bottom: 16px; }
.flash-ok  { background: #14532d22; color: #22c55e; border: 1px solid #22c55e44; }
.flash-err { background: #7f1d1d22; color: #ef4444;  border: 1px solid #ef444444; }

/* ── eBay review page ───────────────────────────────────────────── */
.ebay-review-card { padding: 0; overflow: hidden; }
.ebay-review-toolbar { display: flex; align-items: center; gap: 16px; padding: 14px 20px;
    border-bottom: 1.5px solid var(--border-solid); flex-wrap: wrap; }
.ebay-check-all { display: flex; align-items: center; gap: 6px; font-size: .875rem; font-weight: 600;
    cursor: pointer; user-select: none; }
.ebay-review-legend { display: flex; gap: 14px; font-size: .8rem; margin-left: auto; }
.legend-income  { color: var(--income-dark); font-weight: 700; }
.legend-expense { color: var(--expense);     font-weight: 700; }
.ebay-txn-table { width: 100%; border-collapse: collapse; }
.ebay-txn-table th { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-muted); padding: 8px 14px; border-bottom: 1.5px solid var(--border-solid); text-align: left; }
.ebay-txn-table td { padding: 9px 14px; border-bottom: 1px solid var(--border-solid); font-size: .875rem; vertical-align: middle; }
.txn-row:last-child td { border-bottom: none; }
.txn-row.row-income  { background: transparent; }
.txn-row.row-expense { background: #7f1d1d08; }
.txn-row:hover { background: var(--accent-dim); }
.txn-date { white-space: nowrap; color: var(--text-muted); font-size: .8rem; }
.txn-desc { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.txn-type-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px;
    border-radius: 20px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.badge-income  { background: var(--income-dim, #14532d22); color: var(--income-dark); }
.badge-expense { background: #7f1d1d22; color: var(--expense); }
.txn-amount { font-variant-numeric: tabular-nums; font-weight: 700; text-align: right !important; white-space: nowrap; }
.income-col  { color: var(--income-dark); }
.expense-col { color: var(--expense); }
.btn-exclude { padding: 3px 9px; border-radius: 6px; font-size: .72rem; font-weight: 700;
    border: 1.5px solid var(--border-solid); background: transparent; color: var(--text-muted);
    cursor: pointer; white-space: nowrap; transition: all var(--transition); }
.btn-exclude:hover { background: #7f1d1d22; color: var(--expense); border-color: var(--expense); }
.ebay-review-footer { display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px; border-top: 1.5px solid var(--border-solid); }
#selected-count { font-size: .875rem; color: var(--text-muted); }
.empty-state { text-align: center; padding: 40px; color: var(--text-muted); }

/* ── Settings page ──────────────────────────────────────────────── */
.settings-section { margin-bottom: 20px; }
.settings-section-title { font-size: 1rem; font-weight: 800; margin-bottom: 8px; }
.settings-section-desc { font-size: .875rem; color: var(--text-muted); margin-bottom: 18px; line-height: 1.6; }
.tax-biz-cards { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.tax-biz-card { padding: 14px 16px; border: 1.5px solid var(--border-solid); border-radius: 8px; background: var(--surface); }
.tax-biz-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.tax-biz-name { font-weight: 700; font-size: .9rem; }
.tax-badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: .75rem; font-weight: 700; }
.badge-klein   { background: #78350f22; color: #d97706; border: 1px solid #d9770644; }
.badge-regel   { background: #14532d22; color: #22c55e; border: 1px solid #22c55e44; }
.badge-planned { background: #1e3a5f22; color: #60a5fa; border: 1px solid #60a5fa44; }
.tax-biz-detail { font-size: .8rem; color: var(--text-muted); }
.tax-switch-box { border: 1.5px solid var(--border-solid); border-radius: 8px; padding: 18px;
    background: var(--accent-dim); margin-top: 4px; }
.tax-switch-title { font-size: .9rem; font-weight: 700; margin-bottom: 6px; }
.tax-switch-hint  { font-size: .8rem; color: var(--text-muted); margin-bottom: 14px; line-height: 1.5; }
.tax-switch-form { display: flex; flex-direction: column; gap: 12px; }
.tax-switch-row { display: flex; align-items: center; gap: 10px; }
.tax-switch-row label { font-size: .875rem; font-weight: 600; }
.tax-switch-row select { padding: 6px 10px; border: 1.5px solid var(--border-solid); border-radius: 6px;
    font-size: .875rem; background: var(--surface); color: var(--text); }
.tax-switch-confirm { display: flex; align-items: flex-start; gap: 8px; font-size: .8rem;
    color: var(--text-muted); line-height: 1.5; cursor: pointer; }
.tax-switch-confirm input { margin-top: 2px; flex-shrink: 0; }
.tax-switch-btn { align-self: flex-start; }
.tax-switch-result { padding: 8px 12px; border-radius: 6px; font-size: .8rem; font-weight: 600; }
.switch-ok    { background: #14532d22; color: #22c55e; }
.switch-error { background: #7f1d1d22; color: #ef4444; }
.tax-switch-planned { display: flex; align-items: center; gap: 10px; margin-top: 4px;
    padding: 12px 16px; border-radius: 8px; background: #1e3a5f22;
    border: 1px solid #60a5fa44; color: #60a5fa; font-size: .875rem; }
.tax-planned-icon { font-size: 1.2rem; }
.konto-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.konto-info { display: flex; flex-direction: column; gap: 2px; }
.konto-label    { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.konto-username { font-size: 1rem; font-weight: 700; }

/* ── Auth simple card (forgot/reset) ────────────────────────────── */
.auth-simple-card {
    max-width: 420px; margin: 80px auto; padding: 36px 40px;
    background: var(--surface); border: 1.5px solid var(--border-solid);
    border-radius: 12px; text-align: center;
}
.auth-simple-logo { font-size: 2.5rem; margin-bottom: 12px; }
.auth-simple-title { font-size: 1.3rem; font-weight: 800; margin-bottom: 8px; }
.auth-simple-desc { font-size: .875rem; color: var(--text-muted); margin-bottom: 20px; line-height: 1.6; }
.auth-success { background: #14532d22; color: #22c55e; border: 1px solid #22c55e44;
    border-radius: 8px; padding: 12px 16px; font-size: .875rem; font-weight: 600; margin-bottom: 16px; }
.alert-success { background: #14532d22; color: #22c55e; border: 1px solid #22c55e44;
    border-radius: 8px; padding: 10px 14px; font-size: .875rem; font-weight: 600; margin-bottom: 14px; }
.auth-simple-card .form-group { text-align: left; margin-bottom: 14px; }
.auth-simple-card .form-group label { display: block; font-size: .8rem; font-weight: 600; margin-bottom: 4px; }
.auth-simple-card .form-control { width: 100%; padding: 9px 12px; border: 1.5px solid var(--border-solid);
    border-radius: 7px; font-size: .9rem; background: var(--surface); color: var(--text); }
.auth-simple-card .btn-login { width: 100%; }
.btn-contact { display: block; text-align: center; font-size: .8rem; color: var(--text-muted);
    margin-top: 10px; text-decoration: none; }
.btn-contact:hover { color: var(--accent); }

/* ── Backup page ─────────────────────────────────────────────────── */
.backup-card { margin-bottom: 20px; }
/* Restore section */
.restore-env-badge { display:flex; align-items:center; gap:8px; margin-bottom:10px; font-size:.82rem; color:var(--text-muted); }
.restore-warning { background:rgba(220,38,38,.1); border:1px solid rgba(220,38,38,.25); color:#dc2626; border-radius:6px; padding:10px 14px; font-size:.85rem; font-weight:600; margin-bottom:14px; }
.restore-form-wrap { display:flex; flex-direction:column; gap:12px; margin-bottom:12px; }
.restore-confirm-label { display:flex; align-items:center; gap:8px; font-size:.875rem; cursor:pointer; }
.restore-confirm-label input[type=checkbox] { width:16px; height:16px; cursor:pointer; }
.restore-progress { margin-top:10px; }
.restore-progress-bar-wrap { height:6px; background:var(--border-solid); border-radius:3px; overflow:hidden; margin-bottom:8px; }
.restore-progress-bar { height:100%; background:var(--accent); border-radius:3px; width:0%; transition:width .4s ease; }
#restore-msg { font-size:.85rem; color:var(--text-muted); }
.backup-stats { display: flex; gap: 24px; margin-bottom: 14px; }
.backup-stat { display: flex; flex-direction: column; gap: 2px; }
.backup-stat-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.backup-stat-value { font-size: 1.1rem; font-weight: 700; }
.backup-hint { font-size: .8rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 16px; }
.backup-table { width: 100%; border-collapse: collapse; margin-bottom: 4px; }
.backup-table th { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-muted); padding: 6px 8px; border-bottom: 1.5px solid var(--border-solid); text-align: left; }
.backup-table td { padding: 7px 8px; border-bottom: 1px solid var(--border-solid); font-size: .875rem; }
.backup-table tr:last-child td { border-bottom: none; }

/* ── Steam page ──────────────────────────────────────────────────── */
.steam-guide-card { margin-bottom: 20px; }
.steam-guide-steps { margin: 10px 0 10px 20px; display: flex; flex-direction: column; gap: 6px; font-size: .875rem; }
.steam-guide-steps li strong { color: var(--text); }
.steam-guide-note { font-size: .78rem; color: var(--text-muted); margin-top: 10px; }
.steam-guide-note code { background: var(--accent-dim); padding: 1px 5px; border-radius: 4px; font-size: .75rem; }
.steam-upload-card { margin-bottom: 20px; }
.steam-drop-zone {
    border: 2px dashed var(--border-solid); border-radius: 10px; padding: 40px 20px;
    text-align: center; cursor: pointer; transition: all var(--transition);
    background: var(--accent-dim);
}
.steam-drop-zone:hover, .steam-drop-zone.drag-over {
    border-color: var(--accent); background: var(--accent-dim);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}
.steam-drop-icon { font-size: 2.5rem; margin-bottom: 8px; }
.steam-drop-text { font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.steam-drop-sub { font-size: .8rem; color: var(--text-muted); }
.steam-progress-wrap { margin-top: 16px; }
.steam-progress-bar { height: 8px; background: var(--accent-dim); border-radius: 4px; overflow: hidden; margin-bottom: 8px; }
.steam-progress-fill { height: 100%; width: 0%; background: var(--accent); border-radius: 4px; transition: width .2s; }
.steam-progress-label { font-size: .8rem; color: var(--text-muted); text-align: center; }

/* ── eBay Reference Documents ───────────────────────────────────────────── */
/* Alert banner (EÜR warning) */
.alert-banner { display:flex; align-items:flex-start; gap:12px; padding:14px 16px; border-radius:8px; margin-bottom:20px; }
.alert-icon { font-size:1.2rem; flex-shrink:0; margin-top:1px; }
.alert-body { flex:1; font-size:.92rem; line-height:1.55; }
.alert-body strong { display:block; margin-bottom:4px; }
.alert-dismiss { background:none; border:none; cursor:pointer; font-size:1rem; color:var(--text-muted); padding:0 4px; flex-shrink:0; }
.alert-dismiss:hover { color:var(--text); }
.ref-warn-list { margin:6px 0 0 0; padding-left:18px; }
.ref-warn-list li { margin-bottom:3px; }
.ref-warn-list a { color:inherit; text-decoration:underline; }
.ref-check-table { width:100%; border-collapse:collapse; margin-top:8px; font-size:.85rem; }
.ref-check-table th { text-align:left; font-size:.78rem; font-weight:700; letter-spacing:.04em; text-transform:uppercase; color:var(--text-muted); padding:4px 8px 4px 0; border-bottom:1px solid rgba(255,255,255,.12); }
.ref-check-table td { padding:5px 8px 5px 0; border-bottom:1px solid rgba(255,255,255,.06); vertical-align:middle; }
.ref-check-table td:first-child { font-weight:600; white-space:nowrap; padding-right:16px; }
.ref-check-detail { font-size:.8rem; font-weight:400; opacity:.8; margin-left:6px; }

/* Month blocks on eBay page */
.ref-month-block { border:1px solid var(--border); border-radius:8px; margin-bottom:12px; overflow:hidden; }
.ref-month-header { display:flex; align-items:center; gap:12px; padding:12px 16px; background:var(--surface); }
.ref-month-label { font-weight:600; font-size:.95rem; flex:1; }
.ref-status-badges { display:flex; gap:6px; }
.ref-badge { font-size:.75rem; padding:2px 8px; border-radius:12px; font-weight:600; white-space:nowrap; }
.ref-ok { background:var(--income-dim); color:var(--income-dark); }
.ref-missing { background:rgba(217,119,6,.15); color:#b45309; }
.ref-match { background:var(--income-dim); color:var(--income-dark); }
.ref-mismatch { background:rgba(217,119,6,.15); color:#b45309; }
.ref-no-amount { background:var(--surface2); color:var(--text-muted); }

/* Doc list inside a month block */
.ref-uploaded-list { padding:10px 16px; border-top:1px solid var(--border); display:flex; flex-direction:column; gap:6px; }
.ref-doc-row { display:flex; align-items:center; gap:10px; font-size:.88rem; }
.ref-doc-type { color:var(--text-muted); font-size:.78rem; min-width:200px; }
.ref-doc-name { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--accent); }
.ref-doc-name:hover { text-decoration:underline; }
.ref-doc-amount { font-variant-numeric:tabular-nums; color:var(--text-muted); font-size:.85rem; white-space:nowrap; }
.btn-icon { background:none; border:none; cursor:pointer; font-size:.95rem; padding:2px 4px; color:var(--text-muted); line-height:1; border-radius:4px; }
.btn-icon:hover { color:#dc2626; background:rgba(220,38,38,.08); }

/* Slot grid — unified uploaded + upload prompt per document type */
.ref-slot-grid { border-top:1px solid var(--border); }
.ref-slot-group-hdr { padding:5px 16px; font-size:.72rem; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--text-muted); background:var(--surface); border-bottom:1px solid var(--border); }
.ref-slot-row { display:flex; align-items:flex-start; gap:12px; padding:8px 16px; border-bottom:1px solid rgba(255,255,255,.04); }
.ref-slot-row:last-child { border-bottom:none; }
.ref-slot-label { font-size:.83rem; color:var(--text-muted); min-width:230px; flex-shrink:0; padding-top:3px; }

/* Uploaded state */
.ref-slot-files { display:flex; flex-direction:column; gap:4px; flex:1; }
.ref-slot-file { display:flex; align-items:center; gap:8px; }
.ref-slot-filename { color:var(--accent); font-size:.88rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:260px; text-decoration:none; }
.ref-slot-filename:hover { text-decoration:underline; }
.ref-slot-amount { font-variant-numeric:tabular-nums; color:var(--text-muted); font-size:.83rem; white-space:nowrap; }
.ref-slot-add { background:none; border:none; cursor:pointer; font-size:.95rem; padding:0 2px; color:var(--text-muted); line-height:1; border-radius:4px; opacity:.5; }
.ref-slot-add:hover { opacity:1; color:var(--accent); }

/* Missing / upload prompt state */
.ref-slot-upload { flex:1; display:flex; align-items:center; gap:10px; background:none; border:1px dashed var(--border); border-radius:6px; padding:5px 12px; cursor:pointer; text-align:left; }
.ref-slot-upload:hover { border-color:var(--accent); }
.ref-slot-upload:hover .ref-slot-upload-hint { color:var(--accent); }
.ref-slot-missing-text { font-size:.82rem; color:var(--text-muted); opacity:.45; font-style:italic; flex:1; }
.ref-slot-upload-hint { font-size:.78rem; color:var(--text-muted); white-space:nowrap; }

.ref-korrektur-group { border:none; }
.ref-korrektur-group > .ref-slot-row { padding-left:32px; }
.ref-korrektur-summary { list-style:none; display:flex; align-items:center; gap:8px; padding:6px 16px; font-size:.8rem; font-weight:600; color:var(--text-muted); cursor:pointer; user-select:none; }
.ref-korrektur-summary::before { content:'▶'; font-size:.65rem; transition:transform .15s; }
details[open] > .ref-korrektur-summary::before { transform:rotate(90deg); }
.ref-korrektur-summary::-webkit-details-marker { display:none; }
.ref-korrektur-hint { font-weight:400; opacity:.6; }

.ref-upload-status { font-size:.85rem; padding:8px 16px; border-top:1px solid var(--border); }
.ref-ok-bg { color:var(--income-dark); }
.ref-error { color:#dc2626; }

/* Reference doc inline review form */
.ref-review-form { padding:10px 0 4px; }
.ref-review-form strong { display:block; margin-bottom:8px; font-size:.88rem; }
.ref-review-fields { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:10px; }
.ref-review-fields label { display:flex; flex-direction:column; gap:3px; font-size:.78rem; color:var(--text-muted); }
.ref-review-input { padding:4px 8px; border:1px solid var(--border); border-radius:4px; font-size:.88rem; background:var(--bg); color:var(--text); width:180px; }
.ref-review-input[type=date] { width:150px; }
.ref-review-input[type=number] { width:120px; }
.ref-review-actions { display:flex; gap:8px; }

/* ── Advisor Chat ─────────────────────────────────────────────────── */
.advisor-chat-wrap    { display:flex; flex-direction:column; height:calc(100vh - var(--nav-h) - var(--topbar-h) - 3rem); }
.advisor-chat-bubbles { flex:1; overflow-y:auto; padding:1rem; display:flex; flex-direction:column; gap:.75rem; }
.advisor-chat-bar     { padding:.75rem 1rem; border-top:1px solid var(--border-solid); display:flex; gap:.5rem; align-items:flex-end; background:var(--surface-solid); }
.advisor-chat-input   { flex:1; padding:.55rem .8rem; border:1px solid var(--border-solid); border-radius:var(--radius); font-size:.95rem; font-family:inherit; background:var(--bg); color:var(--text); resize:none; max-height:120px; overflow-y:auto; }
.advisor-chat-input:focus { outline:none; border-color:var(--border-focus); }
.advisor-chat-send    { padding:.55rem 1rem; background:var(--accent); color:#fff; border:none; border-radius:var(--radius); font-size:.95rem; font-weight:600; cursor:pointer; white-space:nowrap; transition:background var(--transition); }
.advisor-chat-send:hover  { background:var(--accent-dark); }
.advisor-chat-send:disabled { opacity:.5; cursor:not-allowed; }

.advisor-bubble-wrap           { display:flex; flex-direction:column; }
.advisor-bubble-wrap.user-wrap { align-items:flex-end; }
.advisor-bubble-wrap.adv-wrap  { align-items:flex-start; }
.advisor-bubble                { max-width:72%; padding:.6rem .9rem; border-radius:var(--radius); line-height:1.55; word-break:break-word; white-space:pre-wrap; font-size:.93rem; }
.advisor-bubble.user           { background:var(--accent); color:#fff; border-bottom-right-radius:4px; }
.advisor-bubble.advisor        { background:var(--surface-solid); border:1px solid var(--border-solid); border-bottom-left-radius:4px; color:var(--text); }
.advisor-bubble-meta           { font-size:.68rem; color:var(--text-dim); margin-top:.2rem; padding:0 .2rem; }
.advisor-bubble-speaker        { font-size:.72rem; font-weight:700; color:var(--text-muted); margin-bottom:.25rem; padding:0 .1rem; }

/* Roundtable speaker accents */
.advisor-bubble.speaker-steuerberater { border-left:3px solid var(--accent); }
.advisor-bubble.speaker-business      { border-left:3px solid var(--income); }
.advisor-bubble.speaker-ebay          { border-left:3px solid #3b82f6; }

/* Advisor hub cards */
.advisor-hub          { display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:1rem; margin-top:1.5rem; }
.advisor-card         { background:var(--surface-solid); border:1px solid var(--border-solid); border-radius:var(--radius-lg); padding:1.5rem; display:flex; flex-direction:column; gap:.75rem; transition:box-shadow var(--transition); text-decoration:none; color:inherit; }
.advisor-card:hover   { box-shadow:var(--shadow-lg); }
.advisor-card.disabled{ opacity:.5; pointer-events:none; cursor:not-allowed; }
.advisor-card-icon    { font-size:2rem; }
.advisor-card-title   { font-size:1.1rem; font-weight:700; color:var(--text); }
.advisor-card-desc    { font-size:.88rem; color:var(--text-muted); line-height:1.5; flex:1; }
.advisor-card-badge   { display:inline-block; padding:.2rem .6rem; border-radius:999px; font-size:.72rem; font-weight:600; background:var(--income-dim); color:var(--income-dark); width:fit-content; }
.advisor-card-badge.unavailable { background:var(--expense-dim); color:var(--expense-dark); }

/* Advisor page header with back link */
.advisor-page-header  { display:flex; align-items:center; gap:.75rem; margin-bottom:1rem; }
.advisor-back         { font-size:.85rem; color:var(--text-muted); text-decoration:none; }
.advisor-back:hover   { color:var(--accent); }
.advisor-title        { font-size:1.3rem; font-weight:700; }
.advisor-no-key       { background:var(--warn-dim); border:1px solid var(--warn); border-radius:var(--radius); padding:1rem 1.25rem; font-size:.9rem; color:var(--text); }

/* ── NERV / MAGI Theme ──────────────────────────────────────────── */
.nerv-page            { background:#050608; }

/* Scanline overlay on hub */
.nerv-hub-wrap        { position:relative; }
.nerv-hub-wrap::before {
    content:''; position:fixed; inset:0; pointer-events:none; z-index:0;
    background:repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,.18) 2px, rgba(0,0,0,.18) 4px);
}

/* Hub header */
.nerv-masthead        { position:relative; z-index:1; border:1px solid #ff6600; border-bottom:2px solid #ff6600; background:#0a0b0c; padding:1.25rem 1.5rem; margin-bottom:1.5rem;
                        display:flex; justify-content:space-between; align-items:flex-start;
                        box-shadow:0 0 24px rgba(255,102,0,.25), inset 0 0 40px rgba(255,102,0,.05); }
.nerv-masthead-left   { display:flex; flex-direction:column; gap:.2rem; }
.nerv-masthead-logo   { font-family:'Courier New',Courier,monospace; font-size:2rem; font-weight:900;
                        color:#ff6600; letter-spacing:.3em; text-shadow:0 0 20px rgba(255,102,0,.8); }
.nerv-masthead-kanji  { font-size:.75rem; color:#cc4400; letter-spacing:.2em; font-family:'Courier New',Courier,monospace; }
.nerv-masthead-sub    { font-size:.65rem; color:#884400; letter-spacing:.15em; font-family:'Courier New',Courier,monospace; margin-top:.1rem; }
.nerv-masthead-right  { text-align:right; display:flex; flex-direction:column; gap:.35rem; }
.nerv-status-line     { font-family:'Courier New',Courier,monospace; font-size:.68rem; color:#ff8800; letter-spacing:.08em; }
.nerv-status-dots     { display:flex; gap:.4rem; justify-content:flex-end; margin-top:.25rem; }
.nerv-dot             { width:8px; height:8px; background:#ff6600; clip-path:polygon(50% 0%,100% 25%,100% 75%,50% 100%,0% 75%,0% 25%);
                        box-shadow:0 0 6px #ff6600; animation:nerv-blink 2s step-start infinite; }
.nerv-dot:nth-child(2){ animation-delay:.4s; }
.nerv-dot:nth-child(3){ animation-delay:.8s; }
.nerv-dot:nth-child(4){ animation-delay:1.2s; }
.nerv-dot:nth-child(5){ animation-delay:1.6s; }
@keyframes nerv-blink { 0%,100%{opacity:1} 50%{opacity:.2} }

/* Hub grid */
.nerv-hub             { position:relative; z-index:1; display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:1px; background:#ff6600; border:1px solid #ff6600; }

/* Hub cards */
.nerv-card            { background:#0a0b0c; padding:0; display:flex; flex-direction:column; text-decoration:none; color:inherit; position:relative; overflow:hidden;
                        transition:background .15s; }
.nerv-card:hover      { background:#0f1012; }
.nerv-card.disabled   { opacity:.4; pointer-events:none; }
.nerv-card-header     { background:#0d0e10; border-bottom:1px solid #331100; padding:.6rem 1rem; display:flex; justify-content:space-between; align-items:center; }
.nerv-card-codename   { font-family:'Courier New',Courier,monospace; font-size:.72rem; font-weight:700; color:#ff6600; letter-spacing:.2em; text-shadow:0 0 8px rgba(255,102,0,.6); }
.nerv-card-hex        { font-size:.9rem; opacity:.5; }
.nerv-card-body       { padding:1rem; flex:1; display:flex; flex-direction:column; gap:.6rem; }
.nerv-card-title      { font-family:'Courier New',Courier,monospace; font-size:.82rem; color:#ff8800; letter-spacing:.1em; text-transform:uppercase; }
.nerv-card-desc       { font-size:.82rem; color:#664422; line-height:1.5; flex:1; }
.nerv-card-footer     { padding:.5rem 1rem .75rem; display:flex; justify-content:space-between; align-items:center; }
.nerv-card-status     { display:flex; align-items:center; gap:.4rem; font-family:'Courier New',Courier,monospace; font-size:.65rem; color:#ff6600; letter-spacing:.1em; }
.nerv-card-led        { width:6px; height:6px; border-radius:50%; background:#ff6600; box-shadow:0 0 5px #ff6600; animation:nerv-blink 1.8s ease-in-out infinite; }
.nerv-card-led.off    { background:#441100; box-shadow:none; animation:none; }
.nerv-card-badge      { font-family:'Courier New',Courier,monospace; font-size:.6rem; color:#332211; letter-spacing:.08em; border:1px solid #331100; padding:.1rem .4rem; }
.nerv-card-badge.avail{ color:#ff4400; border-color:#441100; }
.nerv-card-magi       { background:#0a0f0a; }
.nerv-card-magi .nerv-card-header { background:#0a0f0a; border-bottom-color:#003322; }
.nerv-card-magi .nerv-card-codename { color:#00ffcc; text-shadow:0 0 8px rgba(0,255,204,.6); }
.nerv-card-magi .nerv-card-title   { color:#00ddaa; }
.nerv-card-magi .nerv-card-led     { background:#00ffcc; box-shadow:0 0 5px #00ffcc; }
.nerv-card-magi .nerv-card-status  { color:#00ffcc; }
.nerv-card-magi:hover { background:#0c130c; }

/* NERV map */
.nerv-map {
    position: relative;
    width: 100%;
    max-width: 640px;
    aspect-ratio: 4/3;
    margin: .75rem auto 0;
    background: transparent;
    z-index: 1;
}
.nerv-map-lines {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}
.nerv-map-hazard {
    display: none; /* replaced by fixed screen-edge bars */
}

/* Fixed hazard bars pinned to screen edges */
.nerv-hazard-left,
.nerv-hazard-right {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 18px;
    z-index: 9999;
    pointer-events: none;
    background: repeating-linear-gradient(
        -45deg,
        rgba(255,102,0,.38) 0px,  rgba(255,102,0,.38) 3px,
        rgba(10,5,0,.38)    3px,  rgba(10,5,0,.38)    6px
    );
}
.nerv-hazard-left  { left: 0; }
.nerv-hazard-right { right: 0; }

/* Map nodes — absolutely positioned, centered at their coordinate */
.nerv-map-node {
    position: absolute;
    transform: translate(-50%, -50%);
    text-decoration: none;
    z-index: 2;
    width: 15%;
    aspect-ratio: 1;
    display: block;
    transition: filter .2s;
}
.nerv-map-node:hover          { filter: brightness(1.4) drop-shadow(0 0 8px #ff6600); }
.nerv-map-node.nerv-map-disabled { opacity: .35; pointer-events: none; }

/* Positions (center of each node as % of map) */
.nerv-node-center { left: 50%; top: 50%; width: 32.5%; aspect-ratio: 1.15; z-index: 4; }
.nerv-node-top    { left: 50%; top: 13%; width: 33%; }
.nerv-node-left   { left: 13%; top: 50%; width: 33%; }
.nerv-node-right  { left: 87%; top: 50%; width: 33%; }
.nerv-node-bottom { left: 50%; top: 87%; width: 33%; }

/* Diamond shape (outer = border color, inner = bg) */
.nerv-diamond-outer {
    width: 100%; height: 100%;
    background: #ff6600;
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    display: flex; align-items: center; justify-content: center;
}
.nerv-diamond-outer.nerv-diamond-restricted { background: #442200; }
.nerv-diamond-inner {
    width: 88%; height: 88%;
    background: #0c0d0e;
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .15rem;
}

/* Hexagon shape (MAGI center) */
.nerv-hex-outer {
    width: 100%; height: 100%;
    background: #00ffcc;
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    display: flex; align-items: center; justify-content: center;
}
.nerv-hex-inner {
    width: 88%; height: 88%;
    background: #050f0a;
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .15rem;
}

/* Node text */
.nerv-map-code {
    font-family: 'Courier New', Courier, monospace;
    font-size: clamp(.45rem, 1.3vw, .9rem);
    font-weight: 900;
    color: #ff6600;
    letter-spacing: .1em;
    text-shadow: 0 0 6px rgba(255,102,0,.7);
    line-height: 1;
}
.nerv-hex-inner .nerv-map-code { color: #00ffcc; text-shadow: 0 0 6px rgba(0,255,204,.7); }
.nerv-map-role {
    font-family: 'Courier New', Courier, monospace;
    font-size: clamp(.35rem, .85vw, .65rem);
    color: #664422;
    letter-spacing: .05em;
    text-align: center;
    line-height: 1.2;
    padding: 0 8%;
}
.nerv-hex-inner .nerv-map-role { color: #006644; }

/* Node LED */
.nerv-map-led {
    width: 5px; height: 5px;
    border-radius: 50%;
    background: #ff6600;
    box-shadow: 0 0 4px #ff6600;
    animation: nerv-blink 1.8s ease-in-out infinite;
    flex-shrink: 0;
}
.nerv-map-led.off          { background: #331100; box-shadow: none; animation: none; }
.nerv-map-led.nerv-map-led-teal { background: #00ffcc; box-shadow: 0 0 4px #00ffcc; }

/* NERV no-key alert */
.nerv-no-key          { background:#1a0500; border:1px solid #cc2200; padding:1rem 1.25rem; font-family:'Courier New',Courier,monospace; font-size:.82rem; color:#ff4400; margin-bottom:1rem; position:relative; z-index:1; }

/* NERV Roundtable page */
.nerv-rt-map-area        { flex:1; position:relative; display:flex; align-items:center; justify-content:center; min-height:0; overflow:visible; }
/* Square map for roundtable — equal pixel distance from center to all 4 satellite nodes */
.nerv-rt-map             { position:relative; width:min(100%, min(580px, calc(100dvh - 230px))); max-width:none; aspect-ratio:1 !important; height:auto; margin:0; flex-shrink:0; background:transparent; }

/* Speech areas — all 4 in the gutters beside the square map */
.nerv-rt-speech {
    position: absolute; z-index: 5; pointer-events: none;
    transition: opacity .35s ease;
}
.nerv-rt-read-btn { pointer-events: auto; }
.nerv-rt-speech.nerv-rt-fadeout { opacity: 0; }

/* Left gutter: RAMIEL (upper) + ARAEL (middle) */
.nerv-rt-s-top {
    position: absolute !important;
    right: calc(50% + 300px);   /* just outside the 580px map edge */
    left: 22px;                 /* clear of hazard bar */
    top: 25%; transform: translateY(-50%);
    width: auto; text-align: right;
}
.nerv-rt-s-left {
    position: absolute !important;
    right: calc(50% + 300px);
    left: 22px;
    top: 50%; transform: translateY(-50%);
    width: auto; text-align: right;
}
/* Right gutter: ZERUEL (middle) + SACHIEL (lower) */
.nerv-rt-s-right {
    position: absolute !important;
    left: calc(50% + 300px);
    right: 22px;
    top: 50%; transform: translateY(-50%);
    width: auto; text-align: left;
}
.nerv-rt-s-bottom {
    position: absolute !important;
    left: calc(50% + 300px);
    right: 22px;
    top: 75%; transform: translateY(-50%);
    width: auto; text-align: left;
}

.nerv-rt-speech-label {
    font-family: 'Courier New', Courier, monospace;
    font-size: .6rem; font-weight: 700;
    color: #ff6600; letter-spacing: .2em; margin-bottom: .2rem;
    text-shadow: 0 0 6px rgba(255,102,0,.7); display: block;
}
.nerv-rt-speech-msgs { }
.nerv-rt-msg {
    font-family: 'Courier New', Courier, monospace;
    font-size: .66rem; color: #ff8800;
    line-height: 1.5; border-left: 1px solid #ff4400; padding-left: .3rem;
    opacity: 0;
    animation: nerv-msg-in .5s ease-out .05s forwards;
}
.nerv-rt-s-right .nerv-rt-msg,
.nerv-rt-s-bottom .nerv-rt-msg {
    border-left: 1px solid #ff4400;
}
.nerv-rt-s-top .nerv-rt-msg,
.nerv-rt-s-left .nerv-rt-msg {
    border-left: none;
    border-right: 1px solid #ff4400;
    padding-left: 0; padding-right: .3rem;
}
@keyframes nerv-msg-in {
    from { opacity: 0; transform: translateY(3px); }
    to   { opacity: 1; transform: translateY(0); }
}
.nerv-rt-streaming {
    animation: nerv-stream-pulse 1.8s ease-in-out infinite !important;
}
@keyframes nerv-stream-pulse {
    0%   { opacity: .3; }
    50%  { opacity: .85; }
    100% { opacity: .3; }
}
@keyframes nerv-msg-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Node speaking state */
.nerv-node-speaking .nerv-diamond-outer { background:#ffaa00;
                                           filter:drop-shadow(0 0 10px rgba(255,170,0,.8)); }
.nerv-node-speaking .nerv-map-code      { text-shadow:0 0 14px rgba(255,102,0,1); color:#fff; }
.nerv-node-speaking .nerv-map-led       { animation:nerv-blink .35s step-start infinite; }

/* Floating chat bar */
.nerv-rt-chatbar      { background:#0a0b0c; border-top:1px solid #331100; padding:.6rem 1rem; flex-shrink:0; position:relative; z-index:10; }
.nerv-rt-query        { font-family:'Courier New',Courier,monospace; font-size:.72rem; color:#664422;
                         margin-bottom:.4rem; min-height:1em; letter-spacing:.05em;
                         white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.nerv-rt-query-prefix { color:#ff4400; }
.nerv-rt-input-row    { display:flex; gap:.5rem; align-items:flex-end; }

/* Model selector row */
.nerv-rt-model-row {
    display:flex; align-items:center; gap:.6rem;
    margin-bottom:.35rem;
}
.nerv-rt-model-select {
    background:#050608; color:#ff6600; border:1px solid #441100;
    font-family:'Courier New',Courier,monospace; font-size:.65rem;
    letter-spacing:.08em; padding:.18rem .4rem; cursor:pointer;
    outline:none; appearance:none; -webkit-appearance:none;
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%23ff6600'/%3E%3C/svg%3E");
    background-repeat:no-repeat; background-position:right .35rem center;
    padding-right:1.2rem;
}
.nerv-rt-model-select:hover { border-color:#ff6600; }
.nerv-rt-model-select option { background:#050608; color:#ff6600; }
.nerv-rt-model-cost {
    font-family:'Courier New',Courier,monospace; font-size:.62rem;
    color:#664422; letter-spacing:.06em;
}
.nerv-rt-model-cost-val { color:#aa5500; }

/* MAGI page header */
.magi-page-header     { background:#050608; border-bottom:2px solid #ff6600; padding:1rem 1.5rem; display:flex; flex-direction:column; gap:.3rem; margin-bottom:0; }
.magi-system-title    { font-family:'Courier New',Courier,monospace; font-size:1.4rem; font-weight:900; color:#ff6600; letter-spacing:.25em; text-shadow:0 0 16px rgba(255,102,0,.7); }
.magi-system-subtitle { font-family:'Courier New',Courier,monospace; font-size:.68rem; color:#884400; letter-spacing:.18em; }
.magi-back            { font-family:'Courier New',Courier,monospace; font-size:.72rem; color:#cc4400; text-decoration:none; letter-spacing:.1em; align-self:flex-start; }
.magi-back:hover      { color:#ff6600; }

/* MAGI chat override */
.nerv-chat-page .advisor-chat-wrap    { background:#050608; }
.nerv-chat-page .advisor-chat-bubbles { background:#050608; }
.nerv-chat-page .advisor-chat-bar     { background:#0a0b0c; border-top:1px solid #331100; }
.nerv-chat-page .advisor-chat-input   { background:#080909; border:1px solid #441100; color:#ff8800; font-family:'Courier New',Courier,monospace; border-radius:0; }
.nerv-chat-page .advisor-chat-input::placeholder { color:#441100; }
.nerv-chat-page .advisor-chat-input:focus { border-color:#ff6600; outline:none; }
.nerv-chat-page .advisor-chat-send    { background:#cc4400; border-radius:0; font-family:'Courier New',Courier,monospace; letter-spacing:.1em; font-size:.8rem; }
.nerv-chat-page .advisor-chat-send:hover { background:#ff6600; }
.nerv-chat-page .advisor-bubble.user  { background:#1a0a00; border:1px solid #442200; color:#ff8800; border-radius:0; font-family:'Courier New',Courier,monospace; font-size:.85rem; }
.nerv-chat-page .advisor-bubble.advisor { background:#080b09; border:1px solid #003322; color:#aaffdd; border-radius:0; font-family:'Courier New',Courier,monospace; font-size:.85rem; }
.nerv-chat-page .advisor-bubble-speaker { color:#00ffcc; font-family:'Courier New',Courier,monospace; font-size:.7rem; letter-spacing:.2em; text-shadow:0 0 6px rgba(0,255,204,.5); }
.nerv-chat-page .advisor-bubble-meta   { color:#442200; font-family:'Courier New',Courier,monospace; }
.nerv-chat-page .advisor-no-key        { background:#1a0500; border:1px solid #cc2200; color:#ff4400; border-radius:0; font-family:'Courier New',Courier,monospace; }

/* NERV speaker accents (angel codenames) */
.nerv-chat-page .advisor-bubble.speaker-ramiel  { border-left:3px solid #ff6600; }
.nerv-chat-page .advisor-bubble.speaker-zeruel  { border-left:3px solid #00ffcc; }
.nerv-chat-page .advisor-bubble.speaker-arael   { border-left:3px solid #cc44ff; }
.nerv-chat-page .advisor-bubble.speaker-sachiel { border-left:3px solid #3b82f6; }

/* Roundtable full-viewport layout — no scroll */
.nerv-rt-page {
    zoom: 1.2;
    padding-top: calc(var(--topbar-h) + var(--nav-h)) !important;
    padding-bottom: 0 !important;
    min-height: unset !important;
    height: calc(100dvh / 1.2) !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

/* Compact masthead modifier (used on roundtable) */
.nerv-masthead--compact              { padding:.4rem 1rem; margin-bottom:0; }
.nerv-masthead--compact .nerv-masthead-logo  { font-size:1.1rem; }
.nerv-masthead--compact .nerv-masthead-kanji { display:none; }
.nerv-masthead--compact .nerv-masthead-sub   { margin-top:0; }
.nerv-masthead-back { font-family:'Courier New',Courier,monospace; font-size:.7rem; color:#cc4400; text-decoration:none; letter-spacing:.1em; }
.nerv-masthead-back:hover { color:#ff6600; }

/* Chat history log panel (slides in from right) */
.nerv-rt-log-panel {
    position: fixed;
    top: calc(var(--topbar-h) + var(--nav-h));
    right: 0; bottom: 0; width: 300px;
    background: #080909; border-left: 1px solid #331100;
    transform: translateX(100%); transition: transform .3s ease;
    z-index: 200; display: flex; flex-direction: column; overflow: hidden;
}
.nerv-rt-log-panel.open { transform: translateX(0); }
.nerv-rt-log-header {
    border-bottom: 1px solid #331100; padding: .5rem 1rem;
    display: flex; justify-content: space-between; align-items: center; flex-shrink: 0;
}
.nerv-rt-log-title  { font-family:'Courier New',Courier,monospace; font-size:.68rem; color:#ff6600; letter-spacing:.2em; }
.nerv-rt-log-close  { background:none; border:1px solid #331100; color:#cc4400; font-family:'Courier New',Courier,monospace; font-size:.65rem; cursor:pointer; padding:.1rem .35rem; }
.nerv-rt-log-close:hover { color:#ff6600; border-color:#ff4400; }
.nerv-rt-log-msgs   { flex:1; overflow-y:auto; padding:.5rem; display:flex; flex-direction:column; gap:.4rem; }
.nerv-rt-log-entry  { font-family:'Courier New',Courier,monospace; font-size:.62rem; line-height:1.5; padding:.35rem .5rem; }
.nerv-rt-log-entry.log-user             { color:#ff8800; background:#0d0800; border-left:2px solid #ff4400; }
.nerv-rt-log-entry.log-assistant        { color:#aaffdd; background:#050b08; border-left:2px solid #003322; }
.nerv-rt-log-entry.log-speaker-ramiel  { border-left-color:#ff6600; }
.nerv-rt-log-entry.log-speaker-zeruel  { border-left-color:#00ffcc; }
.nerv-rt-log-entry.log-speaker-arael   { border-left-color:#cc44ff; }
.nerv-rt-log-entry.log-speaker-sachiel { border-left-color:#3b82f6; }
.nerv-rt-log-role   { font-size:.52rem; color:#664422; letter-spacing:.12em; margin-bottom:.15rem; }
.nerv-rt-log-entry.log-speaker-ramiel  .nerv-rt-log-role { color:#884422; }
.nerv-rt-log-entry.log-speaker-zeruel  .nerv-rt-log-role { color:#006644; }
.nerv-rt-log-entry.log-speaker-arael   .nerv-rt-log-role { color:#662288; }
.nerv-rt-log-entry.log-speaker-sachiel .nerv-rt-log-role { color:#1e4a8a; }
.nerv-rt-log-toggle { background:none; border:1px solid #331100; color:#ff6600; font-family:'Courier New',Courier,monospace; font-size:.65rem; letter-spacing:.1em; cursor:pointer; padding:.25rem .5rem; flex-shrink:0; }
.nerv-rt-log-toggle:hover { border-color:#ff4400; }

/* Debug panel — opens left of the log panel */
.nerv-rt-dbg-panel { width:380px; right:300px; border-left-color:#003322; background:#040808; }
.nerv-rt-dbg-panel .nerv-rt-log-title { color:#00ffcc; }
.nerv-rt-dbg-panel .nerv-rt-log-header { border-bottom-color:#003322; }
.nerv-rt-dbg-panel:not(.open) { transform:translateX(calc(100% + 300px)); }
.nerv-rt-dbg-entry { font-family:'Courier New',Courier,monospace; font-size:.58rem; line-height:1.4; padding:.3rem .5rem; border-left:2px solid #222; margin-bottom:2px; }
.nerv-rt-dbg-info  { border-left-color:#336633; }
.nerv-rt-dbg-warn  { border-left-color:#886600; background:#0c0900; }
.nerv-rt-dbg-err   { border-left-color:#882200; background:#0c0400; }
.nerv-rt-dbg-parse { border-left-color:#005588; background:#020810; }
.nerv-rt-dbg-head  { color:#00cc88; }
.nerv-rt-dbg-warn  .nerv-rt-dbg-head { color:#ccaa00; }
.nerv-rt-dbg-err   .nerv-rt-dbg-head { color:#ff4400; }
.nerv-rt-dbg-parse .nerv-rt-dbg-head { color:#0088cc; }
.nerv-rt-dbg-detail { color:#336655; margin-top:.15rem; white-space:pre-wrap; word-break:break-all; }

/* MAGI synthesis speech — bottom-left gutter */
.nerv-rt-s-magi {
    position: absolute !important;
    right: calc(50% + 300px);
    left: 22px;
    top: 75%; transform: translateY(-50%);
    width: auto; text-align: right;
}
.nerv-rt-magi-label { color:#00ffcc !important; text-shadow:0 0 6px rgba(0,255,204,.7); }
.nerv-rt-s-magi .nerv-rt-msg { color:#00ddaa; border-left:none; border-right:1px solid #00ffcc; padding-left:0; padding-right:.3rem; }
.nerv-rt-s-magi .nerv-rt-read-btn { border-color:#003322; color:#00aa88; }
.nerv-rt-s-magi .nerv-rt-read-btn:hover { border-color:#00ffcc; color:#00ffcc; }

/* Popup teal overrides for MAGI */
.nerv-popup-inner[data-advisor="MAGI"] { border-color:#00ffcc; box-shadow:0 0 50px rgba(0,255,204,.2), inset 0 0 60px rgba(0,255,204,.03); }
.nerv-popup-inner[data-advisor="MAGI"] .nerv-popup-header { border-bottom-color:#003322; }
.nerv-popup-inner[data-advisor="MAGI"] .nerv-popup-code { color:#00ffcc; text-shadow:0 0 12px rgba(0,255,204,.7); }
.nerv-popup-inner[data-advisor="MAGI"] .nerv-popup-msg-advisor { color:#00ddaa; background:#020f0a; border-left-color:#00ffcc; }

/* READ button in map speech bubbles */
.nerv-rt-read-btn { background:none; border:1px solid #441100; color:#cc3300; font-family:'Courier New',Courier,monospace; font-size:.55rem; letter-spacing:.12em; cursor:pointer; padding:.1rem .35rem; margin-top:.25rem; display:inline-block; }
.nerv-rt-read-btn:hover { border-color:#ff6600; color:#ff6600; }

/* Advisor detail popup overlay */
.nerv-advisor-popup { position:fixed; inset:0; z-index:600; background:rgba(0,0,0,.82); display:flex; align-items:center; justify-content:center; opacity:0; pointer-events:none; transition:opacity .2s ease; }
.nerv-advisor-popup.open { opacity:1; pointer-events:auto; }

/* Popup inner box */
.nerv-popup-inner { position:relative; width:min(720px, calc(100vw - 80px)); height:min(78vh, 680px); background:#050608; border:1px solid #ff6600; box-shadow:0 0 50px rgba(255,102,0,.25), inset 0 0 60px rgba(255,102,0,.04); display:flex; flex-direction:column; overflow:hidden; }

/* Inner hazard bars */
.nerv-popup-hazard-l, .nerv-popup-hazard-r { position:absolute; top:0; bottom:0; width:10px; z-index:1; pointer-events:none; background:repeating-linear-gradient(-45deg, rgba(255,102,0,.3) 0px, rgba(255,102,0,.3) 2px, rgba(5,6,8,.3) 2px, rgba(5,6,8,.3) 5px); }
.nerv-popup-hazard-l { left:0; }
.nerv-popup-hazard-r { right:0; }

/* Popup header */
.nerv-popup-header { border-bottom:1px solid #331100; padding:.5rem 1.5rem .5rem 1.2rem; display:flex; justify-content:space-between; align-items:center; flex-shrink:0; background:#0a0b0c; z-index:2; }
.nerv-popup-header-left { display:flex; align-items:baseline; gap:.75rem; }
.nerv-popup-code { font-family:'Courier New',Courier,monospace; font-size:1rem; font-weight:900; color:#ff6600; letter-spacing:.25em; text-shadow:0 0 12px rgba(255,102,0,.7); }
.nerv-popup-name { font-family:'Courier New',Courier,monospace; font-size:.65rem; color:#884400; letter-spacing:.15em; }
.nerv-popup-close { background:none; border:1px solid #441100; color:#cc4400; font-family:'Courier New',Courier,monospace; font-size:.68rem; letter-spacing:.1em; cursor:pointer; padding:.2rem .6rem; }
.nerv-popup-close:hover { border-color:#ff4400; color:#ff6600; }

/* Popup message area */
.nerv-popup-msgs { flex:1; overflow-y:auto; padding:1rem 1.5rem; display:flex; flex-direction:column; gap:.75rem; }
.nerv-popup-msg { font-family:'Courier New',Courier,monospace; font-size:.78rem; line-height:1.7; padding:.6rem .8rem; }
.nerv-popup-msg strong { color:#ffcc44; font-weight:700; }
.nerv-popup-msg-advisor { color:#ff8800; background:#0a0800; border-left:2px solid #ff4400; }
.nerv-popup-msg-user    { color:#aaffdd; background:#050b08; border-left:2px solid #00ffcc; margin-left:2rem; }
.nerv-popup-streaming   { opacity:.75; }

/* Popup chat bar */
.nerv-popup-chatbar { border-top:1px solid #331100; padding:.6rem 1rem; flex-shrink:0; background:#0a0b0c; z-index:2; }

/* Individual advisor pages (non-roundtable) */
.nerv-advisor-page .advisor-page-header { background:#050608; border-bottom:1px solid #331100; padding:.8rem 1.25rem; margin-bottom:0; }
.nerv-advisor-page .advisor-back       { font-family:'Courier New',Courier,monospace; font-size:.72rem; color:#cc4400; letter-spacing:.1em; }
.nerv-advisor-page .advisor-back:hover { color:#ff6600; }
.nerv-advisor-page .advisor-title      { font-family:'Courier New',Courier,monospace; font-size:.95rem; color:#ff8800; letter-spacing:.18em; text-transform:uppercase; font-weight:700; }
.nerv-advisor-page .advisor-card-icon  { display:none; }
.nerv-advisor-page .nerv-unit-tag      { font-family:'Courier New',Courier,monospace; font-size:.68rem; color:#ff4400; letter-spacing:.15em; text-shadow:0 0 6px rgba(255,68,0,.5); margin-left:auto; }
