/* ==========================================================================
   Sana — sistema de diseño
   Tokens · base · layout · componentes · vistas · responsive
   ========================================================================== */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Consolas, monospace;

  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fafafc;
  --fill: rgba(0, 0, 0, 0.035);
  --fill-2: rgba(0, 0, 0, 0.06);
  --fill-3: rgba(0, 0, 0, 0.09);
  --line: rgba(0, 0, 0, 0.075);
  --line-2: rgba(0, 0, 0, 0.13);
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #8e8e93;
  --invert: #1d1d1f;
  --on-invert: #ffffff;

  --accent: #0066d6;
  --accent-hover: #0a72e4;
  --accent-press: #0059bd;
  --accent-soft: rgba(0, 102, 214, 0.09);
  --accent-text: #0060c9;

  --green: #1d8348;
  --green-soft: rgba(29, 131, 72, 0.1);
  --orange: #b35c00;
  --orange-soft: rgba(214, 120, 0, 0.11);
  --red: #c9162b;
  --red-soft: rgba(201, 22, 43, 0.08);
  --violet: #6b4fbb;
  --violet-soft: rgba(107, 79, 187, 0.1);

  --t-consulta: #0066d6;
  --t-control: #1d8348;
  --t-lectura: #b35c00;
  --t-procedimiento: #6b4fbb;

  --r-xs: 6px;
  --r-s: 8px;
  --r-m: 12px;
  --r-l: 16px;
  --r-xl: 20px;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);
  --shadow-pop: 0 0 0 0.5px rgba(0, 0, 0, 0.08), 0 10px 30px rgba(0, 0, 0, 0.1), 0 30px 60px rgba(0, 0, 0, 0.06);
  --focus: 0 0 0 3px rgba(0, 102, 214, 0.28);

  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --sidebar-w: 232px;
  --topbar-h: 56px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0b0b0c;
  --surface: #161617;
  --surface-2: #1c1c1e;
  --fill: rgba(255, 255, 255, 0.045);
  --fill-2: rgba(255, 255, 255, 0.07);
  --fill-3: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: #7c7c80;
  --invert: #f5f5f7;
  --on-invert: #1d1d1f;
  --accent: #2b8cff;
  --accent-hover: #4a9dff;
  --accent-press: #1a7cf0;
  --accent-soft: rgba(43, 140, 255, 0.14);
  --accent-text: #5aa7ff;
  --green: #3ac270;
  --green-soft: rgba(58, 194, 112, 0.13);
  --orange: #f0a038;
  --orange-soft: rgba(240, 160, 56, 0.14);
  --red: #ff5a64;
  --red-soft: rgba(255, 90, 100, 0.13);
  --violet: #a58cf0;
  --violet-soft: rgba(165, 140, 240, 0.14);
  --t-consulta: #2b8cff;
  --t-control: #3ac270;
  --t-lectura: #f0a038;
  --t-procedimiento: #a58cf0;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 0 0 0.5px rgba(255, 255, 255, 0.06), 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-pop: 0 0 0 0.5px rgba(255, 255, 255, 0.1), 0 20px 50px rgba(0, 0, 0, 0.55);
  --focus: 0 0 0 3px rgba(43, 140, 255, 0.35);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: -0.006em;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01", "tnum" 0;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 600; letter-spacing: -0.022em; }
p { margin: 0; }
svg { flex-shrink: 0; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-s); }
::selection { background: var(--accent-soft); }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 0.92em; letter-spacing: 0; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ico-sm { width: 15px; height: 15px; }
.ico-xs { width: 13px; height: 13px; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 14px 12px 12px;
  border-right: 1px solid var(--line);
  background: var(--surface-2);
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; }
.brand-text { min-width: 0; flex: 1; }
.nav-collapse { margin-left: auto; flex-shrink: 0; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--invert); color: var(--on-invert);
}
.brand-mark svg { width: 16px; height: 16px; stroke-width: 2; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: -0.02em; }
.brand-sub { font-size: 11.5px; color: var(--text-3); margin-top: -1px; }

.nav-group { margin-bottom: 18px; }
.nav-label { font-size: 11px; font-weight: 500; color: var(--text-3); padding: 0 10px 6px; letter-spacing: 0.01em; }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  width: 100%; height: 34px; padding: 0 10px;
  border-radius: var(--r-s);
  color: var(--text-2); font-weight: 500; font-size: 13.5px;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.nav-item .ico { width: 17px; height: 17px; }
.nav-item:hover { background: var(--fill); color: var(--text); }
.nav-item[aria-current="page"] { background: var(--fill-2); color: var(--text); }
.nav-item[aria-current="page"] .ico { color: var(--accent); }
.nav-count { margin-left: auto; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.user-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px; border-radius: var(--r-m); text-align: left;
  transition: background 0.15s var(--ease);
}
.user-btn:hover { background: var(--fill); }
.user-meta { min-width: 0; flex: 1; }
.user-name { display: block; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; color: var(--text-3); }

.avatar {
  --a: var(--fill-3);
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; flex-shrink: 0;
  background: var(--a); color: var(--text);
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.01em;
}
.avatar[style] { color: #1d1d1f; }
.avatar.lg { width: 48px; height: 48px; font-size: 16px; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s var(--ease);
}
.topbar.scrolled { border-bottom-color: var(--line); }
.icon-btn.menu-btn { display: none; }
.search {
  display: flex; align-items: center; gap: 8px;
  width: min(360px, 100%); min-width: 0; height: 34px; padding: 0 10px;
  border-radius: var(--r-s);
  background: var(--fill); color: var(--text-3);
  transition: background 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.search:hover { background: var(--fill-2); }
.search:focus-within { background: var(--surface); box-shadow: 0 0 0 1px var(--line-2), var(--focus); }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--text); }
.search input::placeholder { color: var(--text-3); }
.kbd {
  font-size: 11px; font-family: var(--font); color: var(--text-3);
  border: 1px solid var(--line-2); border-radius: 5px; padding: 0 5px; line-height: 17px;
}
.topbar-spacer { flex: 1; }
.topbar-group { display: flex; align-items: center; gap: 4px; }

.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.status-dot.off { background: var(--orange); box-shadow: 0 0 0 3px var(--orange-soft); }

.content { padding: 20px 28px 40px; width: 100%; }
.view { animation: viewIn 0.35s var(--ease-out); }
@keyframes viewIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; flex-wrap: wrap; }
.eyebrow { font-size: 12.5px; color: var(--text-2); font-weight: 500; margin-bottom: 4px; }
.page-title { font-size: 26px; line-height: 1.15; letter-spacing: -0.028em; }
.page-sub { color: var(--text-2); margin-top: 4px; max-width: 72ch; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1; }
.page-actions .pos-config { margin-left: auto; }
.pos-docs { display: inline-flex; align-items: center; gap: 8px; }
.pos-cai-left { display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border-radius: 7px; background: var(--fill); color: var(--text-2); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos-cai-left.advertencia { background: var(--orange-soft); color: var(--orange); }
.pos-cai-left.critico { background: var(--red-soft); color: var(--red); }

/* ---------- Buttons ---------- */
.btn {
  --h: 34px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: var(--h); padding: 0 14px;
  border-radius: var(--r-s);
  font-weight: 500; font-size: 13.5px; white-space: nowrap;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), box-shadow 0.15s var(--ease), transform 0.08s var(--ease), opacity 0.15s;
  user-select: none;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.4; cursor: not-allowed; }
.btn .ico { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:active:not(:disabled) { background: var(--accent-press); }
.btn-dark { background: var(--invert); color: var(--on-invert); }
.btn-dark:hover:not(:disabled) { opacity: 0.88; }
.btn-secondary { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2), var(--shadow-1); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-2), 0 1px 3px rgba(0,0,0,.06); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--fill); color: var(--text); }
.btn-danger { color: var(--red); background: var(--red-soft); }
.btn-danger:hover:not(:disabled) { background: color-mix(in srgb, var(--red) 14%, transparent); }
.btn-sm { --h: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-lg { --h: 42px; padding: 0 20px; font-size: 14.5px; border-radius: 10px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 34px; height: 34px; border-radius: var(--r-s);
  display: inline-grid; place-items: center; color: var(--text-2);
  position: relative;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.icon-btn:hover { background: var(--fill); color: var(--text); }
.icon-btn.sm { width: 28px; height: 28px; border-radius: 7px; }
.icon-btn .badge-dot { position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px var(--bg); }

/* ---------- Segmented control ---------- */
.segmented {
  display: inline-flex; padding: 2px; gap: 2px;
  background: var(--fill-2); border-radius: 9px;
}
.segmented button {
  height: 28px; padding: 0 12px; white-space: nowrap; flex: 1 1 auto; border-radius: 7px;
  font-size: 13px; font-weight: 500; color: var(--text-2);
  transition: background 0.2s var(--ease), color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 0 0 0.5px rgba(0,0,0,.06); }
:root[data-theme="dark"] .segmented button[aria-pressed="true"] { background: #3a3a3c; }

/* ---------- Surfaces ---------- */
.panel {
  background: var(--surface);
  border-radius: var(--r-l);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-1);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px 0; }
.panel-title { font-size: 15px; font-weight: 600; letter-spacing: -0.012em; font-family: var(--font-display); }
.panel-sub { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.panel-body { padding: 12px 18px 16px; }
.divider { height: 1px; background: var(--line); margin: 0; border: 0; }

.grid { display: grid; gap: 14px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.gap-4 { gap: 4px; } .gap-12 { gap: 12px; } .gap-16 { gap: 14px; } .gap-24 { gap: 24px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }

/* ---------- Badges / pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 500; white-space: nowrap;
  background: var(--fill-2); color: var(--text-2);
}
.pill .ico { width: 12px; height: 12px; stroke-width: 2; }
.pill.blue { background: var(--accent-soft); color: var(--accent-text); }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.orange { background: var(--orange-soft); color: var(--orange); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.violet { background: var(--violet-soft); color: var(--violet); }
.pill.outline { background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); }
.pill.dashed { background: transparent; box-shadow: none; border: 1px dashed var(--line-2); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.type-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.t-consulta { --t: var(--t-consulta); }
.t-control { --t: var(--t-control); }
.t-lectura { --t: var(--t-lectura); }
.t-procedimiento { --t: var(--t-procedimiento); }
.type-dot { background: var(--t); }

/* Roadmap marker (MEJ) */
.rm {
  display: none; align-items: center; gap: 4px;
  height: 18px; padding: 0 6px; border-radius: 5px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.01em; vertical-align: middle;
  white-space: nowrap;
}
body:not(.show-roadmap) .rm { display: none !important; }
.show-roadmap .rm { display: inline-flex; }
.rm.done { background: var(--green-soft); color: var(--green); }
.rm.pending { background: var(--orange-soft); color: var(--orange); }
.rm.tbd { background: var(--violet-soft); color: var(--violet); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.label .req { color: var(--red); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 12px;
  border-radius: var(--r-s);
  background: var(--surface);
  border: 1px solid var(--line-2);
  outline: none;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: color-mix(in srgb, var(--text) 24%, transparent); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: var(--focus); }
.input:disabled { background: var(--fill); color: var(--text-3); }
.select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.textarea { height: auto; min-height: 88px; padding: 10px 12px; line-height: 1.55; resize: vertical; }
.textarea.bare { border: 0; padding: 0; min-height: 30px; box-shadow: none; background: transparent; resize: none; }
.textarea.bare:focus { box-shadow: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.hint { font-size: 12px; color: var(--text-3); }

.switch { position: relative; width: 38px; height: 23px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--fill-3); transition: background 0.2s var(--ease); }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2), 0 0 0 0.5px rgba(0,0,0,.04); transition: transform 0.22s var(--ease-out); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(15px); }
.switch input:focus-visible + span { box-shadow: var(--focus); }
.switch input:disabled + span { opacity: 0.45; }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px; border-radius: 999px;
  font-size: 13px; font-weight: 500; color: var(--text-2);
  box-shadow: inset 0 0 0 1px var(--line-2);
  transition: all 0.15s var(--ease);
}
.chip:hover { color: var(--text); background: var(--fill); }
.chip[aria-pressed="true"] { background: var(--invert); color: var(--on-invert); box-shadow: none; }
.chip:disabled { opacity: 0.4; cursor: not-allowed; text-decoration: line-through; }

/* ---------- Lists & tables ---------- */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px; min-height: 48px;
  border-top: 1px solid var(--line);
  text-align: left; width: 100%;
  transition: background 0.12s var(--ease);
}
.list-item:first-child { border-top: 0; }
button.list-item:hover, a.list-item:hover { background: var(--surface-2); text-decoration: none; }
.li-main { flex: 1; min-width: 0; }
.li-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.li-sub { font-size: 12.5px; color: var(--text-2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-time { font-variant-numeric: tabular-nums; font-weight: 500; width: 48px; color: var(--text); font-size: 13px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-weight: 500; font-size: 12px; color: var(--text-3);
  padding: 9px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background 0.12s var(--ease); }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: var(--surface-2); }
.table .r { text-align: right; }
.table td.r { font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tr.voided td { color: var(--text-3); }
.table tr.voided .strike { text-decoration: line-through; }

/* ---------- Tabs (underline) ---------- */
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; height: 42px; display: inline-flex; align-items: center; gap: 6px;
  font-weight: 500; color: var(--text-2); white-space: nowrap;
  transition: color 0.15s var(--ease);
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--text); }
.tab .count { font-size: 11.5px; color: var(--text-3); font-weight: 500; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { padding: 14px 18px; border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; }
.stat-label { font-size: 12.5px; color: var(--text-2); }
.stat-value { font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: -0.03em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ---------- Callout ---------- */
.callout {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--r-m);
  background: var(--fill); color: var(--text-2); font-size: 13px;
}
.callout .ico { margin-top: 1px; color: var(--text-3); }
.callout strong { color: var(--text); font-weight: 600; }
.callout.info { background: var(--accent-soft); }
.callout.info .ico { color: var(--accent); }
.callout.warn { background: var(--orange-soft); }
.callout.warn .ico { color: var(--orange); }
.callout.lock .ico { color: var(--text-2); }

/* ---------- Agenda: day grid ---------- */
.agenda-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.date-nav { display: flex; align-items: center; gap: 2px; }
.date-label { display: inline-block; font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: -0.018em; margin-left: 8px; }
.date-label::first-letter, .eyebrow::first-letter { text-transform: uppercase; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

.cal { overflow: auto; max-height: calc(100vh - 200px); border-radius: var(--r-l); }
.cal-grid { display: grid; min-width: 720px; position: relative; }
.cal-head {
  position: sticky; top: 0; z-index: 3;
  padding: 14px 14px 12px; background: var(--surface);
  border-bottom: 1px solid var(--line); border-left: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.cal-corner { position: sticky; left: 0; top: 0; z-index: 4; background: var(--surface); border-bottom: 1px solid var(--line); }
.cal-head-name { font-weight: 600; font-size: 13.5px; }
.cal-head-sub { font-size: 12px; color: var(--text-3); }
.cal-times { position: sticky; left: 0; z-index: 2; background: var(--surface); }
.cal-time { height: 88px; font-size: 11px; color: var(--text-3); text-align: right; padding: 0 10px 0 0; transform: translateY(-7px); font-variant-numeric: tabular-nums; }
.cal-col { position: relative; border-left: 1px solid var(--line); background-image: linear-gradient(var(--line) 1px, transparent 1px); background-size: 100% 88px; }
.cal-col::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(color-mix(in srgb, var(--line) 50%, transparent) 1px, transparent 1px); background-size: 100% 44px; background-position: 0 44px; pointer-events: none; }
.cal-col.off {
  background-color: var(--surface-2);
  background-image: repeating-linear-gradient(-45deg, transparent 0 7px, var(--fill-2) 7px 8px);
}
.cal-col.off::after { display: none; }
.off-label {
  position: sticky; top: 72px; margin: 16px auto 0; width: max-content; max-width: calc(100% - 20px);
  display: flex; align-items: center; gap: 6px; z-index: 1;
  padding: 6px 10px; border-radius: 999px; background: var(--surface); box-shadow: 0 0 0 1px var(--line);
  font-size: 12px; color: var(--text-2); font-weight: 500;
}
.slot-hit { position: absolute; left: 0; right: 0; height: 44px; z-index: 0; }
.slot-hit:hover { background: var(--accent-soft); }
.slot-hit:hover::after { content: "+ Nueva cita"; position: absolute; left: 10px; top: 13px; font-size: 11.5px; color: var(--accent-text); font-weight: 500; }

.appt {
  position: absolute; left: 6px; right: 6px; z-index: 1;
  padding: 6px 9px 6px 11px; border-radius: 9px;
  background: color-mix(in srgb, var(--t) 8%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--t) 16%, transparent);
  text-align: left; overflow: hidden;
  transition: box-shadow 0.15s var(--ease), transform 0.15s var(--ease);
}
.appt::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--t); }
.appt:hover { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--t) 34%, transparent), var(--shadow-2); z-index: 2; }
.appt.short { display: flex; align-items: center; gap: 8px; padding-top: 0; padding-bottom: 0; }
.appt.short .appt-name { margin: 0; }
.appt-time { font-size: 11px; color: var(--text-2); font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 6px; }
.appt-name { font-size: 12.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.appt-meta { font-size: 11px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt.done { opacity: 0.55; }
.appt.unlinked { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2); }
.appt.unlinked { background-image: repeating-linear-gradient(-45deg, transparent 0 6px, var(--fill) 6px 7px); }
.now-line { position: absolute; left: 0; right: 0; height: 0; border-top: 1.5px solid var(--red); z-index: 3; pointer-events: none; }
.now-line::before { content: ""; position: absolute; left: -4px; top: -4.5px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); }

