/* ClinicOS — sistema de diseño
   Principios: jerarquía clara, superficies limpias, acento único, sin degradados decorativos,
   feedback inmediato en press, motion sutil interrumpible, modo claro/oscuro, ≥44px táctil. */

:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --bg-grouped: #eaeaef;
  --surface: #ffffff;
  --surface-2: #f9f9fb;
  --text: #16161a;
  --text-2: #5f5f66;
  --text-3: #6f6f78;
  --border: #dcdce2;
  --border-strong: #c5c5cc;
  --accent: #0a6cff;
  --accent-press: #0857c9;
  /* color de texto/enlaces derivado del acento, con contraste garantizado en ambos temas */
  --accent-text: var(--accent);
  --accent-soft: rgba(10, 108, 255, 0.1);
  --success: #147430;
  --success-soft: rgba(31, 138, 59, 0.12);
  --warning: #8f4f00;
  --warning-soft: rgba(163, 91, 0, 0.12);
  --error: #c62828;
  --error-soft: rgba(198, 40, 40, 0.12);
  --info: #0b57cc;
  --info-soft: rgba(10, 108, 255, 0.1);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-2: 0 6px 24px rgba(0, 0, 0, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --nav-w: 236px;
  --topbar-h: 56px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 180ms;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0e11;
  --bg-grouped: #17171b;
  --surface: #1c1c21;
  --surface-2: #232329;
  --text: #f2f2f5;
  --text-2: #a9a9b2;
  --text-3: #9a9aa4;
  --border: #2e2e36;
  --border-strong: #3c3c46;
  --accent: #4d9bff;
  --accent-press: #77b3ff;
  --accent-text: #77b3ff;
  --accent-soft: rgba(77, 155, 255, 0.16);
  --success: #4cc46a;
  --success-soft: rgba(76, 196, 106, 0.16);
  --warning: #e0a040;
  --warning-soft: rgba(224, 160, 64, 0.16);
  --error: #ff6b6b;
  --error-soft: rgba(255, 107, 107, 0.16);
  --info: #4d9bff;
  --info-soft: rgba(77, 155, 255, 0.16);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 8px 28px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0;
  overflow-wrap: break-word;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; line-height: 1.15; letter-spacing: -0.02em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; letter-spacing: -0.01em; }
p { margin: 0 0 0.75rem; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
small, .muted { color: var(--text-2); font-size: 0.86rem; }
.mono { font-family: var(--mono); font-size: 0.86em; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- layout ---------- */
#app { min-height: 100%; }
.app-shell { display: grid; grid-template-columns: var(--nav-w) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 12px 10px;
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 8px 10px 14px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 0.95rem;
  letter-spacing: -0.02em;
}
.brand-name { font-weight: 650; letter-spacing: -0.01em; }
.brand-sub { font-size: 0.72rem; color: var(--text-3); display: block; margin-top: 1px; }
.nav-section { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); padding: 14px 12px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 9px; color: var(--text-2);
  font-weight: 500; font-size: 0.92rem; cursor: pointer;
  transition: background var(--dur) var(--ease-out), color var(--dur) var(--ease-out), transform 100ms ease-out;
  text-decoration: none; min-height: 40px;
}
.nav-link:hover { background: var(--bg-grouped); color: var(--text); text-decoration: none; }
.nav-link:active { transform: scale(0.98); }
.nav-link.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav-link .ico { width: 18px; height: 18px; flex: none; }
.nav-spacer { flex: 1; }
.nav-user { border-top: 1px solid var(--border); padding: 10px 8px 4px; font-size: 0.85rem; }
.nav-user .name { font-weight: 600; }
.nav-user .role { color: var(--text-3); font-size: 0.76rem; }

.main-col { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 1.05rem; letter-spacing: -0.01em; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.content { padding: 20px; max-width: 1280px; width: 100%; margin: 0 auto; }

.view-enter { animation: viewIn 200ms var(--ease-out); }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- botones ---------- */
.btn {
  appearance: none; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); border-radius: 10px; padding: 9px 14px;
  font: inherit; font-weight: 550; font-size: 0.92rem;
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  cursor: pointer; min-height: 40px; text-decoration: none;
  transition: background 120ms ease-out, transform 100ms ease-out, border-color 120ms, opacity 120ms;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: scale(0.97); transition-duration: 60ms; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-press); border-color: var(--accent-press); }
