/* ==========================================================================
   gmx · Gestoría MX — Design system
   Todo color, tamaño y espacio sale de estos tokens. Las pantallas usan las
   clases de abajo; no se escriben colores ni medidas sueltas en las vistas.
   ========================================================================== */

:root {
  /* Marca (medidos del logo) */
  --marca-azul: #0040bc;
  --marca-celeste: #30a8e4;
  --marca-tinta: #1c1c1c;

  /* Superficies y texto: neutros fríos con sesgo al azul de la marca */
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f6f8fc;
  --surface-3: #eceff6;
  --border: #e0e5ee;
  --border-strong: #c9d1df;
  --control-border: #868fa3;
  --text: var(--marca-tinta);
  --text-2: #4a5367;
  --muted: #646d81;

  /* Acción e interacción */
  --primary: var(--marca-azul);
  --primary-hover: #00349a;
  --primary-soft: #e7edfa;
  --on-primary: #ffffff;
  --accent: var(--marca-celeste);
  --accent-soft: #e5f4fc;
  --focus-ring: 0 0 0 2px #ffffff, 0 0 0 4px #0040bc;

  /* Estados (siempre con texto o ícono, nunca solo color) */
  --success: #11744d; --success-soft: #e3f3eb;
  --warn: #935700;    --warn-soft: #fcf1dc;  --warn-mark: #b97a0f;
  --danger: #bc3227;  --danger-soft: #fbe9e7; --danger-border: #efc4bf;
  --info: #0a6a98;    --info-soft: #e5f4fc;
  --neutral: #5c6476; --neutral-soft: #edf0f5;
  --whatsapp: #0c7a43; --whatsapp-soft: #e7f6ee; --whatsapp-border: #b9e2cc;

  /* Bolsas de dinero: cada concepto conserva su color en todas las pantallas */
  --bolsa-k: var(--marca-azul);
  --bolsa-l: var(--marca-celeste);
  --bolsa-estado: #7a8398;
  --bolsa-facturas: #b37a10;

  /* Series de gráficas (paleta validada para daltonismo) */
  --serie-1: #2a78d6;
  --serie-2: #eb6834;

  /* Tipografía */
  --font-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-ui: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --text-xs: 11.5px;   /* etiquetas en mayúsculas, chips */
  --text-sm: 12.5px;   /* textos secundarios, ayudas */
  --text-base: 14px;   /* texto de la interfaz */
  --text-md: 15px;     /* títulos de tarjeta */
  --text-lg: 18px;     /* montos destacados */
  --text-xl: 24px;     /* títulos de página, cifras de tablero */
  --text-2xl: 30px;    /* cifra principal */

  /* Espaciado (múltiplos de 4) */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;

  /* Forma */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(16, 32, 72, .06);
  --shadow: 0 6px 20px rgba(16, 32, 72, .10);
  --overlay: rgba(16, 32, 72, .35);
  --hover-tint: rgba(16, 32, 72, .04);
  --control-h: 38px;
  --control-h-sm: 30px;
  --sidebar-w: 236px;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 var(--text-base)/1.5 var(--font-ui); color: var(--text); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
h1 { font: 800 var(--text-xl)/1.15 var(--font-display); font-stretch: 112%; letter-spacing: -.01em; }
h2 { font-size: var(--text-md); font-weight: 700; }
h3 { font-size: 13px; font-weight: 700; }
p { margin: 0 0 .75em; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }
.icon { width: 18px; height: 18px; flex: none; }

/* ---------- Utilidades ---------- */
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.text-ink { color: var(--text); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-strong { font-weight: 600; }
.small { font-size: var(--text-sm); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.pre-line { white-space: pre-line; }
.mono { font-family: var(--font-mono); font-size: 12.5px; font-weight: 500; letter-spacing: .01em; font-feature-settings: "zero" 1; }
.right { text-align: right; }
.hidden { display: none !important; }
.w-full { width: 100%; }
.m-0 { margin: 0; }
.mt-0 { margin-top: 0; }
.mt-xs { margin-top: var(--sp-1); }
.mt-sm { margin-top: var(--sp-2); }
.mt { margin-top: var(--sp-4); }
.mb-0 { margin-bottom: 0; }
.mb-xs { margin-bottom: var(--sp-1); }
.mb-sm { margin-bottom: var(--sp-2); }
.mb { margin-bottom: var(--sp-4); }
.ml-sm { margin-left: var(--sp-2); }
.row { display: flex; align-items: center; gap: var(--sp-2); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.row-end { display: flex; justify-content: flex-end; gap: var(--sp-2); }
.baseline { align-items: baseline; }
.items-end { align-items: flex-end; }
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }
.divider-top { border-top: 1px solid var(--border); }
.pt-sm { padding-top: var(--sp-3); }
.narrow-sm { max-width: 480px; }
.narrow { max-width: 640px; }
.narrow-lg { max-width: 860px; }
.is-inactive { opacity: .55; }
.eyebrow { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }

/* ---------- Estructura ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: var(--sp-5) var(--sp-3); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow-y: auto; }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2); padding: var(--sp-1) var(--sp-3) var(--sp-5); color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { display: block; }
.brand-logo { width: 104px; height: auto; }
.brand-name { font-size: var(--text-xs); font-weight: 600; line-height: 1.35; color: var(--muted); letter-spacing: .02em; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; }
.nav a .icon { color: var(--muted); }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav a.active .icon { color: var(--primary); }
.nav-label { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: var(--sp-4) var(--sp-3) var(--sp-1); }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: var(--sp-3); }
.user-chip { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); font-weight: 600; }
.user-chip .avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-size: var(--text-xs); font-weight: 700; }
.user-chip small { display: block; color: var(--muted); font-size: var(--text-xs); font-weight: 500; }
.sidebar-foot form { margin: 0; }
.sidebar-foot button, .sidebar-foot a { display: flex; align-items: center; gap: var(--sp-3); width: 100%; padding: 7px var(--sp-3); border: 0; background: none; color: var(--text-2); font: inherit; cursor: pointer; border-radius: var(--radius-sm); }
.sidebar-foot button:hover, .sidebar-foot a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sidebar-foot .icon { color: var(--muted); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-8); background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.topbar .search { flex: 1; max-width: 560px; position: relative; }
.topbar .search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.topbar .search input { padding-left: 34px; background: var(--surface-2); }
.menu-btn { display: none; }
.content { padding: var(--sp-6) var(--sp-8) var(--sp-10); max-width: 1400px; width: 100%; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-5); flex-wrap: wrap; }
.page-head p { margin: var(--sp-1) 0 0; color: var(--text-2); }
.page-head .actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.crumbs { font-size: var(--text-sm); color: var(--muted); margin-bottom: var(--sp-1); }
.crumbs a { color: var(--text-2); }

/* ---------- Tarjetas y rejillas ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card.flat { box-shadow: none; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head .actions { display: flex; gap: 6px; }
.card-body { padding: var(--sp-4) 18px; }
.card-body.flush { padding: 0; }
.card + .card { margin-top: var(--sp-4); }
.grid > .card + .card { margin-top: 0; }
.grid { display: grid; gap: var(--sp-4); align-items: start; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.stack > * + * { margin-top: var(--sp-4); }

/* Cifras de tablero */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(176px, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-5); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px var(--sp-4); box-shadow: var(--shadow-sm); display: block; color: inherit; }
a.stat:hover { border-color: var(--border-strong); text-decoration: none; }
.stat .label { color: var(--text-2); font-size: var(--text-sm); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.stat .value { font: 800 var(--text-xl)/1.2 var(--font-display); font-stretch: 112%; margin-top: var(--sp-1); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.stat .hint { font-size: var(--text-sm); color: var(--muted); margin-top: 2px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

/* Embudo de estatus */
.pipeline { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: var(--sp-5); }
.pipeline a { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-3) 14px; color: inherit; box-shadow: var(--shadow-sm); border-top: 3px solid var(--tone, var(--border)); }
.pipeline a:hover { text-decoration: none; border-color: var(--border-strong); border-top-color: var(--tone); }
.pipeline .n { font: 800 var(--text-xl)/1.2 var(--font-display); font-stretch: 112%; font-variant-numeric: tabular-nums; }
.pipeline .l { font-size: var(--text-sm); color: var(--text-2); }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); padding: 9px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th.num { text-align: right; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .sub { display: block; color: var(--muted); font-size: var(--text-sm); }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border); }
.row-link { color: var(--text); font-weight: 600; }
.tabla-costos td { vertical-align: middle; padding: 6px 10px; }
.tabla-costos input[type=text] { width: 110px; min-height: var(--control-h-sm); padding: 5px 8px; text-align: right; font-variant-numeric: tabular-nums; }
.tabla-costos input[type=number] { width: 72px; min-height: var(--control-h-sm); padding: 5px 8px; }
.tabla-costos tr.grupo td { background: var(--surface-2); font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-2); padding: 6px 14px; }

/* ---------- Insignias, etiquetas y chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: var(--radius-pill); font-size: var(--text-xs); font-weight: 700; white-space: nowrap; background: var(--neutral-soft); color: var(--neutral); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.tone-primary { --tone: var(--primary); }
.tone-info { --tone: var(--accent); }
.tone-warn { --tone: var(--warn-mark); }
.tone-danger { --tone: var(--danger); }
.tone-success { --tone: var(--success); }
.tone-muted { --tone: var(--neutral); }
.badge.tone-primary { background: var(--primary-soft); color: var(--primary); }
.badge.tone-info { background: var(--info-soft); color: var(--info); }
.badge.tone-warn { background: var(--warn-soft); color: var(--warn); }
.badge.tone-danger { background: var(--danger-soft); color: var(--danger); }
.badge.tone-success { background: var(--success-soft); color: var(--success); }
.badge.tone-muted { background: var(--neutral-soft); color: var(--neutral); }
.tag-urgente { display: inline-block; font-size: var(--text-xs); font-weight: 700; color: var(--danger); background: var(--danger-soft); border-radius: 4px; padding: 0 6px; margin-left: 6px; text-transform: uppercase; letter-spacing: .04em; }
.bolsa { display: inline-flex; align-items: center; gap: 6px; }
.bolsa::before { content: ""; width: 9px; height: 9px; border-radius: 3px; background: var(--bolsa, var(--neutral)); flex: none; }
.bolsa-k { --bolsa: var(--bolsa-k); }
.bolsa-l { --bolsa: var(--bolsa-l); }
.bolsa-estado { --bolsa: var(--bolsa-estado); }
.bolsa-facturas { --bolsa: var(--bolsa-facturas); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips a { padding: 4px 11px; border: 1px solid var(--border); border-radius: var(--radius-pill); color: var(--text-2); font-size: var(--text-sm); font-weight: 600; background: var(--surface); }
.chips a.active { background: var(--text); color: var(--surface); border-color: var(--text); }
.chips a:hover { text-decoration: none; border-color: var(--border-strong); }

/* ---------- Formularios ---------- */
label { display: block; font-weight: 600; font-size: var(--text-sm); color: var(--text-2); margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=tel], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--control-border); border-radius: var(--radius-sm); padding: var(--sp-2) 10px; min-height: var(--control-h);
}
textarea { min-height: 76px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); }
input[type=file] { font: inherit; max-width: 100%; }
.field { margin-bottom: 14px; }
.field .help { font-size: var(--text-sm); color: var(--muted); margin-top: var(--sp-1); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--sp-4); }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 var(--sp-4); }
.form-grid .full, .form-grid-3 .full { grid-column: 1 / -1; }
.span-2 { grid-column: span 2; }
.check { display: flex; align-items: center; gap: var(--sp-2); font-weight: 500; color: var(--text); font-size: var(--text-base); margin: 0; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }
.form-actions { display: flex; gap: var(--sp-2); justify-content: flex-end; padding-top: 6px; }
.form-actions.stretch { justify-content: stretch; }
.req { color: var(--danger); }
.total-line { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3); border-top: 1px solid var(--border); padding-top: var(--sp-3); }
.total-value { font: 800 var(--text-lg)/1.2 var(--font-display); font-stretch: 112%; font-variant-numeric: tabular-nums; }
.total-value.lg { font-size: 22px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: inherit; font-weight: 600; padding: var(--sp-2) 14px; min-height: var(--control-h); border-radius: var(--radius-sm); border: 1px solid var(--control-border); background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { color: var(--danger); border-color: var(--danger-border); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--neutral-soft); }
.btn-sm { padding: var(--sp-1) 10px; min-height: var(--control-h-sm); font-size: var(--text-sm); }
.btn-icon { padding: 6px; min-height: var(--control-h-sm); }
.btn-wa { color: var(--whatsapp); border-color: var(--whatsapp-border); }
.btn-wa:hover { background: var(--whatsapp-soft); }
.inline { display: inline; margin: 0; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.toolbar.borderless { border: 0; }
.toolbar .field { margin: 0; min-width: 150px; }
.toolbar .grow { flex: 1; min-width: 220px; }

.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--border); margin-bottom: var(--sp-5); overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--text-2); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs a:hover { text-decoration: none; color: var(--text); }

