/* ═══════════════════════════════════════════════════════════════════════════
   AdminWeb — Consorcio SETI
   Lenguaje visual: bento suave, esquinas amplias, navegación en píldora.
   Los colores son los mismos de ecosapp (app_colors.dart); lo que cambia es
   la forma, el ritmo y la escala tipográfica.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* ── Marca (sin cambios) ── */
  --brand:        #0A7AE8;
  --brand-dark:   #054E96;
  --brand-bright: #3AA0FF;
  --brand-light:  #E3EFFD;
  --brand-soft:   #F1F7FE;
  --on-brand:     #FFFFFF;

  --ink:      #0F1B33;
  --ink-2:    #1B2843;
  --ink-soft: #4A423C;

  --teal:    #00C2A8;
  --violet:  #7C5CFF;
  --amber:   #FFB020;
  --coral:   #FF5C6C;
  --lime:    #16CE7B;
  --neutral: #8494AD;

  /* ── Superficies ── */
  --canvas:      linear-gradient(160deg, #E6F0FB 0%, #F3F8FD 42%, #FCFDFE 100%);
  --frame:       linear-gradient(150deg, #FFFFFF 0%, #F7FBFE 52%, #EDF4FC 100%);
  --surface:     #FFFFFF;
  --surface-alt: #F1F6FC;
  --surface-el:  #FFFFFF;
  --border:      #E7EEF7;
  --divider:     #EFF4FA;

  --text:   #0F1B33;
  --text-2: #5C6B8A;
  --muted:  #93A1BA;

  --success: #12B76A;  --success-bg: #E7F8F0;
  --warning: #F79009;  --warning-bg: #FFF5E6;
  --danger:  #F43F5E;  --danger-bg:  #FEECEF;
  --info:    #0A7AE8;  --info-bg:    #E6F1FD;

  --grad-brand: linear-gradient(135deg, #3AA0FF 0%, #0A7AE8 48%, #054E96 100%);
  --grad-ink:   linear-gradient(150deg, #1B2843 0%, #0F1B33 100%);

  /* ── Sombras: difusas y bajas, nada de bordes duros ── */
  --shadow-xs: 0 1px 2px rgba(15,27,51,.04);
  --shadow-sm: 0 2px 8px rgba(15,27,51,.05);
  --shadow:    0 8px 28px rgba(15,27,51,.07);
  --shadow-lg: 0 28px 70px rgba(15,27,51,.16);
  --shadow-brand: 0 10px 28px rgba(10,122,232,.26);
  --scrim: rgba(15,27,51,.42);

  /* ── Geometría: radios amplios ── */
  --r-xs: 10px; --r-sm: 14px; --r: 18px;
  --r-lg: 24px; --r-xl: 30px; --r-2xl: 38px; --r-full: 999px;

  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 26px; --sp-8: 34px; --sp-10: 46px;

  --nav-h: 62px;

  --font: "Segoe UI Variable Display", "Segoe UI", -apple-system,
          BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  --brand:        #3AA0FF;
  --brand-dark:   #0A7AE8;
  --brand-bright: #6FBBFF;
  --brand-light:  #14243C;
  --brand-soft:   #101B2D;
  --on-brand:     #04121F;

  --ink:   #E9EFF9;
  --ink-2: #F3F7FC;

  --canvas:      linear-gradient(160deg, #060C17 0%, #0A1220 46%, #0D1526 100%);
  --frame:       linear-gradient(150deg, #111C2E 0%, #0E1826 55%, #0B1320 100%);
  --surface:     #141F33;
  --surface-alt: #1A2740;
  --surface-el:  #1B2941;
  --border:      #22314E;
  --divider:     #1D2B45;

  --text:   #E9EFF9;
  --text-2: #A6B4CD;
  --muted:  #6E7F9E;

  --success-bg: #0E2A20;
  --warning-bg: #2C2211;
  --danger-bg:  #2C1620;
  --info-bg:    #10243C;

  --grad-ink: linear-gradient(150deg, #1E2C46 0%, #16223A 100%);

  --shadow-xs: 0 1px 2px rgba(0,0,0,.35);
  --shadow-sm: 0 2px 10px rgba(0,0,0,.4);
  --shadow:    0 10px 30px rgba(0,0,0,.45);
  --shadow-lg: 0 30px 74px rgba(0,0,0,.62);
  --shadow-brand: 0 10px 28px rgba(58,160,255,.22);
  --scrim: rgba(3,8,16,.7);
}

/* ═══════════════════════════════ Base ═══════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text);
  background: var(--canvas);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; color: var(--text); }
h1 { font-size: 40px; line-height: 1.08; letter-spacing: -.033em; }
h2 { font-size: 26px; line-height: 1.18; letter-spacing: -.024em; }
h3 { font-size: 17px; letter-spacing: -.012em; }
p  { margin: 0; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: var(--r-xs); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--r-full); border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }

[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.noscript {
  margin: 20vh auto; max-width: 420px; padding: var(--sp-6);
  background: var(--danger-bg); color: var(--danger);
  border-radius: var(--r-lg); text-align: center; font-weight: 600;
}

/* ═════════════════════════════ Animaciones ══════════════════════════════ */

@keyframes pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.86); opacity: .5; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

.boot { position: fixed; inset: 0; display: grid; place-content: center; gap: var(--sp-5); justify-items: center; z-index: 90; }
.boot__mark { width: 58px; height: 58px; border-radius: var(--r-lg); background: var(--grad-brand); box-shadow: var(--shadow-brand); animation: pulse 1.5s ease-in-out infinite; }
.boot__text { color: var(--text-2); font-size: 13px; }

/* ═══════════════════════════════ Login ══════════════════════════════════ */

.login { min-height: 100dvh; display: grid; grid-template-columns: 1.02fr .98fr; padding: var(--sp-4); gap: var(--sp-4); }

.login__aside {
  background: var(--grad-brand); color: #fff;
  border-radius: var(--r-2xl); padding: var(--sp-10);
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.login__aside::after {
  content: ""; position: absolute; width: 640px; height: 640px;
  right: -240px; bottom: -300px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.16) 0%, rgba(255,255,255,0) 70%);
}
.login__brand { position: relative; }
.login__logo {
  display: block; width: 236px; height: auto;
  background: #fff; padding: 14px 18px; border-radius: var(--r-lg);
  box-shadow: 0 10px 30px rgba(4,30,66,.2);
}
.login__pitch { position: relative; max-width: 440px; }
.login__pitch h2 { color: #fff; font-size: 40px; line-height: 1.1; letter-spacing: -.03em; margin-bottom: var(--sp-4); }
.login__pitch p { color: rgba(255,255,255,.84); font-size: 15px; line-height: 1.6; }
.login__foot { color: rgba(255,255,255,.62); font-size: 12.5px; position: relative; }

.login__main { display: grid; place-items: center; padding: var(--sp-6); }
.login__card { width: 100%; max-width: 384px; animation: rise .4s ease both; }
.login__card h1 { font-size: 32px; margin-bottom: var(--sp-2); }
.login__card > p { color: var(--text-2); margin-bottom: var(--sp-8); }

.login__card-logo { display: none; width: 190px; height: auto; margin-bottom: var(--sp-6); background: #fff; padding: 10px 14px; border-radius: var(--r); }
:root[data-theme="dark"] .login__card-logo { box-shadow: 0 0 0 1px var(--border); }

@media (max-width: 920px) {
  .login { grid-template-columns: 1fr; padding: 0; }
  .login__aside { display: none; }
  .login__card-logo { display: block; }
}

/* ═══════════════════════════════ Shell ══════════════════════════════════ */

.app { min-height: 100dvh; padding: var(--sp-4); }

/* El panel flotante que contiene todo, como una hoja sobre el lienzo. */
.frame {
  background: var(--frame);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow), 0 0 0 1px rgba(255,255,255,.55) inset;
  min-height: calc(100dvh - var(--sp-4) * 2);
  display: flex; flex-direction: column;
  overflow: clip;
}
:root[data-theme="dark"] .frame { box-shadow: var(--shadow), 0 0 0 1px rgba(255,255,255,.04) inset; }

/* ── Navegación superior en píldora ── */

.topnav {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-6);
  position: sticky; top: 0; z-index: 40;
  background: transparent;
}

.topnav__brand { display: flex; align-items: center; gap: var(--sp-3); flex-shrink: 0; text-decoration: none; color: inherit; }
.topnav__brand:hover { text-decoration: none; }
.topnav__logo {
  width: 104px; height: auto; display: block;
  background: #fff; border-radius: var(--r-full); padding: 7px 14px;
  box-shadow: var(--shadow-xs);
}
:root[data-theme="dark"] .topnav__logo { box-shadow: 0 0 0 1px var(--border); }

.topnav__pills {
  display: flex; align-items: center; gap: 2px;
  background: var(--surface); border-radius: var(--r-full);
  padding: 5px; box-shadow: var(--shadow-xs);
  margin: 0 auto; max-width: 100%; overflow-x: auto;
  scrollbar-width: none;
}
.topnav__pills::-webkit-scrollbar { display: none; }

.nav-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--r-full);
  border: none; background: none; cursor: pointer;
  font-size: 13.5px; font-weight: 550; color: var(--text-2);
  white-space: nowrap; text-decoration: none;
  transition: background .18s, color .18s;
}
.nav-pill:hover { background: var(--surface-alt); color: var(--text); text-decoration: none; }
.nav-pill svg { width: 16px; height: 16px; }
.nav-pill.is-active {
  background: var(--ink); color: #fff; font-weight: 600;
  box-shadow: 0 4px 14px rgba(15,27,51,.22);
}
:root[data-theme="dark"] .nav-pill.is-active {
  background: var(--brand); color: var(--on-brand); box-shadow: var(--shadow-brand);
}

.topnav__actions { display: flex; align-items: center; gap: var(--sp-2); flex-shrink: 0; }

.round-btn {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  border: none; background: var(--surface); color: var(--text-2);
  box-shadow: var(--shadow-xs); transition: color .16s, transform .16s;
}
.round-btn:hover { color: var(--brand); transform: translateY(-1px); }
.round-btn svg { width: 18px; height: 18px; }

.user-chip {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 5px 16px 5px 6px; border-radius: var(--r-full);
  background: var(--surface); box-shadow: var(--shadow-xs);
  border: none; cursor: pointer; text-decoration: none; color: inherit;
  max-width: 230px;
}
.user-chip:hover { text-decoration: none; }
.user-chip__name { font-weight: 600; font-size: 13px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip__role { font-size: 11px; color: var(--muted); line-height: 1.2; white-space: nowrap; }

.burger { display: none; }

/* ── Menú "Más" y hoja móvil ── */

.nav-sheet {
  position: fixed; inset: 0; z-index: 70;
  background: var(--scrim); backdrop-filter: blur(3px);
  display: grid; place-items: start center; padding: var(--sp-6) var(--sp-4);
  animation: rise .18s ease both;
}
.nav-sheet__panel {
  background: var(--surface-el); border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg); padding: var(--sp-5);
  width: 100%; max-width: 560px; max-height: 84dvh; overflow-y: auto;
}
.nav-sheet__group { margin-bottom: var(--sp-5); }
.nav-sheet__group:last-child { margin-bottom: 0; }
.nav-sheet__label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); margin-bottom: var(--sp-3);
}
.nav-sheet__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--sp-2); }
.nav-sheet__item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 12px var(--sp-4); border-radius: var(--r);
  background: var(--surface-alt); color: var(--text);
  font-size: 13.5px; font-weight: 550; text-decoration: none;
}
.nav-sheet__item:hover { background: var(--brand-light); color: var(--brand); text-decoration: none; }
.nav-sheet__item.is-active { background: var(--ink); color: #fff; }
:root[data-theme="dark"] .nav-sheet__item.is-active { background: var(--brand); color: var(--on-brand); }
.nav-sheet__item svg { width: 17px; height: 17px; flex-shrink: 0; }

/* ── Contenido ── */

.view { padding: var(--sp-2) var(--sp-6) var(--sp-8); flex: 1; min-width: 0; animation: rise .26s ease both; }

.view__head { display: flex; align-items: flex-end; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-6); }
.view__head p { color: var(--text-2); font-size: 15px; margin-top: var(--sp-2); max-width: 62ch; }
.view__actions { margin-left: auto; display: flex; gap: var(--sp-2); flex-wrap: wrap; }

