/* ==========================================================================
   Curva — consola de canal
   Sistema visual: gris cálido de sala de montaje + acentos de etalonaje
   (ámbar = por encima de la mediana, verde azulado = por debajo)
   ========================================================================== */

:root {
  /* Superficies */
  --bg: #101114;
  --surface: #17181C;
  --surface-2: #1E2025;
  --surface-3: #272A31;
  --line: #343841;
  --line-soft: #23262C;

  /* Tinta */
  --text: #EEF0F5;
  --dim: #9AA0AD;
  --faint: #6B7180;

  /* Acentos */
  --hot: #FF6B57;
  --hot-soft: rgba(255, 107, 87, 0.18);
  --hot-line: rgba(255, 107, 87, 0.4);
  --cool: #6C7CFF;
  --cool-soft: rgba(108, 124, 255, 0.18);
  --cool-line: rgba(108, 124, 255, 0.4);
  --alert: #F04E5E;
  --alert-soft: rgba(240, 78, 94, 0.18);

  /* Tipografía */
  --display: "Bricolage Grotesque", "Archivo", system-ui, sans-serif;
  --sans: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Métrica */
  --rail-w: 248px;
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
ul { margin: 0; padding: 0; list-style: none; }

:focus-visible {
  outline: 2px solid var(--hot);
  outline-offset: 2px;
  border-radius: 3px;
}

::selection { background: var(--hot); color: #17140F; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3C3733; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.hidden { display: none !important; }

/* ==========================================================================
   Barra lateral
   ========================================================================== */
.rail {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--rail-w);
  background: var(--surface);
  border-right: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  z-index: 40;
}

.rail-head { padding: 20px 18px 14px; }

.wordmark {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.03em;
}

.wordmark svg { flex: none; }

.wordmark small {
  display: block;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: 1px;
}

/* Selector de canal */
.channel {
  margin: 4px 12px 12px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  cursor: pointer;
  width: calc(100% - 24px);
  text-align: left;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.channel:hover { border-color: var(--line); background: var(--surface-3); }

.channel-avatar {
  width: 30px; height: 30px;
  flex: none;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--hot), #B4552A);
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: 13px;
  color: #1A1005;
}

.channel-meta { min-width: 0; flex: 1; }
.channel-name {
  display: block;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.channel-subs { display: block; font-size: 11px; color: var(--faint); font-family: var(--mono); }

/* Navegación */
.nav { flex: 1; overflow-y: auto; padding: 4px 12px; }

.nav-label {
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 16px 8px 6px;
  font-weight: 600;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--dim);
  font-weight: 500;
  font-size: 13.5px;
  position: relative;
  transition: color 0.13s var(--ease), background 0.13s var(--ease);
}
.nav a svg { flex: none; opacity: 0.75; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--text); background: var(--surface-3); }
.nav a[aria-current="page"] svg { opacity: 1; color: var(--hot); }
.nav a[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -12px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 18px;
  background: var(--hot);
  border-radius: 0 3px 3px 0;
}

.nav-count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  background: var(--surface-3);
  padding: 1px 6px;
  border-radius: 99px;
}

/* Pie: cuota y sincronización */
.rail-foot {
  padding: 14px 18px 16px;
  border-top: 1px solid var(--line-soft);
}

.quota-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 11px;
  color: var(--faint);
  margin-bottom: 6px;
}
.quota-row strong {
  font-family: var(--mono);
  font-weight: 500;
  color: var(--dim);
  font-size: 11px;
}

.quota-track {
  height: 4px;
  background: var(--surface-3);
  border-radius: 99px;
  overflow: hidden;
}
.quota-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cool), var(--hot));
  border-radius: 99px;
  transition: width 0.6s var(--ease);
}

.sync-line {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--faint);
}
.dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--cool);
  flex: none;
  box-shadow: 0 0 0 3px var(--cool-soft);
}
.dot.warn { background: var(--hot); box-shadow: 0 0 0 3px var(--hot-soft); }

/* ==========================================================================
   Estructura principal
   ========================================================================== */
