:root {
  color-scheme: light dark;
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #14171c;
  --muted: #667085;
  --line: #e4e7ec;
  --accent: #ff5a00;
  --accent-text: #ffffff;
  --ok: #12a150;
  --err: #d92d20;
  --radius: 22px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0e14;
    --card: #151a23;
    --text: #f2f4f7;
    --muted: #98a2b3;
    --line: #232a36;
    --ok: #32d583;
    --err: #f97066;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.top { display: flex; align-items: center; gap: 12px; padding: 20px 4px 8px; }
.top .logo { width: 44px; height: 44px; border-radius: 12px; }
.top h1 { font-size: 20px; margin: 0; line-height: 1.2; }
.top small { color: var(--muted); font-size: 14px; display: block; }

main { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 16px; padding: 12px 0 28px; }

.big {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 28dvh; border: 0; border-radius: var(--radius);
  font: inherit; font-size: 24px; font-weight: 650; cursor: pointer;
  background: var(--card); color: var(--text);
  box-shadow: 0 1px 0 var(--line) inset, 0 8px 24px rgba(0,0,0,.06);
  transition: transform .12s ease, opacity .2s;
}
.big svg { font-size: 56px; }
.big.arrive { background: var(--accent); color: var(--accent-text); }
.big:active { transform: scale(.98); }
.big:disabled { opacity: .55; }

.status {
  min-height: 56px; display: flex; align-items: center; justify-content: center; gap: 10px;
  text-align: center; border-radius: 16px; padding: 12px 16px; font-weight: 600;
  background: transparent; color: var(--muted);
}
.status.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.status.err { color: var(--err); background: color-mix(in srgb, var(--err) 12%, transparent); flex-direction: column; }
.status svg { font-size: 24px; }
.retry {
  border: 0; border-radius: 12px; padding: 10px 20px; font: inherit; font-weight: 650;
  background: var(--err); color: #fff; cursor: pointer;
}
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.card { background: var(--card); border-radius: var(--radius); padding: 22px; border: 1px solid var(--line); }
.card h2 { margin: 0 0 8px; font-size: 20px; }
.card p, .card li { color: var(--muted); }
.card ol { padding-left: 20px; margin: 12px 0 0; }
.card li { margin: 8px 0; }
.inline-icon { display: inline-block; vertical-align: -3px; color: var(--accent); font-size: 20px; }

/* Admin */
.wrap { width: 100%; max-width: 760px; margin: 0 auto; }
.admin main { justify-content: flex-start; }
.admin h2 { font-size: 18px; margin: 20px 4px 8px; }
input[type=text], input[type=password] {
  width: 100%; padding: 13px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font: inherit;
}
.btn {
  border: 0; border-radius: 12px; padding: 12px 18px; font: inherit; font-weight: 650; cursor: pointer;
  background: var(--accent); color: var(--accent-text); white-space: nowrap;
}
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); padding: 8px 12px; font-size: 14px; }
.btn.danger { color: var(--err); }
.row { display: flex; gap: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.tbl { overflow-x: auto; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 650; background: var(--line); color: var(--muted); }
.pill.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.pill.err { background: color-mix(in srgb, var(--err) 15%, transparent); color: var(--err); }
.link-box { word-break: break-all; font: 13px/1.4 ui-monospace, Menlo, Consolas, monospace; background: var(--bg); border-radius: 10px; padding: 10px; margin-top: 8px; color: var(--text); }

/* Modal se stavem akce */
.overlay {
  position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(0,0,0,.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fade .18s ease;
}
.overlay[hidden] { display: none; }
.modal {
  position: relative; overflow: hidden; width: 100%; max-width: 360px; text-align: center;
  background: var(--card); border-radius: 28px; padding: 36px 24px 28px;
  box-shadow: 0 24px 60px rgba(0,0,0,.35); animation: pop .22s cubic-bezier(.2,1.2,.4,1);
}
.m-icon svg { font-size: 84px; }
.modal.busy .m-icon { color: var(--accent); }
.modal.ok .m-icon { color: var(--ok); }
.modal.err .m-icon { color: var(--err); }
.m-title { font-size: 26px; font-weight: 700; margin-top: 12px; }
.m-text { color: var(--muted); margin-top: 4px; min-height: 1.4em; }
.m-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
.m-actions:empty { display: none; }
.m-btn {
  border: 0; border-radius: 16px; padding: 16px; font: inherit; font-size: 18px; font-weight: 650; cursor: pointer;
  background: var(--accent); color: var(--accent-text);
}
.m-btn.ghost { background: transparent; color: var(--muted); }
.m-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: var(--line); }
.m-bar[hidden] { display: none; }
.m-bar i { display: block; height: 100%; width: 100%; background: var(--ok); transform-origin: left; }
@keyframes drain { to { transform: scaleX(0); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.9); opacity: 0; } }
