/* ============================================================
   Sistema de diseño — Panel de administración y portal de profesores
   Preuniversitario Líder · v3 (oscuro por defecto, claro opcional)
   Patrones: menú lateral agrupado, barra superior con paleta Ctrl+K,
   tarjetas "bento" con borde fino y brillo, KPI con ícono,
   pastillas de estado, avatares con iniciales, formularios plegables.
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  --ad-bg: #0a0f1e;
  --ad-bg-glow-a: rgba(124, 92, 255, .16);
  --ad-bg-glow-b: rgba(255, 122, 48, .10);
  --ad-surface: #111830;
  --ad-surface-2: #172041;
  --ad-surface-3: #1e2850;
  --ad-border: rgba(148, 163, 220, .14);
  --ad-border-strong: rgba(148, 163, 220, .28);
  --ad-text: #eaeefb;
  --ad-muted: #9aa6c7;
  --ad-faint: #6c7898;
  --ad-accent: #ff7a30;
  --ad-accent-2: #ff9557;
  --ad-accent-ink: #1a0b02;
  --ad-violet: #8b7cff;
  --ad-cyan: #3fd8f5;
  --ad-ok: #34d399;   --ad-ok-bg: rgba(52, 211, 153, .14);
  --ad-warn: #fbbf24; --ad-warn-bg: rgba(251, 191, 36, .14);
  --ad-bad: #fb7185;  --ad-bad-bg: rgba(251, 113, 133, .14);
  --ad-info: #7dd3fc; --ad-info-bg: rgba(125, 211, 252, .13);
  --ad-sidebar: #0c1226;
  --ad-shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 12px 32px rgba(2, 6, 23, .45);
  --ad-shadow-pop: 0 20px 50px rgba(2, 6, 23, .6);
  --ad-r: 18px;
  --ad-r-sm: 11px;
}
:root[data-theme="light"] {
  --ad-bg: #f3f5fb;
  --ad-bg-glow-a: rgba(124, 92, 255, .10);
  --ad-bg-glow-b: rgba(255, 122, 48, .09);
  --ad-surface: #ffffff;
  --ad-surface-2: #f6f8fd;
  --ad-surface-3: #eaeefa;
  --ad-border: #e3e8f3;
  --ad-border-strong: #cfd7ea;
  --ad-text: #0f1a33;
  --ad-muted: #56648a;
  --ad-faint: #8390b0;
  --ad-accent: #d6470a;
  --ad-accent-2: #ee6217;
  --ad-accent-ink: #ffffff;
  --ad-violet: #6a52f0;
  --ad-cyan: #0891b2;
  --ad-ok: #0f8a5f;   --ad-ok-bg: #e3f6ee;
  --ad-warn: #a86400; --ad-warn-bg: #fff2d9;
  --ad-bad: #c0304a;  --ad-bad-bg: #fde8ec;
  --ad-info: #0b6aa8; --ad-info-bg: #e2f1fb;
  --ad-sidebar: #ffffff;
  --ad-shadow: 0 1px 2px rgba(15, 26, 51, .04), 0 8px 24px rgba(15, 26, 51, .06);
  --ad-shadow-pop: 0 20px 50px rgba(15, 26, 51, .18);
}

/* Reasigna las variables antiguas para que todo lo heredado (sim.css, estilos en línea) siga legible */
.ad-body {
  --white: var(--ad-surface);
  --bg: var(--ad-surface-2);
  --bg-alt: var(--ad-bg);
  --navy-900: var(--ad-text);
  --navy-800: var(--ad-text);
  --navy-700: var(--ad-muted);
  --text: var(--ad-text);
  --text-soft: var(--ad-muted);
  --text-faint: var(--ad-faint);
  --border: var(--ad-border);
  --orange-600: var(--ad-accent);
  --orange-500: var(--ad-accent-2);
  --radius-sm: var(--ad-r-sm);
  --radius-md: var(--ad-r);
  --radius-lg: var(--ad-r);
  color-scheme: dark;
}
:root[data-theme="light"] .ad-body { color-scheme: light; }

