/*
  ACIQBF, sistema visual (D-09, revisado en la tanda 12).
  Lenguaje de la plantilla Vireo medido en su demo: lienzo #f6f8fc con
  brillos suaves, barra lateral de 264 px translúcida con filtro y
  elemento activo con barra luminosa, cabecera de 60 px, tarjetas de
  radio 24 px con vidrio y sombra larga, títulos Space Grotesk (30 px la
  página, 24 px la tarjeta) sobre texto Inter de 14 px, tablas de 13 px
  con cabecera de 11 px en mayúsculas, controles de 38 px con radio 12,
  botón principal en degradado con halo. El acento es el turquesa de la
  marca AC-IQBF (D-08). Sin dependencias externas: fuentes en static/fonts.
*/

@font-face { font-family: "Inter"; font-weight: 400 700; font-display: swap; src: url("../fonts/inter-var.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 500 700; font-display: swap; src: url("../fonts/space-grotesk-var.woff2") format("woff2"); }

:root {
  color-scheme: light;
  /* marca */
  --brand-50: #e6f5f7; --brand-100: #c6e9ee; --brand-200: #93d3dc; --brand-300: #5dbccb; --brand-400: #35adbf;
  --brand-500: #1a9fb0; --brand-600: #158a9a; --brand-700: #0f7f95; --brand-800: #0b5f70; --brand-900: #083f4b;
  --leaf-50: #eef7e3; --leaf-500: #7bc043; --leaf-700: #4f8a25;
  --accent: var(--brand-500); --accent-hover: var(--brand-600); --accent-wash: var(--brand-50); --accent-rgb: 26, 159, 176;
  --on-accent: #fff; --link: var(--brand-700);
  --gradient-accent: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  --glow-accent: 0 12px 26px -10px rgba(var(--accent-rgb), .45);
  /* neutros fríos de Vireo */
  --n-0: #fff; --n-25: #f6f8fc; --n-50: #f0f3f9; --n-100: #e7ecf4; --n-150: #dde3ee; --n-200: #cfd7e6; --n-300: #b7c1d5;
  --n-400: #94a0b8; --n-500: #6e7a92; --n-600: #535e74; --n-700: #3a4456; --n-800: #232b3a; --n-900: #151b27;
  --canvas: var(--n-25); --surface: #ffffffb8; --surface-solid: #fff; --surface-subtle: var(--n-50); --surface-raised: #fffc; --surface-overlay: #ffffffeb;
  --fill-hover: #1016280a; --fill-active: #10162814; --border: #10162814; --border-strong: #10162824; --glass-hi: #ffffffe6;
  --text-strong: var(--n-900); --text: var(--n-700); --text-muted: var(--n-600); --text-subtle: var(--n-500); --text-disabled: var(--n-400);
  --success-50: #e7f4ec; --success-500: #2e9e5b; --success-700: #1f6f40;
  --warning-50: #fbf1de; --warning-500: #c8870f; --warning-700: #8a5c08;
  --danger-50: #fbe9e6; --danger-500: #d24535; --danger-700: #9a2f22;
  --info-50: #e6effa; --info-500: #2d74c4; --info-700: #1f528c;
  --viz-cyan: #0ea5e9; --viz-violet: #7c5cfc; --viz-amber: #e0930b; --viz-emerald: #10b981; --viz-pink: #ec4899; --viz-red: #ef4444;
  --glow-1: #ffb07829; --glow-2: #7882f629; --glow-3: rgba(var(--accent-rgb), .10);
  /* forma */
  --r-xs: 8px; --r-sm: 12px; --r-md: 14px; --r-lg: 18px; --r-xl: 24px; --r-pill: 999px;
  --shadow-sm: 0 6px 18px -8px #1016282e, 0 2px 6px -2px #1016281a;
  --shadow-md: 0 14px 36px -14px #10162838, 0 4px 12px -6px #1016281f;
  --shadow-lg: 0 28px 64px -20px #10162847, 0 8px 20px -8px #10162829;
  --shadow-card: 0 18px 44px -22px #10162833, 0 2px 10px #1016280f;
  --focus: 0 0 0 3px rgba(var(--accent-rgb), .18);
  --sidebar-w: 264px; --header-h: 60px; --control-h: 38px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Space Grotesk", var(--font);
  --mono: ui-monospace, "Cascadia Mono", "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, 0, 0, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; letter-spacing: -0.006em; color: var(--text); background: var(--canvas); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; font-feature-settings: "cv05", "ss01"; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--accent-hover); }
code { font-family: var(--mono); background: var(--fill-active); padding: 1px 6px; border-radius: 6px; font-size: 0.9em; color: var(--text-strong); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-xs); }
.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 16px; height: 16px; }
.icon.xs { width: 14px; height: 14px; stroke-width: 2.4; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- lienzo con brillos ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; position: relative; isolation: isolate; }
.shell::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(900px 520px at 8% -10%, var(--glow-1), transparent 60%), radial-gradient(800px 520px at 100% 0%, var(--glow-2), transparent 60%), radial-gradient(700px 520px at 60% 110%, var(--glow-3), transparent 60%); }

