:root {
  --bg: #f3efe7;
  --surface: rgba(255, 252, 247, 0.88);
  --surface-strong: #fffdf9;
  --ink: #182126;
  --muted: #5d676f;
  --line: rgba(24, 33, 38, 0.1);
  --accent: #a24626;
  --accent-soft: rgba(162, 70, 38, 0.12);
  --olive: #2e584f;
  --olive-soft: rgba(46, 88, 79, 0.14);
  --gold: #b38a33;
  --danger: #b94b4b;
  --shadow: 0 24px 60px rgba(45, 43, 36, 0.12);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --dashboard-tone: var(--accent);
  --dashboard-tone-soft: var(--accent-soft);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    "Avenir Next",
    "Segoe UI",
    "Helvetica Neue",
    sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(179, 138, 51, 0.15), transparent 28%),
    radial-gradient(circle at top right, rgba(46, 88, 79, 0.18), transparent 24%),
    linear-gradient(180deg, #f8f5ef 0%, #f0e8db 100%);
}

body.presentation-mode {
  background:
    radial-gradient(circle at top left, rgba(179, 138, 51, 0.22), transparent 25%),
    linear-gradient(180deg, #efe6d7 0%, #e6dcc9 100%);
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 28px;
  padding: 24px;
}

.sidebar {
  position: sticky;
  top: 24px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-height: calc(100vh - 48px);
  padding: 28px;
  background: rgba(24, 33, 38, 0.92);
  color: #f6f0e7;
  border-radius: 30px;
  box-shadow: var(--shadow);
}

.brand h1,
.hero h2,
.section-heading h3,
.dashboard-copy h4 {
  margin: 0;
  font-family:
    "Iowan Old Style",
    "Baskerville",
    "Times New Roman",
    serif;
  line-height: 0.98;
}

.brand h1 {
  font-size: 2.3rem;
  margin-top: 0;
  color: #f6f0e7;
}

.brand p,
.sidebar-card p,
.hero-copy,
.architecture-item p,
.dashboard-copy p,
.detail-list li,
.table td,
.table th,
.metric-card p,
.metric-card span,
.hero-metric span,
.insight-card p {
  line-height: 1.55;
}

.brand-kicker,
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 500;
}

.brand-kicker {
  color: rgba(246, 240, 231, 0.7);
}

.eyebrow {
  color: var(--dashboard-tone);
}

.nav {
  display: grid;
  gap: 10px;
}

.nav a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  color: #f6f0e7;
  text-decoration: none;
  background: var(--dashboard-tone-soft, rgba(255, 255, 255, 0.04));
  border: 1px solid color-mix(in srgb, var(--dashboard-tone, rgba(255, 255, 255, 0.18)) 38%, rgba(255, 255, 255, 0.08));
  transition:
    transform 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}

.nav a:hover,
.nav a.active {
  transform: translateX(4px);
  background: color-mix(in srgb, var(--dashboard-tone-soft, rgba(255, 255, 255, 0.08)) 78%, rgba(255, 255, 255, 0.08));
  border-color: color-mix(in srgb, var(--dashboard-tone, rgba(255, 255, 255, 0.2)) 55%, rgba(255, 255, 255, 0.12));
}

.nav a.active {
  box-shadow: inset 3px 0 0 var(--dashboard-tone, rgba(255, 255, 255, 0.18));
}

.nav span {
  color: rgba(246, 240, 231, 0.62);
  font-size: 0.8rem;
}

.sidebar-card,
.hero,
.architecture-card,
.summary-card,
.dashboard-card,
.metric-card,
.insight-card,
.chart-card,
.table-card {
  background: var(--surface);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: var(--shadow);
}

.sidebar-card {
  margin-top: auto;
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
}

.main {
  display: grid;
  gap: 28px;
}

.hero,
.architecture-card,
.summary-card,
.dashboard-card {
  border-radius: var(--radius-xl);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.8fr);
  gap: 20px;
  padding: 30px;
}

.hero h2 {
  margin-top: 10px;
  font-size: clamp(2.4rem, 4vw, 4rem);
}

.hero-copy {
  max-width: 68ch;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-panel {
  display: grid;
  gap: 12px;
}

.hero-metric {
  padding: 18px;
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(255, 251, 245, 0.65)),
    var(--surface-strong);
  border: 1px solid var(--line);
}

