/* CitaFlash — sistema visual.
   Concepto: la agenda como un talonario de turnos; tickets con troquel,
   horas en chips tabulares, una sola tinta de acento. */
:root {
  --ink: #1c1830;
  --ink-2: #4a4560;
  --mute: #7c7792;
  --line: #e4e1ec;
  --paper: #ffffff;
  --bg: #f5f4f8;
  --tint: #efedf5;
  --accent: #d6336c;
  --accent-ink: #ffffff;
  --accent-soft: #fbe7ee;
  --ok: #1f9d6b;
  --ok-soft: #e2f5ec;
  --warn: #b7791f;
  --warn-soft: #fbf1dc;
  --bad: #c53030;
  --bad-soft: #fce8e8;
  --brand: var(--accent);
  --shadow: 0 1px 2px rgba(28, 24, 48, .06), 0 8px 24px rgba(28, 24, 48, .06);
  --f-display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --f-body: 'Figtree', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --r: 14px;
  --r-sm: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #f1eff7; --ink-2: #c8c4d6; --mute: #9893ab; --line: #2f2b42; --paper: #1d1a2b; --bg: #14121f; --tint: #24203a;
    --accent: #ef5b8c; --accent-soft: #3a1d2b; --ok: #3fc48f; --ok-soft: #173327; --warn: #e3a948; --warn-soft: #3a2c14;
    --bad: #f07272; --bad-soft: #3d1c1c; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #f1eff7; --ink-2: #c8c4d6; --mute: #9893ab; --line: #2f2b42; --paper: #1d1a2b; --bg: #14121f; --tint: #24203a;
  --accent: #ef5b8c; --accent-soft: #3a1d2b; --ok: #3fc48f; --ok-soft: #173327; --warn: #e3a948; --warn-soft: #3a2c14;
  --bad: #f07272; --bad-soft: #3d1c1c; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--f-body); font-size: 16px; line-height: 1.5; color: var(--ink); background: var(--bg); }
h1, h2, h3 { font-family: var(--f-display); line-height: 1.1; text-wrap: balance; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--accent); }
img { max-width: 100%; }
.num { font-variant-numeric: tabular-nums; }
.mute { color: var(--mute); }
.small { font-size: 14px; }
.tiny { font-size: 12.5px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.wrap { max-width: 1120px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

/* Buttons */
.btn { font: 600 15px/1 var(--f-body); display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 18px; border-radius: var(--r-sm);
  border: 1px solid transparent; cursor: pointer; text-decoration: none; transition: transform .08s, background .15s, border-color .15s; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; }
.btn-primary { background: var(--brand); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 88%, #000); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--tint); }
.btn-soft { background: var(--tint); color: var(--ink); }
.btn-danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.btn-sm { padding: 8px 12px; font-size: 14px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-wa { background: #1fa855; color: #fff; }

/* Forms */
label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--ink-2); }
input, select, textarea { width: 100%; font: 16px var(--f-body); color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 11px 12px; }
textarea { resize: vertical; min-height: 80px; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--brand); flex: none; }
input[type="color"] { padding: 4px; height: 44px; }
.field { display: flex; flex-direction: column; }
.hint { font-size: 13px; color: var(--mute); margin-top: 6px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; color: var(--ink-2); font-size: 14px; }

/* Surfaces */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--tint); color: var(--ink-2); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.alert { padding: 12px 14px; border-radius: var(--r-sm); font-size: 14.5px; }
.alert.err { background: var(--bad-soft); color: var(--bad); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }

/* Time chips — the "turno" */
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.chip { font: 600 15px var(--f-body); font-variant-numeric: tabular-nums; padding: 11px 0; text-align: center; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer; }
.chip:hover { border-color: var(--brand); }
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Ticket with perforation */
.ticket { position: relative; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.ticket-top { padding: 22px 22px 18px; }
.ticket-cut { position: relative; height: 0; border-top: 2px dashed var(--line); margin: 0 18px; }
.ticket-cut::before, .ticket-cut::after { content: ""; position: absolute; top: -12px; width: 22px; height: 22px; border-radius: 50%; background: var(--bg); border: 1px solid var(--line); }
.ticket-cut::before { left: -30px; }
.ticket-cut::after { right: -30px; }
.ticket-bottom { padding: 18px 22px 22px; }
.ticket-time { font-family: var(--f-display); font-size: 44px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 15px; z-index: 100; box-shadow: var(--shadow); max-width: calc(100% - 32px); }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(15, 12, 28, .5); display: grid; place-items: end center; z-index: 50; padding: 0; }
.modal { background: var(--paper); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 22px max(18px, env(safe-area-inset-left, 0px)) calc(22px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 640px) { .modal-back { place-items: center; padding: 16px; } .modal { border-radius: 18px; } }

.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.list th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--mute); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
