/* DentiClínica BI — estilos
   Los colores de marca (--brand, --brand-2) se reemplazan en tiempo real con los de la
   compañía en Odoo (ver js/core.js → applyBranding). */

:root {
  color-scheme: light;
  --brand: #0e7c86;
  --brand-2: #e39b3a;
  --brand-ink: #ffffff;           /* texto sobre --brand (se recalcula por contraste) */
  --brand-wash: color-mix(in oklab, var(--brand) 9%, var(--surface));

  --paper: #f5f7f7;
  --surface: #ffffff;
  --ink: #16232b;
  --ink-2: #55666e;
  --ink-3: #85949a;
  --line: #d9e1e3;
  --line-soft: #e9eef0;
  --grid: #e6ebec;

  --good: #0ca30c;
  --good-ink: #006300;
  --warn: #fab219;
  --warn-ink: #8a5a00;
  --bad: #d03b3b;
  --bad-ink: #b02a2a;

  /* Paleta categórica validada (orden fijo, nunca se cicla) */
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;

  --radius: 10px;
  --radius-sm: 6px;
  --sidebar: 248px;
  --font: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --focus: 0 0 0 3px color-mix(in oklab, var(--brand) 35%, transparent);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0e1316; --surface: #151c20; --ink: #edf2f3; --ink-2: #aab7bc; --ink-3: #7d8b90;
    --line: #2a353a; --line-soft: #20292d; --grid: #243035;
    --good-ink: #3ccf3c; --warn-ink: #f5b941; --bad-ink: #f07a7a;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0e1316; --surface: #151c20; --ink: #edf2f3; --ink-2: #aab7bc; --ink-3: #7d8b90;
  --line: #2a353a; --line-soft: #20292d; --grid: #243035;
  --good-ink: #3ccf3c; --warn-ink: #f5b941; --bad-ink: #f07a7a;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5;
  color: var(--ink); background: var(--paper);
}
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 650; }
h1 { font-size: 1.75rem; letter-spacing: -0.015em; }
h2 { font-size: 1.0625rem; }
h3 { font-size: 0.9375rem; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
[hidden] { display: none !important; }
.muted { color: var(--ink-2); }
.small { font-size: 0.8125rem; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* -------------------------------------------------------------- controles */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px;
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface);
  font-weight: 600; font-size: 0.875rem; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--line-soft); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: color-mix(in oklab, var(--brand) 88%, black); }
.btn-danger { color: var(--bad-ink); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 0.8125rem; }
.btn[disabled] { opacity: 0.55; cursor: progress; }

.field { display: grid; gap: 6px; }
.field > span { font-size: 0.8125rem; font-weight: 600; color: var(--ink-2); }
.input, select.input, textarea.input {
  height: 38px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); min-width: 0; width: 100%;
}
textarea.input { height: auto; padding: 8px 12px; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
.check { display: flex; align-items: center; gap: 10px; padding: 6px 0; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }

.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.segmented button { border: 0; background: none; padding: 0 12px; height: 34px; font-size: 0.8125rem; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button[aria-pressed="true"] { background: var(--brand-wash); color: var(--ink); box-shadow: inset 0 -2px 0 var(--brand); }

.alert { padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); }
.alert-error { border-color: color-mix(in oklab, var(--bad) 45%, var(--line)); color: var(--bad-ink); }
.alert-ok { border-color: color-mix(in oklab, var(--good) 45%, var(--line)); color: var(--good-ink); }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--line-soft); color: var(--ink-2); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.good { color: var(--good-ink); } .badge.warn { color: var(--warn-ink); } .badge.bad { color: var(--bad-ink); }
.chip { display: inline-block; font-size: 0.75rem; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); margin: 2px 4px 2px 0; }

/* ------------------------------------------------------------- estructura */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
  padding: 20px 14px; background: var(--surface); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; text-decoration: none; }
.brand img { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; background: var(--surface); }
.brand .mark { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; background: var(--brand); color: var(--brand-ink); font-weight: 700; }
.brand b { display: block; font-size: 0.9375rem; line-height: 1.15; }
.brand small { color: var(--ink-3); font-size: 0.75rem; }
.nav-group { margin: 14px 8px 4px; font-size: 0.75rem; color: var(--ink-3); font-weight: 600; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--ink-2); font-weight: 550; font-size: 0.9rem;
}
.nav a:hover { background: var(--line-soft); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--brand-wash); color: var(--ink); box-shadow: inset 3px 0 0 var(--brand); }
.nav svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line); padding: 14px 8px 0; display: grid; gap: 8px; }
.user-line { font-size: 0.8125rem; } .user-line b { display: block; }

