/* NeonLedger design system.
   Brand colour is a runtime token: js/core/theme.js writes --accent / --on-accent / --accent-text / --accent-soft
   from Settings > Branding, so the whole UI (and the PDFs) follow one colour. Defaults below match #CCFF00. */

:root {
  color-scheme: light;
  --accent: #CCFF00; --on-accent: #0B0F00; --accent-rgb: 204, 255, 0; --at-l: #5E7A00; --at-d: #D4FF3A; --as-l: #F3FFC2; --accent-line: #B7E400;
  --accent-text: var(--at-l); --accent-soft: var(--as-l); --chart-accent: var(--at-l);
  --bg: #F8F9F3; --surface: #FFFFFF; --surface-2: #F1F3E8; --ink: #0E1100; --muted: #596047; --faint: #868C73;
  --line: #E2E6D3; --line-strong: #CBD1B8; --overlay: rgba(10, 14, 0, .45);
  --good: #1E7B34; --good-bg: #E3F6E6; --warn: #8A5A00; --warn-bg: #FFF1CC; --bad: #B3261E; --bad-bg: #FDE7E5; --info: #1D5FB8; --info-bg: #E4EEFB;
  --shadow: 0 1px 2px rgba(20, 24, 0, .06), 0 8px 28px rgba(20, 24, 0, .07);
  --glow: 0 0 0 rgba(0, 0, 0, 0);
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --radius: 14px; --radius-sm: 9px; --sidebar-w: 268px; --topbar-h: 62px;
  --font: ui-sans-serif, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: ui-sans-serif, "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --accent-text: var(--at-d); --accent-soft: rgba(var(--accent-rgb), .13); --chart-accent: var(--accent);
  --bg: #000000; --surface: #0B0C07; --surface-2: #14160D; --ink: #F3F7E3; --muted: #A5AC90; --faint: #747A63;
  --line: #22251A; --line-strong: #353A27; --overlay: rgba(0, 0, 0, .7);
  --good: #5BE07A; --good-bg: rgba(91, 224, 122, .13); --warn: #FFC53D; --warn-bg: rgba(255, 197, 61, .13); --bad: #FF7B72; --bad-bg: rgba(255, 123, 114, .13); --info: #6CB2FF; --info-bg: rgba(108, 178, 255, .13);
  --shadow: 0 0 0 1px rgba(255, 255, 255, .02), 0 10px 40px rgba(0, 0, 0, .6);
  --glow: 0 0 22px rgba(var(--accent-rgb), .22);
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #0ca30c; --s7: #9085e9; --s8: #e66767;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) { color-scheme: dark; }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; font-size: 16px; }
@media (min-width: 1920px) { html { font-size: 17.5px; } }
@media (min-width: 2560px) { html { font-size: 21px; } }
@media (min-width: 3400px) { html { font-size: 27px; } }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 .9375rem/1.5 var(--font); -webkit-font-smoothing: antialiased; min-height: 100vh; font-variant-numeric: tabular-nums; }
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; letter-spacing: -.015em; line-height: 1.2; }
h1 { font-size: 1.6rem; font-weight: 750; } h2 { font-size: 1.15rem; font-weight: 700; } h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 .6em; }
a { color: var(--accent-text); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
:root[data-theme="light"] :focus-visible, :root:not([data-theme]) :focus-visible { outline-color: var(--ink); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .right { text-align: right; } .center { text-align: center; } .nowrap { white-space: nowrap; }
.hidden { display: none !important; } .grow { flex: 1; min-width: 0; } .mono { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; } .row.tight { gap: .35rem; } .between { justify-content: space-between; }
.stack { display: grid; gap: 1rem; } .stack.tight { gap: .5rem; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pre { white-space: pre-wrap; }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .25s ease; }
.app.collapsed { grid-template-columns: 78px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 1rem .8rem; z-index: 40; overflow-y: auto; overscroll-behavior: contain; }
.brand { display: flex; align-items: center; gap: .7rem; padding: .3rem .5rem 1.1rem; min-height: 56px; }
.brand-logo { width: 38px; height: 38px; border-radius: 11px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font: 800 1.05rem var(--font-display); flex: none; overflow: hidden; box-shadow: var(--glow); }
.brand-logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.brand-name { font: 750 1.02rem/1.15 var(--font-display); letter-spacing: -.01em; overflow: hidden; }
.brand-name small { display: block; font: 400 .72rem var(--font); color: var(--muted); letter-spacing: 0; margin-top: 2px; }
.nav { display: grid; gap: 2px; margin-top: .2rem; }
.nav-label { font-size: .72rem; color: var(--faint); padding: .9rem .75rem .3rem; letter-spacing: .02em; }
.nav a { display: flex; align-items: center; gap: .75rem; padding: .62rem .75rem; border-radius: 11px; color: var(--muted); text-decoration: none; font-weight: 550; position: relative; min-height: 44px; transition: background .15s, color .15s; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--accent); color: var(--on-accent); box-shadow: var(--glow); }
.nav a .badge-dot { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--ink); color: var(--bg); font-size: .7rem; display: grid; place-items: center; }
.nav a[aria-current="page"] .badge-dot { background: var(--on-accent); color: var(--accent); }
.app.collapsed .brand-name, .app.collapsed .nav a span.t, .app.collapsed .nav-label, .app.collapsed .badge-dot, .app.collapsed .side-foot .t { display: none; }
.app.collapsed .nav a { justify-content: center; padding-inline: 0; }
.side-foot { margin-top: auto; padding-top: 1rem; display: grid; gap: .5rem; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: .6rem; padding: 0 clamp(.9rem, 2vw, 2rem); background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4); border-bottom: 1px solid var(--line); }
.topbar .search { flex: 1; max-width: 520px; }
.page { padding: clamp(1rem, 2.2vw, 2.2rem); width: 100%; max-width: 1760px; margin-inline: auto; flex: 1; }
@media (min-width: 2200px) { .page { max-width: 2200px; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.3rem; }
.page-head .sub { color: var(--muted); margin-top: .25rem; }
.crumbs { font-size: .82rem; color: var(--muted); margin-bottom: .35rem; } .crumbs a { color: var(--muted); }

.menu-btn { display: none; }
.scrim { display: none; }
@media (max-width: 1023px) {
  .app, .app.collapsed { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(86vw, 330px); transform: translateX(-102%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); box-shadow: var(--shadow); height: 100dvh; }
  .app.drawer-open .sidebar { transform: none; }
  .app.drawer-open .scrim { display: block; position: fixed; inset: 0; background: var(--overlay); z-index: 35; animation: fade .2s; }
  .menu-btn { display: inline-grid; }
  .app.collapsed .brand-name, .app.collapsed .nav a span.t, .app.collapsed .nav-label, .app.collapsed .badge-dot, .app.collapsed .side-foot .t { display: revert; }
  .app.collapsed .nav a { justify-content: flex-start; padding-inline: .75rem; }
  .collapse-btn { display: none !important; }
  body.no-scroll { overflow: hidden; }
}
@keyframes fade { from { opacity: 0; } }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 42px; padding: .5rem 1rem; border-radius: 11px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; cursor: pointer; text-decoration: none; color: var(--ink); transition: transform .08s, background .15s, box-shadow .15s, border-color .15s; white-space: nowrap; }
.btn:hover { background: var(--surface-2); } .btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); box-shadow: var(--glow); }
.btn.primary:hover { filter: brightness(.96); box-shadow: 0 0 0 3px var(--accent-soft), var(--glow); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); } .btn.danger:hover { background: var(--bad-bg); }
.btn.ghost { border-color: transparent; background: transparent; } .btn.ghost:hover { background: var(--surface-2); }
.btn.sm { min-height: 34px; padding: .25rem .65rem; font-size: .84rem; border-radius: 9px; }
.btn.icon { padding: 0; width: 42px; } .btn.icon.sm { width: 34px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn .spin { width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: rot .7s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
.ico { width: 1.15em; height: 1.15em; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.field { display: grid; gap: .3rem; min-width: 0; }
.field > label, .lbl { font-size: .8rem; font-weight: 600; color: var(--muted); }
.field .hint { font-size: .78rem; color: var(--faint); } .field .err { font-size: .78rem; color: var(--bad); }
input[type=text], input[type=email], input[type=tel], input[type=url], input[type=number], input[type=date], input[type=password], input[type=search], select, textarea {
  width: 100%; min-height: 42px; padding: .5rem .75rem; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
textarea { min-height: 84px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-text); box-shadow: 0 0 0 3px var(--accent-soft); }
:root[data-theme="dark"] input:focus, :root[data-theme="dark"] select:focus, :root[data-theme="dark"] textarea:focus { border-color: var(--accent); }
input.invalid, select.invalid, textarea.invalid { border-color: var(--bad); }
input[type=checkbox], input[type=radio] { width: 1.15rem; height: 1.15rem; accent-color: var(--accent-text); }
input[type=color] { width: 52px; height: 42px; padding: 3px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); cursor: pointer; }
.check { display: flex; align-items: center; gap: .55rem; min-height: 36px; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: .9rem 1rem; }
.form-grid .wide { grid-column: 1 / -1; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 11px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: .38rem .8rem; border-radius: 9px; cursor: pointer; font-weight: 600; color: var(--muted); min-height: 34px; }
.seg button[aria-pressed="true"], .seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
:root[data-theme="dark"] .seg button.on, :root[data-theme="dark"] .seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); min-width: 0; }
:root[data-theme="dark"] .card { background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface) 70%, #000)); }
.card.flat { box-shadow: none; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .8rem; flex-wrap: wrap; }
.card-head h3 { font-size: .95rem; }
.grid { display: grid; gap: 1rem; }
.kpis { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.kpi { padding: 1rem 1.1rem; position: relative; overflow: hidden; animation: rise .5s both; animation-delay: calc(var(--i, 0) * 40ms); }
.kpi .k-label { font-size: .8rem; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: .4rem; }
.kpi .k-value { font: 780 1.65rem/1.15 var(--font-display); margin-top: .35rem; letter-spacing: -.02em; position: relative; display: inline-block; z-index: 0; }
/* the one signature element: a highlighter swipe behind the headline numbers */
.kpi .k-value::after { content: ""; position: absolute; left: -.18em; right: -.18em; bottom: .06em; height: .42em; background: var(--accent); border-radius: 3px; transform: skew(-6deg) rotate(-.6deg); z-index: -1; opacity: .95; }
:root[data-theme="dark"] .kpi .k-value::after { opacity: .85; box-shadow: 0 0 18px var(--accent-soft); }
:root[data-theme="dark"] .kpi .k-value { color: #fff; }
.kpi .k-sub { font-size: .78rem; color: var(--muted); margin-top: .35rem; }
.kpi.neg .k-value::after { background: var(--bad-bg); } .kpi.warn .k-value::after { background: var(--warn-bg); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.cols-2 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.cols-3 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.split { display: grid; gap: 1rem; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } @media (max-width: 1100px) { .split { grid-template-columns: minmax(0, 1fr); } }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.t th { text-align: left; font-size: .76rem; font-weight: 650; color: var(--muted); padding: .65rem .8rem; border-bottom: 1px solid var(--line-strong); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
table.t th.sortable { cursor: pointer; user-select: none; } table.t th.sortable:hover { color: var(--ink); }
table.t th[aria-sort="ascending"]::after { content: " \2191"; } table.t th[aria-sort="descending"]::after { content: " \2193"; }
table.t td { padding: .7rem .8rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tbody tr { transition: background .12s; } table.t tbody tr:hover { background: var(--surface-2); }
table.t tbody tr.clickable { cursor: pointer; }
table.t td.num, table.t th.num { text-align: right; } table.t tfoot td { font-weight: 700; border-top: 2px solid var(--line-strong); border-bottom: 0; }
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: .9rem; }
.toolbar .search-box { flex: 1; min-width: 200px; max-width: 420px; position: relative; }
.search-box .ico { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search-box input { padding-left: 2.35rem; }
@media (max-width: 719px) {
  table.t.cards thead { display: none; }
  table.t.cards, table.t.cards tbody, table.t.cards tr, table.t.cards td { display: block; width: 100%; }
  table.t.cards tr { border: 1px solid var(--line); border-radius: 12px; margin-bottom: .7rem; padding: .35rem .2rem; background: var(--surface); }
  table.t.cards td { border: 0; padding: .3rem .8rem; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
  table.t.cards td::before { content: attr(data-label); color: var(--muted); font-size: .78rem; font-weight: 600; text-align: left; flex: none; }
  table.t.cards td.act { justify-content: flex-end; } table.t.cards td.act::before { display: none; }
  table.t.cards td.main { font-weight: 650; text-align: left; justify-content: flex-start; } table.t.cards td.main::before { display: none; }
  table.t.cards tbody tr:hover { background: var(--surface); }
}

/* ---------- badges, bars, misc ---------- */
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .16rem .6rem; border-radius: 999px; font-size: .76rem; font-weight: 650; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; }
.badge.good { background: var(--good-bg); color: var(--good); } .badge.warn { background: var(--warn-bg); color: var(--warn); } .badge.bad { background: var(--bad-bg); color: var(--bad); } .badge.info { background: var(--info-bg); color: var(--info); }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }
.tag { display: inline-block; padding: .08rem .5rem; border-radius: 6px; background: var(--surface-2); font-size: .74rem; margin-right: .25rem; }
.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; min-width: 70px; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; box-shadow: var(--glow); }
:root:not([data-theme="dark"]) .progress > i { background: var(--accent-line); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 750; font-size: .85rem; flex: none; }
.empty { text-align: center; padding: 2.4rem 1rem; color: var(--muted); } .empty .ico { width: 2.4rem; height: 2.4rem; color: var(--faint); margin-bottom: .6rem; } .empty h3 { color: var(--ink); margin-bottom: .3rem; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.2rem; margin: 0; } .dl dt { color: var(--muted); font-size: .85rem; } .dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.list { list-style: none; margin: 0; padding: 0; } .list li { display: flex; gap: .8rem; align-items: center; padding: .6rem 0; border-bottom: 1px solid var(--line); } .list li:last-child { border: 0; }
.alert { padding: .8rem 1rem; border-radius: 12px; background: var(--info-bg); color: var(--info); border: 1px solid color-mix(in srgb, var(--info) 25%, transparent); }
.alert.warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); } .alert.bad { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; min-height: 1rem; }
@keyframes shimmer { to { background-position: -200% 0; } }
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; scrollbar-width: none; }
.tabs button, .tabs a.tab { text-decoration: none; display: inline-flex; align-items: center; }
.tabs button, .tabs a.tab { background: none; border: 0; padding: .65rem .9rem; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; min-height: 44px; }
.tabs a.tab { background: none; border: 0; padding: .65rem .9rem; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; min-height: 44px; }
.tabs a.tab[aria-selected="true"], .tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
:root:not([data-theme="dark"]) .tabs a.tab[aria-selected="true"], :root:not([data-theme="dark"]) .tabs button[aria-selected="true"] { border-bottom-color: var(--accent-line); }

