/* ==========================================================================
   Bykring Project Manager — design system
   "Signal" — futuristic, minimal, near-monochrome dark theme with a single
   crisp accent color. Flat surfaces, hairline borders, sharp radii, no
   blur/glass/gradients/grain. One stylesheet for the whole app. Uses CSS
   custom properties so an AI agent can retheme by editing :root only.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
    --bg:            #08090c;
    --bg-2:          #0d0f13;
    --surface:       #101318;
    --surface-2:     #161a20;
    --border:        #23272e;
    --border-strong: #343a44;
    --text:          #eef1f4;
    --text-dim:      #9aa0aa;
    --muted:         #5a6169;
    --accent:        #00e5c7;
    --accent-dim:    #00a88f;
    --accent-soft:   rgba(0, 229, 199, 0.12);
    --amber:         #ffb454;
    --amber-soft:    rgba(255, 180, 84, 0.12);
    --success:       #39d98a;
    --success-bg:    rgba(57, 217, 138, 0.12);
    --danger:        #ff5c72;
    --danger-bg:     rgba(255, 92, 114, 0.12);
    --radius:        8px;
    --radius-sm:     6px;
    --radius-pill:   999px;
    --shadow:        0 24px 48px -32px rgba(0, 0, 0, 0.9);
    --glow:          0 0 0 2px var(--accent);
    --font:          'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    --font-mono:     'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    text-rendering: optimizeLegibility;
    position: relative;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }

.muted { color: var(--muted); font-size: 0.9rem; }
.right { text-align: right; }

/* ---- Brand --------------------------------------------------------------- */
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-family: var(--font-mono); font-weight: 600; font-size: 1rem; letter-spacing: 0.01em; }
.brand-center { justify-content: center; margin-bottom: 0.5rem; }
.brand-mark {
    display: inline-grid; place-items: center;
    width: 1.9rem; height: 1.9rem; border-radius: var(--radius-sm);
    background: var(--accent); color: #04140f; font-family: var(--font-mono);
    font-size: 0.78rem; font-weight: 700;
}
.brand-name { letter-spacing: 0.01em; }

.ui-icon { display: block; width: 1.1em; height: 1.1em; flex: 0 0 auto; }

/* ==========================================================================
   Background — flat + static technical grid (no motion, no blur, no grain)
   ========================================================================== */