@media (max-width: 1100px) {
  .topnav__pills { display: none; }
  .burger { display: grid; }
  .topnav { gap: var(--sp-3); }
  .topnav__actions { margin-left: auto; }
}
@media (max-width: 720px) {
  .app { padding: 0; }
  .frame { border-radius: 0; min-height: 100dvh; }
  .view { padding: var(--sp-2) var(--sp-4) var(--sp-6); }
  .topnav { padding: var(--sp-3) var(--sp-4); }
  h1 { font-size: 30px; }
  .user-chip__name, .user-chip__role { display: none; }
  .user-chip { padding: 5px; }
}

/* ═══════════════════════════════ Cards ══════════════════════════════════ */

.card {
  background: var(--surface); border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm); overflow: clip;
}
.card__head {
  padding: var(--sp-5) var(--sp-6) var(--sp-3);
  display: flex; align-items: center; gap: var(--sp-3);
}
.card__head h3 { font-size: 16px; font-weight: 650; }
.card__head .card__tools { margin-left: auto; display: flex; gap: var(--sp-2); }
.card__body { padding: var(--sp-3) var(--sp-6) var(--sp-6); }
.card__body--flush { padding: 0; }
.card__head + .card__body--flush { padding-top: var(--sp-3); }

/* Tarjeta oscura de contraste, como el bloque de tareas de la referencia. */
.card--ink { background: var(--grad-ink); color: #fff; }
.card--ink h3, .card--ink .card__head h3 { color: #fff; }
.card--ink .text-2 { color: rgba(255,255,255,.72); }
.card--ink .muted { color: rgba(255,255,255,.5); }

.grid { display: grid; gap: var(--sp-4); }
.grid--stats { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.grid--form { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--sp-3) var(--sp-4); }

/* Bento: bloque ancho + columna lateral; se apila en pantallas medianas. */
.grid--bento { grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); }
@media (max-width: 1000px) { .grid--bento { grid-template-columns: 1fr; } }

/* ── Tarjeta de estadística: número protagonista ── */

.stat {
  background: var(--surface); border-radius: var(--r-xl);
  padding: var(--sp-5) var(--sp-6) var(--sp-6);
  box-shadow: var(--shadow-sm); position: relative;
  display: flex; flex-direction: column; min-height: 152px;
}
.stat__icon {
  width: 40px; height: 40px; border-radius: var(--r-sm);
  display: grid; place-items: center; color: #fff;
  margin-bottom: auto; box-shadow: var(--shadow-xs);
}
.stat__icon svg { width: 19px; height: 19px; }
.stat__label {
  font-size: 11px; font-weight: 700; letter-spacing: .085em;
  text-transform: uppercase; color: var(--muted); margin-top: var(--sp-5);
}
.stat__value {
  font-size: 42px; font-weight: 680; letter-spacing: -.04em;
  line-height: 1.02; margin-top: var(--sp-2);
}
.stat__meta { font-size: 12.5px; color: var(--text-2); margin-top: var(--sp-2); }
.stat__meta strong { color: var(--success); font-weight: 650; }

/* KPI grande en línea, estilo cabecera de la referencia. */
.kpi-row { display: flex; flex-wrap: wrap; gap: var(--sp-8); align-items: flex-end; }
.kpi { display: flex; align-items: center; gap: var(--sp-3); }
.kpi__icon { width: 34px; height: 34px; border-radius: var(--r-xs); display: grid; place-items: center; background: var(--brand-light); color: var(--brand); }
.kpi__icon svg { width: 17px; height: 17px; }
.kpi__value { font-size: 40px; font-weight: 680; letter-spacing: -.04em; line-height: 1; }
.kpi__label { font-size: 12px; color: var(--muted); font-weight: 550; }

/* ═══════════════════════════════ Botones ════════════════════════════════ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: 42px; padding: 0 var(--sp-5); border-radius: var(--r-full);
  border: none; font-size: 13.5px; font-weight: 600; cursor: pointer;
  white-space: nowrap; background: var(--surface-alt); color: var(--text);
  transition: background .16s, transform .16s, box-shadow .16s;
}
.btn:hover { background: var(--border); text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: none; }
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn--primary { background: var(--ink); color: #fff; box-shadow: 0 6px 18px rgba(15,27,51,.2); }
.btn--primary:hover { background: var(--ink-2); }
:root[data-theme="dark"] .btn--primary { background: var(--brand); color: var(--on-brand); box-shadow: var(--shadow-brand); }
:root[data-theme="dark"] .btn--primary:hover { background: var(--brand-bright); }

.btn--brand { background: var(--brand); color: var(--on-brand); box-shadow: var(--shadow-brand); }
.btn--brand:hover { background: var(--brand-dark); }

.btn--ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--border); color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-alt); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }

.btn--danger { background: var(--danger); color: #fff; box-shadow: 0 6px 18px rgba(244,63,94,.26); }
.btn--danger:hover { background: #E02E4B; }

.btn--sm { height: 34px; padding: 0 var(--sp-4); font-size: 12.5px; }
.btn--block { width: 100%; }

.btn--icon { width: 38px; height: 38px; padding: 0; border-radius: 50%; background: transparent; color: var(--muted); }
.btn--icon:hover { background: var(--surface-alt); color: var(--text); transform: none; }

.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  border-radius: 50%; animation: spin .6s linear infinite;
}
.btn--ghost.is-loading::after, .btn:not(.btn--primary):not(.btn--danger):not(.btn--brand).is-loading::after {
  border-color: var(--border); border-top-color: var(--brand);
}

/* ═══════════════════════════════ Forms ══════════════════════════════════ */

.field { margin-bottom: var(--sp-4); }
.field__label {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: .075em;
  text-transform: uppercase; color: var(--muted); margin-bottom: var(--sp-2);
}
.field__label .req { color: var(--danger); }

.input, .select, .textarea {
  width: 100%; height: 46px; padding: 0 var(--sp-4);
  background: var(--surface-alt); border: 1px solid transparent;
  border-radius: var(--r); color: var(--text);
  transition: background .16s, border-color .16s, box-shadow .16s;
}
.textarea { height: auto; min-height: 112px; padding: 13px var(--sp-4); resize: vertical; line-height: 1.6; }
.select {
  appearance: none; padding-right: 40px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235C6B8A' stroke-width='2' stroke-linecap='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 16px;
}
.input:hover, .select:hover, .textarea:hover { background: var(--divider); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; background: var(--surface);
  border-color: var(--brand); box-shadow: 0 0 0 4px rgba(10,122,232,.13);
}
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.input:disabled, .select:disabled, .textarea:disabled { opacity: .6; cursor: not-allowed; }
input[type="color"].input { padding: 5px; height: 46px; cursor: pointer; }

.field--error .input, .field--error .select, .field--error .textarea { border-color: var(--danger); }
.field__error { font-size: 12.5px; color: var(--danger); margin-top: var(--sp-2); }
.field__hint { font-size: 12.5px; color: var(--muted); margin-top: var(--sp-2); }

.input-group { position: relative; }
.input-group .input { padding-left: 44px; }
.input-group__icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; display: flex; }
.input-group__icon svg { width: 17px; height: 17px; }
.input-group__btn {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 7px; border-radius: 50%; display: flex;
}
.input-group__btn:hover { color: var(--text); background: var(--surface); }
.input-group__btn svg { width: 17px; height: 17px; }

