@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap");

:root {
  --lyp-blue: #315687;
  --lyp-blue-2: #4972b7;
  --table-header: #4778ad;
  --bg: #eef3f8;
  --panel: #ffffff;
  --ink: #26384f;
  --body: #526278;
  --muted: #6c7a91;
  --line: #d9e1eb;
  --green: #22c777;
  --red: #d41428;
  --dashboard-negative: var(--red);
  --cyan-fill: #cfecf7;
  --pink-fill: #ecd5e9;
  --green-fill: #dcedd5;
  --orange-fill: #f6c6ad;
  --gray-result: #e8e8e8;
  --gray-result-strong: #d1d1d1;
  --good-cell: #b8dcab;
  --bad-cell: #ffd6dc;
  --soft-blue: #eaf2fb;
}

/* Plan vs. Real */
.plan-toolbar {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7f9fc;
}

.plan-toolbar .plan-search-control {
  flex: 1 1 260px;
}

.plan-toolbar input[type="search"] {
  width: 100%;
}

/* Análisis compartido de períodos reales */
.real-period-toolbar {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  margin-bottom: 10px;
  border: 1px solid #cbd9e8;
  border-left: 5px solid var(--lyp-blue);
  border-radius: 10px;
  background: #f5f8fc;
}

.real-period-heading {
  display: grid;
  gap: 2px;
  min-width: 210px;
  margin-right: auto;
  padding-bottom: 5px;
}

.real-period-heading strong {
  color: var(--ink);
  font-size: .8rem;
}

.real-period-heading span {
  color: var(--lyp-blue);
  font-size: .7rem;
  font-weight: 800;
}

.real-period-toolbar label {
  min-width: 155px;
}

.real-period-toolbar select {
  min-width: 155px;
}

.eerr-table th small,
.original-table th small {
  display: block;
  margin-top: 2px;
  color: rgb(255 255 255 / 78%);
  font-size: .58rem;
  font-weight: 600;
}

.plan-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding-bottom: 7px;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 700;
}

.plan-version-status {
  display: inline-flex;
  align-items: center;
  align-self: center;
  min-height: 27px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: .64rem;
  font-weight: 800;
  white-space: nowrap;
}

.plan-version-status.is-current {
  background: #d8f1e4;
  color: #1d744b;
}

.plan-version-status.is-history {
  background: #e7edf4;
  color: #526278;
}

.dot {
  width: 9px;
  height: 9px;
  margin-left: 6px;
  border-radius: 999px;
}

