/* NATSA — hoja de estilos.
   Criterio: herramienta de trabajo diaria, moderna y sutil. Tipografía del
   sistema, superficies claras con bordes suaves, sombras apenas visibles,
   transiciones cortas. El color se reserva para estado y acción.
   La CSP no permite estilos en línea: todo lo visual está acá.
   Políticas de íconos, carga y espacio: docs/INTERFAZ.md. */

:root {
  color-scheme: light; /* controles nativos (casillas, selectores, barras) siguen el tema elegido */
  --bg: #f4f6f9;
  --surface: #ffffff;
  --sunken: #f8fafc;
  --hover: #f1f4f8;
  --border: #e4e8ee;
  --border-strong: #cfd6df;
  --text: #0f172a;
  --soft: #334155;
  --muted: #64748b;

  --primary: #0369a1;
  --primary-strong: #075985;
  --primary-soft: #e6f3fb;
  --ring: rgba(3, 105, 161, .2);
  --success: #15803d;
  --success-soft: #e8f6ec;
  --warning: #b45309;
  --warning-soft: #fdf3e1;
  --danger: #c0262d;
  --danger-soft: #fdeceb;
  --on-color: #ffffff;

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-lg: 0 24px 48px -12px rgba(15, 23, 42, .25);
  --ease: cubic-bezier(.2, .8, .2, 1);

  --sidebar-w: 240px;
  --topbar-h: 60px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b111c;
  --surface: #111927;
  --sunken: #0e1622;
  --hover: #172234;
  --border: #1f2a3c;
  --border-strong: #2d3a50;
  --text: #e6ebf2;
  --soft: #c3cdda;
  --muted: #8995a8;
  --primary: #38b2ec;
  --primary-strong: #7cccf3;
  --primary-soft: rgba(56, 178, 236, .12);
  --ring: rgba(56, 178, 236, .28);
  --success: #4fbf74;
  --success-soft: rgba(79, 191, 116, .12);
  --warning: #e0a446;
  --warning-soft: rgba(224, 164, 70, .12);
  --danger: #ef6b62;
  --danger-soft: rgba(239, 107, 98, .12);
  --on-color: #0b111c;
  --shadow-sm: none;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .6);
}

/* --- Base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); min-height: 100vh; -webkit-font-smoothing: antialiased; }
h1 { font-size: 1.125rem; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; font-weight: 600; letter-spacing: -.01em; }
h3 { font-size: .95rem; font-weight: 600; }
h4 { font-size: .875rem; font-weight: 600; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
code { font-family: var(--mono); font-size: .85em; background: var(--sunken); border: 1px solid var(--border); padding: 0 4px; border-radius: 4px; }
details summary { cursor: pointer; }
svg.lucide { stroke-width: 1.75; flex-shrink: 0; }
.skip-link { position: absolute; left: -9999px; top: 8px; background: var(--surface); padding: 6px 10px; z-index: 100; }
.skip-link:focus { left: 8px; }

/* --- Estructura ------------------------------------------------------------ */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border);
  position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 16px; height: var(--topbar-h); border-bottom: 1px solid var(--border); }
.brand-logo { width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0; }
.brand-name { font-weight: 700; font-size: 1rem; letter-spacing: .02em; line-height: 1.2; }
.brand-sub { font-size: .72rem; color: var(--muted); line-height: 1.3; }
.nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.nav-label { font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 12px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 1px 0; border-radius: var(--radius);
  color: var(--soft); font-weight: 500; transition: background .12s, color .12s;
}
.nav-item svg { width: 18px; height: 18px; color: var(--muted); transition: color .12s; }
.nav-item:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item.active svg { color: var(--primary); }
.nav-sep { height: 1px; background: var(--border); margin: 10px 6px; }
.sidebar-foot { border-top: 1px solid var(--border); padding: 12px; display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: var(--primary-soft); color: var(--primary); font-weight: 600; font-size: .85rem;
}
.who { flex: 1; min-width: 0; line-height: 1.3; }
.who b { display: block; font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who span { font-size: .75rem; color: var(--muted); }
.backdrop { display: none; }
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 0 24px; height: var(--topbar-h);
  background: color-mix(in srgb, var(--surface) 85%, transparent); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30;
}
.topbar .sub { font-size: .78rem; color: var(--muted); }
.spacer { flex: 1; }
.topbar .menu-btn { display: none; }