.aurora { position: fixed; inset: 0; overflow: hidden; z-index: -1; background: var(--bg); }
.aurora-blob { display: none; }
.aurora::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(60% 50% at 82% 0%, rgba(0, 229, 199, 0.08), transparent 60%);
}
.grid-overlay {
    position: absolute; inset: 0;
    background-image: linear-gradient(rgba(0,229,199,0.05) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(0,229,199,0.05) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: radial-gradient(85% 65% at 50% 0%, #000, transparent);
}

/* ---- Pointer-reactive particle network layer (canvas, JS-driven) -------- */
.aurora-particles {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    display: block;
    pointer-events: none;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    padding: 0.6rem 1.1rem; border-radius: var(--radius-sm); border: 1px solid transparent;
    font: inherit; font-weight: 600; font-size: 0.88rem; cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #04140f; }
.btn-primary:hover { background: var(--accent-dim); box-shadow: var(--glow); }
.btn-success { background: var(--amber); color: #241200; }
.btn-success:hover { box-shadow: 0 0 0 2px var(--amber); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: rgba(255,92,114,0.3); }
.btn-danger:hover { background: rgba(255,92,114,0.2); }
.btn-block { width: 100%; }
.btn-lg { padding: 0.8rem 1.4rem; font-size: 0.95rem; }

/* ==========================================================================
   Toolbar (page-level actions)
   ========================================================================== */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap; }
.toolbar .toolbar-title { display: flex; flex-direction: column; gap: 0.2rem; }
.toolbar .toolbar-title h2 { font-size: 1.1rem; }
.toolbar .toolbar-title .muted { font-size: 0.85rem; }
.toolbar .toolbar-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

/* ==========================================================================
   Modal dialog
   ========================================================================== */
dialog.modal {
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    border-radius: var(--radius); padding: 0; width: min(600px, 94vw); box-shadow: var(--shadow);
}
dialog.modal::backdrop { background: rgba(4, 5, 7, 0.7); }
dialog.modal[open] { animation: modal-in 0.15s ease; }
@keyframes modal-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1.5rem 1.75rem; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 1.15rem; }
.modal-body { padding: 1.75rem; max-height: 70vh; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 0.6rem; padding: 1.25rem 1.75rem; border-top: 1px solid var(--border); }
.modal-close { background: transparent; border: 0; color: var(--muted); font-size: 1.4rem; line-height: 1; cursor: pointer; padding: 0.15rem 0.4rem; border-radius: var(--radius-sm); }
.modal-close:hover { color: var(--text); background: var(--surface-2); }

/* Segmented toggle (existing client vs new client) */
.seg { display: flex; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.2rem; gap: 0.2rem; }
.seg label { flex: 1; margin: 0; }
.seg input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg span { display: block; text-align: center; padding: 0.5rem 0.75rem; border-radius: 4px; font-size: 0.85rem; color: var(--text-dim); cursor: pointer; font-weight: 600; transition: background 0.15s ease, color 0.15s ease; }
.seg input:checked + span { background: var(--accent); color: #04140f; }
.seg input:focus-visible + span { box-shadow: var(--glow); }

.icon-btn { display: inline-grid; place-items: center; background: transparent; border: 1px solid transparent; color: var(--muted); cursor: pointer; padding: 0.4rem; border-radius: var(--radius-sm); transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease; }
.icon-btn .ui-icon { width: 1rem; height: 1rem; }
.icon-btn:hover { color: var(--danger); background: var(--danger-bg); border-color: rgba(255,92,114,0.35); }

/* ==========================================================================
   Public site header + hero
   ========================================================================== */
.site-header {
    position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between;
    padding: 1.25rem clamp(1.25rem, 5vw, 4rem);
}
.landing { display: flex; flex-direction: column; min-height: 100vh; }
.hero { flex: 1; display: grid; place-items: center; padding: 2rem; text-align: center; }
.hero-inner { max-width: 680px; }
.eyebrow { display: inline-flex; align-items: center; font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em; color: var(--accent); margin-bottom: 1.1rem; padding: 0.3rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.hero-title { font-size: clamp(2.6rem, 7vw, 4.6rem); font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; color: var(--text); }
.hero-sub { color: var(--text-dim); font-size: clamp(1rem, 2.5vw, 1.2rem); margin: 1.25rem auto 2rem; max-width: 540px; }
.hero-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; margin-top: 2.5rem; }
.site-foot { text-align: center; padding: 1.5rem; color: var(--muted); font-size: 0.85rem; }

/* ==========================================================================
   Auth cards (login / install)
   ========================================================================== */
.auth-body { display: grid; place-items: center; min-height: 100vh; padding: 1.5rem; }
.auth-card {
    width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 2.25rem; box-shadow: var(--shadow); text-align: center;
}
.auth-card h1 { font-size: 1.4rem; margin-top: 0.75rem; }
.auth-card form { text-align: left; margin-top: 1.25rem; }
.back-link { display: inline-flex; align-items: center; gap: 0.4rem; margin-top: 1rem; color: var(--text-dim); font-size: 0.9rem; }
.back-link .ui-icon { width: 1rem; height: 1rem; }
.back-link:hover { color: var(--text); }

/* ==========================================================================
   Alerts
   ========================================================================== */
.alert { padding: 0.7rem 0.9rem; border-radius: var(--radius-sm); font-size: 0.9rem; margin-bottom: 0.85rem; border: 1px solid transparent; }
.alert-error { background: var(--danger-bg); color: #ffb0bb; border-color: rgba(255,92,114,0.3); }
.alert-success { background: var(--success-bg); color: #9ff0c4; border-color: rgba(57,217,138,0.3); }
.alert code { background: var(--surface-2); padding: 0.05rem 0.35rem; border-radius: 4px; }

/* ==========================================================================
   Forms
   ========================================================================== */
.stack { display: flex; flex-direction: column; gap: 1.15rem; }
.stack-lg { display: flex; flex-direction: column; gap: 1.75rem; }
.row { display: flex; gap: 1.15rem; flex-wrap: wrap; }
.row > label { flex: 1; min-width: 120px; }
label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.85rem; color: var(--text-dim); font-weight: 500; }
input, select, textarea {
    font: inherit; font-size: 0.95rem; color: var(--text);
    background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 0.6rem 0.75rem; width: 100%; transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--glow); }
textarea { resize: vertical; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239aa0aa' d='M6 8 0 0h12z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.85rem center; padding-right: 2rem; }

/* ==========================================================================
   Panel layout
   ========================================================================== */
.panel { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar {
    background: var(--bg-2); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; padding: 1.5rem 1.15rem; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 0 0.6rem 1.5rem; }
.side-nav { display: flex; flex-direction: column; gap: 0.2rem; flex: 1; }
.side-link { display: flex; align-items: center; gap: 0.7rem; padding: 0.6rem 0.75rem; border-radius: var(--radius-sm); color: var(--text-dim); font-weight: 500; font-size: 0.9rem; border-left: 2px solid transparent; }
.side-link:hover { background: var(--surface-2); color: var(--text); }
.side-link.is-active { background: var(--surface-2); color: var(--text); border-left-color: var(--accent); }
.side-ico { display: inline-grid; place-items: center; width: 1.2rem; height: 1.2rem; color: var(--muted); }
.side-link:hover .side-ico, .side-link.is-active .side-ico { color: var(--accent); }
.side-foot { border-top: 1px solid var(--border); padding-top: 1rem; }
.who { display: flex; flex-direction: column; padding: 0 0.6rem 0.6rem; }
.who-name { font-weight: 600; font-size: 0.9rem; }
.who-mail { color: var(--muted); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; }
.side-logout { display: block; padding: 0.5rem 0.6rem; color: var(--text-dim); font-size: 0.9rem; border-radius: var(--radius-sm); }
.side-logout:hover { background: var(--surface-2); color: var(--danger); }

.content { min-width: 0; }
.content-head { padding: 1.5rem 0; border-bottom: 1px solid var(--border); }
.content-head h1 { font-size: 1.4rem; max-width: 1180px; margin: 0 auto; padding: 0 clamp(1.25rem, 4vw, 2.5rem); }
.content-body { padding: clamp(1.5rem, 4vw, 2.5rem) clamp(1.25rem, 4vw, 2.5rem); max-width: 1180px; margin: 0 auto; }

/* ---- Stat tiles ---------------------------------------------------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; display: flex; flex-direction: column; gap: 0.4rem; }
.stat-label { color: var(--text-dim); font-size: 0.82rem; }
.stat-value { font-family: var(--font-mono); font-size: 1.75rem; font-weight: 600; letter-spacing: -0.01em; }
.stat-accent { border-color: rgba(255,180,84,0.3); }
.stat-accent .stat-value { color: var(--amber); }
.stat-success { border-color: rgba(57,217,138,0.3); }
.stat-success .stat-value { color: var(--success); }

/* ---- Cards & split ------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.75rem; }
.card + .card { margin-top: 1.5rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; gap: 1rem; }
.card-head h2 { font-size: 1.05rem; }
.split { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.empty { color: var(--muted); text-align: center; padding: 1.5rem 0; }

/* ---- Dashboard sections & card grids ------------------------------------ */
.section + .section { margin-top: 2.25rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; }
.section-head h2 { font-family: var(--font-mono); font-size: 0.85rem; color: var(--text-dim); letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.mini-card { display: flex; flex-direction: column; gap: 0.9rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.4rem; cursor: pointer; min-height: 140px; transition: border-color 0.15s ease; }
.mini-card:hover { border-color: var(--accent); }
.mc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; }
.mc-title { font-weight: 600; font-size: 1rem; letter-spacing: -0.01em; }
.mc-sub { color: var(--text-dim); font-size: 0.85rem; margin-top: 0.15rem; }
.mc-meta { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; border-top: 1px solid var(--border); padding-top: 0.8rem; margin-top: auto; }
.mc-total { font-family: var(--font-mono); font-weight: 600; font-size: 1rem; color: var(--amber); }
.mc-count { display: inline-grid; place-items: center; min-width: 1.6rem; height: 1.6rem; padding: 0 0.5rem; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text-dim); font-family: var(--font-mono); font-size: 0.8rem; font-weight: 600; border: 1px solid var(--border); }

/* ---- Company intelligence dashboard ------------------------------------- */
.dashboard-intelligence { margin-top: 0.5rem; }
.section-head > div .muted { margin: 0.25rem 0 0; }
.company-stats { margin-bottom: 1.25rem; }
.company-stats .stat { min-height: 150px; }
.company-stats .muted { margin-top: auto; font-size: 0.78rem; }
.finance-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.8fr); align-items: start; gap: 1.25rem; }
.finance-grid .card + .card { margin-top: 0; }
.finance-grid .health-card { min-width: 0; }
.chart-card .card-head { align-items: flex-start; }
.chart-card .card-head h2, .health-card .card-head h2 { font-size: 1.05rem; }
.chart-card .card-head .muted { margin: 0.25rem 0 0; font-size: 0.8rem; }
.chart-key { display: flex; align-items: center; gap: 0.35rem; color: var(--text-dim); font-size: 0.76rem; white-space: nowrap; }
.chart-key span { display: inline-block; width: 0.65rem; height: 0.65rem; border-radius: 50%; margin-left: 0.45rem; }
.chart-key span:first-child { margin-left: 0; }
.key-income { background: var(--success); }
.key-expense { background: var(--danger); }
.trend-chart { position: relative; height: 270px; padding-top: 0.5rem; overflow: hidden; }
.trend-chart svg { width: 100%; height: 230px; overflow: visible; }
.is-expandable { cursor: zoom-in; outline: none; }
.chart-summary, .chart-detail { position: absolute; inset: 0; transform-origin: center; }
.chart-summary { transition: transform 0.52s cubic-bezier(.2,.8,.2,1), visibility 0s linear 0.52s; }
.chart-detail { visibility: hidden; clip-path: inset(0 50% 0 50%); transform: scale(0.12); transition: clip-path 0.52s cubic-bezier(.2,.8,.2,1), transform 0.52s cubic-bezier(.2,.8,.2,1), visibility 0s linear 0.52s; }
.chart-detail-inner { height: 100%; overflow: hidden; padding: 0 0.25rem; }
.is-expandable:hover, .is-expandable:focus-visible { cursor: default; }
.is-expandable:hover .chart-summary, .is-expandable:focus-visible .chart-summary { transform: scale(0.1); visibility: hidden; }
.is-expandable:hover .chart-detail, .is-expandable:focus-visible .chart-detail { visibility: visible; clip-path: inset(0 0 0 0); transform: scale(1); transition-delay: 0s; }
.dated-bar-chart { display: grid; grid-template-columns: repeat(var(--date-count), minmax(0, 1fr)); gap: 0; align-items: end; width: 100%; height: 224px; padding: 0.75rem 0.4rem 0; border-bottom: 1px solid var(--border); }
.dated-bar-group { display: grid; grid-template-rows: 190px auto; gap: 0.35rem; min-width: 0; }
.dated-bars { position: relative; display: block; height: 190px; border-bottom: 1px solid var(--border); background: repeating-linear-gradient(to top, transparent 0 62px, rgba(255,255,255,0.04) 63px 64px); }
.dated-bar { position: absolute; right: 0; bottom: 0; left: 0; display: block; width: 100%; height: var(--bar-height); min-height: 0; border-radius: 1px 1px 0 0; transition: filter 0.15s ease, width 0.2s ease; }
.dated-bar:hover { filter: brightness(1.25); }
.dated-income-bar { background: var(--success); color: var(--success); }
.dated-expense-bar { background: var(--danger); color: var(--danger); opacity: 0.85; }
.dated-bar-group time { display: none; color: var(--muted); font-size: 0.62rem; line-height: 1.2; text-align: center; text-transform: uppercase; white-space: nowrap; }
.dated-bar-group.is-month-marker time { display: block; }
.chart-detail-note { margin: 0.55rem 0.4rem 0; color: var(--muted); font-size: 0.72rem; line-height: 1.35; }
.chart-grid-line { stroke: var(--border); stroke-width: 1; stroke-dasharray: 4 5; opacity: 0.8; }
.income-bar { fill: rgba(57,217,138,0.5); stroke: var(--success); stroke-width: 1; }
.expense-bar { fill: rgba(255,92,114,0.5); stroke: var(--danger); stroke-width: 1; }
.chart-value { font-family: var(--font-mono); font-size: 12px; font-weight: 600; letter-spacing: 0; paint-order: stroke; stroke: var(--bg); stroke-width: 4px; stroke-linejoin: round; }
.chart-value-income { fill: var(--success); }
.chart-value-expense { fill: var(--danger); }
.chart-labels { display: grid; grid-template-columns: repeat(6, 1fr); padding: 0 2.8%; color: var(--muted); font-size: 0.74rem; text-align: center; text-transform: uppercase; letter-spacing: 0.06em; }
.total-chart-labels { grid-template-columns: repeat(2, 1fr); padding: 0 19%; }
.health-card { display: flex; flex-direction: column; }
.health-row { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 0.85rem 0; border-bottom: 1px solid var(--border); color: var(--text-dim); font-size: 0.85rem; }
.health-row strong { color: var(--text); text-align: right; font-size: 0.95rem; }
.health-note { color: var(--muted); font-size: 0.78rem; line-height: 1.5; margin: auto 0 0; padding-top: 1rem; }

/* ---- Tables -------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th { text-align: left; color: var(--text-dim); font-family: var(--font-mono); font-weight: 500; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; padding: 0.75rem 0.9rem; border-bottom: 1px solid var(--border); }
.table td { padding: 1rem 0.9rem; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.table tbody tr[onclick] { cursor: pointer; transition: background 0.12s ease; }
.table tbody tr[onclick]:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }

/* ---- Pills --------------------------------------------------------------- */
.pill { display: inline-block; padding: 0.2rem 0.55rem; border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; border: 1px solid currentColor; }
.pill-open { background: var(--success-bg); color: var(--success); }
.pill-closed { background: var(--amber-soft); color: var(--amber); }
.pill-archived { background: var(--surface-2); color: var(--muted); }
.pill-unpaid { background: var(--amber-soft); color: var(--amber); }
.pill-paid { background: var(--success-bg); color: var(--success); }

/* ---- Project header + summary ------------------------------------------- */
.proj-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1rem 0 1.75rem; flex-wrap: wrap; }
.proj-head .muted { margin-left: 0.6rem; }
.proj-actions { display: flex; gap: 0.5rem; }
.invoice-panel { display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; margin-bottom: 1.75rem; background: var(--surface); }
.invoice-panel h2 { font-size: 1.1rem; }
.invoice-panel .muted { margin: 0.3rem 0 0; }
.invoice-eyebrow { display: block; margin-bottom: 0.35rem; color: var(--accent); font-family: var(--font-mono); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.invoice-title-row { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; }
.invoice-panel-actions { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.payment-switch { flex-direction: row; align-items: center; gap: 0.5rem; cursor: pointer; color: var(--text); white-space: nowrap; }
.payment-switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { width: 2.35rem; height: 1.3rem; padding: 0.15rem; display: flex; align-items: center; border-radius: var(--radius-pill); background: var(--border); transition: background 0.2s ease; }
.switch-track span { width: 1rem; height: 1rem; border-radius: 50%; background: var(--text); transition: transform 0.2s ease; }
.payment-switch input:checked + .switch-track { background: var(--success); }
.payment-switch input:checked + .switch-track span { transform: translateX(1.05rem); }
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.sum-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.4rem 1.5rem; display: flex; flex-direction: column; gap: 0.3rem; }
.sum-label { color: var(--text-dim); font-size: 0.82rem; }
.sum-value { font-family: var(--font-mono); font-size: 1.4rem; font-weight: 600; letter-spacing: -0.01em; }
.sum-total { background: var(--bg-2); border: 1px solid var(--accent); color: var(--text); box-shadow: none; }
.sum-total .sum-value { color: var(--accent); }

/* ---- Danger zone --------------------------------------------------------- */
.danger-zone { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 900px) {
    .split { grid-template-columns: 1fr; }
    .invoice-panel { align-items: flex-start; flex-direction: column; }
    .finance-grid { grid-template-columns: 1fr; }
    .panel { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
    .sidebar .brand { padding: 0 0.6rem; }
    .side-nav { flex-direction: row; flex: 1 1 100%; overflow-x: auto; }
    .side-foot { border-top: 0; padding-top: 0; display: flex; align-items: center; gap: 0.75rem; }
    .who { display: none; }
}

@media (max-width: 600px) {
    .chart-card .card-head { flex-direction: column; }
    .chart-key { white-space: normal; }
    .stat-value { font-size: 1.55rem; }
}

@media (prefers-reduced-motion: reduce) {
    .chart-summary, .chart-detail { transition: none; }
}
