/* MEP AI. Tema je svijetla ili tamna (data-scheme); postavlja je _theme_head.html prije crtanja stranice. */
:root {
  color-scheme: light;
  --ok: #1a7f37; --ok-bg: #dafbe1;
  --warn: #9a6700; --warn-bg: #fff8c5;
  --bad: #cf222e; --bad-bg: #ffebe9;
  --info: #0969da; --info-bg: #ddf4ff;
  --bg: #fafafa; --surface: #ffffff; --surface-2: #f4f4f5; --border: #e4e4e7; --border-soft: #f4f4f5;
  --text: #18181b; --muted: #71717a;
  /* --accent je za tekst i oznake, --accent-fill za pozadinu gumba s bijelim tekstom. */
  --accent: #0969da; --accent-fill: #0969da; --accent-hover: #0860ca; --accent-ink: #ffffff;
  --radius: 14px; --radius-sm: 10px; --shadow: 0 1px 2px rgba(24, 24, 27, .06), 0 4px 12px rgba(24, 24, 27, .04);
  --accent-soft: color-mix(in srgb, var(--accent) 13%, transparent);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
:root[data-scheme="dark"] {
  color-scheme: dark;
  --ok: #3fb950; --ok-bg: rgba(46, 160, 67, .16);
  --warn: #d29922; --warn-bg: rgba(187, 128, 9, .16);
  --bad: #f85149; --bad-bg: rgba(248, 81, 73, .15);
  --info: #58a6ff; --info-bg: rgba(56, 139, 253, .16);
  --bg: #09090b; --surface: #18181b; --surface-2: #27272a; --border: #2e2e33; --border-soft: #27272a;
  --text: #fafafa; --muted: #a1a1aa;
  --accent: #2f81f7; --accent-fill: #1f6feb; --accent-hover: #1a63d6; --accent-ink: #ffffff;
  --shadow: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.45; overflow-wrap: break-word; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.35rem; line-height: 1.25; margin: 0; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: .98rem; margin: 0 0 .6rem; display: flex; align-items: center; gap: .4rem; font-weight: 650; }
h3 { font-size: .9rem; margin: 0 0 .4rem; font-weight: 650; }
p { margin: 0 0 .5rem; }
small, .muted { color: var(--muted); }
.muted { font-size: .92em; }
[hidden] { display: none !important; }
.ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
h2 .ico { color: var(--muted); }

/* Zaglavlje */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 1rem; padding: .3rem 1.1rem; position: sticky; top: 0; z-index: 20; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .5rem; color: var(--text); min-height: 42px; }
.brand:hover { text-decoration: none; }
.brand img { height: 28px; width: 28px; display: block; }
.brand img.logo-robot { height: 34px; width: 34px; }
.brand img.logo-robot.small { height: 26px; width: 26px; }
.brand img.logo-type { height: 42px; width: auto; }
:root[data-scheme="dark"] .only-light, :root:not([data-scheme="dark"]) .only-dark { display: none !important; }
.wordmark { font-weight: 700; font-size: 1.08rem; letter-spacing: .01em; white-space: nowrap; }
.wordmark b { color: var(--accent); font-weight: 700; }
.tabs { display: flex; gap: .1rem; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { color: var(--muted); padding: .36rem .6rem; border-radius: var(--radius-sm); white-space: nowrap; font-weight: 550; display: inline-flex; align-items: center; gap: .36rem; }
.tabs a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.tabs a.on { background: var(--accent-soft); color: var(--accent); }
.tabs a.tab-right { margin-left: auto; }

/* Račun, tema i stil */
.account { position: relative; }
.account > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .4rem; color: var(--text); min-height: 42px; border-radius: var(--radius-sm); padding: 0 .3rem; font-weight: 550; }
.account > summary::-webkit-details-marker { display: none; }
.account > summary:hover { background: var(--surface-2); }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .8rem; color: var(--accent-ink); background: var(--accent-fill); }
.account .chevron { width: 14px; height: 14px; color: var(--muted); }
.account[open] .chevron { transform: rotate(180deg); }
.account-menu { position: absolute; right: 0; top: calc(100% + 6px); width: 260px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0, 0, 0, .25); color: var(--text); padding: .7rem; z-index: 40; }
.theme-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px; margin-bottom: .55rem; }
.theme-switch button { display: flex; flex-direction: column; align-items: center; gap: 1px; font: inherit; font-size: .72rem; font-weight: 600; border: 0; background: none; color: var(--muted); border-radius: 5px; padding: .34rem .2rem; cursor: pointer; }
.theme-switch button:hover { color: var(--text); }
.theme-switch button[aria-pressed="true"] { background: var(--accent-fill); color: var(--accent-ink); }
.menu-link { display: block; width: 100%; text-align: left; background: none; border: 0; font: inherit; color: var(--text); padding: .38rem .45rem; border-radius: var(--radius-sm); cursor: pointer; }
.menu-link:hover { background: var(--surface-2); text-decoration: none; }
.account-menu form { margin: 0; }