.switch { display: inline-flex; align-items: center; gap: var(--sp-3); cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track { width: 44px; height: 25px; border-radius: var(--r-full); background: var(--border); position: relative; transition: background .2s; flex-shrink: 0; }
.switch__track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px;
  border-radius: 50%; background: #fff; box-shadow: var(--shadow-xs); transition: transform .2s;
}
.switch input:checked + .switch__track { background: var(--brand); }
.switch input:checked + .switch__track::after { transform: translateX(19px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--brand); outline-offset: 3px; }
.switch__text { font-size: 13.5px; }

.checkbox { display: inline-flex; align-items: center; gap: var(--sp-2); cursor: pointer; font-size: 13.5px; }
.checkbox input { width: 17px; height: 17px; accent-color: var(--brand); }

/* ═══════════════════════════════ Tablas ═════════════════════════════════ */

.table-wrap { overflow-x: auto; padding: 0 var(--sp-3) var(--sp-3); }
.table { width: 100%; border-collapse: separate; border-spacing: 0 6px; font-size: 13.5px; }

.table th {
  text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted);
  padding: var(--sp-2) var(--sp-4); white-space: nowrap; background: transparent;
}
.table td { padding: var(--sp-4); background: var(--surface-alt); vertical-align: middle; }
.table tbody tr td:first-child { border-radius: var(--r) 0 0 var(--r); }
.table tbody tr td:last-child  { border-radius: 0 var(--r) var(--r) 0; }
.table tbody tr:hover td { background: var(--brand-light); }
.table .td-actions { text-align: right; white-space: nowrap; }
.table .td-num { text-align: right; font-variant-numeric: tabular-nums; }

