:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --line: #dfe5ef;
  --text: #1f2937;
  --muted: #6b7280;
  --blue: #2457d6;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --teal: #0f766e;
  --violet: #7c3aed;
  --grey: #64748b;
  --soft: #f8fafc;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family:
    Inter,
    Segoe UI,
    Arial,
    sans-serif;
  background: var(--bg);
  color: var(--text);
}
.app {
  max-width: 1800px;
  margin: 0 auto;
  padding: 18px;
}
h1,
h2,
h3 {
  margin: 0;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.topbar small {
  color: var(--muted);
  display: block;
  margin-top: 6px;
}
.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── TopBar V2 — Gradient Premium ── */
/* ============================================================
   TOPBAR — final harmonization pass
   Navy refinado, menos peso visual, cohesión entre controles
   ============================================================ */
.topbar-v2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 13px 24px;
  /* navy más sofisticado: ligeramente más claro, gradiente más sutil */
  background: linear-gradient(135deg, #1b2742 0%, #1a2740 45%, #1e3358 100%);
  border: 1px solid rgba(212, 175, 55, 0.1);
  border-radius: 14px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 10px 28px -14px rgba(15, 23, 42, 0.45),
    0 2px 8px -2px rgba(15, 23, 42, 0.25);
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.topbar-brand h1 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  margin: 0;
  background: linear-gradient(135deg, #ecd281 0%, #d4af37 55%, #b8941f 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 1px 1px rgba(212, 175, 55, 0.18));
}
.topbar-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.topbar-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(212, 175, 55, 0.07);
  color: #e8c878;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  border: 1px solid rgba(212, 175, 55, 0.18);
  line-height: 1;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.topbar-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.045);
  border-radius: 10px;
  padding: 7px 13px;
  height: 34px;
  cursor: pointer;
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.005em;
  color: #d6dfeb;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease;
}
.topbar-action-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(212, 175, 55, 0.28);
  color: #f1e0a8;
}
.topbar-action-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.35);
}
.topbar-action-btn.accent {
  /* CTA: amarillo más noble, menos brillante, mejor integrado */
  background: linear-gradient(180deg, #d8b649 0%, #c19a26 100%);
  color: #1b2742;
  border: 1px solid rgba(255, 240, 200, 0.35);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35) inset,
    0 4px 12px -4px rgba(212, 175, 55, 0.3);
  font-weight: 750;
}
.topbar-action-btn.accent:hover {
  background: linear-gradient(180deg, #e3c25a 0%, #cfa530 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.4) inset,
    0 6px 16px -6px rgba(212, 175, 55, 0.4);
}
.topbar-action-btn.quiet {
  background: rgba(255, 255, 255, 0.025);
  border-color: rgba(255, 255, 255, 0.07);
  color: #b9c4d4;
  font-weight: 550;
}
.topbar-action-btn.quiet:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(212, 175, 55, 0.22);
  color: #e6dcb4;
}
.topbar-action-btn.ghost-danger {
  background: rgba(248, 113, 113, 0.04);
  color: #f3a5a5;
  border: 1px solid rgba(248, 113, 113, 0.22);
  font-weight: 650;
}
.topbar-action-btn.ghost-danger:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(248, 113, 113, 0.4);
  color: #fca5a5;
}
.topbar-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 220px;
  z-index: 120;
  background: linear-gradient(180deg, #1a1a2e, #16213e);
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  padding: 6px;
  animation: fadeInDown 0.12s ease;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: none;
  background: none;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #c8d6e5;
  text-align: left;
  transition: all 0.12s;
}
.dropdown-item:hover {
  background: rgba(212, 175, 55, 0.1);
  color: #f0d27a;
}
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Tabs V2 (legacy overrides — final styles below) ── */

/* ── Small note readability ── */
.small-note {
  font-size: 12.5px;
  color: #475569;
  margin-top: 4px;
  line-height: 1.4;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  border: 1px solid #cfd7e6;
  background: #fff;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
}
button.primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
button.success {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
button.warning {
  background: var(--amber);
  color: #fff;
  border-color: var(--amber);
}
button.danger {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 16px;
}
.panel h3 {
  margin-bottom: 12px;
  font-size: 16px;
}
.grid {
  display: grid;
  gap: 14px;
}
.g6 {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
}
.g5 {
  grid-template-columns: repeat(5, minmax(120px, 1fr));
}
.g4 {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
}
.g3 {
  grid-template-columns: repeat(3, minmax(120px, 1fr));
}
.g2 {
  grid-template-columns: 1.1fr 0.9fr;
}
label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}
input,
select,
textarea {
  width: 100%;
  border: 1px solid #cfd7e6;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
}
textarea {
  min-height: 78px;
  resize: vertical;
}
.kpis {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}
.kpi .label {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
  font-weight: 700;
}
.kpi .value {
  font-size: 20px;
  font-weight: 800;
}
.kpi .sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1850px;
  background: #fff;
}
th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid #e8edf5;
  vertical-align: top;
}
thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fbff;
  color: #475569;
  font-size: 12px;
  text-align: left;
}
td.right,
th.right {
  text-align: right;
}
.section-row td {
  background: #eef4ff;
  font-weight: 800;
  font-size: 14px;
  color: #0f172a;
}
.subtotal td {
  background: #f8fafc;
  font-weight: 800;
}
.muted {
  color: var(--muted);
}
.mini {
  font-size: 11px;
  color: var(--muted);
}
.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
  border: 1px solid transparent;
  white-space: nowrap;
}
.st-pendiente {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}
.st-parcial {
  background: #ffedd5;
  color: #9a3412;
  border-color: #fed7aa;
}
.st-cumplido {
  background: #dcfce7;
  color: #166534;
  border-color: #bbf7d0;
}
.st-rolled {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #bfdbfe;
}
.st-nf {
  background: #ccfbf1;
  color: #115e59;
  border-color: #99f6e4;
}
.st-cancelado {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
}
.st-reprogramado {
  background: #ede9fe;
  color: #6d28d9;
  border-color: #ddd6fe;
}
.st-review {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}
.delay1 {
  color: var(--amber);
  font-weight: 800;
}
.delay2 {
  color: var(--red);
  font-weight: 800;
}
.cell-f {
  font-weight: 800;
  color: #0f172a;
}
.cell-r {
  font-size: 11px;
  color: var(--green);
  margin-top: 2px;
}
.cell-d {
  font-size: 11px;
  margin-top: 2px;
  font-weight: 700;
}
.pos {
  color: var(--green);
}
.neg {
  color: var(--red);
}
.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.side-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 900px;
  overflow: auto;
}
.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fff;
}
.card strong {
  font-size: 13px;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.actions button {
  padding: 7px 10px;
  min-width: 0;
  border-radius: 10px;
  font-size: 12px;
}
.two-col {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 16px;
}
.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 8px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 11px;
  font-weight: 700;
}
@media (max-width: 1280px) {
  .g6,
  .g5,
  .g4,
  .g3,
  .kpis,
  .two-col,
  .g2 {
    grid-template-columns: 1fr;
  }
}

.validations-dashboard {
  margin-bottom: 16px;
}
.validation-kpis {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.validation-kpi {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: linear-gradient(180deg, #fff, #f8fafc);
}
.validation-kpi .label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 700;
}
.validation-kpi .value {
  font-size: 24px;
  font-weight: 900;
}
.validation-kpi .sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}
.validation-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.summary-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
}
.validation-filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.checkbox-cell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}
.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}
.checkbox-inline input {
  width: auto;
}
.validation-main-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
}
.validation-detail-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 14px;
  min-height: 420px;
}
.detail-empty {
  color: var(--muted);
  font-size: 14px;
}
.validation-status-badge,
.validation-severity-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
  border: 1px solid transparent;
}
.val-status-error {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}
.val-status-warning {
  background: #ffedd5;
  color: #9a3412;
  border-color: #fed7aa;
}
.val-status-ok {
  background: #dcfce7;
  color: #166534;
  border-color: #bbf7d0;
}
.val-sev-blocking {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}
.val-sev-warning {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}
.val-sev-info {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #bfdbfe;
}
.validation-row-clickable {
  cursor: pointer;
}
.validation-row-clickable:hover {
  background: #f8fbff;
}
.validation-detail-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  align-items: flex-start;
}
.validation-detail-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 10px;
  background: #fbfdff;
}
.validation-error-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.validation-error-chip {
  display: inline-block;
  padding: 5px 8px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #374151;
  font-size: 12px;
  font-weight: 700;
}
.validation-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.small-note {
  font-size: 12.5px;
  color: #475569;
  margin-top: 4px;
  line-height: 1.4;
}
.highlight-row {
  outline: 2px solid #2563eb;
  background: #eff6ff !important;
}
.line-editor-create #saveBtn {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.line-editor-edit #saveBtn {
  background: var(--amber);
  color: #fff;
  border-color: var(--amber);
}
.line-editor-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
#lineEditorPanel input:placeholder-shown {
  opacity: 0.9;
}
#fWeek[disabled],
#fForecastEUR[disabled] {
  background: #eef2f7;
  color: #475569;
  cursor: not-allowed;
  opacity: 1;
  font-weight: 800;
}
.derived-field-note {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}

.tabs-shell {
  margin: 4px 0 16px 0;
}
.segmented-tabs {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  background: linear-gradient(180deg, #fbfcfe 0%, #f3f6fb 100%);
  border: 1px solid #d8dfeb;
  border-radius: 13px;
  padding: 4px;
  flex-wrap: wrap;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.85) inset,
    0 1px 1px rgba(15, 23, 42, 0.03),
    0 6px 18px -14px rgba(15, 23, 42, 0.16);
}
.tab-btn {
  position: relative;
  border: 1px solid transparent;
  background: transparent;
  color: #506074;
  border-radius: 9px;
  padding: 9px 22px 10px;
  min-width: 122px;
  font-size: 12.75px;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.2;
  cursor: pointer;
  transition:
    color 0.18s ease,
    background-color 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}
.tab-btn:hover:not(.active) {
  color: #1e293b;
  background: rgba(226, 232, 240, 0.42);
}
.tab-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.28);
}
.tab-btn.active {
  background: #ffffff;
  color: #0a1020;
  border-color: #c9d3e3;
  font-weight: 670;
  letter-spacing: -0.008em;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 1) inset,
    0 1px 1.5px rgba(15, 23, 42, 0.05),
    0 6px 14px -10px rgba(15, 23, 42, 0.16);
}
.tab-btn.active::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 3px;
  width: 20px;
  height: 1.5px;
  border-radius: 2px;
  background: linear-gradient(
    90deg,
    rgba(30, 64, 175, 0) 0%,
    #1e40af 20%,
    #2563eb 50%,
    #1e40af 80%,
    rgba(30, 64, 175, 0) 100%
  );
  opacity: 1;
}
.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
}
.scenario-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.scenario-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}
.scenario-card .label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 8px;
}
.scenario-card .value {
  font-size: 18px;
  font-weight: 800;
}
.scenario-card .sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.dashboard-premium {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.hero-premium {
  position: relative;
  overflow: hidden;
  border: 1px solid #d8e3f4;
  border-radius: 24px;
  padding: 22px;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 58%, #eff6ff 160%);
  color: #fff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
}
.hero-premium:before {
  content: "";
  position: absolute;
  right: -80px;
  top: -60px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.18),
    rgba(255, 255, 255, 0)
  );
  pointer-events: none;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
  position: relative;
  z-index: 1;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.hero-title {
  font-size: 30px;
  font-weight: 900;
  line-height: 1.05;
  margin-bottom: 8px;
}
.hero-subtitle {
  font-size: 14px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.82);
  max-width: 720px;
}
.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.hero-metric {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(10px);
}
.hero-metric .label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 700;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.hero-metric .value {
  font-size: 22px;
  font-weight: 900;
}
.hero-metric .sub {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
  margin-top: 4px;
}
.hero-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  justify-content: space-between;
}
.hero-chip-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px;
}
.hero-chip {
  padding: 14px 15px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.hero-chip .label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.66);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.hero-chip .value {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.hero-actions button {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.hero-actions button.warning {
  background: #d97706;
  color: #fff;
  border-color: #d97706;
}
.dashboard-strip {
  display: grid;
  grid-template-columns: 1.35fr 0.95fr;
  gap: 16px;
}
.soft-panel {
  background: linear-gradient(180deg, #fff, #fbfdff);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  box-shadow: 0 8px 26px rgba(148, 163, 184, 0.1);
}
.soft-panel h3 {
  margin-bottom: 6px;
  font-size: 17px;
}
.panel-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 14px;
}
.pulse-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
}
.pulse-card {
  padding: 14px;
  border-radius: 18px;
  background: #f8fbff;
  border: 1px solid #e3ebf7;
}
.pulse-card .label {
  font-size: 11px;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 8px;
}
.pulse-card .value {
  font-size: 22px;
  font-weight: 900;
  color: #0f172a;
}
.pulse-card .sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}
.pulse-card .trend.pos {
  color: var(--green);
}
.pulse-card .trend.neg {
  color: var(--red);
}
.insight-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.insight-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #f8fbff;
  border: 1px solid #e5edf8;
}
.insight-item .left strong {
  display: block;
  margin-bottom: 3px;
  font-size: 14px;
}
.insight-item .left span {
  font-size: 12px;
  color: var(--muted);
}
.insight-item .right {
  font-weight: 900;
  white-space: nowrap;
  align-self: center;
}
.premium-kpis .kpi {
  border: none;
  box-shadow: 0 10px 28px rgba(148, 163, 184, 0.12);
  border-radius: 20px;
  padding: 16px;
  background: linear-gradient(180deg, #fff, #fbfdff);
}
.premium-kpis .kpi .value {
  font-size: 24px;
}
.dashboard-grid-premium {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.85fr);
  gap: 16px;
  align-items: start;
}
.matrix-panel .toolbar {
  margin-bottom: 14px;
  align-items: flex-start;
}
.matrix-panel .toolbar h3 {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}
.matrix-title-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}
.matrix-header {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 14px;
  align-items: stretch;
}
.matrix-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
}
.matrix-header .matrix-title {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: #0f172a;
  margin: 0 0 4px 0;
  padding-right: 4px;
  flex: 0 0 auto;
}
.matrix-header .matrix-meta {
  flex-direction: row;
  flex-wrap: wrap;
  margin-bottom: 0;
  gap: 8px 10px;
  align-items: center;
  flex: 1 1 auto;
}
.matrix-header .matrix-meta-row {
  gap: 8px 10px;
}
.matrix-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
  justify-content: flex-start;
}
.matrix-actions .context-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  background: #f8fbff;
  border: 1px solid #dce7f5;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}
.matrix-actions .context-chip .k {
  color: #64748b;
  font-weight: 800;
}
.matrix-panel .table-wrap {
  border: 1px solid #e6edf7;
  border-radius: 20px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  max-height: none;
  overflow: visible;
}
.matrix-panel table {
  min-width: 1720px;
}
.matrix-panel thead th {
  background: #f6f9fd;
  border-bottom: 1px solid #e5edf7;
}
.matrix-panel tbody tr:hover td {
  background: #fafcff;
}
.matrix-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
  align-items: flex-start;
}
.matrix-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
}
.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  background: #f8fbff;
  border: 1px solid #dce7f5;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}
.matrix-meta .context-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  background: #f8fbff;
  border: 1px solid #dce7f5;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}
.matrix-meta .context-chip .k {
  color: #64748b;
  font-weight: 800;
}
.side-panel-premium {
  position: sticky;
  top: 16px;
}
.issues-headline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.issues-counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 900;
}
.side-list.compact .card {
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 8px 22px rgba(148, 163, 184, 0.08);
}
.side-list.compact .card strong {
  font-size: 14px;
}
@media (max-width: 1280px) {
  .hero-grid,
  .dashboard-strip,
  .dashboard-grid-premium,
  .pulse-grid,
  .hero-metrics,
  .hero-chip-grid {
    grid-template-columns: 1fr;
  }
  .side-panel-premium {
    position: static;
  }
}