.ad-body {
  background:
    radial-gradient(900px 520px at 85% -10%, var(--ad-bg-glow-a), transparent 60%),
    radial-gradient(700px 480px at -5% 110%, var(--ad-bg-glow-b), transparent 60%),
    var(--ad-bg);
  background-attachment: fixed;
  color: var(--ad-text);
  min-height: 100vh;
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}
.ad-body a { color: var(--ad-accent-2); }
.ad-body h1, .ad-body h2, .ad-body h3 { font-family: var(--font-display); color: var(--ad-text); letter-spacing: -.01em; }
.ad-body :focus-visible { outline: 2px solid var(--ad-violet); outline-offset: 2px; border-radius: 6px; }
.ad-body ::selection { background: rgba(139, 124, 255, .35); }
.ic { width: 20px; height: 20px; flex-shrink: 0; }
.ad-body .sim-muted { color: var(--ad-muted); }
.ad-body hr { border: 0; border-top: 1px solid var(--ad-border); margin: 18px 0; }
.ad-body code, .ad-body .mono { background: var(--ad-surface-3); padding: 2px 7px; border-radius: 6px; font-size: .85em; }

.ad-shell { display: flex; min-height: 100vh; align-items: stretch; }

/* ---------- Menú lateral ---------- */
.ad-sidebar {
  width: 268px; flex-shrink: 0; background: var(--ad-sidebar);
  border-right: 1px solid var(--ad-border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 40;
  scrollbar-width: thin;
}
.ad-sidebar__brand { display: flex; align-items: center; gap: 12px; padding: 22px 22px 14px; }
.ad-sidebar__brand img { width: 38px; height: 38px; flex-shrink: 0; }
.ad-sidebar__brand-text { font-family: var(--font-display); font-size: 1rem; line-height: 1.2; color: var(--ad-text); font-weight: 600; }
.ad-sidebar__brand-text strong { color: var(--ad-accent-2); font-weight: 700; }
.ad-sidebar__role { display: block; font-size: .68rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--ad-faint); margin-top: 3px; }
.ad-sidebar__close { display: none; }

.ad-nav { flex: 1; padding: 6px 14px 14px; }
.ad-nav__group { margin-top: 18px; }
.ad-nav__group:first-child { margin-top: 8px; }
.ad-nav__label { font-size: .66rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ad-faint); padding: 0 12px 7px; }
.ad-nav a {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 12px; margin-bottom: 2px;
  border-radius: 11px; color: var(--ad-muted); font-weight: 600; font-size: .88rem; text-decoration: none;
  transition: background .15s, color .15s;
}
.ad-body .ad-nav a { color: var(--ad-muted); }
.ad-nav a:hover { background: var(--ad-surface-2); color: var(--ad-text); }
.ad-body .ad-nav a:hover { color: var(--ad-text); }
.ad-nav a.on, .ad-body .ad-nav a.on {
  color: var(--ad-text);
  background: linear-gradient(90deg, rgba(255, 122, 48, .20), rgba(139, 124, 255, .10));
  box-shadow: inset 0 0 0 1px rgba(255, 122, 48, .30);
}
.ad-nav a.on .ic { color: var(--ad-accent-2); }
.ad-nav a.on::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 4px 4px 0; background: var(--ad-accent); box-shadow: 0 0 14px var(--ad-accent); }

