/* SellBees ERP / ClientHub — plain CSS, no build step. Theme tokens (light / dark), restrained gold accent, selective glass. */
:root {
    color-scheme: light;
    --bg: #f4f3ee;
    --bg-a: rgba(240, 170, 29, .12);
    --bg-b: rgba(45, 90, 168, .08);
    --surface: #ffffff;
    --surface-2: #faf9f6;
    --input-bg: #ffffff;
    --row-hover: #fbfaf6;
    --glass: rgba(255, 255, 255, .72);
    --glass-border: rgba(35, 33, 29, .10);
    --border: #e4e0d6;
    --border-strong: #8d877a;
    --text: #23211d;
    --text-2: #4a463f;
    --muted: #666157;
    --gold: #f0aa1d;
    --gold-hover: #df9b10;
    --gold-ink: #7a4f00;
    --gold-bar: #a86c00;
    --gold-soft: #fdf4de;
    --gold-line: #e9cd8c;
    --success: #14683f;
    --success-solid: #17683f;
    --success-bg: #e2f3e9;
    --success-line: #b5dcc4;
    --warning: #8f4500;
    --warning-bg: #fdecd6;
    --danger: #b3261e;
    --danger-bg: #fcebe9;
    --danger-line: #efc5c1;
    --info: #244e96;
    --info-bg: #e6edfa;
    --neutral-bg: #ebe8e1;
    --sidebar-bg: rgba(255, 255, 255, .78);
    --sidebar-text: #3a362f;
    --sidebar-muted: #666157;
    --sidebar-hover: rgba(35, 33, 29, .06);
    --sidebar-active: rgba(240, 170, 29, .20);
    --sidebar-border: rgba(35, 33, 29, .10);
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(35, 33, 29, .05), 0 4px 14px rgba(35, 33, 29, .04);
    --focus-color: #a86c00;
    --focus: 0 0 0 3px rgba(240, 170, 29, .40);
    --sidebar: 248px;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #121110;
    --bg-a: rgba(240, 170, 29, .09);
    --bg-b: rgba(77, 125, 214, .10);
    --surface: #1c1a17;
    --surface-2: #232019;
    --input-bg: #14120f;
    --row-hover: #26231d;
    --glass: rgba(32, 29, 25, .72);
    --glass-border: rgba(255, 255, 255, .09);
    --border: #34302a;
    --border-strong: #7f796c;
    --text: #f2efe8;
    --text-2: #cdc7ba;
    --muted: #aaa496;
    --gold-hover: #f7bd45;
    --gold-ink: #f3c566;
    --gold-bar: #e9a824;
    --gold-soft: #2c2412;
    --gold-line: #5b4620;
    --success: #58d39a;
    --success-solid: #1f8a58;
    --success-bg: #132a1e;
    --success-line: #255a3d;
    --warning: #f4ae62;
    --warning-bg: #33250f;
    --danger: #ff8f86;
    --danger-bg: #331614;
    --danger-line: #6a2b27;
    --info: #9bbcf5;
    --info-bg: #172540;
    --neutral-bg: #2a2721;
    --sidebar-bg: rgba(24, 22, 19, .80);
    --sidebar-text: #d9d4ca;
    --sidebar-muted: #aaa496;
    --sidebar-hover: rgba(255, 255, 255, .07);
    --sidebar-active: rgba(240, 170, 29, .16);
    --sidebar-border: rgba(255, 255, 255, .09);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .25);
    --focus-color: #f7bd45;
    --focus: 0 0 0 3px rgba(247, 189, 69, .45);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14.5px;
    line-height: 1.5;
    color: var(--text);
    background: radial-gradient(900px 500px at 12% -5%, var(--bg-a), transparent 60%), radial-gradient(800px 480px at 100% 0%, var(--bg-b), transparent 60%), var(--bg);
    background-attachment: fixed;
}
a { color: var(--text); text-decoration: underline; text-decoration-color: var(--gold-line); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--gold); }
h1, h2, h3 { margin: 0; line-height: 1.3; color: var(--text); }
h1 { font-size: 1.4rem; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 1rem; font-weight: 650; }
h3 { font-size: .9rem; font-weight: 650; }
p { margin: 0 0 .75rem; }
:focus-visible { outline: 2px solid var(--focus-color); outline-offset: 2px; border-radius: 4px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: .75rem; top: -3rem; z-index: 100; background: var(--gold); color: #23211d; padding: .5rem .9rem; border-radius: var(--radius-sm); font-weight: 650; text-decoration: none; }
.skip-link:focus { top: .75rem; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.strong { font-weight: 650; }

/* ---------- App shell: glass sidebar + glass topbar ---------- */
.app { min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 30; display: flex; flex-direction: column;
    background: var(--sidebar-bg); color: var(--sidebar-text); border-right: 1px solid var(--sidebar-border);
    -webkit-backdrop-filter: blur(16px) saturate(140%); backdrop-filter: blur(16px) saturate(140%);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .sidebar { background: var(--surface); } }
.brand { display: flex; align-items: center; gap: .65rem; padding: 1.1rem 1.1rem 1rem; text-decoration: none; color: var(--text); min-height: 64px; }
.brand-logo { background: #fff; border-radius: 8px; padding: 4px 6px; display: flex; align-items: center; max-width: 100%; }
.brand-logo img { display: block; max-height: 32px; max-width: 168px; width: auto; height: auto; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--gold); color: #23211d; font-weight: 800; display: grid; place-items: center; font-size: 1rem; flex: none; }
.brand-name { font-weight: 650; font-size: .98rem; line-height: 1.2; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; flex-direction: column; gap: 2px; padding: .25rem .65rem .75rem; flex: 1; overflow-y: auto; }
.nav-group { margin: 0; }
.nav-group > summary {
    list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: .5rem;
    font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 650; color: var(--sidebar-muted);
    padding: .85rem .6rem .35rem; border-radius: var(--radius-sm);
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::after { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
.nav-group[open] > summary::after { transform: rotate(45deg); }
.nav a {
    display: flex; align-items: center; gap: .65rem; padding: .55rem .65rem; border-radius: var(--radius-sm);
    color: var(--sidebar-text); text-decoration: none; font-weight: 500; min-height: 40px;
}
.nav a:hover { background: var(--sidebar-hover); color: var(--text); }
.nav a.active { background: var(--sidebar-active); color: var(--text); font-weight: 650; box-shadow: inset 3px 0 0 var(--gold); }
.nav a.active .icon { color: var(--gold-bar); }
.sidebar-foot { padding: .75rem; border-top: 1px solid var(--sidebar-border); }
.sidebar-foot .user { font-size: .8rem; color: var(--sidebar-muted); padding: 0 .4rem .5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot button {
    width: 100%; display: flex; align-items: center; gap: .6rem; background: none; border: 1px solid var(--sidebar-border); color: var(--sidebar-text);
    padding: .5rem .65rem; border-radius: var(--radius-sm); cursor: pointer; font: inherit; min-height: 40px;
}
.sidebar-foot button:hover { background: var(--sidebar-hover); color: var(--text); }

.main { position: relative; margin-left: var(--sidebar); min-width: 0; overflow-x: clip; }
.topbar {
    position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .75rem; padding: .55rem 1.75rem; min-height: 54px;
    background: var(--glass); border-bottom: 1px solid var(--glass-border);
    -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .topbar { background: var(--surface); } }
.topbar .brand-name { display: none; }
.topbar .spacer { flex: 1; }
#nav-toggle { display: none; background: none; border: 1px solid var(--border-strong); color: var(--text); border-radius: var(--radius-sm); min-height: 40px; min-width: 44px; place-items: center; cursor: pointer; }
.theme-switch { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 999px; padding: 2px; background: var(--surface); }
.theme-switch button { border: 0; background: none; color: var(--text-2); font: inherit; font-size: .8rem; font-weight: 600; padding: .3rem .75rem; min-height: 32px; border-radius: 999px; cursor: pointer; }
.theme-switch button[aria-pressed="true"] { background: var(--gold); color: #23211d; }
.theme-switch button:not([aria-pressed="true"]):hover { background: var(--neutral-bg); color: var(--text); }
.content { max-width: 1240px; margin: 0 auto; padding: 1.5rem 1.75rem 3rem; }

/* ---------- Page header ---------- */
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; font-size: .82rem; color: var(--muted); margin-bottom: .35rem; }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--text); text-decoration: underline; }
.breadcrumbs .icon { width: 13px; height: 13px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-header .title-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.page-header .meta { color: var(--muted); font-size: .88rem; margin-top: .25rem; display: flex; flex-wrap: wrap; gap: .25rem .9rem; }
.page-header .meta a { color: var(--text-2); }
.actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.actions form { margin: 0; }

/* ---------- Panels ---------- */
.panel { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1.25rem; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; padding: .85rem 1.1rem; border-bottom: 1px solid var(--border); }
.panel-head .sub { color: var(--muted); font-size: .8rem; font-weight: 400; margin-top: 1px; }
.panel-body { padding: 1.1rem; }
.panel-foot { padding: .7rem 1.1rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); font-size: .88rem; }
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-main-side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.grid > * { min-width: 0; }
.grid > .panel { margin-bottom: 0; }
.stack > * + * { margin-top: 1.25rem; }

/* ---------- Metrics ---------- */
.metrics { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.metric {
    display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1rem;
    text-decoration: none; color: var(--text); box-shadow: var(--shadow); min-width: 0;
}
a.metric:hover { border-color: var(--gold-line); background: var(--surface-2); }
.metric .label { font-size: .78rem; color: var(--muted); display: flex; align-items: center; gap: .35rem; }
.metric .value { font-size: 1.3rem; font-weight: 650; margin-top: .2rem; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric .value .cur { font-size: .78rem; color: var(--muted); font-weight: 500; margin-right: .15rem; }
.metric .hint { font-size: .76rem; color: var(--muted); margin-top: .1rem; }
.metric.is-danger .value { color: var(--danger); }
.metric-group-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 .4rem; }
.summary-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.summary-strip > div { padding: .8rem 1rem; border-right: 1px solid var(--border); min-width: 0; }
.summary-strip > div:last-child { border-right: none; }
.summary-strip .label { font-size: .76rem; color: var(--muted); }
.summary-strip .value { font-size: 1.1rem; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.summary-strip .group { font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; color: var(--gold-ink); font-weight: 650; }

/* ---------- Tables ---------- */
.table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .62rem 1.1rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: .74rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; background: var(--surface-2); white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--row-hover); }
.table td.num, .table th.num { text-align: right; }
.table .primary-cell a { font-weight: 600; }
.table .secondary { display: block; font-size: .8rem; color: var(--muted); }
.table tfoot td { font-weight: 650; background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: none; }
.table tr.subrow td { background: var(--surface-2); font-size: .84rem; color: var(--text-2); padding-top: .4rem; padding-bottom: .4rem; }
.table tr.is-overdue td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.table .row-actions { display: flex; gap: .35rem; justify-content: flex-end; flex-wrap: nowrap; }
.table-min-640 { min-width: 640px; }
.table-min-760 { min-width: 760px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .55rem; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; background: var(--neutral-bg); color: var(--text-2); line-height: 1.5; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge-paid, .badge-active { background: var(--success-bg); color: var(--success); }
.badge-partial { background: var(--warning-bg); color: var(--warning); }
.badge-unpaid, .badge-overdue { background: var(--danger-bg); color: var(--danger); }
.badge-completed { background: var(--info-bg); color: var(--info); }
.badge-cancelled, .badge-archived { background: var(--neutral-bg); color: var(--muted); }
.badge-plain::before { display: none; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 38px; padding: .45rem .9rem;
    border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
    font: inherit; font-weight: 600; font-size: .88rem; cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1.2;
}
.btn:hover { background: var(--surface-2); border-color: var(--text-2); }
.btn-primary { background: var(--gold); border-color: var(--gold); color: #23211d; }
.btn-primary:hover { background: var(--gold-hover); border-color: var(--gold-hover); }
.btn-success { background: var(--success-solid); border-color: var(--success-solid); color: #fff; }
.btn-success:hover { filter: brightness(1.12); }
.btn-danger { color: var(--danger); border-color: var(--danger-line); background: var(--surface); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--neutral-bg); border-color: transparent; }
.btn-sm { min-height: 32px; padding: .3rem .6rem; font-size: .8rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: progress; }
.link-btn { background: none; border: none; padding: 0; font: inherit; cursor: pointer; color: var(--text); text-decoration: underline; text-decoration-color: var(--gold-line); }

/* ---------- Filters & tabs ---------- */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; padding: .85rem 1.1rem; border-bottom: 1px solid var(--border); }
.filters .field { gap: .2rem; }
.filters label { font-size: .74rem; font-weight: 600; color: var(--muted); }
.filters input, .filters select { min-height: 36px; padding: .35rem .6rem; }
.filters .grow { flex: 1 1 220px; }
.filters .check { display: flex; align-items: center; gap: .4rem; min-height: 36px; font-size: .86rem; font-weight: 500; color: var(--text-2); }
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; margin-bottom: 1.25rem; }
.toolbar .field label { font-size: .74rem; color: var(--muted); }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); padding: 0 .75rem; overflow-x: auto; }
.tabs a { padding: .75rem .65rem; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .88rem; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); border-bottom-color: var(--gold); }
.tabs .count { font-weight: 500; color: var(--muted); margin-left: .2rem; }

/* ---------- Forms ---------- */
.form-section { padding: 1.1rem; border-bottom: 1px solid var(--border); }
.form-section:last-of-type { border-bottom: none; }
.form-section > h2 { margin-bottom: .2rem; }
.section-hint { color: var(--muted); font-size: .84rem; margin-bottom: .9rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .9rem 1rem; }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field.full { grid-column: 1 / -1; }
label { font-weight: 600; font-size: .85rem; color: var(--text); }
label .opt { font-weight: 400; color: var(--muted); }
.req { color: var(--danger); margin-left: 2px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], input[type=file], select, textarea {
    width: 100%; min-height: 40px; padding: .5rem .7rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font: inherit; background: var(--input-bg); color: var(--text);
}
input[type=file] { padding: .4rem; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: var(--focus); }
input[disabled] { background: var(--surface-2); color: var(--muted); }
.is-invalid { border-color: var(--danger) !important; }
.error { color: var(--danger); font-size: .8rem; }
.hint { color: var(--muted); font-size: .8rem; }
.checkbox { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
.checkbox input { width: 17px; height: 17px; accent-color: var(--gold-bar); }
.form-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; padding: .9rem 1.1rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.form-actions .spacer { flex: 1; }
.select-search { margin-bottom: .35rem; }
.amount-input { font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Alerts / empty ---------- */
.flash { display: flex; gap: .6rem; align-items: flex-start; padding: .75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; border: 1px solid; font-size: .9rem; }
.flash-success { background: var(--success-bg); border-color: var(--success-line); color: var(--success); }
.flash-error { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.flash ul { margin: .25rem 0 0; padding-left: 1.1rem; }
.callout { padding: .7rem .9rem; border-radius: var(--radius-sm); background: var(--gold-soft); border: 1px solid var(--gold-line); font-size: .86rem; color: var(--gold-ink); }
.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.empty .icon { width: 28px; height: 28px; color: var(--muted); margin-bottom: .4rem; }
.empty p { margin-bottom: .8rem; }

/* ---------- Details list ---------- */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1rem; margin: 0; font-size: .9rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.contact-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; font-size: .9rem; }
.contact-list li { display: flex; gap: .55rem; align-items: flex-start; overflow-wrap: anywhere; }
.contact-list .icon { color: var(--gold-bar); margin-top: 2px; }

/* ---------- Progress ---------- */
.progress { height: 6px; background: var(--neutral-bg); border-radius: 99px; overflow: hidden; min-width: 70px; }
.progress > span { display: block; height: 100%; background: var(--gold-bar); border-radius: 99px; }
.progress.is-complete > span { background: var(--success); }
.progress-cell { display: flex; align-items: center; gap: .5rem; }
.progress-cell .pct { font-size: .76rem; color: var(--muted); width: 34px; text-align: right; }

/* ---------- Stamp ---------- */
.stamp { display: inline-block; font-weight: 800; letter-spacing: .12em; font-size: 1.25rem; padding: .15rem .8rem; border: 3px solid; border-radius: 7px; transform: rotate(-5deg); }
.stamp-due { color: var(--danger); border-color: var(--danger); }
.stamp-partial { color: var(--warning); border-color: var(--warning); font-size: .95rem; }
.stamp-paid { color: var(--success); border-color: var(--success); }

/* ---------- Chart ---------- */
.chart { position: relative; padding: .75rem 1.1rem 1rem; }
.chart svg { display: block; width: 100%; height: auto; max-width: 980px; margin: 0 auto; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font-size: 11px; }
.chart .bar { fill: var(--gold-bar); }
.chart .bar-hit { fill: transparent; cursor: default; }
.chart .bar-hit:hover + .bar, .chart .bar-group:hover .bar { fill: var(--gold-ink); }
.chart-tip {
    position: absolute; pointer-events: none; background: #23211d; color: #fff; font-size: .78rem; padding: .35rem .55rem; border-radius: 6px;
    white-space: nowrap; transform: translate(-50%, -110%); opacity: 0; transition: opacity .08s;
}
.chart-tip.show { opacity: 1; }
details.table-toggle summary { cursor: pointer; font-size: .82rem; color: var(--muted); padding: 0 1.1rem .8rem; }

/* ---------- Invoice workspace ---------- */
.pdf-frame { display: block; width: 100%; height: 1000px; border: 0; background: #e9e6df; border-radius: 0 0 var(--radius) var(--radius); }
.balance-box { display: grid; gap: .5rem; }
.balance-box .row { display: flex; justify-content: space-between; gap: 1rem; font-size: .9rem; }
.balance-box .row.total { font-size: 1.05rem; font-weight: 700; padding-top: .55rem; border-top: 1px solid var(--border); }
.items-table td { vertical-align: top; padding: .5rem .5rem; }
.items-table th { padding: .5rem; }
.items-table textarea { min-height: 40px; }
.items-table .amount { padding-top: .95rem; font-weight: 600; }
.total-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .85rem 1.1rem; background: var(--gold-soft); border-top: 1px solid var(--gold-line); font-weight: 700; font-size: 1.05rem; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-card { width: 100%; max-width: 400px; }
.login-card .brand-block { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.25rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
    .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .grid-main-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); transition: transform .15s ease; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0); background: var(--surface); }
    #nav-toggle { display: grid; }
    .topbar { padding: .55rem 1rem; }
    .topbar .brand-name { display: block; font-size: .95rem; }
    body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
    .main { margin-left: 0; }
    .content { padding: 1rem 1rem 2.5rem; }
    .grid-2 { grid-template-columns: minmax(0, 1fr); }
    .pdf-frame { height: 640px; }
}
@media (max-width: 560px) {
    .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .metric .value { font-size: 1.1rem; }
    .page-header { align-items: flex-start; }
    .page-header .actions { width: 100%; }
    .dl { grid-template-columns: minmax(0, 1fr); }
    .dl dt { margin-top: .35rem; }
    .summary-strip > div { border-right: none; border-bottom: 1px solid var(--border); }
    .table th, .table td { padding: .55rem .75rem; }
    .filters .field { flex: 1 1 140px; }
}
@media print {
    .sidebar, .topbar, .actions { display: none !important; }
    .main { margin: 0; }
}

/* ---------- Glass accents (summary cards only; dense data stays on opaque surfaces) ---------- */
.metric, .summary-strip {
    background: var(--glass); border-color: var(--glass-border);
    -webkit-backdrop-filter: blur(10px) saturate(130%); backdrop-filter: blur(10px) saturate(130%);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .metric, .summary-strip { background: var(--surface); } }
.summary-strip .group { color: var(--gold-ink); }
.metrics-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.panel { border-radius: var(--radius); }
.panel-head h2 { letter-spacing: -.005em; }
.table th { position: sticky; top: 0; }

/* ---------- Forms: required marker, validation, loading ---------- */
.field:has(:required) > label::after { content: " *"; color: var(--danger); font-weight: 700; }
.field .error { display: flex; gap: .3rem; align-items: flex-start; font-weight: 500; }
.field .error::before { content: "!"; display: inline-grid; place-items: center; width: 15px; height: 15px; flex: none; border-radius: 50%; background: var(--danger); color: var(--surface); font-size: .7rem; font-weight: 800; margin-top: 2px; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); border-width: 2px; }
input:focus, select:focus, textarea:focus { border-color: var(--gold-bar); box-shadow: var(--focus); }
input[type=checkbox], input[type=radio] { accent-color: var(--gold-bar); }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--text); border-top-color: transparent; animation: spin .7s linear infinite; }
.btn-primary.is-loading::after, .btn-success.is-loading::after { border-color: #23211d; border-top-color: transparent; }
.btn-success.is-loading::after { border-color: #fff; border-top-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-sm { min-height: 36px; }

/* ---------- Confirmation dialog ---------- */
dialog.confirm { border: 1px solid var(--glass-border); border-radius: var(--radius); padding: 0; max-width: min(92vw, 440px); width: 100%; background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
dialog.confirm::backdrop { background: rgba(10, 10, 8, .55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
dialog.confirm .dlg-body { padding: 1.2rem 1.25rem .8rem; }
dialog.confirm h2 { margin-bottom: .4rem; }
dialog.confirm .dlg-actions { display: flex; justify-content: flex-end; gap: .5rem; padding: .8rem 1.25rem 1.1rem; flex-wrap: wrap; }

/* ---------- Status badge extras (text + dot, never colour alone) ---------- */
.badge-draft, .badge-pending { background: var(--warning-bg); color: var(--warning); }
.badge-rejected { background: var(--danger-bg); color: var(--danger); }
.sidebar .badge { margin-left: auto; }
.list-actions { display: flex; gap: .4rem; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- Motion & contrast preferences ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
    .btn, .badge, .nav a.active { border: 1px solid CanvasText; }
}
@media (max-width: 900px) {
    .theme-switch button { padding: .3rem .55rem; }
}

/* =====================================================================================
   Form design system (shared by every form in the app; both themes via tokens)
   ===================================================================================== */
:root {
    --control-border: #918b7e;
    --control-border-hover: #5f5a50;
    --placeholder: #6f6a5f;
    --readonly-bg: #f1efe8;
    --disabled-bg: #ebe8e1;
    --control-radius: 11px;
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666157' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    --search-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666157' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
    --check-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2323211d' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] {
    --control-border: #7f796c;
    --control-border-hover: #aaa496;
    --placeholder: #9a9488;
    --readonly-bg: #1a1814;
    --disabled-bg: #201e1a;
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23aaa496' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    --search-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23aaa496' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
}

/* Text-like controls. The :not() chain also catches inputs that have no type attribute. */
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number], input[type=search],
input[type=date], input[type=month], input[type=tel], input[type=url], select, textarea {
    width: 100%; min-height: 46px; padding: .6rem .9rem; font: inherit; font-size: .95rem; color: var(--text);
    background-color: var(--input-bg); border: 1px solid var(--control-border); border-radius: var(--control-radius);
    transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}
input::placeholder, textarea::placeholder { color: var(--placeholder); opacity: 1; }
input:not([type]):hover, input[type=text]:hover, input[type=email]:hover, input[type=password]:hover, input[type=number]:hover,
input[type=search]:hover, input[type=date]:hover, input[type=month]:hover, select:hover, textarea:hover { border-color: var(--control-border-hover); }
input:not([type]):focus, input[type=text]:focus, input[type=email]:focus, input[type=password]:focus, input[type=number]:focus,
input[type=search]:focus, input[type=date]:focus, input[type=month]:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--gold-bar); box-shadow: var(--focus);
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input[readonly], textarea[readonly] { background-color: var(--readonly-bg); border-style: dashed; cursor: default; }
input:disabled, select:disabled, textarea:disabled { background-color: var(--disabled-bg); color: var(--muted); border-color: var(--border); cursor: not-allowed; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"], input.is-invalid, select.is-invalid, textarea.is-invalid {
    border-color: var(--danger) !important; box-shadow: 0 0 0 1px var(--danger) inset;
}
input.is-valid, select.is-valid, textarea.is-valid { border-color: var(--success); }
input[type=number] { font-variant-numeric: tabular-nums; }
input[type=date], input[type=month] { font-variant-numeric: tabular-nums; }
input[type=date]::-webkit-calendar-picker-indicator, input[type=month]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .75; border-radius: 4px; padding: 2px; }
input[type=date]::-webkit-calendar-picker-indicator:hover, input[type=month]::-webkit-calendar-picker-indicator:hover { opacity: 1; background: var(--neutral-bg); }

/* Select: native behaviour, themed arrow */
select {
    -webkit-appearance: none; appearance: none; padding-right: 2.5rem; cursor: pointer;
    background-image: var(--select-arrow); background-repeat: no-repeat; background-position: right .85rem center; background-size: 16px;
}
select:disabled { cursor: not-allowed; }
select[multiple] { background-image: none; padding: .4rem; min-height: 132px; cursor: default; }
select[multiple] option { padding: .4rem .6rem; border-radius: 6px; }
option { background: var(--surface); color: var(--text); }

/* Search */
input[type=search] { background-image: var(--search-icon); background-repeat: no-repeat; background-position: .85rem center; background-size: 16px; padding-left: 2.5rem; }
input[type=search]::-webkit-search-cancel-button { cursor: pointer; }

/* Compact controls inside tables, filter bars and inline action rows */
.table td input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=file]), .table td select,
.panel-foot input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=file]), .panel-foot select,
.filters input:not([type=checkbox]):not([type=radio]):not([type=hidden]), .filters select, .compact-form input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=file]), .compact-form select {
    min-height: 38px; padding: .4rem .7rem; font-size: .88rem; border-radius: 9px;
}
.table td select, .panel-foot select, .filters select, .compact-form select { padding-right: 2.2rem; }
.filters input[type=search], .select-search { padding-left: 2.4rem; }