.dashboard-v5 .soft-panel {
  border-radius: 22px;
}
.executive-control-panel {
  padding-bottom: 12px;
}
.executive-control-panel > .toolbar > div > h3 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: #64748b;
  text-transform: uppercase;
}
.executive-filters-grid {
  grid-template-columns: 1fr 1fr 1fr 1fr 1fr 0.9fr;
  display: none;
}
.meta-pill.editable {
  cursor: pointer;
  user-select: none;
  transition:
    transform 0.14s ease,
    box-shadow 0.14s ease,
    background 0.14s ease,
    border-color 0.14s ease;
}
.meta-pill.editable:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(148, 163, 184, 0.14);
  background: linear-gradient(180deg, #eef4ff 0%, #dbeafe 100%);
  border-color: #bfdbfe;
  color: #1d4ed8;
}
.meta-pill.editable:active {
  transform: scale(0.98);
}
.meta-pill.editable.open {
  background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
  border-color: #93c5fd;
  color: #1d4ed8;
}
.meta-pill.editable::after {
  content: "▾";
  margin-left: 6px;
  font-size: 11px;
  opacity: 0.72;
}
.meta-pill.editable.is-date::after {
  content: "📅";
  font-size: 12px;
  opacity: 0.9;
}
.meta-pill.primary-action {
  border: none;
  background: linear-gradient(180deg, #2f63db 0%, #2457d6 100%);
  color: #fff;
  box-shadow: 0 10px 20px rgba(36, 87, 214, 0.18);
  padding-inline: 14px;
  cursor: pointer;
}
.meta-pill.primary-action:hover {
  background: linear-gradient(180deg, #2457d6 0%, #1e4ec6 100%);
  color: #fff;
}
.chip-popover {
  position: fixed;
  z-index: 100000;
  min-width: 220px;
  max-width: 320px;
  background: #fff;
  border: 1px solid #dce7f5;
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  padding: 8px;
  display: none;
}
.chip-popover.show {
  display: block;
}
.chip-popover-head {
  font-size: 12px;
  font-weight: 800;
  color: #64748b;
  padding: 6px 8px 8px 8px;
  border-bottom: 1px solid #eef2f7;
  margin-bottom: 6px;
}
.chip-popover-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 280px;
  overflow: auto;
}
.chip-popover-item {
  border: none;
  background: #fff;
  text-align: left;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 700;
  color: #1f2937;
  cursor: pointer;
  width: 100%;
}
.chip-popover-item:hover {
  background: #eef4ff;
  color: #1d4ed8;
}
.chip-popover-item.active {
  background: #dbeafe;
  color: #1d4ed8;
}
.chip-popover-date {
  width: 100%;
  border: 1px solid #cfd7e6;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
}
.chip-popover-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}
.executive-summary-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 14px;
  max-width: 760px;
}
.waterfall-chart-panel {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 18px 12px 10px;
  margin-top: 16px;
  overflow: hidden;
  position: relative;
}
.waterfall-chart-panel canvas {
  width: 100%;
  display: block;
}
.waterfall-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin: 2px 4px 12px;
}
.waterfall-panel-header .bridge-headline-title {
  margin: 0;
}
.waterfall-mode-toolbar {
  flex: 0 0 auto;
  z-index: 2;
}
.board-mode-toggle {
  font:
    600 10px/1 -apple-system,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s ease;
}
.board-mode-toggle:hover {
  border-color: #9ca3af;
  color: #111827;
}
.board-mode-toggle[data-active="true"] {
  background: #111827;
  color: #fff;
  border-color: #111827;
}
.waterfall-chart-panel.board-mode {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 0;
  box-shadow: none;
}
.executive-summary-card {
  background: linear-gradient(180deg, #fff, #f8fafc);
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 14px;
}
.executive-summary-card .label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 8px;
}
.executive-summary-card .value {
  font-size: 22px;
  font-weight: 900;
}
.executive-summary-card .value.neg {
  color: #b42318;
}
.executive-summary-card .sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}
.executive-summary-card.cash-risk-card .value {
  letter-spacing: 0.5px;
}
.executive-summary-card.cash-risk-card.risk-low {
  background: linear-gradient(180deg, #f6fdf8, #ecfdf3);
  border-color: #c7ead4;
}
.executive-summary-card.cash-risk-card.risk-low .value {
  color: #15803d;
}
.executive-summary-card.cash-risk-card.risk-medium {
  background: linear-gradient(180deg, #fafafa, #f1f5f9);
  border-color: #d4d4d8;
}
.executive-summary-card.cash-risk-card.risk-medium .value {
  color: #4b5563;
}
.executive-summary-card.cash-risk-card.risk-high {
  background: linear-gradient(180deg, #fffaf0, #fef3c7);
  border-color: #fde68a;
}
.executive-summary-card.cash-risk-card.risk-high .value {
  color: #b45309;
}
.executive-summary-card.cash-risk-card.risk-critical {
  background: linear-gradient(180deg, #fff5f5, #fee2e2);
  border-color: #fecaca;
}
.executive-summary-card.cash-risk-card.risk-critical .value {
  color: #b42318;
}
.executive-dashboard-grid {
  grid-template-columns: 1.45fr 0.55fr;
}
.executive-table-wrap {
  border: 1px solid #e4ebf5;
  border-radius: 18px;
  overflow: visible;
}
.executive-matrix-table {
  min-width: 1600px;
  border-collapse: separate;
  border-spacing: 0;
}
.executive-matrix-table thead th {
  background: #f8fbff;
  color: #607086;
  font-size: 12px;
  font-weight: 800;
  border-bottom: 1px solid #e5edf7;
  position: sticky;
  top: 0;
  z-index: 2;
}
.executive-matrix-table th,
.executive-matrix-table td {
  padding: 10px 10px;
  border-bottom: 1px solid #edf2f7;
  vertical-align: middle;
}
.executive-matrix-table .concept-col {
  min-width: 300px;
}
.executive-matrix-table .week-head {
  min-width: 96px;
  text-align: center;
}
.executive-matrix-table .week-head .wk1 {
  font-size: 12px;
  font-weight: 900;
  color: #64748b;
}
.executive-matrix-table .week-head .wk2,
.executive-matrix-table .week-head .wk3 {
  font-size: 11px;
  color: #94a3b8;
}
.executive-matrix-table .total-head {
  min-width: 110px;
  text-align: center;
  vertical-align: middle;
}
.executive-matrix-table .total-head .wk1 {
  font-size: 12px;
  font-weight: 900;
  color: #64748b;
}
.executive-matrix-table .total-head .wk2 {
  font-size: 11px;
  color: #94a3b8;
}
.exec-row-level1 td {
  background: #eef3f8;
  font-weight: 900;
  color: #0f172a;
}
.exec-row-level2 td {
  background: #fff;
  font-weight: 700;
}
.exec-row-level3 td {
  background: #fbfcfe;
}
.exec-row-level3 td.is-clickable {
  cursor: pointer;
}
.exec-row-level3 td.is-clickable:hover {
  background: #eff6ff;
}
.exec-label {
  display: flex;
  align-items: center;
  gap: 10px;
}
.exec-indent-1 {
  padding-left: 6px;
}
.exec-indent-2 {
  padding-left: 28px;
}
.exec-indent-3 {
  padding-left: 52px;
}
.exec-toggle {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  border: 1px solid #d7dfeb;
  background: #fff;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #475569;
}
.exec-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 11px;
  font-weight: 800;
}
.exec-amount {
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}
.exec-amount.neg {
  color: #b42318;
}
.exec-amount.pos {
  color: #0f172a;
}
.executive-side-summary {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}
.executive-side-summary .summary-box {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(180deg, #fff, #fbfdff);
}
.executive-side-summary .summary-box strong {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
}
.scenario-v5-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 14px;
}
.scenario-v5-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
}
.scenario-badge {
  display: inline-flex;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 14px;
}
.scenario-badge.base {
  background: #e0e7ff;
  color: #1e3a8a;
}
.scenario-badge.opt {
  background: #dcfce7;
  color: #166534;
}
.scenario-badge.pes {
  background: #fee2e2;
  color: #991b1b;
}

.exec-name-l1 {
  font-size: 15px;
  font-weight: 900;
  line-height: 1.15;
}
.exec-name-l2 {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.15;
}
.exec-name-l3 {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.2;
  color: #334155;
}
.exec-row-level1 .exec-amount {
  font-size: 15px;
  font-weight: 900;
}
.exec-row-level2 .exec-amount {
  font-size: 14px;
  font-weight: 800;
}
.exec-row-level3 .exec-amount {
  font-size: 13px;
  font-weight: 400;
}
.exec-row-level3 td.is-clickable .exec-amount {
  text-decoration: underline;
  text-decoration-color: #2457d6;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}
.exec-row-level3 td.is-clickable:hover .exec-amount {
  color: #1d4ed8;
}

.exec-row-subtotal td {
  background: #f3f1eb;
  font-weight: 900;
  color: #0f172a;
  border-top: 2px solid #1f2937;
  border-bottom: 2px solid #1f2937;
}
.exec-row-subtotal .exec-name-l1 {
  font-size: 13px;
  font-weight: 900;
  line-height: 1.15;
}
.exec-row-subtotal .exec-amount {
  font-size: 13px;
  font-weight: 900;
}

.executive-table-wrap {
  overflow: visible !important;
  max-height: none !important;
}
.matrix-panel .table-wrap {
  max-height: none !important;
  overflow: visible !important;
}
.executive-matrix-table {
  overflow: visible !important;
}
.matrix-panel {
  overflow: visible !important;
}

/* Freeze week header more clearly */
.executive-matrix-table thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 8;
  background: #f8fbff;
  box-shadow: 0 1px 0 #d9e4f2;
}
.executive-matrix-table thead th.pbi-col-hover {
  background: #eaf2fb !important;
}

/* Cross hover */
.executive-matrix-table tr.pbi-row-hover td {
  background: #f3f7fd !important;
}
.executive-matrix-table tr.exec-row-subtotal.pbi-row-hover td {
  background: #ebe7dd !important;
}
.executive-matrix-table tr.exec-row-cash.pbi-row-hover td {
  background: #e7d1d1 !important;
}
.executive-matrix-table td.pbi-col-hover {
  background: #eef4fb !important;
}
.executive-matrix-table tr.exec-row-subtotal td.pbi-col-hover {
  background: #e7e1d3 !important;
}
.executive-matrix-table tr.exec-row-cash td.pbi-col-hover {
  background: #e2caca !important;
}

/* CFO tooltip */
.pbi-tooltip {
  position: fixed;
  z-index: 99999;
  pointer-events: none;
  min-width: 220px;
  max-width: 360px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.96);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.28);
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 0.12s ease,
    transform 0.12s ease;
  font-size: 12px;
  line-height: 1.35;
}
.pbi-tooltip.show {
  opacity: 1;
  transform: translateY(0);
}
.pbi-tooltip .tt-title {
  font-size: 13px;
  font-weight: 900;
  margin-bottom: 4px;
  color: #fff;
}
.pbi-tooltip .tt-sub {
  color: #cbd5e1;
  margin-bottom: 6px;
}

/* Unified floating weeks header: same language as frozen column */
.exec-floating-header {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 55;
  display: block;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition:
    opacity 0.16s ease,
    transform 0.16s ease,
    visibility 0.16s ease;
  pointer-events: none;
  background: #f8fbff;
  border: 1px solid #d9e4f2;
  border-top: none;
  border-radius: 0 0 14px 14px;
  box-shadow:
    0 8px 24px rgba(148, 163, 184, 0.14),
    0 1px 0 #d9e4f2 inset;
  overflow: hidden;
  backdrop-filter: saturate(1.02);
}
.exec-floating-header.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.exec-floating-header table {
  border-collapse: separate;
  border-spacing: 0;
  width: auto;
  min-width: 0;
  margin: 0;
  background: #f8fbff;
  transform: translateX(0);
  will-change: transform;
}
.exec-floating-header th {
  background: #f8fbff !important;
  color: #607086;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  border-bottom: 1px solid #e5edf7;
  padding: 10px 10px;
  white-space: nowrap;
  vertical-align: middle;
  box-shadow: inset 0 -1px 0 #e5edf7;
}

.pbi-tooltip .tt-value {
  font-size: 16px;
  font-weight: 900;
  color: #fff;
}

.btn-row,
.tabs-shell,
.global-context-shell,
.panel {
  position: relative;
  z-index: 20;
}
.executive-table-wrap,
.matrix-panel .table-wrap,
.matrix-panel {
  position: relative;
  isolation: isolate;
}

.exec-row-cash td {
  background: #efdada !important;
  border-top: 2px solid #1f2937;
  border-bottom: 2px solid #1f2937;
  font-weight: 900;
}

.meta-pill.is-button {
  cursor: pointer;
  border: none;
  background: linear-gradient(180deg, #ffffff 0%, #eef4ff 100%);
}
.meta-pill.is-button:hover {
  background: linear-gradient(180deg, #eef4ff 0%, #e0ecff 100%);
}
.matrix-context-bar,
.validation-context-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px 0;
  align-items: center;
}
.context-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 11px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff 0%, #f3f7ff 100%);
  border: 1px solid #dce7f5;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(148, 163, 184, 0.08);
}
.context-chip .k {
  color: #64748b;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.context-chip.is-accent {
  background: linear-gradient(180deg, #eef4ff 0%, #dbeafe 100%);
  color: #1d4ed8;
  border-color: #bfdbfe;
}
.context-chip.is-warn {
  background: linear-gradient(180deg, #fff7ed 0%, #ffedd5 100%);
  color: #9a3412;
  border-color: #fed7aa;
}
.context-chip.is-success {
  background: linear-gradient(180deg, #ecfdf5 0%, #dcfce7 100%);
  color: #166534;
  border-color: #bbf7d0;
}

.global-context-shell {
  margin: 0 0 16px 0;
  padding: 10px 12px;
  border: 1px solid #dce7f5;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 8px 22px rgba(148, 163, 184, 0.08);
}
.global-context-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.global-context-shell {
  display: none !important;
}
.global-context-shell.is-empty {
  display: none;
}

.import-assistant-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 24px;
  backdrop-filter: blur(4px);
}
.import-assistant-modal {
  width: min(980px, 96vw);
  max-height: 90vh;
  overflow: auto;
  border-radius: 24px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid #dbe7f6;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.22);
  padding: 22px;
}
.import-assistant-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.import-assistant-title {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #0f172a;
  margin-bottom: 6px;
}
.import-assistant-sub {
  font-size: 14px;
  color: #64748b;
}
.import-assistant-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
  margin: 14px 0 18px 0;
}
.import-assistant-kpi {
  border: 1px solid #dbe7f6;
  border-radius: 18px;
  padding: 14px;
  background: linear-gradient(180deg, #fff, #f8fbff);
}
.import-assistant-kpi .k {
  font-size: 11px;
  color: #64748b;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 8px;
}
.import-assistant-kpi .v {
  font-size: 28px;
  font-weight: 900;
  color: #0f172a;
}
.import-assistant-kpi .s {
  font-size: 12px;
  color: #64748b;
  margin-top: 6px;
}
.import-assistant-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.import-assistant-card {
  border: 1px solid #dbe7f6;
  border-radius: 18px;
  padding: 14px;
  background: #fff;
}
.import-assistant-card h4 {
  margin: 0 0 10px 0;
  font-size: 15px;
}
.import-assistant-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.import-assistant-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #edf2f7;
  border-radius: 12px;
  background: #fbfdff;
  font-size: 13px;
}
.import-assistant-hint {
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #374151;
}
.import-assistant-hint.warn {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}
.import-assistant-hint.bad {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}
.import-assistant-hint.good {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #166534;
}
.import-assistant-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.import-assistant-actions button {
  min-height: 44px;
  border-radius: 14px;
  font-weight: 900;
}
@media (max-width: 980px) {
  .import-assistant-grid,
  .import-assistant-sections {
    grid-template-columns: 1fr;
  }
}

.global-context-bar .context-chip {
  box-shadow: none;
}

.opening-balances-kpi-panel {
  display: none;
}
.ob-card-with-breakdown {
  position: relative;
  min-width: 220px;
  overflow: visible;
  z-index: 10;
}
.ob-grid-breakdown {
  grid-column: 1/-1;
  grid-row: auto;
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: none;
  align-self: start;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  animation: obSlideDown 0.2s ease;
  overflow-x: auto;
  overflow-y: visible;
  box-sizing: border-box;
}
.ob-inline-toggle {
  background: none;
  border: none;
  padding: 2px 0;
  font-size: 11px;
  cursor: pointer;
  color: var(--blue, #2563eb);
  font-weight: 500;
  margin-top: 4px;
  display: inline-block;
}
.ob-inline-toggle:hover {
  text-decoration: underline;
}
.ob-inline-toggle.open {
  color: var(--blue, #2563eb);
}
.ob-col-company {
  width: 19%;
}
.ob-col-bank {
  width: 14%;
}
.ob-col-account {
  width: 16%;
}
.ob-col-currency {
  width: 8%;
}
.ob-col-balance {
  width: 21%;
}
.ob-col-equivalent {
  width: 22%;
}
@keyframes obSlideDown {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.ob-breakdown-table-compact {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  table-layout: fixed;
  min-width: 0;
}
.ob-breakdown-table-compact tfoot tr td {
  background: #fff;
  padding: 6px 4px;
  border-bottom: none;
}
.ob-breakdown-table-compact th,
.ob-breakdown-table-compact td {
  overflow: hidden;
  text-overflow: ellipsis;
}
.ob-breakdown-table-compact th {
  position: static !important;
  top: auto !important;
  z-index: auto !important;
  background: #fff;
  text-align: left;
  padding: 3px 4px 5px;
  color: var(--text);
  font-weight: 600;
  font-size: 11px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  opacity: 1;
}
.ob-breakdown-table-compact td {
  padding: 1px 4px;
  border-bottom: 1px solid #f0f3f8;
  white-space: nowrap;
  vertical-align: middle;
}
.ob-breakdown-table-compact td:last-child {
  padding-right: 4px;
  text-align: right;
  font-weight: 600;
  overflow: visible;
}
.ob-breakdown-table-compact th:nth-child(5),
.ob-breakdown-table-compact th:nth-child(6),
.ob-breakdown-table-compact td:nth-child(5),
.ob-breakdown-table-compact td:nth-child(6) {
  text-align: right;
}
.ob-breakdown-table-compact td input[type="text"] {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  height: 24px !important;
  text-align: right !important;
  border: 1px solid var(--line) !important;
  border-radius: 4px !important;
  padding: 0 4px !important;
  margin: 0 !important;
  font-size: 10px !important;
  line-height: 24px !important;
  box-sizing: border-box !important;
  color: #0f172a !important;
  background: #fff !important;
  font-variant-numeric: tabular-nums;
}
.ob-breakdown-table-compact tr:hover {
  background: var(--soft);
}
.ob-inline-actions {
  margin-top: 4px;
  text-align: right;
}
.ob-save-btn {
  background: var(--red, #dc2626);
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.ob-save-btn:hover {
  opacity: 0.9;
}
.auto-demo-notice {
  margin: 0 0 16px 0;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 16px;
  background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
  color: #1e3a8a;
  font-size: 13px;
  font-weight: 700;
  display: none;
}
.auto-demo-notice strong {
  font-weight: 900;
}

.oa-balance-statement {
  margin-top: 16px;
  border: 2px solid #111827;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
}
.oa-balance-head {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  background: #0b2a6f;
  color: #fff;
  border-bottom: 2px solid #111827;
}
.oa-balance-head .left,
.oa-balance-head .right {
  padding: 14px 16px;
}
.oa-balance-head .left {
  border-right: 2px solid rgba(255, 255, 255, 0.28);
}
.oa-balance-head .title {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
  color: #fff;
}
.oa-balance-head .meta {
  font-size: 13px;
  line-height: 1.5;
  font-weight: 700;
  color: #fff;
}
.oa-balance-head .currency {
  font-style: italic;
  font-size: 12px;
  margin-bottom: 8px;
  opacity: 0.95;
}
.oa-balance-head .week {
  font-size: 16px;
  font-weight: 900;
  margin-bottom: 8px;
}
.oa-balance-head .date {
  font-size: 13px;
  line-height: 1.45;
  font-weight: 700;
}
.oa-ending-grid {
  margin-top: 16px;
  border: 2px solid #111827;
  border-radius: 10px;
  overflow: auto;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
}
.oa-ending-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1500px;
  background: #fff;
}
.oa-ending-table thead th {
  background: #0b2a6f;
  color: #fff;
  border-right: 1px solid rgba(255, 255, 255, 0.18);
  padding: 10px 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 900;
  position: static;
}
.oa-ending-table thead th:first-child {
  text-align: left;
  min-width: 280px;
}
.oa-ending-table td {
  padding: 10px 8px;
  border-top: 1px solid #111827;
  text-align: right;
  font-weight: 900;
  font-size: 14px;
  color: #111827;
  background: #fff;
}
.oa-ending-table td:first-child {
  text-align: left;
  border-right: 2px solid #111827;
  min-width: 280px;
  background: #fff;
  color: #111827;
}
.oa-ending-table tbody tr.subtle td {
  background: #f3f4f6;
}
.oa-ending-table tbody tr.end td {
  background: #e5e7eb;
  font-size: 18px;
}
.oa-ending-table .neg {
  color: #dc2626;
}
.oa-ending-table .pos {
  color: #111827;
}

.total-row td {
  background: #eef4ff !important;
  font-weight: 900;
  color: #0f172a;
}
.total-row .exec-amount {
  font-size: 14px;
  font-weight: 900;
}
.cash-balance-row td {
  background: #f4d5d5 !important;
  font-weight: 900;
  border-top: 3px solid #111827;
}

.row-persist-focus td {
  background: #eef6ff !important;
  box-shadow: inset 3px 0 0 #2563eb;
}

@media (max-width: 1280px) {
  .executive-summary-row,
  .scenario-v5-grid,
  .executive-dashboard-grid,
  .executive-filters-grid {
    grid-template-columns: 1fr;
  }
}

.drill-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #eef4ff;
  margin-bottom: 16px;
}
.drill-banner .title {
  font-weight: 800;
  margin-bottom: 4px;
}
.drill-banner .sub {
  font-size: 12px;
  color: var(--muted);
}

/* === Visual upgrade: editor, issues panel, validations, matrix === */
#lineEditorPanel {
  position: relative;
  overflow: hidden;
  border: 1px solid #d7e3f4;
  border-radius: 24px;
  padding: 22px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
}
#lineEditorPanel:before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, #2457d6 0%, #4f46e5 45%, #0ea5e9 100%);
}
#lineEditorPanel h3 {
  font-size: 20px;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
  color: #0f172a;
}
.line-editor-sub {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: #eef4ff;
  color: #35518a;
  font-size: 12px;
  font-weight: 800;
  margin: 2px 0 16px 0;
  border: 1px solid #d8e4fb;
}
#lineEditorPanel .grid {
  gap: 16px;
  align-items: end;
}
#lineEditorPanel label {
  color: #64748b;
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 7px;
}
#lineEditorPanel input,
#lineEditorPanel select,
#lineEditorPanel textarea {
  min-height: 46px;
  border-radius: 14px;
  border: 1px solid #d8e1ef;
  background: #fff;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9),
    0 4px 14px rgba(15, 23, 42, 0.03);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}