/* Week */
.week-head-day { font-size: 12px; color: var(--text-3); text-transform: capitalize; }
.week-head-num { font-family: var(--font-display); font-weight: 600; font-size: 20px; letter-spacing: -0.02em; line-height: 1.1; }
.week-head-num.today { color: #fff; background: var(--red); border-radius: 999px; padding: 0 8px; }

/* Atención (pipeline) */
.flow-steps { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); flex-wrap: wrap; }
.flow-steps .sep { width: 14px; height: 1px; background: var(--line-2); }
.flow-steps .on { color: var(--text); font-weight: 500; }
.progress-steps { display: flex; gap: 3px; }
.progress-steps i { width: 18px; height: 4px; border-radius: 3px; background: var(--fill-3); }
.progress-steps i.on { background: var(--green); }
.progress-steps i.cur { background: var(--accent); }

/* ---------- Doctor queue ---------- */
.queue-hero { padding: 18px 20px; display: flex; gap: 24px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.next-label { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.next-name { font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: -0.025em; margin-top: 2px; }
.next-meta { color: var(--text-2); margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.vitals-inline { display: flex; gap: 6px 18px; flex-wrap: wrap; margin-top: 10px; }
.vital { min-width: 64px; }
.vital-l { font-size: 11.5px; color: var(--text-3); }
.vital-v { font-weight: 600; font-variant-numeric: tabular-nums; font-size: 15px; }
.vital-v small { font-weight: 400; color: var(--text-3); font-size: 11.5px; margin-left: 2px; }
.q-pos { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 600; background: var(--fill-2); color: var(--text-2); flex-shrink: 0; }
.locked-row { opacity: 0.6; }

/* ---------- Consulta (patient chart) ---------- */
.patient-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.patient-name { font-family: var(--font-display); font-size: 24px; font-weight: 600; letter-spacing: -0.026em; }
.patient-actions { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.patient-meta { color: var(--text-2); display: flex; gap: 6px 14px; flex-wrap: wrap; margin-top: 3px; font-size: 13px; }
.save-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-3); transition: color 0.2s; }
.save-state.saving { color: var(--text-2); }
.save-state .ico { width: 14px; height: 14px; }
.consult-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; margin-top: 14px; }
.note-block { padding: 14px 18px; border-top: 1px solid var(--line); }
.note-block:first-child { border-top: 0; }
.note-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.note-block.filling { animation: fill 1.2s var(--ease); }
@keyframes fill { 0% { background: var(--accent-soft); } 100% { background: transparent; } }
.dx-chip { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 6px 0 10px; border-radius: 8px; background: var(--fill); font-size: 13px; }
.dx-chip .mono { color: var(--text-2); }

.side-section { padding: 14px 16px; border-top: 1px solid var(--line); }
.side-section:first-child { border-top: 0; }
.side-title { font-size: 12px; font-weight: 600; color: var(--text-3); margin-bottom: 10px; letter-spacing: 0.01em; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }

.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 1px; background: var(--line-2); }
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ""; position: absolute; left: -18px; top: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 2px var(--text-3); }
.tl-item.first::before { box-shadow: inset 0 0 0 2px var(--accent); }
.tl-date { font-size: 12px; color: var(--text-3); }
.tl-title { font-weight: 500; }
.tl-sub { font-size: 12.5px; color: var(--text-2); }

.ant-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ant-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.ant-item:first-child { border-top: 0; }

.range-bar { position: relative; width: 120px; height: 4px; border-radius: 4px; background: var(--fill-3); }
.range-bar .ok { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--green) 35%, transparent); border-radius: 4px; }
.range-bar .mk { position: absolute; top: -3px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 2.5px var(--text); }
.range-bar .mk.hi, .range-bar .mk.lo { box-shadow: inset 0 0 0 2.5px var(--orange); }
.flag { font-size: 11px; font-weight: 600; color: var(--orange); }

/* Original exam image (stylized) */
.exam-paper {
  aspect-ratio: 3 / 4; border-radius: 10px; padding: 14% 12%;
  background: #fbfaf7; color: #3a3a3a;
  box-shadow: 0 0 0 1px var(--line), 0 6px 20px rgba(0,0,0,.08);
  transform: rotate(-1.2deg);
  font-size: 7px; line-height: 1.6; font-family: "Courier New", monospace; overflow: hidden;
}
.exam-paper .h { font-weight: 700; font-size: 8.5px; margin-bottom: 6px; letter-spacing: 0.04em; }
.exam-paper .l { display: flex; justify-content: space-between; border-bottom: 1px dotted #c8c6bf; }
:root[data-theme="dark"] .exam-paper { filter: brightness(0.88); }

.scan-overlay { position: relative; overflow: hidden; border-radius: 10px; }
.scan-overlay::after { content: ""; position: absolute; left: 0; right: 0; height: 30%; top: -30%; background: linear-gradient(transparent, var(--accent-soft), transparent); animation: scan 1.6s var(--ease) infinite; }
@keyframes scan { to { top: 100%; } }

/* ---------- Documents ---------- */
.doc-paper {
  background: #fff; color: #1d1d1f;
  border-radius: 6px; padding: 44px 48px; min-height: 560px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.06), 0 12px 40px rgba(0,0,0,.08);
  font-size: 12.5px; line-height: 1.6;
}
.doc-paper .letterhead { display: flex; justify-content: space-between; align-items: flex-start; padding-bottom: 16px; border-bottom: 1px solid #e5e5ea; margin-bottom: 22px; transition: opacity 0.25s; }
.doc-paper.no-letterhead .letterhead { visibility: hidden; }
.doc-paper .lh-name { font-family: var(--font-display); font-weight: 600; font-size: 15px; letter-spacing: -0.015em; }
.doc-paper .lh-sub { font-size: 11px; color: #6e6e73; }
.doc-paper .rx-item { padding: 10px 0; border-bottom: 1px solid #f0f0f2; }
.doc-paper .rx-drug { font-weight: 600; }
.doc-paper .rx-dose { color: #48484a; }
.doc-paper .sign-area { margin-top: 48px; display: flex; justify-content: flex-end; }
.doc-paper .sign-line { width: 220px; border-top: 1px solid #1d1d1f; padding-top: 6px; text-align: center; font-size: 11.5px; }
.signed-stamp { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: #1d8348; font-weight: 600; margin-bottom: 6px; }
.doc-types { display: flex; flex-direction: column; gap: 2px; }
.doc-type {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-s);
  color: var(--text-2); font-weight: 500; text-align: left; width: 100%;
  transition: background 0.15s var(--ease);
}
.doc-type:hover { background: var(--fill); color: var(--text); }
.doc-type[aria-current="true"] { background: var(--fill-2); color: var(--text); }
.doc-type .mfa { margin-left: auto; color: var(--text-3); }

/* ---------- Audit ---------- */
.audit-action { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.audit-ic { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: var(--fill-2); color: var(--text-2); }
.audit-ic.red { background: var(--red-soft); color: var(--red); }
.audit-ic.orange { background: var(--orange-soft); color: var(--orange); }
.audit-ic.blue { background: var(--accent-soft); color: var(--accent); }
.hash { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); }
.diff { font-family: var(--mono); font-size: 12px; border-radius: var(--r-s); overflow: hidden; box-shadow: 0 0 0 1px var(--line); }
.diff div { padding: 5px 10px; white-space: pre-wrap; word-break: break-word; }
.diff .del { background: var(--red-soft); color: var(--red); }
.diff .add { background: var(--green-soft); color: var(--green); }
.diff .ctx { color: var(--text-2); }

/* ---------- Settings ---------- */
.settings-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 28px; align-items: start; }
.settings-nav { position: sticky; top: calc(var(--topbar-h) + 20px); display: flex; flex-direction: column; gap: 2px; }
.settings-section { scroll-margin-top: calc(var(--topbar-h) + 20px); margin-bottom: 28px; }
.settings-section > h2 { font-size: 20px; letter-spacing: -0.02em; margin-bottom: 4px; }
.settings-section > p { color: var(--text-2); margin-bottom: 16px; max-width: 64ch; }
.setting-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; padding: 11px 18px; border-top: 1px solid var(--line); }
.setting-row:first-child { border-top: 0; }
.setting-row > div:first-child { flex: 1 1 220px; min-width: 0; }
.setting-row .t { font-weight: 500; }
.setting-row .d { font-size: 12.5px; color: var(--text-2); margin-top: 1px; }
.option-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.option-card {
  position: relative; display: flex; flex-direction: column; justify-content: flex-start; text-align: left; padding: 18px; border-radius: var(--r-l);
  background: var(--surface); box-shadow: 0 0 0 1px var(--line-2);
  transition: box-shadow 0.15s var(--ease), background 0.15s;
}
.option-card:hover { box-shadow: 0 0 0 1px color-mix(in srgb, var(--text) 30%, transparent); }
.option-card[aria-checked="true"] { box-shadow: 0 0 0 2px var(--accent); }
.option-card .oc-title { width: 100%; font-weight: 600; font-size: 14.5px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.option-card .oc-desc { color: var(--text-2); font-size: 13px; margin-top: 4px; }
.option-card .radio { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--line-2); flex-shrink: 0; transition: box-shadow 0.15s; }
.option-card[aria-checked="true"] .radio { box-shadow: inset 0 0 0 5px var(--accent); }
.mini-flow { display: flex; align-items: center; gap: 4px; margin-top: 14px; flex-wrap: wrap; }
.mini-flow span { font-size: 11.5px; padding: 3px 8px; border-radius: 6px; background: var(--fill); color: var(--text-2); }
.mini-flow i { width: 10px; height: 1px; background: var(--line-2); }

/* ---------- Overlays ---------- */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.28); animation: fadeIn 0.2s var(--ease); }
:root[data-theme="dark"] .scrim { background: rgba(0, 0, 0, 0.55); }
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  position: fixed; z-index: 51; left: 50%; top: 50%;
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-pop);
  animation: modalIn 0.32s var(--ease-out);
}
.modal.sm { width: min(420px, calc(100vw - 32px)); }
.modal.lg { width: min(760px, calc(100vw - 32px)); }
@keyframes modalIn { from { opacity: 0; transform: translate(-50%, -48%) scale(0.98); } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 0; }
.modal-title { font-size: 18px; letter-spacing: -0.02em; }
.modal-sub { color: var(--text-2); font-size: 13px; margin-top: 3px; }
.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 18px; border-top: 1px solid var(--line); }
.modal-foot .left { margin-right: auto; }

.drawer {
  position: fixed; z-index: 51; top: 8px; right: 8px; bottom: 8px;
  width: min(440px, calc(100vw - 16px));
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-pop);
  animation: drawerIn 0.35s var(--ease-out);
}
@keyframes drawerIn { from { opacity: 0; transform: translateX(24px); } }
.drawer .modal-body { flex: 1; }

.popover {
  position: fixed; z-index: 60; min-width: 220px;
  background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-pop);
  padding: 6px; animation: popIn 0.18s var(--ease-out);
}
@keyframes popIn { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 7px; font-size: 13.5px; text-align: left; color: var(--text); }
.menu-item:hover { background: var(--fill-2); }
.menu-item .ico { color: var(--text-2); }
.menu-item .meta { margin-left: auto; font-size: 12px; color: var(--text-3); }
.menu-item[aria-checked="true"]::after { content: ""; margin-left: auto; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-label { font-size: 11.5px; color: var(--text-3); padding: 6px 10px 4px; font-weight: 500; }

.otp { display: flex; gap: 8px; justify-content: center; }
.otp input {
  width: 46px; height: 56px; text-align: center; font-size: 22px; font-weight: 600;
  border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); outline: none;
  font-variant-numeric: tabular-nums; transition: border-color 0.15s, box-shadow 0.15s;
}
.otp input:focus { border-color: var(--accent); box-shadow: var(--focus); }
.otp .gap { width: 6px; }
.shake { animation: shake 0.35s var(--ease); }
@keyframes shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }

.toast-root { position: fixed; z-index: 70; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px 10px 12px; border-radius: 999px;
  background: var(--invert); color: var(--on-invert);
  font-size: 13.5px; font-weight: 500; box-shadow: 0 10px 30px rgba(0,0,0,.18);
  animation: toastIn 0.35s var(--ease-out);
  pointer-events: auto;
}
.toast .ico { color: var(--green); }
:root[data-theme="dark"] .toast .ico { color: #1d8348; }
.toast.out { animation: toastOut 0.25s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }

.empty { text-align: center; padding: 48px 24px; color: var(--text-2); }
.empty .ico { width: 28px; height: 28px; color: var(--text-3); margin-bottom: 10px; }
.empty h3 { font-size: 15px; color: var(--text); margin-bottom: 4px; }

.dev-badge { font-size: 10px; font-weight: 700; letter-spacing: 0.04em; padding: 2px 6px; border-radius: 5px; background: var(--orange-soft); color: var(--orange); }

.mobile-tabbar { display: none; }
.sidebar-scrim { display: none; }

.dropzone {
  border: 1.5px dashed var(--line-2); border-radius: var(--r-l);
  padding: 28px; text-align: center; color: var(--text-2);
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .ico { width: 24px; height: 24px; color: var(--text-3); margin-bottom: 8px; }

.countdown { font-variant-numeric: tabular-nums; }
.bar { height: 4px; border-radius: 4px; background: var(--fill-3); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--text); border-radius: 4px; }

/* ---------- Flujo del paciente: componentes compartidos ---------- */

/* Recorrido (orden visual del flujo) */
.journey { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(132px, 1fr); background: var(--surface); border-radius: var(--r-l); box-shadow: 0 0 0 1px var(--line), var(--shadow-1); overflow-x: auto; scrollbar-width: none; }
.journey::-webkit-scrollbar { display: none; }
.journey li { position: relative; padding: 10px 16px; min-width: 120px; border-left: 1px solid var(--line); }
.journey li:first-child { border-left: 0; }
.journey li::after { content: ""; position: absolute; right: -5px; top: 50%; width: 8px; height: 8px; border-top: 1px solid var(--line-2); border-right: 1px solid var(--line-2); background: var(--surface); transform: translateY(-50%) rotate(45deg); z-index: 1; }
.journey li:last-child::after { display: none; }
.journey .j-n { display: block; font-family: var(--font-display); font-size: 20px; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; color: var(--text-3); }
.journey .j-l { display: block; font-size: 12px; color: var(--text-2); margin-top: 1px; white-space: nowrap; }
.journey li.on .j-n { color: var(--text); }
.journey li.on { background: color-mix(in srgb, var(--accent) 4%, transparent); }

.doc-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 12px 0; padding: 8px 14px; border-radius: var(--r-m); background: var(--fill); }
.group-label { padding: 14px 20px 6px; font-size: 12px; font-weight: 600; color: var(--text-2); letter-spacing: 0.01em; }
.list-item.come { gap: 4px 10px; flex-wrap: wrap; align-items: flex-start; }
.list-item.come > .row { width: 100%; justify-content: flex-end; }
.list-item.come .li-sub, .list-item.come .li-title { white-space: normal; }
.list-item.come .li-time { padding-top: 1px; }
.list-item .li-sub.wrap-ok, .released .li-sub { white-space: normal; }
.list-item .li-main { background: none; border: 0; padding: 0; cursor: pointer; }
.queue-row { align-items: flex-start; padding-top: 14px; padding-bottom: 14px; }
.queue-row .q-pos { margin-top: 1px; background: var(--invert); color: var(--on-invert); }
.queue-row.moved .q-pos { background: var(--accent); color: #fff; }
.queue-row > .row { align-self: center; }
.move-btns { display: inline-flex; margin-left: 6px; padding-left: 6px; border-left: 1px solid var(--line); }
.move-btns .icon-btn:disabled { opacity: 0.25; cursor: default; background: none; }
.mini-steps { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 11.5px; color: var(--text-3); }
.mini-steps i { width: 14px; height: 1px; background: var(--line-2); }
.mini-steps .on { color: var(--green); font-weight: 600; }
.mini-steps .cur { color: var(--accent-text); font-weight: 600; }
.tag-unconf { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 600; color: var(--orange); }
.tag-unconf::before { content: ""; width: 6px; height: 6px; border-radius: 50%; border: 1.5px solid currentColor; }
.appt.short .tag-unconf { margin-left: auto; }
.tag-pay { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 600; color: var(--orange); margin-left: 6px; }
.tag-pay::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.close-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 720px) { .close-grid { grid-template-columns: 1fr; } }
.pay-line { display: flex; align-items: center; gap: 4px; margin-top: 4px; font-size: 12px; color: var(--orange); font-weight: 500; }
details.fold > summary { list-style: none; cursor: pointer; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold[open] > summary .ico { transform: rotate(180deg); }

/* Fuera de horario en la agenda */
.cal-closed { position: absolute; left: 0; right: 0; z-index: 0; background-color: var(--surface-2); background-image: repeating-linear-gradient(-45deg, transparent 0 7px, var(--fill) 7px 8px); }
.cal-closed span { position: sticky; top: 64px; display: block; padding: 8px 10px; font-size: 11px; color: var(--text-3); }
.slot-hit:hover::after { top: 50%; transform: translateY(-50%); }

/* Formularios por pasos numerados */
.fstep { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 14px; padding: 18px 0; border-top: 1px solid var(--line); }
.fstep:first-child { border-top: 0; }
.fstep-n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600; background: var(--invert); color: var(--on-invert); margin-top: -1px; }
.fstep-t { font-weight: 600; font-size: 14.5px; margin-bottom: 12px; letter-spacing: -0.01em; }
.draft-summary { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.doc-chip { gap: 8px; }

/* Selector de día y hora (agenda y paciente) */
.day-strip { display: flex; gap: 6px; overflow-x: auto; padding: 2px; margin: -2px; scrollbar-width: none; scroll-behavior: smooth; }
.day-strip::-webkit-scrollbar { display: none; }
.day-chip { flex: 0 0 auto; width: 66px; padding: 8px 4px 9px; border-radius: 12px; text-align: center; box-shadow: inset 0 0 0 1px var(--line-2); transition: background 0.15s var(--ease), box-shadow 0.15s var(--ease), color 0.15s; }
.day-chip:hover:not(:disabled) { background: var(--fill); }
.day-chip .dc-w { display: block; font-size: 11.5px; color: var(--text-2); text-transform: capitalize; }
.day-chip .dc-n { display: block; font-family: var(--font-display); font-size: 20px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.day-chip .dc-f { display: block; font-size: 10.5px; color: var(--green); font-weight: 500; }
.day-chip:disabled { opacity: 0.4; cursor: not-allowed; }
.day-chip:disabled .dc-f { color: var(--text-3); }
.day-chip[aria-pressed="true"] { background: var(--invert); box-shadow: none; }
.day-chip[aria-pressed="true"] span { color: var(--on-invert); }
.slot-label { font-size: 12px; font-weight: 500; color: var(--text-3); margin: 4px 0 8px; }
.slot-label + .slot-grid { margin-bottom: 14px; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 6px; }
.slot { height: 38px; border-radius: 10px; font-weight: 500; font-variant-numeric: tabular-nums; box-shadow: inset 0 0 0 1px var(--line-2); transition: background 0.15s var(--ease), color 0.15s, box-shadow 0.15s; }
.slot:hover { background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent); color: var(--accent-text); }
.slot[aria-pressed="true"] { background: var(--accent); color: #fff; box-shadow: none; }

/* Horarios del médico */
.sched-row { display: grid; grid-template-columns: 140px minmax(0, 1fr) 64px; align-items: center; gap: 12px; padding: 9px 18px; border-top: 1px solid var(--line); }
.sched-row:first-child { border-top: 0; }
.sched-day { display: flex; align-items: center; gap: 12px; font-weight: 500; cursor: pointer; }
.sched-row.off .sched-day span { color: var(--text-3); }
.sched-ranges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.range { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 8px; border-radius: 10px; background: var(--fill); }
.range.bad { box-shadow: inset 0 0 0 1.5px var(--red); }
.time-in { appearance: none; -webkit-appearance: none; border: 0; background: transparent; font-variant-numeric: tabular-nums; font-weight: 500; padding: 4px 4px; border-radius: 6px; outline: none; cursor: pointer; }
.time-in:hover { background: var(--fill-2); }
.time-in:focus { box-shadow: var(--focus); }
.range-error { width: 100%; font-size: 12px; color: var(--red); }
.sched-count { text-align: right; font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.avail { gap: 14px; }
.avail-d { width: 56px; font-size: 12.5px; color: var(--text-2); text-transform: capitalize; }
.avail-d strong { color: var(--text); font-weight: 600; }
.avail-bar { height: 6px; border-radius: 6px; background: var(--fill-2); overflow: hidden; }
.avail-bar i { display: block; height: 100%; background: var(--green); border-radius: 6px; }
.avail.is-off { background: var(--surface-2); }

/* Vista previa del mensaje */
.chat { padding: 18px 14px; border-radius: 16px; background: var(--fill); }
.bubble { position: relative; max-width: 300px; padding: 10px 12px 22px; border-radius: 4px 16px 16px 16px; background: var(--surface); box-shadow: var(--shadow-1); font-size: 14px; line-height: 1.45; }
.bubble-time { position: absolute; right: 10px; bottom: 5px; font-size: 10.5px; color: var(--text-3); }
.link-card { display: flex; gap: 10px; align-items: center; width: 100%; margin-top: 10px; padding: 10px; border-radius: 10px; background: var(--fill); text-align: left; transition: background 0.15s; }
.link-card:hover { background: var(--fill-2); }
.link-card > span { display: flex; flex-direction: column; min-width: 0; }
.link-card strong { font-size: 13px; }
.link-card span span { font-size: 12px; color: var(--accent-text); }

/* Página del paciente */
.pp-root { min-height: 100vh; background: var(--bg); }
.pp { max-width: 460px; min-height: 100vh; margin: 0 auto; display: flex; flex-direction: column; padding: 0 20px; }
.pp-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 0; }
.pp-main { flex: 1; padding: 24px 0 32px; }
.pp-h { font-size: 30px; letter-spacing: -0.03em; line-height: 1.1; margin-bottom: 10px; }
.pp-p { font-size: 16px; color: var(--text-2); line-height: 1.5; margin-bottom: 24px; }
.pp-hint { text-align: center; font-size: 13px; color: var(--text-3); margin-top: 16px; }
.pin input { width: 56px; height: 64px; font-size: 26px; }
.pp-card { padding: 22px; border-radius: 20px; background: var(--surface); box-shadow: 0 0 0 1px var(--line), var(--shadow-2); display: flex; flex-direction: column; gap: 18px; }
.pp-card.is-cancelled { opacity: 0.6; }
.pp-doc { font-weight: 600; font-size: 17px; letter-spacing: -0.015em; }
.pp-when { padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.pp-date { font-size: 15px; color: var(--text-2); }
.pp-time { font-family: var(--font-display); font-size: 40px; font-weight: 600; letter-spacing: -0.04em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pp-time span { font-size: 15px; font-weight: 400; color: var(--text-3); letter-spacing: 0; }
.pp-status { display: flex; align-items: center; gap: 8px; margin-top: 16px; padding: 12px 14px; border-radius: 12px; font-weight: 500; font-size: 14.5px; }
.pp-status.green { background: var(--green-soft); color: var(--green); }
.pp-status.red { background: var(--red-soft); color: var(--red); }
.pp-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; }
.pp-actions .btn-lg { --h: 52px; font-size: 16px; border-radius: 14px; }
.pp-cancel { color: var(--red); }
.pp-back { margin: -8px 0 12px -10px; }
.pp-label { font-weight: 600; margin-bottom: 10px; }
.pp-picker .day-chip { width: 72px; }
.pp-picker .slot { height: 46px; font-size: 15px; }
.pp-picker .slot-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
.pp-sticky { position: sticky; bottom: 0; margin: 20px -20px 0; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.pp-sticky .btn-lg { --h: 52px; font-size: 16px; border-radius: 14px; }
.pp-done { width: 72px; height: 72px; margin: 12px auto 20px; border-radius: 50%; display: grid; place-items: center; background: var(--fill-2); color: var(--text-2); }
.pp-done.green { background: var(--green-soft); color: var(--green); }
.pp-done .ico { width: 34px; height: 34px; stroke-width: 1.8; }
.pp-foot { padding: 12px 0 24px; text-align: center; border-top: 1px solid var(--line); }

@media (max-width: 720px) {
  .sched-row { grid-template-columns: minmax(0, 1fr) auto; padding: 12px 16px; }
  .sched-ranges { grid-column: 1 / -1; grid-row: 2; }
  .sched-count { grid-row: 1; grid-column: 2; }
  .queue-row { flex-wrap: wrap; }
  .queue-row > .row { width: 100%; justify-content: flex-end; }
  .list-item.come { flex-wrap: wrap; }
  .list-item.come > .row { width: 100%; justify-content: flex-end; }
  .doc-bar .muted { display: none; }
  .modal.lg .modal-foot .draft-summary { display: none; }
}

/* ---------- Consulta: nota rápida y órdenes ---------- */
.quick-note { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 22%, var(--line)), var(--shadow-1); }
.qn-text { min-height: 76px; font-size: 14px; line-height: 1.6; background: var(--surface-2); }

.order-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 4px; border-radius: 14px; background: var(--fill-2); }
.order-tab { display: flex; align-items: center; justify-content: center; gap: 8px; height: 38px; border-radius: 10px; font-weight: 500; color: var(--text-2); transition: background 0.2s var(--ease), color 0.2s, box-shadow 0.2s; white-space: nowrap; }
.order-tab:hover { color: var(--text); }
.order-tab[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 0 0 0.5px rgba(0,0,0,.06); }
.ot-n { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 10.5px; font-weight: 700; background: var(--fill-3); color: var(--text-2); }
.order-tab[aria-selected="true"] .ot-n { background: var(--invert); color: var(--on-invert); }
.ot-c { min-width: 20px; height: 18px; padding: 0 6px; border-radius: 9px; font-size: 11px; font-weight: 600; background: var(--accent); color: #fff; display: inline-grid; place-items: center; }

.med-card { padding: 14px 16px 12px; }
.med-card.is-clinic { box-shadow: 0 0 0 1px color-mix(in srgb, var(--violet) 35%, transparent), var(--shadow-1); }
.med-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.med-head .q-pos { background: var(--invert); color: var(--on-invert); }
.med-name { flex: 1; min-width: 160px; border: 0; background: transparent; font-size: 15.5px; font-weight: 600; letter-spacing: -0.01em; padding: 4px 6px; border-radius: 6px; outline: none; }
.med-name:focus { box-shadow: var(--focus); }
.med-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px 10px; margin-top: 10px; }
.mf { display: flex; flex-direction: column; gap: 4px; grid-column: span 2; min-width: 0; }
.mf.w2 { grid-column: span 2; }
.mf.full { grid-column: 1 / -1; }
.mf > span { font-size: 11.5px; color: var(--text-3); font-weight: 500; }
.mf .input { height: 32px; font-size: 13.5px; }
.med-raw { margin-top: 10px; font-size: 11.5px; color: var(--text-3); }

.orders-side { position: sticky; top: calc(var(--topbar-h) + 12px); }
.sheets { display: flex; flex-direction: column; gap: 12px; max-height: 58vh; overflow-y: auto; background: var(--fill); border-radius: 0 0 var(--r-l) var(--r-l); padding-top: 14px; }
.mini-sheet { background: #fff; color: #1d1d1f; border-radius: 4px; padding: 14px 16px; aspect-ratio: 5.5 / 8.5; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 0 0 1px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.06); font-size: 9.5px; line-height: 1.4; }
.ms-head { display: flex; justify-content: space-between; align-items: flex-start; padding-bottom: 6px; border-bottom: 1px solid #e5e5ea; }
.ms-head div { display: flex; flex-direction: column; }
.ms-head strong { font-size: 10.5px; }
.ms-head span { color: #6e6e73; }
.ms-page { font-weight: 600; color: #6e6e73; }
.ms-pt { color: #48484a; }
.ms-rx { font-weight: 700; font-size: 11px; }
.ms-item { display: flex; flex-direction: column; padding: 4px 0; border-bottom: 1px dashed #e5e5ea; }
.ms-item b { font-weight: 600; }
.ms-item span { color: #48484a; }
.ms-slot { flex: 1; border-bottom: 1px dashed #f0f0f2; min-height: 18px; }
.ms-empty { color: #8e8e93; padding: 8px 0; }
.ms-sign { margin-top: auto; align-self: flex-end; width: 45%; text-align: center; border-top: 1px solid #1d1d1f; padding-top: 3px; color: #6e6e73; }
.order-summary { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.order-summary strong { font-variant-numeric: tabular-nums; }

/* Hoja de órdenes tipo formulario físico */
.order-sheet { background: var(--surface); border-radius: var(--r-l); box-shadow: 0 0 0 1px var(--line), var(--shadow-2); padding: 22px 24px; }
.os-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.os-title { font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: -0.02em; }
.os-sub { font-size: 12.5px; color: var(--text-2); }
.os-pt { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 14px 0 6px; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 13px; }
.os-pt b { font-weight: 500; color: var(--text-3); margin-right: 4px; }
.os-cols { columns: 3 220px; column-gap: 28px; margin-top: 14px; }
.os-group { break-inside: avoid; margin-bottom: 18px; }
.os-group h4 { display: flex; justify-content: space-between; font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1.5px solid var(--text); }
.os-group h4 span { color: var(--accent-text); }
.os-item { display: flex; align-items: center; gap: 9px; padding: 4px 4px; margin: 0 -4px; border-radius: 6px; font-size: 13px; cursor: pointer; transition: background 0.12s; }
.os-item:hover { background: var(--fill); }
.os-item input { position: absolute; opacity: 0; pointer-events: none; }
.os-item .box { width: 16px; height: 16px; border-radius: 4px; box-shadow: inset 0 0 0 1.5px var(--line-2); display: grid; place-items: center; flex-shrink: 0; transition: background 0.12s, box-shadow 0.12s; }
.os-item .box .ico { width: 12px; height: 12px; stroke-width: 2.6; color: #fff; opacity: 0; }
.os-item.on { font-weight: 500; }
.os-item.on .box { background: var(--accent); box-shadow: none; }
.os-item.on .box .ico { opacity: 1; }
.os-item input:focus-visible + .box { box-shadow: var(--focus); }
.os-foot { margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; }
.os-foot b { font-weight: 500; color: var(--text-3); margin-right: 6px; }

/* Caja: cuentas */
.acct-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; align-items: start; }
.list-item.is-sel { background: var(--fill); }
.nurse-items { margin: 6px 0 4px; padding-left: 18px; font-size: 13px; color: var(--text); }
.nurse-items li { margin: 2px 0; }

@media (max-width: 1024px) {
  .acct-layout { grid-template-columns: minmax(0, 1fr); }
  .orders-side { position: static; }
}
@media (max-width: 720px) {
  .order-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-head { flex-wrap: wrap; }
  .panel-head .mono { white-space: nowrap; }
  .med-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mf, .mf.w2 { grid-column: span 1; }
  .order-sheet { padding: 18px 16px; }
  .os-cols { columns: 1; }
}

/* ---------- Escritorio amplio: aprovechar el ancho ---------- */
.patient-bar { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto; align-items: center; gap: 12px 28px; }
.patient-bar .vitals-inline { margin-top: 0; justify-content: flex-start; padding-left: 24px; border-left: 1px solid var(--line); }
.crumb { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-2); margin-bottom: 10px; }
.crumb button { color: var(--text-2); display: inline-flex; align-items: center; gap: 4px; border-radius: 6px; padding: 2px 4px 2px 0; }
.crumb button:hover { color: var(--text); }
.consult-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.note-grid { display: grid; grid-template-columns: minmax(0, 1fr); }
.note-grid > .note-block { border-top: 0; box-shadow: inset 0 -1px 0 var(--line); }
.note-grid > .note-block:last-child { box-shadow: none; }
.docs-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 20px; align-items: start; }
.docs-side { display: none; }
@media (min-width: 1440px) {
  .split { grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; }
  .consult-layout { grid-template-columns: minmax(0, 1fr) 320px; }
  .note-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .note-grid > .note-block:nth-child(odd):not(.span-all) { box-shadow: inset 0 -1px 0 var(--line), inset -1px 0 0 var(--line); }
  .note-grid > .note-block.span-all { grid-column: 1 / -1; }
  .docs-layout { grid-template-columns: 230px minmax(0, 860px) minmax(260px, 1fr); }
  .docs-side { display: flex; }
}
@media (min-width: 1680px) {
  .content { padding: 22px 36px 40px; }
  .split { grid-template-columns: minmax(0, 1fr) 420px; }
  .consult-layout { grid-template-columns: minmax(0, 1fr) 340px; }
  .consult-main.side-by-side { display: grid; grid-template-columns: minmax(340px, 0.8fr) minmax(0, 1.2fr); align-items: start; }
  .consult-main.side-by-side .quick-note { position: sticky; top: calc(var(--topbar-h) + 12px); }
  .consult-main.side-by-side .note-grid { grid-template-columns: minmax(0, 1fr); }
  .consult-main.side-by-side .note-grid > .note-block:nth-child(odd):not(.span-all) { box-shadow: inset 0 -1px 0 var(--line); }
  .acct-layout { grid-template-columns: 360px minmax(0, 1fr); }
}
@media (max-width: 1200px) {
  .patient-bar { grid-template-columns: minmax(0, 1fr) auto; }
  .patient-bar .vitals-inline { grid-column: 1 / -1; grid-row: 2; padding-left: 0; border-left: 0; }
}
@media (max-width: 1024px) {
  .docs-layout { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Formularios con máscara y validación en vivo ---------- */
.prefix-input { display: flex; align-items: stretch; }
.prefix-input > span { display: grid; place-items: center; padding: 0 10px; border: 1px solid var(--line-2); border-right: 0; border-radius: var(--r-s) 0 0 var(--r-s); background: var(--fill); color: var(--text-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.prefix-input .input { border-radius: 0 var(--r-s) var(--r-s) 0; }
.mono-in, .prefix-input .input { font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.field-msg { font-size: 12px; color: var(--red); min-height: 0; }
.field-msg:empty { display: none; }
.warn-msg { color: var(--orange); }
.input.invalid { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.age-out { display: flex; align-items: center; background: var(--fill); border-color: transparent; color: var(--text); font-weight: 500; }

/* Duplicados */
.dupe-alert { margin: 8px 0 4px; padding: 12px 14px; border-radius: var(--r-m); background: var(--orange-soft); color: var(--text); }
.dupe-alert > .row > .ico { color: var(--orange); margin-top: 2px; }
.dupe-alert.hard { background: var(--red-soft); }
.dupe-alert.hard > .row > .ico { color: var(--red); }
.dupe-alert .list { gap: 6px; }
.dupe-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface); }
.dupe-card { padding: 16px 18px; }
.dupe-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) 240px; gap: 18px; align-items: center; }
.dupe-vs { font-size: 12px; font-weight: 600; color: var(--text-3); }
.dupe-side { display: flex; flex-direction: column; gap: 8px; padding-left: 18px; border-left: 1px solid var(--line); }
.dupe-score { text-align: center; font-size: 12px; color: var(--text-3); }
.dupe-score span { display: block; font-family: var(--font-display); font-size: 26px; font-weight: 600; letter-spacing: -0.03em; color: var(--orange); }
.dupe-score.hi span { color: var(--red); }

/* Fusión */
.merge-head { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.merge-table td { padding: 6px 10px; }
.merge-table tr.same td { color: var(--text-3); }
.merge-opt { width: 100%; text-align: left; padding: 7px 10px; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--line-2); font-size: 13px; transition: background 0.12s, box-shadow 0.12s; }
.merge-opt:hover { background: var(--fill); }
.merge-opt[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); font-weight: 500; }
.both-row td { border-top: 0; padding-top: 0; }

/* Arrastrar y soltar */
.appt[draggable="true"] { cursor: grab; }
.appt.dragging, .queue-row.dragging { opacity: 0.35; }
.drop-ghost { position: absolute; left: 6px; right: 6px; z-index: 5; pointer-events: none; display: flex; align-items: center; padding: 0 10px; border-radius: 9px; font-size: 12px; font-weight: 600; border: 2px dashed; }
.drop-ghost.ok { border-color: var(--green); background: var(--green-soft); color: var(--green); }
.drop-ghost.swap { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.drop-ghost.bad { border-color: var(--red); background: var(--red-soft); color: var(--red); }
.drop-ghost.same { border-color: var(--line-2); background: transparent; color: transparent; }
.queue-row[draggable="true"] { cursor: grab; }
.queue-row.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.queue-row.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
.swap-grid { display: flex; align-items: center; gap: 10px; }
.swap-card { flex: 1; padding: 12px; border-radius: var(--r-m); background: var(--fill); }
.swap-ic { color: var(--text-3); }
.toast-btn { margin-left: 6px; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--on-invert) 18%, transparent); color: var(--on-invert); font-weight: 600; font-size: 12.5px; }
.toast-btn:hover { background: color-mix(in srgb, var(--on-invert) 28%, transparent); }

/* Conexión */
.net-banner { display: flex; align-items: center; gap: 12px; margin: 0 28px; padding: 10px 14px; border-radius: var(--r-m); font-size: 13px; position: sticky; top: calc(var(--topbar-h) + 6px); z-index: 15; box-shadow: var(--shadow-2); }
.net-banner > span { flex: 1; min-width: 0; }
.net-banner.off { background: #fff4e5; color: #6b3a00; }
.net-banner.off .ico { color: var(--orange); }
.net-banner.sync { background: var(--accent-soft); color: var(--text); backdrop-filter: blur(12px); }
:root[data-theme="dark"] .net-banner.off { background: #3a2a12; color: #ffd9a3; }
.net-pending { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2); flex-shrink: 0; }
.net-bar { width: 120px; height: 4px; border-radius: 4px; background: var(--fill-3); overflow: hidden; flex: 0 0 auto !important; }
.net-bar i { display: block; height: 100%; width: 40%; background: var(--accent); border-radius: 4px; animation: netbar 1.1s var(--ease) infinite; }
@keyframes netbar { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.net-status.is-off { color: var(--orange); background: var(--orange-soft); }
.net-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--orange); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }

@media (max-width: 1100px) {
  .dupe-grid { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
  .dupe-side { grid-column: 1 / -1; border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 12px; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: center; }
}
@media (max-width: 720px) {
  .net-banner { margin: 0 16px; flex-wrap: wrap; }
  .dupe-grid { grid-template-columns: minmax(0, 1fr); }
  .dupe-vs { text-align: center; }
  .merge-head { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Punto de venta ---------- */
.pos-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.pos-shift { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; font-size: 13px; }
.pos-open { max-width: 560px; margin: 8px auto 0; padding: 28px 28px 24px; text-align: left; }
.pos-open > h2 { font-size: 22px; letter-spacing: -0.02em; margin-top: 12px; }
.pos-open > p { margin: 4px 0 10px; }
.pos-open-ic { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; background: var(--fill-2); }
.pos-open-ic .ico { width: 24px; height: 24px; }
.pos-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; grid-template-rows: auto auto minmax(280px, 1fr); grid-template-areas: "head head" "cat pay" "cart pay"; gap: 14px; align-items: stretch; min-height: calc(100dvh - 210px); }
.pos-bill { grid-area: head; }
.pos-catalog { grid-area: cat; }
.pos-cart { grid-area: cart; display: flex; flex-direction: column; min-height: 0; }
.pos-cart .pos-lines { flex: 1; min-height: 0; overflow: auto; }
.pos-pay { grid-area: pay; }
.pos-day { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 8px; margin-bottom: 14px; }
.pos-day > div { min-width: 0; padding: 8px 12px; border-radius: 12px; background: var(--fill); }
.pos-day span { display: block; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
.pos-day strong { display: block; margin-top: 2px; font-size: 16px; font-weight: 650; letter-spacing: -.02em; }
.pos-day > div.pos-day-tot { background: var(--invert); color: var(--on-invert); }
.pos-day-tot span { color: inherit; opacity: .72; }
.pos-who { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.pos-evidence { display: flex; flex-wrap: wrap; gap: 6px; }
.pos-who > .btn { height: 36px; }
.pos-who-lab { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pos-who-lab .btn { height: 24px; padding: 0 8px; }
.modal.pos-sheet { width: min(980px, calc(100vw - 32px)); }
.pos-modal-body { max-height: min(68vh, 720px); overflow: auto; }
.pos-pick-wrap { position: relative; flex: 1; min-width: 220px; }
.pos-pick-wrap .search { width: 100%; }
.pos-pick-hint { margin: 0; padding: 0 18px 14px; }
.pos-pick { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 6px); max-height: min(420px, 52vh); overflow: auto; padding: 4px; border-radius: var(--r-m); background: var(--surface); box-shadow: 0 0 0 1px var(--line), var(--shadow-2); }
.pos-pick[hidden] { display: none; }
.pos-pick-opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left; padding: 7px 10px; border-radius: 8px; background: none; color: inherit; }
.pos-pick-opt.hi { background: var(--accent-soft); }
.pos-pick-name { display: block; font-weight: 600; }
.pos-pick-opt .faint { display: block; font-size: 12px; }
.pos-pick-empty { padding: 10px 12px; color: var(--text-3); font-size: 13px; }
.pos-lines .list-item { gap: 10px; }
.qty { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border-radius: 9px; background: var(--fill); }
.qty .num { min-width: 22px; text-align: center; font-weight: 600; }
.doc-kinds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.doc-kinds button { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--line-2); font-weight: 500; color: var(--text-2); transition: all 0.15s var(--ease); }
.doc-kinds button:hover { color: var(--text); background: var(--fill); }
.doc-kinds button[aria-pressed="true"] { background: var(--invert); color: var(--on-invert); box-shadow: none; }
.kv.totals dd, .kv.totals dt { font-size: 13.5px; }
.kv.totals .tot { font-size: 20px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; padding-top: 6px; border-top: 1px solid var(--line); }
.pos-discount-row { display: flex; flex-wrap: wrap; gap: 6px; }
.pos-discount-row .chip:disabled { text-decoration: none; }

/* Papel impreso: ticket térmico (TMU) y carta */
.paper-wrap { display: flex; justify-content: center; padding: 18px; border-radius: var(--r-m); background: var(--fill-2); max-height: 62vh; overflow: auto; }
.paper { background: #fff; color: #111; box-shadow: 0 1px 2px rgba(0,0,0,.1), 0 8px 24px rgba(0,0,0,.08); font-family: "Courier New", ui-monospace, monospace; }
.paper.ticket { width: 80mm; font-size: 11px; line-height: 1.35; }
.paper.letter { width: 100%; max-width: 560px; font-family: var(--font); font-size: 11.5px; line-height: 1.45; }
.paper .pb-h { font-size: 13px; font-weight: 700; }
.paper.letter .pb-h { font-size: 16px; }
.paper .pb-l { color: #555; }
.paper .pb-t { font-size: 10.5px; margin-top: 4px; }
.paper .pb-sep { border-top: 1px dashed #999; margin: 6px 0; }
.paper.letter .pb-sep { border-top-style: solid; border-color: #e3e3e3; margin: 10px 0; }
.paper table { width: 100%; border-collapse: collapse; }
.paper td, .paper th { padding: 2px 0; text-align: left; vertical-align: top; font-weight: 400; }
.paper th { border-bottom: 1px dashed #999; font-weight: 700; }
.paper .r { text-align: right; white-space: nowrap; }
.paper .pb-tot .b td { font-weight: 700; font-size: 1.15em; border-top: 1px dashed #999; padding-top: 3px; }
@media print { body * { visibility: hidden; } .paper, .paper * { visibility: visible; } .paper { position: absolute; left: 0; top: 0; box-shadow: none; } }
.done-grid { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 16px; align-items: start; }
.paper .pb-disc { font-size: .88em; color: #555; }
.order-tickets { padding: 0; box-shadow: none; }
.order-tickets .ot { padding: 4mm 4mm 5mm; border-bottom: 1px dashed #999; page-break-after: always; break-after: page; }
.order-tickets .ot:last-child { border-bottom: 0; }
.order-tickets .ot-h { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.order-tickets .ot-p { font-weight: 700; font-size: 13px; margin: 2px 0; text-transform: uppercase; }
.order-tickets .barcode { display: block; width: 100%; height: 14mm; margin-top: 6px; fill: #000; }
.order-tickets .ot-id { text-align: center; letter-spacing: .2em; font-weight: 700; }
.order-tickets .ot-f { font-size: 10px; color: #444; margin-top: 2px; }
.modal.print-preview { width: min(980px, calc(100vw - 32px)); height: calc(100vh - 48px); }
.modal.print-preview .modal-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.modal.print-preview .done-grid { flex: 1; min-height: 0; align-items: stretch; }
.modal.print-preview .paper-wrap { max-height: none; height: 100%; min-height: 0; align-items: flex-start; }
.modal.print-preview .done-grid { grid-template-columns: minmax(0, 1fr) 280px; }
.modal.print-preview .done-grid > .stack { overflow-y: auto; overflow-x: hidden; min-height: 0; }
.modal.print-preview .done-grid > .stack .btn { white-space: normal; height: auto; min-height: 36px; padding-top: 7px; padding-bottom: 7px; text-align: left; }
.paper.letter .pb-tab th, .paper.letter .pb-tab td { padding: 3px 6px 3px 0; }

/* Arqueo */
.denoms { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.denom { display: grid; grid-template-columns: 54px minmax(0, 1fr); align-items: center; gap: 4px 8px; padding: 8px 10px; border-radius: 10px; background: var(--fill); }
.denom > span { font-weight: 600; font-size: 13px; }
.denom .input { height: 30px; }
.denom em { grid-column: 1 / -1; font-style: normal; font-size: 11.5px; color: var(--text-3); text-align: right; }

/* ---------- Páginas de configuración ---------- */
.settings-page { min-width: 0; }
.settings-tabs { margin-bottom: 22px; }
.settings-nav .doc-type .ico-sm { color: var(--text-3); flex-shrink: 0; }
.settings-nav .doc-type[aria-current="true"] .ico-sm { color: var(--text); }
.sec-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.sec-head h2 { font-size: 20px; letter-spacing: -0.02em; }
.sec-head p { color: var(--text-2); margin-top: 4px; max-width: 72ch; }
.cai-card.advertencia { box-shadow: 0 0 0 1px color-mix(in srgb, var(--orange) 40%, transparent), var(--shadow-1); }
.cai-card.critico { box-shadow: 0 0 0 1px color-mix(in srgb, var(--red) 45%, transparent), var(--shadow-1); }
.cai-code { font-size: 14px; font-weight: 600; letter-spacing: 0.03em; }
.cai-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.pos-card { text-align: left; width: 100%; transition: box-shadow 0.15s; }
.pos-card:hover { box-shadow: 0 0 0 1px var(--line-2), var(--shadow-2); }
.pl-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; align-items: start; }
.pl-price { width: 120px; height: 30px; margin-left: auto; text-align: right; }
.pl-price.own { border-color: var(--accent); background: var(--accent-soft); }
.sched-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--line); }
.sched-line .time-in { padding: 6px 8px; border-radius: 8px; background: var(--fill); }
.day-dot { width: 28px; height: 28px; border-radius: 50%; font-size: 11.5px; font-weight: 600; color: var(--text-3); box-shadow: inset 0 0 0 1px var(--line-2); }
.day-dot[aria-pressed="true"] { background: var(--invert); color: var(--on-invert); box-shadow: none; }
.fmt-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr) minmax(320px, 0.9fr); gap: 14px; align-items: start; }
.fmt-preview { position: sticky; top: calc(var(--topbar-h) + 12px); }
.blocks { display: flex; flex-direction: column; gap: 4px; }
.block-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; background: var(--fill); font-size: 13px; }
.block-kind { width: 120px; font-weight: 600; color: var(--text-2); font-size: 12px; flex-shrink: 0; }
.block-v { flex: 1; min-width: 0; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.mod-card { display: flex; gap: 12px; padding: 14px; border-radius: var(--r-m); background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.mod-card.future { background: var(--surface-2); opacity: 0.85; }
.table .c, .table th.c { text-align: center; }
.mod-table .switch { display: inline-block; vertical-align: middle; }
.perm-table td { padding-top: 8px; padding-bottom: 8px; }
.perm-wrap { max-height: calc(100vh - 290px); min-height: 320px; overflow: auto; }
.perm-table thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); vertical-align: bottom; }
.perm-table th:first-child, .perm-table td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); min-width: 210px; }
.perm-group td:first-child > span { white-space: nowrap; }
.perm-table thead th:first-child { z-index: 3; }
.perm-table .perm-group td, .perm-table .perm-group td:first-child { background: var(--surface-2); cursor: pointer; }
.perm-table .perm-group:hover td { background: var(--fill-2); }
.perm-role-h { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 70px; max-width: 100px; margin: 0 auto; white-space: normal; line-height: 1.25; }
.perm-role-h small { font-size: 11px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--text-3); }
.perm-n { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--text-3); }
.perm-zone-btn { border-radius: 7px; }
.perm-count { display: inline-flex; align-items: center; justify-content: center; min-width: 46px; height: 24px; padding: 0 8px; border-radius: 7px; background: var(--fill-2); color: var(--text); font-size: 12px; font-weight: 600; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.perm-count.full { background: var(--invert); color: var(--on-invert); }
.perm-count.none { background: transparent; color: var(--text-3); }
.perm-zone-btn:hover .perm-count { box-shadow: 0 0 0 1px var(--line-strong, var(--line)); }
.role-zone { padding: 12px 0 4px; border-top: 1px solid var(--line); }
.role-zone-t { font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.role-zone .check { display: flex; padding: 5px 0; }
.perm-group td { background: var(--surface-2); font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-2); }
.perm-check { width: 17px; height: 17px; accent-color: var(--accent); }

@media (max-width: 1280px) {
  .fmt-layout { grid-template-columns: 220px minmax(0, 1fr); }
  .fmt-preview { grid-column: 1 / -1; position: static; }
}
@media (max-width: 1024px) {
  .pos-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; grid-template-areas: "head" "cat" "cart" "pay"; min-height: 0; }
  .pos-cart .pos-lines { max-height: 420px; }
  .pos-day { grid-template-columns: 1fr 1fr; }
  .pos-day-tot { grid-column: 1 / -1; }
  .pos-who { grid-template-columns: minmax(0, 1fr); }
  .pos-who > .btn { width: 100%; }
  .pos-pay { position: static; }
  .pl-layout, .fmt-layout, .done-grid { grid-template-columns: minmax(0, 1fr); }
  .modal.print-preview .done-grid { grid-template-rows: minmax(0, 1fr) auto; }
  .cai-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .denoms { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pos-open { padding: 20px 16px; }
  .paper.ticket { width: 100%; max-width: 80mm; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .split { grid-template-columns: minmax(0, 1fr) 320px; }
  .consult-layout { grid-template-columns: minmax(0, 1fr) 260px; }
}
@media (min-width: 1025px) {
  .app.nav-icons { grid-template-columns: 72px minmax(0, 1fr); }
  .app.nav-icons .sidebar { padding: 14px 8px 12px; }
  .app.nav-icons .brand { flex-direction: column; align-items: center; gap: 8px; padding: 4px 0 14px; }
  .app.nav-icons .brand-text { display: none; }
  .app.nav-icons .nav-collapse { margin-left: 0; }
  .app.nav-icons .nav-label { display: none; }
  .app.nav-icons .nav-group { margin-bottom: 10px; width: 100%; }
  .app.nav-icons .nav-item { justify-content: center; width: 40px; margin: 0 auto; padding: 0; }
  .app.nav-icons .nav-item > span:not(.nav-count) { display: none; }
  .app.nav-icons .nav-count { position: absolute; top: 2px; right: 2px; margin: 0; width: 7px; height: 7px; padding: 0; border-radius: 50%; background: var(--accent); color: transparent; overflow: hidden; }
  .app.nav-icons .user-meta, .app.nav-icons .user-btn > .ico { display: none; }
  .app.nav-icons .user-btn { justify-content: center; padding: 8px 0; }
  .app.nav-icons .sidebar-foot { width: 100%; }
}
@media (max-width: 1024px) {
  .nav-collapse { display: none; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; z-index: 40; left: 0; top: 0; bottom: 0; width: 280px;
    transform: translateX(-100%); transition: transform 0.3s var(--ease-out);
    box-shadow: var(--shadow-pop);
  }
  .sidebar.open { transform: none; }
  .sidebar-scrim.open { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(0,0,0,.25); }
  .icon-btn.menu-btn { display: inline-grid; }
  .split, .consult-layout { grid-template-columns: minmax(0, 1fr); }
  .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; gap: 4px; scrollbar-width: none; }
  .settings-nav .doc-type { white-space: nowrap; width: auto; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 860px) {
  #report-grid, #lab-review-grid { grid-template-columns: minmax(0, 1fr) !important; }
  #docs-grid .doc-types { flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  #docs-grid .doc-type { width: auto; white-space: nowrap; }
}
@media (max-width: 720px) {
  body { font-size: 14.5px; }
  .topbar { padding: 0 16px; gap: 8px; }
  .search { width: auto; flex: 1; }
  .topbar > .topbar-spacer { display: none; }
  .search .kbd, .hide-sm { display: none !important; }
  .content { padding: 20px 16px 96px; }
  .page-title { font-size: 24px; }
  .page-head { margin-bottom: 18px; }
  .cols-2, .cols-3, .form-grid, .ant-grid, .option-cards { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  .panel-head { padding: 16px 16px 0; }
  .panel-body { padding: 14px 16px 16px; }
  .list-item { padding: 12px 16px; }
  .setting-row { padding: 14px 16px; }
  .table th, .table td { padding: 10px 12px; }
  .cal { max-height: none; }
  .doc-paper { padding: 28px 22px; min-height: 0; }
  .modal, .modal.sm, .modal.lg { top: auto; bottom: 0; left: 0; right: 0; width: 100%; transform: none; border-radius: 20px 20px 0 0; max-height: 92vh; animation: sheetIn 0.35s var(--ease-out); }
  .modal.print-preview { width: 100%; height: 92vh; }
  @keyframes sheetIn { from { transform: translateY(40px); opacity: 0; } }
  .drawer { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 92vh; border-radius: 20px 20px 0 0; animation: sheetIn 0.35s var(--ease-out); }
  .mobile-tabbar {
    display: flex; position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 86%, transparent);
    backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--line);
  }
  .mobile-tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; font-size: 10.5px; font-weight: 500; color: var(--text-3); border-radius: 8px; }
  .mobile-tabbar button[aria-current="page"] { color: var(--accent); }
  .mobile-tabbar .ico { width: 21px; height: 21px; }
  .toast-root { bottom: 84px; }
  .queue-hero { padding: 18px; }
  .otp input { width: 42px; height: 52px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- Conexión de órdenes ---------- */
.olink-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; padding: 4px 18px 16px; }
.olink { padding: 14px; border-radius: var(--r-m); background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.olink.off { background: var(--surface-2); }
.olink.off > :not(:first-child) { opacity: 0.55; }
.olink .segmented button { flex: 1; }

/* ---------- Mi configuración del médico ---------- */
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; color: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08); }
.swatch svg { color: #fff; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px currentColor; }
.sig-pad { display: block; width: 100%; max-width: 620px; aspect-ratio: 13 / 4; border-radius: var(--r-m); background: #fff linear-gradient(transparent calc(78% - 1px), #d2d2d7 calc(78% - 1px), #d2d2d7 78%, transparent 78%); box-shadow: inset 0 0 0 1px var(--line); touch-action: none; cursor: crosshair; }
.sig-saved { padding: 12px; border-radius: var(--r-m); background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.sig-saved img { display: block; max-height: 90px; margin: 0 auto; }
.doc-paper .sig-img { display: block; max-height: 64px; max-width: 220px; margin: 0 auto -8px; }
.doc-paper .sign-area { align-items: flex-end; gap: 18px; }
.doc-paper .seal { border: 1.5px solid #1d4f91; color: #1d4f91; border-radius: 8px; padding: 6px 10px; font-size: 10px; line-height: 1.4; text-align: center; transform: rotate(-4deg); }
.doc-paper.mini { box-shadow: 0 0 0 1px var(--line); }
.doc-paper.mini .sign-area { margin-top: 12px; }
.lh-logo { width: 28px; height: 28px; border-radius: 8px; background: #eef3fb; color: #1d4f91; display: grid; place-items: center; margin-bottom: 6px; }
.chip .chip-x { border: 0; background: none; padding: 0 0 0 4px; margin-right: -4px; color: inherit; opacity: 0.6; cursor: pointer; display: inline-grid; place-items: center; }
.chip .chip-x:hover { opacity: 1; }
.density-compact .list-item { min-height: 0; padding-top: 7px; padding-bottom: 7px; }
.density-compact .setting-row { padding-top: 8px; padding-bottom: 8px; }
.density-compact .table td, .density-compact .table th { padding-top: 7px; padding-bottom: 7px; }
.text-large .main { zoom: 1.08; }
.doc-paper .sign-trace { font-size: 9.5px; color: #6e6e73; margin-bottom: 4px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent-text); cursor: pointer; font: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Informes, QR y validación ---------- */
.rep-full { margin-top: 8px; }
.rep-full summary { cursor: pointer; font-size: 13px; color: var(--accent-text); }
.rep-full pre { margin-top: 8px; padding: 12px 14px; border-radius: var(--r-m); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); white-space: pre-wrap; font: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text); }
.sig-saved.pending { box-shadow: inset 0 0 0 2px var(--accent); }
.doc-paper .sign-area { justify-content: space-between; align-items: flex-end; }
.doc-paper .sign-area > div:last-child { margin-left: auto; }
.qr-box { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 0; cursor: pointer; text-align: left; color: inherit; }
.qr-box .qr { display: block; }
.doc-paper .sig-img { max-height: 84px; max-width: 240px; }
.vf-status { display: flex; align-items: center; gap: 14px; padding: 18px 20px; border-radius: 20px; background: var(--surface); box-shadow: 0 0 0 1px var(--line), var(--shadow-2); }
.vf-status > svg { width: 34px; height: 34px; flex: none; }
.vf-status.green > svg { color: var(--green); }
.vf-status.orange > svg { color: var(--orange); }
.vf-status.red > svg { color: var(--red); }
.vf-t { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.vf-s { font-size: 13.5px; color: var(--text-2); margin-top: 2px; }

/* ---------- Documentos por bloques y permisos por zona ---------- */
.doc-paper .doc-title { font-size: 11px; color: #8e8e93; letter-spacing: .04em; margin-bottom: 4px; }
.doc-paper .doc-dx { margin-top: 12px; font-size: 12.5px; }
.doc-paper .doc-foot { margin-top: 18px; padding-top: 8px; border-top: 1px solid #e5e5ea; font-size: 10px; color: #8e8e93; text-align: center; }
.fmt-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .fmt-layout { grid-template-columns: 1fr; } }
.fmt-layout .list-item[aria-current="true"] { background: var(--accent-soft); color: var(--accent-text); }
.list-item.is-off .li-title { color: var(--text-3); text-decoration: line-through; }
.perm-table tr.off td { opacity: .45; }

/* ---------- Hoja de resultados del laboratorio ---------- */
.doc-paper .lab-sheet { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.doc-paper .lab-sheet td { padding: 4px 6px; border-bottom: 1px solid #ececf0; }
.doc-paper .lab-sheet .flag { font-size: 9.5px; font-weight: 700; color: #c4302b; }

/* ---------- Combos con búsqueda y filtros por columna ---------- */
.combo { position: relative; display: inline-block; width: 100%; vertical-align: middle; }
.combo .combo-native { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.combo .combo-input { width: 100%; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.combo-list { position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 4px); min-width: 220px; max-height: 260px; overflow: auto; padding: 4px; border-radius: var(--r-m); background: var(--surface); box-shadow: 0 0 0 1px var(--line), var(--shadow-2); }
.combo-note { padding: 6px 10px 2px; font-size: 11px; letter-spacing: .03em; text-transform: uppercase; color: var(--text-3); }
.combo-opt { padding: 8px 10px; border-radius: 8px; font-size: 13.5px; cursor: pointer; }
.combo-sub { margin-top: 1px; font-size: 12px; font-weight: 400; color: var(--text-3); }
.combo-opt.hi { background: var(--accent-soft); color: var(--accent-text); }
.combo-opt.sel { font-weight: 600; }
.combo-empty { padding: 8px 10px; font-size: 13px; color: var(--text-3); }
.table .filter-row th { padding-top: 4px; padding-bottom: 8px; background: inherit; }
.table .filter-row .tf { height: 28px; font-size: 12.5px; padding: 0 8px; min-width: 70px; width: 100%; }
.table .tf-count { font-size: 11.5px; color: var(--text-3); white-space: nowrap; font-weight: 400; }
.table tr[hidden] { display: none; }
.order-sheet .os-extra { padding: 12px 18px; border-top: 1px solid var(--line); font-size: 13px; }

/* ---------- Muestras, etiquetas y plataforma ---------- */
.tube-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; box-shadow: 0 0 0 1px rgba(0,0,0,.12); }
.tube-label { width: 320px; padding: 12px 14px; border-radius: 6px; background: #fff; color: #1d1d1f; box-shadow: 0 0 0 1px #d2d2d7; font-size: 12px; }
.barcode { display: flex; align-items: stretch; height: 34px; }
.barcode i { display: block; background: #000; }
.co-tree { padding: 0 18px 16px; display: grid; gap: 10px; }
.co-branch { padding: 12px 14px; border-radius: var(--r-m); box-shadow: 0 0 0 1px var(--line); }

/* ---------- Hub, conectores y asistente ---------- */
.net-pill { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); }
.hub-reply { margin-top: 6px; padding: 8px 10px; border-radius: 10px; background: var(--accent-soft); color: var(--text); font-size: 13px; }
.radio-card { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-m); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.radio-card.on { box-shadow: 0 0 0 2px var(--accent); }
.lo-list { max-height: 240px; overflow: auto; padding: 4px 10px; border-radius: var(--r-m); box-shadow: inset 0 0 0 1px var(--line); }
.lo-item[hidden] { display: none; }
.wiz-steps { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 22px 6px; font-size: 12px; color: var(--text-3); }
.wiz-steps span { padding: 3px 10px; border-radius: 999px; background: var(--fill-2, rgba(0,0,0,.04)); }
.wiz-steps .on { background: var(--accent); color: #fff; }
.wiz-steps .done { color: var(--accent-text); }
.wiz-mod { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.list-item[aria-current="true"] { background: var(--accent-soft); }

/* ---------- Hoy en la clínica: compacto, indicadores clicables y vista «Todos» (2026-10-24) ---------- */
.journey li { padding: 0; }
.journey .j-btn { display: block; width: 100%; padding: 7px 12px 6px; text-align: left; background: none; border: 0; cursor: pointer; font: inherit; color: inherit; }
.journey .j-btn:hover { background: var(--surface-2); }
.journey li.sel { background: color-mix(in srgb, var(--accent) 10%, transparent); box-shadow: inset 0 -2px 0 var(--accent); }
.journey .j-n { font-size: 17px; line-height: 1.2; }
.journey .j-l { font-size: 11.5px; }
.journey .j-miss, .journey .j-ok { position: absolute; top: 6px; right: 14px; font-size: 11px; font-weight: 600; border: 0; background: none; padding: 1px 6px; border-radius: 999px; }
.journey .j-miss { color: var(--orange); background: color-mix(in srgb, var(--orange) 12%, transparent); cursor: pointer; }
.journey .j-miss[aria-pressed="true"] { background: var(--orange); color: #fff; }
.journey .j-ok { color: var(--green); }
.att .att-chips { margin: 12px 0 0; }
.att .doc-bar { margin: 10px 0; padding: 6px 12px; }
.att .att-filter { margin: 12px 0; }
.att .split { gap: 12px; }
.att .panel-head { padding: 10px 14px 0; }
.att .list-item { padding: 7px 14px; min-height: 40px; }
.att .queue-row { padding-top: 8px; padding-bottom: 8px; }
.att .mini-steps { margin-top: 4px; }
.att .group-label { padding: 10px 14px 4px; }
.att .stack.gap-16 { gap: 12px; }
.doc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin: 12px 0; }
.doc-card { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: var(--r-m); background: var(--surface); box-shadow: 0 0 0 1px var(--line), var(--shadow-1); }
.doc-card-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-card-stats { display: flex; gap: 14px; font-size: 11.5px; color: var(--text-2); }
.doc-card-stats b { display: block; font-size: 16px; color: var(--text); font-variant-numeric: tabular-nums; }
.doc-card .btn { align-self: flex-start; }
.week-all { width: 100%; border-collapse: collapse; font-size: 13px; }
.week-all th, .week-all td { padding: 8px 10px; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
.week-all thead th { border-top: 0; font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.week-all th.today { color: var(--accent-text); }
.wa-cell { display: flex; flex-direction: column; gap: 1px; width: 100%; min-width: 74px; padding: 6px 8px; border-radius: var(--r-s, 8px); border: 0; background: var(--fill); text-align: left; cursor: pointer; font: inherit; color: var(--text-2); font-size: 11px; }
.wa-cell b { font-size: 16px; color: var(--text); }
.wa-cell:hover { background: color-mix(in srgb, var(--accent) 10%, var(--fill)); }
.wa-off { display: inline-block; font-size: 11px; color: var(--text-3); padding: 6px 0; }

/* ---------- Configuración de agenda (2026-10-24) ---------- */
.cfg-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
.cfg-nav { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 2px; padding: 8px; border-radius: var(--r-l); background: var(--surface); box-shadow: 0 0 0 1px var(--line), var(--shadow-1); }
.cfg-group { padding: 10px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-3); }
.cfg-scope { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 7px 10px; border-radius: var(--r-m); border: 0; background: none; text-align: left; cursor: pointer; font: inherit; color: var(--text); }
.cfg-scope span:last-child { font-size: 11.5px; }
.cfg-scope:hover { background: var(--fill); }
.cfg-scope[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--accent-text); font-weight: 600; }
.cfg-sec .panel-body { padding-top: 10px; }
.cfg-sec.inherited .panel-body { opacity: .62; }
.cfg-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; padding: 8px 10px; border-radius: var(--r-m); background: var(--fill); }
.cfg-row.off { opacity: .55; }
.cfg-chan { display: inline-flex; gap: 10px; flex-wrap: wrap; }
.cfg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 24px; }
.wa-bubble { max-width: 360px; background: var(--fill); border-radius: 16px 16px 16px 4px; padding: 12px 14px; font-size: 13.5px; }
@media (max-width: 860px) { .cfg-layout { grid-template-columns: minmax(0, 1fr); } .cfg-nav { position: static; } }

/* ---------- Preclínica por médico, fotos con IA y «Preparado para esta consulta» (2026-10-24) ---------- */
.pre-cfg td, .pre-cfg th { padding: 6px 8px; }
.pre-cfg tr.off td { opacity: .55; }
.select.sm { height: 30px; font-size: 12.5px; padding: 0 6px; }
.pre-group { margin-top: 14px; }
.pre-group .side-title { margin-bottom: 8px; }
.link-btn { background: none; border: 0; padding: 0; margin-top: 4px; color: var(--accent-text); font: inherit; font-size: 12px; cursor: pointer; }
.review-split { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 16px; align-items: start; }
.review-img .exam-paper { max-width: 180px; }
tr.doubt td { background: color-mix(in srgb, var(--orange) 10%, transparent); }
.alarm-line { display: flex; align-items: center; gap: 4px; margin-top: 4px; font-size: 12px; color: var(--red); font-weight: 500; }
.prep { margin-top: 14px; }
.prep-vitals { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.prep-vital { padding: 8px 10px; border-radius: var(--r-m); background: var(--fill); }
.prep-vital.alarm { background: color-mix(in srgb, var(--red) 12%, transparent); }
.prep-vital.alarm .vital-v { color: var(--red); }
.prep-exam { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.tr { font-weight: 700; margin-left: 2px; }
.tr.up { color: var(--red); } .tr.down { color: var(--green); }
.exam-thumb { width: 54px; height: 66px; overflow: hidden; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: zoom-in; flex-shrink: 0; }
.exam-thumb .exam-paper { transform: scale(.32); transform-origin: top left; width: 170px; pointer-events: none; }
.exam-thumb.sm { width: 40px; height: 48px; }
.exam-thumb.sm .exam-paper { transform: scale(.24); }
@media (max-width: 720px) { .review-split { grid-template-columns: 1fr; } }
.pre-cfg .switch, .cfg-row .switch, .table td > .switch { display: inline-block; vertical-align: middle; }

/* ---------- Visor de originales a pantalla completa (2026-10-24) ---------- */
#overlay:has(.viewer) .scrim { background: rgba(0, 0, 0, 0.86); }
.viewer { position: fixed; inset: 0; z-index: 51; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; color: #f5f5f7; animation: fadeIn 0.2s var(--ease); pointer-events: none; }
.viewer > * { pointer-events: auto; }
.vw-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; }
.vw-title { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vw-sub { font-size: 12.5px; color: rgba(245, 245, 247, 0.62); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer .icon-btn { color: rgba(245, 245, 247, 0.86); }
.viewer .icon-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.12); color: #fff; }
.viewer .icon-btn:disabled { opacity: 0.3; cursor: default; }
.vw-sep { width: 1px; height: 20px; background: rgba(255, 255, 255, 0.18); margin: 0 4px; }
.vw-stage { position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 8px 64px; pointer-events: none; }
.vw-page { height: min(76vh, 980px); aspect-ratio: 3 / 4; transition: transform 0.28s var(--ease-out); pointer-events: auto; }
.vw-page.side { height: min(60vw, 64vh); }
.vw-page .exam-paper { height: 100%; width: auto; transform: none; zoom: 2.4; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45); }
.vw-page.side .exam-paper { zoom: 1.9; }
.vw-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); pointer-events: auto; }
.vw-nav.prev { left: 12px; } .vw-nav.next { right: 12px; }
.vw-strip { display: flex; justify-content: center; gap: 8px; padding: 10px 16px 16px; overflow-x: auto; }
.vw-strip .exam-thumb { opacity: 0.55; border-color: transparent; }
.vw-strip .exam-thumb.on { opacity: 1; box-shadow: 0 0 0 2px #fff; }
.exam-thumb.locked { display: inline-flex; align-items: center; justify-content: center; cursor: not-allowed; color: var(--text-3); background: var(--fill); }
@media (max-width: 720px) { .vw-stage { padding: 8px 8px; } .vw-nav { display: none; } .vw-page { height: auto; width: min(92vw, 520px); } }

/* ---------- Resumen de preclínica (antes y después del OK) (2026-10-24) ---------- */
.pill-btn { border: 0; cursor: pointer; font: inherit; }
.pill-btn:hover { filter: brightness(0.96); box-shadow: 0 0 0 1px currentColor inset; }
.pre-meters { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; font-size: 13px; }
.pre-bar { height: 6px; border-radius: 999px; background: var(--fill); margin-top: 6px; overflow: hidden; }
.pre-bar span { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.pre-bar span.warn { background: var(--orange); }
.pre-bar span.muted { background: var(--text-3); }
.pre-sum { border-radius: var(--r-m); box-shadow: 0 0 0 1px var(--line); overflow: hidden; }
.pre-sum-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 52px; align-items: center; gap: 12px; padding: 7px 12px; border-top: 1px solid var(--line); font-size: 13.5px; }
.pre-sum-row:first-child { border-top: 0; }
.pre-sum-row.miss { background: color-mix(in srgb, var(--red) 6%, transparent); }
.pre-sum-l { color: var(--text-2); }
.pre-sum-v { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.pre-sum-v.al { color: var(--red); }
.pre-sum-row > :last-child { justify-self: end; }
.pre-ok { color: var(--green); display: inline-flex; }
@media (max-width: 560px) { .pre-meters { grid-template-columns: 1fr; } }

/* ---------- Preclínica: botón verde, − / + táctil, editor de campos y adaptación a teléfono (2026-10-24) ---------- */
.btn-done { background: color-mix(in srgb, var(--green) 14%, var(--surface)); color: var(--green); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--green) 35%, transparent); }
.btn-done:hover:not(:disabled) { background: color-mix(in srgb, var(--green) 22%, var(--surface)); }
.stepper { display: flex; align-items: stretch; flex: 1; min-width: 0; border-radius: var(--r-m, 10px); }
.stepper .input { flex: 1; min-width: 56px; text-align: center; border-radius: 0; }
.st-btn { flex-shrink: 0; width: 38px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: var(--fill); color: var(--text-2); cursor: pointer; }
.st-btn:first-child { border-radius: 10px 0 0 10px; } .st-btn:last-child { border-radius: 0 10px 10px 0; }
.st-btn:hover { background: var(--fill-2, var(--line)); color: var(--text); }
.st-btn:active { background: var(--line-2); }
.pa-pair { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.unit { min-width: 40px; font-size: 12.5px; }
.pre-name { cursor: pointer; border-radius: 8px; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
.pre-name:hover { background: var(--surface-2); }
.pre-name:focus-visible { outline: none; box-shadow: var(--focus); }
.fe-preview { padding: 12px; border-radius: var(--r-m); background: var(--fill); }
@media (max-width: 720px) {
  .input, .select, .textarea { font-size: 16px; }
  .st-btn { width: 44px; }
  .stepper .input { min-height: 44px; }
  .pre-cfg .al-col { display: none; }
  .pre-cfg td, .pre-cfg th { padding: 8px 6px; }
  .pre-cfg td.pre-name { white-space: normal; min-width: 0; width: 100%; }
  .pre-cfg th { white-space: nowrap; font-size: 11px; }
  .pre-cfg .combo { min-width: 0; }
  .queue-row > .row { flex-wrap: wrap; justify-content: flex-end; }
  .pre-sum-row { grid-template-columns: minmax(0, 1fr) auto 40px; gap: 8px; padding: 8px 10px; }
  .cfg-layout { gap: 10px; }
  .modal-foot { flex-wrap: wrap; }
}
@media (min-width: 721px) and (max-width: 1024px) {
  .pa-pair .st-btn, .stepper .st-btn { width: 42px; }
}
@media (pointer: coarse) { .st-btn { width: 44px; } .pre-name { min-height: 44px; } }

/* ---------- Preclínica en solo lectura: mismo formulario, campos bloqueados (2026-10-24) ---------- */
.pre-status { margin-bottom: 14px; }
.pre-ro .pre-edit-only, .pre-ro .link-btn, .pre-ro .dropzone { display: none; }
.pre-ro .input:disabled, .pre-ro .select:disabled, .pre-ro .textarea:disabled { opacity: 1; color: var(--text); -webkit-text-fill-color: var(--text); background: var(--surface-2); cursor: default; }
.pre-ro .select:disabled { background-image: none; }
.pre-ro .st-btn:disabled { opacity: 0.35; cursor: default; }
.pre-ro .field.miss .input, .pre-ro .field.miss .select, .pre-ro .field.miss .textarea { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--red) 55%, transparent); }
.pre-ro .field.al .input { color: var(--red); -webkit-text-fill-color: var(--red); font-weight: 600; }
.pre-miss { height: 16px; padding: 0 6px; font-size: 10.5px; margin-left: 4px; }

/* ---------- Preclínica en filas compactas: nombre a la izquierda, resultado o control a la derecha (2026-10-24) ---------- */
#pre-form .pre-group + .pre-group { margin-top: 14px; }
#pre-form .pre-group .side-title { margin-bottom: 6px; }
.pre-edit-row { grid-template-columns: minmax(0, 1fr) auto; padding: 5px 8px 5px 12px; }
.pre-edit-row .pre-sum-l { line-height: 1.25; }
.pre-edit-c { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 0; }
.pre-edit-c > .row { justify-content: flex-end; flex-wrap: nowrap; }
.pre-edit-row .stepper { flex: 0 0 auto; width: 148px; }
.pre-edit-row .stepper .input { height: 32px; min-width: 0; }
.pre-edit-row .pa-pair { flex: 0 0 auto; }
.pre-edit-row .select { width: 200px; height: 32px; }
.pre-edit-row .input[type="date"] { width: 170px; height: 32px; }
.pre-edit-row .input.num[readonly] { width: 148px; height: 32px; text-align: center; }
.pre-edit-row .unit { min-width: 44px; text-align: left; }
.pre-edit-row.wide-text { grid-template-columns: 1fr; gap: 6px; }
.pre-edit-row.wide-text .pre-edit-c { align-items: stretch; }
.pre-edit-row.wide-text .pre-edit-c > .row > :first-child { flex: 1; }
.pre-edit-row .link-btn { font-size: 12px; }
@media (max-width: 720px) {
  .pre-edit-row { grid-template-columns: 1fr; gap: 6px; padding: 8px 10px; }
  .pre-edit-c { justify-content: stretch; }
  .pre-edit-c > .row:first-child { flex: 1; }
  .pre-edit-row .stepper { flex: 1; width: auto; }
  .pre-edit-row .stepper .input { height: 44px; }
  .pre-edit-row .select, .pre-edit-row .input[type="date"], .pre-edit-row .input.num[readonly] { flex: 1; width: auto; height: 44px; }
  .pre-edit-row .pa-pair { flex: 1; }
}
/* «+ otra toma» en la misma línea; la segunda toma baja a su propia línea dentro de la fila */
.pre-edit-c { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-end; column-gap: 10px; }
.pre-edit-c > .row:not(:first-child) { flex-basis: 100%; justify-content: flex-end; }
.pre-edit-row .link-btn { white-space: nowrap; min-width: 72px; text-align: right; }
.pre-edit-row:not(:has(.link-btn)) .pre-edit-c > .row:first-child { margin-right: 82px; }
@media (max-width: 900px) { .pre-edit-row:not(:has(.link-btn)) .pre-edit-c > .row:first-child { margin-right: 0; } .pre-edit-row .link-btn { min-width: 0; } }
.pre-edit-row.wide-text .pre-edit-c > .row { flex: 1; margin-right: 0 !important; }
.pre-edit-row.wide-text .pre-edit-c > .row > .input, .pre-edit-row.wide-text .pre-edit-c > .row > .textarea { flex: 1; width: auto; }
.pre-edit-row.wide-text > .pre-edit-c { justify-self: stretch; }
.pre-edit-row .unit { width: 48px; min-width: 48px; }
.pre-edit-row .link-btn, .pre-edit-row .link-ph { width: 76px; min-width: 76px; flex-shrink: 0; }
.pre-edit-row:not(:has(.link-btn)) .pre-edit-c > .row:first-child, .pre-edit-c > .row:first-child { margin-right: 0 !important; }
@media (max-width: 720px) { .pre-edit-row > .pre-edit-c { justify-self: stretch; } .pre-edit-row .link-ph { display: none; } .pre-edit-row .link-btn { width: auto; min-width: 0; } }
/* Teléfono: nombre y control en la misma línea; solo la presión y los textos bajan a su propia línea */
@media (max-width: 720px) {
  .pre-edit-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 6px 8px 6px 10px; }
  .pre-edit-row > .pre-edit-c { justify-self: end; }
  .pre-edit-c > .row:first-child { flex: 0 0 auto; }
  .pre-edit-row .stepper { flex: 0 0 auto; width: 136px; }
  .pre-edit-row .st-btn { width: 40px; }
  .pre-edit-row .stepper .input { height: 40px; min-width: 52px; }
  .pre-edit-row .unit { width: auto; min-width: 0; font-size: 12px; }
  .pre-edit-row .unit:empty { display: none; }
  .pre-edit-row .select, .pre-edit-row .input[type="date"], .pre-edit-row .input.num[readonly] { flex: 0 0 auto; width: 150px; height: 40px; }
  .pre-edit-row .link-btn { flex-basis: 100%; width: auto; text-align: right; }
  .pre-edit-row.wide-pa, .pre-edit-row.wide-text { grid-template-columns: 1fr; }
  .pre-edit-row.wide-pa > .pre-edit-c, .pre-edit-row.wide-text > .pre-edit-c { justify-self: stretch; }
  .pre-edit-row.wide-pa .pre-edit-c > .row:first-child { flex: 1; }
  .pre-edit-row.wide-pa .pa-pair { flex: 1; }
  .pre-edit-row.wide-pa .stepper { flex: 1; width: auto; }
}
@media (max-width: 720px) {
  .pre-edit-row .pre-sum-l { font-size: 13px; }
  .pre-edit-row .stepper { width: 144px; }
  .pre-edit-row .st-btn { width: 34px; }
  .pre-edit-row .stepper .input { min-width: 0; padding: 0 4px; }
  .pre-edit-c { flex-wrap: nowrap; column-gap: 6px; }
  .pre-edit-row .link-btn { flex: 0 0 28px; width: 28px; min-width: 28px; height: 28px; font-size: 0; border-radius: 999px; background: var(--fill); color: var(--blue); display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
  .pre-edit-row .link-btn::before { content: '+'; font-size: 17px; font-weight: 500; line-height: 1; }
  .pre-edit-row .link-ph { display: inline-block; width: 28px; min-width: 28px; }
  .pre-edit-c:has(> .row + .row) { flex-wrap: wrap; }
  .pre-edit-row.wide-pa .pre-edit-c { flex-wrap: nowrap; }
  .pre-edit-row.wide-pa .stepper { width: auto; }
}
@media (max-width: 720px) { .pre-edit-row .input.num[readonly] { width: 144px; } }

/* 2026-10-24 · órdenes en una tabla, laboratorio por análisis */
.table tbody tr[aria-current="true"] > td { background: var(--fill); }
.med-edit > td { background: var(--surface-2); padding: 12px 14px 14px; }
.lab-sub > td { background: var(--surface-2); }
.lab-open { padding: 4px 2px 8px; }
.lab-report { margin: 8px 0 0; white-space: pre-wrap; font-family: inherit; font-size: 13px; line-height: 1.45; color: var(--text-2); }
.lab-chart { width: 100%; height: auto; display: block; }
.lab-chart text { font-family: inherit; }
.lab-hist { margin-top: 8px; }
.order-detail { margin-top: 4px; }
@media (max-width: 720px) {
  .order-detail .med-name { min-width: 0; width: 100%; }
  .lab-report { font-size: 12.5px; }
  .lab-hist-btn { padding: 0 8px; }
  .lab-hist-btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}

/* ---------- Control de colas ---------- */
.q-bar .panel-body { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; }
.q-bar .field { min-width: 220px; }
.q-stats { display: flex; gap: 22px; margin-left: auto; }
.q-stats div { display: flex; flex-direction: column; align-items: flex-end; }
.q-stats strong { font-size: 22px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.q-stats span { font-size: 12px; color: var(--text-2); }
.q-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; margin-top: 16px; align-items: start; }
.q-now { padding: 22px 18px; text-align: center; display: flex; flex-direction: column; gap: 8px; position: sticky; top: 76px; }
.q-now-l { font-size: 13px; color: var(--text-2); }
.q-now-t { font-size: 56px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.q-now-n { font-size: 15px; font-weight: 500; }
.q-now-acts { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.q-active td { background: var(--fill-2); }
.q-rec, .q-page { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 16px; align-items: start; }
.q-page { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.q-cfg .input, .q-cfg .select { height: 32px; }
.mic-meter { height: 8px; border-radius: 4px; background: var(--fill-2); overflow: hidden; }
.mic-meter span { display: block; height: 100%; width: 0; background: var(--green); transition: width .08s linear; }
.q-ticket .q-ticket-n { font-size: 40px; font-weight: 700; text-align: center; letter-spacing: .02em; margin: 4px 0; }
.q-ticket .barcode { display: block; width: 100%; height: 12mm; margin-top: 6px; fill: #000; }
@media (max-width: 980px) { .q-grid, .q-rec, .q-page { grid-template-columns: minmax(0, 1fr); } .q-now { position: static; } .q-stats { margin-left: 0; } }

/* Televisor y kiosco: pantalla completa. Los colores salen del estilo elegido (.tvt-*) */
.tv-app, .tvt-noche { --tv-bg: #000; --tv-card: #1c1c1e; --tv-chip: #2c2c2e; --tv-line: #2c2c2e; --tv-text: #f5f5f7; --tv-mute: #a1a1a6; --tv-faint: #6e6e73; --tv-now: #fff; --tv-now-text: #000; --tv-flash: #0066d6; --tv-flash-text: #fff; --tv-prio: #f0a038; --tv-prio-text: #000; --tv-busy: #5aa7ff; --tv-edge: transparent; }
.tvt-claro { --tv-bg: #f5f5f7; --tv-card: #fff; --tv-chip: #e8e8ed; --tv-line: #e5e5ea; --tv-text: #1d1d1f; --tv-mute: #6e6e73; --tv-faint: #8e8e93; --tv-now: #1d1d1f; --tv-now-text: #fff; --tv-flash: #0066d6; --tv-flash-text: #fff; --tv-prio: #c96f00; --tv-prio-text: #fff; --tv-busy: #0066d6; --tv-edge: transparent; }
.tvt-azul { --tv-bg: #0a2540; --tv-card: #123358; --tv-chip: #1b4472; --tv-line: #1f4a78; --tv-text: #fff; --tv-mute: #9fb6d1; --tv-faint: #7d97b5; --tv-now: #fff; --tv-now-text: #0a2540; --tv-flash: #2b8cff; --tv-flash-text: #fff; --tv-prio: #ffb340; --tv-prio-text: #0a2540; --tv-busy: #7cc4ff; --tv-edge: transparent; }
.tvt-verde { --tv-bg: #062b24; --tv-card: #0d3b32; --tv-chip: #145045; --tv-line: #18594c; --tv-text: #eafff8; --tv-mute: #8fbfb2; --tv-faint: #6f9e92; --tv-now: #e6fff6; --tv-now-text: #062b24; --tv-flash: #1d9d5c; --tv-flash-text: #fff; --tv-prio: #ffcf5c; --tv-prio-text: #062b24; --tv-busy: #6fe3c1; --tv-edge: transparent; }
.tvt-ambar { --tv-bg: #1a1a1a; --tv-card: #262626; --tv-chip: #333; --tv-line: #3a3a3a; --tv-text: #fafafa; --tv-mute: #a3a3a3; --tv-faint: #737373; --tv-now: #ffb000; --tv-now-text: #1a1a1a; --tv-flash: #fff; --tv-flash-text: #1a1a1a; --tv-prio: #ffb000; --tv-prio-text: #1a1a1a; --tv-busy: #e5e5e5; --tv-edge: transparent; }
.tvt-contraste { --tv-bg: #000; --tv-card: #000; --tv-chip: #000; --tv-line: #fff; --tv-text: #fff; --tv-mute: #fff; --tv-faint: #fff; --tv-now: #ffff00; --tv-now-text: #000; --tv-flash: #00ffff; --tv-flash-text: #000; --tv-prio: #ffff00; --tv-prio-text: #000; --tv-busy: #00ffff; --tv-edge: #fff; }
.tv-app { min-height: 100vh; background: var(--tv-bg); color: var(--tv-text); font-family: var(--font); }
.tv { min-height: 100vh; display: flex; flex-direction: column; padding: 2.2vw 2.6vw; gap: 1.6vw; position: relative; }
.tv-head { display: flex; align-items: center; gap: 2vw; font-size: clamp(16px, 1.6vw, 30px); }
.tv-brand { display: flex; align-items: center; gap: .6em; font-weight: 600; }
.tv-brand svg { width: 1.3em; height: 1.3em; }
.tv-name { color: var(--tv-mute); }
.tv-clock { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; }
.tv-banner { display: flex; align-items: center; gap: .6em; padding: .7em 1em; border-radius: 16px; background: var(--tv-card); box-shadow: inset 0 0 0 2px var(--tv-edge); font-size: clamp(18px, 2vw, 36px); }
.tv-banner.live { background: #c9162b; color: #fff; animation: tvPulse 1.4s ease-in-out infinite; }
.tv-banner svg { width: 1.2em; height: 1.2em; flex: none; }
@keyframes tvPulse { 50% { opacity: .75; } }
.tv-body { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1.6vw; }
.tv-now { background: var(--tv-now); color: var(--tv-now-text); border-radius: 28px; padding: 2.4vw; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 34vh; }
.tv-now.flash { animation: tvFlash .9s ease-in-out 4; }
@keyframes tvFlash { 50% { background: var(--tv-flash); color: var(--tv-flash-text); } }
.tv-now-l { font-size: clamp(18px, 2vw, 40px); opacity: .6; }
.tv-now-t { font-size: clamp(64px, 11vw, 220px); font-weight: 800; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.tv-now-n { font-size: clamp(20px, 2.4vw, 48px); font-weight: 600; margin-top: .2em; }
.tv-now-d { display: flex; align-items: center; gap: .3em; font-size: clamp(28px, 4.4vw, 88px); font-weight: 700; margin-top: .15em; }
.tv-now-d svg { width: .8em; height: .8em; }
.tv-now-s { font-size: clamp(16px, 1.6vw, 30px); opacity: .6; }
.tv-last, .tv-list { background: var(--tv-card); box-shadow: inset 0 0 0 2px var(--tv-edge); border-radius: 22px; padding: 1.4vw 1.6vw; }
.tv-sec { display: flex; justify-content: space-between; gap: 1em; font-size: clamp(16px, 1.5vw, 28px); font-weight: 600; margin-bottom: .6em; }
.tv-sec span { color: var(--tv-mute); font-weight: 400; }
.tv-row { display: grid; grid-template-columns: 1fr 1.3fr auto; gap: 1em; align-items: baseline; padding: .35em 0; border-top: 1px solid var(--tv-line); font-size: clamp(18px, 2vw, 40px); }
.tv-row strong { font-variant-numeric: tabular-nums; }
.tv-at { color: var(--tv-mute); font-size: .7em; }
.tv-lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.6vw; }
.tv-chips { display: flex; flex-wrap: wrap; gap: .5em; }
.tv-chip { display: inline-flex; padding: .25em .6em; border-radius: 10px; background: var(--tv-chip); box-shadow: inset 0 0 0 1px var(--tv-edge); font-weight: 600; font-variant-numeric: tabular-nums; font-size: clamp(16px, 1.6vw, 32px); }
.tv-chip.prio { background: var(--tv-prio); color: var(--tv-prio-text); }
.tv-chip.busy { background: transparent; box-shadow: inset 0 0 0 2px var(--tv-busy); color: var(--tv-busy); }
.tv-chip.sm { font-size: 13px; }
.tv-empty { color: var(--tv-faint); font-size: clamp(16px, 1.4vw, 26px); }
.tv-foot { display: flex; flex-wrap: wrap; gap: .6em 2em; color: var(--tv-mute); font-size: 14px; margin-top: auto; }
.tv-foot > span { display: flex; align-items: center; gap: .5em; }
.tv-sound { position: fixed; left: 50%; bottom: 4vh; transform: translateX(-50%); z-index: 5; display: flex; align-items: center; gap: .6em; padding: 1em 1.6em; border: 0; border-radius: 999px; background: #0066d6; color: #fff; font: 600 clamp(16px, 1.6vw, 28px) var(--font); cursor: pointer; box-shadow: 0 8px 30px rgba(0,0,0,.35); }
.tv-sound svg { width: 1.2em; height: 1.2em; }
.tv-out { position: fixed; right: 12px; top: 12px; z-index: 5; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--tv-card); color: var(--tv-faint); cursor: pointer; opacity: .35; display: grid; place-items: center; }
.tv-out:hover { opacity: 1; }

/* Diseño con video: el video ocupa la pantalla y la lista va en una columna al costado */
.tv-split { height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 27vw, 560px); overflow: hidden; }
.tv-split.left { grid-template-columns: clamp(300px, 27vw, 560px) minmax(0, 1fr); }
.tv-split.left .tv-media { order: 2; }
.tv-media { position: relative; background: #000; overflow: hidden; }
.tv-media iframe, .tv-media video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: contain; background: #000; }
.tv-media-empty, .tv-media-msg { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6em; color: #8e8e93; font-size: clamp(16px, 1.6vw, 28px); text-align: center; padding: 2em; }
.tv-media-msg { background: rgba(0,0,0,.75); color: #fff; }
.tv-media-empty svg { width: 2.4em; height: 2.4em; opacity: .6; }
.tv-pop { position: absolute; left: 50%; bottom: 6%; transform: translateX(-50%); display: flex; align-items: center; gap: .5em; padding: .35em .9em; border-radius: 28px; background: var(--tv-now); color: var(--tv-now-text); font-size: clamp(28px, 4.2vw, 84px); font-weight: 800; letter-spacing: -0.02em; box-shadow: 0 16px 50px rgba(0,0,0,.5); animation: tvPop .35s var(--ease-out); white-space: nowrap; }
.tv-pop svg { width: .7em; height: .7em; }
.tv-pop span { font-weight: 600; }
@keyframes tvPop { from { opacity: 0; transform: translate(-50%, 20px); } }
.tv-panel { display: flex; flex-direction: column; gap: 1vw; padding: 1.4vw; overflow: hidden; background: var(--tv-bg); position: relative; }
.tv-pop[hidden], .tv-media-msg[hidden] { display: none; }
.tv-side { display: contents; }
.tv-panel .tv-now-d { justify-content: center; text-align: center; line-height: 1.1; }
.tv-panel .tv-now-d svg { display: none; }
.tv-panel .tv-out { top: auto; bottom: 12px; right: 12px; }
.tv-panel .tv-body { grid-template-columns: minmax(0, 1fr); gap: 1vw; }
.tv-panel .tv-head { font-size: clamp(14px, 1.1vw, 22px); flex-wrap: wrap; gap: .4em 1em; }
.tv-panel .tv-name { display: none; }
.tv-panel .tv-banner { font-size: clamp(15px, 1.2vw, 24px); }
.tv-panel .tv-now { min-height: 0; padding: 1.4vw; border-radius: 22px; }
.tv-panel .tv-now-t { font-size: clamp(54px, 6.4vw, 140px); }
.tv-panel .tv-now-d { font-size: clamp(24px, 2.6vw, 54px); }
.tv-panel .tv-now-l, .tv-panel .tv-now-s { font-size: clamp(14px, 1.1vw, 22px); }
.tv-panel .tv-now-n { font-size: clamp(16px, 1.4vw, 28px); }
.tv-panel .tv-last, .tv-panel .tv-list { padding: 1vw 1.1vw; border-radius: 18px; }
.tv-panel .tv-row { font-size: clamp(16px, 1.3vw, 28px); }
.tv-panel .tv-sec { font-size: clamp(14px, 1.05vw, 22px); }
.tv-panel .tv-chip { font-size: clamp(14px, 1.1vw, 24px); }
.tv-panel .tv-lists { display: flex; flex-direction: column; gap: 1vw; min-height: 0; overflow: hidden; }
.tv-panel .tv-foot { font-size: 12px; }
.tv-panel .tv-out { position: absolute; }
.tv-panel .tv-foot { padding-right: 40px; }
.tv-split .tv-sound { top: 4vh; bottom: auto; left: calc((100vw - clamp(300px, 27vw, 560px)) / 2); }
.tv-split.left .tv-sound { left: calc(clamp(300px, 27vw, 560px) + (100vw - clamp(300px, 27vw, 560px)) / 2); }

.tv-login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--tv-bg); }
.tv-login-card { width: min(420px, 100%); padding: 28px; color: var(--text); text-align: left; }
.tv-login-card h1 { font-size: 24px; margin: 12px 0 4px; }
.kiosk { min-height: 100vh; display: flex; flex-direction: column; padding: 2.4vw 3vw; }
.k-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 1vh; }
.k-body h1 { font-size: clamp(30px, 4vw, 64px); letter-spacing: -0.03em; margin: 0; }
.k-sub { font-size: clamp(18px, 2vw, 32px); color: var(--tv-mute); margin: 0; }
.k-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; width: min(980px, 100%); margin-top: 3vh; }
.k-btn { min-height: 120px; border: 0; border-radius: 24px; background: var(--tv-now); color: var(--tv-now-text); font: 600 clamp(20px, 2vw, 32px) var(--font); padding: 20px; cursor: pointer; }
.k-btn:active { transform: scale(.98); }
.k-btn.prio { background: var(--tv-prio); color: var(--tv-prio-text); }
.k-num { font-size: clamp(90px, 16vw, 260px); font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
.kiosk .btn-ghost { color: var(--tv-text); }
.kiosk .faint { color: var(--tv-faint); }
@media (max-width: 760px) { .tv-body { grid-template-columns: minmax(0, 1fr); } .tv-split, .tv-split.left { grid-template-columns: minmax(0, 1fr); grid-template-rows: 45vh minmax(0, 1fr); } .tv-split.left .tv-media { order: 0; } }

/* Selector de estilos y diseños en Control de colas */
.q-themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.q-theme { display: flex; flex-direction: column; gap: 8px; padding: 8px; border: 0; border-radius: 14px; background: var(--surface, transparent); color: var(--text); font: 500 13px var(--font); text-align: left; cursor: pointer; box-shadow: inset 0 0 0 1px var(--line); }
.q-theme[aria-checked="true"] { box-shadow: inset 0 0 0 2px var(--text); }
.q-theme:disabled { cursor: default; opacity: .7; }
.q-swatch { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 9px; background: var(--s0); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(127,127,127,.25); }
.q-swatch i { position: absolute; left: 8%; top: 14%; width: 54%; height: 72%; border-radius: 6px; background: var(--s2); }
.q-swatch b { position: absolute; right: 8%; top: 14%; width: 26%; height: 72%; border-radius: 6px; background: var(--s1); box-shadow: inset 0 0 0 1px rgba(127,127,127,.3); }
.q-swatch em { position: absolute; right: 12%; top: 24%; width: 18%; height: 14%; border-radius: 3px; background: var(--s3); }
td .q-swatch { width: 34px; flex: none; border-radius: 5px; }
.q-layouts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.q-layout { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 14px; box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; font-size: 13px; font-weight: 500; }
.q-layout input { position: absolute; opacity: 0; }
.q-layout:has(input:checked) { box-shadow: inset 0 0 0 2px var(--text); }
.q-layout:has(input:focus-visible) { box-shadow: var(--focus); }
.q-lay-img { display: grid; gap: 4px; aspect-ratio: 16 / 7; padding: 5px; border-radius: 8px; background: var(--fill-2); }
.q-lay-img i { border-radius: 4px; background: var(--fill-3); }
.q-lay-img.full { grid-template-columns: 1.6fr 1fr; grid-template-rows: 1.4fr 1fr; }
.q-lay-img.full i:first-child { background: var(--text); }
.q-lay-img.full i:last-child { grid-column: 1 / -1; }
.q-lay-img.split { grid-template-columns: 2.6fr 1fr; grid-template-rows: 1fr; }
.q-lay-img.split i:first-child { background: #1d1d1f; }

/* 2026-10-25 · Inicio de sesión y cambio de contraseña (MEJ-007) */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.auth-card { width: min(400px, 100%); padding: 28px; text-align: left; }
.auth-card h1 { font-size: 24px; margin: 12px 0 4px; letter-spacing: -0.02em; }
.auth-card .hint { display: block; }
@media (max-width: 420px) { .auth { align-items: start; padding-top: 48px; } .auth-card { padding: 22px 18px; } }

/* 2026-10-25 · Código de 6 dígitos (MEJ-021) */
.mfa-qr { display: grid; place-items: center; margin: 12px auto; width: 200px; max-width: 100%; padding: 8px; background: #fff; border-radius: 12px; box-shadow: 0 0 0 1px var(--line); }
.mfa-qr svg { display: block; width: 100%; height: auto; }
.mfa-code { font-size: 22px; letter-spacing: .3em; text-align: center; }
.mfa-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; padding: 12px; border-radius: 12px; background: var(--surface-2); box-shadow: 0 0 0 1px var(--line); font-size: 15px; text-align: center; user-select: all; }

/* 2026-10-30 · Equipos de laboratorio, prueba de conexión ASTM/HL7 (MEJ-025) */
.lis-traf { max-height: 420px; overflow: auto; font-family: var(--mono); font-size: 12.5px; }
.lis-ev { display: grid; grid-template-columns: 74px 18px minmax(0, 1fr); gap: 6px; padding: 6px 16px; border-top: 1px solid var(--line); }
.lis-ev .t { color: var(--text-3); }
.lis-ev .d { font-weight: 700; text-align: center; }
.lis-ev .x { overflow-wrap: anywhere; white-space: pre-wrap; }
.lis-ev .n { color: var(--text-3); font-family: var(--font); font-size: 12.5px; }
.lis-ev.rx .d { color: var(--accent); }
.lis-ev.tx .d { color: var(--violet); }
.lis-ev.mal { background: var(--red-soft); }
.lis-ev.msg { background: var(--green-soft); }
.lis-ctrl { color: var(--orange); font-weight: 700; }
.lis-crudo { margin: 8px 0 0; padding: 10px 12px; border-radius: var(--r-s); background: var(--surface-2); box-shadow: 0 0 0 1px var(--line); font-family: var(--mono); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow: auto; }
@media (max-width: 600px) { .lis-ev { grid-template-columns: 58px 16px minmax(0, 1fr); padding: 6px 12px; } }
