/* ==========================================================================
   Happy Hair Clinic — "Liquid Glass Clinic"  (theme v3)
   Apple-style liquid glass: translucent materials, specular edges, atmospheric
   depth, fluid motion. Luxury-refined for a demanding beauty clientele.
   ========================================================================== */

:root {
  /* Gris HHC. Regla: el gris de marca #9ba8b0 es para SUPERFICIES (botones,
     bordes, acentos gráficos); el TEXTO va en gris oscuro #333, nunca en gris
     claro sobre fondo claro. Los nombres --gold* se conservan por
     compatibilidad; los valores son gris, no oro. */
  --gold: #9ba8b0;        /* acento / superficie */
  --gold-soft: #c2ccd1;   /* acento claro (sobre fondos oscuros) */
  --gold-deep: #333333;   /* texto de acento sobre fondo claro */
  --gold-mid: #8d9aa2;    /* gris medio (elementos gráficos) */
  /* Botón: degradado que va HACIA BLANCO para que resalte y no se opaque. */
  --btn-grad: linear-gradient(160deg, #ffffff 0%, #f3f6f7 46%, #d5dde1 100%);
  --btn-brd: rgba(51,51,51,.14);
  --btn-shadow: 0 14px 30px -12px rgba(51,51,51,.32), inset 0 1px 0 rgba(255,255,255,.95);
  --btn-shadow-hover: 0 20px 40px -14px rgba(51,51,51,.4), inset 0 1px 0 rgba(255,255,255,.95);
  --charcoal: #2b2b2b;
  --ink: #333333;
  --muted: #5f676c;
  /* HHC brand slate — the dark surfaces (sidebar, masthead, dark panels) */
  --slate: #6d767b;
  --slate-deep: #565d61;
  --slate-abyss: #474d51;
  --line: rgba(51, 51, 51, 0.1);

  /* Liquid glass material — translucent so the atmosphere refracts through */
  --glass-bg: linear-gradient(135deg, rgba(255,255,255,0.50) 0%, rgba(255,255,255,0.22) 100%);
  --glass-bg-strong: linear-gradient(135deg, rgba(255,255,255,0.72) 0%, rgba(255,255,255,0.46) 100%);
  --glass-blur: saturate(185%) blur(32px);
  --glass-brd: rgba(255, 255, 255, 0.60);
  --spec: inset 0 1px 0 rgba(255,255,255,0.85), inset 0 0 0 1px rgba(255,255,255,0.18);
  --elev-1: 0 10px 30px -18px rgba(44,52,56, 0.35);
  --elev-2: 0 22px 50px -26px rgba(44,52,56, 0.42);
  --elev-3: 0 40px 80px -40px rgba(32,39,42, 0.5);

  --r-xl: 26px;
  --r-lg: 18px;
  --r-md: 13px;

  --ok: #4f9d69; --warn: #d99a3a; --danger: #cf5b52; --info: #4a86a8;

  --sidebar-w: 244px;
  /* ── Type system: "Couture Hairline" ──────────────────────────────────────
     ONE workhorse (Schibsted Grotesk) for everything; the display serif
     One family app-wide (Schibsted Grotesk); hierarchy comes from weight + size only. */
  --font-sans: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* Strict scale tokens — no size is chosen "by eye" */
  --t-name: 2.3rem;      /* client name — Apple large-title, bold */
  --t-metric: 2.5rem;    /* score ring numeral — its twin */
  --t-page: 1.7rem;      /* page titles on list/overview pages */
  --t-feature: 1.45rem;  /* one feature headline per view */
  --t-value: 1.375rem;   /* KPI / stat numbers (tabular) */
  --t-title: 1.0625rem;  /* card/section headers */
  --t-body: 0.9375rem;   /* body, rows, KV values */
  --t-caption: 0.8125rem;/* meta, code, dates, subtitles */
  --t-eyebrow: 0.6875rem;/* uppercase kickers, chips, badges */
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--t-body);
  line-height: 1.55;
  color: var(--ink);
  background: #eef1f1;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}
/* Lining figures for clean numerals. Schibsted's *tabular* period renders wide,
   so we stay proportional (no tabular) — currency/decimals read tight and elegant. */
.mono-num, .cx-stat__v, .stat__value, .rz-num, .ov-ring__v {
  font-variant-numeric: lining-nums;
}

/* Atmospheric mesh — static (no ambient jitter); quiet so the type leads */
body::before {
  content: "";
  position: fixed; inset: -25%; z-index: -2;
  background:
    radial-gradient(42% 50% at 12% 16%, rgba(196,206,212, 0.5), transparent 66%),
    radial-gradient(40% 46% at 88% 10%, rgba(210, 218, 222, 0.42), transparent 66%),
    radial-gradient(46% 52% at 78% 84%, rgba(186, 198, 204, 0.4), transparent 68%),
    radial-gradient(50% 56% at 22% 96%, rgba(203,213,218, 0.4), transparent 70%),
    linear-gradient(135deg, #f4f6f6, #edefeb);
  filter: saturate(104%);
}
/* Fine grain for tactile Apple texture */
body::after {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

@keyframes drift {
  0%   { transform: translate3d(0,0,0) scale(1); }
  50%  { transform: translate3d(-2%, 1.5%, 0) scale(1.04); }
  100% { transform: translate3d(2%, -1%, 0) scale(1.02); }
}
@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes floatIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

a { color: var(--gold-deep); text-decoration: none; }
a:hover { color: var(--charcoal); }

/* ============================ App shell ============================ */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

/* Sidebar — floating glass rail ----------------------------------- */
.sidebar {
  position: sticky; top: 0; align-self: start;
  height: calc(100vh - 28px); margin: 14px 0 14px 14px;
  border-radius: 28px;
  background: linear-gradient(180deg, var(--slate) 0%, var(--slate-abyss) 100%);
  backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: var(--elev-3), inset 0 1px 0 rgba(255,255,255,0.10);
  display: flex; flex-direction: column; padding: 24px 16px 16px; overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 0; }
.sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; }
.sidebar__brand img { width: 140px; height: auto; filter: drop-shadow(0 4px 12px rgba(0,0,0,.4)); }
.sidebar__section {
  font-size: 0.6rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: rgba(255,255,255,0.55); font-weight: 700; padding: 12px 12px 8px;
}
.sidebar__nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 13px; border-radius: 13px;
  color: rgba(255,255,255,0.82); font-weight: 600; font-size: 0.875rem; white-space: nowrap;
  transition: all 0.28s var(--ease-spring); position: relative;
}
.nav-item svg { width: 19px; height: 19px; stroke-width: 1.8; flex-shrink: 0; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,0.08); }
.nav-item.active {
  color: #333;
  background: var(--btn-grad);
  box-shadow: 0 10px 22px -8px rgba(0,0,0,0.4), var(--spec);
}
.sidebar__footer { margin-top: auto; padding-top: 14px; }
.sidebar__user {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.88);
}
.sidebar__user small { color: rgba(255,255,255,0.62); font-size: 0.72rem; }