/* ---------- modal, toast, palette ---------- */
.modal-root { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 1rem; background: var(--overlay); animation: fade .15s; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); width: min(100%, 560px); max-height: min(92dvh, 900px); display: flex; flex-direction: column; animation: pop .18s cubic-bezier(.2, .9, .3, 1.2); }
.modal.lg { width: min(100%, 860px); } .modal.xl { width: min(100%, 1100px); } .modal.full { width: min(100%, 1240px); height: min(94dvh, 1000px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.modal-body { padding: 1.1rem 1.25rem; overflow-y: auto; flex: 1; overscroll-behavior: contain; } .modal-foot { display: flex; justify-content: flex-end; gap: .6rem; padding: .9rem 1.25rem; border-top: 1px solid var(--line); flex-wrap: wrap; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@media (max-width: 719px) { .modal-root { padding: 0; align-items: end; } .modal, .modal.lg, .modal.xl { width: 100%; border-radius: 18px 18px 0 0; max-height: 94dvh; } .modal.full { height: 96dvh; width: 100%; border-radius: 18px 18px 0 0; } }
.toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 200; display: grid; gap: .5rem; max-width: min(92vw, 380px); }
.toast { background: var(--ink); color: var(--bg); padding: .75rem 1rem; border-radius: 12px; box-shadow: var(--shadow); display: flex; gap: .8rem; align-items: center; animation: pop .2s; font-weight: 550; }
.toast.error { background: var(--bad); color: #fff; } .toast button { background: none; border: 0; color: var(--accent); font-weight: 750; cursor: pointer; padding: .2rem .4rem; }
:root:not([data-theme="dark"]) .toast button { color: var(--accent); }
.palette { width: min(100%, 640px); align-self: start; margin-top: 12vh; } .palette input { border: 0; border-bottom: 1px solid var(--line); border-radius: 18px 18px 0 0; min-height: 56px; font-size: 1.05rem; padding-inline: 1.2rem; }
.palette ul { list-style: none; margin: 0; padding: .4rem; max-height: 50vh; overflow-y: auto; } .palette li { padding: .6rem .8rem; border-radius: 10px; display: flex; gap: .7rem; align-items: center; cursor: pointer; } .palette li[aria-selected="true"] { background: var(--accent-soft); } .palette li small { color: var(--muted); margin-left: auto; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); min-width: 220px; padding: .35rem; z-index: 60; } .menu button, .menu a { display: flex; gap: .6rem; align-items: center; width: 100%; padding: .55rem .7rem; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; text-decoration: none; color: var(--ink); min-height: 40px; } .menu button:hover, .menu a:hover { background: var(--surface-2); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: .3rem 0; } .rel { position: relative; }

/* ---------- charts ---------- */
.chart { position: relative; width: 100%; } .chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font: 500 11px var(--font); fill: var(--muted); } .chart .grid line { stroke: var(--line); stroke-width: 1; } .chart .axis-line { stroke: var(--line-strong); }
.chart .tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); padding: .45rem .65rem; border-radius: 9px; font-size: .8rem; line-height: 1.35; white-space: nowrap; transform: translate(-50%, -110%); opacity: 0; transition: opacity .08s; z-index: 5; box-shadow: var(--shadow); } .chart .tip.show { opacity: 1; } .chart .tip b { font-weight: 700; }
.legend { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin-top: .6rem; font-size: .8rem; color: var(--muted); } .legend span { display: inline-flex; align-items: center; gap: .4rem; } .legend i { width: .7rem; height: .7rem; border-radius: 3px; display: inline-block; }
.donut-wrap { display: grid; grid-template-columns: minmax(120px, 190px) 1fr; gap: 1rem; align-items: center; } @media (max-width: 520px) { .donut-wrap { grid-template-columns: 1fr; justify-items: center; } }
.donut-wrap .legend { flex-direction: column; margin: 0; width: 100%; } .donut-wrap .legend span { justify-content: space-between; width: 100%; } .donut-wrap .legend em { font-style: normal; color: var(--ink); font-weight: 650; margin-left: auto; padding-left: 1rem; }
.chart-table { display: none; margin-top: .6rem; } .chart-table.show { display: block; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.2rem; background: radial-gradient(900px 500px at 15% 10%, var(--accent-soft), transparent 60%), var(--bg); }
.login-card { width: min(100%, 410px); } .login-card .brand-logo { width: 56px; height: 56px; border-radius: 16px; font-size: 1.5rem; }

