/* ============================================================
   menta tech · Brand tokens
   ============================================================ */
:root {
  --menta-black: #232533;
  --menta-blue: #315DF5;
  --white: #FFFFFF;
  --light-gray: #F2F2F2;
  --border: #E6E6EC;
  --text-muted: #6B6E7E;
  --success: #1B9E5A;
  --warning: #B45309;
  --danger:  #B91C1C;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  overflow-x: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 300;
  color: var(--menta-black);
  background: var(--white);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-align: left;
}
strong, b { font-weight: 700; }
a { color: var(--menta-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   1. AUTH SCREEN (passphrase gate)
   ============================================================ */
#auth-screen {
  position: fixed; inset: 0; z-index: 100;
  background: linear-gradient(135deg, #315DF5 0%, #232533 70%);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
#auth-screen.hidden { display: none; }
.auth-card {
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  width: 100%; max-width: 420px;
  color: var(--white);
}
.auth-logo {
  display: flex; align-items: center;
  margin-bottom: 32px;
}
.auth-logo img { height: 32px; width: auto; }
.auth-title { font-size: 24px; font-weight: 300; margin-bottom: 8px; line-height: 1.2; }
.auth-sub { font-size: 12px; font-weight: 300; opacity: 0.75; margin-bottom: 32px; }
.auth-field { margin-bottom: 16px; }
.auth-field label {
  display: block; font-size: 11px; opacity: 0.75;
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px;
}
.auth-field input {
  width: 100%; padding: 12px 14px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 300;
  outline: none; transition: border 0.2s;
}
.auth-field input:focus { border-color: var(--white); }
.auth-btn {
  width: 100%; padding: 12px 14px; margin-top: 8px;
  background: var(--white); color: var(--menta-black);
  border: none; border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: transform 0.1s;
}
.auth-btn:hover { transform: translateY(-1px); }
.auth-error {
  font-size: 12px; color: #FFB4B4; margin-top: 10px;
  min-height: 14px;
}
.auth-foot {
  margin-top: 28px; padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.12);
  font-size: 11px; opacity: 0.6; line-height: 1.5;
}

/* ============================================================
   2. PORTAL LAYOUT
   ============================================================ */
.portal { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }

/* --- Sidebar --- */
.sidebar {
  position: sticky; top: 0; align-self: start;
  height: 100vh;
  background: var(--menta-black);
  color: var(--white);
  padding: 32px 24px;
  display: flex; flex-direction: column;
}
.sidebar-logo {
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 40px;
}
.sidebar-logo img { height: 28px; width: auto; }

.client-tag {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 32px;
}
.client-tag .label { font-size: 10px; opacity: 0.55; text-transform: uppercase; letter-spacing: 0.5px; }
.client-tag .name { font-weight: 700; font-size: 15px; margin-top: 4px; }
.client-tag .period { font-size: 12px; opacity: 0.75; margin-top: 2px; }

.nav { list-style: none; flex: 1; }
.nav li a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin-bottom: 2px;
  font-size: 13px; font-weight: 300;
  color: rgba(255,255,255,0.7);
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}
.nav li a:hover { background: rgba(255,255,255,0.06); color: var(--white); }
.nav li a.active { background: var(--menta-blue); color: var(--white); }
.nav-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px;
  background: rgba(255,255,255,0.10);
  border-radius: 4px;
  font-size: 10px; font-weight: 700;
}
.nav li a.active .nav-num { background: rgba(255,255,255,0.18); }

.sidebar-foot {
  border-top: 1px solid rgba(255,255,255,0.10);
  padding-top: 16px; margin-top: 16px;
  font-size: 10px; opacity: 0.55; line-height: 1.6;
}

/* --- Main content --- */
/* min-width: 0 destraba el grid item 1fr para que NO crezca por min-content
   de hijos con white-space:nowrap (history-table) u otros bloqueos.
   Sin esto, .main se desborda hacia la derecha y body{overflow-x:hidden}
   oculta el overflow → el padding derecho queda fuera del viewport. */
.main { background: var(--white); min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 100px;
  border-bottom: 1px solid var(--border);
  background: var(--white);
  position: sticky; top: 0; z-index: 10;
  /* topbar también es un descendiente del 1fr track; lo blindamos igual */
  min-width: 0;
}

.breadcrumb { font-size: 12px; color: var(--text-muted); }
.breadcrumb .sep { margin: 0 6px; opacity: 0.5; }
.topbar .actions { display: flex; gap: 8px; }
.btn-ghost, .btn-primary {
  padding: 8px 14px; border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif; font-size: 12px; font-weight: 700;
  cursor: pointer; border: 1px solid var(--border);
  background: var(--white); color: var(--menta-black);
  transition: border 0.15s, background 0.15s;
}
.btn-ghost:hover { border-color: var(--menta-black); }
.btn-primary {
  background: var(--menta-blue); color: var(--white); border-color: var(--menta-blue);
}
.btn-primary:hover { filter: brightness(1.08); }

.content {
  padding: 56px 100px;
  max-width: 1320px;
  margin: 0 auto;
  /* Permite que el contenido se encoja al ancho asignado por .main
     en lugar de crecer por min-content de sus hijos. */
  min-width: 0;
}
.section { margin-bottom: 88px; scroll-margin-top: 80px; }
.section-head { margin-bottom: 32px; }
.section-eyebrow {
  font-size: 11px; font-weight: 700;
  color: var(--menta-blue);
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 8px;
}
.section-title { font-size: 24px; font-weight: 300; letter-spacing: -0.3px; }
.section-sub { font-size: 13px; color: var(--text-muted); margin-top: 6px; max-width: 720px; }

