/* ==========================================================================
   Observatorio Netnográfico y Percepción de Campañas — Grupo Los Cokeros
   Paleta cálida académica (crema, ámbar, esmeralda, carbón)
   ========================================================================== */

@property --fade-start {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

@property --fade-end {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

:root {
  --bg-page: #faf7f0;
  --bg-surface: #ffffff;
  --bg-subtle: #fdfaf3;
  --border-warm: #eae0cc;
  --border-input: #767065;
  --text-main: #1f1b16;
  --text-muted: #645c50;
  --amber-soft: #fae8b8;
  --amber-border: #e6c97a;
  --amber-strong: #b45309;
  --amber-ink: #6b3405;
  --emerald: #059669;
  --emerald-hover: #047857;
  --emerald-soft: #ecfdf5;
  --sky: #0284c7;
  --rose: #e11d48;
  --radius-lg: 14px;
  --radius-md: 10px;
  --shadow-card: 0 2px 10px rgba(66, 50, 20, 0.04);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
}

/* Accesibilidad: clase canónica visually-hidden */
.visually-hidden {
  position: absolute;
  clip-path: inset(50%);
  overflow: hidden;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  white-space: nowrap;
}

:focus-visible {
  outline: 3px solid var(--amber-strong);
  outline-offset: 2px;
}

/* Banner de notificaciones */
.status-toast {
  position: fixed;
  inset-block-end: 1.25rem;
  inset-inline-end: 1.25rem;
  z-index: 50;
  max-inline-size: 440px;
  background: #1f1b16;
  color: #fffbeb;
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.22);
  font-size: 0.9rem;
  font-weight: 500;
}

/* Encabezado */
.top-header {
  background: var(--bg-surface);
  border-block-end: 1px solid var(--border-warm);
}

.header-container {
  max-inline-size: 1360px;
  margin-inline: auto;
  padding: 1.25rem 1.5rem 0.9rem;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.brand-block {
  display: flex;
  align-items: flex-start;
  gap: 0.95rem;
}

.brand-icon {
  inline-size: 46px;
  block-size: 46px;
  border-radius: 12px;
  background: var(--amber-soft);
  color: var(--amber-ink);
  display: grid;
  place-items: center;
  flex: none;
  margin-block-start: 0.15rem;
}

.title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.app-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.demo-pill {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.meta-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-block: 0.35rem;
}

.amber-badge {
  background: #fdf2d0;
  color: var(--amber-ink);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.18rem 0.65rem;
  border-radius: 6px;
}

.account-chip {
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  padding: 0.16rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border-warm);
  background: var(--bg-subtle);
  color: var(--text-main);
}

.account-chip:hover {
  border-color: var(--amber-strong);
}

.yt-chip {
  color: #b91c1c;
  background: #fef2f2;
  border-color: #fecaca;
}

.ig-chip {
  color: #9d174d;
  background: #fdf2f8;
  border-color: #fbcfe8;
}

.tt-chip {
  color: #111827;
  background: #f3f4f6;
  border-color: #d1d5db;
}

.app-subtitle {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  min-block-size: 42px;
  padding: 0.5rem 0.95rem;
  border-radius: 9px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-sm {
  min-block-size: 36px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn-amber {
  background: var(--amber-soft);
  color: var(--amber-ink);
  border-color: var(--amber-border);
}

.btn-amber:hover {
  background: #f6dc96;
}

.btn-amber-soft {
  background: #fcf1d2;
  color: var(--amber-ink);
  border-color: #ebd394;
}

.btn-amber-soft:hover {
  background: #f8e4af;
}

.btn-emerald {
  background: var(--emerald);
  color: #ffffff;
}

.btn-emerald:hover {
  background: var(--emerald-hover);
}

.btn-dark {
  background: #1f1b16;
  color: #ffffff;
}

.btn-dark:hover {
  background: #363028;
}

.btn-outline {
  background: #ffffff;
  color: var(--text-main);
  border-color: #cfc4ae;
}

.btn-outline:hover {
  background: var(--bg-subtle);
  border-color: #a89a7e;
}

.btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* Pestañas (siguiendo reglas de accesibilidad y sin variar dimensiones) */
.tabs-bar-wrap {
  max-inline-size: 1360px;
  margin-inline: auto;
  padding-inline: 1.5rem;
  border-block-start: 1px solid #f2eadb;
}

.tabs-scroller {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: inline proximity;
  scroll-padding-inline: 2.5rem;
  --fade-size: 2.5rem;
  --fade-dir: right;
  --fade-start-pos: 0;
  --fade-end-pos: 100%;
  mask:
    linear-gradient(black, black) no-clip subtract,
    linear-gradient(to var(--fade-dir), black, transparent) var(--fade-start-pos) 0 / var(--fade-start) 100% no-repeat no-clip,
    linear-gradient(to var(--fade-dir), transparent, black) var(--fade-end-pos) 0 / var(--fade-end) 100% no-repeat no-clip;
  animation: reveal-fade-start linear both, hide-fade-end linear both;
  animation-timeline: scroll(self inline);
  animation-range: 0 var(--fade-size), calc(100% - var(--fade-size)) 100%;
}

.tabs-scroller::-webkit-scrollbar {
  display: none;
}

@keyframes reveal-fade-start {
  to {
    --fade-start: var(--fade-size);
  }
}

@keyframes hide-fade-end {
  from {
    --fade-end: var(--fade-size);
  }
}

[role="tab"] {
  position: relative;
  flex: none;
  scroll-snap-align: start;
  background: transparent;
  border: 0;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.85rem 1.15rem;
  min-block-size: 48px;
  cursor: pointer;
}

[role="tab"]:hover {
  color: var(--text-main);
}

[role="tab"][aria-selected="true"] {
  color: var(--amber-strong);
}

[role="tab"][aria-selected="true"]::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  border-block-end: 3px solid var(--amber-strong);
}

/* Tabpanels: sin padding/margin/border directos para respetar hidden="until-found" */
.main-container {
  max-inline-size: 1360px;
  margin-inline: auto;
}

.tabpanel-inner {
  padding: 1.35rem 1.5rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

/* Tarjetas base */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-warm);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

/* Formularios y campos */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
  margin-block-end: 0.85rem;
}

.field:last-child {
  margin-block-end: 0;
}

.field label {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="file"],
select,
textarea {
  font: inherit;
  font-size: max(1rem, 0.92rem);
  min-block-size: 44px;
  padding: 0.52rem 0.8rem;
  border-radius: 9px;
  border: 1px solid var(--border-input);
  background: #ffffff;
  color: var(--text-main);
  inline-size: 100%;
}

textarea {
  min-block-size: 110px;
  resize: vertical;
}

input:user-invalid,
select:user-invalid,
textarea:user-invalid {
  border-color: var(--rose);
  background: #fff1f2;
}

/* Barra de filtros */
.filter-card {
  padding: 1rem 1.25rem;
}

.filter-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr auto;
  gap: 1rem;
  align-items: end;
}