/* ---------- Avisos ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: var(--sp-4); font-weight: 500; }
.alert .icon { margin-top: 1px; }
.alert-ok { background: var(--success-soft); color: var(--success); }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.alert-info { background: var(--info-soft); color: var(--info); }
.empty { padding: var(--sp-8) 18px; text-align: center; color: var(--muted); }
.empty-state { padding: var(--sp-10); text-align: center; }

/* ---------- Expediente ---------- */
.exp-head { display: flex; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; align-items: flex-start; margin-bottom: 18px; }
.exp-head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.folio-xl { font: 600 22px/1.2 var(--font-mono); letter-spacing: 0; font-feature-settings: "zero" 1; }
.folio-lg { font: 600 16px/1.3 var(--font-mono); font-feature-settings: "zero" 1; }
.exp-meta { display: flex; gap: 18px; flex-wrap: wrap; color: var(--text-2); margin-top: 6px; font-size: 13.5px; }
.dl { display: grid; grid-template-columns: 130px 1fr; gap: var(--sp-2) var(--sp-3); margin: 0; }
.dl dt { color: var(--muted); font-size: var(--text-sm); }
.dl dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.progress { height: 6px; background: var(--neutral-soft); border-radius: var(--radius-pill); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--success); border-radius: var(--radius-pill); }
.progress.serie-1 span { background: var(--serie-1); }
.progress-sm { width: 140px; }

