/* ═══════════════════════════════════════════════
   DalIA Dashboard — Paleta extraída del logo
   Fondos: azul marino / verde oscuro
   Acentos: verde agua, azul cielo, lavanda
═══════════════════════════════════════════════ */
:root {
  --bg:           #0e0e1a;
  --bg2:          #141428;
  --bg3:          #1a2828;
  --surface:      #1e1e32;
  --surface2:     #242440;
  --border:       rgba(160,220,200,0.12);
  --border2:      rgba(140,200,220,0.18);

  --accent:       #a0dcc8;   /* verde agua — color primario del logo */
  --accent2:      #8cc8dc;   /* azul cielo */
  --accent3:      #a0b4dc;   /* lavanda */
  --accent-dark:  #142828;   /* verde marino oscuro */

  --text:         #e8f4f0;
  --text2:        rgba(232,244,240,0.55);
  --text3:        rgba(232,244,240,0.35);

  --success:      #a0dcc8;
  --warning:      #dcd0a0;
  --danger:       #dc8ca0;
  --neutral:      #a0b4dc;

  --nav-h:        64px;
  --sidebar-w:    240px;
  --radius:       10px;
  --radius-sm:    6px;
  --shadow:       0 4px 24px rgba(0,0,0,0.4);
  --transition:   0.25s cubic-bezier(0.4,0,0.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 15px; }
body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--accent2); text-decoration: none; }
a:hover { color: var(--accent); }

/* ── NAV ── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: var(--nav-h);
  background: rgba(14,14,26,0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border2);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem;
  gap: 1rem;
}
.nav-logo { display: flex; align-items: center; gap: 0.75rem; }
.nav-logo img { height: 38px; width: auto; }
.nav-logo span { font-size: 0.75rem; color: var(--text2); letter-spacing: 0.1em; text-transform: uppercase; }
.nav-user { display: flex; align-items: center; gap: 1rem; font-size: 0.85rem; color: var(--text2); }
.nav-user .role-badge {
  background: rgba(160,220,200,0.12);
  color: var(--accent);
  border: 1px solid rgba(160,220,200,0.25);
  padding: 2px 10px; border-radius: 20px; font-size: 0.75rem;
}
.btn-logout {
  background: rgba(220,140,160,0.1);
  color: var(--danger);
  border: 1px solid rgba(220,140,160,0.2);
  padding: 5px 14px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 0.8rem; transition: var(--transition);
}
.btn-logout:hover { background: rgba(220,140,160,0.2); }

/* ── LAYOUT ── */
.layout { display: flex; padding-top: var(--nav-h); min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  position: fixed; top: var(--nav-h); bottom: 0; left: 0;
  overflow-y: auto; padding: 1.5rem 0;
}
.sidebar-section { padding: 0.5rem 1rem 0.25rem; font-size: 0.68rem;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--text3); }
.sidebar a {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem 1.25rem; color: var(--text2); font-size: 0.88rem;
  transition: var(--transition); border-left: 3px solid transparent;
}
.sidebar a:hover, .sidebar a.active {
  color: var(--accent); background: rgba(160,220,200,0.06);
  border-left-color: var(--accent);
}
.sidebar a .icon { font-size: 1rem; width: 18px; text-align: center; }

.main { margin-left: var(--sidebar-w); flex: 1; padding: 2rem; }

/* ── CARDS / STATS ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  display: flex; flex-direction: column; gap: 0.3rem;
  transition: var(--transition);
}
.stat-card:hover { border-color: var(--border2); transform: translateY(-2px); }
.stat-card .label { font-size: 0.75rem; color: var(--text2); text-transform: uppercase; letter-spacing: 0.08em; }
.stat-card .value { font-size: 2rem; font-weight: 700; color: var(--accent); line-height: 1; }
.stat-card .sub { font-size: 0.78rem; color: var(--text3); }

/* ── TABLE ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.card-header h2 { font-size: 1rem; font-weight: 600; color: var(--text); }
.card-body { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
thead tr { background: var(--bg2); }
th { padding: 0.75rem 1rem; text-align: left; font-size: 0.72rem;
     text-transform: uppercase; letter-spacing: 0.08em; color: var(--text2);
     white-space: nowrap; }
td { padding: 0.7rem 1rem; border-bottom: 1px solid rgba(255,255,255,0.04);
     color: var(--text); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(160,220,200,0.03); }
td a { color: var(--accent2); }
td a:hover { color: var(--accent); }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px; font-size: 0.72rem;
  font-weight: 500; white-space: nowrap;
}
.badge-completed  { background: rgba(160,220,200,0.15); color: var(--success); border: 1px solid rgba(160,220,200,0.25); }
.badge-skipped    { background: rgba(160,180,220,0.12); color: var(--neutral); border: 1px solid rgba(160,180,220,0.2); }
.badge-failed     { background: rgba(220,140,160,0.12); color: var(--danger); border: 1px solid rgba(220,140,160,0.2); }
.badge-processing { background: rgba(220,208,160,0.12); color: var(--warning); border: 1px solid rgba(220,208,160,0.2); }

/* ── SEMÁFORO SENTIMENTAL ── */
.sentiment { display: inline-flex; align-items: center; gap: 5px; font-size: 0.82rem; }
.sentiment-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.s-positive .sentiment-dot { background: var(--success); box-shadow: 0 0 6px var(--success); }
.s-neutral  .sentiment-dot { background: var(--warning); box-shadow: 0 0 6px var(--warning); }
.s-negative .sentiment-dot { background: var(--danger);  box-shadow: 0 0 6px var(--danger); }

/* ── URGENCY BAR ── */
.urgency { display: flex; align-items: center; gap: 6px; }
.urgency-bar { height: 5px; border-radius: 3px; background: var(--bg3); width: 60px; overflow: hidden; }
.urgency-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent2), var(--accent)); }

