/* CareHealth — dos temas: "glass" (Liquid Glass con colores Amebium, predeterminado) y "light". */
:root {
  --ink: #0d1f21;
  --text: #0d1f21;
  --ink-2: #3b5153;
  --muted: #6b7f80;
  --line: #dde7e5;
  --bg: #f3f7f6;
  --card: #ffffff;
  --field: #ffffff;
  --mint: #6dd2c1;
  --teal: #1f7a6d;
  --lime: #cafb9c;
  --green: #3d9468;
  --danger: #c2413a;
  --warn: #b7791f;
  --chip-bg: #e9f6f3;
  --chip-line: #cdece6;
  --hover: rgba(13, 31, 33, .05);
  --chart-grid: #e6eeec;
  --chart-line: #0d1f21;
  --chart-dot: #ffffff;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(13, 31, 33, .06), 0 8px 24px rgba(13, 31, 33, .05);
  /* Acento de marca para el vidrio (verde agua Amebium) */
  --brand-rgb: 38, 166, 146;
  --brand-hover-rgb: 24, 118, 104;
  color-scheme: light;
}

:root[data-theme="glass"] {
  --text: #f2fbfa;
  --ink-2: rgba(242, 251, 250, .82);
  --muted: rgba(242, 251, 250, .66);
  --line: rgba(255, 255, 255, .16);
  --bg: #050b0d;
  --card: rgba(255, 255, 255, .08);
  --field: rgba(255, 255, 255, .08);
  --teal: #7fe3d2;
  --green: #8ee8a8;
  --danger: #ff8a80;
  --warn: #ffcf70;
  --chip-bg: rgba(109, 210, 193, .14);
  --chip-line: rgba(109, 210, 193, .32);
  --hover: rgba(255, 255, 255, .1);
  --chart-grid: rgba(255, 255, 255, .1);
  --chart-line: #e9fffb;
  --chart-dot: #0b1b1d;
  --radius: 18px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
a { color: var(--teal); }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
.muted { color: var(--muted); }
.mono { font-family: 'Geist Mono', ui-monospace, monospace; }
.boot { padding: 40vh 16px; text-align: center; color: var(--muted); }
[hidden] { display: none !important; }
svg.icon { width: 20px; height: 20px; flex: none; }

/* ===== Liquid Glass: fondo difuminado fijo (capa en body::before, funciona en iOS) ===== */
:root[data-theme="glass"] body { background: transparent; }
:root[data-theme="glass"] { background: #050b0d; }
:root[data-theme="glass"] body::before {
  content: ''; position: fixed; inset: -24px; z-index: -1; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(4, 10, 12, .55) 0%, rgba(4, 10, 12, .70) 60%, rgba(4, 10, 12, .84) 100%),
    url('/assets/bg-hero.jpg') 70% center / cover no-repeat;
  filter: blur(6px) saturate(115%);
}
:root[data-theme="glass"] .card,
:root[data-theme="glass"] .treatment {
  backdrop-filter: blur(22px) saturate(160%); -webkit-backdrop-filter: blur(22px) saturate(160%);
  background: linear-gradient(135deg, rgba(255, 255, 255, .10) 0%, rgba(255, 255, 255, .04) 100%);
  border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 8px 32px rgba(0, 0, 0, .30), inset 0 1px 0 rgba(255, 255, 255, .22);
}
:root[data-theme="glass"] .treatment { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16); }
/* Reflejo que cruza + elevación al pasar el cursor */
:root[data-theme="glass"] .glass-hover { position: relative; overflow: hidden; transition: transform 250ms ease, box-shadow 250ms ease; }
:root[data-theme="glass"] .glass-hover::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, .14) 50%, transparent 70%);
  transform: translateX(-120%); transition: transform 700ms ease;
}
:root[data-theme="glass"] .glass-hover:hover { transform: translateY(-2px); box-shadow: 0 14px 40px rgba(0, 0, 0, .38), inset 0 1px 0 rgba(255, 255, 255, .28); }
:root[data-theme="glass"] .glass-hover:hover::after { transform: translateX(120%); }

