/* ============================================================
   ProviPulse -- identidad visual (evolucion de Tornasol Noir:
   mismos magenta/violeta/cian + dorado nuevo, tratamiento mas
   glossy). Decision registrada en GUIA_UI.md ss1. Iconos: sprite
   SVG inline (no Material Symbols, no emojis -- ver GUIA_UI.md ss2).
   ============================================================ */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url('fonts/outfit-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url('fonts/outfit-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #0e0a15;
  --surface: #170f21;
  --surface-2: #1e1529;
  --surface-glass: rgba(30,20,42,0.62);
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);
  --ink: #f4ecf6;
  --ink-muted: rgba(224,204,224,0.62);
  --magenta: #ff2f72;
  --violet: #9b3bf0;
  --cyan: #00d9e3;
  --gold: #ffb238;
  --good: #35dd9e;
  --warn: #ffb238;
  --critical: #ff5c7a;
  --sidebar-bg: #150e1e;
  --sidebar-ink: #efe6f4;
  --sidebar-ink-muted: rgba(239,230,244,0.56);
  --sidebar-active: rgba(255,255,255,0.08);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.35);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 24px 64px rgba(0,0,0,0.55);
  --glow-accent: 0 0 24px rgba(255,47,114,0.28);
  --gradient-primary: linear-gradient(135deg, var(--violet), var(--magenta));
  --gradient-tornasol: linear-gradient(to right, var(--cyan), var(--magenta) 55%, var(--gold));
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 9px;
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
body { position: relative; min-height: 100vh; overflow-x: hidden; }
body::before, body::after {
  content: "";
  position: fixed; z-index: 0; pointer-events: none;
  border-radius: 50%; filter: blur(120px);
}
body::before { top: -120px; right: -120px; width: 460px; height: 460px; background: rgba(255,47,114,0.14); }
body::after { bottom: -140px; left: -80px; width: 420px; height: 420px; background: rgba(0,217,227,0.08); }
.login-screen, .shell { position: relative; z-index: 1; }

h1,h2,h3,h4 { font-family: var(--font-display); margin: 0; text-wrap: balance; }
button, input, select { font-family: inherit; font-size: inherit; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }
::-webkit-scrollbar-track { background: transparent; }
a { color: inherit; text-decoration: none; }

/* ================= Login ================= */

.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-screen.hidden { display: none; }
.login-main { width: 100%; max-width: 400px; display: flex; flex-direction: column; align-items: center; gap: 24px; }

