/* ==========================================================================
   Tema oscuro — AI Social Media Manager
   Se carga DESPUÉS de app.css: sobrescribe colores y añade los componentes
   del rediseño (indicadores, tarjetas de cristal, configuración actual).
   ========================================================================== */

/* ------------------------------------------------------------------ base --- */
html {
  background: var(--canvas-2);
}

body {
  margin: 0;
  background:
    radial-gradient(1100px 600px at 12% -10%, rgba(124, 58, 237, 0.28), transparent 60%),
    radial-gradient(900px 520px at 92% 8%, rgba(37, 99, 235, 0.22), transparent 62%),
    var(--canvas);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

/* --------------------------------------------------------------- lateral --- */
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
  height: 100vh;
  padding: var(--sp-6) var(--sp-4);
  overflow-y: auto;
  background:
    radial-gradient(420px 260px at 0% 92%, rgba(124, 58, 237, 0.32), transparent 70%),
    linear-gradient(180deg, #0a0f26, #070a1c);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0 var(--sp-2) var(--sp-4);
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--grad-brand);
  color: #fff;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
  box-shadow: var(--glow-brand);
}

.brand__name {
  font-size: var(--text-md);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--ink);
}

.brand__sub {
  font-size: var(--text-xs);
  color: var(--subtle);
}

#navegacion {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-group__label {
  margin: 0 0 var(--sp-1) var(--sp-3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6b74a0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 9px var(--sp-3);
  border-radius: var(--radius-md);
  color: var(--muted);
  font-size: var(--text-base);
  font-weight: 500;
  text-decoration: none;
  transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
}

.nav-item--active,
.nav-item[aria-current="page"] {
  background: linear-gradient(100deg, rgba(124, 58, 237, 0.95), rgba(139, 92, 246, 0.75));
  color: #fff;
  box-shadow: 0 8px 22px rgba(109, 40, 217, 0.4);
}

.nav-item__icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  font-size: 14px;
  color: #c7cdf0;
}

.nav-item--active .nav-item__icon,
.nav-item[aria-current="page"] .nav-item__icon {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.nav-item__count {
  margin-left: auto;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.12);
  font-size: 11px;
  font-weight: 700;
}

.sidebar__footer {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-top: auto;
  flex: 0 0 auto;
  padding-top: var(--sp-2);
}

.sidebar-card {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(139, 92, 246, 0.35);
  background:
    radial-gradient(180px 90px at 10% 0%, rgba(124, 58, 237, 0.35), transparent 70%),
    rgba(15, 21, 48, 0.9);
}

.sidebar-card__icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 10px;
  background: var(--grad-brand);
  color: #fff;
  font-size: 16px;
}

.sidebar-card__title {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink);
}

.sidebar-card__text {
  margin: 2px 0 0;
  font-size: var(--text-xs);
  line-height: 1.4;
  color: var(--subtle);
}

.sidebar__footer .btn {
  width: 100%;
  justify-content: flex-start;
  gap: var(--sp-2);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.sidebar__footer .btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

#usuario {
  margin: 0;
  padding: 0 var(--sp-2);
  font-size: var(--text-xs);
  color: var(--subtle);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --------------------------------------------------------------- superior --- */
.main-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  height: var(--topbar-h);
  padding: 0 var(--sp-6);
  background: rgba(7, 10, 28, 0.86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.topbar__menu {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
}

.topbar__tab {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 6px 14px;
  border-radius: 10px 10px 0 0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-bottom: none;
  font-size: var(--text-sm);
  color: var(--muted);
}

.topbar__tab span[aria-hidden] {
  color: var(--brand-500);
}

.topbar__spacer {
  flex: 1;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  font-size: var(--text-xs);
  color: var(--muted);
}

.status-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
}

.icon-btn:hover {
  color: var(--ink);
  border-color: var(--border);
}

.icon-btn__dot {
  position: absolute;
  top: 6px;
  right: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f87171;
}

.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--grad-brand);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
}

