/* Truck Mix Max — izgled */

:root {
  color-scheme: light;
  --page: #f3f2ee;
  --surface: #fcfcfb;
  --surface-2: #f4f3ef;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6b6a65;
  --line: #e7e6e0;
  --border: rgba(11, 11, 11, 0.09);
  --brand: #13233f;
  --brand-2: #1c3157;
  --brand-ink: #c9d1e0;
  --accent: #f2a900;
  --accent-hover: #ffbb1f;
  --input-bg: #fff8dc;
  --input-border: #ead27f;
  --input-focus: #c98500;
  --focus-ring: rgba(242, 169, 0, 0.35);
  --good: #0ca30c;
  --warn: #fab219;
  --bad: #d03b3b;
  --bad-line: #b42323;
  --shadow: 0 1px 2px rgba(19, 35, 63, 0.05), 0 4px 16px rgba(19, 35, 63, 0.04);
  /* serije za grafik (provjereno validatorom, svijetla podloga) */
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --s5: #e87ba4;
  --s6: #008300;
  --on-s4: #0b0b0b;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #222220;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #a3a198;
    --line: #2c2c2a;
    --border: rgba(255, 255, 255, 0.09);
    --brand: #101c33;
    --brand-2: #1a2a49;
    --input-bg: #262111;
    --input-border: #6b5a1e;
    --input-focus: #f2a900;
    --focus-ring: rgba(242, 169, 0, 0.3);
    --bad-line: #e66767;
    --shadow: none;
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --s4: #c98500;
    --s5: #d55181;
    --s6: #0ca30c;
    --on-s4: #ffffff;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 150px; }
body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--page);
  color: var(--ink);
}
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.25; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #0b0b0b; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
:focus-visible { outline: 2px solid var(--input-focus); outline-offset: 2px; }