.dot.good { background: #2e9c66; }
.dot.bad { background: #d24b5a; }
.dot.no-plan { background: #d48b1f; }

.plan-note {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 600;
}

.plan-table-wrap {
  max-height: 68vh;
}

.plan-table {
  width: 100%;
  min-width: 900px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--ink);
  font-size: .72rem;
}

.plan-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 9px;
  background: var(--table-header);
  color: #fff;
  text-align: right;
  white-space: nowrap;
}

.plan-table th:first-child {
  text-align: left;
}

.plan-detail-table th:nth-child(2) {
  text-align: left;
}

.plan-table th:last-child,
.plan-table td:last-child {
  text-align: center;
}

.plan-table .plan-col-category { width: 36%; }
.plan-table .plan-col-code { width: 9%; }
.plan-table .plan-col-account { width: 31%; }
.plan-table .plan-col-number { width: 12%; }
.plan-table .plan-col-percent { width: 10%; }
.plan-table .plan-col-status { width: 12%; }

.plan-detail-table {
  min-width: 1080px;
}

.plan-table td {
  padding: 8px 9px;
  border-bottom: 1px solid #e4eaf1;
  background: #fff;
  vertical-align: middle;
}

.plan-table td.amount {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.plan-detail-table td:nth-child(2) {
  overflow-wrap: anywhere;
}

.plan-table tr:hover td {
  background: #f7faff;
}

.plan-table .level-1 td,
.plan-table .level-2 td,
.plan-table .level-4 td {
  font-weight: 800;
}

.plan-table .level-1 td {
  background: #dfe9f5;
  border-top: 2px solid #b5c8dd;
}

.plan-table .level-2 td { background: #edf3f9; }
.plan-table .level-4 td { background: #f5f8fb; }

.plan-table .level-7 td:nth-child(2) {
  padding-left: 22px;
}

.plan-table .level-real-only td:nth-child(2) {
  padding-left: 22px;
}

.plan-table td small {
  display: block;
  margin-top: 3px;
  color: #a46610;
  font-size: .62rem;
  font-weight: 700;
}

.plan-table .row-no-plan td {
  background: #fff8ea;
}

.plan-result-row td {
  border-top: 2px solid #315687;
  background: #eaf2fb;
  font-weight: 800;
}

.status-pill {
  display: inline-flex;
  justify-content: center;
  min-width: 82px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: .62rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-good { background: #d8f1e4; color: #1d744b; }
.status-bad { background: #ffe0e4; color: #a52e3c; }
.status-neutral { background: #e7edf4; color: #526278; }
.status-no-plan { background: #fff0cb; color: #915c0e; }

.plan-company-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 12px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--lyp-blue);
  border-radius: 9px;
  background: #fff;
  color: var(--muted);
  font-size: .7rem;
  font-weight: 700;
}

.plan-company-summary strong {
  color: var(--ink);
  font-size: .8rem;
}

.plan-company-summary .has-alert {
  color: #a46610;
}

.plan-empty {
  margin-top: 10px;
}

@media (max-width: 760px) {
  .real-period-toolbar { align-items: stretch; flex-direction: column; }
  .real-period-heading { min-width: 0; margin-right: 0; }
  .real-period-toolbar label,
  .real-period-toolbar select { width: 100%; min-width: 0; }
  .plan-legend { width: 100%; margin-left: 0; }
  .plan-company-summary { align-items: flex-start; flex-direction: column; gap: 5px; }
  .plan-table { min-width: 820px; }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--body);
  font-family: Montserrat, system-ui, "Segoe UI", Arial, sans-serif;
  font-size: 13px;
  overflow-x: hidden;
}

button,
select,
input {
  font: inherit;
}

.shell {
  display: grid;
  gap: 12px;
  padding: 12px;
  width: 100%;
  max-width: 100vw;
  min-width: 0;
  overflow-x: hidden;
}

.hero,
.upload-strip,
.view-strip,
.panel,
.kpi-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgb(23 42 68 / 5%);
}

.hero {
  padding: 19px 22px;
  border-top: 4px solid var(--lyp-blue);
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--lyp-blue-2);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--ink);
}

h1 {
  font-size: 1.68rem;
  line-height: 1.08;
  font-weight: 600;
}

h2 {
  font-size: 0.95rem;
}

h3 {
  font-size: 0.86rem;
}

.hero p:last-child {
  margin: 8px 0 0;
  max-width: 780px;
  font-weight: 500;
}

.upload-strip {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  min-width: 0;
  overflow: hidden;
}

.upload-primary,
.upload-secondary {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.upload-primary {
  flex: 1 1 auto;
}

.upload-secondary {
  flex: 0 0 auto;
  justify-content: flex-end;
}

.plan-upload-preview {
  margin: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7f9fc;
}

.plan-upload-preview[hidden] { display: none; }

.plan-preview-heading,
.plan-preview-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.plan-preview-badge {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: .65rem;
  font-weight: 800;
  white-space: nowrap;
}

.plan-preview-badge.is-valid { background: #d8f1e4; color: #1d744b; }
.plan-preview-badge.is-invalid { background: #ffe0e4; color: #a52e3c; }

.plan-preview-source {
  margin: 9px 0 12px;
  color: var(--muted);
  font-size: .7rem;
}

.plan-preview-table-wrap { max-height: 300px; }

.plan-preview-table {
  width: 100%;
  min-width: 920px;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--ink);
  font-size: .68rem;
}

.plan-preview-table th {
  padding: 8px;
  background: var(--table-header);
  color: #fff;
  text-align: right;
  white-space: nowrap;
}

.plan-preview-table th:first-child { text-align: left; }
.plan-preview-table td { padding: 8px; border-bottom: 1px solid #e4eaf1; background: #fff; }
.plan-preview-table td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.plan-preview-table .negative { color: var(--red); font-weight: 800; }
.plan-preview-table .preview-ok { color: #1d744b; font-weight: 800; }

.plan-preview-issues {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: .68rem;
}

.plan-preview-issues.is-error { background: #fff0f2; color: #923140; }
.plan-preview-issues.is-warning { background: #fff8e8; color: #815713; }
.plan-preview-issues ul { margin: 7px 0 0; padding-left: 19px; }
.plan-preview-issues li + li { margin-top: 4px; }
.plan-preview-actions { justify-content: flex-end; margin-top: 12px; }

@media (max-width: 760px) {
  .plan-preview-heading { align-items: flex-start; flex-direction: column; }
}

label {
  display: grid;
  gap: 5px;
  color: #65748c;
  font-size: 0.68rem;
  font-weight: 800;
}

select,
input[type="search"] {
  height: 31px;
  min-width: 150px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  padding: 0 10px;
  font-weight: 700;
}

button {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 0 14px;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  filter: brightness(0.98);
}

.primary,
.main-tabs button.active {
  background: var(--table-header);
  border-color: var(--lyp-blue);
  color: white;
}

.danger {
  border-color: #ffb7ba;
  color: #ff4f55;
}

.secondary {
  background: white;
}

.compact {
  width: 86px;
}

.view-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  min-width: 0;
}

.main-tabs {
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 6px;
  background: #f4f7fb;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow-x: auto;
}

.main-tabs button {
  min-width: 118px;
  border: 0;
  background: transparent;
}

.nav-block {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
  border: 1px solid #dfe6ef;
  border-radius: 9px;
  background: #fff;
}

.nav-block + .nav-block {
  position: relative;
  margin-left: 2px;
}

.nav-block-label {
  padding: 0 5px;
  color: var(--muted);
  font-size: .59rem;
  font-weight: 800;
  letter-spacing: .07em;
  line-height: 1.1;
  text-transform: uppercase;
  white-space: nowrap;
}

.nav-block-buttons {
  display: flex;
  gap: 4px;
}

.nav-block-real { border-top: 3px solid #88b7df; }
.nav-block-control { border-top: 3px solid #e7b14d; }
.nav-block-base { border-top: 3px solid #aab4c2; }

.kpi-grid.is-hidden {
  display: none;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.kpi-grid.viewer-kpis {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.kpi-card {
  display: grid;
  align-content: center;
  min-height: 92px;
  gap: 8px;
  padding: 14px 16px;
  border-left: 4px solid var(--lyp-blue);
}

.kpi-card.success {
  border-left-color: var(--green);
}

.kpi-card.warning {
  border-left-color: var(--red);
}

.kpi-card span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.kpi-card strong {
  color: var(--lyp-blue);
  font-size: 1.42rem;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0;
}

.kpi-card em {
  width: max-content;
  border-radius: 999px;
  background: #e5fbff;
  color: #178194;
  padding: 3px 8px;
  font-style: normal;
  font-weight: 800;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 62px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}

.company-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
  max-width: 62%;
}

.company-tabs button {
  position: relative;
  border-top: 4px solid transparent;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.company-tabs button.active,
.company-tabs button[aria-pressed="true"] {
  padding-right: 30px;
  border-color: var(--lyp-blue);
  background: var(--lyp-blue);
  color: #fff;
  box-shadow: 0 5px 12px rgb(49 86 135 / 28%);
  transform: translateY(-1px);
  font-weight: 800;
}

.company-tabs button.active::after,
.company-tabs button[aria-pressed="true"]::after {
  content: "\2713";
  position: absolute;
  top: 50%;
  right: 10px;
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  font-size: .68rem;
  line-height: 1;
  transform: translateY(-50%);
}

.main-panel,
#content {
  min-width: 0;
  max-width: 100%;
}

.main-panel {
  overflow: hidden;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  padding-bottom: 16px;
}

.eerr-table {
  width: max-content;
  min-width: 1420px;
  border-collapse: separate;
  border-spacing: 0;
}

.eerr-table th,
.eerr-table td {
  height: 38px;
  border-bottom: 1px solid #e5ebf2;
  padding: 8px 10px;
  text-align: right;
  white-space: nowrap;
  font-weight: 600;
}

.eerr-table th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--lyp-blue);
  color: white;
  font-weight: 800;
}

.eerr-table th:first-child,
.eerr-table td:first-child {
  width: 120px;
  min-width: 120px;
  max-width: 120px;
  text-align: left;
}

.eerr-table th:nth-child(2),
.eerr-table td:nth-child(2) {
  width: 300px;
  min-width: 300px;
  text-align: left;
}

.eerr-table td:first-child {
  color: var(--lyp-blue);
  font-weight: 800;
}

.eerr-table td:nth-child(2) {
  position: sticky;
  left: 120px;
  z-index: 3;
  background: white;
}

.eerr-table th:first-child,
.eerr-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 4;
  background: white;
}

.eerr-table th:first-child,
.eerr-table th:nth-child(2) {
  background: var(--table-header);
  z-index: 6;
}

.total-income td:first-child,
.total-income td:nth-child(2) {
  background: var(--cyan-fill);
}

.total-cost td:first-child,
.total-cost td:nth-child(2) {
  background: var(--pink-fill);
}

.margin td:first-child,
.margin td:nth-child(2) {
  background: var(--green-fill);
}

.total-expense td:first-child,
.total-expense td:nth-child(2) {
  background: var(--orange-fill);
}

.result td:first-child,
.result td:nth-child(2) {
  background: var(--gray-result);
}

.result-pct td:first-child,
.result-pct td:nth-child(2) {
  background: var(--gray-result-strong);
}

.eerr-table .blank td {
  height: 14px;
  padding: 0;
  background: white;
}

.total-income td:not(:first-child) {
  background: var(--cyan-fill);
  color: var(--ink);
  font-weight: 800;
}

.total-cost td:not(:first-child) {
  background: var(--pink-fill);
  color: var(--ink);
  font-weight: 800;
}

.margin td:nth-child(2),
.margin td:not(:first-child) {
  background: var(--green-fill);
  color: var(--ink);
  font-weight: 800;
}

.total-expense td:not(:first-child) {
  background: var(--orange-fill);
  color: var(--ink);
  font-weight: 800;
}

.result td:nth-child(2) {
  background: var(--gray-result);
  color: #111;
  font-weight: 800;
}

.result-pct td:nth-child(2) {
  background: var(--gray-result-strong);
  color: #111;
  font-weight: 800;
}

.amount.negative,
.negative-number {
  color: var(--red) !important;
  font-weight: 800;
}

.result .amount.positive,
.result-pct .amount.positive {
  background: var(--good-cell);
  color: #0f4e2b;
  font-weight: 800;
}

.result .amount.negative,
.result-pct .amount.negative {
  background: var(--bad-cell);
  color: var(--red);
  font-weight: 800;
}

.dashboard {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.dashboard-metrics,
.dashboard-grid {
  display: grid;
  gap: 10px;
}

.dashboard-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-grid {
  grid-template-columns: 1.35fr 1fr;
}

.dash-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfe;
  overflow: hidden;
}

.dash-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
  background: white;
}

.metric-card {
  min-height: 88px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfe;
}

.metric-card span,
.dash-card header span,
.rank-row span,
.insight-card span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.metric-card strong {
  color: var(--ink);
  font-size: 1.25rem;
}

.metric-card em {
  color: var(--body);
  font-style: normal;
  font-weight: 700;
}

.rank-row {
  display: grid;
  grid-template-columns: 170px minmax(120px, 1fr) 110px;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  border-bottom: 1px solid #edf1f5;
}

.rank-row strong:last-child {
  color: var(--ink);
  text-align: right;
}

.bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4eaf2;
}

.bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--lyp-blue);
}

.bar i.negative {
  background: var(--red);
}

.insight-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.insight-card {
  display: grid;
  gap: 4px;
  padding: 12px 13px;
  border-bottom: 1px solid #edf1f5;
  border-right: 1px solid #edf1f5;
}

.insight-card:nth-child(2n) {
  border-right: 0;
}

.insight-card strong {
  color: var(--ink);
  font-size: 0.8rem;
}

.unknown-table,
.homologation-table {
  display: grid;
  max-height: 390px;
  overflow: auto;
}

.unknown-row,
.unknown-head {
  display: grid;
  grid-template-columns: 140px 100px minmax(280px, 1fr) 270px;
  gap: 10px;
  align-items: center;
  padding: 8px 13px;
  border-bottom: 1px solid #edf1f5;
}

.unknown-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7f9fc;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.unknown-row strong {
  color: var(--ink);
}

.unknown-row select {
  width: 100%;
}

.homologation-filter {
  display: flex;
  gap: 10px;
  align-items: end;
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
}

.homologation-filter input {
  min-width: 320px;
}

.is-collapsed {
  display: none;
}

.empty-state {
  padding: 18px;
  color: var(--muted);
  font-weight: 700;
}


@media (max-width: 980px) {
  .upload-strip,
  .view-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .kpi-grid,
  .dashboard-metrics,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

#uploadPanel.is-collapsed { display:none; }


/* Regla única: toda cifra negativa usa el rojo de Plan vs. Real */
.dashboard-negative,
.kpi-card strong.dashboard-negative,
.metric-card strong.dashboard-negative,
.metric-card em.dashboard-negative,
.insight-card strong.dashboard-negative,
.insight-card em.dashboard-negative,
.rank-row strong.amount.negative {
  color: var(--red);
}

/* Acceso servidor */
.hero { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.user-box { display: grid; justify-items: end; gap: 3px; flex: 0 0 auto; }
.user-box span { color: var(--ink); font-weight: 800; }
.user-box small { color: var(--muted); font-weight: 700; }
.user-box a { color: var(--lyp-blue); font-size: .72rem; font-weight: 800; text-decoration: none; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-shell { width: min(430px, 100%); }
.login-card { background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--lyp-blue); border-radius: 14px; padding: 28px; box-shadow: 0 10px 30px rgb(23 42 68 / 10%); }
.login-card > p { margin: 10px 0 20px; }
.login-form { display: grid; gap: 14px; }
.login-form input { height: 40px; width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 0 11px; color: var(--ink); }
.login-form button { width: 100%; margin-top: 4px; }
.login-error { margin: 0 0 14px; padding: 10px 12px; border-radius: 8px; background: #fff0f2; color: #a63848; font-weight: 700; }
@media (max-width: 700px) { .hero { align-items: flex-start; flex-direction: column; } .user-box { justify-items: start; } }


/* EERR original sin homologacion */
.original-view {
  min-width: 0;
}

.original-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px 10px;
}

.original-toolbar > div {
  display: grid;
  gap: 3px;
}

.original-toolbar strong {
  color: var(--ink);
  font-size: .92rem;
}

.original-toolbar span {
  color: var(--muted);
  font-size: .76rem;
  font-weight: 700;
}

.original-note {
  margin: 0;
  padding: 0 16px 14px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
}

.original-table-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  max-height: 68vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.original-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--ink);
  font-size: .7rem;
}

.original-table th,
.original-table td {
  border-bottom: 1px solid #e5ebf2;
  padding: 8px;
  white-space: nowrap;
  vertical-align: middle;
}

.original-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  min-width: 118px;
  padding: 10px 8px;
  background: var(--table-header);
  color: white;
  text-align: right;
  font-weight: 800;
}

.original-table th:first-child,
.original-table td:first-child {
  position: sticky;
  left: 0;
  min-width: 440px;
  max-width: 440px;
  text-align: left;
}

.original-table th:first-child {
  z-index: 5;
  background: var(--table-header);
}

.original-table td:first-child {
  z-index: 2;
  background: white;
  color: var(--ink);
}

.original-table td:not(:first-child) {
  min-width: 150px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.original-table tr.original-summary td {
  color: var(--ink);
  font-weight: 800;
}

.original-table tr.original-detail td:first-child {
  padding-left: 28px;
}

.original-table .level-1 td {
  background: #dfe9f5;
  border-top: 2px solid #b5c8dd;
}

.original-table .level-2 td { background: #edf3f9; }
.original-table .level-4 td { background: #f5f8fb; }

.original-table .original-result-row td {
  background: #f0f0f0;
  font-weight: 800;
}

.original-table tr:hover td {
  background: #f7faff;
}

.original-table td.negative {
  color: var(--red);
}

.original-table .original-total-header {
  background: var(--table-header);
}

.original-table .original-total {
  background: #f3f7fb;
  font-weight: 800;
}

.original-empty {
  min-height: 120px;
  display: grid;
  place-items: center;
}

/* Información base: Plan estandarizado */
.standardized-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7f9fc;
}

.standardized-summary {
  display: grid;
  gap: 4px;
}

.standardized-actions {
  display: flex;
  align-items: end;
  gap: 12px;
}

.standardized-toolbar strong {
  color: var(--ink);
  font-size: .8rem;
}

.standardized-toolbar span,
.standardized-note {
  color: var(--muted);
  font-size: .7rem;
  font-weight: 600;
}

.standardized-actions label:last-child {
  min-width: 300px;
}

.standardized-toolbar input[type="search"] {
  width: 100%;
}

.standardized-note {
  margin: 0 0 10px;
}

.standardized-table-wrap {
  max-height: 68vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.standardized-table {
  width: 100%;
  min-width: 1950px;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--ink);
  font-size: .7rem;
}

.standardized-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  min-width: 118px;
  padding: 10px 8px;
  background: var(--table-header);
  color: #fff;
  text-align: right;
  font-weight: 800;
  white-space: nowrap;
}

.standardized-table th:first-child,
.standardized-table th:nth-child(2),
.standardized-table th:nth-child(3) {
  text-align: left;
}

.standardized-table th:first-child { min-width: 82px; }
.standardized-table th:nth-child(2) { min-width: 310px; }
.standardized-table th:nth-child(3) { min-width: 205px; }

.standardized-table td {
  padding: 8px;
  border-bottom: 1px solid #e4eaf1;
  background: #fff;
  vertical-align: middle;
}

.standardized-table td.amount {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.standardized-table td.negative { color: var(--red); }
.standardized-table .standardized-total { background: #f3f7fb; font-weight: 800; }
.standardized-table tr:hover td { background: #f7faff; }
.standardized-table .level-1 td,
.standardized-table .level-2 td,
.standardized-table .level-4 td { font-weight: 800; }
.standardized-table .level-1 td { background: #dfe9f5; border-top: 2px solid #b5c8dd; }
.standardized-table .level-2 td { background: #edf3f9; }
.standardized-table .level-4 td { background: #f5f8fb; }
.standardized-table .level-7 td:nth-child(2) { padding-left: 22px; }
.standardized-table .standardized-result-row td { background: #f0f0f0; font-weight: 800; }
.standardized-empty { min-height: 120px; display: grid; place-items: center; }

@media (max-width: 980px) {
  .main-tabs {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .main-tabs button {
    min-width: 0;
  }

  .nav-block-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav-block-real .nav-block-buttons {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .standardized-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .standardized-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .standardized-toolbar label {
    min-width: 0;
  }

  .original-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .original-toolbar button {
    width: 100%;
  }

  .original-table th:first-child,
  .original-table td:first-child {
    min-width: 300px;
    max-width: 300px;
  }
}

@media (max-width: 600px) {
  .original-table th:first-child,
  .original-table td:first-child {
    min-width: 245px;
    max-width: 245px;
  }

  .original-table th,
  .original-table td,
  .original-table td:not(:first-child) {
    min-width: 132px;
  }
}

/* Selector múltiple de empresas en Consolidado */
.company-tabs.group-tabs {
  max-width: 74%;
}

.company-tabs.group-tabs button {
  transition: background-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.company-tabs.group-tabs button.active,
.company-tabs.group-tabs button[aria-pressed="true"] {
  background: var(--lyp-blue);
  box-shadow: 0 5px 12px rgb(49 86 135 / 28%);
  color: #fff;
  transform: translateY(-1px);
}

@media (max-width: 980px) {
  .company-tabs.group-tabs {
    max-width: 100%;
    justify-content: flex-start;
  }
}