/* Stranica */
.page { max-width: 1240px; margin: 0 auto; padding: 1rem 1.1rem 2rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; margin-bottom: .75rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: .8rem .95rem; margin-bottom: .75rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem; }
.section-head h2 { margin: 0; }
.row { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.spread { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 .8rem; }
.grid-4 { display: grid; grid-template-columns: 1.3fr 1.5fr 2fr 1.7fr; gap: 0 .8rem; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .55rem 1rem; margin: 0; }
.facts dt { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.facts dd { margin: 0; white-space: pre-line; }

/* Gumbi i obrasci */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .3rem; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .3rem .7rem; font: inherit; font-weight: 550; cursor: pointer; min-height: 32px; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent-fill); border-color: transparent; color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: var(--bad); }
.btn.ok { color: var(--ok); }
.btn.small { padding: .1rem .5rem; min-height: 26px; font-size: .8rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, summary:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label, .label { font-weight: 600; font-size: .8rem; display: block; margin-bottom: .18rem; color: var(--text); }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=time], input[type=search], select, textarea {
  width: 100%; padding: .32rem .55rem; border: 1px solid var(--border); border-radius: var(--radius-sm); font: inherit; background: var(--surface); color: var(--text); min-height: 32px;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .85; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; }
/* Polje koje se širi u visinu s tekstom: cijeli tekst je uvijek vidljiv, bez klizanja u stranu. */
textarea.grow-text { resize: none; overflow: hidden; line-height: 1.35; white-space: pre-wrap; overflow-wrap: anywhere; }
textarea.inline-edit.grow-text { display: block; padding-top: .25rem; padding-bottom: .25rem; }
.saved { border-color: var(--ok) !important; }
.save-error { border-color: var(--bad) !important; }
.field { margin-bottom: .6rem; }
.field .help { color: var(--muted); font-size: .76rem; margin-top: .12rem; }
.field .err, .form-error { color: var(--bad); font-size: .8rem; margin-top: .12rem; }
.check { display: flex; align-items: center; gap: .4rem; font-weight: 500; margin: .1rem 0; min-height: 26px; }
.check input { width: 16px; height: 16px; flex: none; margin: 0; accent-color: var(--accent); }
.options { display: flex; flex-wrap: wrap; gap: .1rem .9rem; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; }
.filters .field { margin: 0; flex: 1 1 130px; }
.filters .grow { flex: 3 1 220px; }
details > summary { cursor: pointer; font-weight: 550; color: var(--accent); }
details.more { margin: .3rem 0 .7rem; }
details.more[open] > summary { margin-bottom: .5rem; }