/* ---------- barra lateral ---------- */
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--surface); backdrop-filter: blur(18px) saturate(1.1); border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 30; color: var(--text-muted); }
.sidebar__brand { height: var(--header-h); display: flex; align-items: center; gap: 10px; padding: 0 20px; flex: none; }
.sidebar__brand a { display: inline-flex; align-items: center; gap: 10px; color: var(--text-strong); }
.sidebar__brand img { height: 34px; width: auto; display: block; border-radius: 6px; }
.sidebar__search { position: relative; padding: 0 12px 6px; flex: none; }
.sidebar__search .icon { position: absolute; left: 24px; top: 11px; width: 16px; height: 16px; color: var(--text-subtle); pointer-events: none; }
.sidebar__search input.sidebar__filter { width: 100%; height: 38px; padding: 0 12px 0 42px; font: inherit; font-size: 13px; color: var(--text-strong); background: var(--surface-subtle); border: 1px solid var(--border); border-radius: var(--r-md); }
.sidebar__search input.sidebar__filter::placeholder { color: var(--text-subtle); }
.sidebar__search input.sidebar__filter:focus { border-color: var(--accent); outline: none; box-shadow: var(--focus); }
.sidebar__nav { padding: 8px 12px 16px; display: flex; flex-direction: column; gap: 2px; overflow: hidden auto; flex: 1; min-height: 0; scrollbar-width: none; }
.sidebar__section { display: contents; }
.sidebar__label { margin: 16px 12px 4px; font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-subtle); user-select: none; }
.sidebar__section:first-child .sidebar__label { margin-top: 8px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 9px 12px; border-radius: var(--r-md); color: var(--text-muted); font-weight: 500; font-size: 13px; transition: background .14s var(--ease), color .14s var(--ease); }
.nav-item:hover { background: var(--fill-hover); color: var(--text-strong); }
.nav-item .icon { opacity: .85; }
.nav-item .label { flex: auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item.active { color: var(--text-strong); background: linear-gradient(90deg, rgba(var(--accent-rgb), .16), rgba(var(--accent-rgb), .04)); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .18); }
.nav-item.active::before { content: ""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%); width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.nav-item.active .icon { color: var(--accent); opacity: 1; }
.nav-item .count { margin-left: auto; min-width: 18px; padding: 1px 7px; border-radius: var(--r-pill); font-size: 11px; font-weight: 600; line-height: 1.5; font-variant-numeric: tabular-nums; background: var(--fill-active); color: var(--text-muted); text-align: center; }
.nav-item .count.warn { background: var(--warning-50); color: var(--warning-500); }
.nav-item.is-hidden { display: none; }
.sidebar__empty { padding: 20px 12px; font-size: 13px; color: var(--text-muted); text-align: center; }
.sidebar__user { border-top: 1px solid var(--border); padding: 12px 16px; display: flex; align-items: center; gap: 10px; flex: none; }
.avatar { width: 36px; height: 36px; border-radius: var(--r-pill); background: var(--fill-active); color: var(--text-muted); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; flex: none; user-select: none; }
.avatar.accent { background: rgba(var(--accent-rgb), .16); color: var(--accent); }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.sidebar__meta { min-width: 0; flex: 1; }
.sidebar__name { font-size: 13px; font-weight: 600; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__role { font-size: 12px; color: var(--text-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { background: none; border: 1px solid transparent; color: var(--text-muted); width: 38px; height: 38px; border-radius: var(--r-md); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative; transition: background .14s var(--ease), color .14s var(--ease); flex: none; }
.icon-btn:hover { background: var(--fill-hover); color: var(--text-strong); }
.icon-btn.tonal { background: var(--fill-hover); color: var(--text-strong); }
.icon-btn.tonal:hover { background: var(--fill-active); }
.icon-btn .dot { position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface-solid); }
.icon-btn .pip { position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--r-pill); background: var(--accent); color: var(--on-accent); font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; font-family: var(--mono); }

/* ---------- cabecera y área principal ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.header { position: sticky; top: 0; z-index: 20; height: var(--header-h); display: flex; align-items: center; gap: 8px; padding: 0 16px; background: var(--surface-raised); backdrop-filter: blur(12px) saturate(1.05); border-bottom: 1px solid var(--border); }
.search { display: inline-flex; align-items: center; gap: 8px; height: 38px; min-width: 0; width: 100%; max-width: 300px; padding: 0 12px; margin-left: 4px; color: var(--text-muted); background: var(--surface-subtle); border: 1px solid var(--border); border-radius: var(--r-pill); transition: background .14s, border-color .14s; }
.search:hover { border-color: var(--border-strong); }
.search:focus-within { border-color: var(--accent); box-shadow: var(--focus); background: var(--surface-solid); }
.search .icon { color: var(--text-subtle); width: 16px; height: 16px; }
.header .search input[type=search] { border: 0; background: none; flex: 1; font: inherit; font-size: 13px; color: var(--text-strong); padding: 0; min-width: 0; min-height: 0; box-shadow: none; }
.header .search input[type=search]::placeholder { color: var(--text-muted); }
.header .search input[type=search]:focus { outline: none; box-shadow: none; border: 0; }
.search kbd { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; font-family: var(--mono); font-size: 11px; color: var(--text-subtle); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xs); }
.header__spacer { flex: 1; }
.header__actions { display: flex; align-items: center; gap: 4px; }
.header__actions .btn { margin-left: 8px; }
.header__divider { width: 1px; height: 22px; background: var(--border-strong); margin: 0 6px; }

.content { padding: 16px 24px 32px; width: 100%; }
.crumbs { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-muted); margin: 4px 0 16px; flex-wrap: wrap; }
.crumbs a { color: var(--text-muted); display: inline-flex; align-items: center; gap: 4px; }
.crumbs a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }
.crumbs .icon { width: 16px; height: 16px; }
.crumbs .sep { color: var(--text-subtle); display: inline-flex; }
.crumbs .sep .icon { width: 14px; height: 14px; }
.crumbs .here { color: var(--text-strong); font-weight: 500; }

.foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; min-height: 48px; padding: 16px 24px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 12px; }
.foot .ver { color: var(--text-subtle); font-family: var(--mono); }
.foot nav { display: flex; gap: 14px; }
.foot nav a { color: var(--text-muted); }
.foot nav a:hover { color: var(--accent); }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: var(--sidebar-w); transform: translateX(-100%); transition: transform .2s var(--ease); box-shadow: var(--shadow-lg); background: var(--surface-solid); }
  .shell.nav-open .sidebar { transform: none; }
  .content { padding: 12px 16px 28px; }
  .search { max-width: none; }
  .search kbd { display: none; }
}

/* ---------- cabecera de página ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { margin: 0; font-family: var(--font-display); font-size: 30px; font-weight: 700; color: var(--text-strong); letter-spacing: -0.015em; line-height: 38px; }
.page-head h1 .mono { font-size: 13px; letter-spacing: 0; vertical-align: middle; margin-left: 6px; }
.page-head .subtitle { margin: 4px 0 0; color: var(--text-muted); font-size: 17px; line-height: 26px; }
.page-head .subtitle b { color: var(--text-strong); font-weight: 600; }
.eyebrow { font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-subtle); }
.page-head .eyebrow { margin-bottom: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- tarjetas ---------- */
.card { position: relative; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-card); backdrop-filter: blur(18px) saturate(1.1); padding: 20px 24px 24px; margin-bottom: 24px; }
.card::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; box-shadow: inset 0 1px 0 var(--glass-hi); }
.card > :last-child { margin-bottom: 0; }
.card h2 { margin: 0 0 14px; font-family: var(--font-display); font-size: 24px; font-weight: 600; color: var(--text-strong); line-height: 32px; letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px; }
.card h2 .btn.small, .card h2 .badge { margin-left: auto; font-family: var(--font); letter-spacing: 0; }
.card h2 .badge { margin-left: 0; }
.card h3 { margin: 20px 0 8px; font-size: 11px; line-height: 16px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-subtle); font-weight: 600; }
.card .lead { color: var(--text-muted); font-size: 13px; margin: -8px 0 16px; }
.card.flat { background: var(--surface-subtle); box-shadow: none; backdrop-filter: none; }
.card.flat::after { box-shadow: none; }
.card.accent-edge::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 3px; background: var(--accent); z-index: 1; }
.card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card__head h2 { margin: 0; display: block; }
.card__head .eyebrow { display: block; margin-bottom: 2px; }
.card__head .sub { display: block; font-size: 13px; color: var(--text-muted); font-weight: 400; margin-top: 2px; font-family: var(--font); letter-spacing: 0; line-height: 20px; }
.card__head .card__actions { display: flex; align-items: center; gap: 8px; flex: none; }
.card__head .link { font-size: 13px; font-weight: 600; color: var(--link); white-space: nowrap; padding-top: 6px; }
.narrow { max-width: 640px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.cols-form { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.cols-8-4 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 24px; align-items: start; }
.sticky-col { position: sticky; top: calc(var(--header-h) + 16px); }
@media (max-width: 1100px) { .cols, .cols-form, .cols-8-4 { grid-template-columns: 1fr; } .sticky-col { position: static; } }

/* ---------- indicadores (KPI) ---------- */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
@media (max-width: 1100px) { .tiles { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .tiles { grid-template-columns: 1fr; } }
.tile { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-card); backdrop-filter: blur(18px) saturate(1.1); padding: 18px 20px; display: grid; grid-template-columns: 44px 1fr; gap: 2px 14px; align-items: center; }
.tile .ico { grid-row: 1 / span 2; width: 44px; height: 44px; border-radius: var(--r-md); background: rgba(var(--accent-rgb), .14); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; }
.tile .ico.leaf { background: color-mix(in oklab, var(--viz-emerald) 14%, transparent); color: var(--viz-emerald); }
.tile .ico.warn { background: color-mix(in oklab, var(--viz-amber) 14%, transparent); color: var(--viz-amber); }
.tile .ico.info { background: color-mix(in oklab, var(--viz-cyan) 14%, transparent); color: var(--viz-cyan); }
.tile .ico.violet { background: color-mix(in oklab, var(--viz-violet) 14%, transparent); color: var(--viz-violet); }
.tile .num { grid-column: 2; font-family: var(--font-display); font-size: 22px; font-weight: 600; color: var(--text-strong); font-variant-numeric: tabular-nums; line-height: 1.2; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .lbl { grid-column: 2; font-size: 12px; color: var(--text-muted); line-height: 1.35; }
.tile .hint { grid-column: 1 / -1; font-size: 12px; color: var(--text-subtle); margin-top: 6px; }
.tile.plain { grid-template-columns: 1fr; }
.tile.plain .num, .tile.plain .lbl { grid-column: 1; }

/* ---------- tablas ---------- */
.table-wrap { overflow-x: auto; margin: 0 -24px -24px; }
.card > .table-wrap:first-child, .card__head + .table-wrap, .filters + .table-wrap { margin-top: 0; }
table { width: 100%; border-collapse: collapse; font-size: 13px; color: var(--text); }
thead { background: var(--surface-subtle); }
th, td { text-align: left; padding: 12px 16px; vertical-align: middle; }
th:first-child, td:first-child { padding-left: 24px; }
th:last-child, td:last-child { padding-right: 24px; }
th { color: var(--text-muted); font-weight: 600; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; border-bottom: 1px solid var(--border-strong); }
td { border-bottom: 1px solid var(--border); }
tbody tr { transition: background .08s var(--ease); }
tbody tr:hover td { background: var(--fill-hover); }
tbody tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.r { font-family: var(--mono); font-size: 12.5px; color: var(--text-strong); }
td.date, td .date { font-family: var(--mono); font-size: 12px; color: var(--text-muted); white-space: nowrap; }
td a { font-weight: 600; color: var(--text-strong); }
td a:hover { color: var(--accent); }
td .sub { display: block; font-size: 12px; color: var(--text-subtle); font-weight: 400; margin-top: 1px; }
.rate { font-size: 12.5px; }
.pagination { display: flex; gap: 14px; justify-content: center; align-items: center; padding: 16px 0 0; font-size: 13px; color: var(--text-muted); }
.pagination a { font-weight: 600; }
.empty { color: var(--text-subtle); font-size: 13px; padding: 12px 0; }
td.empty { padding: 20px 24px; text-align: center; }

/* ---------- insignias de estado ---------- */
.badge { --b-50: var(--fill-active); --b-500: var(--text-muted); display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: var(--r-pill); font-size: 11px; font-weight: 600; white-space: nowrap; line-height: 1; color: var(--b-500); background: var(--b-50); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.s0 { --b-50: var(--fill-active); --b-500: var(--text-muted); }
.badge.s1 { --b-50: var(--info-50); --b-500: var(--info-500); }
.badge.s2 { --b-50: var(--warning-50); --b-500: var(--warning-500); }
.badge.s3 { --b-50: var(--success-50); --b-500: var(--success-500); }
.badge.s4 { --b-50: var(--danger-50); --b-500: var(--danger-500); }
.badge.s8, .badge.s9 { --b-50: var(--fill-hover); --b-500: var(--text-subtle); text-decoration: line-through; }
.badge.a-pending { --b-50: var(--warning-50); --b-500: var(--warning-500); }
.badge.a-approved { --b-50: var(--success-50); --b-500: var(--success-500); }
.badge.a-rejected { --b-50: var(--danger-50); --b-500: var(--danger-500); }
.badge.a-not_required { --b-50: var(--fill-active); --b-500: var(--text-muted); }
.badge.accent { --b-50: var(--accent-wash); --b-500: var(--accent); }
.badge.plain::before { display: none; }
.badge.count { height: 20px; min-width: 20px; justify-content: center; padding: 0 6px; font-family: var(--mono); }

/* ---------- botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--control-h); padding: 0 16px; border-radius: var(--r-sm); border: 1px solid var(--border-strong); background: transparent; color: var(--text); font-family: var(--font); font-size: 13px; font-weight: 600; line-height: 1.25; cursor: pointer; white-space: nowrap; user-select: none; transition: background .08s var(--ease), border-color .08s var(--ease), color .08s var(--ease), box-shadow .14s var(--ease); }
.btn .icon { width: 16px; height: 16px; }
.btn:hover { background: var(--fill-hover); color: var(--text-strong); }
.btn:active { background: var(--fill-active); }
.btn.primary { color: var(--on-accent); background: var(--gradient-accent); border-color: transparent; border-radius: var(--r-pill); box-shadow: var(--glow-accent); padding: 0 17px; }
.btn.primary:hover { color: var(--on-accent); filter: brightness(1.06); box-shadow: var(--glow-accent), var(--shadow-sm); }
.btn.primary:active { filter: brightness(.97); }
.btn.tonal { background: var(--fill-hover); border-color: transparent; color: var(--text-strong); }
.btn.tonal:hover { background: var(--fill-active); }
.btn.ghost { border-color: transparent; }
.btn.danger { color: var(--danger-500); border-color: transparent; background: var(--danger-50); }
.btn.danger:hover { filter: brightness(.97); color: var(--danger-500); }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 12px; }
.btn.link { border: 0; background: none; color: var(--link); padding: 0; min-height: 0; }
.btn.link:hover { text-decoration: underline; text-underline-offset: 2px; }
.btn.block { width: 100%; display: flex; }
.btn:disabled { color: var(--text-disabled); background: var(--fill-hover); border-color: transparent; box-shadow: none; cursor: not-allowed; }

/* ---------- formularios ---------- */
form div { margin-bottom: 14px; }
label { display: block; font-size: 13px; font-weight: 500; color: var(--text-strong); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=url], input[type=tel], select, textarea {
  width: 100%; min-height: var(--control-h); padding: 0 12px; border: 1px solid var(--border); border-radius: var(--r-sm); font-family: var(--font); font-size: 13px; background: var(--surface-solid); color: var(--text); transition: border-color .08s var(--ease), box-shadow .14s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--text-disabled); }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
textarea { padding: 12px; min-height: 64px; line-height: 1.5; resize: vertical; }
input[type=checkbox] { appearance: none; width: 18px; height: 18px; min-height: 0; padding: 0; border: 1px solid var(--border-strong); border-radius: var(--r-xs); background: var(--surface-solid); cursor: pointer; position: relative; vertical-align: middle; }
input[type=checkbox]:hover { border-color: var(--accent); }
input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent); }
input[type=checkbox]:checked::after { content: ""; position: absolute; inset: 0; background: 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='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center no-repeat; }
select { appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238A93A4' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; cursor: pointer; }
.helptext { display: block; color: var(--text-subtle); font-size: 12px; margin-top: 5px; line-height: 1.4; }
.errorlist { color: var(--danger-500); margin: 4px 0 0; padding-left: 18px; font-size: 12px; }
.fielderror { display: block; color: var(--danger-500); font-size: 12px; margin-top: 4px; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger-500); }
.field { margin-bottom: 14px; min-width: 0; }
.field-check label { display: flex; align-items: center; gap: 8px; min-height: var(--control-h); margin: 0; padding-top: 25px; }
.field-check input { margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.form-grid > div:has(textarea), .form-grid > p, .form-grid > .full { grid-column: 1 / -1; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }
.form-actions { display: flex; gap: 8px; align-items: center; padding-top: 8px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; align-items: center; }
.filters input[type=search] { flex: 1; min-width: 220px; width: auto; }
.filters select, .filters input[type=date] { width: auto; min-width: 180px; }
.filters label { display: inline; margin: 0; font-weight: 400; color: var(--text-muted); }
.filters .btn { min-height: var(--control-h); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--r-pill); border: 1px solid var(--border-strong); background: transparent; color: var(--text-muted); font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.chip:hover { background: var(--fill-hover); color: var(--text-strong); }
.chip.on { background: var(--gradient-accent); color: var(--on-accent); border-color: transparent; box-shadow: var(--glow-accent); }
.chip .n { font-family: var(--mono); font-size: 11px; opacity: .8; }
.input-group { display: flex; align-items: stretch; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-solid); overflow: hidden; }
.input-group:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.input-group .addon { display: inline-flex; align-items: center; padding: 0 12px; font-size: 13px; color: var(--text-subtle); background: var(--surface-subtle); border-right: 1px solid var(--border); white-space: nowrap; }
.input-group input { border: 0; border-radius: 0; box-shadow: none !important; }

/* ---------- avisos ---------- */
.messages { margin-bottom: 16px; display: grid; gap: 8px; }
.msg { --a-50: var(--fill-hover); --a-500: var(--text-muted); display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r-md); border: 1px solid var(--border); border-left: 3px solid var(--a-500); background: var(--a-50); color: var(--text); font-size: 13px; margin-bottom: 16px; }
.msg-success { --a-50: var(--success-50); --a-500: var(--success-500); }
.msg-warning { --a-50: var(--warning-50); --a-500: var(--warning-500); }
.msg-error { --a-50: var(--danger-50); --a-500: var(--danger-500); }
.msg-info { --a-50: var(--info-50); --a-500: var(--info-500); }
.note { color: var(--warning-700); font-size: 12.5px; margin: 6px 0; padding: 6px 10px; background: var(--warning-50); border-radius: var(--r-xs); }
.toasts { position: fixed; top: 72px; right: 16px; z-index: 50; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.toast { margin: 0; background: var(--surface-overlay); backdrop-filter: blur(18px) saturate(1.1); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); animation: toast-in .2s var(--ease); }
.toast.is-hiding { opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .2s; }
.toast__close { margin-left: auto; background: none; border: 0; color: var(--text-subtle); cursor: pointer; font-size: 18px; line-height: 1; padding: 0 2px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } .nav-item, .btn, tbody tr { transition: none; } }

