:root {
  --bg: #0c0e13; --side: #10131a; --panel: #151922; --panel2: #1b202b; --panel3: #222837; --line: #252b39; --line2: #2f3647;
  --text: #e8eaf0; --muted: #8b93a7; --dim: #5f677b;
  --accent: #3b82f6; --accent2: #60a5fa; --accent-soft: rgba(59,130,246,.14);
  --ok: #22c55e; --warn: #f59e0b; --danger: #ef4444; --violet: #8b5cf6;
  --r: 12px; --shadow: 0 10px 40px rgba(0,0,0,.45);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent2); text-decoration: none; }
h1 { font-size: 22px; margin: 0; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0; font-weight: 600; }
h3 { font-size: 12px; margin: 0 0 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .small { font-size: 12.5px; }
.row { display: flex; gap: 10px; align-items: center; } .wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.col { display: flex; flex-direction: column; gap: 10px; }
.hidden { display: none !important; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------- layout ---------------- */
.app { display: grid; grid-template-columns: 236px 1fr; height: 100vh; }
.side { background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 12px; gap: 4px; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 20px; }
.brand .logo { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--violet)); box-shadow: 0 6px 20px rgba(59,130,246,.35); }
.brand .logo svg { width: 20px; height: 20px; stroke: #fff; }
.brand b { font-size: 15.5px; letter-spacing: .02em; display: block; }
.brand span { font-size: 11.5px; color: var(--muted); }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px; color: var(--muted); font-weight: 500; }
.nav a:hover { background: var(--panel); color: var(--text); }
.nav a.on { background: var(--accent-soft); color: var(--accent2); }
.nav a .count { margin-left: auto; font-size: 11px; background: var(--panel3); color: var(--text); border-radius: 999px; padding: 0 7px; }
.side .foot { margin-top: auto; border-top: 1px solid var(--line); padding: 14px 10px 0; display: flex; align-items: center; gap: 10px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--panel3); display: grid; place-items: center; font-weight: 700; font-size: 12px; text-transform: uppercase; }
.main { overflow-y: auto; display: flex; flex-direction: column; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 5; background: rgba(12,14,19,.88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
  padding: 16px 28px; display: flex; align-items: center; gap: 14px; min-height: 72px; }
.topbar .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.content { padding: 24px 28px 60px; }

/* ---------------- controles ---------------- */
button, .btn { font: inherit; border: 1px solid transparent; border-radius: 9px; padding: 8px 14px; cursor: pointer; color: var(--text); background: var(--panel2);
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; transition: background .15s, border-color .15s, opacity .15s; }
button:hover { background: var(--panel3); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover { background: #2f74e6; }
button.soft { background: var(--accent-soft); color: var(--accent2); }
button.soft:hover { background: rgba(59,130,246,.24); }
button.ghost { background: transparent; border-color: var(--line2); }
button.ghost:hover { background: var(--panel2); }
button.danger { color: #fca5a5; }
button.danger.solid { background: var(--danger); color: #fff; }
button.warn { background: rgba(245,158,11,.15); color: #fbbf24; font-weight: 600; }
button.warn:hover { background: rgba(245,158,11,.25); }
button.icon { padding: 7px; background: transparent; color: var(--muted); }
button.icon:hover { background: var(--panel2); color: var(--text); }
button.sm { padding: 5px 10px; font-size: 13px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], input[type=datetime-local], select, textarea {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line2); border-radius: 9px; padding: 8px 11px; outline: none; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=color] { width: 42px; height: 36px; padding: 3px; border: 1px solid var(--line2); border-radius: 9px; background: var(--bg); cursor: pointer; }
::-webkit-calendar-picker-indicator { filter: invert(.75); cursor: pointer; }
label.f, div.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
label.f > span { color: var(--text); font-weight: 500; }
.hint { font-size: 12.5px; color: var(--muted); margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line2); border-radius: 9px; padding: 3px; }
.seg button { background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 7px; font-size: 13px; }
.seg button.on { background: var(--panel3); color: var(--text); }
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; }
.toggle input { display: none; }
.toggle i { width: 36px; height: 21px; border-radius: 999px; background: var(--panel3); position: relative; flex: none; transition: background .15s; }
.toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: transform .15s; }
.toggle input:checked + i { background: var(--accent); }
.toggle input:checked + i::after { transform: translateX(15px); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line2); color: var(--muted); cursor: pointer; font-size: 13px; background: transparent; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent2); }