/* ── FILTERS ── */
.filters { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }
.filters select, .filters input[type=text] {
  background: var(--bg2); border: 1px solid var(--border2);
  color: var(--text); padding: 6px 12px; border-radius: var(--radius-sm);
  font-size: 0.83rem; outline: none; transition: var(--transition);
}
.filters select:focus, .filters input:focus { border-color: var(--accent); }
.btn-filter {
  background: rgba(140,200,220,0.12); color: var(--accent2);
  border: 1px solid rgba(140,200,220,0.25);
  padding: 6px 16px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 0.83rem; transition: var(--transition);
}
.btn-filter:hover { background: rgba(140,200,220,0.22); }

/* ── PAGINATION ── */
.pagination { display: flex; gap: 0.4rem; align-items: center; padding: 1rem 1.25rem; }
.pagination a, .pagination span {
  padding: 5px 11px; border-radius: var(--radius-sm); font-size: 0.82rem;
  border: 1px solid var(--border); color: var(--text2);
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); background: rgba(160,220,200,0.06); }
.pagination .current { background: rgba(160,220,200,0.15); color: var(--accent); border-color: rgba(160,220,200,0.3); }

/* ── DOC DETAIL ── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.detail-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.detail-section h3 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent2); margin-bottom: 1rem; }
.detail-row { display: flex; gap: 0.75rem; padding: 0.4rem 0; border-bottom: 1px solid rgba(255,255,255,0.04); font-size: 0.85rem; }
.detail-row:last-child { border-bottom: none; }
.detail-row .key { color: var(--text2); min-width: 140px; flex-shrink: 0; }
.detail-row .val { color: var(--text); word-break: break-word; }

/* ── TIMELINE EVENTS ── */
.timeline { padding: 0.5rem 0; }
.timeline-item { display: flex; gap: 1rem; padding: 0.75rem 0; position: relative; }
.timeline-item::before {
  content: ''; position: absolute; left: 11px; top: 2rem; bottom: -0.75rem;
  width: 1px; background: var(--border);
}
.timeline-item:last-child::before { display: none; }
.t-dot { width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--accent2); background: var(--bg2); display: flex; align-items: center; justify-content: center; font-size: 0.65rem; }
.t-content { flex: 1; }
.t-header { display: flex; gap: 0.75rem; align-items: center; margin-bottom: 0.25rem; }
.t-state { font-size: 0.78rem; font-weight: 600; color: var(--accent); }
.t-time { font-size: 0.72rem; color: var(--text3); }
.t-desc { font-size: 0.82rem; color: var(--text2); }

/* ── LOGIN ── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 30% 50%, rgba(20,40,40,0.8) 0%, var(--bg) 70%); }
.login-box { background: var(--surface); border: 1px solid var(--border2);
  border-radius: 14px; padding: 2.5rem; width: 100%; max-width: 380px; box-shadow: var(--shadow); }
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo img { max-width: 160px; height: auto; }
.login-box h1 { font-size: 1.1rem; font-weight: 600; color: var(--text); margin-bottom: 0.3rem; text-align: center; }
.login-box p { font-size: 0.82rem; color: var(--text2); text-align: center; margin-bottom: 1.75rem; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.78rem; color: var(--text2); margin-bottom: 0.4rem; text-transform: uppercase; letter-spacing: 0.06em; }
.form-group input {
  width: 100%; background: var(--bg2); border: 1px solid var(--border2);
  color: var(--text); padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 0.9rem; outline: none; transition: var(--transition);
}
.form-group input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(160,220,200,0.1); }
.btn-primary {
  width: 100%; background: linear-gradient(135deg, var(--accent-dark), #1a3a3a);
  border: 1px solid var(--accent); color: var(--accent);
  padding: 11px; border-radius: var(--radius-sm); font-size: 0.9rem;
  font-weight: 600; cursor: pointer; letter-spacing: 0.05em;
  transition: var(--transition); margin-top: 0.5rem;
}
.btn-primary:hover { background: rgba(160,220,200,0.15); }
.alert-error { background: rgba(220,140,160,0.1); border: 1px solid rgba(220,140,160,0.3);
  color: var(--danger); padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.85rem; margin-bottom: 1rem; text-align: center; }

/* ── SEARCH BOX ── */
.search-box {
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 2rem;
  text-align: center; color: var(--text2); font-size: 0.9rem;
}
.search-box .soon { font-size: 2rem; margin-bottom: 0.5rem; }

/* ── BLOCKCHAIN BADGE ── */
.chain-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem;
  background: rgba(140,180,220,0.1); border: 1px solid rgba(140,180,220,0.25);
  color: var(--accent3); padding: 4px 12px; border-radius: 20px; }
.chain-badge.verified { color: var(--accent); background: rgba(160,220,200,0.1); border-color: rgba(160,220,200,0.25); }

/* ── PAGE HEADER ── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.3rem; font-weight: 600; color: var(--text); }
.page-header p { font-size: 0.83rem; color: var(--text2); margin-top: 0.2rem; }
.breadcrumb { font-size: 0.78rem; color: var(--text3); }
.breadcrumb a { color: var(--text2); }
.breadcrumb a:hover { color: var(--accent); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 1rem; }
  .detail-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── NAV LOGO TEXT ── */
.nav-logo-text { display: flex; flex-direction: column; line-height: 1.2; }
.nav-logo-name { font-size: 1rem; font-weight: 600; color: var(--accent); letter-spacing: 0.05em; }
.nav-logo-tagline { font-size: 0.65rem; color: var(--text3); letter-spacing: 0.14em; text-transform: uppercase; }

/* ── FOOTER ── */
.footer {
  margin-left: var(--sidebar-w);
  border-top: 1px solid var(--border);
  background: var(--bg2);
  padding: 1rem 2rem;
}
.footer-inner {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 0.75rem;
}
.footer-brand { display: flex; align-items: center; gap: 0.75rem; }
.footer-name { font-size: 0.85rem; font-weight: 600; color: var(--accent); margin-right: 0.4rem; }
.footer-tagline { font-size: 0.7rem; color: var(--text3); letter-spacing: 0.1em; text-transform: uppercase; }
.footer-copy { font-size: 0.75rem; color: var(--text3); }
.footer-copy a { color: var(--accent2); }
.footer-copy a:hover { color: var(--accent); }