/* Política de espacio: el contenido ocupa todo el ancho de la ventana y el último
   bloque de cada pantalla se estira hasta el pie, así no quedan zonas vacías a la
   derecha ni debajo. Los formularios sueltos (contraseña) conservan su tamaño. */
.view { padding: 20px 24px 24px; width: 100%; flex: 1; display: flex; flex-direction: column; }
.view:focus { outline: none; }
.view > .card:last-child:not(.login-card), .view > .grid-side:last-child { flex: 1; }
.view > .card:last-child:not(.login-card) { display: flex; flex-direction: column; }
.view > .login-card { max-width: 520px; }
.view > .grid-side:last-child { align-items: stretch; }
.view > .grid-side:last-child > .card { display: flex; flex-direction: column; }
.view > .grid-side:last-child > .stack > .card:last-child { flex: 1; }
.view > .fill:last-child { flex: 1; display: flex; flex-direction: column; }
.fill > .card:last-child, .fill > .grid-2:last-child { flex: 1; }
.fill > .grid-2:last-child { align-items: stretch; }

/* --- Política de carga (ver app.js y core/progress.js) --------------------- */
#progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 90; overflow: hidden; opacity: 0; transition: opacity .2s; pointer-events: none; }
#progress.on { opacity: 1; }
#progress.end { opacity: 0; }
#progress::before { content: ""; position: absolute; top: 0; bottom: 0; width: 35%; background: var(--primary); border-radius: 2px; animation: progress 1.1s var(--ease) infinite; }
@keyframes progress { from { left: -35%; } to { left: 100%; } }
.view.is-refreshing > * { opacity: .55; pointer-events: none; transition: opacity .15s; }
.view.entering > * { animation: enter .18s var(--ease); }
@keyframes enter { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.skeleton { gap: 12px; }
.sk { border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--hover) 0%, var(--sunken) 50%, var(--hover) 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.sk-title { height: 18px; width: 220px; }
.sk-bar { height: 34px; width: 60%; margin-bottom: 8px; }
.sk-line { height: 14px; }
.sk-line:nth-child(odd) { width: 92%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.is-busy { position: relative; pointer-events: none; }
.btn.is-busy::before, .icon-btn.is-busy::before {
  content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite; flex-shrink: 0;
}
.btn.is-busy svg { display: none; }
.icon-btn.is-busy svg { visibility: hidden; }
.icon-btn.is-busy::before { position: absolute; }

/* --- Bloques --------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.card-sub { color: var(--muted); font-size: .85rem; margin: -8px 0 14px; }
.box { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; background: var(--surface); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.grid-side { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; }

/* --- Indicadores del Panel ------------------------------------------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; box-shadow: var(--shadow-sm); }
.kpi-label { font-size: .78rem; font-weight: 500; color: var(--muted); }
.kpi-value { font-size: 1.75rem; font-weight: 600; line-height: 1.25; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi-foot { font-size: .75rem; color: var(--muted); }
.kpi-alerta .kpi-value { color: var(--danger); }

/* --- Botones --------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px;
  font: inherit; font-size: .875rem; font-weight: 500; line-height: 1; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius); cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow-sm); transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}
.btn:hover { background: var(--hover); text-decoration: none; }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.is-busy:disabled { opacity: .8; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.btn svg { width: 16px; height: 16px; }
.btn-primary, .btn-accent { background: var(--primary); border-color: var(--primary); color: var(--on-color); }
.btn-primary:hover, .btn-accent:hover { background: var(--primary-strong); border-color: var(--primary-strong); }
.btn-success { background: var(--success); border-color: var(--success); color: var(--on-color); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); background: var(--surface); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { background: none; border-color: transparent; box-shadow: none; }
.btn-sm { height: 30px; padding: 0 10px; font-size: .8125rem; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid transparent;
  background: none; color: var(--muted); border-radius: var(--radius); cursor: pointer; font: inherit; flex-shrink: 0;
  transition: background .12s, color .12s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }
.btn-link { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; }
.btn-link:hover { text-decoration: underline; }

/* --- Pestañas -------------------------------------------------------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tab {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; margin-bottom: -1px; border: 0;
  border-bottom: 2px solid transparent; background: none; font: inherit; font-size: .875rem; font-weight: 500;
  color: var(--muted); cursor: pointer; transition: color .12s, border-color .12s;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab svg { width: 16px; height: 16px; }

/* --- Formularios ----------------------------------------------------------- */
.field { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lbl { display: block; font-size: .8125rem; font-weight: 500; margin-bottom: 6px; color: var(--soft); }
.input, select.input, textarea.input {
  width: 100%; min-height: 36px; padding: 7px 11px; font: inherit; font-size: .875rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  transition: border-color .12s, box-shadow .12s;
}
textarea.input { min-height: 72px; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input-hint { font-size: .78rem; color: var(--muted); margin-top: 6px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.search-wrap { position: relative; flex: 1; min-width: 220px; }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-right: 76px; }
.input-group .btn-link { position: absolute; right: 10px; font-size: .8rem; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.filters .input { width: auto; min-width: 150px; }
.filters .search-wrap .input { width: 100%; }
.uppercase { text-transform: uppercase; }

/* --- Tablas ---------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.tbl { width: 100%; border-collapse: collapse; font-size: .875rem; }
.tbl th { text-align: left; font-weight: 600; font-size: .75rem; color: var(--muted); padding: 9px 12px; background: var(--sunken); border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .1s; }
.tbl tbody tr:hover { background: var(--sunken); }
.tbl .num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-dim { color: var(--muted); }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 8px 16px; font-size: .875rem; }
.kv dt { color: var(--muted); }

/* --- Etiquetas ------------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; font-size: .72rem; font-weight: 500; line-height: 1.6; border-radius: 999px; color: var(--soft); background: var(--hover); white-space: nowrap; }
.badge-success { color: var(--success); background: var(--success-soft); }
.badge-warning { color: var(--warning); background: var(--warning-soft); }
.badge-danger { color: var(--danger); background: var(--danger-soft); }
.badge-primary, .badge-info { color: var(--primary); background: var(--primary-soft); }
.chip { display: inline-block; font-size: .72rem; color: var(--soft); padding: 0 7px; border: 1px solid var(--border); border-radius: 999px; margin: 1px 2px 1px 0; background: var(--surface); }
.chip-neutral { color: var(--muted); }

/* --- Barras de ocupación --------------------------------------------------- */
.meter { height: 4px; background: var(--hover); border-radius: 999px; overflow: hidden; }
.meter > span { display: block; height: 100%; width: 0; background: var(--success); border-radius: 999px; transition: width .3s var(--ease); }
.meter.warn > span { background: var(--warning); }
.meter.full > span { background: var(--danger); }

/* --- Tablero de turnos: semana con columna de horarios --------------------- */
.board-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.board-week {
  display: grid; grid-template-columns: 64px repeat(7, minmax(124px, 1fr));
  grid-template-rows: auto; grid-auto-rows: minmax(56px, auto); align-content: start;
  flex: 1; overflow: auto; border-top: 1px solid var(--border); margin: 0 -20px -18px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.bw-corner, .bw-head { position: sticky; top: 0; z-index: 2; background: var(--surface); border-bottom: 1px solid var(--border); }
.bw-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 6px; padding: 8px 10px; border-left: 1px solid var(--border); }
.bw-day { display: inline-flex; align-items: baseline; gap: 6px; border: 0; background: none; font: inherit; color: var(--soft); cursor: pointer; padding: 2px 4px; margin: -2px -4px; border-radius: var(--radius-sm); }
.bw-day span { font-size: .8rem; color: var(--muted); }
.bw-day b { font-weight: 600; }
.bw-day:hover { background: var(--hover); }
.bw-head.today .bw-day b { color: var(--primary); }
.bw-head.today { box-shadow: inset 0 -2px 0 var(--primary); }
.bw-load { font-size: .75rem; color: var(--muted); }
.bw-exc { flex-basis: 100%; font-size: .72rem; color: var(--warning); background: var(--warning-soft); border-radius: var(--radius-sm); padding: 1px 6px; }
.bw-time { font-size: .72rem; color: var(--muted); text-align: right; padding: 6px 10px 0 0; border-top: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.bw-time.now { color: var(--primary); font-weight: 600; }
.bw-cell { border-left: 1px solid var(--border); border-top: 1px solid var(--border); padding: 4px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.bw-cell.today { background: color-mix(in srgb, var(--primary) 3%, var(--surface)); }
.slot {
  --tone: var(--success);
  display: block; width: 100%; text-align: left; font: inherit; color: var(--text); cursor: pointer;
  background: color-mix(in srgb, var(--tone) 7%, var(--surface)); border: 1px solid color-mix(in srgb, var(--tone) 22%, var(--border));
  border-left: 3px solid var(--tone); border-radius: var(--radius); padding: 6px 8px;
  transition: box-shadow .12s, transform .12s;
}
.slot:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.slot.warn { --tone: var(--warning); }
.slot.full { --tone: var(--danger); }
.slot.cancelled { --tone: var(--border-strong); color: var(--muted); }
.slot.cancelled .slot-act { text-decoration: line-through; }
.slot-top { display: flex; justify-content: space-between; gap: 6px; }
.slot-time { font-size: .75rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--soft); }
.slot-count { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.slot-act { font-size: .85rem; font-weight: 600; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-meta { font-size: .72rem; color: var(--muted); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-list .slot { display: grid; grid-template-columns: 110px 1fr 160px; gap: 12px; align-items: center; padding: 10px 12px; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; font-size: .75rem; color: var(--muted); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.legend .lg-ok { background: var(--success); }
.legend .lg-warn { background: var(--warning); }
.legend .lg-full { background: var(--danger); }
.legend .lg-cancel { background: var(--border-strong); }

/* --- Avisos ---------------------------------------------------------------- */
.alert { display: block; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--sunken); font-size: .875rem; color: var(--soft); }
.alert-info { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 20%, var(--border)); }
.alert-success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 20%, var(--border)); }
.alert-warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 25%, var(--border)); }
.alert-danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 25%, var(--border)); }
button.alert { width: 100%; text-align: left; font: inherit; cursor: pointer; transition: box-shadow .12s; }
button.alert:hover { box-shadow: var(--shadow); }

/* --- Ventana modal --------------------------------------------------------- */
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .4); backdrop-filter: blur(2px); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px; z-index: 50; overflow-y: auto; animation: fade .15s ease-out; }
.modal-box { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; width: 100%; max-width: 540px; box-shadow: var(--shadow-lg); animation: pop .18s var(--ease); }
.modal-box.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--sunken); border-radius: 0 0 14px 14px; }
body.modal-open { overflow: hidden; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }

/* --- Avisos flotantes ------------------------------------------------------ */
#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: 380px; }
.toast {
  background: #0f172a; color: #f1f5f9; padding: 10px 14px 10px 16px; border-radius: 10px; font-size: .875rem;
  box-shadow: var(--shadow-lg); border-left: 3px solid #4fbf74; animation: pop .18s var(--ease); transition: opacity .25s, transform .25s;
}
[data-theme="dark"] .toast { background: #1d2a3f; }
.toast.error { border-left-color: #ef6b62; }
.toast.warn { border-left-color: #e0a446; }
.toast.info { border-left-color: #38b2ec; }
.toast.leaving { opacity: 0; transform: translateY(4px); }

/* --- Estados ------------------------------------------------------------- */
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty b { display: block; color: var(--soft); font-weight: 600; }
.empty p { font-size: .85rem; margin-top: 2px; }
.loading { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); padding: 24px; }
.spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 14px; flex-wrap: wrap; }
.pager .btn svg { width: 15px; height: 15px; }

/* --- Ficha del socio y asistencia ------------------------------------------ */
.profile-head { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.profile-avatar {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: var(--primary-soft); color: var(--primary); font-weight: 600; font-size: 1.15rem;
}
.att-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; }
.seg { display: inline-flex; padding: 2px; gap: 2px; background: var(--hover); border-radius: var(--radius); }
.seg button { border: 0; background: none; color: var(--soft); padding: 4px 10px; font: inherit; font-size: .8rem; font-weight: 500; border-radius: var(--radius-sm); cursor: pointer; transition: background .12s, color .12s; }
.seg button:hover:not(:disabled) { background: var(--surface); }
.seg button:disabled { cursor: default; }
.seg button[aria-pressed="true"] { box-shadow: var(--shadow); }
.seg button[aria-pressed="true"].st-presente { background: var(--success); color: var(--on-color); }
.seg button[aria-pressed="true"].st-tarde { background: var(--warning); color: var(--on-color); }
.seg button[aria-pressed="true"].st-ausente { background: var(--danger); color: var(--on-color); }
.seg button[aria-pressed="true"].st-justificado { background: var(--primary); color: var(--on-color); }
.pick-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); margin-top: 6px; }
.pick-list button { display: flex; width: 100%; justify-content: space-between; gap: 8px; padding: 8px 12px; border: 0; background: var(--surface); color: var(--text); text-align: left; font: inherit; cursor: pointer; }
.pick-list button:hover { background: var(--hover); }
.pick-list button + button { border-top: 1px solid var(--border); }
.diff { font-family: var(--mono); font-size: .75rem; white-space: pre-wrap; word-break: break-word; color: var(--soft); }

