:root {
  --bg: #070707;
  --s1: #0f0f0f;
  --s2: #151515;
  --s3: #1c1c1c;
  --line: #222;
  --line2: #2c2c2c;
  --text: #f4f4f4;
  --muted: #8b8b8b;
  --faint: #5a5a5a;
  --good: #4ade80;
  --bad: #f87171;
  --warn: #fbbf24;
  --r: 14px;
  --display: 'Archivo Black', 'Inter', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); font-size: 14px; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: #fff; color: #000; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.good { color: var(--good); }
.bad { color: var(--bad); }
.display { font-family: var(--display); letter-spacing: -0.01em; font-weight: 400; }

/* Layout */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px; height: 60px; padding: 0 28px; background: rgba(7,7,7,.82); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.topbar .logo img { height: 17px; display: block; }
.crumbs { display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 500; min-width: 0; }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { color: var(--faint); }
.crumbs .cur { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.page { max-width: 1280px; margin: 0 auto; padding: 36px 28px 80px; }
.page-head { display: flex; align-items: flex-end; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--display); font-size: 40px; line-height: 1; margin: 0; font-weight: 400; letter-spacing: -0.02em; }
.page-head .grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
@media (max-width: 1000px) { .grid2 { grid-template-columns: 1fr; } }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line2); background: var(--s2); color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer; transition: background .15s, border-color .15s, opacity .15s; white-space: nowrap; }
.btn:hover { background: var(--s3); border-color: #3a3a3a; }
.btn.primary { background: #fff; color: #000; border-color: #fff; }
.btn.primary:hover { background: #e6e6e6; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--s2); }
.btn.danger { color: var(--bad); }
.btn.sm { height: 30px; padding: 0 12px; font-size: 12px; }
.btn.icon { width: 32px; padding: 0; height: 32px; }
.btn:disabled { opacity: .45; cursor: default; }
.spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Tabs / segmented */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 28px; overflow-x: auto; }
.tab { padding: 12px 14px; color: var(--muted); font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-color: #fff; }
.seg { display: inline-flex; background: var(--s1); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: transparent; color: var(--muted); font-weight: 600; font-size: 12px; padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.seg button.on { background: #fff; color: #000; }

/* Cards */
.card { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r); }
.card.pad { padding: 22px; }
.card h3 { margin: 0 0 16px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { padding: 18px 20px; }
.kpi .label { font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: 10px; display: flex; gap: 6px; align-items: center; }
.kpi .value { font-family: var(--display); font-size: 28px; line-height: 1; letter-spacing: -0.01em; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* Client cards */
.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.client-card { padding: 22px; display: flex; flex-direction: column; gap: 18px; transition: border-color .15s, transform .15s; cursor: pointer; min-height: 210px; position: relative; overflow: hidden; }
.client-card:hover { border-color: #3a3a3a; transform: translateY(-2px); }
.client-card .name { font-family: var(--display); font-size: 24px; line-height: 1.05; }
.client-card .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: auto; }
.client-card .stats b { display: block; font-size: 16px; font-weight: 700; }
.client-card .stats span { font-size: 11px; color: var(--muted); }
.client-card.new { align-items: center; justify-content: center; border-style: dashed; color: var(--muted); font-weight: 600; background: transparent; }
.client-card.new:hover { color: var(--text); }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: default; user-select: none; }
.t th.sortable { cursor: pointer; }
.t th.sortable:hover { color: var(--muted); }
.t td { padding: 13px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr.link { cursor: pointer; }
.t tbody tr.link:hover td { background: var(--s2); }
.t .r { text-align: right; }
.t tfoot td { font-weight: 700; border-top: 1px solid var(--line2); border-bottom: 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--s3); flex: none; object-fit: cover; display: grid; place-items: center; font-weight: 700; font-size: 12px; color: var(--muted); }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who b { font-weight: 600; display: block; }
.who small { color: var(--muted); font-size: 12px; }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; background: var(--s2); border: 1px solid var(--line2); font-size: 12px; font-weight: 600; color: var(--muted); }
.chip.auto { color: #000; background: #fff; border-color: #fff; }
.chip.warn { color: var(--warn); border-color: rgba(251,191,36,.3); background: rgba(251,191,36,.06); }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; color: var(--muted); font-weight: 500; }
.field small { color: var(--faint); font-size: 11px; }
.input { height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line2); background: var(--bg); outline: none; transition: border-color .15s; width: 100%; }
textarea.input { height: auto; padding: 10px 14px; resize: vertical; min-height: 70px; }
.input:focus { border-color: #666; }
.input-pre { position: relative; }
.input-pre > i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--faint); font-style: normal; pointer-events: none; }
.input-pre > .input { padding-left: 26px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.err { color: var(--bad); font-size: 13px; }
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; color: var(--muted); font-weight: 500; }
.toggle input { display: none; }
.toggle .sw { width: 34px; height: 20px; border-radius: 99px; background: var(--s3); border: 1px solid var(--line2); position: relative; transition: background .15s; }
.toggle .sw::after { content: ''; position: absolute; width: 14px; height: 14px; border-radius: 50%; top: 2px; left: 2px; background: var(--muted); transition: transform .15s, background .15s; }
.toggle input:checked + .sw { background: #fff; }
.toggle input:checked + .sw::after { transform: translateX(14px); background: #000; }

/* Modal */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); backdrop-filter: blur(4px); z-index: 50; display: grid; place-items: center; padding: 20px; animation: fade .15s; }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 40px); overflow: auto; background: var(--s1); border: 1px solid var(--line2); border-radius: 18px; padding: 28px; animation: pop .18s; }
.modal h2 { font-family: var(--display); font-weight: 400; font-size: 24px; margin: 0 0 22px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* Deal presets */
.presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.preset { padding: 12px 10px; border-radius: 12px; border: 1px solid var(--line2); background: var(--bg); text-align: center; cursor: pointer; font-weight: 600; font-size: 12px; color: var(--muted); }
.preset.on { border-color: #fff; color: var(--text); background: var(--s2); }

/* Chart */
.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .tip { position: absolute; pointer-events: none; background: #fff; color: #000; border-radius: 10px; padding: 8px 12px; font-size: 12px; white-space: nowrap; transform: translate(-50%, calc(-100% - 12px)); box-shadow: 0 8px 30px rgba(0,0,0,.5); }
.chart .tip b { display: block; font-size: 14px; }
.axis text { fill: var(--faint); font-size: 11px; }

/* Budget bar */
.bbar { height: 14px; border-radius: 99px; background: var(--s3); display: flex; overflow: hidden; gap: 2px; }
.bbar > div { height: 100%; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* Videos */
.vid { display: grid; grid-template-columns: 128px minmax(0, 1fr) auto; gap: 16px; padding: 14px; align-items: center; border-bottom: 1px solid var(--line); }
.vid:last-child { border-bottom: 0; }
.vid .thumb { width: 128px; aspect-ratio: 16/9; border-radius: 8px; background: var(--s3); object-fit: cover; display: block; }
.vid .title { font-weight: 600; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.vid .title:hover { text-decoration: underline; }
.vid .meta { color: var(--muted); font-size: 12px; margin-top: 6px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.vid .nums { text-align: right; }
.vid .nums b { font-family: var(--display); font-size: 18px; font-weight: 400; display: block; }
.vid.excluded { opacity: .45; }

/* Auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(ellipse at 50% -20%, #1a1a1a, var(--bg) 60%); }
.auth-box { width: 100%; max-width: 380px; }
.auth-box .logo { display: block; height: 30px; margin: 0 auto 36px; }
.auth-box .card { padding: 28px; }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .icon { width: 44px; opacity: .25; margin-bottom: 14px; }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 6px; }
.banner { padding: 12px 16px; border-radius: 12px; border: 1px solid rgba(251,191,36,.25); background: rgba(251,191,36,.05); color: var(--warn); font-size: 13px; margin-bottom: 20px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #fff; color: #000; padding: 10px 18px; border-radius: 999px; font-weight: 600; z-index: 60; animation: pop .2s; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.copy { display: flex; gap: 8px; }
.copy .input { font-family: ui-monospace, monospace; font-size: 12px; }
.menu { position: relative; }
.menu .pop { position: absolute; right: 0; top: calc(100% + 8px); background: var(--s1); border: 1px solid var(--line2); border-radius: 12px; padding: 6px; min-width: 200px; z-index: 30; box-shadow: 0 20px 50px rgba(0,0,0,.5); }
.menu .pop .who-line { padding: 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; font-size: 12px; color: var(--muted); }
.menu .pop button, .menu .pop a { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 8px; border: 0; background: transparent; cursor: pointer; font-weight: 500; }
.menu .pop button:hover, .menu .pop a:hover { background: var(--s2); }
.kv { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.kv b { font-weight: 600; }
.progress { height: 6px; background: var(--s3); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: #fff; border-radius: 99px; }
@media (max-width: 700px) {
  .page { padding: 24px 16px 60px; }
  .topbar { padding: 0 16px; }
  .page-head h1 { font-size: 30px; }
  .form-grid, .presets { grid-template-columns: 1fr 1fr; }
  .vid { grid-template-columns: 96px minmax(0,1fr); }
  .vid .thumb { width: 96px; }
  .vid .nums { grid-column: 2; text-align: left; }
}