.filter-grid .field {
  margin-block-end: 0;
}

.filter-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.active-subfilters {
  margin-block-start: 0.8rem;
  padding-block-start: 0.7rem;
  border-block-start: 1px dashed var(--border-warm);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
}

.subfilter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #fef3c7;
  color: var(--amber-ink);
  border: 1px solid #f59e0b;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-weight: 700;
}

/* 6 KPIs */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.85rem;
}

.kpi-card {
  padding: 0.95rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.4rem;
}

.kpi-highlight {
  background: #fdf3d7;
  border-color: #e6c677;
}

.kpi-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.4rem;
}

.kpi-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.25;
}

.kpi-icon {
  inline-size: 28px;
  block-size: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  flex: none;
}

.icon-amber { background: #fef3c7; color: #b45309; }
.icon-rose { background: #ffe4e6; color: #e11d48; }
.icon-sky { background: #e0f2fe; color: #0284c7; }
.icon-emerald { background: #d1fae5; color: #059669; }

.kpi-value {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.kpi-foot {
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* Grillas de 2 columnas */
.two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 1.15rem;
}

.panel-card {
  padding: 1.25rem 1.35rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
}

.card-head-between {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.card-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.card-sub {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.dot {
  inline-size: 9px;
  block-size: 9px;
  border-radius: 50%;
  display: inline-block;
}
.dot-amber { background: #d97706; }
.dot-emerald { background: #10b981; }
.dot-brown { background: #92400e; }
.dot-dark { background: #1f1b16; }

/* Donut Chart */
.donut-wrap {
  position: relative;
  display: grid;
  place-items: center;
  margin-block: 0.35rem;
}

.donut-segment {
  cursor: pointer;
  transition: opacity 0.15s ease, stroke-width 0.15s ease;
}

.donut-segment:hover {
  opacity: 0.86;
}

.donut-center {
  position: absolute;
  text-align: center;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-inline-size: 120px;
}

.donut-center strong {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.1;
}

.donut-center span {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-block-start: 0.15rem;
}

.donut-center small {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.perception-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.legend-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-warm);
  border-radius: 9px;
  padding: 0.48rem 0.7rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  text-align: start;
}

.legend-pill[aria-pressed="true"] {
  border-color: var(--amber-strong);
  background: #fef3c7;
}

.legend-left {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-footer-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--text-muted);
  padding-block-start: 0.55rem;
  border-block-start: 1px solid #f3ecde;
}

/* Barras Apiladas por Campaña */
.campaigns-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.campaign-box {
  border: 1px solid var(--border-warm);
  background: var(--bg-subtle);
  border-radius: 11px;
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.campaign-box:hover,
.campaign-box.active-filter {
  border-color: var(--amber-strong);
  background: #fffdf7;
}

.campaign-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-block-end: 0.55rem;
}

.campaign-name {
  font-size: 0.86rem;
  font-weight: 800;
}

.net-accept-pill {
  background: #d1fae5;
  color: #065f46;
  font-size: 0.76rem;
  font-weight: 800;
  padding: 0.2rem 0.6rem;
  border-radius: 7px;
  white-space: nowrap;
}

.stacked-bar {
  display: flex;
  block-size: 20px;
  border-radius: 999px;
  overflow: hidden;
  background: #e5e7eb;
  margin-block-end: 0.55rem;
}

.sb-seg {
  display: grid;
  place-items: center;
  color: #ffffff;
  font-size: 0.69rem;
  font-weight: 800;
}

.sb-fav { background: #10b981; }
.sb-neu { background: #0ea5e9; }
.sb-rej { background: #ef4444; }

.campaign-subpills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
}

.c-subpill {
  display: flex;
  justify-content: space-between;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  font-size: 0.73rem;
  font-weight: 700;
}

.c-sub-fav { background: #ecfdf5; color: #047857; }
.c-sub-neu { background: #f0f9ff; color: #0369a1; }
.c-sub-rej { background: #fef2f2; color: #b91c1c; }

/* 16 Roles Netnográficos */
.roles-bars-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-block-size: 410px;
  overflow-y: auto;
  padding-inline-end: 0.25rem;
}

.role-bar-btn {
  width: 100%;
  background: var(--bg-subtle);
  border: 1px solid var(--border-warm);
  border-radius: 9px;
  padding: 0.52rem 0.75rem;
  cursor: pointer;
  font: inherit;
  text-align: start;
}

.role-bar-btn:hover,
.role-bar-btn[aria-pressed="true"] {
  border-color: var(--amber-strong);
  background: #fef8e6;
}

.role-bar-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  margin-block-end: 0.32rem;
}

.role-track {
  block-size: 6px;
  border-radius: 999px;
  background: #ede6d6;
  overflow: hidden;
}

.role-fill {
  block-size: 100%;
  border-radius: 999px;
}

/* Informe Netnográfico por Pieza */
.report-selector-row {
  margin-block-end: 0;
}

.sr-label-inline {
  font-size: 0.74rem;
}

.platform-pill {
  padding: 0.22rem 0.68rem;
  border-radius: 7px;
  font-size: 0.75rem;
  font-weight: 800;
}

.pill-tiktok { background: #111827; color: #ffffff; }
.pill-youtube { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.pill-instagram { background: #fce7f3; color: #9d174d; border: 1px solid #f9a8d4; }
.pill-facebook { background: #dbeafe; color: #1d4ed8; border: 1px solid #93c5fd; }

.report-inner-box {
  border: 1px solid var(--border-warm);
  background: #fdfbf6;
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.report-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.65rem;
}

.report-piece-title {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 800;
}

.report-piece-sub {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.mini-kpis-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.4rem;
}

.mini-kpi {
  background: #ffffff;
  border: 1px solid var(--border-warm);
  border-radius: 8px;
  padding: 0.4rem 0.35rem;
  text-align: center;
  display: flex;
  flex-direction: column;
}

.mini-kpi span {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.mini-kpi strong {
  font-size: 0.82rem;
  font-weight: 800;
}

.mini-kpi-er {
  background: #fef3c7;
  border-color: #f59e0b;
}

.findings-box {
  background: #ffffff;
  border: 1px solid var(--border-warm);
  border-radius: 9px;
  padding: 0.75rem 0.85rem;
  font-size: 0.82rem;
  color: #332d24;
}

.findings-box p {
  margin: 0;
}

.predominant-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-block-end: 0.4rem;
}

.predominant-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.pred-pill {
  background: #ffffff;
  border: 1px solid var(--border-warm);
  border-radius: 7px;
  padding: 0.22rem 0.55rem;
  font-size: 0.74rem;
  font-weight: 700;
}

.report-export-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
}

/* Tabla Responsiva de Comentarios */
.table-section-card {
  padding: 1.25rem 1.35rem;
}

.table-head-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-block-end: 1rem;
}

.table-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.search-inline-form input[type="search"] {
  min-inline-size: 280px;
}

.table-wrapper {
  overflow: auto;
  max-inline-size: 100%;
  max-block-size: min(620px, 78vh);
  container-type: inline-size;
  border: 1px solid var(--border-warm);
  border-radius: 10px;
}

.comments-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.83rem;
  --label-2: "Usuario";
  --label-3: "Comentario";
  --label-4: "Rol Netnográfico";
  --label-5: "Percepción";
  --label-6: "Justificación";
}

.comments-table thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
  background: #faf6ec;
}

.comments-table th,
.comments-table td {
  padding: 0.85rem 0.9rem;
  text-align: start;
  vertical-align: top;
  border-block-end: 1px solid #f0e8d8;
}

.comments-table thead th {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.comments-table tbody th {
  position: sticky;
  inset-inline-start: 0;
  z-index: 1;
  background: #ffffff;
  font-weight: 700;
  min-inline-size: 145px;
}

.comments-table tbody tr:hover td,
.comments-table tbody tr:hover th {
  background: #fdfaf2;
}

.piece-cell-title {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-block: 0.15rem 0.35rem;
}

.role-badge {
  display: inline-block;
  padding: 0.24rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.macro-sub {
  display: block;
  font-size: 0.71rem;
  color: var(--text-muted);
  margin-block-start: 0.25rem;
}

.reply-flag {
  display: inline-block;
  margin-block-start: 0.3rem;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
  font-size: 0.69rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 5px;
}

@container (width < 720px) {
  .comments-table,
  .comments-table thead,
  .comments-table tbody,
  .comments-table tr,
  .comments-table th,
  .comments-table td {
    display: block;
  }

  .comments-table thead {
    display: none;
  }

  .comments-table tbody tr {
    margin-block-end: 1rem;
    border: 1px solid var(--border-warm);
    border-radius: 10px;
    overflow: hidden;
  }

  .comments-table tbody th {
    position: sticky;
    inset-block-start: 0;
    background: #faf6ec;
  }

  .comments-table td:nth-child(2)::before { content: var(--label-2) ": "; font-weight: 700; }
  .comments-table td:nth-child(3)::before { content: var(--label-3) ": "; font-weight: 700; }
  .comments-table td:nth-child(4)::before { content: var(--label-4) ": "; font-weight: 700; }
  .comments-table td:nth-child(5)::before { content: var(--label-5) ": "; font-weight: 700; }
  .comments-table td:nth-child(6)::before { content: var(--label-6) ": "; font-weight: 700; }
}

/* Panel 2: Credenciales */
.settings-hero-card {
  padding: 1.25rem 1.35rem;
}

.settings-hero-flex {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.sync-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.sync-options-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-block-start: 0.9rem;
  padding-block-start: 0.85rem;
  border-block-start: 1px solid #f2eadb;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.84rem;
}

.checkbox-inline input[type="checkbox"] {
  inline-size: 18px;
  block-size: 18px;
  accent-color: var(--emerald);
}

.sync-log-box {
  margin-block-start: 0.85rem;
  background: #1f1b16;
  color: #fef3c7;
  padding: 0.8rem 1rem;
  border-radius: 9px;
  font-size: 0.82rem;
  white-space: pre-wrap;
}

.creds-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.15rem;
}

.cred-fieldset {
  margin: 0;
  padding: 1.25rem 1.35rem;
}

.cred-legend {
  font-size: 0.98rem;
  font-weight: 800;
  padding-inline: 0.35rem;
}

.cred-hint {
  margin: 0 0 0.95rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.label-with-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.key-status-badge {
  font-size: 0.71rem;
  font-weight: 700;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: #f3f4f6;
  color: #4b5563;
}

.key-status-badge.configured {
  background: #d1fae5;
  color: #065f46;
}

.secret-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem;
}

.two-mini-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.four-mini-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
}

.cred-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-block-start: 0.85rem;
}

.test-result-msg {
  margin-block-start: 0.55rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.save-creds-bar {
  margin-block-start: 1.15rem;
  padding: 1rem 1.35rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-size: 0.84rem;
}

.stack-column {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.campaign-manager-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-block-size: 300px;
  overflow-y: auto;
}

.camp-mgr-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.55rem;
  border: 1px solid var(--border-warm);
  border-radius: 9px;
  background: var(--bg-subtle);
  font-size: 0.8rem;
}

/* Modal Nativo <dialog> (reglas dialog + light-dismiss) */
dialog {
  border: 1px solid var(--border-warm);
  border-radius: 16px;
  padding: 0;
  max-inline-size: min(860px, 94vw);
  max-block-size: 86vh;
  background: #ffffff;
  color: var(--text-main);
  box-shadow: 0 24px 50px rgba(24, 18, 10, 0.25);
}

dialog[open] {
  display: flex;
  flex-direction: column;
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background-color: rgba(25, 20, 12, 0.48);
  backdrop-filter: blur(2px);
}

.dialog-header {
  padding: 1.15rem 1.4rem;
  border-block-end: 1px solid var(--border-warm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: #fdf9ef;
}

.dialog-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
}

.dialog-subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.dialog-body {
  padding: 1.2rem 1.4rem;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.guide-role-card {
  border: 1px solid var(--border-warm);
  border-radius: 10px;
  padding: 0.8rem 0.95rem;
  background: var(--bg-subtle);
}

.guide-role-card p {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Responsividad general */
@media (width < 1100px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .two-col-grid,
  .creds-grid {
    grid-template-columns: 1fr;
  }
}

@media (width < 720px) {
  .filter-grid,
  .kpi-grid,
  .mini-kpis-row,
  .report-export-row,
  .dialog-body,
  .four-mini-fields,
  .two-mini-fields {
    grid-template-columns: 1fr 1fr;
  }
}

/* Pantalla de Login y Sesión */
.login-screen {
  min-block-size: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.login-screen[hidden] {
  display: none;
}

.login-card {
  inline-size: min(460px, 100%);
  padding: 2rem 1.85rem;
}

.login-brand {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  margin-block-end: 1.4rem;
}

.login-title {
  margin: 0.35rem 0 0.2rem;
  font-size: 1.3rem;
  font-weight: 800;
}

.login-error {
  margin-block: 0.65rem 0.9rem;
  padding: 0.65rem 0.85rem;
  border-radius: 9px;
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  font-size: 0.84rem;
  font-weight: 600;
}

.login-submit-btn {
  inline-size: 100%;
  margin-block-start: 0.4rem;
}

.user-session-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0.35rem 0.2rem 0.75rem;
  border-radius: 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-warm);
}

.user-email-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}

.sync-log-row {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-warm);
  border-radius: 9px;
  background: var(--bg-subtle);
  font-size: 0.78rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.sync-log-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-weight: 700;
}

/* Impresión limpia / PDF */
@media print {
  .top-header .tabs-bar-wrap,
  .header-actions,
  .filter-card,
  .report-export-row,
  .table-controls {
    display: none !important;
  }
  body {
    background: #ffffff;
  }
  .card {
    box-shadow: none;
    break-inside: avoid;
  }
}