.login-card {
  width: 100%;
  background: var(--surface-glass);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 32px;
  position: relative;
  overflow: hidden;
}
.login-card::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.06) 0%, transparent 40%);
  pointer-events: none;
}
.login-card::after {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--gradient-tornasol); opacity: 0.8;
}
.login-card .spectral-hit {
  position: absolute; top: -2px; left: -2px; width: 100px; height: 100px;
  background: radial-gradient(circle at top left, rgba(255,255,255,0.16) 0%, transparent 70%);
  pointer-events: none;
}
.login-header { margin-bottom: 24px; }
.login-brand-row { display: flex; align-items: center; gap: 12px; }
.login-mark {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--magenta), var(--violet) 55%, var(--cyan));
  display: flex; align-items: center; justify-content: center;
}
.login-mark svg { width: 21px; height: 21px; color: #fff; }
.login-title { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; color: var(--magenta); }
.login-sub { font-size: 13px; color: var(--ink-muted); margin-top: 8px; }

.field { margin-bottom: 18px; }
.field label {
  display: block; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--ink-muted); margin-bottom: 6px;
}
.field-icon .input-glow {
  display: flex; align-items: center; gap: 10px;
  background: rgba(46,39,53,0.4); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 11px 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.field-icon .input-glow:focus-within { border-color: var(--cyan); box-shadow: 0 0 15px rgba(0,217,227,0.2); }
.field-icon .input-glow svg { color: var(--ink-muted); flex-shrink: 0; }
.field-icon input { flex: 1; min-width: 0; background: transparent; border: none; color: var(--ink); padding: 0; }
.field-icon input:focus { outline: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: var(--radius-sm); border: none;
  font-weight: 600; font-size: 13.5px; cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease, box-shadow 0.2s ease, border-color 0.15s ease;
}
.btn-block { width: 100%; }
.btn-gradient {
  background: var(--gradient-primary); color: #fffaf9; border-radius: 999px;
  padding: 13px 24px; box-shadow: var(--glow-accent);
}
.btn-gradient:hover { box-shadow: 0 0 32px rgba(255,47,114,0.45); filter: brightness(1.06); }
.btn-gradient:active { transform: scale(0.97); }
.btn-gradient:disabled { opacity: 0.5; cursor: default; box-shadow: none; filter: none; }
.btn-primary { background: var(--gradient-primary); color: #fffaf9; box-shadow: var(--glow-accent); }
.btn:disabled { opacity: 0.5; cursor: default; }

.error-text { color: var(--critical); font-size: 12.5px; margin-top: 12px; min-height: 16px; text-align: center; }

.icon-btn-plain {
  background: transparent; border: none; color: var(--ink-muted);
  display: flex; align-items: center; padding: 8px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border);
}
.icon-btn-plain:hover { color: var(--magenta); border-color: var(--border-strong); background: rgba(255,255,255,0.04); }

/* ================= Shell / Sidebar ================= */

.shell { display: none; min-height: 100vh; }
.shell.visible { display: flex; }

.sidebar {
  width: 248px; flex-shrink: 0;
  background: var(--sidebar-bg); color: var(--sidebar-ink);
  display: flex; flex-direction: column; padding: 22px 14px;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; }
.sidebar-brand .mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--magenta), var(--violet) 55%, var(--cyan));
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sidebar-brand .mark svg { width: 18px; height: 18px; color: #fff; }
.sidebar-brand .name { font-family: var(--font-display); font-size: 17px; font-weight: 700; letter-spacing: -0.01em; color: #fff; }
.sidebar-brand .tag { font-size: 10px; color: var(--sidebar-ink-muted); letter-spacing: 0.02em; margin-top: 1px; }

.sidebar-section-label {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--sidebar-ink-muted); padding: 14px 12px 6px;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px;
  color: var(--sidebar-ink-muted); font-size: 13.3px; font-weight: 600;
  cursor: pointer; border: none; background: transparent; width: 100%; text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--sidebar-ink); }
.nav-item.active { background: var(--sidebar-active); color: #fff; }
.nav-item.active .nav-dot {
  margin-left: auto; width: 6px; height: 6px; border-radius: 50%;
  background: linear-gradient(135deg, var(--magenta), var(--gold));
}

.sidebar-foot {
  margin-top: auto; border-radius: var(--radius-md); padding: 14px;
  background: linear-gradient(160deg, rgba(255,47,114,0.22), rgba(155,59,240,0.22));
  border: 1px solid rgba(255,255,255,0.08);
}
.sidebar-foot .t { font-size: 12.5px; font-weight: 700; color: #fff; margin-bottom: 3px; }
.sidebar-foot .d { font-size: 11.3px; color: var(--sidebar-ink-muted); line-height: 1.5; }

/* ================= Main / topbar ================= */

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; padding: 18px 32px; gap: 16px;
  flex-wrap: wrap; row-gap: 10px;
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
  background: rgba(14,10,21,0.85); backdrop-filter: blur(14px);
}
.topbar-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.topbar-title h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-eyebrow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-muted); }
.topbar-title h1 { font-size: 21px; font-weight: 700; letter-spacing: -0.01em; }
.topbar-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.topbar-left-group { display: flex; align-items: center; gap: 12px; min-width: 0; margin-right: auto; }

.hamburger-btn {
  display: none; flex-shrink: 0; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--ink); cursor: pointer;
}
.hamburger-btn:hover { border-color: var(--border-strong); color: var(--magenta); }

