/* ============================================================
   Portal Cliente · Ponte Dixital
   Rediseño UI/UX 2026 — Modern Dashboard Premium
   ============================================================ */

/* ── Tokens ── */
:root {
  --atl:       oklch(42% 0.12 175);
  --atl-hi:    oklch(50% 0.13 175);
  --atl-lo:    oklch(96.5% 0.04 175);
  --atl-mid:   oklch(93% 0.06 175);
  --cream:     oklch(97% 0.007 90);
  --white:     oklch(99.5% 0.003 90);
  --s2:        oklch(95% 0.008 88);
  --ink:       oklch(16% 0.018 200);
  --mid:       oklch(42% 0.012 200);
  --muted:     oklch(58% 0.009 200);
  --border:    oklch(88% 0.010 175);
  --border-hi: oklch(80% 0.014 175);
  --amber:     oklch(60% 0.17 72);
  --amber-lo:  oklch(96% 0.05 80);
  --red:       oklch(50% 0.17 25);
  --red-lo:    oklch(97% 0.03 25);
  --font:      'DM Sans', system-ui, -apple-system, sans-serif;
  --serif:     'Playfair Display', Georgia, serif;
  --shadow-sm: 0 1px 2px oklch(0% 0 0 / 6%), 0 3px 10px oklch(0% 0 0 / 6%);
  --shadow-md: 0 2px 6px oklch(0% 0 0 / 8%), 0 8px 24px oklch(0% 0 0 / 7%);
  --r:         12px;
  --r-sm:      8px;
  --r-full:    999px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding-bottom: 80px;
}
a { color: inherit; }
button { font-family: var(--font); }

/* ─────────────────────────────────────────
   TOPBAR
───────────────────────────────────────── */
.portal-topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
  padding: 0 16px; height: 56px;
  box-shadow: 0 1px 0 var(--border), 0 2px 8px oklch(0% 0 0 / 4%);
}

.topbar-brand {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none;
}
.topbar-logo {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--atl); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.topbar-logo svg { color: #fff; }
.brand-pd   { font-family: var(--serif); font-weight: 600; font-size: 15px; color: var(--ink); }
.brand-sep  { color: var(--border-hi); font-size: 16px; }
.brand-area { font-size: 11px; color: var(--muted); }

.topbar-nav {
  display: none; margin-left: auto; gap: 2px;
}
.topbar-nav a {
  font-size: 13px; font-weight: 500; color: var(--mid);
  text-decoration: none; padding: 6px 12px; border-radius: var(--r-sm);
  transition: background 120ms, color 120ms;
  position: relative;
}
.topbar-nav a:hover { background: var(--s2); color: var(--ink); }
.topbar-nav a.active { background: var(--atl-lo); color: var(--atl); font-weight: 600; }

.topbar-right {
  margin-left: auto; display: flex; align-items: center; gap: 6px;
  position: relative;
}

/* Bell notification */
.btn-bell {
  position: relative; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 1px solid var(--border);
  border-radius: var(--r-sm); cursor: pointer; color: var(--mid);
  transition: background 120ms, color 120ms, border-color 120ms;
}
.btn-bell:hover { background: var(--s2); color: var(--ink); border-color: var(--border-hi); }
.bell-badge {
  position: absolute; top: -3px; right: -3px;
  min-width: 16px; height: 16px; border-radius: var(--r-full);
  background: var(--red); color: #fff;
  font-size: 9.5px; font-weight: 700; display: flex;
  align-items: center; justify-content: center; padding: 0 3px;
  border: 1.5px solid var(--white);
}

/* Notifications dropdown */
.notif-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 300px; background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow-md);
  overflow: hidden; display: none; z-index: 60;
}
.notif-dropdown.open { display: block; }
.notif-header {
  padding: 12px 16px 10px; font-size: 11px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.notif-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--ink); line-height: 1.4;
}
.notif-item:last-child { border-bottom: none; }
.notif-icon {
  width: 28px; height: 28px; border-radius: 6px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; margin-top: 1px;
}
.notif-icon.warn { background: var(--amber-lo); color: var(--amber); }
.notif-icon.err  { background: var(--red-lo); color: var(--red); }
.notif-icon.info { background: var(--atl-lo); color: var(--atl); }
.notif-empty { padding: 20px 16px; text-align: center; font-size: 13px; color: var(--muted); }