/* ── LOGIN TAGLINE & FOOTER ── */
.login-tagline {
  font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent2); margin-top: 0.5rem;
}
.login-footer {
  text-align: center; margin-top: 1.5rem;
  font-size: 0.75rem; color: var(--text3);
  padding-top: 1rem; border-top: 1px solid var(--border);
}
.login-footer a { color: var(--accent2); }
.login-footer a:hover { color: var(--accent); }

@media (max-width: 768px) {
  .footer { margin-left: 0; }
}

/* ── SVG LOGOS ── */
.nav-logo img { height: 44px; width: auto; }
.login-logo img { max-width: 220px; height: auto; }
.footer-brand img { height: 32px; width: auto; }

/* ── PNG LOGOS OVERRIDE ── */
.nav-logo img       { height: 48px; width: auto; }
.login-logo img     { max-width: 200px; height: auto; }
.footer-brand img   { height: 36px; width: auto; }

/* ── NAV LOGO FIX ── */
.nav-logo img       { height: 56px !important; width: auto; }
.nav-logo-name      { display: none; }
.nav-logo-tagline   { font-size: 6.5px !important; color: var(--text3); letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.6; }

/* ── LIGHT MODE ── */
[data-theme="light"] {
  --bg:           #f0f4f0;
  --bg2:          #e4ede8;
  --bg3:          #d8e8e0;
  --surface:      #ffffff;
  --surface2:     #eaf2ee;
  --border:       rgba(20,40,40,0.12);
  --border2:      rgba(20,40,60,0.18);

  --accent:       #1a7a5a;
  --accent2:      #1a5a8a;
  --accent3:      #4a4a9a;
  --accent-dark:  #0e3a2a;

  --text:         #0e1a14;
  --text2:        rgba(14,26,20,0.60);
  --text3:        rgba(14,26,20,0.38);

  --success:      #1a7a5a;
  --warning:      #8a6a00;
  --danger:       #8a1a3a;
  --neutral:      #3a4a8a;

  --nav-bg:       rgba(240,244,240,0.95);
  --shadow:       0 4px 24px rgba(0,0,0,0.10);
}

[data-theme="light"] .nav {
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border2);
}
[data-theme="light"] .sidebar {
  background: var(--bg2);
  border-right: 1px solid var(--border);
}
[data-theme="light"] .footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
}
[data-theme="light"] .stat-card,
[data-theme="light"] .card,
[data-theme="light"] .detail-section {
  background: var(--surface);
  border-color: var(--border);
}
[data-theme="light"] thead tr { background: var(--bg2); }
[data-theme="light"] .filters select,
[data-theme="light"] .filters input[type=text] {
  background: var(--surface); border-color: var(--border2); color: var(--text);
}
[data-theme="light"] .search-box { background: var(--surface); }

/* ── THEME TOGGLE BUTTON ── */
.theme-toggle {
  background: none; border: 1px solid var(--border2);
  color: var(--text2); width: 32px; height: 32px;
  border-radius: 50%; cursor: pointer; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); background: rgba(160,220,200,0.08); }

/* ═══════════════════════════════════════════
   SIDEBAR COLAPSABLE
═══════════════════════════════════════════ */
.sidebar { transition: width var(--transition); overflow: hidden; }
.sidebar.collapsed { width: 56px; }
.sidebar.collapsed .sidebar-section,
.sidebar.collapsed a span:not(.icon) { display: none; }
.sidebar.collapsed a { justify-content: center; padding: 0.6rem 0; }
.sidebar.collapsed a .icon { margin: 0; font-size: 1.1rem; width: auto; }
.sidebar-toggle {
  position: absolute; top: calc(var(--nav-h) + 12px); left: calc(var(--sidebar-w) - 14px);
  z-index: 300; width: 24px; height: 24px; border-radius: 50%;
  background: var(--surface2); border: 1px solid var(--border2);
  color: var(--text2); cursor: pointer; font-size: 0.7rem;
  display: flex; align-items: center; justify-content: center;
  transition: left var(--transition), var(--transition);
  box-shadow: var(--shadow);
}
.sidebar-toggle:hover { color: var(--accent); border-color: var(--accent); }
.sidebar-toggle.collapsed { left: 44px; }
.main.expanded { margin-left: 56px; }
.footer.expanded { margin-left: 56px; }

/* ═══════════════════════════════════════════
   DASHBOARD TOOLBAR
═══════════════════════════════════════════ */
.db-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.5rem;
}
.db-greeting { font-size: 1.15rem; color: var(--text); display: flex; align-items: center; gap: 0.75rem; }
.db-greeting strong { color: var(--accent); }
.db-date-label { font-size: 0.78rem; color: var(--text3); background: var(--surface2);
  padding: 3px 10px; border-radius: 20px; border: 1px solid var(--border); }
