/* =============================================================================
   LUNEXUS Agenda — estilos del prototipo
   Navegación oscura, contenido claro, acentos verde y cian.
   ========================================================================== */

:root {
  --nav-bg: #0b1220;
  --nav-bg-2: #111b2e;
  --nav-line: rgba(255, 255, 255, 0.08);
  --nav-text: #c3cede;
  --nav-text-strong: #ffffff;
  --nav-hover: rgba(255, 255, 255, 0.06);
  --nav-active: rgba(16, 185, 129, 0.16);

  --page: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f6;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #64748b;

  --green: #10b981;
  --green-ink: #047857;
  --green-dark: #065f46;
  --green-soft: #d1fae5;
  --cyan: #06b6d4;
  --cyan-ink: #0e7490;
  --cyan-soft: #cffafe;
  --brand-gradient: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);

  --danger: #dc2626;
  --danger-ink: #b91c1c;
  --danger-soft: #fee2e2;
  --warning: #f59e0b;
  --warning-ink: #92400e;
  --warning-soft: #fef3c7;
  --info-soft: #e0f2fe;

  /* Estados de cita */
  --st-pendiente: #f59e0b;
  --st-pendiente-bg: #fef3c7;
  --st-pendiente-ink: #92400e;
  --st-confirmada: #06b6d4;
  --st-confirmada-bg: #cffafe;
  --st-confirmada-ink: #155e75;
  --st-atendida: #10b981;
  --st-atendida-bg: #d1fae5;
  --st-atendida-ink: #065f46;
  --st-cancelada: #94a3b8;
  --st-cancelada-bg: #f1f5f9;
  --st-cancelada-ink: #475569;

  --tenant-accent: #10b981;
  --focus: #0891b2;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 6px 20px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.25);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sidebar-w: 256px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