.calculo-estado { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--sp-3) var(--sp-3) var(--sp-2); margin-bottom: 14px; }
.calculo-estado .field { margin-bottom: var(--sp-2); }
.desglose { list-style: none; margin: 0 0 var(--sp-2); padding: 0; font-size: var(--text-sm); }
.desglose li { display: flex; justify-content: space-between; gap: var(--sp-3); padding: 5px 0; border-bottom: 1px dashed var(--border); }
.desglose li > span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.desglose small { color: var(--muted); font-size: var(--text-xs); }
.desglose li.ajuste { color: var(--warn); }
.desglose li.total { font-weight: 700; border-bottom: 0; }
button.link { border: 0; background: none; padding: 0; font: inherit; color: var(--primary); cursor: pointer; text-decoration: underline; }
.conceptos { display: grid; gap: var(--sp-2); }
.check.concepto { align-items: flex-start; font-size: var(--text-sm); }
.check.concepto input { margin-top: 2px; flex: none; }
.check.concepto .sub { display: block; color: var(--muted); font-size: var(--text-xs); font-weight: 400; }
input[readonly] { background: var(--surface-2); color: var(--text-2); }
.tabla-costos td .sub { text-align: right; font-size: var(--text-xs); }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; align-items: center; gap: var(--sp-3); padding: 10px 18px; border-bottom: 1px solid var(--border); }
.checklist li:last-child { border-bottom: 0; }
.checklist .state { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none; border: 1.5px solid var(--border-strong); color: transparent; }
.checklist .state .icon { width: 14px; height: 14px; }
.checklist li.recibido .state { background: var(--success); border-color: var(--success); color: var(--on-primary); }
.checklist li.no_aplica .state { background: var(--neutral-soft); border-color: var(--neutral-soft); color: var(--neutral); }
.checklist li.no_aplica .name { color: var(--muted); text-decoration: line-through; }
.checklist .name { flex: 1; min-width: 0; }
.checklist .seg { display: inline-flex; border: 1px solid var(--control-border); border-radius: var(--radius-sm); overflow: hidden; flex: none; }
.checklist .seg button { border: 0; background: var(--surface); font: inherit; font-size: var(--text-sm); font-weight: 600; padding: var(--sp-1) 9px; cursor: pointer; color: var(--text-2); }
.checklist .seg button + button { border-left: 1px solid var(--control-border); }
.checklist .seg button.on { background: var(--neutral-soft); color: var(--text); }
.checklist .seg button.on[value=recibido] { background: var(--success); color: var(--on-primary); }
.checklist .seg button.on[value=pendiente] { background: var(--warn-soft); color: var(--warn); }