/* Main ------------------------------------------------------------- */
.main { padding: 24px 30px 40px; min-width: 0; animation: riseIn 0.5s var(--ease-spring) both; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.topbar h1 {
  font-family: var(--font-sans);
  font-size: var(--t-page); font-weight: 600; letter-spacing: -0.01em; line-height: 1.15;
  margin: 0; color: var(--charcoal);
}
.topbar .subtitle { color: var(--muted); font-size: var(--t-caption); margin-top: 3px; }

.search {
  display: flex; align-items: center; gap: 9px;
  background: var(--glass-bg); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-brd); border-radius: 999px;
  padding: 9px 16px; min-width: 230px; color: var(--muted); box-shadow: var(--spec);
}
.search input {
  border: none; outline: none; background: transparent;
  font-family: inherit; font-size: 0.875rem; color: var(--ink); width: 100%;
}

.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--slate), var(--slate-abyss));
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 0.9rem;
  box-shadow: 0 8px 18px -8px rgba(92,107,115,0.85), var(--spec);
}

/* ============================ Glass cards ============================ */
.glass, .card-hhc {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-brd);
  border-radius: var(--r-xl);
  box-shadow: var(--elev-2), var(--spec);
}
.card-hhc { border-radius: var(--r-lg); background: var(--glass-bg-strong); box-shadow: var(--elev-1), var(--spec); }

