/* ---------- tokens (copied from the main app) ---------- */
:root {
  --ink: #0c211a;
  --mint: #d6ffe5;
  --lime: #e8ff2b;
  --forest: #08913f;
  --danger: #ff6b6b;
  --font-sans: "Outfit", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Space Mono", ui-monospace, SFMono-Regular, monospace;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background: #fff;
  -webkit-font-smoothing: antialiased;
}

body.login-mode { background: var(--mint); }

button { cursor: pointer; font: inherit; }

:focus-visible { outline: 3px solid var(--forest); outline-offset: 2px; }

/* ---------- animations (mirrored) ---------- */
@keyframes pop {
  from { opacity: 0; transform: scale(0.92) translateY(10px); }
  to   { opacity: 1; transform: none; }
}
@keyframes rowIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.animate-pop { animation: pop 0.3s cubic-bezier(0.2, 1.3, 0.4, 1) both; }
.animate-row { animation: rowIn 0.35s cubic-bezier(0.2, 0.7, 0.2, 1) both; }

/* ---------- neo / neo-sm ---------- */
.neo    { border: 2px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); }
.neo-sm { border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); }

.panel-dark { background: var(--ink); color: #fff; }
.pill-lime  {
  display: inline-flex; align-items: center;
  padding: 2px 8px; background: var(--lime);
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
}

/* ---------- buttons ---------- */
.btn-lime, .btn-outline, .menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  padding: 8px 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background-color 0.15s ease;
}
.btn-lime, .menu-btn { background: var(--lime); color: var(--ink); }
.btn-lime:hover:not(:disabled), .menu-btn:hover:not(:disabled) {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--ink);
}
.btn-lime:active:not(:disabled), .menu-btn:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 var(--ink);
}
.btn-outline { background: #fff; color: var(--ink); }
.btn-outline:hover:not(:disabled) { background: rgba(12, 33, 26, 0.05); }
.btn-lg   { padding: 12px 22px; font-size: 13px; }
.btn-compact { padding: 6px 12px; font-size: 11px; }
.menu-btn.danger { background: var(--danger); color: #fff; }
.menu-btn:disabled, .btn-lime:disabled, .btn-outline:disabled {
  opacity: 0.55; cursor: not-allowed;
}
.btn-lime { width: 100%; }

/* ---------- fields ---------- */
.field {
  width: 100%;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--mint);
  padding: 12px 20px;
  font-size: 15px;
  outline: none;
}
.field:focus { box-shadow: 0 0 0 3px var(--lime); }
.code-field { text-align: center; letter-spacing: 0.3em; font-family: var(--font-mono); }
.select-compact { padding: 8px 14px; width: auto; font-size: 13px; border-radius: 999px; }
.label { display: block; font-family: var(--font-mono); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.label .field { margin-top: 6px; }
.checkline { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; }
.textlink { background: none; border: 0; padding: 0; font-size: 12px; text-decoration: underline; color: var(--ink); }
.muted-sm { font-size: 13px; }

/* ---------- link-slide ---------- */
.topbar-nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  background: linear-gradient(currentColor, currentColor) left bottom / 0 2px no-repeat;
  transition: background-size 0.25s ease;
  padding-bottom: 2px;
}
.topbar-nav a:hover { background-size: 100% 2px; }
.topbar-nav a.is-active { font-weight: 700; background-size: 100% 2px; }

/* ---------- login ---------- */
.login-shell {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 16px; }
.login-head { padding: 22px; text-align: center; }
.login-eyebrow {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--lime); margin: 0 0 4px;
}
.login-title { margin: 0; font-size: 24px; font-weight: 800; text-transform: uppercase; }
.login-sub { margin: 8px 0 0; font-size: 12px; font-weight: 300; color: rgba(255, 255, 255, 0.7); }
.login-body { background: #fff; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.login-submit { margin-top: 4px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.form-error { margin: 4px 0 0; font-size: 12px; font-weight: 700; color: #b91c1c; }
.login-foot { text-align: center; font-family: var(--font-mono); font-size: 10px; color: rgba(12, 33, 26, 0.6); margin: 0; }
.login-foot code { background: rgba(12, 33, 26, 0.08); padding: 1px 4px; border-radius: 3px; }

/* ---------- shell ---------- */
.topbar {
  position: sticky; top: 16px; z-index: 30;
  margin: 16px auto 0; max-width: 1120px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; background: #fff; padding: 10px 18px;
}
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { font-weight: 800; font-size: 18px; letter-spacing: -0.01em; }
.topbar-nav { display: flex; gap: 26px; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.who-name { font-size: 13px; font-weight: 700; }
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 999px;
  background: var(--lime); font-family: var(--font-mono); font-size: 10px;
  font-weight: 700; border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink);
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.container { max-width: 1120px; margin: 0 auto; padding: 32px 18px 80px; }
.page { display: flex; flex-direction: column; gap: 14px; animation: fade 0.2s ease-out both; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-title { margin: 0; font-size: 22px; font-weight: 800; text-transform: uppercase; }
.page-sub { margin: 4px 0 0; font-size: 13px; font-weight: 300; }
.page-actions { display: flex; gap: 10px; align-items: center; }

/* ---------- table ---------- */
.table-wrap { overflow: hidden; background: #fff; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px 16px; text-align: left; font-size: 13px; }
.data-table thead th {
  font-family: var(--font-mono); font-size: 10px; text-transform: uppercase;
  font-weight: 700; background: var(--mint); border-bottom: 2px solid var(--ink);
}
.data-table tbody tr + tr td { border-top: 1px solid rgba(12, 33, 26, 0.12); }
.data-table td.right, .data-table th.right { text-align: right; }
.data-table td.empty { text-align: center; padding: 32px; color: rgba(12, 33, 26, 0.55); }
.cell-user { display: flex; flex-direction: column; gap: 2px; }
.cell-user b { font-weight: 700; }
.cell-user small { font-size: 11px; color: rgba(12, 33, 26, 0.6); }

/* status pill */
.status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  border: 2px solid var(--ink);
}
.status.pending { background: var(--lime); }
.status.processing { background: #fff3c4; }
.status.completed { background: var(--mint); }
.status.failed { background: #ffe0e0; }
.status.rejected { background: #ffd6d6; }
.status.approved { background: var(--mint); }

.row-actions { display: inline-flex; gap: 6px; justify-content: flex-end; }
.row-actions .menu-btn { padding: 5px 12px; font-size: 11px; }

.pager { display: flex; align-items: center; gap: 10px; justify-content: center; padding-top: 6px; }
.pager button { border: 2px solid var(--ink); background: #fff; border-radius: 999px; padding: 4px 12px; font-family: var(--font-mono); font-size: 11px; font-weight: 700; }
.pager button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- super affiliate cards ---------- */
.sa-list { display: flex; flex-direction: column; gap: 14px; }
.sa-card { background: #fff; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.sa-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sa-who { display: flex; flex-direction: column; gap: 2px; }
.sa-who b { font-size: 15px; }
.sa-who small { font-size: 12px; color: rgba(12, 33, 26, 0.6); }
.sa-sections { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sa-sections > div { background: rgba(214, 255, 229, 0.5); border: 2px solid var(--ink); padding: 10px 12px; font-size: 13px; }
.sa-sections h4 { margin: 0 0 4px; font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; }
.sa-sections p { margin: 0; font-weight: 300; white-space: pre-wrap; }
.sa-links { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; }
.sa-links a { color: var(--forest); text-decoration: underline; word-break: break-all; }
.sa-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(12, 33, 26, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: fade 0.15s ease-out both;
}
.modal {
  width: 100%; max-width: 780px; max-height: calc(100vh - 40px);
  background: #fff; display: flex; flex-direction: column;
  overflow: hidden; animation: pop 0.25s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}
.modal-head {
  padding: 14px 18px; border-bottom: 2px solid var(--ink);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--mint);
}
.modal-title { margin: 0; font-size: 16px; font-weight: 800; text-transform: uppercase; }
.modal-close {
  border: 2px solid var(--ink); background: #fff; width: 32px; height: 32px;
  border-radius: 999px; font-family: var(--font-mono); font-weight: 700;
}
.modal-body { padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.modal-foot {
  padding: 14px 18px; border-top: 2px solid var(--ink);
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  background: #fff;
}

/* investigate modal sections */
.inv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .inv-grid { grid-template-columns: 1fr; } .sa-sections { grid-template-columns: 1fr; } }
.inv-block { border: 2px solid var(--ink); padding: 12px 14px; background: rgba(214, 255, 229, 0.35); }
.inv-block h4 { margin: 0 0 8px; font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
.inv-block dl { margin: 0; display: grid; grid-template-columns: 120px 1fr; gap: 4px 10px; font-size: 13px; }
.inv-block dt { font-weight: 700; color: rgba(12, 33, 26, 0.75); }
.inv-block dd { margin: 0; }

.inv-list { display: flex; flex-direction: column; gap: 6px; }
.inv-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; border: 2px solid var(--ink); background: #fff; font-size: 12px;
}
.inv-item small { color: rgba(12, 33, 26, 0.6); font-family: var(--font-mono); font-size: 10px; }

.reject-field { display: flex; flex-direction: column; gap: 6px; }
.reject-field textarea {
  border: 2px solid var(--ink); border-radius: 14px; padding: 10px 14px;
  font-family: var(--font-sans); font-size: 14px; resize: vertical; min-height: 90px;
  background: var(--mint);
}
.reject-field textarea:focus { outline: none; box-shadow: 0 0 0 3px var(--lime); }

/* ---------- toasts ---------- */
.toasts {
  position: fixed; bottom: 16px; right: 16px; z-index: 100;
  display: flex; flex-direction: column; gap: 8px; width: 320px; pointer-events: none;
}
.toast {
  border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--ink);
  padding: 10px 14px; font-size: 13px; font-weight: 700;
  animation: pop 0.2s ease-out both;
}
.toast.ok  { background: var(--lime); }
.toast.err { background: var(--danger); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

.hidden, [hidden] { display: none !important; }