:root {
  --bg: #080b12; --surface: #101622; --surface-2: #161e2d; --surface-3: #1d2738; --line: #263247;
  --text: #f5f7fb; --muted: #97a4b8; --primary: #f2b705; --primary-2: #ffd761; --on-primary: #17120a;
  --danger: #ef4444; --warning: #f59e0b; --success: #22c55e; --info: #38bdf8;
  --sti: #38bdf8; --eventos: #f472b6; --radius: 16px; --shadow: 0 18px 45px rgba(0,0,0,.3);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { background: radial-gradient(1200px 600px at 100% -10%, rgba(242,183,5,.07), transparent 60%), var(--bg); }
a { color: var(--primary-2); }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* Shell */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow: auto; background: rgba(13,18,32,.92); border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; gap: 4px; }
.logo { display: flex; gap: 10px; align-items: center; padding: 4px 8px 16px; }
.logo img { width: 40px; height: 40px; border-radius: 12px; }
.logo strong { display: block; }
.logo span { font-size: 12px; color: var(--primary-2); font-weight: 700; letter-spacing: .08em; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: 14px 10px 4px; }
.nav-link { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 600; }
.nav-link:hover, .nav-link.active { background: var(--surface-2); color: var(--text); }
.nav-link.active { box-shadow: inset 3px 0 var(--primary); }
.nav-link .count { margin-left: auto; background: var(--primary); color: var(--on-primary); font-size: 11px; border-radius: 99px; padding: 0 7px; }
.sidebar-foot { margin-top: auto; padding: 12px 10px 0; font-size: 12px; color: var(--muted); }
.main { min-width: 0; padding: 22px 28px 60px; }
.topbar { display: flex; gap: 14px; align-items: center; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; }
.topbar h1 { margin: 0; font-size: 26px; }
.topbar p { margin: 2px 0 0; color: var(--muted); }
.top-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.btn.menu-btn { display: none; }
.brand-switch { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.brand-switch button { border: 0; background: transparent; color: var(--muted); padding: 7px 12px; border-radius: 9px; font-weight: 700; cursor: pointer; }
.brand-switch button.active { background: var(--surface-3); color: var(--text); }

/* Components */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); border-radius: 11px; padding: 9px 14px; font-weight: 700; cursor: pointer; text-decoration: none; min-height: 40px; }
.btn:hover { border-color: #3a4a66; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--primary-2), var(--primary)); color: var(--on-primary); border-color: transparent; }
.btn.danger { background: transparent; color: #fca5a5; border-color: rgba(239,68,68,.45); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; min-height: 32px; font-size: 13px; }
.panel { background: linear-gradient(180deg, rgba(22,30,45,.95), rgba(16,22,34,.95)); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.panel h2 { margin: 0 0 4px; font-size: 18px; }
.panel h3 { margin: 16px 0 8px; font-size: 15px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head p { margin: 0; color: var(--muted); font-size: 13px; }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.split { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; text-decoration: none; color: inherit; display: block; }
.kpi span { color: var(--muted); font-size: 13px; font-weight: 600; }
.kpi strong { display: block; font-size: 28px; line-height: 1.2; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); font-size: 12px; }
.kpi.accent { border-color: rgba(242,183,5,.5); }
.kpi.alert strong { color: #fca5a5; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
input, select, textarea { width: 100%; background: #0b1019; border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; min-height: 42px; }
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .nav-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.stack { display: grid; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.notice { border: 1px solid var(--line); border-left: 3px solid var(--primary); background: rgba(242,183,5,.06); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin: 0; }
.notice.error { border-left-color: var(--danger); background: rgba(239,68,68,.08); color: #fecaca; }
.notice.ok { border-left-color: var(--success); background: rgba(34,197,94,.08); }
.badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 99px; padding: 2px 9px; font-size: 11px; font-weight: 800; letter-spacing: .03em; border: 1px solid var(--line); background: var(--surface-3); white-space: nowrap; }
.badge.b-sti { color: var(--sti); border-color: rgba(56,189,248,.4); }
.badge.b-eventos { color: var(--eventos); border-color: rgba(244,114,182,.4); }
.badge.s-DRAFT, .badge.s-NEW { color: var(--muted); }
.badge.s-READY, .badge.s-CONTACTED, .badge.s-ACCEPTED { color: var(--info); }
.badge.s-APPROVED, .badge.s-QUALIFIED { color: var(--primary-2); }
.badge.s-SCHEDULED, .badge.s-QUOTE_SENT, .badge.s-FOLLOW_UP { color: #c4b5fd; }
.badge.s-PUBLISHED, .badge.s-WON, .badge.s-USED { color: var(--success); }
.badge.s-FAILED, .badge.s-LOST, .badge.s-ALTA { color: #fca5a5; }
.badge.s-MEDIA { color: var(--warning); }
.badge.s-CANCELLED, .badge.s-SPAM, .badge.s-DISMISSED, .badge.s-BAJA, .badge.s-PUBLISHING { color: var(--muted); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; background: var(--surface); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; } tr.clickable:hover td { background: var(--surface-2); }
.empty { color: var(--muted); padding: 22px; text-align: center; border: 1px dashed var(--line); border-radius: 12px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 99px; padding: 6px 12px; font-weight: 700; cursor: pointer; font-size: 13px; }
.tabs button.active { color: var(--on-primary); background: var(--primary); border-color: transparent; }
.list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.item { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px 14px; }
.item-head { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.item p { margin: 6px 0 0; }
.hook { font-weight: 800; color: var(--primary-2); }

/* Command center */
.command { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.command label { font-size: 18px; font-weight: 800; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 99px; padding: 5px 10px; font: 12px ui-monospace, Menlo, monospace; cursor: pointer; }
.chip:hover { color: var(--text); }

/* Calendar */
.cal-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-dow { color: var(--muted); font-size: 12px; font-weight: 700; text-align: center; padding: 4px 0; }
.cal-cell { min-height: 108px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 6px; display: grid; align-content: start; gap: 4px; min-width: 0; }
.cal-cell.out { opacity: .4; } .cal-cell.today { border-color: var(--primary); }
.cal-num { font-size: 12px; color: var(--muted); font-weight: 700; }
.cal-ev { display: block; width: 100%; text-align: left; border: 0; border-left: 3px solid var(--muted); background: var(--surface-3); color: var(--text); border-radius: 6px; padding: 3px 6px; font-size: 11px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev.b-sti { border-left-color: var(--sti); } .cal-ev.b-eventos { border-left-color: var(--eventos); }
.cal-ev.s-PUBLISHED { opacity: .7; } .cal-ev.s-FAILED { background: rgba(239,68,68,.18); }
.cal-ev.radar { border-left-style: dashed; background: transparent; color: var(--muted); }

/* Media */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.media-tile { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #0b1019; aspect-ratio: 4 / 5; }
.media-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-tile .tools { position: absolute; inset: auto 0 0 0; display: flex; justify-content: space-between; padding: 4px; background: linear-gradient(transparent, rgba(0,0,0,.75)); }
.media-tile .tools button { border: 0; background: rgba(0,0,0,.6); color: #fff; border-radius: 6px; width: 26px; height: 26px; cursor: pointer; }
.media-tile .n { position: absolute; top: 4px; left: 4px; background: rgba(0,0,0,.7); border-radius: 6px; font-size: 11px; padding: 0 6px; }
.drop { border: 1px dashed #3a4a66; border-radius: 12px; padding: 16px; text-align: center; color: var(--muted); cursor: pointer; display: grid; gap: 4px; }
.drop:hover { border-color: var(--primary); color: var(--text); }

/* Pipeline */
.pipeline { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-bottom: 14px; }
.stage { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; cursor: pointer; text-align: left; color: inherit; }
.stage strong { display: block; font-size: 22px; }
.stage.active { border-color: var(--primary); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(3,6,12,.72); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { width: min(860px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); }
.modal-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px; }
.modal-head h2 { margin: 0; font-size: 20px; }

/* Login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth .panel { width: min(420px, 100%); }
.auth .logo { justify-content: center; padding-bottom: 6px; }

.toast { position: fixed; right: 18px; bottom: 18px; max-width: min(420px, calc(100vw - 36px)); background: #0b1019; border: 1px solid var(--line); border-left: 3px solid var(--primary); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); transform: translateY(20px); opacity: 0; pointer-events: none; transition: .2s; z-index: 80; }
.toast.show { transform: none; opacity: 1; }
.toast.error { border-left-color: var(--danger); }
.bar { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--primary); }
pre.code { background: #0b1019; border: 1px solid var(--line); border-radius: 10px; padding: 10px; overflow-x: auto; font-size: 12px; white-space: pre-wrap; word-break: break-all; }

@media (max-width: 1100px) { .grid.split { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .btn.menu-btn { display: inline-flex; }
  .main { padding: 16px 16px 60px; }
  .grid.two, .form-grid { grid-template-columns: 1fr; }
  .command { grid-template-columns: 1fr; }
  .command label { white-space: normal; }
  .cal-cell { min-height: 72px; } .cal-ev { font-size: 10px; }
  .topbar h1 { font-size: 22px; }
}
@media (max-width: 560px) { .cal-dow { font-size: 10px; } .cal-cell { padding: 3px; } .kpi strong { font-size: 22px; } }
.thumb { width: 48px; height: 60px; object-fit: cover; border-radius: 8px; display: block; }
.row > select, .row > input { width: auto; min-width: 160px; }
.row > .tabs { margin-bottom: 0; }
a.cal-ev { text-decoration: none; }
#view > * + * { margin-top: 18px; } .kpis { margin-bottom: 0; }