.shell { margin-left: var(--rail-w); min-height: 100vh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 18px 32px;
  background: rgba(18, 17, 16, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}

.topbar-title { min-width: 0; }
.topbar-title h1 {
  font-family: var(--display);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.025em;
}
.topbar-title p { font-size: 12.5px; color: var(--faint); margin-top: 1px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.page {
  padding: 24px 32px 72px;
  max-width: 1560px;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 34px 0 14px;
}
.section-head:first-child { margin-top: 0; }
.section-head h2 {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.section-head p { font-size: 12.5px; color: var(--faint); }
.section-head .spacer { margin-left: auto; }

/* ==========================================================================
   Rejillas
   ========================================================================== */
.grid { display: grid; gap: 14px; }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-5 { grid-template-columns: repeat(5, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-8-4 { grid-template-columns: 2fr 1fr; }
.g-7-5 { grid-template-columns: 1.4fr 1fr; }
.g-5-7 { grid-template-columns: 1fr 1.4fr; }

/* ==========================================================================
   Tarjetas
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  position: relative;
}
.card.flush { padding: 0; overflow: hidden; }
.card.tight { padding: 12px 14px; }

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.card-head h3 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.card-head .spacer { margin-left: auto; }
.card-head .hint { font-size: 11.5px; color: var(--faint); font-weight: 400; }

.card-sub { font-size: 12px; color: var(--faint); margin-top: -8px; margin-bottom: 14px; }

/* Indicador clave */
.kpi { display: flex; flex-direction: column; gap: 10px; }
.kpi-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 600;
}
.kpi-value {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.kpi-value span { font-size: 15px; color: var(--dim); font-weight: 600; margin-left: 2px; }
.kpi-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }

.delta {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: var(--r-sm);
}
.delta.up { color: var(--hot); background: var(--hot-soft); }
.delta.down { color: var(--cool); background: var(--cool-soft); }
.delta.flat { color: var(--faint); background: var(--surface-2); }

/* ==========================================================================
   Botones
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.13s var(--ease), border-color 0.13s var(--ease), transform 0.08s var(--ease);
}
.btn:hover { background: var(--surface-3); border-color: #423C36; }
.btn:active { transform: translateY(1px); }
.btn svg { flex: none; opacity: 0.8; }

.btn.primary {
  background: var(--hot);
  border-color: var(--hot);
  color: #1B1207;
  font-weight: 600;
}
.btn.primary:hover { background: #F0A257; border-color: #F0A257; }
.btn.primary svg { opacity: 1; }

.btn.ghost { background: transparent; border-color: transparent; color: var(--dim); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }

.btn.danger { color: var(--alert); border-color: rgba(217, 80, 63, 0.3); background: transparent; }
.btn.danger:hover { background: var(--alert-soft); border-color: var(--alert); }

.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.icon { padding: 7px; }

/* Selector segmentado */
.segmented {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  padding: 2px;
}
.segmented button {
  border: 0;
  background: transparent;
  color: var(--faint);
  padding: 5px 11px;
  border-radius: 4px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--mono);
  transition: color 0.13s var(--ease), background 0.13s var(--ease);
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }

/* ==========================================================================
   Formularios
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 14px; }

.field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--dim);
}
.field .help { font-size: 11.5px; color: var(--faint); line-height: 1.45; }

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="datetime-local"], input[type="date"],
input[type="search"], select, textarea {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 8px 11px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 13.5px;
  width: 100%;
  transition: border-color 0.13s var(--ease), background 0.13s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: #423C36; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--hot);
  background: var(--surface-3);
}
textarea { resize: vertical; min-height: 78px; line-height: 1.55; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 8l3-3.5' stroke='%23A79E93' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}
input.mono-in, .mono-in { font-family: var(--mono); font-size: 12.5px; letter-spacing: -0.01em; }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: start; }
.row-2 > .field + .field, .row-3 > .field + .field { margin-top: 0; }

/* Interruptor */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
  width: 34px; height: 20px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 99px;
  position: relative;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease);
  flex: none;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--dim);
  transition: transform 0.18s var(--ease), background 0.18s var(--ease);
}
.switch input:checked + .switch-track { background: var(--hot); border-color: var(--hot); }
.switch input:checked + .switch-track::after { transform: translateX(14px); background: #1B1207; }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--hot); outline-offset: 2px; }
.switch-text { font-size: 13px; }
.switch-text small { display: block; color: var(--faint); font-size: 11.5px; }

/* ==========================================================================
   Distintivos y píldoras
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge.hot { color: var(--hot); background: var(--hot-soft); border-color: var(--hot-line); }
.badge.cool { color: var(--cool); background: var(--cool-soft); border-color: var(--cool-line); }
.badge.neutral { color: var(--dim); background: var(--surface-2); border-color: var(--line); }
.badge.alert { color: var(--alert); background: var(--alert-soft); border-color: rgba(217, 80, 63, 0.3); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 12px;
  color: var(--dim);
  cursor: pointer;
  transition: all 0.13s var(--ease);
}
.chip:hover { border-color: #423C36; color: var(--text); }
.chip[aria-pressed="true"] { background: var(--hot-soft); border-color: var(--hot-line); color: var(--hot); }
.chip .swatch { width: 8px; height: 8px; border-radius: 2px; flex: none; }

/* ==========================================================================
   Índice de rendimiento — elemento firma
   ========================================================================== */
.index-bar {
  --pos: 50%;
  position: relative;
  height: 4px;
  background: var(--surface-3);
  border-radius: 99px;
  overflow: hidden;
}
.index-bar::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: min(50%, var(--pos));
  right: calc(100% - max(50%, var(--pos)));
  background: var(--hot);
  border-radius: 99px;
}
.index-bar.under::before { background: var(--cool); }
.index-bar::after {
  content: "";
  position: absolute;
  left: 50%; top: -2px; bottom: -2px;
  width: 1px;
  background: var(--faint);
  opacity: 0.7;
}