/* Client avatar */
.topbar-avatar {
  width: 32px; height: 32px; border-radius: var(--r-full);
  background: var(--atl); color: #fff;
  font-size: 12px; font-weight: 700; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
  cursor: default; user-select: none;
}

.btn-logout {
  font-size: 12px; font-weight: 500; color: var(--mid);
  text-decoration: none; padding: 6px 12px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  transition: background 120ms, border-color 120ms; white-space: nowrap;
}
.btn-logout:hover { background: var(--s2); border-color: var(--border-hi); }

@media (min-width: 640px) {
  .topbar-right { margin-left: 0; }
  .topbar-nav { display: flex; margin-left: auto; }
  body { padding-bottom: 40px; }
  .portal-topbar { padding: 0 32px; }
}
@media (min-width: 1100px) {
  .portal-topbar { padding: 0 48px; }
}

/* ─────────────────────────────────────────
   LAYOUT
───────────────────────────────────────── */
.portal-content {
  max-width: 960px; margin: 0 auto;
  padding: 24px 16px 24px;
  display: flex; flex-direction: column; gap: 16px;
}
@media (min-width: 640px) {
  .portal-content { padding: 32px 32px 32px; gap: 20px; }
}
@media (min-width: 1100px) {
  .portal-content { padding: 36px 48px 36px; }
}

/* ── Section label ── */
.section-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: -4px; padding-left: 2px;
}

/* ─────────────────────────────────────────
   ALERT STRIPS
───────────────────────────────────────── */
.alert-strip {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 500; line-height: 1.4;
}
.alert-amber { background: var(--amber-lo); color: oklch(36% 0.1 72); border: 1px solid oklch(87% 0.08 78); }
.alert-red   { background: var(--red-lo); color: oklch(38% 0.12 25); border: 1px solid oklch(87% 0.07 25); }
.alert-link  { margin-left: auto; color: inherit; font-weight: 700; text-decoration: none; white-space: nowrap; flex-shrink: 0; }
.alert-link:hover { text-decoration: underline; }

/* ─────────────────────────────────────────
   HEALTH SCORE HERO CARD
───────────────────────────────────────── */
.health-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r); padding: 22px 24px;
  box-shadow: var(--shadow-md);
  display: flex; flex-direction: column; gap: 16px;
}
.health-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.health-site { display: flex; align-items: center; gap: 10px; }
.health-site-icon {
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--s2); display: flex; align-items: center; justify-content: center;
  color: var(--muted); flex-shrink: 0;
}
.health-site-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.health-site-url  { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.health-site-url a { color: var(--atl); text-decoration: none; }
.health-site-url a:hover { text-decoration: underline; }

/* Status pill */
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--r-full);
  font-size: 12px; font-weight: 600; flex-shrink: 0;
}
.status-pill.up      { background: oklch(94% 0.07 145); color: oklch(35% 0.12 145); }
.status-pill.down    { background: var(--red-lo); color: var(--red); }
.status-pill.unknown { background: var(--s2); color: var(--muted); }
.status-pill-dot {
  width: 7px; height: 7px; border-radius: 50%;
}
.status-pill.up   .status-pill-dot { background: currentColor; }
.status-pill.down .status-pill-dot { background: var(--red); }
.status-pill.unknown .status-pill-dot { background: var(--muted); }
@keyframes pulse-pill {
  0%   { box-shadow: 0 0 0 0 oklch(35% 0.12 145 / 0.5); }
  70%  { box-shadow: 0 0 0 6px oklch(35% 0.12 145 / 0); }
  100% { box-shadow: 0 0 0 0 oklch(35% 0.12 145 / 0); }
}
.status-pill.up .status-pill-dot { animation: pulse-pill 2.5s ease-out infinite; }

