/* Check: every colour comes from the tokens below; the rules after them only lay things out and pick a token.
   Colours carry meaning: red = difference, yellow = check by hand, green = approved, blue = an action.
   Wherever the two files stand side by side, Word (approved text) is blue and PDF (what goes to print) is red. */
:root{
  /* neutrals: cool slate, soft enough for a whole working day */
  --bg:#fff;          /* page */
  --surface:#fff;        /* cards, tables, file cards */
  --surface-2:#f5f7f9;   /* table header, quiet fills */
  --tray:#fff;        /* inside a pair and the result box: white file cards sit on it */
  --band:#e2e8f0;        /* filter bar */
  --head:#eef0f3;        /* title strip of a pair: a soft neutral grey */
  --head-line:#eceef2;   /* its edges */
  --line:#f0f3f6;        /* lines inside a box */
  --line-2:#e8ebf0;      /* edges of cards and buttons */
  --line-3:#e8ecf2;      /* edges on hover */
  --ink:#1c2838;         /* text */
  --ink-2:#3b4a5c;       /* secondary text, icons on buttons */
  --muted:#5a6879;       /* hints (still 4.5:1 on every surface) */
  --faint:#8794a6;       /* handles and decorative icons only, never text */
  /* actions */
  --accent:#2b6cd8;--accent-hover:#2259c0;--accent-ink:#1d4ea0;--accent-soft:#eaf1fa;--accent-line:#e9eff6;
  --focus:#2563d8;
  /* statuses: text, background, edge, solid (bars, dots) */
  --bad:#b8232c;--bad-bg:#fdeced;--bad-line:#fceff0;--bad-solid:#d9434a;
  --warn:#7a5000;--warn-bg:#fff3d4;--warn-line:#faf3e0;--warn-solid:#e0a40a;
  --ok:#1a6e41;--ok-bg:#e4f4ea;--ok-line:#ecf6f0;--ok-solid:#2e9a5f;
  /* Word / PDF as rgb triplets, for the tinted columns and the changed words */
  --blue:59,111,196;--red:192,38,45;--blue-ink:23,74,160;--red-ink:170,20,28;
  --shadow-1:0 0 0 0 transparent; /* cards carry no shadow, only a faint border */
  --shadow-2:0 0 0 0 transparent;
  --shadow-btn:0 1px 2px rgba(22,34,51,.12),0 2px 6px rgba(43,108,216,.25);
}