#lineEditorPanel input:focus,
#lineEditorPanel select:focus,
#lineEditorPanel textarea:focus {
  outline: none;
  border-color: #7aa2ff;
  box-shadow:
    0 0 0 4px rgba(36, 87, 214, 0.1),
    0 8px 22px rgba(36, 87, 214, 0.1);
}
#lineEditorPanel input[type="number"] {
  font-weight: 700;
}
#fWeek[disabled],
#fForecastEUR[disabled] {
  background: linear-gradient(180deg, #eef2f7 0%, #e8eef7 100%);
  color: #334155;
  cursor: not-allowed;
  opacity: 1;
  font-weight: 900;
  border-color: #d3dce8;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}
#fForecastEUR[disabled] {
  color: #1d4ed8;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.derived-field-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  font-size: 11px;
  color: #64748b;
  font-weight: 800;
}
.derived-field-note:before {
  content: "AUTO";
  font-size: 9px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  border: 1px solid #cbd5e1;
  letter-spacing: 0.04em;
}
.line-editor-create #saveBtn,
.line-editor-edit #saveBtn {
  min-height: 48px;
  width: 100%;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 14px 28px rgba(36, 87, 214, 0.18);
}
.line-editor-edit #saveBtn {
  box-shadow: 0 14px 28px rgba(217, 119, 6, 0.18);
}
#lineEditorPanel button[type="button"]:not(#saveBtn) {
  min-height: 48px;
  width: 100%;
  border-radius: 14px;
  background: #f8fafc;
  border-color: #d6dee9;
  color: #334155;
  font-weight: 800;
}
#lineEditorPanel button[type="button"]:not(#saveBtn):hover {
  background: #eef2f7;
}
.validation-detail-panel {
  border: 1px solid #dbe4f1;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  padding: 16px;
  min-height: 420px;
  box-shadow: 0 10px 28px rgba(148, 163, 184, 0.1);
}
.validation-detail-block {
  border: 1px solid #dfe8f5;
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 12px;
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(148, 163, 184, 0.08);
}
.validation-main-grid .table-wrap {
  border: 1px solid #dbe4f1;
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(148, 163, 184, 0.08);
}
.validation-main-grid thead th {
  background: #f5f9ff;
  color: #516276;
  border-bottom: 1px solid #dce6f4;
}
.validation-main-grid tbody tr:nth-child(even) td {
  background: #fcfdff;
}
.validation-main-grid tbody tr:hover td {
  background: #eef6ff;
}
.soft-panel.side-panel-premium {
  border: 1px solid #d7e3f4;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 16px 34px rgba(148, 163, 184, 0.12);
}
.issues-headline h3 {
  font-size: 18px;
  margin-bottom: 4px;
}
.issues-counter {
  min-width: 38px;
  height: 38px;
  background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #bfdbfe;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.side-list.compact {
  gap: 12px;
  padding-right: 2px;
}
.side-list.compact .card {
  border: 1px solid #dbe5f2;
  border-radius: 18px;
  padding: 15px;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
  box-shadow: 0 10px 22px rgba(148, 163, 184, 0.1);
}
.side-list.compact .card strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
  color: #0f172a;
}
.side-list.compact .mini {
  line-height: 1.45;
}
.side-list.compact .actions {
  gap: 8px;
  margin-top: 10px;
}
.side-list.compact .actions button {
  background: #f8fafc;
  border-color: #d7dfeb;
  color: #334155;
  font-weight: 800;
}
.matrix-panel .table-wrap,
.executive-table-wrap {
  border: 1px solid #dbe5f2;
  border-radius: 22px;
  box-shadow:
    0 12px 28px rgba(148, 163, 184, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  background: #fff;
}
.executive-matrix-table thead th,
.matrix-panel thead th {
  background: linear-gradient(180deg, #f8fbff 0%, #edf4ff 100%);
  color: #526173;
  border-bottom: 1px solid #dbe6f4;
}
.executive-matrix-table tbody tr:nth-child(even) td {
  background: #fbfcff;
}
.executive-matrix-table tbody tr:hover td {
  background: #f2f7ff !important;
}
.exec-row-level1 td {
  background: #eef4ff !important;
  font-weight: 900;
  color: #0f172a;
  border-bottom: 1px solid #d9e5f7;
}
.exec-row-level2 td {
  background: #ffffff;
  border-bottom: 1px solid #e8eef7;
}
.exec-row-level3 td {
  background: #fcfdff;
  color: #334155;
}
.exec-amount {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.exec-amount.neg {
  color: #b91c1c;
}
.meta-pill {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border-color: #d9e6f6;
  box-shadow: 0 4px 10px rgba(148, 163, 184, 0.08);
}
.summary-row,
.summary-box,
.executive-summary-card {
  box-shadow: 0 6px 18px rgba(148, 163, 184, 0.08);
}
@media (max-width: 1280px) {
  #lineEditorPanel {
    padding: 18px;
  }
  .validation-detail-panel {
    min-height: 280px;
  }
}

#executiveBalanceStatement {
  display: none !important;
}

.oa-context-bar {
  display: none !important;
}

.executive-summary-row {
  display: none !important;
}

body {
  background: radial-gradient(
    circle at top,
    #edf4ff 0%,
    #f4f6fb 26%,
    #f4f6fb 100%
  );
  color: #0f172a;
}
.app {
  max-width: 1880px;
  padding: 22px;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  background: rgba(244, 246, 251, 0.85);
  backdrop-filter: blur(12px);
  padding: 6px 0 16px 0;
  margin: -4px 0 18px 0;
  pointer-events: auto;
}
.topbar > div:first-child {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid #dbe5f2;
  border-radius: 22px;
  padding: 18px 22px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.07);
  flex: 1 1 560px;
}
.topbar h1 {
  font-size: 30px;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar small {
  font-size: 12px;
  line-height: 1.45;
  max-width: 900px;
}
.btn-row {
  align-items: center;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid #dbe5f2;
  border-radius: 22px;
  padding: 12px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}
.topbar-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #eaf2ff 0%, #dbeafe 100%);
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid #bfdbfe;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
button {
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease,
    border-color 0.16s ease;
  box-shadow: 0 4px 12px rgba(148, 163, 184, 0.08);
}
button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(148, 163, 184, 0.16);
}
button.primary {
  box-shadow: 0 12px 22px rgba(36, 87, 214, 0.2);
}
button.success {
  box-shadow: 0 12px 22px rgba(22, 163, 74, 0.18);
}
button.warning {
  box-shadow: 0 12px 22px rgba(217, 119, 6, 0.18);
}
button.danger {
  box-shadow: 0 12px 22px rgba(220, 38, 38, 0.18);
}
/* V2 overrides intentionally removed — base .segmented-tabs / .tab-btn rules carry the premium finish. */
.executive-control-panel {
  position: relative;
  overflow: visible;
}
.executive-control-panel:before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, #2457d6 0%, #4f46e5 52%, #0ea5e9 100%);
}
#executiveSummaryRow .executive-summary-card {
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(148, 163, 184, 0.1);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}
#executiveSummaryRow .executive-summary-card:after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, #dbeafe 0%, #bfdbfe 100%);
  opacity: 0.95;
}
#executiveSummaryRow .executive-summary-card.oa-strong:after {
  background: linear-gradient(90deg, #2457d6 0%, #60a5fa 100%);
}
#executiveSummaryRow .executive-summary-card.oa-alert:after {
  background: linear-gradient(90deg, #dc2626 0%, #fb7185 100%);
}
#executiveSummaryRow .value.oa-neg {
  color: #b91c1c;
}
#executiveSummaryRow .value.oa-pos {
  color: #0f172a;
}
.oa-runway-bar {
  margin: 14px 0 14px 0;
  padding: 18px 18px 16px 18px;
  border-radius: 22px;
  border: 1px solid #dbe5f2;
  background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 16px 30px rgba(148, 163, 184, 0.1);
  overflow: visible;
}
.oa-runway-bar.tone-danger {
  background: linear-gradient(135deg, #fff7f7 0%, #fff 62%, #fff7ed 100%);
  border-color: #fecaca;
}
.oa-runway-bar.tone-warning {
  background: linear-gradient(135deg, #fffaf0 0%, #fff 60%, #f8fbff 100%);
  border-color: #fde68a;
}
.oa-runway-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.oa-runway-title {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}
.oa-runway-sub {
  font-size: 13px;
  color: #64748b;
  line-height: 1.45;
  max-width: 720px;
}
.oa-runway-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #eef4ff;
  color: #1d4ed8;
  border: 1px solid #cfe0ff;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}
.oa-runway-head .oa-runway-pill.tone-danger {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}
.oa-runway-head .oa-runway-pill.tone-warning {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}
.oa-runway-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
  overflow: visible;
  align-items: stretch;
}
.oa-runway-card {
  min-height: 72px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 14px;
  background: #ffffff;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.oa-runway-card .label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  font-weight: 500;
  margin-bottom: 4px;
}
.oa-runway-card .value {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.oa-runway-card .value.neg {
  color: #dc2626;
}
.oa-runway-card .sub {
  margin-top: 2px;
  font-size: 11px;
  color: #6b7280;
  font-weight: 400;
}
.oa-runway-card.cash-risk-card {
  background: #ffffff;
  border-color: #e5e7eb;
  box-shadow: none;
}
.oa-runway-card.cash-risk-card .value {
  letter-spacing: 0.3px;
}
.oa-runway-card.cash-risk-card.risk-low .value {
  color: #16a34a;
}
.oa-runway-card.cash-risk-card.risk-medium .value {
  color: #6b7280;
}
.oa-runway-card.cash-risk-card.risk-high .value {
  color: #d97706;
}
.oa-runway-card.cash-risk-card.risk-critical .value {
  color: #dc2626;
}
.oa-runway-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: #e8eef8;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
}
.oa-runway-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    #22c55e 0%,
    #84cc16 40%,
    #f59e0b 70%,
    #ef4444 100%
  );
}
.oa-runway-marker {
  position: absolute;
  top: 50%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #2457d6;
  transform: translate(-50%, -50%);
  box-shadow: 0 8px 16px rgba(36, 87, 214, 0.18);
}
.oa-runway-scale {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  font-size: 11px;
  color: #64748b;
  font-weight: 700;
}
/* Semana crítica — first week with negative ending free cash */
.oa-critical-head {
  background: linear-gradient(180deg, #fff1f2 0%, #ffe4e6 100%) !important;
  color: #991b1b !important;
  box-shadow: inset 0 -2px 0 #e11d48;
}
.oa-critical-col {
  background: rgba(254, 226, 226, 0.55) !important;
  box-shadow:
    inset 1px 0 0 rgba(225, 29, 72, 0.18),
    inset -1px 0 0 rgba(225, 29, 72, 0.18);
}
/* Punto mínimo — lowest closing balance of horizon */
.oa-low-head {
  background: linear-gradient(180deg, #fff7ed 0%, #ffedd5 100%) !important;
  color: #9a3412 !important;
  box-shadow: inset 0 -2px 0 #f59e0b;
}
.oa-low-col {
  background: rgba(254, 243, 199, 0.45) !important;
  box-shadow:
    inset 1px 0 0 rgba(245, 158, 11, 0.22),
    inset -1px 0 0 rgba(245, 158, 11, 0.22);
}
/* Combined — when critical week and lowest point coincide */
.oa-combined-head {
  background: linear-gradient(180deg, #450a0a 0%, #7f1d1d 100%) !important;
  color: #fff !important;
  box-shadow: inset 0 -2px 0 #fbbf24;
}
.oa-combined-col {
  background: rgba(127, 29, 29, 0.08) !important;
  box-shadow:
    inset 1px 0 0 rgba(127, 29, 29, 0.32),
    inset -1px 0 0 rgba(127, 29, 29, 0.32);
}
.oa-week-status {
  display: block;
  margin-top: 6px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: normal;
  line-height: 1.15;
  text-align: center;
}
.oa-combined-head .oa-week-status {
  color: #fde68a;
}
/* Mini legend */
.matrix-legend {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-left: auto;
  font-size: 11px;
  color: #475569;
  letter-spacing: 0.01em;
}
.matrix-legend strong {
  color: #0f172a;
  font-weight: 700;
}
.matrix-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.matrix-legend-swatch {
  display: inline-block;
  width: 14px;
  height: 10px;
  border-radius: 2px;
  border: 1px solid rgba(15, 23, 42, 0.08);
}
.matrix-legend-swatch.swatch-critical {
  background: linear-gradient(180deg, #fff1f2, #ffe4e6);
  border-bottom: 2px solid #e11d48;
}
.matrix-legend-swatch.swatch-low {
  background: linear-gradient(180deg, #fff7ed, #ffedd5);
  border-bottom: 2px solid #f59e0b;
}
.matrix-header-row-2 {
  align-items: center;
}
.executive-matrix-table th:first-child,
.executive-matrix-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  box-shadow: 8px 0 16px rgba(226, 232, 240, 0.24);
}
.executive-matrix-table thead th:first-child {
  z-index: 4;
}
.exec-row-level1 td:first-child {
  background: #eef4ff !important;
}
.exec-row-level2 td:first-child {
  background: #fff !important;
}
.exec-row-level3 td:first-child {
  background: #fcfdff !important;
}
.issues-headline,
.executive-side-summary .summary-box,
.side-list.compact .card {
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease;
}
.side-list.compact .card:hover,
.executive-side-summary .summary-box:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(148, 163, 184, 0.14);
}
.soft-panel.side-panel-premium {
  top: 92px;
}
@media (max-width: 1280px) {
  .oa-runway-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .soft-panel.side-panel-premium {
    top: auto;
  }
  /* Frozen first column must remain sticky at all viewport widths/zoom levels.
     (Previously set to position: static here — that broke horizontal freeze.) */
  .topbar {
    position: static;
    padding-top: 0;
  }
}
@media (max-width: 760px) {
  .app {
    padding: 14px;
  }
  .oa-runway-metrics {
    grid-template-columns: 1fr;
  }
  .topbar h1 {
    font-size: 24px;
  }
}

.executive-summary-row {
  display: none !important;
}

.oa-context-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px 0;
  padding: 12px 14px;
  border: 1px solid #dbe5f2;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 10px 24px rgba(148, 163, 184, 0.08);
}
.oa-context-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  background: #f8fbff;
  border: 1px solid #dbe7f6;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}
.oa-context-chip .label {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}
.oa-context-chip.is-accent {
  background: #eef4ff;
  border-color: #cfe0ff;
  color: #1d4ed8;
}
.oa-context-chip.is-highlight {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}
.highlight-row-persistent td,
tr.highlight-row-persistent td {
  background: #eef6ff !important;
  box-shadow: inset 3px 0 0 #2563eb;
}
#validationTableBody tr.validation-row-clickable.is-selected td {
  background: #eef6ff !important;
  box-shadow: inset 3px 0 0 #2563eb;
}

.executive-summary-row {
  display: none !important;
}

/* ── Comparison columns (W vs W-1) ── */
.comp-head {
  background: #f0f4f8 !important;
  color: #1b3a5c;
  text-align: center;
  vertical-align: middle;
  padding: 10px 10px;
  border-left: 2px solid #d0d8e0;
  white-space: nowrap;
  min-width: 110px;
}
.comp-head .wk1 {
  font-size: 12px;
  font-weight: 900;
  color: #64748b;
}
.comp-head .wk2 {
  font-size: 11px;
  color: #94a3b8;
}
.comp-head:first-of-type {
  border-left: 3px solid #1b3a5c;
}
td.comp-cell {
  background: #f3f4f6 !important;
  font-size: 12px;
  text-align: right;
  padding: 4px 10px;
  border-left: 1px solid #e5e7eb;
  white-space: nowrap;
}
tr td.comp-cell:first-of-type {
  border-left: 1px solid #e5e7eb;
}

/* ── Total summary column (separates weekly detail from summary block) ── */
.executive-matrix-table .total-head {
  background: #f3f4f6 !important;
  border-left: 2px solid #cbd5e1;
}
td.total-cell {
  background: #f3f4f6 !important;
  border-left: 2px solid #cbd5e1;
  font-weight: 700;
}
/* Preserve emphasis tint on key rows over the gray summary background */
.exec-row-level1 td.total-cell,
.exec-row-level1 td.comp-cell {
  background: #e6ecf2 !important;
}
.cash-balance-row td.total-cell,
.cash-balance-row td.comp-cell {
  background: #f4dcdc !important;
}

/* ── Foco Ejecutivo — premium institutional layout (BlackRock style) ── */
.variance-explanation.fe-card {
  margin: 18px 0 10px;
  width: 100%;
  max-width: 1280px;
  padding: 20px 24px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  color: #0f172a;
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.variance-explanation.fe-card > * {
  margin: 0;
}

/* SECTION 0 — Header label */
.variance-explanation .fe-label {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #94a3b8;
  line-height: 1;
}

/* SECTION 1 — Headline */
.variance-explanation .fe-headline {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.variance-explanation .fe-headline-main {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.variance-explanation .fe-headline-main.is-neg {
  color: #dc2626;
}
.variance-explanation .fe-headline-main.is-pos {
  color: #16a34a;
}
.variance-explanation .fe-headline-sub {
  font-size: 14px;
  font-weight: 500;
  color: #334155;
  line-height: 1.3;
}
.variance-explanation .fe-headline-driver {
  color: #0f172a;
  font-weight: 600;
}
.variance-explanation .fe-headline-neutral {
  font-size: 16px;
  color: #64748b;
  font-style: italic;
  font-weight: 500;
}

/* SECTION 2 — Drivers (horizontal pills) */
.variance-explanation .fe-drivers {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.variance-explanation .fe-driver {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
  line-height: 1.2;
}
.variance-explanation .fe-driver-neg {
  background: #fef2f2;
  color: #b91c1c;
}
.variance-explanation .fe-driver-pos {
  background: #f0fdf4;
  color: #15803d;
}
.variance-explanation .fe-driver-icon {
  font-size: 11px;
  line-height: 1;
}
.variance-explanation .fe-driver-name {
  font-weight: 500;
}
.variance-explanation .fe-driver-val {
  font-weight: 700;
}
.variance-explanation .fe-driver-tag {
  margin-left: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #15803d;
  background: #dcfce7;
  padding: 2px 6px;
  border-radius: 999px;
  line-height: 1.2;
}

/* SECTION 3 — Alert (inline badge) */
.variance-explanation .fe-alert-row {
  display: flex;
}
.variance-explanation .fe-alert {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  line-height: 1.3;
  white-space: nowrap;
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
}
.variance-explanation .fe-alert-warning {
  background: #fff7ed;
  color: #c2410c;
  border-color: #fed7aa;
}
.variance-explanation .fe-alert-critical {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

/* SECTION 4 — Narrative */
.variance-explanation .fe-narrative {
  font-size: 13px;
  color: #475569;
  line-height: 1.5;
}

/* ─── Card head with Board Mode toggle ─── */
.variance-explanation .fe-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.variance-explanation .fe-mode-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 32px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
  isolation: isolate;
}
.variance-explanation .fe-mode-switch .fe-mode-indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  background: #111827;
  border-radius: 7px;
  box-shadow:
    0 1px 2px rgba(17, 24, 39, 0.18),
    0 0 0 0.5px rgba(17, 24, 39, 0.06);
  transform: translateX(0);
  transition: transform 180ms cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 0;
  pointer-events: none;
}
.variance-explanation .fe-mode-switch[data-active="board"] .fe-mode-indicator {
  transform: translateX(100%);
}
.variance-explanation .fe-mode-opt {
  position: relative;
  z-index: 1;
  appearance: none;
  background: transparent;
  border: 0;
  color: #6b7280;
  font-family: "Inter", sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0 14px;
  height: 24px;
  min-width: 78px;
  border-radius: 7px;
  cursor: pointer;
  transition:
    background 120ms ease-out,
    color 120ms ease-out;
}
.variance-explanation .fe-mode-opt:hover:not(.is-active) {
  background: rgba(255, 255, 255, 0.7);
  color: #111827;
}
.variance-explanation .fe-mode-opt.is-active {
  color: #fff;
  font-weight: 600;
}

/* Standard view + board view — fade transitions */
.variance-explanation .fe-standard-view,
.variance-explanation .fe-board-mode {
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: opacity 120ms ease-out;
}
.variance-explanation .fe-standard-view[data-fading="out"],
.variance-explanation .fe-board-mode[data-fading="out"] {
  opacity: 0;
  transition-duration: 80ms;
}

/* ─── LAYER 2 — Recommendation block ─── */
.variance-explanation .fe-recommendation {
  margin-top: 4px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-left: 3px solid #0f172a;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.variance-explanation .fe-rec-label {
  font-family: "Inter", sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #64748b;
}
.variance-explanation .fe-rec-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.variance-explanation .fe-rec-list li {
  font-size: 13px;
  font-weight: 500;
  color: #0f172a;
  line-height: 1.45;
  padding-left: 14px;
  position: relative;
}
.variance-explanation .fe-rec-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: #0f172a;
  font-weight: 700;
}

/* ─── LAYER 3 — Board Mode (Goldman Sachs style) ─── */
.variance-explanation.fe-board-on {
  background: #fff;
  border: 1px solid #0f172a;
  border-radius: 4px;
  box-shadow: none;
  font-family: "Times New Roman", Georgia, serif;
}
.variance-explanation .fe-board-mode {
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: #000;
  font-family: "Times New Roman", Georgia, serif;
}
.variance-explanation .fe-board-mode .bm-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid #000;
  padding-bottom: 6px;
}
.variance-explanation .fe-board-mode .bm-headline {
  font-size: 18px;
  font-weight: 700;
  color: #000;
  line-height: 1.3;
}
.variance-explanation .fe-board-mode .bm-headline.bm-neg {
  color: #b00020;
}
.variance-explanation .fe-board-mode .bm-drivers {
  font-size: 14px;
  font-weight: 500;
  color: #000;
  font-variant-numeric: tabular-nums;
}
.variance-explanation .fe-board-mode .bm-alert {
  font-size: 13px;
  font-weight: 700;
  color: #b00020;
  letter-spacing: 0.04em;
}
.variance-explanation .fe-board-mode .bm-rec {
  font-size: 14px;
  font-weight: 700;
  color: #000;
  border-top: 1px solid #000;
  padding-top: 8px;
  letter-spacing: 0.02em;
}
.variance-explanation .fe-board-mode .bm-drivers .bm-rank {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #555;
  margin-right: 4px;
}
.variance-explanation .fe-board-mode .bm-rec {
  text-transform: uppercase;
}

/* ──────────────────────────────────────────────────────────────
   NEGATIVE CONTEXT — mute positive indicators so negative drivers
   retain primary visual emphasis. Positive offsets become
   secondary, neutral, lowercase, no green highlights.
   ────────────────────────────────────────────────────────────── */

/* Analysis view: positive driver pill becomes neutral/muted */
.variance-explanation.is-negative-context .fe-driver-pos {
  background: transparent;
  color: #6b7280;
  border: 1px solid #e5e7eb;
  font-weight: 400;
}
.variance-explanation.is-negative-context .fe-driver-pos .fe-driver-icon {
  /* Hide bright green bullet in negative scenarios */
  display: none;
}
.variance-explanation.is-negative-context .fe-driver-pos .fe-driver-name,
.variance-explanation.is-negative-context .fe-driver-pos .fe-driver-val {
  color: #4b5563;
  font-weight: 500;
  text-transform: lowercase;
}
.variance-explanation.is-negative-context .fe-driver-tag {
  background: transparent;
  color: #6b7280;
  border: 1px solid #e5e7eb;
  text-transform: lowercase;
  letter-spacing: 0;
  font-weight: 500;
}

/* Board view: secondary "Partial offset" muted, no green */
.variance-explanation
  .fe-board-mode.is-negative-context
  .bm-rank.bm-secondary-opposite {
  color: #6b7280;
  font-weight: 600;
}
.variance-explanation
  .fe-board-mode.is-negative-context
  .bm-driver-text.bm-secondary-opposite {
  color: #4b5563;
  font-weight: 400;
  text-transform: lowercase;
}

/* ──────────────────────────────────────────────────────────────
   Universal secondary-driver muting (applies in ANY scenario).
   Only the primary driver carries color emphasis. The secondary
   driver renders neutral/muted regardless of cash direction.
   ────────────────────────────────────────────────────────────── */
.variance-explanation .fe-driver.fe-driver-secondary {
  background: transparent !important;
  border: 1px solid #e5e7eb;
  color: #6b7280 !important;
  font-weight: 400;
}
.variance-explanation .fe-driver.fe-driver-secondary .fe-driver-icon {
  display: none;
}
.variance-explanation .fe-driver.fe-driver-secondary .fe-driver-name,
.variance-explanation .fe-driver.fe-driver-secondary .fe-driver-val {
  color: #4b5563 !important;
  font-weight: 500;
  text-transform: lowercase;
}
.variance-explanation .fe-driver.fe-driver-secondary .fe-driver-tag {
  background: transparent !important;
  color: #6b7280 !important;
  border: 1px solid #e5e7eb;
  text-transform: lowercase;
  letter-spacing: 0;
  font-weight: 500;
}

/* ─────────────────────────────────────────────
   BOARD SLIDE — Institutional one-page composite
   ───────────────────────────────────────────── */
.waterfall-chart-panel.board-mode {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 36px 44px 32px;
  box-shadow: none;
}
.waterfall-chart-panel.board-mode .waterfall-mode-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}
.board-slide {
  display: flex;
  flex-direction: column;
  gap: 22px;
  color: #111827;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.board-slide-headline {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: #111827;
  margin: 0;
}
.board-slide-drivers {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  font-size: 12px;
}
.bs-driver-tag {
  color: #6b7280;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 11px;
  margin-right: 6px;
}
.bs-driver-val {
  color: #111827;
  font-weight: 600;
  font-size: 13px;
}
.board-slide-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.bs-kpi {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 16px;
  min-height: 76px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}
.bs-kpi-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #6b7280;
  text-transform: uppercase;
}
.bs-kpi-value {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.bs-kpi-value.neg {
  color: #7a1c1c;
}
.bs-kpi-value.risk-critical {
  color: #7a1c1c;
}
.bs-kpi-value.risk-high {
  color: #b45309;
}
.bs-kpi-value.risk-medium {
  color: #6b7280;
}
.bs-kpi-value.risk-low {
  color: #166534;
}
.bs-kpi-sub {
  font-size: 10.5px;
  color: #9ca3af;
  font-weight: 400;
}
.board-slide-chart {
  background: #ffffff;
  border-top: 1px solid #f3f4f6;
  border-bottom: 1px solid #f3f4f6;
  padding: 8px 0 4px;
}
.board-slide-chart canvas {
  display: block;
  width: 100% !important;
}
.board-slide-insight {
  font-size: 13.5px;
  line-height: 1.55;
  color: #374151;
  margin: 0;
  max-width: 90%;
}
.board-slide-action {
  border-top: 1px solid #e5e7eb;
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bs-action-line {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #111827;
  text-transform: uppercase;
}
.bs-action-sub {
  font-size: 12px;
  color: #6b7280;
  font-weight: 400;
}

/* ─────────────────────────────────────────────
   BOARD MODE — hide everything except the slide
   ───────────────────────────────────────────── */
body.board-mode-active
  .executive-control-panel
  > *:not(.waterfall-chart-panel):not(.toolbar) {
  display: none !important;
}
body.board-mode-active .executive-control-panel .toolbar {
  display: none !important;
}
body.board-mode-active #oa-executive-runway,
body.board-mode-active #executiveSummaryRow,
body.board-mode-active .executive-filters-grid,
body.board-mode-active .executive-dashboard-grid {
  display: none !important;
}
body.board-mode-active .executive-control-panel {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 24px 0 !important;
}
body.board-mode-active .waterfall-chart-panel.board-mode {
  max-width: 1280px;
  margin: 0 auto;
}

/* =========================================================
   Priority Issues Panel — Executive redesign
   ========================================================= */
.priority-subtitle {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
  margin: 10px 0 6px 0;
  padding-bottom: 5px;
  border-bottom: 1px solid #e2e8f0;
}
.priority-stack {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.priority-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 7px 9px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.priority-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
}
.priority-card.is-critical {
  border-color: #fca5a5;
  background: linear-gradient(180deg, #fff7f7 0%, #ffffff 60%);
}
.priority-card .pc-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.priority-card .pc-row-top {
  justify-content: space-between;
}
.priority-card .pc-name {
  font-size: 12.5px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.priority-card .pc-sub {
  font-size: 10.5px;
  color: #64748b;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.priority-card .pc-flag {
  display: inline-flex;
  align-items: center;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #b91c1c;
  background: #fee2e2;
  border: 1px solid #fecaca;
  padding: 1px 5px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.priority-card .pc-amts {
  font-size: 11px;
  color: #1e293b;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  gap: 4px;
}
.priority-card .pc-amts em {
  font-style: normal;
  font-size: 9.5px;
  font-weight: 700;
  color: #94a3b8;
  margin-right: 2px;
}
.priority-card .pc-sep {
  color: #cbd5e1;
  font-weight: 400;
}
.priority-card .pc-foot {
  justify-content: space-between;
  margin-top: 2px;
  gap: 6px;
  flex-wrap: wrap;
}
.priority-card .pc-states {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.priority-card .pc-states .badge,
.priority-card .pc-states .pill {
  font-size: 9.5px !important;
  padding: 2px 6px !important;
  line-height: 1.2 !important;
  border-radius: 6px !important;
  font-weight: 700 !important;
}
.priority-card .pc-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.priority-card .pc-primary {
  background: #0f172a;
  color: #fff;
  border: 1px solid #0f172a;
  padding: 4px 10px;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.priority-card .pc-primary:hover {
  background: #1e293b;
}
.pc-more-wrap {
  position: relative;
}
.pc-more {
  background: transparent;
  border: 1px solid #e2e8f0;
  color: #475569;
  width: 24px;
  height: 24px;
  font-size: 14px;
  line-height: 1;
  font-weight: 800;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.pc-more:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0f172a;
}
.pc-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
  padding: 4px;
  z-index: 50;
  min-width: 130px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pc-menu button {
  background: transparent;
  border: 0;
  text-align: left;
  padding: 6px 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: #334155;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
}
.pc-menu button:hover {
  background: #f1f5f9;
  color: #0f172a;
}
.priority-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #e2e8f0;
}
.pc-link {
  background: transparent;
  border: 0;
  color: #475569;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}
.pc-link:hover {
  background: #f1f5f9;
  color: #0f172a;
}
.pc-link-primary {
  color: #1d4ed8;
}
.pc-link-primary:hover {
  background: #eff6ff;
  color: #1e40af;
}

/* Executive summary subtitle + 2-col compact grid */
.exec-summary-subtitle {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
  margin: 2px 0 8px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid #e2e8f0;
}
.exec-summary-grid,
.exec-summary-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.executive-side-summary {
  margin-bottom: 10px !important;
  gap: 6px !important;
}
.executive-side-summary .summary-box.compact {
  padding: 8px 11px !important;
  border-radius: 8px !important;
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}
.executive-side-summary .summary-box.compact strong {
  font-size: 10.5px !important;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b !important;
  font-weight: 700 !important;
  margin: 0 !important;
  line-height: 1.2;
  white-space: nowrap;
  flex-shrink: 0;
}
.executive-side-summary .summary-box.compact span {
  font-size: 12.5px !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  text-align: right;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.executive-side-summary .summary-box.compact.is-warn {
  background: #fff7ed !important;
  border-color: #fed7aa !important;
}
.executive-side-summary .summary-box.compact.is-warn span {
  color: #9a3412 !important;
}
.executive-side-summary .summary-box:hover {
  transform: none !important;
  box-shadow: none !important;
}

.priority-empty {
  text-align: center;
  padding: 16px 12px;
  background: #f8fafc;
  border: 1px dashed #e2e8f0;
  border-radius: 10px;
}
.priority-empty .pe-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #dcfce7;
  color: #16a34a;
  font-weight: 900;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}
.priority-empty .pe-title {
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
}
.priority-empty .pe-sub {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
}

/* Modal */
.priority-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: pmFade 0.15s ease-out;
}
@keyframes pmFade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.priority-modal {
  background: #fff;
  border-radius: 18px;
  width: min(720px, 100%);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 60px rgba(15, 23, 42, 0.3);
  overflow: hidden;
}
.priority-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 18px 22px;
  border-bottom: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}
.priority-modal-head h3 {
  margin: 0 0 2px 0;
  font-size: 17px;
  font-weight: 800;
  color: #0f172a;
}
.priority-modal-head .pm-sub {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}
.pm-close {
  background: transparent;
  border: 1px solid #e2e8f0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 20px;
  line-height: 1;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pm-close:hover {
  background: #f1f5f9;
  color: #0f172a;
}
.priority-modal-body {
  overflow-y: auto;
  padding: 16px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* =========================================================
   Phase 1 — Executive priority alert card
   Overrides previous .priority-card visuals when .phase1
   class is present. Premium, compact, alert-only.
   ========================================================= */
.priority-card.phase1 {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}
.priority-card.phase1:hover {
  border-color: #cbd5e1;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}
.priority-card.phase1.is-critical {
  border-color: #fecaca;
  background: linear-gradient(180deg, #fffafa 0%, #ffffff 70%);
}

/* Header / title — strongest text, max 2 lines */
.priority-card.phase1 .pc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.priority-card.phase1 .pc-title {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.3;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.005em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  flex: 1;
  min-width: 0;
  white-space: normal;
}

/* Metadata row */
.priority-card.phase1 .pc-meta {
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  letter-spacing: 0.01em;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Financial block — Forecast dominant */
.priority-card.phase1 .pc-finance {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 14px;
  padding: 6px 0 2px 0;
  border-top: 1px dashed #eef2f7;
  margin-top: 2px;
}
.priority-card.phase1 .pc-forecast {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.priority-card.phase1 .pc-forecast-label {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  line-height: 1;
}
.priority-card.phase1 .pc-forecast-value {
  font-size: 17px;
  font-weight: 800;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.priority-card.phase1 .pc-real,
.priority-card.phase1 .pc-delta {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}
.priority-card.phase1 .pc-real-label,
.priority-card.phase1 .pc-delta-label {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
}
.priority-card.phase1 .pc-real-value {
  font-size: 11.5px;
  font-weight: 700;
  color: #475569;
}
.priority-card.phase1 .pc-delta-value {
  font-size: 11.5px;
  font-weight: 700;
}
.priority-card.phase1 .pc-delta.pos .pc-delta-value {
  color: #15803d;
}
.priority-card.phase1 .pc-delta.neg .pc-delta-value {
  color: #b91c1c;
}

/* Badges — exactly two: reason + status */
.priority-card.phase1 .pc-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.priority-card.phase1 .pc-badge {
  display: inline-flex;
  align-items: center;
  height: 18px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: none;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid transparent;
  line-height: 1;
  white-space: nowrap;
}
/* Reason badge palette — sober, executive */
.pr-reason-overdue {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}
.pr-reason-impact {
  background: #fff7ed;
  color: #9a3412;
  border-color: #fed7aa;
}
.pr-reason-critical {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}
.pr-reason-pago {
  background: #f1f5f9;
  color: #1e293b;
  border-color: #e2e8f0;
}
.pr-reason-cobro {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}
.pr-reason-manual {
  background: #eef2ff;
  color: #4338ca;
  border-color: #c7d2fe;
}
.pr-reason-unclass {
  background: #f8fafc;
  color: #64748b;
  border-color: #e2e8f0;
}
.pr-reason-review {
  background: #fefce8;
  color: #854d0e;
  border-color: #fde68a;
}
.pr-reason-default {
  background: #f8fafc;
  color: #475569;
  border-color: #e2e8f0;
}

/* Status badge — only Prioritario / Abierto */
.priority-card.phase1 .pc-status-priority {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}
.priority-card.phase1 .pc-status-open {
  background: #ffffff;
  color: #475569;
  border-color: #cbd5e1;
}

/* Actions — bottom aligned, discreet, max 2 buttons */
.priority-card.phase1 .pc-actions {
  display: flex;
  gap: 6px;
  margin-top: 2px;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
}
.priority-card.phase1 .pc-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 12px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.005em;
  border-radius: 6px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
  white-space: nowrap;
  line-height: 1;
}
.priority-card.phase1 .pc-btn-secondary {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #d8dee7;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
}
.priority-card.phase1 .pc-btn-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}
.priority-card.phase1 .pc-btn-primary {
  background: #0f172a;
  color: #ffffff;
  border: 1px solid #0f172a;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.08);
}
.priority-card.phase1 .pc-btn-primary:hover {
  background: #1e293b;
  border-color: #1e293b;
}

/* Responsive — stack actions vertically on narrow viewports */
@media (max-width: 640px) {
  .priority-card.phase1 .pc-actions {
    flex-direction: column;
  }
  .priority-card.phase1 .pc-btn {
    flex: none;
    width: 100%;
  }
  .priority-card.phase1 .pc-finance {
    gap: 10px;
  }
}

/* Phase 1 — Pago / Cobro pill in priority-card meta */
.priority-card.phase1 .pc-meta .pc-type {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.01em;
  vertical-align: baseline;
  border: 1px solid transparent;
}
.priority-card.phase1 .pc-meta .pc-type.is-cobro {
  color: oklch(0.4 0.13 155);
  background: oklch(0.96 0.04 155);
  border-color: oklch(0.88 0.05 155);
}
.priority-card.phase1 .pc-meta .pc-type.is-pago {
  color: oklch(0.42 0.16 25);
  background: oklch(0.96 0.04 25);
  border-color: oklch(0.88 0.06 25);
}

/* Highlight target cell when navigating from priority card */
td.highlight-cell {
  position: relative;
  background: oklch(0.95 0.1 90) !important;
  box-shadow: inset 0 0 0 2px oklch(0.7 0.18 80);
  transition:
    background 0.4s ease,
    box-shadow 0.4s ease;
}

/* ============================================================
   GLOBAL STICKY NAV — topbar + tabs (Dashboard, Datos, Escenarios)
   Consistent across all 3 tabs. Premium look, no jitter.
   ============================================================ */
:root {
  --sticky-topbar-h: 76px;
  --sticky-tabs-h: 56px;
  --sticky-nav-h: calc(var(--sticky-topbar-h) + var(--sticky-tabs-h));
}

.topbar-v2 {
  position: sticky;
  top: 0;
  z-index: 90;
  margin-bottom: 10px;
  /* keep gradient background solid so content doesn't bleed through */
}

.tabs-shell {
  position: sticky;
  top: var(--sticky-topbar-h);
  z-index: 85;
  margin: 0 0 20px 0;
  padding: 10px 0 14px 0;
  background: linear-gradient(
    180deg,
    rgba(244, 246, 251, 0.97) 0%,
    rgba(244, 246, 251, 0.93) 75%,
    rgba(244, 246, 251, 0) 100%
  );
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
}
.tab-btn:hover {
  transform: none;
  box-shadow: none;
}
.tab-btn:hover:not(.active) {
  box-shadow: none;
}
.tab-btn.active:hover {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 1) inset,
    0 1px 1.5px rgba(15, 23, 42, 0.05),
    0 6px 14px -10px rgba(15, 23, 42, 0.16);
}

/* Internal sticky elements (matrix headers, side panels) must sit
   below the global nav so they don't overlap it. */
.executive-matrix-table thead th,
table thead th {
  top: var(--sticky-nav-h) !important;
  z-index: 6;
}

.side-panel-premium {
  top: calc(var(--sticky-nav-h) + 12px);
}

/* Disable the legacy unused .topbar sticky (component uses .topbar-v2) */
.topbar {
  position: static;
  background: transparent;
  backdrop-filter: none;
}

/* ============================================================
   DATA TAB — PREMIUM REFINEMENT (visual only)
   ============================================================ */

/* Section titles — clearer hierarchy */
#tab-datos .section-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #0f172a;
  margin-bottom: 4px;
}
#tab-datos .section-title--sub {
  font-size: 14px;
  font-weight: 700;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Background contrast: page slightly grayer than cards */
#tab-datos {
  background: transparent;
}
#tab-datos .panel {
  background: #ffffff;
  border: 1px solid #e6ebf3;
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

/* Company setup — compact, secondary feel */
#tab-datos .company-setup-panel {
  padding: 14px 18px 16px;
  background: linear-gradient(180deg, #fbfcfe, #ffffff);
}
#tab-datos .company-setup-panel label {
  font-size: 11.5px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
#tab-datos .company-setup-panel input,
#tab-datos .company-setup-panel select {
  height: 36px;
  font-size: 13.5px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #fff;
}
#tab-datos #addCompanyBtn {
  height: 36px;
  font-weight: 700;
  background: #16a34a;
  color: #fff;
  border: 1px solid #15803d;
  border-radius: 8px;
  padding: 0 16px;
  box-shadow: 0 1px 0 rgba(22, 101, 52, 0.15);
}
#tab-datos #addCompanyBtn:hover {
  background: #15803d;
}

/* Validation Center — main block */
#tab-datos .premium-validation {
  padding: 20px 22px 22px;
  background: #fff;
  border: 1px solid #e6ebf3;
}
#tab-datos .validation-toolbar {
  align-items: flex-start;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #eef2f7;
}
#tab-datos .validation-header-left .section-title {
  font-size: 19px;
  font-weight: 800;
}
#tab-datos .validation-exec-summary {
  margin-top: 10px;
  font-size: 13px;
  color: #1e293b;
  font-weight: 600;
  letter-spacing: 0.005em;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
#tab-datos .validation-exec-summary .es-sep {
  color: #cbd5e1;
  font-weight: 400;
}
#tab-datos .validation-exec-summary .es-muted {
  color: #64748b;
  font-weight: 500;
}
#tab-datos .validation-exec-summary .es-err {
  color: #b91c1c;
}
#tab-datos .validation-exec-summary .es-warn {
  color: #b45309;
}
#tab-datos .validation-exec-summary .es-ok {
  color: #15803d;
}
#tab-datos .validation-exec-summary .es-quality {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 700;
}