/* Score row */
.health-score-row {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.health-score-num {
  font-size: 48px; font-weight: 700; letter-spacing: -2px; line-height: 1;
  font-variant-numeric: tabular-nums; flex-shrink: 0;
}
.health-score-num.grade-a { color: var(--atl); }
.health-score-num.grade-b { color: oklch(50% 0.15 155); }
.health-score-num.grade-c { color: var(--amber); }
.health-score-num.grade-d { color: var(--red); }
.health-score-meta { flex: 1; min-width: 120px; }
.health-score-label { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.health-score-desc  { font-size: 13px; font-weight: 600; color: var(--ink); margin-top: 2px; }
.health-progress-wrap { flex: 1; min-width: 80px; }
.health-progress {
  height: 8px; background: var(--border); border-radius: var(--r-full); overflow: hidden;
}
.health-progress-bar {
  height: 100%; border-radius: var(--r-full);
  transition: width 0.8s cubic-bezier(0.16,1,0.3,1);
}
.health-progress-bar.grade-a { background: var(--atl); }
.health-progress-bar.grade-b { background: oklch(50% 0.15 155); }
.health-progress-bar.grade-c { background: var(--amber); }
.health-progress-bar.grade-d { background: var(--red); }
.health-progress-label { font-size: 10.5px; color: var(--muted); margin-top: 4px; text-align: right; }

/* Verify button inside health card */
.btn-verify {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; background: none; border: 1px solid var(--border-hi);
  border-radius: var(--r-sm); font-size: 12px; font-weight: 500;
  color: var(--mid); cursor: pointer; white-space: nowrap;
  transition: background 120ms, border-color 120ms;
}
.btn-verify:hover { background: var(--s2); border-color: var(--border-hi); }
.btn-verify:disabled { opacity: .4; cursor: not-allowed; }

/* ─────────────────────────────────────────
   METRICS GRID
───────────────────────────────────────── */
.metrics-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
@media (min-width: 480px) {
  .metrics-grid { grid-template-columns: repeat(4, 1fr); }
}

.metric-tile {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r); padding: 16px 16px 14px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 150ms;
}
.metric-tile:hover { box-shadow: var(--shadow-md); }

.metric-tile-top {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px;
}
.metric-icon {
  width: 30px; height: 30px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.metric-icon.ok   { background: oklch(93.5% 0.06 145); color: oklch(38% 0.13 145); }
.metric-icon.warn { background: var(--amber-lo); color: var(--amber); }
.metric-icon.bad  { background: var(--red-lo); color: var(--red); }
.metric-icon.neutral { background: var(--s2); color: var(--muted); }
.metric-icon.atl  { background: var(--atl-lo); color: var(--atl); }

.metric-label {
  position: relative; display: flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.10em; color: var(--muted);
}
.metric-value {
  font-size: 26px; font-weight: 700; letter-spacing: -0.8px; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.metric-sub   { font-size: 11px; color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric-delta { font-size: 11px; font-weight: 600; margin-top: 5px; }
.metric-delta.up   { color: var(--atl); }
.metric-delta.down { color: var(--red); }

.metric-ok      { color: oklch(38% 0.14 145); }
.metric-warn    { color: var(--amber); }
.metric-bad     { color: var(--red); }
.metric-neutral { color: var(--ink); }

.tile-bar-wrap { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; margin-top: 10px; }
.tile-bar { height: 100%; border-radius: 2px; transition: width 0.8s cubic-bezier(0.16,1,0.3,1); }
.metric-ok-bar      { background: oklch(50% 0.14 145); }
.metric-warn-bar    { background: var(--amber); }
.metric-bad-bar     { background: var(--red); }
.metric-neutral-bar { background: var(--muted); }

@keyframes blink { 0%,100%{opacity:.3} 50%{opacity:1} }
.metric-loading .metric-value { animation: blink 1.2s ease-in-out infinite; color: var(--muted) !important; }

/* ── Metric tooltips ── */
.metric-tooltip { cursor: pointer; color: var(--muted); user-select: none; position: relative; display: inline-flex; align-items: center; }
.metric-tooltip .tooltip-box {
  display: none; position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%); background: var(--ink); color: #fff;
  font-size: 11px; font-weight: 400; padding: 7px 10px; border-radius: 7px;
  width: 180px; line-height: 1.5; z-index: 50; pointer-events: none;
  font-family: var(--font); text-transform: none; letter-spacing: 0;
}
.metric-tooltip .tooltip-box::after {
  content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: var(--ink);
}
.metric-tooltip .tooltip-box.visible { display: block; }

/* ─────────────────────────────────────────
   INSIGHTS / RESUMEN EJECUTIVO
───────────────────────────────────────── */
.insights-card {
  background: linear-gradient(135deg, oklch(24% 0.05 175), oklch(30% 0.07 175));
  border: none; border-radius: var(--r); padding: 18px 20px;
  display: flex; align-items: flex-start; gap: 14px;
  box-shadow: var(--shadow-sm);
}
.insights-icon {
  width: 34px; height: 34px; border-radius: 8px;
  background: oklch(100% 0 0 / 12%); display: flex;
  align-items: center; justify-content: center; color: #fff;
  flex-shrink: 0; margin-top: 1px;
}
.insights-content { flex: 1; min-width: 0; }
.insights-title { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: oklch(80% 0.04 175); margin-bottom: 8px; }
.insights-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.insights-list li {
  font-size: 13px; font-weight: 500; color: #fff;
  display: flex; align-items: flex-start; gap: 8px; line-height: 1.4;
}
.insights-list li::before { content: '·'; color: oklch(70% 0.07 175); flex-shrink: 0; margin-top: 0; }

/* ─────────────────────────────────────────
   PDF REPORT CARD
───────────────────────────────────────── */
.pdf-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r); padding: 16px 18px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 120ms;
}
.pdf-card:hover { box-shadow: var(--shadow-md); }
.pdf-icon {
  width: 40px; height: 40px; border-radius: 9px;
  background: var(--red-lo); color: var(--red);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.pdf-meta { flex: 1; min-width: 0; }
.pdf-title { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.pdf-sub   { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.btn-pdf {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; background: var(--atl); color: #fff;
  font-size: 12px; font-weight: 600; border-radius: var(--r-sm);
  text-decoration: none; white-space: nowrap; flex-shrink: 0;
  transition: background 120ms;
}
.btn-pdf:hover { background: var(--atl-hi); }

/* ─────────────────────────────────────────
   KEYWORDS STRIP
───────────────────────────────────────── */
.keywords-strip {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r); padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.keywords-header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.keywords-header-icon { color: var(--atl); }
.keywords-intro { font-size: 13px; font-weight: 600; color: var(--ink); }
.keywords-list { display: flex; flex-direction: column; gap: 8px; }
.keyword-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.keyword-item:last-child { border-bottom: none; padding-bottom: 0; }
.keyword-pill {
  font-size: 13px; font-weight: 500; color: var(--ink);
  background: var(--atl-lo); border-radius: var(--r-full);
  padding: 3px 12px; white-space: nowrap; flex-shrink: 0;
  max-width: 55%; overflow: hidden; text-overflow: ellipsis;
}
.keyword-stat { font-size: 11px; color: var(--muted); white-space: nowrap; text-align: right; }
.keyword-pos {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 5px;
  background: var(--s2); font-size: 11px; font-weight: 700; color: var(--mid);
  border: 1px solid var(--border); flex-shrink: 0;
}
.keyword-pos.pos-top { background: oklch(93% 0.06 145); color: oklch(36% 0.12 145); border-color: oklch(85% 0.08 145); }

/* ─────────────────────────────────────────
   STAT HIGHLIGHT (visitas + clics)
───────────────────────────────────────── */
.stat-highlight {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r); padding: 20px 22px;
  display: flex; align-items: stretch; gap: 0;
  box-shadow: var(--shadow-sm);
}
.stat-item { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.stat-sep { width: 1px; background: var(--border); margin: 0 20px; flex-shrink: 0; }
.stat-num {
  font-size: 34px; font-weight: 700; color: var(--ink);
  letter-spacing: -1.5px; line-height: 1; font-variant-numeric: tabular-nums;
}
.stat-name  { font-size: 11.5px; color: var(--mid); font-weight: 500; margin-top: 3px; }
.stat-delta { font-size: 11px; font-weight: 600; margin-top: 5px; display: flex; align-items: center; gap: 4px; }
.sd-up   { color: oklch(40% 0.13 145); }
.sd-down { color: var(--red); }

/* ─────────────────────────────────────────
   CHART CARD
───────────────────────────────────────── */
.chart-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r); padding: 16px 18px 18px;
  box-shadow: var(--shadow-sm);
}
.chart-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 10px; flex-wrap: wrap;
}
.chart-title { font-size: 13px; font-weight: 600; color: var(--ink); }
.chart-ranges { display: flex; gap: 4px; }
.range-btn {
  padding: 4px 10px; font-family: var(--font); font-size: 11px; font-weight: 500;
  color: var(--mid); background: none; border: 1px solid var(--border);
  border-radius: var(--r-sm); cursor: pointer; transition: all 120ms;
}
.range-btn:hover { border-color: var(--atl); color: var(--atl); }
.range-btn.active { background: var(--atl-lo); border-color: var(--atl); color: var(--atl); font-weight: 600; }
.chart-legend { display: flex; align-items: center; font-size: 11px; color: var(--muted); gap: 4px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.chart-wrap { position: relative; min-height: 160px; }
.chart-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; min-height: 140px; font-size: 12.5px; color: var(--muted); text-align: center;
}
.chart-loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.8);
}
.chart-spinner {
  width: 24px; height: 24px; border: 2px solid var(--border);
  border-top-color: var(--atl); border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─────────────────────────────────────────
   PLAN CARD
───────────────────────────────────────── */
.plan-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r); padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.plan-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.plan-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--r-full);
  background: var(--atl-lo); color: var(--atl);
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  margin-bottom: 4px;
}
.plan-name { font-size: 15px; font-weight: 600; color: var(--ink); }
.plan-desc { font-size: 12.5px; color: var(--mid); line-height: 1.5; margin-top: 4px; }
.plan-desc a { color: var(--atl); text-decoration: none; }
.plan-cta {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--atl);
  text-decoration: none; padding: 7px 14px;
  border: 1px solid var(--atl-mid); border-radius: var(--r-sm);
  background: var(--atl-lo); white-space: nowrap;
  transition: background 120ms; flex-shrink: 0;
}
.plan-cta:hover { background: oklch(92% 0.07 175); }
.quota-bar-wrap { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-bottom: 14px; }
.quota-bar { height: 100%; border-radius: 3px; transition: width 0.6s cubic-bezier(0.16,1,0.3,1); }
.report-schedule {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 12px; color: var(--mid); padding-top: 12px;
  border-top: 1px solid var(--border);
}
.report-schedule strong { color: var(--ink); }

