/* Las fuentes oficiales se sirven desde public/fonts mediante studio/server.mjs. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/inter-400-normal-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/inter-600-normal-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/playfair-display-400-normal-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/playfair-display-700-normal-latin.woff2') format('woff2');
}

:root {
  --accent: #835322;
  --accent-dark: #6a4219;
  --accent-bg: #F7EFE4;
  --text: #1a1a1a;
  --text-muted: #6b6258;
  --border: #e5ddd0;
  --surface: #ffffff;
  --surface-alt: #faf6ef;
  --danger: #b23b2e;
  --ok: #2e7d4f;
  --font: 'Inter', system-ui, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface-alt);
}

body.has-build-footer { padding-bottom: 26px; }
.build-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  height: 26px;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1rem;
  font-size: .7rem;
  color: #7d6e5a;
  background: #1a120b;
  border-top: 1px solid #3a2b1c;
  white-space: nowrap;
  overflow: hidden;
}
.build-footer code { color: #c9a876; font-size: .7rem; }
.build-footer span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.build-footer span:last-child { margin-left: auto; flex-shrink: 0; }

html.env-local body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  border: 8px solid transparent;
  border-image: repeating-linear-gradient(45deg, #f5a623 0 20px, #1a1a1a 20px 40px) 20;
}

a { color: var(--accent); }

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w, 220px);
  flex-shrink: 0;
  min-height: 100vh;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  background: #1a1209 !important;
  color: #fff;
  padding: 1.5rem 1rem;
}
/* Plegado: se queda solo la franja con el botón de desplegar. */
:root.sidebar-collapsed .sidebar { width: 2.6rem; padding: 1.5rem .4rem; overflow: hidden; }
:root.sidebar-collapsed .sidebar .sidebar-body { display: none; }
:root.sidebar-collapsed .sidebar .panel-resizer { display: none; }
.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: .5rem;
  right: .45rem;
  z-index: 2;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 0;
  border-radius: 6px;
  width: 1.6rem;
  height: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.sidebar-toggle:hover { background: rgba(255,255,255,0.22); }
:root.sidebar-collapsed .sidebar-toggle { right: .45rem; left: .45rem; width: auto; }
.sidebar h1 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  margin: 0 0 .25rem;
}
.sidebar .tag {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #c9a876;
  margin-bottom: 1.5rem;
  display: block;
}
.sidebar .tag-version {
  margin-top: -1.1rem;
  text-transform: none;
  letter-spacing: normal;
  color: #7d6e5a;
}
.sidebar nav { display: flex; flex-direction: column; gap: .25rem; }
.sidebar nav a {
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  padding: .55rem .7rem;
  border-radius: 6px;
  font-size: .92rem;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar nav a.active { background: var(--accent); color: #fff; }
.sidebar-return-owner { width: 100%; margin-top: 1rem; font-size: .78rem; }
.sidebar-account { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,0.12); display: flex; flex-direction: column; gap: .45rem; }
.sidebar-account-email { font-size: .74rem; color: rgba(255,255,255,0.6); overflow-wrap: anywhere; }
.sidebar-signout { align-self: flex-start; padding: .3rem .7rem; font-size: .75rem; background: transparent; color: rgba(255,255,255,0.8); border-color: rgba(255,255,255,0.25); }
.sidebar-signout:hover { color: #fff; border-color: #fff; }

.content { flex: 1; min-width: 0; padding: 2rem 3rem; max-width: 1320px; margin-inline: auto; }
.content h2 { font-family: var(--font-serif); margin-top: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.field { margin-bottom: 1.1rem; }
.field label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .35rem; color: var(--text); }
.field .hint { font-size: .78rem; color: var(--text-muted); margin-top: .3rem; }

input[type=text], input[type=email], input[type=password], input[type=datetime-local], input[type=time], input[type=number],
textarea, select {
  width: 100%;
  padding: .55rem .7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .92rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
textarea { resize: vertical; min-height: 90px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); border-color: var(--accent); }

.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 220px; }

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .4rem .8rem;
}
.checkbox-grid label { display: flex; align-items: center; gap: .4rem; font-weight: 400; font-size: .88rem; }
.checkbox-grid input { width: auto; }