/* --- Section 1: Month selector --- */
.month-selector {
  display: inline-block;
  background: rgba(49,93,245,0.08);
  border: 1px solid rgba(49,93,245,0.25);
  border-radius: 8px;
  padding: 4px 30px 4px 10px;
  font-family: 'Inter', sans-serif;
  font-size: 18px;
  font-weight: 300;
  color: var(--menta-black);
  letter-spacing: -0.3px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='none' stroke='%23315DF5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5l3 3 3-3'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: background-color 0.15s, border-color 0.15s;
}
.month-selector:hover { background-color: rgba(49,93,245,0.14); border-color: rgba(49,93,245,0.4); }
.month-selector:focus { outline: none; border-color: var(--menta-blue); box-shadow: 0 0 0 3px rgba(49,93,245,0.15); }
.section-title-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* --- Section 1: Balance (Maria's PDF format — beige + brand blue highlights, uniform rows) --- */
.hero-card {
  background: linear-gradient(135deg, #315DF5 0%, #232533 100%);
  border-radius: var(--radius-lg);
  padding: 32px;
  color: var(--white);
  margin-bottom: 28px;
}
.hero-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.hero-metric .label {
  font-size: 11px; opacity: 0.7; text-transform: uppercase; letter-spacing: 0.6px;
  margin-bottom: 8px;
}
.hero-metric .value { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }
.hero-metric .sub { font-size: 11px; opacity: 0.65; margin-top: 4px; }

.balance-table {
  background: #F5EFE5;
  border-radius: var(--radius-md);
  padding: 8px 32px 0;
  color: var(--menta-black);
  overflow: hidden;
}
.balance-row {
  display: grid;
  grid-template-columns: 1fr 70px 140px;
  align-items: center;
  min-height: 52px;
  padding: 10px 0;
  font-size: 13px;
  line-height: 1.4;
}
.balance-row .desc { color: var(--menta-black); padding-right: 16px; }
.balance-row .desc .note {
  display: block;
  font-size: 11px;
  color: #6B6E7E;
  margin-top: 2px;
  font-style: italic;
  line-height: 1.35;
}
.balance-row .pct {
  text-align: center;
  font-weight: 700;
  color: var(--menta-black);
  font-size: 13px;
}
.balance-row .amount {
  font-weight: 400;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.balance-row.bold .desc,
.balance-row.bold .amount { font-weight: 700; }
.balance-row.bold {
  /* no borders — visual weight comes from bold text only */
}

/* Blue highlight rows — uniform with rest */
.balance-row.highlight {
  background: #315DF5;
  color: #FFFFFF;
  margin: 0 -32px;
  padding: 14px 32px;
  border: none;
  min-height: 52px;
}
.balance-row.highlight ~ .balance-row.highlight {
  margin-top: 8px;  /* gap beige entre las dos filas highlight, funciona con row-ajustes (hidden o visible) entre medio */
}
.balance-row.highlight .desc,
.balance-row.highlight .amount,
.balance-row.highlight .pct { color: var(--white); font-weight: 700; }
.balance-row.highlight .desc .note {
  color: rgba(255,255,255,0.78);
  font-style: normal;
  font-weight: 400;
  font-size: 11px;
}

.balance-footnote {
  background: #FFFFFF;
  margin: 0;
  padding: 2px 32px 0 32px;
  font-size: 11px;
  color: #6B6E7E;
  font-style: italic;
}

/* --- Section 2 helpers --- */
.status-stack {
  display: flex; flex-direction: column;
  gap: 4px; align-items: flex-start;
}
.status-chip.small {
  font-size: 10px; padding: 3px 8px; font-weight: 700;
}

/* --- Section 2 · History table (restaurado + responsive) --- */
.history-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--white);
}
.history-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
}
.history-table th {
  text-align: left;
  font-weight: 700;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 14px 14px;
  background: var(--light-gray);
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  line-height: 1.25;
}
.history-table th.num,
.history-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.history-table td {
  padding: 14px 14px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}
.history-table tr:last-child td { border-bottom: none; }
.history-table tr.current { background: rgba(49,93,245,0.04); }
.history-table tr.current td { font-weight: 700; }
.history-table .trend-up { color: var(--success); font-size: 11px; margin-left: 6px; }
.history-table .trend-dn { color: var(--danger); font-size: 11px; margin-left: 6px; }

/* --- Section 2 · Banner acumulado pendiente --- */
.pending-banner.settled { border-left-color: var(--success) !important; }
.pending-banner.settled .metric .eyebrow { color: var(--success) !important; }
.pending-banner {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 1.4fr;
  gap: 32px;
  align-items: center;
  background: #F5EFE5;
  border-left: 4px solid #315DF5;
  border-radius: var(--radius-md);
  padding: 32px 36px;
  margin-bottom: 28px;
}
.pending-banner .metric .eyebrow {
  font-size: 10px; font-weight: 700;
  color: var(--menta-blue);
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 8px;
}
.pending-banner .metric .value {
  font-size: 32px; font-weight: 700;
  color: var(--menta-black);
  letter-spacing: -0.5px;
  line-height: 1.1;
}
.pending-banner .metric .sub {
  font-size: 12px; color: #6B6E7E; margin-top: 6px;
}
.pending-banner .copy h4 {
  font-size: 14px; font-weight: 700;
  color: var(--menta-black);
  margin-bottom: 6px;
}
.pending-banner .copy p {
  font-size: 12px; color: #4A4D5C; line-height: 1.55;
}
.pending-banner .copy p strong { color: var(--menta-black); }