/* ---------------------------------------------------------------- página --- */
.content {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--sp-6) var(--sp-6) var(--sp-10);
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  margin: 0 0 var(--sp-2);
}

.page-head h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.page-head__text p {
  margin: 2px 0 0;
  color: var(--subtle);
  font-size: var(--text-sm);
}

.page-head__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.panel-head {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

.panel-head__icon {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  flex: 0 0 60px;
  border-radius: 18px;
  background: var(--grad-purple);
  color: #fff;
  font-size: 26px;
  box-shadow: 0 16px 38px rgba(109, 40, 217, 0.45);
}

.panel-head__title {
  margin: 0;
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.panel-head__sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: var(--text-sm);
}

.date-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(139, 92, 246, 0.4);
  background: rgba(124, 58, 237, 0.16);
  color: #ddd6fe;
  font-size: var(--text-sm);
}

/* ------------------------------------------------------------ indicadores --- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-4);
}

.kpi {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-5);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: var(--shadow-md);
}

.kpi::after {
  content: "";
  position: absolute;
  inset: auto -30px -60px auto;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  filter: blur(6px);
}

.kpi__icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  font-size: 20px;
  backdrop-filter: blur(4px);
}

.kpi__value {
  margin: 0;
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

.kpi__label {
  margin: 6px 0 0;
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.86);
}

.kpi--purple { background: linear-gradient(135deg, #5b21b6, #8b5cf6); }
.kpi--blue   { background: linear-gradient(135deg, #1e40af, #3b82f6); }
.kpi--teal   { background: linear-gradient(135deg, #0f766e, #14b8a6); }
.kpi--amber  { background: linear-gradient(135deg, #b45309, #f59e0b); }

/* ---------------------------------------------------------------- tarjetas --- */
.card {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
  padding: 0;
}

.card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
  margin: 0;
  padding: var(--sp-5) var(--sp-5) 0;
}

.card__title {
  margin: 0;
  font-size: var(--text-md);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card__sub {
  margin: 4px 0 0;
  color: var(--subtle);
  font-size: var(--text-xs);
}

.card > :not(.card__head) {
  padding: var(--sp-4) var(--sp-5) var(--sp-5);
}

.card > .table-wrap,
.card > .table-scroll {
  padding: 0;
}

.card--flat {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}

.card--interactive:hover {
  border-color: rgba(139, 92, 246, 0.45);
  transform: translateY(-1px);
}

/* ---------------------------------------------------------- estado vacío --- */
.empty--boxed {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-8) var(--sp-4);
  border-radius: var(--radius-md);
  border: 1px dashed rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.02);
  text-align: center;
}

.empty--boxed .empty__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--grad-purple);
  color: #fff;
  font-size: 18px;
  box-shadow: 0 10px 24px rgba(109, 40, 217, 0.4);
}

.empty--boxed .empty__title {
  margin: var(--sp-2) 0 0;
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--ink);
}

.empty--boxed .empty__text {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--subtle);
}

/* ------------------------------------------------------------- listas --- */
.inbox-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--line);
}

.inbox-item:last-child { border-bottom: none; }

.config-list {
  display: flex;
  flex-direction: column;
}

.config-list__row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--text-sm);
}

.config-list__row:last-child { border-bottom: none; }

.config-list__icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 8px;
  background: rgba(139, 92, 246, 0.16);
  color: #c4b5fd;
  font-size: 13px;
}

.config-list__label { flex: 1; }

.config-list__value {
  color: var(--ink);
  font-weight: 500;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.config-list__chevron { color: var(--subtle); }

.config-foot {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--line);
  font-size: var(--text-xs);
  color: var(--subtle);
}

.pill-activo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: rgba(34, 197, 94, 0.16);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #4ade80;
  font-size: var(--text-xs);
  font-weight: 600;
}

.pill-activo::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
}

