: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-rgb: 255 107 26;
  --accent-ink: #0a0a0a;
  --accent-hi: #ff8a3d;
  --banner-bg: #2a1a0c;
  --banner-text: #ffd9c2;
  --tint-bg: #1a120b;
  --display-scale: 1;
  --display-track: -0.01em;
  --accent-soft: rgb(var(--accent-rgb) / 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: var(--display-track); }
h1 { font-size: calc(34px * var(--display-scale)); line-height: 1.1; font-weight: 700; }
h2 { font-size: calc(20px * var(--display-scale)); 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: var(--banner-bg); border-bottom: 1px solid rgb(var(--accent-rgb) / 0.3); color: var(--banner-text); 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: var(--accent-ink); 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.bad { background: rgba(255, 93, 93, 0.14); color: var(--bad); 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, var(--accent-hi), 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; }
/* reward artwork in the milestone circles: zoomed in on the reward itself */
.track.pics .rail { margin: 40px 38px 0; }
.track.pics .labels { margin: 0 38px; height: 78px; }
.track.pics .labels div { top: 40px; width: 118px; white-space: normal; line-height: 1.25; }
.track.pics .labels div:last-child { transform: translateX(-50%); text-align: center; }
.track .node.pic { width: 68px; height: 68px; margin: -34px 0 0 -34px; padding: 0; background: #111; border: 3px solid #2a2a2a; z-index: 1; }
.track .node.pic .ph { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; }
.track .node.pic img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.55); display: block; }
.track .node.pic:not(.on) img { filter: grayscale(1) brightness(.5); }
.track .node.pic.on { background: #111; border-color: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft), 0 0 18px rgb(var(--accent-rgb) / .35); }
.track .node.pic .badge { position: absolute; right: -4px; bottom: -4px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: #1b1b1b; border: 2px solid #0a0a0a; color: var(--muted); }
.track .node.pic.on .badge { background: var(--accent); color: #0a0a0a; font-size: 13px; }
.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: var(--accent-hi); }
.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: rgb(var(--accent-rgb) / 0.3); }
.bubble.pending { opacity: 0.7; }
.bubble.failed { border-color: var(--bad); }
.bubble.failed a { color: var(--bad); font-weight: 600; }
.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%, rgb(var(--accent-rgb) / 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: var(--tint-bg); border: 1px solid rgb(var(--accent-rgb) / 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; }
  .track.pics .rail { margin: 28px 24px 0; }
  .track.pics .labels { margin: 0 24px; height: 40px; }
  .track.pics .labels div { top: 28px; }
  .track .node.pic { width: 44px; height: 44px; margin: -22px 0 0 -22px; }
  .track .node.pic .badge { width: 18px; height: 18px; font-size: 9px; right: -5px; bottom: -5px; }
}

/* ---------- in-portal ad preview (Facebook-feed look) ---------- */
.modal.modal-fbp { width: min(500px, 100%); padding: 16px; background: #18191a; }
.fbp { background: #242526; border-radius: 12px; overflow: hidden; color: #e4e6eb; font-family: Helvetica, Arial, var(--body); }
.fbp-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px 8px; position: relative; }
.fbp-av { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #0a0a0a; display: grid; place-items: center; font-weight: 800; font-size: 15px; flex: none; }
.fbp-name { font-weight: 700; font-size: 15px; }
.fbp-sub { font-size: 12.5px; color: #b0b3b8; }
.fbp-x { position: absolute; right: 10px; top: 10px; background: #3a3b3c; border: 0; color: #e4e6eb; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; }
.fbp-body { padding: 4px 14px 10px; font-size: 15px; line-height: 1.38; white-space: pre-wrap; }
.fbp-body.clamped { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; }
.fbp-more { background: none; border: 0; color: #b0b3b8; font-weight: 600; padding: 0 14px 10px; cursor: pointer; font-size: 14px; }
.fbp-media { position: relative; background: #000; cursor: pointer; }
.fbp-media img, .fbp-media video { width: 100%; display: block; max-height: 70vh; object-fit: contain; background: #000; }
.fbp-play { position: absolute; inset: 0; margin: auto; width: 68px; height: 68px; border-radius: 50%; background: rgba(0,0,0,.6); border: 2px solid #fff; color: #fff; display: grid; place-items: center; font-size: 26px; }
.fbp-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #3a3b3c; padding: 10px 14px; }
.fbp-head2 { font-weight: 700; font-size: 15px; }
.fbp-cta { background: #4e4f50; color: #e4e6eb; border-radius: 6px; padding: 8px 12px; font-weight: 600; font-size: 14px; white-space: nowrap; text-transform: capitalize; }
.fbp-react { display: flex; justify-content: space-around; padding: 8px 6px; color: #b0b3b8; font-weight: 600; font-size: 14px; border-top: 1px solid #3e4042; }

/* ---------- weekly report ---------- */
.qrow { display: flex; gap: 8px; flex-wrap: wrap; }
.qbtn { position: relative; cursor: pointer; }
.qbtn input { position: absolute; opacity: 0; pointer-events: none; }
.qbtn span { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line-2); background: #0d0d0d; font-weight: 600; }
.qbtn input:checked + span { background: var(--accent); border-color: var(--accent); color: #0a0a0a; }
.qbtn input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }
@media (max-width: 900px) { #repGrid { grid-template-columns: minmax(0, 1fr) !important; } }

/* ---------- customers ---------- */
.cust { display: flex; justify-content: space-between; gap: 14px; align-items: center; padding: 13px 0; border-top: 1px solid var(--line); }
.cust:first-child { border-top: 0; }
.cust-main { min-width: 0; display: grid; gap: 3px; }
.cust-name { font-weight: 600; }
.cust-actions { display: flex; gap: 8px; align-items: center; flex: none; }
.pill-select { width: auto; padding: 6px 28px 6px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--card-2); }
.pill-select.good { color: var(--good); border-color: rgba(60, 207, 122, .35); }
.pill-select.warn { color: var(--warn); border-color: rgba(245, 196, 67, .35); }
.pill-select.accent { color: var(--accent); border-color: rgb(var(--accent-rgb) / .35); }
.pill-select.bad { color: var(--bad); border-color: rgba(255, 93, 93, .35); }
#custFilter button span { margin-left: 2px; }
@media (max-width: 820px) {
  .cust { flex-direction: column; align-items: stretch; }
  .cust-actions { flex-wrap: wrap; }
  #custFilter { overflow-x: auto; max-width: 100%; }
}