.card-dark {
  background: linear-gradient(150deg, rgba(48,42,36,0.94), rgba(24,20,16,0.96));
  backdrop-filter: var(--glass-blur);
  color: #fff; border-radius: var(--r-lg);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: var(--elev-2), inset 0 1px 0 rgba(255,255,255,0.10);
}

.hoverable { transition: box-shadow 0.3s var(--ease-spring); }
.hoverable:hover { box-shadow: var(--elev-3), var(--spec); }

.section-title {
  font-size: var(--t-eyebrow); text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--muted); font-weight: 600; margin-bottom: 14px;
}

/* Stat tile -------------------------------------------------------- */
.stat { padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; }
.stat__label { font-size: var(--t-caption); color: var(--muted); font-weight: 600; }
.card-dark .stat__label { color: rgba(255,255,255,0.6); }
.stat__value { font-family: var(--font-sans); font-size: var(--t-value); font-weight: 600; letter-spacing: -0.01em; }
.stat__meta { font-size: var(--t-caption); color: var(--muted); }
.stat__icon {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: rgba(155,168,176,0.16); color: var(--gold-deep); box-shadow: var(--spec);
}
.card-dark .stat__icon { background: rgba(255,255,255,0.09); color: var(--gold-soft); }

/* ============================ Buttons ============================ */
.btn-gold {
  background: var(--btn-grad);
  border: 1px solid var(--btn-brd); color: #333; font-weight: 700; font-size: 0.875rem;
  border-radius: 13px; padding: 10px 20px;
  box-shadow: var(--btn-shadow);
  transition: transform 0.28s var(--ease-spring), box-shadow 0.28s var(--ease-spring);
}
.btn-gold:hover { color: #333; box-shadow: var(--btn-shadow-hover); }
.btn-ghost {
  background: var(--glass-bg); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-brd); color: var(--ink); font-weight: 600; font-size: var(--t-caption);
  border-radius: 13px; padding: 9px 17px; transition: background 0.25s ease; box-shadow: var(--spec);
}
.btn-ghost:hover { background: var(--glass-bg-strong); }

