:root {
  --bg: #0d1117;
  --surface: #151b23;
  --surface-2: #1b232d;
  --surface-3: #222c38;
  --border: #2a3441;
  --border-strong: #3a4757;
  --text: #e6eaf0;
  --muted: #8d99aa;
  --faint: #617085;

  --accent: #6aa7ff;
  --accent-strong: #8dbbff;
  --accent-ink: #06101f;
  --accent-soft: rgba(106, 167, 255, 0.14);

  --ok: #4cc38a;
  --ok-soft: rgba(76, 195, 138, 0.14);
  --warn: #e6a93b;
  --warn-soft: rgba(230, 169, 59, 0.14);
  --bad: #ef6b6b;
  --bad-soft: rgba(239, 107, 107, 0.14);

  --radius: 10px;
  --radius-sm: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.app { padding-top: 32px; padding-bottom: 0; }
.pad { padding: 24px 0; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(13, 17, 23, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-in { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { flex: none; display: block; }
.brand-name { font-weight: 750; font-size: 26px; letter-spacing: -0.02em; }
@media (max-width: 560px) { .topbar .brand-mark { width: 40px; height: 40px; } .brand-name { font-size: 22px; } }
.brand-name span, .auth-name span { color: #f5b83d; }

.badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-ok { color: var(--ok); background: var(--ok-soft); border-color: rgba(76, 195, 138, 0.35); }
.badge-bad { color: var(--bad); background: var(--bad-soft); border-color: rgba(239, 107, 107, 0.4); }

/* ---------- Banners ---------- */
.banners {
  position: fixed; top: 64px; right: 16px; z-index: 60;
  display: flex; flex-direction: column; gap: 8px;
  width: min(440px, calc(100vw - 32px));
  pointer-events: none;
}
.banner {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border-strong);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  font-size: 14px;
}
.banner-error { border-color: rgba(239, 107, 107, 0.55); background: #2a1a1d; }
.banner-info { border-color: rgba(106, 167, 255, 0.45); }
.banner-text { flex: 1; word-break: break-word; }
.banner-close {
  background: none; border: 0; padding: 2px; cursor: pointer; color: var(--muted);
  border-radius: 4px; line-height: 0;
}
.banner-close:hover { color: var(--text); }

/* ---------- Generic UI ---------- */
.icon { display: inline-flex; line-height: 0; }
.icon svg { width: 16px; height: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface-2);
  color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer;
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
}
.btn:hover:not(:disabled) { background: var(--surface-3); border-color: var(--faint); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-sm { padding: 5px 10px; font-size: 13px; }

.alert {
  padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  font-size: 14px;
}
.alert-bad { border-color: rgba(239, 107, 107, 0.55); background: var(--bad-soft); color: #ffd6d6; }
.alert strong { color: #fff; }
.alert code, code.inline {
  font-family: var(--mono); font-size: 12.5px;
  background: rgba(255, 255, 255, 0.08); padding: 1px 6px; border-radius: 4px;
}

/* Status pills */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 650; white-space: nowrap;
  background: var(--surface-3); color: var(--muted);
  border: 1px solid var(--border-strong);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.s-investigando, .pill.s-generando { color: var(--accent); background: var(--accent-soft); border-color: rgba(106, 167, 255, 0.45); }
.pill.pulse::before { animation: pulse 1.4s ease-in-out infinite; }
.pill.s-lista, .pill.s-aprobado, .pill.s-listo { color: var(--ok); background: var(--ok-soft); border-color: rgba(76, 195, 138, 0.4); }
.pill.s-error, .pill.s-rechazado, .pill.s-fallo { color: var(--bad); background: var(--bad-soft); border-color: rgba(239, 107, 107, 0.45); }
.pill.s-esperando_aprobacion { color: var(--warn); background: var(--warn-soft); border-color: rgba(230, 169, 59, 0.45); }
.pill.s-guardado { color: var(--accent); background: var(--accent-soft); border-color: rgba(106, 167, 255, 0.4); }

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(106, 167, 255, 0.55); }
  50% { opacity: 0.55; box-shadow: 0 0 0 5px rgba(106, 167, 255, 0); }
}

/* ---------- Home ---------- */
.hero {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; margin-bottom: 32px;
}
.hero h1 { margin-bottom: 4px; }
.hero .lead { color: var(--muted); margin-bottom: 20px; }
.hero .alert { margin-bottom: 20px; }

.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) 120px 230px; gap: 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label {
  font-size: 12.5px; font-weight: 650; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.input, .textarea {
  width: 100%;
  background: var(--bg); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 9px 11px; color: var(--text);
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.textarea { resize: vertical; min-height: 84px; }
.form-actions { display: flex; align-items: center; gap: 14px; }
.hint { font-size: 13px; color: var(--muted); }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.section-head .count { color: var(--muted); font-size: 13px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; padding-bottom: 48px; }
.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: border-color 0.12s, transform 0.12s;
}
.card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.card-link { display: flex; flex-direction: column; color: inherit; flex: 1; }
.card-link:hover { text-decoration: none; }
.card-cover {
  aspect-ratio: 4 / 3; background: var(--surface-2); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; color: var(--faint);
  font-size: 13px; overflow: hidden;
}
.card-cover img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.card-title { font-size: 16px; font-weight: 650; word-break: break-word; padding-right: 36px; }
.card-specs {
  color: var(--muted); font-size: 13.5px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--muted); }
.card-meta b { color: var(--text); font-weight: 650; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.card-date { font-size: 12.5px; color: var(--faint); }
.card-del {
  position: absolute; top: 10px; right: 10px;
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  background: rgba(13, 17, 23, 0.82); border: 1px solid var(--border-strong);
  color: var(--muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.card-del:hover { color: var(--bad); border-color: var(--bad); }

.empty {
  grid-column: 1 / -1;
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  padding: 40px 24px; text-align: center; color: var(--muted);
}
.empty h3 { color: var(--text); margin-bottom: 6px; font-size: 16px; }

/* ---------- Detail ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); margin-bottom: 16px; }
.back:hover { color: var(--text); text-decoration: none; }
.detail-head { margin-bottom: 20px; }
.title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.title-row h1 { word-break: break-word; }
.detail-meta { margin-top: 6px; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 16px; }
.detail-specs { margin-top: 10px; color: var(--muted); max-width: 80ch; white-space: pre-wrap; }

.busy {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px; margin-bottom: 16px;
  border: 1px solid rgba(106, 167, 255, 0.4); background: var(--accent-soft);
  border-radius: var(--radius-sm); font-size: 14px;
}
.busy-bar { flex: none; width: 56px; height: 4px; border-radius: 2px; background: rgba(106, 167, 255, 0.25); overflow: hidden; position: relative; }
.busy-bar::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 40%;
  background: var(--accent); border-radius: 2px;
  animation: slide 1.2s ease-in-out infinite;
}
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
.busy-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.busy-text b { font-weight: 650; margin-right: 8px; }
.busy-text .mono { color: var(--muted); font-size: 12.5px; }

.errbox {
  margin-bottom: 16px; padding: 14px 16px; border-radius: var(--radius-sm);
  border: 1px solid rgba(239, 107, 107, 0.55); background: var(--bad-soft);
}
.errbox h3 { color: #ffb4b4; margin-bottom: 8px; }
.errbox pre { margin: 0; font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; word-break: break-word; color: #ffd6d6; }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 12px;
}
.panel > summary {
  list-style: none; cursor: pointer; padding: 12px 16px;
  display: flex; align-items: center; gap: 10px; font-weight: 650;
  user-select: none;
}
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary::before {
  content: ""; width: 7px; height: 7px; flex: none;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg); transition: transform 0.12s; margin-right: 2px;
}
.panel[open] > summary::before { transform: rotate(45deg); }
.panel > summary .sum-meta { margin-left: auto; font-weight: 400; font-size: 13px; color: var(--muted); }
.panel-body { padding: 16px; border-top: 1px solid var(--border); }

.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px 16px; margin: 0 0 20px; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; word-break: break-word; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--border); font-size: 12.5px; color: var(--text);
}
.chip.warn { color: var(--warn); border-color: rgba(230, 169, 59, 0.4); background: var(--warn-soft); }
.chip.bad { color: var(--bad); border-color: rgba(239, 107, 107, 0.4); background: var(--bad-soft); }
.chip.ok { color: var(--ok); border-color: rgba(76, 195, 138, 0.4); background: var(--ok-soft); }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-family: var(--mono); color: var(--muted); }
.swatch i { width: 26px; height: 26px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, 0.18); display: block; }

.subhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 12px; flex-wrap: wrap; }
.subhead h4 { font-size: 14px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }

.imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; max-height: 520px; overflow: auto; padding-right: 4px; }
.imgs.hide-desc .tile.descartada { display: none; }
.tile { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; display: flex; flex-direction: column; }
.tile .thumb { position: relative; display: block; aspect-ratio: 1; background: var(--bg); }
.tile .thumb img { width: 100%; height: 100%; object-fit: cover; }
.tile .flag {
  position: absolute; left: 6px; top: 6px; padding: 1px 7px; border-radius: 999px;
  font-size: 11px; font-weight: 700; background: rgba(13, 17, 23, 0.85); color: var(--ok);
  border: 1px solid rgba(76, 195, 138, 0.5); z-index: 1;
}
.tile.descartada { border-color: rgba(239, 107, 107, 0.45); }
.tile.descartada .thumb img { opacity: 0.4; filter: grayscale(0.85); }
.tile.descartada .thumb::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top right, transparent calc(50% - 1px), rgba(239, 107, 107, 0.8) 50%, transparent calc(50% + 1px));
}
.tile.descartada .flag { color: var(--bad); border-color: rgba(239, 107, 107, 0.6); }
.tile .tile-body { padding: 8px 9px 10px; display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.tile .tile-desc { color: var(--text); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tile .tile-motivo { color: var(--bad); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tile .chips { gap: 4px; }
.tile .chip { font-size: 11px; padding: 0 6px; }

.log {
  margin: 0; padding: 12px 14px; max-height: 280px; overflow: auto;
  background: #090c10; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
  color: #b9c4d3;
}

.files { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.files th, .files td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border); }
.files th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.files td.num, .files th.num { text-align: right; white-space: nowrap; }
.files td.path { font-family: var(--mono); font-size: 12.5px; word-break: break-all; }

/* ---------- Posts ---------- */
.posts-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 28px 0 14px; flex-wrap: wrap; }
.posts-head .hint { max-width: 60ch; }
.posts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.posts-empty { grid-column: 1 / -1; }

.post {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--border-strong);
  border-radius: var(--radius); display: flex; flex-direction: column;
}
.post[data-estado="aprobado"], .post[data-estado="listo"] { border-color: rgba(76, 195, 138, 0.55); border-left-color: var(--ok); }
.post[data-estado="guardado"] { border-color: rgba(106, 167, 255, 0.5); border-left-color: var(--accent); }
.post[data-estado="rechazado"], .post[data-estado="fallo"] { border-color: rgba(239, 107, 107, 0.5); border-left-color: var(--bad); }
.post[data-estado="rechazado"] .post-body { opacity: 0.6; }

.post-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px 0; }
.post-num { font-family: var(--mono); font-weight: 700; color: var(--muted); font-size: 13px; }
.post-tag {
  font-size: 12px; font-weight: 600; color: var(--accent);
  background: var(--accent-soft); padding: 1px 9px; border-radius: 999px;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.post-head .pill { margin-left: auto; }

.post-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 12px 14px 14px; }
.post.con-imagen .post-body { grid-template-columns: 180px minmax(0, 1fr); }

.post-media { display: flex; flex-direction: column; gap: 8px; }
.post-media a.img-link { display: block; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--bg); aspect-ratio: 4 / 5; }
.post-media img { width: 100%; height: 100%; object-fit: cover; }
.media-links { display: flex; gap: 10px; font-size: 12.5px; }

.post-fields { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pf { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pf > label { font-size: 11.5px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.edit {
  display: block; resize: none;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 5px 7px; margin: 0 -7px; width: calc(100% + 14px);
  color: var(--text); line-height: 1.4; field-sizing: content; min-height: 2em;
  transition: background 0.12s, border-color 0.12s;
}
.edit:hover { background: var(--surface-2); }
.edit:focus { outline: none; background: var(--bg); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.edit.titular { font-size: 17px; font-weight: 700; line-height: 1.3; }
.edit.copy { min-height: 110px; font-size: 14px; }
.edit.hash { font-size: 13px; color: var(--accent); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-top: 2px; }
.tab {
  background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  padding: 6px 10px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted);
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }

.post-error { font-size: 13px; color: #ffb4b4; background: var(--bad-soft); border: 1px solid rgba(239, 107, 107, 0.4); border-radius: var(--radius-sm); padding: 6px 9px; word-break: break-word; }
.post-note { font-size: 12.5px; color: var(--warn); }
.post-det > summary { cursor: pointer; font-size: 12.5px; color: var(--muted); }
.post-det > div { margin-top: 8px; font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; word-break: break-word; }
.post-det b { color: var(--text); font-weight: 650; }

.post-actions { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg button {
  background: var(--surface-2); border: 0; border-right: 1px solid var(--border-strong);
  padding: 6px 12px; font-size: 13px; font-weight: 650; cursor: pointer; color: var(--text);
}
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--surface-3); }
.seg button[aria-pressed="true"].b-guardado { background: var(--accent-soft); color: var(--accent); }
.seg button[aria-pressed="true"].b-rechazado { background: var(--bad-soft); color: var(--bad); }
.seg button[aria-pressed="true"].b-aprobado { background: var(--ok-soft); color: var(--ok); }
.save-status { margin-left: auto; font-size: 12.5px; color: var(--muted); min-height: 1.2em; }
.save-status.bad { color: var(--bad); }
.save-status.ok { color: var(--ok); }

/* ---------- Action bar ---------- */
.actionbar {
  position: sticky; bottom: 0; z-index: 20;
  margin: 32px -24px 0; padding: 12px 24px;
  background: rgba(21, 27, 35, 0.96); backdrop-filter: blur(8px);
  border-top: 1px solid var(--border-strong);
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
}
.counts { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.counts .big { font-size: 20px; font-weight: 700; }
.counts .big small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.counts .small { font-size: 13px; color: var(--muted); }
.act-right { margin-left: auto; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.rehacer { display: flex; flex-direction: column; gap: 2px; max-width: 340px; }
.rehacer .hint { font-size: 12px; line-height: 1.35; }
.rehacer .hint.bad { color: var(--bad); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .wrap { padding: 0 16px; }
  .posts { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .actionbar { margin-left: -16px; margin-right: -16px; padding: 10px 16px; gap: 12px; }
  .act-right { margin-left: 0; width: 100%; justify-content: space-between; }
  .kv { grid-template-columns: 110px minmax(0, 1fr); }
  .banners { top: 60px; }
}
@media (max-width: 560px) {
  .post.con-imagen .post-body { grid-template-columns: minmax(0, 1fr); }
  .post-media { max-width: 220px; }
}
@media (prefers-reduced-motion: reduce) {
  .pill.pulse::before, .busy-bar::after { animation: none; }
  .card { transition: none; }
}

/* ---------- Publicar en Facebook ---------- */
.btn-pub {
  margin-left: 6px;
  background: var(--warn-soft); border-color: rgba(230, 169, 59, 0.6); color: var(--warn);
}
.btn-pub:hover:not(:disabled) { background: rgba(230, 169, 59, 0.24); border-color: var(--warn); }
.btn-pub .icon svg { width: 14px; height: 14px; }
.spinner {
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid rgba(230, 169, 59, 0.3); border-top-color: var(--warn);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.pub-done { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-left: 6px; font-size: 13px; }
.pub-done .hint { font-size: 12.5px; }
.pub-msg { flex-basis: 100%; margin: 0; }
.pub-msg.hint { font-size: 12.5px; }
.pubcount { font-size: 13px; font-weight: 650; color: var(--ok); }

.alert-warn { border-color: rgba(230, 169, 59, 0.55); background: var(--warn-soft); color: #ffe2a8; }

body.modal-open { overflow: hidden; }
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(5, 8, 12, 0.72);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  overflow: auto;
}
.modal {
  width: min(640px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  padding: 22px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  display: flex; flex-direction: column; gap: 16px;
}
.modal-target { color: var(--muted); }
.modal-target strong { color: var(--text); }
.modal-grid { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 16px; }
.modal-img { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--bg); aspect-ratio: 4 / 5; }
.modal-img img { width: 100%; height: 100%; object-fit: cover; }
.modal-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.modal-text {
  margin: 0; padding: 10px 12px; max-height: 240px; overflow: auto;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 14px; white-space: pre-wrap; word-break: break-word;
}
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
@media (max-width: 560px) {
  .modal-grid { grid-template-columns: minmax(0, 1fr); }
  .modal-img { max-width: 160px; }
}
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* Publicar vive dentro del grupo de botones, donde estaba Aprobar */
.seg button.b-publicar {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--warn-soft); color: var(--warn);
}
.seg button.b-publicar:hover:not(:disabled) { background: rgba(230, 169, 59, 0.26); }
.seg button.b-publicar:disabled { opacity: 0.55; cursor: not-allowed; }
.seg button.b-publicar .icon svg { width: 14px; height: 14px; }

/* ---------- Header nav ---------- */
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topnav a { font-size: 14px; font-weight: 600; color: var(--muted); padding: 4px 2px; border-bottom: 2px solid transparent; }
.topnav a:hover { color: var(--text); text-decoration: none; }
.topnav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- Ajustes ---------- */
.alert-info { border-color: rgba(106, 167, 255, 0.45); background: var(--accent-soft); color: var(--text); }
.alert-ok { border-color: rgba(76, 195, 138, 0.45); background: var(--ok-soft); color: #c9f1dc; }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-result { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.form-result:empty { display: none; }
.field .hint { font-size: 12.5px; }

.canales { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; margin-bottom: 32px; }
.canal {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--ok);
  border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0;
}
.canal.pendiente { border-left-color: var(--warn); }
.canal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.canal-dom { font-size: 16px; word-break: break-all; }
.canal-page { color: var(--muted); }
.canal-page strong { color: var(--text); }
.canal-kv { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 4px 12px; margin: 0; font-size: 13px; }
.canal-kv dt { color: var(--muted); }
.canal-kv dd { margin: 0; word-break: break-all; }
.canal-motivo { color: var(--warn); font-size: 13px; }
.canal-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-danger:hover:not(:disabled) { border-color: var(--bad); color: var(--bad); }
.canal-result { font-size: 13px; padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); word-break: break-word; }
.canal-result.ok { border-color: rgba(76, 195, 138, 0.5); background: var(--ok-soft); color: #c9f1dc; }
.canal-result.bad { border-color: rgba(239, 107, 107, 0.5); background: var(--bad-soft); color: #ffd6d6; }

.ps-block { border: 1px solid rgba(230, 169, 59, 0.55); background: var(--warn-soft); border-radius: var(--radius-sm); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.ps-title { font-weight: 650; color: #ffe2a8; font-size: 14px; }
.ps-cmd {
  margin: 0; padding: 10px 12px; background: #090c10; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; word-break: break-all; user-select: all; color: #d7dee9;
}
.ps-actions { display: flex; gap: 8px; }
.ps-block .hint { color: #e8d4a5; }

@media (max-width: 900px) {
  .form-grid.cols-2 { grid-template-columns: minmax(0, 1fr); }
  .canales { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Ajustes: token y variable de entorno ---------- */
.input-row { display: flex; gap: 8px; }
.input-row .input { flex: 1; min-width: 0; }
.token-mask { font-family: var(--mono); color: var(--ok); }
.field > .hint { display: block; }
.env-details { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); }
.env-details > summary { cursor: pointer; padding: 10px 12px; font-size: 13.5px; font-weight: 600; color: var(--muted); user-select: none; }
.env-details > summary:hover { color: var(--text); }
.env-body { padding: 4px 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.env-host:empty { display: none; }
.btn-primary:disabled { cursor: not-allowed; }

/* ---------- Publicar en tres redes ---------- */
.pub-row { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; margin-left: 4px; }
.pub-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.pub-slot { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pub-row .btn-pub { margin-left: 0; }
.pub-done .pill { font-size: 12px; }

/* ---------- Ajustes: Instagram y LinkedIn por sitio ---------- */
.canales { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
.canal-sec { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.canal-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.canal-sec-head h4 { font-size: 14px; }
.li-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.hint.ok { color: var(--ok); }
.hint.bad { color: var(--bad); }
.canal-result.warn { border-color: rgba(230, 169, 59, 0.5); background: var(--warn-soft); color: #ffe2a8; }
@media (max-width: 900px) {
  .canales { grid-template-columns: minmax(0, 1fr); }
  .li-fields { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Programar (tarjeta de post) ---------- */
.sched-list, .sched-panel { flex-basis: 100%; }
.sched-line { margin: 0; font-size: 13px; color: var(--muted); }
.sched-line::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: middle; }
.linklike { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-size: 13px; text-decoration: underline; }
.linklike:hover { color: var(--accent-strong); }
.linklike:disabled { opacity: 0.5; cursor: default; }
.sched-panel { border: 1px solid var(--border-strong); background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.sched-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 10px; }
.sched-f { display: flex; flex-direction: column; gap: 4px; }
.sched-actions { display: flex; gap: 8px; }

/* ---------- Agenda ---------- */
.pill.s-pendiente { color: var(--accent); background: var(--accent-soft); border-color: rgba(106, 167, 255, 0.4); }
.pill.s-publicada { color: var(--ok); background: var(--ok-soft); border-color: rgba(76, 195, 138, 0.4); }
.pill.s-fallida { color: var(--bad); background: var(--bad-soft); border-color: rgba(239, 107, 107, 0.45); }
.pill.s-caducada, .pill.s-aplazada { color: var(--warn); background: var(--warn-soft); border-color: rgba(230, 169, 59, 0.45); }
.alert-warn { margin-bottom: 12px; }
.ag-pausa { margin-bottom: 12px; font-size: 15px; border-width: 2px; }
.ag-strip { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.ag-strip.pausado { border-color: var(--bad); background: var(--bad-soft); }
.ag-spacer { flex: 1; }
.ag-cap { font-size: 13.5px; color: var(--muted); }
.ag-day { margin-bottom: 18px; }
.ag-day h3 { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.ag-row { display: flex; align-items: center; gap: 12px; padding: 9px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 6px; flex-wrap: wrap; }
.ag-time { font-weight: 700; min-width: 48px; }
.ag-hist .ag-time { min-width: 120px; font-weight: 500; color: var(--muted); }
.ag-red { font-size: 12.5px; font-weight: 650; color: var(--accent); background: var(--accent-soft); padding: 1px 9px; border-radius: 999px; }
.ag-desc { flex: 1; min-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.ag-sitio { margin-left: 10px; font-size: 12px; color: var(--faint); }
.ag-error { color: #ffb4b4; font-size: 13px; word-break: break-word; }
.pl-posts { max-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.pl-post { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 4px; cursor: pointer; font-size: 13.5px; }
.pl-post:hover { background: var(--surface-2); }
.pl-post.off { opacity: 0.55; cursor: default; }
.pl-post input { accent-color: var(--accent); }
.pl-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-redes { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.pl-msg { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.pl-msg:empty { display: none; }
.pl-plan { margin-top: 20px; display: flex; flex-direction: column; gap: 12px; }
.pl-plan:empty { display: none; }
.tbl-wrap { overflow-x: auto; }
.files.plan td { vertical-align: top; }
.files.plan td .input { min-width: 210px; }
@media (max-width: 900px) { .sched-fields { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Voz tipografica de la imagen ---------- */
.post-voice { display: flex; }
.voice-pill { font-size: 11.5px; font-family: var(--mono); color: var(--muted); }
.voice-ctl { display: flex; flex-direction: column; gap: 10px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.voice-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 12px; align-items: start; }
.voice-grid .voice-acento { grid-column: 1 / -1; }
.voice-grid .input { padding: 6px 9px; font-size: 13px; }
.voice-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.post-det > summary { padding: 2px 0; }
.voice-ctl .seg button { padding: 5px 12px; }
.voice-ctl .seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }

/* ---------- Sesion: entrar, registro, menu de usuario ---------- */
body[data-auth="out"] .topbar-right { display: none; }
.auth-wrap { min-height: calc(100vh - 56px - 96px); display: flex; align-items: center; justify-content: center; padding: 24px 0; }
.auth-card {
  width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 36px 32px 30px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  display: flex; flex-direction: column; gap: 22px;
}
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 12px; }
.auth-brand .brand-mark { color: var(--accent); line-height: 0; }
.auth-name { font-size: 26px; font-weight: 750; letter-spacing: -0.02em; }
.auth-title { font-size: 16px; font-weight: 600; text-align: center; color: var(--muted); margin-top: -8px; }
.auth-form { display: flex; flex-direction: column; gap: 18px; }
.auth-form .input { padding: 11px 12px; font-size: 15px; }
.auth-btn { width: 100%; padding: 11px 14px; font-size: 15px; }
.auth-alt { text-align: center; font-size: 14px; color: var(--muted); }
.auth-msg { display: flex; flex-direction: column; gap: 10px; }
.auth-msg:empty { display: none; }
.pass-len.ok { color: var(--ok); }

.usermenu { display: flex; align-items: center; }
.um-wrap { position: relative; }
.um-btn {
  display: inline-flex; align-items: center; gap: 8px; max-width: 220px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 999px;
  padding: 4px 12px; cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--text);
}
.um-btn:hover { background: var(--surface-2); }
.um-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-pill { color: var(--accent); background: var(--accent-soft); border-color: rgba(106, 167, 255, 0.45); padding: 0 8px; font-size: 11px; }
.um-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 70; width: 300px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); padding: 8px; display: flex; flex-direction: column; gap: 4px;
}
.um-who { display: flex; flex-direction: column; padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; min-width: 0; }
.um-who .hint { overflow: hidden; text-overflow: ellipsis; }
.um-item { background: none; border: 0; text-align: left; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; color: var(--text); }
.um-item:hover { background: var(--surface-3); }
.um-form { display: flex; flex-direction: column; gap: 8px; padding: 6px 10px 10px; }
.um-form .input { padding: 7px 10px; font-size: 13.5px; }
.um-msg { font-size: 12.5px; }
.um-msg:empty { display: none; }
.um-ok { color: var(--ok); }
.um-bad { color: var(--bad); }

.topnav { display: flex; align-items: center; gap: 18px; }
.topnav a { display: inline-flex; align-items: center; gap: 6px; }
.nav-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--warn); color: #1a1204; font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }

.quota { font-size: 13px; font-weight: 600; color: var(--muted); }
.quota.full { color: var(--bad); }

/* ---------- Usuarios (admin) ---------- */
.pill.u-pendiente { color: var(--warn); background: var(--warn-soft); border-color: rgba(230, 169, 59, 0.45); }
.pill.u-activo { color: var(--ok); background: var(--ok-soft); border-color: rgba(76, 195, 138, 0.4); }
.pill.u-suspendido { color: var(--bad); background: var(--bad-soft); border-color: rgba(239, 107, 107, 0.45); }
.files.users td { vertical-align: middle; }
.files.users .u-row-pend td { background: rgba(230, 169, 59, 0.06); }
.u-actions { white-space: nowrap; display: flex; gap: 6px; }
@media (max-width: 900px) {
  .um-btn { max-width: 140px; }
  .topnav { gap: 12px; }
  .auth-card { padding: 28px 22px 24px; }
}

/* ---------------------------------------------------------------- Plan */
.plan-now { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; display: grid; gap: 18px; margin-bottom: 36px; }
.plan-now-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.plan-now-head h2 { font-size: 22px; margin: 2px 0 4px; }
.plan-now-side { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.meter-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.meter-top b { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
.meter-bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter-bar span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .4s ease; }
.meter.full .meter-bar span { background: var(--warn); }
.plan-choose { padding-bottom: 48px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 99px; padding: 3px; background: var(--surface); }
.seg-btn { border: 0; background: transparent; padding: 6px 14px; border-radius: 99px; cursor: pointer; color: var(--muted); font-size: 13.5px; }
.seg-btn[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }
.seg-save { color: var(--ok); font-weight: 650; font-size: 12px; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.plan-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 20px 20px; display: flex; flex-direction: column; gap: 10px; }
.plan-card.featured { border-color: rgba(106, 167, 255, 0.55); background: linear-gradient(180deg, var(--accent-soft), var(--surface) 55%); }
.plan-card.current { border-color: rgba(76, 195, 138, 0.55); }
.plan-flag { position: absolute; top: -11px; left: 18px; background: var(--accent); color: var(--accent-ink); font-size: 11.5px; font-weight: 700; letter-spacing: .02em; padding: 2px 10px; border-radius: 99px; }
.plan-price { display: flex; align-items: baseline; gap: 4px; }
.plan-price b { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.plan-price span { color: var(--muted); }
.plan-sub { margin-top: -6px; }
.plan-feats { list-style: none; margin: 6px 0 8px; padding: 0; display: grid; gap: 8px; font-size: 14px; color: var(--muted); flex: 1; }
.plan-feats li { padding-left: 20px; position: relative; }
.plan-feats li::before { content: ""; position: absolute; left: 2px; top: 7px; width: 9px; height: 5px; border-left: 2px solid var(--ok); border-bottom: 2px solid var(--ok); transform: rotate(-45deg); }
.plan-feats b { color: var(--text); }
.plan-card .btn { width: 100%; justify-content: center; }
.plan-note { margin-top: 16px; max-width: 70ch; }
.plan-wait { display: flex; align-items: center; gap: 14px; padding: 32px 0; }
@media (max-width: 600px) {
  .plan-now { padding: 16px; }
  .section-head:has(.seg) { flex-direction: column; align-items: flex-start; }
}

/* ---------- Conexiones por sitio, calendario, cola de agenda y guia ---------- */
.pill-wrap { white-space: normal; text-align: left; align-items: flex-start; line-height: 1.35; padding-top: 3px; padding-bottom: 3px; }
.pill-wrap::before { margin-top: 5px; flex: none; }
.canal-sec-head { flex-wrap: wrap; }
.canal-guia { font-size: 13px; white-space: nowrap; }
.canal-foot { border-top: 1px solid var(--border); padding-top: 12px; }
.add-site { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.add-site .field { flex: 1 1 260px; }
.manual-form { display: flex; flex-direction: column; gap: 12px; }
.pg-choose { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 12px; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.pg-choose legend { font-weight: 650; font-size: 13.5px; padding: 0 6px; }

/* Calendario */
.cal-panel { margin: 0; background: var(--surface-2); }
.cal-panel > summary { flex-wrap: wrap; }
.cal-body { display: flex; flex-direction: column; gap: 16px; }
.dchips { display: flex; flex-wrap: wrap; gap: 6px; }
.dchip { position: relative; display: inline-flex; cursor: pointer; }
.dchip input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.dchip span {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  border: 1px solid var(--border-strong); border-radius: 50%; background: var(--surface);
  font-weight: 650; font-size: 13.5px; color: var(--muted); user-select: none;
}
.dchip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.dchip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.horas-box { display: flex; flex-direction: column; gap: 8px; }
.hora-row { display: flex; align-items: center; gap: 8px; }
.hora-row .input { width: 140px; max-width: 100%; }
.mode-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.mode-card {
  display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 12px 38px; position: relative; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface);
}
.mode-card input { position: absolute; left: 13px; top: 15px; margin: 0; accent-color: var(--accent); width: 16px; height: 16px; }
.mode-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.mode-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.mode-title { font-weight: 650; font-size: 14px; }
.cal-out:empty { display: none; }
.prox h4 { font-size: 14px; margin-bottom: 6px; }
.prox-list { margin: 0 0 6px; padding-left: 20px; display: grid; gap: 2px; font-size: 14px; }

/* Aprobar y programar (tarjeta de post) */
.enc-lines { flex-basis: 100%; display: flex; flex-direction: column; gap: 4px; }
.enc-line { margin: 0; font-size: 13px; }
.enc-ok { color: var(--ok); }
.enc-warn { color: var(--warn); }
.enc-hint { color: var(--muted); }
.posts-head .btn { flex: none; }

/* Agenda: cola */
.aq-row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 6px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.aq-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.aq-main .ag-desc { flex: 1 1 200px; }
.aq-zona { font-size: 12px; color: var(--faint); }
.aq-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px 14px; flex-wrap: wrap; }
.aq-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.aq-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.aq-edit { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; border-top: 1px solid var(--border); max-width: 320px; }
.ag-chip { display: inline-flex; align-items: center; gap: 2px; font-size: 12.5px; font-weight: 650; color: var(--accent); background: var(--accent-soft); padding: 1px 4px 1px 10px; border-radius: 999px; }
.ag-x { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; padding: 0; }
.ag-x:hover:not(:disabled) { background: rgba(255, 255, 255, 0.14); }
.ag-x:disabled { opacity: 0.45; cursor: default; }
.ag-x .icon svg { width: 12px; height: 12px; }
.ag-badge { font-size: 12px; font-weight: 650; color: var(--warn); background: var(--warn-soft); border: 1px solid rgba(230, 169, 59, 0.4); padding: 1px 9px; border-radius: 999px; }
.ag-hist .ag-time { min-width: 0; }

/* Guia de conexion */
.guia { max-width: 70ch; }
.guia-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 24px; }
.guia-sec { margin-bottom: 28px; display: flex; flex-direction: column; gap: 12px; scroll-margin-top: 72px; }
.guia-sec:focus { outline: none; }
.guia-sec:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.guia-sec h2 { font-size: 20px; }
.guia-sec p, .guia-sec li { line-height: 1.6; }
.guia-steps, .guia-list { margin: 0; padding-left: 22px; display: grid; gap: 8px; }
.guia-alpha { list-style: lower-alpha; }
.guia-sec .alert { margin: 0; }
@media (max-width: 560px) {
  .aq-meta { align-items: flex-start; }
  .hora-row .input { flex: 1; width: auto; }
  .aq-edit { max-width: none; }
}

/* Barra superior en pantallas estrechas: con el enlace Guía ya no cabe en una fila */
@media (max-width: 700px) {
  .topbar-in { height: auto; min-height: 56px; flex-wrap: wrap; gap: 6px 12px; padding-top: 6px; padding-bottom: 6px; }
  .topbar-right { flex-wrap: wrap; gap: 6px 12px; justify-content: flex-end; min-width: 0; }
  .topnav { flex-wrap: wrap; gap: 4px 12px; }
}

/* ---------- Calendario ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.btn-icon { padding: 4px 12px; font-size: 18px; line-height: 1.1; }
.cal-h1 { display: flex; align-items: center; gap: 10px; }
.cal-h1 .icon svg { width: 26px; height: 26px; color: var(--accent); }
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin: 20px 0 14px; }
.cal-nav { display: flex; align-items: center; gap: 10px; }
.cal-title { font-size: 18px; font-weight: 650; min-width: 11ch; text-align: center; text-transform: capitalize; }
.cal-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cal-sel { width: auto; min-width: 150px; max-width: 100%; padding-top: 5px; padding-bottom: 5px; }
.cal-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.cal-layout.no-drafts { grid-template-columns: minmax(0, 1fr); }
.cal-main { min-width: 0; }
.cal-drafts { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 10px; max-height: 80vh; overflow: auto; position: sticky; top: 68px; }
.cal-drafts h3 { font-size: 15px; }
.cal-draft-list { display: flex; flex-direction: column; gap: 8px; }
.cal-draft { display: flex; gap: 10px; padding: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: grab; }
.cal-draft.dragging, .cal-card.dragging { opacity: 0.45; }
.cal-draft-img { width: 52px; height: 65px; object-fit: cover; border-radius: 4px; flex: none; background: var(--bg); border: 1px solid var(--border); }
.cal-draft-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; align-items: flex-start; }
.cal-draft-t { font-size: 13px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.cal-dowrow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-bottom: 6px; font-size: 12.5px; font-weight: 650; color: var(--muted); text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-day { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); min-height: 130px; padding: 6px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cal-semana .cal-day { min-height: 380px; }
.cal-day.dim { background: transparent; opacity: 0.55; }
.cal-day.drop { border-color: var(--accent); background: var(--accent-soft); opacity: 1; }
.cal-day-head { display: flex; align-items: baseline; gap: 6px; }
.cal-dow, .cal-mon { display: none; font-size: 12.5px; color: var(--muted); }
.cal-num { font-size: 13px; font-weight: 650; min-width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--muted); }
.cal-day.today .cal-num { background: var(--accent); color: var(--accent-ink); }
.cal-day.today { border-color: rgba(106, 167, 255, 0.55); }
.cal-items { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cal-card { background: var(--surface-2); border: 2px solid var(--border-strong); border-radius: var(--radius-sm); padding: 5px 6px; display: flex; flex-direction: column; gap: 5px; cursor: pointer; min-width: 0; }
.cal-card:hover { background: var(--surface-3); }
.cal-card[draggable="true"] { cursor: grab; }
.cal-card.auto { border-color: #e3b341; }
.cal-card.fail { background: var(--bad-soft); }
.cal-card-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.cal-thumb { width: 26px; height: 32px; object-fit: cover; border-radius: 3px; flex: none; background: var(--bg); }
.cal-card-t { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cal-card-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.cal-nbs { display: inline-flex; gap: 3px; }
.nb { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 4px; font-size: 11px; font-weight: 800; color: #fff; line-height: 1; }
.nb-facebook { background: #1877f2; font-family: Georgia, serif; }
.nb-instagram { background: linear-gradient(45deg, #f09433, #dc2743 55%, #bc1888); }
.nb-linkedin { background: #0a66c2; }
.nb-fail { outline: 2px solid var(--bad); outline-offset: 1px; }
.nb-done { box-shadow: 0 0 0 2px var(--ok-soft); }
.cal-card-time { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.cal-st { display: inline-flex; width: 14px; height: 14px; border-radius: 50%; align-items: center; justify-content: center; }
.cal-st .icon svg { width: 12px; height: 12px; }
.st-pend { color: var(--accent); }
.st-ok { background: var(--ok); color: #06180f; }
.st-ok .icon svg { width: 10px; height: 10px; }
.st-fail { background: var(--bad); }
.cal-slot { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 8px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; text-align: left; }
.cal-slot:hover { border-color: var(--accent); color: var(--text); }
.cal-slot.drop { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.cal-slot.auto-slot { border-color: rgba(227, 179, 65, 0.6); color: #e3b341; }
.cal-spark { margin-right: 2px; }
.cal-slot-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-legend { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 14px 0 0; font-size: 13px; color: var(--muted); }
.cal-key { display: inline-block; width: 22px; height: 14px; border-radius: 3px; background: var(--surface-2); margin-left: 8px; }
.cal-key:first-child { margin-left: 0; }
.key-auto { border: 2px solid #e3b341; }
.key-slot { border: 1px dashed var(--border-strong); }
.cal-empty { margin-top: 10px; max-width: 70ch; }
.cal-modal { width: min(560px, 100%); }
.cal-modal-grid { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; }
.cal-modal-grid > .modal-col:only-child { grid-column: 1 / -1; }
.cal-modal-t { font-size: 16px; }
.cal-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cal-edit { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); }
.cal-nets { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cal-net { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.5px; }
.cal-actions { flex-wrap: wrap; justify-content: flex-start; align-items: center; }
.cal-actions .btn { text-decoration: none; }
.cal-pick { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow: auto; }
.cal-pick-row { display: flex; align-items: center; gap: 10px; padding: 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.cal-pick-row img { width: 36px; height: 45px; object-fit: cover; border-radius: 3px; flex: none; }
.cal-pick-t { flex: 1; min-width: 0; font-size: 13.5px; }
.enc-link a { font-size: 13px; }

/* Movil: lista vertical por dias, sin rejilla de 7 columnas */
@media (max-width: 759px) {
  .cal-layout, .cal-layout.no-drafts { grid-template-columns: minmax(0, 1fr); }
  .cal-drafts { position: static; max-height: none; }
  .cal-dowrow { display: none; }
  .cal-grid { grid-template-columns: minmax(0, 1fr); }
  .cal-day, .cal-semana .cal-day { min-height: 0; }
  .cal-day:not(.has-items):not(.today) { display: none; }
  .cal-day.dim { opacity: 1; background: var(--surface); }
  .cal-dow, .cal-mon { display: inline; }
  .cal-day-head { gap: 8px; }
  .cal-toolbar { margin-top: 14px; }
  .cal-tools { width: 100%; }
  .cal-sel { flex: 1 1 140px; }
  .cal-modal-grid { grid-template-columns: minmax(0, 1fr); }
  .cal-modal-grid .modal-img { max-width: 160px; }
}

/* Calendario: tarjeta como en native.no, titular arriba e imagen a todo el ancho. */
.cal-card { width: 100%; text-align: left; }
.cal-card-top { flex-direction: column-reverse; align-items: stretch; gap: 5px; }
.cal-thumb { width: 100%; height: auto; aspect-ratio: 16 / 10; border-radius: 4px; }
.cal-semana .cal-thumb { aspect-ratio: 4 / 5; }
.cal-slot { width: 100%; }
@media (max-width: 760px) {
  .cal-card-top { flex-direction: row; align-items: center; gap: 10px; }
  .cal-thumb, .cal-semana .cal-thumb { width: 64px; height: 80px; aspect-ratio: auto; flex: none; }
  .cal-card-t { white-space: normal; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; }
}

/* ---------- Reel de 8 s (Facebook) ---------- */
.post-reel {
  display: flex; flex-direction: column; gap: 10px;
  margin: 0 14px 14px; padding: 12px; min-width: 0;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.post-reel[hidden] { display: none; }
.reel-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.reel-head .hint { font-size: 12.5px; }
.reel-create { display: flex; align-items: flex-end; gap: 10px 14px; flex-wrap: wrap; }
.reel-q { display: flex; flex-direction: column; gap: 3px; }
.reel-q .input { padding: 5px 8px; font-size: 13px; }
.reel-hint { flex-basis: 100%; margin: 0; font-size: 12.5px; }
.reel-hint[hidden] { display: none; }
.reel-gen { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 13.5px; color: var(--accent); }
.reel-gen .spinner { border-color: rgba(106, 167, 255, 0.3); border-top-color: var(--accent); flex: none; }
.reel-player { display: flex; justify-content: center; }
.reel-video {
  display: block; width: auto; max-width: 100%; height: 420px; aspect-ratio: 9 / 16; object-fit: contain;
  background: #000; border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.reel-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.reel-actions .pub-done { margin-left: 0; }
.btn-primary .spinner { border-color: rgba(6, 16, 31, 0.3); border-top-color: var(--accent-ink); }
.btn-primary .icon svg { width: 14px; height: 14px; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--muted); }
.btn-quiet:hover:not(:disabled) { background: var(--surface-3); border-color: var(--border); color: var(--text); }
.post-reel .sched-line, .post-reel .enc-line { margin: 0; }
.modal-img.modal-video { aspect-ratio: 9 / 16; background: #000; }
.modal-img.modal-video video { display: block; width: 100%; height: 100%; object-fit: contain; }
.cal-modal-grid .modal-img.modal-video, .modal-grid .modal-img.modal-video { max-height: 70vh; }
@media (max-width: 560px) {
  .post-reel { margin: 0 10px 12px; padding: 10px; }
  .reel-video { height: 320px; }
  .reel-create .btn, .reel-actions .btn { flex: 1 1 auto; }
  .reel-q { flex: 1 1 120px; }
  .modal-img.modal-video { max-width: 140px; }
}

/* Insignia del calendario: reel de Facebook ("f" + triangulo, solo texto) */
.nb-facebook_reel { background: #1877f2; font-family: Georgia, serif; gap: 2px; white-space: nowrap; }
