/* Tokeny převzaté 1:1 z app/assets/tailwind/application.css (@theme). */
:root {
  --ground: #E6E4DB;
  --surface: #F5F3ED;
  --surface-muted: #EFEDE5;
  --ink: #1B1E1C;
  --ink-soft: #5A5D57;
  --line: #CFCCC1;
  --line-strong: #B8B5A8;
  --petrol: #0C6E6B;
  --petrol-ink: #084F4D;
  --petrol-pale: #DFF0EF;
  --petrol-edge: #9FC9C7;
  --live: #CDE84A;
  --paid: #2E7D46;
  --paid-pale: #EAF3EC;
  --paid-edge: #B6D3BE;
  --due: #8A6D08;
  --due-pale: #F4EFDD;
  --due-edge: #DBCE9A;
  --over: #B23A2E;
  --over-pale: #F6E6E3;
  --over-edge: #E0B4AE;
  --crew-green: #3B6E4A;
  --crew-purple: #6E5B8A;
  --font-display: "Archivo", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
  --radius-card: 8px;
  --shadow-card: 0 1px 0 rgba(27, 30, 28, .04), 0 2px 8px rgba(27, 30, 28, .06);
  --demo-bar: 32px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-body);
  background: var(--ground);
  color: var(--ink);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--petrol); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Demo bar ---------- */