.btn-danger { background: var(--error); border-color: var(--error); color: #fff; }
.btn-danger:hover { filter: brightness(0.92); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg-grouped); color: var(--text); }
.btn-sm { min-height: 32px; padding: 5px 10px; font-size: 0.84rem; border-radius: 8px; }
.btn-icon { min-width: 40px; padding: 8px; }
.btn-block { width: 100%; }

/* ---------- formularios ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; min-width: 0; }
.field > label { font-size: 0.83rem; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 0.78rem; color: var(--text-3); }
.field .err { font-size: 0.8rem; color: var(--error); display: none; }
.field.invalid .err { display: block; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--error); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 9px;
  padding: 9px 11px; min-height: 40px; width: 100%;
  transition: border-color 120ms, box-shadow 120ms;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { min-height: 90px; resize: vertical; }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--error); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row > * { flex: 1; min-width: 160px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }

/* ---------- superficies ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-head h3 { flex: 1; min-width: 0; }
.section-title { margin: 22px 0 10px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); font-weight: 650; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1; min-width: 160px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2);
  border-radius: 999px; padding: 5px 12px; font-size: 0.84rem; cursor: pointer; min-height: 32px;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background 120ms, color 120ms, transform 100ms ease-out;
}
.chip:active { transform: scale(0.96); }
.chip.active { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; font-weight: 600; }

/* ---------- tablas ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data th, table.data td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data th { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); font-weight: 650; background: var(--surface-2); position: sticky; top: 0; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background 100ms; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
.row-click { cursor: pointer; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- badges / estados ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.76rem; font-weight: 650; padding: 3px 9px; border-radius: 999px;
  background: var(--bg-grouped); color: var(--text-2); white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-error { background: var(--error-soft); color: var(--error); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-neutral { background: var(--bg-grouped); color: var(--text-2); }

/* ---------- listas ---------- */
.list { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-bottom: 1px solid var(--border); cursor: pointer;
  transition: background 100ms;
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--surface-2); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; }
.list-item .sub { color: var(--text-2); font-size: 0.84rem; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  background: var(--accent-soft); color: var(--accent-text);
  display: grid; place-items: center; font-weight: 650; font-size: 0.85rem;
}

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px;
}
.stat .label { font-size: 0.78rem; color: var(--text-2); font-weight: 600; }
.stat .value { font-size: 1.55rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat .hint { font-size: 0.76rem; color: var(--text-3); }

/* ---------- modales ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, 0.38);
  display: grid; place-items: center; padding: 16px;
  animation: fadeIn 150ms ease-out;
}
.modal {
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-2);
  width: min(560px, 100%); max-height: min(86vh, 900px);
  display: flex; flex-direction: column;
  animation: modalIn 200ms var(--ease-out);
}
.modal.wide { width: min(820px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 10px; }
.modal-head h2 { font-size: 1.1rem; flex: 1; }
.modal-body { padding: 6px 18px 16px; overflow: auto; }
.modal-foot { padding: 12px 18px 16px; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--border); flex-wrap: wrap; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }

/* Mobile modal: full-screen bottom sheet */
@media (max-width: 600px) {
  .modal-backdrop { place-items: end center; padding: 0; }
  .modal {
    width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0;
    animation: modalInMobile 220ms var(--ease-out);
  }
  .modal.wide { width: 100%; }
  .modal-head { padding: 14px 16px 8px; }
  .modal-body { padding: 8px 16px 16px; }
  .modal-foot { padding: 10px 16px 16px; }
  @keyframes modalInMobile { from { opacity: 0; transform: translateY(100%); } to { opacity: 1; transform: none; } }
}

/* Touch targets: minimum 44x44px */
@media (hover: none) and (pointer: coarse) {
  .btn { min-height: 44px; min-width: 44px; }
  .btn-sm { min-height: 40px; min-width: 40px; }
  .btn-icon { min-width: 44px; min-height: 44px; }
  .nav-link { min-height: 44px; }
  .chip { min-height: 40px; }
  .tab { min-height: 44px; }
  input, select, textarea { min-height: 44px; }
  .avatar { width: 40px; height: 40px; }
  .badge-count { min-width: 18px; height: 18px; }
}

/* Dark mode contrast fixes */
[data-theme="dark"] {
  --text-3: #b8b8c0;  /* was #9a9aa4 - too low contrast on --surface-2 */
}

/* slide-over (panel lateral de detalle) */
.slideover-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,0.3); animation: fadeIn 150ms ease-out; }
.slideover {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 95;
  width: min(460px, 100%); background: var(--surface);
  border-left: 1px solid var(--border); box-shadow: var(--shadow-2);
  display: flex; flex-direction: column;
  animation: slideIn 220ms var(--ease-out);
}
@keyframes slideIn { from { transform: translateX(40px); opacity: 0.5; } to { transform: none; opacity: 1; } }

