/* ================= BriskBox · Meta Ads — misma dirección visual que el dashboard comercial =================
   Fondo gris claro, cards blancas con sombra real y radios generosos, KPIs con
   fill sólido (naranja) + una card de contraste oscura. Sidebar de navegación. */
:root {
  --bg:        #F7F7F5;
  --surface:   #FFFFFF;
  --surface-2: #F1F0ED;
  --dark:      #1B1B1F;
  --border:    rgba(23,23,27,.07);
  --text:      #26262B;
  --text-2:    #6B6B72;
  --text-3:    #9A9AA0;
  --accent:    #F93D00;
  --accent-2:  #FF6A3C;
  --accent-wash:#FDECE4;
  --good:      #1E8A55;
  --good-wash: #E6F4EC;
  --bad:       #D93600;
  --font-main:'Space Grotesk',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
  --radius:18px;
  --radius-md:14px;
  --radius-sm:10px;
  --shadow-sm:0 1px 2px rgba(23,23,27,.04), 0 1px 3px rgba(23,23,27,.05);
  --shadow:0 2px 6px rgba(23,23,27,.04), 0 14px 30px -16px rgba(23,23,27,.16);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}
h1, h2, h3 { margin: 0; font-family: var(--font-main); font-weight: 600; letter-spacing: -.01em; }
button { font-family: inherit; cursor: pointer; }
[hidden] { display: none !important; }
.filter-label, .panel-hint, .stat-label, .live-text, .data-table th,
.filter-reset, .btn-ghost, .zone-sub { font-family: var(--font-main); }

/* ---------- Shell + sidebar ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 214px; flex: 0 0 214px; position: sticky; top: 0; height: 100vh;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 14px;
}
.sidebar-brand { display: flex; justify-content: center; padding: 6px 8px 0; }
.sidebar-logo { width: 122px; max-width: 78%; height: auto; display: block; }
.sidebar-nav { display: flex; flex-direction: column; gap: 3px; margin-top: 34px; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: 11px; text-decoration: none;
  font-family: var(--font-main); color: var(--text-2); font-size: 13px; font-weight: 500; letter-spacing: 0;
  padding: 10px 11px; border-radius: var(--radius-sm); transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--accent-wash); color: var(--accent); font-weight: 500; }
.nav-ico { display: grid; place-items: center; width: 18px; height: 18px; flex: 0 0 18px; }
.nav-ico svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding: 14px 8px 4px; border-top: 1px solid var(--border); }
.live { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 11px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #2FA36B; }
.live-dot.pulse { animation: blink 1.2s ease-out; }
@keyframes blink { 0% { background: var(--accent); } 100% { background: #2FA36B; } }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text-2); border-radius: var(--radius-sm); padding: 8px 12px; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; transition: .15s; }
.btn-ghost:hover { border-color: var(--text-3); color: var(--text); }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* Piezas solo-mobile: ocultas en desktop, activadas en @media (max-width: 768px). */
.mobile-topbar { display: none; }
.nav-backdrop { display: none; }

/* ---------- Filtros ---------- */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 14px 22px; position: sticky; top: 0; z-index: 10; background: rgba(247,247,245,.85); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.filter-field { display: flex; flex-direction: column; gap: 6px; }
.filter-label { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); }
.filter-select, .filter-date { background: var(--surface); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius-sm); padding: 8px 11px; font-size: 13px; font-family: var(--font-main); outline: none; min-width: 150px; box-shadow: var(--shadow-sm); transition: border-color .15s; }
.filter-select:focus, .filter-date:focus { border-color: var(--accent); }
.filter-custom { display: flex; gap: 12px; }
.filter-reset { background: var(--surface); border: 1px solid var(--border); color: var(--text-2); border-radius: var(--radius-sm); padding: 8px 13px; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; height: 36px; align-self: flex-end; box-shadow: var(--shadow-sm); transition: .15s; }
.filter-reset:hover { color: var(--accent); border-color: var(--accent); }


