/* ──────────────────────────────────────────────
   Reset & tokens — Conocimiento Ganadero theme
   ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Brand */
  --purple:         #6c22d4;
  --purple-hover:   #5a1ab8;
  --purple-light:   rgba(108,34,212,0.1);
  --purple-border:  rgba(108,34,212,0.3);

  /* Surfaces */
  --bg:          #f8f7f3;
  --surface:     #eeecea;
  --surface-2:   #e4e1db;
  --card:        #ffffff;
  --header-bg:   #181818;

  /* Text */
  --text:        #0d0d0d;
  --text-muted:  #555555;
  --text-faint:  #888888;

  /* Borders */
  --border:      #e0ddd6;
  --border-dark: rgba(255,255,255,0.12);

  /* Semantic */
  --success:     #2d7a3a;
  --success-bg:  #e6f4ea;
  --warning:     #966b00;
  --warning-bg:  #fef9e7;
  --danger:      #b04040;
  --danger-bg:   #fdecea;

  /* Fonts */
  --font-display: 'Suez One', serif;
  --font-ui:      'Barlow', sans-serif;
  --font-body:    'Open Sans', sans-serif;

  /* Layout */
  --radius:    6px;
  --radius-sm: 3px;
  --max-w:     1100px;
  --nav-h:     0px;
  --ease:      0.18s ease;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--purple); text-underline-offset: 3px; }
a:hover { color: var(--purple-hover); }

/* ──────────────────────────────────────────────
   Layout shell — app-shell: header fijo, sidebar + main en fila
   ────────────────────────────────────────────── */
:root { --sidebar-w: 210px; }

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-areas: "sidebar main";
  height: 100vh;
  overflow: hidden;
}

/* header/footer obsoletos — ocultos pero mantenidos por compatibilidad */
.header, .footer { display: none; }

/* ──────────────────────────────────────────────
   Sidebar top: brand + auth
   ────────────────────────────────────────────── */
.sidebar-top {
  padding: 0.85rem 0.75rem 0.6rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-shrink: 0;
}
.sidebar-top .btn-auth {
  margin-left: 0;
  width: 100%;
  text-align: center;
  justify-content: center;
}

/* ──────────────────────────────────────────────
   Sidebar
   ────────────────────────────────────────────── */
.sidebar {
  grid-area: sidebar;
  background: var(--header-bg);
  overflow-y: auto;
  border-right: 1px solid rgba(255,255,255,0.06);
}

.sidebar .tab-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.75rem 0.5rem;
}

.sidebar .tab-btn {
  justify-content: flex-start;
  text-align: left;
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.9rem;
  font-size: 11.5px;
  width: 100%;
}

/* Mobile: sidebar como barra horizontal en la parte superior */
@media (max-width: 767px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "sidebar"
      "main";
    height: 100dvh;
  }
  .sidebar-top {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
  }
  .sidebar-top .brand-client { display: none; }
  .sidebar-top .btn-auth { width: auto; }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    overflow-x: auto;
    overflow-y: hidden;
  }

  .sidebar .tab-nav {
    flex-direction: row;
    padding: 0.4rem 0.75rem;
    gap: 0.15rem;
    white-space: nowrap;
  }

  .sidebar .tab-btn {
    width: auto;
    padding: 0.35rem 0.85rem;
    font-size: 11px;
    border-radius: 100px;
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-icon {
  height: 28px;
  width: auto;
  display: block;
  filter: brightness(0) invert(1);
  opacity: 0.9;
}

.brand-sep {
  display: block;
  width: 1px;
  height: 16px;
  background: var(--border-dark);
  flex-shrink: 0;
}

.brand-client {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.85);
  white-space: nowrap;
}

/* Tab navigation — base (overridden per context: sidebar / mobile) */
.tab-nav {
  display: flex;
  gap: 0.15rem;
}

.tab-btn {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.4rem 1rem;
  border-radius: 100px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  transition: all var(--ease);
  white-space: nowrap;
}

.tab-btn:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
}

