/* Cjenik.xml – calm, paper-and-shelf-label look. Tokens first. */
:root {
  --bg: #eef2f1;
  --band: #e3e9e7;
  --surface: #ffffff;
  --ink: #15212b;
  --muted: #53616c;
  --line: #c9d3d6;
  --tag: #ffd43b;
  --tag-ink: #1d1a0c;
  --action: #0a5c6b;
  --action-hover: #084a57;
  --action-ink: #ffffff;
  --focus: #0a7ea0;
  --error: #b42318;
  --error-bg: #fdecea;
  --warn: #8a5300;
  --warn-bg: #fff4dc;
  --ok: #1f7a4a;
  --ok-bg: #e5f4ec;
  --info-bg: #e8eff3;
  --code-bg: #f6f8f8;

  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Menlo, Consolas, monospace;

  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-3: clamp(2rem, 1.3rem + 3vw, 3.25rem);

  --radius-s: 4px;
  --radius-m: 8px;
  --gutter: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101619;
    --band: #151d21;
    --surface: #1a2328;
    --ink: #e6ecee;
    --muted: #9aa8b0;
    --line: #2f3d44;
    --tag: #f2c94c;
    --tag-ink: #1d1a0c;
    --action: #5cc3d6;
    --action-hover: #82d3e2;
    --action-ink: #0a1d22;
    --focus: #8fdcf0;
    --error: #ff8a7a;
    --error-bg: #3a1c19;
    --warn: #f2bb5c;
    --warn-bg: #352a14;
    --ok: #6fd39c;
    --ok-bg: #16301f;
    --info-bg: #1c2a31;
    --code-bg: #131b1f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101619;
  --band: #151d21;
  --surface: #1a2328;
  --ink: #e6ecee;
  --muted: #9aa8b0;
  --line: #2f3d44;
  --tag: #f2c94c;
  --tag-ink: #1d1a0c;
  --action: #5cc3d6;
  --action-hover: #82d3e2;
  --action-ink: #0a1d22;
  --focus: #8fdcf0;
  --error: #ff8a7a;
  --error-bg: #3a1c19;
  --warn: #f2bb5c;
  --warn-bg: #352a14;
  --ok: #6fd39c;
  --ok-bg: #16301f;
  --info-bg: #1c2a31;
  --code-bg: #131b1f;
  color-scheme: dark;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.55;
  overflow-wrap: break-word;
}

h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 0.6em; }
h1 { font-size: var(--step-3); font-weight: 750; letter-spacing: -0.02em; max-width: 20ch; }
h2 { font-size: var(--step-2); font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: var(--step-1); font-weight: 650; }
h4 { font-size: var(--step-0); font-weight: 650; }
p { margin: 0 0 1em; max-width: 68ch; }
a { color: var(--action); text-underline-offset: 0.15em; }
a:hover { color: var(--action-hover); }
code, pre { font-family: var(--mono); font-size: 0.92em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter); }
@media (min-width: 720px) { :root { --gutter: 32px; } }

.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }

/* Header */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); }
.header-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; padding-top: 14px; padding-bottom: 14px; }
.wordmark { font-family: var(--mono); font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.wordmark span { background: var(--tag); color: var(--tag-ink); padding: 0 4px; margin-left: 1px; border-radius: var(--radius-s); }
.site-header ul { display: flex; flex-wrap: wrap; gap: 4px 18px; list-style: none; margin: 0; padding: 0; font-size: var(--step--1); }
.site-header nav a { color: var(--muted); text-decoration: none; }
.site-header nav a:hover { color: var(--ink); text-decoration: underline; }

/* Hero */
.hero { padding-top: 48px; padding-bottom: 56px; }
.lede { font-size: 1.125rem; color: var(--muted); max-width: 60ch; }

.anatomy { margin: 36px 0 28px; }
.anatomy figcaption { font-size: var(--step--1); color: var(--muted); margin-bottom: 10px; }
.anatomy-name {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 18px 18px 14px;
}
.anatomy .seg { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.anatomy .seg code {
  font-size: clamp(1.05rem, 0.8rem + 1.4vw, 1.7rem);
  font-weight: 600;
  padding: 2px 6px 4px;
  border-bottom: 3px solid var(--tag);
  white-space: nowrap;
  animation: lift 600ms ease-out both;
}
.anatomy .seg:nth-of-type(2) code { animation-delay: 90ms; }
.anatomy .seg:nth-of-type(3) code { animation-delay: 180ms; }
.anatomy .seg:nth-of-type(4) code { animation-delay: 270ms; }
.anatomy .seg:nth-of-type(5) code { animation-delay: 360ms; }
.anatomy .seg:nth-of-type(6) code { animation-delay: 450ms; }
.anatomy .seg small { font-size: 0.75rem; color: var(--muted); padding: 0 6px; }
.anatomy .sep { font-family: var(--mono); font-size: clamp(1.05rem, 0.8rem + 1.4vw, 1.7rem); color: var(--muted); padding-top: 2px; }
@keyframes lift { from { border-bottom-color: transparent; } to { border-bottom-color: var(--tag); } }
@media (prefers-reduced-motion: reduce) { .anatomy .seg code { animation: none; } }

.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.deadline { margin: 0 0 0 8px; }
.tag {
  display: inline-block;
  background: var(--tag);
  color: var(--tag-ink);
  font-weight: 700;
  padding: 4px 12px 4px 18px;
  border-radius: 2px var(--radius-s) var(--radius-s) 2px;
  clip-path: polygon(10px 0, 100% 0, 100% 100%, 10px 100%, 0 50%);
}

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { border-color: var(--action); color: var(--ink); }
.button.primary { background: var(--action); border-color: var(--action); color: var(--action-ink); }
.button.primary:hover { background: var(--action-hover); border-color: var(--action-hover); color: var(--action-ink); }
.button.quiet { background: transparent; border-color: transparent; color: var(--muted); text-decoration: underline; }
.button.small { min-height: 36px; padding: 4px 12px; font-size: var(--step--1); }
.button-icon { min-height: 36px; min-width: 36px; padding: 4px 10px; font-size: var(--step--1); }

/* Bands */
.band { background: var(--band); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 56px 0; }
section.wrap { padding-top: 56px; padding-bottom: 56px; }

.notice { background: var(--warn-bg); border-left: 4px solid var(--warn); padding: 12px 16px; border-radius: 0 var(--radius-m) var(--radius-m) 0; max-width: 80ch; }
.facts { display: grid; gap: 8px 40px; grid-template-columns: 1fr; margin-top: 28px; }
@media (min-width: 820px) { .facts { grid-template-columns: 1fr 1fr; } }
.facts > div { padding-top: 16px; border-top: 2px solid var(--line); }
.facts h3 { font-size: 1.05rem; }
.format-note { margin-top: 16px; max-width: 80ch; }
.format-note summary { cursor: pointer; font-weight: 600; color: var(--action); }
.format-note p { margin-top: 10px; }
.sources-title { font-size: 1.05rem; margin-top: 28px; }
.sources { padding-left: 1.2em; margin: 0; }
.sources li { margin-bottom: 4px; }

/* Forms */
.privacy { color: var(--muted); }
fieldset { border: 0; padding: 0; margin: 0 0 28px; min-width: 0; }
legend { font-weight: 650; font-size: 1.05rem; padding: 0; margin-bottom: 8px; }
fieldset.inline legend { font-size: var(--step-0); }
label { font-size: var(--step--1); font-weight: 600; }
.kind label, fieldset.inline label { display: flex; align-items: center; gap: 8px; font-size: var(--step-0); font-weight: 400; min-height: 32px; }
.kind { display: flex; flex-wrap: wrap; gap: 4px 24px; }
.kind legend { width: 100%; }
.hint { color: var(--muted); font-size: var(--step--1); }

input[type="text"], input[type="date"], select, textarea {
  width: 100%;
  min-height: 40px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
}
input:disabled, select:disabled { background: var(--band); color: var(--muted); border-style: dashed; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--error); box-shadow: inset 0 0 0 1px var(--error); }
input[type="radio"], input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--action); margin: 0; flex: none; }
textarea { font-family: var(--mono); font-size: 0.85rem; }

.outlet-grid { display: grid; gap: 14px 20px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .outlet-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .outlet-grid { grid-template-columns: 2fr 1.4fr 2fr 1fr 1fr; } }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field .hint { margin: 0; font-size: 0.8rem; }
.msg { margin: 2px 0 0; font-size: 0.8rem; font-weight: 600; }
.msg.error { color: var(--error); }
.msg.warning { color: var(--warn); }

.items-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.items-head h3 { margin: 0; }
.items-actions, .row-buttons { display: flex; flex-wrap: wrap; gap: 10px; }

.import-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 16px; margin: 12px 0 20px; display: grid; gap: 8px; }
.import-panel fieldset { margin: 8px 0; display: flex; flex-wrap: wrap; gap: 4px 20px; }
.import-panel fieldset legend { width: 100%; }

/* Items table */
.table-wrap { margin-top: 12px; }
#items { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); }
#items th { text-align: left; font-size: 0.8rem; font-weight: 650; color: var(--muted); padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: bottom; }
#items td { padding: 8px; vertical-align: top; border-bottom: 1px solid var(--line); }
#items tbody tr:last-child td { border-bottom: 0; }
#items td.num { color: var(--muted); font-family: var(--mono); font-size: 0.85rem; padding-top: 16px; }
#items .anchor-cell { min-width: 150px; }
#items .anchor-cell label { display: flex; gap: 6px; align-items: flex-start; font-weight: 400; font-size: 0.8rem; margin-bottom: 6px; }
#items .anchor-cell label input { margin-top: 2px; }
#items .col-price { min-width: 112px; }
#items .col-text { min-width: 140px; }
#items .col-bool { min-width: 84px; }
#items .col-date { min-width: 150px; }
#items tr.row-sale .anchor-cell input[type="text"] { background: var(--warn-bg); }

/* Wide tables (products) scroll inside their box on mid-size screens. */
@media (min-width: 900px) {
  .table-wrap { overflow-x: auto; border-radius: var(--radius-m); }
}