p { margin: 0; }
a { color: var(--cyan-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

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

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.icon { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: middle; }
.icon svg { width: 100%; height: 100%; display: block; }

/* ---------- Layout ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: var(--nav-bg);
  color: var(--nav-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  border-right: 1px solid var(--nav-line);
}
.sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--brand-gradient);
  display: grid; place-items: center; color: #04241b; font-weight: 800; font-size: 15px; flex: none;
}
.brand-mark .icon { width: 20px; height: 20px; color: #ffffff; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { color: #fff; font-size: 15px; letter-spacing: 0.06em; }
.brand-text span { font-size: 12px; color: #7dd3c0; letter-spacing: 0.02em; }

.sidebar__context { padding: 0 14px 12px; }
.context-card {
  background: var(--nav-bg-2);
  border: 1px solid var(--nav-line);
  border-radius: 10px;
  padding: 10px;
}
.context-card label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: #8fa1b9; margin-bottom: 6px; }
.context-card select {
  width: 100%; background: #0b1528; color: #fff; border: 1px solid #2a3a55; border-radius: 8px;
  padding: 8px 10px; font-weight: 600;
}
.context-card .tenant-meta { margin-top: 8px; font-size: 12px; color: #8fa1b9; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.sidebar__nav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: #6f819b; padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: 8px; color: var(--nav-text);
  text-decoration: none; font-weight: 500; border: 0; background: none; text-align: left;
}
.nav-item:hover { background: var(--nav-hover); color: #fff; }
.nav-item.is-active { background: var(--nav-active); color: #fff; box-shadow: inset 3px 0 0 var(--green); }
.nav-item.is-active .icon { color: #34d399; }
.nav-item .nav-count { margin-left: auto; font-size: 11px; background: #1e2b44; color: #cbd5e1; padding: 1px 7px; border-radius: 99px; }

.sidebar__footer { border-top: 1px solid var(--nav-line); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.sidebar-btn {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  background: transparent; color: var(--nav-text); border: 1px solid #2a3a55; border-radius: 8px; padding: 8px 10px;
  font-weight: 600; text-decoration: none; font-size: 13px;
}
.sidebar-btn:hover { background: var(--nav-hover); color: #fff; }
.sidebar-btn--accent { border-color: rgba(16, 185, 129, 0.5); color: #6ee7b7; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 24px; background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  min-height: 60px;
}
.topbar .topbar__menu { display: none; }
.topbar__crumbs { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 13px; min-width: 0; }
.topbar__crumbs strong { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__spacer { flex: 1; }
.demo-pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--cyan-ink);
  background: var(--cyan-soft); border-radius: 99px; padding: 3px 10px; font-weight: 600; white-space: nowrap;
}
.user-switch { display: flex; align-items: center; gap: 8px; }
.user-switch select { max-width: 240px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #fff; background: #334155; flex: none;
}
.avatar--sm { width: 26px; height: 26px; font-size: 11px; }
.avatar--lg { width: 48px; height: 48px; font-size: 16px; }

.content { padding: 24px; max-width: 1440px; width: 100%; margin: 0 auto; }
.banner {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px;
  margin-bottom: 16px; font-size: 13px; border: 1px solid;
}
.banner--warning { background: var(--warning-soft); border-color: #fcd34d; color: var(--warning-ink); }
.banner--info { background: var(--info-soft); border-color: #7dd3fc; color: #075985; }
.banner--danger { background: var(--danger-soft); border-color: #fca5a5; color: var(--danger-ink); }
.banner .icon { margin-top: 1px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.page-head p { color: var(--text-2); margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 8px; padding: 9px 14px; font-weight: 600; font-size: 13.5px;
  border: 1px solid transparent; background: none; white-space: nowrap; text-decoration: none;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--green-ink); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-secondary:hover { background: var(--surface-3); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-ink); }
.btn-danger-outline { border-color: #fca5a5; color: var(--danger-ink); background: #fff; }
.btn-danger-outline:hover { background: var(--danger-soft); }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 8px; display: inline-grid; place-items: center;
  border: 1px solid transparent; background: none; color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .icon { width: 16px; height: 16px; }
.icon-btn--danger:hover { background: var(--danger-soft); color: var(--danger-ink); }
.link-btn { background: none; border: 0; padding: 0; color: var(--cyan-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Tarjetas ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 0; }
.card__head h2, .card__head h3 { font-size: 15px; font-weight: 700; }
.card__head p { color: var(--text-3); font-size: 12.5px; }
.card__body { padding: 16px 18px; }
.card__foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.span-2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }

.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.kpi__label { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; font-weight: 500; }
.kpi__icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--green-soft); color: var(--green-ink); }
.kpi__icon .icon { width: 16px; height: 16px; }
.kpi__icon--cyan { background: var(--cyan-soft); color: var(--cyan-ink); }
.kpi__icon--amber { background: var(--warning-soft); color: var(--warning-ink); }
.kpi__icon--slate { background: var(--surface-3); color: var(--text-2); }
.kpi__icon--red { background: var(--danger-soft); color: var(--danger-ink); }
.kpi__value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.kpi__hint { font-size: 12px; color: var(--text-3); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px;
  font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge--pendiente { background: var(--st-pendiente-bg); color: var(--st-pendiente-ink); }
.badge--confirmada { background: var(--st-confirmada-bg); color: var(--st-confirmada-ink); }
.badge--atendida { background: var(--st-atendida-bg); color: var(--st-atendida-ink); }
.badge--cancelada { background: var(--st-cancelada-bg); color: var(--st-cancelada-ink); }
.badge--activo { background: var(--green-soft); color: var(--green-dark); }
.badge--prueba { background: var(--cyan-soft); color: var(--st-confirmada-ink); }
.badge--suspendido, .badge--inactivo { background: var(--danger-soft); color: var(--danger-ink); }
.badge--neutral { background: var(--surface-3); color: var(--text-2); }
.badge--plan { background: #ede9fe; color: #5b21b6; }
.badge--online { background: #e0e7ff; color: #3730a3; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px;
  background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 500;
}
.chip .swatch { width: 8px; height: 8px; border-radius: 50%; }

/* ---------- Formularios ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label { font-weight: 600; font-size: 13px; color: var(--text); }
.field .req { color: var(--danger-ink); }
.field-hint { font-size: 12px; color: var(--text-3); }
.field-error { font-size: 12px; color: var(--danger-ink); font-weight: 600; }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--border-strong); background: #fff; border-radius: 8px;
  padding: 9px 11px; min-height: 38px; color: var(--text);
}
.textarea { min-height: 80px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.2); }
.is-invalid .input, .is-invalid .select, .is-invalid .textarea, .input.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--green-ink); }
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); max-height: 220px; overflow-y: auto; }
.fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin: 0; }
.fieldset legend { font-weight: 700; font-size: 13px; padding: 0 6px; }

.hours-table { width: 100%; border-collapse: collapse; }
.hours-table td { padding: 5px 4px; vertical-align: middle; }
.hours-table td:first-child { width: 130px; }
.hours-table .input { min-height: 34px; padding: 6px 8px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .input, .toolbar .select { width: auto; min-width: 150px; }
.search-box { position: relative; flex: 1; min-width: 220px; max-width: 380px; }
.search-box .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 16px; height: 16px; }
.search-box .input { padding-left: 34px; width: 100%; }

.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch-opt { position: relative; }
.swatch-opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.swatch-opt span { display: block; width: 32px; height: 32px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--border-strong); }
.swatch-opt input:checked + span { box-shadow: 0 0 0 2px var(--text); }
.swatch-opt input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

.segmented { display: inline-flex; background: var(--surface-3); border-radius: 9px; padding: 3px; gap: 2px; }
.segmented button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; font-weight: 600; color: var(--text-2); font-size: 13px; }
.segmented input:focus-visible + .btn { outline: 3px solid var(--focus); outline-offset: 2px; }
.segmented label { cursor: pointer; }
.segmented button.is-active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-3); font-weight: 600; padding: 10px 14px; background: var(--surface-2);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fbfdff; }
.table .actions { text-align: right; white-space: nowrap; }
.cell-main { display: flex; align-items: center; gap: 10px; }
.cell-main strong { display: block; font-weight: 600; }
.cell-main span { display: block; font-size: 12px; color: var(--text-3); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Estado vacío ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--text-2); }
.empty__icon { width: 52px; height: 52px; border-radius: 14px; margin: 0 auto 12px; background: var(--surface-3); display: grid; place-items: center; color: var(--text-3); }
.empty__icon .icon { width: 24px; height: 24px; }
.empty h3 { font-size: 16px; color: var(--text); margin-bottom: 4px; }
.empty p { max-width: 420px; margin: 0 auto 14px; font-size: 13px; }

/* ---------- Listas ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item__main { flex: 1; min-width: 0; }
.list-item__main strong { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item__main span { display: block; font-size: 12.5px; color: var(--text-3); }
.time-box { width: 58px; text-align: center; flex: none; border-radius: 8px; background: var(--surface-3); padding: 4px 0; }
.time-box strong { display: block; font-size: 14px; }
.time-box span { display: block; font-size: 11px; color: var(--text-3); }
.clickable { cursor: pointer; }
.clickable:hover { background: var(--surface-2); }

.shortcuts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.shortcut {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; border-radius: 10px;
  border: 1px dashed var(--border-strong); background: var(--surface-2); text-align: left; font-weight: 600;
}
.shortcut:hover { border-color: var(--green); background: #f0fdf9; }
.shortcut .icon { color: var(--green-ink); }

/* ---------- Barras (reportes) ---------- */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 180px) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.bar-row__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.bar-track { height: 12px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--cyan-ink); border-radius: 0 4px 4px 0; }
.bar-fill--green { background: var(--green-ink); }
.bar-row__value { font-variant-numeric: tabular-nums; color: var(--text-2); min-width: 72px; text-align: right; }