.ad-sidebar__footer { padding: 14px; border-top: 1px solid var(--ad-border); display: flex; flex-direction: column; gap: 10px; }
.ad-sidebar__user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ad-sidebar__user-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.ad-sidebar__user-t b { font-size: .86rem; color: var(--ad-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-sidebar__user-t small { font-size: .72rem; color: var(--ad-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-logout { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 9px 12px; border-radius: 11px; border: 1px solid var(--ad-border); background: transparent; color: var(--ad-muted); font: 600 .84rem var(--font-body); cursor: pointer; transition: all .15s; }
.ad-logout:hover { border-color: var(--ad-bad); color: var(--ad-bad); background: var(--ad-bad-bg); }
.ad-logout .ic { width: 17px; height: 17px; }

.ad-avatar {
  display: inline-grid; place-items: center; width: 34px; height: 34px; flex-shrink: 0; border-radius: 50%;
  background: linear-gradient(135deg, var(--ad-violet), var(--ad-accent)); color: #fff;
  font: 700 .74rem var(--font-display); letter-spacing: .02em;
}

/* ---------- Barra superior ---------- */
.ad-main { flex: 1; min-width: 0; padding: 0 36px 80px; max-width: 1360px; }
.ad-topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 16px 0;
  margin-bottom: 6px; background: linear-gradient(var(--ad-bg) 60%, transparent); backdrop-filter: blur(8px);
}
.ad-topbar__right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.ad-iconbtn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--ad-border); background: var(--ad-surface); color: var(--ad-muted); cursor: pointer; transition: all .15s; }
.ad-iconbtn:hover { color: var(--ad-text); border-color: var(--ad-border-strong); }
.ad-menu-btn { display: none; }
.ad-cmdk { display: flex; align-items: center; gap: 10px; flex: 1; max-width: 420px; height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--ad-border); background: var(--ad-surface); color: var(--ad-faint); font: 500 .86rem var(--font-body); cursor: pointer; text-align: left; transition: border-color .15s; }
.ad-cmdk:hover { border-color: var(--ad-border-strong); }
.ad-cmdk span { flex: 1; }
.ad-cmdk kbd { font: 600 .68rem var(--font-body); padding: 3px 7px; border-radius: 6px; border: 1px solid var(--ad-border); color: var(--ad-faint); background: var(--ad-surface-2); }
.ad-chip-user { display: inline-flex; align-items: center; gap: 9px; height: 40px; padding: 0 14px 0 4px; border-radius: 999px; border: 1px solid var(--ad-border); background: var(--ad-surface); font-weight: 600; font-size: .84rem; color: var(--ad-text); max-width: 200px; }
.ad-chip-user span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-chip-user .ad-avatar { width: 30px; height: 30px; }
.ic-sun { display: none; }
:root[data-theme="light"] .ic-sun { display: block; }
:root[data-theme="light"] .ic-moon { display: none; }

/* Paleta de comandos */
.ad-cmd { position: fixed; inset: 0; z-index: 100; background: rgba(3, 7, 18, .6); backdrop-filter: blur(4px); display: flex; justify-content: center; align-items: flex-start; padding-top: 14vh; }
.ad-cmd[hidden] { display: none; }
.ad-cmd__box { width: min(560px, calc(100vw - 32px)); background: var(--ad-surface); border: 1px solid var(--ad-border-strong); border-radius: 16px; box-shadow: var(--ad-shadow-pop); overflow: hidden; }
.ad-cmd__in { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--ad-border); color: var(--ad-faint); }
.ad-cmd__in input { flex: 1; background: transparent; border: 0; outline: none; color: var(--ad-text); font: 500 1rem var(--font-body); }
.ad-cmd__list { max-height: 50vh; overflow-y: auto; padding: 8px; }
.ad-cmd__list a { display: block; padding: 10px 12px; border-radius: 10px; color: var(--ad-muted); text-decoration: none; font-weight: 600; font-size: .92rem; }
.ad-body .ad-cmd__list a { color: var(--ad-muted); }
.ad-cmd__list a.on, .ad-cmd__list a:hover { background: var(--ad-surface-3); color: var(--ad-text); }
.ad-body .ad-cmd__list a.on, .ad-body .ad-cmd__list a:hover { color: var(--ad-text); }
.ad-cmd__list p { padding: 14px; color: var(--ad-faint); text-align: center; }

/* ---------- Encabezado de página ---------- */
.ad-pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 14px 0 26px; }
.ad-crumb { font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ad-accent-2); margin-bottom: 6px; }
.ad-pagehead h1 { font-size: 1.85rem; line-height: 1.15; font-weight: 700; }
.ad-pagehead p { color: var(--ad-muted); margin-top: 6px; font-size: .94rem; max-width: 640px; line-height: 1.5; }

