/* Layout: semana em faixas por dia; dentro de cada dia, uma coluna por carrinho com seus turnos. */
:root {
  --bg: #eef2f0;
  --surface: #ffffff;
  --surface-2: #f6f8f7;
  --ink: #16201c;
  --muted: #5a6762;
  --line: #d8e0dc;
  --accent: #1d6b57;
  --accent-ink: #ffffff;
  --ok: #24764a;
  --ok-bg: #e2f2e8;
  --wait: #9a5b0b;
  --wait-bg: #fbefd9;
  --warn: #b3261e;
  --warn-bg: #fbe6e4;
  --pend: #3a55b0;
  --pend-bg: #e4e9fa;
  --cart-1: #2563c9;
  --cart-2: #c4511a;
  --cart-3: #7b45c4;
  --cart-4: #0f7d86;
  --cart-5: #a3346a;
  --today: #fff8e6;
  --shadow: 0 1px 2px rgba(22,32,28,.06), 0 2px 8px rgba(22,32,28,.05);
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1513; --surface: #18201d; --surface-2: #1d2622; --ink: #e6ece9; --muted: #9ba8a2; --line: #2b3632;
    --accent: #5cc3a3; --accent-ink: #0c1a15; --ok: #74d39c; --ok-bg: #173325; --wait: #f0b85c; --wait-bg: #3a2a10;
    --warn: #f28b82; --warn-bg: #3b1a18; --pend: #a9bcf7; --pend-bg: #1e2643; --cart-1: #7aa7f5; --cart-2: #f0905e; --cart-3: #b892f0; --cart-4: #5fc9d1; --cart-5: #e77fb0;
    --today: #2a2615; --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1513; --surface: #18201d; --surface-2: #1d2622; --ink: #e6ece9; --muted: #9ba8a2; --line: #2b3632;
  --accent: #5cc3a3; --accent-ink: #0c1a15; --ok: #74d39c; --ok-bg: #173325; --wait: #f0b85c; --wait-bg: #3a2a10;
  --warn: #f28b82; --warn-bg: #3b1a18; --pend: #a9bcf7; --pend-bg: #1e2643; --cart-1: #7aa7f5; --cart-2: #f0905e; --cart-3: #b892f0; --cart-4: #5fc9d1; --cart-5: #e77fb0;
  --today: #2a2615; --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.45; }
.wrap { max-width: 1180px; margin: 0 auto; padding-block: 20px 56px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: grid; gap: 20px; }

header.top { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 20px; }
h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.6rem, 4vw, 2.3rem); line-height: 1.05; margin: 0; letter-spacing: -.01em; text-wrap: balance; }
.sub { color: var(--muted); margin: 6px 0 0; font-size: .95rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

button { font: inherit; cursor: pointer; }
.btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 10px; padding: 9px 14px; font-weight: 700; font-size: .92rem; display: inline-flex; align-items: center; gap: 7px; min-height: 42px; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--warn); }
.btn.danger.armed { background: var(--warn); color: #fff; border-color: var(--warn); }
.btn svg { width: 17px; height: 17px; flex: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; box-shadow: var(--shadow); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); border-radius: 999px; padding: 6px 12px; font-size: .88rem; font-weight: 700; display: inline-flex; align-items: center; gap: 7px; min-height: 36px; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--muted)); flex: none; }
.search { flex: 1 1 220px; min-width: 0; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; background: var(--surface-2); }
.search svg { width: 17px; height: 17px; color: var(--muted); flex: none; }
.search input { border: 0; background: transparent; color: var(--ink); font: inherit; padding: 9px 0; width: 100%; min-width: 0; }
.search input:focus { outline: none; }
.search:focus-within { outline: 3px solid var(--accent); outline-offset: 1px; }

.notice { border-radius: 12px; padding: 12px 14px; font-size: .95rem; background: var(--surface); border: 1px dashed var(--line); color: var(--muted); }

