/* Paleta: azul para la acción y lo seleccionado, verde manzana para lo positivo
   y la marca, grises claros de fondo y plomo para el texto. */
:root {
  --blue: #4338ca;
  --blue-dark: #3730a3;
  --blue-soft: #eef0ff;
  --green: #0f766e;
  --green-dark: #0b5f58;
  --green-soft: #ecf6f4;
  --ink: #1b2430;
  --slate: #4a5565;
  --muted: #6b7686;
  --line: #e4e8ee;
  --line-strong: #cfd6df;
  --bg: #f5f7ff;
  --surface: #fff;
  --red: #b42318;
  --red-soft: #fdeceb;
  --amber-soft: #fff6e0;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 15px/1.5 Inter, system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.65rem; font-weight: 600; letter-spacing: -.01em; margin: 0 0 1.25rem; }
h2 { font-size: 1.15rem; font-weight: 600; margin: 2rem 0 .75rem; }
h3 { font-size: 1rem; font-weight: 600; margin: 1.5rem 0 .6rem; }
small { color: var(--muted); }
pre { white-space: pre-wrap; font: inherit; margin: .5rem 0 0; }

/* Estructura: menú lateral fijo y contenido */
.app { display: grid; grid-template-columns: 16.5rem minmax(0, 1fr); min-height: 100vh; }
.app.guest { grid-template-columns: minmax(0, 1fr); }
.content { min-width: 0; }
main { max-width: 84rem; margin: 0 auto; padding: 2rem 2.25rem 3rem; }
.app.guest main { max-width: 26rem; margin-top: 8vh; padding: 2rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 1rem; padding: 1.1rem .85rem; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: .65rem; padding: .25rem .5rem; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand strong { font-size: 1.02rem; font-weight: 600; line-height: 1.2; }
.brand-mark { display: grid; place-items: center; flex: none; width: 2.1rem; height: 2.1rem; border-radius: 9px; background: var(--green); color: #fff; font-weight: 700; font-size: .85rem; }
.sidebar nav { display: grid; gap: 2px; align-content: start; flex: 1; }
.sidebar nav a { display: flex; align-items: center; gap: .7rem; padding: .5rem .65rem; border-radius: var(--radius-sm); color: var(--slate); font-weight: 500; }
.sidebar nav a:hover { background: var(--bg); text-decoration: none; }
.sidebar nav a.active { background: var(--blue-soft); color: var(--blue); }
.sidebar svg { width: 1.15rem; height: 1.15rem; flex: none; }
.nav-section { margin: 1.1rem 0 .3rem; padding: 0 .65rem; font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.account { display: flex; align-items: center; gap: .6rem; padding: .75rem .4rem 0; border-top: 1px solid var(--line); }
.avatar { display: grid; place-items: center; flex: none; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font-weight: 600; font-size: .8rem; }
.avatar:hover, .who:hover { text-decoration: none; }
.who { display: grid; min-width: 0; flex: 1; color: var(--ink); line-height: 1.25; }
.who strong { font-weight: 600; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { font-size: .76rem; }
.icon-button { display: grid; place-items: center; padding: .4rem; background: none; color: var(--muted); border-radius: var(--radius-sm); }
.icon-button:hover { background: var(--bg); color: var(--ink); }

/* Botones */
button, a.button { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 500; padding: .5rem .95rem; border: 1px solid transparent; border-radius: var(--radius-sm); background: var(--blue); color: #fff; cursor: pointer; white-space: nowrap; }
button:hover, a.button:hover { background: var(--blue-dark); text-decoration: none; }
button.outline, a.button.outline { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
button.outline:hover, a.button.outline:hover { background: var(--bg); }
button.link { background: none; color: var(--blue); padding: 0; border: 0; font-weight: 500; }
button.link:hover { background: none; text-decoration: underline; }
button.link.danger { color: var(--red); }
button.full { width: 100%; margin-top: .5rem; }

/* Formularios */
label { display: grid; gap: .3rem; font-size: .85rem; font-weight: 500; color: var(--slate); }
input, select, textarea { font: inherit; font-weight: 400; color: var(--ink); padding: .5rem .65rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue-soft); border-color: var(--blue); }
input:disabled, select:disabled, textarea:disabled { background: var(--bg); color: var(--muted); }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select { height: 2.5rem; }
td input:not([type="checkbox"]):not([type="radio"]), td select, .week input, .week select { height: 2.1rem; }
input[type="checkbox"], input[type="radio"] { width: 1rem; height: 1rem; padding: 0; accent-color: var(--blue); flex-shrink: 0; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; margin: 0; background: var(--surface); box-shadow: var(--shadow); }
fieldset.plain { border: 0; padding: 0; background: none; box-shadow: none; }
legend { padding: 0 .5rem; font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--blue-dark); }
.stack { display: grid; gap: .8rem; max-width: 25rem; }
.stack.roomy { max-width: 48rem; }
.sections { display: grid; gap: 1.1rem; max-width: 48rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: .8rem 1.1rem; }
.grid .wide, .fields .wide { grid-column: 1 / -1; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1.25rem; }
.fields .subhead { margin: .75rem 0 0; padding-top: .85rem; border-top: 1px solid var(--line); font-weight: 600; color: var(--ink); }
.fields .subhead span { font-weight: 400; color: var(--muted); }
.inline { display: flex; gap: .55rem; align-items: center; }
.inline.wrap { flex-wrap: wrap; align-items: end; }
.checks { display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; }
.checks label, .permissions label, label.inline { display: flex; align-items: center; gap: .45rem; font-weight: 400; color: var(--ink); }
.permissions { display: grid; gap: .55rem; }
.permissions label { font-size: .95rem; }
form[data-permissions] { display: grid; gap: 1rem; }
.results { display: grid; gap: .3rem; color: var(--muted); font-size: .88rem; }
.results button { justify-content: flex-start; background: var(--surface); color: var(--ink); border-color: var(--line-strong); font-weight: 400; white-space: normal; text-align: left; }
.results button:hover { background: var(--blue-soft); }

/* Tablas: una tarjeta blanca con encabezado gris */
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
th, td { text-align: left; padding: .7rem .9rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
thead th { background: #f3f5f8; color: var(--muted); font-size: .72rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
tbody tr:last-child > * { border-bottom: 0; }
tbody tr:hover > td { background: #fbfcfd; }
tbody th { width: 14rem; color: var(--muted); font-weight: 500; }
td input, td select { padding: .35rem .5rem; }
.picked { background: var(--blue-soft) !important; }
.summary { margin: 1rem 0; max-width: 34rem; }
.summary th { width: auto; }
.summary td { text-align: right; }
.summary tr.debt th, .summary tr.debt td, .debt-text { color: var(--red); font-weight: 600; }

/* Estados de las citas y filas anuladas */
tr[class^="status-"] td:first-child { border-left: 4px solid #b6c2cf; }
tr.status-confirmed td:first-child { border-left-color: var(--green); }
tr.status-attended td:first-child { border-left-color: var(--blue); }
tr.status-no_show td:first-child { border-left-color: #e5484d; }
tr.status-cancelled td { color: #98a2b0; text-decoration: line-through; }
tr.status-cancelled td:first-child { border-left-color: #d5dbe3; }
tr.status-cancelled td:last-child { text-decoration: none; }
.agenda aside tr[class] td:first-child { border-left: 0; }

/* Avisos y etiquetas */
.badge { display: inline-block; padding: .18rem .65rem; border-radius: 999px; background: var(--blue-soft); color: var(--blue-dark); font-size: .8rem; font-weight: 500; }
.badge.off { background: var(--red-soft); color: var(--red); }
.error { padding: .7rem 1rem; background: var(--red-soft); color: var(--red); border-radius: var(--radius-sm); }
.notice { padding: .75rem 1rem; background: var(--green-soft); color: var(--green-dark); border: 1px solid #c4e3de; border-radius: var(--radius-sm); overflow-wrap: anywhere; }
.alert { padding: .75rem 1rem; background: var(--amber-soft); border: 1px solid #f0d58a; border-radius: var(--radius-sm); }
.hint { color: var(--muted); font-size: .88rem; }
small.valid { color: var(--green-dark); font-weight: 500; }
small.invalid { color: var(--red); }

/* Barras de herramientas, pestañas y tarjetas */
.toolbar { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 1rem 0; }
.toolbar h2, .toolbar h3 { margin: 0; }
.tabs { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: 0 0 1rem; }
.tabs a, .tabs span { padding: .35rem .85rem; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--slate); font-size: .88rem; font-weight: 500; }
.tabs span { border-color: transparent; background: none; }
.tabs a:hover { background: var(--bg); text-decoration: none; }
.tabs a.current { background: var(--blue-soft); border-color: var(--blue-soft); color: var(--blue); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; }
.card { display: block; padding: 1.2rem 1.3rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: inherit; }
.card:hover { border-color: var(--blue); text-decoration: none; }
.card strong { display: block; font-size: 1.05rem; font-weight: 600; color: var(--ink); }
.card span { color: var(--muted); font-size: .85rem; }
.card p { margin: .5rem 0 0; color: var(--slate); font-size: .9rem; }
dl { margin: 1rem 0; }
dt { color: var(--muted); font-size: .78rem; font-weight: 500; }
dd { margin: 0 0 .6rem; }
details > summary { cursor: pointer; color: var(--blue); font-weight: 500; }

/* Agenda y presupuesto: panel lateral y contenido */
.agenda { display: grid; grid-template-columns: 17rem minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.agenda aside { padding: 1.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.agenda aside table { border: 0; box-shadow: none; border-radius: 0; }
.agenda aside th, .agenda aside td { padding: .4rem 0; }
.agenda .toolbar { margin-top: 0; }
.day { display: flex; align-items: center; justify-content: space-between; gap: .5rem; text-align: center; font-weight: 600; margin-bottom: 1rem; }
.day a { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; font-size: 1.4rem; line-height: 1; }
.day a:hover { background: var(--bg); text-decoration: none; }
.day span::first-letter { text-transform: uppercase; }

/* Ficha del usuario: pestañas a la izquierda */
.ficha { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: 1.75rem; align-items: start; }
.ficha section > h2:first-child, .ficha section > .error + h2 { margin-top: 0; }
.side { display: grid; gap: 2px; padding: .5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.side a { padding: .5rem .7rem; border-radius: var(--radius-sm); color: var(--slate); font-weight: 500; }
.side a:hover { background: var(--bg); text-decoration: none; }
.side a.current { background: var(--blue-soft); color: var(--blue); }

/* Horario semanal */
.week { overflow-x: auto; }
.week table { min-width: 46rem; }
.week th, .week td { text-align: center; padding: .45rem .4rem; }
.week th:first-child, .week td:first-child { text-align: left; white-space: nowrap; color: var(--muted); font-weight: 500; }
.week input[type="time"], .week select { width: 100%; min-width: 5.5rem; padding: .3rem; }

/* Pantallas angostas: el menú pasa arriba */
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar nav { display: flex; flex-wrap: wrap; flex: 1 1 100%; order: 3; }
  .nav-section { display: none; }
  .account { border-top: 0; padding: 0; margin-left: auto; }
  .who { display: none; }
  main { padding: 1.25rem 1rem 2rem; }
  .agenda, .ficha { grid-template-columns: minmax(0, 1fr); }
  table { display: block; overflow-x: auto; }
}
@media (max-width: 640px) { .fields { grid-template-columns: minmax(0, 1fr); } }

/* Impresión: solo el contenido */
.print-only { display: none; }
@media print {
  .no-print, a.button { display: none !important; }
  .print-only { display: block; }
  .app { display: block; }
  body { background: #fff; }
  main { max-width: none; padding: 0; }
  a { color: inherit; }
  table { font-size: 11pt; box-shadow: none; }
  .signature { margin-top: 3rem; }
}

/* Cabecera de ficha: banda azul con los datos principales y tarjetas de aviso */
.hero { display: flex; flex-wrap: wrap; gap: 1.25rem 2rem; align-items: center; justify-content: space-between; padding: 1.35rem 1.6rem; margin-bottom: 1.1rem; border-radius: 16px; color: #fff; background: var(--brand-gradient); box-shadow: 0 8px 22px rgba(79, 70, 229, .22); }
.hero-main { display: flex; align-items: center; gap: 1.1rem; min-width: 0; }
.hero-avatar { display: grid; place-items: center; flex: none; width: 4.2rem; height: 4.2rem; border-radius: 50%; background: rgba(255, 255, 255, .16); border: 2px solid rgba(255, 255, 255, .45); font-size: 1.35rem; font-weight: 700; }
.hero h1 { margin: .05rem 0 .2rem; font-size: 1.55rem; color: #fff; }
.hero small { color: rgba(255, 255, 255, .78); font-weight: 600; letter-spacing: .03em; }
.hero p { margin: 0; color: rgba(255, 255, 255, .92); }
.pill { display: inline-block; margin-left: .5rem; padding: .12rem .65rem; border-radius: 999px; background: var(--green); color: #fff; font-size: .78rem; font-weight: 600; }
.hero-cards { display: grid; grid-template-columns: repeat(3, minmax(9.5rem, 13rem)); gap: .7rem; }
.hero-card { padding: .65rem .85rem; border-radius: 10px; background: rgba(255, 255, 255, .13); border: 1px solid rgba(255, 255, 255, .28); min-height: 4.4rem; }
.hero-card small { display: block; font-size: .68rem; letter-spacing: .07em; text-transform: uppercase; }
.hero-card p { font-size: .88rem; line-height: 1.35; overflow-wrap: anywhere; }
.hero-card:not(.warn) p { font-style: italic; color: rgba(255, 255, 255, .8); }
.hero-card.warn { background: #fff6e0; border-color: #f0d58a; }
.hero-card.warn small { color: #8a5a00; }
.hero-card.warn p { color: #3d2c00; font-weight: 500; }

/* Pestañas de una ficha: texto con subrayado azul en la activa */
.subtabs { display: flex; flex-wrap: wrap; gap: .25rem 1.6rem; margin: 0 0 1.1rem; border-bottom: 1px solid var(--line-strong); }
.subtabs a { padding: .6rem .15rem; margin-bottom: -1px; color: var(--slate); font-weight: 500; border-bottom: 2px solid transparent; }
.subtabs a:hover { color: var(--ink); text-decoration: none; }
.subtabs a.current { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }
.count { display: inline-block; min-width: 1.4rem; padding: 0 .4rem; margin-left: .25rem; border-radius: 999px; background: var(--line); color: var(--slate); font-size: .75rem; text-align: center; }
.subtabs a.current .count { background: var(--blue-soft); color: var(--blue); }

/* Panel: tarjeta blanca con título y acción principal arriba */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 1.4rem 1.5rem 1.5rem; margin-bottom: 1.25rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .25rem; }
.panel-head h2 { margin: 0; font-size: 1.2rem; }
.panel table { box-shadow: none; }
.section-label { display: flex; align-items: center; gap: .9rem; margin: 1.4rem 0 .8rem; font-size: .72rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--slate); }
.section-label::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.section-label span { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); }
.panel .fields, fieldset .fields { grid-template-columns: repeat(auto-fill, minmax(17.5rem, 1fr)); }
.req { color: #d92d20; }

/* Botón de guardar: verde manzana */
button.success, a.button.success { background: var(--green); color: #fff; font-weight: 600; }
button.success:hover, a.button.success:hover { background: #0c625c; }

/* Etiquetas de estado con color */
.chip { display: inline-block; padding: .14rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #eef1f5; color: var(--slate); }
.chip.accepted, .chip.confirmed, .chip.attended { background: var(--green-soft); color: var(--green-dark); }
.chip.presented, .chip.scheduled { background: var(--blue-soft); color: var(--blue-dark); }
.chip.rejected, .chip.no_show, .chip.cancelled { background: var(--red-soft); color: var(--red); }

@media (max-width: 1100px) { .hero-cards { grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); flex: 1 1 100%; } }

/* Título de cada página: banda azul */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1.05rem 1.5rem; margin-bottom: 1.25rem; border-radius: 14px; color: #fff; background: var(--brand-gradient); box-shadow: 0 6px 18px rgba(79, 70, 229, .2); }
.page-head h1 { margin: 0; font-size: 1.4rem; color: #fff; }
.page-head span { padding: .2rem .8rem; border-radius: 999px; background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .3); font-size: .82rem; font-weight: 500; }
.app.guest .page-head { margin: -2rem -2rem 1.5rem; border-radius: var(--radius) var(--radius) 0 0; box-shadow: none; }

/* Tarjetas de resumen con color */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .8rem; margin-bottom: 1rem; align-items: stretch; }
.stat { padding: .8rem 1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--line-strong); box-shadow: var(--shadow); }
.stat small { display: block; font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.stat strong { display: block; font-size: 1.7rem; font-weight: 700; line-height: 1.2; }
.stat.blue { border-left-color: var(--blue); background: linear-gradient(90deg, var(--blue-soft), var(--surface) 70%); }
.stat.blue strong { color: var(--blue-dark); }
.stat.green { border-left-color: var(--green); background: linear-gradient(90deg, var(--green-soft), var(--surface) 70%); }
.stat.green strong { color: var(--green-dark); }
.stat.teal { border-left-color: #12a594; background: linear-gradient(90deg, #e3f6f3, var(--surface) 70%); }
.stat.teal strong { color: #0b6b60; }
.stat.red { border-left-color: #e5484d; background: linear-gradient(90deg, var(--red-soft), var(--surface) 70%); }
.stat.red strong { color: var(--red); }
a.button.big { font-size: 1rem; padding: .8rem 1.2rem; border-radius: var(--radius); }

/* Cabeceras: cifras, etiquetas de estado y botones sobre el azul */
.hero-card .figure { font-size: 1.25rem; font-weight: 700; font-style: normal !important; color: #fff !important; }
.hero-card.warn .figure { color: #8a2c0d !important; }
.hero-cards.two { grid-template-columns: repeat(2, minmax(9.5rem, 13rem)); }
.pill.presented, .pill.draft, .pill.scheduled { background: #dbe9fb; color: #0a3f85; }
.pill.rejected, .pill.cancelled { background: #fde2e0; color: #8f1d14; }
button.ghost { background: rgba(255, 255, 255, .14); color: #fff; border-color: rgba(255, 255, 255, .45); }
button.ghost:hover { background: rgba(255, 255, 255, .26); }

/* Estado de una cita en la lista: el desplegable toma el color del estado */
.chip-select { height: 2rem !important; padding: 0 .6rem; border-radius: 999px; font-size: .82rem; font-weight: 600; border-color: transparent; background: #eef1f5; color: var(--slate); }
.chip-select.confirmed, .chip-select.attended { background: var(--green-soft); color: var(--green-dark); }
.chip-select.scheduled { background: var(--blue-soft); color: var(--blue-dark); }
.chip-select.no_show, .chip-select.cancelled { background: var(--red-soft); color: var(--red); }

/* Las acciones de guardar y crear van en verde manzana; navegar, en azul */
form:not(.inline) > button:not(.outline):not(.link):not(.ghost):not(.icon-button),
form > div > button:not(.outline):not(.link):not(.ghost),
fieldset > button:not(.outline):not(.link) { background: var(--green); color: #fff; font-weight: 600; }
form:not(.inline) > button:not(.outline):not(.link):not(.ghost):not(.icon-button):hover,
form > div > button:not(.outline):not(.link):not(.ghost):hover,
fieldset > button:not(.outline):not(.link):hover { background: #0c625c; }

/* Menú: una línea verde marca la entrada activa */
.sidebar nav a.active { box-shadow: inset 3px 0 0 var(--green); }
.agenda aside { border-top: 4px solid var(--blue); }
@media print { .page-head, .hero { background: none !important; color: #000; box-shadow: none; padding: 0; } .page-head h1, .hero h1, .hero p, .hero small, .hero-card .figure { color: #000 !important; } .page-head span { display: none; } }

/* Selector de sucursal del menú */
.branch-switch { padding: .65rem .7rem; border-radius: var(--radius-sm); background: var(--bg); border: 1px solid var(--line); }
.branch-switch label { font-size: .68rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.branch-switch select { width: 100%; height: 2.2rem !important; font-size: .92rem; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--blue-dark); border-color: var(--line-strong); }
.branch-switch strong { font-size: .95rem; text-transform: none; letter-spacing: 0; color: var(--ink); }
.where { margin: 0 0 .8rem; padding: .45rem .7rem; border-radius: var(--radius-sm); background: var(--green-soft); color: var(--green-dark); font-size: .88rem; }

/* Menú lateral azul. La entrada activa toma el color del contenido y "entra"
   en él: se une al borde derecho, con las esquinas de arriba y abajo curvadas. */
.sidebar { --curve: 18px; padding: 1.1rem 0 1rem .85rem; gap: .9rem; color: #fff; border-right: 0; background: var(--sidebar-gradient); }
.sidebar > * { margin-right: .85rem; }
.sidebar > nav { margin-right: 0; gap: 3px; padding: var(--curve) 0; overflow-x: hidden; }
.brand, .brand strong { color: #fff; }
.sidebar nav a { margin-right: .85rem; color: rgba(255, 255, 255, .86); border-radius: 999px; padding: .55rem .9rem; }
.sidebar nav a:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.nav-section { color: rgba(255, 255, 255, .58); margin-right: .85rem; }
.sidebar nav a.active { position: relative; margin-right: 0; border-radius: 999px 0 0 999px; background: var(--bg); color: var(--blue-dark); font-weight: 600; box-shadow: none; }
.sidebar nav a.active svg { color: var(--blue); }
.sidebar nav a.active::before, .sidebar nav a.active::after { content: ''; position: absolute; right: 0; width: var(--curve); height: var(--curve); pointer-events: none; }
.sidebar nav a.active::before { top: calc(-1 * var(--curve)); background: radial-gradient(circle at 0 0, transparent calc(var(--curve) - .5px), var(--bg) var(--curve)); }
.sidebar nav a.active::after { bottom: calc(-1 * var(--curve)); background: radial-gradient(circle at 0 100%, transparent calc(var(--curve) - .5px), var(--bg) var(--curve)); }

.branch-switch { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .22); }
.branch-switch label { color: rgba(255, 255, 255, .72); }
.branch-switch select { background: #fff; border-color: transparent; }
.branch-switch strong { color: #fff; }
.account { border-top-color: rgba(255, 255, 255, .22); }
.who, .who strong { color: #fff; }
.who small { color: rgba(255, 255, 255, .7); }
.avatar { background: var(--green); color: #fff; }
.icon-button { color: rgba(255, 255, 255, .8); }
.icon-button:hover { background: rgba(255, 255, 255, .15); color: #fff; }
.sidebar::-webkit-scrollbar { width: 0; }

/* Con el menú ya en azul, el título de la página va sobre el fondo claro. */
.page-head { padding: 0 .25rem; margin-bottom: 1.1rem; color: var(--ink); background: none; box-shadow: none; border-radius: 0; }
.page-head h1 { color: var(--ink); font-size: 1.6rem; }
.page-head span { background: var(--surface); border-color: var(--line); color: var(--slate); box-shadow: var(--shadow); }
.app.guest .page-head { margin: 0 0 1.25rem; padding: 0; }

@media (max-width: 900px) {
  .sidebar { padding: .85rem; }
  .sidebar > *, .sidebar nav a, .nav-section { margin-right: 0; }
  .sidebar > nav { padding: 0; }
  .sidebar nav a.active { border-radius: 999px; }
  .sidebar nav a.active::before, .sidebar nav a.active::after { display: none; }
}
@media print { .page-head { padding: 0; } }

/* Nombre de la clínica en el menú, con su etiqueta, para distinguirlo de la sucursal */
.brand-name { display: grid; line-height: 1.2; min-width: 0; }
.brand-name small { font-size: .66rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: rgba(255, 255, 255, .65); }

/* Logo de la clínica en el menú */
.brand-logo { flex: none; width: 2.6rem; height: 2.6rem; border-radius: 10px; object-fit: contain; background: #fff; padding: 3px; }
.logo-preview { display: flex; align-items: center; gap: 1rem; padding: .9rem 1rem; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--bg); }
.logo-preview img { width: 5rem; height: 5rem; object-fit: contain; background: #fff; border-radius: 12px; padding: 4px; border: 1px solid var(--line); }
.panel-foot { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 1.4rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }
.panel-foot .hint { margin: 0; }

/* Horario semanal: la fila que dice qué días atiende va destacada */
.week tr.attends td { background: var(--green-soft); font-weight: 600; }
.week tr.attends td:first-child { color: var(--green-dark); }
.week select:disabled { background: var(--bg); color: #a5afbc; }
.week td label { display: inline-flex; align-items: center; gap: .35rem; font-weight: inherit; color: inherit; }
table.choice { box-shadow: none; max-width: 36rem; }
table.choice td:not(:first-child), table.choice th:not(:first-child) { text-align: center; }
table.choice { max-width: 46rem; }
table.choice select { min-width: 10rem; }

/* ---------------------------------------------------------------------------
   Botones con cuerpo: degradado, borde y sombra, para que se vean "tocables".
   - Azul: acción principal y navegación.   - Verde manzana: guardar y crear.
   - Claro: acciones secundarias.           - Rojo suave: quitar, terminar, eliminar.
   --------------------------------------------------------------------------- */
button, a.button {
  border: 1px solid #0a55ad;
  border-radius: 10px;
  background: linear-gradient(180deg, #6366f1 0%, var(--brand) 55%, var(--brand-strong) 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .28) inset, 0 2px 5px rgba(79, 70, 229, .32);
  text-shadow: 0 1px 0 rgba(0, 0, 0, .12);
  transition: transform .08s ease, box-shadow .12s ease, filter .12s ease;
}
button:hover, a.button:hover { background: linear-gradient(180deg, #6366f1 0%, var(--brand) 55%, var(--brand-strong) 100%); filter: brightness(1.06); box-shadow: 0 1px 0 rgba(255, 255, 255, .28) inset, 0 4px 10px rgba(79, 70, 229, .36); transform: translateY(-1px); }
button:active, a.button:active { transform: translateY(0); filter: brightness(.96); box-shadow: 0 1px 2px rgba(79, 70, 229, .3) inset; }

/* Guardar y crear: verde manzana */
button.success, a.button.success,
form:not(.inline) > button:not(.outline):not(.link):not(.ghost):not(.icon-button),
form > div > button:not(.outline):not(.link):not(.ghost),
fieldset > button:not(.outline):not(.link) {
  border-color: #0a524d;
  background: linear-gradient(180deg, #17897f 0%, #0f766e 55%, #0c625c 100%);
  color: #fff;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .35);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .45) inset, 0 2px 5px rgba(15, 118, 110, .35);
}
button.success:hover, a.button.success:hover,
form:not(.inline) > button:not(.outline):not(.link):not(.ghost):not(.icon-button):hover,
form > div > button:not(.outline):not(.link):not(.ghost):hover,
fieldset > button:not(.outline):not(.link):hover {
  background: linear-gradient(180deg, #17897f 0%, #0f766e 55%, #0c625c 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .45) inset, 0 4px 10px rgba(15, 118, 110, .4);
}

/* Secundarios: claros, con borde */
button.outline, a.button.outline {
  border-color: var(--line-strong);
  background: linear-gradient(180deg, #fff 0%, #f1f4f8 100%);
  color: var(--ink);
  text-shadow: none;
  box-shadow: 0 1px 0 #fff inset, 0 1px 3px rgba(16, 24, 40, .12);
}
button.outline:hover, a.button.outline:hover { background: linear-gradient(180deg, #fff 0%, #e9eef4 100%); box-shadow: 0 1px 0 #fff inset, 0 3px 8px rgba(16, 24, 40, .16); }

/* Acciones de una fila (Editar, Corregir, Cambiar condiciones, Desactivar…):
   botones pequeños en azul claro, en vez de texto suelto. */
button.link, td .inline > a, td:last-child > a, .panel-head > a:not(.button) {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .3rem .75rem;
  border: 1px solid #c3c8f3;
  border-radius: 999px;
  background: linear-gradient(180deg, #f6f7ff 0%, #e4e7fd 100%);
  color: var(--blue-dark);
  font-size: .82rem; font-weight: 600; line-height: 1.3; white-space: nowrap;
  text-decoration: none; text-shadow: none;
  box-shadow: 0 1px 0 #fff inset, 0 1px 2px rgba(79, 70, 229, .16);
  transition: transform .08s ease, box-shadow .12s ease;
}
button.link:hover, td .inline > a:hover, td:last-child > a:hover, .panel-head > a:not(.button):hover {
  background: linear-gradient(180deg, #eef0ff 0%, #d9dcfb 100%);
  text-decoration: none; filter: none;
  box-shadow: 0 1px 0 #fff inset, 0 3px 7px rgba(79, 70, 229, .22);
  transform: translateY(-1px);
}
button.link:active, td .inline > a:active, td:last-child > a:active { transform: translateY(0); box-shadow: 0 1px 2px rgba(79, 70, 229, .25) inset; }

/* Quitar, terminar, eliminar: rojo suave */
button.link.danger {
  border-color: #f3c0bb;
  background: linear-gradient(180deg, #fff7f6 0%, #fde3e0 100%);
  color: var(--red);
  box-shadow: 0 1px 0 #fff inset, 0 1px 2px rgba(180, 35, 24, .16);
}
button.link.danger:hover { background: linear-gradient(180deg, #fff1ef 0%, #fbd2cd 100%); box-shadow: 0 1px 0 #fff inset, 0 3px 7px rgba(180, 35, 24, .22); }

/* Excepciones que no deben parecer botones de acción */
.icon-button, .icon-button:hover { border: 0; background: none; box-shadow: none; transform: none; filter: none; text-shadow: none; }
.icon-button:hover { background: rgba(255, 255, 255, .15); }
button.ghost { border-color: rgba(255, 255, 255, .5); background: linear-gradient(180deg, rgba(255, 255, 255, .26), rgba(255, 255, 255, .1)); color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 2px 6px rgba(0, 0, 0, .14); text-shadow: none; }
button.ghost:hover { background: linear-gradient(180deg, rgba(255, 255, 255, .36), rgba(255, 255, 255, .18)); }
.results button, .results button:hover { border-color: var(--line-strong); background: var(--surface); color: var(--ink); box-shadow: none; transform: none; text-shadow: none; font-weight: 400; }
.results button:hover { background: var(--blue-soft); }
td .inline { flex-wrap: wrap; gap: .4rem; }
@media print { button, a.button { display: none !important; } }

/* ---------------------------------------------------------------------------
   Ajustes de la segunda vuelta de diseño
   --------------------------------------------------------------------------- */
:root { --amber: #b7791f; }

/* Botones planos: el degradado queda para las superficies grandes (menú, encabezados). */
button, a.button { background: var(--blue); border-color: var(--blue); box-shadow: 0 1px 2px rgba(16, 24, 40, .1); text-shadow: none; transition: background .12s ease, box-shadow .12s ease; }
button:hover, a.button:hover { background: var(--blue-dark); border-color: var(--blue-dark); filter: none; transform: none; box-shadow: 0 2px 6px rgba(79, 70, 229, .25); }
button:active, a.button:active { box-shadow: none; filter: none; }
button:focus-visible, a.button:focus-visible, .segmented a:focus-visible { outline: 3px solid rgba(79, 70, 229, .35); outline-offset: 2px; }
button.success, a.button.success,
form:not(.inline) > button:not(.outline):not(.link):not(.ghost):not(.icon-button):not(.danger),
form > div > button:not(.outline):not(.link):not(.ghost):not(.danger),
fieldset > button:not(.outline):not(.link) { background: var(--green); border-color: #0c625c; color: #fff; text-shadow: none; box-shadow: 0 1px 2px rgba(16, 24, 40, .1); }
button.success:hover, a.button.success:hover,
form:not(.inline) > button:not(.outline):not(.link):not(.ghost):not(.icon-button):not(.danger):hover,
form > div > button:not(.outline):not(.link):not(.ghost):not(.danger):hover,
fieldset > button:not(.outline):not(.link):hover { background: #0c625c; border-color: #0a524d; box-shadow: 0 2px 6px rgba(15, 118, 110, .3); }
button.outline, a.button.outline { background: var(--surface); border-color: var(--line-strong); color: var(--ink); box-shadow: 0 1px 2px rgba(16, 24, 40, .06); }
button.outline:hover, a.button.outline:hover { background: #f4f6f9; border-color: #b9c2ce; box-shadow: 0 1px 2px rgba(16, 24, 40, .1); }
button.danger { background: var(--red); border-color: var(--red); color: #fff; }
button.danger:hover { background: #912018; border-color: #912018; box-shadow: 0 2px 6px rgba(180, 35, 24, .28); }
button.link, td .inline > a, td:last-child > a, .panel-head > a:not(.button) { background: var(--blue-soft); border-color: var(--brand-line); box-shadow: none; transition: background .12s ease; }
button.link:hover, td .inline > a:hover, td:last-child > a:hover, .panel-head > a:not(.button):hover { background: var(--brand-line); box-shadow: none; transform: none; }
button.link.danger { background: var(--red-soft); border-color: #f6cdc9; color: var(--red); box-shadow: none; }
button.link.danger:hover { background: #fbd9d5; box-shadow: none; }
.icon-button, .icon-button:hover { border: 0; background: none; box-shadow: none; }
.icon-button:hover { background: rgba(255, 255, 255, .15); }
button.ghost { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .45); color: #fff; box-shadow: none; }
button.ghost:hover { background: rgba(255, 255, 255, .28); border-color: rgba(255, 255, 255, .6); }
.results button, .results button:hover { border-color: var(--line-strong); background: var(--surface); color: var(--ink); box-shadow: none; }
.results button:hover { background: var(--blue-soft); }
svg.icon { width: 1.05em; height: 1.05em; flex: none; }

/* Tablas con más aire */
th, td { padding: .85rem 1.05rem; }
thead th { padding-top: .7rem; padding-bottom: .7rem; }
tbody tr:hover > td { background: #f7f8ff; }
tr.late td:first-child { color: var(--amber); }

/* Estados vacíos */
.empty { display: grid; justify-items: center; gap: .35rem; padding: 2.75rem 1.5rem; text-align: center; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.panel .empty { border: 0; padding: 2rem 1rem; }
.empty-icon { display: grid; place-items: center; width: 3.4rem; height: 3.4rem; margin-bottom: .4rem; border-radius: 50%; background: var(--blue-soft); color: var(--blue); }
.empty-icon svg { width: 1.6rem; height: 1.6rem; }
.empty strong { font-size: 1.05rem; }
.empty p { margin: 0 0 .6rem; max-width: 26rem; color: var(--muted); }
td.hint[colspan] { padding: 1.75rem 1rem; text-align: center; }

/* Avisos flotantes */
.notice.toast { position: fixed; top: 1.25rem; right: 1.25rem; z-index: 60; max-width: 24rem; margin: 0; padding: .8rem 1.1rem .8rem 2.6rem; background: #1b2430; color: #fff; border: 0; border-radius: 12px; box-shadow: 0 12px 32px rgba(16, 24, 40, .28); animation: toast-in .25s ease; transition: opacity .5s ease, transform .5s ease; }
.notice.toast::before { content: "✓"; position: absolute; left: .9rem; top: 50%; translate: 0 -50%; display: grid; place-items: center; width: 1.25rem; height: 1.25rem; border-radius: 50%; background: var(--green); color: #fff; font-size: .8rem; font-weight: 700; }
.notice.toast.gone { opacity: 0; transform: translateY(-.5rem); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-.75rem); } }
@media (prefers-reduced-motion: reduce) { .notice.toast { animation: none; transition: none; } }

/* Confirmación */
dialog.confirm { width: min(26rem, calc(100vw - 2rem)); padding: 1.5rem; border: 0; border-radius: 16px; color: var(--ink); box-shadow: 0 24px 60px rgba(16, 24, 40, .35); }
dialog.confirm::backdrop { background: rgba(16, 24, 40, .45); }
dialog.confirm p { margin: 0 0 1.25rem; font-size: 1.02rem; line-height: 1.5; }
dialog.confirm div { display: flex; justify-content: flex-end; gap: .6rem; }

/* Inicio */
.welcome { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 2rem; padding: 1.4rem 1.6rem; margin-bottom: 1.1rem; border-radius: 16px; color: #fff; background: var(--brand-gradient); box-shadow: 0 8px 22px rgba(79, 70, 229, .22); }
.welcome h1 { margin: 0 0 .2rem; color: #fff; font-size: 1.6rem; }
.welcome p { margin: 0; color: rgba(255, 255, 255, .85); }
.welcome a.button.outline { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .45); color: #fff; box-shadow: none; }
.welcome a.button.outline:hover { background: rgba(255, 255, 255, .26); }
.cap { display: inline-block; }
.cap::first-letter { text-transform: uppercase; }
.inline.wrap { flex-wrap: wrap; }
a.stat { color: inherit; transition: box-shadow .12s ease, transform .12s ease; }
a.stat:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 6px 16px rgba(16, 24, 40, .1); }
.stat span { display: block; margin-top: .15rem; font-size: .8rem; color: var(--muted); }
.stat.amber { border-left-color: #e0a100; background: linear-gradient(90deg, var(--amber-soft), var(--surface) 70%); }
.stat.amber strong { color: var(--amber); }
.welcome + .stats { grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }

/* Agenda: barra superior y calendario por sillón */
.agenda-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem .8rem; padding: .7rem .9rem; margin-bottom: .8rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.agenda-bar .day { margin: 0; gap: .25rem; min-width: 17rem; }
.agenda-bar .inline { margin: 0; }
.agenda-bar input, .agenda-bar select { height: 2.3rem; }
.grow { flex: 1; }
.where { margin: 0 .25rem .8rem; color: var(--slate); }
.segmented { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.segmented a { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .8rem; border-radius: 7px; color: var(--slate); font-size: .88rem; font-weight: 500; }
.segmented a:hover { text-decoration: none; color: var(--ink); }
.segmented a.current { background: var(--surface); color: var(--blue-dark); box-shadow: 0 1px 2px rgba(16, 24, 40, .14); }

.cal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
.cal-head, .cal-body { display: grid; grid-template-columns: 3.6rem repeat(var(--cols), minmax(9.5rem, 1fr)); min-width: calc(3.6rem + var(--cols) * 9.5rem); }
.cal-head { position: sticky; top: 0; z-index: 5; background: #f3f5f8; border-bottom: 1px solid var(--line); }
.cal-head strong { padding: .65rem .75rem; border-left: 1px solid var(--line); font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; color: var(--slate); text-align: center; }
.cal-body { position: relative; }
.cal-hours, .cal-col { position: relative; }
.cal-hours span { position: absolute; right: .5rem; translate: 0 -.6em; font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-hours span:first-child { translate: 0 .15em; }
.cal-col { border-left: 1px solid var(--line); }
.cal-slot { position: absolute; left: 0; right: 0; border-top: 1px dashed #eef1f5; }
.cal-slot.hour { border-top: 1px solid var(--line); }
a.cal-slot:hover { background: var(--green-soft); text-decoration: none; }
a.cal-slot:hover::after { content: "＋ Dar cita"; position: absolute; inset: 0; display: grid; place-items: center; font-size: .78rem; font-weight: 600; color: var(--green-dark); }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: #e5484d; z-index: 3; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: #e5484d; }
.cal-appt { position: absolute; left: 3px; right: 3px; z-index: 2; border-radius: 8px; border-left: 4px solid var(--blue); background: var(--blue-soft); color: var(--blue-dark); box-shadow: 0 1px 2px rgba(16, 24, 40, .1); }
.cal-appt summary { display: block; height: 100%; padding: .25rem .5rem; overflow: hidden; cursor: pointer; list-style: none; font-size: .8rem; line-height: 1.3; border-radius: 0 8px 8px 0; }
.cal-appt summary::-webkit-details-marker { display: none; }
.cal-appt summary:hover { filter: brightness(.97); background: rgba(255, 255, 255, .35); }
.cal-appt summary > * { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-appt .t { font-size: .72rem; font-weight: 600; opacity: .85; font-variant-numeric: tabular-nums; }
.cal-appt .p { font-size: .72rem; opacity: .8; }
.cal-appt.short summary { display: flex; gap: .4rem; align-items: center; padding-top: 0; padding-bottom: 0; }
.cal-appt.short .p { display: none; }
.cal-appt.confirmed { border-left-color: var(--green); background: var(--green-soft); color: var(--green-dark); }
.cal-appt.attended { border-left-color: #12a594; background: #e3f6f3; color: #0b6b60; }
.cal-appt.no_show { border-left-color: #e5484d; background: var(--red-soft); color: var(--red); }
.cal-appt[open] { z-index: 8; }
.cal-pop { position: absolute; top: calc(100% + 4px); left: 0; z-index: 9; width: 16rem; padding: .85rem 1rem; border-radius: 12px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 14px 34px rgba(16, 24, 40, .22); font-size: .88rem; }
.cal-col:last-of-type:not(:nth-of-type(2)) .cal-pop { left: auto; right: 0; }
.cal-pop p { margin: 0 0 .6rem; }
.cal-pop p:last-child { margin-bottom: 0; }
.cal-pop form { margin-bottom: .6rem; }

/* Entrada a pantalla dividida */
.app.guest.split main { max-width: none; margin: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; background: none; }
.login { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 100vh; }
.login-side { display: flex; flex-direction: column; justify-content: center; gap: 1.25rem; padding: 3rem clamp(2rem, 6vw, 5rem); color: #fff; background: var(--brand-gradient); }
.login-mark { display: grid; place-items: center; width: 3.6rem; height: 3.6rem; border-radius: 16px; background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .35); }
.login-mark svg { width: 2rem; height: 2rem; }
.login-side h2 { margin: 0; max-width: 24rem; font-size: 2rem; line-height: 1.2; color: #fff; text-wrap: balance; }
.login-side ul { display: grid; gap: .8rem; margin: .5rem 0 0; padding: 0; list-style: none; color: rgba(255, 255, 255, .9); }
.login-side li { display: flex; align-items: center; gap: .7rem; }
.login-side li svg { width: 1.2rem; height: 1.2rem; color: var(--green); }
.login-form { display: flex; flex-direction: column; justify-content: center; width: 100%; max-width: 26rem; margin: 0 auto; padding: 3rem 2rem; }
.login-form h1 { margin-bottom: .3rem; }
.login-form .stack { margin-top: 1rem; }
.login-form input { height: 2.8rem; }
.login-form button { height: 2.9rem; font-size: 1rem; }
@media (max-width: 760px) { .login { grid-template-columns: minmax(0, 1fr); } .login-side { display: none; } }
@media print { .agenda-bar, .segmented, .cal-now { display: none !important; } }
.welcome + .stats { grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); }
.app.guest.split { background: var(--surface); }

/* ---------------------------------------------------------------------------
   Agenda: tres vistas, estados de la clínica, filtro y sobrecupos
   --------------------------------------------------------------------------- */
.agenda-bar h1 { margin: 0 .25rem 0 0; font-size: 1.35rem; }
.agenda-bar.sub { padding: .5rem .9rem; }
.agenda-bar .where { margin: 0; font-size: .88rem; background: none; padding: 0; }
a.button.on { background: var(--blue-soft); border-color: #c3c8f3; color: var(--blue-dark); }

/* Estado: el color lo pone la clínica */
.st, .st-select { --c: #7b8794; display: inline-block; padding: .2rem .65rem; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--c) 45%, #fff); border-left: 5px solid var(--c); background: color-mix(in srgb, var(--c) 14%, #fff); color: color-mix(in srgb, var(--c) 55%, #101828); font-size: .8rem; font-weight: 600; white-space: nowrap; }
.st-select { height: 2rem !important; padding: 0 1.6rem 0 .6rem; max-width: 13rem; white-space: normal; cursor: pointer; }
.over { display: inline-block; padding: .08rem .45rem; border-radius: 6px; background: var(--amber-soft); border: 1px solid #f0d58a; color: var(--amber); font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }

/* Día: filtro a la izquierda y lista */
.agenda { grid-template-columns: 15.5rem minmax(0, 1fr); gap: 1rem; }
.agenda aside.filter { padding: .9rem 1rem; }
.filter .section-label { margin-top: 0; }
.filter label.check { display: flex; align-items: flex-start; gap: .5rem; padding: .28rem .4rem .28rem .5rem; margin: 0; border-left: 4px solid var(--c, transparent); border-radius: 0 6px 6px 0; font-size: .86rem; font-weight: 400; line-height: 1.3; cursor: pointer; }
.filter label.check:hover { background: var(--bg); }
.filter label.check span { flex: 1; }
.filter label.check b { padding: 0 .4rem; border-radius: 999px; background: var(--bg); font-size: .74rem; color: var(--slate); }
.filter label.all { font-weight: 600; border-left: 0; padding-left: .5rem; margin-bottom: .3rem; }
.filter-group { display: grid; gap: 1px; padding: .5rem 0; border-top: 1px solid var(--line); }
.filter-group small { padding: 0 .5rem .2rem; font-size: .7rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.search-box { display: flex; align-items: center; gap: .5rem; padding: 0 .8rem; margin-bottom: .8rem; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); color: var(--muted); }
.search-box input { flex: 1; height: 2.5rem; border: 0; background: none; box-shadow: none; outline: none; padding: 0; }
.search-box:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); }
.day-list td { vertical-align: top; }
.day-list .time { display: inline-block; padding: .35rem .55rem; border-radius: 8px; background: color-mix(in srgb, var(--c) 18%, #fff); border-left: 4px solid var(--c); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.day-list .name { font-weight: 600; text-transform: uppercase; font-size: .9rem; }
.day-list td small { display: block; margin-top: .15rem; line-height: 1.45; }
.day-list tr.out td { background: #fafbfc; }
.day-list tr.out .name { color: var(--muted); text-decoration: line-through; }
.sit { display: inline-block; padding: .25rem .7rem; border-radius: 8px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.sit:hover { text-decoration: none; filter: brightness(.97); }
.sit.red { background: var(--red-soft); color: var(--red); }
.sit.green { background: var(--green-soft); color: var(--green-dark); }
.sit.amber { background: var(--amber-soft); color: var(--amber); }
.sit.gray { background: #eef1f5; color: var(--slate); }

/* Calendarios: gris donde no atiende, verde donde está libre, rayado donde hay bloqueo */
.cal-head, .cal-body { grid-template-columns: 3.4rem repeat(var(--cols), minmax(8.5rem, 1fr)); min-width: calc(3.4rem + var(--cols) * 8.5rem); }
.cal.semana .cal-head, .cal.semana .cal-body { grid-template-columns: 3.4rem repeat(7, minmax(6.5rem, 1fr)); min-width: 49rem; }
.cal-head a, .cal-head strong { padding: .6rem .5rem; border-left: 1px solid var(--line); font-size: .82rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--blue-dark); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-head strong { color: var(--slate); }
.cal-head strong::first-letter { text-transform: uppercase; }
.cal-head strong.today { color: var(--blue-dark); box-shadow: inset 0 -3px 0 var(--blue); }
.cal-col { background: #f6f7f9; }
.cal-col.today { background: #f2f4fd; }
.cal-hours span { font-size: .68rem; opacity: .7; }
.cal-hours span.hour { font-size: .74rem; opacity: 1; font-weight: 600; }
.cal-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); pointer-events: none; }
.cal-free { position: absolute; left: 2px; right: 2px; border-radius: 4px; background: #dff1ee; box-shadow: inset 0 0 0 1px #fff; }
.cal-free span { display: none; }
a.cal-free:hover { background: var(--green); text-decoration: none; z-index: 1; }
a.cal-free:hover span { display: grid; place-items: center; height: 100%; font-size: .72rem; font-weight: 700; color: #fff; }
a.cal-free:hover span::before { content: "＋ "; }
.cal-off { position: absolute; left: 0; right: 0; z-index: 1; background: repeating-linear-gradient(135deg, #cdd2ee 0 2px, #f4f7fb 2px 7px); }
.cal-appt { --c: var(--brand); left: 2px; right: 2px; border-radius: 6px; border-left: 4px solid var(--c); background: color-mix(in srgb, var(--c) 30%, #fff); color: color-mix(in srgb, var(--c) 45%, #101828); }
.cal-appt.confirmed, .cal-appt.attended, .cal-appt.no_show { border-left-color: var(--c); background: color-mix(in srgb, var(--c) 30%, #fff); color: color-mix(in srgb, var(--c) 45%, #101828); }
.cal-appt summary { padding: .15rem .4rem; font-size: .76rem; }
.cal-appt strong { text-transform: uppercase; font-size: .72rem; }
.cal-appt.short .t { display: none; }
.cal-appt.over { left: 50%; border: 1px dashed var(--c); border-left: 4px solid var(--c); z-index: 3; }
.cal-pop .links { display: flex; gap: .9rem; }
.cal-col:nth-last-of-type(-n+2):not(:nth-of-type(-n+3)) .cal-pop { left: auto; right: 0; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin-top: .7rem; font-size: .82rem; color: var(--muted); }
.legend i { display: inline-block; width: 1.1rem; height: .8rem; margin-right: .3rem; border-radius: 3px; vertical-align: -1px; border: 1px solid var(--line-strong); }
.legend i.free { background: #dff1ee; }
.legend i.closed { background: #f6f7f9; }
.legend i.off { background: repeating-linear-gradient(135deg, #cdd2ee 0 2px, #f4f7fb 2px 7px); }

/* Estados de cita y formularios varios */
input[type="color"] { width: 2.6rem; height: 2.1rem; padding: 2px; cursor: pointer; }
input.narrow { width: 4.5rem; }
.plain-list { margin: 0; padding: 0; list-style: none; display: grid; gap: .3rem; font-size: .9rem; color: var(--slate); }
label.check { display: flex; align-items: center; gap: .5rem; }
@media (max-width: 900px) { .agenda { grid-template-columns: minmax(0, 1fr); } }
.agenda { grid-template-columns: 14rem minmax(0, 1fr); }
.day-list th, .day-list td { padding: .7rem .6rem; }
.day-list th:first-child, .day-list td:first-child { padding-left: .9rem; }
.day-list .time { padding: .3rem .45rem; font-size: .88rem; }
.day-list .st-select { max-width: 10.5rem; }
.day-list td:last-child { width: 1%; }
.agenda > section { overflow-x: auto; }

/* Resultado de una carga: que no pase inadvertido */
.result { padding: 1.1rem 1.4rem; margin-bottom: 1rem; border-radius: var(--radius); background: var(--green-soft); border: 1px solid #c4e3de; border-left: 6px solid var(--green); }
.result.warn { background: var(--amber-soft); border-color: #f0d58a; border-left-color: #e0a100; }
.result h2 { margin: 0 0 .4rem; font-size: 1.2rem; }
.result p, .result ul { margin: .3rem 0; }
.toolbar input[type="search"] { min-width: 17rem; }
.nowrap { white-space: nowrap; }

/* Día: filtro en una fila de botones y citas en tarjetas por hora */
.chips-filter { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-bottom: .8rem; }
.chips-label { font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-right: .2rem; }
.chips-sep { width: 1px; height: 1.4rem; margin: 0 .3rem; background: var(--line-strong); }
.pick { margin: 0; cursor: pointer; }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick span { --c: inherit; display: inline-flex; align-items: center; gap: .4rem; padding: .32rem .75rem; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); font-size: .83rem; font-weight: 500; white-space: nowrap; }
.pick span::before { content: ""; width: .6rem; height: .6rem; border-radius: 50%; background: var(--c, var(--slate)); opacity: .35; }
.pick input:checked + span { border-color: color-mix(in srgb, var(--c, #4a5565) 55%, #fff); background: color-mix(in srgb, var(--c, #4a5565) 12%, #fff); color: var(--ink); }
.pick input:checked + span::before { opacity: 1; }
.pick input:focus-visible + span { outline: 3px solid rgba(79, 70, 229, .35); outline-offset: 2px; }
.pick b { padding: 0 .4rem; border-radius: 999px; background: rgba(16, 24, 40, .08); font-size: .72rem; }
.pick.all span::before { display: none; }
.timeline { display: grid; gap: 1.1rem; }
.hour-block { display: grid; grid-template-columns: 4.2rem minmax(0, 1fr); gap: .9rem; align-items: start; }
.hour-block h2 { margin: .5rem 0 0; font-size: 1.05rem; font-weight: 700; color: var(--slate); font-variant-numeric: tabular-nums; text-align: right; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: .7rem; padding-left: .9rem; border-left: 2px solid var(--line-strong); }
.appt { --c: #7b8794; display: flex; flex-direction: column; gap: .3rem; padding: .75rem .9rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--c); box-shadow: var(--shadow); }
.appt header, .appt footer { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.appt .time { font-weight: 700; font-variant-numeric: tabular-nums; }
.appt .name { font-size: 1rem; font-weight: 600; line-height: 1.25; }
.appt .meta { margin: 0; font-size: .82rem; line-height: 1.45; color: var(--muted); }
.appt footer { margin-top: auto; padding-top: .45rem; justify-content: space-between; }
.appt .move { font-size: .82rem; font-weight: 600; }
.appt.out { background: #fafbfc; border-top-style: dashed; }
.appt.out .name { color: var(--muted); text-decoration: line-through; }
.appt .st-select { max-width: 12rem; }
@media (max-width: 700px) { .hour-block { grid-template-columns: minmax(0, 1fr); } .hour-block h2 { text-align: left; } .cards { padding-left: 0; border-left: 0; } }

/* Nota de la cita */
.note-box { position: relative; }
.note-box summary { display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 50%; list-style: none; cursor: pointer; color: var(--muted); border: 1px solid transparent; }
.note-box summary::-webkit-details-marker { display: none; }
.note-box summary:hover { background: var(--bg); color: var(--ink); }
.note-box summary svg { width: 1.1rem; height: 1.1rem; }
.note-box.has summary { background: var(--amber-soft); border-color: #f0d58a; color: var(--amber); }
.note-pop { position: absolute; top: calc(100% + 6px); right: 0; z-index: 20; width: 18rem; padding: .85rem 1rem; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 14px 34px rgba(16, 24, 40, .22); }
.note-pop form { display: grid; gap: .6rem; margin: 0; }
.note-pop textarea, .note-inline textarea { width: 100%; resize: vertical; font: inherit; }
.note-pop p { margin: 0; }
.note-text { display: flex; gap: .4rem; align-items: flex-start; margin: .1rem 0 0; padding: .4rem .55rem; border-radius: 8px; background: var(--amber-soft); color: #6b4a08; font-size: .84rem; line-height: 1.35; }
.note-text svg { flex: none; width: 1rem; height: 1rem; margin-top: .1rem; }
.note-inline { display: grid; gap: .4rem; justify-items: start; }
.has-note svg { width: .85rem; height: .85rem; vertical-align: -1px; }

/* Día por doctor con muchos doctores: columnas angostas que caben sin desplazar */
.cal.dense .cal-head, .cal.dense .cal-body { grid-template-columns: 3.2rem repeat(var(--cols), minmax(5.6rem, 1fr)); min-width: calc(3.2rem + var(--cols) * 5.6rem); }
.cal-head a { display: flex; flex-direction: column; gap: .05rem; line-height: 1.2; }
.cal-head a small { font-size: .68rem; font-weight: 500; color: var(--muted); }
.cal.dense .cal-head a { padding: .45rem .3rem; font-size: .76rem; }
.cal.dense .cal-appt summary { padding: .1rem .3rem; }
.cal.dense .cal-appt strong { font-size: .66rem; }
.cal.dense .cal-appt .t { font-size: .64rem; }
.cal.dense .has-note svg { width: .7rem; height: .7rem; }

/* Día en modo compacto: una fila por cita */
.chips-filter .segmented { margin-left: auto; }
.appt .meta span { display: block; }
.timeline.compact { gap: .6rem; }
.timeline.compact .cards { grid-template-columns: minmax(0, 1fr); gap: .3rem; }
.timeline.compact .appt { display: grid; grid-template-columns: 9.5rem minmax(9rem, 1.1fr) minmax(10rem, 1.4fr) auto; align-items: center; gap: .2rem .8rem; padding: .3rem .7rem; border-top: 1px solid var(--line); border-left: 5px solid var(--c); border-radius: 8px; box-shadow: none; }
.timeline.compact .appt header { order: 1; flex-wrap: nowrap; gap: .35rem; }
.timeline.compact .appt header .grow, .timeline.compact .appt header .sit { display: none; }
.timeline.compact .appt .name { order: 2; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timeline.compact .appt .meta { order: 3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timeline.compact .appt .meta span { display: inline; }
.timeline.compact .appt .meta span + span::before { content: " · "; }
.timeline.compact .appt .meta .contact { display: none; }
.timeline.compact .appt .note-text { display: none; }
.timeline.compact .appt footer { order: 4; margin: 0; padding: 0; flex-wrap: nowrap; }
.timeline.compact .appt .st-select { max-width: 10.5rem; height: 1.8rem !important; }
.timeline.compact .note-box summary { width: 1.6rem; height: 1.6rem; }
.timeline.compact .hour-block h2 { margin-top: .25rem; }
@media (max-width: 1100px) { .timeline.compact .appt { grid-template-columns: 9.5rem minmax(0, 1fr) auto; } .timeline.compact .appt .meta { display: none; } }
.timeline.compact .appt { grid-template-columns: 9.5rem minmax(9rem, 1.1fr) minmax(10rem, 1.4fr) 15rem; }
.timeline.compact .appt footer { justify-content: flex-start; gap: .7rem; }

/* Calendario: la hora se lee en la regla; el bloque muestra solo al paciente y su alto es la duración */
.cal-head, .cal-body { grid-template-columns: 3.6rem repeat(var(--cols), minmax(8.5rem, 1fr)); }
.cal-hours span { font-size: .64rem; opacity: .55; }
.cal-hours span.half { font-size: .68rem; opacity: .8; }
.cal-hours span.hour { font-size: .78rem; opacity: 1; font-weight: 700; color: var(--ink); }
.cal-appt summary { display: flex; align-items: flex-start; padding: .1rem .4rem; }
.cal-appt.short summary { align-items: center; }
.cal-appt strong { line-height: 1.5; }
.cal-grip { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; cursor: ns-resize; border-radius: 0 0 6px 6px; touch-action: none; }
.cal-grip::after { content: ""; position: absolute; left: 50%; bottom: 2px; width: 1.4rem; height: 3px; translate: -50% 0; border-radius: 2px; background: color-mix(in srgb, var(--c) 60%, #101828); opacity: 0; transition: opacity .12s ease; }
.cal-appt:hover .cal-grip::after, .cal-appt.stretching .cal-grip::after { opacity: .7; }
.cal-appt.stretching { z-index: 9; box-shadow: 0 6px 18px rgba(16, 24, 40, .25); outline: 2px solid var(--c); }
.cal-appt.stretching::after { content: attr(data-stretch); position: absolute; right: 4px; bottom: 10px; padding: .05rem .4rem; border-radius: 6px; background: #101828; color: #fff; font-size: .7rem; font-weight: 600; }
.notice.toast.bad { background: #7a1a12; }
.notice.toast.bad::before { content: "!"; background: #fbd2cd; color: #7a1a12; }

/* Día por doctor: cada doctor lleva su propia regla de horas, con una marca por cada bloque suyo */
.cal.doctores .cal-head, .cal.doctores .cal-body { grid-template-columns: repeat(var(--cols), minmax(10rem, 1fr)); min-width: calc(var(--cols) * 10rem); }
.cal.doctores.dense .cal-head, .cal.doctores.dense .cal-body { grid-template-columns: repeat(var(--cols), minmax(7.4rem, 1fr)); min-width: calc(var(--cols) * 7.4rem); }
.cal.doctores .cal-hours, .cal.doctores .cal-head > span:first-child { display: none; }
.cal.doctores .cal-col:first-of-type, .cal.doctores .cal-head > a:first-of-type { border-left: 0; }
.cal-col.ruled { --rule: 2.7rem; }
.cal-rule { position: absolute; top: 0; bottom: 0; left: 0; width: var(--rule); background: var(--surface); border-right: 1px solid var(--line); z-index: 1; }
.cal-rule span { position: absolute; right: .3rem; translate: 0 .12rem; font-size: .66rem; line-height: 1; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-rule span.hour { font-weight: 700; color: var(--ink); font-size: .7rem; }
.cal-col.ruled .cal-free, .cal-col.ruled .cal-appt { left: calc(var(--rule) + 2px); }
.cal-col.ruled .cal-off, .cal-col.ruled .cal-line { left: var(--rule); }
.cal-col.ruled .cal-appt.over { left: calc(50% + var(--rule) / 2); }
.cal.dense .cal-col.ruled { --rule: 2.3rem; }
.cal.dense .cal-rule span { font-size: .6rem; right: .2rem; }
.cal.doctores .cal-head a { padding-left: .4rem; padding-right: .4rem; }
.cal.semana .cal-hours span { translate: 0 .12rem; }

/* Correr una cita arrastrando el bloque */
.cal-appt[data-resize] summary { cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none; }
.cal-appt.sliding summary { cursor: grabbing; }
.cal-appt.sliding { opacity: .92; }
.cal-appt.sliding::after { bottom: auto; top: -1.35rem; right: 0; }

.cal-appt.sliding::after { white-space: nowrap; right: auto; left: 0; }

/* Agenda de sobrecupos: el mismo horario en limpio, en otro color */
.overlay-note { margin: 0 0 .8rem; padding: .7rem 1rem; border-radius: var(--radius-sm); background: var(--amber-soft); border: 1px solid #f0d58a; border-left: 5px solid #e0a100; color: #5c4306; }
.cal.overlay { border-color: #f0d58a; box-shadow: 0 0 0 3px rgba(224, 161, 0, .14); }
.cal.overlay .cal-head { background: var(--amber-soft); }
.cal.overlay .cal-free { background: #fbe9bb; }
.cal.overlay a.cal-free:hover { background: #f0c34a; }
.cal.overlay a.cal-free:hover span { color: #5c4306; }
.cal-appt.ob { border: 1px dashed var(--c); border-left: 4px solid var(--c); }
.cal-appt .stacked { position: absolute; top: 2px; right: 3px; z-index: 2; padding: 0 .35rem; border-radius: 999px; background: #e0a100; color: #fff; font-size: .66rem; font-weight: 700; line-height: 1.5; }
.cal-appt .stacked:hover { text-decoration: none; background: #b7791f; }
.legend i.free { background: #dff1ee; }

/* ---------------------------------------------------------------------------
   Odontograma del plan de tratamiento
   Rojo: pendiente. Azul: realizado. Verde: lo que se está eligiendo.
   --------------------------------------------------------------------------- */
.odonto-panel { margin-bottom: 1.25rem; }
.odonto { --od-pend: #e5484d; --od-done: var(--brand); --od-sel: #0f766e; }
.odonto-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem; margin-bottom: .6rem; }
.odonto .segmented button { border: 0; background: none; box-shadow: none; color: var(--slate); padding: .35rem .8rem; border-radius: 7px; font-size: .88rem; font-weight: 500; text-shadow: none; }
.odonto .segmented button:hover { background: none; color: var(--ink); box-shadow: none; }
.odonto .segmented button.current { background: var(--surface); color: var(--blue-dark); box-shadow: 0 1px 2px rgba(16, 24, 40, .14); }
.od-legend { font-size: .8rem; color: var(--muted); }
.od-legend i { display: inline-block; width: .8rem; height: .8rem; margin: 0 .25rem 0 .7rem; border-radius: 3px; vertical-align: -1px; }
.od-legend i.pend { background: var(--od-pend); } .od-legend i.done { background: var(--od-done); } .od-legend i.sel { background: var(--od-sel); }
.od-set { display: block; width: 100%; max-width: 46rem; margin: 0 auto; height: auto; }
.odonto[data-view="permanente"] .od-temporal, .odonto[data-view="temporal"] .od-permanente { display: none; }
.odonto[data-view="mixta"] .od-temporal { margin-top: .9rem; padding-top: .9rem; border-top: 1px dashed var(--line-strong); }
.od-face, .od-shape { fill: #fff; stroke: #8b96a5; stroke-width: 1; stroke-linejoin: round; }
.od-shape { fill: #f3f5f8; }
.od-num { font-size: 9px; font-weight: 600; fill: var(--slate); text-anchor: middle; font-variant-numeric: tabular-nums; }
.od-zone rect { fill: #f3f5f8; stroke: var(--line-strong); stroke-width: 1; }
.od-zone text { font-size: 9px; font-weight: 600; fill: var(--slate); text-anchor: middle; pointer-events: none; }
.od-face.done, .od-shape.done { fill: color-mix(in srgb, var(--od-done) 70%, #fff); stroke: var(--od-done); }
.od-face.pend, .od-shape.pend { fill: color-mix(in srgb, var(--od-pend) 70%, #fff); stroke: var(--od-pend); }
.od-zone.done rect { fill: color-mix(in srgb, var(--od-done) 30%, #fff); stroke: var(--od-done); }
.od-zone.pend rect { fill: color-mix(in srgb, var(--od-pend) 30%, #fff); stroke: var(--od-pend); }
.odonto.selectable .od-face, .odonto.selectable .od-shape, .odonto.selectable .od-zone { cursor: pointer; }
.odonto.selectable .od-face:hover, .odonto.selectable .od-shape:hover, .odonto.selectable .od-zone:hover rect { fill: color-mix(in srgb, var(--od-sel) 35%, #fff); }
.od-face.sel, .od-shape.sel, .od-zone.sel rect { fill: var(--od-sel) !important; stroke: #094641 !important; stroke-width: 1.6; }
.od-summary { margin: .8rem 0; padding: .6rem .85rem; border-radius: var(--radius-sm); background: var(--bg); color: var(--muted); font-size: .88rem; }
.od-summary.has { background: var(--green-soft); color: var(--green-dark); font-weight: 500; border: 1px solid #c4e3de; }
.od-add { display: grid; gap: .8rem; margin-bottom: .9rem; }
.od-section { padding-top: .9rem; border-top: 1px solid var(--line); }
.od-section input { min-width: 18rem; }
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding: .55rem .8rem; margin: 1rem 0 0; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); }
.bulk-bar label { margin: 0; }
.bulk-bar input[name="discount_percent"] { width: 4.5rem; height: 2.1rem; }
tr.item-done td:nth-child(2), tr.item-done td:first-child + td { color: var(--slate); }
@media print { .odonto .segmented, .od-summary, .od-add, .od-section { display: none !important; } }

/* ---------------------------------------------------------------------------
   Menú lateral que se encoge a solo íconos
   --------------------------------------------------------------------------- */
.menu-toggle { align-self: flex-end; display: grid; place-items: center; width: 2rem; height: 2rem; margin: -.4rem .85rem -.5rem 0; padding: 0; border: 0; border-radius: 8px; background: rgba(255, 255, 255, .1); color: rgba(255, 255, 255, .85); box-shadow: none; }
.menu-toggle:hover { background: rgba(255, 255, 255, .22); color: #fff; box-shadow: none; }
.app { transition: grid-template-columns .18s ease; }
@media (min-width: 761px) {
  .app.slim { grid-template-columns: 4.5rem minmax(0, 1fr); }
  .app.slim .sidebar { padding-left: .6rem; }
  .app.slim .sidebar > * { margin-right: .6rem; }
  .app.slim .menu-toggle { align-self: center; margin: 0 .6rem 0 0; }
  .app.slim .brand { justify-content: center; padding: .25rem 0; }
  .app.slim .brand-name, .app.slim .branch-switch, .app.slim .account .who, .app.slim .sidebar nav a span { display: none; }
  .app.slim .nav-section { height: 1px; margin: .6rem .6rem .6rem 0; padding: 0; background: rgba(255, 255, 255, .22); font-size: 0; }
  .app.slim .sidebar nav a { justify-content: center; margin-right: .6rem; padding: .6rem 0; }
  .app.slim .sidebar nav a.active { margin-right: 0; padding-right: .6rem; }
  .app.slim .sidebar svg { width: 1.25rem; height: 1.25rem; }
  .app.slim .account { flex-direction: column; gap: .4rem; padding: .7rem 0 0; }
}
@media (max-width: 760px) { .menu-toggle { display: none; } }

/* ---------------------------------------------------------------------------
   Plan de tratamiento: resumen en una franja y prestaciones a todo el ancho
   --------------------------------------------------------------------------- */
.plan-strip { display: grid; gap: .9rem 1.5rem; grid-template-columns: minmax(0, 1fr); padding: 1rem 1.25rem; margin-bottom: 1.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.plan-facts { display: flex; flex-wrap: wrap; gap: .7rem 2rem; margin: 0; }
.plan-facts div { min-width: 0; }
.plan-facts dt { font-size: .68rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.plan-facts dd { margin: .1rem 0 0; font-weight: 500; }
.plan-facts.money { padding-top: .8rem; border-top: 1px solid var(--line); }
.plan-facts.money dd { font-variant-numeric: tabular-nums; }
.plan-facts .debt dt, .plan-facts .debt dd { color: var(--red); font-weight: 600; }
.plan-steps { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.plan-steps form { margin: 0; }
.plan > section > table { margin-bottom: .5rem; }
.plan table td small { display: block; margin-top: .1rem; font-weight: 400; }
th.num, td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.item-state { display: inline-block; margin-right: .3rem; padding: .14rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.item-state.pend { background: var(--red-soft); color: var(--red); }
.item-state.done { background: var(--blue-soft); color: var(--blue-dark); }
.item-state.paid { background: var(--green-soft); color: var(--green-dark); }
.item-state.part { background: var(--amber-soft); color: var(--amber); }
.item-state small { display: inline !important; color: inherit; font-size: inherit; font-weight: inherit; }
td.row-actions { width: 1%; white-space: nowrap; text-align: right; }
td.row-actions form { margin: 0; }
details.menu { position: relative; display: inline-block; }
details.menu summary { list-style: none; cursor: pointer; padding: .3rem .75rem; border-radius: 999px; border: 1px solid var(--brand-line); background: var(--blue-soft); color: var(--blue-dark); font-size: .82rem; font-weight: 600; }
details.menu summary::-webkit-details-marker { display: none; }
details.menu summary::after { content: " ▾"; }
details.menu summary:hover { background: var(--brand-line); }
.menu-pop { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; display: grid; gap: .35rem; min-width: 11rem; padding: .6rem; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 14px 34px rgba(16, 24, 40, .22); text-align: left; }
.menu-pop button.link { width: 100%; justify-content: flex-start; }

/* Plan: secciones editables y prestaciones que se arrastran entre ellas */
.plan-group { border-radius: var(--radius); transition: box-shadow .12s ease, background .12s ease; }
.plan-group.drop-here { background: var(--green-soft); box-shadow: 0 0 0 2px var(--green); }
.plan-group.dragging, tr.dragging { opacity: .45; }
.group-head[draggable="true"] { cursor: grab; }
.group-head h3 { margin: 0; }
tr[data-drag-item] { cursor: grab; }
details.rename { position: relative; }
details.rename summary { display: flex; align-items: center; gap: .6rem; list-style: none; cursor: pointer; }
details.rename summary::-webkit-details-marker { display: none; }
.edit-mark { display: inline-flex; align-items: center; gap: .25rem; padding: .15rem .55rem; border-radius: 999px; background: var(--blue-soft); color: var(--blue-dark); font-size: .76rem; font-weight: 600; }
details.rename summary:hover .edit-mark { background: var(--brand-line); }
.rename-pop { position: absolute; left: 0; top: calc(100% + 6px); z-index: 20; display: grid; gap: .6rem; padding: .8rem; min-width: 22rem; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 14px 34px rgba(16, 24, 40, .22); }
.rename-pop form { margin: 0; }
.rename-pop input[name="name"] { flex: 1; min-width: 12rem; }
.menu-pop .move-to { padding-top: .45rem; border-top: 1px solid var(--line); }
.menu-pop .move-to label { display: grid; gap: .2rem; font-size: .76rem; color: var(--muted); }
.menu-pop .move-to select { height: 2rem; font-size: .85rem; }

tr.drop-before > td { box-shadow: inset 0 3px 0 var(--green); background: var(--green-soft); }

tr.drop-after > td { box-shadow: inset 0 -3px 0 var(--green); background: var(--green-soft); }

/* Avance de una prestación: se abre al tocar su estado */
details.menu.progress summary { border: 0; }
details.menu.progress summary.item-state { padding: .14rem .6rem; font-size: .78rem; }
details.menu.progress summary.pend { background: var(--red-soft); color: var(--red); }
details.menu.progress summary.done { background: var(--blue-soft); color: var(--blue-dark); }
details.menu.progress summary.paid { background: var(--green-soft); color: var(--green-dark); }
details.menu.progress summary.part { background: var(--amber-soft); color: var(--amber); }
.progress-pop { left: 0; right: auto; min-width: 13rem; }
.progress-title { font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.progress-pop button.link { gap: .6rem; }
.progress-pop button.link.current { outline: 2px solid var(--blue); }
.progress-pop .bar { display: inline-block; width: 2.6rem; height: .45rem; border-radius: 999px; background: #dfe6ef; overflow: hidden; }
.progress-pop .bar i { display: block; height: 100%; background: var(--blue); }
/* Las tablas del plan no recortan sus menús desplegables (avance, acciones); las esquinas se redondean en las celdas. */
.plan table { overflow: visible; }
.plan thead th:first-child { border-top-left-radius: var(--radius); }
.plan thead th:last-child { border-top-right-radius: var(--radius); }
.plan tbody tr:last-child > :first-child { border-bottom-left-radius: var(--radius); }
.plan tbody tr:last-child > :last-child { border-bottom-right-radius: var(--radius); }
details.menu[open] { z-index: 30; }

/* Marca de realizada a la izquierda de cada prestación, y modo de selección múltiple */
td.tick { width: 1%; padding-right: 0 !important; }
.tick-mark { display: grid; place-items: center; width: 1.9rem; height: 1.9rem; padding: 0; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); color: transparent; box-shadow: none; cursor: pointer; list-style: none; }
.tick-mark svg { width: 1rem; height: 1rem; }
.tick-mark::-webkit-details-marker { display: none; }
button.tick-mark:hover, summary.tick-mark:hover { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); box-shadow: none; }
.tick-mark.done { border-color: var(--blue); background: var(--blue); color: #fff; cursor: default; }
.tick-mark.off { cursor: default; border-style: dashed; }
details.tick-menu summary::after { content: none; }
details.tick-menu summary { padding: 0; border: 2px solid var(--line-strong); background: var(--surface); }
.tick-pop { left: 0; right: auto; min-width: 16rem; }
.doer { display: grid; gap: .2rem; font-size: .76rem; color: var(--muted); margin: 0; }
.doer select { height: 2.1rem; font-size: .88rem; }
.bulk-bar .doer { display: flex; align-items: center; gap: .4rem; }
.plan .bulk-only { display: none; }
.plan.selecting .bulk-only { display: inline-flex; }
.plan.selecting input.bulk-only { display: inline-block; }
.plan.selecting .quick, .plan.selecting .bulk-start, .plan.selecting .bulk-hint { display: none; }
.bulk-hint { font-size: .85rem; color: var(--muted); }
.plan.selecting .bulk-bar { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }

/* Evolucionar una prestación: doctor, avance y lo que se hizo */
.evolve-pop { left: 0; right: auto; width: 21rem; gap: .65rem; white-space: normal; }
.evolve-title { font-size: .9rem; line-height: 1.3; }
.how-far { display: flex; gap: .3rem; margin: 0; padding: 0; border: 0; }
.how-far legend { padding: 0; margin-bottom: .25rem; font-size: .76rem; color: var(--muted); }
.how-far label { flex: 1; margin: 0; cursor: pointer; }
.how-far input { position: absolute; opacity: 0; pointer-events: none; }
.how-far span { display: block; padding: .35rem 0; text-align: center; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); font-size: .82rem; font-weight: 600; color: var(--slate); }
.how-far input:checked + span { border-color: var(--blue); background: var(--blue); color: #fff; }
.how-far input:focus-visible + span { outline: 3px solid rgba(79, 70, 229, .35); outline-offset: 1px; }
.evolve-pop textarea { width: 100%; resize: vertical; font: inherit; color: var(--ink); }
.evolve-pop .hint { margin: 0; font-size: .76rem; }
/* Evolución clínica mínima (src/evolution-rule.ts): contador de palabras en vivo. */
.evo-need { font-weight: 500; color: var(--slate, #667085); }
.evo-count { display: block; margin-top: .25rem; font-size: .78rem; font-weight: 600; color: var(--slate, #667085); }
.evo-count.is-short { color: #b42318; }
.evo-count.is-ok { color: #0b6b5c; }
.bulk-note { display: flex; flex-direction: column; gap: .25rem; flex: 1 1 22rem; min-width: 16rem; }
.bulk-note textarea { width: 100%; resize: vertical; font: inherit; }
.tick-mark.part { border-color: #e0a100; background: var(--amber-soft); color: var(--amber); }
details.notes { margin-top: .35rem; }
details.notes summary { display: inline-flex; align-items: center; gap: .3rem; cursor: pointer; list-style: none; font-size: .78rem; font-weight: 600; color: var(--blue-dark); }
details.notes summary::-webkit-details-marker { display: none; }
details.notes summary svg { width: .9rem; height: .9rem; }
details.notes blockquote { margin: .4rem 0 0; padding: .5rem .7rem; border-left: 3px solid var(--blue); border-radius: 0 8px 8px 0; background: var(--bg); white-space: normal; }
details.notes blockquote p { margin: 0 0 .2rem; white-space: pre-wrap; font-weight: 400; }

/* ---------------------------------------------------------------------------
   Presupuesto bloqueado y hoja para imprimir
   --------------------------------------------------------------------------- */
.badge.locked { display: inline-flex; align-items: center; gap: .3rem; background: var(--amber-soft); color: var(--amber); border: 1px solid #f0d58a; }
.badge.locked svg { width: .85rem; height: .85rem; }
.plan-steps .grow { flex: 1; }
.lock-bar { position: sticky; bottom: 1rem; z-index: 40; display: flex; flex-wrap: wrap; align-items: center; gap: .7rem 1rem; margin-top: 1.5rem; padding: .8rem 1.1rem; border-radius: 14px; background: #1b2430; color: #fff; box-shadow: 0 14px 34px rgba(16, 24, 40, .35); }
.lock-bar p { flex: 1; min-width: 16rem; margin: 0; color: rgba(255, 255, 255, .88); }
.lock-bar p strong { color: #fff; }
.lock-bar form { margin: 0; }
.lock-bar .hint { color: rgba(255, 255, 255, .7); }
.lock-icon { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: #e0a100; color: #1b2430; }
.lock-icon svg { width: 1.1rem; height: 1.1rem; }

body.sheet-page { background: #dfe4ea; }
.sheet-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; max-width: 210mm; margin: 1rem auto; padding: 0 .5rem; }
.sheet { max-width: 210mm; margin: 0 auto 2rem; padding: 16mm 15mm; background: #fff; color: #111; box-shadow: 0 8px 30px rgba(16, 24, 40, .18); font-size: 10.5pt; line-height: 1.4; }
.sheet h1 { margin: 1.1rem 0 .6rem; font-size: 15pt; }
.sheet h2 { margin: 1.1rem 0 .35rem; font-size: 11pt; text-transform: uppercase; letter-spacing: .04em; color: var(--brand-deep); }
.sheet-head { display: flex; justify-content: space-between; gap: 1.5rem; padding-bottom: .8rem; border-bottom: 2px solid var(--brand); }
.sheet-clinic { display: flex; gap: .8rem; align-items: center; }
.sheet-clinic img { width: 22mm; height: 22mm; object-fit: contain; }
.sheet-clinic div { display: grid; }
.sheet-clinic strong { font-size: 14pt; }
.sheet-clinic span { font-size: 9pt; color: #444; }
.sheet-clinic span:empty { display: none; }
.sheet-id { display: grid; text-align: right; align-content: start; }
.sheet-id small { font-size: 8.5pt; text-transform: uppercase; letter-spacing: .08em; color: #555; }
.sheet-id strong { font-size: 15pt; color: var(--brand-deep); }
.sheet-facts { display: flex; flex-wrap: wrap; gap: .5rem 2.2rem; margin: 0 0 .6rem; }
.sheet-facts dt { font-size: 8pt; text-transform: uppercase; letter-spacing: .06em; color: #666; }
.sheet-facts dd { margin: 0; font-weight: 600; }
.sheet-odonto { margin: .6rem 0 .2rem; padding: .5rem; border: 1px solid #d5dbe3; border-radius: 8px; break-inside: avoid; }
.sheet-odonto .odonto-bar { margin-bottom: .2rem; }
.sheet-odonto .segmented { display: none; }
.sheet-odonto .od-set { max-width: 150mm; }
.sheet table { width: 100%; border: 0; border-radius: 0; box-shadow: none; border-collapse: collapse; overflow: visible; background: none; }
.sheet-table th { background: none; border-bottom: 1.5px solid #111; padding: .3rem .4rem; font-size: 8.5pt; color: #333; }
.sheet-table td { padding: .32rem .4rem; border-bottom: 1px solid #dde2e8; vertical-align: top; }
.sheet-table tbody tr:hover > td { background: none; }
.sheet-table tfoot td { border-bottom: 0; font-weight: 600; color: #333; }
.sheet-table tr { break-inside: avoid; }
.sheet-total { width: auto !important; margin: 1rem 0 0 auto; min-width: 75mm; }
.sheet-total th { text-align: left; font-weight: 400; padding: .25rem .6rem .25rem 0; border: 0; color: #111; width: auto; }
.sheet-total td { text-align: right; padding: .25rem 0; border: 0; font-variant-numeric: tabular-nums; }
.sheet-total tr.grand th, .sheet-total tr.grand td { padding-top: .5rem; border-top: 2px solid #111; font-size: 13pt; font-weight: 700; }
.sheet-note { margin: 1.2rem 0 0; font-size: 8.5pt; color: #555; }
.sheet-signs { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; margin-top: 22mm; text-align: center; font-size: 9pt; color: #333; break-inside: avoid; }
.sheet-signs span { display: block; margin-bottom: .3rem; border-top: 1px solid #111; }
@page { size: A4; margin: 12mm; }
@media print {
  body.sheet-page { background: #fff; }
  .sheet { max-width: none; margin: 0; padding: 0; box-shadow: none; }
  .sheet, .sheet * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .lock-bar { display: none !important; }
}
.sheet-bar { flex-wrap: nowrap; }
.sheet-bar .hint { flex: 1; min-width: 0; text-align: right; font-size: .82rem; }
.sheet-bar .grow { display: none; }
@media (max-width: 700px) { .sheet-bar .hint { display: none; } .sheet-bar .grow { display: block; flex: 1; } }

/* Ficha del paciente: alerta médica destacada */
.hero-card.alert-card { display: flex; align-items: center; gap: .8rem; min-width: 17rem; max-width: 30rem; }
.hero-card.alert-card p { margin: .1rem 0 0; }
.alert-icon { display: grid; place-items: center; flex: none; width: 2.4rem; height: 2.4rem; border-radius: 50%; background: rgba(255, 255, 255, .16); color: rgba(255, 255, 255, .75); }
.alert-icon svg { width: 1.25rem; height: 1.25rem; }
.hero-card.alert-card.warn { background: #fff4d6; border-color: #f0c34a; color: #5c4306; box-shadow: 0 0 0 3px rgba(240, 195, 74, .35); }
.hero-card.alert-card.warn small { color: #8a5d00; font-weight: 700; }
.hero-card.alert-card.warn p { color: #3d2c00; font-weight: 600; }
.hero-card.alert-card.warn .alert-icon { background: #e5484d; color: #fff; animation: alert-pulse 1.8s ease-in-out infinite; }
@keyframes alert-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(229, 72, 77, .55); } 50% { box-shadow: 0 0 0 8px rgba(229, 72, 77, 0); } }
@media (prefers-reduced-motion: reduce) { .hero-card.alert-card.warn .alert-icon { animation: none; } }

/* Alertas médicas: el recuadro es un botón; rojo y parpadeando si hay alertas, amarillo si hay algo que leer */
button.hero-card.alert-card { text-align: left; font: inherit; cursor: pointer; border-width: 1px; border-style: solid; box-shadow: none; text-shadow: none; transition: transform .12s ease, box-shadow .12s ease; }
button.hero-card.alert-card:hover { transform: translateY(-1px); filter: none; }
button.hero-card.alert-card.none { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .28); color: #fff; }
button.hero-card.alert-card.none:hover { background: rgba(255, 255, 255, .2); }
.alert-text { display: grid; gap: .05rem; min-width: 0; }
.alert-text small { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: inherit; opacity: .85; }
.alert-text > span { font-weight: 600; line-height: 1.3; }
.alert-text em { font-style: normal; font-size: .74rem; opacity: .75; }
button.hero-card.alert-card.alert { background: #fde8e6; border-color: #e5484d; color: #7a1a12; box-shadow: 0 0 0 3px rgba(229, 72, 77, .4); }
button.hero-card.alert-card.alert:hover { background: #fbd6d2; }
button.hero-card.alert-card.alert .alert-icon { background: #e5484d; color: #fff; animation: alert-blink 1.1s steps(2, jump-none) infinite, alert-pulse 1.8s ease-in-out infinite; }
button.hero-card.alert-card.notice { background: #fff4d6; border-color: #e0a100; color: #5c4306; box-shadow: 0 0 0 3px rgba(240, 195, 74, .4); }
button.hero-card.alert-card.notice:hover { background: #ffecb8; }
button.hero-card.alert-card.notice .alert-icon { background: #e0a100; color: #fff; animation: alert-blink 1.6s steps(2, jump-none) infinite; }
@keyframes alert-blink { 0% { opacity: 1; } 100% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { button.hero-card.alert-card .alert-icon { animation: none !important; } }

dialog.sheet-dialog { width: min(52rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); padding: 0; border: 0; border-radius: 16px; color: var(--ink); box-shadow: 0 24px 60px rgba(16, 24, 40, .35); }
dialog.sheet-dialog::backdrop { background: rgba(16, 24, 40, .5); }
dialog.sheet-dialog form { display: grid; gap: 1rem; padding: 1.4rem 1.6rem; margin: 0; }
dialog.sheet-dialog header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
dialog.sheet-dialog header h2 { display: flex; align-items: center; gap: .5rem; margin: 0; font-size: 1.2rem; }
dialog.sheet-dialog header h2 svg { width: 1.3rem; height: 1.3rem; color: #e5484d; }
dialog.sheet-dialog footer { display: flex; justify-content: flex-end; }
dialog.sheet-dialog fieldset.plain { display: grid; gap: 1rem; margin: 0; padding: 0; border: 0; min-width: 0; }
dialog.sheet-dialog .hint { margin: 0; }
.medical-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: .9rem 1.5rem; }
.medical-groups h3 { margin: 0 0 .35rem; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.medical-groups label.check { align-items: flex-start; gap: .5rem; margin: 0; padding: .2rem 0; font-weight: 400; font-size: .92rem; line-height: 1.3; cursor: pointer; }
dialog.sheet-dialog textarea { width: 100%; resize: vertical; font: inherit; }
button.hero-card.alert-card { white-space: normal; max-width: min(44rem, 100%); align-items: flex-start; }
button.hero-card.alert-card .alert-icon { margin-top: .1rem; }
.alert-text > span { overflow-wrap: anywhere; }
/* Alertas médicas: el fondo sigue siendo el azul del encabezado; resaltan el borde y el ícono. */
button.hero-card.alert-card.alert, button.hero-card.alert-card.notice { background: rgba(255, 255, 255, .1); color: #fff; }
button.hero-card.alert-card.alert:hover, button.hero-card.alert-card.notice:hover { background: rgba(255, 255, 255, .18); }
button.hero-card.alert-card.alert { border: 2px solid #ff6b6f; box-shadow: 0 0 0 3px rgba(229, 72, 77, .45); }
button.hero-card.alert-card.notice { border: 2px solid #f0c34a; box-shadow: 0 0 0 3px rgba(240, 195, 74, .4); }
button.hero-card.alert-card.alert .alert-text small, button.hero-card.alert-card.notice .alert-text small { color: #fff; opacity: .85; }
button.hero-card.alert-card.alert .alert-text > span, button.hero-card.alert-card.notice .alert-text > span { color: #fff; }
/* Alertas médicas: sin borde de color. Todo azul como el encabezado; solo el ícono resalta y parpadea. */
button.hero-card.alert-card.alert, button.hero-card.alert-card.notice { border: 1px solid rgba(255, 255, 255, .28); box-shadow: none; background: rgba(255, 255, 255, .12); }

/* Encabezado del plan: datos del paciente y aviso de alertas médicas */
.hero-patient { font-weight: 600; color: #fff; }
.hero-alert { display: inline-flex; align-items: center; gap: .55rem; margin-top: .55rem; padding: .3rem .8rem .3rem .3rem; border-radius: 999px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .28); color: #fff; font-size: .88rem; }
.hero-alert:hover { background: rgba(255, 255, 255, .2); text-decoration: none; }
.hero-alert .alert-icon { width: 1.7rem; height: 1.7rem; }
.hero-alert .alert-icon svg { width: .95rem; height: .95rem; }
.hero-alert.alert .alert-icon { background: #e5484d; color: #fff; animation: alert-blink 1.1s steps(2, jump-none) infinite; }
.hero-alert.notice .alert-icon { background: #e0a100; color: #fff; animation: alert-blink 1.6s steps(2, jump-none) infinite; }
@media (prefers-reduced-motion: reduce) { .hero-alert .alert-icon { animation: none !important; } }
/* Ficha del paciente: las alertas médicas van siempre a la derecha del encabezado, no debajo. */
.hero.patient-hero { flex-wrap: nowrap; align-items: center; }
.hero.patient-hero .hero-main { flex: 1 1 auto; min-width: 0; }
.hero.patient-hero .hero-main h1 { overflow-wrap: anywhere; }
.hero.patient-hero .hero-cards { flex: 0 1 22rem; margin-left: auto; justify-content: flex-end; }
.hero.patient-hero .alert-card { width: 100%; min-width: 0; max-width: 22rem; }
@media (max-width: 760px) { .hero.patient-hero { flex-wrap: wrap; } .hero.patient-hero .hero-cards { flex-basis: 100%; } .hero.patient-hero .alert-card { max-width: none; } }
.hero.patient-hero .hero-cards { display: flex; flex: 0 0 auto; width: min(22rem, 45%); margin-left: auto; }
.hero.patient-hero .hero-main { flex: 1 1 0; }
.hero.patient-hero .alert-card { flex: 1 1 auto; width: 100%; max-width: none; }
@media (max-width: 760px) { .hero.patient-hero .hero-cards { width: 100%; } }

/* El aviso de bloqueo se muestra unos segundos y se retira; vuelve desde la etiqueta "Bloqueado". */
.lock-bar { transition: opacity .35s ease, transform .35s ease, visibility .35s; }
.lock-bar.away { opacity: 0; transform: translateY(1.5rem); visibility: hidden; pointer-events: none; }
button.badge.locked { cursor: pointer; font: inherit; font-size: .8rem; font-weight: 500; padding: .18rem .65rem; box-shadow: none; text-shadow: none; border-radius: 999px; }
button.badge.locked:hover { background: #ffecb8; filter: none; transform: none; box-shadow: none; }
@media (prefers-reduced-motion: reduce) { .lock-bar { transition: none; } }

/* ---------------------------------------------------------------------------
   Cajas
   --------------------------------------------------------------------------- */
.subtabs a svg { width: 1rem; height: 1rem; vertical-align: -2px; margin-right: .25rem; }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem .8rem; padding: .8rem 1rem; margin-bottom: .9rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.filters label { display: grid; gap: .2rem; margin: 0; font-size: .76rem; color: var(--muted); }
.filters input, .filters select { height: 2.3rem; }
.box-state { display: inline-block; padding: .14rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.box-state.open { background: var(--green-soft); color: var(--green-dark); }
.box-state.closed { background: var(--amber-soft); color: var(--amber); }
.box-state.reviewed { background: var(--blue-soft); color: var(--blue-dark); }
.move-kind { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.move-kind.payment { background: var(--green-soft); color: var(--green-dark); }
.move-kind.refund { background: var(--red-soft); color: var(--red); }
.move-kind.expense { background: var(--amber-soft); color: var(--amber); }
.move-kind.withdrawal { background: #eef1f5; color: var(--slate); }
table.arqueo tbody th, table.arqueo tfoot th { width: auto; color: var(--ink); font-weight: 600; }
table tfoot td, table tfoot th { border-top: 2px solid var(--line-strong); border-bottom: 0; background: #f7f9fb; font-weight: 600; }
table.cash-math { max-width: 34rem; }
.my-box form label { display: grid; gap: .2rem; font-size: .8rem; color: var(--muted); }
.hero-avatar svg { width: 1.8rem; height: 1.8rem; }
@media print { .filters, .subtabs { display: none !important; } .sheet-signs.print-only { display: grid !important; } }

/* Bloqueo que no se guardó porque hay pacientes con cita en el tramo (16 de octubre de 2026). */
.blk-attempt { margin-bottom: 1rem; border-color: color-mix(in srgb, var(--status-warning, #c28a2e) 45%, var(--line)); background: color-mix(in srgb, var(--status-warning, #c28a2e) 6%, var(--surface)); }
.blk-attempt h3 { display: flex; align-items: center; gap: .45rem; margin: 0 0 .35rem; font-size: 1rem; }
.blk-attempt h3 svg { width: 1.05rem; height: 1.05rem; color: #9a6a1a; }
.blk-attempt > p { margin: 0 0 .7rem; color: var(--slate); font-size: .88rem; }
.blk-attempt .blk-act { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; }
.blk-attempt .blk-act form { margin: 0; }
.blk-attempt .blk-branch small { display: block; color: var(--muted); font-size: .75rem; }

/* Cambiar el nombre del plan desde el encabezado: lápiz a la derecha del título; al pulsarlo, el campo ocupa su lugar. */
.hero-title { display: flex; flex-wrap: wrap; align-items: center; gap: 0 .5rem; }
.hero-title h1 { min-width: 0; overflow-wrap: anywhere; }
.hero-rn-toggle { position: absolute; opacity: 0; pointer-events: none; }
.hero-rn-btn { flex: none; display: inline-flex; padding: .3rem; border-radius: 8px; color: rgba(255, 255, 255, .85); cursor: pointer; }
.hero-rn-btn:hover, .hero-rn-toggle:checked + .hero-rn-btn { background: rgba(255, 255, 255, .18); color: #fff; }
.hero-rn-toggle:focus-visible + .hero-rn-btn { outline: 2px solid #fff; }
.hero-rn-btn .icon { width: 1.1rem; height: 1.1rem; }
.hero-rename-form { display: none; flex: 0 0 100%; gap: .5rem; align-items: center; margin: .3rem 0 .2rem; max-width: 30rem; }
.hero-rn-toggle:checked ~ .hero-rename-form { display: flex; }
.hero-rename-form input[name="name"] { flex: 1; min-width: 0; color: var(--text); }

/* Ortodoncia simplificada, paso 1: aviso tras evolucionar, chip del rol en la fila y mini formulario del control. */
.orto-notice { display: grid; gap: .25rem; padding: .6rem .85rem; margin: 0 0 1rem; }
.orto-notice p { margin: 0; display: flex; gap: .4rem; align-items: center; }
.orto-notice svg { width: 1rem; height: 1rem; flex: none; }
.item-sub .badge.orto-chip { margin-left: .4rem; font-size: .72rem; font-weight: 600; background: var(--teal-soft, #e6f6f4); color: #0b5f58; border-color: #a7ddd6; }
.evolve-pop fieldset.orto-mini { display: grid; gap: .4rem; margin: 0; padding: .45rem .6rem .55rem; border: 1px solid var(--line, #e4eaf1); border-radius: 8px; background: none; box-shadow: none; }
.orto-mini legend { padding: 0 .25rem; font-size: .78rem; font-weight: 600; color: #0b5f58; }
.orto-mini label { display: grid; gap: .15rem; margin: 0; font-size: .76rem; color: var(--muted); }
.orto-mini input, .orto-mini textarea { width: 100%; font: inherit; font-size: .84rem; }
.orto-mini-arcs { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.orto-line { display: flex; gap: .35rem; align-items: center; color: #0b5f58; }
.orto-line svg { width: .95rem; height: .95rem; }
.ocl-voided .ocl-ctl h3 a, .ocl-voided .ocl-ctl-kind, .ocl-voided .ocl-ctl-date { text-decoration: line-through; opacity: .7; }
.ocl-from-budget { display: flex; gap: .35rem; align-items: center; color: #475569; font-size: .84rem; }
.ocl-from-budget svg { width: .9rem; height: .9rem; }

/* CONSENT-02 (parte B): aviso ámbar de consentimiento en las ventanas de evolucionar del plan (solo informa). */
.cns-evo-warn { display: flex; align-items: flex-start; gap: .4rem; margin: .35rem 0; padding: .45rem .6rem; font-size: .8rem; line-height: 1.35; color: #7a5212; }
.cns-evo-warn svg { flex: none; width: .95rem; height: .95rem; margin-top: .1rem; color: #9a6a1a; }
/* Periodoncia (PERIO-FOLLOW-01): chip bajo una prestación pendiente que exige periodontograma y el paciente no lo tiene vigente. */
.perio-row { display: block; margin-top: .25rem; }
.perio-chip { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .55rem; border-radius: 999px; border: 1px solid #f2d9a6; background: #fdf5e6; color: #7a5212; font-size: .76rem; font-weight: 600; line-height: 1.5; white-space: nowrap; text-decoration: none; vertical-align: middle; }
.perio-chip svg { width: .85rem; height: .85rem; color: #9a6a1a; }
.perio-chip:hover { border-color: #e0b866; text-decoration: underline; }
.perio-chip:focus-visible { outline: 2px solid var(--brand-focus, #4F46E5); outline-offset: 2px; }
.plan.selecting .cns-evo-bulk.bulk-only { display: flex; flex-basis: 100%; }

/* Dónde se realiza cada prestación (migración 135): rótulo en el catálogo y aviso al agregar al presupuesto. */
.svc-name .svc-where { display: block; font-size: .75rem; color: var(--muted, #667085); font-weight: 450; }
.od-place-note { color: #9a6a1a; font-weight: 560; margin: 0; }

/* Estado de la cuenta en Usuarios y ayuda de la contraseña temporal (SEC-02). */
.usr-account { display: block; margin-top: .2rem; font-size: .72rem; font-weight: 600; white-space: nowrap; }
.usr-account.warn { color: #9a6a1a; }
.usr-account.off { color: #c53a3a; }
.usr-temp-help { grid-column: 1 / -1; margin: 0; font-size: .84rem; color: var(--muted, #667085); }
