:root {
  --bg: #f1f5f9; --card: #ffffff; --ink: #0f172a; --muted: #64748b; --line: #e2e8f0;
  --accent: #2563eb; --accent-ink: #ffffff; --warn: #b45309; --late: #b91c1c; --good: #047857; --house: #7c3aed;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0b1220; --card: #111a2e; --ink: #e5e7eb; --muted: #94a3b8; --line: #1f2a44; --accent: #60a5fa; --accent-ink: #0b1220; --warn: #fbbf24; --late: #f87171; --good: #34d399; --house: #a78bfa; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
header { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 12px 16px 8px; border-bottom: 1px solid var(--line); padding-top: max(12px, env(safe-area-inset-top)); }
.top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
h1 { margin: 0; font-size: 20px; }
h2 { margin: 24px 0 10px; font-size: 15px; letter-spacing: .02em; text-transform: uppercase; color: var(--muted); }
main { max-width: 1100px; margin: 0 auto; padding: 0 16px 64px; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.count { font-weight: 400; }

.who { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-bottom: 4px; }
.who button { flex: 0 0 auto; border: 2px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 8px 14px; font: inherit; font-weight: 600; min-height: 44px; }
.who button[aria-checked="true"] { border-color: var(--c); box-shadow: inset 0 0 0 2px var(--c); }
.who .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-right: 6px; }
.who .zz { margin-left: 6px; font-size: 12px; color: var(--muted); font-weight: 400; }
.me-bar { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; font-size: 14px; }
.switch { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; }
.switch input { width: 20px; height: 20px; }

.push-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; }
.push-bar button { min-height: 40px; padding: 6px 12px; border-radius: 10px; font-weight: 600; }
#push-on { border: 0; background: var(--accent); color: var(--accent-ink); }
.banner { margin: 16px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); }
.list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.empty { color: var(--muted); padding: 6px 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; border-left: 6px solid var(--line); }
.card.late { border-left-color: var(--warn); } .card.very-late { border-left-color: var(--late); } .card.house { border-left-color: var(--house); }
.card.owned { border-left-color: var(--c); } .card.finished { opacity: .75; border-left-color: var(--good); }
.card h3 { margin: 0; font-size: 17px; line-height: 1.25; }
.meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.tag { font-weight: 600; } .tag.late { color: var(--warn); } .tag.very-late { color: var(--late); } .tag.house { color: var(--house); }
.note { font-size: 13px; color: var(--muted); margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
button { font: inherit; }
.actions button, .add button { min-height: 44px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--ink); font-weight: 600; }
.actions button.primary, .add button { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.actions button.quiet { color: var(--muted); font-weight: 500; }
button:disabled { opacity: .5; }

.week { display: grid; gap: 8px; }
.week .row { display: grid; grid-template-columns: 84px 1fr auto; align-items: center; gap: 10px; font-size: 14px; }
.week .bar { height: 12px; border-radius: 6px; background: var(--line); overflow: hidden; }
.week .bar i { display: block; height: 100%; background: var(--c); border-radius: 6px; }

.top { flex-wrap: wrap; }
.new-job { margin-left: auto; min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
#clock { order: 3; flex-basis: 100%; font-size: 13px; }
.add { display: grid; gap: 10px; max-width: 560px; }
.add input[type="text"], .add input:not([type]), .add select { min-height: 44px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; }
.add-row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; }
.add-row label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.add-row button { min-height: 44px; padding: 8px 18px; border-radius: 10px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; margin-left: auto; }
.photo-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.photo-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 10px 16px; border-radius: 12px; border: 2px dashed var(--line); background: var(--card); font-weight: 600; cursor: pointer; }
.photo-btn:focus-within { outline: 2px solid var(--accent); }
button.quiet { min-height: 44px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--muted); }
.preview { max-width: 100%; max-height: 240px; border-radius: 12px; border: 1px solid var(--line); object-fit: contain; background: #000; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.card .thumb { display: block; width: 100%; padding: 0; border: 0; background: none; border-radius: 10px; overflow: hidden; }
.card .thumb img { display: block; width: 100%; max-height: 190px; object-fit: cover; }
.lightbox { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.92); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px; }
.lightbox img { max-width: 100%; max-height: 82vh; border-radius: 8px; }
.lightbox button { min-height: 44px; padding: 8px 22px; border-radius: 999px; border: 0; background: #fff; color: #000; font-weight: 700; }

.pair { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 20px; }
.pair-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px; display: grid; gap: 12px; }
.pair-card h2 { margin: 0; font-size: 20px; text-transform: none; letter-spacing: 0; color: var(--ink); }
.pair-card p { margin: 0; color: var(--muted); font-size: 14px; }
.pair-card input { min-height: 56px; font: 600 26px/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .12em; text-align: center; text-transform: uppercase; border-radius: 12px; border: 2px solid var(--line); background: var(--bg); color: var(--ink); }
.pair-card button, #invite-share { min-height: 48px; border-radius: 12px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; padding: 8px 18px; }
.pair-error { color: var(--late) !important; min-height: 1.2em; }
.phones { display: grid; gap: 6px; margin-bottom: 10px; font-size: 14px; }
.phones .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.phones .row button { min-height: 36px; padding: 4px 10px; }
.invite-box { margin-top: 12px; display: grid; gap: 10px; max-width: 380px; }
.invite-code { margin: 0; font: 700 34px/1.1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .1em; }
.toast { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px; max-width: 90vw; z-index: 10; }
[hidden] { display: none !important; }