/* ---------- Botones ---------- */
.ad-btn, .ad-body .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 12px;
  font: 600 .86rem var(--font-body); cursor: pointer; text-decoration: none; white-space: nowrap;
  border: 1px solid var(--ad-border-strong); background: var(--ad-surface-2); color: var(--ad-text);
  transition: transform .15s, box-shadow .15s, background .15s, border-color .15s;
}
.ad-body .ad-btn, .ad-body .ad-btn:hover { color: var(--ad-text); }
.ad-btn:hover, .ad-body .btn:hover { border-color: var(--ad-muted); background: var(--ad-surface-3); transform: none; }
.ad-btn .ic { width: 17px; height: 17px; }
.ad-btn--primary, .ad-body .btn--primary, .ad-body .ad-btn--primary {
  background: linear-gradient(135deg, var(--ad-accent-2), var(--ad-accent)); color: var(--ad-accent-ink); border-color: transparent;
  box-shadow: 0 8px 22px -6px rgba(255, 122, 48, .55);
}
.ad-btn--primary:hover, .ad-body .btn--primary:hover { background: linear-gradient(135deg, var(--ad-accent-2), var(--ad-accent)); border-color: transparent; transform: translateY(-1px); box-shadow: 0 12px 26px -6px rgba(255, 122, 48, .65); }
.ad-body .ad-btn--primary, .ad-body .ad-btn--primary:hover { color: var(--ad-accent-ink); }
.ad-body .btn--ghost { background: transparent; }
.ad-body .btn--sm { padding: 7px 13px; font-size: .8rem; border-radius: 10px; }
.ad-btn--danger, .ad-body .btn--danger { color: var(--ad-bad); border-color: rgba(251, 113, 133, .4); background: var(--ad-bad-bg); }
.ad-body .btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Tarjetas ---------- */
.ad-wrap { max-width: 1360px; }
.ad-head { display: none; }
.ad-card {
  position: relative; background: var(--ad-surface); border: 1px solid var(--ad-border); border-radius: var(--ad-r);
  box-shadow: var(--ad-shadow); padding: 24px 26px; margin-bottom: 20px; overflow-x: auto;
}
.ad-card > h2, .ad-fold > summary h2 { font-size: 1.05rem; font-weight: 600; margin: 0 0 4px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ad-card > h2 { margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--ad-border); }
.ad-card > h2 + p.sim-muted { margin: -6px 0 16px; font-size: .88rem; }
.ad-card > h2 + p.sim-muted:last-child { margin-bottom: 0; }
.ad-card > p.sim-muted:only-of-type:not(:first-child) { padding: 6px 0; }

/* Formularios plegables ("＋ Nuevo …") */
.ad-fold { padding: 0; overflow: visible; }
.ad-fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 14px; padding: 18px 24px; border-radius: var(--ad-r); }
.ad-fold > summary::-webkit-details-marker { display: none; }
.ad-fold > summary:hover { background: var(--ad-surface-2); }
.ad-fold__ico { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: rgba(255, 122, 48, .15); color: var(--ad-accent-2); flex-shrink: 0; }
.ad-fold__t { flex: 1; min-width: 0; }
.ad-fold__t h2 { margin: 0; padding: 0; border: 0; font-size: 1rem; }
.ad-fold__t small { color: var(--ad-muted); font-size: .82rem; }
.ad-fold__chev { color: var(--ad-faint); transition: transform .2s; }
.ad-fold[open] > summary { border-bottom: 1px solid var(--ad-border); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.ad-fold[open] .ad-fold__chev { transform: rotate(180deg); }
.ad-fold__body { padding: 22px 24px 24px; }
.ad-fold__body > h2 { display: none; }

/* ---------- Tarjetas de estadística ---------- */
.ad-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 22px; }
.ad-stat, .ad-card.ad-stat {
  display: flex; flex-direction: column; gap: 4px; padding: 20px 22px 18px; margin: 0; overflow: hidden; border-top: 1px solid var(--ad-border);
  background: linear-gradient(160deg, var(--ad-surface-2), var(--ad-surface) 60%);
}
.ad-stat::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: radial-gradient(circle, var(--ad-glow, rgba(255,122,48,.22)), transparent 70%); pointer-events: none; }
.ad-stat--navy { --ad-glow: rgba(139, 124, 255, .26); --ad-tone: var(--ad-violet); }
.ad-stat--warn { --ad-glow: rgba(251, 191, 36, .24); --ad-tone: var(--ad-warn); }
.ad-stat--ok { --ad-glow: rgba(52, 211, 153, .22); --ad-tone: var(--ad-ok); }
.ad-stat--cyan { --ad-glow: rgba(63, 216, 245, .22); --ad-tone: var(--ad-cyan); }
.ad-stat__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; margin-bottom: 10px; background: color-mix(in srgb, var(--ad-tone, var(--ad-accent)) 18%, transparent); color: var(--ad-tone, var(--ad-accent-2)); }
.ad-stat__num { font-family: var(--font-display); font-size: 2.1rem; font-weight: 700; color: var(--ad-text); line-height: 1.05; letter-spacing: -.02em; }
.ad-stat__label { color: var(--ad-muted); font-size: .85rem; font-weight: 600; }
.ad-stat__sub { color: var(--ad-faint); font-size: .76rem; }
.ad-stat--link { text-decoration: none; transition: transform .18s, border-color .18s; }
.ad-body a.ad-stat--link:hover { transform: translateY(-3px); border-color: var(--ad-border-strong); }

