/* TurnosYa — mismos colores y tipografías que la página de presentación. Pensado primero para celular. */
:root {
  --bg: #F4F6FB; --surface: #FFFFFF; --ink: #141B2D; --muted: #5A6378; --line: #DCE1EC;
  --accent: #2F5BFF; --accent-ink: #FFFFFF; --accent-soft: #E3E9FF;
  --sun: #FFC93C; --sun-ink: #3A2A00; --ok: #16875A; --ok-soft: #DDF4E9;
  --bad: #C8402F; --bad-soft: #FBE4E0; --warn-soft: #FFF3D1; --wa: #1FA855;
  --f-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --f-body: "Figtree", "Segoe UI", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0D1120; --surface: #161B2D; --ink: #E9ECF5; --muted: #9AA3B8; --line: #2A3149;
    --accent: #7390FF; --accent-ink: #0A0F1F; --accent-soft: #1F2950;
    --sun: #FFD25E; --sun-ink: #2A1F00; --ok: #42C98F; --ok-soft: #14352A;
    --bad: #FF8070; --bad-soft: #3A1C19; --warn-soft: #3A3014; --wa: #25C25F;
    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(--f-body); font-size: 16px; line-height: 1.5; }
h1, h2, h3 { font-family: var(--f-display); line-height: 1.12; margin: 0; text-wrap: balance; letter-spacing: -.01em; }
h1 { font-size: 1.7rem; font-weight: 800; }
h2 { font-size: 1.25rem; font-weight: 700; margin-top: 12px; }
p { margin: 0; }
a { color: var(--accent); }
code { font-family: var(--f-mono); font-size: .88em; word-break: break-all; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.center { text-align: center; }

.wrap { max-width: 760px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.stack { display: grid; gap: 14px; }
.narrow { max-width: 460px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.row-between { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }

/* Botones y formularios */
button, input, select, textarea { font: inherit; color: inherit; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 999px; padding: 12px 22px; font-weight: 700; text-decoration: none; cursor: pointer; line-height: 1.2; }
.btn.block { width: 100%; }
.btn.small { padding: 8px 14px; font-size: .9rem; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1.5px solid var(--line); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.wa-btn { background: var(--wa); color: #fff; }
.link-btn { border: 0; background: none; color: var(--accent); font-weight: 600; cursor: pointer; padding: 4px 0; }
.danger-text { color: var(--bad) !important; }

.field { display: grid; gap: 5px; min-width: 0; }
.field label { font-size: .85rem; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea, .hours input {
  width: 100%; padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface);
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; }
.hint { color: var(--muted); font-size: .8rem; }
.alert { background: var(--warn-soft); border: 1px solid var(--sun); border-radius: 12px; padding: 12px 14px; }
.flash { background: var(--ok-soft); color: var(--ok); border-radius: 12px; padding: 12px 14px; font-weight: 600; }
.empty { color: var(--muted); padding: 28px 0; text-align: center; }
.back { display: inline-block; font-weight: 600; text-decoration: none; margin-bottom: 4px; }

/* Marca */
.brand { display: inline-flex; align-items: center; gap: 8px; font-family: var(--f-display); font-weight: 800; font-size: 1.2rem; color: var(--ink); text-decoration: none; }
.logo { width: 28px; height: 28px; }

/* Ingreso */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 28px 24px; display: grid; gap: 16px; }

/* Página pública */
.biz-head { background: var(--ink); color: var(--bg); padding-block: 28px 22px; }
.biz-head small { opacity: .75; font-size: .85rem; }
.biz-head h1 { font-size: 2rem; }
.biz-head p { opacity: .8; margin-top: 4px; }
.pub { display: grid; gap: 14px; padding-block: 22px 32px; }
.step-title { font-size: 1.3rem; margin: 0; }
.list { display: grid; gap: 10px; }
.svc { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px; color: var(--ink); text-decoration: none; }
.svc:hover { border-color: var(--accent); }
.svc small { display: block; color: var(--muted); font-size: .85rem; }
.price { font-family: var(--f-mono); font-weight: 700; white-space: nowrap; }
.days { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.day { flex: none; width: 58px; display: grid; justify-items: center; padding: 8px 0; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); text-decoration: none; line-height: 1.2; }
.day small { font-size: .75rem; color: var(--muted); }
.day b { font-family: var(--f-mono); font-size: 1.1rem; }
.day.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.day.on small { color: var(--accent-ink); }
.day-label { font-weight: 600; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.slot { text-align: center; padding: 12px 0; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-family: var(--f-mono); font-weight: 700; text-decoration: none; }
.slot:hover { border-color: var(--accent); color: var(--accent); }
.summary { margin: 0; background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px; padding: 6px 16px; }
.summary div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.summary div:last-child { border-bottom: 0; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 700; text-align: right; }
.summary dd small { font-weight: 400; color: var(--muted); }
.foot { padding-block: 10px 28px; color: var(--muted); font-size: .85rem; text-align: center; }
.ticket-head { display: grid; justify-items: center; text-align: center; gap: 8px; padding-top: 12px; }
.check { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; }
.check svg { width: 34px; height: 34px; }
.remembered { background: var(--accent-soft); border-radius: 12px; padding: 10px 14px; font-size: .9rem; }
.confirm-box { display: grid; gap: 10px; background: var(--bad-soft); border-radius: 14px; padding: 16px; }

/* Estados */
.pill { display: inline-block; font-size: .72rem; font-weight: 700; border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.pill.pendiente { background: var(--warn-soft); color: var(--ink); }
.pill.confirmado { background: var(--ok-soft); color: var(--ok); }
.pill.cancelado { background: var(--bad-soft); color: var(--bad); }
.pill.nuevo { background: var(--sun); color: var(--sun-ink); }

/* Panel */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-in { display: flex; align-items: center; gap: 12px; padding-block: 10px; }
.biz-name { flex: 1; min-width: 0; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabs-in { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs a { flex: none; padding: 10px 12px; color: var(--muted); text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.main { display: grid; gap: 16px; padding-block: 20px 48px; }
.intro { background: var(--accent-soft); border-radius: 12px; padding: 12px 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: grid; gap: 12px; }

/* Turno de ahora / próximo */
.now-card { background: var(--ink); color: var(--bg); border-radius: 16px; padding: 6px 16px; display: grid; }
.now-row { display: grid; grid-template-columns: 70px 52px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; }
.now-row + .now-row { border-top: 1px solid color-mix(in srgb, var(--bg) 20%, transparent); }
.now-label { font-family: var(--f-mono); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--sun); }
.now-time { font-family: var(--f-mono); font-weight: 700; }
.now-who { display: grid; min-width: 0; line-height: 1.25; }
.now-who small { opacity: .75; }
.now-extra { font-size: .85rem; font-weight: 600; white-space: nowrap; }
.now-none { padding: 10px 0; opacity: .8; }

/* Avisos */
.toasts { position: fixed; z-index: 30; top: calc(12px + env(safe-area-inset-top, 0px)); right: max(12px, env(safe-area-inset-right, 0px)); width: min(380px, calc(100vw - 24px)); display: grid; gap: 8px; }
.toast { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--sun); border-radius: 14px; padding: 12px 12px 12px 14px; box-shadow: 0 14px 34px -14px rgba(0, 0, 0, .45); animation: toast-in .3s ease both; }
.toast.confirmado { border-left-color: var(--ok); }
.toast.cancelado { border-left-color: var(--bad); }
.toast b { display: block; }
.toast span { color: var(--muted); font-size: .9rem; }
.toast a { font-weight: 700; text-decoration: none; }
.toast button { border: 0; background: none; font-size: 1.3rem; line-height: 1; color: var(--muted); cursor: pointer; padding: 2px 4px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.notif-ask { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; background: var(--accent-soft); padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); font-size: .9rem; }
.notif-ask span { flex: 1; min-width: 200px; }

.share-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .9rem; color: var(--muted); }
.share-line code { color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; }

.daynav { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; }
.day-title { font-size: 1.35rem; text-align: center; }
.day-title .rel { color: var(--accent); }
.date-jump { grid-column: 1 / -1; display: flex; gap: 12px; align-items: center; justify-content: center; }
.date-jump input { padding: 6px 10px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--surface); }
.stats { display: flex; flex-wrap: wrap; gap: 6px; font-size: .85rem; }
.stats span { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }

.agenda { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bk { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: start; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.bk time { font-family: var(--f-mono); font-weight: 700; display: grid; line-height: 1.25; }
.bk time small { font-weight: 500; color: var(--muted); font-size: .78rem; }
.bk .who { min-width: 0; display: grid; gap: 2px; }
.bk .who small { color: var(--muted); }
.bk .who .sent { color: var(--ok); font-weight: 600; }
.bk .wa { font-family: var(--f-mono); font-size: .85rem; width: fit-content; }
.bk .side { display: grid; gap: 6px; justify-items: end; }
.bk.is-new { border-color: var(--sun); box-shadow: inset 4px 0 0 var(--sun); }
.bk.cancelado { opacity: .6; }
.bk.cancelado b { text-decoration: line-through; }
.more summary { cursor: pointer; color: var(--accent); font-size: .85rem; font-weight: 600; list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more .menu { display: grid; gap: 2px; margin-top: 6px; background: var(--bg); border-radius: 10px; padding: 4px; }
.more .menu button { border: 0; background: none; text-align: right; padding: 6px 8px; cursor: pointer; color: var(--ink); font-size: .88rem; }

.svc-list { display: grid; gap: 10px; }
.svc-row { display: grid; grid-template-columns: 2fr 1.2fr 1fr; gap: 10px; align-items: end; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.svc-row.off { opacity: .65; }
.svc-row .toggle { grid-column: 1 / 3; display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.svc-row.add { border-style: dashed; }
.svc-row.add .btn { grid-column: 3; }

.hours { display: grid; gap: 8px; }
.hours-row { display: grid; grid-template-columns: 96px 1fr 1fr; gap: 10px; align-items: center; border: 0; margin: 0; padding: 10px 14px; background: var(--surface); border-radius: 12px; border: 1px solid var(--line); }
.hours-row legend { float: left; font-weight: 700; padding: 0; }
.rng { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .85rem; }
.rng input { padding: 7px 8px; min-width: 0; }
.blocked { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.blocked li { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.inline-form .grow { flex: 1; min-width: 180px; }

.biz-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.biz-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.biz-list li > div { display: grid; gap: 2px; min-width: 0; }
.biz-list small { color: var(--muted); }
.biz-list li.unpaid { border-color: var(--bad); box-shadow: inset 4px 0 0 var(--bad); }
.biz-list b .pill { margin-left: 6px; vertical-align: middle; }
.biz-actions { display: grid; gap: 8px; justify-items: end; }
.pay-form { display: flex; gap: 6px; align-items: center; }
.pay-form select { padding: 7px 10px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--surface); }
.pill.al_dia { background: var(--ok-soft); color: var(--ok); }
.pill.impago { background: var(--bad-soft); color: var(--bad); }
.pill.exento { background: var(--accent-soft); color: var(--accent); }

@media (max-width: 600px) {
  h1 { font-size: 1.45rem; }
  .grid3 { grid-template-columns: 1fr; }
  .svc-row { grid-template-columns: 1fr 1fr; }
  .svc-row .field:first-child { grid-column: 1 / -1; }
  .svc-row .toggle { grid-column: 1 / -1; }
  .svc-row.add .btn { grid-column: 1 / -1; }
  .hours-row { grid-template-columns: 1fr; gap: 6px; }
  .bk { grid-template-columns: 50px 1fr; }
  .bk .side { grid-column: 2; justify-items: start; grid-auto-flow: column; justify-content: start; align-items: center; }
  .more .menu button { text-align: left; }
  .biz-list li { flex-direction: column; align-items: stretch; }
  .biz-actions { justify-items: stretch; }
  .pay-form select { flex: 1; }
  .now-row { grid-template-columns: 52px 1fr auto; }
  .now-label { grid-column: 1 / -1; }
  .toasts { top: auto; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