button, .btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .6rem 1.1rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
button:hover, .btn:hover { border-color: var(--accent); color: var(--accent); }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button.primary:hover { background: var(--accent-dark); color: #fff; }
button.danger { color: var(--danger); border-color: var(--danger); }
button.danger:hover { background: var(--danger); color: #fff; }
button.social { color: #6a3fb5; border-color: #6a3fb5; }
button.social:hover { background: #6a3fb5; color: #fff; }
button:disabled { opacity: .5; cursor: not-allowed; }

.actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.5rem; }
.gdoc-actions { display: flex; align-self: flex-start; gap: .4rem; flex-wrap: wrap; margin-top: 1.6rem; }
.gdoc-actions button { padding: .45rem .7rem; font-size: .82rem; }

table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; }

.badge {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
}
.badge.published { background: #e4f3ea; color: var(--ok); }
.badge.draft { background: #f1efe9; color: var(--text-muted); }
.badge.scheduled { background: var(--accent-bg); color: var(--accent-dark); }

.table-actions { display: flex; gap: .4rem; }
.table-actions button, .table-actions a { padding: .35rem .6rem; font-size: .8rem; }

/* .table-actions ahora vive en un <div> DENTRO del td (no en el propio td):
   poner display:flex directamente en un td le quita el tamaño de celda de
   tabla normal (deja de estirarse a la columna completa) y aparecían huecos
   sin colorear al lado de los botones. El fondo de fila es un refuerzo. */
tr.group-separator { background: var(--accent-bg); }
.group-separator td { background: var(--accent-bg); padding: .5rem; border-bottom: 2px solid var(--accent); }
.issue-toggle { width: 100%; justify-content: space-between; padding: .15rem 0; border: 0; background: transparent; color: inherit; }
.issue-toggle:hover { border-color: transparent; color: var(--accent-dark); }
.issue-toggle span { font-size: .78rem; font-weight: 500; }
a.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
a.btn.primary:hover { background: var(--accent-dark); color: #fff; }

/* ── Editor de texto enriquecido ─────────────────────────────────────────── */
.rte-toolbar {
  display: flex;
  gap: .3rem;
  flex-wrap: wrap;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  padding: .4rem;
  background: var(--surface-alt);
}
.rte-toolbar button {
  padding: .35rem .55rem;
  font-size: .82rem;
  font-weight: 700;
}
.rte-context-menu {
  position: fixed;
  z-index: 1200;
  min-width: 240px;
  padding: .35rem 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
}
.rte-context-menu[hidden] { display: none; }
.rte-context-menu button {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  width: 100%;
  padding: .45rem 1rem;
  border: 0;
  background: none;
  font: inherit;
  font-size: .85rem;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.rte-context-menu button:hover { background: var(--accent-bg); }
.rte-context-menu button[hidden] { display: none; }
.rte-context-menu small { color: var(--text-muted); }
.rte-context-menu hr { margin: .3rem 0; border: 0; border-top: 1px solid var(--border); }
.rte-body {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 0 0 6px 6px;
  padding: 1rem;
  min-height: 320px;
  line-height: 1.6;
  font-size: .96rem;
}
.rte-body,
.rte-body * { font-family: var(--font) !important; }
.rte-body h2,
.rte-body h3,
.rte-body blockquote { font-family: var(--font-serif) !important; }
.rte-body:focus { outline: none; border-color: var(--accent); }
.rte-body p { margin-bottom: 1rem; }
.rte-body h2, .rte-body h3 { margin: 1.2rem 0 .6rem; }
.rte-body blockquote { border-left: 3px solid var(--accent); padding-left: 1rem; color: var(--text-muted); font-style: italic; margin: 1rem 0; }

/* Igualan el aspecto que tendrán en el sitio real (.article-content en global.css) */
.rte-body figure { margin: 1.2rem 0; cursor: pointer; border-radius: 6px; transition: box-shadow .15s; }
.rte-body figure.rte-selected { box-shadow: 0 0 0 3px var(--accent); }
.rte-body figure img { width: 100% !important; height: auto !important; display: block; margin-inline: auto; border-radius: 6px; }
.rte-body figure.img-s img { width: 40% !important; margin-inline: auto; }
.rte-body figure.img-m img { width: 70% !important; margin-inline: auto; }
.rte-body figure.img-left img { margin-left: 0; margin-right: auto; }
.rte-body figure.img-center img { margin-inline: auto; }
.rte-body figure.img-right img { margin-left: auto; margin-right: 0; }
.rte-body figcaption {
  font-size: .82rem; color: var(--text-muted); text-align: center; font-style: italic; margin-top: .4rem;
  min-height: 1.2em; outline: none;
}
.rte-body figcaption:empty::before { content: attr(data-placeholder); color: #b3a894; }

.rte-image-toolbar {
  position: absolute;
  display: none;
  gap: .25rem;
  background: #1a1209;
  border-radius: 6px;
  padding: .3rem;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
  z-index: 20;
}
.rte-image-toolbar button {
  padding: .3rem .55rem;
  font-size: .78rem;
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,.25);
}
.rte-image-toolbar button:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.rte-image-divider { width: 1px; margin: .1rem .05rem; background: rgba(255,255,255,.3); }
.rte-body blockquote { border-left: 3px solid var(--accent); padding-left: 1rem; color: var(--text-muted); font-style: italic; margin: 1rem 0; }

/* ── Log de progreso (jobs) ──────────────────────────────────────────────── */
.job-log {
  background: #14100a;
  color: #d8cdb8;
  font-family: 'SF Mono', Consolas, monospace;
  font-size: .8rem;
  border-radius: 8px;
  padding: 1rem;
  max-height: 260px;
  overflow-y: auto;
  white-space: pre-wrap;
  margin-top: 1rem;
}
.job-log .ok { color: #7fd99b; }
.job-log .err { color: #ff9a8b; }
/* Cabeceras de fase del pipeline ("Paso 2/3: …"). */
.job-log .step { color: #ffd277; margin-top: .35rem; }
/* El recuadro está siempre visible, así que vacío tiene que explicarse. */
.job-log .muted { color: #8d8372; }

.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--text);
  color: #fff;
  padding: .8rem 1.2rem;
  border-radius: 8px;
  font-size: .88rem;
  box-shadow: 0 6px 24px rgba(0,0,0,.25);
  z-index: 999;
}
.toast.err { background: var(--danger); }

.muted { color: var(--text-muted); }

/* ── Tráfico público y bots ─────────────────────────────────────────────── */
.traffic-page { max-width: 1580px; }
.traffic-filters .field { margin-bottom: 0; }
.traffic-kpis { margin-bottom: 1.5rem; }
.traffic-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
.traffic-grid .card { min-width: 0; }
.traffic-grid h4 { margin-top: 0; }
.traffic-ranked-list { display: flex; flex-direction: column; gap: .6rem; }
.traffic-ranked-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .15rem .8rem; align-items: center; font-size: .86rem; }
.traffic-ranked-item span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.traffic-ranked-item strong { font-size: .8rem; }
.traffic-ranked-item i { grid-column: 1 / -1; display: block; height: 5px; background: #eee5d8; border-radius: 5px; overflow: hidden; }
.traffic-ranked-item i::after { content: ''; display: block; height: 100%; width: var(--traffic-width); background: var(--accent); border-radius: inherit; }
.traffic-chart { height: 190px; display: flex; align-items: end; gap: 3px; overflow-x: auto; border-bottom: 1px solid var(--border); padding: 0 0 .1rem; }
.traffic-chart-column { flex: 1 0 14px; height: 100%; min-width: 14px; display: flex; align-items: end; position: relative; }
.traffic-bar { display: block; min-height: 0; }
.traffic-bar.human { background: #7a98bd; width: 52%; border-radius: 3px 0 0 0; }
.traffic-bar.bot { background: var(--accent); width: 48%; border-radius: 0 3px 0 0; }
.traffic-chart-column small { position: absolute; bottom: -1.2rem; left: 0; font-size: .55rem; color: var(--text-muted); transform: rotate(-45deg); transform-origin: top left; white-space: nowrap; }
.traffic-chart { padding-bottom: 1.3rem; }
.traffic-table-wrap { overflow: auto; max-height: 650px; }
.traffic-table-wrap table { min-width: 1050px; }
.traffic-table-wrap td { vertical-align: top; max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.traffic-type { display: inline-block; padding: .15rem .45rem; border-radius: 999px; font-size: .72rem; font-weight: 600; }
.traffic-type.bot { background: #f8ead3; color: #875116; }
.traffic-type.human { background: #e2eef9; color: #246197; }
@media (max-width: 860px) { .traffic-grid { grid-template-columns: 1fr; } }

.banner-warn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
  background: var(--sem-amarillo-bg, var(--accent-bg));
  color: var(--sem-amarillo-fg, var(--accent-dark));
  border: 1px solid var(--accent-bg);
  border-radius: 8px;
  padding: .7rem 1rem;
  font-size: .88rem;
  font-weight: 600;
  margin-bottom: 1rem;
}
.thumb { width: 100%; max-width: 260px; border-radius: 8px; display: block; margin-top: .5rem; }

.preview-caption { display: flex; align-items: flex-start; gap: 1.5rem; flex-wrap: wrap; }
.preview-caption img { max-width: 320px; width: 100%; border-radius: 8px; border: 1px solid var(--border); }

/* ── Analítica: KPIs, semáforos y gráficos ──────────────────────────────── */
:root {
  --chart-current: #a15c14;
  --chart-previous: #2a78d6;
  --sem-verde-bg: #e4f3ea; --sem-verde-fg: var(--ok);
  --sem-amarillo-bg: var(--accent-bg); --sem-amarillo-fg: var(--accent-dark);
  --sem-rojo-bg: #fbe7e4; --sem-rojo-fg: var(--danger);
  --sem-gris-bg: #f1efe9; --sem-gris-fg: var(--text-muted);
}

.content.wide { max-width: 1560px; }

.info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  font-size: .68rem;
  font-style: normal;
  cursor: help;
  margin-left: .3rem;
}

.badge.sem-verde { background: var(--sem-verde-bg); color: var(--sem-verde-fg); }
.badge.sem-amarillo { background: var(--sem-amarillo-bg); color: var(--sem-amarillo-fg); }
.badge.sem-rojo { background: var(--sem-rojo-bg); color: var(--sem-rojo-fg); }
.badge.sem-gris { background: var(--sem-gris-bg); color: var(--sem-gris-fg); }
.badge.sem-verde::before { content: '● '; }
.badge.sem-amarillo::before { content: '● '; }
.badge.sem-rojo::before { content: '● '; }
.badge.sem-gris::before { content: '● '; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1rem;
}
.kpi-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
}
.kpi-tile .kpi-label {
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  font-weight: 600;
  display: flex;
  align-items: center;
}
.kpi-tile .kpi-value {
  font-family: var(--font-serif);
  font-size: 1.9rem;
  margin: .3rem 0 .2rem;
  line-height: 1.1;
}
.kpi-tile .kpi-context { font-size: .8rem; color: var(--text-muted); }
.kpi-tile .kpi-context .up { color: var(--ok); font-weight: 600; }
.kpi-tile .kpi-context .down { color: var(--danger); font-weight: 600; }
.kpi-tile .badge { margin-top: .5rem; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: .25rem;
}
.section-head h3 { margin: 0; font-family: var(--font-serif); }

.legend { display: flex; gap: 1rem; font-size: .8rem; color: var(--text-muted); margin-bottom: .5rem; flex-wrap: wrap; }
.legend .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: .35rem; vertical-align: middle; }

.chart-tooltip {
  position: fixed;
  pointer-events: none;
  background: #1a1209;
  color: #fff;
  font-size: .78rem;
  padding: .4rem .6rem;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  z-index: 999;
  display: none;
  white-space: nowrap;
}

.chart-bar { transition: opacity .1s; cursor: pointer; }
.chart-bar:hover { opacity: .75; }

.pending-card {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.3rem;
  background: var(--surface-alt);
  margin-bottom: 1rem;
}
.pending-card h4 { margin: 0 0 .3rem; font-size: .95rem; }
.pending-card p { margin: 0; font-size: .84rem; color: var(--text-muted); }

.goal-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.goal-form .field { margin-bottom: 0; }

.quality-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .8rem;
}
.quality-grid .q-item { font-size: .84rem; }
.quality-grid .q-value { font-size: 1.3rem; font-family: var(--font-serif); }
.quality-grid .q-value.warn { color: var(--danger); }

.range-presets { display: flex; gap: .4rem; flex-wrap: wrap; }
.range-presets button { padding: .4rem .8rem; font-size: .82rem; }
.range-presets button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
#filter-card input[type=date] { padding: .4rem .5rem; }

/* ── Panel de redes (sección "Redes" y pie del editor) ─────────────────── */
.net-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.net-card { border: 1px solid #ddd; border-radius: 8px; padding: 1rem; background: #fff; }
.net-card.off { opacity: .55; }
.net-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.net-head h3 { margin: 0; font-size: 1rem; flex: 1; }
.net-card img { width: 100%; border-radius: 6px; display: block; margin-bottom: .75rem; background: #f2f2f2; }
.net-card img.vertical { width: auto; max-height: 480px; margin-inline: auto; }
.net-card textarea { width: 100%; font: inherit; font-size: .9rem; }
.net-card .hint { font-size: .8rem; margin: .35rem 0 .75rem; }
.net-counter { font-size: .78rem; color: #777; }
.net-counter.over { color: #b71c1c; font-weight: 600; }
.net-actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.net-actions input[type=time] { padding: .35rem .5rem; font-size: .85rem; }
.queue-row { display: flex; gap: .75rem; align-items: center; justify-content: space-between;
  padding: .45rem 0; border-bottom: 1px solid #eee; font-size: .9rem; }
.queue-row:last-child { border-bottom: 0; }

/* ── Calendario de publicaciones (estilo Google Calendar) ─────────────────── */
.cal-toolbar { display: flex; align-items: center; gap: .5rem; margin-bottom: 1.25rem; }
.cal-toolbar h3 { margin: 0 0 0 .5rem; font-family: var(--font-serif); font-size: 1.35rem; font-weight: 400; color: var(--text); }
.cal-toolbar #cal-today { border-radius: 20px; padding: .45rem 1rem; }
.cal-nav {
  width: 34px; height: 34px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border-color: transparent; font-size: 1.1rem; background: transparent;
}
.cal-nav:hover { background: var(--surface-alt); border-color: transparent; }

.cal-legend { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.25rem; }
.cal-tag { display: inline-flex; align-items: center; gap: .4rem; font-size: .78rem; color: var(--text-muted); }
.cal-tag::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.cal-tag--article { color: var(--accent); }
.cal-tag--facebook { color: #1877f2; }
.cal-tag--instagram { color: #c13584; }
.cal-tag--instagram_story { color: #8134af; }
.cal-tag--facebook_story { color: #4267b2; }
.cal-tag--telegram { color: #229ed9; }
.cal-tag--linkedin { color: #0a66c2; }

.cal-grid { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--border); }
.cal-grid__weekdays { display: grid; grid-template-columns: repeat(7, 1fr); background: #fff; border-bottom: 1px solid var(--border); }
.cal-grid__weekdays span { text-align: center; padding: .6rem 0; font-size: .7rem; font-weight: 700; color: var(--text-muted); letter-spacing: .04em; }
.cal-grid__days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.cal-cell {
  min-height: 110px;
  border: none;
  background: #fff;
  padding: .4rem;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: .3rem;
  font: inherit;
}
.cal-cell:hover { background: var(--surface-alt); }
.cal-cell--empty { visibility: hidden; cursor: default; }
.cal-cell--empty:hover { background: #fff; }
.cal-cell__num {
  align-self: flex-start;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 600; color: var(--text);
  border-radius: 50%;
}
.cal-cell--today .cal-cell__num { background: var(--accent); color: #fff; }
.cal-cell__events { display: flex; flex-direction: column; gap: .2rem; }

.cal-chip {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .72rem;
  padding: .12rem .4rem;
  border-radius: 4px;
  background: var(--surface-alt);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-chip__dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: var(--accent); }
.cal-chip--article .cal-chip__dot { background: var(--accent); }
.cal-chip--facebook .cal-chip__dot { background: #1877f2; }
.cal-chip--instagram .cal-chip__dot { background: #c13584; }
.cal-chip--instagram_story .cal-chip__dot { background: #8134af; }
.cal-chip--facebook_story .cal-chip__dot { background: #4267b2; }
.cal-chip--telegram .cal-chip__dot { background: #229ed9; }
.cal-chip--linkedin .cal-chip__dot { background: #0a66c2; }
.cal-chip--more { background: none; color: var(--text-muted); font-weight: 600; }
.cal-chip--error { outline: 1px solid var(--danger); }

.cal-modal { position: fixed; inset: 0; z-index: 500; background: rgba(20,14,8,.45); display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.cal-modal[hidden] { display: none; }
.cal-modal__card { width: 100%; max-width: 640px; max-height: 85vh; overflow-y: auto; position: relative; }
.cal-modal__close { position: absolute; top: .75rem; right: .75rem; width: 30px; height: 30px; padding: 0; border-radius: 50%; }
.cal-modal__event { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .5rem 0; border-bottom: 1px solid var(--border); font-size: .88rem; }
.cal-modal__event:last-child { border-bottom: 0; }
/* El panel de redes trae su propia cola "Programadas" (todas las fechas);
   dentro del calendario ya está el listado de este día arriba, así que se
   oculta para no duplicar. */
#cal-social-panel [data-queue-card] { display: none; }

/* ── Visor de creatividades de entrevistas ─────────────────────────────── */
.interview-design-modal { position: fixed; inset: 0; z-index: 800; overflow: auto; padding: 2rem; background: rgba(20,14,8,.58); }
.interview-design-dialog { max-width: 1180px; margin: 0 auto; padding: 1.35rem; border-radius: 12px; background: var(--surface); box-shadow: 0 20px 60px rgba(0,0,0,.32); }
.interview-design-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.interview-design-heading h2 { margin: 0 0 .2rem; font-family: var(--font-serif); }
.interview-design-heading .hint { margin: 0; }
.interview-design-layout { display: grid; grid-template-columns: minmax(300px, 1.15fr) minmax(280px, .85fr); gap: 1.5rem; align-items: start; }
.interview-design-preview { background: #cbb3a6; padding: 5.8%; aspect-ratio: 1; min-width: 0; }
.interview-design-sheet { position: relative; width: 100%; height: 100%; background: #f7f1ed; overflow: hidden; color: #2b2520; font-family: var(--font-sans); }
.interview-design-brand { position: absolute; inset: 10% 0 auto; display: grid; justify-items: center; gap: .6rem; letter-spacing: .08em; font-size: clamp(.6rem, 1.25vw, .95rem); }
.interview-design-logo { width: 4.2em; height: 4.2em; object-fit: contain; }
.interview-design-copy { position: absolute; left: 7%; top: 45%; width: 43%; text-align: center; }
.interview-design-copy > span { font-size: clamp(.56rem, 1.3vw, .92rem); font-weight: 800; letter-spacing: .08em; }
.interview-design-copy h3 { margin: .9em 0 .85em; font-family: var(--font-sans); font-size: clamp(1.15rem, 3vw, 2.45rem); line-height: 1.1; letter-spacing: .04em; }
.interview-design-copy p { margin: 0; font-size: clamp(.5rem, 1.12vw, .8rem); line-height: 1.34; }
.interview-design-copy small { display: block; margin-top: 1.15rem; font-size: clamp(.42rem, .82vw, .62rem); font-weight: 800; line-height: 1.25; letter-spacing: .03em; }
.interview-design-photo { position: absolute; right: 7%; top: 41%; width: 35%; height: 50%; overflow: hidden; border: 2px solid #111; background: #ddd; cursor: grab; touch-action: none; }
.interview-design-photo.dragging { cursor: grabbing; }
.interview-design-photo img { width: 100%; height: 100%; display: block; object-fit: cover; user-select: none; pointer-events: none; }
.interview-design-fields { min-width: 0; }
.interview-design-fields textarea { width: 100%; font: inherit; }
.interview-design-fields input[type=range] { width: 100%; }
@media (max-width: 760px) {
  .interview-design-modal { padding: .75rem; }
  .interview-design-dialog { padding: 1rem; }
  .interview-design-layout { grid-template-columns: 1fr; }
}

/* ── Paneles arrastrables (menú lateral y panel de revisión) ─────────────── */
.panel-resizer {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 7px;
  cursor: col-resize;
  z-index: 3;
  background: transparent;
}
.panel-resizer-right { right: -3px; }
.panel-resizer-left { left: -3px; }
.panel-resizer:hover,
.panel-resizer.dragging { background: var(--accent); opacity: .55; }
/* Mientras se arrastra, nada de selección de texto ni de robar el puntero el
   iframe del documento. */
body.panel-dragging { user-select: none; }
body.panel-dragging iframe { pointer-events: none; }

/* ── Revisión ───────────────────────────────────────────────────────────── */
.review-page { display: flex; flex-direction: column; height: 100vh; padding: 0; max-width: none; margin: 0; }
/* Cabecera del listado de Revisión: el título y el botón de releer la hoja. */
.review-head { display: flex; align-items: center; gap: .75rem; }
.review-head h2 { margin: 0; }
.review-head .btn { margin-left: auto; }

.review-topbar {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.review-topbar h2 { margin: 0; font-size: 1.1rem; }
.review-topbar .review-meta { color: #6b6256; font-size: .85rem; }
.review-topbar .review-actions { margin-left: auto; display: flex; gap: .5rem; align-items: center; }

.review-body { display: flex; flex: 1; min-height: 0; }
.review-doc { flex: 1; min-width: 0; position: relative; background: #f1efe9; }
.review-doc iframe { width: 100%; height: 100%; border: 0; display: block; }
.review-doc-read {
  width: 100%;
  height: 100%;
  overflow: auto;
  background: #fff;
  padding: 2rem clamp(1rem, 6vw, 5rem);
}
.review-doc-read img { max-width: 100%; height: auto; }
.review-doc-fallback { padding: 2rem; max-width: 46rem; }

.review-tabs { display: flex; gap: .35rem; padding: .4rem 1.25rem 0; background: var(--surface); border-bottom: 1px solid var(--border); }

.review-side {
  position: relative;
  width: var(--review-side-w, 340px);
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: var(--surface);
  overflow-y: auto;
  padding: 1rem 1.1rem 2rem;
}
.review-side.collapsed { width: 2.6rem; padding: .5rem .35rem; overflow: hidden; }
.review-side.collapsed .review-side-body { display: none; }
.review-side.collapsed .panel-resizer { display: none; }
.review-side h3 { margin: .2rem 0 .6rem; font-size: .95rem; }
.review-side-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--border);
  border: 0;
  border-radius: 6px;
  width: 1.7rem;
  height: 1.7rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.review-side-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.review-verdicts { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .8rem; }
.review-verdicts label { display: flex; gap: .45rem; align-items: center; font-size: .92rem; cursor: pointer; }
.review-side textarea { width: 100%; min-height: 7rem; resize: vertical; }
.review-sheet dl { margin: 0; font-size: .85rem; }
.review-sheet dt { color: #6b6256; margin-top: .5rem; }
.review-sheet dd { margin: 0; }

.review-report { margin-top: 1rem; font-size: .88rem; }
.review-report h4 { margin: .9rem 0 .35rem; font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: #6b6256; }
.review-report ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.review-report li { padding: .4rem .55rem; border-radius: 6px; border-left: 3px solid transparent; background: #faf8f4; }
.review-report li.level-error { border-left-color: #b3261e; background: #fdf0ef; }
.review-report li.level-warn { border-left-color: #c58a0a; background: #fdf8ec; }
.review-report li.level-ok { border-left-color: #2f7d4f; }
.review-report .detail { display: block; color: #6b6256; margin-top: .15rem; }
.review-report .summary { font-weight: 600; }
.review-finding-actions { display: flex; gap: .3rem; margin-top: .35rem; }
.review-finding-actions button { padding: .2rem .5rem; font-size: .75rem; }
.review-gdoc { margin-top: 1rem; }
.review-gdoc textarea { min-height: 5rem; }
.review-gdoc .actions { margin-top: .6rem; }
.review-quote {
  background: var(--accent-bg);
  border-left: 3px solid var(--accent);
  padding: .4rem .55rem;
  font-size: .82rem;
  border-radius: 0 6px 6px 0;
  margin: 0 0 .5rem;
}
.review-quote button { padding: .1rem .4rem; font-size: .72rem; margin-left: .3rem; }
.review-comments { list-style: none; margin: .6rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; font-size: .82rem; }
.review-comments li { background: #faf8f4; border-radius: 6px; padding: .4rem .55rem; }

/* ── Orquestador Symphony ──────────────────────────────────────────────── */
.orchestrator-status { display: flex; gap: .45rem; flex-wrap: wrap; margin: 0 0 1rem; }
.orchestrator-fields { align-items: end; }
.orchestrator-fields .field { min-width: 150px; flex: 1 1 170px; }
.orchestrator-fields .field.compact { max-width: 140px; }
.orchestrator-heading { display: flex; justify-content: space-between; gap: 1rem; align-items: start; }
.orchestrator-heading h3 { margin: 0 0 .3rem; }
.orchestrator-heading .hint { margin: 0; }
.orchestrator-issues { margin-top: 1rem; }
.orchestrator-issue { display: flex; gap: 1rem; justify-content: space-between; align-items: start; padding: .9rem 0; border-top: 1px solid var(--border); }
.orchestrator-issue:first-child { border-top: 0; padding-top: 0; }
.orchestrator-issue-main { min-width: 0; }
.orchestrator-issue-title { font-size: 1rem; margin-bottom: .25rem; }
.orchestrator-issue p { margin: .55rem 0 0; white-space: pre-wrap; color: var(--text-muted); font-size: .88rem; }
@media (max-width: 640px) {
  .orchestrator-issue { flex-direction: column; }
}

/* ── Tablero Kanban del Orquestador ────────────────────────────────────── */
.orchestrator-page { max-width: none; width: 100%; padding: 1.5rem 2rem; overflow: hidden; }
.orchestrator-titlebar { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.orchestrator-titlebar h2 { margin-bottom: .25rem; }
.orchestrator-titlebar p { margin-top: 0; }
.kanban { display: grid; grid-template-columns: repeat(5, minmax(250px, 1fr)); gap: 1rem; overflow-x: auto; padding: .3rem 0 1.2rem; min-height: calc(100vh - 190px); }
.kanban-column { background: #eee8de; border-radius: 10px; padding: .8rem; min-width: 250px; display: flex; flex-direction: column; }
.kanban-column > header { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .1rem .2rem .75rem; }
.kanban-column h3 { margin: 0; font-size: .92rem; }
.kanban-column header span { min-width: 1.45rem; padding: .15rem .42rem; border-radius: 999px; background: #ddd4c6; text-align: center; font-size: .75rem; font-weight: 700; }
.kanban-dropzone { min-height: 4rem; display: flex; flex-direction: column; gap: .65rem; }
.kanban-dropzone:empty::after { content: 'Suelta aquí una tarea'; color: var(--text-muted); font-size: .8rem; text-align: center; padding: 1.2rem .4rem; border: 1px dashed #cfc4b3; border-radius: 7px; }
.kanban-card { cursor: grab; border: 1px solid var(--border); border-radius: 8px; background: #fff; padding: .75rem; box-shadow: 0 1px 2px #3218; }
.kanban-card:hover { border-color: var(--accent); }
.kanban-card.dragging { opacity: .45; }
.kanban-card-id { font-size: .7rem; color: var(--text-muted); font-weight: 700; letter-spacing: .04em; }
.kanban-card h4 { margin: .3rem 0; font-size: .92rem; line-height: 1.35; }
.kanban-card p { margin: .45rem 0 .7rem; white-space: pre-wrap; font-size: .78rem; color: var(--text-muted); line-height: 1.4; }
.kanban-card-footer { display: flex; justify-content: space-between; align-items: center; gap: .35rem; }
.kanban-card-footer .btn { padding: .25rem .45rem; font-size: .72rem; }
.runner-chip { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: .2rem .4rem; border-radius: 999px; background: #eef0f3; color: #36424b; font-size: .7rem; font-weight: 600; }
.runner-claude { background: #f8e8dc; color: #994114; }
.runner-local { background: #e5f0e8; color: #276746; }
.kanban-add { margin-top: .75rem; padding: .45rem; border: 0; border-radius: 6px; background: transparent; color: var(--text-muted); text-align: left; cursor: pointer; font: inherit; font-size: .82rem; }
.kanban-add:hover { background: #e0d7c9; color: var(--text); }
.task-dialog { position: fixed; inset: 0; z-index: 1100; display: grid; place-items: center; padding: 1rem; }
.task-dialog[hidden] { display: none; }
.task-dialog-backdrop { position: absolute; inset: 0; background: #1b140bbb; }
.task-dialog-panel { position: relative; width: min(680px, 100%); max-height: calc(100vh - 2rem); overflow: auto; padding: 1.25rem; border-radius: 10px; background: var(--surface); box-shadow: 0 12px 36px #0006; }
.task-dialog-panel > header { display: flex; justify-content: space-between; gap: 1rem; align-items: start; margin-bottom: 1rem; }
.task-dialog-panel h3 { margin: 0; }
@media (max-width: 760px) { .orchestrator-page { padding: 1.25rem 1rem; } .kanban { grid-template-columns: repeat(5, 82vw); } }

/* ── Apartado de Logs ─────────────────────────────────────────────────── */
.logs-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.logs-tab.active { background: var(--accent, #c99a42); color: #1c1710; }
.logs-text {
  max-height: 60vh;
  overflow: auto;
  margin: 0;
  padding: .7rem .8rem;
  border-radius: 6px;
  background: #15110c;
  color: #e8e2d4;
  font: .8rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}
.logs-chip {
  display: inline-block;
  padding: .12rem .5rem;
  border-radius: 999px;
  background: #2a2a2a22;
  font-size: .76rem;
  font-weight: 600;
}
.logs-chip.ok { background: #1f7a4420; color: #1f7a44; }
.logs-chip.mal { background: #a3242420; color: #a32424; }
.logs-chip.aviso { background: #8a640020; color: #8a6400; }
/* Grafana vive en su propio origen y dibuja sus gráficas a pantalla completa:
   sin una altura fija el iframe colapsa a unos pocos píxeles. */
.logs-grafana { width: 100%; min-height: 70vh; border: 0; border-radius: 6px; background: #fff; }