.colchart { display: flex; align-items: flex-end; gap: 4px; height: 190px; padding: 8px 0 0; border-bottom: 1px solid var(--border-strong); }
.colchart__col { flex: 1; display: flex; flex-direction: column-reverse; gap: 2px; height: 100%; justify-content: flex-start; position: relative; min-width: 6px; }
.colchart__col:hover { background: var(--surface-2); }
.colchart__seg { width: 100%; border-radius: 0; }
.colchart__seg:last-child { border-radius: 4px 4px 0 0; }
.colchart__labels { display: flex; gap: 4px; margin-top: 6px; }
.colchart__labels span { flex: 1; text-align: center; font-size: 11px; color: var(--text-3); min-width: 6px; overflow: hidden; white-space: nowrap; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); margin-bottom: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-tip {
  position: fixed; z-index: 200; pointer-events: none; background: var(--text); color: #fff; font-size: 12px;
  padding: 8px 10px; border-radius: 8px; box-shadow: var(--shadow); max-width: 240px; line-height: 1.45;
}

.meter { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--brand-gradient); border-radius: 99px; }

/* ---------- Agenda ---------- */
.cal-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-toolbar h2 { font-size: 17px; font-weight: 700; min-width: 200px; }
.cal-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.cal-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-bottom: 10px; }
.cal-legend span { display: inline-flex; gap: 6px; align-items: center; }
.cal-legend i { width: 12px; height: 12px; border-radius: 3px; border-left: 3px solid; }

