/* TurnoxApp · prototipo
   Diseño (solo modo claro): panel claro y sobrio tipo software clínico; cada negocio pinta su color de marca (--brand).
   Layout: barra de demo arriba, panel con navegación lateral, página pública en una columna centrada. */
:root {
  --bg: #F3F5F8;
  --surface: #FFFFFF;
  --surface-2: #EDF1F5;
  --line: #DCE2E9;
  --line-strong: #C5CED8;
  --fg: #142130;
  --muted: #5A6878;
  --faint: #8794A3;
  --accent: #6A16E0;
  --brand: var(--accent);
  --brand-mix: 100%;
  --on-brand: #FFFFFF;
  --ok: #157347; --ok-soft: #E3F4EA;
  --warn: #9A5B00; --warn-soft: #FDF1DC;
  --bad: #B42318; --bad-soft: #FDE8E6;
  --info: #1F5FBF; --info-soft: #E5EEFC;
  --off: #6B7785; --off-soft: #EEF0F3;
  --demobar: #101A26; --demobar-fg: #E8EEF5; --demobar-muted: #93A1B1;
  --shadow: 0 1px 2px rgba(16, 26, 38, .06), 0 4px 16px rgba(16, 26, 38, .06);
  --shadow-lg: 0 12px 40px rgba(16, 26, 38, .18);
  --r: 10px; --r-sm: 7px;
  --font-d: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
  --font-b: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
/* Solo modo claro: la app se ve igual aunque el sistema esté en modo oscuro. */
html, :root[data-theme] { color-scheme: light; }

/* Tonos derivados del color de marca: se calculan donde se define --brand. */
.brand-scope, .logo-mark, .preview {
  --brand-text: color-mix(in srgb, var(--brand) var(--brand-mix), var(--fg));
  --brand-soft: color-mix(in srgb, var(--brand) 11%, var(--surface));
  --brand-softer: color-mix(in srgb, var(--brand) 6%, var(--surface));
  --brand-line: color-mix(in srgb, var(--brand) 35%, var(--line));
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--fg);
  font-family: var(--font-b); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }
h1, h2, h3 { font-family: var(--font-d); line-height: 1.25; margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; font-weight: 800; }
h2 { font-size: 1.08rem; font-weight: 700; }
h3 { font-size: .95rem; font-weight: 700; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.ic { flex-shrink: 0; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; justify-content: center; }
.neg { color: var(--bad); }
.num, .money, .stat-value, .table td.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Barra de demo ---------- */
.demobar { background: var(--demobar); color: var(--demobar-fg); }
/* La barra de demo queda fija arriba; el menú lateral se pega justo debajo de ella. */
#demobar { position: sticky; top: 0; z-index: 40; }
.db-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap;
  padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.db-brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-d); font-size: 1rem; }
.db-logo { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: #2B4FD6; color: #fff; }
.db-tag { font-family: var(--font-b); font-size: .72rem; color: var(--demobar-muted); border: 1px solid #2A3A4C; padding: 2px 8px; border-radius: 99px; letter-spacing: .02em; }
.db-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.db-field { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--demobar-muted); }
.db-field select { background: #1A2836; color: var(--demobar-fg); border: 1px solid #2A3A4C; border-radius: 8px; padding: 6px 10px; max-width: 290px; }
.db-reset { display: inline-flex; align-items: center; gap: 6px; background: none; border: 1px solid #2A3A4C; color: var(--demobar-muted); border-radius: 8px; padding: 6px 10px; font-size: .8rem; }
.db-reset:hover { color: var(--demobar-fg); border-color: #3B4F66; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; font-size: .82rem; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--fg); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg-dark { background: #1A2836; }
.seg-dark button { color: var(--demobar-muted); }
.seg-dark button.on { background: #6A16E0; color: #fff; }

/* ---------- Botones y controles ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; font-size: .86rem; color: var(--fg); white-space: nowrap; text-decoration: none; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover { background: color-mix(in srgb, var(--brand) 86%, #000); }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger-ghost { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.btn.sm { padding: 5px 10px; font-size: .8rem; }
.btn.lg { padding: 12px 18px; font-size: .95rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.disabled-look { background: var(--surface-2); color: var(--muted); border-color: var(--line); cursor: default; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--fg); }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:disabled { opacity: .4; cursor: default; }
.btn-group { display: inline-flex; align-items: center; gap: 6px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.btn-row.center { justify-content: center; }
.link { background: none; border: 0; padding: 0; color: var(--brand-text); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.select-inline, .form input, .form select, .form textarea, .search input, .input-prefix, .wait-form input {
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); padding: 8px 10px; min-width: 0; }
.select-inline { padding: 7px 10px; }
.form textarea { resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus, .search input:focus, .select-inline:focus { outline: 2px solid color-mix(in srgb, var(--brand) 60%, transparent); outline-offset: 0; border-color: var(--brand); }
.form input[readonly] { background: var(--surface-2); }
.form input[type=color] { padding: 2px; height: 38px; }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 600; padding: 2px 9px; border-radius: 99px; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-pend { background: var(--warn-soft); color: var(--warn); }
.st-conf { background: var(--info-soft); color: var(--info); }
.st-ok { background: var(--ok-soft); color: var(--ok); }
.st-bad { background: var(--bad-soft); color: var(--bad); }
.st-off { background: var(--off-soft); color: var(--off); }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-text); vertical-align: middle; }
.chip-whatsapp { background: var(--ok-soft); color: var(--ok); }
.chip-email { background: var(--info-soft); color: var(--info); }
.chip-push { background: var(--surface-2); color: var(--fg); }
.chip-sms { background: var(--warn-soft); color: var(--warn); }
.avatar { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-text); font-weight: 700; font-size: .8rem; flex-shrink: 0; }
.avatar.sm { width: 28px; height: 28px; font-size: .7rem; }
.avatar.xs { width: 22px; height: 22px; font-size: .62rem; }
.avatar.lg { width: 52px; height: 52px; font-size: 1rem; }
.logo-mark { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: var(--brand); color: #fff; font-family: var(--font-d); font-weight: 800; font-size: .9rem; letter-spacing: .02em; flex-shrink: 0; }
.logo-mark.sm { width: 30px; height: 30px; border-radius: 8px; font-size: .7rem; }
.logo-mark.lg { width: 64px; height: 64px; border-radius: 16px; font-size: 1.3rem; }

/* ---------- Panel del negocio ---------- */
.admin { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: calc(var(--app-h) - 54px); }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: var(--db-h, 58px); height: calc(var(--app-h) - var(--db-h, 58px)); overflow-y: auto; align-self: start; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.side-brand strong { display: block; font-family: var(--font-d); font-size: .95rem; line-height: 1.2; }
.side-brand > div span { display: block; font-size: .76rem; color: var(--muted); }
.side-role { display: flex; flex-direction: column; gap: 4px; padding: 10px; background: var(--surface-2); border-radius: var(--r-sm); font-size: .76rem; color: var(--muted); }
.side-role select { border: 1px solid var(--line-strong); border-radius: 6px; padding: 5px 6px; background: var(--surface); font-size: .82rem; color: var(--fg); }
.side-role strong { color: var(--fg); font-size: .85rem; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 8px 10px; border-radius: var(--r-sm); color: var(--muted); font-weight: 500; text-align: left; }
.nav-item:hover { background: var(--surface-2); color: var(--fg); }
.nav-item.active { background: var(--brand-soft); color: var(--brand-text); font-weight: 600; }
.nav-item span:first-of-type { flex: 1; }
.nav-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--brand); color: #fff; font-size: .7rem; font-weight: 700; display: inline-grid; place-items: center; margin-left: 6px; }
.nav-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.side-public { margin-top: auto; display: flex; align-items: center; gap: 8px; border: 1px dashed var(--line-strong); background: none; padding: 9px 10px; border-radius: var(--r-sm); color: var(--muted); font-size: .82rem; font-weight: 600; }
.side-public:hover { color: var(--brand-text); border-color: var(--brand-line); }
.main { padding: 24px max(16px, env(safe-area-inset-right)) 48px 28px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 2px; }
.head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.month-label { min-width: 150px; text-align: center; font-weight: 600; }
.section-title { margin-top: 8px; }
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r); border: 1px solid; }
.banner > div { flex: 1; min-width: 0; }
.banner.info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 30%, transparent); color: var(--fg); }
.banner.info .ic { color: var(--info); }
.banner.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); color: var(--fg); }
.banner.warn .ic { color: var(--warn); }
.note-card { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; background: var(--brand-softer); border: 1px solid var(--brand-line); border-radius: var(--r); }
.note-card .ic { color: var(--brand-text); margin-top: 2px; }
.hint-row { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .8rem; margin-bottom: -6px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.card.pad { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.card.list { overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 10px; }
.card-title { display: flex; justify-content: space-between; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 700; font-family: var(--font-d); }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 12px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat-label { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.stat-value { font-family: var(--font-d); font-size: 1.35rem; font-weight: 700; }
.stat-note { font-size: .76rem; color: var(--muted); }
.stats.compact .stat { padding: 10px 12px; background: var(--surface-2); border: 0; }
.stats.compact .stat-value { font-size: 1.05rem; }

/* Agenda */
.ag-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.ag { display: grid; min-width: max-content; }
.ag-colwrap, .ag-timescol { border-left: 1px solid var(--line); min-width: 0; }
.ag-timescol { border-left: 0; }
.ag-head { display: flex; align-items: center; gap: 8px; height: 62px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface); }
.ag-head strong { display: block; font-size: .86rem; line-height: 1.2; }
.ag-head span { font-size: .74rem; color: var(--muted); }
.ag-head > div { min-width: 0; }
.ag-head-empty { padding: 0; }
.ag-times { position: relative; }
.ag-time { position: absolute; right: 8px; transform: translateY(-50%); font-size: .7rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.ag-col { position: relative; cursor: copy;
  background-color: var(--surface-2);
  background-image: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--line) 55%, transparent) 6px 7px); }
.ag-work { position: absolute; left: 0; right: 0; background-color: var(--surface);
  background-image: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px 42px); }
.ag-note { position: absolute; top: 10px; left: 8px; right: 8px; display: flex; gap: 6px; align-items: center; font-size: .76rem; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; z-index: 2; }
.ag-note.special { color: var(--brand-text); border-color: var(--brand-line); background: var(--brand-softer); top: auto; bottom: 8px; }
.ag-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--bad); z-index: 3; pointer-events: none; }
.ag-now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
.ab { position: absolute; left: 4px; right: 4px; z-index: 2; display: flex; flex-direction: column; align-items: flex-start; gap: 0; text-align: left; overflow: hidden;
  padding: 4px 8px; border-radius: 6px; border: 1px solid; font-size: .74rem; line-height: 1.3; }