.hero-metric strong {
  display: block;
  margin-top: 6px;
  font-size: 2rem;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 18px;
  margin-bottom: 20px;
}

.architecture-card,
.summary-card {
  padding: 28px;
}

.architecture-grid,
.kpi-grid {
  display: grid;
  gap: 16px;
}

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

.architecture-item {
  padding: 20px;
  border-radius: 22px;
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.96), rgba(246, 240, 231, 0.72)),
    var(--surface-strong);
  border: 1px solid var(--line);
}

.architecture-item h4 {
  margin: 12px 0 10px;
  font-size: 1.2rem;
}

.architecture-item ul,
.detail-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

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

.balance-toolbar,
.balance-kpis {
  display: grid;
  gap: 16px;
}

.balance-toolbar {
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
  margin-bottom: 18px;
}

.balance-switch,
.balance-state {
  border: 1px solid var(--line);
  border-radius: 22px;
}

.balance-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(247, 242, 235, 0.84)),
    var(--surface-strong);
}

.balance-chip {
  appearance: none;
  border: 0;
  min-width: 72px;
  padding: 14px 18px;
  border-radius: 16px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.balance-chip:hover {
  transform: translateY(-1px);
}

.balance-chip.active {
  background: var(--ink);
  color: #fff7ee;
}

.balance-state {
  padding: 18px 20px;
  background:
    radial-gradient(circle at top left, rgba(46, 88, 79, 0.12), transparent 28%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(247, 242, 235, 0.82));
}

.balance-state strong {
  display: block;
  margin-top: 6px;
  font-size: 1.5rem;
}

.balance-state p {
  margin: 10px 0 0;
  color: var(--muted);
}

.balance-kpis {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

.pyg-switch {
  margin-bottom: 18px;
  width: fit-content;
}

.ratios-switch {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.ratios-history-card {
  padding: 16px;
}

.ratios-history-layout {
  display: block;
}

.ratios-history-copy {
  display: grid;
  gap: 10px;
}

.ratios-history-label {
  color: var(--muted);
  font-size: 0.95rem;
}

.ratios-history-table {
  table-layout: fixed;
}

.ratios-history-table th,
.ratios-history-table td {
  text-align: center;
  padding: 8px 6px;
}

.ratios-history-value {
  white-space: nowrap;
}

.ratio-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  padding: 6px 12px;
  border-radius: 999px;
  color: #fffdf9;
  font-weight: 500;
}

.ratio-pill-max {
  background: rgba(185, 75, 75, 0.92);
}

.ratio-pill-min {
  background: rgba(46, 88, 79, 0.9);
}

.pyg-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 14px;
}

.ratios-kpis {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ventas-panel-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 18px;
}

.ventas-tree-shell,
.ventas-pyramid-shell {
  width: 100%;
  border-radius: 18px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(243, 239, 231, 0.62)),
    #fff;
  border: 1px solid var(--line);
}

.ventas-tree-shell {
  min-height: 500px;
}

.ventas-pyramid-shell {
  min-height: 190px;
}

.ventas-tree-shell svg,
.ventas-pyramid-shell svg {
  display: block;
  width: 100%;
  height: 100%;
}

.ventas-pending-card p {
  margin: 0;
  color: var(--muted);
}

.ventas-comparison-card {
  margin-top: 16px;
  padding: 12px !important;
}

.ventas-label-cell {
  padding-left: 12px !important;
  padding-right: 12px !important;
  border-radius: 0;
  color: #ffffff !important;
}

.ventas-comparison-table .col-concepto {
  width: 24%;
}

.ventas-comparison-table .col-year,
.ventas-comparison-table .col-var,
.ventas-comparison-table .col-pct {
  width: 19%;
}

.ventas-comparison-card h5 {
  margin-bottom: 10px;
}

.ventas-comparison-card .table th,
.ventas-comparison-card .table td {
  padding-top: 6px;
  padding-bottom: 6px;
}

.clients-kpis,
.clients-concentration-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.clients-concentration-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.clients-control-row {
  display: grid;
  gap: 14px;
  margin: 16px 0;
}

.clients-switch {
  display: flex;
  flex-wrap: wrap;
}