.info-banner {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
  padding: var(--sp-5) var(--sp-6);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(99, 102, 241, 0.35);
  background:
    radial-gradient(520px 200px at 92% 120%, rgba(168, 85, 247, 0.35), transparent 70%),
    linear-gradient(120deg, rgba(30, 27, 75, 0.95), rgba(49, 20, 100, 0.85));
}

.info-banner__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 17px;
}

.info-banner h2 {
  margin: 0 0 6px;
  font-size: var(--text-md);
}

.info-banner p {
  margin: 0;
  max-width: 72ch;
  color: #d9d6ff;
  font-size: var(--text-sm);
  line-height: 1.5;
}

/* ------------------------------------------------------------ formularios --- */
.input,
.select,
.textarea {
  width: 100%;
  padding: 10px var(--sp-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(9, 13, 33, 0.85);
  color: var(--ink);
  font-size: var(--text-base);
  font-family: inherit;
}

.input::placeholder,
.textarea::placeholder { color: #5f6a94; }

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: var(--focus-ring);
}

.field__label {
  display: block;
  margin-bottom: 6px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--muted);
}

.field__help {
  margin: 6px 0 0;
  font-size: var(--text-xs);
  color: var(--subtle);
}

.field__req { color: #f87171; }

/* ---------------------------------------------------------------- botones --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 9px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform var(--motion-fast) var(--ease), background var(--motion-fast) var(--ease);
}

.btn:hover { background: rgba(255, 255, 255, 0.09); }
.btn:active { transform: translateY(1px); }

.btn--primary {
  border: none;
  background: var(--grad-brand);
  color: #fff;
  box-shadow: 0 10px 24px rgba(109, 40, 217, 0.38);
}

.btn--primary:hover { filter: brightness(1.07); background: var(--grad-brand); }

.btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

.btn--danger {
  background: rgba(248, 113, 113, 0.14);
  border-color: rgba(248, 113, 113, 0.4);
  color: #fca5a5;
}

.btn--sm { padding: 6px 12px; font-size: var(--text-xs); }
.btn--block { width: 100%; }

/* ------------------------------------------------------------------ tablas --- */
.table-wrap {
  background: rgba(9, 13, 33, 0.55);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}

table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }

th {
  background: rgba(255, 255, 255, 0.04);
  color: var(--subtle);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

th, td {
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(139, 92, 246, 0.07); }

.table__title { font-weight: 600; color: var(--ink); }
.table__sub { margin-top: 2px; font-size: var(--text-xs); color: var(--subtle); }

/* ---------------------------------------------------------------- insignias --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  border: 1px solid transparent;
}

.badge__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge--neutral { background: rgba(148, 163, 184, 0.14); color: #cbd5e1; }
.badge--success { background: rgba(34, 197, 94, 0.16); color: #4ade80; }
.badge--warning { background: rgba(245, 158, 11, 0.16); color: #fbbf24; }
.badge--danger  { background: rgba(248, 113, 113, 0.16); color: #fca5a5; }
.badge--info    { background: rgba(56, 189, 248, 0.16); color: #7dd3fc; }
.badge--brand   { background: rgba(139, 92, 246, 0.2); color: #c4b5fd; }

.chip {
  display: inline-flex;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  font-size: var(--text-xs);
  color: var(--muted);
}

.prov {
  display: inline-flex;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
}

.prov--real { background: rgba(226, 232, 240, 0.12); color: #e2e8f0; }
.prov--demo { background: var(--data-demo-bg); color: var(--data-demo); }
.prov--est  { background: var(--data-est-bg); color: var(--data-est); }
.prov--na   { background: var(--data-na-bg); color: var(--data-na); }

/* ---------------------------------------------------------------- avisos --- */
.alert {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: var(--text-sm);
}

.alert--info    { background: var(--info-50); border-color: rgba(56, 189, 248, 0.28); color: #bae6fd; }
.alert--success { background: var(--success-50); border-color: rgba(34, 197, 94, 0.28); color: #bbf7d0; }
.alert--warning { background: var(--warning-50); border-color: rgba(245, 158, 11, 0.3); color: #fde68a; }
.alert--danger  { background: var(--danger-50); border-color: rgba(248, 113, 113, 0.32); color: #fecaca; }

.alert__title { margin: 0; font-weight: 700; font-size: var(--text-sm); }
.alert__body { margin: 0; font-size: var(--text-xs); opacity: 0.92; }

.toasts { position: fixed; right: var(--sp-6); bottom: var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-2); z-index: 60; }

.toast {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  background: var(--glass-strong);
  border: 1px solid var(--line);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  max-width: 420px;
}

.toast--danger { border-color: rgba(248, 113, 113, 0.45); }
.toast--success { border-color: rgba(34, 197, 94, 0.45); }

/* ---------------------------------------------------------------- esqueletos --- */
.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06));
  background-size: 200% 100%;
  animation: brillo 1.4s infinite linear;
}

.skeleton--title { height: 28px; width: 40%; }
.skeleton--line { height: 14px; width: 70%; }
.skeleton--block { height: 120px; }

@keyframes brillo {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ------------------------------------------------------------------ calendario --- */
.calendar {
  display: block;
  width: 100%;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
}

.calendar__head {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--subtle);
}

.calendar__head > div { padding: 0 var(--sp-2); }

.calendar .grid { display: grid;
  width: 100%; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--sp-2); }