.tab-btn.active {
  color: #fff;
  background: var(--purple);
}

.tab-btn--link {
  display: block;
  text-decoration: none;
  text-align: center;
}

.btn-auth {
  margin-left: auto;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  padding: 0.4rem 1.1rem;
  border-radius: 100px;
  border: 1px solid rgba(255,255,255,0.25);
  background: transparent;
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  transition: all var(--ease);
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-auth:hover {
  border-color: rgba(255,255,255,0.6);
  color: #fff;
  background: rgba(255,255,255,0.08);
}

/* ──────────────────────────────────────────────
   Buttons
   ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 0.5rem 1.25rem;
  border-radius: 100px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--ease);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--purple);
  color: #fff;
  border-color: var(--purple);
}
.btn-primary:hover { background: var(--purple-hover); border-color: var(--purple-hover); }

.btn-outline {
  background: transparent;
  color: var(--purple);
  border-color: var(--purple-border);
}
.btn-outline:hover { background: var(--purple-light); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface); color: var(--text); }

.btn-lg { padding: 0.7rem 1.75rem; font-size: 14px; }
.btn-sm { padding: 0.3rem 0.85rem; font-size: 12px; }

/* ──────────────────────────────────────────────
   Main area
   ────────────────────────────────────────────── */
.main {
  grid-area: main;
  padding: 2rem 1.5rem;
  overflow-y: auto;
  min-width: 0;
}

/* ──────────────────────────────────────────────
   Utility
   ────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ──────────────────────────────────────────────
   Login card (BAFO not authed)
   ────────────────────────────────────────────── */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--nav-h) - 80px);
}

.login-card {
  text-align: center;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2.5rem 2rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.login-icon {
  height: 48px;
  width: auto;
  filter: hue-rotate(0deg);
  opacity: 0.8;
}

.login-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--text);
  letter-spacing: 0.01em;
}

.login-body {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.65;
}

/* ──────────────────────────────────────────────
   BAFO dashboard
   ────────────────────────────────────────────── */
.panel-bafo {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.selector-label {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.select-field {
  appearance: none;
  -webkit-appearance: none;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 2.25rem 0.5rem 0.85rem;
  min-width: 260px;
  cursor: pointer;
  outline: none;
  transition: border-color var(--ease);
}
.select-field:focus { border-color: var(--purple); }
.select-field:disabled { opacity: 0.5; cursor: not-allowed; }

.select-arrow {
  position: absolute;
  right: 0.7rem;
  width: 10px;
  height: 6px;
  color: var(--text-muted);
  pointer-events: none;
}

.status-text {
  font-size: 12px;
  color: var(--text-faint);
  font-style: italic;
}

/* BAFO chart area */
.chart-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.chart-meta {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  width: 100%;
}

.chart-meta-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.chart-meta-label {
  font-size: 13px;
  color: var(--text-muted);
}

.chart-meta-open {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-faint);
  text-decoration: none;
}
.chart-meta-open:hover { color: var(--purple); }

.chart-area {
  position: relative;
  width: 100%;
  height: 580px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.state-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 14px;
  padding: 2rem;
  text-align: center;
}

.state-icon {
  width: 40px;
  height: 40px;
  color: var(--text-faint);
}

.chart-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: white;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* BAFO table */
.bafo-table-wrapper {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  width: 100%;
}

.bafo-table-scroll {
  overflow-x: auto;
}

.bafo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  white-space: nowrap;
}

.bafo-table thead th {
  padding: 0.45rem 0.85rem;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  text-align: right;
}
.bafo-table thead th:first-child { text-align: left; }

.bafo-table tbody tr:not(:last-child) td { border-bottom: 1px solid var(--border); }
.bafo-table tbody tr:hover td { background: var(--surface); }

.bafo-table td { padding: 0.4rem 0.85rem; }

.tbl-category {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12px;
  color: var(--text);
  text-align: left;
  min-width: 130px;
}

.tbl-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
  min-width: 52px;
}
.tbl-value:not(:empty) { color: var(--text-muted); }