.clients-summary-card,
.clients-ranking-card {
  margin-top: 16px;
}

.clients-summary-controls {
  display: grid;
  gap: 12px;
  margin: 14px 0 16px;
}

.clients-list-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  margin-bottom: 12px;
}

.clients-search {
  display: grid;
  gap: 6px;
  min-width: 260px;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.clients-search input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  padding: 10px 14px;
  font: inherit;
  color: var(--ink);
  letter-spacing: normal;
  text-transform: none;
}

.clients-search input:focus {
  outline: 2px solid rgba(63, 142, 136, 0.18);
  border-color: rgba(63, 142, 136, 0.5);
}

.clients-summary-table .col-section {
  width: 22%;
}

.clients-summary-table .col-sales {
  width: 18%;
}

.clients-summary-table .col-clients {
  width: 12%;
}

.clients-summary-table .col-operations {
  width: 12%;
}

.clients-summary-table .col-ticket {
  width: 20%;
}

.clients-summary-table th,
.clients-summary-table td {
  white-space: nowrap;
}

.clients-summary-total td {
  background: rgba(191, 146, 60, 0.08);
  font-weight: 600;
}

.clients-ranking-table .col-concepto {
  width: 46%;
}

.clients-ranking-table .col-year,
.clients-ranking-table .col-pct {
  width: 18%;
}

.clients-full-table .col-section {
  width: 18%;
}

.clients-full-table .col-client {
  width: 58%;
}

.clients-full-table .col-sales {
  width: 24%;
}

.clients-full-total td {
  background: rgba(24, 33, 38, 0.05);
  font-weight: 500;
}

.tesoreria-stack {
  display: grid;
  gap: 18px;
}

.tesoreria-card {
  margin-top: 0;
}

.tesoreria-chart-shell {
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(246, 240, 231, 0.82)),
    var(--surface-strong);
  padding: 14px 16px 12px;
  margin: 14px 0 16px;
}

.tesoreria-split {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 18px;
  align-items: start;
}

.tesoreria-table .col-concepto {
  width: 36%;
}

.tesoreria-table .col-year {
  width: 26%;
}

.tesoreria-table .col-var,
.tesoreria-table .col-pct {
  width: 19%;
}

.tesoreria-table--distribution .col-concepto {
  width: 50%;
}

.tesoreria-table--distribution .col-year,
.tesoreria-table--distribution .col-pct {
  width: 25%;
}

.tesoreria-history-table {
  margin-top: 6px;
}

.tesoreria-history-table th,
.tesoreria-history-table td {
  white-space: nowrap;
}

.beneficios-card {
  margin-top: 0;
}

.beneficios-table .col-benef-year {
  width: 14%;
}

.beneficios-table .col-benef-amount {
  width: 28%;
}

.beneficios-table .col-benef-total {
  width: 30%;
}

.informe-dashboard {
  display: grid;
  gap: 18px;
}

.informe-lead p,
.informe-section p {
  max-width: none;
}

.informe-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.informe-section {
  min-height: 180px;
}

.balance-details {
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(246, 240, 231, 0.82)),
    var(--surface-strong);
  overflow: hidden;
}

.balance-details summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  cursor: pointer;
  font-weight: 500;
  list-style: none;
}

.balance-details summary::-webkit-details-marker {
  display: none;
}

.balance-details-hint {
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 400;
}

.balance-details-panel {
  padding: 0 22px 22px;
}

.balance-details-header h5 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.balance-details-header p {
  margin: 0 0 16px;
  color: var(--muted);
}

.balance-full-table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 253, 249, 0.9);
}

.balance-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  gap: 16px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}

.balance-row:last-child {
  border-bottom: 0;
}

.balance-row.section,
.balance-row.total {
  background: rgba(24, 33, 38, 0.05);
  font-weight: 500;
}

.balance-row.group {
  background: rgba(162, 70, 38, 0.05);
  font-weight: 500;
}

.balance-row-label.level-1 {
  padding-left: 18px;
}

.balance-row-label.level-2 {
  padding-left: 36px;
  color: var(--muted);
}

.balance-row-value {
  text-align: right;
  font-weight: 500;
}

.metric-card {
  padding: 20px;
  border-radius: 22px;
  border: 1px solid var(--line);
}