/* Action buttons hierarchy */
#tab-datos .validation-actions-bar {
  gap: 8px;
}
#tab-datos .validation-actions-bar .primary {
  background: #2563eb;
  color: #fff;
  border: 1px solid #1d4ed8;
  border-radius: 8px;
  font-weight: 700;
  height: 36px;
  padding: 0 14px;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.18);
}
#tab-datos .validation-actions-bar .primary:hover {
  background: #1d4ed8;
}
#tab-datos .validation-actions-bar .ghost-strong {
  background: #fff;
  color: #1e293b;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-weight: 600;
  height: 36px;
  padding: 0 12px;
}
#tab-datos .validation-actions-bar .ghost-strong:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}
#tab-datos .validation-actions-bar .ghost-soft {
  background: transparent;
  color: #64748b;
  border: 1px solid transparent;
  font-weight: 500;
  height: 36px;
  padding: 0 10px;
}
#tab-datos .validation-actions-bar .ghost-soft:hover {
  color: #1e293b;
  background: #f8fafc;
}

/* KPI cards — cleaner, premium */
#tab-datos .validation-kpis {
  gap: 10px;
}
#tab-datos .validation-kpi {
  background: #fff;
  border: 1px solid #e6ebf3;
  border-radius: 12px;
  padding: 14px 14px 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}