.main { min-width: 0; padding: 28px 36px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { color: var(--ink-2); margin-top: 6px; max-width: 70ch; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.toolbar .input { width: auto; }
.menu-toggle { display: none; }

/* --------------------------------------------------------------- KPIs */
.kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 20px;
}
.kpi { padding: 18px 20px; border-left: 1px solid var(--line-soft); min-width: 0; }
.kpi:first-child { border-left: 0; }
.kpi .label { font-size: 0.8125rem; color: var(--ink-2); font-weight: 550; }
.kpi .value { font-size: 1.75rem; font-weight: 650; letter-spacing: -0.02em; margin-top: 4px; white-space: nowrap; }
.kpi:first-child .value { font-size: 2.25rem; }
.kpi .delta { font-size: 0.8125rem; margin-top: 4px; color: var(--ink-2); }
.delta .up { color: var(--good-ink); font-weight: 650; }
.delta .down { color: var(--bad-ink); font-weight: 650; }
.kpi .meter { margin-top: 10px; }

/* ------------------------------------------------------- paneles y grid */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; min-width: 0; }
.panel.wide { grid-column: 1 / -1; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.chart-box { position: relative; height: 280px; }
.chart-box.tall { height: 360px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.8125rem; color: var(--ink-2); margin-bottom: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.loading { opacity: 0.5; transition: opacity 0.2s; }
.empty { padding: 36px 12px; text-align: center; color: var(--ink-2); }

/* -------------------------------------------------------------- tablas */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
table.data th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: 0.8125rem; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.data td.n, table.data th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tbody tr:hover { background: color-mix(in oklab, var(--line-soft) 60%, transparent); }
table.data tfoot td { font-weight: 650; border-top: 1px solid var(--line); border-bottom: 0; }
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; margin-top: 12px; font-size: 0.8125rem; }

/* ----------------------------------------------------- metas: la regla */
.metas { display: grid; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.meta-row { display: grid; grid-template-columns: minmax(180px, 1.1fr) minmax(240px, 2fr) minmax(150px, 0.8fr); gap: 20px; align-items: center; padding: 18px 20px; border-top: 1px solid var(--line-soft); }
.meta-row:first-child { border-top: 0; }
.meta-row .who { font-size: 0.8125rem; color: var(--ink-2); }
.meta-row .figs { text-align: right; font-size: 0.875rem; }
.meta-row .figs b { font-size: 1.25rem; display: block; }

.ruler { position: relative; height: 34px; }
.ruler .track {
  position: absolute; left: 0; right: 0; top: 10px; height: 12px; border-radius: 3px;
  background:
    repeating-linear-gradient(90deg, transparent 0 calc(20% - 1px), color-mix(in oklab, var(--ink-3) 55%, transparent) calc(20% - 1px) 20%),
    color-mix(in oklab, var(--brand) 10%, var(--line-soft));
}
.ruler .fill { position: absolute; left: 0; top: 10px; height: 12px; border-radius: 3px 0 0 3px; background: var(--brand); max-width: 100%; transform-origin: left; }
.ruler .fill.over { border-radius: 3px; }
.ruler .proj { position: absolute; top: 6px; width: 2px; height: 20px; background: var(--ink); opacity: 0.55; }
.ruler .goal { position: absolute; top: 2px; width: 2px; height: 28px; background: var(--ink); }
.ruler .ticks { position: absolute; left: 0; right: 0; top: 24px; display: flex; justify-content: space-between; font-size: 0.6875rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: no-preference) {
  .ruler .fill { animation: grow 0.7s cubic-bezier(.2,.7,.2,1) both; }
  @keyframes grow { from { transform: scaleX(0); } }
}

.meter { height: 6px; border-radius: 3px; background: color-mix(in oklab, var(--brand) 14%, var(--line-soft)); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--brand); border-radius: 3px; }

/* ------------------------------------------------------- tabs y diálogos */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--brand); }

dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 0; width: min(560px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); }
dialog::backdrop { background: rgba(10, 20, 25, 0.45); }
dialog form { display: grid; gap: 14px; padding: 22px; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 12px; }

.toast { position: fixed; bottom: 20px; right: 20px; background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: var(--radius-sm); font-size: 0.875rem; z-index: 50; }