/* ---------- Dropdown custom (reemplaza <select> nativos) ---------- */
.dd { position: relative; }
.dd-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; min-width: 150px; background: var(--surface); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius-sm); padding: 8px 11px; font-size: 13px;
  font-family: var(--font-main); box-shadow: var(--shadow-sm); cursor: pointer; text-align: left;
  transition: border-color .15s, box-shadow .15s;
}
.dd-toggle:hover { border-color: var(--text-3); }
.dd-toggle:focus-visible, .dd.open .dd-toggle { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.dd-value { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dd-chevron { width: 14px; height: 14px; flex: 0 0 14px; color: var(--text-3); transition: transform .15s; }
.dd.open .dd-chevron { transform: rotate(180deg); }
.dd-menu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 100%; z-index: 50;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow); padding: 5px; max-height: 280px; overflow-y: auto;
}
.dd-option {
  display: block; width: 100%; text-align: left; background: transparent; border: 0;
  border-radius: var(--radius-sm); padding: 8px 10px; font-family: var(--font-main);
  font-size: 12px; color: var(--text-2); cursor: pointer; white-space: nowrap;
}
.dd-option:hover, .dd-option.is-focus { background: var(--surface-2); color: var(--text); }
.dd-option.is-active { color: var(--accent); font-weight: 500; }

/* ---------- Datepicker custom (reemplaza <input type="date"> nativos) ---------- */
.dp { position: relative; }
.dp-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; min-width: 150px; background: var(--surface); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius-sm); padding: 8px 11px; font-size: 13px;
  font-family: var(--font-main); box-shadow: var(--shadow-sm); cursor: pointer; text-align: left;
  transition: border-color .15s, box-shadow .15s;
}
.dp-toggle:hover { border-color: var(--text-3); }
.dp-toggle:focus-visible, .dp.open .dp-toggle { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.dp-value { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dp-value.is-placeholder { color: var(--text-3); }
.dp-icon { width: 15px; height: 15px; flex: 0 0 15px; color: var(--text-3); }
.dp.open .dp-icon { color: var(--accent); }
.dp-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 50; width: 268px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow); padding: 12px;
}
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dp-month {
  font-family: var(--font-main); font-size: 13px; font-weight: 600; color: var(--text);
  text-transform: capitalize; letter-spacing: -.01em;
}
.dp-nav {
  display: grid; place-items: center; width: 28px; height: 28px; background: transparent;
  border: 0; border-radius: var(--radius-sm); color: var(--text-2); cursor: pointer; transition: .15s;
}
.dp-nav svg { width: 16px; height: 16px; }
.dp-nav:hover { background: var(--surface-2); color: var(--accent); }
.dp-dow, .dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.dp-dow { margin-bottom: 4px; }
.dp-dow span {
  text-align: center; font-size: 10px; font-weight: 500; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .04em; padding: 4px 0;
}
.dp-grid { gap: 2px; }
.dp-day {
  aspect-ratio: 1; display: grid; place-items: center; background: transparent; border: 0;
  border-radius: var(--radius-sm); font-family: var(--font-main); font-size: 12.5px;
  color: var(--text); cursor: pointer; transition: background .12s, color .12s;
  font-variant-numeric: tabular-nums;
}
.dp-day:hover { background: var(--surface-2); }
.dp-day.is-muted { color: var(--text-3); }
.dp-day.is-today { color: var(--accent); font-weight: 600; }
.dp-day.is-selected, .dp-day.is-selected:hover { background: var(--accent); color: #fff; font-weight: 600; }
.dp-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.dp-action {
  background: transparent; border: 0; padding: 4px 8px; font-family: var(--font-main);
  font-size: 12px; font-weight: 500; color: var(--accent); cursor: pointer; border-radius: var(--radius-sm);
  transition: background .12s;
}
.dp-action:hover { background: var(--accent-wash); }

/* ---------- Layout ---------- */
.view-root { padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; max-width: 1600px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }

/* ---------- Stat cards (default blanca; variantes brand / dark) ---------- */
.stat-card { background: var(--surface); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); transition: box-shadow .2s, transform .2s; }
.stat-card:hover { box-shadow: var(--shadow); }
.stat-body { display: flex; flex-direction: column; gap: 11px; }
.stat-label { color: var(--text-3); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; }
.stat-value { font-family: var(--font-main); font-size: clamp(30px,3.2vw,42px); font-weight: 700; letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums; color: var(--text); }
.delta { font-size: 11px; font-family: var(--font-main); color: var(--text-2); }
.delta-up, .delta-down, .delta-flat { color: var(--text-2); }
/* variante fill naranja */
.stat-brand { background: var(--accent); box-shadow: 0 10px 24px -12px rgba(249,61,0,.6); }
.stat-brand .stat-label { color: rgba(255,255,255,.82); }
.stat-brand .stat-value { color: #fff; }
.stat-brand .delta { color: rgba(255,255,255,.9); }
/* variante contraste oscuro */
.stat-dark { background: var(--dark); box-shadow: 0 10px 24px -14px rgba(0,0,0,.6); }
.stat-dark .stat-label { color: rgba(255,255,255,.6); }
.stat-dark .stat-value { color: #fff; }
.stat-dark .delta { color: rgba(255,255,255,.7); }

/* ---------- Paneles ---------- */
.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; min-width: 0; transition: box-shadow .2s; }
.panel:hover { box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; padding: 15px 18px 0; }
.panel-title { font-family: var(--font-main); font-size: 15px; font-weight: 600; letter-spacing: -.01em; color: var(--text); }
.panel-hint { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.panel-body { padding: 12px 18px 16px; }
.panel-chart { padding: 6px 10px 12px; }
.chart-box { width: 100%; }

/* ---------- Gauge / conversión ---------- */
.big-metric { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 2px; }
.big-value { font-family: var(--font-main); font-size: 40px; font-weight: 700; color: var(--accent); }
.big-label { color: var(--text-2); font-size: 12.5px; text-align: center; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; color: var(--text-3); font-weight: 400; font-size: 10px; letter-spacing: .09em; text-transform: uppercase; padding: 0 12px 10px; border-bottom: 1px solid var(--border); }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--text-2); }
.data-table tr:last-child td { border-bottom: 0; }
.data-table td:first-child { color: var(--text); font-weight: 500; }
.ta-right { text-align: right; font-family: var(--font-main); font-variant-numeric: tabular-nums; }