.calendar__cell {
  min-height: 86px;
  padding: var(--sp-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(9, 13, 33, 0.55);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calendar__day { font-size: var(--text-xs); color: var(--subtle); font-weight: 700; }

.calendar__event {
  width: 100%;
  text-align: left;
  padding: 4px 6px;
  border-radius: 6px;
  border: none;
  background: rgba(139, 92, 246, 0.22);
  color: #ddd6fe;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar__event:hover { background: rgba(139, 92, 246, 0.35); }

/* ------------------------------------------------------------------ varios --- */
.muted { color: var(--muted); }
.subtle { color: var(--subtle); }
.mono { font-family: var(--font-mono); }
.divider { border: none; border-top: 1px solid var(--line); margin: var(--sp-4) 0; }
.note {
  padding: var(--sp-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}
.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--brand-600);
  color: #fff;
  font-weight: 600;
}
.skip-link:focus { left: 8px; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 8px; }

details summary { cursor: pointer; color: var(--brand-500); }
details pre { white-space: pre-wrap; color: var(--muted); }

/* --------------------------------------------------------------- responsive --- */
@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: min(300px, 84vw);
    transform: translateX(-102%);
    transition: transform var(--motion-base) var(--ease);
    box-shadow: var(--shadow-lg);
  }
  .sidebar--abierta { transform: translateX(0); }
  .topbar__menu { display: grid; place-items: center; }
  .content { padding: var(--sp-4); }
  .panel-head { flex-wrap: wrap; }
  .panel-head__title { font-size: 26px; }
}

@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .calendar .grid, .calendar__head { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calendar__head > div:nth-child(n + 3) { display: none; }
}

/* El contenido de una tarjeta no debe estirarse más de lo necesario. */
.grid { align-items: start; }

