/* =====================================================================
   PORTAL CLIENTE — css/portal-cliente.css
   ===================================================================== */
:root {
  --navy:    #0d1b2a;
  --navy-2:  #16243f;
  --blue:    #2563EB;
  --blue-lt: #3b82f6;
  --gold:    #D4A017;
  --cream:   #E8EFF8;
  --muted:   #6B7280;
  --surface: #ffffff;
  --bg:      #F4F6FB;
  --border:  #DDE3EE;
  --red:     #DC2626;
  --green:   #16A34A;
  --font:    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius:  10px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: #1a2030; font-size: 14px; min-height: 100vh; }

/* ── HEADER ── */
.portal-header {
  background: var(--navy);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 12px;
}
.portal-header__brand { display: flex; align-items: center; gap: 12px; }
.portal-header__brand img { height: 32px; width: auto; }
.portal-header__title { color: var(--cream); font-size: 0.95rem; font-weight: 600; white-space: nowrap; }
.portal-header__client {
  color: rgba(232,239,248,.55);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
.portal-header__actions { display: flex; align-items: center; gap: 10px; }
.btn-ghost-nav {
  background: none; border: 1px solid rgba(232,239,248,.22); border-radius: 7px;
  color: rgba(232,239,248,.8); padding: 6px 12px; cursor: pointer;
  font-size: 0.8rem; font-weight: 600; transition: all .15s;
}
.btn-ghost-nav:hover { background: rgba(232,239,248,.08); color: var(--cream); }

/* ── TABS ── */
.portal-tabs {
  display: flex;
  gap: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  overflow-x: auto;
}
.portal-tab {
  padding: 14px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  border: none;
  border-bottom: 3px solid transparent;
  background: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.portal-tab:hover { color: var(--blue); }
.portal-tab.is-active { color: var(--blue); border-bottom-color: var(--blue); }

/* ── CONTAINER ── */
.portal-body { max-width: 1280px; margin: 0 auto; padding: 28px 24px 60px; }

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 20px;
}
.card__title {
  font-size: 1rem;
  font-weight: 700;
  color: #16243f;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card__hint { font-size: 0.78rem; color: var(--muted); margin-top: -10px; margin-bottom: 16px; }

/* ── STAT CHIPS ── */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-chip__label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stat-chip__value { font-size: 1.45rem; font-weight: 700; color: #16243f; }
.stat-chip__sub   { font-size: 0.75rem; color: var(--muted); }
.stat-chip.is-venta  .stat-chip__value { color: var(--green); }
.stat-chip.is-compra .stat-chip__value { color: var(--blue); }
.stat-chip.is-saldo  .stat-chip__value { color: var(--navy-2); }

/* ── FILTROS ── */
.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.filter-bar label { font-size: 0.75rem; font-weight: 600; color: var(--muted); display: block; margin-bottom: 4px; }
.filter-bar select, .filter-bar input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 0.875rem;
  color: #1a2030;
  background: var(--surface);
}

/* ── TABLA DE COMPROBANTES ── */
.tabla-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.tabla-comprobantes {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  min-width: 700px;
}
.tabla-comprobantes th {
  background: #F8F9FB;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tabla-comprobantes td { padding: 10px 14px; border-bottom: 1px solid #F0F2F7; vertical-align: middle; }
.tabla-comprobantes tbody tr:last-child td { border-bottom: none; }
.tabla-comprobantes tbody tr:hover td { background: #F4F6FB; }
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.badge--venta  { background: #dcfce7; color: #166534; }
.badge--compra { background: #dbeafe; color: #1e40af; }
.badge--afip   { background: #fef9c3; color: #6b5500; }
.badge--manual { background: #f3f4f6; color: #374151; }
.num-right { text-align: right; font-variant-numeric: tabular-nums; }
.text-green { color: var(--green); font-weight: 600; }
.text-blue  { color: var(--blue);  font-weight: 600; }
.tabla-foot td { padding: 10px 14px; font-weight: 700; background: #F8F9FB; border-top: 2px solid var(--border); }

/* ── GRÁFICOS ── */
.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-bottom: 24px; }
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.chart-card__title { font-size: 0.875rem; font-weight: 700; color: #16243f; margin-bottom: 16px; }
.chart-wrap { position: relative; width: 100%; }

/* ── EMPTY STATE ── */
.empty-portal {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty-portal__icon { font-size: 3rem; margin-bottom: 12px; }
.empty-portal__title { font-size: 1rem; font-weight: 700; color: #16243f; margin-bottom: 6px; }

/* ── LOGIN GATE ── */
#loginGate { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg,#0d1a3a 0%,#080c14 55%,#0a0f1e 100%); padding: 20px; }
#loginGate.is-hidden { display: none; }
.lg-card { background: #fff; border-radius: 14px; padding: 34px 30px; max-width: 380px; width: 100%;
  box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.lg-card img { height: 38px; display: block; margin-bottom: 18px; }
.lg-card h2 { font-size: 1.3rem; margin: 0 0 6px; color: #16243f; font-family: var(--font); }
.lg-card p.lg-sub { font-size: .84rem; color: #5b6779; margin: 0 0 20px; line-height: 1.5; }
.lg-field { margin-bottom: 14px; }
.lg-field label { display: block; font-size: .78rem; font-weight: 600; color: #5b6779; margin-bottom: 5px; }
.lg-field input { width: 100%; padding: 10px 12px; border: 1px solid #dbe1ea; border-radius: 8px; font-size: .92rem; box-sizing: border-box; }
.lg-field input:focus { outline: 2px solid #16243f; outline-offset: 1px; }
#loginGateBtn { width: 100%; padding: 11px; border: none; border-radius: 8px; background: #16243f; color: #fff;
  font-weight: 600; font-size: .92rem; cursor: pointer; margin-top: 6px; }
#loginGateBtn:hover { background: #1f3354; }
#loginGateBtn:disabled { opacity: .6; cursor: default; }
#loginGateError { color: #c0392b; font-size: .8rem; margin: 10px 0 0; min-height: 1em; }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .portal-body { padding: 16px 14px 60px; }
  .portal-tabs { padding: 0 14px; }
  .portal-header { padding: 0 14px; }
  .portal-header__client { max-width: 120px; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
}