.metric-card strong {
  display: block;
  margin: 14px 0 4px;
  font-size: clamp(1.8rem, 2.8vw, 2.8rem);
  line-height: 1;
  font-weight: 600;
}

.metric-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.metric-card.positive {
  background: linear-gradient(180deg, rgba(46, 88, 79, 0.12), rgba(255, 255, 255, 0.9));
}

.metric-card.warning {
  background: linear-gradient(180deg, rgba(179, 138, 51, 0.14), rgba(255, 255, 255, 0.92));
}

.metric-card.alert {
  background: linear-gradient(180deg, rgba(185, 75, 75, 0.12), rgba(255, 255, 255, 0.9));
}

.presentation-toggle {
  border: 0;
  background: var(--ink);
  color: #fff7ee;
  padding: 12px 16px;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.dashboards {
  display: grid;
  gap: 24px;
}

.dashboard-card {
  padding: 28px;
  position: relative;
  overflow: hidden;
}

.dashboard-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--dashboard-tone), transparent 72%);
  opacity: 0.95;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 18px;
  margin-bottom: 22px;
}

.dashboard-copy h4 {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  margin-top: 8px;
}

.dashboard-copy p {
  margin: 12px 0 0;
  max-width: 70ch;
  color: var(--muted);
}

.dashboard-deck {
  max-width: 74ch;
  color: color-mix(in srgb, var(--dashboard-tone) 34%, var(--muted));
  font-size: 1rem;
  line-height: 1.5;
}

.dashboard-tag {
  padding: 10px 12px;
  border-radius: 999px;
  background: var(--dashboard-tone-soft);
  color: var(--dashboard-tone);
  font-size: 0.82rem;
  font-weight: 500;
}

.dashboard-theme-balance {
  --dashboard-tone: #557a72;
  --dashboard-tone-soft: rgba(85, 122, 114, 0.14);
}

.dashboard-theme-pyg {
  --dashboard-tone: #b56a4a;
  --dashboard-tone-soft: rgba(181, 106, 74, 0.14);
}

.dashboard-theme-explotacion {
  --dashboard-tone: #5f7f97;
  --dashboard-tone-soft: rgba(95, 127, 151, 0.14);
}

.dashboard-theme-ratios {
  --dashboard-tone: #b08c37;
  --dashboard-tone-soft: rgba(176, 140, 55, 0.14);
}

.dashboard-theme-ventas {
  --dashboard-tone: #a87347;
  --dashboard-tone-soft: rgba(168, 115, 71, 0.14);
}

.dashboard-theme-clientes {
  --dashboard-tone: #8d6757;
  --dashboard-tone-soft: rgba(141, 103, 87, 0.14);
}

.dashboard-theme-tesoreria {
  --dashboard-tone: #4a8c8a;
  --dashboard-tone-soft: rgba(74, 140, 138, 0.14);
}

.dashboard-theme-beneficios {
  --dashboard-tone: #8d7a39;
  --dashboard-tone-soft: rgba(141, 122, 57, 0.14);
}

.dashboard-theme-informe {
  --dashboard-tone: #7b6c61;
  --dashboard-tone-soft: rgba(123, 108, 97, 0.14);
}

.nav-theme-balance {
  --dashboard-tone: #557a72;
  --dashboard-tone-soft: rgba(85, 122, 114, 0.18);
}

.nav-theme-pyg {
  --dashboard-tone: #b56a4a;
  --dashboard-tone-soft: rgba(181, 106, 74, 0.18);
}

.nav-theme-explotacion {
  --dashboard-tone: #5f7f97;
  --dashboard-tone-soft: rgba(95, 127, 151, 0.18);
}

.nav-theme-ratios {
  --dashboard-tone: #b08c37;
  --dashboard-tone-soft: rgba(176, 140, 55, 0.18);
}

.nav-theme-ventas {
  --dashboard-tone: #a87347;
  --dashboard-tone-soft: rgba(168, 115, 71, 0.18);
}

.nav-theme-clientes {
  --dashboard-tone: #8d6757;
  --dashboard-tone-soft: rgba(141, 103, 87, 0.18);
}

.nav-theme-tesoreria {
  --dashboard-tone: #4a8c8a;
  --dashboard-tone-soft: rgba(74, 140, 138, 0.18);
}