/* ---------- ficha: portada, hechos, línea de tiempo ---------- */
.hero { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 20px 24px; align-items: start; }
.hero__ico { width: 96px; height: 96px; border-radius: var(--r-lg); background: rgba(var(--accent-rgb), .14); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; }
.hero__ico .icon { width: 40px; height: 40px; stroke-width: 1.5; }
.hero__title { margin: 0; font-family: var(--font-display); font-size: 24px; line-height: 32px; font-weight: 600; color: var(--text-strong); letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hero__desc { margin: 6px 0 12px; color: var(--text-muted); font-size: 14px; max-width: 70ch; }
.hero__meta { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--text-muted); }
.hero__meta span { display: inline-flex; align-items: center; gap: 6px; }
.hero__meta .icon { width: 16px; height: 16px; color: var(--text-subtle); }
.hero__meta a { color: var(--text-strong); font-weight: 500; }
.hero__total { text-align: right; min-width: 180px; }
.hero__total .lbl { display: block; font-size: 12px; color: var(--text-muted); }
.hero__total .amount { display: block; font-family: var(--font-display); font-size: 32px; line-height: 36px; font-weight: 600; color: var(--text-strong); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; white-space: nowrap; }
.hero__total .amount small { font-size: 14px; font-weight: 500; color: var(--text-muted); margin-left: 4px; }
.hero__total .badge { margin-top: 8px; }
.hero__tabs { grid-column: 1 / -1; display: flex; gap: 4px; margin: 4px -24px -24px; padding: 0 24px; border-top: 1px solid var(--border); }
.hero__tabs a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; font-size: 13px; font-weight: 500; color: var(--text-muted); position: relative; }
.hero__tabs a.on { color: var(--text-strong); }
.hero__tabs a.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px; }
@media (max-width: 800px) { .hero { grid-template-columns: 64px 1fr; } .hero__ico { width: 64px; height: 64px; } .hero__total { grid-column: 1 / -1; text-align: left; } }