/* Inicio: saludo + cuadrícula */
.ad-hero { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center; padding: 26px 28px; margin-bottom: 20px; border-radius: var(--ad-r); border: 1px solid var(--ad-border); background: linear-gradient(120deg, rgba(139,124,255,.22), rgba(255,122,48,.14) 55%, transparent), var(--ad-surface); box-shadow: var(--ad-shadow); }
.ad-hero h2 { font-size: 1.4rem; margin: 0 0 6px; border: 0; padding: 0; }
.ad-hero p { color: var(--ad-muted); font-size: .92rem; max-width: 520px; }
.ad-hero__date { font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ad-accent-2); margin-bottom: 8px; }
.ad-bento { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; margin-bottom: 20px; }
.ad-bento > .ad-card { margin: 0; }
.ad-chart { display: flex; align-items: flex-end; gap: 12px; height: 170px; padding-top: 10px; }
.ad-chart__col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; height: 100%; }
.ad-chart__bar { width: 100%; max-width: 46px; border-radius: 10px 10px 4px 4px; background: linear-gradient(180deg, var(--ad-accent-2), rgba(139, 124, 255, .55)); min-height: 4px; position: relative; transition: filter .15s; }
.ad-chart__col:hover .ad-chart__bar { filter: brightness(1.2); }
.ad-chart__bar b { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: .72rem; color: var(--ad-muted); font-weight: 700; }
.ad-chart__col small { font-size: .7rem; color: var(--ad-faint); font-weight: 600; text-transform: uppercase; }
.ad-chart__col.is-today small { color: var(--ad-accent-2); }
.ad-quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 20px; }
.ad-quick a { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 16px; border: 1px solid var(--ad-border); background: var(--ad-surface); color: var(--ad-text); text-decoration: none; font-weight: 600; font-size: .9rem; transition: all .18s; }
.ad-body .ad-quick a { color: var(--ad-text); }
.ad-quick a:hover { border-color: var(--ad-border-strong); transform: translateY(-2px); background: var(--ad-surface-2); }
.ad-quick a > span:nth-child(2) { flex: 1; line-height: 1.3; }
.ad-quick .ad-fold__ico { width: 42px; height: 42px; }
.ad-quick .ic:last-child { color: var(--ad-faint); width: 16px; }
.ad-feed { display: flex; flex-direction: column; }
.ad-feed__row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--ad-border); }
.ad-feed__row:last-child { border-bottom: 0; padding-bottom: 0; }
.ad-feed__row:first-child { padding-top: 0; }
.ad-feed__t { flex: 1; min-width: 0; line-height: 1.3; }
.ad-feed__t b { display: block; font-size: .87rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-feed__t small { color: var(--ad-faint); font-size: .76rem; }

/* ---------- Estados vacíos ---------- */
.ad-empty { text-align: center; padding: 34px 16px; color: var(--ad-muted); }
.ad-empty__ico { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--ad-surface-3); color: var(--ad-faint); margin-bottom: 12px; }
.ad-empty b { display: block; color: var(--ad-text); font-size: .98rem; margin-bottom: 4px; }
.ad-empty p { font-size: .86rem; max-width: 380px; margin: 0 auto; }
.ad-body .ad-card > p.sim-muted:first-child:last-child,
.ad-body .ad-card > h2 + p.sim-muted:last-child { padding: 18px 8px; text-align: center; border: 1px dashed var(--ad-border-strong); border-radius: 14px; margin: 0; }