.nav-theme-beneficios {
  --dashboard-tone: #8d7a39;
  --dashboard-tone-soft: rgba(141, 122, 57, 0.18);
}

.nav-theme-informe {
  --dashboard-tone: #7b6c61;
  --dashboard-tone-soft: rgba(123, 108, 97, 0.18);
}

.dashboard-layout {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
}

.balance-layout {
  grid-template-columns: 1fr;
}

.pyg-layout {
  grid-template-columns: 1.05fr 0.95fr;
}

.pyg-top-layout {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 14px;
}

.balance-main-column {
  display: grid;
  gap: 18px;
}

.chart-column,
.insight-column {
  display: grid;
  gap: 18px;
}

.chart-card,
.insight-card,
.table-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
}

.chart-card h5,
.insight-card h5,
.table-card h5 {
  margin: 0 0 14px;
  font-size: 1rem;
  font-weight: 500;
}

.chart-shell {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(243, 239, 231, 0.62)),
    #fff;
  border: 1px solid var(--line);
}

.balance-chart-shell {
  aspect-ratio: auto;
  min-height: 78px;
}

.pyg-chart-shell {
  aspect-ratio: auto;
  min-height: 114px;
}

.pyg-bottom-chart {
  margin-top: 14px;
}

.pyg-dashboard {
  padding: 22px;
}

.pyg-dashboard .dashboard-header {
  margin-bottom: 14px;
}

.pyg-dashboard .dashboard-copy p {
  margin-top: 8px;
  font-size: 0.98rem;
}

.pyg-dashboard .metric-card {
  padding: 16px;
}

.pyg-dashboard .metric-card strong {
  margin: 10px 0 2px;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
}

.pyg-dashboard .table-card,
.pyg-dashboard .chart-card {
  padding: 16px;
}

.pyg-dashboard .table th,
.pyg-dashboard .table td {
  padding: 7px 0;
}