/* Field structure: label, control, helper, error */
.field > label, .field > .label { font-size: .85rem; font-weight: 600; color: var(--text); }
.field .hint, .form-help { color: var(--muted); font-size: .8rem; line-height: 1.4; }
.field:has(:required) > label::after { content: " *"; color: var(--danger); font-weight: 700; }
.field .error { margin-top: .1rem; }
.form-card { max-width: 760px; }
.form-card.wide { max-width: 980px; }
.form-section > h2 { font-size: 1rem; margin-bottom: .15rem; }
.form-section + .form-section { border-top: 1px solid var(--border); }
.form-actions { gap: .6rem; }

/* Currency / numeric prefix */
.input-affix {
    display: flex; align-items: stretch; width: 100%; max-width: 100%; background-color: var(--input-bg);
    border: 1px solid var(--control-border); border-radius: var(--control-radius); overflow: hidden;
    transition: border-color .16s ease, box-shadow .16s ease;
}
.input-affix:hover { border-color: var(--control-border-hover); }
.input-affix:focus-within { border-color: var(--gold-bar); box-shadow: var(--focus); }
.input-affix .affix {
    display: grid; place-items: center; padding: 0 .85rem; background: var(--surface-2); color: var(--text-2);
    font-weight: 650; border-right: 1px solid var(--border); user-select: none; min-width: 2.6rem;
}
.input-affix input, .input-affix input:hover, .input-affix input:focus {
    border: 0 !important; box-shadow: none !important; border-radius: 0; background: transparent; flex: 1; min-width: 0; width: auto;
    font-variant-numeric: tabular-nums;
}
.input-affix:has(input[aria-invalid="true"]) { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger) inset; }
.table td .input-affix, .panel-foot .input-affix, .compact-form .input-affix { display: inline-flex; width: auto; border-radius: 9px; }
.table td .input-affix .affix, .panel-foot .input-affix .affix, .compact-form .input-affix .affix { padding: 0 .55rem; min-width: 2rem; font-size: .85rem; }