.db-datestrip { display: flex; gap: 0.3rem; align-items: center; flex-wrap: wrap; }
.db-pill {
  padding: 5px 13px; border-radius: 20px; font-size: 0.78rem; font-weight: 500;
  border: 1px solid var(--border2); color: var(--text2); cursor: pointer;
  background: none; text-decoration: none; transition: var(--transition);
}
.db-pill:hover, .db-pill.active {
  background: rgba(160,220,200,0.15); color: var(--accent); border-color: var(--accent);
}
.db-cal-btn { font-size: 0.9rem; padding: 4px 10px; }
.db-datepicker {
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 1rem 1.25rem;
  margin-bottom: 1.25rem; display: flex; align-items: center;
}
.dp-form { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.dp-form label { font-size: 0.82rem; color: var(--text2); display: flex; align-items: center; gap: 0.5rem; }
.dp-form input[type=date] {
  background: var(--bg2); border: 1px solid var(--border2); color: var(--text);
  padding: 5px 10px; border-radius: var(--radius-sm); font-size: 0.83rem; outline: none;
}

/* ═══════════════════════════════════════════
   KPI GRID
═══════════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.85rem; margin-bottom: 1.25rem;
}
.kpi-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem;
  display: flex; flex-direction: column; gap: 0.2rem;
  transition: var(--transition); position: relative; overflow: hidden;
}
.kpi-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--border2);
}
.kpi-card.kpi-green::before { background: var(--success); }
.kpi-card.kpi-yellow::before { background: var(--warning); }
.kpi-card.kpi-red::before { background: var(--danger); }
.kpi-card:hover { transform: translateY(-2px); border-color: var(--border2); }
.kpi-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text2); }
.kpi-value { font-size: 2.2rem; font-weight: 700; color: var(--accent); line-height: 1.1; }
.kpi-sub { font-size: 0.72rem; color: var(--text3); }
.kpi-bar-wrap { height: 4px; background: var(--bg3); border-radius: 2px; overflow: hidden; margin-top: 0.3rem; }
.kpi-bar-fill { height: 100%; border-radius: 2px; transition: width 0.6s ease; }
.kpi-bar-label { font-size: 0.7rem; color: var(--text3); margin-top: 2px; }
.kpi-chip { font-size: 0.7rem; background: var(--surface2); border: 1px solid var(--border);
  color: var(--text3); padding: 2px 8px; border-radius: 10px; }

/* Termómetro de segmentos */
.kpi-thermo { display: flex; gap: 3px; margin: 0.35rem 0; }
.thermo-seg { height: 6px; flex: 1; border-radius: 3px; opacity: 0.2; transition: opacity 0.4s; }
.thermo-seg.active { opacity: 1; }

/* ═══════════════════════════════════════════
   ROW 2 — 4 CARDS
═══════════════════════════════════════════ */
.db-row2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem; margin-bottom: 1.25rem;
}
.db-card { min-height: 180px; }

/* Semáforo */
.semaforo-wrap { padding: 0.75rem 1rem; }
.semaforo { display: flex; justify-content: center; gap: 1.5rem; margin-bottom: 1rem; }
.sem-light { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }
.sem-bulb { width: 42px; height: 42px; border-radius: 50%; opacity: 0.2; transition: opacity 0.4s, box-shadow 0.4s; }
.sem-light.active .sem-bulb { opacity: 1; }
.sem-red   .sem-bulb { background: var(--danger); }
.sem-yellow .sem-bulb { background: var(--warning); }
.sem-green  .sem-bulb { background: var(--success); }
.sem-light.active.sem-red    .sem-bulb { box-shadow: 0 0 16px var(--danger); }
.sem-light.active.sem-yellow .sem-bulb { box-shadow: 0 0 16px var(--warning); }
.sem-light.active.sem-green  .sem-bulb { box-shadow: 0 0 16px var(--success); }
.sem-val { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.sem-lbl { font-size: 0.68rem; color: var(--text3); text-transform: uppercase; }
.sent-bar-stack { display: flex; height: 8px; border-radius: 4px; overflow: hidden; gap: 1px; }
.sent-bar-stack div { height: 100%; transition: width 0.6s ease; }
.sent-legend { display: flex; gap: 1rem; margin-top: 0.5rem; font-size: 0.72rem; color: var(--text2); }
.sent-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }

/* Urgencia chart */
.urg-chart { padding: 0.75rem 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.urg-row { display: flex; align-items: center; gap: 0.5rem; }
.urg-label { font-size: 0.75rem; color: var(--text2); width: 24px; flex-shrink: 0; }
.urg-bar-bg { flex: 1; height: 8px; background: var(--bg3); border-radius: 4px; overflow: hidden; }
.urg-bar-fill { height: 100%; border-radius: 4px; transition: width 0.6s ease; }
.urg-count { font-size: 0.75rem; color: var(--text2); width: 20px; text-align: right; }

/* Confidencialidad */
.conf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; padding: 0.75rem; }
.conf-cell { border: 1px solid; border-radius: var(--radius-sm); padding: 0.6rem; text-align: center; }
.conf-ico { font-size: 1.3rem; }
.conf-val { font-size: 1.4rem; font-weight: 700; }
.conf-lbl { font-size: 0.68rem; color: var(--text2); text-transform: uppercase; }

/* Tipos */
.type-list { padding: 0.75rem 1rem; display: flex; flex-direction: column; gap: 0.6rem; }
.type-row { display: flex; align-items: center; gap: 0.5rem; }
.type-name { font-size: 0.78rem; color: var(--text2); width: 130px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.type-bar-bg { flex: 1; height: 8px; background: var(--bg3); border-radius: 4px; overflow: hidden; }
.type-bar-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg,var(--accent2),var(--accent)); transition: width 0.6s; }
.type-cnt { font-size: 0.75rem; color: var(--text2); width: 20px; text-align: right; }

/* ═══════════════════════════════════════════
   ROW 3 — TENDENCIA + TABLA
═══════════════════════════════════════════ */
.db-row3 { display: flex; gap: 0.85rem; margin-bottom: 1.5rem; }
.db-row3 .card { flex: 1; }

[data-theme=light] .kpi-card,
[data-theme=light] .db-card { background: var(--surface); border-color: var(--border); }

/* ════════════════════════════════════════════
   SIDEBAR COLAPSABLE v3
════════════════════════════════════════════ */
.nav-left { display: flex; align-items: center; gap: 0.75rem; }

.sidebar-toggle-btn {
  background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; gap: 4px; padding: 6px;
  border-radius: var(--radius-sm);
}
.tog-bar {
  display: block; width: 20px; height: 2px;
  background: var(--text2); border-radius: 2px;
  transition: var(--transition);
}
.sidebar-toggle-btn:hover .tog-bar { background: var(--accent); }

