/* Social Bridge · panel. Sin frameworks: variables, rejilla y poco más. */

:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --text: #182033;
  --muted: #5f6b80;
  --faint: #8a94a6;
  --border: #e3e7ef;
  --border-strong: #cfd6e2;
  --accent: #3d5afe;
  --accent-hover: #2f4ae0;
  --accent-text: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 11%, var(--surface));
  --ok: #138a4c;
  --ok-soft: #e3f5eb;
  --warn: #a35f00;
  --warn-soft: #fdf1dc;
  --bad: #c62828;
  --bad-soft: #fdeaea;
  --info-soft: #e8f1fd;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgb(16 24 40 / 0.05), 0 1px 3px rgb(16 24 40 / 0.06);
  --shadow-lg: 0 12px 32px rgb(16 24 40 / 0.14);
  --sidebar: 248px;
}

/* Tema: claro por defecto; oscuro si se elige, o si se elige «Sistema» y el equipo está en oscuro. */
:root { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
    --bg: #0f131a;
    --surface: #171c25;
    --surface-2: #1c222d;
    --text: #e7eaf0;
    --muted: #9ba5b7;
    --faint: #6f7a8d;
    --border: #262e3b;
    --border-strong: #343e4f;
    --accent: #7088ff;
    --accent-hover: #8799ff;
    --accent-text: #0c1020;
    --accent-soft: color-mix(in srgb, var(--accent) 18%, var(--surface));
    --ok: #4cc584;
    --ok-soft: #142a1f;
    --warn: #e6a94f;
    --warn-soft: #2c2213;
    --bad: #f17c74;
    --bad-soft: #321a1a;
    --info-soft: #18243a;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 12px 32px rgb(0 0 0 / 0.45);
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    color-scheme: dark;
    --bg: #0f131a;
    --surface: #171c25;
    --surface-2: #1c222d;
    --text: #e7eaf0;
    --muted: #9ba5b7;
    --faint: #6f7a8d;
    --border: #262e3b;
    --border-strong: #343e4f;
    --accent: #7088ff;
    --accent-hover: #8799ff;
    --accent-text: #0c1020;
    --accent-soft: color-mix(in srgb, var(--accent) 18%, var(--surface));
    --ok: #4cc584;
    --ok-soft: #142a1f;
    --warn: #e6a94f;
    --warn-soft: #2c2213;
    --bad: #f17c74;
    --bad-soft: #321a1a;
    --info-soft: #18243a;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 12px 32px rgb(0 0 0 / 0.45);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; line-height: 1.25; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; margin: 0; }
h3 { font-size: 0.95rem; margin: 0; }
p { margin: 0; }
code, pre.code, textarea.code { font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
code { background: var(--surface-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 6px; word-break: break-all; }
pre.code { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; overflow-x: auto; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.86rem; }
.error { color: var(--bad); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Iconos del sprite */
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }

/* ---------- Estructura: menú lateral + contenido ---------- */
.with-shell { padding-left: var(--sidebar); }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 14px; padding: 18px 14px; overflow-y: auto; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 750; font-size: 1.02rem; }
.brand:hover { text-decoration: none; }
.brand span { display: grid; line-height: 1.2; }
.brand small { font-weight: 500; color: var(--faint); font-size: 0.72rem; }
.sidebar > .brand { padding: 2px 6px 6px; }
.org-switch { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--muted); }
.org-switch select { border: 0; background: transparent; padding: 0; font-weight: 600; color: var(--text); width: 100%; }
.org-switch select:focus { outline: none; }
.org-switch.static span { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: grid; gap: 2px; }
.nav-title { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); padding: 8px 10px 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--muted); font-weight: 550; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--accent-soft); color: var(--accent); }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: 6px; border-top: 1px solid var(--border); padding-top: 12px; }
.me { flex: 1; display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--radius-sm); color: var(--text); min-width: 0; }
.me:hover, .me.on { background: var(--surface-2); text-decoration: none; }
.me-text { display: grid; line-height: 1.25; min-width: 0; }
.me-text strong { font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text small { color: var(--faint); font-size: 0.75rem; }
.avatar { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 0.82rem; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.accent { background: var(--accent); color: var(--accent-text); }
.mobilebar, .nav-toggle, .nav-scrim { display: none; }

.page { max-width: 1160px; margin: 0 auto; padding: 32px 36px 64px; }
.page-narrow { max-width: 440px; padding-top: 10vh; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head .lead { color: var(--muted); margin-top: 4px; max-width: 70ch; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 0.88rem; margin-bottom: 6px; }
.actions, .row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.block { margin: 32px 0; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.block-head h2 { display: flex; align-items: center; gap: 8px; }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 0.75rem; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head .i { color: var(--accent); }
.stack { display: grid; gap: 16px; align-content: start; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.grid-2.wide-left { grid-template-columns: 1.7fr 1fr; }

/* Avisos */
.flash { display: flex; align-items: center; gap: 10px; background: var(--info-soft); border: 1px solid var(--border); padding: 10px 10px 10px 14px; border-radius: var(--radius-sm); margin-bottom: 20px; }
.flash > .i { color: var(--accent); }
.flash span { flex: 1; }
.flash .icon-btn { width: 30px; height: 30px; }
.notice { display: flex; gap: 12px; background: var(--warn-soft); border: 1px solid transparent; padding: 14px 16px; border-radius: var(--radius-sm); margin-bottom: 20px; }
.notice > .i { color: var(--warn); margin-top: 2px; }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
.notice.error { background: var(--bad-soft); }
.notice.error > .i { color: var(--bad); }
.notice.ok { background: var(--ok-soft); }
.notice.ok > .i { color: var(--ok); }
.hint { display: flex; gap: 8px; color: var(--muted); font-size: 0.86rem; }
.hint .i { color: var(--faint); margin-top: 2px; }

/* ---------- Formularios ---------- */
label { display: grid; gap: 6px; font-weight: 600; font-size: 0.9rem; }
label small, legend small { font-weight: 400; color: var(--muted); }
label > small:first-of-type { margin-top: -4px; font-size: 0.8rem; }
label.inline { display: flex; align-items: center; gap: 10px; font-weight: 500; }
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=color]), select, textarea {
  width: 100%; padding: 10px 12px; font: inherit; font-weight: 400; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=checkbox], input[type=radio] { width: 17px; height: 17px; accent-color: var(--accent); margin: 0; }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 12px; }
legend { font-weight: 600; padding: 0; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 160px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-text); font: inherit; font-weight: 650; cursor: pointer; white-space: nowrap; transition: background .15s, transform .05s; }
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--surface); color: var(--bad); border-color: var(--border-strong); }
.btn-danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn-small { padding: 5px 11px; font-size: 0.84rem; gap: 6px; }
.btn-small .i { width: 15px; height: 15px; }
.btn-block { width: 100%; }
.btn-lg { padding: 12px 22px; font-size: 1rem; }
.linklike { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.linklike:hover { text-decoration: underline; }
.linklike.danger, .danger { color: var(--bad); }

/* ---------- Estados y redes ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 0.78rem; font-weight: 650; padding: 3px 9px 3px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.pill .i { width: 14px; height: 14px; }
.st-published, .st-scheduled { --st: var(--ok); --st-soft: var(--ok-soft); }
.st-queued, .st-ready, .st-running { --st: var(--accent); --st-soft: var(--accent-soft); }
.st-awaiting_review, .st-pending_approval { --st: var(--warn); --st-soft: var(--warn-soft); }
.st-failed { --st: var(--bad); --st-soft: var(--bad-soft); }
.st-draft, .st-cancelled { --st: var(--faint); --st-soft: var(--surface-2); }
.pill[class*=st-] { background: var(--st-soft); color: var(--st); border-color: transparent; }
.st-running .i { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.net { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; color: #fff; flex: none; }
.net svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.net-linkedin { background: #0a66c2; }
.net-x { background: #111; }
.net-facebook { background: #1877f2; }
.net-instagram { background: radial-gradient(circle at 30% 110%, #fdc468 0%, #f77737 25%, #e1306c 55%, #833ab4 90%); }
.net-tiktok { background: #111; box-shadow: inset -2px -2px 0 #ff0050, inset 2px 2px 0 #00f2ea; }
.net-youtube { background: #ff0000; }
.net.lg { width: 38px; height: 38px; border-radius: 11px; }
.net.lg svg { width: 20px; height: 20px; }
:root[data-theme="dark"] :is(.net-x, .net-tiktok) { background: #000; outline: 1px solid #333; }
@media (prefers-color-scheme: dark) { :root[data-theme="system"] :is(.net-x, .net-tiktok) { background: #000; outline: 1px solid #333; } }
.netstat { position: relative; display: inline-flex; }
.netstat .dot { position: absolute; right: -3px; bottom: -3px; width: 11px; height: 11px; border-radius: 50%; background: var(--st, var(--faint)); border: 2px solid var(--surface); }
.netstat.st-draft .dot { display: none; }

/* ---------- Inicio ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 8px; }
.stat { display: flex; align-items: center; gap: 14px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); }
.stat:hover { border-color: var(--border-strong); text-decoration: none; }
.stat-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--st-soft, var(--surface-2)); color: var(--st, var(--muted)); }
.stat-icon .i { width: 21px; height: 21px; }
.stat strong { font-size: 1.5rem; line-height: 1; display: block; }
.stat small { color: var(--muted); font-size: 0.82rem; }
.stat.zero { opacity: 0.65; box-shadow: none; }

.postlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.postrow { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto 18px; gap: 18px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; color: var(--text); box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.postrow:hover { border-color: var(--accent); text-decoration: none; }
.postrow > .i { color: var(--faint); }
.postrow-when { display: grid; line-height: 1.25; border-right: 1px solid var(--border); padding-right: 14px; }
.postrow-when strong { font-size: 0.86rem; text-transform: capitalize; }
.postrow-when small { color: var(--muted); font-size: 0.82rem; }
.postrow-main { display: grid; gap: 6px; min-width: 0; }
.postrow-title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.postrow-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.postrow-nets { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.empty { display: flex; align-items: center; gap: 14px; padding: 22px; border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--text); background: var(--surface); }
.empty > .i { width: 30px; height: 30px; color: var(--faint); }
.how { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; counter-reset: how; }
.how li { list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: grid; gap: 6px; box-shadow: var(--shadow); }
.how li .i { width: 22px; height: 22px; color: var(--accent); }
.how { padding: 0; margin: 0; }

/* ---------- Publicación: editor ---------- */
.composer { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.composer-col { display: grid; gap: 22px; }
.section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.step { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 0.8rem; font-weight: 750; flex: none; }
.section-title small { display: block; font-weight: 400; color: var(--muted); font-size: 0.82rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.textarea-wrap { position: relative; }
.composer-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding: 16px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.composer-actions .hint { margin-right: auto; }

.dropzone { position: relative; display: grid; place-items: center; text-align: center; gap: 6px; padding: 22px; border: 2px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; font-weight: 500; }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.dropzone > .i { width: 28px; height: 28px; }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone strong { color: var(--text); }
.dropzone.small { padding: 14px; }
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.previews:empty { display: none; }
.previews figure { margin: 0; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: #000; aspect-ratio: 9 / 12; position: relative; }
.previews img, .previews video { width: 100%; height: 100%; object-fit: cover; display: block; }
.previews figcaption { position: absolute; inset: auto 0 0; padding: 4px 6px; font-size: 0.7rem; color: #fff; background: linear-gradient(transparent, rgb(0 0 0 / .7)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.media-item { margin: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface-2); position: relative; }
.media-item img, .media-item video { width: 100%; height: 170px; object-fit: cover; display: block; background: #000; }
.media-item figcaption { padding: 8px 10px; font-size: 0.78rem; display: grid; gap: 6px; word-break: break-all; }
.media-item .tag { position: absolute; top: 8px; left: 8px; display: inline-flex; gap: 4px; align-items: center; padding: 2px 8px; border-radius: 999px; background: rgb(0 0 0 / .65); color: #fff; font-size: 0.72rem; font-weight: 650; }
.media-item .tag .i { width: 13px; height: 13px; }
.media-item label.inline { font-size: 0.78rem; color: var(--bad); }

.when-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-btn { padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 0.82rem; cursor: pointer; }
.chip-btn:hover { border-color: var(--accent); color: var(--accent); }

.targets-pick { display: grid; gap: 10px; }
.target { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--surface); transition: border-color .15s, background .15s; }
.target:has(input[name=accounts]:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); }
.target-head { display: flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 500; }
.target-head input { flex: none; }
.target-name { display: grid; line-height: 1.25; min-width: 0; flex: 1; }
.target-name strong { font-size: 0.92rem; }
.target-name small { color: var(--muted); font-size: 0.78rem; }
.target-body { display: grid; gap: 8px; margin: 10px 0 0 29px; }
.target:not(:has(input[name=accounts]:checked)) .target-body { display: none; }
.target summary { cursor: pointer; font-size: 0.84rem; color: var(--accent); font-weight: 550; display: inline-flex; gap: 6px; align-items: center; }
.target summary .i { width: 15px; height: 15px; }
.target details textarea { margin-top: 8px; }
.target-opts { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }
.target-opts label.inline { font-size: 0.84rem; font-weight: 500; }
.counter { font-size: 0.78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.counter.over { color: var(--bad); font-weight: 700; }
.how-note { font-size: 0.78rem; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.how-note .i { width: 14px; height: 14px; }

/* ---------- Publicación: vista ---------- */
.post-body { white-space: pre-wrap; font: inherit; margin: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; }
.meta-list { display: grid; gap: 10px; margin: 0; }
.meta-list div { display: flex; gap: 10px; align-items: center; }
.meta-list .i { color: var(--faint); }
.targets { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.target-status { border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: grid; gap: 10px; background: var(--surface); }
.target-line { display: flex; align-items: center; gap: 12px; }
.target-line .target-name { flex: 1; }
.target-error { display: flex; gap: 8px; color: var(--bad); font-size: 0.86rem; background: var(--bad-soft); padding: 8px 10px; border-radius: 8px; }
.target-error .i { margin-top: 2px; }
.target-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.target-actions .inline-form input { padding: 5px 9px; font-size: 0.84rem; }
.target-status details summary { cursor: pointer; font-size: 0.84rem; color: var(--muted); }
.steps { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 3px; font-size: 0.84rem; }
.steps li { display: flex; gap: 6px; align-items: flex-start; }
.steps .i { width: 15px; height: 15px; margin-top: 2px; }
.step-ok .i { color: var(--ok); }
.step-failed { color: var(--bad); }
.step-skipped { color: var(--faint); }
.runs { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.run { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.run-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- Tablas y listas de gestión ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th { text-align: left; color: var(--faint); font-weight: 650; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; }
.table th, .table td { padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.inactive td { opacity: 0.55; }
.table select { width: auto; padding: 6px 10px; }
.list { list-style: none; margin: 0; padding: 0; display: grid; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.list-item .grow small { color: var(--muted); font-size: 0.82rem; }
.list-item.inactive { opacity: 0.55; }
.tag-soft { display: inline-flex; align-items: center; gap: 4px; font-size: 0.72rem; font-weight: 650; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.roles-help { display: grid; gap: 10px; margin: 18px 0 0; }
.roles-help div { display: flex; gap: 10px; }
.roles-help .i { color: var(--accent); margin-top: 2px; }
.roles-help dt { font-weight: 650; }
.roles-help dd { margin: 0; color: var(--muted); font-size: 0.86rem; }
.plain { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 18px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; width: fit-content; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border-radius: 9px; color: var(--muted); font-weight: 600; }
.tabs a:hover { text-decoration: none; background: var(--surface-2); }
.tabs a.active { background: var(--accent-soft); color: var(--accent); }
.tabs .net { width: 22px; height: 22px; border-radius: 6px; }
.tabs .net svg { width: 13px; height: 13px; }
.setup-steps { margin: 0; padding: 0; list-style: none; display: grid; gap: 14px; counter-reset: s; }
.setup-steps li { display: grid; grid-template-columns: 30px 1fr; gap: 12px; counter-increment: s; }
.setup-steps li::before { content: counter(s); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 750; font-size: 0.85rem; }
.copy-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.copy-row code { padding: 6px 10px; font-size: 0.86rem; }

/* ---------- Calendario ---------- */
.month-nav { display: flex; align-items: center; gap: 6px; }
.month-nav strong { min-width: 160px; text-align: center; text-transform: capitalize; font-size: 1.05rem; }
.calendar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.cal-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head div { padding: 10px; font-size: 0.72rem; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em; border-bottom: 1px solid var(--border); }
.cal-day { position: relative; min-height: 124px; padding: 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: grid; align-content: start; gap: 5px; }
.cal-day:nth-child(7) { border-right: 0; }
.cal-day.out { background: var(--surface-2); }
.cal-day.out .cal-num { color: var(--faint); }
.cal-num { font-size: 0.8rem; font-weight: 700; justify-self: start; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.cal-day.today .cal-num { background: var(--accent); color: var(--accent-text); }
.cal-add { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: var(--accent); opacity: 0; transition: opacity .15s; }
.cal-add .i { width: 16px; height: 16px; }
.cal-day:hover .cal-add { opacity: 1; background: var(--accent-soft); }
.cal-post { display: grid; gap: 3px; font-size: 0.76rem; padding: 5px 7px; border-radius: 8px; color: var(--text); background: var(--st-soft, var(--surface-2)); border-left: 3px solid var(--st, var(--border-strong)); }
.cal-post:hover { text-decoration: none; filter: brightness(0.97); }
.cal-post-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-time { font-weight: 750; margin-right: 4px; }
.cal-nets { display: flex; gap: 3px; }
.cal-nets .net { width: 16px; height: 16px; border-radius: 4px; }
.cal-nets .net svg { width: 10px; height: 10px; stroke-width: 2.6; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; color: var(--muted); font-size: 0.82rem; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--st); }

/* ---------- Acceso ---------- */
.bare .page { padding-top: 8vh; }
.auth { padding: 30px; }
.auth-brand { display: grid; justify-items: center; gap: 10px; text-align: center; margin-bottom: 22px; }
.auth-brand h1 { font-size: 1.4rem; }
.auth .btn { width: 100%; padding: 11px; }

/* ---------- Móvil ---------- */
@media (max-width: 960px) {
  .with-shell { padding-left: 0; }
  .mobilebar { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: 0; z-index: 20; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--border); }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .nav-toggle:checked ~ .sidebar { transform: none; }
  .nav-toggle:checked ~ .nav-scrim { display: block; position: fixed; inset: 0; background: rgb(0 0 0 / .35); z-index: 25; }
  .page { padding: 20px 16px 48px; }
  .grid-2, .grid-2.wide-left, .composer, .field-row { grid-template-columns: 1fr; }
  .postrow { grid-template-columns: minmax(0, 1fr) 18px; gap: 10px; }
  .postrow-when { border: 0; padding: 0; display: flex; gap: 6px; grid-column: 1 / -1; }
  .postrow-nets { justify-content: flex-start; grid-column: 1; }
  .postrow > .i { grid-row: 2; grid-column: 2; }
  .cal-day { min-height: 76px; padding: 4px; }
  .cal-post-title, .cal-time { display: none; }
  .cal-add { display: none; }
  .composer-actions { flex-wrap: wrap; }
  .composer-actions .hint { flex-basis: 100%; }
}

.target-actions:empty { display: none; }
.manual summary { display: inline-flex; align-items: center; gap: 6px; font-size: 0.84rem; color: var(--muted); cursor: pointer; }
.manual summary .i { width: 15px; height: 15px; }
.manual[open] summary { margin-bottom: 8px; }

[hidden] { display: none !important; }

/* Imagen de marca de la organización */
.orgmark { width: 26px; height: 26px; border-radius: 7px; flex: none; object-fit: cover; display: inline-grid; place-items: center;
  background: var(--org, var(--accent)); color: #fff; font-size: 0.68rem; font-weight: 750; letter-spacing: 0.02em; }
.brand-logo { padding: 4px 6px 10px; }
.brand-logo img { max-width: 100%; max-height: 44px; object-fit: contain; display: block; }
.mobilebar .brand { font-size: 0.95rem; }
.brand-preview { display: grid; gap: 12px; padding: 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.brand-preview .mock { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.brand-preview .btn, .brand-preview .nav-mock { background: var(--pv, var(--accent)); color: var(--pv-text, var(--accent-text)); border-color: var(--pv, var(--accent)); }
.brand-preview .nav-mock { padding: 7px 12px; border-radius: 9px; font-weight: 600; background: color-mix(in srgb, var(--pv, var(--accent)) 12%, var(--surface)); color: var(--pv, var(--accent)); display: inline-flex; gap: 8px; align-items: center; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.swatch { width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); cursor: pointer; padding: 0; }
.swatch:hover { transform: scale(1.08); }
.color-row { display: flex; gap: 10px; align-items: center; }
.color-row input[type=color] { width: 46px; height: 40px; padding: 2px; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface); cursor: pointer; }
.color-row input[type=text] { width: 120px !important; font-family: ui-monospace, monospace; }
.brand-file { display: flex; gap: 14px; align-items: center; }
.brand-file .thumb { width: 64px; height: 64px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); display: grid; place-items: center; overflow: hidden; flex: none; }
.brand-file .thumb.wide { width: 140px; }
.brand-file .thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.brand-file .thumb .i { color: var(--faint); }
.brand-file .grow { display: grid; gap: 6px; flex: 1; min-width: 0; }

input[type=file] { font: inherit; font-size: 0.85rem; color: var(--muted); max-width: 100%; }
input[type=file]::file-selector-button { font: inherit; font-weight: 600; margin-right: 10px; padding: 6px 12px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; }
input[type=file]::file-selector-button:hover { background: var(--surface-2); }
.color-row { flex-wrap: wrap; }

/* Selector de tema */
.theme-switch { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.theme-switch button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 5px 6px; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted); font: inherit; font-size: 0.78rem; font-weight: 600; cursor: pointer; }
.theme-switch button .i { width: 15px; height: 15px; }
.theme-switch button:hover { color: var(--text); }
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.bare .theme-switch { width: 260px; margin: 18px auto 0; }

/* Título del Short */
.title-field { display: grid; gap: 6px; }
.title-field > label { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.yt-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 0.72rem; font-weight: 650; color: var(--muted); }
.yt-chip .net { width: 18px; height: 18px; border-radius: 5px; }
.yt-chip .net svg { width: 11px; height: 11px; }
.req-chip { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 8px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); }
.title-row { position: relative; }
.title-row input { padding-right: 70px !important; }
.title-row .counter { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); }
.title-field .linklike { justify-self: start; }
.title-field .linklike .i { width: 15px; height: 15px; }
.title-field.needs input { border-color: var(--warn); }

.yt-preview { display: grid; gap: 4px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: 0.86rem; }
.yt-preview p { margin: 0; white-space: pre-wrap; word-break: break-word; }
.yt-preview [data-yt-desc]:empty::after, .yt-preview [data-yt-title]:empty::after { content: '—'; color: var(--faint); }