#tab-datos .validation-kpi:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}
#tab-datos .validation-kpi .label {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
#tab-datos .validation-kpi .value {
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
#tab-datos .validation-kpi .sub {
  margin-top: 4px;
  font-size: 11.5px;
  color: #94a3b8;
  font-weight: 500;
}
/* Subtle severity hints on incident KPIs */
#tab-datos .validation-kpi.kpi-error {
  border-top: 2px solid #ef4444;
}
#tab-datos .validation-kpi.kpi-warning {
  border-top: 2px solid #f59e0b;
}
#tab-datos .validation-kpi.kpi-dup {
  border-top: 2px solid #8b5cf6;
}
#tab-datos .validation-kpi.kpi-quality {
  border-top: 2px solid #2563eb;
}

/* Errors by type / company — list-row look (not inputs) */
#tab-datos .summary-list {
  gap: 6px;
}
#tab-datos .summary-row {
  background: #fff;
  border: 1px solid #eef2f7;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
  transition:
    background 0.12s ease,
    border-color 0.12s ease;
}
#tab-datos .summary-row:hover {
  background: #f8fafc;
  border-color: #dbe3ee;
}
#tab-datos .summary-row > :last-child {
  font-weight: 700;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

/* Filters toolbar — compact */
#tab-datos .validation-filters {
  background: #f8fafc;
  border: 1px solid #eef2f7;
  border-radius: 12px;
  padding: 12px;
  gap: 10px;
}
#tab-datos .validation-filters label {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  display: block;
}
#tab-datos .validation-filters input,
#tab-datos .validation-filters select {
  height: 34px;
  font-size: 13px;
  border-radius: 7px;
  border: 1px solid #d8e0ec;
  background: #fff;
  padding: 0 10px;
}
#tab-datos .validation-filters input:focus,
#tab-datos .validation-filters select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  outline: none;
}
#tab-datos .checkbox-cell {
  gap: 4px;
}
#tab-datos .checkbox-inline {
  font-size: 12.5px;
  color: #475569;
  font-weight: 500;
}

/* Issues table */
#tab-datos .validation-main-grid .table-wrap {
  position: relative;
  overflow: auto;
  max-height: calc(100vh - var(--sticky-nav-h, 132px) - 220px);
  background: #fff;
}
#tab-datos #validationTable {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}
/* Sticky header pinned to the TOP OF THE SCROLL CONTAINER (not the page),
   overriding the global `table thead th` rule that uses --sticky-nav-h. */
#tab-datos #validationTable thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 5;
  background: #f1f5f9;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 12px;
  border-bottom: 1px solid #cbd5e1;
  text-align: left;
  /* Solid bottom shadow keeps rows visually behind the header on scroll */
  box-shadow:
    0 1px 0 #cbd5e1,
    0 4px 8px -4px rgba(15, 23, 42, 0.08);
}
#tab-datos #validationTable tbody td {
  padding: 10px 12px;
  font-size: 13px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  background: #fff;
}
#tab-datos #validationTable tbody tr {
  transition: background 0.12s ease;
}
#tab-datos #validationTable tbody tr:hover td {
  background: #f8fbff;
}
#tab-datos #validationTable tbody tr.row-selected td,
#tab-datos #validationTable tbody tr.is-selected td {
  background: #f5f8fd;
  box-shadow: none;
}
#tab-datos #validationTable tbody tr.row-selected td:first-child,
#tab-datos #validationTable tbody tr.is-selected td:first-child {
  box-shadow: inset 2px 0 0 #2563eb;
}

/* Severity / status badge polish */
#tab-datos .validation-status-badge,
#tab-datos .validation-severity-badge {
  font-size: 10.5px;
  padding: 3px 8px;
  text-transform: none;
  letter-spacing: 0.02em;
  font-weight: 700;
}
#tab-datos .val-status-ok {
  background: #f0fdf4;
  color: #166534;
  border-color: #dcfce7;
}

/* Detail panel — resolution card */
#tab-datos .validation-detail-panel {
  background: #fff;
  border: 1px solid #e6ebf3;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
#tab-datos .validation-detail-block {
  background: #fbfcfe;
  border: 1px solid #eef2f7;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
#tab-datos .validation-detail-block h4,
#tab-datos .validation-detail-block .block-title {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
#tab-datos .detail-empty {
  font-size: 13px;
  color: #94a3b8;
  text-align: center;
  padding: 32px 16px;
}

/* Detail action buttons */
#tab-datos .validation-actions button {
  height: 34px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 7px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #1e293b;
}
#tab-datos .validation-actions button:hover {
  background: #f1f5f9;
}
#tab-datos .validation-actions button.primary,
#tab-datos .validation-actions button.btn-go {
  background: #2563eb;
  color: #fff;
  border-color: #1d4ed8;
}
#tab-datos .validation-actions button.primary:hover,
#tab-datos .validation-actions button.btn-go:hover {
  background: #1d4ed8;
}