/* --------------------------------------------------------------- login */
.login { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.login-brand {
  background: var(--brand); color: var(--brand-ink); padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.login-brand::after {
  /* marcas de sonda periodontal: bandas cada 3 mm */
  content: ""; position: absolute; right: 48px; top: 0; bottom: 0; width: 10px;
  background: repeating-linear-gradient(180deg, color-mix(in oklab, var(--brand-ink) 35%, transparent) 0 30px, transparent 30px 60px);
  opacity: 0.6;
}
.login-brand img { width: 64px; height: 64px; object-fit: contain; background: #fff; border-radius: 12px; padding: 6px; }
.login-brand h1 { font-size: clamp(2.25rem, 5vw, 3.75rem); letter-spacing: -0.03em; max-width: 12ch; margin-top: 24px; }
.login-brand p { max-width: 42ch; opacity: 0.9; margin-top: 12px; font-size: 1.0625rem; }
.login-form { display: grid; place-items: center; padding: 32px 20px; background: var(--surface); }
.login-form form { width: min(380px, 100%); display: grid; gap: 16px; }
.login-form h2 { font-size: 1.5rem; }

/* ----------------------------------------------------------- explorador */
.explorer { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.explorer aside { display: grid; gap: 16px; }
.explorer fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px 10px; margin: 0; max-height: 260px; overflow: auto; }
.explorer legend { font-size: 0.8125rem; font-weight: 600; color: var(--ink-2); padding: 0 4px; }
.order-badge { margin-left: auto; font-size: 0.6875rem; font-weight: 700; color: var(--brand-ink); background: var(--brand); border-radius: 999px; min-width: 18px; text-align: center; }

.home-list { display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.home-list a { display: grid; grid-template-columns: 40px 1fr auto; gap: 14px; align-items: center; padding: 16px 20px; text-decoration: none; border-top: 1px solid var(--line-soft); }
.home-list a:first-child { border-top: 0; }
.home-list a:hover { background: var(--brand-wash); }
.home-list .ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-wash); color: var(--brand); }
.home-list .ic svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.home-list b { display: block; }
.home-list span.muted { font-size: 0.875rem; }

/* ----------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .grid { grid-template-columns: 1fr; }
  .explorer { grid-template-columns: 1fr; }
  .meta-row { grid-template-columns: 1fr; gap: 8px; }
  .meta-row .figs { text-align: left; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; width: min(280px, 85vw); transform: translateX(-105%); transition: transform 0.2s; box-shadow: 0 0 0 100vmax transparent; }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(10, 20, 25, 0.4); }
  .menu-toggle { display: inline-flex; }
  .main { padding: 16px 16px 48px; }
  .login { grid-template-columns: 1fr; }
  .login-brand { padding: 28px 20px; min-height: 0; }
  .login-brand::after { display: none; }
  .login-brand h1 { margin-top: 16px; }
  .form-grid, .checks { grid-template-columns: 1fr; }
  .kpi { border-left: 0; border-top: 1px solid var(--line-soft); }
  .kpi:first-child { border-top: 0; }
  .chart-box { height: 240px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ------------------------------------------------------------ gráficas SVG */
.chart-box { outline: none; }
.chart-box:focus-visible { box-shadow: var(--focus); border-radius: var(--radius-sm); }
.chart-box svg { display: block; overflow: visible; }
.viz-tick { fill: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz-cat { fill: var(--ink-2); font-size: 12px; }
.viz-val { fill: var(--ink-2); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.viz-center { fill: var(--ink); font-size: 18px; font-weight: 650; }
.viz-tip {
  display: none; position: absolute; z-index: 5; pointer-events: none; min-width: 140px; max-width: 260px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: 0 6px 20px rgba(10, 20, 25, 0.12); padding: 8px 10px; font-size: 0.8125rem;
}
.viz-tip-t { color: var(--ink-2); margin-bottom: 4px; }
.viz-tip-r { display: flex; align-items: center; gap: 8px; }
.viz-tip-r i { width: 12px; height: 3px; border-radius: 2px; flex: none; }
.viz-tip-r b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.viz-tip-r span { color: var(--ink-2); }
.explorer aside > *, .explorer fieldset { min-width: 0; }
.menu-toggle { width: 40px; height: 40px; padding: 0; justify-content: center; margin: -4px 0 8px -8px; }
.menu-toggle svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; }
@media (max-width: 820px) {
  .segmented { max-width: 100%; overflow-x: auto; }
  .segmented button { white-space: nowrap; flex: none; }
}
.explorer input[type="date"] { flex: 1 1 0; min-width: 0; }

/* ------------------------------------------------- filtros por clic */
.chart-box.selectable svg { cursor: pointer; }
.viz-tip-hint { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line-soft); color: var(--ink-3); font-size: 0.75rem; }
.filtros-activos { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -8px 0 18px; }
.filtros-activos > span { font-size: 0.8125rem; color: var(--ink-2); }
.filtro-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 6px 0 12px; border-radius: 999px;
  border: 1px solid color-mix(in oklab, var(--brand) 45%, var(--line)); background: var(--brand-wash);
  font-size: 0.8125rem; font-weight: 600; cursor: pointer; color: var(--ink);
}
.filtro-chip small { font-weight: 500; color: var(--ink-2); }
.filtro-chip b { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-size: 0.875rem; }
.filtro-chip:hover b { background: color-mix(in oklab, var(--brand) 20%, transparent); }

/* --------------------------------------------- metas: velocímetros y real vs. meta */
:root { --serious: #ec835a; }
.gauges { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; margin-bottom: 16px; }
.gauge { display: grid; justify-items: center; gap: 4px; padding-bottom: 16px; }
.gauge-head { justify-self: stretch; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.gauge-svg { max-width: 280px; overflow: visible; }
.gauge-valor { font-size: 2rem; font-weight: 650; letter-spacing: -0.02em; margin-top: -6px; }
.gauge-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.gauge-aguja { transition: transform 0.9s cubic-bezier(.2, .8, .2, 1); }
@media (prefers-reduced-motion: reduce) { .gauge-aguja { transition: none; } }
.viz-pct { font-size: 11px; font-weight: 700; fill: var(--ink); font-variant-numeric: tabular-nums; }
.viz-pct.ok { fill: var(--good-ink); }
.viz-pct.bajo { fill: var(--bad-ink); }
.viz-pct.cerca { fill: var(--warn-ink); }
.anual-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.viz-pct.riesgo { fill: color-mix(in oklab, var(--serious) 70%, var(--ink)); }
.viz-pct.curso { fill: var(--ink-3); }

/* -------------------------- barra lateral en ventanas bajas
   El menú se desplaza por dentro; marca y usuario quedan siempre visibles. */
.sidebar { overflow: hidden; }
.sidebar > .brand, .sidebar > .sidebar-foot { flex: none; }
.sidebar > .nav {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  margin: 0 -6px; padding: 0 6px 8px;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
  /* sombra suave que indica que hay más opciones al desplazar */
  background:
    linear-gradient(var(--surface) 30%, transparent) top / 100% 24px no-repeat local,
    linear-gradient(transparent, var(--surface) 70%) bottom / 100% 24px no-repeat local,
    linear-gradient(color-mix(in oklab, var(--ink) 10%, transparent), transparent) top / 100% 8px no-repeat scroll,
    linear-gradient(transparent, color-mix(in oklab, var(--ink) 10%, transparent)) bottom / 100% 8px no-repeat scroll;
}
.sidebar-foot { margin-top: 0; padding-top: 12px; }
@media (max-height: 760px) {
  .sidebar { padding: 14px 12px; gap: 2px; }
  .brand { padding-bottom: 10px; }
  .nav a { padding: 6px 10px; }
  .nav-group { margin: 10px 8px 2px; }
  .sidebar-foot { padding-top: 10px; gap: 6px; }
  .sidebar-foot .btn { height: 30px; }
}
@media (max-height: 560px) {
  .sidebar-foot .user-line span { display: none; }  /* oculta el correo, deja el nombre */
}

/* ------------------------------------------- secciones plegables del menú */
.nav-sec { display: grid; }
button.nav-group {
  display: flex; align-items: center; gap: 6px; width: calc(100% - 8px); margin: 12px 4px 2px; padding: 4px 6px;
  border: 0; border-radius: var(--radius-sm); background: none; cursor: pointer;
  font-size: 0.75rem; font-weight: 600; color: var(--ink-3); text-align: left;
}
button.nav-group:hover { color: var(--ink); background: var(--line-soft); }
button.nav-group > span:first-child { flex: 1; }
button.nav-group svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round;
  stroke-linejoin: round; transition: transform 0.15s; }
button.nav-group[aria-expanded="false"] svg { transform: rotate(-90deg); }
.nav-count { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink-3); }
@media (max-height: 760px) { button.nav-group { margin-top: 8px; } }
@media (prefers-reduced-motion: reduce) { button.nav-group svg { transition: none; } }
