/* ============================================================
   Componentes y layout · CRM GESÙ Hope Center
   Estándar visual: DESIGN/guia_componentes_ghc.md + maqueta CRM GHC.dc.html
   ============================================================ */

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg-app);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }
.tnum { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Barra de scroll discreta */
.scroll::-webkit-scrollbar { width: 9px; height: 9px; }
.scroll::-webkit-scrollbar-thumb { background: #CBD3E1; border-radius: 9px; }
.scroll::-webkit-scrollbar-track { background: transparent; }

/* ---------- Marca / logo ---------- */
.brand-mark {
  flex: none; border-radius: 11px; background: #fff;
  display: grid; place-items: center; box-shadow: var(--shadow-sm);
}
.brand-mark svg { display: block; }

/* ============================================================
   LOGIN
   ============================================================ */
.login-wrap { min-height: 100vh; display: flex; background: var(--bg-rail); }
.login-card {
  width: 100%; max-width: 460px; flex: none; background: var(--bg-app);
  display: flex; flex-direction: column; justify-content: center;
  padding: 48px 44px; min-height: 100vh;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 36px; }
.login-brand .name { font-size: 17px; font-weight: 800; color: var(--text-strong); }
.login-brand .sub {
  font-size: 11.5px; font-weight: 700; color: var(--text-subtle);
  text-transform: uppercase; letter-spacing: .6px;
}
.login-title { font-size: 24px; font-weight: 800; color: var(--text-strong); margin-bottom: 6px; }
.login-lead { font-size: 13.5px; color: var(--text-muted); font-weight: 600; margin-bottom: 26px; }
.login-foot {
  margin-top: auto; padding-top: 32px;
  font-size: 11.5px; color: var(--text-subtle); font-weight: 600;
}

/* ---------- Campo de formulario ---------- */
.field { margin-bottom: 16px; }
.field > label {
  display: block; font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 6px;
}
.field .req { color: var(--error); }
.input {
  width: 100%; font-size: 14px; color: var(--text-strong); background: var(--surface);
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-md);
  padding: 11px 13px; transition: border-color .12s, box-shadow .12s;
}
.input::placeholder { color: var(--text-subtle); }
.input:hover { border-color: #C6D0E2; }
.input:focus { outline: none; border-color: var(--brand-primary); box-shadow: var(--focus-ring); }
.field.invalid .input { border-color: var(--error); box-shadow: var(--focus-ring-error); }
.input-pw { position: relative; }
.input-pw .input { padding-right: 42px; }
.input-pw .toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; padding: 4px; color: var(--text-subtle);
  display: grid; place-items: center;
}

/* Mensajes en línea */
.msg { display: flex; align-items: flex-start; gap: 6px; font-size: 12px; font-weight: 700; line-height: 1.4; }
.msg.error { color: var(--error); }
.msg.error svg { stroke: var(--error); flex: none; margin-top: 1px; }
.msg.success-line { color: var(--success-text); }
.msg.success-line svg { stroke: var(--success-text); flex: none; margin-top: 1px; }
.field-msg { margin-top: 6px; }

/* Aviso enmarcado (cuenta desactivada, informativo) */
.notice {
  display: flex; align-items: flex-start; gap: 9px;
  border-radius: 11px; padding: 13px 15px; font-size: 12px; font-weight: 600; line-height: 1.45;
}
.notice svg { flex: none; margin-top: 1px; }
.notice.neutral { background: #F1F2F5; border: 1px solid var(--border-strong); color: var(--text-muted); }
.notice.neutral strong { color: #4A5568; }
.notice.error { background: var(--error-bg); border: 1px solid var(--error-border); color: var(--error-text); }
.notice.error svg { stroke: var(--error-text); }
.notice.info { background: var(--surface); border: 1px solid var(--border); color: var(--text-muted); box-shadow: var(--shadow-sm); }
.notice.info svg { stroke: var(--brand-primary); }
.notice.info strong { color: var(--text); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 14px; font-weight: 700; border-radius: var(--radius-md);
  padding: 11px 16px; cursor: pointer; border: 1.5px solid transparent;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn.block { width: 100%; }
.btn-primary { background: var(--brand-primary); color: #fff; box-shadow: var(--shadow-primary); }
.btn-primary:hover { background: var(--brand-primary-hover); }
.btn-primary:disabled { background: #B9C2D4; box-shadow: none; cursor: not-allowed; }
.btn-secondary { background: var(--surface); color: var(--brand-primary); border-color: var(--brand-primary-border); }
.btn-secondary:hover { background: var(--brand-primary-soft); }
.btn-neutral { background: var(--border-soft); color: var(--text); }
.btn-neutral:hover { background: #E4E8F0; }
.link { color: var(--brand-primary); font-weight: 700; cursor: pointer; }
.link:hover { color: var(--brand-primary-hover); text-decoration: underline; }

/* ============================================================
   SHELL: riel + barra superior + lienzo
   ============================================================ */
.shell { display: flex; min-height: 100vh; background: var(--bg-app); }

.rail {
  width: var(--rail-width); flex: none; background: var(--surface-inverse); color: #fff;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 40;
}
.rail-head { padding: 18px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.09); }
.rail-head .row { display: flex; align-items: center; gap: 10px; }
.rail-head .name { font-size: 14px; font-weight: 800; color: #fff; }
.rail-head .sub { font-size: 10.5px; color: var(--rail-sub); font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }
.rail-nav { flex: 1; overflow-y: auto; padding: 12px 10px 16px; display: flex; flex-direction: column; gap: 1px; }
.rail-group { padding: 14px 11px 6px; font-size: 10px; font-weight: 700; color: var(--rail-group); text-transform: uppercase; letter-spacing: .7px; }
.rail-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 11px; border-radius: var(--radius-md);
  cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--rail-item); background: transparent;
}
.rail-item:hover { color: #fff; }
.rail-item .ico {
  width: 20px; height: 20px; flex: none; border-radius: 6px; display: grid; place-items: center;
  font-size: 11px; font-weight: 800; color: var(--rail-sub); background: rgba(255,255,255,.08);
}
.rail-item.active { color: #fff; font-weight: 700; background: var(--rail-active-bg); }
.rail-item.active .ico { color: #fff; background: var(--brand-primary); }
.rail-item .tag {
  margin-left: auto; font-size: 9px; font-weight: 800; color: var(--rail-sub);
  background: rgba(255,255,255,.08); border-radius: 5px; padding: 2px 6px;
}
.rail-foot { padding: 12px 14px; border-top: 1px solid rgba(255,255,255,.09); display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 32px; height: 32px; flex: none; border-radius: 50%; background: var(--brand-primary); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 12px;
}
.rail-foot .who { min-width: 0; line-height: 1.25; flex: 1; }
.rail-foot .who .n { font-size: 12.5px; font-weight: 700; color: var(--rail-title); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-foot .who .r { font-size: 10.5px; color: var(--rail-sub); font-weight: 600; }
.rail-foot .logout { flex: none; background: none; border: none; cursor: pointer; color: var(--rail-sub); display: grid; place-items: center; padding: 4px; }
.rail-foot .logout:hover { color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; background: rgba(237,240,246,.86);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border-strong);
  padding: 13px 26px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.topbar .kicker { font-size: 11px; font-weight: 700; color: var(--text-subtle); text-transform: uppercase; letter-spacing: .6px; }
.topbar .title { font-size: 18px; font-weight: 800; color: var(--text-strong); line-height: 1.2; }
.topbar-right { display: flex; align-items: center; gap: 12px; flex: none; }
.hamburger { display: none; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-md); padding: 8px; cursor: pointer; color: var(--text); }

/* Selector de ejercicio */
.year-picker {
  display: flex; align-items: center; gap: 8px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  padding: 7px 12px; cursor: pointer; box-shadow: var(--shadow-sm); position: relative;
}
.year-picker .lbl { font-size: 10.5px; font-weight: 700; color: var(--text-subtle); text-transform: uppercase; letter-spacing: .4px; }
.year-picker .yr { font-size: 14px; font-weight: 800; color: var(--brand-primary); }
.year-badge { font-size: 9.5px; font-weight: 700; padding: 2px 6px; border-radius: 5px; }
.year-badge.abierto { color: var(--success-text); background: var(--success-bg); border: 1px solid var(--success-border); }
.year-badge.cerrado { color: var(--text-muted); background: #F1F2F5; border: 1px solid var(--border-strong); }
.year-backdrop { position: fixed; inset: 0; z-index: 55; }
.year-menu {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 190px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: 6px; z-index: 60;
}
.year-menu button {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: none; border: none; border-radius: var(--radius-md); padding: 9px 11px; cursor: pointer;
  font-size: 13px; font-weight: 700; color: var(--text-strong); text-align: left;
}
.year-menu button:hover { background: var(--surface-2); }
.year-menu button.sel { background: var(--brand-primary-soft); color: var(--brand-primary); }

.canvas { flex: 1; overflow: auto; padding: 24px 26px 56px; }
.stage { width: 100%; max-width: 1200px; margin: 0 auto; }

/* Backdrop del riel móvil */
.rail-backdrop { display: none; position: fixed; inset: 0; background: rgba(14,26,51,.5); z-index: 35; }

/* ============================================================
   VISTA INTEGRADA
   ============================================================ */
.hero {
  background: var(--hero-gradient); border-radius: var(--radius-xl); padding: 28px 30px;
  color: #fff; margin-bottom: 20px; position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -30px; top: -30px; width: 200px; height: 200px;
  border-radius: 50%; background: rgba(252,162,60,.16);
}
.hero .kicker { font-size: 12px; font-weight: 700; color: #9CB6EE; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 8px; }
.hero .h { font-size: 28px; font-weight: 800; line-height: 1.2; margin-bottom: 10px; max-width: 640px; }
.hero .p { font-size: 13.5px; color: #C9D6F2; font-weight: 600; max-width: 560px; }

.launch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.launch-card {
  background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--c, var(--brand-primary));
  border-radius: var(--radius-xl); padding: 20px; box-shadow: var(--shadow-sm); cursor: pointer;
  display: flex; flex-direction: column; gap: 14px; min-height: 190px;
  transition: box-shadow .14s, transform .14s;
}
.launch-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.launch-card .top { display: flex; align-items: center; justify-content: space-between; }
.launch-card .badge-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--soft, var(--brand-primary-soft)); color: var(--c, var(--brand-primary)); }
.launch-card .mid { flex: 1; }
.launch-card .mid .t { font-size: 16px; font-weight: 800; color: var(--text-strong); margin-bottom: 4px; }
.launch-card .mid .d { font-size: 12.5px; color: var(--text-subtle); font-weight: 600; line-height: 1.4; }
.launch-card .foot { border-top: 1px solid var(--border-soft); padding-top: 11px; display: flex; align-items: flex-end; justify-content: space-between; }
.launch-card .stat { font-size: 22px; font-weight: 800; color: var(--c, var(--brand-primary)); }
.launch-card .stat-lbl { font-size: 11px; font-weight: 700; color: var(--text-subtle); }
.launch-card .open { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: var(--c, var(--brand-primary)); }
.lock-badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700;
  color: var(--text-muted); background: #F1F2F5; border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill); padding: 3px 9px;
}
.launch-card.locked { cursor: not-allowed; opacity: .68; }
.launch-card.locked:hover { box-shadow: var(--shadow-sm); transform: none; }

/* ============================================================
   Estados de sistema (sin acceso, en construcción)
   ============================================================ */
.state-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl);
  padding: 40px 32px; box-shadow: var(--shadow-sm); text-align: center; max-width: 520px; margin: 24px auto;
}
.state-box .ico-wrap { width: 60px; height: 60px; border-radius: var(--radius-lg); display: grid; place-items: center; margin: 0 auto 16px; }
.state-box .ico-wrap.lock { background: #F1F2F5; color: var(--text-muted); }
.state-box .ico-wrap.build { background: var(--brand-primary-soft); color: var(--brand-primary); }
.state-box h2 { font-size: 20px; font-weight: 800; color: var(--text-strong); margin: 0 0 8px; }
.state-box p { font-size: 13.5px; color: var(--text-muted); font-weight: 600; margin: 0 0 20px; line-height: 1.5; }

/* Banda de solo lectura (ejercicio cerrado) */
.readonly-banner {
  display: flex; align-items: center; gap: 10px; background: #F1F2F5; border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); padding: 11px 15px; margin-bottom: 16px; color: var(--text-muted);
  font-size: 12.5px; font-weight: 700;
}
.readonly-banner svg { flex: none; stroke: var(--text-muted); }

/* Pantalla de carga */
.boot {
  min-height: 100vh; display: grid; place-items: center; background: var(--bg-app);
}
.boot .spinner {
  width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--border-strong);
  border-top-color: var(--brand-primary); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   DATOS GENERALES · componentes compartidos (Paquete 3)
   ============================================================ */
.spinner {
  width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--border-strong);
  border-top-color: var(--brand-primary); animation: spin .8s linear infinite;
}
.tab-loading { display: grid; place-items: center; padding: 60px 0; }
.btn-sm { padding: 8px 13px; font-size: 12.5px; }
.muted-hint { font-size: 12px; color: var(--text-subtle); font-weight: 600; }
.muted-empty { font-size: 12.5px; color: var(--text-subtle); font-weight: 600; padding: 10px 0; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.card-h { display: flex; justify-content: space-between; align-items: baseline; }
.card-t { font-size: 14px; font-weight: 800; color: var(--text-strong); }
.card-sub { font-size: 11.5px; color: var(--text-subtle); font-weight: 600; margin: 4px 0 14px; }
.sub-label { font-size: 11px; font-weight: 700; color: var(--text-subtle); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 8px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stack-col { display: flex; flex-direction: column; gap: 16px; }

/* Barra de filtros del tablero */
.filterbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 12px 16px; box-shadow: var(--shadow-sm); margin-bottom: 16px;
}
.filterbar-l { display: flex; align-items: baseline; gap: 10px; }
.filter-kicker { font-size: 11px; font-weight: 700; color: var(--text-subtle); text-transform: uppercase; letter-spacing: .5px; }
.filterbar-r { display: flex; align-items: center; gap: 12px; }
.toggle { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--text); cursor: pointer; }
.toggle-track { width: 34px; height: 20px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background .15s; display: inline-block; }
.toggle-track.on { background: var(--brand-primary); }
.toggle-knob { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: var(--shadow-sm); }
.toggle-track.on .toggle-knob { transform: translateX(14px); }

/* KPIs */
.kpi4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--c, var(--brand-primary)); border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.kpi-l { font-size: 11.5px; font-weight: 700; color: var(--text-subtle); text-transform: uppercase; letter-spacing: .4px; }
.kpi-v { font-size: 32px; font-weight: 800; color: var(--text-strong); margin: 6px 0 2px; }
.kpi-s { font-size: 11.5px; font-weight: 600; color: var(--text-subtle); }

/* Barras horizontales */
.barh { display: flex; align-items: center; gap: 11px; padding: 5px 0; }
.barh-lbl { width: 116px; flex: none; font-size: 12.5px; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barh-track { flex: 1; height: 9px; border-radius: 9px; background: var(--border-soft); overflow: hidden; }
.barh-fill { height: 100%; border-radius: 9px; background: var(--brand-primary); }
.barh-val { width: 42px; flex: none; text-align: right; font-size: 12px; font-weight: 800; color: var(--text-strong); }

/* Columnas verticales */
.cols { display: flex; align-items: flex-end; gap: 10px; }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.col-v { font-size: 11px; font-weight: 800; color: var(--text-strong); }
.col-bar { width: 100%; max-width: 40px; border-radius: 7px 7px 0 0; }
.col-x { font-size: 10.5px; font-weight: 700; color: var(--text-subtle); white-space: nowrap; }

/* Género apilado */
.stack { display: flex; height: 16px; border-radius: 8px; overflow: hidden; margin: 14px 0 12px; background: var(--border-soft); }
.legend { display: flex; gap: 18px; flex-wrap: wrap; }
.legend span { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700; color: var(--text); }
.legend i { width: 10px; height: 10px; border-radius: 3px; }

/* Metas */
.meta-row { padding: 8px 0; border-bottom: 1px solid var(--border-soft); }
.meta-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.meta-ind { font-size: 12.5px; font-weight: 700; color: var(--text-strong); line-height: 1.3; }
.meta-val { font-size: 12px; font-weight: 800; color: var(--text-strong); flex: none; }

/* Resumen financiero */
.fin-mini { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.fin-big { font-size: 30px; font-weight: 800; margin: 6px 0 2px; }
.fin-dark { background: var(--surface-inverse); border-radius: var(--radius-xl); padding: 18px 20px; display: flex; flex-direction: column; justify-content: center; }
.fin-dark-t { font-size: 12.5px; color: #9CB6EE; font-weight: 600; line-height: 1.4; margin-bottom: 10px; }
.fin-dark-btn { align-self: flex-start; font-size: 12.5px; font-weight: 700; color: var(--surface-inverse); background: #fff; border: none; border-radius: var(--radius-md); padding: 9px 14px; cursor: pointer; }
.fin-dark-note { font-size: 11.5px; color: #9CB6EE; font-weight: 600; }

/* ============================================================
   BÚSQUEDA Y LISTADO
   ============================================================ */
.searchbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.searchbox { display: flex; align-items: center; gap: 8px; flex: 1; max-width: 360px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-md); padding: 9px 12px; }
.searchbox svg { stroke: var(--text-subtle); flex: none; }
.searchbox input { border: none; outline: none; font-size: 13px; color: var(--text-strong); width: 100%; background: none; }
.chips-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-select { position: relative; display: inline-flex; align-items: center; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-md); }
.filter-select.active { border-color: var(--brand-primary); background: var(--brand-primary-soft); }
.filter-select select { appearance: none; -webkit-appearance: none; border: none; background: none; font-size: 12px; font-weight: 600; color: var(--text); padding: 8px 30px 8px 11px; cursor: pointer; outline: none; max-width: 200px; }
.filter-select svg { position: absolute; right: 9px; pointer-events: none; stroke: var(--text-subtle); }
.filter-input { font-size: 12px; font-weight: 600; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-md); padding: 8px 11px; outline: none; }
.filter-input:focus { border-color: var(--brand-primary); box-shadow: var(--focus-ring); }
.filter-input.date { color: var(--text-muted); }
.chip-clear { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: var(--error-text); background: var(--error-bg); border: 1px solid var(--error-border); border-radius: var(--radius-md); padding: 8px 11px; cursor: pointer; }
.list-summary { display: flex; align-items: center; justify-content: space-between; margin: 0 4px 10px; font-size: 12.5px; color: var(--text-muted); font-weight: 600; }
.list-summary strong { color: var(--text-strong); }

.casos-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow-x: auto; box-shadow: var(--shadow-sm); }
.casos-inner { min-width: 760px; }
.casos-row { display: grid; grid-template-columns: 74px 1.6fr 1fr 1.3fr 1fr 1.1fr 40px; gap: 12px; align-items: center; padding: 12px 18px; }
.casos-head { background: var(--surface-2); border-bottom: 1px solid #E9EDF4; font-size: 11px; font-weight: 700; color: var(--text-subtle); text-transform: uppercase; letter-spacing: .4px; }
.casos-item { border-bottom: 1px solid #F4F6FA; cursor: pointer; }
.casos-item:hover { background: var(--surface-2); }
.casos-item:last-child { border-bottom: none; }
.casos-item svg { stroke: #C6D0E2; }
.c-id { font-size: 12px; font-weight: 700; color: var(--text-subtle); }
.c-nom { display: flex; align-items: center; gap: 9px; min-width: 0; }
.c-avatar { width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--brand-primary-soft); color: var(--brand-primary-hover); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; }
.c-nom-txt { font-size: 13px; font-weight: 700; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-cell { font-size: 12.5px; color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Badges de estatus de trámite */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; border-radius: var(--radius-pill); padding: 3px 9px; width: fit-content; }
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge-egresada { color: var(--success-text); background: var(--success-bg); border: 1px solid var(--success-border); }
.badge-proceso { color: var(--brand-secondary-text); background: #FEF1E0; border: 1px solid var(--brand-secondary-border); }
.badge-pendiente { color: #4A5568; background: var(--border-soft); border: 1px solid #D8DEE8; }
.badge-neutral { color: var(--text-muted); background: #F1F2F5; border: 1px solid var(--border-strong); }

/* Paginación */
.pager { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.pager-ctrls { display: flex; align-items: center; gap: 5px; }
.pager-num, .pager-nav { min-width: 32px; height: 32px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); font-weight: 700; font-size: 13px; cursor: pointer; }
.pager-num.active { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; }
.pager-nav:disabled { color: #C6D0E2; cursor: not-allowed; }
.pager-ell { color: var(--text-subtle); padding: 0 2px; }

/* ============================================================
   FICHA DE CASO
   ============================================================ */
.ficha-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.segmented { display: flex; background: var(--border-soft); border-radius: var(--radius-md); padding: 3px; }
.segmented button { background: none; border: none; border-radius: 7px; padding: 7px 16px; font-size: 12.5px; font-weight: 700; color: var(--text-muted); cursor: pointer; }
.segmented button.active { background: var(--surface); color: var(--brand-primary); box-shadow: var(--shadow-sm); }
.segmented button:disabled { color: #C6D0E2; cursor: not-allowed; }

.ficha-head { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 20px; margin-bottom: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 16px; box-shadow: var(--shadow-sm); }
.ficha-avatar { width: 56px; height: 56px; flex: none; border-radius: var(--radius-xl); background: var(--brand-primary-soft); color: var(--brand-primary-hover); display: flex; align-items: center; justify-content: center; font-size: 19px; font-weight: 800; }
.ficha-id { min-width: 0; flex: 1; }
.ficha-nombre-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.ficha-nombre { font-size: 20px; font-weight: 800; color: var(--text-strong); }
.ficha-caso { font-size: 11px; font-weight: 700; color: var(--text-subtle); background: var(--border-soft); border-radius: 6px; padding: 2px 8px; }
.ficha-ctx { font-size: 12.5px; color: var(--text-subtle); font-weight: 600; margin-top: 3px; }
.ficha-sello { display: flex; align-items: center; gap: 6px; background: var(--sensitive-bg); border: 1px solid var(--sensitive-border); border-radius: var(--radius-md); padding: 8px 12px; }
.ficha-sello svg { stroke: var(--sensitive-text); }
.ficha-sello span { font-size: 11.5px; font-weight: 700; color: var(--sensitive-text); }

.ficha-secs { display: flex; flex-direction: column; gap: 16px; }
.ficha-sec { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.ficha-sec.sensible { border-color: var(--sensitive-border); padding: 0; overflow: hidden; }
.sec-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; color: var(--text-strong); margin-bottom: 14px; }
.sec-head.sensible { background: var(--sensitive-bg); color: var(--sensitive-text); padding: 12px 20px; margin: 0; border-bottom: 1px solid var(--sensitive-border); }
.sec-head.sensible svg { stroke: var(--sensitive-text); }
.ficha-sec.sensible > .field-grid, .ficha-sec.sensible > .chk-grid { padding: 18px 20px; }
.sec-num { width: 22px; height: 22px; flex: none; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; }
.sec-title { }
.sec-badge { font-size: 10.5px; font-weight: 700; color: var(--sensitive-text); background: #fff; border: 1px solid var(--sensitive-border); border-radius: var(--radius-pill); padding: 2px 9px; margin-left: auto; }

.field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px 18px; }
.field-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.field-full { grid-column: 1 / -1; }
.field-lbl { font-size: 11px; font-weight: 700; color: var(--text-subtle); margin-bottom: 5px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.col-tag { font-size: 10px; font-weight: 700; color: #A9B3C6; background: #F1F3F7; border-radius: 4px; padding: 1px 5px; letter-spacing: .3px; }
.auto-tag { font-size: 10px; font-weight: 700; color: var(--brand-primary); background: var(--brand-primary-soft); border-radius: 4px; padding: 1px 6px; }
.sens-note { font-size: 10px; color: var(--sensitive-text); font-weight: 700; }
.field-val { font-size: 13.5px; font-weight: 600; color: var(--text-strong); }
.field-obs { font-size: 13px; color: var(--text); line-height: 1.55; background: var(--surface-2); border: 1px solid #E9EDF4; border-radius: var(--radius-md); padding: 12px 14px; }
.calc-inert { font-size: 12.5px; font-weight: 600; color: var(--text-subtle); background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--radius-md); padding: 9px 12px; }
.sel-wrap { position: relative; display: block; }
.sel-wrap select.input { appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer; }
.sel-wrap svg { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; stroke: var(--text-subtle); }
textarea.input { resize: vertical; min-height: 84px; line-height: 1.5; }
.input.err { border-color: var(--error); box-shadow: var(--focus-ring-error); }

/* Casillas SI/NO */
.chk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.chk { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border-radius: var(--radius-md); border: 1px solid var(--border-strong); background: var(--surface-2); font-size: 12.5px; font-weight: 700; color: var(--text); }
.chk.si { background: var(--success-bg); border-color: var(--success-border); color: var(--success-text); }
.chk.no { color: var(--text-muted); }
.chk.editable { cursor: pointer; }
.chk.editable:hover { border-color: var(--brand-primary); }
.chk-ico { display: grid; place-items: center; flex: none; }
.chk-lbl { flex: 1; min-width: 0; }
.chk.sens svg:last-child { stroke: var(--sensitive-text); flex: none; }

/* ============================================================
   REGISTRO DE CASO
   ============================================================ */
.reg-wrap { max-width: 840px; margin: 0 auto; }
.reg-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); overflow: hidden; box-shadow: var(--shadow-sm); }
.reg-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border-soft); }
.reg-head-ico { width: 34px; height: 34px; flex: none; border-radius: var(--radius-md); background: var(--brand-primary-soft); color: var(--brand-primary-hover); display: grid; place-items: center; }
.reg-head-t { font-size: 16px; font-weight: 800; color: var(--text-strong); }
.reg-head-s { font-size: 12px; color: var(--text-subtle); font-weight: 600; }
.reg-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 22px; }
.reg-sec-title { font-size: 13px; font-weight: 800; color: var(--text-strong); margin-bottom: 12px; display: flex; align-items: center; }
.reg-sens { font-size: 10px; font-weight: 700; color: var(--sensitive-text); background: var(--sensitive-bg); border: 1px solid var(--sensitive-border); border-radius: 5px; padding: 2px 7px; margin-left: 8px; }
.reg-lbl { display: block; font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.reg-lbl .req { color: var(--error); }
.reg-lbl .auto-tag { margin-left: 6px; }
.reg-err { display: flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; color: var(--error); margin-top: 5px; }
.reg-err svg { stroke: var(--error); flex: none; }
.reg-note { font-size: 12px; color: var(--text-subtle); font-weight: 600; background: var(--surface-2); border: 1px solid #E9EDF4; border-radius: var(--radius-md); padding: 11px 13px; }
.reg-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 15px 22px; border-top: 1px solid var(--border-soft); background: #FAFBFD; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .hamburger { display: grid; place-items: center; }
  .rail {
    position: fixed; left: 0; top: 0; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: var(--shadow-lg);
  }
  .shell.rail-open .rail { transform: translateX(0); }
  .shell.rail-open .rail-backdrop { display: block; }
  .topbar { padding: 12px 16px; }
  .canvas { padding: 20px 16px 48px; }
  .hero { padding: 22px; }
  .hero .h { font-size: 22px; }
  .launch-grid { grid-template-columns: 1fr; }
  .grid-2, .fin-mini { grid-template-columns: 1fr; }
  .kpi4 { grid-template-columns: 1fr 1fr; }
  .field-grid2 { grid-template-columns: 1fr; }
  .filterbar { align-items: flex-start; }
}
@media (max-width: 480px) {
  .kpi4 { grid-template-columns: 1fr; }
  .searchbox { max-width: none; width: 100%; }
  .ficha-nombre { font-size: 17px; }
}
@media (max-width: 480px) {
  .login-card { padding: 36px 22px; }
  .topbar .title { font-size: 16px; }
}