/* Edit Record (premium editor) */
#tab-datos .premium-editor {
  padding: 20px 22px;
  background: linear-gradient(180deg, #ffffff, #fbfcfe);
}
#tab-datos .premium-editor label {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
#tab-datos .premium-editor input,
#tab-datos .premium-editor select {
  height: 38px;
  border-radius: 8px;
  border: 1px solid #d8e0ec;
  background: #fff;
  font-size: 13.5px;
  padding: 0 12px;
}
#tab-datos .premium-editor input:focus,
#tab-datos .premium-editor select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  outline: none;
}

/* AUTO-calculated fields — visually distinct */
#tab-datos .field-auto input,
#tab-datos .field-auto select,
#tab-datos #fWeek[disabled],
#tab-datos #fForecastEUR[disabled] {
  background: #f1f5f9 !important;
  border: 1px dashed #cbd5e1 !important;
  color: #475569;
  font-weight: 600;
  cursor: not-allowed;
}
#tab-datos .auto-badge {
  display: inline-block;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #dbeafe;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}
#tab-datos .derived-field-note {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
  font-style: italic;
  font-weight: 400;
}

/* Save / Clear buttons — premium blue primary */
#tab-datos .premium-editor #saveBtn,
#tab-datos .line-editor-create #saveBtn,
#tab-datos .line-editor-edit #saveBtn {
  height: 38px;
  background: #2563eb;
  color: #fff;
  border: 1px solid #1d4ed8;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13.5px;
  padding: 0 18px;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
  letter-spacing: 0.005em;
}
#tab-datos .line-editor-create #saveBtn:hover,
#tab-datos .line-editor-edit #saveBtn:hover {
  background: #1d4ed8;
}
#tab-datos #clearFormBtn {
  height: 38px;
  background: #fff;
  color: #64748b;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13.5px;
  padding: 0 16px;
}
#tab-datos #clearFormBtn:hover {
  background: #f1f5f9;
  color: #1e293b;
}

/* More breathing room between major blocks */
#tab-datos > .panel + .panel,
#tab-datos > .panel + section.panel,
#tab-datos > section.panel + .panel {
  margin-top: 18px;
}

/* ============================================================
   PREMIUM ESCENARIOS TAB — CFO/Treasury simulation module
   ============================================================ */
/* Keep tab-pane visibility rules authoritative: only display when active. */
.tab-pane.premium-scenarios {
  display: none;
}
.tab-pane.premium-scenarios.active {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.premium-scenarios .panel {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 24px 26px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.premium-scenarios .sim-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.premium-scenarios .sim-section-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: #0b1220;
  letter-spacing: -0.015em;
}
.premium-scenarios .sim-section-sub {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 12.5px;
  line-height: 1.45;
  max-width: 720px;
}
.premium-scenarios .sim-context-panel {
  padding: 14px 20px 16px;
}
.premium-scenarios .sim-context-panel .sim-section-head {
  margin-bottom: 8px;
}
.premium-scenarios .sim-context-panel .sim-section-sub {
  margin-top: 2px;
}

/* ── Context bar ── */
.sim-context-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.sim-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sim-field label {
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.sim-field input,
.sim-field select {
  height: 40px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #ffffff;
  color: #0f172a;
  font-size: 14px;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.sim-field input:focus,
.sim-field select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.sim-context-save {
  height: 40px;
  padding: 0 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
}

@media (max-width: 1024px) {
  .sim-context-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .sim-context-grid {
    grid-template-columns: 1fr;
  }
  .premium-scenarios .sim-section-head {
    flex-direction: column;
    align-items: stretch;
  }
  .sim-context-save {
    width: 100%;
  }
}

/* ── Scenario cards ── */
.sim-cards-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 6px;
}
@media (max-width: 1100px) {
  .sim-cards-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 720px) {
  .sim-cards-grid {
    grid-template-columns: 1fr;
  }
}

.sim-card {
  position: relative;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition:
    border-color 0.2s,
    box-shadow 0.2s,
    transform 0.2s;
}
.sim-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 6px 18px -8px rgba(15, 23, 42, 0.12);
}
.sim-card.is-active {
  border-color: #2563eb;
  background: linear-gradient(180deg, #f4f7ff 0%, #fbfcff 70%, #ffffff 100%);
  box-shadow:
    0 0 0 3px rgba(37, 99, 235, 0.08),
    0 10px 28px -14px rgba(37, 99, 235, 0.28);
}
.sim-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sim-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.sim-badge.base {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}
.sim-badge.opt {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}
.sim-badge.pes {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.sim-active-badge {
  display: none;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.07);
  color: #1d4ed8;
  border: 1px solid rgba(37, 99, 235, 0.18);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.35;
  white-space: nowrap;
}
.sim-active-badge::before {
  content: "✓";
  font-size: 8.5px;
  font-weight: 700;
}
.sim-card.is-active .sim-active-badge {
  display: inline-flex;
}

.sim-card-title {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  color: #0b1220;
  letter-spacing: -0.02em;
}
.sim-card-summary {
  margin: -6px 0 4px;
  color: #64748b;
  font-size: 12.5px;
  line-height: 1.5;
}

.sim-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sim-input-group label {
  font-size: 10.5px;
  font-weight: 700;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.sim-input-group input {
  height: 42px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #ffffff;
  font-size: 15px;
  font-weight: 700;
  color: #0b1220;
  letter-spacing: -0.01em;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.sim-input-group input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.sim-help {
  font-size: 11.5px;
  color: #475569;
  font-weight: 500;
  font-style: normal;
}

/* ── Impact preview ── */
.sim-impact {
  margin-top: 4px;
  padding: 9px 12px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.sim-impact-title {
  font-size: 9.5px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}
.sim-impact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 20px;
}
.sim-impact-label {
  font-size: 11.5px;
  color: #475569;
  font-weight: 500;
}
.sim-impact-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  line-height: 1.5;
}
.sim-impact-pill.neutral {
  background: #f1f5f9;
  color: #475569;
  border-color: #e2e8f0;
}
.sim-impact-pill.favorable {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}
.sim-impact-pill.pressure {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

/* ── Action bar ── */
.sim-action-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #e2e8f0;
}
.sim-action-bar button {
  height: 40px;
  padding: 0 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sim-action-bar button.primary {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}
.sim-action-bar button.primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
  box-shadow: 0 4px 12px -4px rgba(37, 99, 235, 0.5);
}
.sim-action-bar button.ghost,
.sim-action-bar button.secondary {
  background: #ffffff;
  color: #334155;
  border-color: #cbd5e1;
}
.sim-action-bar button.ghost:hover,
.sim-action-bar button.secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}
.sim-action-bar button.tertiary {
  background: transparent;
  color: #334155;
  border-color: transparent;
  font-weight: 600;
  padding: 0 14px;
  text-decoration: underline;
  text-decoration-color: rgba(51, 65, 85, 0.18);
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}
.sim-action-bar button.tertiary:hover {
  color: #1d4ed8;
  background: #eff4fb;
  text-decoration-color: rgba(29, 78, 216, 0.35);
}
.sim-action-bar .sim-action-spacer {
  flex: 1;
}
@media (max-width: 640px) {
  .sim-action-bar {
    flex-direction: column;
  }
  .sim-action-bar .sim-action-spacer {
    display: none;
  }
  .sim-action-bar button {
    width: 100%;
  }
}

/* ── Executive summary strip ── */
.exec-stat-strip {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 1024px) {
  .exec-stat-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .exec-stat-strip {
    grid-template-columns: 1fr;
  }
}

.exec-stat-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.exec-stat-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 14px -6px rgba(15, 23, 42, 0.1);
}
.exec-stat-label {
  font-size: 10.5px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.exec-stat-value {
  font-size: 22px;
  font-weight: 800;
  color: #0b1220;
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin-top: 2px;
}
.exec-stat-cap {
  font-size: 11.5px;
  color: #94a3b8;
  line-height: 1.4;
}

/* ============================================================
   SECTION OPENER — Unified visual opening across tabs
   Dashboard · Datos · Escenarios share the same gramática:
   thin blue rule + uppercase executive title
   ============================================================ */
.section-opener {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 4px 0 18px 0;
  padding: 0;
}
.section-opener-rule {
  height: 2px;
  width: 100%;
  border-radius: 2px;
  background: linear-gradient(
    90deg,
    rgba(36, 87, 214, 0) 0%,
    #2457d6 6%,
    #2563eb 50%,
    #4f46e5 86%,
    rgba(79, 70, 229, 0) 100%
  );
  opacity: 0.92;
}
.section-opener-title {
  margin: 0;
  font-size: 13px;
  font-weight: 620;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #1e3a8a;
  line-height: 1.25;
  font-feature-settings: "ss01", "cv11";
}

/* Hide legacy duplicated h3 inside the dashboard control panel
   (the title now lives in the unified SectionOpener above). */
.toolbar--legacy-hidden {
  display: none !important;
}

/* Suppress the original 4px blue bar on .executive-control-panel
   when preceded by the unified opener — avoids double rule. */
.section-opener ~ .dashboard-premium .executive-control-panel:before {
  display: none;
}

@media (max-width: 720px) {
  .section-opener {
    margin: 2px 0 14px 0;
    gap: 8px;
  }
  .section-opener-title {
    font-size: 12px;
    letter-spacing: 0.12em;
  }
}

/* ============================================================
   Responsive vertical rhythm — tighten only at narrower widths.
   Desktop ≥1280px keeps current spacing untouched.
   ============================================================ */
@media (max-width: 1279px) {
  .topbar-v2 {
    margin-bottom: 8px;
  }
  .tabs-shell {
    margin: 0 0 14px 0;
    padding: 8px 0 10px 0;
  }
  .section-opener {
    margin: 2px 0 14px 0;
  }
}
@media (max-width: 980px) {
  .topbar-v2 {
    margin-bottom: 6px;
    padding: 11px 18px;
  }
  .tabs-shell {
    margin: 0 0 10px 0;
    padding: 6px 0 8px 0;
  }
  .section-opener {
    margin: 0 0 10px 0;
    gap: 7px;
  }
}

/* ============================================================
   DASHBOARD — Round 2: jerarquía ejecutiva, presencia y autoridad.
   Solo ajustes visuales. No toca lógica, datos ni layout.
   ============================================================ */

/* 1) RUNWAY — hero ejecutivo, marco más sutil, contenido protagonista */
.oa-runway-bar {
  position: relative;
  padding: 26px 26px 22px 26px;
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid #e6ebf3;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 16px 36px -20px rgba(15, 23, 42, 0.16),
    0 3px 10px -4px rgba(15, 23, 42, 0.05);
}
.oa-runway-bar::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 2px;
  background: linear-gradient(180deg, #2457d6 0%, #1e3a8a 100%);
  opacity: 0.75;
}
.oa-runway-bar.tone-danger {
  border-color: #f1d9d9;
}
.oa-runway-bar.tone-danger::before {
  background: linear-gradient(180deg, #dc2626 0%, #991b1b 100%);
  opacity: 0.65;
}
.oa-runway-bar.tone-warning {
  border-color: #f1e4c4;
}
.oa-runway-bar.tone-warning::before {
  background: linear-gradient(180deg, #f59e0b 0%, #b45309 100%);
  opacity: 0.7;
}

.oa-runway-head {
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.oa-runway-title {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #0b1220;
  margin-bottom: 2px;
  line-height: 1.05;
}
.oa-runway-sub {
  font-size: 12px;
  color: #94a3b8;
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* 2) Badge "Semana crítica" — más fino, mejor integrado con el título */
.oa-runway-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  gap: 5px;
  border: 1px solid transparent;
  line-height: 1;
  vertical-align: middle;
  position: relative;
  top: -1px;
}
.oa-runway-head .oa-runway-pill.tone-danger {
  background: #fdf3f3;
  color: #b91c1c;
  border-color: #f3d4d4;
  box-shadow: none;
}
.oa-runway-head .oa-runway-pill.tone-warning {
  background: #fdf8ec;
  color: #b45309;
  border-color: #f0dfb4;
  box-shadow: none;
}

/* 3) Mini-cards Runway — críticos dominan, secundarios más calmados */
.oa-runway-metrics {
  gap: 12px;
  margin-bottom: 20px;
}
.oa-runway-card {
  position: relative;
  min-height: 86px;
  padding: 13px 15px;
  border-radius: 12px;
  border: 1px solid #eef1f6;
  background: #fbfcfe;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease;
}
.oa-runway-card .label {
  font-size: 9px;
  color: #9aa3b1;
  font-weight: 600;
  letter-spacing: 0.085em;
  text-transform: uppercase;
  margin-bottom: 7px;
}
.oa-runway-card .value {
  font-size: 17.5px;
  font-weight: 650;
  color: #475569;
  letter-spacing: -0.012em;
  line-height: 1.1;
}
.oa-runway-card .sub {
  margin-top: 5px;
  font-size: 10px;
  color: #aab2bf;
  font-weight: 500;
  letter-spacing: 0.005em;
}

/* KPIs CRÍTICOS — Punto mínimo, Saldo final, Cash Risk: dominan claramente */
.oa-runway-card.cash-risk-card,
.oa-runway-card.kpi-critical {
  background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
  border: 1px solid #cfd9eb;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 8px 18px -6px rgba(15, 23, 42, 0.12),
    0 2px 5px rgba(15, 23, 42, 0.04);
}
.oa-runway-card.cash-risk-card::after,
.oa-runway-card.kpi-critical::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  top: 0;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: linear-gradient(90deg, #2457d6 0%, #4f7be8 100%);
  opacity: 0.9;
}
.oa-runway-card.cash-risk-card.risk-critical::after,
.oa-runway-card.cash-risk-card.risk-high::after {
  background: linear-gradient(90deg, #dc2626 0%, #f87171 100%);
}
.oa-runway-card.cash-risk-card .value,
.oa-runway-card.kpi-critical .value {
  font-size: 27px;
  font-weight: 800;
  color: #0b1220;
  letter-spacing: -0.028em;
  line-height: 1.05;
}
.oa-runway-card.cash-risk-card .label,
.oa-runway-card.kpi-critical .label {
  color: #1f2937;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.09em;
}
.oa-runway-card.cash-risk-card .sub,
.oa-runway-card.kpi-critical .sub {
  color: #64748b;
  font-weight: 500;
  font-size: 10.5px;
}

/* 4) Timeline runway */
.oa-runway-track {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #eef2f8 0%, #e6ecf6 100%);
  box-shadow:
    inset 0 1px 2px rgba(15, 23, 42, 0.06),
    0 1px 0 rgba(255, 255, 255, 0.6);
  margin-top: 8px;
}
.oa-runway-fill {
  height: 100%;
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(36, 87, 214, 0.18);
}
.oa-runway-marker {
  width: 16px;
  height: 16px;
  border-width: 3px;
  border-color: #fff;
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.18),
    0 6px 14px rgba(36, 87, 214, 0.32);
}
.oa-runway-scale {
  margin-top: 12px;
  font-size: 10.5px;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 0.03em;
}

/* 5) CASH FLOW BRIDGE — board-level, header integrado */
.waterfall-chart-panel {
  padding: 22px 24px 18px;
  margin-top: 24px;
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
  border: 1px solid #e2e8f3;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 20px 44px -22px rgba(15, 23, 42, 0.2),
    0 6px 14px -6px rgba(15, 23, 42, 0.06);
}
.waterfall-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 2px 14px;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eef2f8;
}
.waterfall-panel-header .bridge-headline-title {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.028em;
  color: #0b1220;
  margin: 0;
  line-height: 1.15;
}
.waterfall-chart-panel canvas {
  min-height: 460px !important;
  width: 100% !important;
  display: block;
}

/* 6) Botón "Modo comité" — natural en el header */
.waterfall-mode-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.board-mode-toggle {
  font-size: 9.75px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 7px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  transition: all 0.16s ease;
  line-height: 1;
}
.board-mode-toggle:hover {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0b1220;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}
.board-mode-toggle[data-active="true"] {
  background: #0b1220;
  color: #ffffff;
  border-color: #0b1220;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.22);
}

/* 7) Jerarquía superior vs detalle inferior */
.dashboard-premium.dashboard-v5 .executive-control-panel {
  padding-bottom: 22px;
  background: transparent;
  border: none;
  box-shadow: none;
}
.dashboard-premium.dashboard-v5
  .executive-control-panel
  > .oa-runway-bar:first-of-type,
.dashboard-premium.dashboard-v5 #oa-executive-runway {
  margin-top: 4px;
}
.dashboard-premium.dashboard-v5 .executive-dashboard-grid {
  margin-top: 24px;
  gap: 18px;
}
/* Detalle inferior (matriz + side panel) — visualmente más calmado */
.dashboard-premium.dashboard-v5 .matrix-panel.executive-matrix-panel,
.dashboard-premium.dashboard-v5 .side-panel-premium {
  border-radius: 16px;
  border: 1px solid #ecf0f6;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

/* Responsive: mantener jerarquía sin apretar */
@media (max-width: 1279px) {
  .oa-runway-bar {
    padding: 22px 20px 18px;
  }
  .oa-runway-title {
    font-size: 26px;
  }
  .oa-runway-card.cash-risk-card .value,
  .oa-runway-card.kpi-critical .value {
    font-size: 23px;
  }
  .waterfall-chart-panel {
    padding: 22px 18px 14px;
  }
  .waterfall-panel-header .bridge-headline-title {
    font-size: 18px;
  }
  .waterfall-chart-panel canvas {
    min-height: 380px !important;
  }
}
@media (max-width: 980px) {
  .oa-runway-metrics {
    grid-template-columns: 1fr 1fr;
  }
  .oa-runway-title {
    font-size: 22px;
  }
  .oa-runway-card.cash-risk-card .value,
  .oa-runway-card.kpi-critical .value {
    font-size: 21px;
  }
  .waterfall-panel-header {
    flex-wrap: wrap;
    gap: 10px;
  }
  .waterfall-panel-header .bridge-headline-title {
    font-size: 16px;
  }
  .waterfall-chart-panel canvas {
    min-height: 300px !important;
  }
}

/* ============================================================
 * Datos · Inline edit inside the right detail panel (Prioridad 1)
 * ============================================================ */

/* Premium empty state for the validation detail panel */
.validation-detail-panel .detail-empty.detail-empty-premium {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 10px;
  padding: 28px 22px;
  min-height: 360px;
  border: 1px dashed #d6e0ef;
  border-radius: 14px;
  background: linear-gradient(180deg, #fbfdff 0%, #f4f8ff 100%);
  color: #475569;
}
.validation-detail-panel .detail-empty-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #e6efff;
  color: #2457d6;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}
.validation-detail-panel .detail-empty-title {
  font-size: 15px;
  font-weight: 700;
  color: #0b1220;
  letter-spacing: -0.01em;
}
.validation-detail-panel .detail-empty-sub {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 6px;
}
.validation-detail-panel .detail-empty-bullets {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.validation-detail-panel .detail-empty-bullets li {
  font-size: 12.5px;
  color: #64748b;
  padding-left: 16px;
  position: relative;
}
.validation-detail-panel .detail-empty-bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2457d6;
  opacity: 0.55;
}

/* ============================================================
   INLINE EDIT PANEL — Premium lateral editor (Round 2)
   ============================================================ */
.validation-detail-panel.is-inline-editing {
  padding: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #ffffff 0%, #f6faff 100%);
  overflow: hidden;
}

/* ---- Header ---- */
.validation-detail-panel.is-inline-editing .inline-edit-header {
  padding: 16px 20px 14px;
  border-bottom: 1px solid #e6ecf6;
  background: #ffffff;
  position: relative;
}
.validation-detail-panel.is-inline-editing .inline-edit-header::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 2px;
  background: linear-gradient(180deg, #2457d6 0%, #1e3a8a 100%);
}
.inline-edit-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.inline-edit-eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #2457d6;
  margin-bottom: 3px;
}
.inline-edit-title {
  font-size: 16px;
  font-weight: 800;
  color: #0b1220;
  margin: 0;
  letter-spacing: -0.018em;
}
.inline-edit-sub {
  margin-top: 4px;
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}
.inline-edit-close {
  border: 1px solid #dbe4f1;
  background: #ffffff;
  color: #475569;
  height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.inline-edit-close:hover {
  background: #eef4ff;
  color: #2457d6;
  border-color: #b8cdf0;
}

/* ---- Strip the form's own chrome when nested ---- */
.validation-detail-panel.is-inline-editing #lineEditorPanel {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 4px 18px 8px;
  margin: 0;
  border-radius: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
}
.validation-detail-panel.is-inline-editing #lineEditorPanel::before {
  display: none;
}
.validation-detail-panel.is-inline-editing #lineEditorPanel > h3#formTitle,
.validation-detail-panel.is-inline-editing #lineEditorPanel > #formSubtitle {
  display: none;
}

/* ---- Grid: max 2 cols, balanced spacing ---- */
.validation-detail-panel.is-inline-editing #lineEditorPanel .grid.g6 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px 14px;
  align-items: start;
}
.validation-detail-panel.is-inline-editing #lineEditorPanel .grid.g6 > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.validation-detail-panel.is-inline-editing #lineEditorPanel label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.validation-detail-panel.is-inline-editing #lineEditorPanel input,
.validation-detail-panel.is-inline-editing #lineEditorPanel select,
.validation-detail-panel.is-inline-editing #lineEditorPanel textarea {
  padding: 7px 10px;
  font-size: 13px;
  border-radius: 7px;
  border: 1px solid #dde4ee;
  background: #ffffff;
  color: #0f172a;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}
