/* ============================================================
   MangoCenter BI 1.1 — Design System
   ImaginA · Índigo #1B1F5E · Coral #FF6B4A · Inter
   ============================================================ */

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --indigo:      #1B1F5E;
  --indigo-dark: #13163F;
  --indigo-mid:  #252A7A;
  --indigo-soft: #E8EAF6;
  --coral:       #FF6B4A;
  --coral-light: #FFF0ED;
  --coral-dark:  #E05030;
  --white:       #F8F9FF;
  --bg:          #F0F2FA;
  --card:        #FFFFFF;
  --text:        #1A1A2A;
  --text-mid:    #4A4A6A;
  --text-soft:   #8888AA;
  --border:      #E2E4F0;
  --green:       #10B981;
  --green-bg:    #ECFDF5;
  --red:         #EF4444;
  --red-bg:      #FEF2F2;
  --amber:       #F59E0B;
  --amber-bg:    #FFFBEB;
  --shadow-sm:   0 1px 3px rgba(27,31,94,.07), 0 1px 2px rgba(27,31,94,.04);
  --shadow-md:   0 4px 16px rgba(27,31,94,.08), 0 1px 4px rgba(27,31,94,.05);
  --shadow-lg:   0 12px 40px rgba(27,31,94,.12), 0 4px 12px rgba(27,31,94,.06);
  --radius-sm:   6px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --sidebar-w:   230px;
  --topbar-h:    60px;
  --trans:       .18s cubic-bezier(.4,0,.2,1);
}

html { font-size: 15px; }
body {
  font-family: 'Inter', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select { font-family: inherit; }
svg { display: block; flex-shrink: 0; }

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #C8CAE0; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #9A9CC0; }

/* ============================================================
   LOGIN
   ============================================================ */
#login-screen, #change-screen {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: stretch;
  background: var(--indigo-dark);
}

/* Reglas de la clave nueva (checklist en vivo) — pantalla de cambio obligatorio */
.pw-rules { list-style: none; padding: 0; margin: -.6rem 0 1.2rem; display: flex;
  flex-wrap: wrap; gap: .3rem .9rem; font-size: .78rem; }
.pw-rules li { color: var(--text-soft); display: flex; align-items: center; gap: .35rem; transition: color var(--trans); }
.pw-rules li::before { content: "○"; font-size: .85rem; }
.pw-rules li.ok { color: var(--green); }
.pw-rules li.ok::before { content: "✓"; }

.login-brand {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: linear-gradient(145deg, var(--indigo-dark) 0%, var(--indigo-mid) 60%, #2D3490 100%);
  padding: 3rem; gap: 2rem; position: relative; overflow: hidden;
}
.login-brand::before {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.login-iso {
  animation: float 4s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}
.login-tagline {
  text-align: center;
}
.login-tagline h2 {
  font-size: 1.7rem; font-weight: 800; color: #fff; letter-spacing: -.5px; line-height: 1.2;
}
.login-tagline p {
  font-size: .95rem; color: rgba(255,255,255,.55); margin-top: .5rem; font-weight: 400;
}
.login-client-badge {
  display: flex; align-items: center; gap: .6rem;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
  border-radius: 99px; padding: .45rem 1.1rem;
  font-size: .82rem; color: rgba(255,255,255,.7); font-weight: 500;
}
.login-client-badge span { color: #fff; font-weight: 600; }

.login-form-wrap {
  width: 420px; display: flex; align-items: center; justify-content: center;
  background: var(--white); padding: 3rem 2.8rem;
}
.login-form-inner { width: 100%; }
.login-form-inner h3 {
  font-size: 1.35rem; font-weight: 700; color: var(--indigo); margin-bottom: .35rem;
}
.login-form-inner p {
  font-size: .875rem; color: var(--text-soft); margin-bottom: 2rem;
}

.form-group { margin-bottom: 1.25rem; }
.form-group label {
  display: block; font-size: .8rem; font-weight: 600;
  color: var(--text-mid); margin-bottom: .45rem; letter-spacing: .3px;
  text-transform: uppercase;
}
.form-group select,
.form-group input[type="password"],
.form-group input[type="text"] {
  width: 100%; padding: .75rem 1rem;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: .95rem; color: var(--text); background: var(--white);
  transition: border-color var(--trans), box-shadow var(--trans);
  outline: none;
}
.form-group select:focus,
.form-group input:focus {
  border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(27,31,94,.08);
}

.btn-login {
  width: 100%; padding: .85rem; margin-top: .5rem;
  background: var(--coral); color: #fff;
  font-size: 1rem; font-weight: 700; letter-spacing: .3px;
  border-radius: var(--radius-sm); border: none;
  transition: background var(--trans), transform var(--trans), box-shadow var(--trans);
  box-shadow: 0 4px 14px rgba(255,107,74,.35);
}
.btn-login:hover  { background: var(--coral-dark); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(255,107,74,.4); }
.btn-login:active { transform: translateY(0); }

.login-error {
  background: var(--red-bg); border: 1px solid #FECACA;
  color: var(--red); font-size: .85rem; font-weight: 500;
  padding: .7rem 1rem; border-radius: var(--radius-sm);
  margin-top: 1rem; display: none;
}
.login-error.visible { display: block; animation: shake .35s ease; }
@keyframes shake {
  0%,100%{ transform:translateX(0) } 20%,60%{ transform:translateX(-4px) }
  40%,80%{ transform:translateX(4px) }
}

/* ============================================================
   APP SHELL
   ============================================================ */
#app { display: flex; height: 100vh; overflow: hidden; }
#app.hidden { display: none; }

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--indigo);
  display: flex; flex-direction: column;
  height: 100vh; overflow-y: auto; overflow-x: hidden;
  transition: width var(--trans), transform var(--trans);
  z-index: 200; position: relative;
}

.sb-header {
  padding: 1.1rem 1rem 1rem 1.1rem;
  display: flex; align-items: center; gap: .75rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
  min-height: var(--topbar-h);
}
.sb-logo-text { display: flex; flex-direction: column; }
.sb-logo-text strong {
  font-size: .95rem; font-weight: 800; color: #fff; letter-spacing: -.2px; line-height: 1.1;
}
.sb-logo-text span {
  font-size: .72rem; color: rgba(255,255,255,.4); font-weight: 400; margin-top: 1px;
}

.sb-section-label {
  font-size: .68rem; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: rgba(255,255,255,.3);
  padding: 1.2rem 1.1rem .4rem;
}

.sb-nav { flex: 1; padding: .5rem 0; }

.sb-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem 1.1rem; margin: 1px .5rem;
  border-radius: var(--radius-sm); cursor: pointer;
  color: rgba(255,255,255,.55); font-size: .875rem; font-weight: 500;
  transition: background var(--trans), color var(--trans), border-color var(--trans);
  border-left: 3px solid transparent; user-select: none;
  white-space: nowrap; overflow: hidden;
}
.sb-item svg { flex-shrink: 0; opacity: .7; transition: opacity var(--trans); }
.sb-item:hover { background: rgba(255,255,255,.06); color: rgba(255,255,255,.85); }
.sb-item:hover svg { opacity: 1; }
.sb-item.active {
  background: rgba(255,107,74,.12); color: #fff;
  border-left-color: var(--coral);
}
.sb-item.active svg { opacity: 1; color: var(--coral); }

