:root {
  --bg: #121212; --card: #1e1e1e; --line: #2c2c2c; --text: #f2f2f2; --muted: #9a9a9a;
  --yellow: #fcb800; --yellow-ink: #202020; --green: #35c46a; --red: #ff5d5d; --blue: #5aa2ff;
  --viber: #7360f2;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f4f2; --card: #fff; --line: #e3e3df; --text: #1c1c1c; --muted: #6b6b6b;
    --green: #1f9d4f; --red: #d63a3a; --blue: #2468d6;
    color-scheme: light;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh; padding-bottom: env(safe-area-inset-bottom);
  -webkit-text-size-adjust: 100%; touch-action: manipulation;
}
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
h1, h2 { margin: 0; }
.muted { color: var(--muted); font-size: .875rem; }

/* login */
#login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
#login-form { width: 100%; max-width: 340px; display: grid; gap: 14px; text-align: center; }
#login-form .logo { margin: 0 auto; width: 240px; max-width: 70%; height: auto; }
.logo-s { height: 28px; width: auto; vertical-align: middle; margin-right: 6px; }
#login-form label { display: grid; gap: 6px; text-align: left; font-size: .875rem; color: var(--muted); }
input, textarea {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); font-size: 16px; /* 16px: iOS ne zoomoljon */
}
textarea { resize: vertical; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 15px; }
.err { color: var(--red); min-height: 1.4em; margin: 0; }

/* gombok */
.btn {
  border: 0; border-radius: 12px; padding: 13px 16px; font-weight: 600; cursor: pointer;
  background: var(--line); min-height: 48px;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--yellow); color: var(--yellow-ink); }
.btn.viber { background: var(--viber); color: #fff; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.small { padding: 8px 12px; min-height: 36px; font-size: .875rem; }
.btn:disabled { opacity: .5; }

/* fejléc */
.top {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(12px + env(safe-area-inset-top)) 16px 8px;
}
.top h1 { font-size: 1.3rem; display: flex; align-items: center; }
.top-r { display: flex; align-items: center; gap: 10px; }
.live { color: var(--muted); font-size: .8rem; }
.live.on { color: var(--green); }
.tabs { display: flex; gap: 8px; padding: 0 16px 12px; background: var(--bg); }
.tabs button {
  flex: 1; border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 8px 10px; cursor: pointer;
}
.tabs button.on { background: var(--yellow); color: var(--yellow-ink); border-color: var(--yellow); font-weight: 600; }
.tabs b { margin-left: 4px; opacity: .8; }

/* lista */
#list { display: grid; gap: 12px; padding: 4px 16px 32px; max-width: 720px; margin: 0 auto; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: grid; gap: 10px; }
.card.fresh { border-color: var(--yellow); box-shadow: 0 0 0 2px color-mix(in srgb, var(--yellow) 35%, transparent); }
.card.done { opacity: .6; }
.row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.num { font-weight: 700; font-size: 1.05rem; }
.time { color: var(--muted); font-size: .875rem; }
.addr { font-size: 1.05rem; font-weight: 600; overflow-wrap: anywhere; }
.addr small { display: block; font-weight: 400; color: var(--muted); font-size: .9rem; }
.who { overflow-wrap: anywhere; }
.who a { color: var(--blue); text-decoration: none; }
.pay { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: .85rem; font-weight: 600; }
.pay.fizetve { background: color-mix(in srgb, var(--green) 22%, transparent); color: var(--green); }
.pay.keszpenz, .pay.szep { background: color-mix(in srgb, var(--yellow) 25%, transparent); color: var(--yellow); }
.pay.egyeb { background: var(--line); color: var(--muted); }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .pay.keszpenz, :root:not([data-theme="dark"]) .pay.szep { color: #8a6300; } }
.badge { padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--line); white-space: nowrap; }
.badge.uj { background: var(--yellow); color: var(--yellow-ink); }
.badge.keszul, .badge.opd_kerve { background: color-mix(in srgb, var(--blue) 25%, transparent); color: var(--blue); }
.badge.opd_visszaigazolt, .badge.atadva { background: color-mix(in srgb, var(--viber) 30%, transparent); color: #b6acff; }
.badge.kiszallitva { background: color-mix(in srgb, var(--green) 25%, transparent); color: var(--green); }
.badge.torolve { background: color-mix(in srgb, var(--red) 25%, transparent); color: var(--red); }
.eta { font-weight: 600; }
.eta.late { color: var(--red); }
details summary { cursor: pointer; color: var(--muted); font-size: .9rem; padding: 4px 0; }
details ul { margin: 6px 0 0; padding-left: 18px; }
details li small { color: var(--muted); display: block; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.card-actions .btn { flex: 1 1 auto; }

/* sheet */
.sheet { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.sheet-body {
  position: relative; width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto;
  background: var(--bg); border-radius: 20px 20px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  display: grid; gap: 10px; overscroll-behavior: contain;
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sheet-head h2 { font-size: 1.15rem; }
.lbl { margin: 6px 0 0; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 12px 0; min-width: 64px; flex: 1 1 64px; font-weight: 600; cursor: pointer; }
.chips button.on { background: var(--yellow); color: var(--yellow-ink); border-color: var(--yellow); }
.custom { display: flex; align-items: center; gap: 12px; }
.custom input { max-width: 170px; }
.ready { font-weight: 700; }
.actions { display: grid; gap: 8px; margin-top: 4px; }
.note { margin: 0; min-height: 1.2em; }
.toast {
  position: fixed; left: 50%; top: calc(12px + env(safe-area-inset-top)); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; z-index: 40; font-weight: 600; max-width: 90vw;
}
@media (prefers-reduced-motion: no-preference) {
  .card { animation: in .25s ease-out; }
  @keyframes in { from { opacity: 0; transform: translateY(6px); } }
}

.opd-reply { border: 1px dashed var(--line); border-radius: 12px; padding: 10px; display: grid; gap: 6px; }
.opd-reply .lbl { margin: 0; font-size: .9rem; }
.opd-reply .chips button { padding: 10px 0; min-width: 56px; }

.daynav { display: flex; gap: 8px; align-items: center; padding: 0 16px 6px; max-width: 720px; margin: 0 auto; }
.daynav input { flex: 1; min-width: 0; text-align: center; padding: 8px 10px; }
.daynav .btn { min-width: 44px; }
.day-sum { margin: 0; padding: 0 16px 10px; max-width: 720px; margin: 0 auto; }
.tabs { max-width: 720px; margin: 0 auto; }