.cell-user { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.cell-user__name { font-weight: 600; line-height: 1.25; }
.cell-user__mail { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 250px; }

.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; color: #fff;
  font-weight: 700; font-size: 13px; overflow: hidden;
}
.avatar--sm { width: 32px; height: 32px; font-size: 11.5px; }
.avatar--lg { width: 76px; height: 76px; font-size: 26px; border-radius: var(--r-lg); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ═══════════════════════════════ Píldoras ═══════════════════════════════ */

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: var(--r-full);
  font-size: 11.5px; font-weight: 650; white-space: nowrap;
  background: var(--surface); color: var(--text-2); box-shadow: var(--shadow-xs);
}
.pill--success { background: var(--success-bg); color: var(--success); box-shadow: none; }
.pill--warning { background: var(--warning-bg); color: var(--warning); box-shadow: none; }
.pill--danger  { background: var(--danger-bg);  color: var(--danger);  box-shadow: none; }
.pill--info    { background: var(--info-bg);    color: var(--info);    box-shadow: none; }
.pill--neutral { background: var(--surface); color: var(--text-2); }
.pill__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ═══════════════════════════════ Estados ════════════════════════════════ */

.state { padding: var(--sp-10) var(--sp-5); text-align: center; }
.state__icon {
  width: 64px; height: 64px; border-radius: var(--r-lg); margin: 0 auto var(--sp-5);
  display: grid; place-items: center; background: var(--surface-alt); color: var(--muted);
}
.state__icon svg { width: 28px; height: 28px; }
.state h3 { font-size: 18px; margin-bottom: var(--sp-2); }
.state p { color: var(--text-2); font-size: 14px; max-width: 400px; margin: 0 auto var(--sp-5); }

