:root {
  --bg: #111214; --bg2: #18191c; --bg3: #1f2125; --line: #2a2d33; --text: #e8e9ec; --muted: #8d919a;
  --red: #e63b2e; --red2: #c9301f; --green: #3fb950; --amber: #d29922; --blue: #58a6ff;
  --radius: 10px; --font: -apple-system, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); }
a { color: var(--blue); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
.center { padding: 60px 16px; text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.hidden { display: none !important; }
.wrap { max-width: 1400px; margin: 0 auto; padding: 0 16px 60px; }
.svg { width: 1.1em; height: 1.1em; vertical-align: -0.18em; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* hlavička */
.top { display: flex; align-items: center; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--line); margin-bottom: 20px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .02em; color: var(--text); font-size: 16px; }
.brand .mark { width: 28px; height: 28px; border-radius: 7px; background: var(--red); display: grid; place-items: center; color: #fff; }
.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav a { padding: 7px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.nav a.on, .nav a:hover { background: var(--bg3); color: var(--text); }

/* PIN */
.pin { max-width: 320px; margin: 80px auto; }
.pin input { width: 100%; text-align: center; letter-spacing: .4em; font-size: 22px; }

/* komponenty */
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; cursor: pointer; }
.stat:hover { border-color: #3a3e46; }
.stat b { display: block; font-size: 26px; font-weight: 700; }
.stat span { color: var(--muted); font-size: 12px; }
.stat.on { border-color: var(--red); }
h1 { font-size: 20px; margin: 0 0 14px; }
h2 { font-size: 15px; margin: 0 0 10px; }
h3 { font-size: 13px; margin: 14px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg3); color: var(--text); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #444954; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.red { background: var(--red); border-color: var(--red); color: #fff; }
.btn.red:hover { background: var(--red2); }
.btn.green { background: #1f6f2e; border-color: #1f6f2e; color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 4px 9px; font-size: 12px; }
input[type=text], input[type=number], input[type=password], input[type=url], select, textarea { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
input:focus, select:focus, textarea:focus { outline: none; border-color: #4a5060; }
textarea { min-height: 120px; resize: vertical; }
label.f { display: block; margin-bottom: 10px; }
label.f > span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--bg3); color: var(--muted); border: 1px solid var(--line); }
.badge.nove { color: var(--blue); } .badge.spracuvam { color: var(--amber); } .badge.na_kontrolu { color: var(--amber); border-color: #5a4a1c; }
.badge.schvalene { color: var(--green); border-color: #234d2b; } .badge.odoslane { color: var(--green); background: #16311c; } .badge.chyba { color: var(--red); border-color: #5a2a26; }
.badge.ok { color: var(--green); } .badge.warn { color: var(--amber); } .badge.err { color: var(--red); }
.err { color: var(--red); margin-top: 8px; }
.ok { color: var(--green); }
.toast { position: fixed; right: 16px; bottom: 16px; background: var(--bg3); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; max-width: 420px; z-index: 50; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.toast.err { border-color: var(--red); }
table { width: 100%; border-collapse: collapse; }
td, th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
.log { max-height: 320px; overflow: auto; font-size: 12px; }
.log div { padding: 4px 0; border-bottom: 1px solid var(--line); display: flex; gap: 8px; }
.log .t { color: var(--muted); white-space: nowrap; }
.log .chyba { color: var(--red); }

/* produkty */
.plist { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.pcard { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; position: relative; }
.pcard:hover { border-color: #444954; }
.pcard .th { aspect-ratio: 1; background: #fff; display: grid; place-items: center; }
.pcard .th img { width: 100%; height: 100%; object-fit: contain; }
.pcard .th.empty { background: var(--bg3); color: var(--muted); font-size: 12px; }
.pcard .b { padding: 10px; }
.pcard .n { font-weight: 600; font-size: 13px; line-height: 1.3; height: 34px; overflow: hidden; }
.pcard .sel { position: absolute; top: 8px; left: 8px; width: 20px; height: 20px; accent-color: var(--red); }

/* detail produktu */
.imgrow { display: grid; grid-template-columns: 1fr 1fr 1fr 260px; gap: 12px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; }
.imgrow.hero { border-color: #5a3a1c; }
.imgrow.vyradeny { opacity: .55; }
.imgrow figure { margin: 0; }
.imgrow figcaption { color: var(--muted); font-size: 11px; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }
.imgrow .ph { aspect-ratio: 1; background: repeating-conic-gradient(#2a2d33 0 25%, #1f2125 0 50%) 0 0/16px 16px; border-radius: 6px; display: grid; place-items: center; overflow: hidden; }
.imgrow .ph.white { background: #fff; }
.imgrow .ph img { width: 100%; height: 100%; object-fit: contain; }
.imgrow .ctl { font-size: 12px; }
.imgrow .ctl label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.imgrow .ctl input[type=range] { width: 120px; }
.imgrow .ctl input[type=number] { width: 70px; padding: 3px 6px; }
.qc { font-size: 12px; margin-top: 6px; }
.qc .problemy span { display: inline-block; margin: 2px 4px 0 0; padding: 1px 6px; border-radius: 6px; background: #3a2a1c; color: var(--amber); font-size: 11px; }
.qc .ok { color: var(--green); }
.aiinfo { font-size: 12px; color: var(--muted); }
.big { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: grid; place-items: center; z-index: 60; cursor: zoom-out; }
.big img { max-width: 92vw; max-height: 92vh; background: #fff; }
.progress { height: 3px; background: var(--red); position: fixed; top: 0; left: 0; width: 0; transition: width .3s; z-index: 70; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips a { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.chips a.on { border-color: var(--red); color: var(--text); }
@media (max-width: 900px) { .imgrow { grid-template-columns: 1fr 1fr; } }