.index-value {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.index-value.up { color: var(--hot); }
.index-value.down { color: var(--cool); }

/* ==========================================================================
   Fichas de vídeo
   ========================================================================== */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: 16px;
}

.video-card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), transform 0.15s var(--ease);
  display: flex;
  flex-direction: column;
}
.video-card:hover { border-color: var(--line); transform: translateY(-2px); }

.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--surface-3);
  overflow: hidden;
}
.thumb svg { display: block; width: 100%; height: 100%; }
.thumb-time {
  position: absolute;
  right: 6px; bottom: 6px;
  background: rgba(10, 9, 8, 0.85);
  color: #F2ECE3;
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 1px 5px;
  border-radius: 3px;
}
.thumb-flag {
  position: absolute;
  left: 6px; top: 6px;
}
.thumb-flag .badge {
  background: rgba(12, 11, 10, 0.82);
  backdrop-filter: blur(4px);
}

.video-body { padding: 11px 12px 12px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.video-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 35px;
}
.video-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--faint);
}
.video-meta .sep { opacity: 0.4; }
.video-foot { margin-top: auto; display: flex; flex-direction: column; gap: 5px; }
.video-foot-row { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--faint); }

/* ==========================================================================
   Tablas
   ========================================================================== */
.table-wrap { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th {
  text-align: left;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--surface);
}
table.data th.right, table.data td.right { text-align: right; }
table.data td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
table.data tbody tr { transition: background 0.1s var(--ease); }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }

.cell-video { display: flex; align-items: center; gap: 11px; min-width: 280px; }
.cell-thumb {
  width: 68px;
  aspect-ratio: 16 / 9;
  border-radius: 4px;
  overflow: hidden;
  flex: none;
  background: var(--surface-3);
}
.cell-thumb svg { width: 100%; height: 100%; display: block; }
.cell-video-text { min-width: 0; }
.cell-video-text strong {
  display: block;
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 330px;
}
.cell-video-text small { color: var(--faint); font-family: var(--mono); font-size: 11px; }

/* ==========================================================================
   Listas de elementos
   ========================================================================== */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
}
.list-item:last-child { border-bottom: 0; }
.list-item:first-child { padding-top: 0; }

