/* Review UI prototyp — tmavé foto-forward téma, perníkový akcent.
   Dotykové cíle ≥ 44 px (práce na iPadu), zkratky jen desktop akcelerátor. */

:root {
  --bg: #1c1917;
  --bg2: #292524;
  --bg3: #38322e;
  --line: #44403c;
  --text: #e7e5e4;
  --text-dim: #a8a29e;
  --accent: #d97706;        /* perníková jantarová */
  --accent-soft: #92600a;
  --st-kandidat: #78716c;
  --st-shortlist: #d97706;
  --st-final: #16a34a;
  --st-zamitnuto: #991b1b;
  --radius: 10px;
  --touch: 44px;
  --bulkbar-space: 0px;
  --topbar-h: 60px;   /* skutečnou výšku dopočítá JS (kvůli zalomení lišty) */
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* místo pod pevnou horní lištou (sticky uvnitř flex sloupce na iOS Safari
     nedrží — proto fixed + toto odsazení) */
  padding-top: var(--topbar-h);
}
main { flex: 1; padding: 12px 16px calc(24px + var(--bulkbar-space)); }
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 1.1rem; margin: 0; }
h1 small { color: var(--text-dim); font-weight: 400; }
.muted { color: var(--text-dim); }
.small { font-size: .85rem; }