/* ---------- document form ---------- */
.items { display: grid; gap: .6rem; }
.item-row { display: grid; grid-template-columns: minmax(180px, 2.2fr) 70px 90px 100px 92px 92px 110px 40px; gap: .5rem; align-items: start; padding: .7rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.item-row.d0t0 { grid-template-columns: minmax(180px, 2.2fr) 70px 90px 100px 110px 40px; }
.item-row.d1t0, .item-row.d0t1 { grid-template-columns: minmax(180px, 2.2fr) 70px 90px 100px 92px 110px 40px; }
.item-row .amt { text-align: right; padding-top: .6rem; font-weight: 650; }
.item-row .cell-l { font-size: .72rem; color: var(--muted); display: none; }
.item-row .it-main { display: grid; gap: .4rem; }
@media (max-width: 1100px) { .items .item-row.item-row { grid-template-columns: repeat(4, minmax(0, 1fr)); } .item-row > .it-main { grid-column: 1 / -1; } .item-row .amt { grid-column: span 2; text-align: left; } .item-row .cell-l { display: block; } }
.catalog-pick { position: relative; }
.pdf-preview { background: #7d8070; padding: 1rem; border-radius: 12px; display: grid; gap: 1rem; justify-items: center; overflow: auto; flex: 1; }
:root[data-theme="dark"] .pdf-preview { background: #1b1d14; }
.pdf-preview .pg { background: #fff; box-shadow: 0 8px 30px rgba(0, 0, 0, .35); width: min(100%, 780px); line-height: 0; } .pdf-preview svg { width: 100%; height: auto; display: block; }
.swatches { display: flex; gap: .45rem; flex-wrap: wrap; } .swatch { width: 34px; height: 34px; border-radius: 10px; border: 2px solid var(--line); cursor: pointer; padding: 0; } .swatch[aria-pressed="true"] { outline: 3px solid var(--ink); outline-offset: 2px; }
.rte-bar { display: flex; gap: .25rem; flex-wrap: wrap; padding: .4rem; border: 1px solid var(--line-strong); border-bottom: 0; border-radius: 10px 10px 0 0; background: var(--surface-2); } .rte-bar .btn { min-height: 34px; padding: 0 .6rem; }
.rte { min-height: 280px; max-height: 55vh; overflow: auto; border: 1px solid var(--line-strong); border-radius: 0 0 10px 10px; padding: .9rem 1rem; background: #fff; color: #111; line-height: 1.5; } .rte:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent-text); }
.rte table { border-collapse: collapse; width: 100%; } .rte td, .rte th { border: 1px solid #ccc; padding: .35rem .5rem; } .rte th { background: #f0f0e6; } .rte img { max-width: 100%; height: auto; }

@media print { .sidebar, .topbar, .toasts, .sticky-actions, .btn, .menu-btn { display: none !important; } .app { display: block; } body { background: #fff; color: #000; } .card { box-shadow: none; border: 1px solid #ccc; } .page { padding: 0; max-width: none; } }