.week { display: grid; gap: 14px; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.day.today { background: linear-gradient(var(--today), var(--today)) top / 100% 52px no-repeat, var(--surface); border-color: color-mix(in srgb, var(--wait) 45%, var(--line)); }
.dayhead { display: flex; align-items: baseline; gap: 10px; padding: 14px 16px 6px; }
.dayhead h2 { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; margin: 0; }
.tag-today { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--wait); background: var(--wait-bg); padding: 2px 8px; border-radius: 999px; }
.daycount { margin-left: auto; color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.cols { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 0; }
@media (max-width: 760px) { .cols { grid-template-columns: 1fr; } }
.col { padding: 8px 16px 16px; border-top: 1px solid var(--line); min-width: 0; display: grid; align-content: start; gap: 8px; }
@media (min-width: 761px) { .col + .col { border-left: 1px solid var(--line); } }
.colhead { display: flex; align-items: center; gap: 8px; font-size: .8rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding-top: 4px; }

.slot { --c: var(--muted); text-align: left; width: 100%; border: 1px solid var(--line); border-left: 5px solid var(--c); background: var(--surface-2); color: var(--ink); border-radius: 10px; padding: 10px 12px; display: grid; gap: 3px; }
button.slot:hover { border-color: var(--c); }
.slot .time { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.slot .names { font-weight: 700; overflow-wrap: anywhere; }
.slot .names.empty { color: var(--warn); font-weight: 700; }
.slot .place { color: var(--muted); font-size: .9rem; display: flex; gap: 5px; align-items: center; overflow-wrap: anywhere; }
.slot .place svg { width: 14px; height: 14px; flex: none; }
.slot .obs { font-size: .85rem; color: var(--muted); font-style: italic; overflow-wrap: anywhere; }
.pill { font-family: var(--font-body); font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; }
.pill.ok { color: var(--ok); background: var(--ok-bg); }
.pill.wait { color: var(--wait); background: var(--wait-bg); }
.pill.clash { color: var(--warn); background: var(--warn-bg); }
.pill.pend { color: var(--pend); background: var(--pend-bg); }
.slot.pedido { border-style: dashed; border-left-style: dashed; background: var(--surface); }
.slot.match { box-shadow: 0 0 0 2px var(--accent); }
.addslot { border: 1.5px dashed var(--line); background: transparent; color: var(--muted); border-radius: 10px; padding: 10px; font-weight: 700; font-size: .9rem; min-height: 44px; }
.addslot:hover { color: var(--accent); border-color: var(--accent); }
.vago { color: var(--muted); font-size: .9rem; padding: 6px 2px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: grid; gap: 12px; }
.panel h2 { font-family: var(--font-display); font-size: 1.2rem; margin: 0; }
.panel p { margin: 0; color: var(--muted); font-size: .92rem; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 16px; margin: 0; padding: 0; list-style: none; }
.people li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.people li button { border: 0; background: none; color: var(--ink); padding: 0; text-align: left; overflow-wrap: anywhere; font-weight: 700; }
.people li button:hover { color: var(--accent); text-decoration: underline; }
.people .n { font-variant-numeric: tabular-nums; color: var(--muted); }

dialog { border: 1px solid var(--line); border-radius: 16px; padding: 0; background: var(--surface); color: var(--ink); width: min(520px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(10,16,14,.45); }
.dlg { padding: 18px; display: grid; gap: 14px; }
.dlg h3 { font-family: var(--font-display); margin: 0; font-size: 1.25rem; }
.dlg .ctx { color: var(--muted); font-size: .9rem; margin-top: -8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 420px) { .grid2 { grid-template-columns: 1fr; } }
label.f { display: grid; gap: 4px; font-size: .85rem; font-weight: 700; color: var(--muted); min-width: 0; }
label.f input, label.f select, label.f textarea { font: inherit; font-weight: 400; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; width: 100%; min-width: 0; min-height: 42px; }
label.f textarea { min-height: 64px; resize: vertical; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: .9rem; cursor: pointer; background: var(--surface-2); }
.seg input { accent-color: var(--accent); }
.alert { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 9px 12px; font-size: .9rem; font-weight: 700; }
.dlg-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; }
.dlg-foot .r { display: flex; gap: 8px; margin-left: auto; }
.cartrows { display: grid; gap: 8px; }
.cartrow { display: flex; gap: 8px; align-items: center; }
.cartrow input { flex: 1; min-width: 0; font: inherit; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; }

.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 700; font-size: .92rem; z-index: 20; max-width: calc(100vw - 32px); }
.ro .edit-only { display: none !important; }
@media (prefers-reduced-motion: no-preference) { .slot, .chip, .btn { transition: border-color .15s, background-color .15s; } }

/* Site próprio: modo leitura x modo edição */
body:not(.ro) .view-only { display: none !important; }
a.btn { text-decoration: none; }
.foot { display: flex; justify-content: center; }
.linkbtn { border: 0; background: none; color: var(--muted); text-decoration: underline; font-size: .9rem; padding: 8px; }
.linkbtn:hover { color: var(--accent); }
label.check { display: flex; align-items: center; gap: 8px; font-size: .92rem; }
label.check input { width: 18px; height: 18px; accent-color: var(--accent); }
[hidden] { display: none !important; }

/* Contas de responsável */
body:not(.admin) .admin-only { display: none !important; }
.foot { flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.who { color: var(--muted); font-size: .9rem; }
.info { background: var(--ok-bg); color: var(--ok); border-radius: 10px; padding: 9px 12px; font-size: .9rem; font-weight: 700; }
.hint { margin: 0; color: var(--muted); font-size: .85rem; }
.hint a { color: var(--accent); font-weight: 700; }
.resplist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 40vh; overflow: auto; }
.resplist li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.resplist .rinfo { flex: 1 1 180px; min-width: 0; display: grid; }
.resplist .rnome { font-weight: 700; overflow-wrap: anywhere; }
.resplist .remail { color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
.resplist .ract { display: flex; gap: 6px; flex-wrap: wrap; }
.resplist .btn { min-height: 34px; padding: 5px 10px; font-size: .82rem; }
fieldset.invite { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 12px; margin: 0; display: grid; gap: 10px; min-width: 0; }
fieldset.invite legend { font-weight: 700; padding: 0 6px; }