.rank {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  color: var(--faint);
  width: 18px;
  flex: none;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Barra de filtros
   ========================================================================== */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.search {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 380px;
}
.search svg {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  pointer-events: none;
}
.search input { padding-left: 32px; }
.toolbar .spacer { margin-left: auto; }
.toolbar select { width: auto; min-width: 140px; }

/* ==========================================================================
   Gráficos
   ========================================================================== */
.chart { width: 100%; display: block; overflow: visible; }
.chart text { font-family: var(--mono); fill: var(--faint); font-size: 10px; }
.chart .grid-line { stroke: var(--line-soft); stroke-width: 1; }
.chart .axis-line { stroke: var(--line); stroke-width: 1; }
.chart .band { fill: var(--surface-3); opacity: 0.85; }
.chart .median { stroke: var(--faint); stroke-width: 1.5; stroke-dasharray: 4 4; fill: none; }
.chart .serie { fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.chart .serie.hot { stroke: var(--hot); }
.chart .serie.cool { stroke: var(--cool); }
.chart .serie.dim { stroke: var(--faint); opacity: 0.35; stroke-width: 1.25; }
.chart .bar-hot { fill: var(--hot); }
.chart .bar-cool { fill: var(--cool); }
.chart .bar-track { fill: var(--surface-3); }
.chart .label-strong { fill: var(--text); font-family: var(--sans); font-size: 11px; }

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 12px;
  font-size: 11.5px;
  color: var(--faint);
}
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 2px; border-radius: 2px; display: block; }

.draw .serie { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 1.1s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* Mapa de calor */
.heat { display: grid; grid-template-columns: 30px repeat(12, 1fr); gap: 3px; }
.heat-cell { height: 26px; border-radius: 3px; background: var(--surface-3); }
.heat-label { height: 26px; font-family: var(--mono); font-size: 10px; color: var(--faint); display: grid; place-items: center; }

/* ==========================================================================
   IA: tarjetas de proveedor y roles
   ========================================================================== */
.provider-card { display: flex; flex-direction: column; gap: 0; height: 100%; }
.provider-card .btn-add { margin-top: auto; width: 100%; justify-content: center; }
.provider-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line-soft);
}
.provider-logo {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: 14px;
  flex: none;
}
.provider-name { font-weight: 600; font-size: 14px; }
.provider-sub { font-size: 11.5px; color: var(--faint); font-family: var(--mono); }

.key-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
}
.key-row:last-of-type { border-bottom: 0; }
.key-info { min-width: 0; flex: 1; }
.key-account { font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.key-secret { font-family: var(--mono); font-size: 11px; color: var(--faint); letter-spacing: 0.02em; }

.usage-bar { height: 3px; background: var(--surface-3); border-radius: 99px; margin-top: 5px; overflow: hidden; }
.usage-bar i { display: block; height: 100%; background: var(--cool); border-radius: 99px; }
.usage-bar i.high { background: var(--hot); }
.usage-bar i.full { background: var(--alert); }

/* Rol */
.role-card { border-left: 2px solid var(--hot); }
.role-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.role-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--hot-soft);
  color: var(--hot);
  display: grid;
  place-items: center;
  flex: none;
}
.role-title { font-weight: 600; font-size: 14px; }
.role-desc { font-size: 12px; color: var(--faint); line-height: 1.45; margin-top: 2px; }

.fallback-chain { display: flex; flex-direction: column; gap: 6px; }
.fallback-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  font-size: 12.5px;
}
.fallback-order {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--faint);
  background: var(--surface-3);
  width: 18px; height: 18px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  flex: none;
}
.fallback-item .drag { color: var(--faint); cursor: grab; margin-left: auto; }

/* ==========================================================================
   Calendario
   ========================================================================== */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: var(--r); overflow: hidden; }
