/* ——— Pisave (lokalno, brez zunanjih zahtev) ——— */
@font-face {
  font-family: "Bricolage"; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url(/fonts/bricolage-grotesque-latin-standard-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Bricolage"; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url(/fonts/bricolage-grotesque-latin-ext-standard-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face { font-family: "Plex"; font-weight: 400; font-display: swap; src: url(/fonts/ibm-plex-sans-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD; }
@font-face { font-family: "Plex"; font-weight: 400; font-display: swap; src: url(/fonts/ibm-plex-sans-latin-ext-400-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Plex"; font-weight: 500; font-display: swap; src: url(/fonts/ibm-plex-sans-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD; }
@font-face { font-family: "Plex"; font-weight: 500; font-display: swap; src: url(/fonts/ibm-plex-sans-latin-ext-500-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Plex"; font-weight: 600; font-display: swap; src: url(/fonts/ibm-plex-sans-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD; }
@font-face { font-family: "Plex"; font-weight: 600; font-display: swap; src: url(/fonts/ibm-plex-sans-latin-ext-600-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF; }

/* ——— Žetoni ——— */
:root {
  --paper: #EEF0F3;
  --surface: #FFFFFF;
  --surface-2: #F6F7F9;
  --ink: #16202E;
  --ink-2: #4B5667;
  --ink-3: #7B8595;
  --line: #D7DCE4;
  --line-2: #E6E9EE;
  --accent: #2F45D0;
  --accent-ink: #FFFFFF;
  --accent-soft: #E4E8FB;
  --ok: #1B7650; --ok-soft: #E1F1E8;
  --warn: #945D00; --warn-soft: #FAEFD9;
  --err: #B3322A; --err-soft: #FAE4E1;
  --skip: #6F7888; --skip-soft: #E9ECF0;
  --display: "Bricolage", "Segoe UI", system-ui, sans-serif;
  --text: "Plex", "Segoe UI", system-ui, sans-serif;
  --r-sm: 5px;
  --r-md: 9px;
  --r-lg: 14px;
  --rail: 232px;
  --focus: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121823; --surface: #1A2230; --surface-2: #202938;
    --ink: #E8ECF2; --ink-2: #B0B9C7; --ink-3: #8390A3;
    --line: #2F3A4C; --line-2: #273143;
    --accent: #7D8DFF; --accent-ink: #0E1430; --accent-soft: #252F5A;
    --ok: #5FD19B; --ok-soft: #1C3A2D; --warn: #F0B454; --warn-soft: #3D3019;
    --err: #FF8A80; --err-soft: #43231F; --skip: #9AA4B4; --skip-soft: #2A3342;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 15px/1.5 var(--text);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--display); font-weight: 650; letter-spacing: -0.015em; margin: 0; line-height: 1.15; }
h1 { font-size: clamp(26px, 3.2vw, 34px); }
h2 { font-size: 20px; }
h3 { font-size: 16px; font-family: var(--text); font-weight: 600; letter-spacing: 0; }
p { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.boot { padding: 40vh 0 0; text-align: center; color: var(--ink-3); }

/* ——— Ogrodje ——— */
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }
.shell > div { min-width: 0; }
.rail {
  position: sticky; top: 0; height: 100vh; padding: 28px 18px 20px;
  display: flex; flex-direction: column; gap: 28px;
  border-right: 1px solid var(--line); background: var(--surface);
}
.brand { display: flex; align-items: baseline; gap: 8px; padding: 0 10px; text-decoration: none; color: var(--ink); }
.brand b { font-family: var(--display); font-size: 22px; font-weight: 750; letter-spacing: -0.03em; }
.brand span { font-size: 13px; color: var(--ink-3); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--r-md);
  color: var(--ink-2); text-decoration: none; font-weight: 500;
}
.nav a svg { width: 19px; height: 19px; flex: none; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.rail-foot { margin-top: auto; padding: 0 10px; font-size: 13px; color: var(--ink-3); display: grid; gap: 6px; }
.mode-flag { display: inline-flex; align-items: center; gap: 6px; }
.mode-flag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.mode-flag.is-mock::before { background: var(--warn); }
.mode-flag.is-off::before { background: var(--err); }

main { padding: 36px clamp(18px, 4vw, 48px) 80px; max-width: 1180px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.page-head p { margin-top: 6px; color: var(--ink-2); max-width: 62ch; }
.section { margin-top: 36px; }
.section > h2 { margin-bottom: 12px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }

/* ——— Gumbi ——— */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--err); }
.btn.danger:hover { border-color: var(--err); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.small { min-height: 32px; padding: 4px 11px; font-size: 14px; }
.btn[disabled] { opacity: .55; cursor: progress; }
.btn svg { width: 17px; height: 17px; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-sm); border: 0; background: transparent; color: var(--ink-3); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--err); }
.icon-btn svg { width: 17px; height: 17px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ——— Oznake stanja ——— */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 8px; border-radius: 999px;
  font-size: 13px; font-weight: 500; white-space: nowrap; background: var(--accent-soft); color: var(--accent);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.issued { background: var(--ok-soft); color: var(--ok); }
.badge.draft { background: var(--warn-soft); color: var(--warn); }
.badge.failed { background: var(--err-soft); color: var(--err); }
.badge.skipped, .badge.missed, .badge.paused { background: var(--skip-soft); color: var(--skip); }
.badge.processing { background: var(--surface-2); color: var(--ink-2); }
.badge.plan-draft { background: transparent; box-shadow: inset 0 0 0 1px var(--accent); color: var(--accent); }
.pill { display: inline-block; padding: 1px 8px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line-2); font-size: 13px; color: var(--ink-2); }

/* ——— Nadzorna plošča ——— */
.hero { padding: 30px 30px 26px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.hero-when { font-family: var(--display); font-weight: 700; font-size: clamp(40px, 7vw, 76px); line-height: .95; letter-spacing: -0.04em; }
.hero-what { margin-top: 14px; font-size: 17px; color: var(--ink-2); max-width: 60ch; }
.hero-what strong { color: var(--ink); font-weight: 600; }
.hero .actions { margin-top: 20px; }
.hero.empty .hero-when { font-size: clamp(30px, 5vw, 48px); }

.runway { margin-top: 28px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.runway-track { position: relative; display: grid; grid-template-columns: repeat(61, minmax(13px, 1fr)); min-width: 720px; height: 118px; align-items: end; }
.rw-day { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.rw-day::after { content: ""; width: 1px; height: 8px; background: var(--line); }
.rw-day.weekend::after { height: 4px; }
.rw-day.month-start::after { height: 20px; background: var(--ink-3); }
.rw-month { position: absolute; top: 0; left: 50%; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.rw-today::after { height: 26px; width: 2px; background: var(--ink); }
.rw-today .rw-month { color: var(--ink); font-weight: 600; }
.rw-bar {
  width: 9px; border-radius: 3px 3px 1px 1px; background: var(--accent); margin-bottom: 3px; border: 0; padding: 0; cursor: pointer;
}
.rw-bar.mode-draft { background: transparent; box-shadow: inset 0 0 0 2px var(--accent); }
.rw-bar:hover { filter: brightness(1.15); }
.rw-stack { display: flex; flex-direction: column-reverse; align-items: center; gap: 2px; }
.runway-legend { display: flex; gap: 18px; margin-top: 10px; font-size: 13px; color: var(--ink-3); flex-wrap: wrap; }
.runway-legend i { display: inline-block; width: 9px; height: 12px; border-radius: 2px; background: var(--accent); vertical-align: -1px; margin-right: 6px; }
.runway-legend i.draft { background: transparent; box-shadow: inset 0 0 0 2px var(--accent); }

.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1px; margin-top: 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--line-2); overflow: hidden; }
.figures > div { padding: 16px 20px; background: var(--surface); }
.figures dt a { color: inherit; text-decoration: none; }
.figures dt a:hover { color: var(--accent); text-decoration: underline; }
.fig-sub { font-size: 13px; margin-top: 2px; }
.figures dt { font-size: 13px; color: var(--ink-2); }
.figures dd { margin: 4px 0 0; font-family: var(--display); font-size: 26px; font-weight: 650; letter-spacing: -0.02em; }

.alert { border: 1px solid color-mix(in srgb, var(--err) 35%, var(--line)); border-left: 4px solid var(--err); background: var(--surface); border-radius: var(--r-md); padding: 14px 16px; }
.alert h3 { color: var(--err); margin-bottom: 6px; }
.alert.info { border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); border-left-color: var(--warn); }
.alert.info h3 { color: var(--warn); }

/* ——— Seznami ——— */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.list-row {
  display: grid; grid-template-columns: 104px minmax(0, 1fr) auto auto; gap: 16px; align-items: center;
  padding: 13px 18px; border-top: 1px solid var(--line-2); text-decoration: none; color: inherit; width: 100%;
  background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; cursor: pointer;
}
.list-row:first-child { border-top: 0; }
.list-row:hover { background: var(--surface-2); }
.list-row .when { font-weight: 600; }
.list-row .when small { display: block; font-weight: 400; color: var(--ink-3); font-size: 13px; }
.list-row .who { min-width: 0; }
.list-row .who b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .who span { display: block; color: var(--ink-2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .amount { font-weight: 600; text-align: right; }
.list-row .err-line { grid-column: 2 / -1; color: var(--err); font-size: 14px; }
.list-row.nodate { grid-template-columns: minmax(0, 1fr) auto auto; }
.list-row.nodate .when { display: none; }
.list-empty { padding: 28px 20px; color: var(--ink-2); }
.list-empty .btn { margin-top: 14px; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
table.data { width: 100%; border-collapse: collapse; min-width: 640px; }
table.data th { text-align: left; font-weight: 500; font-size: 13px; color: var(--ink-2); padding: 11px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
table.data td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover td { background: var(--surface-2); }
table.data .r { text-align: right; }
table.data td b { font-weight: 500; }
table.data td small { display: block; color: var(--ink-2); font-size: 13px; }

/* ——— Koledar ——— */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.cal-head h1 { text-transform: none; }
.cal-nav { display: flex; gap: 8px; }
.cal-sum { color: var(--ink-2); margin-top: 6px; }
.calendar { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.cal-dow, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow div { padding: 9px 10px; font-size: 13px; color: var(--ink-2); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.cal-cell { min-height: 116px; padding: 7px 7px 9px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.out { background: var(--surface-2); }
.cal-cell.out .cal-day { color: var(--ink-3); }
.cal-day { font-size: 13px; font-weight: 500; color: var(--ink-2); display: flex; justify-content: space-between; align-items: center; padding: 0 3px; }
.cal-cell.today .cal-day b { background: var(--ink); color: var(--paper); border-radius: 999px; padding: 0 7px; }
.chip {
  display: block; width: 100%; text-align: left; border: 0; cursor: pointer; min-width: 0;
  padding: 4px 7px 5px 9px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--ink);
  position: relative; font-size: 13px; line-height: 1.3;
}
.chip::before { content: ""; position: absolute; left: 0; top: 3px; bottom: 3px; width: 3px; border-radius: 2px; background: var(--accent); }
.chip b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip span { display: block; color: var(--ink-2); }
.chip.issued { background: var(--ok-soft); } .chip.issued::before { background: var(--ok); }
.chip.draft { background: var(--warn-soft); } .chip.draft::before { background: var(--warn); }
.chip.failed { background: var(--err-soft); } .chip.failed::before { background: var(--err); }
.chip.skipped { background: var(--skip-soft); color: var(--ink-3); } .chip.skipped::before { background: var(--skip); } .chip.skipped b { text-decoration: line-through; }
.chip.draft-plan { background: var(--surface); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent); }
.chip.edited span::after { content: "  ✎ spremenjen"; color: var(--accent); white-space: pre; }
.chip:hover { filter: brightness(.97); }
.cal-dots { display: none; }
.agenda { display: none; }

/* ——— Obrazci ——— */
.form { display: grid; gap: 28px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px 22px 24px; }
.panel > h2 { font-size: 18px; margin-bottom: 4px; }
.panel > .hint { color: var(--ink-2); margin-bottom: 16px; font-size: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 18px; }
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field > span { font-size: 14px; font-weight: 500; }
.field > small { color: var(--ink-3); font-size: 13px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); outline: none;
}
.input:focus { border-color: var(--accent); box-shadow: var(--focus); }
textarea.input { resize: vertical; min-height: 64px; line-height: 1.45; }
.input.num { text-align: right; }
.choice { display: grid; gap: 10px; }
.choice label { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); cursor: pointer; }
.choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { margin-top: 4px; accent-color: var(--accent); }
.choice b { display: block; font-weight: 500; }
.choice small { color: var(--ink-2); font-size: 14px; }
.form-foot { position: sticky; bottom: 0; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 0; background: linear-gradient(transparent, var(--paper) 30%); }
.form-foot .spacer { flex: 1; }
.error-box { color: var(--err); font-size: 14px; }
.placeholder-help { font-size: 13px; color: var(--ink-3); margin-top: 6px; }
.placeholder-help code { font: inherit; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 4px; padding: 0 4px; }

/* Iskalno polje z izbiro (stranke, artikli) */
.combo { position: relative; }
.combo-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); max-height: 280px; overflow: auto;
  margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: 0 12px 32px rgba(16, 24, 40, .16);
}
.combo-list li { padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; }
.combo-list li[aria-selected="true"], .combo-list li:hover { background: var(--accent-soft); }
.combo-list li small { display: block; color: var(--ink-2); font-size: 13px; }
.combo-list .combo-empty { color: var(--ink-3); cursor: default; }
.combo-list .combo-empty:hover { background: none; }
.picked { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 40px; padding: 6px 6px 6px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.picked b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Vrstice računa */
.rows { display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--r-md); overflow: visible; container: rows / inline-size; }
.rows-head, .row-edit {
  display: grid; gap: 10px; align-items: start;
  grid-template-columns: minmax(170px, 2.2fr) minmax(150px, 2.4fr) 78px 64px 104px 70px 96px 96px 34px;
}
.rows-head { padding: 9px 12px; font-size: 13px; color: var(--ink-2); background: var(--surface-2); border-bottom: 1px solid var(--line); border-radius: var(--r-md) var(--r-md) 0 0; }
.rows-head .r { text-align: right; }
.row-edit { padding: 10px 12px; border-bottom: 1px solid var(--line-2); }
.row-edit:last-child { border-bottom: 0; }
.row-edit .input { min-height: 36px; padding: 6px 9px; }
.row-edit textarea.input { min-height: 36px; max-height: 140px; resize: vertical; field-sizing: content; }
.row-edit .row-total { text-align: right; padding-top: 8px; font-weight: 500; }
.row-edit .lbl { display: none; }
.row-edit .picked { min-height: 36px; padding: 3px 4px 3px 10px; }
.rows-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-top: 14px; }
.totals { display: grid; grid-template-columns: auto auto; gap: 4px 24px; justify-content: end; text-align: right; }
.totals dt { color: var(--ink-2); }
.totals dd { margin: 0; }
.totals .grand { font-family: var(--display); font-size: 22px; font-weight: 700; color: var(--ink); }
.rows-read .row-read { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 10px 12px; border-bottom: 1px solid var(--line-2); }
.rows-read .row-read:last-child { border-bottom: 0; }
.resolved { display: block; margin-top: 4px; font-size: 13px; color: var(--ink-3); }
.rows-read .row-read small { color: var(--ink-2); grid-column: 1 / -1; white-space: pre-line; }

details.more { border-top: 1px solid var(--line-2); padding-top: 14px; margin-top: 18px; }
details.more summary { cursor: pointer; font-weight: 500; color: var(--ink-2); }
details.more[open] summary { margin-bottom: 14px; }

/* ——— Dialog ——— */
dialog.sheet {
  width: min(980px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--line);
  border-radius: var(--r-lg); background: var(--paper); color: var(--ink); box-shadow: 0 30px 80px rgba(10, 16, 30, .35);
}
dialog.sheet::backdrop { background: rgba(14, 20, 32, .45); }
dialog.sheet[open] { animation: rise .18s ease-out; }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 22px 24px 16px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.sheet-head p { color: var(--ink-2); margin-top: 4px; }
.sheet-body { padding: 20px 24px 8px; display: grid; gap: 20px; }
.sheet-foot { display: flex; flex-wrap: wrap; gap: 10px; padding: 16px 24px 20px; border-top: 1px solid var(--line); background: var(--surface); position: sticky; bottom: 0; }
.sheet-foot .spacer { flex: 1; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; }
.facts dt { font-size: 13px; color: var(--ink-2); }
.facts dd { margin: 2px 0 0; font-weight: 500; }
dialog.confirm { width: min(440px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; background: var(--surface); color: var(--ink); }
dialog.confirm::backdrop { background: rgba(14, 20, 32, .45); }
dialog.confirm p { color: var(--ink-2); margin: 10px 0 20px; }

/* ——— Prijava ——— */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 30px 28px; display: grid; gap: 16px; }
.login-card .brand { padding: 0; margin-bottom: 6px; }
.login-card .btn { width: 100%; margin-top: 4px; }

/* ——— Obvestilo ——— */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 100;
  background: var(--ink); color: var(--paper); padding: 11px 18px; border-radius: var(--r-md); font-weight: 500;
  box-shadow: 0 12px 30px rgba(10, 16, 30, .3); max-width: calc(100vw - 32px);
}
.toast.error { background: var(--err); color: #fff; }
.skeleton { color: var(--ink-3); padding: 20px 0; }

/* ——— Odzivnost ——— */
/* Vrstice se prilagodijo širini kartice, ne zaslona. */
@container rows (max-width: 1080px) {
  .rows-head { display: none; }
  .row-edit { grid-template-columns: repeat(12, minmax(0, 1fr)); row-gap: 10px; padding: 14px 12px; }
  .row-edit > .c-item { grid-column: span 5; }
  .row-edit > .c-desc { grid-column: span 7; }
  .row-edit > .c-qty, .row-edit > .c-price, .row-edit > .c-disc, .row-edit > .c-vat, .row-edit > .c-total { grid-column: span 2; }
  .row-edit > .c-unit, .row-edit > .c-del { grid-column: span 1; }
  .row-edit > .c-del { justify-self: end; align-self: end; }
  .row-edit .lbl { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 3px; }
  .row-edit .row-total { padding-top: 8px; }
  .row-edit > .c-total .lbl { text-align: right; }
}
@container rows (max-width: 620px) {
  .row-edit { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .row-edit > .c-item, .row-edit > .c-desc { grid-column: 1 / -1; }
  .row-edit > .c-qty, .row-edit > .c-unit, .row-edit > .c-price, .row-edit > .c-disc, .row-edit > .c-vat { grid-column: span 2; }
  .row-edit > .c-total { grid-column: span 1; }
  .row-edit > .c-del { grid-column: span 1; }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: fixed; z-index: 40; top: auto; bottom: 0; left: 0; right: 0; height: auto; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    flex-direction: row; border-right: 0; border-top: 1px solid var(--line);
  }
  .rail .brand, .rail-foot { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-around; }
  .nav a { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 4px; flex: 1; text-align: center; }
  .nav a svg { width: 21px; height: 21px; }
  .nav a.nav-secondary { display: none; }
  .nav .nav-long { display: none; }
  .nav .nav-short { display: inline; }
  .mobile-top { display: flex !important; }
  main { padding: 18px 16px 110px; }
  .figures { grid-template-columns: 1fr 1fr; }
  .figures > div { padding: 14px 16px; }
  .figures dd { font-size: 22px; }
  .hero { padding: 22px 20px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .list-row { grid-template-columns: 70px minmax(0, 1fr) auto; }
  .list-row .badge { grid-column: 2 / -1; justify-self: start; }
  .list-row.nodate { grid-template-columns: minmax(0, 1fr) auto; }
  .list-row.nodate .badge { grid-column: 1 / -1; }
  .list-row.nodate .err-line { grid-column: 1 / -1; }
  .cal-cell { min-height: 58px; padding: 5px 4px; }
  .cal-cell .chip { display: none; }
  .cal-dots { display: flex; gap: 3px; flex-wrap: wrap; padding: 0 3px; }
  .cal-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
  .cal-dots i.issued { background: var(--ok); } .cal-dots i.draft { background: var(--warn); }
  .cal-dots i.failed { background: var(--err); } .cal-dots i.skipped { background: var(--skip); }
  .cal-cell.has-items { cursor: pointer; }
  .cal-cell.selected { box-shadow: inset 0 0 0 2px var(--accent); }
  .agenda { display: block; margin-top: 18px; }
  .agenda h3 { margin: 18px 0 8px; }
  dialog.sheet { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; border: 0; }
  .list-row .when .rel { display: none; }
  .sheet-head, .sheet-body, .sheet-foot { padding-left: 16px; padding-right: 16px; }
  .sheet-foot { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .form-foot { bottom: 64px; }
}
.mobile-top { display: none; align-items: center; justify-content: space-between; padding: 14px 16px 0; }
.top-links { display: flex; align-items: center; gap: 4px; }
.top-links .icon-btn { color: var(--ink-2); }
.top-links .icon-btn:hover { color: var(--accent); }
.top-links .icon-btn[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.top-links .icon-btn svg { width: 21px; height: 21px; }
.mobile-top .brand { padding: 0; }


/* ——— Plačila, e-pošta, banka ——— */
@media (min-width: 861px) { .nav .nav-short { display: none; } }
.badge.paid { background: var(--ok-soft); color: var(--ok); }
.badge.partial { background: var(--warn-soft); color: var(--warn); }
.badge.overdue { background: var(--err-soft); color: var(--err); }
.badge.open { background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-2); }
.badge.sent { background: var(--accent-soft); color: var(--accent); }
.err-text { color: var(--err); }
td small.err-text, td small { display: block; }

.notices { display: grid; gap: 10px; }
.alert.note { border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); border-left-color: var(--accent); }
.alert.note h3 { color: var(--accent); }
.notice-list { display: grid; gap: 4px; justify-items: start; }
.link-btn { border: 0; background: none; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; text-align: left; }

.subpanel { border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; display: grid; gap: 14px; background: var(--surface); }
.switch { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.switch input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.switch b { display: block; font-weight: 500; }
.switch small { display: block; color: var(--ink-2); font-size: 14px; }
.email-fields { display: grid; gap: 14px; margin-top: 14px; }
.subpanel .email-fields { margin-top: 0; }
.email-fields[hidden] { display: none; }

.list.mini .list-row { padding: 10px 14px; grid-template-columns: minmax(0, 1fr) auto auto; }
.pay-box { border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; background: var(--surface); }
.pay-list { list-style: none; margin: 10px 0 0; padding: 0; border-top: 1px solid var(--line-2); }
.pay-list li { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto 34px; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.pay-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-top: 12px; }
.pay-form .field { width: 170px; }

.summary-line { margin: -8px 0 14px; color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip-f { display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); text-decoration: none; font-size: 14px; font-weight: 500; }
.chip-f span { color: var(--ink-3); font-size: 13px; }
.chip-f:hover { border-color: var(--ink-3); color: var(--ink); }
.chip-f[aria-current="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.chip-f[aria-current="true"] span { color: color-mix(in srgb, var(--surface) 70%, transparent); }

.bank-top { align-items: start; }
.dropzone { display: flex; gap: 14px; align-items: center; padding: 22px 18px; border: 1.5px dashed var(--line); border-radius: var(--r-md); cursor: pointer; background: var(--surface-2); }
.dropzone svg { width: 28px; height: 28px; color: var(--accent); flex: none; }
.dropzone b { display: block; font-weight: 500; }
.dropzone small { color: var(--ink-3); font-size: 13px; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
[data-upload-result] .alert { margin-top: 12px; }

.tx-row { padding: 12px 18px; border-top: 1px solid var(--line-2); }
.tx-row:first-child { border-top: 0; }
.tx-main { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 14px; align-items: baseline; }
.tx-main .when { font-weight: 600; }
.tx-main .who b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-main .who span { display: block; color: var(--ink-2); font-size: 14px; overflow-wrap: anywhere; }
.tx-main .amount { font-weight: 600; white-space: nowrap; }
.tx-main .amount.in { color: var(--ok); }
.tx-main .amount.out { color: var(--ink-2); }
.tx-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 0 90px; }
.tx-state { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; color: var(--ink-2); }
.tx-state.ok { color: var(--ok); }
.tx-state svg { width: 16px; height: 16px; }
.btn.sugg { text-align: left; white-space: normal; height: auto; max-width: 100%; border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); color: var(--accent); }
[data-head-actions] { flex-wrap: nowrap; }
.btn.sugg small { color: var(--ink-3); font-weight: 400; margin-left: 6px; }

.mail-head { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; font-size: 14px; }
.mail-head > div { display: contents; }
.mail-head dt { color: var(--ink-2); }
.mail-head dd { margin: 0; overflow-wrap: anywhere; }
.mail-frame { width: 100%; height: 520px; border: 1px solid var(--line); border-radius: var(--r-md); background: #eef0f3; display: block; }
.mail-text { white-space: pre-wrap; font: 13px/1.5 var(--text); background: var(--surface-2); padding: 12px; border-radius: var(--r-sm); margin: 10px 0 0; }
.attachment { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-md); text-decoration: none; color: var(--ink); background: var(--surface); justify-self: start; }
.attachment:hover { border-color: var(--accent); }
.attachment svg { width: 26px; height: 26px; color: var(--err); flex: none; }
.attachment b { display: block; font-weight: 500; }
.attachment small { color: var(--ink-3); font-size: 13px; }
.compose { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 20px; align-items: start; }
.compose-form { display: grid; gap: 14px; }
.compose-form .field small .link-btn { font-size: 13px; }
.preview-label { font-size: 13px; margin-bottom: 6px; }
.mail-row { grid-template-columns: 70px minmax(0, 1fr) minmax(0, 220px) auto; }
.mail-row .mail-to { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 900px) {
  .compose { grid-template-columns: 1fr; }
  .mail-frame { height: 60vh; }
  .mail-row { grid-template-columns: 70px minmax(0, 1fr) auto; }
  .mail-row .mail-to { display: none; }
  .mail-row .badge { grid-column: 2 / -1; justify-self: start; }
  .tx-main { grid-template-columns: 58px minmax(0, 1fr) auto; gap: 10px; }
  .tx-foot { margin-left: 0; }
  .pay-list li { grid-template-columns: 90px minmax(0, 1fr) auto 34px; }
  .pay-list li span:nth-child(2) { font-size: 13px; }
}

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