.demo-bar {
  position: fixed; inset: 0 0 auto 0; height: var(--demo-bar); z-index: 100;
  display: flex; align-items: center; gap: 14px; padding: 0 14px;
  background: #2A2C2A; color: #D9D7CD; font-size: 12px; border-bottom: 1px solid #000;
}
.demo-bar a { color: #F5F3ED; font-weight: 600; white-space: nowrap; }
.demo-bar a:hover { text-decoration: underline; }
.demo-bar .db-title { font-weight: 600; color: #F5F3ED; white-space: nowrap; }
.demo-bar .db-note { color: #9A9C94; white-space: nowrap; }
.demo-bar .db-spacer { flex: 1; }
.demo-bar .db-short { display: none; }
.demo-bar button, .demo-bar select {
  background: transparent; border: 1px solid #555850; color: #F5F3ED; border-radius: 4px;
  padding: 2px 9px; font-size: 12px; cursor: pointer; height: 22px; white-space: nowrap;
}
.demo-bar select option { color: var(--ink); }
.demo-bar button:hover { background: #3A3D39; }
.demo-bar .db-firm { display: flex; align-items: center; gap: 6px; color: #9A9C94; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; padding-top: var(--demo-bar); }
.sidebar {
  position: sticky; top: var(--demo-bar); height: calc(100vh - var(--demo-bar));
  display: flex; flex-direction: column; gap: 4px; background: var(--ink); color: #D9D7CD;
  padding: 20px 14px; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 22px; }
.brand-mark {
  display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 6px; background: var(--live);
  font-family: var(--font-display); font-size: 18px; font-weight: 800; color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.15);
}
.brand-name { font-family: var(--font-display); font-size: 19px; font-weight: 800; letter-spacing: .02em; color: var(--surface); }
.brand-firm { margin-top: -2px; font-family: var(--font-mono); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .14em; color: var(--ink-soft); }
.nav-item {
  display: flex; align-items: center; gap: 12px; border-radius: 6px; padding: 9px 10px;
  font-size: 13.5px; font-weight: 500; color: #D9D7CD; transition: background .15s;
}
.nav-item:hover { background: #2A2D29; color: var(--surface); }
.nav-item.is-active { background: var(--petrol); color: #fff; }
.nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-item span.label { flex: 1; }
.nav-badge {
  display: grid; place-items: center; min-width: 20px; border-radius: 999px; background: var(--live);
  padding: 0 6px; font-family: var(--font-mono); font-size: 10px; font-weight: 700; color: var(--ink);
}
.nav-badge.pulse { animation: pulse 1.2s ease-out 3; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(205,232,74,.8); } 100% { box-shadow: 0 0 0 10px rgba(205,232,74,0); } }
.nav-section { padding: 14px 10px 6px; font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .16em; color: #7C7E76; }
.side-foot { margin-top: auto; border-top: 1px solid #2E312D; padding: 12px 10px 0; }
.side-user { display: flex; align-items: center; gap: 10px; padding-top: 12px; }
.side-user b { display: block; font-size: 13px; font-weight: 600; color: var(--surface); }
.side-user small { font-size: 11px; color: #7C7E76; }
.side-logout {
  margin-top: 12px; display: flex; width: 100%; align-items: center; gap: 12px; border: 0; background: none;
  border-radius: 6px; padding: 8px 12px; font-size: 13px; font-weight: 500; color: #7C7E76; cursor: pointer; text-align: left;
}
.side-logout:hover { background: #2A2D29; color: var(--surface); }
.side-logout svg { width: 16px; height: 16px; }

main { min-width: 0; }
.topbar {
  position: sticky; top: var(--demo-bar); z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border-bottom: 1px solid var(--line); background: var(--ground); padding: 16px 32px;
}
.crumb { margin-bottom: 2px; font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-soft); }
.page-title { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; }
.content { max-width: 1180px; padding: 28px 32px 64px; }
.menu-toggle { display: none; }

/* ---------- Primitivy ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; border-radius: 6px; border: 1px solid var(--ink); background: var(--ink);
  padding: 8px 16px; font-size: 14px; font-weight: 600; color: var(--surface); cursor: pointer; transition: opacity .15s, background .15s;
  white-space: nowrap; line-height: 1.3;
}
.btn:hover { opacity: .9; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { border-color: var(--petrol); background: var(--petrol); color: #fff; }
.btn-ghost { border-color: var(--line-strong); background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--surface-muted); opacity: 1; }
.btn-danger { border-color: var(--over-edge); background: var(--over-pale); color: var(--over); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn svg { width: 16px; height: 16px; }
.btn-block { width: 100%; justify-content: center; }
.link-btn { border: 0; background: none; padding: 0; cursor: pointer; color: var(--petrol); font-family: var(--font-mono); font-size: 12px; text-decoration: underline; }

.mono-label { font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-soft); }
.card { border-radius: var(--radius-card); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-card); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding: 16px 18px; }
.card-head h3 { font-family: var(--font-display); font-size: 15px; font-weight: 700; letter-spacing: .01em; }
.card-body { padding: 18px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 24px; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 24px; }
.grid-main { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }

.stat { padding: 18px; }
.stat-value { margin-top: 6px; font-family: var(--font-display); font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat-value.over { color: var(--over); }
.stat-sub { margin-top: 2px; font-size: 12.5px; color: var(--ink-soft); }

.list-rows { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 14px; border-bottom: 1px solid var(--line); padding: 14px 18px; transition: background .15s;
  width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; cursor: default;
}
a.list-row, button.list-row { cursor: pointer; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-muted); }
.row-main { min-width: 0; flex: 1; }
.row-title { display: block; font-size: 14.5px; font-weight: 600; }
.row-sub { font-size: 12.5px; color: var(--ink-soft); }
.row-mono { display: block; font-family: var(--font-mono); font-size: 11px; color: var(--ink-soft); }
.row-time { width: 52px; flex: none; font-family: var(--font-mono); font-size: 13px; font-weight: 700; }
.row-num { width: 80px; flex: none; font-family: var(--font-mono); font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.money { font-family: var(--font-mono); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty-state { padding: 32px 18px; text-align: center; font-size: 14px; color: var(--ink-soft); }
.muted { color: var(--ink-soft); }
.small { font-size: 12.5px; }

.tag {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; border-radius: 4px; border: 1px solid;
  padding: 4px 8px; font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tone-plain { border-color: var(--line-strong); background: var(--surface-muted); color: var(--ink-soft); }
.tone-live { border-color: var(--petrol-edge); background: var(--petrol-pale); color: var(--petrol-ink); }
.tone-paid { border-color: var(--paid-edge); background: var(--paid-pale); color: var(--paid); }
.tone-due { border-color: var(--due-edge); background: var(--due-pale); color: var(--due); }
.tone-over { border-color: var(--over-edge); background: var(--over-pale); color: var(--over); }

.avatar { display: grid; place-items: center; flex: none; border-radius: 50%; font-family: var(--font-display); font-weight: 700; color: #fff; }
.avatar.sm { width: 22px; height: 22px; font-size: 10px; }
.avatar.md { width: 34px; height: 34px; font-size: 12px; }
.avatar.lg { width: 32px; height: 32px; font-size: 13px; }
.crew-0 { background: var(--petrol); }
.crew-1 { background: var(--crew-green); }
.crew-2 { background: var(--crew-purple); }
.crew-3 { background: var(--ink); }

.flash { margin-bottom: 20px; display: flex; align-items: center; gap: 10px; border-radius: var(--radius-card); border: 1px solid var(--petrol-edge); background: var(--petrol-pale); padding: 12px 16px; font-size: 12.5px; color: var(--petrol-ink); }
.flash.alert { border-color: var(--over-edge); background: var(--over-pale); color: var(--over); }
.flash svg { width: 16px; height: 16px; flex: none; }
.flash a, .flash .link-btn { color: inherit; }

.field-label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; }
.field-input {
  display: block; width: 100%; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--surface);
  padding: 8px 12px; font-size: 14px; color: var(--ink);
}
.field-input:focus { border-color: var(--petrol); outline: none; box-shadow: 0 0 0 3px var(--petrol-pale); }
.field-input.has-error { border-color: var(--over); }
.field-error { margin-top: 4px; font-size: 12px; color: var(--over); }
.form-grid { display: grid; gap: 12px; }
.form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid.cols-12 { grid-template-columns: 1fr 2fr; }
.form-row { display: flex; gap: 8px; }
.form-section { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.max-280 { max-width: 280px; }
.max-420 { max-width: 420px; }
.mb-20 { margin-bottom: 20px; }

/* Položky zakázky */
table.items { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.items th { border-bottom: 1px solid var(--line); padding-bottom: 10px; text-align: left; font-family: var(--font-mono); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-soft); }
table.items td { border-bottom: 1px solid var(--line); padding: 12px 0; }
table.items .num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 8px; }
.x-btn { border: 0; background: none; cursor: pointer; padding: 0 8px; color: var(--ink-soft); font-size: 15px; }
.x-btn:hover { color: var(--over); }
.totals { display: flex; justify-content: space-between; padding-top: 14px; font-family: var(--font-display); font-size: 17px; font-weight: 800; }
.totals-sub { margin-top: 4px; display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-soft); }
.totals span:last-child, .totals-sub span:last-child { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }

/* Status flow */
.flow-bar { margin-bottom: 20px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.flow { display: flex; align-items: center; gap: 4px; overflow-x: auto; padding-bottom: 4px; max-width: 100%; }
.flow-link { height: 2px; width: 20px; flex: none; background: var(--paid); }
.flow-link.todo { background: var(--line-strong); }
.flow-step { display: flex; flex: none; align-items: center; gap: 8px; }
.flow-dot { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); font-family: var(--font-mono); font-size: 10px; font-weight: 700; color: var(--ink-soft); }
.flow-dot.done { border-color: var(--paid); background: var(--paid); color: #fff; }
.flow-dot.current { border-color: var(--petrol); background: var(--petrol); color: #fff; box-shadow: 0 0 0 4px var(--petrol-pale); }
.flow-step b { white-space: nowrap; font-size: 12px; font-weight: 600; color: var(--petrol-ink); }
.flow-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Checklist */
.check-row { display: flex; width: 100%; align-items: center; gap: 12px; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 10px 0; text-align: left; cursor: pointer; }
.check-row:last-of-type { border-bottom: 0; }
.check-box { display: grid; place-items: center; width: 20px; height: 20px; flex: none; border-radius: 5px; border: 2px solid var(--line-strong); color: #fff; }
.check-box.on { border-color: var(--paid); background: var(--paid); }
.check-box svg { width: 12px; height: 12px; }
.check-label.on { color: var(--ink-soft); text-decoration: line-through; }
.check-progress { height: 6px; border-radius: 3px; background: var(--surface-muted); border: 1px solid var(--line); overflow: hidden; margin-bottom: 8px; }
.check-progress span { display: block; height: 100%; background: var(--paid); transition: width .3s; }

.meta-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; font-size: 13px; color: var(--ink-soft); }
.meta-item { display: flex; align-items: center; gap: 8px; }
.meta-item svg { width: 15px; height: 15px; }

/* ---------- Kalendář ---------- */
.cal-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 16px; align-items: start; }
.cal-wrap > * { min-width: 0; }
.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 4px 12px; }
.cal-toolbar h2 { font-family: var(--font-display); font-size: 17px; font-weight: 700; }
.cal-toolbar .group { display: flex; gap: 6px; }
.cal-scroll { overflow-x: auto; }
.cal-grid { display: grid; grid-template-columns: 52px repeat(7, minmax(92px, 1fr)); min-width: 700px; }
.cal-head { border-bottom: 1px solid var(--line); padding: 6px 4px; text-align: center; font-size: 12px; font-weight: 600; }
.cal-head small { display: block; font-family: var(--font-mono); font-size: 10px; color: var(--ink-soft); font-weight: 500; }
.cal-head.today { color: var(--petrol); }
.cal-hours { position: relative; }
.cal-hour-label { height: 44px; font-family: var(--font-mono); font-size: 10px; color: var(--ink-soft); text-align: right; padding-right: 6px; transform: translateY(-6px); }
.cal-day { position: relative; border-left: 1px solid var(--line); background-image: repeating-linear-gradient(to bottom, var(--line) 0, var(--line) 1px, transparent 1px, transparent 44px); }
.cal-day.today { background-color: rgba(205, 232, 74, .08); }
.cal-day.drop-hover { background-color: var(--petrol-pale); }
.cal-day.placing { cursor: copy; }
.cal-visit {
  position: absolute; left: 2px; right: 2px; border-radius: 4px; overflow: hidden; color: #fff; padding: 3px 6px; line-height: 1.2;
  cursor: grab; box-shadow: 0 1px 2px rgba(0,0,0,.15); border: 0; text-align: left;
}
.cal-visit:active { cursor: grabbing; }
.cal-visit.dragging { opacity: .5; }
.cal-visit .t { font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; opacity: .85; }
.cal-visit .n { font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-visit .m { font-size: 10px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--over); z-index: 2; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--over); }
.pending-chip {
  display: block; width: 100%; text-align: left; border: 1px dashed var(--petrol-edge); background: var(--petrol-pale); color: var(--petrol-ink);
  border-radius: 6px; padding: 8px 10px; cursor: grab; margin-bottom: 8px;
}
.pending-chip.selected { border-style: solid; border-color: var(--petrol); box-shadow: 0 0 0 3px var(--petrol-pale); background: #fff; }
.pending-chip b { display: block; font-size: 13px; }
.pending-chip span { font-size: 11.5px; color: var(--ink-soft); }
.legend { display: flex; flex-wrap: wrap; gap: 16px; }
.legend > div { display: flex; align-items: center; gap: 8px; font-size: 13px; }

/* ---------- Modal + panel ---------- */
.overlay { position: fixed; inset: 0; z-index: 200; background: rgba(27, 30, 28, .45); display: flex; align-items: flex-start; justify-content: center; padding: 64px 16px 16px; overflow-y: auto; }
.modal { width: 100%; max-width: 520px; }
.modal .card-body { display: flex; flex-direction: column; gap: 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.panel-overlay { position: fixed; inset: var(--demo-bar) 0 0 0; z-index: 150; background: rgba(27,30,28,.35); display: flex; justify-content: flex-end; }
.panel { width: 100%; max-width: 560px; height: 100%; overflow-y: auto; background: var(--ground); padding: 24px 16px 32px; box-shadow: -8px 0 24px rgba(0,0,0,.15); animation: slide-in .25s ease-out; }
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.panel-browser { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-family: var(--font-mono); font-size: 11px; color: var(--ink-soft); }
.panel-browser .url { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 1px solid var(--line-strong); border-radius: 999px; padding: 4px 12px; background: var(--surface); }
.public-card { overflow: hidden; }
.public-head { background: var(--petrol); color: #fff; padding: 20px 20px 24px; }
.public-firm { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 15px; font-weight: 800; }
.public-firm .brand-mark { width: 22px; height: 22px; font-size: 13px; border-radius: 4px; }
.public-head h2 { margin-top: 14px; font-family: var(--font-display); font-size: 17px; font-weight: 700; }
.public-head p { margin-top: 2px; font-size: 12.5px; opacity: .9; }
.public-foot { margin-top: 16px; text-align: center; font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .14em; color: var(--ink-soft); }
.sent-check { margin: 0 auto; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--paid-pale); color: var(--paid); }
.sent-check svg { width: 24px; height: 24px; }

/* ---------- Login ---------- */
.login { min-height: 100vh; padding: calc(var(--demo-bar) + 48px) 16px 48px; display: flex; justify-content: center; }
.login-card { width: 100%; max-width: 560px; }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.login-brand .brand-name { color: var(--ink); }
.firm-block { border: 1px solid var(--line); border-radius: var(--radius-card); margin-top: 14px; overflow: hidden; }
.firm-block h3 { font-family: var(--font-display); font-size: 15px; padding: 12px 16px; background: var(--surface-muted); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }

/* ---------- Faktura (tiskový náhled) ---------- */
.invoice-paper { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: 40px 44px; max-width: 860px; position: relative; }
.inv-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; border-bottom: 2px solid var(--ink); padding-bottom: 18px; }
.inv-head h2 { font-family: var(--font-display); font-size: 26px; font-weight: 800; letter-spacing: -.01em; }
.inv-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 22px 0; }
.inv-parties p { font-size: 13px; line-height: 1.55; }
.inv-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; margin-bottom: 22px; }
.inv-meta b { display: block; font-family: var(--font-mono); font-size: 13px; }
table.inv { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.inv th { text-align: left; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); border-bottom: 1px solid var(--ink); padding: 6px 6px 6px 0; }
table.inv td { border-bottom: 1px solid var(--line); padding: 9px 6px 9px 0; }
table.inv .num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.inv-summary { display: grid; grid-template-columns: 1fr 320px; gap: 24px; margin-top: 22px; align-items: start; }
.inv-total { display: flex; justify-content: space-between; align-items: baseline; border-top: 2px solid var(--ink); margin-top: 8px; padding-top: 10px; font-family: var(--font-display); font-size: 20px; font-weight: 800; }
.inv-total span:last-child { font-family: var(--font-mono); }
.inv-stamp { display: inline-block; margin-top: 18px; transform: rotate(-6deg); border: 3px solid currentColor; border-radius: 6px; padding: 6px 14px; font-family: var(--font-mono); font-weight: 700; font-size: 18px; letter-spacing: .12em; opacity: .8; }
.inv-stamp.paid { color: var(--paid); }
.inv-stamp.over { color: var(--over); }
.inv-foot { margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 11px; color: var(--ink-soft); }

/* ---------- Tour ---------- */
.tour-steps { counter-reset: s; display: flex; flex-direction: column; gap: 12px; padding: 0; margin: 0; list-style: none; }
.tour-steps li { display: flex; gap: 12px; font-size: 13.5px; }
.tour-steps li::before { counter-increment: s; content: counter(s); display: grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--petrol); color: #fff; font-family: var(--font-mono); font-size: 11px; font-weight: 700; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 300; background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 6px; font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.25); }

/* ---------- Responsivita ---------- */
@media (max-width: 1100px) {
  .cal-wrap { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: var(--demo-bar); left: 0; bottom: 0; width: 260px; z-index: 120; transform: translateX(-100%); transition: transform .2s; height: auto; }
  .app.menu-open .sidebar { transform: none; box-shadow: 8px 0 24px rgba(0,0,0,.3); }
  .menu-toggle { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; flex: none; }
  .menu-toggle svg { width: 20px; height: 20px; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; }
  .topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
  .content { padding: 20px 16px 48px; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .form-grid.cols-2, .form-grid.cols-4, .form-grid.cols-12 { grid-template-columns: 1fr; }
  .demo-bar { gap: 8px; padding: 0 8px; }
  .demo-bar .db-note, .demo-bar .db-title-long { display: none; }
  .demo-bar .db-firm-label { display: none; }
  .demo-bar select { max-width: 112px; }
  .demo-bar button { padding: 2px 6px; }
  .demo-bar .db-long { display: none; }
  .demo-bar .db-short { display: inline; }
  .inv-head { flex-direction: column; gap: 12px; }
  .inv-head > div:last-child { text-align: left !important; }
  .inv-head .public-firm { justify-content: flex-start !important; }
  .inv-head h2 { font-size: 22px; }
  .invoice-paper { padding: 22px 16px; }
  .inv-parties, .inv-summary { grid-template-columns: 1fr; }
  .inv-meta { grid-template-columns: 1fr 1fr; }
  .list-row { flex-wrap: wrap; }
  .row-num { width: auto; }
  .page-title { font-size: 19px; }
}
@media (max-width: 420px) {
  .demo-bar .db-title { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  .demo-bar, .sidebar, .topbar, .flash, .no-print { display: none !important; }
  .app { display: block; padding: 0; }
  body { background: #fff; }
  .content { padding: 0; max-width: none; }
  .invoice-paper { border: 0; box-shadow: none; padding: 0; max-width: none; }
}