.docs { list-style: none; margin: 0; padding: 0; }
.docs li { display: flex; align-items: center; gap: var(--sp-3); padding: 10px 18px; border-bottom: 1px solid var(--border); }
.docs li:last-child { border-bottom: 0; }
.docs .file-ico { width: 34px; height: 34px; border-radius: var(--radius-sm); background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; flex: none; }
.docs .info { flex: 1; min-width: 0; }
.docs .info a { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.timeline { list-style: none; margin: 0; padding: 0 18px; }
.timeline li { position: relative; padding: 10px 0 10px 22px; border-left: 1px solid var(--border); margin-left: 5px; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 15px; width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); border: 2px solid var(--surface); }
.timeline li.t-estatus::before { background: var(--primary); }
.timeline li.t-pago::before { background: var(--success); }
.timeline li.t-nota::before { background: var(--accent); }
.timeline .when { font-size: var(--text-sm); color: var(--muted); }

.money-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border); }
.money-grid div { background: var(--surface); padding: var(--sp-3) var(--sp-4); }
.money-grid .l { font-size: var(--text-sm); color: var(--muted); }
.money-grid .v { font: 800 var(--text-lg)/1.3 var(--font-display); font-stretch: 112%; font-variant-numeric: tabular-nums; }

details.disclosure { border-top: 1px solid var(--border); }
details.disclosure > summary { padding: var(--sp-3) 18px; cursor: pointer; font-weight: 600; color: var(--primary); list-style: none; display: flex; align-items: center; gap: var(--sp-2); }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure[open] > summary { border-bottom: 1px solid var(--border); }
details.disclosure .inner { padding: 14px 18px var(--sp-1); }
details.disclosure.top { border-top: 0; border-bottom: 1px solid var(--border); }
.link-summary { cursor: pointer; color: var(--primary); }