.ab:hover { filter: brightness(.97); box-shadow: var(--shadow); z-index: 4; }
.ab-time { display: flex; align-items: center; gap: 4px; font-weight: 600; opacity: .85; font-variant-numeric: tabular-nums; }
.ab-client { font-weight: 700; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ab-svc { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ab.tight { padding-block: 3px; }
.ab.tight .ab-svc { display: none; }
.ab-paid { display: inline-flex; color: var(--ok); }
.ab.st-pend { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 40%, transparent); color: var(--warn); }
.ab.st-conf { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 45%, transparent); color: var(--info); }
.ab-done { display: inline-flex; color: var(--ok); }
.ab.st-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); color: var(--ok); }
.ab.st-bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 35%, transparent); color: var(--bad); }

.list-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; width: 100%; padding: 12px 16px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-2); }
.list-row.is-off { opacity: .6; }
.lr-time { font-weight: 700; font-variant-numeric: tabular-nums; display: flex; flex-direction: column; line-height: 1.2; }
.lr-time small { color: var(--muted); font-weight: 500; }
.lr-main strong { display: block; }
.lr-main span { color: var(--muted); font-size: .84rem; }
.lr-who { color: var(--muted); font-size: .84rem; }
.lr-end { display: flex; align-items: center; gap: 10px; }

/* Tablas */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.table-wrap.flat { border: 0; border-radius: 0; }
.table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); 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 .num { text-align: right; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--brand-softer); }
.table.mini td { padding: 6px 4px; font-size: .82rem; }
.cell-person { display: flex; align-items: center; gap: 10px; }
.cell-person > span:last-child:not(.avatar) { display: flex; flex-direction: column; min-width: 0; }
.search { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.search input { flex: 1; max-width: 460px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.mini-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.mini-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; border-bottom: 1px solid var(--line); background: var(--surface); text-align: left; font-size: .86rem; }
.mini-row:last-child { border-bottom: 0; }
button.mini-row:hover { background: var(--surface-2); }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r); }
.empty-title { color: var(--fg); font-weight: 700; font-family: var(--font-d); }

.locked { max-width: 520px; margin: 40px auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 32px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.locked .ic { color: var(--muted); }

/* Lista de espera */
.wait-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.wait-row:last-child { border-bottom: 0; }
.wait-row .cell-person { flex: 1; min-width: 220px; }

/* Formularios */
.form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-label { font-size: .8rem; font-weight: 600; color: var(--muted); }
.field-hint { font-size: .76rem; color: var(--faint); }
.field-btn { justify-content: flex-end; }
.form-hint { font-size: .82rem; color: var(--warn); background: var(--warn-soft); padding: 7px 10px; border-radius: 6px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.push-left { margin-right: auto; }
.grid2, .grid3, .grid4 { display: grid; gap: 12px; }
.grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fieldset { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; margin: 0; }
.fieldset legend { font-size: .8rem; font-weight: 600; color: var(--muted); padding: 0 4px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: .86rem; }
.check input { accent-color: var(--brand); width: 16px; height: 16px; }
.radio-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.radio-card { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 12px; cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--brand); background: var(--brand-softer); }
.radio-card input { accent-color: var(--brand); margin-top: 3px; }
.radio-card span { display: flex; flex-direction: column; gap: 2px; }
.radio-card span span { color: var(--muted); font-size: .82rem; }
.input-prefix { display: flex; align-items: center; padding: 0 0 0 10px; overflow: hidden; }
.input-prefix span { color: var(--muted); white-space: nowrap; }
.form .input-prefix input { border: 0; padding-left: 2px; flex: 1; outline: none; }
.hours-grid { display: flex; flex-direction: column; gap: 6px; }
.hours-row { display: grid; grid-template-columns: 90px minmax(0, 1fr); align-items: center; gap: 8px; font-size: .84rem; }
.hours-row input { padding: 6px 8px !important; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.confirm-box { margin-top: 14px; padding: 12px; border-radius: var(--r-sm); background: var(--bad-soft); border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent); }
.confirm-box .btn-row { margin-top: 10px; }

.toggle { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-ui { width: 36px; height: 20px; border-radius: 99px; background: var(--line-strong); position: relative; flex-shrink: 0; margin-top: 2px; transition: background .15s; }
.toggle-ui::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle input:checked + .toggle-ui { background: var(--brand); }
.toggle input:checked + .toggle-ui::after { transform: translateX(16px); }
.toggle input:focus-visible + .toggle-ui { outline: 2px solid var(--accent); outline-offset: 2px; }
.toggle > span:last-child { display: flex; flex-direction: column; font-size: .88rem; }
.toggle .muted { font-size: .8rem; }

.notif-list { display: flex; flex-direction: column; max-height: 420px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r-sm); }
.notif-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: .84rem; }
.notif-row:last-child { border-bottom: 0; }
.notif-row p { color: var(--muted); margin-top: 2px; }
.evt { font-size: .72rem; background: var(--surface-2); padding: 2px 6px; border-radius: 4px; white-space: nowrap; }

.dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; margin: 0; font-size: .88rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.dl.tight { gap: 4px 12px; font-size: .82rem; }

/* Gastos */
.budget-row { display: flex; flex-direction: column; gap: 5px; }
.budget-top { display: flex; justify-content: space-between; gap: 8px; font-size: .86rem; }
.meter { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.meter.over span { background: var(--bad); }
.over-note { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; color: var(--bad); font-weight: 600; }

/* Gráficas */
.chart-wrap { overflow-x: auto; }
.chart { width: 100%; height: auto; display: block; min-width: 300px; }
.grid-line { stroke: var(--line); stroke-width: 1; }
.axis-text { fill: var(--muted); font-size: 11px; font-family: var(--font-b); }
.bar { fill: var(--brand); }
.bar-2 { fill: var(--faint); }
.bar-hit:hover .bar { filter: brightness(1.12); }
.legend { display: flex; gap: 16px; font-size: .8rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; background: var(--brand); display: inline-block; }
.sw-2 { background: var(--faint); }
.hbars { display: flex; flex-direction: column; gap: 8px; }
.hbar-row { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: .84rem; }
.hbar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: var(--brand); border-radius: 0 4px 4px 0; }
.hbar-val { font-variant-numeric: tabular-nums; color: var(--muted); }
.tooltip { position: fixed; z-index: 100; background: var(--fg); color: var(--bg); font-size: .78rem; padding: 5px 9px; border-radius: 6px; pointer-events: none; white-space: nowrap; }