/* ---------- horní lišta ---------- */
.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 10px 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
}
.brand { font-weight: 700; letter-spacing: .02em; }
.proto {
  background: var(--accent); color: #1c1917;
  font-size: .65rem; font-weight: 800;
  border-radius: 4px; padding: 2px 6px; vertical-align: 2px;
}
.topbar nav { display: flex; gap: 4px; flex: 1; min-width: 0; align-items: center; }
.topbar nav a, .nav-disabled {
  padding: 10px 14px; min-height: var(--touch);
  display: inline-flex; align-items: center;
  border-radius: var(--radius); color: var(--text);
}
.topbar nav a.active { background: var(--bg3); color: var(--accent); font-weight: 600; }
.topbar nav a:hover { background: var(--bg3); }
.nav-disabled { color: #57534e; cursor: not-allowed; }
.topbar nav .nav-last { margin-left: auto; color: var(--text-dim); }
.nav-user { color: var(--text-dim); white-space: nowrap; padding: 8px; }
.nav-logout { margin: 0; }
.nav-logout button {
  min-height: var(--touch); padding: 8px 10px; cursor: pointer;
  color: var(--text-dim); background: transparent; border: 0; font: inherit;
}
.nav-logout button:hover, .nav-user:hover { color: var(--accent); }
/* na detailu patří pravý okraj lišty návratu + názvu souboru; menu drží vlevo */
.topbar nav.has-info .nav-last { margin-left: 0; }
.nav-info {
  margin-left: auto; display: flex; align-items: center; gap: 10px;
  min-width: 0; flex-shrink: 1;
}
/* Zpět: výrazné a široké — hlavní úniková cesta z detailu */
.nav-info .nav-back {
  white-space: nowrap;
  background: var(--accent); border-color: var(--accent);
  color: #1c1917; font-weight: 700;
  min-width: 150px; padding: 8px 28px; justify-content: center;
}
.nav-info .nav-back:hover { background: #f59e0b; border-color: #f59e0b; color: #1c1917; }
.nav-file {
  font-weight: 600; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav-file small { color: var(--text-dim); font-weight: 400; }

/* ---------- patička ---------- */
.footbar {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 8px 16px; border-top: 1px solid var(--line);
  color: var(--text-dim); font-size: .8rem; background: var(--bg2);
}
@media (pointer: coarse) { .kbd-hints { display: none; } }

/* ---------- filtry ---------- */
.filters {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px;
}
.filters-primary, .filters-extra {
  display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end;
}
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: var(--text-dim); }
.filters .f-grow { flex: 1; min-width: 180px; }
.filters select, .filters input[type="search"] {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 0 10px; min-height: var(--touch); font-size: .95rem;
}
.f-chapter select { border-color: var(--accent-soft); }
.checkline {
  min-height: var(--touch); flex-direction: row !important;
  align-items: center; gap: 8px !important; color: var(--text);
}
.checkline input { width: 18px; height: 18px; accent-color: var(--accent); }
.filters-advanced { color: var(--text-dim); }
.filters-advanced summary {
  min-height: 36px; display: inline-flex; align-items: center;
  cursor: pointer; color: var(--text-dim); font-size: .86rem;
}
.filters-extra { padding-top: 6px; border-top: 1px solid var(--line); }

/* ---------- mřížka ---------- */
.grid-meta { display: flex; gap: 16px; align-items: baseline; margin: 4px 2px 10px; color: var(--text-dim); font-size: .85rem; }
.grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}
.card {
  position: relative; display: block; aspect-ratio: 1;
  background: var(--bg2); border-radius: var(--radius); overflow: hidden;
  border: 2px solid transparent; outline: none;
}
.card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card:focus-visible, .card:hover { border-color: var(--accent); }
/* karta, na kterou vede návrat z detailu — ať je vidět, kde jsem pracoval */
.card:target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent); }
/* malé hodnocení hvězdami nahoře v kartě (přehled, nesmí rušit fotku) */
.card-stars {
  position: absolute; left: 7px; top: 5px; z-index: 2;
  color: #fbbf24; font-size: .68rem; letter-spacing: 1px;
  text-shadow: 0 1px 2px rgba(0,0,0,.9);
}
/* ▶ = položka je video (referenční) */
.card-video {
  position: absolute; left: 7px; bottom: 7px; z-index: 2;
  background: rgba(28,25,23,.8); color: #fff; border-radius: 50%;
  width: 26px; height: 26px; display: flex; align-items: center;
  justify-content: center; font-size: .7rem;
}
.stage-video {
  max-width: 100%; max-height: calc(100vh - 150px);
  border-radius: var(--radius); background: #000;
}
/* ×N = fotka je ve skupině podobných */
.card-variants {
  position: absolute; left: 7px; top: 22px; z-index: 2;
  font-size: .62rem; font-weight: 700; color: #1c1917;
  background: rgba(231,229,228,.88); border-radius: 8px; padding: 0 6px;
}
/* ✎ = fotka má vyplněný popis */
.card-note {
  position: absolute; right: 42px; top: 8px; z-index: 2;
  color: rgba(231,229,228,.9); font-size: .8rem;
  text-shadow: 0 1px 2px rgba(0,0,0,.9);
}
.card-curation {
  position: absolute; left: 7px; top: 40px; z-index: 2;
  padding: 2px 7px; border-radius: 10px; font-size: .62rem;
  font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.5);
}
.card-curation.recommended { background: #166534; color: #dcfce7; }
.card-curation.alternate { background: rgba(41,37,36,.86); color: #d6d3d1; }
.segmented { display: flex; flex-wrap: wrap; gap: 8px; }
.segmented .btn.on { background: var(--accent); color: #1c1917; }
.trash-actions {
  display: grid; gap: 10px; margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--line);
}
.trash-actions form { display: grid; gap: 8px; }
.permanent-delete { padding-top: 8px; border-top: 1px solid var(--line); }
/* stavové chipy na kartě: barva = stav, text = kapitola */
.card .dots {
  position: absolute; left: 6px; right: 6px; bottom: 6px; z-index: 2;
  display: flex; flex-wrap: wrap; gap: 4px;
}
.card .dots .chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .66rem; line-height: 1.35; padding: 2px 7px; border-radius: 20px;
  border: 1px solid var(--line); background: rgba(28,25,23,.72);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,.5);
}
.card .dots .chip.k { border-color: var(--st-kandidat); color: #e7e5e4; }
.card .dots .chip.s { border-color: var(--st-shortlist); color: #f7c179; background: rgba(120,60,10,.5); }
.card .dots .chip.f { border-color: var(--st-final); background: var(--st-final); color: #08240f; font-weight: 700; }
.card .dots .chip.z { border-color: var(--st-zamitnuto); color: #fca5a5; text-decoration: line-through; background: rgba(70,20,20,.6); }
/* techniky/receptury na kartě: drobné bílé plné chipy (jen přehled) */
.card .dots .chip.t {
  border-color: transparent; background: rgba(231,229,228,.88);
  color: #1c1917; font-size: .6rem; padding: 1px 7px;
}
.card.status-kandidat  { border-color: var(--st-kandidat); }
.card.status-shortlist { border-color: var(--st-shortlist); }
.card.status-final     { border-color: var(--st-final); }
.card.status-zamitnuto { opacity: .38; border-color: var(--st-zamitnuto); }

/* ⋯ rychlé akce na kartě — klik = detail, ⋯ = akce na místě */
.act-btn {
  position: absolute; right: 6px; top: 6px; z-index: 3;
  width: var(--touch); height: var(--touch); border-radius: 8px;
  background: rgba(28,25,23,.72); border: 1px solid var(--line); color: var(--text);
  display: none; align-items: center; justify-content: center;
  font-size: 1.1rem; line-height: 1; cursor: pointer;
}
.card:hover .act-btn, .card:focus-within .act-btn { display: flex; }
@media (pointer: coarse) { .act-btn { display: flex; } }
body.select-mode .act-btn { display: none; }
.act-btn:hover, .act-btn.on {
  background: var(--accent); color: #1c1917; border-color: var(--accent);
}

/* modal s pracovním blokem (⋯ na kartě) — stejné ovládání jako v detailu */
#photo-modal { position: fixed; inset: 0; z-index: 60; }
#photo-modal[hidden] { display: none; }
.pm-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); }
.pm-box {
  position: relative; margin: 6vh auto 0;
  width: min(480px, calc(100vw - 24px));
  max-height: 86vh; overflow-y: auto;
  background: var(--bg2); border: 1px solid var(--accent-soft);
  border-radius: 14px; padding: 10px 14px 14px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .65);
}
.pm-head { display: flex; align-items: center; gap: 12px; }
.pm-title { font-weight: 700; }
.pm-detail { font-size: .85rem; }
.pm-close {
  margin-left: auto; width: var(--touch); height: var(--touch);
  background: none; border: none; color: var(--text-dim);
  font-size: 1.6rem; line-height: 1; cursor: pointer;
}
.pm-close:hover { color: var(--text); }
.pm-box .work-block { margin-bottom: 0; }

/* detail — primární akce nahoře (hodnocení + zamítnout), zbytek sbalený */
.detail-primary {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px 12px; flex-wrap: wrap;
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 8px 12px;
}
.detail-primary #quality-control { flex: 1 1 auto; min-width: 0; }
.reject-form { margin: 0; flex: 0 0 auto; }
.reject-form .btn { white-space: nowrap; }
.detail .secondary {
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius);
}
.detail .secondary > summary {
  cursor: pointer; min-height: 44px; display: flex; align-items: center;
  padding: 0 12px; color: var(--text-dim); font-size: .85rem;
}
.pager { display: flex; gap: 14px; align-items: center; justify-content: center; margin: 18px 0 6px; }
.empty { color: var(--text-dim); padding: 30px 6px; }