/* Pilule: odabir jednim klikom */
.pills { display: flex; flex-wrap: wrap; gap: .25rem; }
.pill { position: relative; margin: 0; font-weight: 500; cursor: pointer; }
.pill input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.pill span { display: inline-flex; align-items: center; gap: .3rem; padding: .16rem .6rem; border: 1px solid var(--border); border-radius: 999px; font-size: .82rem; background: var(--surface); color: var(--muted); min-height: 26px; }
.pill:hover span { color: var(--text); border-color: var(--muted); }
.pill input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.pill input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.pill small { color: inherit; opacity: .7; }
.dept-filter { display: flex; flex-wrap: wrap; gap: .3rem .6rem; align-items: center; }
.dept-filter .label { margin: 0; color: var(--muted); }

/* Oznake */
.chip { display: inline-flex; align-items: center; gap: .28rem; font-size: .72rem; font-weight: 600; border-radius: 999px; padding: .04rem .48rem; background: var(--surface-2); color: var(--muted); white-space: nowrap; border: 1px solid var(--border-soft); }
.chip-work, .chip-done, .chip-stop, .chip-ai { border-color: transparent; }
.chip-work::before, .chip-done::before, .chip-stop::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-work { background: var(--info-bg); color: var(--info); }
.chip-done { background: var(--ok-bg); color: var(--ok); }
.chip-stop { background: var(--bad-bg); color: var(--bad); }
.chip-ai { background: var(--warn-bg); color: var(--warn); }
.chip-project { color: var(--accent); }
.due-late { color: var(--bad); font-weight: 650; }
.due-today { color: var(--warn); font-weight: 650; }
.due-done { color: var(--muted); text-decoration: line-through; }

/* Status jednim klikom */
.status-pills { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: .25rem; }
.st { font: inherit; font-size: .76rem; font-weight: 600; border: 0; border-right: 1px solid var(--border); background: var(--surface); color: var(--muted); padding: .14rem .5rem; cursor: pointer; min-height: 26px; }
.st:last-child { border-right: 0; }
.st:hover { color: var(--text); background: var(--surface-2); }
.st-R.on { background: var(--info-bg); color: var(--info); }
.st-P.on { background: var(--ok-bg); color: var(--ok); }
.st-S.on { background: var(--bad-bg); color: var(--bad); }
.inline-edit { border-color: transparent !important; background: transparent !important; padding-left: .3rem !important; min-height: 26px !important; font-size: .84rem; }
.inline-edit:hover, .inline-edit:focus { border-color: var(--border) !important; background: var(--surface) !important; }
.inline-edit.saved { border-color: var(--ok) !important; }