.skeleton {
  background: linear-gradient(90deg, var(--surface-alt) 25%, var(--divider) 37%, var(--surface-alt) 63%);
  background-size: 400% 100%; animation: shimmer 1.3s ease infinite;
  border-radius: var(--r-xs); height: 15px;
}

.spinner {
  width: 26px; height: 26px; border: 2.5px solid var(--border);
  border-top-color: var(--brand); border-radius: 50%;
  animation: spin .65s linear infinite; margin: var(--sp-10) auto;
}

/* ═══════════════════════════════ Modal ══════════════════════════════════ */

.modal-scrim {
  position: fixed; inset: 0; background: var(--scrim); backdrop-filter: blur(4px);
  z-index: 80; display: grid; place-items: center; padding: var(--sp-4);
  animation: rise .16s ease both; overflow-y: auto;
}
.modal {
  background: var(--surface-el); border-radius: var(--r-2xl);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 580px;
  max-height: calc(100dvh - 40px); display: flex; flex-direction: column;
  animation: rise .24s ease both;
}
.modal--lg { max-width: 880px; }
.modal--sm { max-width: 430px; }
.modal__head { padding: var(--sp-6) var(--sp-8) var(--sp-4); display: flex; align-items: center; gap: var(--sp-3); flex-shrink: 0; }
.modal__head h3 { font-size: 21px; font-weight: 650; letter-spacing: -.02em; }
.modal__body { padding: var(--sp-2) var(--sp-8) var(--sp-6); overflow-y: auto; flex: 1; }
.modal__foot { padding: var(--sp-4) var(--sp-8) var(--sp-6); display: flex; gap: var(--sp-2); justify-content: flex-end; flex-shrink: 0; }

