:root {
  /* Identidad de pomplay.com.pe */
  --bg: #040621;
  --panel: #0d1030;
  --panel-2: #151a3d;
  --line: #232a52;
  --text: #f4f4f5;
  --muted: #8f95b2;
  --accent: #ec4237;
  --accent-ink: #ffffff;
  --cyan: #ff6b75;
  --ok: #3ddc84;
  --warn: #ffb020;
  --bad: #ff5d5d;
  --radius: 14px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--cyan); text-decoration: none; }
h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: -0.02em; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.boot { padding: 40px; color: var(--muted); }
.hidden { display: none !important; }

/* Layout */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { background: #0d111a; border-right: 1px solid var(--line); padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand img { height: 30px; }
.brand b { font-size: 12px; color: var(--muted); letter-spacing: 0.12em; text-transform: uppercase; display: block; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.nav a:hover { background: var(--panel); color: var(--text); }
.nav a.active { background: var(--accent); color: var(--accent-ink); }
.nav .sep { height: 1px; background: var(--line); margin: 10px 8px; }
.nav .badge { margin-left: auto; background: var(--bad); color: #fff; border-radius: 99px; padding: 1px 7px; font-size: 11px; }
.nav a.active .badge { background: var(--accent-ink); color: var(--accent); }
.me { margin-top: 18px; padding: 10px 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.main { padding: 26px 32px 60px; max-width: 1400px; width: 100%; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }

/* Components */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; overflow-x: auto; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat .v { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.stat .l { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.stat.hl { background: linear-gradient(135deg, #3a1020, var(--panel)); border-color: #6e2230; }
.stat.hl .v { color: var(--accent); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }

button, .btn { font: inherit; font-weight: 700; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); border-radius: 10px; padding: 8px 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
button:hover, .btn:hover { border-color: #3a465e; }
button.primary, .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.ok { background: #153d26; border-color: #23683f; color: #b6ffd2; }
button.bad { background: #3d1515; border-color: #6b2323; color: #ffc4c4; }
button.ghost { background: transparent; }
button.sm { padding: 5px 10px; font-size: 12px; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

input, select, textarea { font: inherit; background: #0d111a; color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; width: 100%; }
textarea { min-height: 90px; resize: vertical; }
input[type=checkbox] { width: auto; }
input[type=color] { padding: 2px; height: 36px; }
label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.05em; }
.field { margin-bottom: 12px; }
.check { display: flex; gap: 8px; align-items: center; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--text); font-weight: 500; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--panel-2); }

.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.pill.pending_approval, .pill.queued, .pill.uploaded, .pill.pending { background: #3a2c0b; color: #ffd27a; border-color: #5e4510; }
.pill.approved, .pill.done, .pill.ready, .pill.published, .pill.confirmed, .pill.analyzed, .pill.connected { background: #12341f; color: #8cf5b4; border-color: #1f5a35; }
.pill.rejected, .pill.failed, .pill.error, .pill.cancelled { background: #3a1414; color: #ff9c9c; border-color: #5e2020; }
.pill.processing, .pill.running, .pill.analyzing, .pill.generating, .pill.publishing { background: #0b2c3a; color: #7fe3ff; border-color: #154a5e; }
.pill.scheduled, .pill.paused { background: #2a1840; color: #d7b4ff; border-color: #452769; }

.progress { height: 6px; background: var(--panel-2); border-radius: 99px; overflow: hidden; min-width: 80px; }
.progress > div { height: 100%; background: var(--accent); }

/* Tarjetas de contenido */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; display: flex; flex-direction: column; }
.tile:hover { border-color: #3d4a63; transform: translateY(-1px); }
.tile .thumb { aspect-ratio: 4/5; background: #06080d; display: grid; place-items: center; overflow: hidden; position: relative; }
.tile .thumb img { width: 100%; height: 100%; object-fit: cover; }
.tile .thumb .type { position: absolute; top: 8px; left: 8px; }
.tile .thumb .copytxt { padding: 40px 16px 16px; font-size: 13px; color: var(--text); white-space: pre-wrap; line-height: 1.45; align-self: start; max-height: 100%; overflow: hidden; }
.tile .meta { padding: 10px 12px; }
.tile .meta b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.events { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.event { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.event img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; background: #000; }
.event .body { padding: 10px 12px; }
.event.rejected { opacity: 0.45; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(3, 5, 9, 0.78); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal .box { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; width: min(1100px, 100%); max-height: 92vh; overflow: auto; padding: 22px; }
.modal .box.narrow { width: min(560px, 100%); }
.preview-media { background: #000; border-radius: 12px; overflow: hidden; display: grid; place-items: center; max-height: 70vh; }
.preview-media video, .preview-media img { max-width: 100%; max-height: 70vh; display: block; }
.variant { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; white-space: pre-wrap; cursor: pointer; }
.variant.sel { border-color: var(--accent); background: #2a1022; }

#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 99; }
.toast { background: var(--panel-2); border: 1px solid var(--line); border-left: 4px solid var(--accent); padding: 10px 14px; border-radius: 10px; max-width: 380px; box-shadow: 0 8px 30px rgba(0,0,0,0.4); }
.toast.err { border-left-color: var(--bad); }

.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 80% 0%, #3a1020 0%, var(--bg) 45%); }
.login .card { width: min(400px, 100%); padding: 28px; }
.login img { height: 42px; margin-bottom: 14px; }

.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .d { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; min-height: 104px; padding: 6px; font-size: 12px; }
.cal .d.out { opacity: 0.4; }
.cal .d.today { border-color: var(--accent); }
.cal .post { background: var(--panel-2); border-radius: 6px; padding: 3px 6px; margin-top: 4px; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal .dow { font-size: 11px; color: var(--muted); text-align: center; font-weight: 700; text-transform: uppercase; }

.notice { border: 1px dashed #5e4510; background: #241b07; color: #ffd27a; border-radius: 12px; padding: 12px 14px; }
.empty { padding: 40px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
.dz { border: 2px dashed var(--line); border-radius: 14px; padding: 26px; text-align: center; color: var(--muted); }
.dz.over { border-color: var(--accent); color: var(--text); }
img.design-preview { width: 100%; border-radius: 12px; background: #000; display: block; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .main { padding: 18px 16px 60px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
}
