/* Vizuál převzatý z aplikace Coolpet expedice: papírové pozadí, zelený akcent, tiché tabulky. */
:root {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --line: #e1dfd8;
  --line-strong: #cfccc3;
  --text: #1c1c1a;
  --muted: #6d6b64;
  --accent: #1f6b45;
  --accent-hover: #185a39;
  --danger: #b3261e;
  --danger-bg: #fbeceb;
  --warn: #8a5a00;
  --warn-bg: #fdf3dc;
  --ok: #1f6b45;
  --ok-bg: #e6f2eb;
  --info: #2c5282;
  --info-bg: #e9eff7;
  --pending: #fdf3dc;
  --hover: #faf9f6;
  --radius: 4px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  color: var(--text);
  color-scheme: light;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.45; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--info); }
[hidden] { display: none !important; }
.boot { padding: 40px 24px; color: var(--muted); }
.muted { color: var(--muted); }
.up { color: var(--danger); }
.down { color: var(--ok); }

/* Horní lišta */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { flex: 1; font-weight: 650; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; }
.brand span { color: var(--muted); font-weight: 400; }
.topbar-actions { display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: 13px; }
.fresh { white-space: nowrap; }
.fresh.stale { color: var(--warn); }
.who { white-space: nowrap; }

/* Stránka a záložky */
.page { max-width: 1280px; margin: 0 auto; padding: 16px 24px 120px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tab {
  border: 0; background: none; padding: 8px 12px; cursor: pointer; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab b { font-weight: 600; color: var(--warn); margin-left: 4px; font-variant-numeric: tabular-nums; }
.tab.on { color: var(--text); border-bottom-color: var(--text); }

h2 { font-size: 13px; font-weight: 600; margin: 0 0 6px; }
.lead { color: var(--muted); font-size: 13px; margin: 0 0 12px; max-width: 860px; }
.scope-note { color: var(--muted); font-size: 12px; margin-top: 10px; }
.help { color: var(--muted); font-size: 12px; }

/* Přehled */
.summary { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 20px; }
.figure { padding: 14px 18px; border-left: 1px solid var(--line); }
.figure:first-child { border-left: 0; }
.figure[data-go] { cursor: pointer; }
.figure[data-go]:hover { background: var(--hover); }
.figure .label { color: var(--muted); font-size: 12px; }
.figure .value { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; margin-top: 2px; }
.figure .value small { font-size: 13px; font-weight: 400; color: var(--muted); }
.figure .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.meter { height: 3px; background: var(--line); margin-top: 8px; }
.meter > i { display: block; height: 100%; background: var(--accent); width: 0; }
.two-col { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 24px; align-items: start; }
table.list td { padding: 9px 14px; }
table.list tr[data-warn], table.list tr[data-go] { cursor: pointer; }

/* Ovládací prvky */
.btn {
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--radius);
  padding: 6px 12px; cursor: pointer; white-space: nowrap; text-decoration: none; color: var(--text); display: inline-block;
}
.btn:hover { background: #f7f6f2; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 550; }
.btn.primary:hover { background: var(--accent-hover); }
.btn-quiet { border-color: var(--line); color: var(--muted); }
.btn-quiet:hover { border-color: var(--line-strong); color: var(--text); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 2px 8px; font-size: 13px; }
.btn.wide { width: 100%; padding: 8px 12px; }
.linkbtn { border: 0; background: none; color: var(--info); cursor: pointer; padding: 0; }

input.num, input.txt, .filters select, .filters input[type=search], .field input, .field select {
  padding: 5px 8px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); min-height: 30px;
}
input.num { width: 92px; text-align: right; font-variant-numeric: tabular-nums; }
input.txt { width: 100%; min-width: 140px; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }
input.num::placeholder { color: #a9a69d; }

/* Filtry */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filters input[type=search] { width: 240px; }
.filters select { max-width: 100%; min-width: 0; }
.filters label.chk, label.chk { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); white-space: nowrap; }
.filters .grow, .grow { flex: 1; }
.filters.spread { justify-content: space-between; }
.count { color: var(--muted); font-size: 12px; white-space: nowrap; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg button { border: 0; border-left: 1px solid var(--line); background: none; padding: 5px 10px; cursor: pointer; color: var(--muted); }
.seg button:first-child { border-left: 0; }
.seg button.on { background: var(--text); color: #fff; }

/* Tabulky */
.tablewrap, .table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 12px;
  padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none;
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
th.nosort { cursor: default; }
th .arr { color: var(--text); font-size: 10px; }
td { padding: 7px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--hover); }
tr.pending td { background: var(--pending); }
td.r, th.r { text-align: right; }
td.wrap { white-space: normal; min-width: 220px; }
td.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.src { color: var(--muted); font-size: 12px; white-space: normal; min-width: 140px; }
.more { padding: 10px; text-align: center; border-top: 1px solid var(--line); }
.sugg { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font-variant-numeric: tabular-nums; text-decoration: underline dotted; text-underline-offset: 3px; }
.sugg::before { content: "návrh "; color: var(--muted); text-decoration: none; display: inline-block; margin-right: 2px; }

/* Stav: tečka + text, stejně jako v expedici */
.state { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; margin-right: 10px; }
.state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); flex: none; }
.state.bad { color: var(--danger); font-weight: 500; }
.state.bad::before { background: var(--danger); }
.state.warn::before { background: #c9a227; }
.state.info::before { background: var(--info); }
.state.ok::before { background: var(--ok); }
.state.done { color: var(--muted); }
.state.done::before { background: #b5b2a9; }
.tag { color: var(--muted); font-size: 12px; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 5px; margin-left: 4px; white-space: nowrap; }

/* Hromadné akce */
.bulk { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 12px; margin-bottom: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

/* Spodní lišta neuložených změn */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--surface); border-top: 1px solid var(--line-strong); }
.dock-in { max-width: 1280px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dock .sum { flex: 1; min-width: 240px; }
.dock .sum b { font-variant-numeric: tabular-nums; font-weight: 600; }

/* Modální okno */
.modal-bg { position: fixed; inset: 0; background: rgba(28, 28, 26, .25); display: flex; align-items: center; justify-content: center; z-index: 30; padding: 16px; }
.modal { background: var(--surface); width: min(900px, 94vw); max-height: 86vh; overflow: auto; border-radius: var(--radius); padding: 16px 20px 20px; }
.modal h2 { font-size: 16px; font-weight: 650; margin: 0 0 12px; }
.modal .acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.modal .summary { grid-template-columns: repeat(3, 1fr); }

/* Přihlášení */
.auth { max-width: 380px; margin: 12vh auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.auth h1 { font-size: 16px; font-weight: 650; margin: 0 0 2px; }
.field { display: flex; flex-direction: column; gap: 4px; margin: 12px 0; }
.field label { font-size: 12px; color: var(--muted); }
.field input { width: 100%; }
.err { color: var(--danger); min-height: 20px; margin: 6px 0; }
.secret { font-family: ui-monospace, Consolas, monospace; font-size: 14px; letter-spacing: 1px; background: var(--bg); border: 1px solid var(--line); padding: 8px 10px; border-radius: var(--radius); word-break: break-all; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 4px 24px; max-width: 860px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 20px 16px; margin-bottom: 20px; }

/* Hláška */
#toast { position: fixed; left: 24px; bottom: 72px; background: var(--text); color: #fff; padding: 10px 14px; border-radius: var(--radius); max-width: min(520px, calc(100vw - 48px)); line-height: 1.45; opacity: 0; transition: opacity .15s; pointer-events: none; z-index: 40; }
#toast.on { opacity: 1; }

.two-col > section { min-width: 0; }
@media (max-width: 1100px) { .two-col { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) {
  .two-col { grid-template-columns: minmax(0, 1fr); }
  .summary { grid-template-columns: repeat(2, 1fr); }
  .figure:nth-child(3) { border-left: 0; }
  .figure:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 760px) {
  .topbar { padding: 8px 12px; gap: 8px; flex-wrap: wrap; }
  .topbar-actions { gap: 8px; font-size: 12px; }
  .who { display: none; }
  .page { padding: 12px 12px 140px; }
  .filters input[type=search] { width: 100%; }
  th, td { padding: 7px 10px; }
  .dock-in { padding: 8px 12px; }
  #toast { left: 12px; bottom: 120px; }
}
.qr { width: 200px; margin: 8px auto 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.qr svg { display: block; width: 100%; height: auto; }
.manual { margin: 0 0 8px; }
.manual summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.manual .secret { margin-top: 8px; }