/* Tablice: na mobitelu postaju kartice */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th { position: relative; text-align: left; font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; padding: .32rem .5rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data td { padding: .42rem .5rem; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tr:last-child td { border-bottom: 0; }
table.data td[data-label="Broj"] b { white-space: nowrap; font-weight: 600; }
table.data a.title { font-weight: 600; color: var(--text); }
/* Broj, status i odrednica u stupcima: statusi su poravnati bez obzira na duljinu broja. */
.number-line { display: grid; grid-template-columns: minmax(10ch, max-content) max-content minmax(0, 1fr); align-items: center; column-gap: 1.1rem; }
.number-line .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.number-line .chip { justify-self: start; }
.number-line + .number-line { margin-top: .3rem; }
.head-count { font-weight: 400; font-size: .8rem; }
.col-grip { position: absolute; top: 0; right: 0; bottom: 0; width: 8px; cursor: col-resize; touch-action: none; }
.col-grip::after { content: ""; position: absolute; top: 20%; bottom: 20%; right: 3px; width: 2px; border-radius: 2px; background: var(--border); }
.col-grip:hover::after, .col-grip.active::after { background: var(--accent); }

/* Povijest izmjena */
.log-wrap { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: auto; }
table.log { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .82rem; }
table.log th { text-align: left; font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; padding: .34rem .55rem; background: var(--surface-2); border-bottom: 1px solid var(--border); }
table.log td { padding: .26rem .55rem; border-bottom: 1px solid var(--border-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.log tbody tr { cursor: pointer; }
table.log tbody tr:hover { background: var(--surface-2); }
table.log tbody tr:last-child td { border-bottom: 0; }
table.log tr.open td { white-space: normal; }
table.log .when { color: var(--muted); font-variant-numeric: tabular-nums; }
.c-when { width: 128px; } .c-who { width: 96px; } .c-kind { width: 84px; } .c-project { width: 28%; }
.kind-new { color: var(--ok); font-weight: 600; }
.kind-del { color: var(--warn); font-weight: 600; }
.kind-mod { color: var(--text); font-weight: 600; }
.kind-assign { color: var(--info); font-weight: 600; }
.kind-muted { color: var(--muted); font-weight: 500; }
.log-foot { color: var(--muted); font-size: .78rem; margin-top: .4rem; }

/* Popis emailova */
.mail { border-bottom: 1px solid var(--border-soft); padding: .5rem .45rem; margin: 0 -.45rem; }
.mail:hover { background: var(--surface-2); }
.mail:last-child { border-bottom: 0; }
.mail .subject { font-weight: 600; color: var(--text); }
.mail .meta { color: var(--muted); font-size: .8rem; }
.mail .summary { margin: .1rem 0 .25rem; }
.mail-body { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: .7rem; }
.review > summary { cursor: pointer; margin: .35rem 0; }
.review + .review { margin-top: .8rem; }
.suggestion { background: var(--warn-bg); border-radius: var(--radius-sm); padding: .4rem .6rem; margin: .3rem 0; }
.similar { background: var(--warn-bg); border-radius: var(--radius); padding: .55rem .75rem; margin-bottom: .75rem; }
.similar h3 { color: var(--warn); }
.similar-row { display: flex; justify-content: space-between; gap: .6rem; align-items: center; padding: .3rem 0; border-top: 1px solid var(--border-soft); flex-wrap: wrap; }
.deadline { display: flex; gap: .3rem; flex-wrap: wrap; align-items: center; margin: .1rem 0; }
.deadline form { margin: 0; }
.confirm-line { display: inline-flex; gap: .3rem; align-items: center; }
.confirm-line select { width: auto; max-width: 16rem; min-height: 28px; padding: .1rem .4rem; font-size: .8rem; }
.chip-with-x { margin: 0; gap: .25rem; }
.chip-x { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: .95rem; line-height: 1; padding: 0 .1rem; opacity: .75; }
.chip-x:hover { opacity: 1; }
/* Statistika. Kategorijske boje redom (provjereno za daltonizam na bijeloj i #18181b podlozi); slot 0 je "Ostali". */
:root {
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-0: #b5b4ad;
  --viz-grid: #e1e0d9; --viz-axis: #c3c2b7; --viz-muted: #898781; --delta-up: #006300; --delta-down: #d03b3b;
}
:root[data-scheme="dark"] {
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-0: #5c5b57;
  --viz-grid: #2c2c2a; --viz-axis: #383835; --delta-up: #0ca30c; --delta-down: #e66767;
}
.s0 { fill: var(--series-0); background: var(--series-0); } .s1 { fill: var(--series-1); background: var(--series-1); }
.s2 { fill: var(--series-2); background: var(--series-2); } .s3 { fill: var(--series-3); background: var(--series-3); }
.s4 { fill: var(--series-4); background: var(--series-4); } .s5 { fill: var(--series-5); background: var(--series-5); }
.s6 { fill: var(--series-6); background: var(--series-6); } .s7 { fill: var(--series-7); background: var(--series-7); }
.stats-filters { align-items: flex-end; }
.stats-filters .field { min-width: 120px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1rem; box-shadow: var(--shadow); }
.kpi-label { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.kpi-value { font-size: 1.9rem; font-weight: 700; line-height: 1.15; margin-top: .15rem; }
.kpi-sub { font-size: .8rem; color: var(--muted); margin-top: .15rem; }
.delta-up { color: var(--delta-up); font-weight: 650; } .delta-down { color: var(--delta-down); font-weight: 650; }.kpi-note { font-size: .74rem; color: var(--muted); opacity: .8; margin-top: .1rem; }
.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.stats-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats-grid > .card { margin-bottom: 1rem; min-width: 0; }
.chart-sub { font-size: .8rem; margin: -.2rem 0 .5rem; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--viz-grid); stroke-width: 1; }
.chart .axis { stroke: var(--viz-axis); stroke-width: 1; }
.chart .tick { fill: var(--viz-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart .tick.strong { fill: var(--muted); font-weight: 600; font-size: 13px; }
.chart .value { fill: var(--text); font-size: 13px; font-weight: 650; }
.chart .ghost { fill: none; stroke: var(--series-1); stroke-width: 1.5; stroke-dasharray: 4 3; }
.chart .hit { fill: transparent; }
.chart .mark:hover path:not(.ghost), .chart .mark:hover rect:not(.hit) { opacity: .82; }
.legend { display: flex; flex-wrap: wrap; gap: .25rem .9rem; font-size: .8rem; color: var(--muted); margin-bottom: .4rem; }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; margin-right: .35rem; vertical-align: -1px; }
.share-rows { display: grid; gap: .4rem; }
.share-row { display: grid; grid-template-columns: 3.4rem 1fr 2.6rem; align-items: center; gap: .6rem; }
.share-year { font-weight: 600; color: var(--muted); font-size: .85rem; }
.share-total { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); font-size: .85rem; }
.share-bar { display: flex; gap: 2px; height: 26px; min-width: 0; }
.share-bar .seg { min-width: 3px; border-radius: 4px; color: #fff; font-size: .72rem; font-weight: 650; display: flex; align-items: center; justify-content: center; overflow: hidden; white-space: nowrap; container-type: inline-size; }
.seg-label { font-weight: inherit; }
/* Postotak se piše kad stane u dio trake, ne prema fiksnom postotku (širina trake ovisi o ekranu). */
@container (max-width: 2.3rem) { .seg-label:not(.short) { display: none; } }
@container (max-width: 1.7rem) { .seg-label { display: none; } }
.share-bar .seg.s4 { color: #0b0b0b; } .share-bar .seg.s0 { color: var(--text); }
.seg-empty { color: var(--muted); font-size: .8rem; align-self: center; }
.table-view { margin-top: .5rem; } .table-view summary { font-size: .8rem; }
table.compact th, table.compact td { padding: .3rem .5rem; }
td.num, th.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-bar { position: relative; min-width: 3.2rem; }
table.data td.cell-bar { padding-bottom: .62rem; }
/* Crta je ispod broja, ne kroz njega: godina prema najboljoj godini u istom retku. */
.mini-bar { position: absolute; left: .5rem; bottom: .28rem; height: 3px; border-radius: 2px; background: var(--series-1); opacity: .6; max-width: calc(100% - 1rem); }
.cell-value { position: relative; }
.trend { font-size: .75rem; font-weight: 650; white-space: nowrap; border-radius: 999px; padding: .05rem .5rem; }
.trend-down { color: var(--bad); background: var(--bad-bg); } .trend-up { color: var(--ok); background: var(--ok-bg); }
.trend-new { color: var(--info); background: var(--info-bg); } .trend-flat { color: var(--muted); background: var(--surface-2); }
.trend-big { font-size: 1.05rem; padding: .15rem .7rem; vertical-align: middle; }
.alert-row { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; padding: .3rem 0; border-top: 1px solid var(--border-soft); }
.alert-row:first-of-type, .chart-sub + .alert-row { border-top: 0; }
.year-path { font-variant-numeric: tabular-nums; }
@media (max-width: 1100px) {
  .stats-grid, .stats-grid.three { grid-template-columns: minmax(0, 1fr); }
  .stats-grid .chart { max-width: 760px; }
}
@media (max-width: 760px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Filtar statusa: boje kao oznake statusa (Radno plavo, Predano zeleno, Stopirano crveno). */
.status-select option { background: var(--surface); color: var(--text); }
.status-select option[value="R"] { color: var(--info); }
.status-select option[value="P"] { color: var(--ok); }
.status-select option[value="S"] { color: var(--bad); }
.status-select:has(option[value="R"]:checked) { color: var(--info); background-color: var(--info-bg); border-color: var(--info); font-weight: 600; }
.status-select:has(option[value="P"]:checked) { color: var(--ok); background-color: var(--ok-bg); border-color: var(--ok); font-weight: 600; }
.status-select:has(option[value="S"]:checked) { color: var(--bad); background-color: var(--bad-bg); border-color: var(--bad); font-weight: 600; }

/* Gumb "i": kratko objašnjenje elementa. Otvara se klikom, zatvara klikom bilo gdje ili tipkom Esc. */
.info-btn { display: inline-grid; place-items: center; width: 18px; height: 18px; padding: 0; margin-left: .3rem; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); font: italic 700 .7rem/1 Georgia, serif; cursor: pointer; vertical-align: middle; }
.info-btn:hover, .info-btn:focus-visible { color: var(--accent); border-color: var(--accent); }
.info-pop { margin: auto; width: min(26rem, calc(100vw - 2rem)); padding: .8rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); box-shadow: 0 8px 30px rgba(0, 0, 0, .25); font-size: .85rem; line-height: 1.45; text-transform: none; letter-spacing: normal; font-weight: 400; }
.info-pop h3 { margin: 0 0 .4rem; font-size: .9rem; }
.info-pop ul { margin: 0; padding-left: 1.1rem; }
.info-pop li + li { margin-top: .3rem; }
@supports (position-area: bottom) {
  .info-pop { margin: .4rem 0; position-area: bottom span-right; position-try-fallbacks: flip-block, flip-inline; }
}
/* Postavke › Arhitekti: krivi zapis → pravo ime */
.alias-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem .7rem; }
.alias-form .field { flex: 1 1 14rem; margin: 0; min-width: 0; }
.alias-arrow { padding-bottom: .35rem; color: var(--muted); }
.name-columns { columns: 16rem; column-gap: 1.5rem; margin: .5rem 0 0; padding-left: 1.1rem; font-size: .85rem; }
.name-columns li { break-inside: avoid; }

/* Zupčanik: postavke u istom skočnom prozoru kao objašnjenja */
.gear-btn { font-style: normal; }
.gear-btn svg { display: block; }
.settings-pop { width: min(30rem, calc(100vw - 2rem)); }
.pop-form { display: grid; gap: .45rem; }
.pop-form .help { color: var(--muted); font-size: .78rem; margin: -.25rem 0 .3rem 1.6rem; }
.pop-form .help.flush { margin-left: 0; }
.pop-form .options { margin: .1rem 0 .2rem; }
.pop-form .btn { justify-self: start; }
.date-row { display: flex; align-items: center; gap: .4rem; margin-left: 1.6rem; }
.date-row .day-input { width: 4.2rem; }
.date-row select { width: auto; }
.pop-form:has(input[name=stats_estimate_enabled]:not(:checked)) .date-row { opacity: .5; }
.pop-form .check:has(input:disabled) { opacity: .5; }

/* Oznake projekta i spajanje na stranici projekta */
.tags { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-top: .8rem; }
.tags-label { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; margin-right: .2rem; }
.tag { font-size: .8rem; padding: .12rem .35rem .12rem .6rem; color: var(--text); }
.tag-add { display: flex; gap: .35rem; align-items: center; margin: 0; }
.tag-add input { width: 11rem; padding-top: .2rem; padding-bottom: .2rem; }
details.merge { margin-top: .7rem; max-width: 46rem; }
details.merge .field { max-width: 30rem; }
.deadline-date { font-weight: 600; text-decoration: underline dotted; text-underline-offset: 3px; }
.mini-label { display: block; font-size: .7rem; color: var(--muted); margin: .35rem 0 0 .3rem; text-transform: uppercase; letter-spacing: .04em; }
.quick-rok > summary { list-style: none; display: inline-flex; }
.quick-rok > summary::-webkit-details-marker { display: none; }
.rok-form { margin-top: .3rem; display: grid; gap: .25rem; min-width: 170px; }
.path-row { display: flex; gap: .3rem; align-items: center; margin-bottom: .45rem; }
.path-row input { flex: 1; font-family: Consolas, Menlo, monospace; font-size: .8rem; }
.note-add { display: flex; gap: .4rem; align-items: flex-start; margin-bottom: .3rem; }
.note-add textarea { flex: 1; }
.note { border-top: 1px solid var(--border-soft); padding: .4rem 0; }
.note .text { white-space: pre-wrap; }
.msg { padding: .45rem .7rem; border-radius: var(--radius-sm); margin-bottom: .6rem; font-weight: 500; }
.msg.success { background: var(--ok-bg); color: var(--ok); }
.msg.error { background: var(--bad-bg); color: var(--bad); }
.msg.warning { background: var(--warn-bg); color: var(--warn); }
.pager { display: flex; gap: .5rem; align-items: center; justify-content: center; margin-top: .6rem; }
.status-ok { color: var(--ok); font-weight: 600; }
.status-bad { color: var(--bad); font-weight: 600; }
.anchor { scroll-margin-top: 100px; }

/* Prijava */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; background: var(--bg); }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.4rem 1.3rem; width: 100%; max-width: 380px; }
.login-brand { display: flex; align-items: center; gap: .55rem; margin-bottom: 1rem; }
.login-brand img { width: 46px; height: 46px; }
.login-brand .wordmark { font-size: 1.4rem; }

/* Odabir logotipa */

pre.trace { white-space: pre-wrap; background: #0d1117; color: #e6edf3; padding: .6rem; border-radius: var(--radius-sm); font-size: .76rem; max-height: 340px; overflow: auto; }

@media (min-width: 761px) {
  table.resizable { table-layout: fixed; }
}

@media (max-width: 1040px) {
  .topbar { gap: .1rem .6rem; }
  .brand { margin-right: auto; }
  .tabs { order: 3; flex-basis: 100%; padding-bottom: .25rem; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  body { font-size: 15px; }
  .topbar { padding: .25rem .7rem; }
  .account-name, .account .chevron, .col-grip { display: none; }
  .page { padding: .7rem .7rem 2rem; }
  h1 { font-size: 1.2rem; }
  .grid-2, .grid-4, .facts { grid-template-columns: minmax(0, 1fr); }
  table.data.cards thead { display: none; }
  table.data.cards, table.data.cards tbody, table.data.cards tr, table.data.cards td { display: block; width: 100%; }
  table.data.cards tr { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .4rem .6rem; margin-bottom: .5rem; background: var(--surface); }
  table.data.cards td { border: 0; padding: .16rem 0; }
  table.data.cards td[data-label]::before { content: attr(data-label); display: block; font-size: .66rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
  table.data.cards td:empty { display: none; }
  table.log, table.log tbody, table.log tr, table.log td { display: block; width: auto; }
  table.log thead, table.log colgroup { display: none; }
  table.log tr { padding: .35rem .55rem; border-bottom: 1px solid var(--border-soft); }
  table.log td { display: inline; border: 0; padding: 0 .35rem 0 0; white-space: normal; }
  table.log td.change { display: block; padding-top: .05rem; }
  table.log td.project { display: block; color: var(--muted); }
  .btn { min-height: 38px; }
  .btn.small { min-height: 32px; }
  .pill span { min-height: 32px; padding: .28rem .7rem; }
  .st { min-height: 34px; padding: .2rem .7rem; }
}


/* Rezultat gumba "Testiraj" (Ollama, sandučić) uz sam gumb */
.test-result { font-size: .82rem; align-self: center; }
td .test-result:not(:empty) { margin-top: .3rem; }
.save-result:not(:empty) { margin-left: .6rem; }

/* Automatsko preuzimanje: dok je glavna kvačica isključena, ostale postavke su zasivljene */
#preuzimanja:has(input[name=downloads_enabled]:not(:checked)) .dl-depends { opacity: .45; pointer-events: none; }
