:root {
  --ink: #1c1b1f; --muted: #6b6870; --line: #e6e2dc; --bg: #f6f4f0; --card: #fff;
  --accent: #9b1c31; --accent-2: #c23a4f; --ok: #2e7d4f; --warn: #b26a00; --err: #b3261e;
  --r: 16px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  --ink-2: #444; --line-strong: #cfc9c0; --input: #fff; --soft: #ebe7e1; --hover: #faf9f7; --today: #fff8f8; --sel: #f7eef0;
  --tag: #00376b; --ok-bg: #e8f3ec; --ok-line: #cfe6d7; --err-bg: #fbeaea; --err-line: #f1cccc;
  --c-draft-bg: #eeeae4; --c-draft: #5f5a52; --c-appr-bg: #e6effa; --c-appr: #285ea8; --c-sched-bg: #fff1db; --c-sched: #8a5300;
  --c-sent-bg: #efe6fa; --c-sent: #6a3fa0; --c-pub-bg: #e3f3e8; --c-pub: #23683f;
  color-scheme: light;
  --font-body: "Inter Variable", Inter, system-ui, sans-serif;
  --font-mono: "JetBrains Mono Variable", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-family: var(--font-body);
  font-feature-settings: "cv11", "ss01";
}
body, p, input, select, textarea, button { font-family: var(--font-body); font-weight: 400; }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-body); font-weight: 700; }
/* Cifras, fechas, horas y contadores en JetBrains Mono */
.num, .counter, .daynum span, .cal .chip b, .events li > .small, td.nowrap, .stat b, .pv-media .count,
.img-meta .small, .steps li::before, input[type=datetime-local] {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: .2rem 0 1rem; letter-spacing: -.01em; }
h3 { font-size: 1rem; margin: 0 0 .6rem; }
h3 > i.fa-solid { color: var(--accent); margin-right: .2rem; }
.muted { color: var(--muted); } .small { font-size: .82rem; } .nowrap { white-space: nowrap; }
.mono { font-family: var(--font-mono); font-size: .85rem; }

