:root {
  --bg: #0a0a0a;
  --side: #050505;
  --card: #121212;
  --card-2: #181818;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #f4f1ec;
  --muted: rgba(244, 241, 236, 0.58);
  --faint: rgba(244, 241, 236, 0.36);
  --accent: #ff6b1a;
  --accent-soft: rgba(255, 107, 26, 0.14);
  --good: #3ccf7a;
  --good-soft: rgba(60, 207, 122, 0.13);
  --warn: #f5c443;
  --warn-soft: rgba(245, 196, 67, 0.13);
  --bad: #ff5d5d;
  --radius: 14px;
  --display: 'Archivo', system-ui, sans-serif;
  --body: 'Inter', system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 34px; line-height: 1.1; font-weight: 700; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 600; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- shell ---------- */
.banner { background: #2a1a0c; border-bottom: 1px solid rgba(255, 107, 26, 0.3); color: #ffd9c2; text-align: center; padding: 9px 16px; font-size: 14px; }
.banner a { color: var(--accent); font-weight: 600; cursor: pointer; }
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: var(--side); border-right: 1px solid var(--line); padding: 26px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.logo { display: flex; align-items: center; gap: 10px; padding: 0 12px 26px; font-family: var(--display); font-weight: 800; font-size: 15px; letter-spacing: 0.06em; line-height: 1.05; text-transform: uppercase; text-decoration: none; }
.logo svg { width: 34px; height: 34px; flex: none; }
.logo span b { color: var(--accent); display: block; }
.nav a { display: flex; align-items: center; gap: 14px; padding: 11px 14px; border-radius: 10px; text-decoration: none; color: var(--muted); font-size: 15.5px; font-weight: 500; position: relative; }
.nav a:hover { background: var(--card); color: var(--text); }
.nav a.on { background: var(--card); color: var(--text); }
.nav a.on svg { color: var(--accent); }
.nav a .dot { position: absolute; right: 12px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #000; font-size: 11.5px; font-weight: 700; display: grid; place-items: center; }
.nav svg { width: 21px; height: 21px; flex: none; }
.nav-label { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); padding: 18px 14px 6px; }
.side .spacer { flex: 1; }
.main { padding: 34px 40px 60px; min-width: 0; max-width: 1320px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.topbar .actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--card-2); border: 1px solid var(--line-2); display: grid; place-items: center; font-weight: 600; }
.mobile-bar { display: none; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); cursor: pointer; font-weight: 500; font-size: 14px; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: rgba(255, 255, 255, 0.3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #0a0a0a; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 999px; cursor: pointer; color: var(--muted); font-size: 13.5px; font-weight: 500; }
.seg button.on { background: var(--card-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], textarea, select {
  width: 100%; background: #0d0d0d; border: 1px solid var(--line-2); border-radius: 10px; padding: 11px 13px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--card-2); color: var(--muted); border: 1px solid var(--line); }
.pill.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.err { color: var(--bad); font-size: 14px; min-height: 20px; }

/* ---------- cards / layout ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.card-head p { margin: 4px 0 0; }
.grid { display: grid; gap: 18px; }
.cols-main { grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); align-items: start; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat .label { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.stat .value { font-family: var(--display); font-size: 34px; font-weight: 700; line-height: 1.15; margin-top: 8px; }
.stat .delta { font-size: 12.5px; margin-top: 4px; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.stack { display: grid; gap: 18px; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); }
.list-row:first-child { border-top: 0; padding-top: 0; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty svg { width: 34px; height: 34px; color: var(--faint); margin-bottom: 8px; }

/* ---------- milestone track (rewards) ---------- */
.track { margin: 4px 0 6px; }
.track .rail { position: relative; height: 6px; background: #1f1f1f; border-radius: 6px; margin: 18px 14px 0; }
.track .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; background: linear-gradient(90deg, #ff8a3d, var(--accent)); }
.track .node { position: absolute; top: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; background: #0a0a0a; border: 3px solid #2a2a2a; }
.track .node.on { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.track .labels { position: relative; height: 44px; margin: 0 14px; }
.track .labels div { position: absolute; transform: translateX(-50%); top: 14px; text-align: center; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.track .labels b { display: block; color: var(--text); font-size: 13px; }
.track .labels div:last-child { transform: translateX(-100%); text-align: right; }

/* ---------- chart ---------- */
.chart { width: 100%; height: 190px; display: block; }
.chart .bar { fill: var(--accent); }
.chart .bar:hover { fill: #ff9a5c; }
.chart .grid-line { stroke: rgba(255, 255, 255, 0.06); }
.chart text { fill: var(--faint); font-size: 11px; font-family: var(--body); }
.chart-tip { position: fixed; pointer-events: none; background: #000; border: 1px solid var(--line-2); padding: 7px 10px; border-radius: 8px; font-size: 12.5px; z-index: 50; display: none; }

/* ---------- ads ---------- */
.ads-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.ad-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.ad-card .thumb { aspect-ratio: 1; background: #161616 center/cover no-repeat; position: relative; }
.ad-card .thumb .pill { position: absolute; top: 10px; left: 10px; backdrop-filter: blur(6px); background: rgba(0, 0, 0, 0.6); }
.ad-card .thumb .pill.good { background: rgba(10, 40, 22, 0.8); }
.ad-card .body { padding: 14px 16px 16px; display: grid; gap: 10px; flex: 1; }
.ad-card .metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; border-top: 1px solid var(--line); padding-top: 10px; margin-top: auto; }
.ad-card .metrics div { font-size: 11.5px; color: var(--muted); }
.ad-card .metrics b { display: block; font-size: 16px; color: var(--text); font-family: var(--display); }
.clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.mini-ads { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mini-ad { display: flex; gap: 12px; align-items: center; background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.mini-ad .t { width: 58px; height: 58px; border-radius: 8px; background: #222 center/cover; flex: none; }
.mini-ad .n { font-size: 13.5px; font-weight: 600; line-height: 1.3; }

/* ---------- upload ---------- */
.drop { border: 2px dashed var(--line-2); border-radius: var(--radius); padding: 46px 20px; text-align: center; cursor: pointer; transition: 0.15s; background: #0d0d0d; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop svg { width: 42px; height: 42px; color: var(--accent); }
.drop h3 { margin: 10px 0 4px; font-size: 18px; }
.prog { height: 6px; background: #222; border-radius: 6px; overflow: hidden; margin-top: 6px; }
.prog i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }
.file-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); }
.file-row:first-child { border-top: 0; }
.file-ic { width: 34px; height: 34px; border-radius: 8px; background: var(--card-2); display: grid; place-items: center; color: var(--muted); }
.file-ic svg { width: 18px; height: 18px; }

/* ---------- onboarding ---------- */
.ob { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px; align-items: start; }
.ob-steps { position: sticky; top: 24px; display: grid; gap: 2px; }
.ob-steps button { text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: 10px; cursor: pointer; display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 14.5px; }
.ob-steps button:hover { background: var(--card); color: var(--text); }
.ob-steps button.on { background: var(--card); color: var(--text); font-weight: 600; }
.ob-steps .ck { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #333; flex: none; display: grid; place-items: center; font-size: 11px; }
.ob-steps .ck.done { background: var(--accent); border-color: var(--accent); color: #000; }
.ob-q { padding: 20px 0; border-top: 1px solid var(--line); }
.ob-q:first-of-type { border-top: 0; padding-top: 6px; }
.ob-q .qn { color: var(--accent); font-weight: 700; font-family: var(--display); margin-right: 6px; }
.ob-q label { display: block; font-weight: 600; font-size: 16px; margin-bottom: 4px; }
.ob-q .hint { color: var(--muted); font-size: 13.5px; margin: 0 0 10px; }
.yesno { display: flex; gap: 8px; }
.yesno button { flex: 0 0 90px; height: 42px; border-radius: 10px; border: 1px solid var(--line-2); background: #0d0d0d; cursor: pointer; font-weight: 600; }
.yesno button.on { background: var(--accent); border-color: var(--accent); color: #000; }
.savebar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }

/* ---------- messages ---------- */
.thread { display: grid; gap: 12px; margin-bottom: 16px; }
.bubble { max-width: 78%; padding: 12px 15px; border-radius: 14px; background: var(--card-2); border: 1px solid var(--line); white-space: pre-wrap; }
.bubble.mine { justify-self: end; background: var(--accent-soft); border-color: rgba(255, 107, 26, 0.3); }
.bubble .who { font-size: 12px; color: var(--muted); margin-bottom: 4px; }

/* ---------- leaderboard ---------- */
.lb-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 10px; }
.lb-row.me { background: var(--accent-soft); }
.lb-row .rk { font-family: var(--display); font-weight: 700; color: var(--muted); }
.lb-row.me .rk { color: var(--accent); }

/* ---------- tables (admin) ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 0 12px 10px; white-space: nowrap; }
td { padding: 12px; border-top: 1px solid var(--line); vertical-align: middle; }
td.r, th.r { text-align: right; }

/* ---------- modal / toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7); display: grid; place-items: center; z-index: 40; padding: 16px; }
.modal { background: var(--card); border: 1px solid var(--line-2); border-radius: 18px; padding: 26px; width: min(560px, 100%); max-height: 90vh; overflow: auto; }
.modal h2 { margin-bottom: 16px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #000; border: 1px solid var(--line-2); padding: 11px 18px; border-radius: 999px; z-index: 60; font-size: 14px; }
.copy-box { display: flex; gap: 8px; }
.copy-box input { font-size: 13px; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; background:
  radial-gradient(600px 400px at 20% 10%, rgba(255, 107, 26, 0.12), transparent 70%), var(--bg); }
.auth .card { width: min(420px, 100%); padding: 32px; }
.auth .logo { padding: 0 0 24px; }
.auth h1 { font-size: 28px; margin-bottom: 6px; }
.auth .btn { width: 100%; height: 46px; margin-top: 4px; }

.view-as { display: flex; align-items: center; gap: 10px; background: #1a120b; border: 1px solid rgba(255, 107, 26, 0.35); border-radius: 12px; padding: 10px 14px; margin-bottom: 22px; font-size: 14px; flex-wrap: wrap; }
.view-as select { width: auto; padding: 6px 10px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .cols-main { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 30; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform 0.2s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.6); }
  .mobile-bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--side); position: sticky; top: 0; z-index: 20; }
  .mobile-bar .logo { padding: 0; }
  .main { padding: 22px 16px 50px; }
  h1 { font-size: 27px; }
  .ob { grid-template-columns: 1fr; }
  .ob-steps { position: static; display: flex; overflow-x: auto; gap: 6px; }
  .ob-steps button { white-space: nowrap; }
  .mini-ads { grid-template-columns: 1fr; }
  .stat .value { font-size: 27px; }
  .card { padding: 18px; }
  .track .labels div { font-size: 11px; }
  .track .labels div span { display: none; }
}
