/*
  Layout concept: a deep "wash bay" header band carries the LavaDok
  wordmark, under a sticky segmented tab bar (Agendar / Gestão /
  Faturamento). Agendar is a loose grid of hour-card tickets with a
  foam-bubble capacity meter; Gestão stacks event settings, vehicle
  types/pricing and the horário roster; Faturamento is a stat row
  over a scrollable ledger table.
*/
:root {
  --bg: #eef5f7;
  --bg-band: #0b4f6c;
  --surface: #ffffff;
  --surface-soft: #e4f1f4;
  --border: #cfe2e7;
  --fg: #0c2733;
  --fg-muted: #4d6b76;
  --accent: #ff8c42;
  --accent-ink: #7a3300;
  --accent-soft: #ffe3c9;
  --good: #2f9e5c;
  --good-soft: #d9f2e3;
  --full: #c0392b;
  --full-soft: #fbdedb;
  --font-display: "Baloo 2", "Segoe UI Rounded", sans-serif;
  --font-body: "Work Sans", "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1c24; --bg-band: #07141a; --surface: #11303c; --surface-soft: #16394a;
    --border: #224755; --fg: #eaf3f5; --fg-muted: #9bb8c2;
    --accent: #ff9d5c; --accent-ink: #2a1200; --accent-soft: #3a2413;
    --good: #4cc786; --good-soft: #163a28; --full: #ff8477; --full-soft: #3d1813;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a1c24; --bg-band: #07141a; --surface: #11303c; --surface-soft: #16394a;
  --border: #224755; --fg: #eaf3f5; --fg-muted: #9bb8c2;
  --accent: #ff9d5c; --accent-ink: #2a1200; --accent-soft: #3a2413;
  --good: #4cc786; --good-soft: #163a28; --full: #ff8477; --full-soft: #3d1813;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--fg); font-family: var(--font-body); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; }

.gutter {
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

.hero { background: var(--bg-band); padding-block: 28px 20px; }
.hero-inner { max-width: 820px; margin: 0 auto; }
.wordmark { font-family: var(--font-display); font-weight: 800; font-size: clamp(30px, 7vw, 42px); color: #fff; margin: 0 0 2px; letter-spacing: -0.01em; }
.wordmark span { color: var(--accent); }
.eyebrow { font-family: var(--font-body); font-weight: 700; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: #cfe7ef; margin: 0 0 8px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.meta-chip { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); color: #e9f4f7; border-radius: 999px; padding: 6px 12px; font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.admin-chip-btn { background: transparent; border: 1px solid rgba(255,255,255,.3); color: #e9f4f7; border-radius: 999px; padding: 6px 12px; font-size: 12.5px; font-weight: 700; cursor: pointer; font-family: var(--font-body); }
.admin-chip-btn:hover { background: rgba(255,255,255,.12); }

.tabbar { position: sticky; top: 0; z-index: 15; background: var(--bg); border-bottom: 1px solid var(--border); }
.tabbar-inner { max-width: 820px; margin: 0 auto; display: flex; gap: 4px; padding-block: 8px; overflow-x: auto; }
.tab-btn { flex: none; font-family: var(--font-body); font-weight: 700; font-size: 13.5px; color: var(--fg-muted); background: transparent; border: 1px solid transparent; border-radius: 10px; padding: 8px 14px; cursor: pointer; }
.tab-btn.active { background: var(--surface-soft); color: var(--fg); border-color: var(--border); }

main { max-width: 820px; margin: 0 auto; padding-block: 20px 56px; }
.panel { display: none; }
.panel.active { display: block; }

.summary-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.summary-tile { flex: 1 1 120px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 13px 15px; min-width: 0; }
.summary-tile .n { font-family: var(--font-display); font-weight: 700; font-size: 23px; font-variant-numeric: tabular-nums; }
.summary-tile .l { font-size: 12px; color: var(--fg-muted); margin-top: 2px; }

.notice { background: var(--surface-soft); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; font-size: 13.5px; color: var(--fg-muted); margin-bottom: 18px; line-height: 1.5; }
.notice.err { background: var(--full-soft); color: var(--full); border-color: transparent; }
.notice strong { color: var(--fg); }

.section-label { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--fg); margin: 0 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.section-sub { font-size: 12.5px; font-weight: 500; color: var(--fg-muted); font-family: var(--font-body); }
.section-hint { font-size: 12.5px; color: var(--fg-muted); margin: -6px 0 12px; line-height: 1.5; }

.slots-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.slot-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.slot-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.slot-time { font-family: var(--font-display); font-weight: 700; font-size: 20px; font-variant-numeric: tabular-nums; }
.slot-pill { font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.slot-pill.open { background: var(--good-soft); color: var(--good); }
.slot-pill.full { background: var(--full-soft); color: var(--full); }

.meter { height: 6px; border-radius: 999px; background: var(--surface-soft); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .25s ease; }

.car-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; min-height: 2px; }
.car-row { display: flex; flex-direction: column; gap: 4px; background: var(--surface-soft); border-radius: 10px; padding: 8px 10px; font-size: 13px; min-width: 0; }
.car-row .line1, .car-row .line2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.car-row .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.car-row .nm.washed { text-decoration: line-through; color: var(--fg-muted); }
.car-row .meta { color: var(--fg-muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.car-row .rm { flex: none; width: 20px; height: 20px; border-radius: 999px; border: none; background: transparent; color: var(--fg-muted); cursor: pointer; font-size: 14px; line-height: 1; }
.car-row .rm:hover { background: var(--full-soft); color: var(--full); }
.empty-hint { font-size: 12.5px; color: var(--fg-muted); padding: 4px 2px; }

.wash-pill, .pay-pill { flex: none; display: inline-flex; align-items: center; gap: 4px; border: none; cursor: pointer; font-family: var(--font-body); font-weight: 700; font-size: 11px; border-radius: 999px; padding: 3px 9px; white-space: nowrap; }
.wash-pill.done, .pay-pill.paid { background: var(--good-soft); color: var(--good); }
.wash-pill.todo { background: var(--surface); color: var(--fg-muted); border: 1px solid var(--border); }
.pay-pill.pending { background: var(--full-soft); color: var(--full); }
.wash-pill:disabled, .pay-pill:disabled { opacity: .6; cursor: default; }

.add-btn, .ghost-btn { border: 1.5px dashed var(--border); background: transparent; color: var(--fg-muted); font-family: var(--font-body); font-weight: 600; font-size: 13px; border-radius: 10px; padding: 9px 10px; cursor: pointer; }
.add-btn:hover, .ghost-btn:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.add-btn:disabled { opacity: .5; cursor: not-allowed; }

.form-box { display: flex; flex-direction: column; gap: 8px; background: var(--surface-soft); border-radius: 12px; padding: 12px; }
.form-box input, .form-box select, .form-box textarea { font-family: var(--font-body); font-size: 13.5px; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--fg); width: 100%; }
.form-row { display: flex; gap: 8px; flex-wrap: wrap; }
.form-row > * { flex: 1 1 110px; min-width: 0; }
.field-label { font-size: 11.5px; font-weight: 600; color: var(--fg-muted); display: block; margin-bottom: 3px; }
.btn-row { display: flex; gap: 8px; }
.btn-row > * { flex: 1; }
.btn-primary, .btn-ghost { font-family: var(--font-body); font-weight: 700; font-size: 13.5px; padding: 9px 10px; border-radius: 8px; border: none; cursor: pointer; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--fg-muted); border: 1px solid var(--border); }
.field-err { color: var(--full); font-size: 12px; }

a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; margin-bottom: 16px; }

.check-row { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--fg-muted); font-weight: 600; margin-bottom: 10px; }
.check-row input { width: 15px; height: 15px; }

.admin-row { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.admin-row:last-child { border-bottom: none; }
.admin-row .time-inputs { display: flex; align-items: center; gap: 6px; flex: 1 1 160px; min-width: 0; }
.admin-row input[type="time"], .admin-row input[type="number"], .admin-row input[type="text"] {
  font-family: var(--font-body); font-size: 13.5px; padding: 7px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-soft); color: var(--fg); min-width: 0;
}
.admin-row input[type="time"] { width: 100px; }
.admin-row input[type="number"] { width: 68px; }
.admin-row input.type-name { width: 120px; flex: 1 1 110px; }
.admin-row input.type-price { width: 90px; }
.admin-row .cap-wrap, .admin-row .price-wrap { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--fg-muted); }
.admin-row .count-badge { font-size: 11.5px; font-weight: 600; color: var(--fg-muted); background: var(--surface-soft); border-radius: 999px; padding: 3px 8px; flex: none; }
.admin-row .del-btn { flex: none; border: none; background: transparent; color: var(--fg-muted); cursor: pointer; font-size: 14px; padding: 6px 8px; border-radius: 8px; }
.admin-row .del-btn:hover:not(:disabled) { background: var(--full-soft); color: var(--full); }
.admin-row .del-btn:disabled { opacity: .35; cursor: not-allowed; }

.ledger-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; }
table.ledger { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 680px; }
table.ledger th { text-align: left; font-family: var(--font-body); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-muted); background: var(--surface-soft); padding: 9px 12px; position: sticky; top: 0; white-space: nowrap; }
table.ledger td { padding: 9px 12px; border-top: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
table.ledger tbody tr:nth-child(odd) { background: color-mix(in srgb, var(--surface-soft) 35%, transparent); }
.amt { font-variant-numeric: tabular-nums; font-weight: 600; }
.muted { color: var(--fg-muted); }

.modal-backdrop { position: fixed; inset: 0; background: rgba(5,15,20,.5); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal-backdrop[hidden] { display: none; }
.modal-box { background: var(--surface); border-radius: 16px; padding: 20px; width: 100%; max-width: 360px; }
.modal-box h3 { font-family: var(--font-display); font-size: 18px; margin: 0 0 4px; }
.modal-box p { font-size: 13px; color: var(--fg-muted); margin: 0 0 14px; }

footer.page-footer { margin-top: 24px; font-size: 12px; color: var(--fg-muted); text-align: center; }

@media (prefers-reduced-motion: reduce) { .meter > span { transition: none; } }