.sb-divider { height: 1px; background: rgba(255,255,255,.06); margin: .6rem .5rem; }

.sb-footer {
  padding: 1rem 1.1rem; border-top: 1px solid rgba(255,255,255,.06);
}
.sb-user-chip {
  display: flex; align-items: center; gap: .65rem;
  padding: .6rem .75rem; border-radius: var(--radius-sm);
  background: rgba(255,255,255,.05);
}
.sb-avatar {
  width: 30px; height: 30px; border-radius: 99px;
  background: var(--coral); display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
.sb-user-info { overflow: hidden; flex: 1; }
.sb-user-info strong {
  display: block; font-size: .8rem; font-weight: 600; color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sb-user-info span { font-size: .7rem; color: rgba(255,255,255,.35); }
.sb-logout {
  color: rgba(255,255,255,.3); padding: 4px;
  border-radius: 4px; transition: color var(--trans);
}
.sb-logout:hover { color: var(--coral); }

/* ── Main area ────────────────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h); flex-shrink: 0;
  background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 1.5rem; gap: 1rem;
  box-shadow: var(--shadow-sm);
}
.topbar-left { display: flex; align-items: center; gap: .9rem; flex: 1; min-width: 0; }
.menu-toggle {
  display: none; color: var(--text-mid); padding: 6px;
  border-radius: var(--radius-sm); transition: background var(--trans);
}
.menu-toggle:hover { background: var(--bg); }
.topbar-title { font-size: 1.05rem; font-weight: 700; color: var(--indigo); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: .75rem; flex-shrink: 0; }

.freshness-badge {
  display: flex; align-items: center; gap: .4rem;
  font-size: .78rem; color: var(--text-soft); font-weight: 500;
  padding: .3rem .7rem; border-radius: 99px;
  background: var(--bg); border: 1px solid var(--border);
  white-space: nowrap;
}
.freshness-badge .dot {
  width: 7px; height: 7px; border-radius: 99px; background: var(--green);
  animation: pulse-dot 2s ease-in-out infinite;
}
.freshness-badge.stale .dot { background: var(--amber); }
.freshness-badge.old   .dot { background: var(--red); }
@keyframes pulse-dot { 0%,100%{ opacity:1 } 50%{ opacity:.4 } }

.sucursal-selector select {
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: .35rem .7rem; font-size: .82rem; color: var(--text);
  background: var(--white); outline: none; cursor: pointer;
  transition: border-color var(--trans);
}
.sucursal-selector select:focus { border-color: var(--indigo); }

/* ── Content ──────────────────────────────────────────────── */
.content {
  flex: 1; overflow-y: auto; padding: 1.5rem;
  display: flex; flex-direction: column; gap: 1.25rem;
}

/* ── Inspector Banner ─────────────────────────────────────── */
.inspector-banner {
  border-radius: var(--radius-md); padding: 1rem 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  font-size: .875rem;
}
.inspector-banner.alert {
  background: #FFF8F6; border: 1.5px solid rgba(255,107,74,.25);
  border-left: 4px solid var(--coral);
}
.inspector-banner.clean {
  background: var(--green-bg); border: 1.5px solid rgba(16,185,129,.2);
  border-left: 4px solid var(--green);
}
.inspector-banner .ib-icon { font-size: 1.1rem; flex-shrink: 0; }
.inspector-banner .ib-label {
  font-weight: 700; font-size: .78rem; letter-spacing: .5px;
  text-transform: uppercase; margin-right: .4rem;
}
.inspector-banner.alert .ib-label { color: var(--coral); }
.inspector-banner.clean .ib-label { color: var(--green); }
.inspector-banner .ib-text { color: var(--text-mid); flex: 1; }
.inspector-banner .ib-count {
  font-size: 1.4rem; font-weight: 800; color: var(--coral); line-height: 1;
}

/* ── Prescriptivo Banner ──────────────────────────────────── */
.prescriptivo-banner {
  background: linear-gradient(135deg, var(--indigo) 0%, var(--indigo-mid) 100%);
  border-radius: var(--radius-md); padding: 1rem 1.25rem;
  display: flex; align-items: flex-start; gap: 1rem; color: #fff;
}
.presc-icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: rgba(255,107,74,.2); display: flex; align-items: center; justify-content: center;
  color: var(--coral); flex-shrink: 0; margin-top: 2px;
}
.presc-body { flex: 1; }
.presc-label {
  font-size: .72rem; font-weight: 700; letter-spacing: .8px;
  text-transform: uppercase; color: rgba(255,255,255,.5); margin-bottom: .25rem;
}
.presc-text { font-size: .9rem; color: rgba(255,255,255,.9); line-height: 1.5; }
.presc-accion-principal {
  font-size: .92rem; color: #fff; line-height: 1.55;
  background: rgba(255,107,74,.15); border-left: 3px solid var(--coral);
  padding: .55rem .75rem; border-radius: 6px; margin-top: .25rem;
}
.presc-accion-principal strong { color: var(--coral); }
.presc-details { margin-top: .6rem; }
.presc-toggle {
  cursor: pointer; font-size: .78rem; font-weight: 600; letter-spacing: .4px;
  color: rgba(255,255,255,.6); list-style: none; user-select: none;
}
.presc-toggle:hover { color: rgba(255,255,255,.9); }
.presc-bullets {
  margin: .5rem 0 0 .5rem; padding-left: 1.2rem;
  color: rgba(255,255,255,.82); font-size: .85rem; line-height: 1.6;
}
.presc-bullets li { margin-bottom: .3rem; }
.presc-bullets strong { color: rgba(255,255,255,.95); }

/* ── Section info / empty state ────────────────────────────── */
.section-info {
  font-size: .83rem; color: var(--text-soft); line-height: 1.55;
  background: var(--surface-2); border-left: 3px solid var(--indigo-light);
  padding: .55rem .8rem; border-radius: 0 6px 6px 0;
}

/* ── KPI Grid ─────────────────────────────────────────────── */
.kpi-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(4, 1fr);
}
.kpi-grid-2 { grid-template-columns: repeat(2, 1fr); }
.kpi-grid-3 { grid-template-columns: repeat(3, 1fr); }