/* Cabecera */
.top { display: flex; align-items: center; gap: 1rem; padding: .6rem 1.2rem; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; flex-wrap: wrap; }
.logo { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none !important; }
.logo img { width: 40px; height: 40px; border-radius: 10px; display: block; }
.logo span { font-weight: 600; color: var(--muted); font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; }
.logo.big { flex-direction: column; margin: 0 auto 1.2rem; display: flex; }
.logo.big img { width: 96px; height: 96px; border-radius: 22px; }
.top nav { display: flex; gap: .2rem; flex-wrap: wrap; }
.top nav a { color: var(--ink); padding: .45rem .9rem; border-radius: 999px; }
.top nav a i { color: var(--accent); margin-right: .15rem; }
.top nav a:hover { background: var(--bg); text-decoration: none; }
.brandpick { margin-left: auto; display: inline-flex; align-items: center; gap: .55rem; background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: .25rem .8rem .25rem .25rem; cursor: pointer; font: inherit; color: var(--ink); max-width: 260px; }
.brandpick:hover { border-color: var(--line-strong); }
.brandpick .bp-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; font-size: .9rem; }
.brandpick .fa-chevron-down { color: var(--muted); font-size: .75rem; }
.av { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; display: inline-grid; place-items: center; flex: none; background: var(--soft); }
.av.all { background: var(--ink); color: var(--bg); font-size: .85rem; }
.av.sm { width: 26px; height: 26px; } .av.lg { width: 48px; height: 48px; } .av.xl { width: 96px; height: 96px; }
.brand-modal { border: 0; border-radius: 22px; padding: 0; width: min(440px, 92vw); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.brand-modal::backdrop { background: rgba(28,27,31,.45); backdrop-filter: blur(3px); }
.brand-modal header, .brand-modal footer { display: flex; justify-content: space-between; align-items: center; padding: .9rem 1.1rem; }
.brand-modal header h3 { margin: 0; }
.brand-modal footer { border-top: 1px solid var(--line); gap: .5rem; justify-content: flex-start; }
.brand-modal ul { list-style: none; margin: 0; padding: .3rem .6rem; max-height: 60vh; overflow: auto; }
.brand-modal li a { display: flex; align-items: center; gap: .8rem; padding: .55rem .6rem; border-radius: 14px; color: var(--ink); }
.brand-modal li a:hover { background: var(--bg); text-decoration: none; }
.brand-modal li a.on { background: var(--sel); }
.brand-modal li a > span:not(.av) { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.brand-modal li a .fa-check { color: var(--accent); }
.avatar-edit { display: flex; gap: 1.2rem; align-items: center; }
.bc-head { display: flex; align-items: center; gap: .7rem; margin-bottom: .4rem; } .bc-head h3 { margin: 0; }
.logout { color: var(--muted); font-size: 1.05rem; width: 2.2rem; height: 2.2rem; display: inline-grid; place-items: center; border-radius: 50%; }
.logout:hover { background: var(--bg); color: var(--accent); text-decoration: none; }
.status-bar { font-size: .78rem; color: var(--muted); padding: .35rem 1.2rem; display: flex; gap: .35rem; align-items: center; }
.status-bar i { margin-left: .8rem; } .status-bar i:first-child { margin-left: 0; }
.status-bar i.on { color: var(--ok); } .status-bar i.off { color: var(--warn); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-left: .8rem; }
.dot:first-child { margin-left: 0; } .dot.on { background: var(--ok); } .dot.off { background: var(--warn); }
main { padding: 1rem 1.2rem 4rem; max-width: 1400px; margin: 0 auto; }

/* Elementos */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: .5rem 1.05rem; border-radius: 999px; white-space: nowrap; cursor: pointer; font: inherit; font-size: .9rem; }
.btn:hover { border-color: var(--line-strong); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { background: transparent; }
.btn.danger, .link.danger { color: var(--err); }
.btn.small { padding: .3rem .8rem; font-size: .8rem; }
.btn.icon { width: 2.4rem; height: 2.4rem; padding: 0; }
.btn i, .link i { font-size: .92em; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .6; cursor: wait; }
.link { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; font-size: .82rem; }
input, select, textarea { width: 100%; font: inherit; padding: .55rem .8rem; border: 1px solid var(--line); border-radius: 12px; background: var(--input); color: var(--ink); }
textarea { resize: vertical; }
input[type=checkbox] { width: auto; }
input[type=color] { padding: 2px; height: 2.4rem; }
label { display: block; font-size: .85rem; color: var(--muted); }
label > input, label > select, label > textarea { margin-top: .25rem; color: var(--ink); }
label.check { display: flex; align-items: center; gap: .4rem; color: var(--ink); font-size: .9rem; margin: .2rem 0; }
fieldset { border: 1px solid var(--line); border-radius: 14px; padding: .6rem .8rem; margin: 0; }
legend { font-size: .8rem; color: var(--muted); padding: 0 .3rem; }
.stack > * + * { margin-top: .7rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem 1.2rem; }
.span2 { grid-column: 1 / -1; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; }
.inline { display: flex; gap: .5rem; margin-top: .8rem; }
.flash { padding: .7rem 1.1rem; border-radius: 14px; margin-bottom: .8rem; background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-line); }
.flash.error { background: var(--err-bg); color: var(--err); border-color: var(--err-line); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.nets { display: flex; flex-wrap: wrap; gap: .2rem 1rem; }
.nets legend { width: 100%; }
.net-check { min-width: 150px; }

/* Chips de estado y redes */
.chip { display: inline-block; font-size: .75rem; padding: .15rem .55rem; border-radius: 99px; background: var(--soft); color: var(--ink-2); }
.st-borrador { background: var(--c-draft-bg); color: var(--c-draft); }
.st-aprobado { background: var(--c-appr-bg); color: var(--c-appr); }
.st-programado { background: var(--c-sched-bg); color: var(--c-sched); }
.st-enviado { background: var(--c-sent-bg); color: var(--c-sent); }
.st-publicado { background: var(--c-pub-bg); color: var(--c-pub); }
.vs-pendiente { background: var(--c-sched-bg); color: var(--c-sched); } .vs-publicado { background: var(--c-pub-bg); color: var(--c-pub); } .vs-omitido { background: var(--soft); color: var(--muted); }
.net { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; font-style: normal; font-size: .78rem; color: #fff; margin-right: 2px; vertical-align: middle; }
.n-instagram { background: linear-gradient(45deg,#f09433,#dc2743,#bc1888); } .n-facebook { background: #1877f2; }
.n-linkedin { background: #0a66c2; } .n-x { background: #111; } .n-mailchimp { background: #ffe01b; color: #222; }
.n-behance { background: #1769ff; } .n-youtube { background: #ff0000; }

/* Calendario */
.cal-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.cal-head h1 { margin: 0 .4rem; min-width: 12rem; text-align: center; }
.cal-wrap { display: grid; grid-template-columns: 1fr 260px; gap: 1rem; align-items: start; }
.cal { width: 100%; border-collapse: collapse; table-layout: fixed; background: var(--card); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.cal th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: .5rem; border-bottom: 1px solid var(--line); }
.cal td { vertical-align: top; height: 118px; border: 1px solid var(--line); padding: .3rem; }
.cal td.other { background: var(--hover); } .cal td.other .daynum { opacity: .45; }
.cal td.today { background: var(--today); box-shadow: inset 0 0 0 2px var(--accent); }
.daynum { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); }
.daynum .add { opacity: 0; font-size: .7rem; width: 1.3rem; height: 1.3rem; display: inline-grid; place-items: center; border-radius: 50%; background: var(--accent); color: #fff; }
.daynum .add:hover { text-decoration: none; } .cal td:hover .add { opacity: 1; }
.chip { max-width: 100%; }
.cal .chip, .side .chip { display: block; border-radius: 10px; border-left: 4px solid var(--accent); margin-top: .25rem; padding: .25rem .4rem; font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.cal .chip small, .side .chip small { display: block; } .cal .chip .net { width: 1.15rem; height: 1.15rem; font-size: .58rem; }
.legend { list-style: none; padding: 0; margin: 0; } .legend .chip { border-left: 0; }

/* Lista */
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: .8rem; }
.tabs a { padding: .35rem .8rem; border-radius: 99px; background: var(--card); border: 1px solid var(--line); color: var(--ink); font-size: .85rem; }
.tabs a.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
table.list { width: 100%; border-collapse: collapse; }
.list th { text-align: left; font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: .5rem; border-bottom: 1px solid var(--line); }
.list td { padding: .6rem .5rem; border-bottom: 1px solid var(--line); }
.list tbody tr { cursor: pointer; } .list tbody tr:hover { background: var(--hover); }

/* Detalle */
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: .6rem; }
.detail-head h1 { margin: .1rem 0 .3rem; }
.steps { display: flex; list-style: none; padding: 0; margin: 0 0 1rem; gap: .3rem; flex-wrap: wrap; counter-reset: s; }
.steps li { flex: 1; min-width: 110px; font-size: .78rem; padding: .45rem .9rem; background: var(--soft); color: var(--muted); border-radius: 999px; counter-increment: s; }
.steps li::before { content: counter(s) ". "; }
.steps li.done { background: var(--accent); color: #fff; }
.detail-grid { display: grid; grid-template-columns: 340px 1fr; gap: 1rem; align-items: start; }
details > summary { cursor: pointer; list-style: none; } details > summary h3 { display: inline; }
details > summary::after { content: " ▸"; color: var(--muted); } details[open] > summary::after { content: " ▾"; }
details[open] > summary { margin-bottom: .6rem; }
.img-item { margin-bottom: .8rem; }
.focus { position: relative; cursor: crosshair; border-radius: 8px; overflow: hidden; line-height: 0; }
.focus img { width: 100%; height: auto; display: block; }
.focus .pin { position: absolute; left: var(--fx); top: var(--fy); width: 22px; height: 22px; margin: -11px 0 0 -11px; border: 3px solid #fff; border-radius: 50%; box-shadow: 0 0 0 2px var(--accent), 0 2px 6px rgba(0,0,0,.4); pointer-events: none; }
.img-meta { display: flex; justify-content: space-between; margin-top: .3rem; }
.events { list-style: none; padding: 0; margin: 0; font-size: .85rem; } .events li { padding: .25rem 0; border-bottom: 1px dashed var(--line); }
.net-card .net-head { display: flex; justify-content: space-between; align-items: center; }
.net-body { display: grid; grid-template-columns: minmax(240px, 340px) 1fr; gap: 1rem; }
.verify-row { display: flex; gap: .4rem; align-items: center; margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--line); flex-wrap: wrap; }
.verify-row input { flex: 1; min-width: 200px; }
.counter { display: block; text-align: right; font-size: .75rem; color: var(--muted); }
.counter.over { color: var(--err); font-weight: 700; }

/* Vistas previas */
.preview { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card); font-size: .82rem; align-self: start; }
.pv-user { display: flex; align-items: center; gap: .5rem; padding: .5rem .6rem; }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: inline-block; }
.pv-media { position: relative; background: var(--soft); display: grid; place-items: center; color: var(--muted); }
.pv-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pv-media .count { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.6); color: #fff; font-size: .7rem; padding: 1px 7px; border-radius: 99px; }
.pv-text { padding: .5rem .6rem; white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow: auto; }
.pv-tags { padding: 0 .6rem .6rem; color: var(--tag); }
.pv-mailhead { padding: .6rem; border-bottom: 1px solid var(--line); }
.pv-titlebig { font-weight: 700; padding: .5rem .6rem; font-size: .9rem; }
.pv-x .pv-media { margin: 0 .6rem .6rem; border-radius: 12px; overflow: hidden; }

/* Verificación y marcas */
.stats { display: flex; gap: .8rem; flex-wrap: wrap; }
.stat { display: flex; align-items: center; gap: .5rem; padding: .6rem 1rem; } .stat b { font-size: 1.3rem; }
.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.brand-card { color: var(--ink); } .brand-card:hover { text-decoration: none; border-color: var(--line-strong); }

/* Login */
.login-page { display: grid; place-items: center; min-height: 100vh; }
.login { width: min(360px, 92vw); } .login label { margin-bottom: .8rem; }

/* Móvil */
@media (max-width: 1000px) {
  .detail-grid, .cal-wrap { grid-template-columns: 1fr; }
  .net-body { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .form-grid { grid-template-columns: 1fr; }
  .cal td { height: 80px; font-size: .7rem; } .cal .chip small { display: none; }
  .top { gap: .5rem .8rem; padding: .5rem .8rem; }
  .logo { font-size: .8rem; }
  .top nav { order: 5; width: 100%; flex-wrap: nowrap; overflow-x: auto; }
  .top nav a { padding: .3rem .5rem; font-size: .9rem; white-space: nowrap; }
  .brandpick { margin-left: auto; max-width: 52%; }
  .brandpick .bp-name { font-size: .82rem; }
  .top .btn.primary { padding: .35rem .7rem; }
  main { padding: .8rem; }
}

/* Selector de archivos en forma de píldora */
input[type=file] { padding: .35rem .4rem; border-radius: 999px; font-size: .85rem; }
input[type=file]::file-selector-button { border: 0; background: var(--bg); color: var(--ink); padding: .4rem .9rem; border-radius: 999px; margin-right: .6rem; cursor: pointer; font: inherit; }
input[type=file]::file-selector-button:hover { background: var(--soft); }
select { border-radius: 999px; padding-left: 1rem; }
.steps li { font-family: var(--font-body); }

tr.inactive { opacity: .5; }
code { font-family: var(--font-mono); background: var(--bg); padding: .1rem .4rem; border-radius: 6px; }

/* ---------- Modo noche ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #ecebe8; --ink-2: #d6d3cf; --muted: #a29da6; --line: #34313a; --line-strong: #4a4652;
  --bg: #121116; --card: #1c1b21; --input: #232129; --soft: #2b2931; --hover: #201f25; --today: #2a1a1f; --sel: #33202a;
  --accent: #c4314b; --accent-2: #d9485f; --ok: #5cc48a; --warn: #e3a13b; --err: #f07a72;
  --tag: #8ab4f8; --ok-bg: #16281e; --ok-line: #24402f; --err-bg: #2e1717; --err-line: #4a2424;
  --c-draft-bg: #2e2b28; --c-draft: #cfc8bd; --c-appr-bg: #1b2a3d; --c-appr: #8ab4f8; --c-sched-bg: #33270f; --c-sched: #f0b45a;
  --c-sent-bg: #2a2140; --c-sent: #c3a6f5; --c-pub-bg: #17301f; --c-pub: #6fd39a;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.25);
}
:root[data-theme="dark"] a { color: #ef7b8f; }
:root[data-theme="dark"] .btn.primary, :root[data-theme="dark"] .steps li.done, :root[data-theme="dark"] .daynum .add { color: #fff; }
:root[data-theme="dark"] .top nav a, :root[data-theme="dark"] .brand-modal li a, :root[data-theme="dark"] .brand-card,
:root[data-theme="dark"] .tabs a:not(.on), :root[data-theme="dark"] .cal .chip, :root[data-theme="dark"] .side .chip { color: var(--ink); }
:root[data-theme="dark"] .top nav a i, :root[data-theme="dark"] h3 > i.fa-solid { color: #ef7b8f; }
:root[data-theme="dark"] .n-x { background: #000; box-shadow: 0 0 0 1px #555; }
:root[data-theme="dark"] .brand-modal { background: var(--card); color: var(--ink); }
:root[data-theme="dark"] .preview { border-color: var(--line); }
body, .top, .card, .cal, input, select, textarea, .btn { transition: background-color .2s, border-color .2s, color .2s; }

/* Botón de tema */
.theme-btn { background: none; border: 0; cursor: pointer; color: var(--muted); font-size: 1.05rem; width: 2.2rem; height: 2.2rem;
  border-radius: 50%; display: inline-grid; place-items: center; }
.theme-btn:hover { background: var(--bg); color: var(--accent); }
.theme-btn.floating { position: fixed; top: 1rem; right: 1rem; }
@media (max-width: 700px) { .top .btn.primary { padding: .35rem .7rem; font-size: .85rem; } }
:root[data-theme="dark"] a.btn { color: var(--ink); } :root[data-theme="dark"] a.btn.primary { color: #fff; }
:root[data-theme="dark"] .btn.danger { color: var(--err); }
.top { gap: .6rem 1rem; } .top nav a { padding: .45rem .75rem; }