.sidebar-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(5,3,9,0.6);
  z-index: 90; opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
}
.sidebar-backdrop.open { opacity: 1; pointer-events: auto; }

.period-group { display: flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); padding: 3px; border-radius: 999px; }
.period-btn { border: none; background: transparent; color: var(--ink-muted); font-size: 11.8px; font-weight: 600; padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.period-btn.active { background: var(--ink); color: var(--bg); }

.user-chip { display: flex; align-items: center; gap: 9px; padding: 5px 12px 5px 5px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.user-chip .avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, var(--cyan), var(--violet)); display:flex;align-items:center;justify-content:center; font-family: var(--font-display); font-size: 11.5px; font-weight: 700; color: #fff; }
.user-chip .who { display: flex; flex-direction: column; line-height: 1.25; }
.user-chip .who b { font-size: 12px; font-weight: 700; }
.user-chip .who span { font-size: 10.5px; color: var(--ink-muted); }

.content { padding: 28px 32px 60px; max-width: 1320px; width: 100%; margin: 0 auto; }
.view { display: none; flex-direction: column; gap: 22px; }
.view.active { display: flex; }

/* ================= Hero ================= */
.hero {
  border-radius: var(--radius-lg); padding: 30px 34px; position: relative; overflow: hidden;
  color: #fff9fb; display: flex; align-items: center; justify-content: space-between; gap: 24px;
  box-shadow: var(--shadow-lg);
}
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 85% -10%, rgba(255,255,255,0.28), transparent 55%);
  pointer-events: none;
}
.hero-eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.85; margin-bottom: 6px; }
.hero h2 { font-size: 25px; font-weight: 700; letter-spacing: -0.01em; max-width: 480px; }
.hero p { font-size: 13px; opacity: 0.86; margin-top: 6px; max-width: 440px; line-height: 1.55; }
.hero-metric { text-align: right; position: relative; z-index: 1; flex-shrink: 0; }
.hero-metric .v { font-family: var(--font-display); font-size: 40px; font-weight: 700; letter-spacing: -0.02em; }
.hero-metric .l { font-size: 11.5px; opacity: 0.82; margin-top: 2px; }
.hero-metric .delta { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; font-size: 11.5px; font-weight: 700; background: rgba(255,255,255,0.18); padding: 4px 9px; border-radius: 999px; }