/* ---------------- tarjetas ---------------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.card.pad { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat { padding: 16px 18px; display: flex; gap: 14px; align-items: center; }
.stat .ic { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent2); }
.stat .ic.g { background: rgba(34,197,94,.13); color: #4ade80; } .stat .ic.v { background: rgba(139,92,246,.15); color: #a78bfa; } .stat .ic.o { background: rgba(245,158,11,.14); color: #fbbf24; }
.stat b { font-size: 22px; display: block; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 12.5px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 26px 0 12px; }
.section-title:first-child { margin-top: 0; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--panel3); color: var(--muted); white-space: nowrap; }
.badge.ok { background: rgba(34,197,94,.13); color: #4ade80; }
.badge.warn { background: rgba(245,158,11,.14); color: #fbbf24; }
.badge.err { background: rgba(239,68,68,.14); color: #f87171; }
.badge.blue { background: var(--accent-soft); color: var(--accent2); }
.badge.violet { background: rgba(139,92,246,.16); color: #a78bfa; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(34,197,94,.18); }
.dot.off { background: var(--danger); }

/* ---------------- dispositivos ---------------- */
.devgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.dev { display: flex; flex-direction: column; overflow: hidden; }
.dev .screen { aspect-ratio: 16/8; background: #07080c; border-bottom: 1px solid var(--line); display: grid; place-items: center; position: relative; overflow: hidden; }
.dev .screen img { max-width: 100%; max-height: 100%; object-fit: contain; }
.dev .screen .ph { color: var(--dim); display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12.5px; }
.dev .screen .ph svg { width: 34px; height: 34px; }
.dev .body { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.dev .name { font-weight: 600; font-size: 15px; }
.dev .kv { display: grid; grid-template-columns: 116px 1fr; gap: 4px 10px; font-size: 12.5px; }
.dev .kv dt { color: var(--muted); } .dev .kv dd { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev .actions { display: flex; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.paircode { font: 700 30px/1 "Cascadia Mono", Consolas, ui-monospace, monospace; letter-spacing: .12em; color: #fff; background: var(--bg); border: 1px dashed var(--accent); border-radius: 12px; padding: 16px 20px; text-align: center; }

/* ---------------- publicaciones ---------------- */
.pubgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
.pub { overflow: hidden; cursor: pointer; transition: border-color .15s, transform .15s; position: relative; }
.pub:hover { border-color: var(--line2); transform: translateY(-1px); }
.pub.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.thumb { aspect-ratio: 9/16; background: #07080c; position: relative; overflow: hidden; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.thumb .tb { position: absolute; left: 8px; top: 8px; }
.thumb .cd { position: absolute; left: 8px; right: 8px; bottom: 8px; background: rgba(0,0,0,.65); border-radius: 8px; padding: 6px 8px; font-size: 11.5px; text-align: center; font-weight: 600; }
.pub .meta { padding: 10px 12px; }
.pub .meta b { display: block; font-weight: 600; font-size: 13.5px; }
.pub .check { position: absolute; right: 8px; top: 8px; width: 24px; height: 24px; border-radius: 50%; background: rgba(0,0,0,.6); border: 2px solid rgba(255,255,255,.7); display: grid; place-items: center; }
.pub.sel .check { background: var(--accent); border-color: var(--accent); }
.pub .check svg { width: 14px; height: 14px; stroke: #fff; opacity: 0; } .pub.sel .check svg { opacity: 1; }

/* ---------------- tablas / listas ---------------- */
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--line); }
table.t td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: var(--panel2); }

.editor { display: grid; grid-template-columns: 1fr 340px; gap: 18px; align-items: start; }
.items { list-style: none; margin: 0; padding: 8px; min-height: 120px; }
.item { display: grid; grid-template-columns: 20px 24px 46px 1fr auto auto auto; gap: 12px; align-items: center; padding: 8px 10px; border-radius: 10px; border: 1px solid transparent; }
.item:hover { background: var(--panel2); }
.item .grip { color: var(--dim); cursor: grab; }
.item .n { color: var(--muted); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.item .mini { width: 46px; height: 82px; border-radius: 6px; overflow: hidden; background: #07080c; border: 1px solid var(--line); }
.item .mini img, .item .mini video { width: 100%; height: 100%; object-fit: cover; display: block; }
.item.off .mini, .item.off .info { opacity: .4; }
.item.drag { opacity: .35; } .item.ot { border-top-color: var(--accent); } .item.ob { border-bottom-color: var(--accent); }
.item .dur { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); } .item .dur input { width: 72px; }
.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty-state svg { width: 42px; height: 42px; stroke: var(--dim); margin-bottom: 8px; }
.empty-state b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.sticky { position: sticky; top: 90px; }

/* ---------------- calendario ---------------- */
.week { display: grid; grid-template-columns: 52px repeat(7, 1fr); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--panel); }
.week .wh { padding: 10px 8px; text-align: center; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); font-size: 12.5px; }
.week .wh b { display: block; font-size: 17px; }
.week .wh.today { color: var(--accent2); background: var(--accent-soft); }
.week .hours { position: relative; }
.week .hours div { height: 26px; font-size: 10.5px; color: var(--dim); text-align: right; padding-right: 6px; transform: translateY(-7px); }
.week .daycol { position: relative; border-left: 1px solid var(--line); background: repeating-linear-gradient(to bottom, transparent 0, transparent 25px, rgba(37,43,57,.6) 25px, rgba(37,43,57,.6) 26px); }
.week .blk { position: absolute; border-radius: 6px; padding: 3px 6px; font-size: 11px; overflow: hidden; color: #fff; border-left: 3px solid rgba(255,255,255,.7); cursor: pointer; line-height: 1.25; }
.week .blk:hover { filter: brightness(1.15); z-index: 2; }
.week .blk.lost { opacity: .35; }
.week .now { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 3; }
.week .now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.week .evt { position: absolute; left: 2px; right: 2px; height: 20px; background: var(--warn); color: #111; border-radius: 5px; font-size: 10.5px; font-weight: 700; padding: 2px 6px; z-index: 2; overflow: hidden; white-space: nowrap; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; } .legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------------- modal / toast ---------------- */
.modal-bg { position: fixed; inset: 0; background: rgba(4,6,10,.72); backdrop-filter: blur(3px); z-index: 50; display: grid; place-items: center; padding: 24px; animation: fade .15s; }
.modal { background: var(--panel); border: 1px solid var(--line2); border-radius: 16px; box-shadow: var(--shadow); width: min(560px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column; animation: pop .18s; }
.modal.wide { width: min(980px, 100%); } .modal.xl { width: min(1180px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); }
@keyframes fade { from { opacity: 0; } } @keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--panel3); border: 1px solid var(--line2); padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; animation: pop .2s; max-width: 420px; }
.toast.ok { border-color: rgba(34,197,94,.45); } .toast.err { border-color: rgba(239,68,68,.5); }
.progress { height: 6px; background: var(--panel3); border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }

.preview-frame { background: #000; border-radius: 14px; border: 6px solid #1e2330; box-shadow: var(--shadow); overflow: hidden; margin: 0 auto; }
.preview-frame.v { aspect-ratio: 9/16; height: min(68vh, 720px); }
.preview-frame.h { aspect-ratio: 16/9; width: min(100%, 860px); }
.preview-frame.sm { height: 440px; }
.preview-frame > div { width: 100%; height: 100%; }
.drop-overlay { position: fixed; inset: 0; background: rgba(12,14,19,.86); z-index: 60; display: grid; place-items: center; pointer-events: none; }
.drop-overlay div { border: 2px dashed var(--accent); border-radius: 20px; padding: 60px 90px; font-size: 18px; color: var(--accent2); }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--panel3); border-radius: 10px; border: 3px solid var(--bg); }

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .editor { grid-template-columns: 1fr; }
  .sticky { position: static; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; flex-direction: row; padding: 6px; border-right: 0; border-top: 1px solid var(--line); }
  .side .brand, .side .foot, .nav a span, .nav a .count { display: none; }
  .nav { display: flex; width: 100%; justify-content: space-around; }
  .main { padding-bottom: 64px; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .item { grid-template-columns: 20px 46px 1fr auto; } .item .n, .item .dur { display: none; }
}

.editor .seg, .modal .seg { display: flex; } .editor .seg button, .modal .seg button { flex: 1; }
.col > .badge { align-self: flex-start; }
.accbox { padding: 0 6px 14px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.acc-label { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); margin: 0 0 6px 4px; font-weight: 700; }
.accbox select { background: var(--panel); font-weight: 600; }
.acc-name { font-weight: 600; padding: 0 4px; }
@media (max-width: 760px) { .accbox { display: none; } }
/* ---------- editores de carrusel y evento ---------- */
.strip { display: flex; gap: 10px; flex-wrap: wrap; background: var(--bg); border: 1px dashed var(--line2); border-radius: 12px; padding: 10px; min-height: 110px; }
.sthumb { position: relative; width: 58px; height: 102px; border-radius: 8px; overflow: hidden; background: #07080c; border: 1px solid var(--line2); cursor: grab; }
.sthumb img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.sthumb > span { position: absolute; left: 4px; bottom: 4px; background: rgba(0,0,0,.7); font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 6px; }
.sthumb button { position: absolute; right: 2px; top: 2px; padding: 2px; background: rgba(0,0,0,.65); border-radius: 6px; color: #fff; }
.sthumb button svg { width: 13px; height: 13px; }
.fontsample { font-size: 30px; padding: 10px 14px; background: var(--bg); border: 1px solid var(--line2); border-radius: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv { color: var(--accent2); font-weight: 700; margin-left: 4px; }
input[type=range] { width: 100%; accent-color: var(--accent); }
label.inline-f { flex-direction: row; align-items: center; justify-content: space-between; }
textarea { resize: vertical; font-family: inherit; }
.pub .check b { color: #fff; }
.badge.pro { background: linear-gradient(135deg, #f59e0b, #ef4444); color: #fff; letter-spacing: .08em; }
.pro-box { border-color: rgba(245,158,11,.35); background: linear-gradient(180deg, rgba(245,158,11,.06), transparent 60%), var(--panel); }
.optrow { display: grid; grid-template-columns: 110px 64px 1fr 1fr; gap: 10px; align-items: center; }
.optrow input.em { text-align: center; font-size: 18px; padding: 6px; }
.audchart { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 8px; }
.audchart .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10.5px; color: var(--muted); height: 100%; justify-content: flex-end; }
.audchart .bar i { width: 100%; max-width: 26px; border-radius: 5px 5px 0 0; background: var(--accent); min-height: 2px; }
.audchart .bar.today i { background: #f59e0b; }
.audstats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.audstats div { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.audstats b { display: block; font-size: 20px; } .audstats span { font-size: 12px; color: var(--muted); }
