:root {
  --bg: #f3f5f9;
  --card: #ffffff;
  --text: #13213a;
  --muted: #5b6678;
  --line: #dde3ec;
  --primary: #1d4ed8;
  --primary-ink: #ffffff;
  --free: #15803d;
  --free-bg: #ecfdf3;
  --free-line: #86efac;
  --taken-bg: #f1f3f6;
  --mine: #1d4ed8;
  --mine-bg: #eaf1ff;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --warn-bg: #fff8e1;
  --warn-line: #f5c451;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  --cart: #2563eb;
  font-size: 18px;
}
html.big { font-size: 21px; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.45; -webkit-text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px 48px; }

/* ---------- topo ---------- */
.top {
  background: linear-gradient(135deg, #0f2a6b, #1d4ed8 70%, #3b82f6);
  color: #fff; padding: 22px 0 64px;
}
.top .wrap { padding-bottom: 0; display: flex; align-items: center; gap: 12px; }
.top h1 { font-size: 1.55rem; margin: 0; line-height: 1.2; flex: 1; }
.top p { margin: 4px 0 0; opacity: .9; font-size: .95rem; }
.logo { width: 52px; height: 52px; border-radius: 16px; background: rgba(255,255,255,.16); display: grid; place-items: center; flex: none; }
.logo svg { width: 30px; height: 30px; }
.fontbtn {
  flex: none; border: 2px solid rgba(255,255,255,.55); background: rgba(255,255,255,.12); color: #fff;
  border-radius: 14px; padding: 8px 12px; font-weight: 700; min-height: 48px;
}
.main { margin-top: -44px; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.card h2 { font-size: 1.15rem; margin: 0 0 12px; }
.step { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: #fff; font-size: .9rem; margin-right: 8px; vertical-align: 2px; }

.notice.lock { background: var(--danger-bg); border-color: #fca5a5; color: #7f1d1d; }
.notice { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 14px; padding: 12px 14px; margin-bottom: 16px; white-space: pre-line; }

/* ---------- carrinhos ---------- */
.carts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.cartbtn {
  text-align: left; border: 3px solid var(--line); background: #fff; border-radius: 16px; padding: 14px 16px;
  display: flex; gap: 12px; align-items: center; min-height: 72px;
}
.cartbtn .dot { width: 18px; height: 18px; border-radius: 50%; flex: none; background: var(--c); }
.cartbtn b { display: block; font-size: 1.1rem; }
.cartbtn span { color: var(--muted); font-size: .92rem; }
.cartbtn[aria-pressed="true"] { border-color: var(--c); background: color-mix(in srgb, var(--c) 8%, #fff); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 20%, transparent); }

/* ---------- semanas ---------- */
.weeks { display: flex; gap: 8px; flex-wrap: wrap; }
.weekbtn {
  border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 10px 16px; min-height: 50px; font-weight: 600;
}
.weekbtn small { display: block; font-weight: 500; color: var(--muted); font-size: .78rem; line-height: 1.1; }
.weekbtn[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.weekbtn[aria-pressed="true"] small { color: #dbe6ff; }

/* ---------- dias e horários ---------- */
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .88rem; color: var(--muted); margin: 0 0 12px; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; margin-right: 6px; vertical-align: -1px; }
.day { border-top: 1px solid var(--line); padding: 14px 0 6px; }
.day:first-of-type { border-top: 0; padding-top: 0; }
.day h3 { margin: 0 0 10px; font-size: 1.12rem; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.day h3 small { font-weight: 500; color: var(--muted); font-size: .92rem; }
.day h3 .today { background: var(--primary); color: #fff; font-size: .72rem; padding: 2px 8px; border-radius: 999px; font-weight: 700; }
.slots { display: grid; gap: 10px; }
.slot {
  width: 100%; display: flex; align-items: center; gap: 14px; text-align: left;
  border: 2px solid var(--line); background: #fff; border-radius: 16px; padding: 12px 14px; min-height: 68px;
}
.slot .time { font-weight: 800; font-size: 1.12rem; min-width: 5.6em; }
.slot .who { flex: 1; min-width: 0; }
.slot .who b { display: block; overflow-wrap: anywhere; }
.slot .who span { color: var(--muted); font-size: .88rem; }
.slot .tag { flex: none; border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: .9rem; }
.slot.free { border-color: var(--free-line); background: var(--free-bg); }
.slot.free .tag { background: var(--free); color: #fff; }
.slot.free:hover { border-color: var(--free); }
.slot.taken { background: var(--taken-bg); }
.slot.taken .tag { background: #e2e6ec; color: #3e4a5c; }
.slot.mine { border-color: var(--mine); background: var(--mine-bg); }
.slot.mine .tag { background: var(--mine); color: #fff; }
.slot.past { opacity: .55; }
.slot:disabled { cursor: default; }
.slot:focus-visible, .btn:focus-visible, .cartbtn:focus-visible, .weekbtn:focus-visible, .choice:focus-within { outline: 3px solid #f59e0b; outline-offset: 2px; }
.blocked { background: var(--taken-bg); border-radius: 14px; padding: 14px; color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 24px 8px; }

/* ---------- minhas marcações ---------- */
.mine-list { display: grid; gap: 10px; }
.mine-item { display: flex; gap: 12px; align-items: center; border: 2px solid var(--mine); background: var(--mine-bg); border-radius: 14px; padding: 12px 14px; }
.mine-item .info { flex: 1; min-width: 0; }
.mine-item b { display: block; }
.mine-item span { color: var(--muted); font-size: .9rem; }

/* ---------- botões ---------- */
.btn {
  border: 0; border-radius: 14px; padding: 14px 20px; font-weight: 700; min-height: 56px; font-size: 1.05rem;
  background: var(--primary); color: var(--primary-ink); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn.green { background: var(--free); }
.btn.red { background: var(--danger); }
.btn.ghost { background: #fff; color: var(--text); border: 2px solid var(--line); }
.btn.small { min-height: 44px; padding: 8px 14px; font-size: .95rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: wait; }
.linkbtn { background: none; border: 0; color: var(--primary); text-decoration: underline; padding: 8px 0; font-weight: 600; }

/* ---------- janela (modal) ---------- */
dialog {
  border: 0; border-radius: 22px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  box-shadow: 0 20px 60px rgba(0,0,0,.3); color: var(--text); background: #fff;
}
dialog::backdrop { background: rgba(10, 20, 40, .55); }
.dlg { padding: 22px 20px 20px; }
.dlg h2 { margin: 0 0 14px; font-size: 1.35rem; }
.summary { background: var(--bg); border-radius: 14px; padding: 12px 14px; margin-bottom: 16px; }
.summary b { font-size: 1.1rem; }
.summary .cartname { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .92rem; }
.summary .cartname i { width: 12px; height: 12px; border-radius: 50%; background: var(--cart); }
label.f { display: block; font-weight: 700; margin: 14px 0 6px; }
.hint { color: var(--muted); font-size: .88rem; margin: 4px 0 0; }
input.inp, select.inp, textarea.inp {
  width: 100%; border: 2px solid #c7d0dc; border-radius: 14px; padding: 13px 14px; min-height: 56px; background: #fff; font-size: 1.05rem;
}
input.inp:focus, select.inp:focus, textarea.inp:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29,78,216,.18); }
input.pin { letter-spacing: .5em; font-size: 1.5rem; text-align: center; max-width: 220px; font-weight: 800; }
.choices { display: grid; gap: 10px; }
.choice { display: flex; gap: 12px; align-items: flex-start; border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; cursor: pointer; }
.choice input { width: 24px; height: 24px; margin: 2px 0 0; flex: none; accent-color: var(--primary); }
.choice b { display: block; }
.choice span { color: var(--muted); font-size: .88rem; }
.choice:has(input:checked) { border-color: var(--primary); background: var(--mine-bg); }
.actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.actions .btn { flex: 1 1 180px; }
.err { background: var(--danger-bg); color: var(--danger); border-radius: 12px; padding: 10px 12px; margin-top: 14px; font-weight: 600; }
.ok-icon { width: 76px; height: 76px; border-radius: 50%; background: var(--free-bg); color: var(--free); display: grid; place-items: center; margin: 4px auto 12px; }
.ok-icon svg { width: 44px; height: 44px; }
.center { text-align: center; }
.pinshow { font-size: 2rem; font-weight: 800; letter-spacing: .3em; background: var(--warn-bg); border: 2px dashed var(--warn-line); border-radius: 14px; padding: 8px; margin: 10px auto; max-width: 240px; }

.foot { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 24px; }
.foot a { color: var(--muted); }
.loading { text-align: center; padding: 30px; color: var(--muted); }
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #13213a; color: #fff; padding: 14px 20px;
  border-radius: 14px; font-weight: 600; box-shadow: var(--shadow); z-index: 50; max-width: calc(100vw - 32px);
}

@media (max-width: 480px) {
  .top h1 { font-size: 1.3rem; }
  .slot { flex-wrap: wrap; gap: 6px 12px; }
  .slot .who { flex-basis: calc(100% - 7em); }
  .slot .tag { margin-left: auto; }
}
@media (prefers-reduced-motion: no-preference) {
  .slot, .cartbtn, .weekbtn, .btn { transition: border-color .15s, background-color .15s, transform .1s; }
  .btn:active, .slot:active:not(:disabled) { transform: scale(.98); }
}

/* ---------- escala dos pioneiros: identidade própria ---------- */
html[data-site="pioneiro"] {
  --primary: #0f766e;
  --mine: #0f766e;
  --mine-bg: #e6f6f4;
}
html[data-site="pioneiro"] .top { background: linear-gradient(135deg, #064e3b, #0f766e 65%, #14b8a6); }
html[data-site="pioneiro"] input.inp:focus, html[data-site="pioneiro"] select.inp:focus { box-shadow: 0 0 0 3px rgba(15,118,110,.2); }
.sitetag {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 6px;
  background: #fde68a; color: #713f12; font-weight: 800; font-size: .82rem; letter-spacing: .06em; text-transform: uppercase;
  border-radius: 999px; padding: 4px 12px 4px 9px; box-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.sitetag svg { width: 15px; height: 15px; }

/* ---------- horário com uma pessoa, esperando parceiro(a) ---------- */
.slot.wait { border-color: #fbbf24; background: #fffbeb; }
.slot.wait .tag { background: #b45309; color: #fff; }
.slot.wait:hover { border-color: #b45309; }
.slot .who span { display: block; }
.waitmsg { color: #92400e !important; font-weight: 700; }
.opt { font-weight: 500; color: var(--muted); }
a.btn { text-decoration: none; }