/* ============================ Badges ============================ */
.badge-soft { font-weight: 700; font-size: 0.7rem; padding: 4px 11px; border-radius: 999px; box-shadow: var(--spec); }
.badge-ok   { background: rgba(79,157,105,0.16); color: #3c7d51; }
.badge-warn { background: rgba(217,154,58,0.18); color: #a9702a; }
.badge-danger{ background: rgba(207,91,82,0.16); color: #b6473e; }
.badge-info { background: rgba(74,134,168,0.16); color: #3a6d8a; }
.badge-muted{ background: rgba(42,38,34,0.08); color: var(--muted); }

/* ============================ Forms ============================ */
.field { margin-bottom: 14px; }
.field label { display:block; font-size: var(--t-eyebrow); text-transform: uppercase; letter-spacing: 0.08em;
  font-weight: 600; margin-bottom: 7px; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line);
  background: rgba(255,255,255,0.72); backdrop-filter: blur(6px);
  border-radius: 12px; padding: 11px 13px;
  font-family: inherit; font-size: var(--t-body); color: var(--ink);
  transition: border 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--gold); background: #fff;
  box-shadow: 0 0 0 4px rgba(155,168,176,0.16);
}

/* ============================ Login ============================ */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; padding: 20px; gap: 20px; }
.auth-brand {
  border-radius: 32px; color: #fff; padding: 50px; display: flex; flex-direction: column;
  justify-content: space-between; position: relative; overflow: hidden;
  background:
    radial-gradient(680px 380px at 18% 6%, rgba(155,168,176,0.42), transparent 60%),
    linear-gradient(160deg, var(--slate) 0%, var(--slate-abyss) 100%);
  border: 1px solid rgba(255,255,255,0.08); box-shadow: var(--elev-3);
}
.auth-brand::after { content: ""; position: absolute; right: -120px; bottom: -150px;
  width: 460px; height: 460px; border-radius: 50%;
  background: radial-gradient(circle, rgba(155,168,176,0.28), transparent 70%); }
.auth-brand__logo img { width: 210px; }
.auth-brand__tagline { font-family: var(--font-sans); font-size: 2.2rem; font-weight: 700; letter-spacing: -0.02em;
  line-height: 1.05; letter-spacing: -0.02em; max-width: 13ch; }
.auth-brand__note { color: rgba(255,255,255,0.6); font-size: 0.9rem; max-width: 42ch; }
.auth-card { display: flex; align-items: center; justify-content: center; }
.auth-form { width: 100%; max-width: 370px; animation: floatIn 0.7s var(--ease-spring) both; }
.auth-form h2 { font-family: var(--font-sans); font-size: 1.6rem; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 6px; }
.auth-form p.lead { color: var(--muted); margin-bottom: 26px; font-size: 0.92rem; }
.auth-error { background: rgba(207,91,82,0.12); color: #b6473e; border: 1px solid rgba(207,91,82,0.25);
  border-radius: 12px; padding: 11px 14px; font-size: 0.85rem; font-weight: 600; margin-bottom: 16px; }

/* ============================ Tables ============================ */
.table-hhc { width: 100%; border-collapse: separate; border-spacing: 0 8px; }
.table-hhc th { text-align: left; font-size: var(--t-eyebrow); text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted); font-weight: 600; padding: 4px 15px; }
.table-hhc td { background: rgba(255,255,255,0.66); backdrop-filter: blur(6px); padding: 13px 15px; font-size: var(--t-body); }
.table-hhc tr td:first-child { border-radius: 13px 0 0 13px; }
.table-hhc tr td:last-child { border-radius: 0 13px 13px 0; }
.table-hhc tbody tr { transition: background 0.2s ease; }
.table-hhc tbody tr:hover td { background: rgba(255,255,255,0.9); }

/* ============================ Motion — one calm entrance, no jitter ========= */
.stagger > * { animation: riseIn 0.5s ease-out both; }
.stagger > *:nth-child(1){ animation-delay: 0s; } .stagger > *:nth-child(2){ animation-delay: .06s; }
.stagger > *:nth-child(3){ animation-delay: .12s; } .stagger > *:nth-child(4){ animation-delay: .18s; }
.stagger > *:nth-child(5){ animation-delay: .24s; } .stagger > *:nth-child(6){ animation-delay: .30s; }
#tab-content > * { animation: riseIn 0.45s ease-out both; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; } }

/* ============================ Shared Apple-grade components ============================ */
/* Uppercase kicker — the one repeating label voice */
.eyebrow { font-size: var(--t-eyebrow); letter-spacing: .14em; text-transform: uppercase;
  font-weight: 600; color: var(--gold-deep); }

/* Page header row */
.page-head { display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: var(--t-page); font-weight: 700; letter-spacing: -0.015em; margin: 4px 0 0; }
.page-head .eyebrow { display: block; }
.page-head__meta { font-size: var(--t-caption); color: var(--muted); margin-top: 4px; }

/* Dark masthead panel */
.mh { position: relative; overflow: hidden; border-radius: var(--r-xl);
  padding: 28px 30px 52px; color: #f4f6f6;
  background:
    radial-gradient(560px 300px at 88% -20%, rgba(155,168,176,.26), transparent 62%),
    linear-gradient(150deg, var(--slate) 0%, var(--slate-deep) 55%, var(--slate-abyss) 100%);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 30px 60px -34px rgba(38,44,47,.8), inset 0 1px 0 rgba(255,255,255,.09); }