/* Sidebar expandido (default) */
.sidebar {
  width: var(--sidebar-w);
  transition: width 0.25s cubic-bezier(0.4,0,0.2,1);
  overflow: hidden;
  white-space: nowrap;
}

/* Sidebar colapsado */
.sidebar.collapsed {
  width: 56px;
}
.sidebar.collapsed .sidebar-section { opacity: 0; height: 0; padding: 0; overflow: hidden; }
.sidebar.collapsed .nav-label { opacity: 0; width: 0; overflow: hidden; display: inline-block; }
.sidebar.collapsed a {
  justify-content: center;
  padding: 0.75rem 0;
  position: relative;
}
.sidebar.collapsed a .icon { margin: 0; font-size: 1.15rem; }

/* Tooltip en modo colapsado */
.sidebar.collapsed a[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute; left: 62px; top: 50%; transform: translateY(-50%);
  background: var(--surface2); color: var(--text);
  border: 1px solid var(--border2); padding: 4px 10px;
  border-radius: var(--radius-sm); font-size: 0.8rem;
  white-space: nowrap; z-index: 999; pointer-events: none;
  box-shadow: var(--shadow);
}

/* Main y footer ajustan según sidebar */
.main { transition: margin-left 0.25s cubic-bezier(0.4,0,0.2,1); }
.layout.sidebar-collapsed .main { margin-left: 56px; }
.footer.sidebar-collapsed { margin-left: 56px; }
.footer { transition: margin-left 0.25s cubic-bezier(0.4,0,0.2,1); }

/* ════════════════════════════════════════════
   DASHBOARD v3 — KPI CARDS MEJORADAS
════════════════════════════════════════════ */
.db-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem;
}
.db-greeting { font-size: 1.2rem; color: var(--text); display:flex; align-items:center; gap:0.75rem; }
.db-greeting strong { color: var(--accent); }
.db-date-label {
  font-size: 0.75rem; color: var(--text3);
  background: var(--surface2); border: 1px solid var(--border);
  padding: 3px 10px; border-radius: 20px;
}
.db-datestrip { display:flex; gap:0.3rem; align-items:center; flex-wrap:wrap; }
.db-pill {
  padding: 5px 12px; border-radius: 20px; font-size: 0.78rem;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text2); cursor:pointer; text-decoration:none;
  transition: var(--transition);
}
.db-pill:hover, .db-pill.active {
  background: rgba(160,220,200,0.15); color: var(--accent);
  border-color: rgba(160,220,200,0.35);
}
.db-cal-btn { font-size: 0.88rem; }
.db-datepicker {
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 1rem 1.25rem;
  margin-bottom: 1rem; display: flex; gap: 1rem;
  align-items: center; flex-wrap: wrap;
}
.dp-form { display:flex; gap:1rem; align-items:center; flex-wrap:wrap; }
.dp-form label { font-size: 0.82rem; color: var(--text2); display:flex; gap:0.4rem; align-items:center; }
.dp-form input[type=date] {
  background: var(--bg2); border: 1px solid var(--border2);
  color: var(--text); padding: 5px 10px; border-radius: var(--radius-sm);
  font-size: 0.82rem; outline: none;
}

/* KPI Grid mejorado */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px,1fr));
  gap: 0.85rem; margin-bottom: 1.25rem;
}
.kpi-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1rem 0.85rem;
  position: relative; overflow: hidden;
  transition: var(--transition);
}
.kpi-card::before {
  content:''; position:absolute; top:0; left:0; right:0; height:3px;
  background: var(--accent2);
}
.kpi-card.kpi-green::before { background: var(--success); }
.kpi-card.kpi-yellow::before { background: var(--warning); }
.kpi-card.kpi-red::before { background: var(--danger); }
.kpi-card:hover { transform: translateY(-3px); border-color: var(--border2); box-shadow: var(--shadow); }
.kpi-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text2); margin-bottom:0.25rem; }
.kpi-value { font-size: 2.4rem; font-weight: 700; color: var(--accent); line-height: 1; margin-bottom:0.2rem; }
.kpi-sub { font-size: 0.7rem; color: var(--text3); }
.kpi-bar-wrap { height: 4px; background: var(--bg3); border-radius: 2px; overflow:hidden; margin-top:0.4rem; }
.kpi-bar-fill { height:100%; border-radius:2px; transition: width 0.8s cubic-bezier(0.4,0,0.2,1); }
.kpi-bar-label { font-size:0.68rem; color:var(--text3); margin-top:3px; }
.kpi-chip {
  font-size:0.68rem; background:var(--surface2); border:1px solid var(--border);
  color:var(--text2); padding:2px 8px; border-radius:20px;
}
.kpi-thermo { display:flex; gap:3px; margin:0.35rem 0 0.2rem; }
.thermo-seg { height:7px; flex:1; border-radius:3px; opacity:0.18; transition:opacity 0.4s; }
.thermo-seg.active { opacity:1; }

/* Row 2 */
.db-row2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px,1fr));
  gap: 0.85rem; margin-bottom: 1.25rem;
}
.db-card { min-height: 190px; }

/* Semáforo */
.semaforo-wrap { padding: 0.75rem; }
.semaforo { display:flex; justify-content:center; gap:1.5rem; margin-bottom:0.85rem; }
.sem-light { display:flex; flex-direction:column; align-items:center; gap:4px; }
.sem-bulb {
  width: 36px; height: 36px; border-radius: 50%;
  opacity: 0.15; transition: all 0.4s;
  border: 2px solid currentColor;
}
.sem-red   { color: var(--danger); }
.sem-yellow{ color: var(--warning); }
.sem-green { color: var(--success); }
.sem-light.active .sem-bulb { opacity:1; box-shadow: 0 0 14px currentColor; }
.sem-val { font-size:1.2rem; font-weight:700; }
.sem-lbl { font-size:0.68rem; color:var(--text2); text-transform:uppercase; letter-spacing:0.08em; }
.sent-bar-stack { display:flex; height:8px; border-radius:4px; overflow:hidden; margin:0.5rem 0 0.4rem; }
.sent-bar-stack div { transition: width 0.8s ease; }
.sent-legend { display:flex; gap:0.85rem; font-size:0.72rem; color:var(--text2); }
.sent-legend i { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:3px; }