@media (max-height: 780px) {
  .sidebar { gap: var(--sp-4); padding-block: var(--sp-4); }
  .sidebar-card__text { display: none; }
}
/* Recorte de textos largos en tablas (errores de conexión). */
.truncar {
  display: inline-block;
  max-width: 26ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

/* La fila de historial no lleva el hover de las filas de datos. */
tr[data-historial] td { background: rgba(124, 58, 237, 0.06); }
tr[data-historial]:hover { background: transparent; }
/* ==================== FR-38: calendario editorial ==================== */
.cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.cal-nav,
.cal-vistas {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.cal-titulo {
  margin-left: var(--sp-2);
  font-size: var(--text-md);
  text-transform: capitalize;
}

.cal-filtros {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.select--compacto { width: auto; min-width: 150px; }
.cal-buscar { flex: 1; min-width: 220px; }

.cal-mes {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
}

.cal-encabezado,
.cal-rejilla {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--sp-2);
}

.cal-encabezado {
  margin-bottom: var(--sp-2);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--subtle);
}

.cal-celda {
  min-height: 104px;
  padding: var(--sp-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(9, 13, 33, 0.55);
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: border-color var(--motion-fast) var(--ease);
}

.cal-celda:hover { border-color: rgba(139, 92, 246, 0.55); }
.cal-celda--fuera { opacity: 0.45; }
.cal-dia-num { font-size: var(--text-xs); font-weight: 700; color: var(--subtle); }

.evento {
  display: flex;
  gap: 6px;
  align-items: center;
  width: 100%;
  padding: 4px 6px;
  border: none;
  border-left: 3px solid currentColor;
  border-radius: 6px;
  font-size: 11px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
}

.evento__hora { font-weight: 700; }
.evento__titulo { overflow: hidden; text-overflow: ellipsis; }

.evento--info { background: rgba(56, 189, 248, 0.18); color: #7dd3fc; }
.evento--warning { background: rgba(245, 158, 11, 0.18); color: #fbbf24; }
.evento--success { background: rgba(34, 197, 94, 0.18); color: #4ade80; }
.evento--danger { background: rgba(248, 113, 113, 0.18); color: #fca5a5; }
.evento--neutral { background: rgba(148, 163, 184, 0.16); color: #cbd5e1; }
.evento--brand { background: rgba(139, 92, 246, 0.2); color: #c4b5fd; }

.cal-semana {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--sp-2);
}

.cal-columna {
  min-height: 320px;
  padding: var(--sp-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(9, 13, 33, 0.55);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  cursor: pointer;
}

.cal-columna__cab { font-size: var(--text-xs); font-weight: 700; color: var(--muted); }

.cal-dia {
  padding: var(--sp-4);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: rgba(9, 13, 33, 0.55);
}

.cal-dia__cab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
  text-transform: capitalize;
}

.cal-dia__lista { display: flex; flex-direction: column; gap: var(--sp-2); }

/* Panel lateral de creación y detalle */
.panel-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  justify-content: flex-end;
  background: rgba(3, 6, 18, 0.66);
  backdrop-filter: blur(3px);
}

.panel-lateral {
  width: min(var(--panel-ancho, 520px), 94vw);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--glass-strong);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  animation: entrar-panel var(--motion-base) var(--ease);
}

@keyframes entrar-panel {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.panel-cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-5);
  border-bottom: 1px solid var(--line);
}

.panel-titulo { margin: 0; font-size: var(--text-lg); }
.panel-cuerpo { padding: var(--sp-5); overflow-y: auto; }

.form-publicacion { display: flex; flex-direction: column; gap: var(--sp-4); }

.campo-linea { display: flex; flex-direction: column; gap: 6px; }
.campo-linea__label { font-size: var(--text-sm); font-weight: 600; color: var(--muted); }
.campo-doble { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }

.check-lista {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 150px;
  overflow-y: auto;
  padding: var(--sp-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.check-item { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--text-sm); }

.panel-acciones {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--line);
}

.panel-acciones--wrap { flex-wrap: wrap; justify-content: flex-start; }

.detalle-publicacion { display: flex; flex-direction: column; gap: var(--sp-3); }
.detalle-texto { white-space: pre-wrap; color: var(--ink); font-size: var(--text-sm); line-height: 1.55; }

.detalle-datos {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 6px var(--sp-3);
  margin: 0;
  font-size: var(--text-sm);
}

.detalle-datos dt { color: var(--subtle); }
.detalle-datos dd { margin: 0; color: var(--ink); }
.seccion { margin: var(--sp-2) 0 0; font-size: var(--text-sm); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

.resultado-programacion { display: flex; flex-direction: column; gap: var(--sp-2); }

@media (max-width: 900px) {
  .cal-encabezado, .cal-rejilla { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cal-encabezado span:nth-child(n + 3) { display: none; }
  .cal-semana { grid-template-columns: 1fr; }
}
/* ================= FR-38/orgánica: editor de publicación ================= */
.org-editor { display: flex; flex-direction: column; gap: var(--sp-4); }
.org-nota { margin: 0; padding: var(--sp-3); border-radius: var(--radius-md); background: rgba(56, 189, 248, 0.12); color: #bae6fd; font-size: var(--text-xs); }

.org-cabecera { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: var(--sp-3); }
.org-campo { display: flex; flex-direction: column; gap: var(--sp-2); }
.org-campo__cab { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.org-contador { font-size: var(--text-xs); color: var(--subtle); font-variant-numeric: tabular-nums; }
.org-contador--excede { color: #fca5a5; font-weight: 700; }

.org-redes { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.org-chip {
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}
.org-chip--activa {
  border-color: transparent;
  background: var(--grad-brand);
  color: #fff;
  box-shadow: 0 8px 20px rgba(109, 40, 217, 0.35);
}

.org-tabs { display: flex; flex-direction: column; gap: var(--sp-3); }
.org-tab {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding: var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(9, 13, 33, 0.55);
}

.org-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: var(--sp-6) var(--sp-4);
  border: 1px dashed rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--motion-fast) var(--ease), background var(--motion-fast) var(--ease);
}
.org-dropzone:hover, .org-dropzone--activa { border-color: var(--brand-500); background: rgba(124, 58, 237, 0.1); }

.org-archivos { display: flex; flex-direction: column; gap: var(--sp-2); margin: 0; padding: 0; list-style: none; }
.org-archivo {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
}
.org-archivo__media { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; background: #05081a; }
.org-archivo__datos { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.org-archivo__datos strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-sm); }
.org-archivo__acciones { display: flex; gap: 4px; }
.org-progreso { grid-column: 1 / -1; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.org-progreso__barra { height: 100%; width: 0; background: var(--grad-brand); transition: width 120ms linear; }

.org-preview {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(9, 13, 33, 0.7);
}
.org-preview--vacia { align-items: flex-start; }
.org-preview__cab { display: flex; align-items: center; gap: var(--sp-2); }
.org-preview__media { width: 100%; max-height: 240px; object-fit: cover; border-radius: 10px; }
.org-preview__texto { margin: 0; white-space: pre-wrap; font-size: var(--text-sm); color: var(--ink); }
.org-preview--instagram { border-color: rgba(236, 72, 153, 0.35); }
.org-preview--facebook { border-color: rgba(59, 130, 246, 0.35); }
.org-preview--tiktok { border-color: rgba(20, 184, 166, 0.35); }
.org-preview--youtube { border-color: rgba(248, 113, 113, 0.35); }

.org-avisos { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.org-aviso { font-size: var(--text-xs); padding: 4px 8px; border-radius: 8px; }
.org-aviso--error { background: var(--danger-50); color: #fecaca; }
.org-aviso--advertencia { background: var(--warning-50); color: #fde68a; }
.org-aviso--info { background: var(--info-50); color: #bae6fd; }

.org-programacion {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
}

@media (max-width: 720px) {
  .org-cabecera { grid-template-columns: 1fr; }
  .org-archivo { grid-template-columns: 48px 1fr; }
  .org-archivo__acciones { grid-column: 1 / -1; justify-content: flex-end; }
}
/* Las acciones del editor quedan siempre visibles al hacer scroll. */
.org-editor .panel-acciones {
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding: var(--sp-3) 0;
  background: linear-gradient(180deg, rgba(16, 22, 50, 0.2), rgba(16, 22, 50, 0.98) 40%);
}
/* Espacio para que la barra fija de acciones no tape el último campo. */
.org-editor { padding-bottom: 88px; }