/* ===== Encabezado ===== */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--ink); color: #dafdfb;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
}
:root[data-theme="glass"] .topbar {
  backdrop-filter: blur(18px) saturate(160%); -webkit-backdrop-filter: blur(18px) saturate(160%);
  background: linear-gradient(135deg, rgba(255, 255, 255, .10) 0%, rgba(255, 255, 255, .04) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, .12);
  transition: backdrop-filter .35s ease, background .35s ease, box-shadow .35s ease;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .45);
}
:root[data-theme="glass"] .topbar.is-scrolled {
  backdrop-filter: blur(44px) saturate(185%); -webkit-backdrop-filter: blur(44px) saturate(185%);
  background: linear-gradient(135deg, rgba(20, 44, 46, .72) 0%, rgba(12, 30, 32, .62) 100%);
  box-shadow: 0 10px 36px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .18);
}
/* Escritorio con vidrio: el encabezado es un panel flotante. */
@media (min-width: 1024px) {
  :root[data-theme="glass"] .topbar { top: 16px; margin: 16px 25px 0; border-radius: 18px; border: 1px solid rgba(255, 255, 255, .15); }
}
.topbar-inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 12px; min-height: 44px; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 600; min-width: 0; }
.brand img { width: 30px; height: 30px; flex: none; }
.brand small { display: block; font-weight: 400; font-size: 11px; color: var(--mint); letter-spacing: .08em; text-transform: uppercase; }
.nav { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.nav a, .header-btn {
  display: inline-flex; align-items: center; gap: 6px;
  color: #dafdfb; text-decoration: none; background: none; border: 0; font: inherit;
  padding: 7px 12px; border-radius: 999px; cursor: pointer; font-size: 14px; white-space: nowrap;
}
.nav a:hover, .header-btn:hover { background: rgba(218, 253, 251, .1); }
.nav a.on { background: var(--lime); color: var(--ink); text-shadow: none; }
:root[data-theme="glass"] .nav a.on, :root[data-theme="glass"] .drawer-link.on { background: linear-gradient(135deg, rgb(var(--brand-rgb)), rgb(var(--brand-hover-rgb))); color: #fff; box-shadow: 0 0 0 1px rgba(255, 255, 255, .14), 0 6px 20px rgba(var(--brand-rgb), .5), 0 0 24px rgba(var(--brand-rgb), .4); }
.user-chip { text-align: right; line-height: 1.15; font-size: 13px; padding: 0 4px; }
.user-chip small { display: block; color: var(--mint); font-size: 11px; }
.menu-btn { display: none; color: #dafdfb; background: none; border: 0; width: 44px; height: 44px; margin-left: -8px; border-radius: 12px; cursor: pointer; align-items: center; justify-content: center; }
.menu-btn:hover { background: rgba(218, 253, 251, .1); }
.menu-btn svg { width: 24px; height: 24px; }

/* Menos de 1024px: la navegación se mueve al menú lateral (drawer). */
@media (max-width: 1023px) {
  .menu-btn { display: inline-flex; }
  .nav, .user-chip, .desktop-only { display: none !important; }
}

/* ===== Menú lateral (drawer) =====
   Va fuera del encabezado: si viviera dentro de un elemento con backdrop-filter, "fixed" quedaría
   limitado a la altura del encabezado y en vertical no se vería. */
.drawer-overlay { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .5); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); opacity: 0; transition: opacity .3s ease; }
.drawer-overlay.open { opacity: 1; }
.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 50;
  width: 280px; max-width: 85vw; height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--ink); color: #dafdfb;
  padding-top: env(safe-area-inset-top, 0px); padding-left: env(safe-area-inset-left, 0px);
  transform: translateX(-105%); visibility: hidden;
  transition: transform .3s ease-in-out, visibility 0s linear .3s;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .38);
}
.drawer.open { transform: translateX(0); visibility: visible; transition: transform .3s ease-in-out, visibility 0s; }
:root[data-theme="glass"] .drawer {
  backdrop-filter: blur(34px) saturate(180%); -webkit-backdrop-filter: blur(34px) saturate(180%);
  background: linear-gradient(160deg, rgba(30, 60, 62, .62) 0%, rgba(10, 24, 26, .78) 100%);
  border-right: 1px solid rgba(255, 255, 255, .16);
}
.drawer-head { display: flex; align-items: center; gap: 10px; height: 64px; padding: 0 12px 0 20px; border-bottom: 1px solid rgba(255, 255, 255, .1); flex: none; }
.drawer-head .brand { flex: 1; }
.drawer-close { color: inherit; background: none; border: 0; width: 44px; height: 44px; border-radius: 12px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.drawer-close:hover { background: rgba(255, 255, 255, .1); }
.drawer-nav { flex: 1; overflow-y: auto; padding: 16px 12px; display: grid; gap: 22px; align-content: start; }
.drawer-group p, .drawer-label { margin: 0 0 8px; padding: 0 12px; font-size: 10px; font-weight: 600; letter-spacing: .12em; color: rgba(218, 253, 251, .55); }
.drawer-link { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 12px; border-radius: 12px; color: rgba(218, 253, 251, .85); text-decoration: none; font-size: 14px; font-weight: 500; }
.drawer-link:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.drawer-link.on { background: var(--lime); color: var(--ink); }
.drawer-foot { flex: none; border-top: 1px solid rgba(255, 255, 255, .1); padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 12px; }
.drawer-user { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.drawer-user small { display: block; color: var(--mint); font-size: 12px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: rgba(109, 210, 193, .2); color: var(--lime); flex: none; }
.drawer-logout { justify-content: flex-start; color: #ffb4ad; border: 0; background: none; width: 100%; font: inherit; cursor: pointer; }

/* Selector de tema */
.segmented { display: inline-flex; gap: 4px; padding: 4px; border-radius: 16px; border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .06); }
.segmented button { min-height: 36px; padding: 0 12px; border: 0; border-radius: 12px; font: inherit; font-size: 13px; background: none; color: rgba(218, 253, 251, .8); cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--lime); color: var(--ink); }
:root[data-theme="glass"] .segmented button[aria-pressed="true"] { background: linear-gradient(135deg, rgb(var(--brand-rgb)), rgb(var(--brand-hover-rgb))); color: #fff; }

main.page { max-width: 1100px; margin: 0 auto; padding: 24px 16px 64px; animation: fade-in .4s ease both; }
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin: 4px 0 0; }
.back { display: inline-block; margin-bottom: 10px; font-size: 14px; text-decoration: none; }

/* Tarjetas */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.section { margin-top: 18px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: 14px; min-height: 40px;
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .15s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--ink); color: var(--lime); border-color: var(--ink); }
.btn.primary:hover { background: #17363a; }
:root[data-theme="glass"] .btn { background: rgba(255, 255, 255, .08); }
:root[data-theme="glass"] .btn.primary { background: linear-gradient(135deg, rgb(var(--brand-rgb)), rgb(var(--brand-hover-rgb))); color: #fff; border-color: rgba(255, 255, 255, .2); box-shadow: 0 6px 20px rgba(var(--brand-rgb), .35); }
:root[data-theme="glass"] .btn.primary:hover { background: rgb(var(--brand-hover-rgb)); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.small { padding: 5px 11px; font-size: 13px; font-weight: 500; min-height: 34px; }
.btn:disabled { opacity: .55; cursor: wait; }
.icon-btn { background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 8px; min-width: 36px; min-height: 36px; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--danger); cursor: pointer; font-size: 13px; }

/* Formularios */
label { display: grid; gap: 5px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
label.check { display: flex; align-items: center; gap: 8px; }
label.check input { width: 18px; height: 18px; }
input, select, textarea {
  font: inherit; font-size: 16px; color: var(--text);
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); width: 100%; min-height: 44px;
}
:root[data-theme="glass"] select option { background: #0f2224; color: #f2fbfa; }
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--mint); outline-offset: 0; border-color: var(--mint); }
textarea { min-height: 70px; resize: vertical; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.fields .full { grid-column: 1 / -1; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.inline-form label { flex: 1 1 140px; }
@media (max-width: 639px) { .fields { grid-template-columns: 1fr; } }
.form-error { color: var(--danger); font-size: 14px; margin: 8px 0 0; }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filters .search { flex: 1 1 260px; max-width: 420px; }
.filters select { width: auto; flex: 0 1 240px; }

/* Login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(circle at 30% 10%, #17363a, var(--ink) 60%); }
:root[data-theme="glass"] .login { background: none; }
.login-card { width: min(100%, 380px); display: grid; gap: 14px; }
.login-card .brand-mark { display: flex; align-items: center; gap: 10px; }
.login-card img { width: 42px; height: 42px; }
.login-foot { display: flex; justify-content: center; }

/* Lista de pacientes */
.patients { display: grid; gap: 10px; }
.patient-row {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.3fr) auto; gap: 16px; align-items: center;
  text-decoration: none; color: inherit; padding: 14px 18px;
}
.patient-row:hover { border-color: var(--mint); }
.patient-row .who strong { display: block; font-size: 16px; }
.patient-row .loss { text-align: right; }
.loss strong { font-size: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 3px 10px; border-radius: 999px; background: var(--chip-bg); color: var(--teal); border: 1px solid var(--chip-line); }
.chip.gray { background: transparent; color: var(--muted); border-color: var(--line); }
.chip button { background: none; border: 0; padding: 0; color: inherit; cursor: pointer; font-size: 15px; line-height: 1; }
@media (max-width: 700px) {
  .patient-row { grid-template-columns: 1fr auto; }
  .patient-row .meds { grid-column: 1 / -1; grid-row: 2; }
}

.down { color: var(--green); }
.up { color: var(--danger); }

/* Indicadores */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { padding: 14px 16px; }
.stat span { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat strong { display: block; font-size: 24px; margin-top: 4px; }
.stat small { color: var(--muted); font-size: 12.5px; }
.stat.hero { background: var(--ink); color: #dafdfb; border-color: var(--ink); }
.stat.hero span, .stat.hero small { color: var(--mint); }
.stat.hero strong { color: var(--lime); }
:root[data-theme="glass"] .stat.hero { background: linear-gradient(135deg, rgba(var(--brand-rgb), .55), rgba(var(--brand-hover-rgb), .35)); border-color: rgba(var(--brand-rgb), .6); box-shadow: 0 0 24px rgba(var(--brand-rgb), .35), inset 0 1px 0 rgba(255, 255, 255, .25); }
.bar { height: 6px; border-radius: 999px; background: var(--line); margin-top: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--green); border-radius: inherit; }

/* Gráfica */
.chart svg { width: 100%; height: auto; display: block; }
.chart svg text { fill: var(--muted); }
.chart .c-grid { stroke: var(--chart-grid); }
.chart .c-line { stroke: var(--chart-line); }
.chart .c-dot { fill: var(--chart-dot); stroke: var(--chart-line); }
.chart .c-goal { stroke: var(--green); }
.chart .c-marker { stroke: var(--mint); }
.chart svg text.c-label { fill: var(--teal); }
.chart-empty { padding: 40px 12px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 14px; height: 0; border-top: 2px solid; vertical-align: middle; margin-right: 6px; }

/* Tablas */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: var(--hover); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 560px) {
  .weights th:nth-child(4), .weights td:nth-child(4) { display: none; }
  td, th { padding: 9px 6px; }
}

/* Tratamientos */
.treatments { display: grid; gap: 10px; }
.treatment { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 8px; }
.treatment-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.treatment-top strong { font-size: 16px; }
.dose { font-family: 'Geist Mono', ui-monospace, monospace; font-size: 14px; color: var(--teal); }
.treatment .meta { font-size: 13px; color: var(--muted); }
.treatment .actions { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { font-size: 12px; padding: 2px 9px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.pill.active { background: #e2f5e9; color: #2f7d55; }
.pill.paused { background: #fbf1dd; color: #a06514; }
.pill.finished, .pill.off { background: #eef1f1; color: #6b7f80; }
.pill.admin { background: #e3ecfb; color: #2f5aa8; }
.pill.nurse { background: #e2f5f2; color: #1f7a6d; }
:root[data-theme="glass"] .pill.active { background: rgba(52, 211, 153, .18); color: #7ef0c0; }
:root[data-theme="glass"] .pill.paused { background: rgba(251, 191, 36, .18); color: #ffd36e; }
:root[data-theme="glass"] .pill.finished, :root[data-theme="glass"] .pill.off { background: rgba(255, 255, 255, .1); color: rgba(255, 255, 255, .7); }
:root[data-theme="glass"] .pill.admin { background: rgba(96, 165, 250, .2); color: #a9cdff; }
:root[data-theme="glass"] .pill.nurse { background: rgba(109, 210, 193, .2); color: #8ff0df; }
details.history summary { cursor: pointer; color: var(--muted); font-size: 14px; margin-top: 6px; }
details.history .treatment { opacity: .8; margin-top: 8px; }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }

/* Medicamentos y usuarios */
.meds-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.med-card { display: grid; gap: 10px; align-content: start; }
.med-card.off { opacity: .6; }
.users-table td small { display: block; color: var(--muted); font-size: 12.5px; }

/* Diálogos: centrados; en el teléfono, hoja inferior a lo ancho. */
dialog.dialog { border: 0; border-radius: 18px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: 90dvh; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); background: var(--card); color: var(--text); }
:root[data-theme="glass"] dialog.dialog {
  background: linear-gradient(160deg, rgba(28, 54, 56, .92), rgba(10, 24, 26, .95));
  border: 1px solid rgba(255, 255, 255, .16);
  backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
}
dialog::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(4px); }
@media (max-width: 639px) {
  dialog.dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 20px 20px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .dialog-form > footer { flex-direction: column-reverse; }
  .dialog-form > footer .btn { width: 100%; }
}
.dialog-form > header { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 6px; }
.dialog-body { padding: 10px 18px; max-height: 65dvh; overflow-y: auto; }
.dialog-form > .form-error { padding: 0 18px; }
.dialog-form > footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px 18px; }

#toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); translate: -50% 0; z-index: 100;
  background: var(--ink); color: #dafdfb; padding: 10px 18px; border-radius: 999px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s; max-width: calc(100vw - 32px); text-align: center;
}
:root[data-theme="glass"] #toast { background: rgba(14, 34, 36, .92); border: 1px solid rgba(255, 255, 255, .16); backdrop-filter: blur(20px); }
#toast.show { opacity: 1; }
#toast.error { background: var(--danger); color: #fff; }

/* Barra de desplazamiento con el acento de marca en el vidrio */
:root[data-theme="glass"], :root[data-theme="glass"] * { scrollbar-color: rgba(var(--brand-rgb), .6) transparent; }

@media (prefers-reduced-motion: reduce) {
  main.page, .drawer, .drawer-overlay, .glass-hover, .glass-hover::after { animation: none !important; transition: none !important; }
}