.hero.tone-magenta { background: linear-gradient(120deg, #ff2f72 0%, #b81fa8 45%, #6a17ad 100%); }
.hero.tone-violet { background: linear-gradient(120deg, #7c1fd0 0%, #4a1d9e 55%, #1c1440 100%); }
.hero.tone-cyan { background: linear-gradient(120deg, #00b7c4 0%, #0a7fae 55%, #1c1440 100%); }
.hero.tone-gold { background: linear-gradient(120deg, #ffb238 0%, #e8672f 55%, #9b1f6a 100%); }

/* ================= Grids / cards ================= */
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1100px) { .grid-4, .grid-5 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2,1fr);} }

/* min-width: 0 es la parte importante -- sin esto, una tarjeta con una
   tabla ancha o un chart de ancho fijo adentro empuja su columna de grid
   a crecer con el contenido en vez de encogerse al espacio disponible
   (el "grid blowout" clasico). Con esto, el contenido ancho hace scroll
   horizontal DENTRO de la tarjeta (.table-wrap) en vez de desbordar la
   pagina completa. */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 20px; min-width: 0; }
.grid { min-width: 0; }
.grid > * { min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; row-gap: 10px; }
.donut-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.card-head h3 { font-size: 14.5px; font-weight: 700; }
.card-head .sub { font-size: 11.5px; color: var(--ink-muted); margin-top: 2px; }
.card-head-left { display: flex; flex-direction: column; }

.stat-tile { display: flex; flex-direction: column; gap: 10px; }
.stat-icon { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.stat-icon svg { width: 17px; height: 17px; }
.stat-label { font-size: 11.8px; color: var(--ink-muted); font-weight: 600; }
.stat-value { font-family: var(--font-display); font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.stat-foot { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; }
.delta-up { color: var(--good); }
.delta-down { color: var(--critical); }
.delta-flat { color: var(--ink-muted); }
.stat-foot .vs { color: var(--ink-muted); font-weight: 500; }

.icon-tint-magenta { background: rgba(255,47,114,0.16); color: var(--magenta); }
.icon-tint-violet { background: rgba(155,59,240,0.16); color: var(--violet); }
.icon-tint-cyan { background: rgba(0,217,227,0.16); color: var(--cyan); }
.icon-tint-gold { background: rgba(255,178,56,0.18); color: var(--gold); }
.icon-tint-good { background: rgba(53,221,158,0.16); color: var(--good); }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.pill-auto { background: rgba(0,217,227,0.16); color: var(--cyan); }
.pill-manual { background: rgba(255,178,56,0.18); color: var(--gold); }
.pill-calc { background: rgba(155,59,240,0.16); color: var(--violet); }
.pill-good { background: rgba(53,221,158,0.16); color: var(--good); }
.pill-warn { background: rgba(255,178,56,0.18); color: var(--warn); }
.pill-critical { background: rgba(255,92,122,0.16); color: var(--critical); }

/* ================= Tables ================= */
.table-wrap {
  overflow-x: auto;
  /* La barra nativa del navegador no se puede dejar "siempre visible" de
     forma confiable entre plataformas -- iOS Safari ni siquiera soporta
     ::-webkit-scrollbar, y Chrome/Android la muestra solo mientras haces
     el gesto de swipe y luego la desvanece. Por eso se oculta la nativa
     aqui y se dibuja un indicador propio permanente (.scroll-indicator,
     ver mas abajo + attachScrollIndicators() en app.js) que sí se controla
     100% por CSS/JS y se ve igual en cualquier dispositivo. */
  scrollbar-width: none;
}
.table-wrap::-webkit-scrollbar { display: none; }

.scroll-indicator {
  position: relative;
  height: 5px;
  border-radius: 999px;
  background: var(--surface-2);
  margin-top: 10px;
  overflow: hidden;
}
.scroll-indicator-thumb {
  position: absolute;
  top: 0; left: 0; height: 100%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.4);
}
table { width: 100%; border-collapse: collapse; font-size: 12.8px; }
th { text-align: left; font-size: 10.8px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-muted); font-weight: 700; padding: 0 12px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
.cell-main { font-weight: 600; }
.cell-muted { color: var(--ink-muted); }
.avatar-sm { width: 22px; height: 22px; border-radius: 50%; display:inline-flex;align-items:center;justify-content:center; font-size: 9.5px; font-weight: 700; color: #fff; margin-right: 7px; vertical-align: middle; }

/* ================= Charts ================= */
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-muted); font-weight: 600; }
.legend-swatch { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.chart-tooltip {
  position: fixed; pointer-events: none; opacity: 0; transition: opacity 0.1s ease;
  background: var(--ink); color: var(--bg); font-size: 11px; font-weight: 600;
  padding: 6px 9px; border-radius: 8px; z-index: 999; transform: translate(-50%, -130%);
  box-shadow: var(--shadow-md); max-width: 220px;
}
.chart-tooltip .tt-label { opacity: 0.7; font-weight: 500; margin-bottom: 1px; }
.axis-label { font-size: 10px; fill: var(--ink-muted); font-family: var(--font-body); }

/* ================= Progress / goal bars ================= */
.goal-row { display: flex; flex-direction: column; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.goal-row:last-child { border-bottom: none; padding-bottom: 0; }
.goal-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.goal-name { font-size: 12.8px; font-weight: 700; }
.goal-meta { font-size: 11px; color: var(--ink-muted); margin-top: 1px; }
.goal-value { font-size: 12.5px; font-weight: 700; font-family: var(--font-display); }
.goal-track { height: 7px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.goal-fill { height: 100%; border-radius: 999px; }

/* ================= Layout auxiliar ================= */
.module-split { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .module-split { grid-template-columns: 1fr; } }

.btn-mini { border: none; border-radius: var(--radius-sm); padding: 9px 14px; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.btn-mini-primary { background: linear-gradient(120deg, var(--magenta), var(--violet)); color: #fff; }

.source-card { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--radius-md); border: 1px solid var(--border); }
.source-card .ic { width: 38px; height: 38px; border-radius: 10px; display:flex;align-items:center;justify-content:center; flex-shrink:0; }
.source-card .body { flex: 1; min-width: 0; }
.source-card .name { font-size: 13px; font-weight: 700; }
.source-card .status { font-size: 11.3px; color: var(--ink-muted); margin-top: 1px; }

.note-banner {
  font-size: 12px; color: var(--ink-muted); background: var(--surface-2);
  border: 1px dashed var(--border-strong); border-radius: var(--radius-md);
  padding: 10px 14px; display: flex; align-items: center; gap: 8px;
}
.note-banner svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--gold); }

/* ================= Responsive ================= */

/* Tablet / laptops chicos: la sidebar se vuelve un drawer, el contenido
   usa todo el ancho. Mismo shell, misma sidebar -- solo cambia como se
   posiciona, no se duplica markup. */
@media (max-width: 900px) {
  .hamburger-btn { display: flex; }
  .sidebar-backdrop { display: block; }

  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 100;
    width: min(280px, 84vw); height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }

  .content { padding: 20px 18px 48px; }
  .topbar { padding: 14px 18px; }
  .hero { padding: 24px 22px; }
}

/* Mobile: grids a una columna, hero apilado, chips mas compactos. */
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }

  .hero { flex-direction: column; align-items: flex-start; gap: 18px; }
  .hero-metric { text-align: left; width: 100%; }
  .hero h2 { font-size: 20px; max-width: none; }
  .hero-metric .v { font-size: 30px; }

  /* Texto del titulo mas chico solo en movil, para que quepa junto al
     hamburguesa en la misma fila que el avatar + logout, sin espacio
     muerto de por medio. */
  .topbar-title h1 { font-size: 14.5px; min-width: 0; }
  .topbar-title { overflow: hidden; }
  .topbar-eyebrow { display: none; }
  /* Tope duro de ancho -- sin esto, un titulo largo (ej. "Actividad /
     Bitacora") puede seguir empujando el avatar+logout a su propia fila
     aunque el texto trunque, porque un h1 con white-space:nowrap puede
     reportar su ancho de contenido completo como minimo dentro de un
     padre en columna. Con max-width fijo, siempre le toca su cupo y trunca. */
  .topbar-left-group { gap: 8px; max-width: 60%; }

  /* period-group ahora es hijo directo de .topbar (no de .topbar-right),
     asi que forzar su propia fila con flex-basis no afecta el calculo de
     ancho de los otros dos grupos -- fila 1 siempre es hamburguesa+titulo
     ... avatar+logout, fila 2 es el periodo completo. */
  .period-group { order: 3; flex-basis: 100%; max-width: none; justify-content: space-between; overflow-x: auto; scrollbar-width: none; }
  .period-group::-webkit-scrollbar { display: none; }
  .period-btn { flex-shrink: 0; }

  .content { padding: 16px 14px 40px; }
  .card { padding: 16px; border-radius: var(--radius-md); }
  .module-split { gap: 14px; }

  .login-card { padding: 32px 22px; }
  .login-title { font-size: 27px; }
}

@media (max-width: 480px) {
  .user-chip .who { display: none; }
  .user-chip { padding: 5px; gap: 0; }
  .topbar-right { gap: 8px; }
}

/* Bloquea el scroll de la pagina de fondo mientras el drawer esta abierto
   en movil -- overflow:hidden solo en body NO alcanza en iOS Safari (sigue
   dejando pasar el swipe), por eso se fija con position:fixed + top negativo
   guardando el scroll actual, y se restaura al cerrar (ver app.js). */
body.menu-open { position: fixed; left: 0; right: 0; overflow: hidden; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