/* Marca */
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-strong); }
.preview { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.pv-band { display: flex; align-items: center; gap: 12px; padding: 18px; background: var(--brand-soft); }
.pv-band strong { display: block; font-family: var(--font-d); font-size: 1.05rem; }
.pv-band span:not(.logo-mark) { color: var(--muted); font-size: .84rem; }
.pv-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.pv-label { font-size: .76rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.pv-svc { display: flex; justify-content: space-between; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); font-size: .86rem; }
.pv-svc.on { border-color: var(--brand); background: var(--brand-softer); }
.pv-btn { background: var(--brand); color: #fff; text-align: center; padding: 10px; border-radius: var(--r-sm); font-weight: 600; margin-top: 4px; }

/* Suscripción */
.sub-status .sub-top { display: flex; align-items: center; gap: 10px; }
.sub-status .btn { align-self: flex-start; }
.plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.plan-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.plan-card.featured { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.plan-card.current { background: var(--brand-softer); }
.plan-card .btn { margin-top: auto; }
.plan-flag { position: absolute; top: -10px; left: 16px; background: var(--brand); color: #fff; font-size: .7rem; font-weight: 700; padding: 2px 10px; border-radius: 99px; }
.plan-price { font-family: var(--font-d); font-size: 1.7rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.plan-price span { font-size: .85rem; font-weight: 500; color: var(--muted); font-family: var(--font-b); }
.checkout { display: flex; flex-direction: column; gap: 12px; }
.eyebrow { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.pay-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pay-btn { border: 0; border-radius: var(--r-sm); padding: 12px; font-weight: 600; }
.pay-btn.apple { background: #000; color: #fff; }
.pay-btn.google { background: #fff; color: #1f1f1f; box-shadow: inset 0 0 0 1px #c9ced6; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .8rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Detalle y modal */
.modal-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(10, 18, 28, .5); display: flex; align-items: flex-start; justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left)); overflow-y: auto; }
.modal { position: relative; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; padding: 24px; margin-block: auto; display: flex; flex-direction: column; gap: 12px; }
.modal.wide { max-width: 760px; }
.modal h2 { padding-right: 36px; font-size: 1.2rem; }
.modal h3 { margin-top: 6px; }
.modal-close { position: absolute; top: 14px; right: 14px; border-color: transparent; }
.detail-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-right: 36px; }
.detail-head h2 { padding-right: 0; }
.pay-form { background: var(--surface-2); border-radius: var(--r-sm); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.pay-title { font-weight: 700; font-size: .86rem; }
.pay-done { display: flex; align-items: center; gap: 10px; background: var(--ok-soft); color: var(--ok); padding: 10px 12px; border-radius: var(--r-sm); }
.pay-done div { flex: 1; display: flex; flex-direction: column; }
.pay-done span { color: var(--fg); font-size: .82rem; }
.chip-line { display: flex; align-items: center; gap: 6px; color: var(--muted); }

.toast-root, #toast-root { position: fixed; bottom: max(16px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(560px, calc(100% - 32px)); }
.toast { display: flex; align-items: center; gap: 8px; background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: .88rem; animation: toast-in .2s ease-out; transition: opacity .3s, transform .3s; }
.toast.warn .ic { color: var(--warn); }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Página pública (cliente) ---------- */
.cv { min-height: calc(var(--app-h) - 54px); background: var(--bg); }
.cv-band { background: var(--brand-soft); border-bottom: 1px solid var(--brand-line); }
.cv-band-inner { max-width: 820px; margin: 0 auto; display: flex; gap: 18px; align-items: center; flex-wrap: wrap;
  padding-block: 28px 24px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.cv-id { flex: 1; min-width: 240px; }
.cv-id h1 { font-size: 1.7rem; }
.cv-id > p:first-of-type { color: var(--muted); }
.cv-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: .84rem; color: var(--muted); }
.cv-meta span { display: inline-flex; align-items: center; gap: 5px; }
.cv-meta .ic { color: var(--brand-text); }
.cv-meta b { color: var(--fg); }
.cv-url { font-size: .78rem; color: var(--brand-text); background: var(--surface); border: 1px solid var(--brand-line); border-radius: 99px; padding: 3px 10px; }
.cv-body { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px;
  padding-block: 18px 40px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.cv-who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); }
.cv-who select { border: 1px solid var(--line-strong); border-radius: 6px; padding: 4px 8px; background: var(--surface); max-width: 100%; }
.demo-tag { background: var(--demobar); color: var(--demobar-fg); font-size: .68rem; font-weight: 700; padding: 2px 7px; border-radius: 4px; letter-spacing: .04em; text-transform: uppercase; }
.cv-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.cv-tab { border: 0; background: none; padding: 10px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; white-space: nowrap; }
.cv-tab.on { color: var(--brand-text); border-bottom-color: var(--brand); }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.step h2 { display: flex; align-items: center; gap: 10px; }
.step-n { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; font-size: .8rem; }
.step .empty { border: 0; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.choice { display: flex; flex-direction: column; gap: 2px; text-align: left; border: 1px solid var(--line-strong); background: var(--surface); padding: 12px 14px; border-radius: var(--r-sm); }
.choice span { color: var(--muted); font-size: .82rem; }
.choice.on { border-color: var(--brand); background: var(--brand-softer); box-shadow: 0 0 0 1px var(--brand); }
.svc-list { display: flex; flex-direction: column; gap: 14px; }
.svc-group { display: flex; flex-direction: column; gap: 6px; }
.svc-cat { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.svc { display: flex; align-items: center; gap: 12px; text-align: left; border: 1px solid var(--line); background: var(--surface); padding: 12px 14px; border-radius: var(--r-sm); }
.svc:hover { border-color: var(--line-strong); }
.svc.on { border-color: var(--brand); background: var(--brand-softer); box-shadow: 0 0 0 1px var(--brand); }
.svc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.svc-main span { color: var(--muted); font-size: .8rem; display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.svc-main em { color: var(--brand-text); font-style: normal; font-weight: 600; }
.svc-price { font-weight: 700; font-variant-numeric: tabular-nums; }
.svc-radio { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); flex-shrink: 0; }
.svc.on .svc-radio { border-color: var(--brand); background: radial-gradient(circle, var(--brand) 0 4px, transparent 5px); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 99px; padding: 6px 12px 6px 8px; font-size: .84rem; font-weight: 600; }
.chip-btn:first-child { padding-left: 12px; }
.chip-btn .muted { font-weight: 400; font-size: .76rem; }
.chip-btn.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-text); }
.day-strip { display: grid; grid-auto-flow: column; grid-auto-columns: 68px; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 0; border: 1px solid var(--line); background: var(--surface); padding: 8px 4px; border-radius: var(--r-sm); }
.day-name { font-size: .72rem; color: var(--muted); text-transform: capitalize; }
.day-num { font-family: var(--font-d); font-size: 1.2rem; font-weight: 700; }
.day-count { font-size: .68rem; color: var(--ok); font-weight: 600; white-space: nowrap; }
.day.none .day-count { color: var(--faint); }
.day.none .day-num { color: var(--muted); }
.day.on { border-color: var(--brand); background: var(--brand); color: #fff; }
.day.on .day-name, .day.on .day-count, .day.on .day-num { color: #fff; }
.times-box { border-top: 1px solid var(--line); padding-top: 14px; }
.time-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.time-label { font-size: .74rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.times { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 6px; }
.time { border: 1px solid var(--brand-line); background: var(--surface); color: var(--brand-text); border-radius: var(--r-sm); padding: 8px 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.time:hover { background: var(--brand-softer); }
.time.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.wait-cta { display: flex; gap: 12px; align-items: flex-start; background: var(--brand-softer); border: 1px solid var(--brand-line); border-radius: var(--r-sm); padding: 14px; }
.wait-cta > .ic { color: var(--brand-text); }
.wait-cta > div { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.wait-cta p { color: var(--muted); font-size: .86rem; }
.wait-form .btn { align-self: flex-start; }
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; background: var(--surface-2); border-radius: var(--r-sm); padding: 14px; }
.summary > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.summary .muted { font-size: .76rem; }
.done { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 32px 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.done .summary { width: 100%; text-align: left; }
.done-check { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); }
.my-appt { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.my-appt:last-child { border-bottom: 0; }
.my-date { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 58px; height: 64px; border-radius: var(--r-sm); background: var(--brand-soft); color: var(--brand-text); flex-shrink: 0; line-height: 1.1; }
.my-date span { font-size: .7rem; text-transform: uppercase; font-weight: 600; }
.my-date strong { font-family: var(--font-d); font-size: 1.3rem; }
.my-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.my-appt .btn-row { margin-top: 8px; }
.cv-foot { text-align: center; color: var(--faint); font-size: .78rem; padding: 0 16px 32px; }

/* Plataforma */
.platform { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px;
  padding-block: 24px 48px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.flow { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; counter-reset: f; }
.flow li { counter-increment: f; display: flex; flex-direction: column; gap: 4px; padding: 12px; background: var(--surface-2); border-radius: var(--r-sm); font-size: .84rem; }
.flow li::before { content: counter(f); display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: .72rem; font-weight: 700; margin-bottom: 4px; }
.flow span { color: var(--muted); }
.plan-mini { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.plan-mini div { display: flex; flex-direction: column; gap: 2px; padding: 12px; background: var(--surface-2); border-radius: var(--r-sm); }
.plan-mini div > span:nth-child(2) { font-family: var(--font-d); font-size: 1.2rem; font-weight: 700; }
.view-platform .table td { vertical-align: middle; }

/* ---------- Responsive ---------- */
@container app (max-width: 1000px) {
  .two-col { grid-template-columns: minmax(0, 1fr); }
  .flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container app (max-width: 820px) {
  .admin { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left)); gap: 10px; }
  .side-brand { padding: 0; }
  .side-role { flex-direction: row; align-items: center; justify-content: space-between; padding: 6px 10px; }
  .side-nav { flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 4px; margin-inline: -4px; }
  .nav-item { flex-shrink: 0; padding: 7px 10px; font-size: .84rem; }
  .side-public { margin-top: 0; }
  .main { padding: 18px max(16px, env(safe-area-inset-right)) 40px max(16px, env(safe-area-inset-left)); }
  .plan-grid { grid-template-columns: minmax(0, 1fr); }
  .db-tag { display: none; }
  .demobar { position: static; }
}
@container app (max-width: 560px) {
  h1 { font-size: 1.35rem; }
  .grid2, .grid3, .grid4, .radio-cards, .plan-mini, .flow, .pay-methods { grid-template-columns: minmax(0, 1fr); }
  .list-row { grid-template-columns: 52px minmax(0, 1fr); }
  .lr-who { display: none; }
  .lr-end { grid-column: 2; }
  .db-controls { width: 100%; }
  .db-field { flex: 1 1 100%; min-width: 0; order: 3; }
  .db-field > span { display: none; }
  .db-controls .seg { flex: 1; }
  .db-controls .seg button { flex: 1; }
  .db-field select { width: 100%; max-width: none; }
  .db-reset span { display: none; }
  .hbar-row { grid-template-columns: minmax(0, 100px) minmax(0, 1fr) auto; }
  .modal { padding: 20px 16px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-value { font-size: 1.1rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Selector de profesional y vista semanal */
.res-dd { position: relative; }
.res-dd-btn { display: inline-flex; align-items: center; gap: 8px; list-style: none; cursor: pointer; border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r-sm); padding: 5px 10px 5px 6px; font-weight: 600; font-size: .86rem; max-width: 260px; }
.res-dd-btn::-webkit-details-marker { display: none; }
.res-dd-btn > span:not(.avatar) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-dd-btn > .ic:first-child { margin-left: 4px; color: var(--muted); }
.res-dd-btn:hover, .res-dd[open] .res-dd-btn { border-color: var(--brand); }
.res-dd-menu { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; min-width: 260px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.res-dd-item { display: flex; align-items: center; gap: 10px; border: 0; background: none; border-radius: var(--r-sm); padding: 7px 8px; text-align: left; color: var(--fg); }
.res-dd-item:hover { background: var(--surface-2); }
.res-dd-item.on { background: var(--brand-softer); color: var(--brand-text); }
.res-dd-item > span:not(.avatar) { flex: 1; display: flex; flex-direction: column; line-height: 1.25; font-size: .86rem; }
.res-dd-item small { color: var(--muted); font-size: .74rem; }
.res-dd-note { font-size: .76rem; color: var(--muted); padding: 4px 8px 6px; }
.ag-day { display: flex; align-items: baseline; gap: 6px; width: 100%; border: 0; background: none; padding: 0; text-align: left; color: var(--fg); }
.ag-dname { font-size: .78rem; color: var(--muted); text-transform: capitalize; font-weight: 600; }
.ag-dnum { font-family: var(--font-d); font-size: 1.25rem; font-weight: 700; }
.ag-dcount { font-size: .72rem; color: var(--muted); margin-left: auto; }
.ag-day:hover .ag-dnum { color: var(--brand-text); text-decoration: underline; }
.ag-colwrap.is-today .ag-head { background: var(--brand-softer); box-shadow: inset 0 -2px 0 var(--brand); }
.ag-day.is-today .ag-dnum, .ag-day.is-today .ag-dname { color: var(--brand-text); }
.list-day { display: flex; justify-content: space-between; gap: 8px; padding: 8px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); font-weight: 700; font-size: .84rem; font-family: var(--font-d); }

/* Contexto de la agenda: a quién y qué fechas se están viendo */
.agc-head { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ag-context { display: flex; flex-wrap: wrap; align-items: stretch; background: var(--brand-soft); border: 1px solid var(--brand-line); border-radius: var(--r); overflow: hidden; }
.agc-item { display: flex; align-items: center; gap: 12px; padding: 10px 18px 10px 12px; min-width: 0; }
.agc-item + .agc-item { border-left: 1px solid var(--brand-line); }
.agc-item > div { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.agc-av { width: 40px; height: 40px; background: var(--brand); color: #fff; font-size: .85rem; }
.agc-av.agc-cal { background: var(--surface); color: var(--brand-text); box-shadow: inset 0 0 0 1px var(--brand-line); }
.agc-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--brand-text); }
.agc-value { font-family: var(--font-d); font-size: 1.08rem; font-weight: 700; color: var(--fg); }
.agc-note { font-size: .78rem; color: var(--muted); }
@container app (max-width: 560px) {
  .ag-context { flex-direction: column; width: 100%; }
  .agc-item + .agc-item { border-left: 0; border-top: 1px solid var(--brand-line); }
}

/* Encabezado de agenda: contexto y filtros a la izquierda, indicadores 2x2 a la derecha */
.ag-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 420px); gap: 16px 24px; align-items: start; }
.ag-top-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ag-top-main .ag-context { align-self: flex-start; }
.stats.stats-mini { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.stats-mini .stat { padding: 9px 12px; gap: 0; }
.stats-mini .stat-label { font-size: .66rem; }
.stats-mini .stat-value { font-size: 1.15rem; line-height: 1.3; }
.stats-mini .stat-note { font-size: .72rem; }
.stats-mini .stat:nth-child(5) { grid-column: 1 / -1; flex-direction: row; align-items: baseline; gap: 10px; }
@container app (max-width: 1100px) { .ag-top { grid-template-columns: minmax(0, 1fr); } .ag-top-stats .stats-mini { grid-template-columns: repeat(4, minmax(0, 1fr)); } .stats-mini .stat:nth-child(5) { grid-column: auto; flex-direction: column; gap: 0; } }
@container app (max-width: 560px) { .ag-top-stats .stats-mini { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stats-mini .stat:nth-child(5) { grid-column: 1 / -1; } }

/* Botón flotante de nueva cita */
.fab { position: fixed; z-index: 50; right: max(24px, calc(env(safe-area-inset-right) + 16px)); bottom: max(24px, calc(env(safe-area-inset-bottom) + 16px));
  width: 60px; height: 60px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: var(--brand); color: #fff; box-shadow: 0 6px 20px color-mix(in srgb, var(--brand) 45%, transparent), 0 2px 6px rgba(16, 26, 38, .2); transition: transform .15s, box-shadow .15s; }
.fab:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 10px 28px color-mix(in srgb, var(--brand) 50%, transparent), 0 2px 6px rgba(16, 26, 38, .2); }
.fab:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 40%, transparent); outline-offset: 3px; }
.fab::after { content: "Nueva cita"; position: absolute; right: calc(100% + 10px); white-space: nowrap; background: var(--fg); color: var(--bg); font-size: .78rem; font-weight: 600; padding: 5px 10px; border-radius: 6px; opacity: 0; pointer-events: none; transition: opacity .15s; }
.fab:hover::after { opacity: 1; }
.main { padding-bottom: 104px; }

/* Arrastrar y cambiar duración */
.ab.movable { cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.ab.armed { transform: scale(1.03); box-shadow: 0 10px 28px rgba(16, 26, 38, .28); z-index: 10; transition: transform .12s, box-shadow .12s; }
@media (pointer: coarse) {
  .ab-resize { height: 16px; }
  .ab-resize::after { opacity: .45; width: 28px; }
}
.ab-resize { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; cursor: ns-resize; }
.ab-resize::after { content: ""; position: absolute; left: 50%; bottom: 2px; width: 22px; height: 3px; margin-left: -11px; border-radius: 2px; background: currentColor; opacity: 0; transition: opacity .12s; }
.ab.movable:hover .ab-resize::after { opacity: .45; }
.ab.dragging { z-index: 10; cursor: grabbing; box-shadow: 0 8px 24px rgba(16, 26, 38, .22); opacity: .95; transition: none; }
.ab.dragging .ab-time { opacity: 1; }
.ab.invalid { background: var(--bad-soft) !important; border-color: var(--bad) !important; color: var(--bad) !important; border-style: dashed; }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; }
body.is-resizing, body.is-resizing * { cursor: ns-resize !important; }
body.is-dragging .ag-col { cursor: grabbing; }
.toast-btn { white-space: nowrap; flex-shrink: 0; margin-left: 8px; border: 0; background: none; color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; padding: 2px 4px; }
.only-touch { display: none; }
@media (pointer: coarse) { .only-touch { display: inline; } .only-mouse { display: none; } }

/* Buscador de pacientes en el formulario de cita */
.combo { position: relative; display: flex; align-items: center; }
.combo > .ic { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }
.form .combo-input { width: 100%; padding-left: 34px; }
.combo-list { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 6px; max-height: 330px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.combo-item { display: flex; align-items: center; gap: 10px; border: 0; background: none; border-radius: var(--r-sm); padding: 7px 8px; text-align: left; color: var(--fg); }
.combo-item:hover, .combo-item.active { background: var(--brand-softer); }
.combo-item.active { box-shadow: inset 0 0 0 1px var(--brand-line); }
.combo-item > span:not(.avatar) { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; font-size: .88rem; }
.combo-item small { color: var(--muted); font-size: .76rem; }
.combo-item mark { background: color-mix(in srgb, var(--brand) 22%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }
.combo-new { color: var(--brand-text); border-top: 1px solid var(--line); border-radius: 0 0 var(--r-sm) var(--r-sm); margin-top: 2px; }
.combo-new .ic { margin: 0 3px; }
.combo-empty, .combo-more { font-size: .8rem; color: var(--muted); padding: 6px 8px; }
.new-client { padding: 12px; background: var(--surface-2); border-radius: var(--r-sm); }

/* Calendario de disponibilidad */
.appt-when { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 16px; align-items: start; }
.appt-when-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.when-date { color: var(--fg); }
.cal { border: 1px solid var(--line); border-radius: var(--r); padding: 10px; background: var(--surface); }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cal-head strong { font-family: var(--font-d); font-size: .92rem; }
.icon-btn.sm { width: 28px; height: 28px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.cal-wd { text-align: center; font-size: .68rem; font-weight: 700; color: var(--faint); padding: 2px 0; }
.cal-cell { position: relative; aspect-ratio: 1; max-width: 100%; border: 0; border-radius: 8px; background: var(--brand-softer); color: var(--fg); font-weight: 600; font-size: .84rem; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.cal-cell.empty { background: none; }
.cal-cell:hover:not(:disabled) { background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand-line); }
.cal-cell.today span { text-decoration: underline; text-underline-offset: 3px; }
.cal-cell.on, .cal-cell.on:hover:not(:disabled) { background: var(--brand); color: #fff; box-shadow: none; }
.cal-cell.off { background: none; color: var(--faint); cursor: not-allowed; font-weight: 400; }
.cal-cell.off span { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--faint) 70%, transparent); }
.cal-cell.closed:not(.on) { background: var(--surface-2); color: var(--muted); }
.cal-dot { position: absolute; bottom: 4px; left: 50%; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--ok); }
.cal-dot.few { background: var(--warn); }
.cal-cell.on .cal-dot { background: #fff; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: .7rem; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cal-legend .cal-dot { position: static; margin: 0; }
.cal-x { width: 10px; height: 1.5px; background: var(--faint); display: inline-block; }

/* Urgencias */
.emergency-check { display: block; cursor: pointer; }
.emergency-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.emergency-check > span { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px dashed var(--line-strong); border-radius: var(--r-sm); color: var(--muted); }
.emergency-check > span > span { display: flex; flex-direction: column; line-height: 1.3; }
.emergency-check strong { color: var(--fg); font-size: .88rem; }
.emergency-check small { font-size: .76rem; }
.emergency-check input:checked + span { border: 1px solid var(--bad); background: var(--bad-soft); color: var(--bad); }
.emergency-check input:checked + span strong { color: var(--bad); }
.emergency-check input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.form-hint.danger { color: var(--bad); background: var(--bad-soft); }
.ab.emergency { background: var(--bad-soft); border: 1.5px solid var(--bad); color: var(--bad); z-index: 3; background-image: repeating-linear-gradient(135deg, transparent 0 8px, color-mix(in srgb, var(--bad) 8%, transparent) 8px 10px); }
.ab-flag { display: inline-flex; align-items: center; gap: 2px; margin-left: 4px; font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 0 4px; border-radius: 4px; background: var(--bad); color: #fff; }
.ab-flag.delay { background: var(--warn); }
.ab.delayed { outline: 1.5px dashed color-mix(in srgb, var(--warn) 70%, transparent); outline-offset: -1px; }
.ab-time { flex-wrap: wrap; }
@container app (max-width: 640px) { .appt-when { grid-template-columns: minmax(0, 1fr); } }

/* Cambios sin avisar al paciente */
.ab-notice { position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--info); color: #fff; box-shadow: 0 0 0 2px var(--surface); }
.ab.unnotified .ab-time { padding-right: 18px; }
.ab.unnotified { box-shadow: inset 0 0 0 1.5px var(--info); }
.notice-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--r); background: var(--info-soft); border: 1px solid color-mix(in srgb, var(--info) 35%, transparent); }
.notice-bar > .ic { color: var(--info); }
.notice-bar > div { flex: 1; min-width: 0; font-size: .88rem; }
.notice-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-sm); }
.notice-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.notice-row:last-child { border-bottom: 0; }
.notice-change { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: .84rem; margin-top: 2px; font-variant-numeric: tabular-nums; }
.notice-change s { color: var(--muted); }
.notice-change .ic { color: var(--muted); }
.notice-change b { color: var(--info); }
.notice-inline { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-sm); background: var(--info-soft); }
.notice-inline > .ic { color: var(--info); margin-top: 2px; }
.notice-inline strong { color: var(--info); }
.notice-inline .btn-row { margin-top: 8px; }
.toast .toast-btn + .toast-btn { margin-left: 2px; }

/* Formulario de cita en dos columnas, sin desplazamiento vertical */
.modal.wide:has(#apptForm) { max-width: 840px; padding: 20px 24px; gap: 8px; }
#apptForm { gap: 12px; }
.appt-cols { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; align-items: start; }
.appt-left { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.appt-left #apptDynSide { display: flex; flex-direction: column; gap: 8px; }
.appt-right .field { gap: 4px; }
.field-aside { font-weight: 400; color: var(--faint); margin-left: 4px; }
#apptForm .form-hint { margin: 0; padding: 6px 10px; font-size: .8rem; }
#apptForm .emergency-check > span { padding: 7px 10px; gap: 8px; flex-wrap: wrap; }
#apptForm .emergency-check strong { font-size: .84rem; }
#apptForm .emergency-check small { font-size: .74rem; }
#apptForm .new-client { padding: 8px; gap: 8px; }
#apptForm .grid2 { gap: 10px; }
#apptForm .cal { padding: 8px; }
#apptForm .cal-head { margin-bottom: 2px; }
#apptForm .cal-grid { gap: 2px; }
#apptForm .cal-cell { aspect-ratio: auto; height: 32px; font-size: .8rem; }
#apptForm .cal-dot { bottom: 3px; }
#apptForm .cal-legend { margin-top: 6px; gap: 2px 10px; }
#apptForm .form-actions { margin-top: 0; }
@container app (max-width: 700px) {
  .appt-cols { grid-template-columns: minmax(0, 1fr); }
  .appt-right { order: -1; }
}

/* Leyenda de colores de la agenda */
/* Barra sobre la agenda: ayuda a la izquierda, ícono de leyenda a la derecha */
.ag-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: -8px; }
.ag-bar .hint-row { margin: 0; }
.ag-info { position: relative; flex-shrink: 0; }
.ag-info-btn { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); cursor: help; }
.ag-info-btn:hover, .ag-info-btn:focus-visible, .ag-info:focus-within .ag-info-btn { color: var(--brand-text); border-color: var(--brand); }
.ag-legend-pop { position: absolute; z-index: 25; top: calc(100% + 8px); right: 0; width: 270px; display: none; flex-direction: column; gap: 7px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); font-size: .82rem; color: var(--fg); }
.ag-legend-pop::before { content: ""; position: absolute; top: -6px; right: 11px; width: 10px; height: 10px; background: var(--surface); border-left: 1px solid var(--line); border-top: 1px solid var(--line); transform: rotate(45deg); }
.ag-legend-pop strong { font-family: var(--font-d); font-size: .86rem; margin-bottom: 2px; }
.ag-legend-pop span { display: flex; align-items: center; gap: 8px; }
.ag-info:hover .ag-legend-pop, .ag-info:focus-within .ag-legend-pop { display: flex; }
.lg-sw.lg-delay { background: var(--surface); border: 1.5px dashed var(--warn); }
.lg-sw { width: 14px; height: 10px; border-radius: 3px; border: 1px solid; display: inline-block; }
.lg-sw.st-pend { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 55%, transparent); }
.lg-sw.st-conf { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 55%, transparent); }
.lg-sw.st-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.lg-sw.st-bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 50%, transparent); }
.lg-sw.lg-emerg { background: var(--bad-soft); border: 1.5px solid var(--bad); background-image: repeating-linear-gradient(135deg, transparent 0 3px, color-mix(in srgb, var(--bad) 25%, transparent) 3px 4px); }
.lg-bell { width: 14px; height: 14px; border-radius: 50%; background: var(--info); color: #fff; display: inline-grid; place-items: center; }


/* ---------- Escenario: vista web o vista celular ---------- */
:root { --app-h: 100vh; }
/* Solo el contenido de la app es contenedor: así el botón +, las ventanas y los mensajes siguen fijos a la pantalla. */
#scroller { container-type: inline-size; container-name: app; }
.seg-device button { display: grid; place-items: center; padding: 5px 10px; }
#stage-caption { display: none; }

/* La barra de demo vive fuera del escenario: sus reglas responsivas siguen el tamaño real de la ventana. */
@media (max-width: 820px) { .db-tag { display: none; } #demobar { position: static; } }
@media (max-width: 560px) {
  .db-controls { width: 100%; }
  .db-field { flex: 1 1 100%; min-width: 0; order: 3; }
  .db-field > span { display: none; }
  .db-controls .seg { flex: 1; }
  .db-controls .seg button { flex: 1; }
  .db-field select { width: 100%; max-width: none; }
  .db-reset span { display: none; }
  .seg-device { display: none !important; }
}

/* Marco de teléfono: transform hace que lo fijo (botón +, ventanas, mensajes) quede dentro del teléfono. */
body.device-mobile { background: color-mix(in srgb, var(--demobar) 8%, var(--bg)); }
body.device-mobile #stage-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 24px 16px 32px; }
body.device-mobile #stage {
  position: relative; transform: translateZ(0);
  width: 390px; max-width: 100%; height: min(844px, calc(100vh - 140px)); min-height: 560px;
  border-radius: 46px; border: 12px solid #0E141B; box-shadow: 0 0 0 2px #2A3644, 0 24px 60px rgba(14, 20, 27, .35);
  background: var(--bg); overflow: hidden;
}
body.device-mobile #stage::before { content: ""; position: absolute; z-index: 80; top: 8px; left: 50%; width: 96px; height: 26px; margin-left: -48px; border-radius: 20px; background: #0E141B; pointer-events: none; }
body.device-mobile #scroller { --app-h: 100cqh; container-type: size; height: 100%; overflow-y: auto; overflow-x: hidden; padding-top: 40px; overscroll-behavior: contain; scrollbar-width: none; }
body.device-mobile #scroller::-webkit-scrollbar { display: none; }
body.device-mobile #stage-caption { display: block; font-size: .78rem; color: var(--muted); }
body.device-mobile .modal-backdrop { padding: 48px 10px 16px; }
body.device-mobile .fab { right: 18px; bottom: 22px; }
body.device-mobile #toast-root { bottom: 18px; }
body.device-mobile .admin, body.device-mobile .cv { min-height: calc(100cqh - 40px); }

/* Ventanas emergentes: están fuera del contenedor, así que repiten aquí sus reglas para pantallas angostas. */
@media (max-width: 560px) {
  .modal .grid2, .modal .grid3, .modal .grid4, .modal .radio-cards, .modal .pay-methods { grid-template-columns: minmax(0, 1fr); }
  .modal { padding: 20px 16px; }
}
@media (max-width: 700px) { .appt-cols { grid-template-columns: minmax(0, 1fr); } .appt-right { order: -1; } }
body.device-mobile .modal .grid2, body.device-mobile .modal .grid3, body.device-mobile .modal .grid4, body.device-mobile .modal .radio-cards, body.device-mobile .modal .pay-methods { grid-template-columns: minmax(0, 1fr); }
body.device-mobile .modal { padding: 20px 16px; border-radius: 18px; }
body.device-mobile .modal.wide:has(#apptForm) { padding: 18px 14px; }
body.device-mobile .appt-cols { grid-template-columns: minmax(0, 1fr); }
body.device-mobile .appt-right { order: -1; }
body.device-mobile #toast-root { width: calc(100% - 24px); }


/* ---------- Menú hamburguesa (pantallas angostas) ---------- */
.mbar { display: none; }
.drawer-wrap { display: none; }
@container app (max-width: 820px) {
  .side { display: none; }
  .mbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--line);
    padding: 10px max(16px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left)); }
  .mbar-menu { position: relative; border-color: transparent; }
  .mbar-dot { position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 2px var(--surface); }
  .mbar-title { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
  .mbar-title strong { font-family: var(--font-d); font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mbar-title span { font-size: .76rem; color: var(--brand-text); font-weight: 600; }
}
.drawer-wrap.open { display: block; }
.drawer-overlay { position: fixed; inset: 0; z-index: 70; background: rgba(10, 18, 28, .45); animation: fade-in .18s ease-out; }
.drawer { position: fixed; z-index: 71; top: 0; bottom: 0; left: 0; width: min(300px, 86%); background: var(--surface); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 12px; overflow-y: auto;
  padding: max(14px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  animation: drawer-in .2s ease-out; }
.drawer-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.drawer-top .icon-btn { border-color: transparent; }
.drawer .side-brand { padding: 0 4px; }
.drawer-nav { display: flex; flex-direction: column; gap: 2px; }
.drawer-nav .nav-item { padding: 10px 10px; font-size: .92rem; }
.drawer .side-public { margin-top: auto; }
body.device-mobile .drawer { padding-top: 48px; }
@keyframes drawer-in { from { transform: translateX(-100%); } }
@keyframes fade-in { from { opacity: 0; } }

/* Mensajes con botones: el texto ocupa el ancho y los botones bajan si no caben. */
.toast.has-actions { flex-wrap: wrap; row-gap: 6px; }
.toast-msg { flex: 1 1 240px; min-width: 0; }
.toast-actions { display: flex; flex-wrap: wrap; gap: 2px 4px; margin-left: auto; }
.toast-actions .toast-btn { margin-left: 0; padding: 4px 8px; border-radius: 6px; }
.toast-actions .toast-btn:hover { background: color-mix(in srgb, var(--bg) 14%, transparent); }
@container app (max-width: 560px) { .toast-actions { width: 100%; justify-content: flex-end; } }
body.device-mobile .toast-actions { width: 100%; justify-content: flex-end; border-top: 1px solid color-mix(in srgb, var(--bg) 18%, transparent); padding-top: 6px; }
body.device-mobile .toast.has-actions { align-items: flex-start; }
@media (max-width: 560px) { .toast-actions { width: 100%; justify-content: flex-end; border-top: 1px solid color-mix(in srgb, var(--bg) 18%, transparent); padding-top: 6px; } .toast.has-actions { align-items: flex-start; } }

/* ---------- Imprevistos ---------- */
.card-head.between { justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.reason-chips { margin-top: -4px; }
.reason-chips .chip-btn { padding: 4px 10px; font-weight: 500; font-size: .8rem; }
.inc-preview { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-sm); background: var(--ok-soft); color: var(--ok); font-size: .86rem; }
.inc-preview span { color: var(--fg); }
.inc-preview.has { background: var(--warn-soft); color: var(--warn); }
.inc-list-head { display: flex; flex-wrap: wrap; gap: 6px; }
.inc-tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; background: var(--bad-soft); color: var(--bad); font-size: .8rem; font-weight: 600; }
.inc-bulk { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.inc-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-sm); max-height: 300px; overflow-y: auto; }
.inc-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.inc-row:last-child { border-bottom: 0; }
.inc-row .row-actions { align-items: center; }
.select-inline.sm { padding: 4px 6px; font-size: .8rem; }
.inc-msg textarea { width: 100%; }
.notice-bar.incident { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.notice-bar.incident > .ic { color: var(--bad); }
.ab.affected { border: 1.5px solid var(--bad) !important; box-shadow: 0 0 0 2px color-mix(in srgb, var(--bad) 18%, transparent); }
.ab-flag.incident { background: var(--bad); }
.ag-note.incident { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); background: var(--bad-soft); font-weight: 600; }
.inc-client { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--bad-soft); color: var(--bad); font-size: .84rem; }
.inc-client span { color: var(--fg); }
@container app (max-width: 560px) { .tb-incident span { display: none; } }
body.device-mobile .modal .inc-row .row-actions { width: 100%; justify-content: flex-start; }

.inc-list-head { align-items: center; }
.inc-move { display: inline-flex; align-items: center; gap: 6px; }
.inc-move label { font-size: .8rem; color: var(--muted); }
.notice-bar.incident > div:first-of-type { display: flex; flex-direction: column; gap: 2px; }
.notice-bar .row-actions { flex-shrink: 0; }

/* Equipo y permisos */
.role-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.role-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.role-card p { font-size: .84rem; color: var(--muted); }
.role-chip { align-self: flex-start; font-size: .74rem; font-weight: 700; padding: 2px 10px; border-radius: 99px; }
.r-admin { background: var(--brand-soft); color: var(--brand-text); }
.r-pro { background: var(--ok-soft); color: var(--ok); }
.r-recepcion { background: var(--warn-soft); color: var(--warn); }
.team-table td.center, .team-table th.center { text-align: center; }
.role-box { width: 18px; height: 18px; accent-color: var(--brand); }
.side-role em.demo-tag { font-style: normal; margin-left: 4px; font-size: .6rem; padding: 1px 5px; }
.delta { font-size: .74rem; color: var(--muted); }
.delta.up { color: var(--ok); }
.delta.down { color: var(--bad); }
@container app (max-width: 820px) { .role-cards { grid-template-columns: minmax(0, 1fr); } }

.stats.stats-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@container app (max-width: 820px) { .stats.stats-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* En vista celular la barra de demo no tapa al teléfono y el menú lateral no aplica. */
body.device-mobile .side { top: 0; }
.report-filters { gap: 12px; }
.inline-field { display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; color: var(--muted); }
.table tr.is-selected td { background: var(--brand-soft); }

/* Celular: filas de listas en dos renglones y espacio para el botón + */
@container app (max-width: 560px) {
  .mini-row { flex-wrap: wrap; row-gap: 6px; }
  .mini-row > .grow { flex-basis: 100%; }
  .report-filters .muted.small { flex-basis: 100%; }
}
@container app (max-width: 820px) { .main { padding-bottom: 104px; } }

.compare-note { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); margin-bottom: -6px; }

/* Encabezados ordenables */
.table th.sortable { padding: 0; }
.th-sort { display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: none; padding: 10px 14px; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; text-align: left; white-space: nowrap; }
.table th.num .th-sort { justify-content: flex-end; }
.th-sort:hover { color: var(--fg); background: color-mix(in srgb, var(--line) 50%, transparent); }
.sort-ic { font-size: .7rem; color: var(--faint); letter-spacing: 0; }
.th-sort:hover .sort-ic { color: var(--muted); }
th.sorted .th-sort { color: var(--brand-text); }
th.sorted .sort-ic { color: var(--brand-text); }

/* Gastos: sucursales, categorías y presupuesto */
.scope-seg { align-self: flex-start; flex-wrap: wrap; }
.mini-row .icon-btn.sm { flex-shrink: 0; border-color: transparent; }
.cat-head, .cat-row { display: grid; grid-template-columns: minmax(0, 1fr) 160px 32px; gap: 8px; align-items: center; }
.cat-head { font-size: .74rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
#catRows { display: flex; flex-direction: column; gap: 6px; }
.form .cat-row > input, .form .cat-row .input-prefix { width: 100%; }
.form .cat-row .input-prefix input { width: 100%; }
.plain-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: .9rem; }
.sub-cancel { align-self: flex-start; }

/* Editor de horario con selectores */
.hours-grid { gap: 4px; }
.hday { display: grid; grid-template-columns: 120px minmax(0, 1fr); align-items: start; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.hday:last-child { border-bottom: 0; }
.hday-on { display: flex; align-items: center; gap: 8px; font-size: .86rem; font-weight: 600; padding-top: 6px; cursor: pointer; }
.hday-on input { width: 16px; height: 16px; accent-color: var(--brand); }
.hday:not(.on) .hday-on span { color: var(--muted); font-weight: 500; }
.hday-blocks { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.hday:not(.on) .hday-blocks { display: none; }
.hday.on .hday-off { display: none; }
.hday-off { font-size: .84rem; padding-top: 6px; }
.hb { display: flex; align-items: center; gap: 6px; }
.form .hb select.tsel { padding: 5px 6px; font-variant-numeric: tabular-nums; }
.hb .icon-btn.sm { border-color: transparent; }
.link.small { font-size: .8rem; font-weight: 600; }
.section-title.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.section-title.between h2 { margin: 0; }
.field > .hday { grid-template-columns: minmax(0, 1fr); border: 0; padding: 0; }
@container app (max-width: 560px) { .hday { grid-template-columns: minmax(0, 1fr); gap: 4px; } }

/* Planes por tamaño */
.plan-grid.tiers { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.plan-card.too-small { opacity: .6; }
.plan-limits { font-size: .84rem; font-weight: 600; }
.plan-why { font-size: .8rem; color: var(--warn); background: var(--warn-soft); padding: 6px 8px; border-radius: 6px; }
.plans-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.plans-head .section-title { margin: 0; }
.seg .save { font-size: .7rem; color: var(--ok); font-weight: 700; }
.use-row { display: flex; flex-direction: column; gap: 5px; }
.meter.full span { background: var(--warn); }
.plan-mini.tiers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@container app (max-width: 1000px) { .plan-grid.tiers { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container app (max-width: 560px) { .plan-grid.tiers { grid-template-columns: minmax(0, 1fr); } }
.plain-list li.warn-li { color: var(--warn); }
.plain-list li.warn-li strong { color: var(--warn); }

/* Privacidad */
.json-box { max-height: 360px; overflow: auto; background: var(--surface-2); border-radius: var(--r-sm); padding: 12px; font-size: .76rem; line-height: 1.45; white-space: pre; margin: 0; }
.privacy-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }

.banner-short { display: none; }
@container app (max-width: 560px) { .banner-more { display: none; } .banner-short { display: inline; } .banner { padding: 10px 12px; } }

.method-deltas { display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--line); padding-top: 10px; }
.method-delta { display: flex; justify-content: space-between; gap: 8px; font-size: .82rem; }

/* Roles editables */
.role-cards { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.role-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.role-card .btn { align-self: flex-start; margin-top: auto; }
.role-card > .muted.small { display: inline-flex; align-items: center; gap: 4px; margin-top: auto; }
.role-new { border-style: dashed; background: none; cursor: pointer; align-items: flex-start; text-align: left; color: var(--brand-text); }
.role-new:hover { border-color: var(--brand); background: var(--brand-softer); }
.rc-0 { background: var(--brand-soft); color: var(--brand-text); }
.rc-1 { background: var(--ok-soft); color: var(--ok); }
.rc-2 { background: var(--warn-soft); color: var(--warn); }
.rc-3 { background: var(--info-soft); color: var(--info); }
.rc-4 { background: var(--bad-soft); color: var(--bad); }
.rc-5 { background: var(--surface-2); color: var(--fg); }
.perm-group { display: flex; flex-direction: column; gap: 6px; }
.check.perm { align-items: flex-start; }
.check.perm input { margin-top: 2px; }
.check.perm span { display: flex; flex-direction: column; }
.check.perm small { color: var(--muted); font-size: .76rem; }

/* Alta de negocio nuevo */
.signup { min-height: calc(var(--app-h) - 58px); background: var(--bg); }
.su-wrap { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; padding-block: 24px 48px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.su-head { display: flex; align-items: center; gap: 8px; font-family: var(--font-d); }
.su-head .db-logo { background: var(--brand); }
.su-steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.su-steps li { display: flex; flex-direction: row; white-space: nowrap; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); padding: 4px 10px 4px 4px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); }
.su-steps li span { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--surface-2); font-size: .7rem; font-weight: 700; }
.su-steps li.su-on { color: var(--brand-text); border-color: var(--brand); font-weight: 600; }
.su-steps li.su-on span { background: var(--brand); color: #fff; }
.su-steps li.su-done span { background: var(--ok-soft); color: var(--ok); }
.su-card h2 { font-size: 1.3rem; }
.su-nav { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 6px; justify-content: space-between; }
.giro-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.giro-card { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 10px; cursor: pointer; }
.giro-card:has(input:checked) { border-color: var(--brand); background: var(--brand-softer); box-shadow: 0 0 0 1px var(--brand); }
.giro-card input { accent-color: var(--brand); margin-top: 3px; }
.giro-card span { display: flex; flex-direction: column; }
.giro-card small { color: var(--muted); font-size: .76rem; }
.su-svc-head, .su-svc { display: grid; grid-template-columns: 24px minmax(0, 1fr) 110px 130px; gap: 8px; align-items: center; }
.su-svc-head { font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
#suSvcRows, #suTeamRows { display: flex; flex-direction: column; gap: 6px; }
.su-svc input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); }
.form .su-svc .input-prefix input { width: 100%; }
.su-team { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 150px auto auto; gap: 8px; align-items: center; }
.su-team:not(:has(select + select)) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 150px auto; }
.su-team .icon-btn.sm { border-color: transparent; }
.welcome { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.welcome .welcome-list { text-align: left; align-self: stretch; }
.db-new { color: var(--demobar-fg); border-color: #3B4F66; }
@container app (max-width: 700px) {
  .giro-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .su-svc-head { display: none; }
  .su-svc { grid-template-columns: 24px minmax(0, 1fr) minmax(0, 1fr); padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .su-svc > :nth-child(2) { grid-column: 2 / 4; }
  .su-svc > :nth-child(3) { grid-column: 2; }
  .su-team, .su-team:not(:has(select + select)) { grid-template-columns: minmax(0, 1fr) auto; }
  .su-team > input, .su-team > select { grid-column: 1; }
  .su-team > .icon-btn { grid-column: 2; grid-row: 1; }
}

/* Horarios: cada modo muestra solo su campo, alineado bajo su opción */
.mode-form:not(:has(input[name=mode][value=fijo]:checked)) .f-fijo,
.mode-form:has(input[name=mode][value=fijo]:checked) .f-servicio { display: none; }
.mode-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px 24px; align-items: start; }
.mode-layout .mode-options { grid-template-columns: minmax(0, 1fr); }
.mode-fields { display: flex; flex-direction: column; gap: 12px; }
@container app (max-width: 700px) { .mode-layout { grid-template-columns: minmax(0, 1fr); } }

/* Sesión en la barra de la demo */
.db-session { display: flex; align-items: center; gap: 8px; color: var(--demobar-fg); padding: 4px 10px; border: 1px solid #2A3A4C; border-radius: 8px; min-width: 0; }
.db-session span { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.db-session strong { font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.db-session small { font-size: .7rem; color: var(--demobar-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.db-session.off { color: var(--demobar-muted); }
.db-logo.lg { width: 44px; height: 44px; border-radius: 12px; }

/* Usuario en el menú lateral */
.side-role.side-user { flex-direction: row; align-items: center; gap: 8px; }
.side-user .grow { display: flex; flex-direction: column; min-width: 0; }
.side-user strong, .side-user small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-av { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; font-size: .7rem; font-weight: 700; }
.side-user .icon-btn.sm { flex: none; }
.banner.support { background: #101A26; color: #E8EEF5; border-color: #101A26; margin-bottom: 14px; }
.banner.support .btn { background: #fff; }
.main > .banner.info:first-child { margin-bottom: 14px; }

/* Pantalla de inicio de sesión */
.login { min-height: calc(var(--app-h) - 58px); background: var(--bg); }
.login-wrap { max-width: 1040px; margin: 0 auto; padding: 36px 16px 48px; display: flex; flex-direction: column; gap: 22px; }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand div { display: flex; flex-direction: column; }
.login-brand strong { font-family: var(--font-d); font-size: 1.4rem; }
.login-brand span { color: var(--muted); font-size: .9rem; }
.login-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.login-card { display: flex; flex-direction: column; gap: 12px; }
.login-card h2 { font-size: 1.3rem; margin-top: 6px; }
.login-tabs { align-self: stretch; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.login-alt { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 14px; font-size: .86rem; color: var(--muted); }
.login-demo { display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.login-demo h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 8px 0 0; }
.login-demo-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.login-demo code { background: var(--surface); padding: 1px 6px; border-radius: 4px; }
.demo-acct { display: flex; align-items: center; gap: 10px; text-align: left; width: 100%; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--fg); }
.demo-acct:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,.06)); }
.demo-acct .grow { display: flex; flex-direction: column; min-width: 0; }
.demo-acct .grow > span { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.demo-acct .ic { color: var(--muted); flex: none; }
.code-input { font-size: 1.4rem; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }
.cv-who .btn { margin-left: auto; }
.cv-switch { display: flex; align-items: center; gap: 6px; }
.cv-preview { margin-bottom: 4px; }
@container app (max-width: 760px) {
  .login-grid { grid-template-columns: minmax(0, 1fr); }
  .login-wrap { padding-top: 20px; }
  .db-session strong, .db-session small { max-width: 130px; }
}
.login-demo select { width: 100%; border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 9px 10px; background: var(--surface); color: var(--fg); font: inherit; }

/* Plataforma: lista de negocios con buscador, filtros, ubicación y paginación */
.pf-head { display: flex; align-items: center; gap: 6px; }
.pf-head h2 { margin: 0; }
.ag-info.pop-left .ag-legend-pop { left: -8px; right: auto; }
.ag-info.pop-left .ag-legend-pop::before { left: 15px; right: auto; }
.access-pop { width: min(420px, 82vw); }
.access-pop ol { margin: 4px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; }
.access-pop li { padding-left: 2px; }
.access-pop li b { display: block; font-size: .82rem; }
.access-pop li span { display: block; color: var(--muted); font-size: .78rem; line-height: 1.4; }
.pf-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 6px 0 10px; }
.pf-tools .search-box { flex: 1 1 280px; }
.pf-tools select { border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 8px 10px; background: var(--surface); color: var(--fg); font: inherit; font-size: .86rem; }
.pf-table .loc { display: flex; flex-direction: column; gap: 1px; }
.map-link { display: inline-flex; align-items: center; gap: 3px; font-size: .74rem; color: var(--info); text-decoration: none; white-space: nowrap; }
.map-link:hover { text-decoration: underline; }
.loc-dd summary { cursor: pointer; display: flex; flex-direction: column; list-style: none; }
.loc-dd summary::-webkit-details-marker { display: none; }
.loc-dd summary strong::after { content: " ▾"; color: var(--muted); font-weight: 400; }
.loc-dd[open] summary strong::after { content: " ▴"; }
.loc-b { display: flex; flex-direction: column; padding: 6px 0 0 8px; margin-top: 6px; border-left: 2px solid var(--line); font-size: .82rem; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.pager-btns { display: flex; gap: 4px; align-items: center; }
.pager .pg { min-width: 32px; height: 32px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; font-size: .82rem; font-weight: 600; color: var(--fg); }
.pager .pg.on { background: var(--fg); color: var(--surface); border-color: var(--fg); }
td.center { text-align: center; padding: 24px; }

/* Mi marca: sucursales y ubicación */
.branch-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 10px; }
.branch-form { border: 1px solid var(--line); border-radius: var(--r); padding: 14px; gap: 10px; }
.branch-head { display: flex; align-items: center; gap: 8px; }
.branch-ic { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--brand-softer, var(--surface-2)); color: var(--brand-text, var(--brand)); flex: none; }
.form .branch-name { flex: 1; font-weight: 700; font-family: var(--font-d); border-color: transparent; padding-left: 4px; }
.form .branch-name:hover, .form .branch-name:focus { border-color: var(--line-strong); }
.branch-actions { align-items: center; flex-wrap: wrap; }
@container app (max-width: 900px) { .branch-grid { grid-template-columns: minmax(0, 1fr); } }
.pf-tools .search input { max-width: none; }

/* Reserva paso a paso: un paso abierto, los listos se pliegan y arriba queda el resumen */
.bk-bar { position: sticky; top: 0; z-index: 5; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(6px); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 2px 8px rgba(15, 23, 42, .05); }
body:not(.device-mobile) .bk-bar { top: calc(var(--db-h) + 8px); }
.bk-progress { display: flex; align-items: center; gap: 10px; font-size: .76rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.bk-track { flex: 1; height: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bk-track i { display: block; height: 100%; background: var(--brand); border-radius: 4px; transition: width .25s; }
.bk-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bk-chip { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 4px 10px; border-radius: 99px; border: 1px solid color-mix(in srgb, var(--brand) 35%, transparent); background: var(--brand-softer, var(--surface-2)); color: var(--brand-text, var(--fg)); font-size: .8rem; font-weight: 600; }
.bk-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-steps { display: flex; flex-direction: column; gap: 8px; }
.bk-steps .step.open { scroll-margin-top: calc(var(--db-h, 0px) + 120px); }
body.device-mobile .bk-steps .step.open { scroll-margin-top: 110px; }
.step-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); color: var(--fg); }
.step-row .grow { display: flex; flex-direction: column; min-width: 0; }
.step-row small { font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.step-row strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-row.is-done:hover { border-color: var(--line-strong); }
.step-row.is-locked { opacity: .55; background: transparent; border-style: dashed; }
.step-row .step-n { flex: none; }
.step-n.ok { background: var(--ok-soft); color: var(--ok); }
.step-edit { font-size: .82rem; font-weight: 600; color: var(--brand-text, var(--brand)); white-space: nowrap; }

/* Inicio del cliente: sus negocios y citas */
.portal { min-height: calc(var(--app-h) - 58px); background: var(--bg); }
.portal-wrap { max-width: 1040px; margin: 0 auto; padding: 28px 16px 48px; display: flex; flex-direction: column; gap: 20px; }
.biz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.biz-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--brand); border-radius: var(--r); }
.biz-top { display: flex; gap: 10px; align-items: center; }
.biz-top .grow { display: flex; flex-direction: column; min-width: 0; }
.biz-next { margin: 0; display: flex; gap: 6px; align-items: flex-start; font-size: .86rem; }
.biz-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.cp-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.cp-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--fg); }
.cp-row:not(.static):hover { border-color: var(--line-strong); }
.cp-row .grow { display: flex; flex-direction: column; min-width: 0; }
.cp-row .grow > span { font-size: .8rem; }
.cp-date { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 44px; height: 44px; flex: none; border-radius: 10px; background: color-mix(in srgb, var(--brand) 12%, var(--surface)); color: var(--brand); font-size: .66rem; text-transform: uppercase; font-weight: 700; }
.cp-date b { font-size: 1.05rem; line-height: 1; }
.cv-back { margin-right: 4px; }

/* Encabezado del inicio del cliente: franja de color, como en la página de cada negocio */
.portal-band { position: relative; overflow: hidden; background: linear-gradient(100deg, color-mix(in srgb, #8A0FF0 9%, var(--surface)), color-mix(in srgb, #0B62F4 8%, var(--surface))); border-bottom: 1px solid color-mix(in srgb, #6A16E0 18%, var(--line)); }
.portal-band-inner { max-width: 1040px; margin: 0 auto; padding: 24px 16px; display: flex; align-items: center; gap: 14px; }
.portal-band-inner .grow { min-width: 0; }
.portal-band h1 { font-size: 1.6rem; margin: 0; }
.portal-band p { margin: 2px 0 0; color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; }
.portal-av { display: grid; place-items: center; flex: none; width: 48px; height: 48px; border-radius: 50%; background: linear-gradient(135deg, #8A0FF0, #0B62F4); color: #fff; font-weight: 700; }
.portal-out { flex: none; align-self: flex-start; background: var(--surface); }
@container app (max-width: 600px) {
  .portal-band-inner { padding: 18px 16px; gap: 12px; }
  .portal-band h1 { font-size: 1.35rem; }
  .portal-av { width: 40px; height: 40px; font-size: .85rem; }
  .portal-band p { display: flex; flex-direction: column; }
  .portal-band p .portal-mail::before { content: none; }
  .portal-out span { display: none; }
  .portal-out { padding: 8px; }
}
.portal-mail { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.portal-mail::before { content: " · "; }
.portal-wrap > section > .section-title, .portal-wrap > section > h2.section-title { margin-bottom: 12px; }

/* Marca TurnoxApp */
.tx-logo { display: inline-flex; align-items: center; gap: 8px; }
.tx-mark { flex: none; display: block; }
.tx-word { font-family: var(--font-d); font-weight: 800; font-size: 1.12rem; letter-spacing: -.01em; line-height: 1; }
.tx-word b { font-weight: 800; color: #0B1228; }
.tx-word i { font-style: normal; background: linear-gradient(90deg, #7A10EC, #5B18D2); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tx-logo.on-dark .tx-word b { color: #fff; }
.tx-logo.on-dark .tx-word i { background: linear-gradient(90deg, #B57BFF, #8DA8FF); -webkit-background-clip: text; background-clip: text; }
.tx-logo.lg { gap: 12px; }
.tx-logo.lg .tx-word { font-size: 2.1rem; }
.tx-logo.sm .tx-word { font-size: .86rem; }
.tx-logo.sm { gap: 4px; }
.login-brand { flex-direction: column; align-items: flex-start; gap: 6px; }
.login-tagline { color: var(--muted); font-size: .92rem; }
.login { position: relative; overflow: hidden; }
.login-wrap { position: relative; z-index: 1; }
.tx-lines { position: absolute; pointer-events: none; color: #6A16E0; }
.login-deco { width: 620px; right: -120px; top: 40px; opacity: .14; }
.band-deco { width: 300px; right: -40px; top: -40px; opacity: .18; }
.portal-band-inner { position: relative; z-index: 1; }
.cv-foot { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
@container app (max-width: 700px) {
  .login-deco { width: 380px; right: -150px; top: 10px; }
  .tx-logo.lg .tx-word { font-size: 1.7rem; }
  .db-brand .tx-word { font-size: 1rem; }
}

/* Selectores: flecha propia con aire a la derecha (la del navegador queda pegada al borde) */
select:not([multiple]) {
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
  padding-right: 38px !important;
}
select.tsel { background-position: right 6px center; background-size: 13px; padding-right: 24px !important; }
/* Mismo aspecto para todos los selectores (los de hora del horario siguen compactos) */
select:not([multiple]):not(.tsel) {
  height: 39px; padding-top: 0; padding-bottom: 0; padding-left: 10px;
  border: 1px solid var(--line-strong); border-radius: 7px;
  background-color: var(--surface); color: var(--fg);
  font-family: inherit; font-size: 14px; line-height: normal;
}
select:not([multiple]):focus-visible { outline: 2px solid color-mix(in srgb, var(--brand, var(--accent)) 60%, transparent); outline-offset: 0; border-color: var(--brand, var(--accent)); }

/* Barra propia de TurnoxApp (inicio del cliente y plataforma) */
.tx-top { background: var(--surface); border-bottom: 1px solid var(--line); }
.tx-top-inner { max-width: 1240px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 10px; min-height: 54px; }
.tx-top-tag { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); padding: 3px 8px; border-radius: 99px; }
.tx-top-user { display: inline-flex; align-items: center; gap: 6px; font-size: .86rem; color: var(--muted); }
.platform { padding-top: 8px; }
/* Pie del menú del negocio: TurnoxApp discreto y ayuda */
.side-made { display: flex; align-items: center; gap: 6px; padding: 2px 4px; font-size: .74rem; color: var(--muted); font-family: var(--font-d); font-weight: 700; }
.side-made .link-btn { margin-left: auto; font-family: var(--font-b); font-weight: 600; font-size: .76rem; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand-text, var(--accent)); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
/* Vista de producción: se oculta todo lo propio de la demo */
body.prod-view #demobar, body.prod-view .login-demo, body.prod-view .demo-tag { display: none !important; }
body.prod-view .login-grid { grid-template-columns: minmax(0, 520px); justify-content: center; }
body.prod-view .login-brand { align-items: center; text-align: center; }
body.prod-view .login-wrap { max-width: 560px; }
#prod-pill { position: fixed; left: 50%; top: 0; transform: translateX(-50%); z-index: 200; }
.prod-pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px; border-radius: 0 0 10px 10px; border: 0; background: #101A26; color: #E8EEF5; font-size: .8rem; box-shadow: 0 6px 20px rgba(15, 23, 42, .25); }
.prod-pill b { color: #B57BFF; font-weight: 700; }
.db-prod { color: #D7C2FF; border-color: #4B3A7A; }
@container app (max-width: 600px) { .tx-top-user { display: none; } .tx-top .btn span { display: none; } }

body.no-drag, body.no-drag * { cursor: not-allowed !important; }

/* Pie del menú fijo abajo: "Ver página de reservas" y TurnoxApp siempre visibles */
.side-foot { margin-top: auto; flex: none; display: flex; flex-direction: column; gap: 10px; padding: 10px 0 2px; background: var(--surface); border-top: 1px solid var(--line); }
.side-foot .side-public { margin-top: 0; }
.side-made { padding: 0 4px; }
.side-made .tx-word { font-size: .84rem; }
/* El menú lateral no se desplaza completo: solo las secciones, y el pie queda fijo abajo */
.side { overflow: hidden; }
.side-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.drawer { display: flex; flex-direction: column; overflow: hidden; }
.drawer-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
/* Barra de la demo en celular real: una sola fila */
@media (max-width: 560px) {
  .db-inner { flex-wrap: nowrap !important; gap: 6px; }
  .db-brand .tx-word, .db-brand .db-tag { display: none; }
  .db-controls { flex: 1; min-width: 0; flex-wrap: nowrap !important; justify-content: flex-end; gap: 6px; }
  .db-session { flex: 1; min-width: 0; padding: 3px 8px; }
  .db-session small { display: none; }
  .db-session strong { max-width: none; }
}

/* ===== Agenda en celular ("Mi día") ===== */
.mag { display: flex; flex-direction: column; gap: 12px; }
.mag-seg { align-self: flex-start; }
.mag-seg button { display: inline-flex; align-items: center; gap: 6px; }
.mag-head { position: sticky; top: 0; z-index: 6; margin: 0 -16px; padding: 10px 16px 10px; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.mag-title { display: flex; align-items: center; gap: 8px; }
.mag-title .grow { display: flex; flex-direction: column; min-width: 0; }
.mag-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--brand-text, var(--brand)); }
.mag-title strong { font-family: var(--font-d); font-size: 1.2rem; line-height: 1.2; }
.mag-cal { position: relative; overflow: hidden; }
.mag-cal input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.mag-strip { display: flex; align-items: center; gap: 4px; }
.mag-days { flex: 1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.mag-day { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 0 4px; border-radius: 12px; border: 1px solid transparent; background: none; color: var(--fg); min-height: 56px; }
.mag-day span { font-size: .68rem; color: var(--muted); text-transform: capitalize; }
.mag-day b { font-size: 1.05rem; font-family: var(--font-d); }
.mag-day i { font-style: normal; font-size: .64rem; font-weight: 700; min-height: 14px; color: var(--brand-text, var(--brand)); }
.mag-day.is-today b { color: var(--brand-text, var(--brand)); }
.mag-day.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.mag-day.on span, .mag-day.on i, .mag-day.on b { color: #fff; }
.mag-people { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.mag-people::-webkit-scrollbar { display: none; }
.mag-chip { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 8px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--surface); font-size: .86rem; font-weight: 600; color: var(--fg); }
.mag-chip.on { border-color: var(--brand); background: var(--brand-softer, var(--surface-2)); color: var(--brand-text, var(--fg)); box-shadow: 0 0 0 1px var(--brand); }
.mag-branch { align-self: stretch; }
.mag-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: .86rem; color: var(--muted); }
.mag-sum b { color: var(--fg); }
.mag-sum .pend b { color: var(--warn); }
.mag-abs { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); color: var(--bad); background: none; border-radius: 99px; padding: 4px 10px; font-size: .8rem; font-weight: 600; }
.mag-bar { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid color-mix(in srgb, var(--info) 30%, transparent); background: var(--info-soft); color: var(--fg); font-size: .86rem; }
.mag-bar.warn { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.mag-list { display: flex; flex-direction: column; gap: 8px; }
.mag-card { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line-strong); border-radius: var(--r); overflow: hidden; }
.mag-card.st-pend { border-left-color: var(--warn); }
.mag-card.st-conf { border-left-color: var(--info); }
.mag-card.st-ok { border-left-color: var(--ok); }
.mag-card.st-bad { border-left-color: var(--bad); }
.mag-card.is-off { opacity: .55; }
.mag-card.emergency { border-left-color: var(--bad); }
.mag-main { display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left; padding: 12px 12px 10px; background: none; border: 0; color: var(--fg); }
.mag-time { display: flex; flex-direction: column; flex: none; width: 50px; }
.mag-time b { font-family: var(--font-d); font-size: 1.05rem; }
.mag-time small { color: var(--muted); font-size: .76rem; }
.mag-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mag-info strong { font-size: 1rem; }
.mag-info > span { color: var(--muted); font-size: .86rem; }
.mag-who { display: inline-flex; align-items: center; gap: 6px; color: var(--fg) !important; font-size: .8rem !important; }
.mag-flag { display: inline-flex; align-items: center; gap: 4px; color: var(--warn) !important; font-size: .76rem !important; font-weight: 600; }
.mag-acts { display: flex; gap: 8px; align-items: center; padding: 0 12px 12px 74px; flex-wrap: wrap; }
.mag-acts .btn { min-height: 38px; }
.mag-acts .icon-btn { width: 38px; height: 38px; display: inline-grid; place-items: center; }
.mag-free { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 12px; border-radius: var(--r); border: 1px dashed var(--line-strong); background: transparent; color: var(--muted); font-size: .88rem; }
.mag-free b { color: var(--fg); }
.mag-free-cta { margin-left: auto; font-weight: 700; color: var(--brand-text, var(--brand)); }
.mag-now { display: flex; align-items: center; gap: 8px; color: var(--bad); font-size: .76rem; font-weight: 700; }
.mag-now::before, .mag-now::after { content: ""; height: 2px; background: var(--bad); border-radius: 2px; }
.mag-now::before { width: 10px; }
.mag-now::after { flex: 1; }
.mag-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 36px 16px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r); }
.mag-empty strong { color: var(--fg); }

/* Barra de pestañas abajo */
.mtabs { position: fixed; z-index: 55; left: 0; right: 0; bottom: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px max(6px, env(safe-area-inset-bottom)); box-shadow: 0 -4px 16px rgba(15, 23, 42, .06); }
.mtab { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: 0; padding: 4px 2px; color: var(--muted); font-size: .7rem; font-weight: 600; }
.mtab.on { color: var(--brand-text, var(--brand)); }
.mtab.on .ic { stroke-width: 2.2; }
.mtab i { position: absolute; top: 0; left: calc(50% + 6px); min-width: 16px; height: 16px; border-radius: 99px; background: var(--brand); color: #fff; font-style: normal; font-size: .62rem; display: grid; place-items: center; padding: 0 4px; }
body.has-tabbar .fab { bottom: calc(76px + env(safe-area-inset-bottom)); }
body.has-tabbar .main { padding-bottom: 96px; }
body.has-tabbar #toast-root { bottom: 140px; }
body.prod-view.has-tabbar .mtabs { bottom: 0; }
/* La cabecera del día queda pegada debajo de la barra superior del negocio */
.mag-head { top: var(--mbar-h, 57px); }
/* En un teléfono real la pestaña de "Vista de producción" se hace pequeña, a la derecha */
@media (max-width: 700px) {
  #prod-pill { left: auto; right: 8px; top: 8px; transform: none; }
  .prod-pill { border-radius: 99px; padding: 6px 10px; }
  .prod-pill span { display: none; }
}
/* "← Inicio" a la izquierda, con el saludo junto a él */
.cv-who .cv-back { margin-left: -8px; margin-right: 4px; order: -1; }
.cv-who:has(.cv-back) { justify-content: flex-start; }