/* ---------- Formularios ---------- */
.ad-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; align-items: end; }
.ad-body .form-row { display: flex; flex-direction: column; gap: 7px; }
.ad-body .form-row label, .ad-body label { font-size: .78rem; font-weight: 600; color: var(--ad-muted); }
.ad-body input[type=text], .ad-body input[type=password], .ad-body input[type=email], .ad-body input[type=number],
.ad-body input[type=date], .ad-body input[type=time], .ad-body input[type=search], .ad-body input[type=url], .ad-body input[type=tel],
.ad-body input:not([type]), .ad-body select, .ad-body textarea {
  width: 100%; padding: 10px 13px; border-radius: 11px; border: 1px solid var(--ad-border-strong); background: var(--ad-surface-2);
  color: var(--ad-text); font: 500 .9rem var(--font-body); transition: border-color .15s, box-shadow .15s; box-shadow: none;
}
.ad-body select { appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239aa6c7' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.ad-body textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.ad-body input::placeholder, .ad-body textarea::placeholder { color: var(--ad-faint); }
.ad-body input:focus, .ad-body select:focus, .ad-body textarea:focus { outline: none; border-color: var(--ad-violet); box-shadow: 0 0 0 3px rgba(139, 124, 255, .22); background: var(--ad-surface-2); }
.ad-body input[type=checkbox], .ad-body input[type=radio] { width: 17px; height: 17px; accent-color: var(--ad-accent); cursor: pointer; vertical-align: middle; }
.ad-body input[type=file] { font-size: .85rem; color: var(--ad-muted); }
.ad-body input[type=file]::file-selector-button { margin-right: 12px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--ad-border-strong); background: var(--ad-surface-3); color: var(--ad-text); font: 600 .8rem var(--font-body); cursor: pointer; }
.ad-body option { background: var(--ad-surface); color: var(--ad-text); }

.ad-search, .ad-body input.ad-search {
  display: block; width: 100%; max-width: 380px; margin: 0 0 16px; padding: 10px 14px 10px 40px; border-radius: 12px;
  background-color: var(--ad-surface-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%236c7898' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20.5 20.5-4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 13px center;
}

/* ---------- Tablas ---------- */
.ad-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .87rem; }
.ad-table th { text-align: left; color: var(--ad-faint); font-weight: 700; font-size: .68rem; letter-spacing: .09em; text-transform: uppercase; padding: 10px 14px; background: var(--ad-surface-2); border-bottom: 1px solid var(--ad-border); white-space: nowrap; position: sticky; top: 0; }
.ad-table th:first-child { border-top-left-radius: 11px; border-bottom-left-radius: 11px; }
.ad-table th:last-child { border-top-right-radius: 11px; border-bottom-right-radius: 11px; }
.ad-table td { padding: 13px 14px; border-bottom: 1px solid var(--ad-border); color: var(--ad-muted); vertical-align: middle; }
.ad-table td:first-child { color: var(--ad-text); font-weight: 600; }
.ad-table tbody tr { transition: background .12s; }
.ad-table tbody tr:hover { background: var(--ad-surface-2); }
.ad-table tbody tr:last-child td { border-bottom: none; }
.ad-table a { font-weight: 600; text-decoration: none; }
.ad-table a:hover { text-decoration: underline; }

.ad-person { display: flex; align-items: center; gap: 11px; min-width: 0; }
.ad-person .ad-avatar { width: 34px; height: 34px; }
.ad-person__t { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.ad-person__t b { color: var(--ad-text); font-weight: 600; }
.ad-person__t small { color: var(--ad-faint); font-size: .75rem; font-weight: 500; }

.ad-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ad-actions form { display: inline-flex; gap: 6px; align-items: center; }

/* ---------- Pastillas de estado ---------- */
.ad-tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: .72rem; font-weight: 700; white-space: nowrap; background: var(--ad-info-bg); color: var(--ad-info); }
.ad-tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ad-tag.on { background: var(--ad-ok-bg); color: var(--ad-ok); }
.ad-tag.off { background: var(--ad-bad-bg); color: var(--ad-bad); }
.ad-tag.warn { background: var(--ad-warn-bg); color: var(--ad-warn); }