.cal-dow {
  background: var(--surface-2);
  padding: 7px 9px;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 600;
}
.cal-day {
  background: var(--surface);
  min-width: 0;
  min-height: 92px;
  padding: 7px 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: background 0.12s var(--ease);
}
.cal-day:hover { background: var(--surface-2); }
.cal-day.out { background: var(--bg); }
.cal-day.out .cal-num { opacity: 0.3; }
.cal-num { font-family: var(--mono); font-size: 11.5px; color: var(--faint); }
.cal-day.today .cal-num {
  color: #1B1207;
  background: var(--hot);
  border-radius: 99px;
  width: 19px; height: 19px;
  display: grid;
  place-items: center;
  font-weight: 600;
}
.cal-ev {
  min-width: 0;
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 4px;
  background: var(--hot-soft);
  color: var(--hot);
  border-left: 2px solid var(--hot);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.cal-ev.draft { background: var(--surface-3); color: var(--dim); border-left-color: var(--faint); }
.cal-ev.done { background: var(--cool-soft); color: var(--cool); border-left-color: var(--cool); }

/* ==========================================================================
   Zona de subida
   ========================================================================== */
.dropzone {
  border: 1.5px dashed var(--line);
  border-radius: var(--r);
  padding: 32px 20px;
  text-align: center;
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.dropzone:hover { border-color: var(--hot); background: var(--hot-soft); }
.dropzone svg { color: var(--faint); margin-bottom: 10px; }
.dropzone strong { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 3px; }
.dropzone span { font-size: 12px; color: var(--faint); }

.upload-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}
.upload-item:last-child { border-bottom: 0; }
.upload-progress { height: 3px; background: var(--surface-3); border-radius: 99px; margin-top: 9px; overflow: hidden; }
.upload-progress i { display: block; height: 100%; background: var(--hot); border-radius: 99px; transition: width 0.4s var(--ease); }

/* ==========================================================================
   Estado vacío
   ========================================================================== */
.empty {
  text-align: center;
  padding: 46px 24px;
  color: var(--faint);
}
.empty svg { margin-bottom: 12px; opacity: 0.5; }
.empty strong { display: block; color: var(--text); font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.empty p { font-size: 12.5px; max-width: 320px; margin: 0 auto 16px; line-height: 1.5; }

/* ==========================================================================
   Avisos
   ========================================================================== */
.toast-stack {
  position: fixed;
  right: 24px; bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 11px 15px;
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: rise 0.28s var(--ease);
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.toast .dot { background: var(--hot); box-shadow: 0 0 0 3px var(--hot-soft); }

.notice {
  display: flex;
  gap: 11px;
  padding: 13px 15px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-left: 2px solid var(--hot);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--dim);
}
.notice svg { flex: none; color: var(--hot); margin-top: 1px; }
.notice strong { color: var(--text); font-weight: 600; display: block; margin-bottom: 2px; font-size: 13px; }

/* ==========================================================================
   Entrada escalonada
   ========================================================================== */
.stagger > * { animation: fade 0.4s var(--ease) backwards; }
.stagger > *:nth-child(1) { animation-delay: 0.02s; }
.stagger > *:nth-child(2) { animation-delay: 0.06s; }
.stagger > *:nth-child(3) { animation-delay: 0.1s; }
.stagger > *:nth-child(4) { animation-delay: 0.14s; }
.stagger > *:nth-child(5) { animation-delay: 0.18s; }
.stagger > *:nth-child(6) { animation-delay: 0.22s; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

/* ==========================================================================
   Adaptación
   ========================================================================== */
@media (max-width: 1240px) {
  .g-4 { grid-template-columns: repeat(2, 1fr); }
  .g-5 { grid-template-columns: repeat(3, 1fr); }
  .g-3 { grid-template-columns: repeat(2, 1fr); }
  .g-8-4, .g-7-5, .g-5-7 { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  :root { --rail-w: 62px; }
  .rail-head .wordmark small, .channel-meta, .nav a span, .nav-label, .rail-foot .quota-row,
  .rail-foot .quota-track, .sync-line span { display: none; }
  .rail-head { padding: 18px 0; display: grid; place-items: center; }
  .channel { justify-content: center; margin: 0 auto 12px; width: 44px; padding: 6px; }
  .nav { padding: 4px 10px; }
  .nav a { justify-content: center; padding: 10px 0; }
  .nav a::before { left: -10px; }
  .nav-count { display: none; }
  .rail-foot { display: grid; place-items: center; padding: 12px 0; }
  .topbar, .page { padding-left: 18px; padding-right: 18px; }
  .g-5, .g-4, .g-3, .g-2, .row-2, .row-3 { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; }
}

@media (max-width: 560px) {
  .topbar-actions { width: 100%; margin-left: 0; }
  .kpi-value { font-size: 26px; }
  .cal-day { min-height: 62px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