/* ═══════════════════════════════ Toasts ═════════════════════════════════ */

.toasts { position: fixed; bottom: var(--sp-6); right: var(--sp-6); z-index: 95; display: flex; flex-direction: column; gap: var(--sp-2); max-width: 390px; }
.toast {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  background: var(--surface-el); border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-5); box-shadow: var(--shadow-lg);
  animation: rise .22s ease both; font-size: 13.5px;
  border-left: 4px solid var(--brand);
}
.toast--success { border-left-color: var(--success); }
.toast--error   { border-left-color: var(--danger); }
.toast--warning { border-left-color: var(--warning); }
.toast svg { width: 19px; height: 19px; flex-shrink: 0; margin-top: 1px; }
.toast--success svg { color: var(--success); }
.toast--error svg { color: var(--danger); }
.toast--warning svg { color: var(--warning); }
.toast--info svg { color: var(--brand); }

@media (max-width: 600px) { .toasts { left: var(--sp-4); right: var(--sp-4); bottom: var(--sp-4); max-width: none; } }

/* ═══════════════════════════════ Extras ═════════════════════════════════ */

.toolbar { display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap; padding: var(--sp-4) var(--sp-6); }
.toolbar .input-group { flex: 1; min-width: 210px; max-width: 360px; }
.toolbar .select, .toolbar .input { height: 42px; }