.timegrid { display: flex; overflow: auto; max-height: calc(100vh - 290px); min-height: 420px; position: relative; }
.timegrid__times { width: 56px; flex: none; position: sticky; left: 0; z-index: 6; background: var(--surface); border-right: 1px solid var(--border); }
.timegrid__cols { display: flex; flex: 1; min-width: 0; }
.timegrid__col { flex: 1; min-width: 130px; border-right: 1px solid var(--border); position: relative; }
.timegrid__col:last-child { border-right: 0; }
.timegrid__head {
  position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--border);
  height: 54px; padding: 6px 8px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;
}
.timegrid__head strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.timegrid__head span { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.timegrid__head.is-today strong { color: #fff; background: var(--tenant-accent); border-radius: 99px; padding: 0 8px; }
.timegrid__head-btn { background: none; border: 0; padding: 0; display: flex; flex-direction: column; align-items: center; width: 100%; }
.timegrid__times .timegrid__head { z-index: 7; }
.timegrid__body { position: relative; cursor: copy; }
.timegrid__body.no-create { cursor: default; }
.timegrid__hour { position: absolute; left: 0; right: 0; border-top: 1px solid var(--border); }
.timegrid__half { position: absolute; left: 0; right: 0; border-top: 1px dashed #eef1f5; }
.timegrid__label { position: absolute; right: 6px; font-size: 11px; color: var(--text-3); transform: translateY(-50%); background: var(--surface); padding: 0 2px; }
.timegrid__off { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(135deg, #f3f5f8 0 6px, #eceff4 6px 12px); pointer-events: none; }
.timegrid__block { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(135deg, rgba(220, 38, 38, 0.08) 0 6px, rgba(220, 38, 38, 0.16) 6px 12px); border-left: 3px solid #fca5a5; pointer-events: none; font-size: 11px; color: var(--danger-ink); padding: 2px 6px; overflow: hidden; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 3; pointer-events: none; }
.now-line::before { content: ""; position: absolute; left: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }

.event {
  position: absolute; border-radius: 7px; padding: 4px 7px; font-size: 12px; line-height: 1.3;
  overflow: hidden; cursor: pointer; border: 1px solid rgba(255, 255, 255, 0.9); border-left: 4px solid; text-align: left;
  z-index: 2; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08); color: var(--text);
}
.event:hover { z-index: 4; box-shadow: 0 4px 14px rgba(15, 23, 42, 0.18); }
.event strong { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event .event__time { font-size: 11px; opacity: 0.85; }
.event--pendiente { background: var(--st-pendiente-bg); border-left-color: var(--st-pendiente); color: var(--st-pendiente-ink); }
.event--confirmada { background: var(--st-confirmada-bg); border-left-color: var(--st-confirmada); color: var(--st-confirmada-ink); }
.event--atendida { background: var(--st-atendida-bg); border-left-color: var(--st-atendida); color: var(--st-atendida-ink); }
.event--cancelada { background: repeating-linear-gradient(135deg, #f8fafc 0 6px, #eef2f6 6px 12px); border-left-color: var(--st-cancelada); color: var(--st-cancelada-ink); }
.event--cancelada strong { text-decoration: line-through; }
.event--by-pro { background: #fff; color: var(--text); }
.event--by-pro.event--cancelada { background: repeating-linear-gradient(135deg, #fff 0 6px, #f1f5f9 6px 12px); }
.event__status-icon { position: absolute; top: 4px; right: 4px; width: 13px; height: 13px; }

.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.month__dow { padding: 8px; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.month__cell { min-height: 112px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 6px; display: flex; flex-direction: column; gap: 3px; background: #fff; cursor: pointer; text-align: left; border-top: 0; border-left: 0; font: inherit; }
.month__cell:hover { background: var(--surface-2); }
.month__cell.is-out { background: #fafbfc; color: var(--text-3); }
.month__day { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 13px; }
.month__day .count { font-size: 11px; color: var(--text-3); font-weight: 500; }
.month__cell.is-today .month__day b { background: var(--tenant-accent); color: #fff; border-radius: 99px; padding: 0 7px; }
.month__ev { font-size: 11.5px; border-radius: 5px; padding: 1px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid; }
.month__more { font-size: 11.5px; color: var(--cyan-ink); font-weight: 600; }

/* ---------- Modales ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(11, 18, 32, 0.55); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto;
  animation: fadeIn 0.15s ease;
}
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 560px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: popIn 0.16s ease;
}
.modal--lg { max-width: 820px; }
.modal--sm { max-width: 420px; }
.modal__head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid var(--border); }
.modal__head h2 { font-size: 17px; font-weight: 700; flex: 1; }
.modal__head p { color: var(--text-3); font-size: 13px; margin-top: 2px; }
.modal__body { padding: 18px 20px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 14px 14px; flex-wrap: wrap; }
.modal__foot .left { margin-right: auto; display: flex; gap: 8px; flex-wrap: wrap; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

.detail-list { display: grid; grid-template-columns: 140px 1fr; gap: 10px 14px; font-size: 13.5px; }
.detail-list dt { color: var(--text-3); font-weight: 500; }
.detail-list dd { margin: 0; font-weight: 500; }

.alert-box { border-radius: 10px; padding: 10px 12px; font-size: 13px; display: flex; gap: 8px; align-items: flex-start; }
.alert-box ul { margin: 4px 0 0; padding-left: 18px; }
.alert-box--error { background: var(--danger-soft); color: var(--danger-ink); border: 1px solid #fca5a5; }
.alert-box--warning { background: var(--warning-soft); color: var(--warning-ink); border: 1px solid #fcd34d; }
.alert-box--ok { background: var(--green-soft); color: var(--green-dark); border: 1px solid #6ee7b7; }

.slot-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.slot-chip {
  border: 1px solid var(--border-strong); background: #fff; border-radius: 8px; padding: 6px 10px; font-weight: 600;
  font-size: 13px; font-variant-numeric: tabular-nums;
}
.slot-chip:hover { border-color: var(--green); background: #f0fdf9; }
.slot-chip.is-selected { background: var(--green-ink); color: #fff; border-color: var(--green-ink); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 300; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.toast {
  display: flex; gap: 10px; align-items: flex-start; background: #0f172a; color: #fff; border-radius: 10px;
  padding: 12px 14px; box-shadow: var(--shadow-lg); font-size: 13.5px; animation: popIn 0.18s ease;
  border-left: 4px solid var(--green);
}
.toast--error { border-left-color: #f87171; }
.toast--info { border-left-color: var(--cyan); }
.toast--warning { border-left-color: var(--warning); }
.toast .icon { margin-top: 1px; }
.toast--success .icon { color: #34d399; }
.toast--error .icon { color: #f87171; }
.toast--info .icon { color: #22d3ee; }
.toast--warning .icon { color: #fbbf24; }

/* ---------- Tarjetas de entidades ---------- */
.entity-card { display: flex; flex-direction: column; }
.entity-card__top { display: flex; gap: 12px; align-items: flex-start; padding: 16px 18px 12px; }
.entity-card__top h3 { font-size: 15px; font-weight: 700; }
.entity-card__top p { font-size: 13px; color: var(--text-3); }
.entity-card__body { padding: 0 18px 14px; display: flex; flex-direction: column; gap: 10px; font-size: 13px; flex: 1; }
.entity-card__foot { padding: 10px 14px; border-top: 1px solid var(--border); display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.entity-card.is-inactive { opacity: 0.72; }
.info-line { display: flex; gap: 8px; align-items: flex-start; color: var(--text-2); }
.info-line .icon { width: 15px; height: 15px; color: var(--text-3); margin-top: 2px; }

.plan-card { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.plan-card.is-featured { border-color: var(--green); box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2), var(--shadow); }
.plan-card .price { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.plan-card ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.plan-card li { display: flex; gap: 8px; align-items: center; }
.plan-card li .icon { width: 15px; height: 15px; color: var(--green-ink); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab { border: 0; background: none; padding: 10px 14px; font-weight: 600; color: var(--text-3); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab.is-active { color: var(--text); border-bottom-color: var(--green-ink); }

/* ---------- Reserva pública ---------- */
.public { min-height: 100vh; background: linear-gradient(180deg, #0b1220 0, #0b1220 240px, var(--page) 240px); }
.public__bar { display: flex; align-items: center; gap: 12px; padding: 16px 24px; color: #fff; max-width: 980px; margin: 0 auto; }
.public__bar .spacer { flex: 1; }
.public__wrap { max-width: 980px; margin: 0 auto; padding: 0 16px 48px; }
.public__hero { color: #fff; padding: 8px 8px 24px; }
.public__hero h1 { font-size: 26px; }
.public__hero p { color: #b6c3d6; margin-top: 6px; }
.stepper { display: flex; gap: 6px; list-style: none; margin: 0 0 18px; padding: 0; overflow-x: auto; }
.stepper li { flex: 1; min-width: 92px; font-size: 12px; color: var(--text-3); display: flex; flex-direction: column; gap: 6px; }
.stepper li::before { content: ""; height: 4px; border-radius: 99px; background: var(--border); }
.stepper li.is-done::before, .stepper li.is-current::before { background: var(--brand-gradient); }
.stepper li.is-current { color: var(--text); font-weight: 700; }
.option-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.option {
  text-align: left; border: 1px solid var(--border); background: #fff; border-radius: 12px; padding: 14px;
  display: flex; flex-direction: column; gap: 6px; transition: border-color 0.12s, box-shadow 0.12s;
}
.option:hover { border-color: var(--green); box-shadow: var(--shadow); }
.option.is-selected { border-color: var(--green-ink); box-shadow: 0 0 0 2px rgba(4, 120, 87, 0.25); }
.option strong { font-size: 14.5px; }
.option span { font-size: 12.5px; color: var(--text-3); }
.date-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 14px; }
.date-pill { flex: none; width: 72px; border: 1px solid var(--border); background: #fff; border-radius: 10px; padding: 8px 4px; text-align: center; }
.date-pill strong { display: block; font-size: 18px; }
.date-pill span { display: block; font-size: 11.5px; color: var(--text-3); text-transform: capitalize; }
.date-pill.is-selected { background: var(--green-ink); border-color: var(--green-ink); color: #fff; }
.date-pill.is-selected span { color: #d1fae5; }
.date-pill:disabled { opacity: 0.45; cursor: not-allowed; }
.summary-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.success-mark { width: 64px; height: 64px; border-radius: 50%; background: var(--green-soft); color: var(--green-ink); display: grid; place-items: center; margin: 0 auto 12px; }
.success-mark .icon { width: 32px; height: 32px; }

.footnote { text-align: center; color: var(--text-3); font-size: 12px; padding: 18px; }

/* ---------- Responsive ---------- */
.sidebar-overlay { display: none; }
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shortcuts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.2s ease; }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open .sidebar-overlay { display: block; position: fixed; inset: 0; background: rgba(11, 18, 32, 0.5); z-index: 35; }
  .main { margin-left: 0; }
  .topbar { padding: 10px 14px; }
  .topbar .topbar__menu { display: inline-grid; }
  .content { padding: 16px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .cal-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .demo-pill .demo-pill__text { display: none; }
}
@media (max-width: 640px) {
  .grid-4 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .kpi { padding: 12px; }
  .kpi__value { font-size: 21px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .page-head h1 { font-size: 20px; }
  .user-switch .user-switch__label { display: none; }
  .user-switch select { max-width: 150px; }
  .detail-list { grid-template-columns: 1fr; gap: 2px; }
  .detail-list dd { margin-bottom: 8px; }
  .bar-row { grid-template-columns: 1fr auto; }
  .bar-row .bar-track { grid-column: 1 / -1; grid-row: 2; }
  .month__cell { min-height: 72px; padding: 4px; }
  .month__ev { display: none; }
  .timegrid__col { min-width: 112px; }
  .cal-toolbar h2 { min-width: 0; font-size: 15px; width: 100%; order: -1; }
  .modal-backdrop { padding: 0; }
  .modal { border-radius: 0; min-height: 100vh; }
  .modal__foot { border-radius: 0; }
  .toolbar .input, .toolbar .select { flex: 1; }
  .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Ajustes de densidad */
.timegrid--wide .timegrid__col { min-width: 190px; }
.topbar__crumbs > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.topbar__crumbs strong { flex-shrink: 0; }
@media (max-width: 1400px) { .user-switch .user-switch__label { display: none; } }

/* ---------- WhatsApp simulado ---------- */
.wa-thread {
  background: #efeae2; border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px;
  max-height: 340px; overflow-y: auto; border: 1px solid #e2ddd5;
}
.wa-msg { max-width: 86%; background: #fff; border-radius: 10px; padding: 7px 10px 5px; font-size: 13px; line-height: 1.45; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08); color: #111b21; }
.wa-msg--out { align-self: flex-end; background: #d9fdd3; border-top-right-radius: 2px; }
.wa-msg--in { align-self: flex-start; border-top-left-radius: 2px; }
.wa-msg__type { display: block; font-size: 11px; font-weight: 700; color: #027a48; margin-bottom: 2px; }
.wa-msg__text { word-wrap: break-word; }
.wa-msg__meta { display: block; text-align: right; font-size: 11px; color: #667781; margin-top: 2px; }
.wa-read { color: #0b84c6; font-weight: 700; }
.var-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.var-chip { border: 1px dashed var(--border-strong); background: var(--surface-2); border-radius: 99px; padding: 2px 9px; font-size: 12px; font-family: ui-monospace, Consolas, monospace; color: var(--text-2); }
.var-chip:hover { border-color: var(--green); color: var(--green-ink); }
.wa-phone { background: #0b141a; border-radius: 22px; padding: 10px; }
.wa-phone__bar { display: flex; align-items: center; gap: 8px; color: #e9edef; padding: 4px 6px 10px; font-size: 13px; }
.wa-phone .wa-thread { max-height: 380px; border: 0; }

/* ---------- Correo simulado ---------- */
.mail { border: 1px solid var(--border); border-radius: 12px; background: #fff; overflow: hidden; box-shadow: var(--shadow-sm); }
.mail__head { padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.mail__subject { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.mail__meta { display: flex; flex-direction: column; gap: 1px; font-size: 12px; color: var(--text-3); }
.mail__body { padding: 0 0 16px; font-size: 13.5px; line-height: 1.6; color: #1f2937; }
.mail__body > div { padding: 0 18px; }
.mail__brand { color: #fff; font-weight: 700; padding: 12px 18px !important; margin-bottom: 14px; letter-spacing: 0.02em; }
.mail__body > div:not(.mail__brand):first-child { padding-top: 14px; }
.mail-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.mail-btn { display: inline-block; border: 1px solid var(--border-strong); border-radius: 8px; padding: 7px 12px; font-size: 12.5px; font-weight: 600; color: var(--text); background: #fff; }
.mail-btn--primary { background: var(--green-ink); border-color: var(--green-ink); color: #fff; }
.mail-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.mail-list > li { border-bottom: 1px solid var(--border); }
.mail-list > li:last-child { border-bottom: 0; }
.mail-list summary { display: flex; gap: 10px; align-items: center; padding: 10px 12px; cursor: pointer; font-size: 13px; }
.mail-list summary:hover { background: var(--surface-2); }
.mail-list details[open] summary { border-bottom: 1px solid var(--border); }
.mail-list details .mail { border: 0; border-radius: 0; box-shadow: none; }
.mail-list__type { font-size: 11px; font-weight: 700; color: var(--green-ink); white-space: nowrap; }
.mail-list__subj { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-list__in { display: flex; gap: 8px; align-items: center; padding: 9px 12px; font-size: 13px; background: #eef2ff; color: #3730a3; }
.mail-list__in span:nth-child(2) { flex: 1; }