/* ---- base ---- */
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.45 system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif}
body.noscroll{overflow:hidden}
::selection{background:rgba(43,108,216,.22)}
:focus-visible{outline:3px solid var(--focus);outline-offset:2px}
h2{margin:0 0 12px;font-size:1.1rem}
.sr-only,#upload-h,.pairs-titles{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
button{font:inherit;padding:8px 14px;border:1px solid var(--line-2);border-radius:0;background:var(--surface);color:var(--ink);cursor:pointer}
button.primary{background:var(--accent);border-color:var(--accent);color:#fff}
button:disabled{opacity:.5;cursor:not-allowed}
/* upload texts: "drag" on a computer, "tap" on a touch screen */
.when-touch{display:none}
@media (hover:none) and (pointer:coarse){.when-mouse{display:none}.when-touch{display:inline}}

/* ---- header: deep blue, a soft light from the right; the logo and its animation are unchanged ---- */
.top{background:#24426d;background:radial-gradient(900px 260px at 100% 0,rgba(140,185,250,.26),transparent 70%),linear-gradient(100deg,#203a60 0%,#28497a 50%,#33609a 100%);
  color:#fff;margin-bottom:16px;box-shadow:0 1px 0 rgba(10,20,40,.2),0 2px 12px rgba(16,32,58,.12)}
/* viewport-fit=cover lets the header run edge to edge; its content stays clear of the notch */
.top-in{max-width:1560px;margin:0 auto;padding:19px max(16px,env(safe-area-inset-right)) 19px max(16px,env(safe-area-inset-left));min-height:82px;
  display:flex;align-items:center;justify-content:space-between;gap:8px 24px;flex-wrap:wrap}
.brand{display:flex;flex-direction:row;align-items:center;gap:12px;flex-shrink:0}.logo{display:block;flex-shrink:0}
.logo-btn{padding:0;border:0;background:none;cursor:pointer;border-radius:10px;line-height:0}
.logo-btn:focus-visible{outline:3px solid #fff;outline-offset:3px}
.logo-check{stroke-dasharray:24;stroke-dashoffset:0;transition:stroke .9s,opacity .25s}
.logo-lens{opacity:0;transform-origin:16px 16px;transition:opacity .2s}
.logo-btn.searching .logo-check{opacity:0}
.logo-btn.searching .logo-lens{opacity:1}
.logo-btn.searching .logo{animation:lens-search 3s ease-in-out forwards}
.logo-btn.found .logo-check{stroke:#1e7e46;animation:check-draw .7s ease-out,check-flash 1.6s ease-in-out}
.logo-bg{transition:fill .3s}
.logo-btn.found .logo-bg{animation:bg-flash 1.6s ease-in-out}
@keyframes bg-flash{0%,100%{fill:#fff}30%,55%{fill:#1e7e46}}
@keyframes check-flash{0%,100%{stroke:#1e7e46}30%,55%{stroke:#fff}}
/* three swings; the last one ends on the right, exactly where "ed" will push the icon (--edw = width of "ed") */
@keyframes lens-search{
  0%{transform:translateX(0)}
  10%{transform:translateX(-10px)}
  27%{transform:translateX(var(--edw,36px))}
  44%{transform:translateX(-10px)}
  61%{transform:translateX(var(--edw,36px))}
  78%{transform:translateX(-10px)}
  100%{transform:translateX(var(--edw,36px))}}
@keyframes check-draw{from{stroke-dashoffset:24}to{stroke-dashoffset:0}}
@media (prefers-reduced-motion:reduce){.logo-btn.searching .logo{animation:none}.logo-btn.found .logo-check,.logo-btn.found .logo-bg{animation:none}}
.top h1{margin:0;font-size:2.1rem;line-height:1;letter-spacing:.01em;white-space:nowrap;transition:color .6s}
.top h1.checked{color:#9ff0b9;transition:color .4s}
/* "ed" of Checked: on return the colour fades first, then "ed" fades, then it collapses and the icon slides back */
.top h1 .ed{display:inline-block;vertical-align:top;overflow:hidden;max-width:0;opacity:0;transition:opacity .3s .5s,max-width .3s .8s ease-in-out}
.top h1.checked .ed{max-width:var(--edw,1.6em);opacity:1;transition:max-width 0s,opacity .4s}

/* ---- page ---- */
main{max-width:1560px;margin:0 auto;padding:0 max(16px,env(safe-area-inset-right)) max(40px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));
  display:grid;grid-template-columns:minmax(0,1fr);gap:16px}
.card{background:var(--surface);border:1px solid var(--line-2);border-radius:0;padding:16px;box-shadow:var(--shadow-1)}
/* the results sit straight on the page, apart from the pairs above them */
#results-card{margin-top:57px}
#results-card.card{background:transparent;border:none;box-shadow:none;padding:0}
@media (max-width:600px){
  .top{margin-bottom:12px}
  .top-in{min-height:0;padding-top:14px;padding-bottom:14px}
  .top h1{font-size:1.75rem}
  main{padding-left:max(12px,env(safe-area-inset-left));padding-right:max(12px,env(safe-area-inset-right));gap:12px}
  .card{padding:14px 12px}
}

/* ---- upload: automatic zone on the left (tinted), plain adding on the right; the divider and the corner grip resize them ---- */
.drops{position:relative;display:flex;align-items:stretch;gap:0;--auto:33%}
.drop{display:flex;flex-direction:column;gap:6px;align-items:center;justify-content:center;padding:36px 12px;font-size:1.15rem;text-align:center;
  border:2px dashed var(--line-2);border-radius:0;cursor:pointer;color:var(--muted);transition:border-color .15s,background-color .15s}
.drop strong{color:var(--ink);font-size:1.45rem}
.drop-sep{margin-top:12px}
.drop-types{color:var(--ink);font-weight:600}
.drop:hover{border-color:var(--accent-line)}
.drop.over{border-color:var(--accent);background:var(--accent-soft)}
.drop-auto{flex:0 0 var(--auto);border-color:#8fb0dc;background:#f2f6fc}
.drop-auto:hover,.drop-auto.over{border-color:var(--accent);background:#e8f0fa}
.drops #drop{flex:1 1 0}
.drops .drop{min-width:0;height:var(--dh,240px);justify-content:center;gap:calc(6px * var(--s,1));padding:calc(12px * var(--s,1)) 12px;font-size:calc(1.15rem * var(--s,1));overflow:hidden}
.drops .drop strong{font-size:calc(1.45rem * var(--s,1));line-height:1.3}
.drops .drop-sep{margin-top:calc(12px * var(--s,1))}
.drops.all-auto #drop,.drops.all-manual .drop-auto{display:none}
.drops.moving{user-select:none;cursor:col-resize}
.drop-split{flex:none;width:18px;display:grid;place-items:center;cursor:col-resize;touch-action:none;border-radius:0}
.drop-split span{width:4px;height:44px;border-radius:0;background:var(--line-3)}
.drop-grip{position:absolute;right:8px;bottom:6px;width:56px;height:16px;display:grid;place-items:center;cursor:row-resize;touch-action:none;border-radius:0}
.drop-grip span{width:44px;height:4px;border-radius:0;background:var(--line-3)}
.drop-split:hover span,.drop-split.moving span,.drop-split:focus-visible span,
.drop-grip:hover span,.drop-grip.moving span,.drop-grip:focus-visible span{background:var(--accent)}
.drop-split:focus-visible,.drop-grip:focus-visible{outline:2px solid var(--focus);outline-offset:1px}
.messages{list-style:none;margin:8px 0 0;padding:0}
.messages li{padding:6px 10px;margin-top:6px;border-radius:0;background:var(--warn-bg);color:var(--warn)}
/* phone: the zones stack, both always shown, natural height and full-size letters */
@media (max-width:760px){
  .drops{flex-direction:column;gap:12px}
  .drops .drop{height:auto;padding-top:28px;padding-bottom:28px;font-size:1.15rem;gap:6px}
  .drops .drop strong{font-size:1.25rem}
  .drops .drop-sep{margin-top:12px}
  /* both zones take the height of their text (the right one used to collapse to a sliver) */
  .drop-auto,.drops #drop{flex:none}
  .drop-split,.drop-grip{display:none}
  .drops.all-auto #drop,.drops.all-manual .drop-auto{display:flex}
}

/* ---- pairs: list header, then one card per pair (title strip + two file cards with ⇄ between) ---- */
.pairs-head{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-bottom:26px}
.pairs-titles{display:flex;align-items:baseline;gap:12px;flex-wrap:wrap;min-width:0;padding-left:2px}
.pairs-titles h2{margin:0;font-size:1.05rem}
.pairs-sum{color:var(--muted);font-size:.92rem}
/* "Uporedi sve" spans the "Uporedi" + freeze columns of the pairs below it and its X stands over their X */
.pairs-actions{display:flex;align-items:center;gap:8px;margin-left:auto;margin-right:12px}
#progress{color:var(--muted);font-size:.9rem}
#progress:empty{display:none}
#compare-btn{width:192px;height:36px;padding:0;border-radius:0;font-weight:600;box-shadow:var(--shadow-btn);transition:background-color .12s,border-color .12s}
#compare-btn:hover:not(:disabled){background:var(--accent-hover);border-color:var(--accent-hover)}
/* X buttons that clear everything (pairs, results): outlined, red on hover */
.clear-all{display:grid;place-items:center;flex:none;width:32px;height:32px;padding:0;border:1px solid var(--line-2);border-radius:0;background:var(--surface);color:var(--ink-2);
  box-shadow:var(--shadow-1);transition:color .12s,background .12s,border-color .12s}
.clear-all:hover:not(:disabled){color:var(--bad);background:var(--bad-bg);border-color:var(--bad-line)}
.pairs-actions .clear-all{width:36px;height:36px}
.pairs-list{display:flex;flex-direction:column;gap:18px}
/* no frame around a pair: the blue title strip and the file cards (as wide as the strip) are the whole card */
.pair{position:relative;border:0;border-radius:0;background:var(--surface);transition:box-shadow .15s}
.pair-head{display:flex;align-items:center;gap:12px;padding:10px 12px 10px 14px;border-bottom:1px solid var(--head-line);border-radius:0;background:var(--head)}
.pair-title{flex:1;display:flex;align-items:center;gap:10px;min-width:0;font-weight:700;font-size:1.02rem;color:var(--ink)}
.pair-n{display:grid;place-items:center;flex:none;width:26px;height:26px;border-radius:50%;background:var(--surface);color:var(--accent-ink);font-size:.82rem;box-shadow:0 0 0 1px var(--head-line)}
.pair-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.pair-chip{flex:none;padding:2px 10px;border-radius:0;background:var(--surface-2);color:var(--muted);font-size:.8rem;font-weight:600;box-shadow:0 0 0 1px var(--line)}
.pair-acts{display:flex;align-items:center;gap:8px;flex:none}
/* per-pair "Uporedi": outlined, so it does not compete with the filled "Uporedi sve" above it */
.pair-head .pair-compare{width:148px;height:36px;padding:0;border-radius:0;font-weight:600;background:var(--surface);color:var(--accent-ink);border:1.5px solid var(--accent);box-shadow:none;
  transition:background-color .12s,color .12s}
.pair-head .pair-compare:hover:not(:disabled){background:var(--accent-soft);color:#21426f}
.pair-head .pair-compare:disabled{background:#f1f4f8;border-color:var(--line-2);color:var(--faint)}
/* freeze and remove in the corner of the pair */
.pair .pair-head .x{position:static;z-index:1;display:grid;place-items:center;width:36px;height:36px;padding:0;border:1px solid var(--line-2);border-radius:0;
  background:var(--surface);color:var(--ink-2);box-shadow:var(--shadow-1);transition:color .12s,background .12s,border-color .12s}
.pair .x svg{width:16px;height:16px;stroke-width:2.8}
.pair .x:hover{color:var(--bad);background:var(--bad-bg);border-color:var(--bad-line)}
.pair .x.freeze svg{width:17px;height:17px}
.pair .x.freeze:hover,.pair .x.freeze[aria-pressed=true]{color:var(--accent-ink);background:var(--accent-soft);border-color:var(--accent-line)}
/* skipped pair ("Preskoči"): dimmed, its button says why */
.pair.frozen{background:#f4f6f9}
.pair.frozen .pair-head{background:#f3f4f6;border-bottom-color:var(--line-2)}
.pair.frozen .pair-grid{opacity:.45;filter:grayscale(.6)}
.pair-head .pair-compare.skip:disabled{opacity:1;cursor:default;background:var(--surface-2);border-color:var(--line-3);color:var(--ink-2)}
.pair-grid{display:grid;grid-template-columns:minmax(0,1fr) 40px minmax(0,1fr);position:relative;padding:12px 0}
.pair-vs{display:grid;place-items:center;color:var(--faint)}
.pair-vs svg{width:20px;height:20px}
/* file card: info on the left (name and details start under the "W"/"P" of the type tag), buttons in a 2 x 2 block
   on the right behind a thin line; on a narrow card the block moves under the info, still on the right */
.pside{padding:0;min-width:0}
.pside[draggable=true]{cursor:grab}
.pside.dragging{opacity:.45}
.pside:not(.pside-empty){display:flex;flex-wrap:wrap;align-items:center;gap:12px 16px;padding:12px 14px 14px;background:var(--surface);border:1px solid var(--line-2);border-radius:0;
  box-shadow:var(--shadow-2);transition:border-color .12s,box-shadow .12s}
.pside:not(.pside-empty):hover{border-color:var(--line-3)}
.pside.drop-target,.pside.drop-target:not(.pside-empty){background:var(--accent-soft);outline:2px dashed var(--accent);outline-offset:-4px}
.pside.copied{outline:2px dashed var(--accent);outline-offset:2px}
.tags{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.tag{display:inline-block;padding:3px 14px;border-radius:0;font-weight:700;font-size:.9rem;letter-spacing:.03em}
.tag.word{background:#e3eefc;color:#3d639a;box-shadow:inset 0 0 0 1px rgba(61,99,154,.05)}
.tag.pdf{background:#fde8e9;color:#c0262d;box-shadow:inset 0 0 0 1px rgba(192,38,45,.05)}
.tag.sm{padding:4px 0;font-size:.85rem;width:5.2em;text-align:center;flex:none}
/* zaključan PDF (no text layer): yellow */
.tag.lock{display:inline-flex;align-items:center;gap:6px;background:var(--warn-bg);color:var(--warn);box-shadow:inset 0 0 0 1px rgba(122,80,0,.05)}
.tag.lock.sm{width:auto;padding:2px 8px}
.tag.lock.blink{animation:lockblink .55s ease-in-out 6}
@keyframes lockblink{0%,100%{background:var(--warn-bg);box-shadow:0 0 0 0 rgba(224,164,10,0)}50%{background:#ffd84d;box-shadow:0 0 0 4px rgba(224,164,10,.45)}}
@media (prefers-reduced-motion:reduce){.tag.lock.blink{animation:none;box-shadow:0 0 0 3px rgba(224,164,10,.55)}}
.lock-msg{font-size:.85rem;color:var(--warn)}
.pinfo{flex:1 1 230px;min-width:0}
.fname-b{font-weight:600;line-height:1.35;white-space:normal;overflow:hidden;text-overflow:ellipsis;overflow-wrap:anywhere;color:var(--ink)}
.pside:not(.pside-empty) .fname-b{margin:12px 0 8px;padding-left:14px}
.pinfo .meta,.pinfo .lock-msg{padding-left:14px}
.pside .lock-msg{margin:8px 0 0}
.meta{display:flex;gap:10px;align-items:baseline;margin-top:6px;font-size:.88rem;color:var(--ink-2)}
.meta-k{flex:0 0 3.2rem;color:var(--muted);font-size:.75rem;text-transform:uppercase;letter-spacing:.05em}
.meta-v{min-width:0;overflow-wrap:anywhere}
.meta-v.mono{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;letter-spacing:.03em}
.meta.bad{color:var(--bad)}
/* EAN is the same in both files of the pair */
.ean-ok{display:inline-block;margin-left:-5px;color:var(--ok);font-size:.95rem;font-weight:700;line-height:1;vertical-align:baseline}
.pacts{display:grid;grid-template-columns:repeat(2,minmax(98px,1fr));gap:6px;flex:none;flex-wrap:wrap;justify-content:flex-end;margin-left:auto;padding-left:16px;border-left:1px solid var(--line)}
.pbtn{display:inline-flex;align-items:center;gap:6px;height:34px;padding:0 11px;border-radius:4px;border-color:#cdd5df;color:var(--ink-2);font-size:.88rem;font-weight:600;
  transition:color .12s,background-color .12s,border-color .12s}
.pbtn svg{width:16px;height:16px}
.pbtn:hover{color:var(--accent-ink);background:var(--accent-soft);border-color:var(--accent-line)}
.pacts .pbtn{width:100%;justify-content:flex-start}
.pbtn.copy.on{background:var(--accent-soft);border-color:var(--accent);color:var(--accent-ink)}
/* "Ukloni": empties only this field */
.pbtn.drop-file{width:100%;padding:0 11px;justify-content:flex-start}
.pbtn.drop-file svg{width:14px;height:14px}
.pbtn.drop-file:hover{color:var(--bad);background:var(--bad-bg);border-color:var(--bad-line)}
/* empty field: the whole field is the add button (click, or drop a file on it) */
.pside-empty{display:flex;flex-direction:column;gap:8px}
.pside-empty .add{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;height:auto;min-height:110px;padding:12px 16px;text-align:center;
  border:2px dashed var(--line-2);border-radius:0;background:#f9fbfd;color:var(--muted);transition:border-color .15s,background-color .15s}
.pside-empty .add:hover,.pside-empty.drop-target .add{border-color:var(--accent);background:var(--accent-soft)}
.add-h{font-weight:600;color:var(--ink)}
.add-d{color:var(--accent-ink);font-size:.9rem;margin-bottom:4px}
.add-n{max-width:44ch;font-size:.85rem}
/* empty field while a document of its column is copied: the whole field pastes */
.pside-empty.paste-mode .add{border-color:var(--accent);border-style:dashed;background:#eef4fb;animation:pastehint 1.2s ease-in-out 2}
.pside-empty.paste-mode .add:hover{background:#e3edf9}
.pside-empty.paste-mode .add-h{display:inline-flex;align-items:center;gap:8px;color:var(--accent-ink)}
.pside-empty.paste-mode .add-h svg{width:18px;height:18px}
.pside-empty.paste-mode .add-d{color:var(--accent-ink);overflow-wrap:anywhere}
@keyframes pastehint{50%{box-shadow:0 0 0 4px rgba(43,108,216,.25)}}
@media (prefers-reduced-motion:reduce){.pside-empty.paste-mode .add{animation:none}}
/* "+ Novi par" under the list */
.add-pair{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;margin-top:12px;height:48px;border:2px dashed var(--line-2);border-radius:0;background:#f9fbfd;
  color:var(--accent-ink);font-weight:600;transition:border-color .15s,background-color .15s}
.add-pair span{font-size:1.4rem;line-height:1}
.add-pair:hover{border-color:var(--accent);background:var(--accent-soft)}
@media (max-width:760px){
  .pair-grid{grid-template-columns:1fr;gap:0}
  .pair-vs{height:32px;transform:rotate(90deg)}
  .pside-left{border-bottom:1px solid var(--line)}
  .pair-head{flex-wrap:wrap}
  .pair-acts{width:100%}
  .pair-head .pair-compare{flex:1;width:auto}
}

/* ---- result tabs: flat; the open one is white with a blue bar on the line under the row ---- */
/* the light line joins the tab(s) with the "close all" X at the right end */
.tabs-bar{display:flex;align-items:flex-start;gap:12px;margin-bottom:8px;border:1px solid var(--line-2);border-left:0}
.tabs{display:flex;gap:6px;flex-wrap:nowrap;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:thin;scrollbar-color:var(--line-3) transparent;scroll-snap-type:x proximity;flex:1;min-width:0}
.tabitem{position:relative;display:flex;flex:none;scroll-snap-align:start;max-width:min(560px,86vw)}
.tab{padding:12px 18px;border-radius:0;border-color:transparent;border-bottom:none;background:transparent;color:var(--muted);font-weight:600;transition:background .12s,color .12s}
.tabitem .tab{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%;padding-right:46px}
.tabs-bar .tab{margin-bottom:-1px}
.tab:hover{background:rgba(28,40,56,.05);color:var(--ink)}
.tab[aria-selected=true]{background:var(--surface);border-color:var(--line-2);color:var(--accent-ink);box-shadow:inset 0 -2px 0 #8fb1e3}
.badge{display:inline-block;min-width:1.6em;padding:0 6px;margin-left:6px;border-radius:0;background:var(--bad-bg);color:var(--bad);text-align:center;font-size:.85em}
/* the X closes the tab (it sits inside the tab) */
.tab-x{position:absolute;right:10px;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:22px;height:22px;padding:0;border:none;border-radius:0;
  background:transparent;color:var(--faint);transition:background .12s,color .12s}
.tab-x svg{width:12px;height:12px;stroke-width:2.8}
.tab-x:hover{color:var(--bad);background:var(--bad-bg)}
.tab[aria-selected=true]+.tab-x{color:var(--accent-ink)}
/* tabs can be reordered by dragging */
#tabs .tab[draggable=true]{cursor:grab}
#tabs .tab.dragging{opacity:.5}
#tabs .tab.drop-before{box-shadow:inset 3px 0 0 var(--accent)}
#tabs .tab.drop-after{box-shadow:inset -3px 0 0 var(--accent)}
/* "close all results" at the right end of the line (over the X of the cards) */
/* same right edge as the X of the pair strips: 12px strip padding + 16px card padding + 1px card border */
.tabs-bar .clear-all{width:36px;height:36px;margin:4px 28px 0 0}
/* a result tab whose pair is still being compared */
.spin{display:inline-block;width:12px;height:12px;margin-left:8px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;vertical-align:-1px;animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:reduce){.spin{animation-duration:2.4s}}

/* ---- result box: built like a pair card (title strip, then white file cards on the tray, the layouts below them) ---- */
.panel,.section{min-width:0;overflow-x:auto}
.panel .pbox{display:flow-root;padding:0;margin:0 0 56px;background:var(--tray);border:0;border-radius:0;overflow:hidden}
.pbox>:last-child{margin-bottom:0}
.panel-head{display:flex;justify-content:space-between;align-items:center;gap:8px;flex-wrap:wrap}
.panel .pbox .panel-head{margin:0;padding:12px 16px;min-height:64px;background:var(--head);color:var(--ink);border-bottom:1px solid var(--head-line)}
.panel h3{margin:0;font-size:1.19rem;line-height:1.3;color:var(--ink)}
/* export: the main action of a result */
.export-wrap{display:flex;align-items:center;gap:8px;margin-right:0}
.export-wrap .export-btn{min-width:148px;height:40px;padding:0 16px;border-radius:0;font-weight:600;background:var(--accent);border-color:var(--accent);color:#fff;box-shadow:var(--shadow-btn);
  transition:background .12s}
.export-wrap .export-btn:hover:not(:disabled){background:var(--accent-hover);border-color:var(--accent-hover)}
/* clear the selection: a small X next to the export button */
.sel-clear{display:grid;place-items:center;width:36px;height:36px;padding:0;border-radius:0;color:var(--ink-2);border-color:var(--line-2);background:var(--surface);
  transition:color .12s,background .12s,border-color .12s}
.sel-clear:hover{color:var(--bad);border-color:var(--bad-line);background:var(--bad-bg)}
/* file cards: name on the left, lock info and layout buttons on the right */
.panel .pbox .pfiles{display:flex;flex-direction:column;gap:10px;margin:0;padding:14px 0;color:var(--ink-2);font-size:1.2rem}
.pfile{display:flex;flex-wrap:wrap;align-items:center;gap:10px 14px;min-height:62px;min-width:0;margin:0;padding:10px 14px;border:1px solid var(--line-2);border-radius:0;
  background:var(--surface);box-shadow:var(--shadow-2);transition:background .12s,border-color .12s}
.pfile:hover{background:#f8fafd;border-color:var(--line-3)}
/* locked file: a yellow edge on the left; the ZAKLJUČAN tag says the rest */
.pfile:has(.is-locked){box-shadow:inset 4px 0 0 var(--warn-solid),var(--shadow-2)}
.pfile-main{display:contents}
.pfile-id{display:flex;align-items:center;gap:10px;flex:1 1 280px;min-width:0;padding:0}
.pfile .pname{flex:0 1 auto;min-width:0;overflow-wrap:anywhere}
.pfile>.tag.lock{order:2;flex:none;width:auto;margin:0;padding:3px 12px;justify-content:center}
.lock-slot{display:none}
.pfile-btns{display:flex;align-items:center;gap:8px;flex:none;order:3;margin-left:0;padding-left:14px;border-left:1px solid var(--line);align-self:center}
.pfile-btns.empty{display:none}
/* layout buttons: "Otvori rasklop" a blue word; show/hide neutral (blue while the layout is hidden) */
.sheet-open{min-width:148px;height:40px;padding:0 18px;border-radius:0;font-weight:600;margin-right:7px}
.pfile .sheet-open{width:184px;min-width:0;margin-right:0;white-space:nowrap;background:var(--surface);border-color:var(--line-2);transition:background-color .12s,border-color .12s,color .12s}
.pfile .sheet-full{color:var(--accent-ink)}
.pfile .sheet-full:hover{background:var(--accent-soft);border-color:var(--accent-line)}
.pfile .sheet-toggle{color:var(--ink-2)}
.pfile .sheet-toggle:hover{background:var(--surface-2);border-color:var(--line-3);color:var(--ink)}
.pfile .sheet-toggle[aria-expanded=false]{border-color:var(--accent-line);color:var(--accent-ink)}
.pfile .sheet-toggle[aria-expanded=false]:hover{background:var(--accent-soft)}
/* small "i" next to ZAKLJUČAN; its note opens as a line inside the card */
.info-i{order:2;display:grid;place-items:center;flex:none;width:24px;height:24px;margin-left:-8px;padding:0;border:1px solid var(--warn-line);border-radius:50%;background:var(--surface);
  color:var(--warn);font:700 .8rem/1 Georgia,"Times New Roman",serif;font-style:italic;cursor:pointer;transition:background-color .12s,border-color .12s,color .12s}
.info-i:hover,.info-i[aria-expanded=true]{background:var(--warn);border-color:var(--warn);color:#fff}
.info-pop{order:4;flex-basis:100%;margin:2px 0 0;padding:8px 12px;border-radius:0;background:var(--warn-bg);color:var(--warn);font-size:.95rem;line-height:1.45}
.info-pop[hidden]{display:none}
/* warnings: inside the result box, each with its own X */
.warn{position:relative;text-wrap:pretty;white-space:pre-line;width:fit-content;max-width:100%;padding:10px 50px 10px 14px;border-radius:0;background:var(--warn-bg);color:var(--warn);
  margin-bottom:8px;line-height:1.45;box-shadow:inset 0 0 0 1px rgba(224,164,10,.28)}
.panel .pbox .warn{margin:0 0 14px;width:auto}
.warn-x{position:absolute;top:8px;right:8px;display:grid;place-items:center;width:28px;height:28px;padding:0;border:1px solid rgba(122,80,0,.28);border-radius:0;
  background:rgba(255,255,255,.6);color:var(--warn);box-shadow:none;transition:background .12s}
.warn-x:hover{background:#fff}
.warn-x svg{width:16px;height:16px}
/* layout sheets, side by side under the file cards */
.panel .sheet-sec{border-top:none;padding-top:0}
.panel .pbox .sheet-sec{padding:0 0 14px;border:none}
.sheet-sec:has(> .sheets[hidden]){display:none}
.sheets{display:grid;grid-template-columns:repeat(var(--cols,1),minmax(0,1fr));gap:12px;align-items:start}
.panel .pbox .sheets{margin:0}
.sheets[hidden],.sheet-col[hidden]{display:none}
.sheet-col{min-width:0}
.sheet-cap{margin:0 0 6px;font-size:.78rem;font-weight:700;letter-spacing:.05em;text-transform:uppercase;color:var(--ink-2)}
.sheet{position:relative;width:100%;border:1px solid var(--line-2);border-radius:0;overflow:hidden;background:#fff;user-select:none}
.sheet img{display:block;width:100%;height:100%}
.sheet-inline{overflow:auto;border-radius:0;scrollbar-color:var(--line-3) transparent}
.sheet-inline[hidden]{display:none}
.sheet-inline .sheet{cursor:zoom-in}
.sheet-inline.zoomed{max-height:75vh;border:1px solid var(--line-2);touch-action:pan-x pan-y}
.sheet-inline.zoomed .sheet{width:calc(var(--z,3) * 100%);cursor:grab;border:none;border-radius:0}
.sheet-inline.grabbing,.sheet-inline.grabbing .sheet{cursor:grabbing}
/* marks on the layout: thin, in the colour the user picks */
.mk{position:absolute;box-sizing:content-box;padding:2px;margin:calc(-2px - var(--mk-w)) 0 0 calc(-2px - var(--mk-w));
  border:var(--mk-w) solid var(--mk);box-shadow:0 0 0 1px rgba(0,0,0,.45),inset 0 0 0 1px rgba(0,0,0,.25);border-radius:0}
.mk-n{position:absolute;left:calc(-1 * var(--mk-w));bottom:calc(100% + var(--mk-w) + 2px);padding:1px 4px;border-radius:0;
  background:var(--mk);color:var(--mk-ink);font:700 11px/1.2 system-ui,-apple-system,"Segoe UI",sans-serif;box-shadow:0 0 0 1px rgba(0,0,0,.45);white-space:nowrap}
.mk.flash{animation:mkflash 1.6s ease-out}
@keyframes mkflash{0%,40%{box-shadow:0 0 0 1px rgba(0,0,0,.45),0 0 0 6px var(--mk)}100%{box-shadow:0 0 0 1px rgba(0,0,0,.45),0 0 0 0 var(--mk)}}
.overview{max-width:100%;height:auto;border:1px solid var(--line-2);border-radius:0;cursor:zoom-in}
.result-head .export-wrap{flex:none;margin-left:2px}
.result-head .export-wrap .export-btn{width:auto;min-width:184px;height:60px;padding:0 22px;font-size:1.2rem;white-space:nowrap}
.result-head .sel-clear{order:-1;width:44px;height:44px}
@media (max-width:760px){
  .panel .pbox .panel-head{padding:10px 12px}
  .panel .pbox .pfiles{padding:10px 0}
  .panel .pbox .warn{margin:0 0 10px}
  .pfile-btns{width:100%;padding-left:0;border-left:none}
  .pfile-id{flex-basis:100%}
  .pfile .sheet-open{flex:1;min-width:0;padding:0 8px}
  .sheets{grid-template-columns:1fr}
}
@media (max-width:600px){
  .panel h3{font-size:1.06rem}
  .export-wrap .export-btn{flex:1;height:44px}
  .panel .pbox .pfiles{font-size:.95rem}
}

/* ---- filters: status tiles (count in the status colour), section tiles and the PDF button, in one strip of equal cells.
   A grid, so every tile is the same width and nothing can run off the screen; the strip adapts to its own width
   (container queries): a laptop at 125-150 %, a tablet, a phone ---- */
.result-head{margin:0 0 8px;padding:16px 10px 12px;border:1px solid var(--line-2);border-bottom:0;border-radius:0;background:var(--surface-2);container:filters / inline-size}
.result-head .ftabs{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));align-items:stretch;gap:10px;width:100%;padding:0;border-radius:0;background:none;overflow:visible}
.result-head .fgroup{display:contents}
.result-head .ftab.fstat{display:flex;min-width:0;align-items:center;justify-content:space-between;gap:10px;height:60px;padding:0 12px 0 20px;
  border:1px solid var(--line-2);border-radius:0;background:var(--surface);color:var(--ink);font-size:1.2rem;font-weight:700;box-shadow:var(--shadow-1);
  transition:border-color .12s,box-shadow .12s,background .12s}
.result-head .ftab.fstat .flabel{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left}
.result-head .ftab.fstat.zero{color:var(--muted)}
.result-head .ftab.fstat:hover{border-color:var(--line-3)}
/* the open filter: a grey frame, the same for every filter */
.result-head .ftab.fstat[aria-selected=true]{border-color:#9aa6b4;background:#f5f9fe;color:var(--accent-ink);box-shadow:0 0 0 2px #9aa6b4}
.fstat .fnum{display:grid;place-items:center;flex:none;min-width:38px;height:34px;padding:0 10px;border-radius:0;font-size:1.15rem;font-weight:800;font-variant-numeric:tabular-nums}
.result-head .fstat .fnum{background:#e6edf6;color:var(--ink)}
.result-head .fstat.ftab-diff .fnum,.result-head .fstat.ftab-diff.zero .fnum{background:#fad9db;color:var(--ink);box-shadow:inset 0 0 0 1px #f3c4c7}
.result-head .fstat.ftab-manual .fnum{background:var(--warn-bg);color:var(--ink)}
.result-head .fstat.ftab-ok .fnum{background:var(--ok-bg);color:var(--ink)}
.result-head .fstat .fnum.fok{background:var(--ok-bg);color:var(--ok)}
.result-head .fstat.zero .fnum{background:#eef1f5;color:var(--ink)}
/* PDF: the last cell, as tall as the tiles; with rows ticked, the small X (clear the selection) stands in front of it */
.result-head .export-wrap{display:flex;align-items:stretch;gap:6px;min-width:0;margin:0 0 0 8px}
.result-head .export-wrap .export-btn{flex:1;min-width:0;width:auto;height:60px;padding:0 10px;font-size:1.2rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.result-head .sel-clear{order:-1;flex:none;width:44px;height:auto;align-self:stretch}
/* too narrow for seven cells in a row: four per row (the section tiles and PDF on the second row);
   a long label wraps onto two lines instead of being cut */
@container filters (max-width:1339px){
  .result-head .ftabs{grid-template-columns:repeat(4,minmax(0,1fr))}
  .result-head .export-wrap{grid-column:span 2;margin-left:0}
  .result-head .ftab.fstat .flabel{white-space:normal;line-height:1.15}
}
@container filters (min-width:680px) and (max-width:779px){
  .result-head .ftab.fstat{height:56px;font-size:1.05rem;padding:0 10px 0 14px}
  .result-head .fstat .fnum{min-width:34px;height:32px;font-size:1.05rem}
  .result-head .export-wrap .export-btn{height:56px;font-size:1.05rem}
}
/* small (a phone): two cells per row, PDF across the whole last row */
@container filters (max-width:679px){
  .result-head .ftabs{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .result-head .export-wrap{grid-column:1/-1}
}
@container filters (max-width:479px){
  .result-head .ftab.fstat{height:56px;font-size:1.05rem;padding:0 8px 0 12px}
  .result-head .fstat .fnum{min-width:32px;height:30px;font-size:1.05rem}
  .result-head .export-wrap .export-btn{height:56px;font-size:1.05rem}
}
@container filters (max-width:399px){
  .result-head .ftab.fstat,.result-head .fstat .fnum{font-size:1rem}
}
@media (max-width:600px){.result-head{margin-bottom:14px}}
/* ---- results: sections and tables (#, Status, left file, right file, where to look) ---- */
.table-wrap{overflow-x:auto}
.section{border-top:0;padding:12px 0}
.section.first{border-top:none;padding-top:4px}
.results .section{padding:20px 0 22px}
.results .section:first-child{border-top:none;padding-top:0}
.section h4{margin:0 0 6px;text-transform:uppercase;letter-spacing:.04em;font-size:1.05rem;color:var(--ink-2)}
.section.first h4{margin-bottom:14px}
.results .section h4{margin:0 0 14px}
.empty{color:var(--muted)}
.panel .results>.empty,.panel .results>p.empty{color:var(--ink-2)}
.error{padding:10px;border-radius:0;background:var(--bad-bg);color:var(--bad)}
table.res{width:100%;border-collapse:separate;border-spacing:0;table-layout:fixed;font-size:.94rem;border:1px solid var(--line-2);border-top:0;border-radius:0;overflow:hidden;
  background:var(--surface);box-shadow:var(--shadow-1)}
.res th,.res td{text-align:left;vertical-align:top;padding:16px 18px;border-bottom:1px solid var(--line)}
.res tbody tr:last-child td{border-bottom:none}
.res th{font-size:.78rem;font-weight:700;letter-spacing:.05em;text-transform:uppercase;color:var(--muted);background:var(--surface-2)}
/* column titles: centred, bigger */
.res thead th{text-align:center;vertical-align:middle;padding-top:18px;padding-bottom:18px;font-size:1.1rem;font-weight:800;letter-spacing:.06em}
.res th.num,.res td.num{width:56px;padding-right:0}
.res th.st{width:25%}.res th.look{width:25%}
.th-sub{display:block;margin-top:2px;font-size:.98rem;font-weight:500;letter-spacing:0;text-transform:none;color:var(--muted)}
.panel table.res tbody tr{cursor:pointer}
/* the row's status: a bar on its left edge */
.res td.num{box-shadow:inset 4px 0 0 transparent}
.res tr.diff td.num{box-shadow:inset 4px 0 0 var(--bad-solid)}
.res tr.manual td.num{box-shadow:inset 4px 0 0 var(--warn-solid)}
.res tr.ok td.num{box-shadow:inset 4px 0 0 var(--ok-solid)}
/* column tints: left = approved (blue), right = checked (red); in same-format pairs the base column is lighter */
.res{--ca:var(--blue);--cb:var(--red);--ca-ink:var(--blue-ink);--cb-ink:var(--red-ink);--ta:.10;--tb:.085}
.mode-word_word .res{--cb:var(--blue);--cb-ink:var(--blue-ink);--ta:.05;--tb:.11}
.mode-pdf_pdf .res{--ca:var(--red);--ca-ink:var(--red-ink);--ta:.04;--tb:.09}
.res td.w{background:rgba(var(--ca),calc(var(--ta) * .45))}
.res td.p{background:rgba(var(--cb),calc(var(--tb) * .45))}
/* the Word and PDF titles look like the Status and "Gde da se pogleda" titles: no colour */
.res th.w,.res th.p{background:var(--surface-2);color:var(--muted)}
.res td.w,.res td.p{white-space:pre-wrap;overflow-wrap:anywhere}
/* rows ticked for the export */
.res tr.picked td{background:#edf3fb}
.txt{line-height:1.65;color:var(--ink)}
.none{color:var(--muted);font-style:italic}
/* changed words: bold in the column colour on a light marker, they pulse when their row comes into view */
.hl{font-weight:700;padding:0 2px;border-radius:0;background:rgba(var(--hc),.16);box-decoration-break:clone;-webkit-box-decoration-break:clone}
.w .hl{--hc:var(--ca);color:rgb(var(--ca-ink))}
.p .hl{--hc:var(--cb);color:rgb(var(--cb-ink))}
.hl.pulse{animation:hlflash 1.3s ease-out 2}
@keyframes hlflash{0%{box-shadow:0 0 0 3px rgba(var(--hc),.4)}100%{box-shadow:0 0 0 3px rgba(var(--hc),0)}}
@media (prefers-reduced-motion:reduce){.hl.pulse{animation:none}}
/* under a finding in the PDF column: the whole text block as the app read it */
.full-read{margin-top:14px;padding-top:10px;border-top:1px solid var(--line)}
.full-title{text-align:center;font-size:.72rem;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);margin-bottom:6px}
.full-txt{position:relative;white-space:pre-wrap;overflow-wrap:anywhere;font-size:.82rem;line-height:1.5;color:var(--ink);max-height:15em;overflow-y:auto;scrollbar-color:var(--line-3) transparent}
.full-txt .hl{font-weight:700}
/* status column: badge and "Nije greška" on one line, level with the number circle; then kind, what was found, where */
.status{display:inline-block;padding:2px 10px;border-radius:0;font-weight:700;font-size:.78rem;letter-spacing:.02em}
.status.ok{background:var(--ok-bg);color:var(--ok)}
.status.diff{background:var(--bad-bg);color:var(--bad)}
.status.manual{background:var(--warn-bg);color:var(--warn)}
.res td.st .st-top{display:flex;align-items:center;justify-content:flex-start;gap:10px;height:30px;padding:0}
.res td.st .status{display:inline-block;height:30px;line-height:30px;padding:0 14px;margin:0;font-size:.85rem}
.kind{margin-top:8px;font-weight:700;line-height:1.35}
.res td.st .kind{margin-top:12px;line-height:30px;font-size:1rem}
.res tr.ok td.st .kind{color:var(--ok)}
.what{margin:6px 0 0;line-height:1.5;color:var(--ink-2)}
.res td.st .what{margin-top:2px}
.loc{margin:10px 0 0;font-size:.85rem;color:var(--muted);line-height:1.45}
.loc-k{font-weight:700;color:var(--ink)}
/* "Nije greška": the row moves to Provereno */
.confirm-btn{flex:none;height:30px;padding:0 12px;border:1px solid var(--line-2);border-radius:0;background:var(--surface);color:var(--ink);font-size:.85rem;font-weight:600;cursor:pointer;
  transition:background-color .12s,border-color .12s,color .12s}
.confirm-btn:hover{background:var(--ok-bg);border-color:var(--ok-line);color:var(--ok)}
.confirm-btn.undo{background:transparent;color:var(--muted)}
.confirm-btn.undo:hover{background:var(--surface-2);border-color:var(--line-3);color:var(--ink)}
.confirmed{margin:8px 0 0;font-size:.85rem;font-weight:600;color:var(--ok)}
/* number circle (shows the place on the layout) and the export checkbox under it */
.num-in{display:flex;flex-direction:column;align-items:center;gap:12px;width:30px}
.pin{display:inline-grid;place-items:center;width:30px;height:30px;padding:0;border-radius:50%;background:var(--ink-2);color:#fff;font-weight:700;font-size:.9rem}
button.pin{border:none;font:inherit;font-weight:700;cursor:pointer;line-height:inherit;transition:background-color .12s}
button.pin:hover{background:var(--accent)}
.okmark{display:inline-grid;place-items:center;width:30px;height:30px;border-radius:50%;background:var(--ok-bg);color:var(--ok);font-weight:700}
.pick{display:grid;place-items:center;width:30px;height:30px;border-radius:0;cursor:pointer}
.pick:hover{background:#e9eef5}
.pick input{width:18px;height:18px;margin:0;accent-color:var(--accent);cursor:pointer}
/* where to look: the crops, clear space between them */
.look-imgs{display:grid;gap:10px}
.look-none{display:block;text-align:center;line-height:30px;color:var(--muted);font-size:1rem;font-style:italic}
.crop{display:block;max-width:100%;border:1px solid var(--line-2);border-radius:0;box-shadow:var(--shadow-1);cursor:zoom-in}
.res td .crop+.crop{margin-top:10px}
.res td.w .crop{margin-top:12px}
.wimg{max-width:90px;max-height:90px;display:block;background:#fff;border:1px solid var(--line-2);padding:4px}
/* short notes ("Cela stranica je ista.") and the bar-code rows are centred in their cells */
.res td.w .txt:has(.none),.res td.p .txt:has(.none){text-align:center}
.res tr.centered td.w,.res tr.centered td.p{text-align:center}
.res tr.centered td .crop,.res tr.centered .wimg{margin-left:auto;margin-right:auto}
/* checked and correct: gathered at the end of "Pronađeno" and on the "Provereno" tab */
.okicon{display:grid;place-items:center;width:24px;height:24px;border-radius:50%;background:var(--ok-solid);color:#fff;font-size:.8rem;flex:none}
.ok-all .ok-title{display:flex;align-items:center;gap:10px;padding:12px 16px;border:1px solid var(--ok-line);border-radius:0;background:var(--ok-bg);color:var(--ok);
  text-transform:none;letter-spacing:0;font-size:1rem}
.ok-sub{margin:18px 0 8px;font-size:.85rem;text-transform:uppercase;letter-spacing:.04em;color:var(--ink-2)}
.ok-n{margin-left:6px;color:var(--muted);font-weight:500;text-transform:none;letter-spacing:0}
/* "nothing found": a green box, in capitals, starting where the filter tiles start */
.none-found{display:inline-flex;align-items:center;gap:10px;margin:16px 0 18px 11px;padding:12px 18px;border:1px solid var(--ok-line);border-radius:0;background:var(--ok-bg);color:var(--ok);
  font-weight:700;font-size:.92rem;letter-spacing:.06em;text-transform:uppercase}
.results>.none-found{display:flex;width:fit-content}
.panel .results>p.none-found{color:var(--ok)}
/* nothing found: the filter strip is closed at the bottom, the notice stands apart and starts under the first tile */
.panel:has(.results>.none-found) .result-head{border-bottom:1px solid var(--line-2)}
/* wide screens: every cell starts on the same top line; the table header sticks to the top until its table ends */
@media (min-width:981px){
  .panel,.section,.table-wrap{overflow:visible}
  table.res{overflow:visible}
  .res td.st .status{width:fit-content}
  .res td.w .txt,.res td.p .txt{padding-top:0;line-height:30px}
  .res thead th{position:sticky;top:0;z-index:3}
  /* white gaps between the columns */
  .res th.w,.res th.p,.res th.look,.res td.w,.res td.p,.res td.look{border-left:5px solid var(--surface)}
  /* a white gap between the column titles and the first row */
  .res tbody tr:first-child td{border-top:8px solid var(--surface)}
  /* ... and between the rows, so every cell is a separate block */
  .res tbody tr:not(:first-child) td{border-top:5px solid var(--surface)}
  .res thead th:first-child{border-top-left-radius:0}
  .res thead th:last-child{border-top-right-radius:0}
}
/* phone and tablet: each row becomes a card, column names shown as labels */
@media (max-width:980px){
  table.res,.res tbody,.res tr,.res td{display:block;width:auto}
  .res thead{display:none}
  table.res{border:none;border-radius:0;overflow:visible;background:none;box-shadow:none}
  .res tr{margin-bottom:14px;border:1px solid var(--line-2);border-radius:0;overflow:hidden;background:var(--surface);box-shadow:var(--shadow-1)}
  .res td{border-bottom:none;border-top:1px solid var(--line)}
  .res td.num{width:auto;padding:12px 16px 0;border-top:none}
  .res td.st{border-top:none}
  .res td.look:empty{display:none}
  .res td.w::before,.res td.p::before,.res td.look::before{content:attr(data-label);display:block;margin-bottom:6px;font-size:.72rem;font-weight:700;letter-spacing:.05em;
    text-transform:uppercase;color:var(--muted);white-space:normal}
  .res td.w::before{color:rgb(var(--ca-ink))}.res td.p::before{color:rgb(var(--cb-ink))}
  .num-in{flex-direction:row;width:auto}
}
/* tablet: the two versions side by side, the crop full width below them */
@media (min-width:561px) and (max-width:980px){
  .res tr{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
  .res td.num,.res td.st,.res td.look{grid-column:1/-1}
  .res td.p{border-left:1px solid var(--line)}
}
@media (max-width:560px){.res td.num{padding:12px 14px 0}}

/* ---- full-screen layout viewer and enlarged crops: dark, the same deep blue as the header ---- */
.viewer{position:fixed;inset:0;z-index:100;display:flex;flex-direction:column;background:#232d3b}
.vbar{display:flex;align-items:flex-start;gap:8px 18px;padding:max(8px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) 8px max(12px,env(safe-area-inset-left));
  background:#17263b;color:#e6edf5}
.vtools{display:flex;flex:1;min-width:0;flex-wrap:wrap;align-items:center;gap:8px 18px}
.vgrp{display:flex;align-items:center;gap:4px;flex-wrap:wrap}
.vlbl{font-size:.75rem;text-transform:uppercase;letter-spacing:.05em;color:#9fb0c3;margin-right:4px}
.vbar button{min-width:34px;height:34px;padding:0 10px;border:1px solid #3c5470;border-radius:0;background:#23364e;color:#e6edf5}
.vbar button:hover{background:#2e4664}
.vzoom{min-width:4.2em;text-align:center;font-variant-numeric:tabular-nums}
.vnum[aria-pressed=true]{background:var(--mk);color:var(--mk-ink);border-color:var(--mk)}
.vbar .vcol{min-width:0;width:28px;height:28px;padding:0;border-radius:50%;background:var(--c);border:2px solid #3c5470}
.vbar .vcol[aria-pressed=true]{box-shadow:0 0 0 2px #17263b,0 0 0 4px #e6edf5}
.vcustom{width:34px;height:30px;padding:0 2px;border:1px solid #3c5470;border-radius:0;background:#23364e;cursor:pointer}
.vbar .vwid{display:grid;place-items:center;width:44px}.vwid i{display:block;width:24px;background:#e6edf5}
.vbar .vwid[aria-pressed=true]{background:var(--accent);border-color:#7d9ccc}
.vbar .vclose{flex:none;margin-left:auto;font-size:1.1rem}
.vstage{flex:1;overflow:auto;cursor:zoom-in;touch-action:pan-x pan-y;overscroll-behavior:contain}
.vstage.grabbing{cursor:grabbing}
.vcanvas{display:flex;box-sizing:border-box;width:max-content;min-width:100%;min-height:100%;padding:16px}
.vcanvas .sheet{flex:none;margin:auto;border:none;border-radius:0;box-shadow:0 4px 24px rgba(0,0,0,.4)}
.vhint{padding:4px 12px max(4px,env(safe-area-inset-bottom));font-size:.78rem;color:#9fb0c3;background:#17263b}
.viewer-gone{max-width:52ch;margin:15vh auto;padding:16px;text-align:center;color:var(--muted)}
@media (max-width:700px){.vhint{display:none}.vbar{gap:6px 10px}}
/* phone viewer (also on its side): the tools are one line that scrolls sideways, the close button stays at the right */
@media (max-width:700px),(max-height:500px),(pointer:coarse) and (max-width:980px){
  .vbar{align-items:center;gap:10px}
  .vtools{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;gap:6px 14px;
    -webkit-mask-image:linear-gradient(90deg,#000 calc(100% - 24px),transparent);mask-image:linear-gradient(90deg,#000 calc(100% - 24px),transparent)}
  .vtools::-webkit-scrollbar{display:none}
  .vgrp{flex:none;flex-wrap:nowrap}
}
/* the viewer hint is about mouse and keyboard */
@media (hover:none) and (pointer:coarse){.vhint{display:none}}
/* enlarged crop: click to zoom in at that point, drag to move, Esc or × to close */
.lb{position:fixed;inset:0;z-index:200;display:flex;flex-direction:column;background:rgba(17,25,37,.97)}
.lb-bar{display:flex;align-items:center;gap:12px;padding:max(8px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) 8px max(12px,env(safe-area-inset-left));color:#c9d5e3}
.lb-hint{font-size:.85rem}
.lb-close{margin-left:auto;width:40px;height:40px;padding:0;border:1px solid #3c5470;border-radius:0;background:#23364e;color:#fff;font-size:1.5rem;line-height:1}
.lb-close:hover{background:#2e4664}
.lb-stage{flex:1;display:flex;overflow:auto;padding:16px 16px max(16px,env(safe-area-inset-bottom));cursor:zoom-in;overscroll-behavior:contain;touch-action:pan-x pan-y}
.lb-stage img{flex:none;margin:auto;max-width:100%;max-height:100%;object-fit:contain;background:#fff;border-radius:0;user-select:none}
.lb-stage.big{cursor:grab}.lb-stage.big img{max-width:none;max-height:none;cursor:zoom-out}
.lb-stage.grabbing,.lb-stage.grabbing img{cursor:grabbing}
@media (max-width:980px){.lb-hint{display:none}}

/* ---- finger-sized controls ---- */
@media (pointer:coarse){
  #compare-btn{width:200px;height:44px}
  .clear-all,.pairs-actions .clear-all,.pair .pair-head .x{width:44px;height:44px}
  .clear-all svg,.pair .x svg{width:20px;height:20px}
  .pair-head .pair-compare{height:44px}
  .pbtn{height:44px;padding:0 14px}
  .tab{min-height:44px}
  .tab-x{right:4px;width:38px;height:38px}
  .tabs-bar .clear-all{width:44px;height:44px;margin-top:2px}
  .info-i{width:36px;height:36px;font-size:1rem}
  .sheet-open,.export-wrap .export-btn{height:44px}
  .pfile{min-height:66px}
  .sel-clear{width:44px;height:44px}
  .pick{flex:none;width:40px;height:40px}
  .pick input{width:22px;height:22px}
  .pin,.okmark{width:36px;height:36px;flex:none}
  .lb-close{width:44px;height:44px}
  .vbar button{min-width:44px;height:44px}
  .vbar .vcol{width:34px;height:34px}
  .vcustom{width:44px;height:40px}
}
@media (pointer:coarse) and (min-width:981px){.num-in{width:40px}}
/* phone: after the finger sizes, so "Uporedi sve" still takes the whole row */
@media (max-width:600px){
  .pairs-actions{width:100%;margin-right:12px}
  #compare-btn{flex:1;width:auto}
  .tabs-bar .clear-all{margin:8px 24px 0 0}
}

/* action buttons: a slightly rounded corner (everything else stays square) */
#compare-btn,.pair-head .pair-compare,.clear-all,.pair .pair-head .x,.pbtn,.sheet-open,.export-wrap .export-btn,.sel-clear,.confirm-btn,.tab-x,.warn-x{border-radius:4px}

/* "Uputstvo": the guide opens in a new tab; stands at the far right of the header */
.guide-btn{display:inline-flex;align-items:center;gap:8px;margin-left:auto;padding:9px 16px;border:1px solid rgba(255,255,255,.5);border-radius:4px;background:rgba(255,255,255,.12);color:#fff;
  font-weight:600;text-decoration:none;transition:background-color .12s,border-color .12s}
.guide-btn:hover{background:rgba(255,255,255,.24);border-color:#fff}
.guide-btn:focus-visible{outline:3px solid #fff;outline-offset:3px}

/* phone: the four file buttons sit below the file details, across the whole card; order: Kopiraj, Otvori, Zameni, Ukloni (last) */
@media (max-width:760px){
  .pside:not(.pside-empty) .pacts{flex:1 1 100%;width:100%;margin-left:0;padding-left:0;border-left:0;grid-template-columns:repeat(2,minmax(0,1fr))}
  .pacts .pbtn.copy{order:1}
  .pacts .pbtn.open{order:2}
  .pacts .pbtn.replace{order:3}
  .pacts .pbtn.drop-file{order:4}
  .pacts .pbtn{justify-content:center}
}