/* ------------------------------------------------------------ dugmad */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 10px; padding: 9px 14px;
  font-weight: 650; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-accent { background: var(--accent); color: #0b0b0b; }
.btn-accent:hover { background: var(--accent-hover); }
.btn-dark { background: var(--brand-2); color: #fff; border-color: rgba(255, 255, 255, 0.14); }
.btn-dark:hover { background: #26406f; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-soft { background: var(--surface-2); border-color: var(--border); color: var(--ink); }
.btn-soft:hover { border-color: var(--input-focus); }
.btn-danger { background: transparent; border-color: var(--bad); color: var(--bad-line); }
.btn-danger:hover { background: rgba(208, 59, 59, 0.08); }
.btn-danger.armed { background: var(--bad); color: #fff; }
.btn-soft.armed { background: var(--warn); border-color: var(--warn); color: #0b0b0b; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.icon { padding: 8px; }

/* ------------------------------------------------------------ zaglavlje */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--brand); color: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .18); }
.topbar-in { max-width: 1240px; margin: 0 auto; padding: 10px 20px 6px; display: flex; align-items: center; gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; margin-right: auto; min-width: 0; }
.brand img { flex: none; display: block; }
.brand strong { display: block; font-size: 17px; letter-spacing: .2px; }
.brand small { display: block; font-size: 12px; color: var(--brand-ink); margin-top: -2px; }
.vehicle { display: flex; align-items: center; gap: 6px; min-width: 0; }
.vehicle select {
  max-width: 220px; min-width: 0; background: var(--brand-2); color: #fff; border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 10px; padding: 8px 30px 8px 12px; font-weight: 600; appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, #c9d1e0 50%), linear-gradient(135deg, #c9d1e0 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px; background-repeat: no-repeat;
  text-overflow: ellipsis;
}
.vehicle select option { color: #0b0b0b; background: #fff; }
.tabs { max-width: 1240px; margin: 0 auto; padding: 0 12px; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  background: none; border: 0; color: var(--brand-ink); padding: 10px 12px 11px; font-weight: 650; cursor: pointer;
  border-bottom: 3px solid transparent; white-space: nowrap;
}
.tabs button:hover { color: #fff; }
.tab-s { display: none; }
.tabs button[aria-selected="true"] { color: #fff; border-bottom-color: var(--accent); }

.kpi-bar {
  max-height: 0; overflow: hidden; transition: max-height .2s ease;
  background: var(--brand-2); border-top: 1px solid rgba(255, 255, 255, .08);
}
.kpi-bar.show { max-height: 60px; }
.kpi-in { max-width: 1240px; margin: 0 auto; padding: 8px 20px; display: flex; gap: 18px; flex-wrap: wrap; align-items: baseline; font-size: 14px; color: var(--brand-ink); }
.kpi-in strong { color: #fff; font-size: 16px; margin-left: 4px; }
.kpi-in .kpi-main strong { color: var(--accent); font-size: 18px; }

/* ------------------------------------------------------------ raspored */
main.wrap { padding-top: 20px; padding-bottom: 40px; }
.panel:focus { outline: none; }
.grid { display: grid; grid-template-columns: minmax(330px, 430px) minmax(0, 1fr); gap: 20px; align-items: start; }
.col-inputs, .col-results { display: grid; gap: 16px; min-width: 0; }
@media (min-width: 961px) {
  .col-results {
    position: sticky; top: calc(var(--head-h, 104px) + 14px);
    max-height: calc(100vh - var(--head-h, 104px) - 28px); overflow-y: auto; overscroll-behavior: contain;
    scrollbar-width: thin; scrollbar-color: var(--line) transparent; border-radius: var(--radius);
  }
}
.results-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 18px 16px; box-shadow: var(--shadow); min-width: 0;
}
.card-head h2, .card-head h3 { margin: 0; font-size: 16px; }
.card-head p { margin: 3px 0 0; color: var(--ink-2); font-size: 13.5px; }
.card-note { margin: 12px 0 0; font-size: 12.5px; color: var(--muted); }
.card.wide { grid-column: 1 / -1; }

/* ------------------------------------------------------------ hero */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 24px; align-items: center;
  background: var(--brand); color: #fff; border: 0; padding: 26px 28px; margin-bottom: 20px;
  background-image: radial-gradient(120% 140% at 100% 0%, rgba(242, 169, 0, .16), transparent 55%);
}
.eyebrow { margin: 0 0 6px; font-size: 13px; font-weight: 650; letter-spacing: .4px; text-transform: uppercase; color: var(--brand-ink); }
.hero-figure { margin: 0; line-height: 1; }
.hero-figure .big-num { font-size: 60px; font-weight: 750; letter-spacing: -1.5px; }
.hero-figure .big-unit { font-size: 22px; font-weight: 650; color: var(--accent); margin-left: 8px; }
.hero-text { margin: 12px 0 0; color: #dfe4ee; max-width: 56ch; }
.hero-side { margin: 0; display: grid; gap: 10px; }
.hero-side > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); border-radius: 10px; }
.hero-side dt { color: var(--brand-ink); font-size: 14px; }
.hero-side dd { margin: 0; font-weight: 700; font-size: 17px; white-space: nowrap; }
.hero-side .up dd { color: var(--accent); }

/* ------------------------------------------------------------ polja za unos */
.form-card { container-type: inline-size; }
.form-card > details > summary { list-style: none; cursor: pointer; display: flex; gap: 12px; align-items: flex-start; }
.form-card > details > summary::-webkit-details-marker { display: none; }
.form-card > details > summary .card-head { flex: 1; }
.chev { flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: var(--ink-2); background: var(--surface-2); transition: transform .15s; }
details[open] > summary .chev { transform: rotate(180deg); }
.fields { margin-top: 10px; }
.field { padding: 10px 0; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.field:first-child { border-top: 0; }
.field label { font-weight: 600; font-size: 14px; }
.hint { margin: 0; font-size: 12.5px; color: var(--muted); }
@container (min-width: 380px) {
  .field { grid-template-columns: minmax(0, 1fr) 168px; column-gap: 14px; align-items: center; }
  .field label { grid-column: 1; grid-row: 1; }
  .field .input-wrap { grid-column: 2; grid-row: 1 / span 2; }
  .field .hint { grid-column: 1; grid-row: 2; }
}
.input-wrap {
  display: flex; align-items: center; background: var(--input-bg); border: 1.5px solid var(--input-border);
  border-radius: 10px; transition: border-color .15s, box-shadow .15s;
}
.input-wrap:focus-within { border-color: var(--input-focus); box-shadow: 0 0 0 3px var(--focus-ring); }
.input-wrap input {
  flex: 1; min-width: 0; width: 100%; border: 0; background: transparent; padding: 9px 4px 9px 12px;
  font-size: 16px; font-weight: 650; text-align: right; font-variant-numeric: tabular-nums;
}
.input-wrap input:focus { outline: none; }
.input-wrap .unit { padding: 0 12px 0 6px; color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.input-wrap:has(input[aria-invalid="true"]) { border-color: var(--bad); box-shadow: 0 0 0 3px rgba(208, 59, 59, .18); }

/* ------------------------------------------------------------ kartice sa rezultatima */
.result-card { display: flex; flex-direction: column; }
.result-big { margin: 12px 0 0; line-height: 1.05; }
.result-big .big-num { font-size: 34px; font-weight: 750; letter-spacing: -.6px; }
.result-big .big-unit { font-size: 15px; font-weight: 650; color: var(--ink-2); margin-left: 6px; }
.result-big-label { margin: 4px 0 0; color: var(--ink-2); font-size: 13.5px; }
.mini { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.mini dt { font-size: 12px; color: var(--muted); line-height: 1.3; }
.mini dd { margin: 2px 0 0; font-weight: 650; font-variant-numeric: tabular-nums; }
.result-card .card-note { margin-top: auto; padding-top: 12px; }

.lines { margin: 14px 0 0; padding: 0; list-style: none; }
.lines li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.lines li:first-child { border-top: 0; }
.lines li span:last-child { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lines li.total { border-top: 2px solid var(--ink); font-weight: 700; }

/* status: ikona + tekst, nikad samo boja */
.status { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); margin: 12px 0 0; font-size: 14px; }
.status strong { display: block; }
.status-icon { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; margin-top: 1px; }
.status-good .status-icon { background: var(--good); }
.status-warn .status-icon { background: var(--warn); color: #0b0b0b; }
.status-bad .status-icon { background: var(--bad); }
.status-neutral .status-icon { background: var(--muted); }

/* ------------------------------------------------------------ segmentna traka (struktura troška) */
.segbar { display: flex; gap: 2px; height: 28px; margin: 16px 0 12px; }
.seg {
  min-width: 0; border-radius: 4px; display: flex; align-items: center; padding: 0 8px;
  color: #fff; font-size: 12px; font-weight: 700; white-space: nowrap; cursor: default; outline-offset: 2px;
}
.seg:hover, .seg:focus-visible { filter: brightness(1.1) saturate(1.05); }
.seg.c1 { background: var(--s1); } .seg.c2 { background: var(--s2); } .seg.c3 { background: var(--s3); }
.seg.c4 { background: var(--s4); color: var(--on-s4); } .seg.c5 { background: var(--s5); } .seg.c6 { background: var(--s6); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.sw.c1 { background: var(--s1); } .sw.c2 { background: var(--s2); } .sw.c3 { background: var(--s3); }
.sw.c4 { background: var(--s4); } .sw.c5 { background: var(--s5); } .sw.c6 { background: var(--s6); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; list-style: none; padding: 0; margin: 0 0 6px; font-size: 13px; color: var(--ink-2); }
.legend li { display: flex; align-items: center; gap: 6px; }
table.costs { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 8px; }
table.costs th { text-align: right; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 0 6px 10px; border-bottom: 1px solid var(--line); }
table.costs th:first-child { text-align: left; padding-left: 0; }
table.costs td { padding: 7px 0 7px 10px; text-align: right; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; white-space: nowrap; }
table.costs td:first-child { text-align: left; padding-left: 0; white-space: normal; }
table.costs td:first-child .cell-name { display: inline-flex; align-items: center; gap: 8px; }
table.costs tfoot td { font-weight: 700; border-bottom: 0; }

.tip {
  position: fixed; z-index: 60; pointer-events: none; background: var(--surface); color: var(--ink);
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; box-shadow: 0 6px 24px rgba(0, 0, 0, .16); font-size: 13px; max-width: 260px;
}
.tip strong { display: block; font-size: 15px; }
.tip span { color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.tip .key { width: 12px; height: 2px; border-radius: 1px; display: inline-block; }

/* ------------------------------------------------------------ poruke klijentu */
.msgs { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-top: 14px; }
.msg { border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.msg h4 { margin: 0; font-size: 14px; }
.msg pre { margin: 0; white-space: pre-wrap; font-family: inherit; font-size: 14px; line-height: 1.55; color: var(--ink); }
.msg .btn { align-self: flex-start; }
.msg-empty { color: var(--ink-2); font-size: 14px; margin: 0; }

/* ------------------------------------------------------------ evidencija */
.log-head { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; justify-content: space-between; }
.log-head h2 { margin: 0; font-size: 20px; }
.log-head p { margin: 4px 0 0; color: var(--ink-2); max-width: 70ch; font-size: 14px; }
.log-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 18px 0; }
.stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat-label { font-size: 13px; color: var(--ink-2); margin: 0; }
.stat-value { font-size: 24px; font-weight: 750; margin: 2px 0 0; letter-spacing: -.3px; }
.stat-sub { font-size: 12.5px; color: var(--muted); margin: 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table.log { border-collapse: collapse; width: 100%; min-width: 1120px; font-size: 14px; }
table.log th {
  background: var(--surface-2); text-align: left; font-size: 12px; color: var(--ink-2); padding: 9px 6px; font-weight: 650;
  border-bottom: 1px solid var(--line); vertical-align: bottom; line-height: 1.25;
}
table.log th.num, table.log td.num { text-align: right; }
table.log td { padding: 6px; border-top: 1px solid var(--line); vertical-align: middle; }
table.log tr:first-child td { border-top: 0; }
table.log td input[type="text"], table.log td input[type="date"] {
  width: 100%; border: 1px solid var(--input-border); background: var(--input-bg); border-radius: 8px; padding: 6px 8px; font-size: 14px;
}
table.log td input.t[type="text"] { min-width: 150px; }
table.log td input.n { text-align: right; font-variant-numeric: tabular-nums; }
table.log td input:focus { outline: none; border-color: var(--input-focus); box-shadow: 0 0 0 3px var(--focus-ring); }
table.log td.out { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.log .chk { width: 20px; height: 20px; accent-color: var(--good); cursor: pointer; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.pill i { font-style: normal; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; }
.pill.good i { background: var(--good); }
.pill.bad i { background: var(--bad); }
.pill.wait i { background: var(--muted); }
.row-del { background: none; border: 0; color: var(--muted); cursor: pointer; width: 30px; height: 30px; border-radius: 8px; font-size: 18px; line-height: 1; }
.row-del:hover { background: rgba(208, 59, 59, .1); color: var(--bad-line); }
.empty { text-align: center; padding: 34px 16px; color: var(--ink-2); }
.empty strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

/* ------------------------------------------------------------ podnožje, dijalog, poruka */
.foot { border-top: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 14px; }
.foot-in { display: flex; gap: 16px 30px; justify-content: space-between; align-items: center; flex-wrap: wrap; padding-top: 18px; padding-bottom: 22px; }
.foot p { margin: 0 0 4px; max-width: 75ch; }
.foot .small { font-size: 12.5px; color: var(--muted); }
.foot-actions { display: flex; gap: 8px; flex-wrap: wrap; }

dialog { border: 0; border-radius: 16px; padding: 0; width: min(440px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
dialog::backdrop { background: rgba(10, 16, 28, .55); }
.dlg { padding: 20px; display: grid; gap: 14px; }
.dlg h2 { margin: 0; font-size: 19px; }
.dlg-lead { margin: -8px 0 0; color: var(--ink-2); font-size: 14px; }
.dlg-field { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
.dlg-field input { border: 1.5px solid var(--input-border); background: var(--input-bg); border-radius: 10px; padding: 10px 12px; font-size: 16px; }
.dlg-field input:focus { outline: none; border-color: var(--input-focus); box-shadow: 0 0 0 3px var(--focus-ring); }
.dlg-actions { display: grid; gap: 8px; }
.dlg-actions .btn { justify-content: flex-start; }
.dlg-foot { display: flex; justify-content: flex-end; }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none; z-index: 70;
  background: #0f1a2e; color: #fff; padding: 10px 14px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
  display: flex; gap: 12px; align-items: center; font-size: 14px; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { background: none; border: 0; color: var(--accent); font-weight: 700; cursor: pointer; padding: 2px 4px; }

/* ------------------------------------------------------------ manji ekrani */
@media (max-width: 960px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 22px; }
}
@media (max-width: 600px) {
  .wrap { padding: 0 12px; }
  .topbar-in { padding: 8px 12px 4px; gap: 8px; }
  .brand small { display: none; }
  .brand strong { font-size: 15px; }
  .btn-label { display: none; }
  #exportBtn { padding: 9px 10px; }
  .vehicle select { max-width: 130px; padding-right: 26px; }
  .kpi-in { padding: 7px 12px; gap: 12px; font-size: 13px; }
  .kpi-in .kpi-extra { display: none; }
  .hero-figure .big-num { font-size: 50px; }
  .card { padding: 16px 14px 14px; }
  main.wrap { padding-top: 14px; }
  .tabs button { padding: 10px 9px 11px; }
  .tab-l { display: none; }
  .tab-s { display: inline; }
}
@media (max-width: 380px) {
  .brand-text { display: none; }
}

@media print {
  .topbar, .foot, .log-actions, .row-del, .msg .btn, .chev { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
  .panel[hidden] { display: none; }
}

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

/* ================================================================ PLATFORMA (dashboard, sveska, forme) */
.is-hidden { display: none !important; }
.tabs a {
  color: var(--brand-ink); padding: 10px 12px 11px; font-weight: 650; text-decoration: none;
  border-bottom: 3px solid transparent; white-space: nowrap;
}
.tabs a:hover { color: #fff; }
.tabs a[aria-current="page"] { color: #fff; border-bottom-color: var(--accent); }
.brand small { max-width: 26ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sync { font-size: 12.5px; color: var(--brand-ink); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.sync::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.sync.wait::before { background: var(--warn); }
.sync.off::before { background: #9aa3b5; }
.sync.err::before { background: var(--bad); }
.sync.demo::before { background: var(--accent); }
.sync a { color: #fff; }

.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; min-width: 240px; padding: 6px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 40px rgba(0, 0, 0, .22);
}
.menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: 8px; font-weight: 600; cursor: pointer; }
.menu button:hover, .menu button:focus-visible { background: var(--surface-2); }

.demo-banner { background: var(--accent); color: #0b0b0b; font-size: 13.5px; padding: 7px 20px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.demo-banner a { color: #0b0b0b; font-weight: 700; }

.page-head { display: flex; gap: 12px 24px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1, .dash-hello h1 { margin: 0; font-size: 26px; letter-spacing: -.3px; }
.lead { margin: 4px 0 0; color: var(--ink-2); }
.add-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar { display: flex; gap: 10px 16px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 6px 12px;
  font-weight: 600; font-size: 14px; cursor: pointer; display: inline-flex; gap: 6px; align-items: baseline;
}
.chip small { color: var(--muted); font-weight: 500; font-size: 12px; }
.chip[aria-pressed="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip[aria-pressed="true"] small { color: var(--brand-ink); }
.chip.radio { position: relative; }
.chip.radio input { position: absolute; opacity: 0; pointer-events: none; }
.chip.radio:has(input:checked) { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip.radio:has(input:focus-visible) { outline: 2px solid var(--input-focus); outline-offset: 2px; }
.seg-switch { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.seg-switch a, .seg-switch button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; font-weight: 650; font-size: 14px; color: var(--ink-2); text-decoration: none; cursor: pointer; }
.seg-switch .on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.pager { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.pager .icon { width: 36px; height: 36px; font-size: 20px; line-height: 1; padding: 0; text-decoration: none; }
.pager-label { display: grid; text-align: center; min-width: 150px; line-height: 1.2; }
.pager-label small { color: var(--muted); font-size: 12.5px; }
.is-disabled { opacity: .35; pointer-events: none; }
.btn.btn-ghost { color: var(--ink); }

/* sveska */
.sv-grid { display: grid; grid-template-columns: minmax(300px, 440px) minmax(0, 1fr); gap: 16px; align-items: start; margin-bottom: 16px; }
.card-head h2 small { font-weight: 500; color: var(--muted); font-size: 13px; margin-left: 4px; }
table.calc { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 15px; }
table.calc th { text-align: left; font-weight: 500; padding: 8px 0; border-bottom: 1px solid var(--line); }
table.calc th small { display: block; color: var(--muted); font-size: 12px; margin-left: 22px; }
table.calc td { text-align: right; padding: 8px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; white-space: nowrap; }
table.calc .sign { display: inline-block; width: 22px; color: var(--muted); font-weight: 700; }
table.calc tr.plus th, table.calc tr.plus td { font-weight: 650; }
table.calc tr.sub th, table.calc tr.sub td { font-weight: 650; background: var(--surface-2); }
table.calc tr.total th, table.calc tr.total td { font-weight: 750; font-size: 18px; border-top: 2px solid var(--ink); border-bottom: 0; padding-top: 10px; }
table.calc tr.total2 th, table.calc tr.total2 td { font-weight: 700; border-top: 1px solid var(--ink); }
table.calc tr.sub th, table.calc tr.sub td { padding-left: 0; }
.mini4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.mini4 dt { font-size: 12px; color: var(--muted); }
.mini4 dd { margin: 2px 0 0; font-weight: 650; font-variant-numeric: tabular-nums; font-size: 14px; }
.cat-break { margin-top: 12px; }
.cat-break summary { cursor: pointer; font-weight: 600; color: var(--ink-2); font-size: 14px; }
table.entries { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 8px; }
table.entries th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); }
table.entries td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.entries .num, table.hist .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.entries td.date, table.entries td.veh { white-space: nowrap; color: var(--ink-2); font-variant-numeric: tabular-nums; }
table.entries td.in { color: var(--ink); font-weight: 650; }
table.entries td.out { color: var(--ink-2); }
.row-link { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; color: inherit; font: inherit; line-height: 1.4; }
.row-link span { color: var(--ink-2); }
.row-link:hover strong, .row-link:focus-visible strong { text-decoration: underline; }
.row-link .pill { margin-left: 4px; vertical-align: 1px; }
.table-scroll { overflow-x: auto; }
table.hist { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
table.hist th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.hist th.num { text-align: right; }
table.hist td { padding: 8px; border-bottom: 1px solid var(--line); }
table.hist td a { color: var(--ink); font-weight: 600; text-decoration: none; }
table.hist td a small { color: var(--muted); font-weight: 500; margin-left: 4px; }
table.hist td a:hover { text-decoration: underline; }
table.hist tr.on td { background: var(--input-bg); }
table.hist td.strong { font-weight: 700; }
.history { margin-bottom: 8px; }
.pill.neutral i { background: var(--muted); }

/* početna */
.dash-hello { display: flex; gap: 12px 24px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; margin-bottom: 18px; }
.week-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 16px; }
.week-card .result-big .big-num { font-size: 40px; }
.week-card.total { background: var(--surface-2); }
.card-foot { margin: 14px 0 0; padding-top: 10px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; font-size: 14px; }
.card-foot a { color: var(--ink); font-weight: 650; }
.add-mini { display: inline-flex; gap: 10px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--ink-2); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.link-btn:hover { color: var(--ink); }
.continue {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px; margin-bottom: 22px; border-radius: var(--radius);
  background: var(--input-bg); border: 1px solid var(--input-border); color: var(--ink); text-decoration: none;
}
.continue span:nth-child(2) { flex: 1; }
.continue:hover { border-color: var(--input-focus); }
.sec-title { font-size: 17px; margin: 0 0 12px; }
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.app-tile {
  display: flex; gap: 12px; align-items: flex-start; padding: 16px; border-radius: var(--radius); text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); position: relative;
}
a.app-tile:hover { border-color: var(--input-focus); }
.app-ic { flex: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--brand); color: var(--accent); }
.app-txt { display: grid; gap: 3px; }
.app-txt span { color: var(--ink-2); font-size: 13.5px; }
.soon-tile { opacity: .62; box-shadow: none; background: transparent; border-style: dashed; }
.soon-tile .app-ic { background: var(--surface-2); color: var(--muted); }
.soon { position: absolute; top: 10px; right: 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.badge { display: inline-block; margin-left: 8px; background: var(--bad); color: #fff; font-size: 11px; padding: 2px 7px; border-radius: 999px; vertical-align: 2px; }
.notice { display: flex; gap: 12px 24px; justify-content: space-between; align-items: center; flex-wrap: wrap; margin-bottom: 16px; background: var(--input-bg); border-color: var(--input-border); }
.notice p { margin: 4px 0 0; color: var(--ink-2); }
.center-card { max-width: 520px; margin: 40px auto; text-align: center; }
.loading { color: var(--muted); padding: 40px 0; text-align: center; }

/* forme u dijalogu */
dialog { width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 24px); }
.dlg { padding: 0; display: block; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 6px; }
.dlg-head h2 { margin: 0; font-size: 20px; }
.dlg-x { background: none; border: 0; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); width: 36px; height: 36px; border-radius: 8px; }
.dlg-x:hover { background: var(--surface-2); }
.dlg-body { padding: 8px 20px 4px; display: grid; gap: 12px; }
.ef { display: grid; gap: 5px; min-width: 0; }
.ef > label, .ef legend { font-weight: 600; font-size: 14px; }
.ef-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ef-row.three { grid-template-columns: 1fr 1fr 1fr; }
.text-in, .dlg select, .ef select {
  width: 100%; border: 1.5px solid var(--input-border); background: var(--input-bg); border-radius: 10px; padding: 9px 12px; font-size: 16px;
}
.text-in:focus, .ef select:focus { outline: none; border-color: var(--input-focus); box-shadow: 0 0 0 3px var(--focus-ring); }
.ef .input-wrap input { text-align: right; }
.cats { border: 0; padding: 0; margin: 0; }
.cat-group { display: grid; grid-template-columns: 70px 1fr; gap: 8px; align-items: start; margin-top: 6px; }
.cat-label { font-size: 12.5px; color: var(--muted); padding-top: 7px; }
.checks { display: grid; gap: 8px; align-content: end; padding-bottom: 6px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500 !important; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.form-err { margin: 0; color: var(--bad-line); font-weight: 600; font-size: 14px; min-height: 1px; }
.dlg-actions-row { display: flex; gap: 8px; align-items: center; padding: 12px 20px 18px; flex-wrap: wrap; border-top: 1px solid var(--line); margin-top: 8px; }
.spacer { flex: 1; }
fieldset.veh { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 4px; margin: 4px 0; display: grid; gap: 10px; }
fieldset.veh legend { font-weight: 700; padding: 0 6px; }
input[aria-invalid="true"] { border-color: var(--bad) !important; }

/* brzi unos na telefonu */
.quickbar { display: none; }
@media (max-width: 760px) {
  .quickbar {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, .08);
  }
  .quickbar button { background: var(--accent); color: #0b0b0b; border: 0; border-radius: 10px; padding: 11px 6px; font-weight: 700; font-size: 15px; }
  body.mode-demo .foot, body.mode-server .foot { padding-bottom: 70px; }
  .view-trosak ~ .quickbar, .view-tura ~ .quickbar { display: none; }
  .dash-hello .add-row, .page-head .add-row:has([data-add]) { display: none; }
  .sync { display: none; }
  .sv-grid { grid-template-columns: minmax(0, 1fr); }
  .pager { margin-left: 0; width: 100%; justify-content: space-between; }
  .mini4 { grid-template-columns: 1fr 1fr; }
  .ef-row.three { grid-template-columns: 1fr 1fr; }
  .ef-row.three .ef:last-child { grid-column: 1 / -1; }
  dialog { width: 100vw; max-width: 100vw; max-height: 100dvh; height: auto; margin: auto 0 0; border-radius: 16px 16px 0 0; }
  .toast { bottom: 84px; }
}
@media (max-width: 960px) and (min-width: 761px) {
  .sv-grid { grid-template-columns: minmax(0, 1fr); }
}

/* kalkulator i akciza */
.hero-actions { margin: 14px 0 0; }
.real-panel { margin-bottom: 16px; border-color: var(--input-border); }
.real-panel .seg-switch { margin: 12px 0 4px; }
table.costs.real td:first-child { width: 34px; }
table.costs.real td { text-align: left; }
.inline-field { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; font-size: 14px; }
.inline-field select { border: 1.5px solid var(--input-border); background: var(--input-bg); border-radius: 10px; padding: 7px 10px; font-weight: 600; }
.input-wrap.sm input { width: 90px; padding: 7px 4px 7px 10px; font-size: 15px; }
.method { margin-bottom: 16px; }
.method summary { cursor: pointer; }
.method ul { margin: 10px 0 0; padding-left: 20px; color: var(--ink-2); display: grid; gap: 4px; font-size: 14px; }
.akc-veh { margin-bottom: 16px; }
.akc-veh .status { margin-top: 10px; }
table.entries.akc { min-width: 760px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 0 0 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; white-space: nowrap; color: var(--ink); }
.pill i { font-style: normal; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 800; color: #fff; }
.pill.good i { background: var(--good); }
.pill.bad i { background: var(--bad); }
.pill.wait i { background: var(--muted); }
.chk { width: 20px; height: 20px; accent-color: var(--good); cursor: pointer; }

/* popravke poslije pregleda */
.app-txt .badge { color: #fff; }
.ef { align-content: start; }
@media (max-width: 760px) {
  dialog[open] { top: auto; bottom: 0; }
}