/* Urgencia chart */
.urg-chart { padding:0.5rem 1rem 0.75rem; }
.urg-row { display:flex; align-items:center; gap:0.5rem; margin-bottom:0.5rem; }
.urg-label { font-size:0.72rem; color:var(--text2); width:20px; flex-shrink:0; font-weight:600; }
.urg-bar-bg { flex:1; height:10px; background:var(--bg3); border-radius:5px; overflow:hidden; }
.urg-bar-fill { height:100%; border-radius:5px; transition: width 0.8s ease; }
.urg-count { font-size:0.72rem; color:var(--text2); width:18px; text-align:right; }

/* Confidencialidad */
.conf-grid { display:grid; grid-template-columns:1fr 1fr; gap:0.5rem; padding:0.75rem; }
.conf-cell {
  border:1px solid; border-radius:var(--radius-sm);
  padding:0.5rem; text-align:center;
  background: rgba(255,255,255,0.02);
}
.conf-ico { font-size:1.2rem; }
.conf-val { font-size:1.4rem; font-weight:700; line-height:1.1; }
.conf-lbl { font-size:0.65rem; color:var(--text2); text-transform:uppercase; }

/* Tipos */
.type-list { padding:0.5rem 1rem 0.75rem; }
.type-row { display:flex; align-items:center; gap:0.5rem; margin-bottom:0.5rem; }
.type-name { font-size:0.72rem; color:var(--text2); width:100px; flex-shrink:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.type-bar-bg { flex:1; height:8px; background:var(--bg3); border-radius:4px; overflow:hidden; }
.type-bar-fill { height:100%; border-radius:4px; background:var(--accent2); transition: width 0.8s ease; }
.type-cnt { font-size:0.72rem; color:var(--text2); width:18px; text-align:right; }

/* Row 3 */
.db-row3 { display:flex; gap:0.85rem; margin-bottom:1.5rem; }

/* Light mode overrides */
[data-theme=light] .kpi-card,
[data-theme=light] .db-card { background:var(--surface); border-color:var(--border); }
[data-theme=light] .db-datepicker { background:var(--surface); }
[data-theme=light] .dp-form input[type=date] { background:var(--bg2); color:var(--text); }

/* nav-username */
.nav-username { font-size:0.85rem; color:var(--text2); }


/* ════════════════════════════════════════════
   BOTÓN REFRESCAR
════════════════════════════════════════════ */
.btn-refresh {
  background: rgba(160,220,200,0.1);
  border: 1px solid rgba(160,220,200,0.3);
  color: var(--accent); padding: 5px 14px;
  border-radius: var(--radius-sm); font-size: 0.82rem;
  cursor: pointer; transition: var(--transition);
  font-weight: 500; letter-spacing: 0.03em;
}
.btn-refresh:hover { background: rgba(160,220,200,0.2); transform: none; }

/* ════════════════════════════════════════════
   SYNC OVERLAY BASE
════════════════════════════════════════════ */
.sync-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(6,6,14,0.85);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
}

/* ── MODAL DE ADVERTENCIA ── */
.sync-modal {
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: 14px; padding: 2.5rem; max-width: 420px; width: 90%;
  text-align: center; box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}
.sync-modal-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.sync-modal h2 { font-size: 1.2rem; color: var(--text); margin-bottom: 0.75rem; }
.sync-modal p { font-size: 0.88rem; color: var(--text2); margin-bottom: 0.5rem; line-height: 1.6; }
.sync-warn { color: var(--warning) !important; font-size: 0.8rem !important; }
.sync-modal-btns { display: flex; gap: 0.75rem; justify-content: center; margin-top: 1.5rem; }
.btn-sync-cancel {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text2); padding: 8px 20px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 0.85rem; transition: var(--transition);
}
.btn-sync-cancel:hover { border-color: var(--accent2); color: var(--text); }
.btn-sync-start {
  background: linear-gradient(135deg, #1a3a2a, #142828);
  border: 1px solid var(--accent); color: var(--accent);
  padding: 8px 24px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 0.85rem; font-weight: 600;
  transition: var(--transition);
}
.btn-sync-start:hover { background: rgba(160,220,200,0.15); }

/* ── PANTALLA DE TRANSFERENCIA ── */
.sync-transfer {
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: 16px; padding: 2rem 2.5rem;
  max-width: 500px; width: 92%; box-shadow: 0 24px 80px rgba(0,0,0,0.5);
  display: flex; flex-direction: column; align-items: center; gap: 1.25rem;
}

.transfer-header {
  display: flex; align-items: center; gap: 0.75rem;
  align-self: flex-start;
}
.transfer-title { font-size: 1.15rem; font-weight: 600; color: var(--text); }
.transfer-badge {
  background: rgba(140,200,220,0.12); border: 1px solid rgba(140,200,220,0.25);
  color: var(--accent2); padding: 2px 10px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 500;
}

/* Pipeline de transferencia */
.transfer-pipeline {
  display: flex; align-items: center; gap: 1rem; width: 100%;
  justify-content: center; padding: 0.5rem 0;
}
.pipeline-node { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; }
.pipeline-icon {
  width: 52px; height: 52px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface2); border: 1px solid var(--border2);
}
.pipeline-label { font-size: 0.7rem; color: var(--text2); text-transform: uppercase; letter-spacing: 0.08em; }