/* ── KPI Cards — patrón DOMOSA ───────────────────────────── */
.kpi-card {
  background: var(--card); border-radius: var(--radius-md);
  padding: 1.2rem 1.25rem 1.2rem 1.45rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  position: relative; overflow: hidden;
  transition: box-shadow var(--trans), transform var(--trans);
  cursor: default;
}
.kpi-card:hover { box-shadow: 0 12px 32px rgba(27,31,94,.13); transform: translateY(-3px); }
/* Barra vertical izquierda */
.kpi-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--indigo), var(--indigo-mid));
}
.kpi-card.accent-coral::before  { background: linear-gradient(180deg, var(--coral), #FF8A6E); }
.kpi-card.accent-green::before  { background: linear-gradient(180deg, var(--green), #34d399); }
.kpi-card.accent-amber::before  { background: linear-gradient(180deg, var(--amber), #fbbf24); }
.kpi-card.accent-red::before    { background: linear-gradient(180deg, var(--red), #f87171); }
.kpi-card.accent-blue::before   { background: linear-gradient(180deg, #3b82f6, #60a5fa); }
.kpi-card.accent-indigo::before { background: linear-gradient(180deg, var(--indigo), var(--indigo-mid)); }

.kpi-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: .65rem; gap: .5rem;
}
.kpi-label-text {
  font-size: .77rem; font-weight: 600; color: var(--text-soft);
  letter-spacing: .2px; line-height: 1.3;
}
.kpi-icon {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: .95rem;
}
.kpi-icon.i-indigo { background: var(--indigo-soft); }
.kpi-icon.i-coral  { background: var(--coral-light); }
.kpi-icon.i-green  { background: var(--green-bg); }
.kpi-icon.i-amber  { background: var(--amber-bg); }
.kpi-icon.i-red    { background: var(--red-bg); }

.kpi-value {
  font-size: 2.4rem; font-weight: 800; color: var(--indigo);
  letter-spacing: -1.5px; line-height: 1.05; margin-bottom: .35rem;
  white-space: nowrap;
}
/* El número usa el color semántico del acento de la card */
.kpi-card.accent-coral  .kpi-value { color: var(--coral); }
.kpi-card.accent-green  .kpi-value { color: var(--green); }
.kpi-card.accent-amber  .kpi-value { color: var(--amber); }
.kpi-card.accent-red    .kpi-value { color: var(--red); }
.kpi-card.accent-indigo .kpi-value { color: var(--indigo); }
.kpi-delta {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: .76rem; font-weight: 600; padding: .18rem .48rem;
  border-radius: 99px;
}
.kpi-delta.pos  { color: var(--green); background: var(--green-bg); }
.kpi-delta.neg  { color: var(--red);   background: var(--red-bg); }
.kpi-delta.neu  { color: var(--text-soft); background: var(--bg); }
.kpi-delta-text { font-size: .74rem; color: var(--text-soft); margin-top: .18rem; }
.kpi-note       { font-size: .71rem; color: var(--amber); font-weight: 500; margin-top: .18rem; }

/* ── Tooltip global (posicionado por JS, nunca se recorta) ── */
#bi-tooltip {
  position: fixed; z-index: 9999; pointer-events: none;
  max-width: 260px; background: var(--indigo); color: #fff;
  font-size: .73rem; line-height: 1.45; font-weight: 400;
  padding: .55rem .8rem; border-radius: 9px;
  box-shadow: 0 4px 18px rgba(27,31,94,.22);
  opacity: 0; transform: translateY(4px);
  transition: opacity .14s ease, transform .14s ease;
  white-space: normal;
}
#bi-tooltip.show { opacity: 1; transform: translateY(0); }
.tip-icon {
  cursor: help; color: var(--text-soft); display: inline-flex;
  align-items: center; flex-shrink: 0;
  transition: color var(--trans);
}
.tip-icon:hover { color: var(--indigo); }

/* ── Card genérica ────────────────────────────────────────── */
.card {
  background: var(--card); border-radius: var(--radius-md);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: .95rem; font-weight: 700; color: var(--indigo); display: flex;
  align-items: center; gap: .5rem;
}
.card-title-badge {
  font-size: .7rem; font-weight: 600; padding: .2rem .5rem;
  border-radius: 99px; background: var(--coral-light); color: var(--coral);
}
.card-actions { display: flex; gap: .5rem; }
.card-body { padding: 1.25rem; }
.card-body.no-pad { padding: 0; }

/* ── Chart container ──────────────────────────────────────── */
.chart-wrap { width: 100%; position: relative; }
.chart-plot { width: 100%; }

/* ── Tables ───────────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; }
table.data-table {
  width: 100%; border-collapse: collapse; font-size: .84rem;
}
table.data-table th {
  background: var(--bg); color: var(--text-mid); font-weight: 700;
  font-size: .75rem; letter-spacing: .3px; text-transform: uppercase;
  padding: .65rem 1rem; text-align: left; white-space: nowrap;
  border-bottom: 2px solid var(--border); position: sticky; top: 0;
  cursor: pointer; user-select: none;
}
table.data-table th:hover { color: var(--indigo); }
table.data-table td {
  padding: .6rem 1rem; border-bottom: 1px solid var(--border);
  color: var(--text); vertical-align: middle;
}
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr:hover td { background: #F5F6FC; }
table.data-table .num { text-align: right; font-feature-settings: 'tnum'; font-weight: 600; }
table.data-table .pos { color: var(--green); font-weight: 700; }
table.data-table .neg { color: var(--red);   font-weight: 700; }
table.data-table .tag {
  display: inline-flex; align-items: center;
  padding: .18rem .55rem; border-radius: 99px;
  font-size: .72rem; font-weight: 700; white-space: nowrap;
}
table.data-table .tag-red    { background: var(--red-bg);   color: var(--red); }
table.data-table .tag-green  { background: var(--green-bg); color: var(--green); }
table.data-table .tag-amber  { background: var(--amber-bg); color: var(--amber); }
table.data-table .tag-indigo { background: var(--indigo-soft); color: var(--indigo); }

/* ── Tabs ─────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 1.25rem; }
.tab-btn {
  padding: .65rem 1.1rem; font-size: .875rem; font-weight: 600;
  color: var(--text-soft); border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color var(--trans), border-color var(--trans); cursor: pointer;
}
.tab-btn:hover { color: var(--indigo); }
.tab-btn.active { color: var(--indigo); border-bottom-color: var(--coral); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Modal del panel de Administración (editor de usuario) */
.adm-modal-backdrop { position: fixed; inset: 0; z-index: 1200; background: rgba(15,18,50,.5);
  display: flex; align-items: flex-start; justify-content: center; padding: 4vh 1rem; overflow-y: auto; }
.adm-modal-card { width: min(1080px, 96vw); max-height: 92vh; overflow-y: auto; margin: auto;
  margin-top: 0 !important; box-shadow: 0 24px 70px rgba(10,12,40,.35); }
.adm-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; }
.adm-modal-x { background: none; border: none; font-size: 1.7rem; line-height: 1; cursor: pointer;
  color: var(--muted, #6B7280); padding: 0 .35rem; border-radius: 6px; }
.adm-modal-x:hover { background: var(--border, #eee); color: var(--indigo, #1B1F5E); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem .9rem; border-radius: var(--radius-sm);
  font-size: .82rem; font-weight: 600; transition: all var(--trans); cursor: pointer;
}
.btn-primary { background: var(--coral); color: #fff; border: none; box-shadow: 0 2px 8px rgba(255,107,74,.3); }
.btn-primary:hover { background: var(--coral-dark); box-shadow: 0 4px 14px rgba(255,107,74,.4); }
.btn-ghost { background: transparent; color: var(--text-mid); border: 1.5px solid var(--border); }
.btn-ghost:hover { border-color: var(--indigo); color: var(--indigo); background: var(--indigo-soft); }
.btn-sm { padding: .35rem .65rem; font-size: .78rem; }
.btn-icon { padding: .4rem; border-radius: var(--radius-sm); color: var(--text-soft); }
.btn-icon:hover { background: var(--bg); color: var(--indigo); }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: .2rem .55rem; border-radius: 99px;
  font-size: .72rem; font-weight: 700;
}
.badge-red    { background: var(--red-bg);   color: var(--red); }
.badge-green  { background: var(--green-bg); color: var(--green); }
.badge-amber  { background: var(--amber-bg); color: var(--amber); }
.badge-indigo { background: var(--indigo-soft); color: var(--indigo); }
.badge-coral  { background: var(--coral-light); color: var(--coral-dark); }

/* ── Progress bar ─────────────────────────────────────────── */
.progress-bar { height: 6px; border-radius: 99px; background: var(--border); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; background: var(--indigo); transition: width .6s ease; }
.progress-fill.coral { background: var(--coral); }
.progress-fill.green { background: var(--green); }
.progress-fill.amber { background: var(--amber); }
.progress-fill.red   { background: var(--red); }

/* ── Skeleton loader ──────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #E8EAF0 25%, #F2F4FA 50%, #E8EAF0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite; border-radius: var(--radius-sm);
}
@keyframes shimmer { 0%{ background-position:200% 0 } 100%{ background-position:-200% 0 } }
.sk-card  { height: 110px; border-radius: var(--radius-md); margin-bottom: .5rem; }
.sk-chart { height: 280px; border-radius: var(--radius-md); }
.sk-row   { height: 20px; margin-bottom: .5rem; }
.sk-row:last-child { width: 60%; }

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: .75rem; padding: 3rem;
  color: var(--text-soft); text-align: center;
}
.empty-state svg { opacity: .3; }
.empty-state p { font-size: .9rem; }

/* ── Toast ────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  display: flex; flex-direction: column; gap: .5rem; z-index: 9999;
}
.toast {
  background: var(--indigo); color: #fff;
  padding: .75rem 1.1rem; border-radius: var(--radius-md);
  font-size: .875rem; font-weight: 500; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: .6rem;
  animation: slide-in .25s ease;
  max-width: 340px;
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }
.toast.warning { background: var(--amber); color: var(--text); }
@keyframes slide-in { from{ transform:translateX(100%);opacity:0 } to{ transform:none;opacity:1 } }
@keyframes slide-out { from{ transform:none;opacity:1 } to{ transform:translateX(110%);opacity:0 } }

/* ── Pipeline log ─────────────────────────────────────────── */
.pipeline-log {
  background: #0F1120; border-radius: var(--radius-md);
  padding: 1rem 1.1rem; font-family: 'Courier New', monospace;
  font-size: .8rem; color: #A0F0A0; max-height: 220px;
  overflow-y: auto; line-height: 1.6;
}
.pipeline-log .log-err { color: #FF7070; }
.pipeline-log .log-warn { color: #FFD070; }

/* ── Sidebar overlay mobile ───────────────────────────────── */
.sb-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(13,15,40,.6); z-index: 199;
}

/* ── Section header ───────────────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.section-title {
  font-size: 1rem; font-weight: 700; color: var(--indigo);
  display: flex; align-items: center; gap: .5rem;
}
.section-sub { font-size: .8rem; color: var(--text-soft); margin-top: .15rem; }

/* ── Two-col grid ─────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

/* ── Collapsible ──────────────────────────────────────────── */
.collapsible-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 1.25rem; cursor: pointer; user-select: none;
  border-bottom: 1px solid transparent; transition: background var(--trans);
}
.collapsible-header:hover { background: var(--bg); }
.collapsible-header.open { border-bottom-color: var(--border); }
.collapsible-chevron { transition: transform var(--trans); color: var(--text-soft); }
.collapsible-header.open .collapsible-chevron { transform: rotate(180deg); }
.collapsible-body { display: none; padding: 1.25rem; }
.collapsible-body.open { display: block; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-3   { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
  :root { --sidebar-w: 230px; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sb-overlay.visible { display: block; }
  .menu-toggle { display: flex; }
  .login-brand { display: none; }
  .login-form-wrap { width: 100%; }
}

@media (max-width: 600px) {
  .content { padding: 1rem; gap: 1rem; }
  .topbar  { padding: 0 1rem; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .kpi-value { font-size: 1.4rem; }
  .card-header { padding: .85rem 1rem; }
  .card-body   { padding: 1rem; }
  .freshness-badge span { display: none; }
  .freshness-badge .dot { width: 9px; height: 9px; }
  table.data-table th,
  table.data-table td { padding: .55rem .75rem; }
}

/* ── Bottom nav (mobile only) ─────────────────────────────── */
@media (max-width: 600px) {
  #app { flex-direction: column; }
  .main { order: 1; }
  .bottom-nav {
    display: flex; height: 60px; background: var(--indigo-dark);
    border-top: 1px solid rgba(255,255,255,.08);
    justify-content: space-around; align-items: center; flex-shrink: 0;
  }
  .bnav-item {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    color: rgba(255,255,255,.45); font-size: .62rem; font-weight: 600;
    padding: 4px 8px; border-radius: var(--radius-sm); cursor: pointer;
    transition: color var(--trans);
  }
  .bnav-item.active, .bnav-item:hover { color: var(--coral); }
  .bnav-item svg { opacity: .7; }
  .bnav-item.active svg { opacity: 1; }
}
@media (min-width: 601px) {
  .bottom-nav { display: none; }
}

/* ============================================================
   BI 2.0 — Módulos reconstruidos (paridad Streamlit)
   ============================================================ */
.module-head { margin-bottom: 1.1rem; }
.module-head h2 {
  font-size: 1.3rem; font-weight: 800; color: var(--indigo);
  letter-spacing: -.4px; margin-bottom: .3rem;
}
.module-head p { font-size: .88rem; color: var(--text-mid); line-height: 1.5; max-width: 900px; }
.module-head .sub { font-size: .8rem; color: var(--text-soft); }

/* Tabs de sección (re-uso visual de .tabs) */
.section-tabs {
  display: flex; gap: 0; flex-wrap: wrap;
  border-bottom: 2px solid var(--border); margin: 1.25rem 0;
}

/* Descripción bajo subtítulo de tab */
.aud-desc { font-size: .86rem; color: var(--text-mid); line-height: 1.55; margin: .25rem 0 1rem; max-width: 900px; }

/* Caja de éxito (equivalente a st.success) */
.ok-box {
  background: var(--green-bg); border: 1px solid rgba(16,185,129,.25);
  border-left: 4px solid var(--green); color: #0f7a5a;
  padding: .9rem 1.1rem; border-radius: var(--radius-sm); font-size: .9rem; font-weight: 500;
}
/* Caja informativa (equivalente a st.info) */
.info-box {
  background: var(--indigo-soft); border-left: 4px solid var(--indigo);
  color: var(--text-mid); padding: .75rem 1rem; border-radius: var(--radius-sm);
  font-size: .84rem; margin-top: .9rem;
}
.warn-box {
  background: var(--amber-bg); border-left: 4px solid var(--amber);
  color: #92660a; padding: .75rem 1rem; border-radius: var(--radius-sm);
  font-size: .84rem; margin: .5rem 0;
}

/* Metric inline (equivalente a st.metric suelto) */
.metric-inline {
  display: inline-flex; flex-direction: column; gap: .15rem;
  background: var(--card); border: 1px solid var(--border);
  border-left: 4px solid var(--coral); border-radius: var(--radius-md);
  padding: .8rem 1.2rem; margin-bottom: 1rem; box-shadow: var(--shadow-sm);
}
.mi-label { font-size: .76rem; font-weight: 600; color: var(--text-soft); letter-spacing: .2px; }
.mi-value { font-size: 1.7rem; font-weight: 800; color: var(--coral); letter-spacing: -1px; line-height: 1.05; }

/* Truncado de texto largo en celdas */
.truncate {
  display: inline-block; max-width: 320px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom;
}

/* Badges/tags adicionales */
.badge-orange, table.data-table .tag-orange { background: #FFF3E8; color: #C2620F; }
.badge-grey,   table.data-table .tag-grey   { background: #EEF0F6; color: #6A6A86; }
.badge-yellow, table.data-table .tag-yellow { background: var(--amber-bg); color: #92660a; }
.badge-blue,   table.data-table .tag-blue   { background: #E8EEFF; color: #2952CC; }

/* Grid de gráficos */
.chart-grid { display: grid; gap: 1.2rem; }
.section-title { font-size: .95rem; font-weight: 700; color: var(--indigo); }

/* Barra inline en celda (Capital Inmovilizado — ProgressColumn de Streamlit) */
.bar-cell { position: relative; min-width: 120px; height: 20px; display: flex; align-items: center; }
.bar-cell .bar-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, var(--coral), #FF8A6E); border-radius: 4px; opacity: .25;
}
.bar-cell span { position: relative; z-index: 1; font-weight: 700; font-size: .8rem; padding-left: .3rem; }
.bar-cell .bar-green { background: linear-gradient(90deg, var(--green), #34d399); opacity:.3; }
.bar-cell .bar-amber { background: linear-gradient(90deg, var(--amber), #fbbf24); opacity:.3; }
.bar-cell .bar-red   { background: linear-gradient(90deg, var(--red), #f87171); opacity:.3; }

/* ── Prioridad (pills sólidos) + mini-barra de demanda — tabla de Rupturas ── */
.prio {
  display: inline-block; padding: .2rem .65rem; border-radius: 999px;
  font-size: .72rem; font-weight: 700; letter-spacing: .02em; white-space: nowrap;
}
.prio-alta  { background: var(--coral); color: #fff; }
.prio-media { background: var(--amber); color: #3d2c00; }
.prio-baja  { background: #C9CDDB; color: #3A3A52; }

.dem-val { font-weight: 600; font-size: .82rem; color: var(--text-strong, #1A1A2A); line-height: 1.1; }
.dem-bar {
  position: relative; height: 5px; width: 84px; margin-top: 4px;
  background: #ECEEF6; border-radius: 3px; overflow: hidden;
}
.dem-bar > i {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--indigo); border-radius: 3px; min-width: 3px;
}
.riesgo-val { color: var(--indigo); font-weight: 700; white-space: nowrap; }

/* Desglose físico de ubicaciones (dónde recoger en origen) */
.ubic-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .12rem .5rem; margin: .12rem .25rem .12rem 0;
  background: #EEF0F8; border: 1px solid #DDE0EF; border-radius: 6px;
  font-size: .74rem; color: #2A2A40; white-space: nowrap;
}
.ubic-chip > strong { color: var(--indigo); font-weight: 700; }
.ubic-chip b { color: var(--indigo); font-weight: 700; }
/* Orígenes de un agotado: una línea por sede con su zona/rack */
.ori-sede { padding: .1rem 0; line-height: 1.5; }
.ori-sede + .ori-sede { border-top: 1px dashed #E2E4F0; margin-top: .15rem; padding-top: .25rem; }
.ori-nom { font-weight: 700; color: var(--indigo); margin-right: .35rem; }
.ubic-rack {
  font-size: .66rem; color: #6A6A86; background: #fff;
  border: 1px solid #E2E4F0; border-radius: 4px; padding: 0 .28rem;
}
.muted { color: #9A9AAE; }
.ubic-warn {
  font-size: .72rem; color: #8a5a00; background: #FFF4DE;
  border: 1px solid #F0D9A8; border-radius: 6px; padding: .12rem .5rem;
  white-space: nowrap; cursor: help;
}
.cob-rup {
  font-size: .72rem; font-weight: 700; color: #fff; background: var(--coral, #FF6B4A);
  border-radius: 6px; padding: .12rem .5rem; white-space: nowrap;
}
.cob-bajo { font-weight: 700; color: #8a5a00; }

/* Badge de clase ABC (planes de compra/traslado) */
.abc { display: inline-block; min-width: 20px; text-align: center; padding: .1rem .3rem;
  border-radius: 5px; font-size: .72rem; font-weight: 700; }
.abc-a { background: #E6F0FF; color: #1B4F9E; }
.abc-b { background: #FFF4DE; color: #8a5a00; }
.abc-c { background: #EFEFF4; color: #6A6A86; }

/* Resolución de agotados: traslado (hay stock en red) vs comprar (red seca) */
.res-tras { display:inline-block; padding:.18rem .55rem; border-radius:6px; font-size:.76rem;
  font-weight:600; background:#E6F0FF; color:#1B4F9E; white-space:nowrap; }
.res-comp { display:inline-block; padding:.18rem .55rem; border-radius:6px; font-size:.76rem;
  font-weight:700; background:#FFE4E1; color:#a3341f; }
.res-part { display:inline-block; padding:.18rem .55rem; border-radius:6px; font-size:.76rem;
  font-weight:700; background:#FFF4DE; color:#8a5a00; white-space:nowrap; }
.res-recep { display:inline-block; padding:.18rem .55rem; border-radius:6px; font-size:.76rem;
  font-weight:700; background:#E3F5E9; color:#1f7a3f; white-space:nowrap; }
.cob-pct { color:var(--muted,#7a7f9a); font-size:.72rem; }
/* Puente Trasladar↔Liquidar (Marketing) */
.redis-alert {
  background:#E6F0FF; border:1px solid #C7DBFF; border-left:4px solid #1B4F9E;
  border-radius:8px; padding:.7rem .9rem; margin:.4rem 0 .8rem;
  color:#1a2a44; font-size:.86rem; line-height:1.45;
}
.redis-alert strong { color:#1B4F9E; }
.redis-alert .redis-sub { display:block; margin-top:.35rem; font-size:.78rem; color:#5a6072; }
.recep-alert {
  background:#FFF1EC; border:1px solid #FFD4C4; border-left:4px solid #FF6B4A;
  border-radius:8px; padding:.7rem .9rem; margin:.4rem 0 .8rem;
  color:#7a2e18; font-size:.86rem; line-height:1.45;
}
.recep-alert strong { color:#c2410c; }
.recep-alert .redis-sub { color:#7a2e18; }
/* Enlace que salta de un módulo a otro (O3) */
.link-jump { color:#1B4F9E; font-weight:700; cursor:pointer; border-bottom:1px dashed #1B4F9E; }
.link-jump:hover { color:#FF6B4A; border-bottom-color:#FF6B4A; }
/* ── Panel Admin ── */
.form-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:.9rem; margin:.6rem 0; }
.fld { display:flex; flex-direction:column; gap:.3rem; font-size:.8rem; font-weight:600; color:#4a4f6a; }
.fld input, .fld select { padding:.5rem .6rem; border:1px solid #DDE0EF; border-radius:7px; font-size:.9rem; font-weight:400; }
.perm-block { margin-top:1rem; }
.perm-tit { font-weight:700; color:var(--indigo,#1B1F5E); margin-bottom:.4rem; }
.perm-hint { font-weight:400; color:#8a8fa6; font-size:.78rem; }
.perm-cols { display:flex; flex-wrap:wrap; gap:.35rem 1.2rem; }
.perm-cols-3 { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:.8rem; }
.perm-grupo { background:#F7F8FC; border:1px solid #E9EBF5; border-radius:8px; padding:.5rem .7rem; }
.perm-grupo-tit { font-size:.72rem; font-weight:800; text-transform:uppercase; letter-spacing:.03em; color:#6a6f8a; margin-bottom:.35rem; }
.chk { display:flex; align-items:center; gap:.4rem; font-size:.83rem; font-weight:400; color:#3a3f5a; cursor:pointer; padding:.12rem 0; }
.chk input { width:15px; height:15px; accent-color:var(--coral,#FF6B4A); }
.matriz td, .matriz th { font-size:.78rem; }
.matriz .perm-name { text-align:left; font-weight:600; white-space:nowrap; }
.matriz th.rot { font-size:.72rem; white-space:nowrap; }
.row-off { opacity:.5; }
.cand-row { display:flex; justify-content:space-between; align-items:center; gap:1rem;
  padding:.6rem .8rem; border:1px solid #E9EBF5; border-radius:8px; margin-bottom:.5rem; background:#fff; }

/* Panel de configuración de presupuesto (scorecard) */
.ppto-card .card-header { display: flex; align-items: center; justify-content: space-between; }
.ppto-global { display: flex; gap: 1.2rem; flex-wrap: wrap; margin: .5rem 0 1rem; }
.ppto-global > div { display: flex; flex-direction: column; gap: .25rem; }
.ppto-global label, .ppto-suc-lbl { font-size: .8rem; font-weight: 600; color: var(--text-strong, #1A1A2A); }
.ppto-sub { font-size: .82rem; font-weight: 600; color: #4A4A66; margin: .3rem 0 .5rem; }
.ppto-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .7rem;
}
.ppto-suc { display: flex; flex-direction: column; gap: .3rem; padding: .5rem .6rem;
  background: #F7F8FC; border: 1px solid #E6E8F2; border-radius: 8px; }
.ppto-suc-lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ppto-card select, .ppto-card input[type=number] {
  padding: .38rem .55rem; border: 1px solid var(--border, #DDE0EF); border-radius: 7px;
  background: #fff; font-size: .82rem; color: #1A1A2A; width: 100%;
}
.ppto-card select:focus, .ppto-card input[type=number]:focus { outline: none; border-color: var(--indigo); }
.ppto-status { margin-top: .7rem; font-size: .8rem; color: #4A7A4A; min-height: 1rem; }
/* Tienda "en apertura": casilla y estados */
.ppto-suc-ap { display: flex; align-items: center; gap: .35rem; font-size: .74rem; font-weight: 600;
  color: #6B7280; cursor: pointer; margin-top: .1rem; }
.ppto-suc-ap input[type=checkbox] { width: auto; margin: 0; accent-color: var(--indigo, #1B1F5E); }
.ppto-suc-apertura { background: #ECEDF8; border-color: #C7CBF0; }
.ppto-suc-apertura .ppto-suc-lbl::after { content: " · en apertura"; font-weight: 500; color: #6B7280; font-size: .72rem; }
.ppto-apertura-hint { margin: .6rem 0 0; font-size: .8rem; color: #6B7280; display: flex; align-items: center; gap: .35rem; }
.ppto-apertura-note { background: #ECEDF8; border-left: 3px solid var(--indigo, #1B1F5E); border-radius: 8px;
  padding: .8rem 1rem; font-size: .88rem; line-height: 1.5; color: #2A2A40; }

/* Veredicto del scorecard (¿dónde enfocarse?) */
.sc-veredicto {
  background: #F4F6FC; border-left: 3px solid var(--indigo, #1B1F5E); border-radius: 8px;
  padding: .8rem 1rem; font-size: .92rem; line-height: 1.55; color: #2A2A40;
}
.sc-acciones { margin-top: .9rem; display: flex; flex-direction: column; gap: .5rem; }
.acc-item {
  display: flex; gap: .8rem; align-items: flex-start; padding: .6rem .8rem;
  border-radius: 8px; background: #FBFCFF; border: 1px solid #ECEEF6; border-left-width: 3px;
}
.acc-item.acc-exc, .acc-item.acc-ok { border-left-color: #27AE60; }
.acc-item.acc-warn { border-left-color: #F0B429; }
.acc-item.acc-bad  { border-left-color: #E74C3C; }
.acc-pill {
  flex-shrink: 0; padding: .2rem .55rem; border-radius: 999px;
  font-size: .72rem; font-weight: 700; white-space: nowrap; min-width: 78px; text-align: center;
}
.acc-pill.acc-exc, .acc-pill.acc-ok { background: #E6F4EA; color: #1E7E4A; }
.acc-pill.acc-warn { background: #FFF4DE; color: #8a5a00; }
.acc-pill.acc-bad  { background: #FDEAEA; color: #B4231F; }
.acc-title  { font-size: .92rem; font-weight: 600; color: #1A1A2A; }
.acc-action { font-size: .86rem; color: #3A3A52; margin-top: .18rem; line-height: 1.45; }
.acc-ok-txt { color: #1E7E4A; font-weight: 600; }

/* Controles del comparador de redistribución */
.cmp-controls {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  margin: .5rem 0 .25rem;
}
.cmp-label { font-size: .82rem; font-weight: 600; color: var(--text-strong, #1A1A2A); }
.cmp-select {
  padding: .4rem .7rem; border: 1px solid var(--border, #DDE0EF); border-radius: 8px;
  background: #fff; font-size: .85rem; color: #1A1A2A; min-width: 220px; cursor: pointer;
}
.cmp-select:focus { outline: none; border-color: var(--indigo); }

/* Ícono de ayuda en encabezados de tabla y títulos (tooltip) */
.th-help, .title-help {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 50%;
  background: #E2E4F0; color: #6A6A86;
  font-size: .68rem; font-weight: 700; line-height: 1;
  cursor: help; vertical-align: middle; margin-left: .25rem;
  transition: background .15s, color .15s;
}
.th-help:hover, .title-help:hover { background: var(--indigo); color: #fff; }

/* Encabezados de sección dentro de módulos */
.sc-h3 { font-size: 1.05rem; font-weight: 700; color: var(--indigo); margin: .5rem 0 .8rem; }

/* Guía y Metodología */
.guia-card {
  background: var(--white); border-left: 3px solid var(--coral);
  padding: .8rem 1.1rem; border-radius: 6px; margin-bottom: .7rem;
  color: var(--text); font-size: .9rem; box-shadow: var(--shadow-sm);
}
.guia-card strong { color: var(--indigo); }
.guia-tip { font-size: .8rem; color: var(--coral); }
.guia-exp {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: .6rem; overflow: hidden;
}
.guia-exp summary {
  padding: .8rem 1.1rem; cursor: pointer; font-size: .9rem; color: var(--text);
  user-select: none; list-style: none;
}
.guia-exp summary::-webkit-details-marker { display: none; }
.guia-exp summary::before { content: '▸ '; color: var(--coral); font-weight: 700; }
.guia-exp[open] summary::before { content: '▾ '; }
.guia-exp[open] summary { border-bottom: 1px solid var(--border); }
.guia-exp-body { padding: .9rem 1.2rem; font-size: .88rem; color: var(--text-mid); line-height: 1.55; }
.guia-qb { border-left: 3px solid var(--coral); padding-left: .8rem; color: var(--text); }
.guia-formula {
  font-size: .82rem; color: var(--text-soft); font-style: italic;
  background: var(--bg); padding: .5rem .7rem; border-radius: 6px; margin-top: .4rem;
}

/* Caja de mensaje generado (campañas, VIP, TikTok) */
.msg-box {
  background: var(--indigo-dark); color: #E8EAF6;
  font-family: 'Inter', monospace; font-size: .82rem; line-height: 1.5;
  padding: 1rem 1.2rem; border-radius: var(--radius-md); border-left: 4px solid var(--coral);
  white-space: pre-wrap; word-break: break-word; margin-top: .6rem; max-height: 420px; overflow-y: auto;
}

/* Selects de filtro (rentabilidad, etc.) */
.rent-select {
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: .4rem .7rem; font-size: .85rem; color: var(--text);
  background: var(--white); outline: none; cursor: pointer; min-width: 140px;
}
.rent-select:focus { border-color: var(--indigo); }

/* Slider (umbral DOH) */
.slider-row { display: flex; align-items: center; gap: 1rem; margin: .5rem 0 1.2rem; flex-wrap: wrap; }
.slider-row label { font-size: .84rem; font-weight: 600; color: var(--text-mid); }
.slider-row input[type=range] { flex: 1; min-width: 180px; accent-color: var(--coral); }
.slider-row .slider-val {
  font-weight: 800; color: var(--coral); font-size: 1rem;
  min-width: 64px; text-align: right;
}

/* Versión del sistema en el pie del sidebar — discreta, para soporte/diagnóstico */
.sb-version { text-align: center; font-size: .68rem; color: rgba(255,255,255,.38);
  letter-spacing: .3px; margin-top: .5rem; user-select: all; }

/* ── Novedades ("Qué cambió en el 2.0") ─────────────────────────── */
/* Badge compartido por modal y panel */
.nov-badge { display: inline-block; background: var(--coral-light); color: var(--coral-dark);
  font-size: .7rem; font-weight: 800; letter-spacing: .4px; text-transform: uppercase;
  padding: .28rem .7rem; border-radius: 99px; }

/* Modal de bienvenida (1 vez) */
.nov-modal-bd { position: fixed; inset: 0; z-index: 1300; background: rgba(15,18,50,.55);
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 1rem;
  overflow-y: auto; animation: nov-fade .18s ease; }
@keyframes nov-fade { from { opacity: 0; } to { opacity: 1; } }
.nov-modal-card { position: relative; width: min(560px, 96vw); background: var(--card);
  border-radius: var(--radius-lg); box-shadow: 0 24px 70px rgba(10,12,40,.4);
  padding: 2rem 1.9rem 1.6rem; margin: auto; border-top: 5px solid var(--coral);
  animation: nov-pop .22s cubic-bezier(.34,1.3,.5,1); }
@keyframes nov-pop { from { transform: translateY(14px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.nov-modal-x { position: absolute; top: .7rem; right: .8rem; background: none; border: none;
  font-size: 1.7rem; line-height: 1; cursor: pointer; color: var(--text-soft); padding: 0 .35rem;
  border-radius: 6px; }
.nov-modal-x:hover { background: var(--bg); color: var(--indigo); }
.nov-modal-card h2 { color: var(--indigo); font-size: 1.4rem; margin: .7rem 0 .5rem; line-height: 1.2; }
.nov-modal-intro { color: var(--text-mid); font-size: .9rem; line-height: 1.55; margin-bottom: 1rem; }
.nov-modal-list { list-style: none; padding: 0; margin: 0 0 1.3rem; display: flex; flex-direction: column; gap: .6rem; }
.nov-modal-list li { display: flex; gap: .6rem; align-items: flex-start; font-size: .86rem;
  color: var(--text-mid); line-height: 1.45; }
.nov-modal-list li strong { color: var(--text); }
.nov-li-ico { color: var(--coral); display: inline-flex; align-items: center; flex-shrink: 0; margin-top: 1px; }
.nov-li-ico svg { width: 18px; height: 18px; }
.nov-modal-actions { display: flex; justify-content: flex-end; gap: .6rem; flex-wrap: wrap; }

/* Panel permanente */
.nov-wrap { max-width: 1000px; margin: 0 auto; }
.nov-hero { background: var(--indigo); color: #fff; border-radius: var(--radius-lg);
  padding: 1.8rem 2rem; margin-bottom: 1.4rem; }
.nov-hero h1 { color: #fff; font-size: 1.6rem; margin: .7rem 0 .5rem; }
.nov-intro { color: rgba(255,255,255,.82); font-size: .95rem; line-height: 1.6; max-width: 68ch; margin: 0; }
.nov-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.nov-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 1.2rem 1.3rem; box-shadow: var(--shadow-sm); }
.nov-card-head { display: flex; align-items: center; gap: .55rem; margin-bottom: .5rem; }
.nov-card-head h3 { color: var(--indigo); font-size: 1.05rem; margin: 0; }
.nov-ico { color: var(--coral); display: inline-flex; align-items: center; }
.nov-ico svg { width: 22px; height: 22px; }
.nov-lead { color: var(--text); font-weight: 600; font-size: .9rem; line-height: 1.45; margin: 0 0 .9rem; }
.nov-cols { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-bottom: .8rem; align-items: start; }
@media (max-width: 560px) { .nov-cols { grid-template-columns: 1fr; } }
.nov-col { background: var(--bg); border-radius: var(--radius-sm); padding: .7rem .8rem; }
.nov-col-suma { background: var(--coral-light); }
.nov-tag { display: inline-block; font-size: .66rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .4px; color: var(--text-soft); margin-bottom: .35rem; }
.nov-tag-suma { color: var(--coral-dark); }
.nov-col p { margin: 0; font-size: .82rem; line-height: 1.5; color: var(--text-mid); }
.nov-ganas { margin: 0; font-size: .85rem; line-height: 1.5; color: var(--text);
  border-left: 3px solid var(--coral); padding-left: .7rem; }
.nov-ganas strong { color: var(--indigo); }
.nov-cierre { text-align: center; margin: 1.6rem auto 0; max-width: 70ch; }
.nov-cierre p { color: var(--text-mid); font-size: .92rem; line-height: 1.6; margin: 0 0 .5rem; }
.nov-firma { color: var(--coral); font-weight: 700; font-size: .9rem; letter-spacing: .3px; }
