/* Navaja: sistema visual "Filo".
   Blanco, tinta, esquinas rectas como una navaja y un solo azul para lo que se toca.
   Vidrio esmerilado para lo que flota encima y entradas que barren de izquierda a derecha. */
:root {
  --paper: #FFFFFF;
  --ground: #F3F4F6;
  --steel-50: #F8F9FA;
  --steel-100: #ECEEF1;
  --steel-200: #D9DDE2;
  --steel-300: #BCC3CB;
  --steel-500: #5E676E;
  --ink: #0A0A0A;
  --ink-2: #2A3036;
  --blue: #006CD2;
  --blue-700: #0053A3;
  --blue-900: #0A1F3A;
  --blue-50: #E8F2FB;
  --blue-100: #CCE1F6;
  --red: #B42318;
  --red-50: #FCEDEB;
  --green: #1C7046;
  --green-50: #E8F3EC;
  --amber: #8A5A00;
  --amber-50: #FDF3DC;
  --font: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --r-s: 0px;
  --r-m: 0px;
  --shadow: 0 1px 2px rgba(22, 25, 29, .06), 0 4px 12px -4px rgba(22, 25, 29, .10);
  --shadow-lg: 0 24px 48px -20px rgba(10, 31, 58, .45);
  --glass: rgba(0, 0, 0, .13);
  --glass-light: rgba(255, 255, 255, .28);
  --blur: 18px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --muted: #6B7378;
  color-scheme: light; /* diseño de un solo tema, claro, elegido a propósito */
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.55; color: var(--ink); background: var(--ground); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
/* Sin tabular-nums: en esta fuente también ensancha comas, puntos y dos puntos. */
::selection { background: var(--blue-100); color: var(--ink); }
img, svg { display: block; max-width: 100%; }
a { color: var(--blue); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--blue-700); }
button, input, select, textarea { font: inherit; color: inherit; }
input, textarea { caret-color: var(--blue); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }
h1, h2, h3 { font-weight: 600; line-height: 1.12; margin: 0; letter-spacing: -0.03em; text-wrap: balance; }
p { margin: 0; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
* { scrollbar-width: thin; scrollbar-color: var(--steel-300) transparent; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* Botones: rectos, con barrido al pasar el mouse y, si llevan a otra pantalla, un cuadro con flecha */
.btn {
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
  min-height: 44px; padding: .6rem 1.1rem; border-radius: var(--r-s); border: 1px solid transparent;
  font-weight: 500; font-size: .95rem; letter-spacing: -0.015em; line-height: 1.2; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn::before { content: ''; position: absolute; inset: 0; z-index: -1; background: var(--wipe, transparent); transform: scaleX(0); transform-origin: left; transition: transform .4s var(--ease-out); pointer-events: none; }
.btn:hover::before { transform: scaleX(1); }
.btn > * { position: relative; }
.btn .ico { width: 36px; height: 36px; margin: -4px -6px -4px .5rem; display: grid; place-items: center; flex: none; background: var(--ico-bg, rgba(0,0,0,.18)); color: var(--ico-fg, currentColor); transition: background-color .25s, color .25s; }
.btn .ico svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.btn-sm .ico { width: 28px; height: 28px; margin: -2px -4px -2px .3rem; }
.btn-lg { min-height: 58px; padding: 12px 26px; font-size: 1rem; gap: 18px; }
.btn-lg:has(.ico) { padding: 12px 10px 12px 22px; }
.btn-lg .ico { margin: 0; }
.btn-primary { background: var(--blue); color: var(--on-accent, #fff); --wipe: var(--blue-700); --ico-bg: rgba(0,0,0,.2); }
.btn-primary:hover { color: var(--on-accent, #fff); }
.btn-primary:hover .ico { --ico-bg: #fff; --ico-fg: var(--blue); }
.btn-light { background: #fff; color: var(--blue); --wipe: var(--blue-50); --ico-bg: var(--blue); --ico-fg: #fff; }
.btn-light:hover { color: var(--blue); }
.btn-ghost { background: rgba(255,255,255,.55); color: var(--ink); --wipe: rgba(255,255,255,.78); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); }
.btn-ghost:hover { color: var(--ink); }
.btn-dark { background: var(--ink); color: var(--paper); --wipe: var(--ink-2); }
.btn-dark:hover { color: var(--paper); }
.btn-line { background: var(--paper); border-color: var(--steel-200); color: var(--ink); --wipe: var(--steel-50); }
.btn-line:hover { border-color: var(--ink); color: var(--ink); }
.btn-danger { background: var(--red); color: #fff; --wipe: #8F1C13; }
.btn-danger:hover { color: #fff; }
.btn-sm { min-height: 36px; padding: .4rem .8rem; font-size: .88rem; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn[disabled]::before { display: none; }
.iconbtn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: var(--r-s); border: 1px solid var(--steel-200); background: var(--paper); color: var(--ink); cursor: pointer; transition: border-color .15s, color .15s; }
.iconbtn:hover { border-color: var(--ink); background: var(--steel-50); }

/* Entradas: barrido de izquierda a derecha y texto que sube desde una máscara. Retraso con --d */
.wipe { animation: wipe-left .7s var(--ease-out) var(--d, 0s) backwards; }
.mask { display: block; overflow: hidden; }
.rise { display: block; animation: type-rise .85s var(--ease-out) var(--d, 0s) backwards; }
@keyframes wipe-left { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes wipe-right { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(0 0 0 0); } }
@keyframes type-rise { from { transform: translate3d(0, 118%, 0); } to { transform: none; } }
@keyframes link-in { from { opacity: 0; transform: translate3d(-16px, 0, 0); } to { opacity: 1; transform: none; } }
@keyframes mark-in { from { opacity: 0; transform: translate3d(-12px, 8px, 0); } to { opacity: 1; transform: none; } }
@keyframes fade-up { from { opacity: 0; transform: translate3d(0, 12px, 0); } to { opacity: 1; transform: none; } }

/* Formularios */
.field { display: grid; gap: .35rem; }
.field > span { font-size: .86rem; font-weight: 600; color: var(--ink-2); }
.input {
  width: 100%; min-height: 44px; padding: .6rem .8rem; border: 1px solid var(--steel-200); border-radius: var(--r-s);
  background: var(--paper); font-size: 1rem;
}
.input:hover { border-color: var(--steel-300); }
.input:focus { border-color: var(--blue); outline: none; box-shadow: inset 0 -2px 0 var(--blue); }
.input::placeholder { color: #8A939C; }
.hint { font-size: .84rem; color: var(--steel-500); }
.error { color: var(--red); font-size: .9rem; font-weight: 600; min-height: 0; }
.error:empty { display: none; }
.check { display: flex; gap: .6rem; align-items: center; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); border-radius: 0; }

/* Marca */
.brand { display: inline-flex; align-items: center; gap: .5rem; text-decoration: none; color: inherit; }
.brand svg { width: 22px; height: 22px; }
.brand b { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.04em; }
.brand svg .m { transform-box: fill-box; transform-origin: left center; }

/* Etiquetas de estado */
.pill { display: inline-flex; align-items: center; gap: .3rem; font-size: .76rem; font-weight: 600; padding: .15rem .5rem; border-radius: 0; background: var(--steel-100); color: var(--ink-2); white-space: nowrap; }
.pill.blue { background: var(--blue-50); color: var(--blue-700); }
.pill.green { background: var(--green-50); color: var(--green); }
.pill.red { background: var(--red-50); color: var(--red); }
.pill.amber { background: var(--amber-50); color: var(--amber); }

/* Aviso flotante */
.toast {
  position: fixed; left: 50%; bottom: 20px; z-index: 60; transform: translate(-50%, 16px); opacity: 0; visibility: hidden;
  background: var(--ink); color: #fff; padding: .7rem 1.1rem; border-radius: var(--r-s); font-size: .92rem; box-shadow: var(--shadow-lg);
  transition: transform .2s cubic-bezier(.2, .8, .2, 1), opacity .2s, visibility .2s; max-width: calc(100vw - 32px);
  pointer-events: none; /* el aviso nunca tapa un botón */
}
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }

/* Hoja (diálogo) */
dialog.sheet {
  border: 0; padding: 0; border-radius: var(--r-m); width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 48px); background: var(--paper); color: var(--ink); box-shadow: var(--shadow-lg);
}
dialog.sheet::backdrop { background: rgba(10, 31, 58, .4); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
dialog.sheet[open] { animation: fade-up .35s var(--ease-out); }
.sheet-head { padding: 1.2rem 1.3rem 1rem; border-bottom: 1px solid var(--steel-100); display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.sheet-head h2 { font-size: 1.25rem; }
.sheet-body { padding: 1.2rem 1.3rem; display: grid; gap: 1rem; }
.sheet-foot { padding: 1rem 1.3rem 1.2rem; display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; border-top: 1px solid var(--steel-100); background: var(--steel-50); border-radius: 0 0 var(--r-m) var(--r-m); }

/* El peine del día: cada diente es un cuarto de hora */
.comb { display: grid; gap: .9rem; }
.comb-row { display: grid; grid-template-columns: 76px 1fr; gap: .8rem; align-items: end; }
.comb-name { font-size: .88rem; font-weight: 600; padding-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.teeth { display: flex; align-items: flex-end; gap: 2px; height: 44px; border-bottom: 2px solid var(--ink); }
.tooth { flex: 1; min-width: 0; border-radius: 0; background: var(--ink); height: 100%; }
.tooth.free { background: var(--blue); height: 34%; }
a.tooth.free:hover { background: var(--blue-700); height: 48%; }
.tooth.past { background: var(--steel-200); height: 100%; }
.tooth.past.free { background: var(--steel-200); height: 18%; }
.comb-axis { display: grid; grid-template-columns: 76px 1fr; gap: .8rem; }
.comb-axis div { position: relative; height: 1.2rem; font-size: .74rem; color: var(--steel-500); }
.comb-axis div span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.comb-legend { display: flex; flex-wrap: wrap; gap: 1.2rem; font-size: .82rem; color: var(--steel-500); }
.comb-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 0; margin-right: .4rem; vertical-align: -1px; }

/* Modo liviano (teléfonos de gama baja o ahorro de datos): lo marca assets/ui.js */
.lite *, .lite *::before, .lite *::after { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; animation: none !important; transition: none !important; }
.lite .stats > div:hover, .lite .choice:hover, .lite .appt:hover, .lite .dbtn:hover { transform: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Aviso de cookies (una sola vez) */
.cookienote { position: fixed; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 70; max-width: 460px; display: flex; flex-wrap: wrap; align-items: center; gap: .7rem 1rem; padding: 1rem 1.1rem; background: #0A1F3A; color: rgba(255,255,255,.88); font-size: .88rem; line-height: 1.45; border-left: 3px solid var(--blue); box-shadow: 0 20px 40px -16px rgba(0,0,0,.5); animation: fade-up .5s var(--ease-out) .6s backwards; }
.cookienote p { flex: 1 1 240px; margin: 0; }
.cookienote a { color: #7EB6EE; }
@media (max-width: 640px) { .cookienote { left: 12px; right: 12px; max-width: none; bottom: calc(84px + env(safe-area-inset-bottom)); } }