/* ─────────────────────────────────────────
   DOCUMENTOS PAGE
───────────────────────────────────────── */
.tabs-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow-sm);
}
.tabs {
  display: flex; border-bottom: 1px solid var(--border);
  padding: 0 16px; background: var(--s2); gap: 2px;
}
.tab-btn {
  padding: 12px 14px; font-family: var(--font); font-size: 13px; font-weight: 500;
  color: var(--muted); background: none; border: none;
  border-bottom: 2px solid transparent; cursor: pointer;
  margin-bottom: -1px; transition: color 120ms, border-color 120ms;
  display: flex; align-items: center; gap: 6px;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--atl); border-bottom-color: var(--atl); font-weight: 600; }
.tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; border-radius: var(--r-full);
  background: var(--border); color: var(--muted);
  font-size: 10px; font-weight: 700; padding: 0 4px;
}
.tab-btn.active .tab-count { background: var(--atl-lo); color: var(--atl); }
.tab-panel { display: none; padding: 8px 0; }
.tab-panel.active { display: block; }

/* Doc list */
.doc-list { display: flex; flex-direction: column; }
.doc-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  transition: background 100ms;
}
.doc-row:last-child { border-bottom: none; }
.doc-row:hover { background: var(--s2); }
.doc-type-icon {
  width: 34px; height: 34px; border-radius: 7px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.doc-type-icon.factura    { background: var(--amber-lo); color: var(--amber); }
.doc-type-icon.presupuesto { background: var(--atl-lo); color: var(--atl); }
.doc-type-icon.bienvenida { background: oklch(95% 0.05 240); color: oklch(40% 0.12 240); }
.doc-meta { flex: 1; min-width: 0; }
.doc-num  { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.doc-date { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.doc-amount { font-size: 13px; font-weight: 600; color: var(--ink); text-align: right; white-space: nowrap; flex-shrink: 0; }
.doc-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; color: var(--atl);
  text-decoration: none; padding: 5px 10px;
  border: 1px solid var(--atl-lo); border-radius: var(--r-sm);
  background: var(--atl-lo); white-space: nowrap; flex-shrink: 0;
  transition: background 120ms;
}
.doc-link:hover { background: var(--atl-mid); }
.doc-empty {
  padding: 40px 20px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.doc-empty-icon { color: var(--border); margin-bottom: 4px; }
.doc-empty-title { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.doc-empty-desc  { font-size: 12.5px; color: var(--muted); max-width: 260px; line-height: 1.5; }

/* ── Badges ── */
.badge { display: inline-block; padding: 2px 9px; border-radius: var(--r-full); font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em; }
.badge-pend { background: var(--amber-lo); color: oklch(36% 0.1 72); }
.badge-ok   { background: oklch(93% 0.06 145); color: oklch(35% 0.12 145); }
.badge-no   { background: var(--red-lo); color: var(--red); }
.badge-proc { background: oklch(95% 0.05 240); color: oklch(35% 0.1 240); }
.badge-env  { background: oklch(95% 0.05 80); color: oklch(38% 0.1 75); }

/* ─────────────────────────────────────────
   CAMBIOS PAGE
───────────────────────────────────────── */
.cambios-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r); padding: 20px;
  box-shadow: var(--shadow-sm);
}

/* Quota info */
.quota-info-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 10px; flex-wrap: wrap;
}
.quota-label { font-size: 13px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.quota-count { font-size: 12px; color: var(--mid); }
.quota-bar-wrap { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-bottom: 16px; }
.quota-bar { height: 100%; border-radius: 3px; transition: width 0.6s cubic-bezier(0.16,1,0.3,1); }

/* Form fields */
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: block; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 6px;
}
.field select, .field textarea, .field input[type=file] {
  width: 100%; padding: 10px 12px;
  background: var(--cream); border: 1px solid var(--border);
  border-radius: var(--r-sm); font-family: var(--font); font-size: 13.5px;
  color: var(--ink); outline: none; transition: border-color 120ms, box-shadow 120ms;
  appearance: none; -webkit-appearance: none;
}
.field select:focus, .field textarea:focus { border-color: var(--atl); box-shadow: 0 0 0 3px oklch(42% 0.12 175 / 0.12); }
.field textarea { resize: vertical; min-height: 100px; line-height: 1.6; }
.field-hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
.char-count { font-size: 11px; color: var(--muted); text-align: right; margin-top: 2px; }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.btn-primary {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 20px; background: var(--atl); color: #fff;
  font-family: var(--font); font-size: 13px; font-weight: 600;
  border: none; border-radius: var(--r-sm); cursor: pointer;
  transition: background 120ms, transform 60ms;
}
.btn-primary:hover   { background: var(--atl-hi); }
.btn-primary:active  { transform: scale(0.98); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* Quota exhausted */
.quota-exhausted {
  text-align: center; padding: 28px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.quota-exhausted-icon  { color: oklch(75% 0.04 175); }
.quota-exhausted-title { font-size: 15px; font-weight: 600; color: var(--ink); }
.quota-exhausted-desc  { font-size: 13px; color: var(--mid); line-height: 1.6; max-width: 280px; }

/* Pending requests — progress steps */
.cambio-pending-card {
  border: 1px solid var(--border); border-radius: var(--r); overflow: hidden;
  margin-top: 8px;
}
.cambio-pending-hd {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px; background: var(--s2); border-bottom: 1px solid var(--border);
}
.cambio-pending-tipo { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.cambio-pending-date { font-size: 11px; color: var(--muted); }
.cambio-pending-body { padding: 12px 16px; background: var(--white); }
.cambio-pending-desc { font-size: 13px; color: var(--ink); line-height: 1.5; margin-bottom: 12px; }

/* 3-step progress */
.steps { display: flex; align-items: center; gap: 0; }
.step {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  position: relative; gap: 5px;
}
.step::after {
  content: ''; position: absolute; top: 11px;
  left: 50%; width: 100%; height: 2px;
  background: var(--border); z-index: 0;
}
.step:last-child::after { display: none; }
.step-dot {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--border); background: var(--white);
  display: flex; align-items: center; justify-content: center;
  position: relative; z-index: 1; flex-shrink: 0;
}
.step.done .step-dot   { background: oklch(93% 0.06 145); border-color: oklch(60% 0.12 145); }
.step.active .step-dot { background: var(--atl); border-color: var(--atl); }
.step.done .step-dot svg   { color: oklch(35% 0.12 145); }
.step.active .step-dot svg { color: #fff; }
.step-label { font-size: 10px; font-weight: 600; color: var(--muted); text-align: center; }
.step.done .step-label   { color: oklch(40% 0.1 145); }
.step.active .step-label { color: var(--atl); }
.step::after { background: var(--border); }
.step.done::after { background: oklch(75% 0.08 145); }

/* Nota del equipo */
.cambio-nota {
  font-size: 12.5px; color: var(--atl); background: var(--atl-lo);
  border-radius: 7px; padding: 8px 12px; margin-top: 10px; line-height: 1.5;
  border-left: 2px solid var(--atl);
}
.cambio-nota-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--atl); margin-bottom: 2px; }

/* Timeline historial */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 0;
  border-bottom: 1px solid var(--border); position: relative;
}
.timeline-item:last-child { border-bottom: none; padding-bottom: 0; }
.timeline-dot {
  width: 28px; height: 28px; border-radius: 50%;
  background: oklch(93% 0.06 145); border: 2px solid oklch(75% 0.1 145);
  display: flex; align-items: center; justify-content: center;
  color: oklch(35% 0.12 145); flex-shrink: 0; margin-top: 1px;
}
.timeline-body { flex: 1; min-width: 0; }
.timeline-hd { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.timeline-tipo {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--muted);
}
.timeline-date { font-size: 11px; color: var(--muted); margin-left: auto; white-space: nowrap; }
.timeline-desc { font-size: 13px; color: var(--ink); line-height: 1.5; }

/* ─────────────────────────────────────────
   BOTTOM NAV (mobile)
───────────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: flex; background: var(--white);
  border-top: 1px solid var(--border);
  padding: 8px 0 max(env(safe-area-inset-bottom, 8px), 8px);
  box-shadow: 0 -2px 12px oklch(0% 0 0 / 6%);
}
.bnav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  text-decoration: none; font-size: 10px; font-weight: 600;
  color: var(--muted); padding: 3px 0; min-height: 44px;
  justify-content: center; transition: color 120ms;
}
.bnav-item.active { color: var(--atl); }
.bnav-item:hover  { color: var(--ink); }
.bnav-item.active svg { stroke: var(--atl); }
@media (min-width: 640px) { .bottom-nav { display: none; } }

/* ─────────────────────────────────────────
   TOAST NOTIFICATIONS
───────────────────────────────────────── */
.toast {
  position: fixed; bottom: 88px; left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 500;
  opacity: 0; transition: opacity 200ms, transform 200ms;
  pointer-events: none; white-space: nowrap; z-index: 100;
  box-shadow: var(--shadow-md);
}
.toast.ok  { background: oklch(38% 0.14 145); }
.toast.err { background: var(--red); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (min-width: 640px) { .toast { bottom: 28px; } }

/* ─────────────────────────────────────────
   LOGIN PAGE
───────────────────────────────────────── */
.login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: var(--cream);
  background-image:
    radial-gradient(ellipse 70% 50% at 10% 90%, oklch(42% 0.12 175 / 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 90% 10%, oklch(42% 0.12 175 / 0.04) 0%, transparent 60%);
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r-xl, 20px); padding: 40px 36px 34px;
  box-shadow: var(--shadow-lg);
}
.login-brand { text-align: center; margin-bottom: 32px; }
.login-logo-wrap {
  width: 56px; height: 56px; margin: 0 auto 16px;
  background: oklch(93% 0.06 175); border: 1px solid oklch(83% 0.08 175);
  border-radius: 14px; display: flex; align-items: center; justify-content: center;
}
.login-brand-name {
  font-family: var(--serif); font-weight: 600; font-size: 24px; color: var(--ink); letter-spacing: -0.3px;
}
.login-tagline { font-size: 12px; color: var(--muted); margin-top: 4px; }
.login-error {
  font-size: 13px; color: var(--red); background: var(--red-lo);
  border: 1px solid oklch(87% 0.06 25); border-radius: var(--r-sm);
  padding: 10px 13px; margin-bottom: 16px; text-align: center;
}
.login-field { margin-bottom: 14px; }
.login-field label {
  display: block; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 6px;
}
.login-field input {
  width: 100%; padding: 11px 14px;
  background: var(--cream); border: 1px solid var(--border);
  border-radius: var(--r-sm); font-family: var(--font); font-size: 15px;
  color: var(--ink); outline: none; transition: border-color 120ms, box-shadow 120ms;
  -webkit-appearance: none;
}
.login-field input:focus {
  border-color: var(--atl); box-shadow: 0 0 0 3px oklch(42% 0.12 175 / 0.12);
}
.login-field input::placeholder { color: var(--muted); }
.login-field .input-wrap { position: relative; }
.login-field .eye-btn {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--muted);
  padding: 4px; transition: color 120ms; display: flex; align-items: center;
}
.login-field .eye-btn:hover { color: var(--ink); }
.login-submit {
  width: 100%; padding: 12px; margin-top: 6px;
  background: var(--atl); border: none; border-radius: var(--r-sm);
  font-family: var(--font); font-size: 14px; font-weight: 600;
  color: #fff; cursor: pointer; transition: background 120ms;
}
.login-submit:hover    { background: var(--atl-hi); }
.login-submit:disabled { opacity: .45; cursor: not-allowed; }
.login-footer { text-align: center; font-size: 11.5px; color: var(--muted); margin-top: 22px; }

/* ─────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────── */
@media (max-width: 479px) {
  .stat-highlight { flex-direction: column; gap: 14px; }
  .stat-sep { display: none; }
  .health-score-row { flex-wrap: wrap; }
  .pdf-card { flex-wrap: wrap; }
  .btn-pdf { width: 100%; justify-content: center; }
}