/* ---------- Filtros / pestañas internas ---------- */
.ad-tabs { display: inline-flex; gap: 4px; flex-wrap: wrap; padding: 4px; margin-bottom: 18px; border-radius: 14px; background: var(--ad-surface); border: 1px solid var(--ad-border); max-width: 100%; }
.ad-card > .ad-tabs, .ad-card > nav.ad-tabs { margin-bottom: 0; }
.ad-tabs a, .ad-body .ad-tabs a { padding: 8px 15px; border-radius: 10px; background: transparent; border: 0; font-weight: 600; font-size: .83rem; color: var(--ad-muted); text-decoration: none; transition: all .15s; }
.ad-tabs a:hover, .ad-body .ad-tabs a:hover { color: var(--ad-text); background: var(--ad-surface-2); }
.ad-tabs a.on, .ad-body .ad-tabs a.on { background: linear-gradient(135deg, var(--ad-accent-2), var(--ad-accent)); color: var(--ad-accent-ink); box-shadow: 0 6px 16px -6px rgba(255, 122, 48, .6); }

.ad-flash { display: flex; gap: 10px; align-items: flex-start; padding: 14px 18px; border-radius: 14px; margin-bottom: 20px; font-weight: 600; font-size: .9rem; word-break: break-word; border: 1px solid; }
.ad-flash.ok { background: var(--ad-ok-bg); color: var(--ad-ok); border-color: color-mix(in srgb, var(--ad-ok) 40%, transparent); }
.ad-flash.err { background: var(--ad-bad-bg); color: var(--ad-bad); border-color: color-mix(in srgb, var(--ad-bad) 40%, transparent); }

.sim-protected-off { user-select: auto; }

/* ---------- Acciones por fila ---------- */
.ad-row-actions { display: flex; flex-direction: column; gap: 8px; min-width: 176px; }
.ad-row-actions .ad-inline { display: flex; gap: 6px; }
.ad-row-actions .ad-inline select, .ad-row-actions .ad-inline input[type=date] { flex: 1; min-width: 0; padding: 7px 10px; font-size: .8rem; border-radius: 9px; }
.ad-row-actions .ad-inline select { padding-right: 28px; }
.ad-row-actions .btn--sm { white-space: nowrap; }
.ad-menu { position: relative; }
.ad-menu > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; width: 100%; padding: 7px 12px; border: 1px solid var(--ad-border-strong); border-radius: 10px; font-weight: 600; font-size: .8rem; color: var(--ad-muted); background: var(--ad-surface-2); transition: all .15s; }
.ad-menu > summary::-webkit-details-marker { display: none; }
.ad-menu > summary:hover { color: var(--ad-text); border-color: var(--ad-muted); }
.ad-menu[open] > summary { background: var(--ad-surface-3); color: var(--ad-text); }
.ad-menu__panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; background: var(--ad-surface); border: 1px solid var(--ad-border-strong); border-radius: 13px; box-shadow: var(--ad-shadow-pop); padding: 6px; min-width: 200px; display: flex; flex-direction: column; gap: 2px; }
.ad-menu__panel form { width: 100%; }
.ad-menu__panel button { width: 100%; text-align: left; background: none; border: none; padding: 9px 11px; border-radius: 9px; font: 600 .84rem var(--font-body); color: var(--ad-text); cursor: pointer; }
.ad-menu__panel button:hover { background: var(--ad-surface-3); }
.ad-menu__panel button.is-danger { color: var(--ad-bad); }
.ad-menu__panel button.is-danger:hover { background: var(--ad-bad-bg); }