.insight-card {
  background:
    radial-gradient(circle at top left, rgba(162, 70, 38, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(247, 242, 235, 0.88));
}

.insight-card p {
  margin: 0;
  color: var(--muted);
}

.detail-list {
  display: grid;
  gap: 12px;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 10px 0;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.table th {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

.table tr:last-child td {
  border-bottom: 0;
}

.balance-main-cell {
  font-weight: 500;
  color: #b38a33;
}

.balance-amount-cell {
  font-weight: 500;
  white-space: nowrap;
}

.explotacion-card .table {
  table-layout: fixed;
}

.explotacion-table .col-concepto {
  width: 38%;
}

.explotacion-table .col-year,
.explotacion-table .col-var {
  width: 20.666%;
}

.ratios-table .col-concepto {
  width: 30%;
}

.ratios-table .col-year,
.ratios-table .col-var,
.ratios-table .col-pct {
  width: 17.5%;
}

.explotacion-table th,
.explotacion-table td,
.ratios-table th,
.ratios-table td {
  border-right: 1px solid var(--line);
}

.explotacion-table th:last-child,
.explotacion-table td:last-child,
.ratios-table th:last-child,
.ratios-table td:last-child {
  border-right: 0;
}

.explotacion-table th:nth-child(2),
.explotacion-table th:nth-child(3),
.explotacion-table th:nth-child(4),
.ratios-table th:nth-child(2),
.ratios-table th:nth-child(3),
.ratios-table th:nth-child(4),
.ratios-table th:nth-child(5),
.explotacion-num,
.explotacion-var,
.ratios-num,
.ratios-var {
  text-align: right;
}

.explotacion-table th:nth-child(2),
.explotacion-table th:nth-child(3),
.explotacion-table th:nth-child(4),
.ratios-table th:nth-child(2),
.ratios-table th:nth-child(3),
.ratios-table th:nth-child(4),
.ratios-table th:nth-child(5) {
  text-align: center;
}

.explotacion-sections-wrap {
  overflow-x: auto;
}

.explotacion-sections-head {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.explotacion-sections-switch {
  flex-wrap: wrap;
  width: 100%;
}

.explotacion-sections-switch .balance-chip {
  min-width: 0;
}

.explotacion-sections-table {
  min-width: 1220px;
}

.explotacion-sections-table--single {
  min-width: 0;
}

.explotacion-sections-table .col-concepto {
  width: 28%;
}

.explotacion-sections-table .col-year {
  width: 9%;
}

.explotacion-sections-table--single .col-concepto {
  width: 66%;
}

.explotacion-sections-table--single .col-year {
  width: 34%;
}

.explotacion-sections-wrap--single {
  overflow-x: visible;
}

.explotacion-chart-card {
  margin-bottom: 18px;
}

.explotacion-chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.explotacion-chart-head h5 {
  margin-bottom: 6px;
}

.explotacion-chart-head p {
  margin: 0;
  color: var(--muted);
}

.explotacion-margin-badge {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(128, 149, 80, 0.14);
  color: var(--olive);
  font-size: 0.94rem;
  font-weight: 500;
  white-space: nowrap;
}

.explotacion-bars-list {
  display: grid;
  gap: 12px;
}

.explotacion-bar-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(260px, 1.4fr) minmax(140px, 0.5fr);
  align-items: center;
  gap: 16px;
}

.explotacion-bar-row-label {
  color: var(--ink);
  font-weight: 500;
}

.explotacion-bar-track {
  position: relative;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(242, 239, 232, 0.9), rgba(235, 233, 228, 0.6));
  overflow: hidden;
}

.explotacion-bar-fill {
  height: 100%;
  border-radius: inherit;
}

.explotacion-bar-row-value {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 500;
  text-align: right;
}

.operativa-bar-ventas .explotacion-bar-fill {
  background: #9f7947;
}

.operativa-bar-compras .explotacion-bar-fill {
  background: #efd3a0;
}

.operativa-bar-servicios .explotacion-bar-fill {
  background: #e8be86;
}

.operativa-bar-personal .explotacion-bar-fill {
  background: #cf9157;
}

.operativa-bar-amortizaciones .explotacion-bar-fill {
  background: #b97543;
}

.operativa-bar-resultado .explotacion-bar-fill {
  background: #7f9250;
}

.operativa-bar-row--result .explotacion-bar-row-label,
.operativa-bar-row--result .explotacion-bar-row-value {
  font-weight: 600;
}

.client-metric-cell {
  display: grid;
  gap: 2px;
}

.client-metric-main {
  display: block;
}

.client-metric-share {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
}

.delta-up {
  color: var(--olive);
  font-weight: 500;
}

.delta-down {
  color: var(--danger);
  font-weight: 500;
}

.delta-flat {
  color: var(--gold);
  font-weight: 500;
}

.chart-hover-point,
.chart-hover-bar {
  cursor: pointer;
}

.chart-tooltip {
  position: fixed;
  z-index: 1000;
  max-width: 240px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(24, 33, 38, 0.94);
  color: #fffdf9;
  font-size: 0.84rem;
  line-height: 1.3;
  box-shadow: 0 10px 28px rgba(24, 33, 38, 0.18);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.chart-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.presentation-mode .sidebar,
.presentation-mode .hero,
.presentation-mode .architecture-card,
.presentation-mode .summary-card,
.presentation-mode .dashboard-card {
  transform: scale(1.002);
}

.presentation-mode .dashboard-card {
  scroll-margin-top: 26px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    min-height: auto;
  }

  .architecture-grid,
  .kpi-grid,
  .balance-toolbar,
  .balance-kpis,
  .pyg-kpis,
  .ratios-kpis,
  .clients-kpis,
  .clients-concentration-grid,
  .ventas-panel-grid,
  .dashboard-layout,
  .hero {
    grid-template-columns: 1fr;
  }

  .tesoreria-split {
    grid-template-columns: 1fr;
  }

  .informe-sections {
    grid-template-columns: 1fr;
  }

  .clients-list-header {
    align-items: stretch;
    flex-direction: column;
  }

  .clients-search {
    min-width: 0;
  }

}

@media (max-width: 720px) {
  .app-shell {
    padding: 14px;
    gap: 18px;
  }

  .sidebar,
  .hero,
  .architecture-card,
  .summary-card,
  .dashboard-card {
    padding: 20px;
    border-radius: 22px;
  }

  .brand h1 {
    font-size: 2rem;
  }

  .hero h2 {
    font-size: 2.3rem;
  }
}