/* ---------- toasts ---------- */
.toasts { position: fixed; bottom: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: 10px; padding: 11px 14px; box-shadow: var(--shadow-2); font-size: 0.9rem;
  animation: toastIn 200ms var(--ease-out);
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--error); }
.toast.warning { border-left-color: var(--warning); }
.toast .t-title { font-weight: 650; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--bg); }
.login-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 28px; box-shadow: var(--shadow-1); }
.login-card .brand { justify-content: center; margin-bottom: 18px; }
.login-demo { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 14px; }
.login-demo .demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.login-demo button { font-size: 0.8rem; min-height: 34px; }

/* ---------- agenda ---------- */
.agenda-grid { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.cal-day { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.cal-hour { display: grid; grid-template-columns: 56px 1fr; border-top: 1px solid var(--border); min-height: 52px; }
.cal-hour:first-child { border-top: none; }
.cal-hour .hh { font-size: 0.74rem; color: var(--text-3); padding: 6px 8px; text-align: right; border-right: 1px solid var(--border); background: var(--surface-2); }
.cal-slots { position: relative; padding: 4px; display: flex; flex-direction: column; gap: 4px; }
.apt-block {
  border-radius: 8px; padding: 6px 10px; font-size: 0.82rem; cursor: pointer;
  background: var(--accent-soft); color: var(--text); border-left: 3px solid var(--accent);
  transition: transform 100ms ease-out, filter 120ms;
}
.apt-block:active { transform: scale(0.98); }
.apt-block:hover { filter: brightness(0.97); }
.apt-block .who { font-weight: 650; }
.apt-block .meta { color: var(--text-2); font-size: 0.76rem; }
.apt-block.st-arrived { border-left-color: var(--warning); background: var(--warning-soft); }
.apt-block.st-in_progress { border-left-color: var(--error); background: var(--error-soft); }
.apt-block.st-completed { border-left-color: var(--success); background: var(--success-soft); }
.apt-block.st-cancelled, .apt-block.st-no_show { opacity: 0.55; border-left-color: var(--text-3); background: var(--bg-grouped); }
.apt-block.st-pending_confirmation { border-left-color: var(--text-3); border-style: dashed; }

/* ---------- timeline clínico ---------- */
.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding: 0 0 16px 12px; }
.tl-item::before {
  content: ""; position: absolute; left: -18px; top: 5px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--accent); border: 2px solid var(--surface);
}
.tl-item .when { font-size: 0.78rem; color: var(--text-3); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab {
  padding: 10px 14px; font-weight: 550; color: var(--text-2); cursor: pointer; border: none; background: none;
  border-bottom: 2px solid transparent; font-size: 0.92rem; white-space: nowrap; min-height: 42px;
  transition: color 120ms, border-color 120ms;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-text); border-bottom-color: var(--accent); }

/* ---------- chart bars (CSS puro) ---------- */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 140px; padding-top: 8px; }
.bars .bar { flex: 1; background: var(--accent-soft); border-radius: 4px 4px 0 0; min-width: 6px; position: relative; transition: background 120ms; }
.bars .bar:hover { background: var(--accent); }
.bars .bar .tip {
  display: none; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--surface); font-size: 0.72rem; padding: 3px 7px; border-radius: 6px; white-space: nowrap; z-index: 2;
}
.bars .bar:hover .tip { display: block; }