.statgroup { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat { position: relative; display: flex; align-items: center; gap: 12px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-card); backdrop-filter: blur(18px) saturate(1.1); min-width: 0; }
.stat .ico { width: 36px; height: 36px; border-radius: var(--r-sm); background: rgba(var(--accent-rgb), .14); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.stat .ico .icon { width: 16px; height: 16px; }
.stat .ico.c2 { background: color-mix(in oklab, var(--viz-cyan) 14%, transparent); color: var(--viz-cyan); }
.stat .ico.c3 { background: color-mix(in oklab, var(--viz-violet) 14%, transparent); color: var(--viz-violet); }
.stat .ico.c4 { background: color-mix(in oklab, var(--viz-amber) 14%, transparent); color: var(--viz-amber); }
.stat .ico.c5 { background: color-mix(in oklab, var(--viz-emerald) 14%, transparent); color: var(--viz-emerald); }
.stat .txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.stat .val { font-family: var(--font-display); font-size: 20px; font-weight: 600; color: var(--text-strong); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.stat .lbl { font-size: 12px; color: var(--text-muted); line-height: 1.35; }

.facts { display: grid; grid-template-columns: minmax(120px, 160px) 1fr; gap: 10px 16px; margin: 0; font-size: 13px; }
.facts dt { color: var(--text-muted); }
.facts dd { margin: 0; color: var(--text-strong); font-weight: 500; }
.facts dd.big { font-family: var(--font-display); font-size: 22px; font-weight: 600; }
.facts dd .mono { margin-left: 6px; }
.line { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.line:last-of-type { border-bottom: 0; }
.line .amt, .line > span:last-child { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text-strong); white-space: nowrap; margin-left: 12px; }
.line.total { border-top: 1px solid var(--border-strong); border-bottom: 0; font-weight: 600; color: var(--text-strong); }
.line.total .amt { font-size: 16px; }
.prose h3:first-child { margin-top: 0; }
.prose p { margin: 0 0 12px; font-size: 13.5px; color: var(--text); line-height: 1.6; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; display: flex; gap: 14px; padding-bottom: 20px; font-size: 13px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline .mark { position: relative; z-index: 1; width: 28px; height: 28px; border-radius: var(--r-pill); display: inline-flex; align-items: center; justify-content: center; background: var(--surface-subtle); border: 1px solid var(--border); color: var(--text-muted); flex: none; }
.timeline .mark .icon { width: 16px; height: 16px; }
.timeline li:not(:last-child) .mark::before { content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); width: 1px; height: 28px; background: var(--border); }
.timeline .mark.done, .timeline .mark.ok { background: var(--success-500); border-color: transparent; color: #fff; }
.timeline .mark.late { background: var(--danger-500); border-color: transparent; color: #fff; }
.timeline .mark.today { background: var(--warning-50); border-color: transparent; color: var(--warning-500); }
.timeline .mark.info { background: var(--info-50); border-color: transparent; color: var(--info-500); }
.timeline .mark.now { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.timeline .body { flex: auto; min-width: 0; padding-top: 4px; }
.timeline .body a, .timeline .body strong { font-weight: 600; color: var(--text-strong); }
.timeline .when { display: block; font-family: var(--mono); font-size: 12px; color: var(--text-subtle); margin-top: 2px; }
.timeline .desc { display: block; color: var(--text-muted); margin-top: 4px; }
.followup { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.followup:last-of-type { border-bottom: 0; }
ul.plain { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
details summary { cursor: pointer; color: var(--link); margin: 10px 0; font-weight: 600; font-size: 13px; list-style: none; display: flex; align-items: center; gap: 6px; }
details summary::-webkit-details-marker { display: none; }
details summary::before { content: ""; width: 6px; height: 6px; border-right: 1.75px solid currentColor; border-bottom: 1.75px solid currentColor; transform: rotate(-45deg); margin-right: 4px; transition: transform .14s; }
details[open] summary::before { transform: rotate(45deg); }
.stack { margin: 0 0 12px; }
.stack form div, details.stack form div { margin-bottom: 10px; }
details.stack summary { margin: 0 0 8px; }
.progress { height: 6px; background: var(--fill-active); border-radius: var(--r-pill); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--gradient-accent); border-radius: var(--r-pill); }
.empty-state { text-align: center; padding: 20px 12px 8px; }
.empty-state__ico { width: 52px; height: 52px; border-radius: var(--r-md); background: rgba(var(--accent-rgb), .14); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.empty-state__ico .icon { width: 24px; height: 24px; }
.empty-state h3 { margin: 0 0 6px; font-family: var(--font-display); font-size: 18px; text-transform: none; letter-spacing: 0; color: var(--text-strong); }
.empty-state p { margin: 0 auto 16px; max-width: 36ch; color: var(--text-muted); font-size: 13px; }

/* ---------- edición de cotización por pasos ---------- */
.step-card .eyebrow { display: block; margin-bottom: 2px; }
.step-card > h2 { margin-bottom: 2px; }
.step-card .sub { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }
.step { padding: 16px 0; border-top: 1px solid var(--border); }
.step:first-of-type { border-top: 0; padding-top: 0; }
.step__head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.step__head h3, details.step summary { margin: 0; font-size: 14px; font-weight: 600; color: var(--text-strong); text-transform: none; letter-spacing: 0; }
.step__head h3 .muted, details.step summary .muted { font-weight: 400; font-size: 13px; }
.step__n { width: 24px; height: 24px; border-radius: 50%; background: rgba(var(--accent-rgb), .14); color: var(--accent); font-family: var(--font-display); font-weight: 700; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
details.step summary { display: flex; align-items: center; gap: 10px; cursor: pointer; color: var(--text-strong); }
details.step summary::before { display: none; }
details.step summary::after { content: ""; margin-left: auto; width: 7px; height: 7px; border-right: 1.75px solid var(--text-subtle); border-bottom: 1.75px solid var(--text-subtle); transform: rotate(45deg); transition: transform .14s; }
details.step[open] summary::after { transform: rotate(-135deg); }
details.step[open] summary { margin-bottom: 12px; }
.extras { display: grid; gap: 8px; }
.extras__head, .extras__row { display: grid; grid-template-columns: 1fr 150px; gap: 10px; align-items: center; }
.extras__head { font-size: 11px; color: var(--text-subtle); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.extras__row input { margin: 0; }
.total-card .lbl { display: block; font-size: 12px; color: var(--text-muted); }
.total-card .amount { display: block; font-family: var(--font-display); font-size: 32px; line-height: 36px; font-weight: 600; color: var(--text-strong); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; white-space: nowrap; margin: 2px 0 6px; }
.total-card .amount small { font-size: 14px; font-weight: 500; color: var(--text-muted); margin-left: 4px; }
.total-card .meta { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.total-card .actions { display: grid; gap: 8px; }
.total-card .actions .btn { width: 100%; }
.breakdown { margin-top: 20px; padding-top: 4px; border-top: 1px solid var(--border); }
.breakdown h3 { margin-top: 14px; }

/* ---------- tablero ---------- */
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
.dash-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; }
.dash-grid-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 24px; }
@media (max-width: 1100px) { .dash-grid, .dash-grid-3, .dash-grid-2 { grid-template-columns: 1fr; } }
.card.fill { display: flex; flex-direction: column; }
.card.fill .chart-box { flex: 1; min-height: 260px; height: auto; }
.chart-box { position: relative; height: 260px; }
.chart-box.small { height: 220px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: 1px; }
.glance { display: grid; }
.glance-item { display: grid; grid-template-columns: 40px minmax(0, 1fr) minmax(0, auto); gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--border); }
.glance-item:last-child { border-bottom: 0; }
.glance-item .ico { width: 40px; height: 40px; border-radius: var(--r-sm); display: inline-flex; align-items: center; justify-content: center; background: rgba(var(--accent-rgb), .14); color: var(--accent); }
.glance-item .ico.leaf { background: color-mix(in oklab, var(--viz-emerald) 14%, transparent); color: var(--viz-emerald); }
.glance-item .ico.warn { background: color-mix(in oklab, var(--viz-amber) 14%, transparent); color: var(--viz-amber); }
.glance-item .ico.info { background: color-mix(in oklab, var(--viz-cyan) 14%, transparent); color: var(--viz-cyan); }
.glance-item .ico.violet { background: color-mix(in oklab, var(--viz-violet) 14%, transparent); color: var(--viz-violet); }
.glance-item > span:nth-child(2) { display: block; min-width: 0; }
.glance-item .lbl { display: block; font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.glance-item .num { display: block; font-family: var(--font-display); font-size: 20px; font-weight: 600; color: var(--text-strong); font-variant-numeric: tabular-nums; line-height: 1.2; }
.delta { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.delta.up { color: var(--viz-emerald); } .delta.down { color: var(--viz-red); } .delta.flat { color: var(--text-subtle); font-weight: 500; }
.bars { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; font-size: 13px; }
.bar-row .name { color: var(--text-strong); font-weight: 500; }
.bar-row .name .sub { display: block; font-size: 12px; color: var(--text-subtle); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .val { font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: 12px; white-space: nowrap; font-family: var(--mono); }
.bar-row .progress { grid-column: 1 / -1; }
.donut-wrap { display: grid; grid-template-columns: 160px 1fr; gap: 20px; align-items: center; }
.donut-legend { display: grid; gap: 10px; font-size: 13px; }
.donut-legend div { display: flex; justify-content: space-between; gap: 10px; }
.donut-legend b { font-variant-numeric: tabular-nums; color: var(--text-strong); font-family: var(--mono); font-weight: 600; }
.donut-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 8px; vertical-align: 1px; }

/* ---------- acceso (sin barra lateral) ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(900px 520px at 8% -10%, var(--glow-1), transparent 60%), radial-gradient(800px 520px at 100% 0%, var(--glow-2), transparent 60%), radial-gradient(700px 520px at 60% 110%, var(--glow-3), transparent 60%), var(--canvas); }
.auth .card { width: 100%; max-width: 420px; padding: 32px 32px 24px; margin: 0; }
.auth .logo { display: block; height: 56px; width: auto; margin: 0 auto 20px; }
.auth h1 { font-family: var(--font-display); font-size: 24px; margin: 0 0 4px; color: var(--text-strong); text-align: center; letter-spacing: -0.01em; }
.auth .lead { text-align: center; margin: 0 0 20px; font-size: 13px; }
.auth .btn { width: 100%; }

/* ---------- Tom Select con el sistema visual ---------- */
.ts-wrapper { width: 100%; }
.ts-control { border: 1px solid var(--border) !important; border-radius: var(--r-sm) !important; background: var(--surface-solid) !important; color: var(--text); padding: 0 12px !important; min-height: var(--control-h); display: flex; align-items: center; font: inherit; font-size: 13px; box-shadow: none !important; }
.ts-control:hover { border-color: var(--border-strong) !important; }
.ts-wrapper.focus .ts-control { border-color: var(--accent) !important; box-shadow: var(--focus) !important; }
.ts-control input { font: inherit !important; font-size: 13px !important; color: var(--text) !important; }
.ts-control input::placeholder { color: var(--text-disabled); }
.ts-wrapper.single .ts-control:after { border-color: var(--text-subtle) transparent transparent transparent !important; right: 14px !important; }
.ts-wrapper.single .ts-control { cursor: pointer; }
.ts-wrapper.single .ts-control .item { color: var(--text); }
.ts-dropdown { border: 1px solid var(--border) !important; border-radius: var(--r-lg) !important; background: var(--surface-solid) !important; color: var(--text) !important; box-shadow: var(--shadow-lg) !important; margin-top: 6px !important; overflow: hidden; font-size: 13px; padding: 6px; }
.ts-dropdown .option { padding: 8px 10px !important; border-radius: var(--r-xs); }
.ts-dropdown .active { background: var(--fill-hover) !important; color: var(--text-strong) !important; }
.ts-dropdown .option.selected { color: var(--accent); font-weight: 600; }
.ts-dropdown .no-results { padding: 10px 12px; color: var(--text-subtle); }
.ts-dropdown-content { max-height: 280px !important; }
.ts-dropdown .dropdown-input-wrap { padding: 4px 4px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.ts-dropdown .dropdown-input { width: 100%; min-height: 34px; padding: 0 10px !important; border: 1px solid var(--border) !important; border-radius: var(--r-xs) !important; background: var(--surface-subtle) !important; color: var(--text-strong) !important; font: inherit !important; font-size: 13px !important; box-shadow: none !important; }
.ts-dropdown .dropdown-input:focus { border-color: var(--accent) !important; box-shadow: var(--focus) !important; }
.filters .ts-wrapper { width: auto; min-width: 240px; }

/* ---------- barra lateral compacta ---------- */
.shell.compact { grid-template-columns: 76px 1fr; }
.shell.compact .sidebar__brand { padding: 0 12px; justify-content: center; }
.shell.compact .sidebar__brand img { height: 30px; }
.shell.compact .sidebar__search, .shell.compact .sidebar__label, .shell.compact .nav-item .label, .shell.compact .sidebar__meta, .shell.compact .nav-item .count { display: none; }
.shell.compact .nav-item { justify-content: center; padding: 9px; }
.shell.compact .nav-item.active::before { left: -12px; }
.shell.compact .sidebar__user { flex-direction: column; gap: 8px; padding: 12px 8px; }
@media (max-width: 960px) { .shell.compact { grid-template-columns: 1fr; } .shell.compact .sidebar__search, .shell.compact .sidebar__label, .shell.compact .nav-item .label, .shell.compact .sidebar__meta { display: block; } .shell.compact .nav-item { justify-content: flex-start; } }

/* ---------- botón de tema ---------- */
.theme-toggle .icon { display: none; }
.theme-toggle[data-mode="system"] .icon.i-system, .theme-toggle[data-mode="light"] .icon.i-light, .theme-toggle[data-mode="dark"] .icon.i-dark { display: block; }

/* ======================================================================
   Tema oscuro: los tokens de Vireo para el modo oscuro, con el turquesa
   de la marca aclarado para que contraste. Se activa por sistema o por
   elección explícita ([data-theme]).
   ====================================================================== */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --canvas: #0a0c11; --surface: #161a23b8; --surface-solid: #161a23; --surface-subtle: #1c212ccc; --surface-raised: #10131cb8; --surface-overlay: #141821eb;
    --fill-hover: #ffffff0a; --fill-active: #ffffff17; --border: #ffffff12; --border-strong: #ffffff1f; --glass-hi: #ffffff0f;
    --text-strong: #eaedf3; --text: #d4dae4; --text-muted: #98a2b3; --text-subtle: #7e889a; --text-disabled: #646e80;
    --n-25: #0f121a; --n-50: #161a23; --n-100: #1c212c; --n-150: #232a38; --n-200: #2d3543; --n-300: #3a4351;
    --accent: #2fb3c6; --accent-hover: #5cc7d6; --accent-wash: #10323a; --accent-rgb: 47, 179, 198; --on-accent: #06181c; --link: #5cc7d6;
    --brand-50: #10323a; --brand-100: #14434d; --brand-700: #5cc7d6; --brand-800: #a6e3ec;
    --leaf-50: #1c2f14; --leaf-700: #a5d979;
    --success-50: #14281d; --success-700: #7fd3a0; --warning-50: #2c2110; --warning-700: #e9b85d;
    --danger-50: #2f1714; --danger-700: #f09a8d; --info-50: #12223a; --info-700: #8fbaf0;
    --success-500: #34d399; --warning-500: #fbbf24; --danger-500: #fb7185; --info-500: #60a5fa;
    --viz-cyan: #38bdf8; --viz-violet: #a78bfa; --viz-amber: #fbbf24; --viz-emerald: #34d399; --viz-pink: #f472b6; --viz-red: #fb7185;
    --glow-1: #ff8a4c2e; --glow-2: #6366f133; --glow-3: rgba(var(--accent-rgb), .12);
    --shadow-card: 0 18px 44px -22px #00000080, 0 2px 10px #0000004d; --shadow-md: 0 14px 36px -14px #00000099, 0 4px 12px -6px #00000066; --shadow-lg: 0 28px 64px -20px #000000b3, 0 8px 20px -8px #00000080;
    --focus: 0 0 0 3px rgba(var(--accent-rgb), .3);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #0a0c11; --surface: #161a23b8; --surface-solid: #161a23; --surface-subtle: #1c212ccc; --surface-raised: #10131cb8; --surface-overlay: #141821eb;
  --fill-hover: #ffffff0a; --fill-active: #ffffff17; --border: #ffffff12; --border-strong: #ffffff1f; --glass-hi: #ffffff0f;
  --text-strong: #eaedf3; --text: #d4dae4; --text-muted: #98a2b3; --text-subtle: #7e889a; --text-disabled: #646e80;
  --n-25: #0f121a; --n-50: #161a23; --n-100: #1c212c; --n-150: #232a38; --n-200: #2d3543; --n-300: #3a4351;
  --accent: #2fb3c6; --accent-hover: #5cc7d6; --accent-wash: #10323a; --accent-rgb: 47, 179, 198; --on-accent: #06181c; --link: #5cc7d6;
  --brand-50: #10323a; --brand-100: #14434d; --brand-700: #5cc7d6; --brand-800: #a6e3ec;
  --leaf-50: #1c2f14; --leaf-700: #a5d979;
  --success-50: #14281d; --success-700: #7fd3a0; --warning-50: #2c2110; --warning-700: #e9b85d;
  --danger-50: #2f1714; --danger-700: #f09a8d; --info-50: #12223a; --info-700: #8fbaf0;
  --success-500: #34d399; --warning-500: #fbbf24; --danger-500: #fb7185; --info-500: #60a5fa;
  --viz-cyan: #38bdf8; --viz-violet: #a78bfa; --viz-amber: #fbbf24; --viz-emerald: #34d399; --viz-pink: #f472b6; --viz-red: #fb7185;
  --glow-1: #ff8a4c2e; --glow-2: #6366f133; --glow-3: rgba(var(--accent-rgb), .12);
  --shadow-card: 0 18px 44px -22px #00000080, 0 2px 10px #0000004d; --shadow-md: 0 14px 36px -14px #00000099, 0 4px 12px -6px #00000066; --shadow-lg: 0 28px 64px -20px #000000b3, 0 8px 20px -8px #00000080;
  --focus: 0 0 0 3px rgba(var(--accent-rgb), .3);
}
/* logo sobre fondo oscuro */
:root[data-theme="dark"] .sidebar__brand img, :root[data-theme="dark"] .auth .logo { background: #fff; padding: 3px 6px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sidebar__brand img, :root:not([data-theme="light"]) .auth .logo { background: #fff; padding: 3px 6px; } }