.mh .eyebrow { color: var(--gold-soft); }
.mh__row { display: flex; align-items: center; gap: 24px; position: relative; z-index: 1; }
.mh__axis { flex: 1; height: 1px; min-width: 30px;
  background: linear-gradient(90deg, rgba(194,204,209,.55), rgba(194,204,209,.08)); }
.mh__mark { position: absolute; right: -26px; bottom: -44px; width: 210px; opacity: .05; pointer-events: none; }

/* Floating frosted metric widgets (overlap a masthead with .wgt-grid--overlap) */
.wgt-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.wgt-grid--overlap { margin: -32px 8px 24px; position: relative; z-index: 2; }
.wgt { background: linear-gradient(135deg, rgba(255,255,255,.92) 0%, rgba(255,255,255,.78) 100%);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-brd); border-radius: var(--r-lg); padding: 15px 17px;
  box-shadow: var(--elev-2), var(--spec); transition: box-shadow .3s var(--ease-spring); }
.wgt:hover { box-shadow: var(--elev-3), var(--spec); }
.wgt__top { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.wgt__ico { width: 27px; height: 27px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.wgt__ico svg { width: 14px; height: 14px; }
.t-gold { background: rgba(155,168,176,.2); color: #4a565d; }
.t-rose { background: rgba(216,158,148,.24); color: #a05c52; }
.t-sage { background: rgba(146,186,164,.26); color: #3f7458; }
.t-sky  { background: rgba(74,134,168,.16); color: #3a6d8a; }
.wgt__lbl { font-size: var(--t-eyebrow); text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); font-weight: 600; }
.wgt__v { font-size: var(--t-value); font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }
.wgt__m { font-size: var(--t-caption); color: var(--muted); margin-top: 2px; }

/* iOS segmented control */
.seg { display: inline-flex; gap: 2px; flex-wrap: wrap;
  background: rgba(42,38,34,.07); border-radius: 14px; padding: 4px;
  box-shadow: inset 0 1px 2px rgba(42,38,34,.06); }
.seg__btn { border: none; background: transparent; font-family: inherit; font-weight: 600;
  color: var(--muted); padding: 8px 15px; cursor: pointer; font-size: var(--t-caption);
  border-radius: 10px; transition: all .25s var(--ease-spring); text-decoration: none; }
.seg__btn:hover { color: var(--ink); }
.seg__btn.active { background: rgba(255,255,255,.92); color: var(--ink);
  box-shadow: 0 3px 10px -4px rgba(38,45,48,.45), var(--spec); }

/* Glass content panel + hairline rows */
.panel { background: var(--glass-bg-strong); backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur); border: 1px solid var(--glass-brd);
  border-radius: var(--r-xl); box-shadow: var(--elev-1), var(--spec); padding: 22px 24px; }
/* ── Tablas anchas: se deslizan DENTRO de su panel ──────────────────────────
   Una tabla de 8 columnas no cabe en 375 px y nunca va a caber. Lo que no puede
   pasar es que arrastre la página entera de lado: en un móvil eso descoloca la
   barra de navegación y el usuario pierde la referencia de dónde está. Medido en
   /inventory: el panel medía 341 px y su contenido 712, y esos 371 px de más
   salían hasta el <html>.

   `:has()` en vez de una clase envoltorio a mano en cada plantilla: son 124
   plantillas y la que se olvide de ponerla es justo la que va a fallar. Solo
   afecta a los paneles que DE VERDAD llevan tabla. */
/* ── Barra de herramientas de una vista ─────────────────────────────────────
   Vivía dentro del <style> de agenda.html, dia.html y mes.html, pero la usan
   SEIS plantillas. En /configuracion y /finanzas/gastos la clase no existía:
   la barra caía a `display:block`, los botones se envolvían como texto en
   línea y se montaban 13 px unos sobre otros porque son más altos que el
   interlineado. Una clase compartida se define en un sitio compartido. */
.agenda-toolbar { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin: 14px 0 16px; }

.panel:has(table) { overflow-x: auto; }

/* El deslizamiento pide su propio respiro: sin esto la última columna queda
   pegada al borde y no se ve que hay más. */
.panel:has(table) > table { min-width: max-content; }

.panel--dark { background: linear-gradient(150deg, var(--slate) 0%, var(--slate-abyss) 100%); color: #f4f6f6;
  border-color: rgba(255,255,255,.08); }
.panel--dark .eyebrow { color: rgba(255,255,255,.55); }
.hairline-row { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--line); font-size: var(--t-body); }
.hairline-row:last-child { border-bottom: none; }

/* Conmutador de pastillas: sede activa, estado de duplicados, filtro de
   seguimiento. Nació tres veces con tres nombres distintos y los mismos
   píxeles; vive aquí para que las tres pantallas no se separen a la primera
   corrección. Scroll horizontal propio: en el teléfono no caben cuatro. */
.pill-switch { display: inline-flex; gap: 3px; padding: 4px; max-width: 100%; min-width: 0;
  background: var(--glass-bg-strong); backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur); border: 1px solid var(--glass-brd);
  border-radius: 999px; box-shadow: var(--spec); overflow-x: auto; scrollbar-width: none; }
.pill-switch::-webkit-scrollbar { height: 0; }
.pill { flex: none; padding: 7px 16px; border-radius: 999px; font-size: var(--t-caption);
  font-weight: 600; color: var(--muted); white-space: nowrap;
  transition: all .2s var(--ease-spring); }
.pill:hover { color: var(--ink); }
/* El gris de marca es superficie: el texto activo va oscuro, nunca blanco. */
.pill.is-active { background: var(--gold); color: #1e2427; box-shadow: 0 2px 8px rgba(155,168,176,.35); }
.pill__n { font-variant-numeric: lining-nums; opacity: .62; margin-left: 5px; }
@media (max-width: 640px) { .pill { padding: 7px 13px; } }

/* Buscador de pacientes (agenda y POS). Sustituye al <select> con los 6.289
   pacientes; los estilos viven aquí porque el desplegable se pinta en dos
   pantallas y el parcial que lo rellena es el mismo. */
.na-cliente { position: relative; }
/* Opaco a propósito: es una lista que se lee sobre otro contenido, y el cristal
   translúcido del resto del sistema aquí impide leer los nombres. */
.na-res { position: absolute; z-index: 30; left: 0; right: 0; top: 100%; margin-top: 4px;
  max-height: 230px; overflow-y: auto; background: #fff;
  border-radius: var(--r-md); box-shadow: var(--elev-2); }
.na-res:empty { display: none; }
.na-res:not(:empty) { border: 1px solid var(--glass-brd); }
.na-opt { display: block; width: 100%; text-align: left; border: 0; background: transparent;
  font-family: inherit; font-size: var(--t-caption); color: var(--ink); padding: 8px 12px;
  cursor: pointer; border-bottom: 1px solid var(--line); }
.na-opt:last-child { border-bottom: 0; }
.na-opt:hover { background: rgba(155,168,176,.16); }
.na-opt small { color: var(--muted); }
.na-empty { padding: 9px 12px; font-size: var(--t-caption); color: var(--muted); }

/* Paginación — mismo material glass que el resto del panel. Vive aquí y no en
   la plantilla del listado de clientes porque ya la usan dos pantallas. */
.pager { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.pager__meta { font-size: var(--t-caption); color: var(--muted); }
.pager__ctrl { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.pager__nums { display: flex; align-items: center; gap: 6px; }
.pager__btn { display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; min-height: 40px; padding: 0 13px; border-radius: var(--r-md);
  font-size: var(--t-caption); font-weight: 600; color: var(--ink);
  background: var(--glass-bg); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-brd); box-shadow: var(--elev-1);
  transition: background .18s ease, box-shadow .18s ease; cursor: pointer; }
.pager__btn:hover { background: var(--glass-bg-strong); box-shadow: var(--elev-2); color: var(--ink); }
/* El gris de marca es superficie, no texto: la página activa va en #333 sobre
   el chip gris, nunca blanco sobre gris claro. */
.pager__btn.is-active { background: var(--gold); border-color: transparent;
  color: var(--gold-deep); font-weight: 700; box-shadow: var(--elev-2); cursor: default; }
.pager__btn.is-off { opacity: .38; pointer-events: none; box-shadow: none; }
.pager__gap { color: var(--muted); padding: 0 2px; }
@media (max-width: 640px) {
  /* En móvil manda el pulgar: solo Anterior/Siguiente, a lo ancho. */
  .pager { flex-direction: column-reverse; align-items: stretch; }
  .pager__ctrl { margin-left: 0; justify-content: space-between; }
  .pager__nums { display: none; }
  .pager__btn { flex: 1; min-height: 46px; }
  .pager__meta { text-align: center; }
}

@media (max-width: 900px){ .wgt-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px){ .mh { padding: 22px 20px 46px; } .mh__axis { display: none; } }

/* ============================ Utilities ============================ */
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.muted { color: var(--muted); }
.mono-num { font-variant-numeric: lining-nums; }

/* keep older var names working */
:root { --hhc-gold: var(--gold); --hhc-gold-soft: var(--gold-soft); --hhc-gold-deep: var(--gold-deep);
  --hhc-charcoal: var(--charcoal); --hhc-ink: var(--ink); --hhc-muted: var(--muted); --hhc-line: var(--line); }

@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) {
  :root { --sidebar-w: 74px; }
  .sidebar__brand img { display: none; }
  .sidebar__brand::before { content: ""; width: 32px; height: 32px; margin: 0 auto;
    background: url('/static/img/logo-hhc-slate.png') center/contain no-repeat; }
  .sidebar__section { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
  .nav-item span, .sidebar__user div { display: none; }
}
@media (max-width: 640px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; height: auto; width: auto; margin: 10px; align-items: center; padding: 10px; overflow-x: auto; }
  .sidebar__brand, .sidebar__section, .sidebar__footer { display: none; }
  .sidebar__nav { flex-direction: row; }
  .main { padding: 16px; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* ============================ Signature pad ============================ */
.sig-open-btn { display:inline-flex; align-items:center; gap:7px; font-family:inherit;
  font-size:var(--t-caption); font-weight:600; color:var(--gold-deep); cursor:pointer;
  background:rgba(155,168,176,.1); border:1px solid rgba(155,168,176,.3); border-radius:11px; padding:8px 14px;
  transition:all .2s var(--ease-spring); }
.sig-open-btn:hover { background:rgba(155,168,176,.18); }
.sigpad { margin-top:12px; }
.sigpad__hint { font-size:var(--t-caption); color:var(--muted); margin-bottom:8px; }
.sigpad__frame { position:relative; background:#fff; border:1px solid var(--line); border-radius:var(--r-md);
  height:180px; overflow:hidden; box-shadow:inset 0 1px 3px rgba(42,38,34,.06); touch-action:none; }
.sig-canvas { display:block; width:100%; height:100%; cursor:crosshair; }
.sigpad__line { position:absolute; left:18px; right:18px; bottom:34px; border-bottom:1.5px dashed var(--line);
  color:transparent; font-size:0; }
.sigpad__frame::after { content:"Firma aquí"; position:absolute; left:18px; bottom:12px;
  font-size:var(--t-eyebrow); letter-spacing:.1em; text-transform:uppercase; color:var(--muted); pointer-events:none; }
.sigpad__actions { display:flex; gap:8px; justify-content:flex-end; margin-top:10px; }

/* Signed proof chip */
.sig-proof { display:flex; align-items:center; gap:12px; padding:12px 14px; border-radius:var(--r-md);
  background:rgba(79,157,105,.08); border:1px solid rgba(79,157,105,.25); }
.sig-proof img { height:44px; width:auto; max-width:130px; background:#fff; border-radius:8px; padding:3px 6px; border:1px solid var(--line); }
.sig-proof__meta { font-size:var(--t-caption); }
.sig-proof__meta b { display:block; color:#3c7d51; }