/* Dots animados */
.pipeline-dots { display: flex; gap: 5px; align-items: center; flex: 1; justify-content: center; }
.pdot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  animation: dot-flow 1.6s ease-in-out infinite;
  opacity: 0.15;
}
.pdot:nth-child(1) { animation-delay: 0s; }
.pdot:nth-child(2) { animation-delay: 0.2s; }
.pdot:nth-child(3) { animation-delay: 0.4s; }
.pdot:nth-child(4) { animation-delay: 0.6s; }
.pdot:nth-child(5) { animation-delay: 0.8s; }
.pdot:nth-child(6) { animation-delay: 1.0s; }
.pdot:nth-child(7) { animation-delay: 1.2s; }
.pdot:nth-child(8) { animation-delay: 1.4s; }
@keyframes dot-flow {
  0%, 100% { opacity: 0.12; transform: scale(0.7); }
  50%       { opacity: 1;    transform: scale(1.2); background: var(--accent2); }
}

/* Barra de progreso */
.transfer-bar-wrap {
  width: 100%; height: 8px; background: var(--bg3);
  border-radius: 4px; overflow: hidden;
}
.transfer-bar-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent2), var(--accent));
  transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 0 10px rgba(160,220,200,0.4);
}
.transfer-pct {
  font-size: 0.78rem; color: var(--text2); align-self: flex-end;
  margin-top: -0.75rem;
}

/* Log de actividad */
.transfer-log {
  width: 100%; max-height: 130px; overflow-y: auto;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.6rem 0.85rem;
  font-size: 0.78rem; font-family: 'JetBrains Mono', monospace;
}
.tlog-item {
  color: var(--text2); padding: 2px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity:0; transform: translateY(4px); } to { opacity:1; transform: none; } }

/* Resumen final */
.transfer-summary {
  display: flex; gap: 1rem; width: 100%; justify-content: center;
  flex-wrap: wrap;
}
.summary-item {
  padding: 6px 16px; border-radius: var(--radius-sm); font-size: 0.82rem;
}
.summary-item.success { background: rgba(160,220,200,0.12); color: var(--success); border: 1px solid rgba(160,220,200,0.25); }
.summary-item.skip    { background: rgba(160,180,220,0.12); color: var(--neutral); border: 1px solid rgba(160,180,220,0.2); }
.summary-item.error   { background: rgba(220,140,160,0.12); color: var(--danger);  border: 1px solid rgba(220,140,160,0.2); }

/* Light mode sync */
[data-theme=light] .sync-modal,
[data-theme=light] .sync-transfer { background: var(--surface); }
[data-theme=light] .transfer-log  { background: var(--bg2); }

/* ════════════════════════════════════════════
   KPI PANEL LATERAL
════════════════════════════════════════════ */
.kpi-card  { cursor: pointer; }
.kpi-card:hover { transform: translateY(-4px); box-shadow: 0 8px 30px rgba(0,0,0,0.4); border-color: var(--accent2); }
.sem-light { cursor: pointer; }
.sem-light:hover .sem-bulb { transform: scale(1.12); }
.conf-cell { cursor: pointer; transition: var(--transition); }
.conf-cell:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.3); }
.type-row  { cursor: pointer; transition: var(--transition); }
.type-row:hover .type-bar-fill { opacity: 0.8; }
.urg-row   { cursor: pointer; transition: var(--transition); }
.urg-row:hover { opacity: 0.8; }

/* Panel lateral */
.kpi-panel-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(3px);
  opacity: 0; transition: opacity 0.25s ease;
  pointer-events: none;
}
.kpi-panel-overlay.open { opacity: 1; pointer-events: all; }

.kpi-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 501;
  width: 520px; max-width: 95vw;
  background: var(--bg2);
  border-left: 1px solid var(--border2);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  box-shadow: -8px 0 40px rgba(0,0,0,0.5);
}
.kpi-panel.open { transform: translateX(0); }

.kpi-panel-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.kpi-panel-header h3 { font-size: 1rem; font-weight: 600; color: var(--text); }
.kpi-panel-header .count-badge {
  font-size: 0.72rem; background: rgba(160,220,200,0.12);
  border: 1px solid rgba(160,220,200,0.25); color: var(--accent);
  padding: 3px 10px; border-radius: 20px; margin-left: 0.5rem;
}
.kpi-panel-close {
  background: none; border: none; color: var(--text2);
  font-size: 1.3rem; cursor: pointer; padding: 4px 8px;
  border-radius: var(--radius-sm); transition: var(--transition);
}
.kpi-panel-close:hover { color: var(--danger); background: rgba(220,140,160,0.1); }

.kpi-panel-body {
  flex: 1; overflow-y: auto; padding: 0.75rem;
}

/* Doc card en el panel */
.kp-doc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.65rem;
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
}
.kp-doc-card:hover { border-color: var(--border2); box-shadow: 0 4px 16px rgba(0,0,0,0.3); }
.kp-doc-card.expanded { border-color: var(--accent2); }

.kp-doc-header {
  padding: 0.85rem 1rem;
  display: flex; align-items: flex-start; gap: 0.75rem;
}
.kp-doc-main { flex: 1; min-width: 0; }
.kp-doc-title {
  font-size: 0.88rem; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}
.kp-doc-meta {
  display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center;
  font-size: 0.72rem; color: var(--text2);
}
.kp-doc-kpis {
  display: flex; gap: 0.4rem; align-items: center; flex-shrink: 0;
}
.kpi-pip {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  font-size: 0.65rem; color: var(--text3);
}
.kpi-pip-val {
  font-size: 0.85rem; font-weight: 700; line-height: 1;
}
.kpi-pip-lbl { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.06em; }

