/* ==========================================================================
   Racuni.info — UI
   ========================================================================== */

:root {
  --bg: #f3f4f0;
  --surface: #ffffff;
  --surface-2: #f7f8f5;
  --surface-3: #eef0eb;
  --line: #e3e6df;
  --line-2: #d3d8cf;
  --ink: #111814;
  --ink-2: #3d4842;
  --muted: #6b766f;
  --brand: #1f7a4d;
  --brand-2: #16603c;
  --brand-soft: #e2f1e8;
  --brand-ink: #0f4d2f;
  --on-brand: #ffffff;
  --blue: #2257d6; --blue-soft: #e7eefc;
  --amber: #a65b06; --amber-soft: #fcefd9;
  --red: #c0392b; --red-soft: #fbe7e4;
  --gray-soft: #eceee9;
  --side-bg: #0e1713;
  --side-ink: #d5ded8;
  --side-muted: #7f8f86;
  --side-hover: rgba(255,255,255,.06);
  --side-active: rgba(84, 201, 140, .14);
  --focus: 0 0 0 3px rgba(31, 122, 77, .22);
  --shadow-sm: 0 1px 2px rgba(17, 24, 20, .06);
  --shadow: 0 1px 2px rgba(17, 24, 20, .05), 0 12px 32px -16px rgba(17, 24, 20, .18);
  --shadow-lg: 0 24px 64px -24px rgba(17, 24, 20, .35);
  --radius: 14px;
  --radius-sm: 9px;
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Fraunces', Georgia, 'Times New Roman', serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b100d; --surface: #121915; --surface-2: #161e1a; --surface-3: #1c2520;
    --line: #232e28; --line-2: #2f3c35; --ink: #e9efeb; --ink-2: #b8c4bd; --muted: #84928a;
    --brand: #3fb27a; --brand-2: #57c48e; --brand-soft: rgba(63,178,122,.14); --brand-ink: #8fe0b6; --on-brand: #06140d;
    --blue: #7ea6ff; --blue-soft: rgba(126,166,255,.13);
    --amber: #f0b35c; --amber-soft: rgba(240,179,92,.13);
    --red: #ff8b7d; --red-soft: rgba(255,139,125,.13);
    --gray-soft: rgba(255,255,255,.07);
    --side-bg: #070b09;
    --focus: 0 0 0 3px rgba(63,178,122,.3);
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 32px -16px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b100d; --surface: #121915; --surface-2: #161e1a; --surface-3: #1c2520;
  --line: #232e28; --line-2: #2f3c35; --ink: #e9efeb; --ink-2: #b8c4bd; --muted: #84928a;
  --brand: #3fb27a; --brand-2: #57c48e; --brand-soft: rgba(63,178,122,.14); --brand-ink: #8fe0b6; --on-brand: #06140d;
  --blue: #7ea6ff; --blue-soft: rgba(126,166,255,.13);
  --amber: #f0b35c; --amber-soft: rgba(240,179,92,.13);
  --red: #ff8b7d; --red-soft: rgba(255,139,125,.13);
  --gray-soft: rgba(255,255,255,.07);
  --side-bg: #070b09;
  --focus: 0 0 0 3px rgba(63,178,122,.3);
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 32px -16px rgba(0,0,0,.6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01';
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.num, td.num, .tabular { font-variant-numeric: tabular-nums; }
::selection { background: color-mix(in srgb, var(--brand) 25%, transparent); }

/* Boot */
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot-mark {
  width: 56px; height: 56px; display: block;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: scale(.9); opacity: .6; } }

/* ------------------------------------------------------------------ Shell */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--side-bg); color: var(--side-ink); padding: 18px 14px;
  background-image: radial-gradient(120% 60% at 0% 0%, rgba(63,178,122,.16), transparent 60%);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 20px; text-decoration: none; color: #fff; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: linear-gradient(145deg, #3fb27a, #1f7a4d); color: #fff;
  font: 600 19px var(--display); box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 6px 16px -6px rgba(63,178,122,.6);
}
.brand-name { font: 600 20px var(--display); letter-spacing: -.01em; }
.brand-mark svg { width: 24px; height: 24px; display: block; }
.brand-name em { font-style: normal; color: #6fdca5; }
.brand-name small { display: block; font: 500 11px var(--font); color: var(--side-muted); letter-spacing: .02em; }

.side .cta {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 4px 18px;
  padding: 10px 12px; border-radius: 11px; text-decoration: none; font-weight: 600;
  background: #3fb27a; color: #04140b; transition: transform .15s, background .15s;
}
.side .cta svg { width: 17px; height: 17px; }
.side .cta:hover { background: #57c48e; transform: translateY(-1px); }
.side .cta kbd { margin-left: auto; font: 600 11px var(--font); background: rgba(0,0,0,.15); padding: 1px 6px; border-radius: 5px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; font-weight: 600; color: var(--side-muted); text-transform: uppercase; letter-spacing: .08em; padding: 14px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px;
  color: var(--side-ink); text-decoration: none; font-weight: 500; transition: background .15s, color .15s;
}
.nav a svg { width: 18px; height: 18px; opacity: .75; }
.nav a:hover { background: var(--side-hover); color: #fff; }
.nav a.active { background: var(--side-active); color: #fff; }
.nav a.active svg { opacity: 1; color: #6fdca5; }
.nav a .count { margin-left: auto; font-size: 11px; font-weight: 600; background: rgba(255,255,255,.08); padding: 1px 7px; border-radius: 99px; color: var(--side-ink); }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, #2c6e4c, #154330); color: #d8f5e6; font-weight: 700; font-size: 13px;
}
.user-card .who { min-width: 0; flex: 1; }
.user-card .who b { display: block; color: #fff; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card .who span { display: block; color: var(--side-muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn-side { background: none; border: 0; color: var(--side-muted); padding: 6px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.icon-btn-side:hover { color: #fff; background: var(--side-hover); }
.icon-btn-side svg { width: 17px; height: 17px; }

.scrim { display: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
#view { padding: 28px 36px 60px; max-width: 1400px; width: 100%; margin: 0 auto; animation: fadeUp .35s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ Page head */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font: 600 30px/1.15 var(--display); letter-spacing: -.02em; margin: 0; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); margin-bottom: 6px; }

/* ------------------------------------------------------------------ Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  padding: 9px 15px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface);
  font-weight: 600; font-size: 13.5px; cursor: pointer; text-decoration: none; color: var(--ink);
  transition: background .15s, border-color .15s, transform .1s, box-shadow .15s; box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--surface-2); border-color: var(--line-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .input:focus, .select:focus, .textarea:focus { outline: none; box-shadow: var(--focus); border-color: var(--brand); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 6px 16px -8px color-mix(in srgb, var(--brand) 80%, transparent); }
.btn-primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 30%, transparent); }
.btn-sm { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-icon { padding: 7px; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn .spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 650; }
.card-head .sub { color: var(--muted); font-size: 12.5px; }

/* ------------------------------------------------------------------ KPIs */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 18px 18px 16px; position: relative; overflow: hidden; }
.kpi .label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; font-weight: 550; }
.kpi .label i { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; }
.kpi .label i svg { width: 15px; height: 15px; }
.kpi .value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi .value small { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.kpi .meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.kpi.hero { background: linear-gradient(150deg, #134a30 0%, #1f7a4d 55%, #2f9a64 100%); border-color: transparent; color: #fff; }
.kpi.hero .label, .kpi.hero .meta, .kpi.hero .value small { color: rgba(255,255,255,.75); }
.kpi.hero .label i { background: rgba(255,255,255,.14); color: #fff; }
.kpi.hero::after { content: ''; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.18), transparent 70%); }
.tone-green i { background: var(--brand-soft); color: var(--brand); }
.tone-blue i { background: var(--blue-soft); color: var(--blue); }
.tone-amber i { background: var(--amber-soft); color: var(--amber); }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 18px; }
.chart-wrap { padding: 8px 20px 18px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .bar-total { fill: color-mix(in srgb, var(--brand) 28%, transparent); }
.chart .bar-paid { fill: var(--brand); }
.chart .bar-group:hover .bar-total { fill: color-mix(in srgb, var(--brand) 40%, transparent); }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .grid { stroke: var(--line); stroke-dasharray: 3 4; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-tip {
  position: fixed; pointer-events: none; z-index: 60; background: var(--ink); color: var(--surface);
  padding: 8px 10px; border-radius: 9px; font-size: 12px; box-shadow: var(--shadow-lg); opacity: 0; transition: opacity .12s;
}
.chart-tip b { display: block; font-size: 13px; }

.top-list { list-style: none; margin: 0; padding: 6px 20px 18px; }
.top-list li { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.top-list li:last-child { border-bottom: 0; }
.top-list .row { display: flex; justify-content: space-between; gap: 10px; font-weight: 550; }
.top-list .row span:last-child { font-variant-numeric: tabular-nums; }
.top-list .meter { height: 6px; border-radius: 99px; background: var(--surface-3); margin-top: 7px; overflow: hidden; }
.top-list .meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), #6fdca5); }

.checklist { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; padding: 16px 20px 20px; }
.check-item { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface-2); text-decoration: none; transition: border-color .15s, transform .15s; }
.check-item:hover { border-color: var(--brand); transform: translateY(-1px); }
.check-item .dot { width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center; border: 2px solid var(--line-2); }
.check-item.done .dot { background: var(--brand); border-color: var(--brand); color: #fff; }
.check-item.done .dot svg { width: 13px; height: 13px; }
.check-item b { display: block; font-size: 13px; }
.check-item span { color: var(--muted); font-size: 12px; }
.check-item.done b { text-decoration: line-through; color: var(--muted); }

/* ------------------------------------------------------------------ Tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); padding: 11px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap;
}
.table th:first-child { border-top-left-radius: var(--radius); }
.table th:last-child { border-top-right-radius: var(--radius); }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: var(--surface-2); }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table .strong { font-weight: 600; }
.table .muted { color: var(--muted); }
.table .actions-cell { text-align: right; white-space: nowrap; width: 1%; }
.cell-title { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: 12.5px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.gray { background: var(--gray-soft); color: var(--muted); }
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.pill.green { background: var(--brand-soft); color: var(--brand); }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.red { background: var(--red-soft); color: var(--red); }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 6px; background: var(--surface-3); color: var(--ink-2); letter-spacing: .02em; }

/* ------------------------------------------------------------------ Toolbar / filters */
.toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 11px; background: var(--surface-3); flex-wrap: wrap; }
.tabs button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-weight: 550; color: var(--muted); font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.tabs button .c { font-size: 11px; background: var(--surface); padding: 0 6px; border-radius: 99px; color: var(--muted); }
.tabs button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.search { position: relative; flex: 1; min-width: 200px; max-width: 360px; margin-left: auto; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.search input { padding-left: 34px; }

/* ------------------------------------------------------------------ Forms */
.input, .select, .textarea {
  width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface);
  transition: border-color .15s, box-shadow .15s; min-height: 38px;
}
.input::placeholder, .textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.textarea { resize: vertical; min-height: 90px; line-height: 1.55; }
.select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236b766f' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label-row { font-size: 12.5px; font-weight: 600; color: var(--ink-2); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.field .hint { font-size: 12px; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.form-section { padding: 20px; border-bottom: 1px solid var(--line); }
.form-section:last-child { border-bottom: 0; }
.form-section h4 { margin: 0 0 14px; font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.form-section h4 .n { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 6px; background: var(--brand-soft); color: var(--brand); font-size: 11px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px dashed var(--line-2); background: var(--surface); padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 550; cursor: pointer; color: var(--ink-2); transition: all .15s; }
.chip:hover { border-color: var(--brand); color: var(--brand); border-style: solid; background: var(--brand-soft); }
.chip.on { background: var(--brand); color: var(--on-brand); border-color: var(--brand); border-style: solid; }
.segmented { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-3); gap: 2px; }
.segmented button { border: 0; background: none; padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; }
.segmented button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 550; font-size: 13px; user-select: none; }
.switch input { appearance: none; width: 34px; height: 20px; border-radius: 99px; background: var(--line-2); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: transform .18s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { transform: translateX(14px); }
.input-affix { position: relative; }
.input-affix .input { padding-right: 38px; }
.input-affix span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 12px; font-weight: 600; pointer-events: none; }

/* ------------------------------------------------------------------ Editor */
.editor { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(340px, 0.7fr); gap: 22px; align-items: start; }
.editor-preview { position: sticky; top: 20px; }
.preview-frame { border-radius: var(--radius); background: var(--surface-3); border: 1px solid var(--line); padding: 16px; }
.preview-frame .head { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12px; font-weight: 600; margin-bottom: 12px; letter-spacing: .04em; text-transform: uppercase; }
.preview-frame .live { display: inline-flex; align-items: center; gap: 6px; color: var(--brand); }
.preview-frame .live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 0 currentColor; animation: live 2s infinite; }
@keyframes live { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 50%, transparent); } 70%, 100% { box-shadow: 0 0 0 7px transparent; } }

.items { width: 100%; border-collapse: separate; border-spacing: 0; }
.items th { font-size: 11px; font-weight: 600; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; text-align: left; padding: 0 6px 8px; white-space: nowrap; }
.items td { padding: 4px 3px; vertical-align: top; }
.items .input { padding: 8px 9px; min-height: 36px; font-size: 13px; }
.items .c-name { width: 31%; }
.items .c-qty { width: 10%; }
.items .c-unit { width: 10%; }
.items .c-price { width: 13%; }
.items .c-disc, .items .c-vat { width: 9%; }
.items .c-total { width: 14%; text-align: right; }
.items td.c-total { padding-top: 13px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.items .num-in { text-align: right; font-variant-numeric: tabular-nums; }
.items .rm { opacity: .5; }
.items tr:hover .rm { opacity: 1; }
.items-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.totals-box { margin-left: auto; margin-top: 16px; width: min(100%, 340px); display: grid; gap: 6px; font-variant-numeric: tabular-nums; }
.totals-box .r { display: flex; justify-content: space-between; color: var(--ink-2); }
.totals-box .r.grand { margin-top: 6px; padding: 12px 14px; border-radius: 11px; background: var(--ink); color: var(--surface); font-weight: 700; font-size: 16px; }
.client-card { margin-top: 10px; padding: 12px 14px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); line-height: 1.6; }
.client-card b { color: var(--ink); font-size: 13.5px; }
.row-inline { display: flex; gap: 8px; align-items: stretch; }
.row-inline > .select, .row-inline > .input { flex: 1; }
.sticky-actions {
  position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; gap: 10px; align-items: center;
  padding: 14px 20px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(8px); border-radius: 0 0 var(--radius) var(--radius);
}
.sticky-actions .grow { flex: 1; color: var(--muted); font-size: 12.5px; }

/* ------------------------------------------------------------------ Doc view */
.doc-page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.doc-page-head .title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.doc-page-head h1 { font: 600 26px var(--display); margin: 0; letter-spacing: -.02em; }
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 22px; align-items: start; }
.paper-stage { background: var(--surface-3); border-radius: var(--radius); padding: 28px; border: 1px solid var(--line); }
.doc-meta { position: sticky; top: 20px; display: grid; gap: 14px; }
.meta-list { padding: 6px 18px 14px; }
.meta-list div { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.meta-list div:last-child { border-bottom: 0; }
.meta-list span { color: var(--muted); }
.meta-list b { font-weight: 600; text-align: right; }
.big-total { padding: 18px; }
.big-total .l { color: var(--muted); font-size: 12.5px; font-weight: 550; }
.big-total .v { font-size: 28px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stack { display: grid; gap: 8px; }

.doc-scaler { width: 100%; position: relative; }
.doc-scaler > .doc { transform-origin: top left; position: absolute; left: 0; top: 0; }

/* ------------------------------------------------------------------ The invoice paper */
.doc {
  --doc-accent: #1f7a4d;
  width: 794px; min-height: 1123px; background: #fff; color: #1b1d20;
  font: 11.5px/1.5 'Inter', 'Helvetica Neue', Arial, sans-serif;
  padding: 44px 46px 30px; display: flex; flex-direction: column; position: relative;
  box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 18px 50px -20px rgba(0,0,0,.28); border-radius: 3px;
  color-scheme: light;
}
.doc * { box-sizing: border-box; }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding-bottom: 14px; border-bottom: 1px solid #e6e8ea; }
.doc-logo { max-width: 55%; min-height: 60px; display: flex; align-items: center; }
.doc-logo img { max-width: 100%; max-height: 100px; display: block; }
.doc-logo .wordmark { font: 700 26px/1.1 'Inter', sans-serif; letter-spacing: -.02em; padding-left: 14px; border-left: 5px solid var(--doc-accent); }
.doc-title { text-align: right; }
.doc-title h1 { font: 800 26px/1.15 'Inter', sans-serif; margin: 0 0 8px; letter-spacing: -.01em; white-space: nowrap; }
.doc-title div { font-size: 11.5px; line-height: 1.6; }
.doc-parties { display: flex; justify-content: space-between; gap: 30px; margin: 14px 0 30px; }
.doc-seller { padding-top: 8px; line-height: 1.75; font-size: 10.5px; }
.doc-seller strong, .doc-buyer strong { font-size: 12.5px; display: block; margin-bottom: 6px; }
.doc-buyer {
  width: 50%; background: #f3f4f6; border-right: 3px solid var(--doc-accent); padding: 16px 16px 16px 20px;
  text-align: right; line-height: 1.75; font-size: 10.5px;
}
.doc-buyer strong { padding-bottom: 8px; border-bottom: 1px solid #e3e5e8; margin-bottom: 8px; }
.doc-items { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.doc-items th { background: #f3f4f6; font-weight: 700; font-size: 9.5px; text-transform: uppercase; padding: 9px 5px; text-align: center; white-space: nowrap; letter-spacing: .01em; }
.doc-items th:first-child, .doc-items td:first-child { text-align: left; padding-left: 4px; }
.doc-items th:last-child, .doc-items td:last-child { text-align: right; padding-right: 5px; }
.doc-items td { padding: 11px 5px; text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.doc-items td:first-child { font-weight: 700; white-space: normal; font-size: 11px; }
.doc-items td:first-child small { display: block; font-weight: 400; color: #666; font-size: 9.5px; }
.doc-items td:last-child { font-weight: 700; }
.doc-sums { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; margin-top: 6px; font-size: 10.5px; font-variant-numeric: tabular-nums; }
.doc-sums div { display: flex; gap: 24px; min-width: 260px; justify-content: space-between; padding: 2px 5px; }
.doc-total-bar { margin-top: 8px; background: #30343c; color: #fff; text-align: right; padding: 9px 10px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.doc-words { text-align: right; font-size: 9.5px; margin-top: 8px; text-transform: uppercase; }
.doc-notes { margin-top: 20px; white-space: pre-wrap; font-size: 11px; line-height: 1.75; word-wrap: break-word; }
.doc-sign { margin-top: 56px; width: 260px; margin-left: 70px; text-align: center; border-top: 1px solid #555; padding-top: 4px; font-size: 11px; }
.doc-spacer { flex: 1; min-height: 30px; }
.doc-foot { text-align: center; font-size: 10.5px; line-height: 1.7; padding-top: 16px; }
.doc-foot .extra { color: #666; margin-top: 4px; }
.doc-badge {
  position: absolute; right: 0; bottom: 200px; writing-mode: vertical-rl; background: #f1f2f3; color: #333;
  font-size: 9.5px; padding: 8px 4px; letter-spacing: .02em;
}
.doc-stamp {
  position: absolute; top: 170px; right: 70px; transform: rotate(-12deg); border: 3px solid; border-radius: 10px;
  padding: 4px 14px; font: 800 22px 'Inter', sans-serif; letter-spacing: .12em; opacity: .75; text-transform: uppercase;
}
.doc-stamp.paid { color: #1f8a52; }
.doc-stamp.cancelled { color: #c0392b; }
.doc-stamp.draft { color: #8a8f96; }


/* ------------------------------------------------------------------ Modern invoice template */
.doc.m { --a: #1f7a4d; --a-soft: color-mix(in srgb, var(--a) 8%, #fff); --a-line: color-mix(in srgb, var(--a) 22%, #fff);
  --ink: #16181d; --mut: #737a86; --ln: #e8eaee; padding: 52px 52px 30px; font-size: 11px; color: var(--ink); }
.doc.m .m-bar { position: absolute; left: 0; right: 0; top: 0; height: 6px; background: linear-gradient(90deg, var(--a), color-mix(in srgb, var(--a) 55%, #fff)); border-radius: 3px 3px 0 0; }
.m-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 30px; }
.m-brand { max-width: 52%; min-height: 56px; display: flex; align-items: center; }
.m-brand img { max-width: 100%; max-height: 88px; display: block; }
.m-word { font-size: 24px; font-weight: 800; letter-spacing: -.03em; display: flex; align-items: center; gap: 10px; }
.m-word::before { content: ''; width: 14px; height: 14px; border-radius: 4px; background: var(--a); }
.m-title { text-align: right; }
.m-kicker { display: flex; justify-content: flex-end; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; color: var(--a); }
.m-no { font-size: 34px; font-weight: 800; letter-spacing: -.035em; line-height: 1.1; margin-top: 4px; font-variant-numeric: tabular-nums; }
.m-status { letter-spacing: .08em; font-size: 9.5px; padding: 3px 9px; border-radius: 99px; }
.m-status.paid { background: #e3f4ea; color: #1b7a47; }
.m-status.cancelled { background: #fbe7e4; color: #b3261e; }
.m-status.draft { background: #eef0f3; color: #6b7280; }

.m-meta { display: grid; grid-template-columns: repeat(4, 1fr); margin: 30px 0 26px; border: 1px solid var(--ln); border-radius: 12px; overflow: hidden; }
.m-meta div { padding: 11px 14px; border-right: 1px solid var(--ln); display: flex; flex-direction: column; gap: 3px; }
.m-meta div:last-child { border-right: 0; }
.m-meta span { font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--mut); }
.m-meta b { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.m-meta .hl { background: var(--a); }
.m-meta .hl span { color: rgba(255,255,255,.75); }
.m-meta .hl b { color: #fff; }

.m-label { display: block; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: var(--mut); margin-bottom: 7px; }
.m-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 26px; }
.m-party { padding: 16px 18px; border-radius: 12px; line-height: 1.65; color: #3b404a; font-size: 10.5px; }
.m-party strong { display: block; font-size: 14px; color: var(--ink); margin-bottom: 4px; letter-spacing: -.01em; }
.m-party .k { display: inline-block; min-width: 26px; font-size: 8.5px; font-weight: 700; color: var(--mut); letter-spacing: .06em; }
.m-party:not(.to) { padding-left: 0; }
.m-party.to { background: var(--a-soft); border: 1px solid var(--a-line); }
.m-party.to .m-label { color: var(--a); }

.m-items { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.m-items th { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--mut); text-align: right; padding: 0 8px 10px; border-bottom: 1.5px solid var(--ink); white-space: nowrap; }
.m-items td { padding: 12px 8px; text-align: right; border-bottom: 1px solid var(--ln); vertical-align: top; white-space: nowrap; font-size: 11px; }
.m-items td small { display: block; font-size: 9px; color: var(--mut); margin-top: 1px; }
.m-items td:nth-child(3) small { display: inline; }
.m-items .i { text-align: left; width: 28px; padding-left: 0; color: var(--mut); font-weight: 600; font-size: 10px; }
.m-items .d { text-align: left; white-space: normal; width: 42%; }
.m-items .d b { font-size: 11.5px; font-weight: 650; }
.m-items .t { font-weight: 700; padding-right: 0; }
.m-items th.t { color: var(--ink); }
.m-items .empty-row { text-align: center; color: #aaa; padding: 28px; }

.m-bottom { display: grid; grid-template-columns: 1fr 270px; gap: 30px; margin-top: 18px; align-items: start; }
.m-left { padding-top: 6px; }
.m-words { font-size: 10px; font-weight: 600; letter-spacing: .02em; color: #3b404a; word-break: break-word; line-height: 1.5; }
.m-sums { font-variant-numeric: tabular-nums; }
.m-sums > div { display: flex; justify-content: space-between; padding: 5px 0; color: #4b515c; font-size: 11px; }
.m-sums .m-grand { margin-top: 8px; padding: 13px 16px; border-radius: 12px; background: var(--ink); color: #fff; align-items: baseline; }
.m-grand span { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: rgba(255,255,255,.7); }
.m-grand b { font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.m-grand b small { font-size: 11px; font-weight: 600; color: rgba(255,255,255,.7); }

.m-notes { margin-top: 26px; padding: 14px 18px; border-left: 3px solid var(--a); background: #f7f8fa; border-radius: 0 10px 10px 0; }
.m-notes div { white-space: pre-wrap; font-size: 10.5px; line-height: 1.7; color: #2b2f36; word-wrap: break-word; }
.m-end { display: grid; grid-template-columns: 1fr 220px; gap: 30px; margin-top: 26px; align-items: end; }
.m-pay { font-size: 10px; line-height: 1.7; color: #3b404a; }
.m-pay b { color: var(--ink); }
.m-ref { margin-top: 6px; display: inline-block; padding: 3px 10px; border-radius: 6px; background: var(--a-soft); color: #3b404a; }
.m-sign { text-align: center; font-size: 11px; }
.m-sign .ln { height: 38px; border-bottom: 1px solid #9aa0aa; margin-bottom: 6px; }
.m-sign span { display: block; font-size: 9px; color: var(--mut); text-transform: uppercase; letter-spacing: .1em; margin-top: 2px; }
.m-foot { display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid var(--ln); padding-top: 12px; font-size: 9.5px; color: var(--mut); }
.m-foot i { font-style: normal; margin: 0 7px; color: #c3c7ce; }
.m-foot b { color: var(--ink); font-weight: 650; }
.m-footnote { font-size: 9px; color: var(--mut); margin-top: 6px; }


/* ------------------------------------------------------------------ Shared table/sums for new templates */
.doc .tt { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.doc .tt th { text-align: right; white-space: nowrap; }
.doc .tt td { text-align: right; white-space: nowrap; vertical-align: top; }
.doc .tt td small { display: block; font-size: 9px; opacity: .6; margin-top: 1px; }
.doc .tt td small.u { display: inline; }
.doc .tt .i { text-align: left; width: 26px; }
.doc .tt .d { text-align: left; white-space: normal; width: 42%; }
.doc .tt .d b { font-weight: 650; }
.doc .tt .t { font-weight: 700; }
.doc .tt .empty-row { text-align: center; color: #aaa; padding: 28px; }
.doc .ss { font-variant-numeric: tabular-nums; }
.doc .ss > div { display: flex; justify-content: space-between; padding: 4px 0; }
.doc .wm { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }

/* ------------------------------------------------------------------ Tamni (bold) */
.doc.b { padding: 0; color: #15171b; font-size: 11px; }
.b-band { background: #14161a; color: #fff; display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 34px 48px 30px; border-radius: 3px 3px 0 0; }
.b-logo { background: #fff; border-radius: 12px; padding: 10px 14px; max-width: 52%; min-height: 60px; display: flex; align-items: center; }
.b-logo img { max-width: 100%; max-height: 74px; display: block; }
.b-logo .wm { color: #15171b; }
.b-title { text-align: right; }
.b-kind { font-size: 38px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; line-height: 1; }
.b-no { font-size: 16px; font-weight: 600; margin-top: 8px; color: color-mix(in srgb, var(--a) 45%, #fff); font-variant-numeric: tabular-nums; }
.b-status { display: inline-block; margin-top: 10px; font-size: 9.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; padding: 4px 10px; border-radius: 99px; background: rgba(255,255,255,.12); }
.b-status.paid { background: #2fbf71; color: #062914; }
.b-status.cancelled { background: #ef5b4c; color: #fff; }
.b-meta { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--a); color: #fff; }
.b-meta div { padding: 12px 48px 12px 0; display: flex; flex-direction: column; gap: 2px; }
.b-meta div:first-child { padding-left: 48px; }
.b-meta span { font-size: 8.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; opacity: .75; }
.b-meta b { font-size: 12.5px; }
.b-body { padding: 28px 48px 0; flex: 1; display: flex; flex-direction: column; }
.b-lbl { display: flex; align-items: center; gap: 7px; font-size: 9px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: #6b717c; margin-bottom: 8px; }
.b-lbl::before { content: ''; width: 8px; height: 8px; background: var(--a); border-radius: 2px; }
.b-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-bottom: 24px; line-height: 1.65; font-size: 10.5px; color: #3c414b; }
.b-parties strong { display: block; font-size: 15px; color: #15171b; margin-bottom: 3px; font-weight: 800; letter-spacing: -.01em; }
.b-parties > div:last-child { text-align: right; }
.b-parties > div:last-child .b-lbl { justify-content: flex-end; }
.doc.b .tt th { background: #14161a; color: #fff; font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; padding: 10px 10px; }
.doc.b .tt th:first-child { border-radius: 8px 0 0 8px; padding-left: 12px; }
.doc.b .tt th:last-child { border-radius: 0 8px 8px 0; padding-right: 12px; }
.doc.b .tt td { padding: 11px 10px; font-size: 11px; }
.doc.b .tt td:first-child { padding-left: 12px; color: #8a909a; font-weight: 700; }
.doc.b .tt td:last-child { padding-right: 12px; }
.doc.b .tt tbody tr:nth-child(even) td { background: #f4f5f7; }
.doc.b .tt tbody tr:nth-child(even) td:first-child { border-radius: 8px 0 0 8px; }
.doc.b .tt tbody tr:nth-child(even) td:last-child { border-radius: 0 8px 8px 0; }
.b-bottom { display: grid; grid-template-columns: 1fr 270px; gap: 30px; margin-top: 18px; }
.b-words { font-size: 10px; font-weight: 600; color: #3c414b; padding-top: 6px; line-height: 1.5; word-break: break-word; }
.doc.b .ss { font-size: 11px; color: #4b515c; }
.doc.b .ss-grand { margin-top: 8px; background: var(--a); color: #fff; border-radius: 10px; padding: 14px 16px !important; align-items: baseline; }
.doc.b .ss-grand span { font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.doc.b .ss-grand b { font-size: 21px; font-weight: 900; }
.doc.b .ss-grand small { font-size: 11px; opacity: .8; }
.b-notes { margin-top: 24px; padding: 14px 18px; border: 1.5px dashed #d6d9de; border-radius: 10px; }
.b-notes div { white-space: pre-wrap; font-size: 10.5px; line-height: 1.7; word-wrap: break-word; }
.b-end { display: grid; grid-template-columns: 1fr 220px; gap: 30px; margin-top: 22px; align-items: end; }
.b-pay { font-size: 10px; line-height: 1.7; color: #3c414b; }
.b-ref { display: inline-block; margin-top: 6px; background: #14161a; color: #fff; padding: 3px 10px; border-radius: 6px; }
.b-sign { text-align: center; }
.b-sign .ln { height: 38px; border-bottom: 2px solid #14161a; margin-bottom: 6px; }
.b-sign span { display: block; font-size: 9px; color: #6b717c; text-transform: uppercase; letter-spacing: .12em; }
.b-foot { display: flex; justify-content: space-between; gap: 16px; padding: 12px 48px; margin-top: 20px; background: #14161a; color: #a9aeb7; font-size: 9.5px; border-radius: 0 0 3px 3px; }
.b-foot b { color: #fff; }
.b-foot i { font-style: normal; margin: 0 7px; color: var(--a); }

/* ------------------------------------------------------------------ Elegantni */
.doc.e { padding: 56px 64px 34px; color: #1d1d1f; font-size: 11px; }
.e-head { text-align: center; }
.e-logo { display: flex; justify-content: center; min-height: 50px; }
.e-logo img { max-width: 60%; max-height: 80px; }
.e-logo .wm { font-family: 'Fraunces', Georgia, serif; font-weight: 600; font-size: 26px; }
.e-rule { height: 4px; border-top: 1px solid #1d1d1f; border-bottom: 1px solid #1d1d1f; margin: 22px 0 18px; }
.e-title { font: italic 500 46px/1 'Fraunces', Georgia, serif; margin: 0; letter-spacing: -.02em; }
.e-no { margin-top: 8px; font-size: 11px; letter-spacing: .3em; text-transform: uppercase; color: var(--a); font-weight: 600; }
.e-status { display: inline-block; margin-left: 8px; letter-spacing: .15em; border: 1px solid currentColor; padding: 1px 8px; border-radius: 99px; font-size: 9px; }
.e-status.cancelled { color: #b3261e; }
.e-status.draft { color: #888; }
.e-meta { margin-top: 10px; color: #6e6e73; font-size: 10.5px; }
.e-meta i { font-style: normal; margin: 0 10px; color: #c7c7cc; }
.e-parties { display: grid; grid-template-columns: 1fr 1fr; margin: 34px 0 30px; border-top: 1px solid #e5e5ea; border-bottom: 1px solid #e5e5ea; }
.e-parties > div { padding: 18px 0; line-height: 1.7; font-size: 10.5px; color: #48484a; }
.e-parties > div.to { text-align: right; border-left: 1px solid #e5e5ea; }
.e-parties strong { display: block; font: 600 17px 'Fraunces', Georgia, serif; color: #1d1d1f; margin-bottom: 4px; }
.e-lbl { display: block; font-size: 8.5px; letter-spacing: .28em; text-transform: uppercase; color: var(--a); font-weight: 700; margin-bottom: 8px; }
.doc.e .tt th { font-size: 8.5px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: #6e6e73; padding: 0 8px 10px; border-bottom: 1px solid #1d1d1f; }
.doc.e .tt td { padding: 12px 8px; border-bottom: 1px solid #ececf0; font-size: 11px; }
.doc.e .tt .i, .doc.e .tt th.i { padding-left: 0; color: #aeaeb2; }
.doc.e .tt .t { padding-right: 0; }
.doc.e .tt th.t { padding-right: 0; }
.doc.e .tt .d b { font-weight: 600; }
.e-total { display: grid; grid-template-columns: 1fr 260px; gap: 30px; margin-top: 16px; align-items: end; }
.e-words { font: italic 400 11px 'Fraunces', Georgia, serif; color: #6e6e73; text-transform: lowercase; line-height: 1.5; word-break: break-word; }
.e-words::first-letter { text-transform: uppercase; }
.doc.e .ss { font-size: 10.5px; color: #48484a; }
.doc.e .ss-grand { margin-top: 8px; border-top: 1px solid #1d1d1f; border-bottom: 3px double #1d1d1f; padding: 10px 0 !important; align-items: baseline; }
.doc.e .ss-grand span { font-size: 9px; letter-spacing: .24em; text-transform: uppercase; font-weight: 700; color: #1d1d1f; }
.doc.e .ss-grand b { font: 600 24px 'Fraunces', Georgia, serif; color: #1d1d1f; }
.doc.e .ss-grand small { font: 500 11px 'Inter', sans-serif; color: #6e6e73; }
.e-notes { margin-top: 30px; }
.e-notes div { white-space: pre-wrap; font-size: 10.5px; line-height: 1.75; color: #3a3a3c; word-wrap: break-word; }
.e-sign { margin: 30px 0 0 auto; width: 220px; text-align: center; font: italic 500 13px 'Fraunces', Georgia, serif; }
.e-sign .ln { height: 34px; border-bottom: 1px solid #1d1d1f; margin-bottom: 6px; }
.e-foot { text-align: center; border-top: 1px solid #e5e5ea; padding-top: 14px; font-size: 9.5px; line-height: 1.75; color: #48484a; }
.e-ref { color: var(--a); font-weight: 600; margin-top: 2px; }
.e-made { margin-top: 6px; font-size: 8.5px; letter-spacing: .2em; text-transform: uppercase; color: #aeaeb2; }

/* ------------------------------------------------------------------ Kreativni (sidebar) */
.doc.s { padding: 0; display: grid; grid-template-columns: 240px 1fr; font-size: 11px; color: #17191d; overflow: hidden; }
.s-side { background: var(--a); color: #fff; padding: 40px 26px 30px; display: flex; flex-direction: column; background-image: linear-gradient(170deg, rgba(255,255,255,.12), transparent 40%, rgba(0,0,0,.15)); }
.s-logo { background: #fff; border-radius: 12px; padding: 10px; display: flex; justify-content: center; align-items: center; min-height: 56px; }
.s-logo img { max-width: 100%; max-height: 60px; }
.s-logo .wm { color: #17191d; font-size: 17px; text-align: center; }
.s-kind { margin-top: 30px; font-size: 10px; font-weight: 700; letter-spacing: .28em; text-transform: uppercase; opacity: .75; }
.s-no { font-size: 30px; font-weight: 900; letter-spacing: -.03em; line-height: 1.1; margin-top: 4px; word-break: break-word; }
.s-status { align-self: flex-start; margin-top: 10px; font-size: 9px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; padding: 4px 10px; border-radius: 99px; background: #fff; color: var(--a); }
.s-meta { margin: 24px 0 0; display: grid; gap: 2px; }
.s-meta dt { font-size: 8.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; opacity: .7; margin-top: 8px; }
.s-meta dd { margin: 0; font-size: 12.5px; font-weight: 700; }
.s-block { margin-top: 26px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.25); font-size: 10px; line-height: 1.7; color: rgba(255,255,255,.88); word-wrap: break-word; }
.s-block strong { display: block; font-size: 13px; color: #fff; margin-bottom: 2px; }
.s-lbl { display: block; font-size: 8.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; opacity: .7; margin-bottom: 6px; }
.s-bank { font-size: 8.8px; line-height: 1.65; }
.s-bank b { color: #fff; }
.s-ref { margin-top: 8px; background: rgba(0,0,0,.2); border-radius: 6px; padding: 4px 8px; }
.s-main { padding: 40px 40px 26px; display: flex; flex-direction: column; min-width: 0; }
.s-top { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: start; margin-bottom: 26px; }
.s-to { line-height: 1.65; font-size: 10.5px; color: #454a54; }
.s-to strong { display: block; font-size: 17px; color: #17191d; font-weight: 800; letter-spacing: -.01em; margin-bottom: 3px; }
.s-lbl2 { display: block; font-size: 8.5px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--a); margin-bottom: 6px; }
.s-due { text-align: right; background: #f4f5f7; border-radius: 14px; padding: 14px 18px; }
.s-due span { display: block; font-size: 8.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #6b717c; }
.s-due b { display: block; font-size: 24px; font-weight: 900; letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin: 2px 0; }
.s-due small { font-size: 9.5px; color: #6b717c; }
.doc.s .tt th { font-size: 8.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--a); padding: 0 7px 9px; border-bottom: 2px solid var(--a); }
.doc.s .tt td { padding: 11px 7px; border-bottom: 1px solid #eceef1; font-size: 10.5px; }
.doc.s .tt .i { padding-left: 0; color: #9aa0a9; font-weight: 700; }
.doc.s .tt .t, .doc.s .tt th.t { padding-right: 0; }
.s-bottom { display: grid; grid-template-columns: 1fr 230px; gap: 24px; margin-top: 16px; }
.s-words { font-size: 9.5px; font-weight: 600; color: #454a54; line-height: 1.5; word-break: break-word; }
.doc.s .ss { font-size: 10.5px; color: #4b515c; }
.doc.s .ss-grand { margin-top: 8px; border-top: 2px solid #17191d; padding-top: 10px !important; align-items: baseline; }
.doc.s .ss-grand span { font-size: 9px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: #17191d; }
.doc.s .ss-grand b { font-size: 19px; font-weight: 900; color: var(--a); }
.doc.s .ss-grand small { font-size: 10px; color: #6b717c; }
.s-notes { margin-top: 22px; background: #f7f8fa; border-radius: 12px; padding: 14px 16px; }
.s-notes div { white-space: pre-wrap; font-size: 10px; line-height: 1.7; word-wrap: break-word; }
.s-sign { margin: 24px 0 0 auto; width: 200px; text-align: center; font-size: 11px; }
.s-sign .ln { height: 34px; border-bottom: 1px solid #9aa0a9; margin-bottom: 6px; }
.s-sign span { display: block; font-size: 8.5px; color: #6b717c; text-transform: uppercase; letter-spacing: .12em; }
.s-foot { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid #eceef1; padding-top: 10px; font-size: 9px; color: #8a909a; }

/* Thumbnails for new templates */
.tpl-pick { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.tpl-thumb.bold i:nth-child(1) { left: 0; right: 0; top: 0; height: 22px; background: #14161a; border-radius: 0; }
.tpl-thumb.bold i:nth-child(2) { left: 0; right: 0; top: 22px; height: 7px; background: var(--brand); border-radius: 0; }
.tpl-thumb.bold i:nth-child(3) { left: 8px; right: 8px; top: 38px; height: 7px; background: #14161a; }
.tpl-thumb.bold i:nth-child(4) { right: 8px; width: 40%; bottom: 8px; height: 10px; background: var(--brand); }
.tpl-thumb.elegant i:nth-child(1) { left: 30%; right: 30%; top: 9px; height: 8px; background: #d8d8dc; }
.tpl-thumb.elegant i:nth-child(2) { left: 8px; right: 8px; top: 22px; height: 3px; border-top: 1px solid #333; border-bottom: 1px solid #333; border-radius: 0; }
.tpl-thumb.elegant i:nth-child(3) { left: 35%; right: 35%; top: 31px; height: 9px; background: #333; opacity: .8; }
.tpl-thumb.elegant i:nth-child(4) { right: 8px; width: 35%; bottom: 9px; height: 5px; border-top: 1px solid #333; border-bottom: 2px double #333; border-radius: 0; }
.tpl-thumb.sidebar i:nth-child(1) { left: 0; top: 0; bottom: 0; width: 30%; background: var(--brand); border-radius: 0; }
.tpl-thumb.sidebar i:nth-child(2) { left: 5%; width: 20%; top: 8px; height: 10px; background: #fff; }
.tpl-thumb.sidebar i:nth-child(3) { left: 36%; right: 8px; top: 26px; height: 3px; background: var(--brand); }
.tpl-thumb.sidebar i:nth-child(4) { right: 8px; width: 30%; top: 8px; height: 12px; background: #eceef0; }


/* ---- Kompaktnost: sve stane na A4 */
.doc .doc-spacer { min-height: 14px; }
.m-notes div, .b-notes div, .e-notes div, .s-notes div, .doc-notes { font-size: 10px !important; line-height: 1.45 !important; }
/* modern */
.doc.m { padding: 38px 44px 24px; }
.m-brand img { max-height: 70px; }
.m-no { font-size: 30px; }
.m-meta { margin: 20px 0 16px; }
.m-meta div { padding: 8px 12px; }
.m-parties { margin-bottom: 16px; }
.m-party { padding: 10px 14px; line-height: 1.5; }
.m-items td { padding: 7px 8px; }
.m-bottom { margin-top: 10px; }
.m-sums > div { padding: 3px 0; }
.m-sums .m-grand { padding: 10px 14px; margin-top: 6px; }
.m-notes { margin-top: 14px; padding: 10px 14px; }
.m-end { margin-top: 14px; }
.m-sign .ln { height: 26px; }
/* bold */
.b-band { padding: 24px 44px 20px; }
.b-logo img { max-height: 60px; }
.b-kind { font-size: 32px; }
.b-meta div { padding: 9px 44px 9px 0; }
.b-meta div:first-child { padding-left: 44px; }
.b-body { padding: 18px 44px 0; }
.b-parties { margin-bottom: 14px; line-height: 1.5; }
.doc.b .tt th { padding: 8px 10px; }
.doc.b .tt td { padding: 7px 10px; }
.b-bottom { margin-top: 10px; }
.doc.b .ss > div { padding: 3px 0; }
.doc.b .ss-grand { padding: 10px 14px !important; margin-top: 6px; }
.b-notes { margin-top: 14px; padding: 10px 14px; }
.b-end { margin-top: 14px; }
.b-sign .ln { height: 26px; }
.b-foot { margin-top: 12px; padding: 10px 44px; }
/* elegant */
.doc.e { padding: 36px 56px 24px; }
.e-logo img { max-height: 62px; }
.e-rule { margin: 14px 0 12px; }
.e-title { font-size: 38px; }
.e-meta { margin-top: 6px; }
.e-parties { margin: 18px 0 16px; }
.e-parties > div { padding: 10px 0; line-height: 1.5; }
.e-parties > div:not(.to) { padding-right: 16px; }
.e-parties > div.to { padding-left: 16px; }
.doc.e .tt td { padding: 7px 8px; }
.e-total { margin-top: 10px; }
.doc.e .ss > div { padding: 3px 0; }
.doc.e .ss-grand { padding: 7px 0 !important; margin-top: 4px; }
.e-notes { margin-top: 16px; }
.e-sign { margin-top: 14px; }
.e-sign .ln { height: 24px; }
.e-foot { padding-top: 10px; line-height: 1.6; }
/* sidebar */
.s-main { padding: 34px 34px 22px; }
.doc.s .tt td { padding: 8px 7px; }
/* classic */
.doc:not(.m):not(.b):not(.e):not(.s) .doc-items td { padding: 8px 5px; }
.doc:not(.m):not(.b):not(.e):not(.s) .doc-sign { margin-top: 36px; }

.e-title { font-size: 34px; }
.e-logo img { max-height: 54px; }
.doc.e { padding-top: 30px; }
.e-parties > div { font-size: 10px; }
.e-notes { margin-top: 12px; }
.e-foot { font-size: 9px; }
.doc.m { padding-top: 32px; }
.m-meta { margin: 16px 0 14px; }
.m-party { font-size: 10px; }
.m-items td { padding: 6px 8px; }
.m-end { margin-top: 10px; }
.m-pay { font-size: 9.5px; line-height: 1.55; }
/* Preračun u KM, pravna upozorenja */
.doc .km { margin-top: 10px; font-size: 9.5px; border: 1px solid #e3e5e8; border-radius: 8px; padding: 8px 10px; max-width: 290px; font-variant-numeric: tabular-nums; color: #333; background: #fff; text-align: left; font-style: normal; text-transform: none; letter-spacing: 0; font-family: 'Inter', sans-serif; }
.doc .km-h { font-weight: 700; font-size: 8.5px; text-transform: uppercase; letter-spacing: .1em; color: #555; margin-bottom: 4px; }
.doc .km-h span { display: block; font-weight: 500; text-transform: none; letter-spacing: 0; color: #777; font-size: 9px; }
.doc .km-r { display: flex; justify-content: space-between; gap: 12px; padding: 1px 0; }
.doc .km-r.tot { font-weight: 700; border-top: 1px solid #e3e5e8; margin-top: 3px; padding-top: 3px; }
.doc-km { display: flex; justify-content: flex-end; }
.doc-km:empty { display: none; }
.s-side .km, .s-words .km { color: #333; }
.doc .ss small, .m-sums small { font-size: 9px; opacity: .65; }
.m-meta { grid-template-columns: repeat(5, 1fr); }
.legal-warn { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--amber-soft); color: var(--amber); font-size: 12.5px; line-height: 1.45; }
.legal-warn svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.linkish { background: none; border: 0; padding: 0; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; font-size: inherit; }

/* Template picker */
.tpl-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.tpl { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px; border-radius: 12px; border: 1.5px solid var(--line-2); background: var(--surface); cursor: pointer; text-align: left; transition: border-color .15s, box-shadow .15s; }
.tpl:hover { border-color: var(--brand); }
.tpl.on { border-color: var(--brand); box-shadow: var(--focus); }
.tpl b { font-size: 13px; margin-top: 6px; }
.tpl > span:last-child { font-size: 12px; color: var(--muted); }
.tpl-thumb { width: 100%; height: 74px; border-radius: 8px; background: #fff; border: 1px solid var(--line); position: relative; overflow: hidden; }
.tpl-thumb i { position: absolute; display: block; border-radius: 3px; }
.tpl-thumb.modern i:nth-child(1) { left: 0; right: 0; top: 0; height: 4px; background: var(--brand); border-radius: 0; }
.tpl-thumb.modern i:nth-child(2) { left: 10px; right: 10px; top: 16px; height: 12px; border: 1px solid #e3e5e8; }
.tpl-thumb.modern i:nth-child(3) { right: 10px; width: 45%; top: 34px; height: 16px; background: #e8f3ec; }
.tpl-thumb.modern i:nth-child(4) { right: 10px; width: 36%; bottom: 8px; height: 9px; background: #16181d; }
.tpl-thumb.classic i:nth-child(1) { left: 10px; width: 40%; top: 10px; height: 12px; background: #3b8a4f; }
.tpl-thumb.classic i:nth-child(2) { right: 10px; width: 40%; top: 28px; height: 16px; background: #eceef0; }
.tpl-thumb.classic i:nth-child(3) { left: 10px; right: 10px; top: 50px; height: 5px; background: #eceef0; }
.tpl-thumb.classic i:nth-child(4) { left: 10px; right: 10px; bottom: 8px; height: 7px; background: #30343c; border-radius: 0; }

/* ------------------------------------------------------------------ Modal */
.overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(8, 14, 11, .45); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 20px; animation: fade .15s ease both;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--surface);
  border-radius: 18px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); animation: pop .2s cubic-bezier(.2,.9,.3,1.2) both;
}
.modal.wide { width: min(760px, 100%); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px 0; }
.modal-head h3 { margin: 0; font: 600 20px var(--display); }
.modal-body { padding: 18px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 18px; border-top: 1px solid var(--line); }
.modal-foot .left { margin-right: auto; }
.picker-list { max-height: 360px; overflow: auto; margin: 10px -6px 0; }
.picker-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.picker-item:hover { background: var(--surface-2); }
.picker-item input { width: 16px; height: 16px; accent-color: var(--brand); }

/* ------------------------------------------------------------------ Toasts */
.toast-host { position: fixed; bottom: 20px; right: 20px; z-index: 70; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 12px; background: var(--ink); color: var(--surface);
  box-shadow: var(--shadow-lg); font-weight: 550; animation: toastIn .25s cubic-bezier(.2,.9,.3,1.2) both; max-width: 360px;
}
.toast svg { width: 17px; height: 17px; flex: none; }
.toast.ok svg { color: #6fdca5; }
.toast.err { background: #b3261e; color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }

/* ------------------------------------------------------------------ Empty */
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty .art { width: 84px; height: 84px; margin: 0 auto 14px; border-radius: 24px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.empty .art svg { width: 38px; height: 38px; }
.empty h3 { color: var(--ink); margin: 0 0 6px; font: 600 19px var(--display); }
.empty p { margin: 0 0 16px; }

/* ------------------------------------------------------------------ Settings */
.settings { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .75fr); gap: 22px; align-items: start; }
.logo-drop { display: flex; align-items: center; gap: 16px; padding: 14px; border: 1px dashed var(--line-2); border-radius: 12px; background: var(--surface-2); }
.logo-drop .thumb { width: 150px; height: 64px; border-radius: 9px; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; flex: none; color: #999; font-size: 12px; }
.logo-drop .thumb img { max-width: 100%; max-height: 100%; }
.swatches { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-2); cursor: pointer; }
.swatch.on { box-shadow: 0 0 0 2px var(--ink); }
.swatches input[type=color] { width: 32px; height: 32px; border: 0; padding: 0; background: none; cursor: pointer; }
.code-hint code { background: var(--surface-3); padding: 1px 6px; border-radius: 5px; font-size: 12px; cursor: pointer; }

/* ------------------------------------------------------------------ Auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-art {
  position: relative; overflow: hidden; color: #eaf5ee; padding: 44px 52px; display: flex; flex-direction: column;
  background: #0c1a13;
  background-image:
    radial-gradient(60% 50% at 20% 10%, rgba(63,178,122,.45), transparent 60%),
    radial-gradient(50% 60% at 90% 90%, rgba(31,122,77,.55), transparent 60%),
    radial-gradient(40% 40% at 80% 20%, rgba(203,236,120,.16), transparent 60%);
}
.auth-art::before {
  content: ''; position: absolute; inset: 0; opacity: .12;
  background-image: linear-gradient(rgba(255,255,255,.5) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.5) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(70% 70% at 50% 40%, #000, transparent);
}
.auth-art > * { position: relative; }
.auth-art .brand { padding: 0; }
.auth-art h2 { font: 500 44px/1.08 var(--display); letter-spacing: -.025em; margin: auto 0 16px; max-width: 520px; }
.auth-art h2 em { color: #8fe7b8; font-style: italic; }
.auth-art p.lead { color: rgba(234,245,238,.7); font-size: 15.5px; max-width: 440px; margin: 0; }
.auth-points { display: flex; gap: 18px; margin-top: 28px; flex-wrap: wrap; color: rgba(234,245,238,.8); font-size: 13px; }
.auth-points span { display: inline-flex; gap: 7px; align-items: center; }
.auth-points svg { width: 16px; height: 16px; color: #6fdca5; }
.float-inv {
  position: absolute; right: -40px; top: 110px; width: 300px; transform: rotate(6deg); background: #fff; color: #222;
  border-radius: 10px; padding: 18px; box-shadow: 0 40px 80px -30px rgba(0,0,0,.6); font-size: 10px; animation: float 7s ease-in-out infinite;
}
@keyframes float { 50% { transform: rotate(5deg) translateY(-10px); } }
.float-inv .fi-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.float-inv .fi-h b { font-size: 14px; }
.float-inv .fi-line { height: 7px; border-radius: 4px; background: #eceff0; margin: 6px 0; }
.float-inv .fi-row { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid #f0f0f0; }
.float-inv .fi-total { margin-top: 10px; background: #30343c; color: #fff; padding: 6px 8px; text-align: right; font-weight: 700; }
.float-inv .fi-paid { position: absolute; right: 16px; bottom: 44px; border: 2px solid #1f8a52; color: #1f8a52; font-weight: 800; padding: 1px 8px; border-radius: 6px; transform: rotate(-10deg); letter-spacing: .1em; }
.auth-form-wrap { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.auth-form { width: min(400px, 100%); }
.auth-form h1 { font: 600 32px var(--display); letter-spacing: -.02em; margin: 0 0 6px; }
.auth-form .sub { color: var(--muted); margin: 0 0 26px; }
.auth-form form { display: grid; gap: 14px; }
.auth-form .btn-primary { padding: 12px; font-size: 14.5px; margin-top: 6px; }
.auth-form .switch-link { text-align: center; color: var(--muted); margin-top: 18px; }
.auth-form .switch-link a { color: var(--brand); font-weight: 600; text-decoration: none; }
.demo-box { margin-top: 22px; padding: 12px 14px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-ink); font-size: 13px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.form-error { color: var(--red); background: var(--red-soft); padding: 9px 12px; border-radius: 10px; font-size: 13px; font-weight: 550; }

/* ------------------------------------------------------------------ Menu */
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 210px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 5px; animation: pop .15s ease both;
}
.menu button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; font-weight: 500; }
.menu button:hover { background: var(--surface-2); }
.menu button svg { width: 16px; height: 16px; color: var(--muted); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 0; }
.menu .danger { color: var(--red); }
.menu .danger svg { color: var(--red); }

/* ------------------------------------------------------------------ Responsive */
@media (max-width: 1180px) {
  .editor, .settings { grid-template-columns: 1fr; }
  .editor-preview { position: static; }
  .doc-layout { grid-template-columns: 1fr; }
  .doc-meta { position: static; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 272px; z-index: 40; transform: translateX(-100%); transition: transform .25s ease; }
  .shell.nav-open .side { transform: none; box-shadow: var(--shadow-lg); }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 39; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; background: var(--side-bg); color: #fff; position: sticky; top: 0; z-index: 20; }
  .topbar .brand { padding: 0; }
  .topbar .brand-name { font-size: 18px; }
  #view { padding: 20px 16px 48px; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .paper-stage { padding: 12px; }
  .page-head h1 { font-size: 25px; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .search { max-width: none; margin-left: 0; }
  .hide-sm { display: none; }
  .table th, .table td { padding: 10px 10px; }
  .table td:first-child .cell-title { white-space: nowrap; }
  .table .cell-sub { font-size: 11.5px; }
  .items thead { display: none; }
  .items tr { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
  .items td { padding: 0; width: auto !important; }
  .items td.c-name { grid-column: 1 / -1; }
  .items td.c-qty, .items td.c-unit, .items td.c-price { grid-column: span 2; }
  .items td.c-disc, .items td.c-vat { grid-column: span 2; }
  .items td.c-total { grid-column: span 1; padding-top: 9px; text-align: left; }
  .items td.c-rm { grid-column: span 1; text-align: right; }
}

/* ------------------------------------------------------------------ Print */
@page { size: A4; margin: 0; }
@media print {
  html, body { background: #fff !important; }
  .side, .topbar, .toast-host, .no-print, .doc-meta, .doc-page-head, .scrim { display: none !important; }
  .shell { display: block; }
  #view { padding: 0 !important; max-width: none; animation: none; }
  .doc-layout { display: block; }
  .paper-stage { padding: 0; border: 0; background: none; border-radius: 0; }
  .doc-scaler { height: auto !important; }
  .doc-scaler > .doc { position: static; transform: none !important; }
  .doc { box-shadow: none; border-radius: 0; width: 210mm; min-height: 296mm; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .doc-items tr { break-inside: avoid; }
}