/* Checkbox & radio */
input[type=checkbox], input[type=radio] {
    -webkit-appearance: none; appearance: none; flex: none; width: 20px; height: 20px; margin: 0; cursor: pointer;
    background-color: var(--input-bg); border: 1.5px solid var(--control-border); background-repeat: no-repeat; background-position: center; background-size: 14px;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
input[type=checkbox] { border-radius: 6px; }
input[type=radio] { border-radius: 50%; }
input[type=checkbox]:hover, input[type=radio]:hover { border-color: var(--control-border-hover); }
input[type=checkbox]:checked { background-color: var(--gold); border-color: var(--gold-bar); background-image: var(--check-mark); }
input[type=radio]:checked { border-color: var(--gold-bar); background-image: radial-gradient(circle, #23211d 0 32%, var(--gold) 36%); background-color: var(--gold); background-size: 100% 100%; }
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible { outline: 2px solid var(--focus-color); outline-offset: 2px; }
input[type=checkbox]:disabled, input[type=radio]:disabled { opacity: .5; cursor: not-allowed; }
.checkbox, label.check { display: inline-flex; align-items: center; gap: .6rem; font-weight: 500; cursor: pointer; }
.checkbox input, label.check input { width: 20px; height: 20px; }

/* Toggle switch: <input type="checkbox" class="switch" role="switch"> */
input[type=checkbox].switch {
    width: 44px; height: 26px; border-radius: 999px; border: 1.5px solid var(--control-border); background-color: var(--neutral-bg);
    background-image: radial-gradient(circle closest-side, var(--text-2) 0 100%); background-size: 18px 18px; background-position: 3px center;
    transition: background-position .16s ease, background-color .16s ease, border-color .16s ease;
}
input[type=checkbox].switch:checked { background-color: var(--gold); border-color: var(--gold-bar); background-image: radial-gradient(circle closest-side, #23211d 0 100%); background-position: 20px center; }

/* Role / option cards (multi-select as checkboxes) */
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .5rem; }
.role-option {
    display: flex; align-items: center; gap: .65rem; padding: .6rem .8rem; min-height: 46px; cursor: pointer; font-weight: 600; font-size: .9rem;
    background: var(--input-bg); border: 1px solid var(--control-border); border-radius: var(--control-radius);
    transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease;
}
.role-option:hover { border-color: var(--control-border-hover); }
.role-option:has(input:checked) { border-color: var(--gold-bar); background: var(--gold-soft); box-shadow: inset 0 0 0 1px var(--gold-bar); }
.role-option:has(input:focus-visible) { outline: 2px solid var(--focus-color); outline-offset: 2px; }
.role-option .role-state { margin-left: auto; font-size: .72rem; font-weight: 650; color: var(--muted); }
.role-option:has(input:checked) .role-state { color: var(--gold-ink); }
.role-grid.compact { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); min-width: 320px; }
.role-grid.compact .role-option { min-height: 38px; padding: .35rem .6rem; font-size: .84rem; border-radius: 9px; }

/* File upload */
input[type=file] {
    width: 100%; padding: .55rem; font: inherit; font-size: .9rem; color: var(--text-2); background: var(--surface-2);
    border: 1.5px dashed var(--control-border); border-radius: var(--control-radius); cursor: pointer;
    transition: border-color .16s ease, background-color .16s ease;
}
input[type=file]:hover { border-color: var(--gold-bar); background: var(--gold-soft); }
input[type=file]:focus-visible { outline: 2px solid var(--focus-color); outline-offset: 2px; }
input[type=file]::file-selector-button {
    margin-right: .8rem; padding: .45rem .9rem; font: inherit; font-weight: 650; font-size: .85rem; cursor: pointer;
    color: var(--text); background: var(--surface); border: 1px solid var(--control-border); border-radius: 9px; transition: background-color .15s ease;
}
input[type=file]::file-selector-button:hover { background: var(--neutral-bg); }
.upload-note { color: var(--muted); font-size: .78rem; margin-top: .2rem; }
.panel-foot input[type=file], .compact-form input[type=file] { width: auto; max-width: 100%; padding: .35rem; }

/* Buttons */
.btn {
    min-height: 42px; padding: .5rem 1.05rem; border-radius: 10px; letter-spacing: .005em;
    transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease, filter .16s ease;
}
.btn-sm { min-height: 36px; padding: .3rem .75rem; border-radius: 9px; }
.btn-secondary { background: var(--surface); }
.btn-outline { background: transparent; border-color: var(--control-border); }
.btn-outline:hover { background: var(--neutral-bg); }
.btn-primary { box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 1px 2px rgba(35, 33, 29, .18); }
.btn-primary:hover { filter: none; }
.btn:active { filter: brightness(.95); }
.btn:disabled, .btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; filter: none; }
.btn.is-loading:disabled { opacity: 1; cursor: progress; }
.btn-danger { font-weight: 650; }
.btn-danger:hover { box-shadow: 0 0 0 1px var(--danger) inset; }

/* Login & dialog forms */
.login-card .panel { border-radius: 16px; box-shadow: 0 10px 40px rgba(0, 0, 0, .12); }
.login-card .form-section { gap: 1rem; }
dialog.confirm .btn { min-height: 42px; }
.upload-wrap { display: flex; flex-direction: column; min-width: 0; flex: 1 1 260px; }

/* =====================================================================================
   AJAX feedback: toasts, in-place refresh state, notification bell & panel
   ===================================================================================== */
.content.is-refreshing { opacity: .6; transition: opacity .15s ease; pointer-events: none; }
.content.is-refreshing::before { content: ""; position: fixed; top: 54px; left: var(--sidebar); right: 0; height: 3px; background: linear-gradient(90deg, transparent, var(--gold), transparent); background-size: 40% 100%; background-repeat: no-repeat; animation: sb-bar 1s linear infinite; z-index: 25; }
@keyframes sb-bar { from { background-position: -40% 0; } to { background-position: 140% 0; } }

.toast-region { position: fixed; top: 64px; right: 1rem; z-index: 200; display: flex; flex-direction: column; gap: .5rem; width: min(380px, calc(100vw - 2rem)); pointer-events: none; }
.toast {
    pointer-events: auto; display: flex; align-items: flex-start; gap: .65rem; padding: .7rem .8rem; border-radius: var(--radius); font-size: .9rem;
    background: var(--surface); color: var(--text); border: 1px solid var(--border); border-left-width: 4px; box-shadow: 0 8px 28px rgba(0, 0, 0, .18);
    animation: toast-in .2s ease;
}
.toast.is-leaving { opacity: 0; transform: translateX(12px); transition: opacity .18s ease, transform .18s ease; }
.toast-icon { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .8rem; color: var(--surface); }
.toast-text { flex: 1; line-height: 1.4; overflow-wrap: anywhere; padding-top: 1px; }
.toast-close { flex: none; background: none; border: 0; color: var(--muted); font-size: 1.3rem; line-height: 1; cursor: pointer; min-width: 32px; min-height: 32px; border-radius: 8px; }
.toast-close:hover { background: var(--neutral-bg); color: var(--text); }
.toast-success { border-left-color: var(--success-solid); } .toast-success .toast-icon { background: var(--success-solid); color: #fff; }
.toast-error { border-left-color: var(--danger); } .toast-error .toast-icon { background: var(--danger); }
.toast-warning { border-left-color: var(--warning); } .toast-warning .toast-icon { background: var(--warning); }
.toast-info { border-left-color: var(--info); } .toast-info .toast-icon { background: var(--info); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.notif { position: relative; }
.notif-bell { position: relative; display: grid; place-items: center; min-width: 44px; min-height: 40px; background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); border-radius: 999px; cursor: pointer; }
.notif-bell:hover { background: var(--neutral-bg); }
.notif-badge { position: absolute; top: -6px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: .72rem; font-weight: 750; display: grid; place-items: center; border: 2px solid var(--bg); }
.notif-badge[hidden] { display: none; }
.notif-panel {
    position: absolute; right: 0; top: calc(100% + 10px); width: min(400px, calc(100vw - 1.5rem)); z-index: 60; border-radius: 14px;
    background: var(--surface); border: 1px solid var(--glass-border); box-shadow: 0 18px 50px rgba(0, 0, 0, .28); overflow: hidden;
}
.notif-panel[hidden] { display: none; }
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .7rem .9rem; border-bottom: 1px solid var(--border); }
.notif-head h2 { font-size: .95rem; }
.notif-actions { display: flex; gap: .15rem; }
.notif-list { list-style: none; margin: 0; padding: 0; max-height: min(420px, 60vh); overflow-y: auto; }
.notif-item + .notif-item { border-top: 1px solid var(--border); }
.notif-open { display: grid; gap: .1rem; padding: .7rem .9rem; color: var(--text); text-decoration: none; }
a.notif-open:hover { background: var(--row-hover); }
.notif-item.is-unread .notif-open { background: var(--gold-soft); box-shadow: inset 3px 0 0 var(--gold-bar); }
.notif-cat { font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; color: var(--gold-ink); font-weight: 700; }
.notif-title { font-weight: 650; }
.notif-msg { font-size: .86rem; color: var(--text-2); }
.notif-time { font-size: .76rem; }
.notif-empty { display: grid; gap: .2rem; text-align: center; padding: 1.6rem 1rem; color: var(--text-2); }
.notif-foot { padding: .6rem .9rem; border-top: 1px solid var(--border); background: var(--surface-2); text-align: center; font-size: .86rem; }

.notice-row { display: flex; gap: .9rem; align-items: center; padding: .85rem 1.1rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.notice-row.is-unread { background: var(--gold-soft); box-shadow: inset 3px 0 0 var(--gold-bar); }
.notice-main { flex: 1 1 260px; min-width: 0; }
.small { font-size: .8rem; }

@media (max-width: 900px) {
    .toast-region { top: 60px; right: 50%; transform: translateX(50%); }
    .content.is-refreshing::before { left: 0; }
    .notif-panel { position: fixed; top: 62px; right: .75rem; left: .75rem; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
    .toast, .content.is-refreshing::before { animation: none; }
    .toast.is-leaving { transition: none; }
}