/* Sumilla expandida */
.kp-doc-body {
  padding: 0 1rem 1rem;
  display: none;
  border-top: 1px solid var(--border);
}
.kp-doc-card.expanded .kp-doc-body { display: block; }
.kp-doc-summary {
  font-size: 0.83rem; color: var(--text2); line-height: 1.6;
  margin: 0.75rem 0;
}
.kp-doc-actions {
  display: flex; gap: 0.5rem; margin-top: 0.75rem;
}
.kp-btn {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 6px 14px; border-radius: var(--radius-sm);
  font-size: 0.78rem; font-weight: 500; cursor: pointer;
  text-decoration: none; transition: var(--transition); border: 1px solid;
}
.kp-btn-primary {
  background: rgba(140,200,220,0.12); color: var(--accent2);
  border-color: rgba(140,200,220,0.3);
}
.kp-btn-primary:hover { background: rgba(140,200,220,0.22); color: var(--accent2); }
.kp-btn-secondary {
  background: rgba(160,220,200,0.08); color: var(--accent);
  border-color: rgba(160,220,200,0.2);
}
.kp-btn-secondary:hover { background: rgba(160,220,200,0.18); color: var(--accent); }

/* Sentiment dot inline */
.sent-dot { width:8px; height:8px; border-radius:50%; display:inline-block; margin-right:2px; }
.sd-positive { background:var(--success); box-shadow:0 0 4px var(--success); }
.sd-neutral  { background:var(--warning); box-shadow:0 0 4px var(--warning); }
.sd-negative { background:var(--danger);  box-shadow:0 0 4px var(--danger); }

/* Panel loading */
.kp-loading {
  display: flex; align-items: center; justify-content: center;
  padding: 3rem; color: var(--text3); font-size: 0.88rem; gap: 0.5rem;
}
.kp-spinner {
  width: 18px; height: 18px; border: 2px solid var(--border2);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

[data-theme=light] .kpi-panel { background: var(--bg2); }
[data-theme=light] .kp-doc-card { background: var(--surface); }


/* ════════════════════════════════════════════
   KPI STATUS CARD UNIFICADA
════════════════════════════════════════════ */
.kpi-status-card { cursor: default; }
.kpi-status-row {
  display: flex; align-items: center; gap: 0; margin: 0.5rem 0;
}
.kpi-status-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  gap: 2px; cursor: pointer; padding: 0.3rem 0;
  border-radius: var(--radius-sm); transition: var(--transition);
}
.kpi-status-item:hover { background: rgba(255,255,255,0.04); }
.kpi-status-num {
  font-size: 1.8rem; font-weight: 700; color: var(--accent); line-height: 1;
}
.kpi-status-lbl {
  font-size: 0.62rem; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text3);
}
.kpi-status-ok .kpi-status-num  { color: var(--success); }
.kpi-status-err .kpi-status-num { color: var(--danger); }
.kpi-status-div {
  width: 1px; height: 36px; background: var(--border); flex-shrink: 0; margin: 0 0.25rem;
}
.kpi-mini-bar {
  height: 4px; background: var(--bg3); border-radius: 3px; overflow: hidden; margin-top: 0.4rem;
}

/* Tipo de doc con color */
.type-name { font-weight: 500; }


/* ════ KPI STATUS CARD — MAS GRANDE ════ */
.kpi-status-card { grid-column: span 2; }
.kpi-status-num  { font-size: 2.4rem !important; }
.kpi-status-lbl  { font-size: 0.72rem !important; }
.kpi-status-item { padding: 0.5rem 0.75rem !important; gap: 4px !important; }
.kpi-status-div  { height: 48px !important; }
.kpi-status-row  { gap: 0.25rem !important; margin: 0.75rem 0 !important; }

/* ════ ALERTA DENUNCIAS ════ */
.denuncia-alert {
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 1.25rem;
  border: 1px solid;
  transition: var(--transition);
  animation: alertPulse 2.5s ease-in-out infinite;
}
.denuncia-alert.danger {
  background: rgba(180,30,50,0.15);
  border-color: rgba(220,60,80,0.45);
  color: #ff8095;
}
.denuncia-alert.safe {
  background: rgba(30,140,80,0.12);
  border-color: rgba(60,200,120,0.35);
  color: #60e0a0;
}
.denuncia-alert-icon { font-size: 1.8rem; flex-shrink: 0; }
.denuncia-alert-body { flex: 1; }
.denuncia-alert-title { font-size: 0.95rem; font-weight: 700; letter-spacing: 0.03em; }
.denuncia-alert-sub   { font-size: 0.78rem; opacity: 0.8; margin-top: 2px; }
.denuncia-alert-badge {
  font-size: 2rem; font-weight: 800; flex-shrink: 0;
  min-width: 56px; text-align: center;
}
@keyframes alertPulse {
  0%,100% { box-shadow: 0 0 0 0 transparent; }
  50%      { box-shadow: 0 0 18px 2px rgba(220,60,80,0.2); }
}
.denuncia-alert.safe { animation: none; }

/* ════ KPI STATUS CARD — FIX SPAN 2 ════ */
.kpi-grid { grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); }
.kpi-status-card {
  grid-column: span 2 !important;
  min-width: 340px;
}
.kpi-status-num { font-size: 2.8rem !important; }

/* ════════════════════════════════════════════
   RADAR DE RIESGO
════════════════════════════════════════════ */
.radar-card { min-height: 320px; }
.radar-wrap {
  display: flex; align-items: center; gap: 1.25rem;
  padding: 0.75rem 1rem 1rem; flex-wrap: wrap;
}
.radar-wrap canvas { flex-shrink: 0; }
.radar-legend { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 0.55rem; }
.radar-leg-row {
  display: flex; align-items: center; gap: 0.5rem; font-size: 0.75rem;
}
.radar-leg-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.radar-leg-lbl { color: var(--text2); width: 80px; flex-shrink: 0; }
.radar-leg-bar {
  flex: 1; height: 5px; background: var(--bg3);
  border-radius: 3px; overflow: hidden;
}
.radar-leg-val {
  font-size: 0.72rem; font-weight: 700;
  width: 28px; text-align: right; flex-shrink: 0;
}

/* db-row3 con radar ocupa bien el espacio */
.db-row3 { flex-wrap: wrap; }
.radar-card { flex: 1; min-width: 320px; }

