/* STAR<GATE>BC 2027 — estilos premium dark */
:root { color-scheme: dark; }
html, body { height: 100%; }
* { scrollbar-width: thin; scrollbar-color: #1f2937 transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: #1f2937; border-radius: 4px; }

.sgm-card { background: linear-gradient(160deg, #111827 0%, #0d1424 100%); border: 1px solid rgba(59,130,246,.12); border-radius: 14px; }
.sgm-card:hover { border-color: rgba(59,130,246,.25); }
.sgm-glow { box-shadow: 0 0 24px rgba(59,130,246,.08); }
.sgm-btn { display: inline-flex; align-items: center; gap: .5rem; padding: .5rem 1rem; border-radius: 10px; font-weight: 600; font-size: .85rem; transition: all .15s; cursor: pointer; }
.sgm-btn-primary { background: linear-gradient(135deg, #2563eb, #3b82f6); color: #fff; }
.sgm-btn-primary:hover { filter: brightness(1.15); }
.sgm-btn-ghost { background: rgba(255,255,255,.05); color: #cbd5e1; border: 1px solid rgba(255,255,255,.08); }
.sgm-btn-ghost:hover { background: rgba(255,255,255,.1); }
.sgm-btn-danger { background: rgba(239,68,68,.12); color: #f87171; border: 1px solid rgba(239,68,68,.25); }
.sgm-btn-gold { background: linear-gradient(135deg, #b8952e, #d4af37); color: #0a0e1a; }
.sgm-input { width: 100%; background: #0a0e1a; border: 1px solid #1f2937; border-radius: 10px; padding: .55rem .8rem; color: #e5e7eb; font-size: .875rem; outline: none; transition: border-color .15s; }
.sgm-input:focus { border-color: #3b82f6; }
.sgm-label { display: block; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: #64748b; margin-bottom: .3rem; }
.sgm-badge { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 999px; font-size: .68rem; font-weight: 600; }
.badge-ok { background: rgba(16,185,129,.12); color: #34d399; }
.badge-warn { background: rgba(245,158,11,.12); color: #fbbf24; }
.badge-danger { background: rgba(239,68,68,.12); color: #f87171; }
.badge-info { background: rgba(59,130,246,.12); color: #60a5fa; }
.badge-violet { background: rgba(139,92,246,.12); color: #a78bfa; }
.badge-muted { background: rgba(255,255,255,.06); color: #94a3b8; }
.badge-gold { background: rgba(212,175,55,.14); color: #d4af37; }

.nav-item { display: flex; align-items: center; gap: .65rem; padding: .5rem .75rem; border-radius: 10px; font-size: .82rem; color: #94a3b8; cursor: pointer; transition: all .12s; white-space: nowrap; }
.nav-item:hover { background: rgba(59,130,246,.08); color: #e2e8f0; }
.nav-item.active { background: rgba(59,130,246,.14); color: #60a5fa; font-weight: 600; }
.nav-item i { width: 18px; text-align: center; font-size: .8rem; }
.nav-section { font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: #475569; padding: .9rem .75rem .3rem; }

.sgm-table { width: 100%; font-size: .82rem; }
.sgm-table th { text-align: left; font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: #64748b; padding: .5rem .75rem; border-bottom: 1px solid #1f2937; }
.sgm-table td { padding: .6rem .75rem; border-bottom: 1px solid rgba(31,41,55,.5); color: #cbd5e1; vertical-align: top; }
.sgm-table tr:hover td { background: rgba(59,130,246,.03); }

.modal-backdrop { position: fixed; inset: 0; background: rgba(4,7,15,.75); backdrop-filter: blur(4px); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal-panel { background: #101827; border: 1px solid rgba(59,130,246,.2); border-radius: 16px; max-width: 640px; width: 100%; max-height: 88vh; overflow-y: auto; }

.kanban-col { min-width: 250px; width: 250px; background: rgba(13,20,36,.7); border: 1px solid rgba(255,255,255,.05); border-radius: 12px; }
.kanban-card { background: #131c30; border: 1px solid rgba(255,255,255,.06); border-radius: 10px; padding: .65rem; cursor: grab; }
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: .4; }
.kanban-col.dragover { border-color: #3b82f6; background: rgba(59,130,246,.06); }

.chat-bubble-user { background: linear-gradient(135deg, #1d4ed8, #3b82f6); border-radius: 14px 14px 4px 14px; }
.chat-bubble-ai { background: #131c30; border: 1px solid rgba(139,92,246,.2); border-radius: 14px 14px 14px 4px; }

.tv-mode .hide-tv { display: none !important; }
.tv-mode { font-size: 1.1rem; }

@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.live-dot { animation: pulse-dot 1.6s infinite; }

.toast-wrap { position: fixed; bottom: 1rem; right: 1rem; z-index: 90; display: flex; flex-direction: column; gap: .5rem; }
.toast { min-width: 260px; max-width: 380px; padding: .7rem 1rem; border-radius: 12px; font-size: .82rem; border: 1px solid; animation: toast-in .25s ease; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.empty-state { padding: 3rem 1rem; text-align: center; color: #64748b; }
.empty-state i { font-size: 2rem; margin-bottom: .75rem; opacity: .5; }

@media (max-width: 768px) {
  .sidebar-desktop { display: none; }
  .main-content { margin-left: 0 !important; }
}
@media (min-width: 769px) { .bottom-nav-mobile { display: none; } }

/* ===== Acceso demo de un clic (login) ===== */
.persona-group { margin-bottom: 1.1rem; }
.persona-group:last-child { margin-bottom: 0; }
.persona-group-title { font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: #475569; margin-bottom: .5rem; }
.persona-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .5rem; }
@media (max-width: 640px) { .persona-grid { grid-template-columns: 1fr; } }

.persona-btn {
  display: flex; align-items: center; gap: .7rem; width: 100%; text-align: left;
  padding: .7rem .8rem; border-radius: 12px; cursor: pointer;
  background: linear-gradient(150deg, rgba(19,28,48,.9), rgba(13,20,36,.9));
  border: 1px solid var(--pc-ring, rgba(255,255,255,.1));
  transition: transform .12s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease;
}
.persona-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  background: linear-gradient(150deg, var(--pc-bg), rgba(13,20,36,.95));
  box-shadow: 0 8px 22px rgba(0,0,0,.45), 0 0 0 1px var(--pc-ring) inset;
}
.persona-btn:active:not(:disabled) { transform: translateY(0); }
.persona-btn:focus-visible { outline: 2px solid var(--pc-fg); outline-offset: 2px; }
.persona-btn.is-dim { opacity: .28; pointer-events: none; }
.persona-btn.is-loading { border-color: var(--pc-fg); background: var(--pc-bg); }
.persona-btn:disabled { cursor: default; }

.persona-ico {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center; font-size: .95rem;
  background: var(--pc-bg, rgba(255,255,255,.06)); color: var(--pc-fg, #94a3b8);
  border: 1px solid var(--pc-ring, rgba(255,255,255,.1));
}
.persona-txt { min-width: 0; display: flex; flex-direction: column; gap: .1rem; flex: 1 1 auto; }
.persona-name { font-size: .82rem; font-weight: 700; color: #e5e7eb; line-height: 1.2; }
.persona-role { font-size: .66rem; font-weight: 600; color: var(--pc-fg, #94a3b8); text-transform: uppercase; letter-spacing: .05em; }
.persona-desc { font-size: .64rem; color: #64748b; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.persona-go { flex: 0 0 auto; color: #334155; font-size: .7rem; transition: transform .15s, color .15s; }
.persona-btn:hover:not(:disabled) .persona-go { color: var(--pc-fg); transform: translateX(3px); }

/* ===== Acciones de contacto de un clic ===== */
.act-row { display: inline-flex; gap: .3rem; align-items: center; }
.act-btn {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  font-size: .72rem; border: 1px solid transparent; transition: all .12s; cursor: pointer;
}
.act-btn:hover { transform: translateY(-1px); filter: brightness(1.2); }
.act-call { background: rgba(59,130,246,.14); color: #60a5fa; border-color: rgba(59,130,246,.3); }
.act-wa   { background: rgba(37,211,102,.14); color: #4ade80; border-color: rgba(37,211,102,.3); }
.act-sms  { background: rgba(139,92,246,.14); color: #a78bfa; border-color: rgba(139,92,246,.3); }
.act-mail { background: rgba(245,158,11,.14); color: #fbbf24; border-color: rgba(245,158,11,.3); }
.act-map  { background: rgba(16,185,129,.14); color: #34d399; border-color: rgba(16,185,129,.3); }
.act-nav  { background: rgba(212,175,55,.14); color: #d4af37; border-color: rgba(212,175,55,.3); }

/* ===== Nota de contenido IA ===== */
.ai-note {
  font-size: .66rem; color: #a78bfa; background: rgba(139,92,246,.08);
  border: 1px solid rgba(139,92,246,.22); border-radius: 8px; padding: .45rem .6rem;
  display: flex; gap: .4rem; align-items: flex-start; line-height: 1.4; margin-top: .6rem;
}
.ai-note i { margin-top: .1rem; }

/* ===== Segmentos / conmutador ===== */
.seg-wrap { display: inline-flex; background: #0a0e1a; border: 1px solid #1f2937; border-radius: 10px; padding: 2px; gap: 2px; }
.seg-btn { padding: .35rem .7rem; border-radius: 8px; font-size: .72rem; font-weight: 600; color: #64748b; cursor: pointer; transition: all .12s; white-space: nowrap; }
.seg-btn:hover { color: #cbd5e1; }
.seg-btn.active { background: rgba(59,130,246,.18); color: #60a5fa; }

/* ===== Selección de tarjetas (nombramientos, formularios, presets) ===== */
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .6rem; }
.pick-card {
  text-align: left; padding: .8rem; border-radius: 12px; cursor: pointer;
  background: linear-gradient(150deg, rgba(19,28,48,.9), rgba(13,20,36,.9));
  border: 1px solid rgba(255,255,255,.08); transition: all .13s;
}
.pick-card:hover { border-color: rgba(59,130,246,.4); transform: translateY(-2px); }
.pick-card.active { border-color: #3b82f6; background: rgba(59,130,246,.1); box-shadow: 0 0 0 1px #3b82f6 inset; }
.pick-card i { font-size: 1rem; color: #60a5fa; }
.pick-title { font-size: .78rem; font-weight: 700; color: #e5e7eb; margin-top: .45rem; }
.pick-desc { font-size: .64rem; color: #64748b; margin-top: .15rem; line-height: 1.35; }

/* ===== Vista móvil simulada (Registros) ===== */
.mobile-frame {
  max-width: 430px; margin: 0 auto; border-radius: 26px; overflow: hidden;
  border: 1px solid rgba(59,130,246,.22); background: #0a0e1a;
  box-shadow: 0 18px 50px rgba(0,0,0,.6);
}
.mobile-frame .mf-bar { padding: .5rem 1rem; background: #0d1424; border-bottom: 1px solid rgba(255,255,255,.06); display: flex; align-items: center; justify-content: space-between; font-size: .62rem; color: #64748b; }
.mobile-frame .mf-body { padding: 1rem; }
.mobile-frame .sgm-input { font-size: 1rem; padding: .7rem .85rem; }
.mobile-frame .sgm-btn { padding: .75rem 1rem; font-size: .9rem; }
.mobile-field { margin-bottom: .9rem; }

/* ===== Timeline estilo CapCut ===== */
.tl-wrap { background: #070b14; border: 1px solid #1f2937; border-radius: 12px; overflow: hidden; }
.tl-ruler { height: 22px; background: #0d1424; border-bottom: 1px solid #1f2937; position: relative; font-size: .58rem; color: #475569; }
.tl-tick { position: absolute; top: 0; bottom: 0; border-left: 1px solid rgba(255,255,255,.07); padding-left: 3px; }
.tl-track { display: flex; align-items: center; min-height: 52px; border-bottom: 1px solid rgba(31,41,55,.6); position: relative; }
.tl-track:last-child { border-bottom: 0; }
.tl-track-label { width: 86px; flex: 0 0 86px; padding: 0 .5rem; font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #64748b; border-right: 1px solid #1f2937; align-self: stretch; display: flex; align-items: center; gap: .35rem; }
.tl-lane { flex: 1; position: relative; height: 52px; overflow: hidden; }
.tl-clip {
  position: absolute; top: 7px; bottom: 7px; border-radius: 6px; cursor: grab;
  padding: .25rem .4rem; font-size: .6rem; font-weight: 600; color: #0a0e1a;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; border: 1px solid rgba(0,0,0,.3);
}
.tl-clip.sel { outline: 2px solid #fff; outline-offset: -2px; }
.tl-clip-video { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
.tl-clip-audio { background: linear-gradient(135deg, #10b981, #34d399); }
.tl-clip-text  { background: linear-gradient(135deg, #d4af37, #eecf6d); }
.tl-clip-image { background: linear-gradient(135deg, #8b5cf6, #a78bfa); }
.tl-playhead { position: absolute; top: 0; bottom: 0; width: 2px; background: #ef4444; z-index: 5; pointer-events: none; }

/* ===== Lienzo de diseño gráfico ===== */
.dz-stage { background: #050810; border: 1px solid #1f2937; border-radius: 12px; overflow: auto; padding: 1.25rem; display: grid; place-items: center; min-height: 340px; }
.dz-canvas { position: relative; background: #fff; box-shadow: 0 10px 40px rgba(0,0,0,.6); transform-origin: center; }
.dz-el { position: absolute; cursor: move; outline: 1px dashed transparent; }
.dz-el:hover { outline-color: rgba(59,130,246,.6); }
.dz-el.sel { outline: 2px solid #3b82f6; }

/* ===== Constructor de formularios ===== */
.fb-palette { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .35rem; }
.fb-chip { display: flex; align-items: center; gap: .4rem; padding: .4rem .5rem; border-radius: 8px; font-size: .68rem; color: #cbd5e1; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07); cursor: pointer; transition: all .12s; }
.fb-chip:hover { background: rgba(59,130,246,.1); border-color: rgba(59,130,246,.35); color: #93c5fd; }
.fb-field { border: 1px solid rgba(255,255,255,.08); border-radius: 10px; padding: .6rem .7rem; background: rgba(13,20,36,.7); margin-bottom: .45rem; }
.fb-field.sel { border-color: #3b82f6; background: rgba(59,130,246,.07); }

/* Temas de formulario (5) */
.ftheme-corporativo { --ft-bg:#ffffff; --ft-fg:#111827; --ft-accent:#2563eb; --ft-bd:#d1d5db; --ft-radius:8px; }
.ftheme-oscuro      { --ft-bg:#0d1424; --ft-fg:#e5e7eb; --ft-accent:#3b82f6; --ft-bd:#1f2937; --ft-radius:10px; }
.ftheme-electoral   { --ft-bg:#fdfcf7; --ft-fg:#1c1917; --ft-accent:#b8952e; --ft-bd:#e7e0cc; --ft-radius:4px; }
.ftheme-minimalista { --ft-bg:#fafafa; --ft-fg:#18181b; --ft-accent:#18181b; --ft-bd:#e4e4e7; --ft-radius:2px; }
.ftheme-vibrante    { --ft-bg:#faf5ff; --ft-fg:#2e1065; --ft-accent:#8b5cf6; --ft-bd:#ddd6fe; --ft-radius:16px; }
.ftheme-preview { background: var(--ft-bg); color: var(--ft-fg); border-radius: 12px; padding: 1.25rem; }
.ftheme-preview label { display:block; font-size:.72rem; font-weight:600; margin-bottom:.25rem; color: var(--ft-fg); opacity:.75; }
.ftheme-preview input, .ftheme-preview select, .ftheme-preview textarea {
  width:100%; background: transparent; color: var(--ft-fg);
  border:1px solid var(--ft-bd); border-radius: var(--ft-radius); padding:.5rem .7rem; font-size:.85rem; outline:none;
}
.ftheme-preview input:focus, .ftheme-preview select:focus, .ftheme-preview textarea:focus { border-color: var(--ft-accent); }
.ftheme-preview .ft-submit { background: var(--ft-accent); color:#fff; border:0; border-radius: var(--ft-radius); padding:.6rem 1.2rem; font-weight:700; font-size:.85rem; cursor:pointer; }
.ftheme-preview .ft-title { font-size:1.15rem; font-weight:800; margin-bottom:.25rem; }

/* ===== Ojo de Horus (móvil primero) ===== */
.horus-hero { background: linear-gradient(150deg, rgba(59,130,246,.14), rgba(139,92,246,.08) 55%, transparent); border: 1px solid rgba(59,130,246,.2); border-radius: 18px; padding: 1.25rem; }
.horus-card { background: linear-gradient(160deg, #111827, #0d1424); border: 1px solid rgba(255,255,255,.07); border-radius: 16px; padding: 1rem; }
.horus-big { font-size: 2.1rem; line-height: 1; font-weight: 800; letter-spacing: -.02em; }
.horus-bar { height: 7px; border-radius: 999px; background: rgba(255,255,255,.07); overflow: hidden; }
.horus-bar > span { display: block; height: 100%; border-radius: 999px; transition: width .5s ease; }
.semaforo { width: 12px; height: 12px; border-radius: 999px; display: inline-block; }
.semaforo-verde { background: #10b981; box-shadow: 0 0 10px rgba(16,185,129,.7); }
.semaforo-amarillo { background: #f59e0b; box-shadow: 0 0 10px rgba(245,158,11,.7); }
.semaforo-rojo { background: #ef4444; box-shadow: 0 0 10px rgba(239,68,68,.7); }

/* ===== Zona de carga de archivos ===== */
.drop-zone { border: 2px dashed rgba(59,130,246,.3); border-radius: 14px; padding: 2rem 1rem; text-align: center; cursor: pointer; transition: all .15s; background: rgba(59,130,246,.03); }
.drop-zone:hover, .drop-zone.dragover { border-color: #3b82f6; background: rgba(59,130,246,.08); }
.drop-zone i { font-size: 1.8rem; color: #3b82f6; opacity: .8; }

/* ===== Captura por voz ===== */
.voice-orb { width: 84px; height: 84px; border-radius: 999px; display: grid; place-items: center; font-size: 1.6rem; margin: 0 auto; cursor: pointer; background: rgba(59,130,246,.12); color: #60a5fa; border: 2px solid rgba(59,130,246,.35); transition: all .2s; }
.voice-orb.rec { background: rgba(239,68,68,.15); color: #f87171; border-color: #ef4444; animation: voice-pulse 1.3s infinite; }
@keyframes voice-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,.5); } 50% { box-shadow: 0 0 0 14px rgba(239,68,68,0); } }

/* ===== Escáner OCR ===== */
.ocr-stage { position: relative; background: #000; border-radius: 14px; overflow: hidden; aspect-ratio: 85.6/53.98; }
.ocr-stage video, .ocr-stage img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ocr-guide { position: absolute; inset: 8%; border: 2px solid rgba(59,130,246,.8); border-radius: 10px; pointer-events: none; box-shadow: 0 0 0 9999px rgba(0,0,0,.35); }

/* ===== Utilidades ===== */
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- Ojo de Horus (extras) ---------- */
.seg-btn.seg-active { background: rgba(59,130,246,.18); color: #60a5fa; }
.semaforo-dot { width: 9px; height: 9px; border-radius: 999px; display: inline-block; margin-right: .35rem; vertical-align: middle; }
.semaforo-ok { background: #10b981; box-shadow: 0 0 8px rgba(16,185,129,.7); }
.semaforo-warn { background: #f59e0b; box-shadow: 0 0 8px rgba(245,158,11,.7); }
.semaforo-danger { background: #ef4444; box-shadow: 0 0 8px rgba(239,68,68,.7); }
.horus-ring { position: relative; display: flex; flex-direction: column; align-items: center; }
.horus-ring-txt { position: absolute; top: 0; left: 0; width: 74px; height: 74px; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.horus-card-m { background: linear-gradient(160deg, rgba(17,24,39,.95), rgba(13,20,36,.95)); }
.horus-mobile { max-width: 520px; margin: 0 auto; }
.horus-bar > span { background: linear-gradient(90deg,#0f8bff,#37e6ff); }

/* ---------- Utilidades compartidas por las vistas de módulo ---------- */
.mod-grid { display: grid; gap: .75rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .55rem; border-radius: 999px; font-size: .66rem; font-weight: 600; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); color: #cbd5e1; }
.chip-on { background: rgba(59,130,246,.18); border-color: rgba(59,130,246,.35); color: #93c5fd; }
.pick-card { text-align: left; padding: .85rem; border-radius: 14px; border: 1px solid rgba(255,255,255,.08); background: linear-gradient(160deg,#111827,#0d1424); cursor: pointer; transition: all .14s; width: 100%; }
.pick-card:hover { border-color: rgba(59,130,246,.45); transform: translateY(-1px); }
.pick-card.pick-on { border-color: #3b82f6; box-shadow: 0 0 0 1px rgba(59,130,246,.4), 0 8px 26px -12px rgba(59,130,246,.6); }
.kv { display: flex; justify-content: space-between; gap: .75rem; padding: .4rem 0; border-bottom: 1px solid rgba(255,255,255,.05); font-size: .74rem; }
.kv:last-child { border-bottom: 0; }
.kv dt { color: #6b7280; }
.kv dd { color: #e5e7eb; text-align: right; font-weight: 500; }

/* ── Operación de campo: hub, modos, cuestionario, metas ── */
.mode-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; padding: 1.1rem .75rem; border-radius: 14px; background: linear-gradient(160deg, #111827 0%, #0d1424 100%); border: 1px solid rgba(255,255,255,.07); color: #94a3b8; cursor: pointer; transition: all .15s; }
.mode-card i { font-size: 1.5rem; }
.mode-card:hover { border-color: rgba(59,130,246,.35); color: #cbd5e1; transform: translateY(-1px); }
.mode-card.mode-on { border-color: #d4af37; color: #d4af37; background: linear-gradient(160deg, rgba(212,175,55,.12) 0%, #0d1424 100%); box-shadow: 0 0 0 1px rgba(212,175,55,.35), 0 10px 30px -14px rgba(212,175,55,.5); }

.link-card { display: flex; align-items: center; gap: .9rem; width: 100%; text-align: left; padding: .85rem 1rem; border-radius: 14px; background: linear-gradient(160deg, #111827 0%, #0d1424 100%); border: 1px solid rgba(255,255,255,.06); cursor: pointer; transition: all .15s; }
.link-card:hover { border-color: rgba(59,130,246,.3); transform: translateX(2px); }
.link-card .link-title { font-size: .9rem; font-weight: 700; color: #e5e7eb; }
.link-card .link-desc { font-size: .72rem; color: #6b7280; margin-top: .15rem; line-height: 1.35; }
.link-card .link-go { margin-left: auto; color: #475569; transition: color .15s; }
.link-card:hover .link-go { color: #60a5fa; }
.link-ico { flex: 0 0 auto; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; font-size: 1.05rem; }

.mode-pill { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .8rem; border-radius: 999px; font-size: .74rem; font-weight: 600; color: #94a3b8; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07); cursor: pointer; transition: all .12s; }
.mode-pill:hover { color: #cbd5e1; background: rgba(255,255,255,.08); }
.mode-pill.mode-on { color: #60a5fa; background: rgba(59,130,246,.14); border-color: rgba(59,130,246,.45); }

.q-card { background: linear-gradient(160deg, #111827 0%, #0d1424 100%); border: 1px solid rgba(255,255,255,.06); border-radius: 14px; padding: 1rem; }
.q-card.q-locked { opacity: .45; pointer-events: none; }
.q-num { flex: 0 0 auto; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; background: rgba(59,130,246,.14); color: #60a5fa; font-size: .72rem; font-weight: 800; }
.q-card.q-done .q-num { background: rgba(16,185,129,.16); color: #34d399; }

.opt-btn { display: block; width: 100%; text-align: left; padding: .55rem .8rem; border-radius: 10px; font-size: .82rem; color: #cbd5e1; background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.07); cursor: pointer; transition: all .12s; }
.opt-btn:hover { background: rgba(59,130,246,.08); border-color: rgba(59,130,246,.3); }
.opt-btn.opt-on { background: rgba(59,130,246,.16); border-color: #3b82f6; color: #fff; font-weight: 600; }

.scale-btn { padding: .4rem .3rem; border-radius: 8px; font-size: .66rem; font-weight: 600; line-height: 1.15; color: #94a3b8; background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.07); cursor: pointer; transition: all .12s; }
.scale-btn:hover { color: #e2e8f0; background: rgba(255,255,255,.07); }
.scale-btn.scale-on { color: #fff; font-weight: 700; }
.scale-btn.scale-on[data-tone="neg"] { background: rgba(239,68,68,.22); border-color: #ef4444; }
.scale-btn.scale-on[data-tone="pos"] { background: rgba(16,185,129,.22); border-color: #10b981; }
.scale-btn.scale-on[data-tone="neutral"] { background: rgba(148,163,184,.22); border-color: #94a3b8; }

.toggle { position: relative; flex: 0 0 auto; width: 44px; height: 24px; border-radius: 999px; background: #1f2937; border: 1px solid rgba(255,255,255,.08); cursor: pointer; transition: background .15s; }
.toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #64748b; transition: all .15s; }
.toggle.toggle-on { background: rgba(16,185,129,.3); border-color: #10b981; }
.toggle.toggle-on::after { left: 22px; background: #34d399; }

/* Metas / compromisos: remarcados en negrita y color distinto (spec) */
.meta-txt { font-weight: 800; color: #f87171; letter-spacing: .01em; }
.meta-txt-ok { font-weight: 800; color: #34d399; }
.meta-card { border-left: 3px solid #ef4444; background: rgba(239,68,68,.06); border-radius: 10px; padding: .7rem .85rem; }
.meta-card.meta-done { border-left-color: #10b981; background: rgba(16,185,129,.06); }
.req-card { border-left: 3px solid #a78bfa; background: rgba(139,92,246,.06); border-radius: 10px; padding: .7rem .85rem; }

/* Mapa táctico (Leaflet) */
#tactical-map { width: 100%; height: 100%; border-radius: 0; z-index: 0; }

/* ── Escena del mapa: en la página y a PANTALLA COMPLETA ─────────────────────
   En pantalla completa la escena se saca de la shell (se mueve a <body>) y se
   fija a la ventana por encima de la barra lateral (40), la cabecera (30) y la
   barra móvil (40). Los modales (60), el buscador global (80) y los avisos (90)
   quedan por encima, así que siguen funcionando con el mapa abierto. */
.map-stage { position: relative; height: clamp(440px, 70vh, 780px); border-radius: 14px; overflow: hidden; border: 1px solid var(--line, rgba(148,163,184,.15)); background: #070a14; }
.map-stage.map-full { position: fixed; inset: 0; z-index: 55; height: 100vh; height: 100dvh; border-radius: 0; border: 0; }
html.map-is-full, html.map-is-full body { overflow: hidden !important; }
.map-hud { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.map-hud > * { pointer-events: auto; }
.hud-top { position: absolute; top: .6rem; left: .6rem; right: .6rem; display: flex; gap: .45rem; align-items: flex-start; pointer-events: none; flex-wrap: wrap; }
.hud-top > * { pointer-events: auto; }
.map-full .hud-top { top: calc(.6rem + env(safe-area-inset-top)); }
.hud-btn { display: inline-flex; align-items: center; gap: .4rem; height: 38px; padding: 0 .75rem; border-radius: 11px; font-size: .74rem; font-weight: 700; color: var(--text, #e5e7eb); background: color-mix(in srgb, var(--panel, #111827) 94%, transparent); border: 1px solid var(--line-strong, rgba(148,163,184,.25)); box-shadow: 0 6px 20px -8px rgba(0,0,0,.6); cursor: pointer; white-space: nowrap; backdrop-filter: blur(8px); }
.hud-btn:hover { border-color: #3b82f6; }
.hud-btn.is-on { color: #60a5fa; border-color: rgba(59,130,246,.6); background: rgba(30,58,138,.55); }
.hud-btn.is-rec { color: #fff; background: #dc2626; border-color: #ef4444; }
.hud-btn .lbl { display: inline; }
.hud-search { position: relative; flex: 1 1 260px; max-width: 440px; min-width: 200px; }
.hud-search input { width: 100%; height: 38px; padding: 0 2.3rem 0 2.3rem; border-radius: 11px; font-size: .78rem; color: var(--text, #e5e7eb); background: color-mix(in srgb, var(--panel, #111827) 94%, transparent); border: 1px solid var(--line-strong, rgba(148,163,184,.25)); box-shadow: 0 6px 20px -8px rgba(0,0,0,.6); outline: none; }
.hud-search input:focus { border-color: #3b82f6; }
.hud-search > i.fa-magnifying-glass { position: absolute; left: .8rem; top: 12px; font-size: .75rem; color: #64748b; }
.hud-search .hud-clear { position: absolute; right: .35rem; top: 5px; width: 28px; height: 28px; border-radius: 8px; color: #94a3b8; }
.hud-results { position: absolute; top: 44px; left: 0; right: 0; max-height: 52vh; overflow: auto; border-radius: 12px; background: var(--panel, #111827); border: 1px solid var(--line-strong, rgba(148,163,184,.25)); box-shadow: 0 18px 50px -18px rgba(0,0,0,.9); }
.hud-res { display: block; width: 100%; text-align: left; padding: .55rem .75rem; font-size: .74rem; border-bottom: 1px solid var(--line, rgba(148,163,184,.12)); color: var(--text, #e5e7eb); cursor: pointer; }
.hud-res:hover { background: rgba(59,130,246,.1); }
.hud-res b { display: block; font-size: .78rem; }
.hud-res small { color: #94a3b8; font-size: .66rem; line-height: 1.35; display: block; }
.hud-panel { position: absolute; top: 3.6rem; left: .6rem; width: 352px; max-width: calc(100% - 1.2rem); max-height: calc(100% - 5.2rem); display: flex; flex-direction: column; border-radius: 14px; overflow: hidden; background: color-mix(in srgb, var(--panel, #111827) 97%, transparent); border: 1px solid var(--line-strong, rgba(148,163,184,.25)); box-shadow: 0 24px 60px -20px rgba(0,0,0,.85); backdrop-filter: blur(10px); }
.map-full .hud-panel { top: calc(3.6rem + env(safe-area-inset-top)); }
.hud-tabs { display: flex; border-bottom: 1px solid var(--line, rgba(148,163,184,.15)); flex-shrink: 0; }
.hud-tab { flex: 1; padding: .6rem .3rem; font-size: .7rem; font-weight: 700; color: #94a3b8; border-bottom: 2px solid transparent; cursor: pointer; }
.hud-tab.is-on { color: #60a5fa; border-bottom-color: #3b82f6; }
.hud-body { padding: .8rem; overflow: auto; font-size: .76rem; }
.hud-h { font-size: .62rem; text-transform: uppercase; letter-spacing: .12em; color: #64748b; font-weight: 800; margin: .9rem 0 .4rem; }
.hud-h:first-child { margin-top: 0; }
.base-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; }
.base-opt { display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: .35rem .2rem; border-radius: 10px; border: 1px solid var(--line, rgba(148,163,184,.15)); font-size: .62rem; color: #94a3b8; cursor: pointer; }
.base-opt i.sw { width: 100%; height: 28px; border-radius: 6px; display: block; }
.base-opt.is-on { border-color: #3b82f6; color: #60a5fa; }
.rt-card { border: 1px solid var(--line, rgba(148,163,184,.15)); border-radius: 12px; padding: .65rem .7rem; margin-bottom: .5rem; background: rgba(255,255,255,.02); }
.rt-card.is-active { border-color: #38bdf8; background: rgba(56,189,248,.06); }
.rt-bar { height: 5px; border-radius: 4px; background: rgba(148,163,184,.18); overflow: hidden; margin: .4rem 0; }
.rt-bar > i { display: block; height: 100%; background: linear-gradient(90deg, #10b981, #34d399); }
.mini-btn { display: inline-flex; align-items: center; gap: .3rem; padding: .28rem .55rem; border-radius: 8px; font-size: .66rem; font-weight: 700; color: #cbd5e1; border: 1px solid var(--line-strong, rgba(148,163,184,.25)); background: rgba(255,255,255,.04); cursor: pointer; }
.mini-btn:hover { border-color: #3b82f6; color: #fff; }
.mini-btn.primary { background: #2563eb; border-color: #3b82f6; color: #fff; }
.mini-btn.danger { background: #b91c1c; border-color: #ef4444; color: #fff; }
.mini-btn[disabled] { opacity: .45; pointer-events: none; }
.hud-jor { position: absolute; left: 50%; bottom: calc(.9rem + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; align-items: center; gap: .7rem; padding: .5rem .7rem; border-radius: 14px; background: color-mix(in srgb, var(--panel, #111827) 97%, transparent); border: 1px solid rgba(239,68,68,.55); box-shadow: 0 18px 50px -14px rgba(0,0,0,.9); max-width: calc(100% - 1.2rem); z-index: 6; }
.hud-jor .st { display: flex; gap: .9rem; }
.hud-jor .st div { text-align: center; line-height: 1.1; }
.hud-jor .st b { display: block; font-size: 1.02rem; font-family: Sora, system-ui, sans-serif; }
.hud-jor .st span { font-size: .55rem; text-transform: uppercase; letter-spacing: .1em; color: #94a3b8; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 0 rgba(239,68,68,.6); animation: rec-pulse 1.4s infinite; flex-shrink: 0; }
@keyframes rec-pulse { 70% { box-shadow: 0 0 0 10px rgba(239,68,68,0); } 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); } }
.jor-pill { position: fixed; left: 50%; bottom: calc(4.6rem + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 45; display: flex; align-items: center; gap: .6rem; padding: .45rem .8rem; border-radius: 999px; background: #7f1d1d; color: #fff; font-size: .72rem; font-weight: 700; box-shadow: 0 12px 30px -10px rgba(0,0,0,.8); cursor: pointer; }
.stop-pin { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: #fff; font-weight: 800; font-size: .68rem; border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.6); }
.sec-label { font-size: .68rem; font-weight: 800; color: #fff; text-shadow: 0 0 3px #000, 0 0 3px #000, 0 0 5px #000; white-space: nowrap; transform: translate(-50%, -50%); pointer-events: none; }
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: #38bdf8; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(56,189,248,.28); }
.team-pin { display: grid; place-items: center; min-width: 28px; height: 28px; padding: 0 .35rem; border-radius: 14px; background: #f59e0b; color: #111; font-weight: 800; font-size: .65rem; border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.6); white-space: nowrap; }
.team-pin.is-old { background: #64748b; color: #fff; }
.pick-on #tactical-map { cursor: crosshair !important; }
.pick-on .leaflet-interactive { cursor: crosshair !important; }
@media (max-width: 768px) {
  .hud-btn .lbl { display: none; }
  .hud-btn { padding: 0 .65rem; }
  .hud-panel { top: auto; bottom: 0; left: 0; right: 0; width: auto; max-width: none; max-height: 58%; border-radius: 16px 16px 0 0; }
  .map-full .hud-panel { padding-bottom: env(safe-area-inset-bottom); }
  .hud-jor { bottom: calc(.6rem + env(safe-area-inset-bottom)); }
  .hud-panel ~ .hud-jor { display: none; }
  .map-stage { height: clamp(380px, 66vh, 640px); }
}
.leaflet-container { background: #070a14; font-family: inherit; }
.leaflet-popup-content-wrapper { background: #0d1424; color: #e5e7eb; border: 1px solid rgba(59,130,246,.3); border-radius: 12px; box-shadow: 0 18px 50px -18px rgba(0,0,0,.9); }
.leaflet-popup-tip { background: #0d1424; border: 1px solid rgba(59,130,246,.3); }
.leaflet-popup-content { margin: .75rem .9rem; font-size: .78rem; line-height: 1.5; }
.leaflet-popup-close-button { color: #64748b !important; }
.leaflet-bar a, .leaflet-bar a:hover { background: #111827; color: #cbd5e1; border-bottom-color: #1f2937; }
.map-pin { display: grid; place-items: center; border-radius: 50%; font-size: .6rem; font-weight: 800; color: #fff; box-shadow: 0 0 0 2px rgba(0,0,0,.5); }
.map-pop-title { font-weight: 800; font-size: .85rem; margin-bottom: .35rem; }
.map-pop-row { display: flex; justify-content: space-between; gap: .8rem; padding: .18rem 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.map-pop-row:last-of-type { border-bottom: 0; }
.map-pop-row b { color: #e5e7eb; }
.map-pop-row span { color: #6b7280; }

/* Campanita de avisos: balanceo suave cuando hay pendientes */
@keyframes bell-swing {
  0%,100% { transform: rotate(0deg); }
  15% { transform: rotate(14deg); }
  30% { transform: rotate(-12deg); }
  45% { transform: rotate(8deg); }
  60% { transform: rotate(-5deg); }
  75% { transform: rotate(2deg); }
}
@media (prefers-reduced-motion: reduce) {
  [style*="bell-swing"] { animation: none !important; }
}

/* ============================================================================
   BUSCADOR DE SECCIONES Y CASILLAS  ·  views-buscador.js
   Presentación "ultra profesional": ficha de sección, botón de histórico,
   modal de histórico 2020-2021 con barras de partido y desglose por casilla.
   Tokens heredados: #111827→#0d1424 gradiente, rgba(59,130,246,.12) borde,
   radios 14px, etiquetas #64748b, texto #cbd5e1.
   ========================================================================== */

/* --- Layout general ------------------------------------------------------- */
.bus-wrap { display: grid; grid-template-columns: minmax(320px, 400px) 1fr; gap: 1rem; align-items: start; }
@media (max-width: 1100px) { .bus-wrap { grid-template-columns: 1fr; } }

.bus-search { background: linear-gradient(160deg, #111827 0%, #0d1424 100%); border: 1px solid rgba(59,130,246,.14); border-radius: 14px; padding: 1rem; position: sticky; top: 1rem; }
@media (max-width: 1100px) { .bus-search { position: static; } }

.bus-input-row { position: relative; }
.bus-input-ico { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: #475569; font-size: .8rem; pointer-events: none; }
.bus-input { width: 100%; background: #060a14; border: 1px solid #1f2937; border-radius: 12px; padding: .7rem .9rem .7rem 2.3rem; color: #f1f5f9; font-size: 1rem; font-weight: 600; letter-spacing: .01em; outline: none; transition: border-color .15s, box-shadow .15s; }
.bus-input::placeholder { color: #475569; font-weight: 400; letter-spacing: 0; }
.bus-input:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.12); }

.bus-kinds { display: flex; gap: .35rem; margin-top: .7rem; }
.bus-kind { flex: 1; text-align: center; padding: .38rem .5rem; border-radius: 9px; font-size: .72rem; font-weight: 600; color: #94a3b8; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06); cursor: pointer; transition: all .12s; }
.bus-kind:hover { background: rgba(59,130,246,.1); color: #cbd5e1; }
.bus-kind.is-on { background: rgba(59,130,246,.16); border-color: rgba(59,130,246,.4); color: #60a5fa; }

.bus-avisos { margin-top: .85rem; display: grid; gap: .4rem; }
.bus-aviso { display: flex; gap: .5rem; align-items: flex-start; font-size: .7rem; line-height: 1.45; color: #94a3b8; background: rgba(245,158,11,.06); border: 1px solid rgba(245,158,11,.15); border-left: 2px solid rgba(245,158,11,.5); border-radius: 8px; padding: .45rem .6rem; }
.bus-aviso i { color: #fbbf24; margin-top: .1rem; font-size: .7rem; }

.bus-results { margin-top: .9rem; max-height: 58vh; overflow-y: auto; padding-right: .15rem; }
@media (max-width: 1100px) { .bus-results { max-height: none; } }
.bus-detail { min-height: 200px; }

/* --- Pista / estado vacío ------------------------------------------------- */
.bus-hint { text-align: center; padding: 1.6rem .9rem; color: #64748b; }
.bus-hint-ico { font-size: 1.7rem; color: rgba(59,130,246,.35); margin-bottom: .6rem; }
.bus-hint p { font-size: .78rem; line-height: 1.5; }
.bus-hint-cov { margin-top: .85rem; display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem; font-size: .66rem; }
.bus-hint-cov span { background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07); border-radius: 999px; padding: .18rem .55rem; color: #94a3b8; }

/* --- Grupos y filas de resultado ----------------------------------------- */
.bus-group + .bus-group { margin-top: 1rem; }
.bus-group-t { display: flex; align-items: center; gap: .45rem; font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: #475569; padding: 0 .2rem .4rem; }
.bus-group-t b { color: #60a5fa; font-weight: 700; }
.bus-list { display: grid; gap: .35rem; }

.bus-item { display: flex; align-items: center; gap: .65rem; width: 100%; text-align: left; background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.055); border-radius: 11px; padding: .5rem .6rem; cursor: pointer; transition: all .12s; }
.bus-item:hover { background: rgba(59,130,246,.09); border-color: rgba(59,130,246,.32); transform: translateX(2px); }
.bus-item-code { flex: 0 0 auto; min-width: 52px; text-align: center; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92rem; font-weight: 700; color: #93c5fd; background: rgba(59,130,246,.11); border: 1px solid rgba(59,130,246,.2); border-radius: 8px; padding: .28rem .35rem; letter-spacing: .02em; }
.bus-item-code-cas { color: #c4b5fd; background: rgba(139,92,246,.11); border-color: rgba(139,92,246,.22); font-size: .78rem; min-width: 62px; }
.bus-item-main { flex: 1 1 auto; min-width: 0; }
.bus-item-main strong { display: block; font-size: .78rem; font-weight: 600; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bus-item-main small { display: block; font-size: .66rem; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: .1rem; }
.bus-item-tags { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .3rem; }
.bus-item-arrow { flex: 0 0 auto; color: #334155; font-size: .7rem; transition: color .12s, transform .12s; }
.bus-item:hover .bus-item-arrow { color: #60a5fa; transform: translateX(2px); }

.bus-tag { font-size: .6rem; font-weight: 600; border-radius: 999px; padding: .1rem .42rem; background: rgba(255,255,255,.06); color: #94a3b8; white-space: nowrap; }
.bus-tag-ok { background: rgba(16,185,129,.12); color: #34d399; }
.bus-tag-off { background: rgba(255,255,255,.05); color: #64748b; }
.bus-tag-cas { background: rgba(139,92,246,.12); color: #a78bfa; }
.bus-tag-warn { background: rgba(245,158,11,.13); color: #fbbf24; }

/* --- Ficha de la sección ------------------------------------------------- */
.fic-card { background: linear-gradient(160deg, #111827 0%, #0d1424 100%); border: 1px solid rgba(59,130,246,.16); border-radius: 16px; overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.fic-head { display: flex; align-items: center; gap: 1rem; padding: 1.05rem 1.15rem; background: linear-gradient(120deg, rgba(37,99,235,.16) 0%, rgba(139,92,246,.08) 55%, transparent 100%); border-bottom: 1px solid rgba(59,130,246,.14); }
.fic-head-lbl { font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .16em; color: #60a5fa; }
.fic-head-code { font-size: 2rem; font-weight: 800; line-height: 1.05; color: #f8fafc; letter-spacing: -.02em; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.fic-head-sub { font-size: .74rem; color: #94a3b8; margin-top: .15rem; }
.fic-head-act { margin-left: auto; display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; }

.fic-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 1px; background: rgba(59,130,246,.1); }
@media (max-width: 720px) { .fic-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 420px) { .fic-grid { grid-template-columns: 1fr; } }
.fic-cell { background: #0c1220; padding: .8rem .95rem; min-height: 86px; display: flex; flex-direction: column; gap: .18rem; }
.fic-lbl { display: flex; align-items: center; gap: .35rem; font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: #64748b; }
.fic-lbl i { color: #3b82f6; font-size: .62rem; }
.fic-val { font-size: 1.45rem; font-weight: 700; color: #f1f5f9; line-height: 1.15; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.fic-val-html { font-size: 1rem; display: flex; align-items: center; }
.fic-foot { font-size: .64rem; color: #64748b; margin-top: auto; line-height: 1.35; }

.fic-exig { display: flex; align-items: center; gap: .55rem; font-size: .72rem; line-height: 1.45; padding: .6rem 1.15rem; border-top: 1px solid rgba(59,130,246,.1); }
.fic-exig i { font-size: .78rem; }
.fic-exig-holgada { background: rgba(16,185,129,.06); color: #6ee7b7; }
.fic-exig-holgada i { color: #34d399; }
.fic-exig-exigente { background: rgba(245,158,11,.06); color: #fcd34d; }
.fic-exig-exigente i { color: #fbbf24; }
.fic-exig-imposible { background: rgba(239,68,68,.07); color: #fca5a5; }
.fic-exig-imposible i { color: #f87171; }

/* --- Botón del histórico (el protagonista) ------------------------------- */
.fic-hist { padding: 1rem 1.15rem 1.15rem; border-top: 1px solid rgba(59,130,246,.1); }
.fic-hist-btn { display: flex; align-items: center; gap: .85rem; width: 100%; text-align: left; padding: .85rem 1rem; border-radius: 14px; cursor: pointer; color: #f8fafc;
  background: linear-gradient(115deg, #1e3a8a 0%, #2563eb 45%, #6d28d9 100%); background-size: 180% 180%; background-position: 0% 50%;
  border: 1px solid rgba(147,197,253,.28); box-shadow: 0 8px 26px rgba(37,99,235,.24); transition: background-position .5s ease, box-shadow .2s, transform .12s; }
.fic-hist-btn:hover { background-position: 100% 50%; box-shadow: 0 12px 34px rgba(109,40,217,.35); transform: translateY(-1px); }
.fic-hist-btn:active { transform: translateY(0); }
.fic-hist-ico { flex: 0 0 auto; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.18); font-size: .95rem; color: #fff; }
.fic-hist-txt { flex: 1 1 auto; min-width: 0; }
.fic-hist-txt strong { display: block; font-size: .84rem; font-weight: 700; letter-spacing: .01em; }
.fic-hist-txt small { display: block; font-size: .68rem; color: rgba(226,232,240,.78); margin-top: .12rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fic-hist-arrow { flex: 0 0 auto; font-size: .78rem; color: rgba(255,255,255,.65); transition: transform .15s; }
.fic-hist-btn:hover .fic-hist-arrow { transform: translateX(3px); }
.fic-hist-tag { margin-top: .5rem; font-size: .65rem; color: #64748b; display: flex; align-items: center; gap: .35rem; }

/* --- Histórico: hero ---------------------------------------------------- */
.hist-hero { position: relative; border-radius: 14px; padding: 1rem 1.1rem; background: linear-gradient(140deg, rgba(37,99,235,.14) 0%, rgba(139,92,246,.09) 60%, rgba(13,20,36,.6) 100%); border: 1px solid rgba(59,130,246,.2); overflow: hidden; }
.hist-hero-tag { display: inline-flex; align-items: center; gap: .35rem; font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: #93c5fd; margin-bottom: .55rem; }
.hist-hero-main { display: flex; align-items: flex-end; gap: 1.1rem; flex-wrap: wrap; }
.hist-hero-win { flex: 1 1 auto; min-width: 150px; }
.hist-hero-lbl { font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: #64748b; }
.hist-hero-key { font-size: 1.6rem; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; }
.hist-hero-key2 { font-size: 1.05rem; font-weight: 700; line-height: 1.15; }
.hist-hero-sub { font-size: .7rem; color: #94a3b8; margin-top: .1rem; font-variant-numeric: tabular-nums; }
.hist-hero-vs { flex: 0 0 auto; align-self: center; font-size: .62rem; font-weight: 700; color: #475569; text-transform: uppercase; letter-spacing: .1em; }
.hist-hero-margin { flex: 0 0 auto; text-align: right; }
.hist-hero-big { font-size: 1.75rem; font-weight: 800; color: #f8fafc; line-height: 1.05; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.hist-hero-note { margin-top: .7rem; padding-top: .6rem; border-top: 1px solid rgba(255,255,255,.07); font-size: .68rem; color: #94a3b8; line-height: 1.45; }

/* --- Histórico: KPIs ---------------------------------------------------- */
.hist-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px,1fr)); gap: .5rem; }
.hist-kpi { background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06); border-radius: 11px; padding: .6rem .7rem; }
.hist-kpi-lbl { display: flex; align-items: center; gap: .3rem; font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #64748b; }
.hist-kpi-lbl i { color: #3b82f6; font-size: .6rem; }
.hist-kpi-val { font-size: 1.15rem; font-weight: 700; color: #f1f5f9; margin-top: .15rem; font-variant-numeric: tabular-nums; }
.hist-kpi-foot { font-size: .62rem; color: #64748b; margin-top: .1rem; line-height: 1.3; }
.hist-kpi-foot.up { color: #34d399; }
.hist-kpi-foot.down { color: #f87171; }

.hist-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px,1fr)); gap: .75rem; }
.hist-meta { background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.06); border-radius: 11px; padding: .7rem .85rem; }
.hist-meta-grid { display: grid; gap: 0; }
.hist-read { font-size: .72rem; line-height: 1.55; color: #cbd5e1; background: rgba(59,130,246,.06); border: 1px solid rgba(59,130,246,.14); border-left: 2px solid #3b82f6; border-radius: 10px; padding: .65rem .8rem; }
.hist-warn { display: flex; gap: .5rem; align-items: flex-start; font-size: .7rem; line-height: 1.5; color: #fcd34d; background: rgba(245,158,11,.07); border: 1px solid rgba(245,158,11,.18); border-radius: 10px; padding: .6rem .75rem; }
.hist-warn i { color: #fbbf24; margin-top: .12rem; }
.hist-none { text-align: center; padding: 2rem 1rem; color: #64748b; }
.hist-none i { font-size: 1.9rem; color: rgba(148,163,184,.28); display: block; margin-bottom: .6rem; }
.hist-none-sm { padding: 1.1rem 1rem; }
.hist-none-sm i { font-size: 1.3rem; margin-bottom: .4rem; }
.hist-none-note { font-size: .68rem; color: #475569; margin-top: .45rem; line-height: 1.45; max-width: 380px; margin-left: auto; margin-right: auto; }
.hist-actions { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; padding-top: .3rem; }

/* --- Barras de votación -------------------------------------------------- */
.vb-wrap { display: grid; gap: .42rem; }
.vb-row { display: grid; grid-template-columns: 128px 1fr 74px 56px; gap: .55rem; align-items: center; }
@media (max-width: 560px) { .vb-row { grid-template-columns: 92px 1fr 62px 48px; gap: .4rem; } }
.vb-label { display: flex; align-items: center; gap: .3rem; min-width: 0; }
.vb-crown { color: #d4af37; font-size: .62rem; flex: 0 0 auto; }
.vb-key { font-size: .72rem; font-weight: 700; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vb-name { font-size: .6rem; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vb-track { height: 15px; background: rgba(255,255,255,.045); border-radius: 8px; overflow: hidden; position: relative; }
.vb-fill { height: 100%; border-radius: 8px; min-width: 2px; transition: width .5s cubic-bezier(.22,1,.36,1); position: relative; }
.vb-row.vb-win .vb-fill { box-shadow: 0 0 12px rgba(212,175,55,.25) inset, 0 0 0 1px rgba(255,255,255,.14) inset; }
.vb-row.vb-win .vb-key { color: #fde68a; }
.vb-coal { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); font-size: .55rem; color: rgba(255,255,255,.7); font-weight: 600; }
.vb-num { text-align: right; font-size: .78rem; font-weight: 700; color: #f1f5f9; font-variant-numeric: tabular-nums; }
.vb-pct { text-align: right; font-size: .7rem; color: #94a3b8; font-variant-numeric: tabular-nums; }
.vb-legend { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .55rem; padding-top: .5rem; border-top: 1px solid rgba(255,255,255,.06); font-size: .62rem; color: #64748b; }
.vb-legend span { display: inline-flex; align-items: center; gap: .28rem; }
.vb-legend-dot { width: 8px; height: 8px; border-radius: 3px; display: inline-block; }

/* --- Resumen de casillas ------------------------------------------------- */
.cas-sum { display: flex; flex-wrap: wrap; gap: .35rem; }
.cas-chip { display: inline-flex; align-items: baseline; gap: .3rem; font-size: .66rem; font-weight: 600; border-radius: 999px; padding: .2rem .6rem; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.07); color: #cbd5e1; }
.cas-chip b { font-size: .8rem; font-variant-numeric: tabular-nums; }

/* --- Sedes -------------------------------------------------------------- */
.sedes { display: grid; gap: .5rem; }
.sede { background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.06); border-radius: 11px; padding: .65rem .75rem; }
.sede:hover { border-color: rgba(59,130,246,.22); }
.sede-top { display: flex; gap: .6rem; align-items: flex-start; }
.sede-ico { flex: 0 0 auto; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: rgba(59,130,246,.11); border: 1px solid rgba(59,130,246,.18); color: #60a5fa; font-size: .74rem; }
.sede-main { flex: 1 1 auto; min-width: 0; }
.sede-main strong { display: block; font-size: .76rem; font-weight: 600; color: #e2e8f0; line-height: 1.35; }
.sede-tipo { font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: #64748b; margin-top: .1rem; }
.sede-cas { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .4rem; }
.sede-cas-tag { font-size: .62rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; color: #c4b5fd; background: rgba(139,92,246,.12); border: 1px solid rgba(139,92,246,.2); border-radius: 6px; padding: .1rem .35rem; cursor: pointer; transition: all .12s; }
.sede-cas-tag:hover { background: rgba(139,92,246,.24); color: #ddd6fe; }
.sede-dom { font-size: .68rem; color: #94a3b8; margin-top: .45rem; line-height: 1.45; }
.sede-ref { font-size: .65rem; color: #64748b; margin-top: .2rem; line-height: 1.4; }
.sede-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .5rem; padding-top: .45rem; border-top: 1px solid rgba(255,255,255,.05); font-size: .62rem; color: #64748b; }
.sede-map { display: inline-flex; align-items: center; gap: .28rem; color: #60a5fa; font-weight: 600; }
.sede-map:hover { color: #93c5fd; text-decoration: underline; }

/* --- kv con spans (el buscador usa span en vez de dt/dd) ----------------- */
.kv-k { color: #6b7280; }
.kv-v { color: #e5e7eb; text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }

/* --- Modal ancho para el histórico -------------------------------------- */
.modal-panel.modal-wide { max-width: 940px; }

@media print {
  .bus-search, .bus-results, .nav-item, .fic-head-act, .hist-actions { display: none !important; }
  .hist-hero, .hist-kpi, .sede, .fic-card { break-inside: avoid; }
}
.hud-jor[hidden], .hud-panel[hidden], .hud-results[hidden], .hud-clear[hidden] { display: none !important; }
.wiz-step { display: flex; gap: .4rem; margin-bottom: .7rem; }
.wiz-step i { flex: 1; height: 4px; border-radius: 3px; background: rgba(148,163,184,.2); }
.wiz-step i.on { background: #3b82f6; }
.wiz-chip { display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .45rem; border-radius: 999px; background: rgba(59,130,246,.15); border: 1px solid rgba(59,130,246,.4); color: #93c5fd; font-size: .66rem; font-weight: 700; }
.wiz-stops { max-height: 30vh; overflow: auto; border: 1px solid var(--line, rgba(148,163,184,.15)); border-radius: 10px; }
.wiz-stop { display: flex; align-items: center; gap: .5rem; padding: .35rem .55rem; border-bottom: 1px solid rgba(148,163,184,.1); font-size: .72rem; }
.wiz-stop:last-child { border-bottom: 0; }
.wiz-stop b { min-width: 1.4rem; color: #60a5fa; }
.pick-banner { position: absolute; top: 3.7rem; left: 50%; transform: translateX(-50%); z-index: 7; padding: .45rem .9rem; border-radius: 999px; background: #1d4ed8; color: #fff; font-size: .74rem; font-weight: 700; box-shadow: 0 10px 30px -8px rgba(0,0,0,.8); display: flex; gap: .6rem; align-items: center; white-space: nowrap; }
.jor-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: .6rem 0; }
.jor-sum div { text-align: center; border: 1px solid var(--line, rgba(148,163,184,.15)); border-radius: 10px; padding: .5rem .2rem; }
.jor-sum b { display: block; font-size: 1.05rem; font-family: Sora, system-ui, sans-serif; color: #fff; }
.jor-sum span { font-size: .58rem; text-transform: uppercase; letter-spacing: .08em; color: #94a3b8; }

/* Modales largos: encabezado fijo y scroll interno; acciones de tabla en línea */
.modal-panel > header { position: sticky; top: 0; background: #101827; z-index: 2; }
.modal-panel .sgm-modal-body { overflow-x: hidden; }
td .act-btn { display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; }