/* ---------- Zona ---------- */
.zone-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.zone-title { font-family: var(--font-main); font-size: 24px; font-weight: 600; letter-spacing: -.02em; }
.zone-sub { color: var(--text-3); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; margin-top: 3px; }
.sede-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { background: var(--surface); border: 1px solid var(--border); color: var(--text-2); border-radius: 999px; padding: 7px 14px; font-size: 12px; box-shadow: var(--shadow-sm); transition: all .15s; }
.chip:hover { color: var(--text); }
.chip-active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 6px 16px -8px rgba(249,61,0,.7); }
/* ---------- Responsive ---------- */
/* Tablet: 3→2 columnas. No afecta desktop (>1024px). */
@media (max-width: 1280px) {
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1000px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-5 { grid-template-columns: repeat(2, 1fr); }
  .span-3 { grid-column: span 2; }
}

/* ===== Mobile (≤768px): sidebar overlay, filtros compactos, touch targets ===== */
@media (max-width: 768px) {
  /* Barra superior con hamburguesa (reemplaza al sidebar fijo). */
  .mobile-topbar {
    display: flex; align-items: center; gap: 12px;
    position: sticky; top: 0; z-index: 30;
    padding: 8px 14px; background: var(--surface); border-bottom: 1px solid var(--border);
  }
  .nav-toggle {
    display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 44px; padding: 0;
    background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text);
  }
  .nav-toggle svg { width: 22px; height: 22px; }
  .mobile-logo { height: 30px; width: auto; display: block; }

  /* Sidebar deslizable como panel superpuesto. */
  .app-shell { display: block; }
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; width: 240px; max-width: 82vw;
    flex: none; z-index: 60; box-shadow: var(--shadow);
    transform: translateX(-100%); transition: transform .25s ease;
  }
  .app-shell.nav-open .sidebar { transform: none; }
  .nav-backdrop {
    display: block; position: fixed; inset: 0; z-index: 55; background: rgba(23,23,27,.42);
    opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s ease;
  }
  .app-shell.nav-open .nav-backdrop { opacity: 1; visibility: visible; }
  .nav-link { padding: 13px 12px; font-size: 14px; }

  /* Filtros: no sticky (no comen alto), 2 por fila, toggles full width. */
  .filters { position: static; padding: 12px 14px; gap: 10px; background: var(--bg); backdrop-filter: none; }
  .filters > .filter-field { flex: 1 1 calc(50% - 5px); min-width: 0; }
  .filters > .filter-custom { flex: 1 1 100%; }
  .filter-custom { gap: 10px; }
  .filter-custom > .filter-field { flex: 1 1 0; min-width: 0; }
  .dd-toggle, .dp-toggle, .filter-select, .filter-date { min-width: 0; width: 100%; padding: 11px 12px; font-size: 14px; }
  .filter-reset { flex: 1 1 100%; height: 44px; }

  /* Área táctil cómoda en opciones y acciones. */
  .dd-option { padding: 12px; font-size: 14px; }
  .dp-action { padding: 8px 12px; font-size: 13px; }
  .dp-day { font-size: 13px; }

  /* Paneles flotantes no se pasan del ancho de pantalla. */
  .dd-menu, .dp-panel { max-width: calc(100vw - 24px); }

  /* Contenido con menos padding lateral. */
  .view-root { padding: 14px; }
}

