/* ==========================================================================
   FrameworkBisnes — shared design system
   One stylesheet across all surfaces (main, storefront, dashboard, join,
   training, admin). Light + dark aware. Money/growth = emerald accent.
   ========================================================================== */

:root {
  --ink:      #0f172a;
  --ink-soft: #334155;
  --muted:    #64748b;
  --line:     #e2e8f0;
  --line-2:   #eef2f7;
  --bg:       #ffffff;
  --bg-soft:  #f8fafc;
  --bg-sunk:  #f1f5f9;

  --brand:    #4f46e5;   /* indigo */
  --brand-2:  #3730a3;
  --brand-ink:#312e81;
  --brand-wash:#eef2ff;

  --money:    #10b981;   /* emerald — commissions, growth, RM */
  --money-2:  #059669;
  --money-wash:#ecfdf5;

  --gold:     #f59e0b;
  --danger:   #ef4444;
  --danger-wash:#fef2f2;

  --radius:   14px;
  --radius-sm:10px;
  --radius-lg:22px;
  --shadow:   0 1px 2px rgba(15,23,42,.04), 0 8px 24px -12px rgba(15,23,42,.18);
  --shadow-lg:0 24px 60px -20px rgba(49,46,129,.35);
  --ring:     0 0 0 3px rgba(79,70,229,.18);

  --maxw: 1120px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink:#f1f5f9; --ink-soft:#cbd5e1; --muted:#94a3b8;
    --line:#1e293b; --line-2:#172033; --bg:#0b1120; --bg-soft:#0f172a; --bg-sunk:#111a2e;
    --brand:#818cf8; --brand-2:#a5b4fc; --brand-ink:#c7d2fe; --brand-wash:#1e1b4b;
    --money:#34d399; --money-2:#6ee7b7; --money-wash:#052e26;
    --danger-wash:#3f1d1d;
    --shadow:0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.6);
    --shadow-lg:0 24px 60px -20px rgba(0,0,0,.7);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); color: var(--ink);
  background: var(--bg); line-height: 1.55; font-size: 16px;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: clip;   /* guard against phantom horizontal scroll from wide children */
}
img { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1,h2,h3,h4 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.02em; font-weight: 800; }
h1 { font-size: clamp(2rem, 5vw, 3.25rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.25rem); }
p { margin: 0 0 1rem; }
small { color: var(--muted); }

.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: 20px; }
.wrap-narrow { max-width: 760px; margin-inline: auto; padding-inline: 20px; }
.section { padding: clamp(48px, 8vw, 96px) 0; }
.center { text-align: center; }
.muted { color: var(--muted); }
.money { color: var(--money-2); }
.nowrap { white-space: nowrap; }
.hide { display: none !important; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  font: inherit; font-weight: 700; font-size: .98rem; cursor: pointer;
  padding: .82em 1.4em; border-radius: 999px; border: 1px solid transparent;
  background: var(--brand); color: #fff; transition: .16s ease; text-decoration: none;
  line-height: 1;
}
.btn:hover { background: var(--brand-2); text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-money { background: var(--money); }
.btn-money:hover { background: var(--money-2); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg-sunk); }
.btn-light { background: #fff; color: var(--brand-ink); }
.btn-light:hover { background: #f4f4ff; }
.btn-sm { padding: .55em 1em; font-size: .85rem; }
.btn-block { display: flex; width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- pills / badges ---------- */
.pill {
  display: inline-flex; align-items: center; gap: .4em; font-size: .74rem; font-weight: 700;
  padding: .38em .8em; border-radius: 999px; background: var(--brand-wash); color: var(--brand-ink);
  letter-spacing: .01em;
}
.pill-money { background: var(--money-wash); color: var(--money-2); }
.pill-gold  { background: #fef3c7; color: #92400e; }
.pill-line  { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display:inline-block; }

.tag-status { font-size:.72rem; font-weight:700; padding:.25em .6em; border-radius:6px; }
.tag-active { background: var(--money-wash); color: var(--money-2); }
.tag-pending{ background:#fff7ed; color:#c2410c; }
.tag-banned { background: var(--danger-wash); color: var(--danger); }

/* ---------- cards ---------- */
.card {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px;
}
.card-soft { background: var(--bg-soft); border-color: var(--line-2); box-shadow: none; }
.grid { display: grid; gap: 20px; }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px){ .g-3, .g-4 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 620px){ .g-2, .g-3, .g-4 { grid-template-columns: 1fr; } }

/* ---------- top nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line);
}
.nav-in { display: flex; align-items: center; gap: 18px; height: 62px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 900; letter-spacing: -.03em;
  color: var(--ink); font-size: 1.12rem; }
.brand:hover { text-decoration: none; }
.brand .mark { width: 30px; height: 30px; border-radius: 9px; display:grid; place-items:center;
  background: linear-gradient(135deg, var(--brand), var(--money)); color:#fff; font-weight:900; font-size:1rem; }
.brand em { font-style: normal; color: var(--brand); }
.nav-links { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav-links a { color: var(--ink-soft); font-weight: 600; font-size: .92rem; padding: .5em .8em; border-radius: 8px; }
.nav-links a:hover { background: var(--bg-sunk); text-decoration: none; color: var(--ink); }
@media (max-width: 760px){ .nav-links a.hide-sm { display:none; } }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; }
.hero-bg {
  position:absolute; inset:0; z-index:-1;
  background:
    radial-gradient(60% 90% at 80% -10%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 60%),
    radial-gradient(50% 80% at 5% 10%, color-mix(in srgb, var(--money) 16%, transparent), transparent 55%);
}
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .76rem; font-weight: 800; color: var(--brand); }

/* ---------- stats ---------- */
.stat { padding: 18px 20px; }
.stat .n { font-size: 1.8rem; font-weight: 900; letter-spacing: -.03em; }
.stat .l { color: var(--muted); font-size: .82rem; font-weight: 600; }

/* ---------- forms ---------- */
label { font-weight: 600; font-size: .88rem; display: block; margin-bottom: 6px; color: var(--ink-soft); }
.input, select, textarea {
  width: 100%; font: inherit; padding: .72em .9em; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); transition: .15s;
}
.input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.field { margin-bottom: 16px; }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--bg-soft); font-weight: 800; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-soft); }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--line); background: var(--bg-soft); padding: 40px 0; color: var(--muted); font-size: .88rem; }
.foot a { color: var(--ink-soft); }

/* ---------- utility ---------- */
.stack > * + * { margin-top: var(--gap, 14px); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.divider { height: 1px; background: var(--line); margin: 24px 0; border: 0; }
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: .8em 1.3em; border-radius: 999px; font-weight: 600;
  font-size: .9rem; opacity: 0; pointer-events: none; transition: .25s; z-index: 200; box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.copybox { display:flex; gap:8px; align-items:center; flex-wrap:wrap; background:var(--bg-sunk); border:1px solid var(--line);
  border-radius: var(--radius-sm); padding: 8px 8px 8px 14px; font-size:.86rem; }
.copybox code { flex:1 1 140px; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--ink-soft); font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.copybox .btn { flex:0 0 auto; }
