/* ============================================================
   Kappino Partners — affiliate.kappino.com
   One stylesheet for the public site, the partner dashboard and
   the admin console. Kappino's auth-page palette: teal → blue
   gradient, Poppins headings, Plus Jakarta Sans body.
   ============================================================ */
:root {
  --teal: #16b8a6;
  --blue: #3f6ef0;
  --green: #0f9d76;
  --grad: linear-gradient(135deg, var(--teal), var(--blue));
  --ink: #1a2236;
  --ink-2: #3b4560;
  --muted: #6b7690;
  --line: #e3e8f0;
  --bg: #f5f7fb;
  --card: #ffffff;
  --field: #fbfcfe;
  --ok: #15803d;
  --ok-bg: #e8f7ee;
  --warn: #a16207;
  --warn-bg: #fdf6e3;
  --bad: #b91c1c;
  --bad-bg: #fdecec;
  --info: #1d4ed8;
  --info-bg: #eaf0fe;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 6px 20px rgba(16, 24, 40, .06);
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e8ecf5; --ink-2: #c3cad9; --muted: #95a0b8; --line: #263049;
    --bg: #0b1220; --card: #111a2c; --field: #0e1627;
    --ok-bg: #0f2a1c; --warn-bg: #2a220d; --bad-bg: #2c1316; --info-bg: #121f3d;
    --ok: #4ade80; --warn: #facc15; --bad: #f87171; --info: #8fb0ff;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .brand { font-family: 'Poppins', 'Plus Jakarta Sans', sans-serif; letter-spacing: -0.01em; }
h1 { font-size: clamp(26px, 4vw, 40px); line-height: 1.15; margin: 0 0 12px; }
h2 { font-size: 20px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 0 0 8px; }
p { margin: 0 0 12px; }
a { color: var(--blue); }
small, .muted { color: var(--muted); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 12px clamp(16px, 4vw, 32px);
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--ink); text-decoration: none; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.brand span b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.topbar .spacer { flex: 1; }
@media (max-width: 640px) {
  .topbar { gap: 10px; }
  .topbar nav .muted { display: none; }
  .brand { font-size: 15px; white-space: nowrap; }
}
@media (max-width: 480px) { .brand span { display: none; } }
.topbar nav { display: flex; gap: 8px; align-items: center; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .08s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn.primary { background: var(--grad); color: #fff; border-color: transparent; }
.btn.danger { background: var(--bad); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn.full { width: 100%; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after {
  content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.6); border-top-color: transparent; animation: spin .7s linear infinite;
}
.btn:not(.primary):not(.danger).loading::after { border-color: var(--muted); border-top-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- layout ---------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 24px clamp(16px, 4vw, 32px) 64px; }
.narrow { max-width: 620px; margin: 0 auto; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: clamp(18px, 3vw, 26px);
}
.card + .card { margin-top: 16px; }
.grid > .card + .card, .feature-grid > .card + .card { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }

/* ---------- forms ---------- */
.field { display: block; margin-bottom: 14px; }
.field > label, .label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 6px; color: var(--ink-2); }
.field .req { color: var(--bad); }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=url], input[type=number], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--field); color: var(--ink); font: inherit; outline: none;
}
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 18%, transparent); }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 560px) { .two-col { grid-template-columns: 1fr; } }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check { position: relative; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check span {
  display: inline-block; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--field); cursor: pointer; font-size: 13.5px; user-select: none;
}
.chip-check input:checked + span { background: var(--grad); color: #fff; border-color: transparent; }
.chip-check input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.otp { letter-spacing: 10px; font-size: 24px; text-align: center; font-family: ui-monospace, Menlo, monospace; }
.inline-check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.inline-check input { margin-top: 3px; }

/* ---------- steps ---------- */
.steps { display: flex; gap: 6px; margin: 4px 0 22px; flex-wrap: wrap; }
.steps .s { flex: 1 1 90px; font-size: 12px; color: var(--muted); }
.steps .s i { display: block; height: 4px; border-radius: 4px; background: var(--line); margin-bottom: 6px; }
.steps .s.on i { background: var(--grad); }
.steps .s.on { color: var(--ink); font-weight: 600; }

/* ---------- notices ---------- */
.notice { padding: 12px 14px; border-radius: 10px; font-size: 14px; border: 1px solid transparent; }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.bad { background: var(--bad-bg); color: var(--bad); }
.notice.info { background: var(--info-bg); color: var(--info); }
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--line); color: var(--ink-2); white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }

/* ---------- KPIs ---------- */
.kpi { padding: 16px 18px; }
.kpi .k { font-size: 12.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi .v { font-family: 'Poppins', sans-serif; font-size: 26px; font-weight: 700; margin-top: 4px; }
.kpi .s { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.kpi.accent { background: var(--grad); color: #fff; border-color: transparent; }
.kpi.accent .k, .kpi.accent .s { color: rgba(255,255,255,.85); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.click { cursor: pointer; }
tr.click:hover td { background: color-mix(in srgb, var(--blue) 5%, transparent); }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }

/* ---------- app shell (dashboard + admin) ---------- */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 20px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs a.on { color: var(--ink); border-bottom-color: var(--blue); }
.tabs a .count { margin-left: 6px; }
.codebox {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px;
  border: 1px dashed var(--line); background: var(--field);
}
.codebox .code { font-family: ui-monospace, Menlo, monospace; font-size: 22px; font-weight: 700; letter-spacing: 2px; flex: 1; }
.codebox .link { font-size: 13px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* bars */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 8px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bars .b i { display: block; width: 100%; max-width: 34px; border-radius: 6px 6px 2px 2px; background: var(--grad); min-height: 2px; }
.bars .b span { font-size: 11px; color: var(--muted); margin-top: 6px; white-space: nowrap; }
.bars .b em { font-style: normal; font-size: 11px; color: var(--ink-2); margin-bottom: 4px; white-space: nowrap; }

/* ---------- modal / drawer ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(8, 14, 28, .5); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; }
.drawer-overlay { justify-content: flex-end; padding: 0; align-items: stretch; }
.drawer { width: min(720px, 100%); height: 100%; overflow: auto; border-radius: 0; }
.dl { display: grid; grid-template-columns: 170px 1fr; gap: 6px 14px; font-size: 14px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; word-break: break-word; }
@media (max-width: 560px) { .dl { grid-template-columns: 1fr; } .dl dt { margin-top: 6px; } }

/* ---------- toasts ---------- */
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
.toast {
  background: var(--ink); color: var(--card); padding: 11px 14px; border-radius: 10px; font-size: 14px;
  box-shadow: var(--shadow); max-width: 380px; animation: tin .2s ease;
}
.toast.bad { background: var(--bad); color: #fff; }
.toast.ok { background: var(--green); color: #fff; }
@keyframes tin { from { opacity: 0; transform: translateY(6px); } }

/* ---------- landing ---------- */
.hero {
  background: radial-gradient(1200px 500px at 10% -10%, rgba(22,184,166,.35), transparent 60%),
              radial-gradient(900px 500px at 100% 0%, rgba(63,110,240,.35), transparent 60%), #08131f;
  color: #fff; padding: clamp(48px, 9vw, 110px) clamp(16px, 4vw, 32px);
}
.hero .inner { max-width: 1120px; margin: 0 auto; display: grid; gap: 32px; grid-template-columns: 1.3fr 1fr; align-items: center; }
@media (max-width: 860px) { .hero .inner { grid-template-columns: 1fr; } }
.hero p.lead { font-size: 18px; color: rgba(255,255,255,.82); max-width: 560px; }
.hero .earn {
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); border-radius: 18px;
  padding: 24px; backdrop-filter: blur(6px);
}
.hero .earn .big { font-family: 'Poppins', sans-serif; font-size: 44px; font-weight: 800; }
.hero .btn:not(.primary) { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.feature-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.feature .n {
  width: 34px; height: 34px; border-radius: 10px; background: var(--grad); color: #fff; font-weight: 700;
  display: grid; place-items: center; margin-bottom: 10px; font-family: 'Poppins', sans-serif;
}
.types { display: flex; flex-wrap: wrap; gap: 8px; }
footer.site { text-align: center; color: var(--muted); font-size: 13px; padding: 28px 16px; border-top: 1px solid var(--line); }
.center-page { min-height: calc(100vh - 60px); display: flex; align-items: flex-start; justify-content: center; padding: clamp(20px, 6vh, 64px) 16px; }
.center-page > .card { width: min(460px, 100%); }
.center-page > .card.wide { width: min(720px, 100%); }
.qr { display: block; margin: 8px auto; border-radius: 10px; background: #fff; padding: 6px; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; font-family: ui-monospace, Menlo, monospace; font-size: 14px; }
.codes span { padding: 6px 8px; background: var(--field); border: 1px solid var(--line); border-radius: 6px; text-align: center; }
