:root {
  --brand: #26b2ed; --brand-ink: #0b6f9f; --bg: #f2f7fa; --card: #fff; --line: #d9e6ee; --text: #14212b; --muted: #5b6b75;
  --bad: #c62828; --bad-bg: #fdecea; --warn: #b26a00; --warn-bg: #fff4e0; --ok: #2e7d32; --ok-bg: #e8f5e9; --info-bg: #eef2f7;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
.bar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 5; }
.bar strong { font-size: 1.3rem; letter-spacing: .02em; }
.logo { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; }
.logo svg { width: 30px; height: 30px; flex: none; }
.bar .sub { opacity: .8; font-size: .9rem; }
#who { display: flex; align-items: center; gap: 12px; }
button.bar-btn { background: rgba(255,255,255,.16); border: 2px solid rgba(255,255,255,.7); color: #fff; padding: 6px 12px; font-size: .92rem; }
button.bar-btn:hover, button.bar-btn.on { background: #fff; color: var(--brand-ink); border-color: #fff; }
@media (max-width: 640px) { .bar .sub, .who-name { display: none; } }
.grow { flex: 1; }
main { max-width: 1400px; margin: 0 auto; padding: 16px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin-bottom: 14px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
button, .btn { font: inherit; font-weight: 700; border-radius: 10px; border: 2px solid var(--brand); background: var(--brand); color: #fff; padding: 9px 16px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
button.ghost, .btn.ghost { background: #fff; color: var(--brand-ink); }
button.link { border: 0; background: none; color: var(--brand-ink); padding: 0; text-decoration: underline; font-weight: 600; }
.mt { margin-top: 10px; } .mb { margin-bottom: 12px; }
button.link.light { color: #fff; }
button:disabled { opacity: .55; cursor: default; }
input[type=text], input[type=password], input[type=search] { font: inherit; padding: 9px 12px; border: 2px solid var(--line); border-radius: 10px; background: #fff; min-width: 0; }
input:focus { outline: none; border-color: var(--brand); }
.login { max-width: 360px; margin: 40px auto; display: grid; gap: 10px; }
.status { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; align-items: center; padding: 10px 14px; }
.status-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.status h2 { margin: 0; font-size: 1rem; }
.err { color: var(--bad); font-weight: 600; }
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.progress i { display: block; height: 100%; background: var(--brand); transition: width .4s; }
.summary { display: grid; grid-template-columns: minmax(230px, 280px) 1fr; gap: 12px 24px; align-items: start; }
.groups { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.group h4 { margin: 0 0 4px; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.group h4 small { font-weight: 700; } .g-bad h4 { color: var(--bad); } .g-warn h4 { color: var(--warn); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: flex; align-items: center; gap: 7px; padding: 6px 8px 6px 10px; border-radius: 10px; border: 2px solid var(--line); background: #fff; color: var(--text); cursor: pointer; white-space: nowrap; }
.chip:hover { border-color: #a9cfe2; } .chip:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.chip b { font-size: 1.15rem; line-height: 1; }
.chip-label { font-weight: 600; font-size: .88rem; }
.chip.on { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: #f3fbff; }
.chip.bad b { color: var(--bad); } .chip.warn b { color: var(--warn); } .chip.ok b { color: var(--ok); }
/* ⓘ vysvetlenie */
.tip { position: relative; display: inline-flex; vertical-align: middle; }
button.tip-i { width: 18px; height: 18px; min-height: 0; padding: 0; border-radius: 50%; border: 1.5px solid #9aa8b4; background: #fff; color: #5b6b75; font: italic 700 11px/1 Georgia, serif; justify-content: center; }
button.tip-i:hover, .tip.open button.tip-i { border-color: var(--brand); color: var(--brand-ink); }
.tip-text { display: none; position: absolute; z-index: 30; top: 24px; right: -8px; width: 300px; white-space: normal; padding: 10px 12px; border-radius: 10px; background: #14212b; color: #fff; font-size: .85rem; font-weight: 400; line-height: 1.4; text-align: left; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.tip:hover .tip-text, .tip.open .tip-text, button.tip-i:focus + .tip-text { display: block; }
.kpi-title .tip-text { right: auto; left: -8px; }
.kpi { display: grid; gap: 5px; } .kpi.no { border-left: 4px solid var(--bad); padding-left: 12px; } .kpi.yes { border-left: 4px solid var(--ok); padding-left: 12px; }
.kpi-title { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--muted); text-transform: uppercase; font-size: .72rem; letter-spacing: .05em; }
.kpi-num { display: flex; align-items: baseline; gap: 8px; } .kpi-num .big { font-size: 1.35rem; } .kpi-pct { font-size: .95rem; font-weight: 700; color: var(--muted); }
.kpi button { justify-self: start; }
.kpi progress { width: 100%; height: 7px; border: 0; border-radius: 6px; overflow: hidden; background: #fde3e0; appearance: none; }
.kpi progress::-webkit-progress-bar { background: #fde3e0; border-radius: 6px; } .kpi progress::-webkit-progress-value { background: var(--ok); border-radius: 6px; }
.kpi progress::-moz-progress-bar { background: var(--ok); border-radius: 6px; }
.tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.tools input[type=search] { flex: 1 1 260px; }
.tools label { display: flex; align-items: center; gap: 6px; }
.th-sort { display: flex; align-items: center; gap: 4px; } th.r .th-sort { justify-content: flex-end; }
.sort-btns { display: inline-flex; flex-direction: column; line-height: 1; }
button.sb { background: none; border: 0; padding: 1px 4px; margin: 0; font-size: .78rem; line-height: 1; color: #9aa8b4; cursor: pointer; box-shadow: none; min-height: 0; }
button.sb:hover { color: var(--brand-ink); background: none; } button.sb.on { color: var(--brand); }
tr.filters th { position: static; background: #fff; padding-top: 4px; padding-bottom: 8px; }
tr.filters input, tr.filters select { width: 100%; min-width: 0; padding: 5px 7px; font-size: .82rem; font-weight: 400; }
tr.filters .f-num { width: 100%; min-width: 64px; max-width: 120px; text-align: right; }
.tbl-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: .8rem; color: var(--muted); font-weight: 600; white-space: nowrap; background: #f7fafc; position: sticky; top: 0; }
td.r, th.r { text-align: right; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f0f8fd; }
tr.ignored td { opacity: .55; }
.name { font-weight: 600; }
.code { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; color: var(--muted); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.tag.bad { background: var(--bad-bg); color: var(--bad); } .tag.warn { background: var(--warn-bg); color: var(--warn); } .tag.ok { background: var(--ok-bg); color: var(--ok); } .tag.info { background: var(--info-bg); color: #34506b; }
.web-yes { color: var(--ok); font-weight: 700; } .web-no { color: var(--bad); font-weight: 700; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
/* detail */
.overlay { position: fixed; inset: 0; background: rgba(20, 30, 22, .35); z-index: 10; display: flex; justify-content: flex-end; }
.drawer { width: min(640px, 100%); height: 100%; overflow-y: auto; background: var(--bg); padding: 16px; box-shadow: -8px 0 24px rgba(0,0,0,.15); }
.drawer h2 { margin: 0 0 4px; font-size: 1.2rem; }
.drawer h3 { margin: 0 0 8px; font-size: .95rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.verdict { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 12px; font-weight: 700; }
.verdict.yes { background: var(--ok-bg); color: var(--ok); } .verdict.no { background: var(--bad-bg); color: var(--bad); } .verdict.info { background: var(--info-bg); color: #34506b; }
.tag.brani { background: #e3f4fc; color: var(--brand-ink); } .tag.shoptet { background: #eef7e6; color: #3b6d1c; }
.hist .nw, .hist td:nth-child(5) { white-space: nowrap; } .hist td:first-child { min-width: 110px; } .hist .reasons { font-weight: 400; margin: 0; padding-left: 16px; }
h4.sub { margin: 12px 0 4px; font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
table.restocks { width: auto; min-width: 220px; } table.restocks td { padding: 4px 12px 4px 0; border-bottom: 1px solid var(--line); } table.restocks td.r { font-weight: 700; }
.tbl-wrap.tall { max-height: 460px; overflow: auto; }
.verdict .big { font-size: 1.6rem; line-height: 1; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.stat small { display: block; color: var(--muted); font-size: .78rem; }
.stat b { font-size: 1.2rem; }
.stat.main { border-color: var(--brand); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 600; }
.close { float: right; }
@media (max-width: 640px) {
  main { padding: 10px; }
  .summary { grid-template-columns: 1fr; } .chip { flex: 1 1 calc(50% - 4px); white-space: normal; } .tip-text { width: 220px; }
  .status { grid-template-columns: 1fr; }
  th.hide-m, td.hide-m { display: none; }
}

.reasons { margin: 6px 0; padding-left: 18px; font-weight: 600; }
textarea { font: inherit; padding: 9px 12px; border: 2px solid var(--line); border-radius: 10px; width: 100%; resize: vertical; }
input[type=number] { font: inherit; padding: 9px 12px; border: 2px solid var(--line); border-radius: 10px; width: 120px; }
select { font: inherit; padding: 8px 10px; border: 2px solid var(--line); border-radius: 10px; background: #fff; }

/* nastavenia */
.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 0 14px; align-items: start; }
.settings > * { min-width: 0; } /* široká tabuľka nesmie roztiahnuť stĺpec (mobil) */
.settings .card h3, .settings h4 { margin: 0 0 10px; font-size: .95rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.settings h4 { margin-top: 14px; font-size: .85rem; }
.settings .wide { grid-column: 1 / -1; }
.settings td input[type=password] { width: 150px; }
.form { display: grid; gap: 12px; }
.form.cols { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.field { display: grid; gap: 4px; } .field > span { font-weight: 600; font-size: .9rem; } .field small { font-size: .8rem; }
.field input[type=text], .field input[type=password], .field select { width: 100%; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.check { display: inline-flex; align-items: center; gap: 4px; font-size: .9rem; }
button.small { padding: 5px 10px; font-size: .85rem; }
ul.plain { list-style: none; padding: 0; margin: 6px 0; } ul.plain li { padding: 2px 0; }
table.roles td { border: 0; padding: 3px 10px 3px 0; }
@media (max-width: 520px) { .settings { grid-template-columns: 1fr; } }

/* tabuľka produktov: na počítači hlavička (radenie + filtre) prilepená pod hornou lištou */
@media (min-width: 901px) {
  .tbl-wrap.sticky { overflow: visible; }
  .tbl-wrap.sticky thead { position: sticky; top: var(--bar-h, 58px); z-index: 4; box-shadow: 0 2px 4px rgba(20,33,43,.06); }
  .tbl-wrap.sticky thead th { position: static; }
}
/* Príjmy na mobile: kartičky s popisom pri každej hodnote */
@media (max-width: 900px) {
  table.cards, table.cards tbody { display: block; } table.cards thead { display: none; }
  table.cards tbody tr { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  table.cards tbody td { display: block; padding: 0; border: 0; text-align: left; }
  table.cards tbody td.wide { flex: 1 1 100%; }
  table.cards tbody td:not(.wide)::before { content: attr(data-label) ': '; color: var(--muted); font-size: .8rem; }
}
/* mobil a tablet: panel hľadania a filtrov namiesto hlavičky, každý produkt ako kartička */
.mtools { display: none; }
@media (max-width: 900px) {
  .mtools { display: grid; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 8px;
    position: sticky; top: var(--bar-h, 58px); z-index: 4; box-shadow: 0 2px 6px rgba(20,33,43,.06); }
  .msearch { width: 100%; }
  .mrow { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; }
  .mf { display: grid; gap: 2px; min-width: 0; } .mf > span { font-size: .72rem; color: var(--muted); font-weight: 600; }
  .mf select, .mf input { width: 100%; min-width: 0; padding: 7px 8px; font-size: .9rem; }
  .mrow { grid-template-columns: 1.25fr 1fr auto; }
  .mfbtn { background: #fff; color: var(--brand-ink); padding: 7px 10px; white-space: nowrap; }
  .mfbtn.act { background: var(--brand); color: #fff; } .mfbtn .car { font-size: .8rem; }
  .mpanel { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; padding-top: 8px; border-top: 1px solid var(--line); }
  .mpanel .mhint { grid-column: 1 / -1; margin: 0; } .mpanel button { grid-column: 1 / -1; justify-self: start; }
  table.items, table.items tbody { display: block; } table.items thead { display: none; }
  .tbl-wrap.sticky { border-radius: 12px; }
  table.items tbody tr { display: flex; flex-wrap: wrap; gap: 2px 14px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  table.items tbody td { display: block; padding: 0; border: 0; text-align: left; }
  /* poradie v kartičke: názov → stav → sklad · Shoptet · doskladnené → web */
  table.items tbody td:nth-child(2) { order: -2; flex: 1 1 100%; } table.items tbody td:nth-child(2) .name { font-weight: 700; }
  table.items tbody td:nth-child(1) { order: -1; flex: 1 1 100%; margin-bottom: 2px; }
  table.items tbody td:nth-child(3) { order: 1; } table.items tbody td:nth-child(4) { order: 2; } table.items tbody td:nth-child(6) { order: 3; }
  table.items tbody td:nth-child(5) { order: 4; flex: 1 1 100%; }
  table.items tbody td.none { display: none; }
  table.items tbody td:nth-child(n+3)::before { content: attr(data-label) ': '; color: var(--muted); font-size: .8rem; font-weight: 400; }
  table.items tbody td:nth-child(3), table.items tbody td:nth-child(4) { font-weight: 700; }
  table.items tbody td.empty { flex: 1 1 100%; } table.items tbody td.empty::before { content: none; }
}
table.items tbody td.diff { color: var(--warn); font-weight: 700; }

/* záložky: jeden riadok, rovnaká šírka */
.tabs { display: flex; gap: 0; border: 2px solid var(--brand); border-radius: 10px; overflow: hidden; max-width: 560px; }
.tabs button { flex: 1 1 0; min-width: 0; justify-content: center; margin: 0; border: 0; border-radius: 0; background: #fff; color: var(--brand-ink); white-space: nowrap; padding: 8px 6px; }
.tabs button + button { border-left: 2px solid var(--brand); }
.tabs button.on { background: var(--brand); color: #fff; }
.tabs .s { display: none; }
@media (max-width: 520px) { .tabs .l { display: none; } .tabs .s { display: inline; } .tabs { max-width: none; } }

/* dvojfaktorové overenie */
input.code { font-size: 1.4rem; letter-spacing: .15em; text-align: center; max-width: 220px; }
img.qr { display: block; margin: 8px 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
code.secret { display: inline-block; margin-top: 4px; padding: 4px 8px; background: var(--info-bg); border-radius: 6px; word-break: break-all; }
ol.steps { padding-left: 20px; display: grid; gap: 12px; }
.recovery ul.rc { columns: 2; list-style: none; padding: 0; font-size: 1.05rem; }
.recovery ul.rc li { padding: 2px 0; }
.card.login.wide-login { max-width: 520px; }

/* Nastavenia na mobile: jeden stĺpec, menšie okraje, popisy pod sebou, používatelia ako kartičky */
@media (max-width: 640px) {
  .settings .card { padding: 14px; }
  .settings .kv { grid-template-columns: 1fr; gap: 0; } .settings .kv dd { margin-bottom: 8px; }
  .settings .form.cols { grid-template-columns: 1fr; }
  .settings .checks { gap: 8px 14px; } .settings .check { font-size: .95rem; padding: 2px 0; }
  .settings textarea, .settings input[type=text], .settings input[type=number], .settings select { width: 100%; }
  .settings input[type=number] { max-width: 140px; }
  .settings .field small { font-size: .82rem; }
  table.users, table.users tbody { display: block; } table.users thead { display: none; }
  table.users tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  table.users td { display: block; padding: 0; border: 0; }
  table.users td:first-child, table.users td.wide { grid-column: 1 / -1; }
  table.users td[data-label]::before { content: attr(data-label); display: block; font-size: .72rem; color: var(--muted); font-weight: 600; }
  table.users td input[type=password] { width: 100%; }
  .settings .tbl-wrap.users-wrap { border: 0; background: none; overflow: visible; }
  table.roles tr { display: grid; } table.roles td { padding: 0 0 2px; } table.roles tr + tr { margin-top: 8px; }
}

/* horná lišta: Nastavenia len ako biela ikona */
button.bar-icon { background: none; border: 0; padding: 6px; border-radius: 10px; line-height: 0; }
button.bar-icon svg { width: 26px; height: 26px; display: block; }
button.bar-icon:hover, button.bar-icon.on { background: rgba(255,255,255,.22); }
button.bar-icon:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