/* ---------- Menú móvil ---------- */
.ad-scrim { display: none; }
@media (max-width: 1100px) {
  .ad-bento { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .ad-sidebar { position: fixed; inset: 0 auto 0 0; transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--ad-shadow-pop); }
  .ad-sidebar.is-open { transform: translateX(0); }
  .ad-sidebar__close { display: grid; place-items: center; margin-left: auto; background: none; border: 0; color: var(--ad-muted); cursor: pointer; padding: 6px; }
  .ad-sidebar__brand { justify-content: space-between; }
  .ad-main { padding: 0 16px 60px; }
  .ad-menu-btn { display: inline-grid; }
  .ad-cmdk span, .ad-cmdk kbd { display: none; }
  .ad-cmdk { flex: 0 0 40px; width: 40px; padding: 0; justify-content: center; }
  .ad-chip-user span:last-child { display: none; }
  .ad-chip-user { padding: 0 4px; }
  .ad-scrim.is-open { display: block; position: fixed; inset: 0; background: rgba(3, 7, 18, .6); z-index: 35; backdrop-filter: blur(2px); }
  .ad-pagehead h1 { font-size: 1.5rem; }
  .ad-card { padding: 18px 16px; }
  .ad-fold { padding: 0; }
  .ad-fold > summary { padding: 14px 16px; }
  .ad-fold__body { padding: 16px; }
  .ad-hero { grid-template-columns: 1fr; padding: 20px; }
  .ad-pagehead .ad-btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .ad-body * { transition: none !important; } }

/* ---------- Ajustes de lectura ---------- */
.ad-body .ad-card p.sim-muted, .ad-body .ad-fold__body p.sim-muted { font-size: .88rem; line-height: 1.65; max-width: 780px; margin-bottom: 14px; }
.ad-table td:first-child { min-width: 150px; }
.ad-table td { font-size: .85rem; }
.ad-card .ad-table { min-width: 560px; }
.ad-body .sim-small { font-size: .78rem; }
.ad-body strong { color: var(--ad-text); }
.ad-body h3 { color: var(--ad-text) !important; }
.ad-count { display: inline-block; min-width: 20px; padding: 1px 7px; margin-left: 4px; border-radius: 999px; background: var(--ad-surface-3); color: var(--ad-muted); font-size: .72rem; text-align: center; }
.ad-tabs a.on .ad-count { background: rgba(255,255,255,.25); color: inherit; }
@media (max-width: 960px) {
  .ad-tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; width: 100%; }
  .ad-tabs::-webkit-scrollbar { display: none; }
  .ad-tabs a { white-space: nowrap; flex-shrink: 0; }
}
.ad-body .btn.is-danger { color: var(--ad-bad); border-color: rgba(251, 113, 133, .35); background: transparent; }
.ad-body .btn.is-danger:hover { background: var(--ad-bad-bg); border-color: var(--ad-bad); }

/* ---------- Pantallas de inicio de sesión ---------- */
.ad-login { background: transparent; }
.ad-body .sim-login__card { background: var(--ad-surface); border: 1px solid var(--ad-border-strong); border-radius: 22px; box-shadow: var(--ad-shadow-pop); padding: 34px 32px 30px; color: var(--ad-text); }
.ad-body .sim-login__card h1 { font-size: 1.45rem; margin: 18px 0 6px; color: var(--ad-text); }
.ad-body .sim-login__card form { display: flex; flex-direction: column; gap: 16px; margin-top: 20px; }
.ad-login__brand { display: flex; align-items: center; gap: 12px; font: 600 1rem var(--font-display); color: var(--ad-text); }
.ad-login__brand img { width: 40px; height: 40px; }
.ad-login__brand strong { color: var(--ad-accent-2); }
.ad-body .sim-error { color: var(--ad-bad); background: var(--ad-bad-bg); padding: 10px 14px; border-radius: 10px; font-size: .86rem; font-weight: 600; }
.ad-body .btn--lg { padding: 13px 22px; font-size: .95rem; }
.ad-body .btn--block { width: 100%; }

@media (max-width: 600px) {
  .ad-stats { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .ad-stat, .ad-card.ad-stat { padding: 14px 14px 12px; }
  .ad-stat__icon { width: 34px; height: 34px; margin-bottom: 6px; }
  .ad-stat__num { font-size: 1.45rem; }
  .ad-stat__label { font-size: .78rem; }
}