/* Teléfonos: KPIs y paneles en 1 sola columna. */
@media (max-width: 620px) {
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: span 1; }
  .btn-export { width: 100%; justify-content: center; padding: 12px 16px; font-size: 14px; }
}

/* ================= Piezas propias del dashboard de Meta Ads ================= */

/* Datepicker: días fuera de rango (futuro / > 37 meses). */
.dp-day.is-disabled, .dp-day.is-disabled:hover { color: var(--text-3); opacity: .35; background: transparent; cursor: default; }

/* Barra superior: botón Actualizar + etiqueta del período. */
.btn-refresh {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; align-self: flex-end;
  background: var(--accent); color: #fff; border: 0; border-radius: var(--radius-sm);
  padding: 0 16px; font-size: 13px; font-weight: 600;
  box-shadow: 0 10px 22px -12px rgba(249,61,0,.7); transition: filter .15s, transform .1s;
}
.btn-refresh:hover { filter: brightness(1.05); }
.btn-refresh:active { transform: scale(.98); }
.btn-refresh:disabled { opacity: .6; cursor: default; }
.btn-refresh svg { width: 15px; height: 15px; }
.btn-refresh.is-loading svg { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.range-error { flex: 1 1 100%; margin: -2px 0 0; color: var(--bad); font-size: 12px; }
.range-error:empty { display: none; }

/* Encabezado de cada vista. */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 24px; font-weight: 600; letter-spacing: -.02em; }
.page-sub { color: var(--text-3); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; margin-top: 3px; }
.range-pill {
  display: inline-flex; flex-direction: column; align-items: flex-end; gap: 2px;
  background: var(--surface); border-radius: var(--radius-md); padding: 8px 14px; box-shadow: var(--shadow-sm);
}
.range-pill-label { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.range-pill-value { font-size: 13px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }

/* Aviso de rango distinto al pedido. */
.notice { background: var(--accent-wash); border-radius: var(--radius-md); padding: 11px 14px; font-size: 12.5px; color: var(--text); }
.notice strong { color: var(--accent); }

/* KPI: texto secundario. */
.stat-sub { font-size: 11px; color: var(--text-2); }
.stat-brand .stat-sub { color: rgba(255,255,255,.9); }
.stat-dark .stat-sub { color: rgba(255,255,255,.7); }
.stat-value.is-small { font-size: clamp(26px,2.6vw,34px); }

/* Estados de carga / vacío / error. */
.state-msg { padding: 44px 20px; text-align: center; color: var(--text-2); font-size: 13px; }
.state-msg.is-error { color: var(--bad); }
.skeleton { position: relative; overflow: hidden; background: var(--surface-2); border-radius: 8px; }
.skeleton::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.65), transparent);
  transform: translateX(-100%); animation: shimmer 1.3s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-label { width: 46%; height: 10px; }
.sk-value { width: 62%; height: 34px; }
.sk-sub { width: 38%; height: 10px; }
.stat-brand .skeleton, .stat-dark .skeleton { background: rgba(255,255,255,.18); }