.pagination { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4) var(--sp-6) var(--sp-5); font-size: 13px; color: var(--text-2); flex-wrap: wrap; }
.pagination__spacer { margin-left: auto; display: flex; gap: var(--sp-2); }

.tabs { display: flex; gap: 4px; margin-bottom: var(--sp-6); overflow-x: auto; background: var(--surface); padding: 5px; border-radius: var(--r-full); box-shadow: var(--shadow-xs); width: fit-content; max-width: 100%; }
.tab { padding: 10px var(--sp-5); border: none; background: none; cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--text-2); border-radius: var(--r-full); white-space: nowrap; }
.tab:hover { color: var(--text); background: var(--surface-alt); }
.tab.is-active { color: #fff; background: var(--ink); }
:root[data-theme="dark"] .tab.is-active { background: var(--brand); color: var(--on-brand); }

.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(290px, 1fr); gap: var(--sp-4); overflow-x: auto; padding-bottom: var(--sp-4); align-items: start; }
.kanban__col { background: var(--surface-alt); border-radius: var(--r-xl); padding: var(--sp-4); }
.kanban__col-head { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-2) var(--sp-4); font-weight: 650; font-size: 13.5px; }
.kanban__count { margin-left: auto; font-size: 11.5px; color: var(--muted); background: var(--surface); padding: 2px 10px; border-radius: var(--r-full); font-weight: 600; }
.kanban__card { background: var(--surface); border-radius: var(--r); padding: var(--sp-4); margin-bottom: var(--sp-2); cursor: pointer; box-shadow: var(--shadow-xs); transition: transform .16s, box-shadow .16s; }
.kanban__card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.kanban__card h4 { font-size: 14px; font-weight: 650; margin-bottom: var(--sp-2); }
.kanban__card p { font-size: 12.5px; color: var(--text-2); }
.kanban__card-foot { display: flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-4); }

.tree { list-style: none; padding-left: var(--sp-6); margin: 0; }
.tree > li { position: relative; padding: 3px 0; }
.tree__node { display: flex; align-items: center; gap: var(--sp-3); background: var(--surface-alt); border-radius: var(--r); padding: var(--sp-4); margin: 4px 0; transition: background .16s; }
.tree__node:hover { background: var(--brand-light); }
.tree__node-title { font-weight: 650; font-size: 14px; }
.tree__node-sub { font-size: 12.5px; color: var(--muted); }
.tree__node-actions { margin-left: auto; display: flex; gap: 2px; }

.chart { width: 100%; height: 210px; display: block; }

.legend { display: flex; flex-wrap: wrap; gap: var(--sp-4); margin-top: var(--sp-4); font-size: 12.5px; }
.legend__item { display: flex; align-items: center; gap: 7px; color: var(--text-2); }
.legend__swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

.code { font-family: var(--mono); font-size: 12px; background: var(--surface-alt); padding: var(--sp-4); border-radius: var(--r); white-space: pre-wrap; word-break: break-word; color: var(--text-2); max-height: 240px; overflow: auto; }

.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.row { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.mt-4 { margin-top: var(--sp-4); }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.nowrap { white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
