:root {
  --bg: #f5f3ee; --panel: #ffffff; --ink: #18212f; --muted: #667085; --line: #e6e2d8;
  --brand: #1f5fa8; --brand-d: #174a85; --brand-l: #e8f1fb; --gold: #c9a227;
  --ok: #1d8a52; --warn: #b7791f; --bad: #c0392b;
  --r: 14px; --sh: 0 1px 2px rgba(16,24,40,.05), 0 6px 20px rgba(16,24,40,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 'Montserrat', 'Segoe UI', system-ui, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(ellipse at 30% 10%, #22396a 0%, #0b1527 70%); }
.login form { width: min(380px, 100%); background: #fff; border-radius: 20px; padding: 34px 30px; box-shadow: 0 30px 80px rgba(0,0,0,.35); text-align: center; }
.login .mark { width: 62px; height: 62px; border-radius: 50%; margin: 0 auto 12px; display: grid; place-items: center; background: var(--brand-l); color: var(--brand); font-size: 30px; }
.login h1 { font-family: 'Playfair Display', Georgia, serif; margin: 0 0 4px; font-size: 26px; }
.login p { margin: 0 0 22px; color: var(--muted); }
.login input { width: 100%; padding: 13px 14px; border: 1.5px solid var(--line); border-radius: 10px; margin-bottom: 12px; text-align: center; }
.login .err { color: var(--bad); font-weight: 600; min-height: 22px; margin: 0 0 6px; }

/* ---------- Barra superior ---------- */
.top { position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 1px solid var(--line); }
.top .row { max-width: 1240px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.brand .mark { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; font-size: 19px; }
.brand b { font-family: 'Playfair Display', Georgia, serif; font-size: 20px; display: block; line-height: 1.1; }
.brand small { color: var(--muted); font-size: 12px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; background: #f1efe9; color: var(--muted); white-space: nowrap; }
.chip i { width: 9px; height: 9px; border-radius: 50%; background: #b9b4a8; display: inline-block; }
.chip.on { background: #e6f5ec; color: var(--ok); } .chip.on i { background: var(--ok); box-shadow: 0 0 0 4px rgba(29,138,82,.15); }
.chip.off { background: #fbeceb; color: var(--bad); } .chip.off i { background: var(--bad); }
.chip.pend { background: #fdf3e1; color: var(--warn); } .chip.pend i { background: var(--warn); }
.tabs { max-width: 1240px; margin: 0 auto; padding: 0 20px; display: flex; gap: 4px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px 12px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button.act { color: var(--brand); border-color: var(--brand); }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1.5px solid var(--line); background: #fff; padding: 9px 16px; border-radius: 10px; font-weight: 600; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap; }
.btn:hover { border-color: #cfc9bb; background: #faf9f6; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-d); }
.btn.primary:disabled { background: #a9bcd3; border-color: #a9bcd3; cursor: default; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #1b1404; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: #f1efe9; }
.btn.wide { width: 100%; }
#publishBtn { padding: 10px 20px; }
#publishBtn.pulse { animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(31,95,168,.45); } 50% { box-shadow: 0 0 0 8px rgba(31,95,168,0); } }

/* ---------- Contenido ---------- */
main { max-width: 1240px; margin: 0 auto; padding: 22px 20px 80px; }
h2 { font-family: 'Playfair Display', Georgia, serif; font-size: 24px; margin: 0 0 14px; }
.muted { color: var(--muted); }
.adders { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 22px; }
.adder { border: 1.5px dashed #cdc6b6; background: #fff; border-radius: var(--r); padding: 18px; display: flex; align-items: center; gap: 14px; cursor: pointer; text-align: left; transition: border-color .15s, background .15s, transform .15s; }
.adder:hover { border-color: var(--brand); background: var(--brand-l); transform: translateY(-1px); }
.adder .ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; background: var(--brand-l); flex: none; }
.adder b { display: block; font-size: 16px; }
.adder small { color: var(--muted); }
.drop-hint { text-align: center; color: var(--muted); font-size: 13px; margin: -10px 0 18px; }
body.dragging::after { content: 'Soltá acá para agregar el flyer o video'; position: fixed; inset: 12px; border: 3px dashed var(--brand); border-radius: 20px; background: rgba(232,241,251,.92); display: grid; place-items: center; font-size: 26px; font-weight: 700; color: var(--brand); z-index: 100; }

.list { display: grid; gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); display: grid; grid-template-columns: 28px 220px 1fr auto; gap: 16px; align-items: center; padding: 12px 14px; }
.card.paused { opacity: .62; }
.card.drag-over { outline: 2px dashed var(--brand); outline-offset: 3px; }
.handle { cursor: grab; color: #b0a993; font-size: 20px; text-align: center; user-select: none; }
.thumb { position: relative; width: 100%; aspect-ratio: 16/9; border-radius: 9px; overflow: hidden; background: #111; cursor: pointer; }
.thumb.portrait { aspect-ratio: 9/16; width: 62%; margin: 0 auto; }
.meta b { font-size: 16px; display: block; margin-bottom: 4px; overflow-wrap: anywhere; }
.meta .tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; }
.tag { padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #f1efe9; color: var(--muted); }
.tag.on { background: #e6f5ec; color: var(--ok); }
.tag.future { background: #fdf3e1; color: var(--warn); }
.tag.expired, .tag.off { background: #f1efe9; color: #8a8576; }
.actions { display: flex; gap: 4px; align-items: center; }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: #d4cfc3; transition: .2s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(18px); }
.empty { text-align: center; padding: 50px 20px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); color: var(--muted); }
.empty .big { font-size: 46px; }
.progress { height: 6px; background: #eee; border-radius: 9px; overflow: hidden; margin-top: 8px; }
.progress > div { height: 100%; background: var(--brand); width: 0; transition: width .2s; }

/* ---------- Formularios ---------- */
.form { display: grid; gap: 16px; grid-template-columns: minmax(0,1fr); }
.field label, .field > .lbl { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: #344054; }
.field .help { font-size: 12px; color: var(--muted); margin-top: 5px; }
.field input[type=text], .field input[type=number], .field input[type=datetime-local], .field input[type=password], .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; }
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31,95,168,.15); }
.row2 { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px; }
.field input, .field select, .field textarea { min-width: 0; }
.seg { display: flex; background: #f1efe9; padding: 3px; border-radius: 10px; gap: 3px; flex-wrap: wrap; }
.seg button { flex: 1; border: 0; background: transparent; padding: 7px 10px; border-radius: 8px; font-weight: 600; font-size: 13px; cursor: pointer; color: var(--muted); }
.seg button.act { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days button { width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--line); background: #fff; font-weight: 700; cursor: pointer; }
.days button.act { background: var(--brand); border-color: var(--brand); color: #fff; }
.tpls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tpls button { border: 2px solid transparent; border-radius: 10px; padding: 0; cursor: pointer; overflow: hidden; background: #fff; box-shadow: 0 0 0 1px var(--line); }
.tpls button.act { border-color: var(--brand); }
.tpls .sw { height: 42px; display: grid; place-items: center; font: 700 18px 'Playfair Display', Georgia, serif; }
.tpls small { display: block; font-size: 11px; font-weight: 600; padding: 5px 4px; color: var(--muted); }
.icons { display: flex; flex-wrap: wrap; gap: 6px; }
.icons button { width: 40px; height: 40px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; font-size: 20px; cursor: pointer; }
.icons button.act { border-color: var(--brand); background: var(--brand-l); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; cursor: pointer; }
.section-t { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 6px 0 -4px; padding-top: 12px; border-top: 1px solid var(--line); }
.range { display: flex; align-items: center; gap: 10px; } .range input { flex: 1; } .range output { width: 48px; text-align: right; font-weight: 700; }

/* ---------- Editor ---------- */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(15,20,30,.55); display: grid; place-items: center; padding: 18px; }
.sheet { background: var(--bg); border-radius: 18px; width: min(1240px, 100%); height: min(860px, 100%); display: grid; grid-template-rows: auto 1fr; overflow: hidden; box-shadow: 0 40px 100px rgba(0,0,0,.4); }
.sheet .hd { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: #fff; border-bottom: 1px solid var(--line); }
.sheet .hd b { font-size: 17px; margin-right: auto; }
.sheet .bd { display: grid; grid-template-columns: 400px 1fr; min-height: 0; }
.sheet .formcol { min-width: 0; overflow-x: hidden; overflow-y: auto; padding: 18px; background: #fff; border-right: 1px solid var(--line); }
.sheet .pvcol { padding: 22px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.pvbox { position: relative; flex: 1; min-height: 0; border-radius: 12px; overflow: hidden; background: #0d0d0d; box-shadow: var(--sh); }
.pvnote { color: var(--muted); font-size: 13px; text-align: center; }
.saved { font-size: 12px; color: var(--muted); }
.mediabox { display: flex; gap: 10px; align-items: center; padding: 10px; border: 1.5px dashed var(--line); border-radius: 10px; background: #fcfbf8; }
.mediabox .nm { flex: 1; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.warn { background: #fdf3e1; color: #7a5410; border-radius: 10px; padding: 10px 12px; font-size: 13px; }

/* ---------- Ajustes / ayuda ---------- */
.split { display: grid; grid-template-columns: 420px 1fr; gap: 22px; align-items: start; }
.box { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--sh); }
.sticky { position: sticky; top: 120px; }
.pvwide { position: relative; aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; background: #111; }
.pvwide.portrait { aspect-ratio: 9/16; max-height: 70vh; margin: 0 auto; }
.steps { padding-left: 20px; margin: 8px 0 0; } .steps li { margin-bottom: 10px; }
code, .code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; background: #f1efe9; padding: 2px 6px; border-radius: 6px; overflow-wrap: anywhere; }
.code { display: block; padding: 10px 12px; margin: 8px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }

.preview-modal .sheet { height: auto; width: min(1180px, 100%); }
.preview-frame { width: 100%; aspect-ratio: 16/9; border: 0; display: block; background: #000; }
.preview-frame.portrait { aspect-ratio: 9/16; height: 78vh; width: auto; margin: 0 auto; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: #18212f; color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; opacity: 0; transition: .25s; z-index: 200; pointer-events: none; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.bad { background: var(--bad); }

@media (max-width: 960px) {
  .sheet .bd { grid-template-columns: 1fr; grid-template-rows: 42% 1fr; }
  .sheet .pvcol { order: -1; padding: 12px; }
  .sheet .formcol { border-right: 0; border-top: 1px solid var(--line); }
  .split, .grid2 { grid-template-columns: 1fr; }
  .sticky { position: static; }
}
@media (max-width: 720px) {
  .adders { grid-template-columns: 1fr; }
  .card { grid-template-columns: 1fr; gap: 10px; }
  .handle { display: none; }
  .thumb { width: 100%; }
  .actions { justify-content: flex-end; }
  .top .row { gap: 10px; }
  #previewBtn span { display: none; }
  .modal { padding: 0; } .sheet { border-radius: 0; height: 100%; }
}