/* --- Ingreso --------------------------------------------------------------- */
.login-body { display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login { width: 100%; max-width: 380px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.login-brand .brand-logo { width: 40px; height: 40px; border-radius: 10px; }
.login-brand .brand-name { font-size: 1.25rem; }
.login-card { padding: 24px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 1.15rem; margin-bottom: 2px; }
.login-card .btn-block { height: 38px; }

/* --- Utilidades ------------------------------------------------------------ */
.muted { color: var(--muted); }
.soft { color: var(--soft); }
.small { font-size: .85rem; }
.tiny { font-size: .75rem; }
.bold { font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }
.t-success { color: var(--success); }
.t-danger { color: var(--danger); }
.t-warning { color: var(--warning); }
.t-primary { color: var(--primary); }
.mt-1 { margin-top: 6px; } .mb-1 { margin-bottom: 6px; }
.mt-2 { margin-top: 12px; } .mb-2 { margin-bottom: 12px; }
.mt-3 { margin-top: 18px; } .mb-3 { margin-bottom: 18px; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; }
.nowrap { white-space: nowrap; }
.scroll-y { max-height: 50vh; overflow-y: auto; }
.w-auto { width: auto; }
.flex-1 { flex: 1; min-width: 0; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-center { text-align: center; }
.clickable { cursor: pointer; }
.capitalize { text-transform: capitalize; }
.pre-wrap { white-space: pre-wrap; }
.mono { font-family: var(--mono); font-size: .8rem; }
.pad { padding: 8px 10px; }
.border-danger { border-color: var(--danger) !important; }
.border-primary { border-color: var(--primary) !important; }
.btn-ghost.bold, .btn-ghost.t-primary { padding: 0; height: auto; font: inherit; font-weight: 600; border: 0; background: none; color: inherit; cursor: pointer; }
.btn-ghost.t-primary { color: var(--primary); }

/* --- Pantallas chicas ------------------------------------------------------ */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .grid-side { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s var(--ease); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .backdrop.show { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .35); z-index: 35; }
  .main { margin-left: 0; }
  .topbar { padding: 0 12px; }
  .topbar .menu-btn { display: inline-grid; }
  .topbar .sub { display: none; }
  .view { padding: 14px 12px 20px; }
  .card { padding: 14px; }
  .board-week { margin: 0 -14px -14px; }
  .grid-2, .grid-3, .field-row { grid-template-columns: 1fr; }
  .day-list .slot { grid-template-columns: 1fr; gap: 2px; }
  .modal { padding: 0; align-items: flex-end; }
  .modal-box, .modal-box.wide { max-width: none; border-radius: 14px 14px 0 0; }
  .kv { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}
@media print {
  .sidebar, .topbar, #toasts, .backdrop, #progress { display: none !important; }
  .main { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