/* Barras de inversión por campaña. */
.bars { display: flex; flex-direction: column; gap: 12px; padding: 4px 0 2px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 260px) 1fr 110px; align-items: center; gap: 14px; }
.bar-label { font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 12px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: #2F3437; min-width: 4px; }
.bar-row:first-child .bar-fill { background: var(--accent); }
.bar-value { text-align: right; font-size: 13px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }

/* Tabla campaña/conjunto: separa visualmente cada campaña. */
.data-table tr.group-start td { border-top: 1px solid rgba(23,23,27,.12); }
.data-table tbody tr:first-child.group-start td { border-top: 0; }
.data-table td.cell-empty { color: transparent; }
.data-table td.muted { color: var(--text-3); }
.data-table tr:hover td { background: rgba(23,23,27,.015); }
.data-table td { vertical-align: middle; }

/* Anuncios: subtítulo de conjunto + pills. */
.adset-block + .adset-block { margin-top: 18px; }
.adset-name { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 12px; font-weight: 500; color: var(--text-2); }
.adset-name::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: 0 0 6px; }
.tag { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.tag::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag-active { color: var(--good); background: var(--good-wash); }
.tag-paused { color: var(--text-2); background: var(--surface-2); }
.tag-review { color: #A15C00; background: #FFF3DC; }
.tag-bad { color: var(--bad); background: var(--accent-wash); }
.preview-link {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; text-decoration: none;
  color: var(--accent); font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--accent-wash); transition: background .15s;
}
.preview-link:hover { background: var(--accent-wash); }
.no-preview { color: var(--text-3); font-size: 12px; }

/* Glosario. */
.gloss-table td:first-child { width: 34%; min-width: 150px; color: var(--text); font-weight: 600; }
.gloss-table td { color: var(--text-2); line-height: 1.55; }
.page-note { margin: 2px 0 0; color: var(--text-2); font-size: 12.5px; line-height: 1.6; max-width: 760px; }

.page-foot { margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 11px; }
.sidebar-account { color: var(--text-3); font-size: 10.5px; letter-spacing: .04em; line-height: 1.4; }
.sidebar-account strong { display: block; color: var(--text-2); font-weight: 500; font-size: 11.5px; letter-spacing: 0; }

@media (max-width: 768px) {
  .btn-refresh { flex: 1 1 100%; height: 44px; justify-content: center; font-size: 14px; }
  .bar-row { grid-template-columns: 1fr auto; gap: 6px 12px; }
  .bar-label { grid-column: 1 / -1; }
  .bar-track { grid-column: 1; }
  .range-pill { align-items: flex-start; }
  .page-title { font-size: 21px; }
}

/* Encabezados numéricos alineados a la derecha (le gana a .data-table th). */
.data-table th.ta-right { text-align: right; }
/* Tablas de anuncios: mismas columnas en todos los conjuntos. */
.ads-table { table-layout: fixed; min-width: 820px; }
.ads-table th:nth-child(1) { width: 30%; }
.ads-table th:nth-child(2) { width: 13%; }
.ads-table th:nth-child(3) { width: 13%; }
.ads-table th:nth-child(4) { width: 11%; }
.ads-table th:nth-child(5) { width: 10%; }
.ads-table th:nth-child(6) { width: 9%; }
.ads-table th:nth-child(7) { width: 14%; text-align: right; }
.ads-table td:nth-child(7) { text-align: right; }
.ads-table td:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.camp-table { min-width: 720px; }
.mobile-logo { flex: 0 0 auto; }
.panel-head { flex-wrap: wrap; gap: 4px 12px; }
@media (max-width: 620px) {
  .grid-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grid-kpi .stat-card { padding: 14px 14px; }
  .grid-kpi .stat-value { font-size: 23px; }
  .grid-kpi .stat-label { font-size: 9.5px; letter-spacing: .07em; }
  .grid-kpi .stat-body { gap: 8px; }
}
.sidebar-logo { width: 62px; max-width: none; }
.mobile-logo { height: 32px; }
.live-dot.is-error { background: var(--bad); }
.sidebar-logo { width: auto; max-width: 150px; max-height: 72px; object-fit: contain; }
.sidebar-logo { width: 96px; max-width: none; max-height: none; height: auto; }

/* ---------- Login (idéntico al dashboard comercial) ---------- */
.login-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: var(--radius); padding: 34px; box-shadow: var(--shadow); }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--accent); color: #fff; font-weight: 700; font-family: var(--font-main); font-size: 16px; }
.login-logo { width: 48px; height: 48px; border-radius: 12px; object-fit: contain; display: block; flex: 0 0 48px; }
.brand-name { font-family: var(--font-main); font-size: 23px; font-weight: 600; letter-spacing: -.02em; }
.brand-tag { margin: 3px 0 0; color: var(--text-3); font-size: 10.5px; font-family: var(--font-main); letter-spacing: .06em; text-transform: uppercase; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field span { font-size: 11px; font-family: var(--font-main); letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); }
.field input { background: var(--surface); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius-sm); padding: 11px 12px; font-size: 14px; font-family: var(--font-main); outline: none; transition: border-color .15s, box-shadow .15s; }
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.btn-primary { margin-top: 6px; background: var(--accent); color: #fff; border: 0; border-radius: var(--radius-sm); padding: 12px; font-weight: 600; font-size: 14px; font-family: var(--font-main); transition: filter .15s, transform .1s; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:active { transform: scale(.99); }
.btn-primary:disabled { opacity: .55; cursor: default; }
.login-error { color: var(--accent); font-size: 12.5px; min-height: 16px; margin: 0; }
.login-foot { margin: 24px 0 0; text-align: center; color: var(--text-3); font-size: 10.5px; font-family: var(--font-main); letter-spacing: .04em; }