/* Stacked cards on small screens */
@media (max-width: 899px) {
  #items, #items tbody, #items tr, #items td { display: block; width: 100%; }
  #items { border: 0; background: transparent; }
  #items thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  #items tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 8px 12px 12px; margin-bottom: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
  #items td { border: 0; padding: 6px 0; }
  #items td::before { content: attr(data-label); display: block; font-size: 0.8rem; font-weight: 650; color: var(--muted); margin-bottom: 3px; }
  #items td.wide { grid-column: 1 / -1; }
  #items td.num { grid-column: 1 / 2; padding-top: 4px; }
  #items td.num::before { content: none; }
  #items td.actions { grid-column: 2 / 3; text-align: right; padding-top: 0; }
  #items td.actions::before { content: none; }
  #items .col-price, #items .col-text, #items .col-bool, #items .col-date, #items .anchor-cell { min-width: 0; }
}

.table-foot { margin-top: 8px; }

.export { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 16px; margin-top: 28px; }
.export > legend { float: left; width: 100%; margin-bottom: 12px; }
.export > legend + * { clear: both; }
.export-options { display: grid; gap: 8px 32px; grid-template-columns: 1fr; }
@media (min-width: 820px) { .export-options { grid-template-columns: 1fr 1fr; } }
.export-options fieldset { margin-bottom: 12px; }
.names { border-top: 1px solid var(--line); padding-top: 12px; margin-bottom: 12px; }
.names p { margin-bottom: 6px; font-size: var(--step--1); }
.names code { background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 1px 6px; }

.result:empty { display: none; }
.result { margin-top: 12px; padding: 10px 14px; border-radius: var(--radius-m); background: var(--info-bg); font-size: var(--step--1); }
.result.error { background: var(--error-bg); color: var(--ink); border-left: 4px solid var(--error); }
.result.ok { background: var(--ok-bg); border-left: 4px solid var(--ok); }
.result ul { margin: 6px 0 0; padding-left: 1.2em; }

/* Validator */
.dropzone { border: 2px dashed var(--line); border-radius: var(--radius-m); padding: 20px; background: var(--surface); display: grid; gap: 8px; justify-items: start; }
.dropzone.over { border-color: var(--action); }
.dropzone .hint { margin: 0; }
.report { margin-top: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 16px; }
.report h3 { font-size: 1.1rem; }
.report .verdict.error { color: var(--error); }
.report .verdict.ok { color: var(--ok); }
.checks { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 6px; }
.checks li { display: grid; grid-template-columns: 7.5em minmax(0, 1fr); gap: 10px; align-items: baseline; font-size: var(--step--1); }
.level { font-weight: 700; font-size: 0.78rem; padding: 1px 8px; border-radius: 999px; text-align: center; }
.level.error { background: var(--error-bg); color: var(--error); }
.level.warning { background: var(--warn-bg); color: var(--warn); }
.level.ok { background: var(--ok-bg); color: var(--ok); }
.level.info { background: var(--info-bg); color: var(--muted); }
.row-issues { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
.row-issues th, .row-issues td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.row-issues-wrap { overflow-x: auto; }

/* Guide */
.steps { list-style: none; counter-reset: step; padding: 0; margin: 24px 0 0; display: grid; gap: 28px; }
.steps > li { counter-increment: step; position: relative; padding-left: 52px; }
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -2px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  font-weight: 750;
  background: var(--tag);
  color: var(--tag-ink);
  border-radius: 50%;
}
.steps ul { padding-left: 1.1em; max-width: 72ch; }
.steps ul li { margin-bottom: 6px; }
.code { background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 12px 14px; overflow-x: auto; white-space: pre; margin: 0 0 10px; max-width: 100%; }

.snippet-tool { margin-top: 48px; padding-top: 28px; border-top: 2px solid var(--line); }
.snippet-grid { display: grid; gap: 12px 20px; grid-template-columns: 1fr; margin-bottom: 16px; }
@media (min-width: 720px) { .snippet-grid { grid-template-columns: repeat(4, 1fr); } }
.snippet-out { display: grid; gap: 10px; }
.snippet-preview { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 16px; }
.cjenik-stavka { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; margin: 0; }
.cjenik-naziv { font-weight: 650; }
.cjenik-akcija { background: var(--tag); color: var(--tag-ink); padding: 0 6px; border-radius: var(--radius-s); font-size: 0.85rem; }
.cjenik-cijena { font-size: 1.2rem; font-weight: 700; }
.cjenik-sidrena { color: var(--muted); font-size: 0.9rem; }

/* Help */
.help-box { background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--tag); border-radius: var(--radius-m); padding: 24px; max-width: 760px; }
.help-box .price { font-weight: 700; }

.site-footer { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--muted); font-size: var(--step--1); }

/* 404 */
.notfound { padding-top: 80px; padding-bottom: 80px; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.steps > li, .snippet-out, .snippet-out > * { min-width: 0; }
:not(pre) > code { overflow-wrap: anywhere; }
[hidden] { display: none !important; }
.snippet-out > .button { justify-self: start; }