.bafo-table tbody tr.tbl-total-row td {
  border-top: 2px solid var(--border);
  background: var(--surface);
}

.tbl-total-label {
  font-weight: 600;
  color: var(--text);
}

.tbl-total {
  font-weight: 600;
  color: var(--text);
}

.tbl-loading {
  padding: 1rem 0.85rem;
  color: var(--text-muted);
  font-size: 12px;
}

.tbl-campo-start td { border-top: 1px solid var(--border); }
.tbl-campo-name { font-weight: 600 !important; color: var(--text) !important; }

/* ──────────────────────────────────────────────
   KPI cards (saldo anual BAFO)
   ────────────────────────────────────────────── */
.global-kpi {
  display: flex;
  gap: 1rem;
  max-width: var(--max-w);
  margin: 0 auto;
  width: 100%;
}

.kpi-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid currentColor;
}

.kpi-card-label {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.6;
}

.kpi-card-value {
  font-family: var(--font-ui);
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.kpi-positive {
  color: #2d7a3a;
  background: rgba(45, 122, 58, 0.06);
  border-color: rgba(45, 122, 58, 0.25) !important;
}

.kpi-negative {
  color: var(--danger);
  background: rgba(176, 64, 64, 0.06);
  border-color: rgba(176, 64, 64, 0.25) !important;
}

.kpi-card-sep {
  margin-top: 0.55rem;
}

/* ──────────────────────────────────────────────
   Gráfico Chart.js
   ────────────────────────────────────────────── */
.global-chart-wrapper {
  width: 100%;
  margin: 0 auto;
  height: 400px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 1.25rem 1rem 1rem;
  box-sizing: border-box;
}

.global-breakdown {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: var(--max-w);
  margin: 0 auto;
  width: 100%;
}

.global-breakdown-summary {
  padding: 0.65rem 1rem;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.global-breakdown-summary::-webkit-details-marker { display: none; }
.global-breakdown-summary:hover { color: var(--purple); }

.global-breakdown-body {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* URL setup */
.url-setup {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: var(--max-w);
  margin: 0 auto;
  width: 100%;
}

.url-setup-summary {
  padding: 0.6rem 0.9rem;
  font-size: 12px;
  color: var(--text-faint);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.url-setup-summary::-webkit-details-marker { display: none; }
.url-setup-summary:hover { color: var(--purple); }

.url-setup-body {
  padding: 0.75rem 0.9rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.url-setup-hint { font-size: 12px; color: var(--text-muted); line-height: 1.6; }

.url-setup-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.url-input {
  flex: 1;
  min-width: 0;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem;
  outline: none;
  transition: border-color var(--ease);
}
.url-input:focus { border-color: var(--purple); }
.url-input::placeholder { color: var(--text-faint); }

/* ──────────────────────────────────────────────
   Calculadora de Negocios
   ────────────────────────────────────────────── */
.panel-calc {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 2rem;
  align-items: start;
}

.calc-form { display: flex; flex-direction: column; gap: 1.5rem; }

.calc-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.calc-section-title {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.75rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.calc-fields {
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.field-row.triple { grid-template-columns: 1fr 1fr 1fr; }
.field-row.full   { grid-template-columns: 1fr; }

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.field label {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.field input,
.field select {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem;
  outline: none;
  transition: border-color var(--ease);
  width: 100%;
}
.field input:focus,
.field select:focus { border-color: var(--purple); background: var(--card); }

.field select { appearance: none; -webkit-appearance: none; cursor: pointer; }

.field-hint {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: -0.15rem;
}

.stage-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.stage-panel-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  background: var(--surface);
  user-select: none;
  transition: background var(--ease);
}
.stage-panel-header:hover { background: var(--card); }

.stage-panel-active .stage-panel-header {
  background: rgba(108,34,212,0.06);
  border-bottom: 1px solid var(--purple-border);
}

.stage-checkbox {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--purple);
  flex-shrink: 0;
}

.stage-panel-name {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.stage-panel-body {
  padding: 1rem 1.1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Results panel */
.calc-results {
  position: sticky;
  top: calc(var(--nav-h) + 1rem);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.results-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.results-header {
  padding: 0.85rem 1.25rem;
  background: var(--header-bg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.results-title {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
}

.results-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.result-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.result-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.result-value {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.result-row.divider { border-top: 1px solid var(--border); padding-top: 0.75rem; }

.result-row.highlight .result-label { font-weight: 600; color: var(--text); }
.result-row.highlight .result-value { font-size: 16px; }

.result-row.pos .result-value { color: var(--success); }
.result-row.neg .result-value { color: var(--danger); }
.result-row.warn .result-value { color: var(--warning); }

/* Margen badge */
.margen-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  gap: 0.5rem;
}
.margen-badge.pos { background: var(--success-bg); }
.margen-badge.neg { background: var(--danger-bg); }
.margen-badge.warn { background: var(--warning-bg); }

.margen-label {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.margen-badge.pos .margen-label { color: var(--success); }
.margen-badge.neg .margen-label { color: var(--danger); }
.margen-badge.warn .margen-label { color: var(--warning); }

.margen-pct {
  font-family: var(--font-display);
  font-size: 2rem;
  line-height: 1;
}
.margen-badge.pos .margen-pct { color: var(--success); }
.margen-badge.neg .margen-pct { color: var(--danger); }
.margen-badge.warn .margen-pct { color: var(--warning); }

/* ──────────────────────────────────────────────
   Tablero de Gestión
   ────────────────────────────────────────────── */
.panel-tablero { display: flex; flex-direction: column; gap: 1.5rem; }

.tablero-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.tablero-title-block {}

.tablero-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--text);
}

.tablero-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.tablero-scenario {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.scenario-label {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.scenario-btn {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  padding: 0.3rem 0.85rem;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--ease);
}
.scenario-btn:hover { color: var(--text); }
.scenario-btn.active {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
}

/* Metric grid */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.metric-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transition: box-shadow var(--ease);
}
.metric-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.06); }

.metric-top {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.metric-icon {
  width: 36px;
  height: 36px;
  background: var(--purple-light);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.metric-info { flex: 1; min-width: 0; }

.metric-label {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
  line-height: 1.2;
}

.metric-unit {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 0.1rem;
}

.metric-edit-btn {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  padding: 0.2rem 0.65rem;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  transition: all var(--ease);
  flex-shrink: 0;
}
.metric-edit-btn:hover {
  border-color: var(--purple-border);
  color: var(--purple);
  background: var(--purple-light);
}

.metric-values {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
}

.metric-actual {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--text);
  line-height: 1;
}

.metric-sep { font-size: 1.2rem; color: var(--text-faint); }

.metric-target {
  font-size: 1rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.metric-unit-val {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-faint);
  margin-left: 0.2rem;
}

/* Progress bar */
.metric-progress-wrap { display: flex; flex-direction: column; gap: 0.3rem; }

.metric-bar-track {
  height: 6px;
  background: var(--surface);
  border-radius: 100px;
  overflow: hidden;
}

.metric-bar-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.4s ease;
}
.metric-bar-fill.good { background: var(--success); }
.metric-bar-fill.mid  { background: var(--warning); }
.metric-bar-fill.low  { background: var(--purple); }

.metric-pct-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.metric-pct {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.metric-remaining {
  font-size: 11px;
  color: var(--text-faint);
}

.metric-note {
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.5;
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}

/* Breakdown table inside card */
.metric-breakdown {
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.breakdown-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 11px;
}

.breakdown-campo { color: var(--text-muted); flex: 1; }
.breakdown-vals {
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
  white-space: nowrap;
}
.breakdown-vals strong { color: var(--text); }

.breakdown-mini {
  width: 50px;
  height: 3px;
  background: var(--surface-2);
  border-radius: 100px;
  overflow: hidden;
}
.breakdown-mini-fill {
  height: 100%;
  background: var(--purple);
  border-radius: 100px;
  opacity: 0.5;
}

/* ──────────────────────────────────────────────
   Edit Modal
   ────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-box {
  background: var(--card);
  border-radius: var(--radius);
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.modal-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  transition: all var(--ease);
}
.modal-close:hover { background: var(--surface); color: var(--text); }

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-field { display: flex; flex-direction: column; gap: 0.3rem; }

.modal-field label {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.modal-field input,
.modal-field textarea {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.85rem;
  outline: none;
  transition: border-color var(--ease);
  width: 100%;
}
.modal-field input:focus,
.modal-field textarea:focus { border-color: var(--purple); background: var(--card); }

.modal-field textarea {
  resize: vertical;
  min-height: 70px;
  font-size: 13px;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* ──────────────────────────────────────────────
   Footer
   ────────────────────────────────────────────── */
.footer {
  background: var(--header-bg);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 12px;
  color: rgba(255,255,255,0.3);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-export {
  font-family: var(--font-ui);
  font-size: 11px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.3);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn-export:hover { color: rgba(255,255,255,0.7); }

/* ──────────────────────────────────────────────
   Responsive
   ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .panel-calc { grid-template-columns: 1fr; }
  .calc-results { position: static; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .main { padding: 1.25rem 1rem; }
  .tab-nav { gap: 0.1rem; }
  .tab-btn { padding: 0.35rem 0.6rem; font-size: 11px; letter-spacing: 0.04em; }
  .brand-client { display: none; }
  .brand-sep { display: none; }
  .metric-grid { grid-template-columns: 1fr; }
  .field-row, .field-row.triple { grid-template-columns: 1fr; }
  .chart-area { height: 400px; }
  .select-field { min-width: 0; width: 100%; }
}

/* ──────────────────────────────────────────────
   WhatsApp CTA card
   ────────────────────────────────────────────── */
.wa-card {
  background: #e9fbe9;
  border: 1px solid #b7e4b7;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.wa-icon {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  background: #25d366;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wa-icon svg { width: 20px; height: 20px; fill: #fff; }
.wa-body { flex: 1; min-width: 0; }
.wa-name {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  color: #1a5e1a;
}
.wa-desc {
  font-size: 11px;
  color: #3a7a3a;
  line-height: 1.5;
  margin-top: 0.1rem;
}
.wa-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  padding: 0.45rem 1.1rem;
  border-radius: 100px;
  background: #25d366;
  color: #fff;
  text-decoration: none;
  border: none;
  white-space: nowrap;
  transition: background var(--ease);
  flex-shrink: 0;
  letter-spacing: 0.03em;
}
.wa-btn:hover { background: #1dae55; color: #fff; }

/* ──────────────────────────────────────────────
   Protocolos — layout compartido
   ────────────────────────────────────────────── */
.panel-venta,
.panel-pesada {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.proto-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 2rem;
  align-items: start;
}
.proto-form  { display: flex; flex-direction: column; gap: 1.5rem; }
.proto-results {
  position: sticky;
  top: calc(var(--nav-h) + 1rem);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Guía / recordatorio */
.proto-guide {
  background: var(--warning-bg);
  border: 1px solid rgba(150,107,0,0.25);
  border-radius: var(--radius);
  padding: 0.85rem 1.25rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.proto-guide-icon { font-size: 18px; flex-shrink: 0; line-height: 1.4; }
.proto-guide-body { flex: 1; }
.proto-guide-title {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--warning);
  margin-bottom: 0.3rem;
}
.proto-guide-list { list-style: none; display: flex; flex-direction: column; gap: 0.2rem; }
.proto-guide-list li {
  font-size: 12px;
  color: #7a5500;
  padding-left: 1.1rem;
  position: relative;
  line-height: 1.5;
}
.proto-guide-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--warning);
  font-size: 11px;
  top: 1px;
}

/* Engrase selector */
.engrase-selector { display: flex; gap: 0.4rem; }
.engrase-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.6rem 0.4rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  transition: all var(--ease);
}
.engrase-btn:hover { border-color: var(--purple-border); background: var(--purple-light); }
.engrase-btn.active { background: var(--purple); border-color: var(--purple); color: #fff; }
.engrase-num { font-family: var(--font-display); font-size: 1.25rem; line-height: 1; }
.engrase-label {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  color: var(--text-muted);
  white-space: nowrap;
}
.engrase-btn.active .engrase-label { color: rgba(255,255,255,0.8); }

/* Destino selector */
.destino-tabs { display: flex; gap: 0.5rem; }
.destino-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  transition: all var(--ease);
  font-family: var(--font-ui);
}
.destino-tab:hover { border-color: var(--purple-border); }
.destino-tab.active { background: var(--purple); border-color: var(--purple); color: #fff; }
.destino-tab-label { font-size: 14px; font-weight: 700; }
.destino-tab-sub   { font-size: 11px; opacity: 0.65; letter-spacing: 0.02em; }

/* Compradores comparison */
.compradores-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.compradores-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  background: var(--header-bg);
}
.compradores-title {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
}
.compradores-body {
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-x: auto;
}
.compradores-empty {
  text-align: center;
  padding: 1.25rem;
  font-size: 13px;
  color: var(--text-faint);
}
.compradores-cols,
.comprador-row {
  display: grid;
  grid-template-columns: 2fr 1.4fr 1fr 62px 1fr 28px;
  gap: 0.5rem;
  align-items: center;
  min-width: 520px;
}
.compradores-cols { padding: 0 0.5rem; }
.compradores-cols span {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.compradores-cols span:last-child,
.compradores-cols span:nth-child(5) { text-align: right; }
.comprador-row {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.5rem;
}
.comprador-row input,
.comprador-row select {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.5rem;
  outline: none;
  transition: border-color var(--ease);
  width: 100%;
}
.comprador-row input:focus,
.comprador-row select:focus { border-color: var(--purple); }
.c-neto {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  color: var(--success);
  text-align: right;
  white-space: nowrap;
}
.c-remove {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  text-align: center;
  transition: color var(--ease);
}
.c-remove:hover { color: var(--danger); }

/* Ayuno indicator */
.ayuno-indicator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
}
.ayuno-indicator.ayuno-ok    { background: var(--success-bg); color: var(--success); }
.ayuno-indicator.ayuno-short { background: var(--warning-bg); color: var(--warning); }
.ayuno-indicator.ayuno-long  { background: var(--danger-bg);  color: var(--danger);  }
.ayuno-hours { font-family: var(--font-display); font-size: 1.5rem; line-height: 1; }

/* Pesada big result */
.pesada-big-result { text-align: center; padding: 0.5rem 0 0.75rem; }
.pesada-big-value  { font-family: var(--font-display); font-size: 2.5rem; color: var(--text); line-height: 1; }
.pesada-big-unit   { font-size: 13px; color: var(--text-muted); margin-top: 0.25rem; }

@media (max-width: 900px) {
  .proto-layout  { grid-template-columns: 1fr; }
  .proto-results { position: static; }
}
@media (max-width: 640px) {
  .engrase-btn   { padding: 0.5rem 0.25rem; }
  .engrase-label { display: none; }
  .wa-card { flex-wrap: wrap; }
}

/* ──────────────────────────────────────────────
   Checklist de Venta
   ────────────────────────────────────────────── */
.venta-prog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.venta-prog-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--text);
  display: block;
}
.venta-prog-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 0.1rem;
  display: block;
}
.venta-prog-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
  min-width: 180px;
}
.venta-prog-count {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}
.venta-progress-track {
  width: 100%;
  height: 5px;
  background: var(--surface);
  border-radius: 100px;
  overflow: hidden;
}
.venta-progress-fill {
  height: 100%;
  background: var(--success);
  border-radius: 100px;
  transition: width 0.35s ease;
}

/* Checklist items */
.checklist { display: flex; flex-direction: column; gap: 0.75rem; }

.check-item {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--ease), background var(--ease);
}
.check-item.done { border-color: #a8d8a8; background: #f6fbf6; }

.check-item-head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.9rem 1.25rem;
}
.check-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all var(--ease);
}
.check-item.done .check-num {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.check-title-wrap { flex: 1; min-width: 0; }
.check-title {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  display: block;
}
.check-subtitle {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 0.1rem;
  display: block;
}
.check-done-btn {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  padding: 0.3rem 0.85rem;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--ease);
  white-space: nowrap;
  flex-shrink: 0;
}
.check-done-btn:hover { border-color: #2d7a3a; color: #2d7a3a; background: #e6f4ea; }
.check-item.done .check-done-btn {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.check-body {
  border-top: 1px solid var(--border);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.check-item.done .check-body { border-top-color: #c8e8c8; }

/* Fotos guide */
.fotos-guide {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.fotos-guide-item {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.85rem;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.55;
}
.fotos-guide-item strong {
  display: block;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
  margin-bottom: 0.3rem;
}

/* Suplementación toggle */
.supl-toggle { display: flex; gap: 0.4rem; }
.supl-btn {
  padding: 0.35rem 1.1rem;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: transparent;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--ease);
  color: var(--text-muted);
}
.supl-btn:hover { color: var(--text); border-color: var(--text-muted); }
.supl-btn.active { background: var(--purple); border-color: var(--purple); color: #fff; }

/* Acción final — enviar a Fernando */
.venta-action {
  background: #e9fbe9;
  border: 1.5px solid #b7e4b7;
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}
.venta-action-inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.venta-action-body { flex: 1; min-width: 0; }
.venta-action-title {
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 700;
  color: #1a5e1a;
}
.venta-action-sub {
  font-size: 12px;
  color: #3a7a3a;
  margin-top: 0.25rem;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .fotos-guide { grid-template-columns: 1fr; }
  .check-subtitle { display: none; }
  .venta-prog-right { min-width: 0; width: 100%; }
}

/* ──────────────────────────────────────────────
   Feedlot 2 etapas
   ────────────────────────────────────────────── */
.feedlot-etapa {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.feedlot-etapa-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.feedlot-etapa-title {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.feedlot-etapa-badge {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.15rem 0.55rem;
  border-radius: 100px;
  background: var(--purple-light);
  color: var(--purple);
  border: 1px solid var(--purple-border);
}

.feedlot-etapa-badge.badge-b {
  background: rgba(45,122,58,0.1);
  color: var(--success);
  border-color: rgba(45,122,58,0.25);
}

/* ──────────────────────────────────────────────
   Gastos comerciales divididos
   ────────────────────────────────────────────── */
.gastos-grupo {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.gastos-grupo-label {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.4rem 0.85rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.gastos-grupo .calc-fields { padding: 0.85rem; }

/* ──────────────────────────────────────────────
   Historial inline (al fondo de la calculadora)
   ────────────────────────────────────────────── */
.hist-inline-wrap {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}

.hist-inline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.historial-lista {
  display: flex;
  flex-direction: row;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.historial-empty {
  padding: 1.5rem 2rem;
  color: var(--text-muted);
  font-size: 13px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  line-height: 1.7;
  white-space: nowrap;
}

.historial-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 210px;
  flex-shrink: 0;
  transition: box-shadow var(--ease);
}
.historial-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.06); }

.historial-card-nombre {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.historial-card-meta {
  font-size: 10px;
  color: var(--text-faint);
}

.historial-card-results {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.5rem 0.65rem;
  background: var(--surface);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}

.historial-result {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.historial-result.pos { color: var(--success); }
.historial-result.neg { color: var(--danger); }

.historial-result-label {
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}

.historial-sep {
  border-left: 1px solid var(--border);
  padding-left: 0.45rem;
  margin-left: 0.15rem;
}

.historial-card-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.1rem;
}

/* Guardar escenario btn */
.btn-guardar {
  width: 100%;
  justify-content: center;
  border-style: dashed;
}

/* ──────────────────────────────────────────────
   App-level login overlay
   ────────────────────────────────────────────── */
.app-login-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Header user info */
.header-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.header-user-email {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  font-family: var(--font-ui);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
