/* ── Partner Studio — standalone dark SaaS cabinet ───────────── */
:root {
  --bg:        #0d1117;
  --bg-2:      #161b22;
  --card:      #161b22;
  --card-2:    #1c232c;
  --border:    #2a313c;
  --border-2:  #353d49;
  --text:      #e6edf3;
  --text-dim:  #9aa6b2;
  --text-mute: #6e7a89;
  --accent:    #14b8a6;
  --accent-2:  #0d9488;
  --accent-soft: rgba(20, 184, 166, .12);
  --danger:    #f87171;
  --warn:      #fbbf24;
  --ok:        #34d399;
  --radius:    14px;
  --radius-sm: 9px;
  --shadow:    0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.25);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
               Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[hidden] { display: none !important; }

/* ── Brand ──────────────────────────────────────────────────── */
.brand { display: flex; align-items: center; gap: 10px; }
.brand__mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #06231f; font-weight: 800; font-size: 17px;
}
.brand__name { font-weight: 700; letter-spacing: -.01em; font-size: 18px; }
.brand--lg { justify-content: center; margin-bottom: 4px; }
.brand--lg .brand__mark { width: 40px; height: 40px; font-size: 22px; border-radius: 11px; }
.brand--lg .brand__name { font-size: 24px; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  appearance: none; border: 1px solid transparent; cursor: pointer;
  font: inherit; font-weight: 600; border-radius: var(--radius-sm);
  padding: 10px 18px; color: var(--text); background: var(--card-2);
  transition: background .15s, border-color .15s, opacity .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn--primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #06231f;
}
.btn--primary:hover { filter: brightness(1.07); }
.btn--ghost { background: transparent; border-color: var(--border-2); color: var(--text-dim); }
.btn--ghost:hover { color: var(--text); border-color: var(--text-mute); }
.btn--block { width: 100%; }
.btn--sm { padding: 7px 14px; font-size: 14px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:disabled:active { transform: none; }

/* ── States (loading / error / boot) ────────────────────────── */
.state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 64px 20px; text-align: center; color: var(--text-dim);
}
.state--boot { min-height: 100vh; }
.state__title { font-weight: 700; color: var(--text); font-size: 17px; margin: 0; }
.state__detail { color: var(--text-mute); margin: 0; font-size: 14px; max-width: 420px; }
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--border-2); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Login ──────────────────────────────────────────────────── */
.login-view {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 380px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 32px 28px;
  display: flex; flex-direction: column; gap: 16px;
}
.login-sub {
  text-align: center; color: var(--text-dim); margin: 0 0 6px; font-size: 14px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 13px; color: var(--text-dim); font-weight: 600; }
.field input {
  background: var(--bg); border: 1px solid var(--border-2); color: var(--text);
  border-radius: var(--radius-sm); padding: 11px 13px; font: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder { color: var(--text-mute); }
.field input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.login-error {
  margin: -4px 0 0; color: var(--danger); font-size: 13.5px; text-align: center;
}

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; background: rgba(13,17,23,.85);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}

/* ── Layout ─────────────────────────────────────────────────── */
.container { max-width: 920px; margin: 0 auto; padding: 24px 20px 48px; }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}

/* ── KPI ────────────────────────────────────────────────────── */
.kpis {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 14px;
}
.kpi { display: flex; flex-direction: column; gap: 6px; }
.kpi__label { font-size: 13px; color: var(--text-dim); font-weight: 600; }
.kpi__value { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.kpi__sub { font-size: 13px; color: var(--text-mute); }

/* ── Payout bar ─────────────────────────────────────────────── */
.payout-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 14px; flex-wrap: wrap;
}
.payout-bar__text { display: flex; flex-direction: column; gap: 3px; }
.payout-bar__title { font-weight: 700; }
.payout-bar__hint { font-size: 13.5px; color: var(--text-dim); }
.payout-bar__hint strong { color: var(--text); font-weight: 700; }

/* ── Sections ───────────────────────────────────────────────── */
.section { margin-bottom: 14px; }
.section__title { font-size: 16px; font-weight: 700; margin: 0 0 14px; }

/* ── Table ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th, .table td {
  padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border);
}
.table th {
  color: var(--text-dim); font-weight: 600; font-size: 13px;
  text-transform: none; white-space: nowrap;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--card-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.fmt-name { font-weight: 600; }

/* ── History ────────────────────────────────────────────────── */
.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.history li {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.history li:last-child { border-bottom: none; }
.history__main { display: flex; flex-direction: column; gap: 2px; }
.history__amount { font-weight: 700; font-variant-numeric: tabular-nums; }
.history__usdt { font-size: 13px; color: var(--text-mute); }
.history__meta { display: flex; align-items: center; gap: 10px; }
.history__date { font-size: 13px; color: var(--text-dim); }

.badge {
  font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--border-2); color: var(--text-dim); white-space: nowrap;
}
.badge--ok { color: var(--ok); border-color: rgba(52,211,153,.4); background: rgba(52,211,153,.08); }
.badge--warn { color: var(--warn); border-color: rgba(251,191,36,.4); background: rgba(251,191,36,.08); }

.empty { color: var(--text-mute); font-size: 14px; text-align: center; padding: 8px 0; margin: 0; }

/* ── Footer ─────────────────────────────────────────────────── */
.footer { margin-top: 20px; text-align: center; color: var(--text-mute); font-size: 13px; }

/* ── Toasts ─────────────────────────────────────────────────── */
.toasts {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 50; display: flex; flex-direction: column; gap: 8px;
  width: calc(100% - 32px); max-width: 420px; pointer-events: none;
}
.toast {
  pointer-events: auto; background: var(--card-2); border: 1px solid var(--border-2);
  color: var(--text); border-radius: var(--radius-sm); padding: 12px 16px;
  font-size: 14px; box-shadow: var(--shadow);
  animation: toast-in .2s ease-out;
}
.toast--ok { border-color: rgba(52,211,153,.5); }
.toast--err { border-color: rgba(248,113,113,.5); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 620px) {
  .kpis { grid-template-columns: 1fr; }
  .kpi__value { font-size: 23px; }
  .payout-bar { flex-direction: column; align-items: stretch; }
  .payout-bar #payout-btn { width: 100%; }
  .container { padding: 18px 14px 40px; }
}