.combo-filter { margin-bottom: 6px; }

/* ---------- Gráficas ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .gridline { stroke: var(--border); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .s1 { fill: var(--serie-1); }
.chart .s2 { fill: var(--serie-2); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover { fill: var(--hover-tint); }
.legend { display: flex; gap: var(--sp-4); font-size: var(--text-sm); color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend .s1 { background: var(--serie-1); }
.legend .s2 { background: var(--serie-2); }
.tooltip { position: absolute; pointer-events: none; background: var(--text); color: var(--surface); border-radius: var(--radius-sm); padding: 7px 10px; font-size: var(--text-sm); line-height: 1.5; white-space: nowrap; transform: translate(-50%, -100%); margin-top: -8px; z-index: 3; box-shadow: var(--shadow); }
.tooltip b { font-weight: 700; }

/* ---------- Acceso ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: var(--sp-6) var(--sp-4); background: var(--bg); }
.auth .card { width: 100%; max-width: 400px; }
.auth .card-body { padding: var(--sp-8) 28px; }
.auth-logo { display: block; width: 132px; height: auto; margin: 0 auto var(--sp-6); }
.auth-foot { margin: 18px 0 0; text-align: center; }

/* ---------- Responsivo ---------- */
.gap-md { gap: var(--sp-4); }
.col-sm { width: 80px; }
.col-md { width: 120px; }
.col-lg { width: 140px; flex: none; }

@media (max-width: 1100px) {
  .grid-main, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .pipeline { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax var(--overlay); }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 10px var(--sp-4); }
  .topbar .btn-primary span { display: none; }
  .content { padding: 18px var(--sp-4) var(--sp-10); }
  .toolbar .field { flex: 1 1 100%; }
  .grid-2, .grid-3, .form-grid, .form-grid-3 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .pipeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dl { grid-template-columns: 110px 1fr; }
  .checklist li { flex-wrap: wrap; }
  .table .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}

/* ---------- Impresión ---------- */
@media print {
  body { background: #fff; font-size: 12px; }
  .no-print, .sidebar, .topbar { display: none !important; }
  .app { display: block; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
  a { color: inherit; }
}