/* výběr více fotek — kolečka jen v režimu výběru (tlačítko „Vybrat").
   Kolečko je jen vizuální indikátor; označuje se tapem/tažením přes celou
   kartu (jako iOS Fotky), proto pointer-events: none. */
.sel-toggle {
  position: absolute; left: 0; top: 0;
  width: 44px; height: 44px;
  display: none; align-items: center; justify-content: center;
  pointer-events: none;
}
body.select-mode .sel-toggle { display: flex; }
body.select-mode .card { touch-action: pan-y; }
body.select-mode .card, body.select-mode .card img {
  -webkit-user-select: none; user-select: none; -webkit-user-drag: none;
}
.f-select.on { border-color: var(--accent); color: var(--accent); font-weight: 700; }
/* Vybrat / Zrušit výběr (+ Vybrat stránku jen v režimu výběru) v horní liště */
.nav-sel { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.topbar nav.has-actions .nav-last { margin-left: 0; }
.nav-sel #bb-all { display: none; }
body.select-mode .nav-sel #bb-all { display: inline-flex; }
.sel-toggle::before {
  content: ""; width: 24px; height: 24px;
  border: 2px solid rgba(231,229,228,.85); border-radius: 50%;
  background: rgba(28,25,23,.45);
  box-shadow: 0 1px 3px rgba(0,0,0,.6);
}
.sel-toggle:hover::before { border-color: var(--accent); }
.card.selected .sel-toggle::before {
  background: var(--accent); border-color: var(--accent);
  content: "✓"; color: #1c1917; font-weight: 800;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }

/* hromadná akční lišta — zrcadlo pracovního bloku detailu; hodnoty se
   nastřádají a zapíšou najednou tlačítkem Aplikovat */
.bulkbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; flex-direction: column; gap: 6px;
  padding: 8px 16px calc(10px + env(safe-area-inset-bottom));
  background: #14110f; border-top: 2px solid var(--accent);
  box-shadow: 0 -4px 18px rgba(0,0,0,.5);
}
.bulkbar[hidden] { display: none !important; }
.bb-head { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.bb-count { font-size: .95rem; }
.bb-count b { color: var(--accent); font-size: 1.1rem; }
#bb-msg { color: var(--text-dim); font-size: .85rem; }
.bb-set { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: end; }
.bb-field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 200px; min-width: 0; }
.bb-field.bb-q, .bb-field.bb-rej { flex: 0 0 auto; }
.bb-popis-f { flex: 2 1 240px; }
.bb-lbl {
  font-size: .72rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text);
}
.bb-set input, .bb-set textarea {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1.5px solid var(--accent-soft); border-radius: 8px;
  min-height: var(--touch); padding: 0 12px; font: inherit; font-size: .9rem;
}
.bb-set textarea { padding: 10px 12px; resize: vertical; }
.bb-set input::placeholder, .bb-set textarea::placeholder { color: var(--text-dim); }
.bb-stars { display: flex; gap: 0; }
.bb-stars .star {
  min-width: 34px; min-height: var(--touch); padding: 0;
  background: none; border: 0; color: #6b6560; cursor: pointer;
  font-size: 1.5rem; line-height: 1;
}
.bb-stars .star.on { color: var(--accent); }
.bb-stars .star:hover, .bb-stars .star:focus-visible { color: var(--accent-soft); }
.bb-reject {
  background: transparent; border: 1.5px solid var(--st-zamitnuto);
  color: #fca5a5; border-radius: 8px; padding: 8px 14px;
  min-height: var(--touch); cursor: pointer; font-size: .92rem; white-space: nowrap;
}
.bb-reject.on { background: var(--st-zamitnuto); color: #fff; font-weight: 600; }
.bb-apply {
  background: var(--accent); border-color: var(--accent);
  color: #1c1917; font-weight: 700; min-width: 190px;
}
.bb-apply:hover { background: #f59e0b; border-color: #f59e0b; }

/* ---------- tlačítka ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--touch); padding: 8px 14px;
  background: var(--bg3); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius);
  font-size: .92rem; cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.wide { width: 100%; margin-top: 10px; }

/* ---------- detail ---------- */
.detail { display: flex; gap: 16px; align-items: flex-start; }
.stage {
  position: relative; flex: 1; min-width: 0;
  background: #0e0c0b; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  min-height: 320px;
}
.stage img { max-width: 100%; max-height: calc(100vh - 150px); object-fit: contain; border-radius: var(--radius); }
.navbtn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 52px; height: 84px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem; color: var(--text);
  background: rgba(28,25,23,.55); border-radius: var(--radius);
}
.navbtn:hover { background: rgba(28,25,23,.85); color: var(--accent); }
.navbtn.prev { left: 10px; }
.navbtn.next { right: 10px; }
.panel { width: 420px; flex-shrink: 0; display: flex; flex-direction: column; gap: 10px; }

/* pracovní metadata fotky */
.photo-meta {
  background: var(--bg2); border: 1px solid var(--accent-soft);
  border-radius: var(--radius); padding: 10px 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.meta-form { display: flex; flex-direction: column; gap: 8px; }
.meta-form label {
  display: flex; flex-direction: column; gap: 4px;
  color: var(--text-dim); font-size: .8rem;
}
.meta-form input, .meta-form textarea, .meta-suggest input {
  min-width: 0; width: 100%;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--accent-soft); border-radius: 8px;
  padding: 9px 10px; font: inherit;
  min-height: var(--touch);
}
.meta-form textarea { resize: vertical; min-height: 74px; }
.meta-suggest { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

/* kvalita */
.quality {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 6px 12px;
  display: grid; grid-template-columns: 105px 1fr; align-items: center;
}
.stars { display: flex; gap: 2px; }

/* ===== hlavní pracovní blok detailu (kvalita, zamítnout, kapitoly,
   techniky, receptury) — výrazný, vysoký kontrast, vše se ukládá ihned ===== */
.work-block {
  background: var(--bg3); border: 1.5px solid var(--accent-soft);
  border-radius: var(--radius); padding: 14px; margin-bottom: 12px;
  display: flex; flex-direction: column; gap: 14px;
}
.wb-label {
  font-size: .72rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text);
}
.wb-toprow { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.wb-quality { display: flex; align-items: center; gap: 12px; }
/* hvězdy blíž k sobě a výrazné */
.work-block .stars { gap: 0; }
.work-block .star {
  background: none; border: none; cursor: pointer;
  font-size: 1.7rem; line-height: 1; color: #6b6560;
  width: var(--touch); height: var(--touch); padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.work-block .star.on { color: var(--accent); }
.work-block .star:hover { color: var(--accent-soft); }
.wb-reject {
  background: transparent; border: 1.5px solid var(--st-zamitnuto);
  color: #fca5a5; border-radius: 8px; padding: 8px 14px;
  min-height: var(--touch); cursor: pointer; font-size: .92rem; white-space: nowrap;
}
.wb-reject.on { background: var(--st-zamitnuto); color: #fff; font-weight: 600; }
.wb-group { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.wb-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.wb-chips:empty { display: none; }
/* chipsy: bílé/barevné, plné, bez rámečku — čisté a přehledné */
.wb-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .82rem; padding: 4px 6px 4px 12px; border-radius: 20px;
  border: none; background: #e7e5e4; color: #1c1917; font-weight: 500;
}
.wb-chip.status-kandidat  { background: #d6d3d1; color: #1c1917; }
.wb-chip.status-shortlist { background: var(--st-shortlist); color: #1c1917; }
.wb-chip.status-final     { background: var(--st-final); color: #08240f; font-weight: 700; }
/* název kapitoly na chipu = tlačítko: klik cykluje kandidát→shortlist→finál */
.wb-cycle {
  background: none; border: none; color: inherit; font: inherit;
  padding: 0 4px; cursor: pointer; min-height: var(--touch);
}
.wb-cycle:hover { text-decoration: underline; }
.wb-x {
  background: none; border: none; color: inherit; opacity: .6; cursor: pointer;
  font-size: 1rem; line-height: 1; padding: 0; border-radius: 50%;
  min-width: var(--touch); min-height: var(--touch);
}
.wb-x:hover { opacity: 1; background: rgba(0,0,0,.18); }
/* pole kapitoly/techniky/receptury: všechna stejně široká, od začátku řádku */
.wb-add {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1.5px solid var(--accent-soft); border-radius: 8px;
  min-height: var(--touch); padding: 0 12px; font-size: .9rem; cursor: pointer;
}
input.wb-add { cursor: text; font: inherit; font-size: .9rem; }
input.wb-add::placeholder { color: var(--text-dim); }
.wb-popis {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1.5px solid var(--accent-soft); border-radius: 8px;
  padding: 9px 12px; font: inherit; font-size: .9rem;
  resize: vertical; min-height: var(--touch);
}
/* tlumený focus místo křiklavého systémového rámečku */
.work-block :focus-visible {
  outline: 2px solid var(--accent-soft); outline-offset: 1px;
}
.wb-add:focus-visible {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(217, 119, 6, .3);
}

/* výběrová lišta */
.selbar {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.sel-chapter { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; font-size: .8rem; color: var(--text-dim); }
.sel-chapter span { grid-column: 1 / -1; }
.sel-chapter select {
  background: var(--bg); color: var(--text); border: 1px solid var(--accent-soft);
  border-radius: 8px; min-height: var(--touch); padding: 0 10px; font-size: .95rem;
}
.chapter-row {
  display: flex; flex-direction: column; gap: 8px;
  padding: 8px 0; border-top: 1px solid var(--line);
}
.chapter-row-title { font-weight: 700; font-size: .92rem; }
.statusbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.statusbtns .btn.on { border-width: 2px; font-weight: 700; }
.btn.st-kandidat.on  { border-color: var(--st-kandidat);  background: #33302d; }
.btn.st-shortlist.on { border-color: var(--st-shortlist); background: #3d2c12; }
.btn.st-final.on     { border-color: var(--st-final);     background: #14301d; }
.btn.st-zamitnuto.on { border-color: var(--st-zamitnuto); background: #331414; }
.sel-summary { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-block; background: var(--bg3); border-radius: 999px;
  padding: 3px 10px; font-size: .8rem;
}
.chip.st-shortlist { border: 1px solid var(--st-shortlist); }
.chip.st-final { border: 1px solid var(--st-final); }
.chip.st-kandidat { border: 1px solid var(--st-kandidat); }
.chip.st-zamitnuto { border: 1px solid var(--st-zamitnuto); }

/* štítky autora (import + ruční doplnění) */
.stitky-autor {
  background: var(--bg2); border: 1px solid var(--accent-soft);
  border-radius: var(--radius); padding: 10px 12px;
  display: flex; flex-direction: column; gap: 12px;
}
.chip-autor { border: 1px solid var(--accent); color: var(--accent); }
.tag-group { display: flex; flex-direction: column; gap: 6px; }
.chipline { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-remove {
  margin-left: 5px; padding: 0; border: 0; background: transparent;
  color: inherit; cursor: pointer; font-size: .95rem; line-height: 1;
}
.tag-add { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.tag-add input {
  min-width: 0; background: var(--bg); color: var(--text);
  border: 1px solid var(--accent-soft); border-radius: 8px;
  min-height: var(--touch); padding: 0 10px;
}

/* tag panel */
.tags {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 6px 12px 10px;
}
.star {
  background: none; border: none; cursor: pointer;
  font-size: 1.5rem; color: #57534e;
  width: var(--touch); height: var(--touch);
}
.star.on { color: var(--accent); }
.ai-panel { padding-top: 0; }
.ai-panel > summary, .file-meta > summary {
  min-height: var(--touch); display: flex; align-items: center;
  justify-content: space-between; gap: 12px; cursor: pointer;
  list-style: none;
}
.ai-panel > summary::-webkit-details-marker,
.file-meta > summary::-webkit-details-marker { display: none; }
.ai-panel > summary::after,
.file-meta > summary::after {
  content: "⌄"; color: var(--text-dim); transition: transform .15s ease;
}
.ai-panel[open] > summary::after,
.file-meta[open] > summary::after { transform: rotate(180deg); }
.tagrow { border-bottom: 1px solid var(--line); }
.tagrow:last-of-type { border-bottom: none; }
.tagrow summary {
  display: flex; align-items: center; gap: 10px;
  min-height: var(--touch); cursor: pointer; list-style: none;
}
.tagrow summary::-webkit-details-marker { display: none; }
.tr-label { color: var(--text-dim); font-size: .8rem; width: 105px; flex-shrink: 0; }
.tr-val { display: flex; flex-wrap: wrap; gap: 5px; flex: 1; }
.badge-human {
  background: var(--accent); color: #1c1917;
  font-size: .65rem; font-weight: 800; border-radius: 4px; padding: 2px 6px;
}
.tagedit { display: flex; gap: 8px; padding: 4px 0 10px; }
.tagedit input[name="value"] {
  flex: 1; background: var(--bg); color: var(--text);
  border: 1px solid var(--accent-soft); border-radius: 8px;
  min-height: var(--touch); padding: 0 10px;
}
.file-meta {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px; margin: 0;
}
.file-meta p { margin: 8px 0 0; }
.tech {
  display: grid; grid-template-columns: 110px 1fr; gap: 4px 10px;
  padding-top: 8px; margin: 0; border-top: 1px solid var(--line);
}
.tech dt { color: var(--text-dim); font-size: .8rem; }
.tech dd { margin: 0; font-size: .9rem; }

/* ---------- nahrávání fotek ---------- */
.upload {
  max-width: 680px; display: flex; flex-direction: column; gap: 14px;
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px;
}
.upload h1 { font-size: 1.15rem; }
.upload p { margin: 0; }
.upload input[type="file"] {
  width: 100%; padding: 18px 12px; color: var(--text-dim);
  background: var(--bg); border: 1.5px dashed var(--accent-soft);
  border-radius: var(--radius); font: inherit;
}
.upload input[type="file"]::file-selector-button {
  background: var(--bg3); color: var(--text);
  border: 1px solid var(--accent-soft); border-radius: 8px;
  min-height: var(--touch); padding: 8px 14px; margin-right: 12px;
  font: inherit; cursor: pointer;
}
.up-labels {
  margin: 0; border: 1px solid var(--accent-soft);
  border-radius: var(--radius); padding: 10px 12px;
  display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end;
}
.up-labels legend { padding: 0 6px; }
.up-labels label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: .8rem; color: var(--text-dim); flex: 1 1 180px;
}
.up-labels select, .up-labels input[data-combobox] {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--accent-soft); border-radius: 8px;
  min-height: var(--touch); padding: 0 10px; font-size: .92rem;
}
.up-labels .checkline { flex: 0 1 auto; }
.up-start { align-self: flex-start; border-color: var(--accent); color: var(--accent); font-weight: 700; }
.up-file-meta { display: flex; flex-direction: column; gap: 8px; }
.up-file-row {
  display: grid; grid-template-columns: minmax(150px, 1fr) minmax(220px, 2fr) 110px;
  gap: 10px; align-items: end; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg3);
}
.up-file-row strong { align-self: center; overflow-wrap: anywhere; }
.up-file-row label, .auth-form label, .chapter-admin label {
  display: flex; flex-direction: column; gap: 4px; color: var(--text-dim); font-size: .8rem;
}
.up-file-row textarea, .up-file-row input, .auth-form input,
.chapter-admin input, .chapter-admin select {
  width: 100%; min-height: var(--touch); padding: 9px 10px;
  background: var(--bg); color: var(--text); border: 1px solid var(--accent-soft);
  border-radius: 8px; font: inherit;
}
.up-file-row textarea { resize: vertical; }
.up-progress { display: flex; flex-direction: column; gap: 8px; }
.up-counter { font-weight: 600; }
.up-list {
  margin: 0; padding-left: 22px; font-size: .88rem;
  display: flex; flex-direction: column; gap: 4px;
  max-height: 45vh; overflow-y: auto;
}
.up-ingested, .up-soft_dup { color: #86efac; }
.up-binary_dup, .up-inferior_copy { color: #f7c179; }
.up-error, .up-unsupported { color: #fca5a5; }
.up-done { display: flex; gap: 10px; }
.up-progress[hidden], .up-done[hidden] { display: none !important; }
.batch-note { color: var(--accent); }

/* ---------- combobox (vlastní nabídka místo <datalist>, kvůli iOS) ---------- */
.cbx-list {
  position: fixed; z-index: 70; max-height: 244px; overflow-y: auto;
  background: var(--bg2); border: 1px solid var(--accent-soft);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.cbx-opt {
  padding: 10px 12px; cursor: pointer; font-size: .9rem;
  min-height: var(--touch); display: flex; align-items: center;
  border-bottom: 1px solid var(--line);
}
.cbx-opt:last-child { border-bottom: none; }
.cbx-opt:hover, .cbx-opt:active { background: var(--bg3); color: var(--accent); }

/* ---------- kniha (náhled rukopisu) ---------- */
.kniha-admin {
  max-width: 680px; display: flex; flex-direction: column; gap: 16px;
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px;
}
.kniha-admin h1 { font-size: 1.15rem; }
.kniha-admin p { margin: 0; }
.kniha-upload, #kniha-form { display: flex; flex-direction: column; gap: 8px; }
.kniha-upload input[type="file"] {
  background: var(--bg); border: 1.5px dashed var(--accent-soft);
  border-radius: var(--radius); padding: 14px 12px; color: var(--text-dim);
}
.kniha-upload .btn { align-self: flex-start; }
#kniha-instrukce {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1.5px solid var(--accent-soft); border-radius: 8px;
  padding: 10px 12px; font: inherit; font-size: .9rem; resize: vertical;
}
.kniha-rozsah { display: flex; gap: 16px; align-items: center; }
.kniha-rozsah label { display: flex; gap: 6px; align-items: center; }
.kniha-rozsah input { accent-color: var(--accent); }
.kniha-report { border-top: 1px solid var(--line); padding-top: 10px;
                display: flex; flex-direction: column; gap: 6px; }
.kniha-akce { display: flex; gap: 10px; }
#kniha-form .bb-apply { align-self: flex-start; }

/* ---------- varianty (skupiny podobných fotek) ---------- */
.vg-group {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 12px; margin-bottom: 14px;
}
.vg-title {
  font-size: .8rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-dim); margin: 0 0 10px;
}
.vg-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.vg-x {
  position: absolute; right: 6px; bottom: 6px; z-index: 3;
  width: var(--touch); height: var(--touch); border-radius: 8px; cursor: pointer;
  background: rgba(28,25,23,.72); border: 1.5px solid var(--st-zamitnuto);
  color: #fca5a5; font-size: 1rem; line-height: 1;
}
.vg-x:hover { background: var(--st-zamitnuto); color: #fff; }

/* ---------- kapitoly ---------- */
.ch-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.ch-tabs a {
  padding: 10px 14px; min-height: var(--touch); display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text);
}
.ch-tabs a.active { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.ch-tabs small { color: var(--text-dim); }
.ch-progress {
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 14px;
  display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center;
}
.ch-progress .bar {
  flex-basis: 100%; height: 6px; background: var(--bg);
  border-radius: 999px; overflow: hidden;
}
.ch-progress .bar span { display: block; height: 100%; background: var(--st-final); }
.ch-progress p { flex-basis: 100%; margin: 0; }
.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.col {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px; min-height: 200px;
}
.col h2 {
  font-size: .85rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-dim); margin: 2px 4px 10px;
  display: flex; justify-content: space-between;
}
.col-kandidat h2  { color: var(--st-kandidat); }
.col-shortlist h2 { color: var(--st-shortlist); }
.col-final h2     { color: var(--st-final); }
.bcard { margin-bottom: 10px; background: var(--bg3); border-radius: var(--radius); overflow: hidden; }
.bcard img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; display: block; }
/* přetažení mezi sloupci: vodorovný tah táhne, svislý scrolluje */
.board .bcard { touch-action: pan-y; }
.board .bcard, .board .bcard img {
  -webkit-user-select: none; user-select: none; -webkit-user-drag: none;
  -webkit-touch-callout: none;
}
.bcard.dragging { opacity: .4; }
.col.drop-hover { outline: 2px dashed var(--accent); outline-offset: -2px; background: #2e2724; }
.drag-ghost {
  position: fixed; z-index: 80; width: 130px; pointer-events: none; opacity: .9;
}
.drag-ghost img {
  width: 100%; border-radius: 8px; display: block;
  box-shadow: 0 10px 28px rgba(0,0,0,.55);
}
.bacts { display: flex; gap: 6px; padding: 6px; }
.bacts .btn { flex: 1; font-size: .8rem; padding: 6px 4px; }
.btn.st-zamitnuto { color: #fca5a5; }
.btn.danger { color: #fca5a5; border-color: var(--st-zamitnuto); }
.chapter-admin {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: end;
  padding: 10px 0 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line);
}
.chapter-admin form { display: flex; gap: 8px; align-items: end; }
.readonly-value { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.labels-admin { max-width: 980px; }
.labels-admin h1 { font-size: 1.2rem; margin-bottom: 14px; }
.labels-admin h2 { font-size: 1rem; margin: 24px 0 8px; color: var(--accent); }
.label-create, .label-row, .label-rename, .label-merge {
  display: flex; gap: 8px; align-items: end;
}
.label-create { margin-bottom: 20px; }
.label-create label, .label-row label { display: flex; flex-direction: column; gap: 4px; color: var(--text-dim); font-size: .8rem; }
.label-create input, .label-create select, .label-row input, .label-row select {
  min-height: var(--touch); padding: 8px 10px; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; font: inherit;
}
.label-list { display: flex; flex-direction: column; gap: 6px; }
.label-row { padding: 8px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); }
.label-rename { flex: 1 1 420px; }
.label-rename label { flex: 1; }
.label-merge { flex: 1 1 300px; }
.label-merge label { flex: 1; }

/* ---------- přihlášení a účet ---------- */
.auth-page { padding: 24px; justify-content: center; align-items: center; }
.auth-page main { flex: 0 1 auto; }
.auth-card, .account-card {
  width: min(440px, 100%); margin: auto; padding: clamp(18px, 4vw, 30px);
  background: var(--bg2); border: 1px solid var(--line); border-radius: 14px;
}
.auth-card h1, .account-card h1 { font-size: 1.35rem; margin-bottom: 8px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.auth-form input { font-size: 1rem; }
.form-error { color: #fca5a5; }
.empty-col { text-align: center; padding: 20px 0; }
.rejected { margin-top: 14px; color: var(--text-dim); }
.rejected summary { cursor: pointer; min-height: var(--touch); display: flex; align-items: center; }
.rejected-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }

/* ---------- responsive (iPad portrait a užší) ---------- */
@media (max-width: 1024px) {
  .detail { flex-direction: column; }
  .panel { width: 100%; }
  .stage img { max-height: 60vh; }
  .board { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .bb-field { flex: 1 1 240px; }
  .up-file-row { grid-template-columns: 1fr 1.7fr 100px; }
}

@media (max-width: 780px) {
  .bulkbar { max-height: 60vh; overflow-y: auto; }
  .bb-field, .bb-apply { flex: 1 1 100%; }
  .topbar { padding-left: max(8px, env(safe-area-inset-left));
            padding-right: max(8px, env(safe-area-inset-right)); }
  .topbar nav { overflow-x: auto; overscroll-behavior-x: contain;
                scrollbar-width: none; gap: 2px; }
  .topbar nav::-webkit-scrollbar { display: none; }
  .topbar nav a, .nav-disabled { padding-inline: 10px; flex: 0 0 auto; }
  .nav-user { margin-left: 4px; }
  main { padding-inline: 10px; }
  .filters { padding: 10px; }
  .filters-primary, .filters-extra { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .filters label, .filters .f-grow { min-width: 0; }
  .filters select, .filters input[type="search"] { width: 100%; font-size: 16px; }
  .checkline { align-self: end; }
  .detail { gap: 10px; }
  .stage { min-height: 230px; }
  .stage img, .stage-video { max-height: 55vh; }
  .navbtn { width: 44px; height: 68px; }
  .nav-info .nav-back { min-width: 96px; padding-inline: 14px; }
  .nav-file { display: none; }
  .upload { max-width: none; padding: 12px; }
  .up-file-row { grid-template-columns: 1fr 92px; }
  .up-file-row strong { grid-column: 1 / -1; }
  .up-file-row textarea, .up-file-row input { font-size: 16px; }
  .chapter-admin { align-items: stretch; }
  .chapter-admin form { flex: 1 1 100%; }
  .chapter-admin label { flex: 1; }
  .label-row { flex-wrap: wrap; }
  .label-rename, .label-merge { flex: 1 1 100%; }
}

@media (max-width: 480px) {
  :root { --radius: 8px; }
  .filters-primary, .filters-extra { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .grid-meta { flex-wrap: wrap; gap: 4px 12px; }
  .panel { gap: 8px; }
  .work-block { padding: 12px 10px; }
  .up-labels { display: grid; grid-template-columns: 1fr; }
  .up-file-row { grid-template-columns: 1fr; }
  .up-file-row strong { grid-column: auto; }
  .up-done { flex-direction: column; }
  .up-done .btn { width: 100%; }
  .tech { grid-template-columns: 92px 1fr; }
}