.validation-detail-panel.is-inline-editing #lineEditorPanel input:focus,
.validation-detail-panel.is-inline-editing #lineEditorPanel select:focus,
.validation-detail-panel.is-inline-editing #lineEditorPanel textarea:focus {
  outline: none;
  border-color: #2457d6;
  box-shadow: 0 0 0 3px rgba(36, 87, 214, 0.1);
}

/* ---- Hierarchy: emphasize key fields (the value, not the label) ---- */
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fCompany)
  input,
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fCompany)
  select,
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fScenario)
  select,
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fType)
  select,
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fNature)
  input,
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fDetail)
  input,
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fValueDate)
  input,
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fForecast)
  input,
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fReal)
  input {
  font-weight: 600;
  color: #0b1220;
}
/* De-emphasize ID and Comment */
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #lineId)
  input,
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fComment)
  input {
  font-size: 12.5px;
  color: #475569;
  background: #f8fafc;
}

/* ---- AUTO fields: discreet read-only treatment ---- */
.validation-detail-panel.is-inline-editing #lineEditorPanel .field-auto input,
.validation-detail-panel.is-inline-editing #lineEditorPanel .field-auto select {
  background: #f5f8fd;
  border-color: #e3eaf5;
  color: #475569;
  font-weight: 600;
  cursor: not-allowed;
}
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .field-auto
  label
  .auto-badge,
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .field-auto
  .auto-badge {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 1px 5px;
  border-radius: 3px;
  background: #eef3fb;
  color: #5a78b3;
  border: none;
  text-transform: uppercase;
  line-height: 1.3;
}
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .field-auto
  .derived-field-note {
  margin-top: 3px;
  font-size: 10px;
  color: #94a3b8;
  font-style: normal;
  line-height: 1.3;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  opacity: 0.9;
}

/* ---- Subtle visual grouping via spacing (no labels, no colored dividers) ---- */
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fNature),
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fValueDate),
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fForecastEUR),
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fStatus) {
  margin-top: 6px;
}

/* ---- Block ordering & section dividers (using CSS order + ::before headers) ---- */
.validation-detail-panel.is-inline-editing #lineEditorPanel .grid.g6 > div {
  order: 99;
}

/* Block 1: Contexto */
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fCompany) {
  order: 1;
}
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fScenario) {
  order: 2;
}
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fType) {
  order: 3;
}
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #lineId) {
  order: 4;
}

/* Block 2: Clasificación */
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fNature) {
  order: 11;
}
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fDetail) {
  order: 12;
}
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fThird) {
  order: 13;
}
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fReference) {
  order: 14;
}

/* Block 3: Fechas e importe operativo */
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fValueDate) {
  order: 21;
}
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fWeek) {
  order: 22;
}
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fForecast) {
  order: 23;
}
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fReal) {
  order: 24;
}

/* Block 4: Calculados */
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fForecastEUR) {
  order: 31;
  grid-column: span 2;
}

/* Block 5: Cierre */
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fStatus) {
  order: 41;
}
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fComment) {
  order: 42;
  grid-column: span 2;
}

/* Section headers removed — visual grouping is handled by spacing only */

/* Hide the form's internal Save / Clear buttons & their wrapper cells */
.validation-detail-panel.is-inline-editing #lineEditorPanel #saveBtn,
.validation-detail-panel.is-inline-editing #lineEditorPanel #clearFormBtn,
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #saveBtn),
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #clearFormBtn) {
  display: none !important;
}

/* ---- Sticky footer with the only canonical actions ---- */
.validation-detail-panel.is-inline-editing .inline-edit-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid #e6ecf6;
  background: #ffffff;
  position: sticky;
  bottom: 0;
  box-shadow: 0 -4px 14px -8px rgba(15, 23, 42, 0.08);
}
.inline-edit-secondary {
  background: #ffffff;
  border: 1px solid #cfdaeb;
  color: #475569;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.inline-edit-secondary:hover {
  background: #f1f5fc;
  color: #0b1220;
  border-color: #b8cdf0;
}
.inline-edit-save {
  background: linear-gradient(180deg, #2457d6 0%, #1e3a8a 100%);
  color: #fff;
  border: none;
  padding: 9px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition:
    filter 0.15s ease,
    transform 0.05s ease;
  box-shadow: 0 2px 6px -1px rgba(36, 87, 214, 0.35);
}
.inline-edit-save:hover {
  filter: brightness(1.06);
}
.inline-edit-save:active {
  transform: translateY(1px);
}

#lineEditorPanel.line-editor-create::after {
  content: "Formulario para alta manual de nuevos registros";
  display: none;
}

@media (max-width: 1100px) {
  .validation-detail-panel.is-inline-editing #lineEditorPanel .grid.g6 {
    grid-template-columns: 1fr;
  }
  .validation-detail-panel.is-inline-editing
    #lineEditorPanel
    .grid.g6
    > div:has(> #fForecastEUR),
  .validation-detail-panel.is-inline-editing
    #lineEditorPanel
    .grid.g6
    > div:has(> #fComment) {
    grid-column: span 1;
  }
  .inline-edit-section-label {
    grid-column: span 1;
  }
}

/* ========================================================================
   DATOS — micro-pulido final (compactación, AUTO, labels, tabla, estado limpio)
   ======================================================================== */

/* 1. Compactar ritmo vertical del panel derecho */
#tab-datos .validation-detail-panel .premium-editor label,
#tab-datos .validation-detail-panel #lineEditorPanel label {
  margin-bottom: 3px;
}
#tab-datos .validation-detail-panel #lineEditorPanel .grid.g6 {
  gap: 9px 14px;
}
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fNature),
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fValueDate),
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fForecastEUR),
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fStatus) {
  margin-top: 4px;
}
#tab-datos .inline-edit-footer {
  padding: 10px 14px !important;
  margin-top: 6px !important;
}
#tab-datos .validation-detail-block {
  margin-bottom: 10px;
}
#tab-datos .validation-detail-block > strong {
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  font-weight: 600;
}

/* 2. AUTO: ayudas más finas, mejor alineadas */
#tab-datos .derived-field-note,
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .field-auto
  .derived-field-note {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 2px;
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.25;
  opacity: 0.85;
}
#tab-datos .auto-badge,
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .field-auto
  .auto-badge {
  font-size: 8px;
  padding: 1px 4px;
  letter-spacing: 0.06em;
  background: #eef3fb;
  color: #6b86bd;
  border: none;
  border-radius: 3px;
  font-weight: 700;
  margin-left: 6px;
  vertical-align: middle;
}

/* 4. Labels un punto más sobrios */
#tab-datos .validation-detail-panel .premium-editor label,
#tab-datos .validation-detail-panel #lineEditorPanel label {
  font-size: 9.5px !important;
  color: #9aa6b8 !important;
  font-weight: 500 !important;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* 3. Estado limpio compacto cuando NO hay incidencias */
#tab-datos .validation-detail-clean {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f6faf6;
  border: 1px solid #e3efe3;
  border-radius: 8px;
  font-size: 12.5px;
  color: #475569;
  margin: 4px 0 12px;
}
#tab-datos .validation-detail-clean .vdc-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12);
  flex: 0 0 auto;
}
#tab-datos .validation-detail-clean .vdc-label {
  font-weight: 600;
  color: #166534;
}
#tab-datos .validation-detail-clean .vdc-sep {
  color: #cbd5e1;
}
#tab-datos .validation-detail-clean .vdc-msg {
  color: #64748b;
}

/* 5. Polish muy sutil de la tabla */
#tab-datos #validationTable thead th {
  font-size: 10.5px;
  letter-spacing: 0.05em;
  color: #64748b;
  font-weight: 600;
  padding-top: 9px;
  padding-bottom: 9px;
}
#tab-datos #validationTable tbody tr:hover td {
  background: #fafbfd;
}
#tab-datos #validationTable tbody tr.is-selected:hover td {
  background: #f1f6fc;
}
#tab-datos #validationTable tbody td {
  padding-top: 9px;
  padding-bottom: 9px;
}

/* === MICRO-PULIDO FINAL DATOS === */

/* 1. Compactar panel derecho en modo DETALLE */
#tab-datos
  .validation-detail-panel:not(.is-inline-editing)
  .validation-detail-block {
  margin-bottom: 8px;
  padding-bottom: 6px;
}
#tab-datos
  .validation-detail-panel:not(.is-inline-editing)
  .validation-detail-block
  > strong {
  font-size: 10px;
  margin-bottom: 4px;
  display: block;
}
#tab-datos
  .validation-detail-panel:not(.is-inline-editing)
  .validation-detail-block
  .small-note {
  margin: 1px 0;
  line-height: 1.4;
}
#tab-datos
  .validation-detail-panel:not(.is-inline-editing)
  .validation-detail-clean {
  margin: 2px 0 8px;
  padding: 7px 10px;
}
#tab-datos
  .validation-detail-panel:not(.is-inline-editing)
  .validation-actions {
  margin-top: 8px;
  gap: 6px;
}

/* 2. Labels del editor: un punto más sobrios */
#tab-datos .validation-detail-panel .premium-editor label,
#tab-datos .validation-detail-panel #lineEditorPanel label {
  font-size: 9px !important;
  color: #a8b2c1 !important;
  font-weight: 500 !important;
  letter-spacing: 0.07em;
}

/* 3. Tabla: hover y header más finos */
#tab-datos #validationTable tbody tr:hover td {
  background: #fbfcfe;
}
#tab-datos #validationTable thead th {
  font-size: 10px;
  color: #748296;
  font-weight: 600;
  letter-spacing: 0.06em;
}
#tab-datos #validationTable tbody td {
  padding-left: 11px;
  padding-right: 11px;
}

/* 4. Campos AUTO: eliminar texto auxiliar redundante, mantener solo badge */
#tab-datos .derived-field-note,
#tab-datos .field-auto .derived-field-note,
.validation-detail-panel.is-inline-editing #lineEditorPanel .derived-field-note,
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .field-auto
  .derived-field-note {
  display: none !important;
}
/* Badge AUTO ligeramente más refinado */
#tab-datos .auto-badge,
.validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .field-auto
  .auto-badge {
  font-size: 7.5px;
  padding: 1px 4px;
  background: #eef2f8;
  color: #7a8aa6;
  letter-spacing: 0.08em;
}

/* ============================================================
   FINAL MICRO-POLISH — DATOS edit panel
   1) Lower visual weight of ID REGISTRO
   2) Soften IMPORTE GRUPO (EUR)
   3) Add breathing room to footer
   ============================================================ */

/* 1. ID REGISTRO — secondary / auxiliary treatment */
#tab-datos
  .validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #lineId)
  label {
  color: #b4bdcc !important;
  font-size: 8.5px !important;
  font-weight: 500 !important;
  opacity: 0.85;
}
#tab-datos
  .validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #lineId)
  input {
  font-size: 11.5px !important;
  color: #94a3b8 !important;
  background: #fafbfd !important;
  border-color: #eef1f6 !important;
  font-weight: 400 !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0;
}

/* 2. IMPORTE GRUPO (EUR) — softer, better integrated */
#tab-datos
  .validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fForecastEUR)
  input,
#tab-datos #fForecastEUR[disabled] {
  background: #fafbfd !important;
  border: 1px solid #eef1f6 !important;
  color: #475569 !important;
  font-weight: 500 !important;
  box-shadow: none !important;
}
#tab-datos
  .validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fForecastEUR)
  label {
  color: #94a3b8 !important;
}
#tab-datos
  .validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fForecastEUR)
  .auto-badge {
  background: #f1f4f9 !important;
  color: #8595ad !important;
  font-weight: 600 !important;
}

/* 3. Footer breathing room — more separation from COMENTARIO */
#tab-datos
  .validation-detail-panel.is-inline-editing
  #lineEditorPanel
  .grid.g6
  > div:has(> #fComment) {
  margin-bottom: 10px;
}
#tab-datos .validation-detail-panel.is-inline-editing .inline-edit-footer {
  margin-top: 14px;
  padding: 16px 20px 18px !important;
}

/* ============================================================
   DATOS — Quitar filtros button + active filters microstate
   ============================================================ */
/* Fit 7 columns: reset + 5 filters + checkboxes */
#tab-datos .validation-filters {
  grid-template-columns:
    minmax(120px, 0.8fr) /* reset */
    minmax(110px, 1fr) /* empresa */
    minmax(110px, 1fr) /* severidad */
    minmax(110px, 1fr) /* tipo error */
    minmax(110px, 1fr) /* estado */
    minmax(140px, 1.2fr) /* buscar */
    minmax(150px, 0.9fr); /* checkboxes */
  gap: 8px;
}
#tab-datos .validation-filters .filter-reset-cell {
  order: -1;
}
#tab-datos .validation-filters .filter-reset-cell[hidden] {
  display: none !important;
}
#tab-datos .validation-filters .filter-reset-cell > label {
  visibility: hidden;
}
#tab-datos .validation-filters .filter-reset-wrap {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  height: 34px;
}
#tab-datos .validation-filters .filter-reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 500;
  color: #475569;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
  white-space: nowrap;
}
#tab-datos .validation-filters .filter-reset-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #1e293b;
}
#tab-datos .validation-filters .filter-reset-btn svg {
  opacity: 0.75;
}
#tab-datos .validation-filters .filter-active-count {
  font-size: 10.5px;
  color: #94a3b8;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  padding-left: 2px;
}
#tab-datos .validation-filters .checkbox-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 6px;
  padding-top: 23px; /* aligns first checkbox with input row (label height + margin) */
}
#tab-datos .validation-filters .checkbox-cell .checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  text-transform: none;
  letter-spacing: 0;
  font-size: 12.5px;
  margin: 0;
  line-height: 1;
}
#tab-datos
  .validation-filters
  .checkbox-cell
  .checkbox-inline
  input[type="checkbox"] {
  width: 14px;
  height: 14px;
  min-width: 14px;
  margin: 0;
  flex-shrink: 0;
}