/* ---------- vacío / carga ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--text-2); }
.empty .ico { font-size: 2rem; opacity: 0.5; margin-bottom: 8px; }
.empty h3 { margin-bottom: 6px; color: var(--text); }
.loading { display: grid; place-items: center; padding: 48px; color: var(--text-2); }
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid var(--border-strong); border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- banners ---------- */
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 0.9rem; border: 1px solid; }
.banner-info { background: var(--info-soft); border-color: transparent; color: var(--text); }
.banner-warning { background: var(--warning-soft); border-color: transparent; }
.banner-error { background: var(--error-soft); border-color: transparent; }
.banner-success { background: var(--success-soft); border-color: transparent; }

/* offline bar */
.net-bar { padding: 6px 14px; text-align: center; font-size: 0.82rem; font-weight: 600; display: none; }
.net-bar.offline { display: block; background: var(--warning-soft); color: var(--warning); }
.net-bar.online-flash { display: block; background: var(--success-soft); color: var(--success); }

/* notifications panel */
.notif-panel {
  position: absolute; right: 0; top: calc(100% + 6px); width: min(360px, 92vw);
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-2); max-height: 420px; overflow: auto; z-index: 60;
  animation: modalIn 160ms var(--ease-out);
}
.notif-item { padding: 11px 14px; border-bottom: 1px solid var(--border); cursor: pointer; }
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: var(--accent-soft); }
.badge-count {
  position: absolute; top: 2px; right: 2px; background: var(--error); color: #fff;
  font-size: 0.62rem; font-weight: 700; border-radius: 999px; min-width: 16px; height: 16px;
  display: grid; place-items: center; padding: 0 4px;
}
.rel { position: relative; }

/* command palette */
.palette-backdrop { position: fixed; inset: 0; z-index: 110; background: rgba(0,0,0,0.35); display: grid; place-items: start center; padding-top: 12vh; }
.palette { width: min(560px, 94vw); background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-2); overflow: hidden; animation: modalIn 160ms var(--ease-out); }
.palette input { border: none; border-bottom: 1px solid var(--border); border-radius: 0; min-height: 52px; font-size: 1.02rem; }
.palette input:focus { box-shadow: none; }
.palette .results { max-height: 380px; overflow: auto; }

/* mobile bottom nav */
.bottom-nav { display: none; }
.menu-btn { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .agenda-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: min(280px, 84vw);
    transform: translateX(-102%); transition: transform 220ms var(--ease-out);
    box-shadow: var(--shadow-2); height: 100dvh;
  }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .content { padding: 14px 14px 84px; }
  .topbar { padding: 0 10px; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(14px); border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-size: 0.68rem; color: var(--text-2); padding: 4px 2px; border-radius: 8px; min-height: 48px;
    justify-content: center; text-decoration: none;
  }
  .bottom-nav a.active { color: var(--accent-text); font-weight: 650; }
  .bottom-nav .ico { width: 21px; height: 21px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  table.data th, table.data td { padding: 9px 10px; }
  .modal { border-radius: 18px 18px 12px 12px; align-self: end; width: 100%; max-height: 92dvh; }
  .modal-backdrop { place-items: end center; padding: 0; }
  .slideover { width: 100%; }
}
@media (max-width: 420px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat .value { font-size: 1.3rem; }
  body { font-size: 14.5px; }
}

/* accesibilidad motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .view-enter, .modal, .slideover, .toast { animation: none !important; }
}

/* impresión de recibos/notas */
.print-area { display: none; }
@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { display: block; position: absolute; inset: 0; padding: 24px; background: #fff; color: #000; }
}

/* utilidades */
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.right { margin-left: auto; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .grid-2 { grid-template-columns: 1fr; } }

/* barras de reportes */
.bar-track { height: 10px; background: var(--border); border-radius: 999px; overflow: hidden; min-width: 56px; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.35s ease; }
.hbars { display: flex; flex-direction: column; gap: 4px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .bar-fill { transition: none; } }

/* errores en formularios y login */
.login-error:empty, .fm-error:empty { display: none; }
.login-error, .fm-error { margin-top: 10px; }
.sec-input { min-height: 46px; width: 100%; }