/* Validation issues — structured, compact, premium */
.validation-issues .validation-issue-list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.validation-issues .validation-issue {
  border: 1px solid var(--border, #e5e7eb);
  border-left: 3px solid var(--border, #e5e7eb);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.6);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.validation-issues .validation-issue--blocking {
  border-left-color: #dc2626;
}
.validation-issues .validation-issue--warning {
  border-left-color: #d97706;
}
.validation-issues .validation-issue--info {
  border-left-color: #2563eb;
}
.validation-issues .validation-issue-row {
  font-size: 12.5px;
  line-height: 1.4;
  color: #374151;
}
.validation-issues .validation-issue-key {
  font-weight: 600;
  color: #111827;
  margin-right: 4px;
}
.validation-issues .validation-issue-val {
  color: #4b5563;
}

/* ============================================================
   Read-only mode (viewer role) — disables write inputs/actions
   ============================================================ */
body.wcf-readonly #tab-escenarios .sim-input-group input {
  pointer-events: none;
  background: #f3f4f6 !important;
  color: #6b7280 !important;
  cursor: not-allowed;
}
body.wcf-readonly #tab-datos .validation-detail-panel button:not(.ghost-soft):not(.ghost-strong),
body.wcf-readonly #tab-datos .validation-detail-panel input:not([type="hidden"]),
body.wcf-readonly #tab-datos .validation-detail-panel select,
body.wcf-readonly #tab-datos .validation-detail-panel textarea {
  pointer-events: none;
  opacity: 0.6;
}
body.wcf-readonly #validationTable .row-action-btn,
body.wcf-readonly #validationTable button[data-action="edit"],
body.wcf-readonly #validationTable button[data-action="delete"] {
  display: none !important;
}

/* L3 drill-down: viewers may click to navigate, but Datos opens read-only.
   Keep cursor as pointer so it remains discoverable. */
body.wcf-readonly .executive-matrix-table .exec-toggle {
  pointer-events: auto;
  cursor: pointer;
}

/* ---- Datos: viewer = strictly read-only ----
   Disable every editable control so values render like static text. */
body.wcf-readonly #tab-datos input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
body.wcf-readonly #tab-datos select,
body.wcf-readonly #tab-datos textarea {
  pointer-events: none !important;
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  color: #1f2937 !important;
  cursor: default !important;
  -webkit-user-select: text;
  user-select: text;
}
/* Re-enable filters/search so viewers can navigate (they only affect view,
   not persisted data — and viewer storage is shimmed to memory anyway). */
body.wcf-readonly #tab-datos .validation-filters input:not([type="hidden"]),
body.wcf-readonly #tab-datos .validation-filters select,
body.wcf-readonly #tab-datos .validation-filters input[type="checkbox"] {
  pointer-events: auto !important;
  background: #fff !important;
  border-color: #d1d5db !important;
  cursor: text;
}
body.wcf-readonly #tab-datos .validation-filters select,
body.wcf-readonly #tab-datos .validation-filters input[type="checkbox"] {
  cursor: pointer;
}
/* Hide every Datos write/import/delete control */
body.wcf-readonly #tab-datos #recalcValidationsBtn,
body.wcf-readonly #tab-datos .validation-detail-panel button[data-action="edit"],
body.wcf-readonly #tab-datos .validation-detail-panel button[data-action="delete"],
body.wcf-readonly #tab-datos .validation-detail-panel button[data-action="save"],
body.wcf-readonly #tab-datos button[data-action="save"],
body.wcf-readonly #tab-datos button[data-action="delete"],
body.wcf-readonly #tab-datos button[data-action="edit"],
body.wcf-readonly #tab-datos #saveBtn,
body.wcf-readonly #tab-datos #addCompanyBtn {
  display: none !important;
}
body.wcf-readonly #validationTable .row-action-btn,
body.wcf-readonly #validationTable button[data-action="edit"],
body.wcf-readonly #validationTable button[data-action="delete"] {
  display: none !important;
}
body.wcf-readonly #tab-datos .validation-detail-panel input:not([type="hidden"]),
body.wcf-readonly #tab-datos .validation-detail-panel select,
body.wcf-readonly #tab-datos .validation-detail-panel textarea {
  pointer-events: none !important;
  background: transparent !important;
  border-color: transparent !important;
  color: #1f2937 !important;
  opacity: 1;
}

/* ---- Escenarios: viewer = strictly read-only ---- */
body.wcf-readonly #tab-escenarios input,
body.wcf-readonly #tab-escenarios select,
body.wcf-readonly #tab-escenarios textarea {
  pointer-events: none !important;
  background: #f9fafb !important;
  color: #4b5563 !important;
  cursor: default !important;
  border-color: #e5e7eb !important;
}
body.wcf-readonly #tab-escenarios .sim-action-bar,
body.wcf-readonly #tab-escenarios #saveScenarioBtn {
  display: none !important;
}


/* ============================================================
   MOBILE / TABLET (<1024px): disable global sticky header & tabs
   so the user recovers vertical space. Desktop unchanged.
   ============================================================ */
@media (max-width: 1023px) {
  :root {
    --sticky-topbar-h: 0px;
    --sticky-tabs-h: 0px;
    --sticky-nav-h: 0px;
  }
  .topbar-v2 {
    position: static !important;
    top: auto !important;
  }
  .tabs-shell {
    position: static !important;
    top: auto !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: transparent;
  }
}

/* ============================================================
   MOBILE / TABLET (<1024px): 13WCF matrix — Option B
   Disable all sticky/frozen behavior in the matrix to avoid
   broken partial freezing (clipping, duplicated headers,
   misaligned columns). One clean horizontally-scrollable table.
   Desktop (>=1024px) preserved exactly.
   ============================================================ */
@media (max-width: 1279px) {
    /* The single scroll context is .mobile-matrix-overlay-body (overflow:auto
       in both axes). The table-wrap MUST NOT introduce its own scroll context
       (overflow-x:auto + overflow-y:visible makes the browser compute both axes
       to auto, which steals the sticky scroll ancestor and breaks thead). */
    .matrix-panel,
    .matrix-panel .table-wrap,
    .executive-table-wrap {
      overflow: visible !important;
      max-height: none !important;
      transform: none !important;
      will-change: auto !important;
      filter: none !important;
    }
    /* Single scroll container: the overlay body handles both axes */
    .mobile-matrix-overlay-body {
      overflow: auto;
      -webkit-overflow-scrolling: touch;
    }
    /* Matrix table must use separate borders for sticky to work */
    .executive-matrix-table {
      border-collapse: separate !important;
      border-spacing: 0 !important;
    }
    .executive-matrix-table thead,
    .matrix-panel thead {
      position: static;
    }
    /* Frozen header row (z:2) */
    .executive-matrix-table thead th,
    .matrix-panel thead th {
      position: sticky !important;
      top: 0 !important;
      z-index: 2 !important;
      background: #f1f5f9 !important;
    }
    /* Frozen Concepto column (z:1) — min-width allows zoom reflow */
    .executive-matrix-table th:first-child,
    .executive-matrix-table td:first-child {
      position: sticky !important;
      left: 0 !important;
      z-index: 1 !important;
      background: #ffffff !important;
      box-shadow: 2px 0 4px -2px rgba(15, 23, 42, 0.12);
      min-width: 180px;
    }
    /* Top-left corner: above both (z:3) */
    .executive-matrix-table thead th:first-child {
      position: sticky !important;
      top: 0 !important;
      left: 0 !important;
      z-index: 3 !important;
      background: #f1f5f9 !important;
    }
    /* Preserve row backgrounds on the frozen column */
    .executive-matrix-table tbody tr.section-header > td:first-child,
    .executive-matrix-table tbody tr.subtotal-row > td:first-child,
    .executive-matrix-table tbody tr.total-row > td:first-child {
      background: #f8fafc !important;
    }
    .exec-row-level1 td:first-child { background: #eef4ff !important; }
    .exec-row-level2 td:first-child { background: #ffffff !important; }
    .exec-row-level3 td:first-child { background: #fcfdff !important; }
    .exec-row-cash td:first-child   { background: #efdada !important; }

    /* Disable the JS floating header — native sticky now handles it cleanly */
    #execFloatingHeader,
    .exec-floating-header,
    .executive-floating-header {
      display: none !important;
    }
  }

  /* Tablet (640–1023px): smaller frozen column + larger touch padding */
  @media (min-width: 640px) and (max-width: 1023px) {
    .executive-matrix-table th:first-child,
    .executive-matrix-table td:first-child {
      min-width: 160px;
    }
    .executive-matrix-table th,
    .executive-matrix-table td {
      padding: 12px 10px;
    }
  }

  /* Mobile (<640px): tighter frozen column + smaller font */
  @media (max-width: 639px) {
    .executive-matrix-table th:first-child,
    .executive-matrix-table td:first-child {
      min-width: 130px;
      font-size: 11px;
    }
    .executive-matrix-table th,
    .executive-matrix-table td {
      padding: 10px 8px;
    }
}

/* ============================================================
   MOBILE / TABLET (<1024px): Cash Flow Bridge — fix overlap
   between title, legend, x-axis labels and value labels.
   Desktop (>=1024px) preserved exactly.
   ============================================================ */
@media (max-width: 1023px) {
  .waterfall-chart-panel {
    padding: 16px 12px 14px;
  }
  .waterfall-panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding-bottom: 10px;
    margin-bottom: 12px;
  }
  .waterfall-panel-header .bridge-headline-title {
    font-size: 15px;
    line-height: 1.25;
  }
  .waterfall-mode-toolbar {
    width: 100%;
    flex-wrap: wrap;
  }
  /* Allow chart to scroll horizontally if too wide for portrait */
  .waterfall-chart-panel .chart-scroll,
  .waterfall-chart-panel > div:has(> canvas) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .waterfall-chart-panel canvas {
    min-height: 340px !important;
    max-width: 100%;
  }
}

/* ============================================================
   MOBILE / TABLET (<1024px): Match desktop layout for the
   matrix + Resumen ejecutivo + Foco ejecutivo block.
   - Matrix renders like web (no frozen rows/columns — already
     handled above).
   - Resumen ejecutivo (.side-panel-premium) sits to the RIGHT
     of the matrix.
   - Foco ejecutivo (variance-explanation) is appended inside
     .matrix-panel after the table by JS, so it naturally
     stays BELOW the matrix.
   Desktop (>=1024px) preserved exactly.
   ============================================================ */
@media (max-width: 1279px) and (min-width: 641px) {
  .dashboard-premium.dashboard-v5 .executive-dashboard-grid,
  .dashboard-grid-premium,
  .executive-dashboard-grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1.6fr) minmax(220px, 0.8fr) !important;
    gap: 14px !important;
    align-items: start !important;
  }
  .side-panel-premium {
    position: static !important;
    top: auto !important;
  }
}
/* Phones (<=640px): stack vertically — matrix on top, side panel below */
@media (max-width: 640px) {
  .dashboard-premium.dashboard-v5 .executive-dashboard-grid,
  .dashboard-grid-premium,
  .executive-dashboard-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }
  .side-panel-premium {
    position: static !important;
    top: auto !important;
  }
}

/* ============================================================
   FROZEN MATRIX HEADER ROW — single source of truth.
   The .executive-table-wrap (or .matrix-panel .table-wrap) IS the
   scroll container. <thead th> sticks to its top.
   Works for desktop and inside the mobile overlay (the overlay's
   own scroll container simply nests harmlessly).
   ============================================================ */
.matrix-panel:not(.matrix-panel--fullscreen) .executive-table-wrap,
.matrix-panel:not(.matrix-panel--fullscreen) .table-wrap {
  overflow: auto !important;
  position: relative !important;
  min-width: 1px !important;
  max-width: 100% !important;
  max-height: calc(100vh - var(--sticky-nav-h, 132px) - 80px) !important;
  padding-bottom: 18px !important;
  padding-right: 14px !important;
  transform: none !important;
  filter: none !important;
  will-change: auto !important;
  scrollbar-gutter: stable;
}

.executive-matrix-table,
.matrix-panel table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  width: max-content !important;
  min-width: 1400px !important;
  max-width: none !important;
}

/* Frozen header row — sticks to the scroll container's top */
.executive-matrix-table thead th,
.matrix-panel thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 2 !important;
  background: #f6f9fd !important;
}

/* Frozen first column (Concepto) — every tbody cell sticks left:0 at ALL zoom levels.
   min-width keeps the column wide enough that horizontal scroll always exists,
   which is what makes left:0 sticky take effect. */
.executive-matrix-table th:first-child,
.executive-matrix-table td:first-child,
.matrix-panel th:first-child,
.matrix-panel td:first-child {
  position: sticky !important;
  left: 0 !important;
  z-index: 2 !important;
  background: #ffffff;
  min-width: 220px !important;
  box-shadow: 8px 0 12px -8px rgba(15, 23, 42, 0.18) !important;
}
.executive-matrix-table tbody tr.exec-row-level1 td:first-child {
  background: #eef4ff !important;
}
.executive-matrix-table tbody tr.exec-row-level2 td:first-child {
  background: #ffffff !important;
}
.executive-matrix-table tbody tr.exec-row-level3 td:first-child {
  background: #fcfdff !important;
}
.executive-matrix-table tbody tr.exec-row-cash td:first-child,
.executive-matrix-table tbody tr.exec-row-subtotal td:first-child {
  background: #f1f5f9 !important;
}

/* Top-left corner: frozen row + frozen column intersection */
.executive-matrix-table thead th:first-child,
.matrix-panel thead th:first-child {
  position: sticky !important;
  top: 0 !important;
  left: 0 !important;
  z-index: 3 !important;
  background: #f6f9fd !important;
}

/* Hide the legacy JS floating duplicate header — native sticky now handles it */
#execFloatingHeader,
.exec-floating-header,
.executive-floating-header {
  display: none !important;
}

/* Executive matrix scroll container: keep a real horizontal overflow context
   so the frozen Concepto column remains sticky even at low zoom. */
.executive-table-wrap {
  max-width: 100% !important;
  overflow: auto !important;
  box-sizing: border-box;
}

.executive-matrix-table {
  width: max-content !important;
  min-width: 1400px !important;
}

.executive-matrix-table th:first-child,
.executive-matrix-table td:first-child {
  position: sticky !important;
  left: 0 !important;
  z-index: 2 !important;
}

.executive-matrix-table thead th:first-child {
  z-index: 4 !important;
  background: #f6f9fd !important;
}

.executive-matrix-table tbody tr.exec-row-level1 td:first-child {
  background: #eef4ff !important;
}

.executive-matrix-table tbody tr.exec-row-level2 td:first-child {
  background: #ffffff !important;
}

.executive-matrix-table tbody tr.exec-row-level3 td:first-child {
  background: #fcfdff !important;
}

.executive-matrix-table tbody tr.exec-row-cash td:first-child {
  background: #efdada !important;
}

.executive-matrix-table tbody tr.exec-row-subtotal td:first-child {
  background: #f3f1eb !important;
}

/* ============================================================
   Dashboard layout v2: matrix full-width, then 2-col footer
   (FOCO EJECUTIVO | RESUMEN EJECUTIVO). Stacks on tablet/mobile.
   ============================================================ */
.executive-matrix-fullwidth {
  width: 100%;
  margin-top: 24px;
}
.executive-bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}
.executive-bottom-panel {
  border-radius: 16px;
  border: 1px solid #ecf0f6;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
  padding: 18px;
  position: static;
  top: auto;
}
.executive-bottom-grid--6040 {
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
}
.executive-bottom-row {
  margin-top: 18px;
}
.executive-bottom-row .executive-bottom-panel {
  width: 100%;
}
@media (max-width: 1023px) {
  .executive-bottom-grid,
  .executive-bottom-grid--6040 {
    grid-template-columns: 1fr;
  }
}

/* ===== Batch diagnostic panels (read-only, admin/super_admin/cfo) ===== */
.batch-diag-summary {
  margin: -12px 0 10px;
  padding: 0 2px;
  background: transparent;
  border: none;
  font-size: 10.5px;
  font-weight: 400;
  line-height: 1.4;
  color: color-mix(in oklab, var(--muted-foreground, #6b7280) 90%, transparent);
  opacity: 0.75;
  letter-spacing: 0;
  text-transform: none;
}
.batch-diag-summary[hidden] { display: none; }
.batch-diag-summary-inner {
  display: inline;
  white-space: nowrap;
}
.batch-diag-filename {
  font-weight: 400;
  color: inherit;
  cursor: help;
}
.batch-diag-sep {
  color: color-mix(in oklab, var(--muted-foreground, #6b7280) 55%, transparent);
}
@media (max-width: 900px) {
  .batch-diag-summary-inner { white-space: normal; }
  .batch-diag-filename {
    display: inline-block;
    max-width: 60vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
  }
}
.data-status-panel { margin: 12px 0; }
.data-status-panel[hidden] { display: none; }
.data-status-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.data-status-table th,
.data-status-table td { padding: 6px 10px; border-bottom: 1px solid color-mix(in oklab, currentColor 8%, transparent); text-align: left; }
.data-status-table th { font-weight: 600; opacity: 0.75; background: color-mix(in oklab, currentColor 3%, transparent); }
.data-status-table tr.is-active-batch { background: color-mix(in oklab, var(--accent, #2563eb) 8%, transparent); }
.data-status-table code { font-size: 12px; }
.batch-diag-pill {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em;
  background: var(--accent, #2563eb); color: #fff;
}
.batch-diag-empty { text-align: center; opacity: 0.6; padding: 12px; }
