/* ─── Reset / base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  color: var(--txt);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; }
input, textarea, button { font-family: inherit; }
input, textarea { color: inherit; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hi); }

.hidden { display: none !important; }

/* accessible keyboard focus ring for all interactive controls */
:where(a, button, input, textarea, select, [tabindex]):focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* inline icon glyphs (SVG) used inside buttons */
.ic {
  width: 15px; height: 15px;
  flex: 0 0 auto;
  display: inline-block;
  vertical-align: -2px;
  stroke: currentColor;
}

.app-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  color: var(--txt);
  background: var(--bg);
  transition: opacity .35s ease, visibility .35s ease;
}
.app-loader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.loader-brand {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .02em;
}
.loader-mark {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 28px;
}
.loader-mark span {
  width: 7px;
  height: 14px;
  border-radius: 4px;
  background: var(--blue);
  animation: loaderBounce .9s ease-in-out infinite;
}
.loader-mark span:nth-child(2) { animation-delay: .15s; }
.loader-mark span:nth-child(3) { animation-delay: .3s; }
@keyframes loaderBounce {
  0%, 60%, 100% { transform: scaleY(.65); opacity: .55; }
  30% { transform: scaleY(1.35); opacity: 1; }
}

/* ─── Theme tokens ─────────────────────────────────────────────────────── */
:root[data-theme="light"] {
  --bg:           #fafafa;
  --bg-surface:   #ffffff;
  --bg-elevated:  #f3f4f6;
  --bg-hover:     #eef0f3;
  --bg-sel:       #e2e8f0;
  --border:       #e5e7eb;
  --border-mid:   #d1d5db;
  --border-hi:    #9ca3af;
  --txt:          #0f172a;
  --txt-2:        #334155;
  --txt-dim:      #6b7280;
  --accent:       #0f172a;
  --accent-soft:  #1e293b;
  --blue:         #2563eb;
  --blue-2:       #1d4ed8;
  --green:        #16a34a;
  --amber:        #d97706;
  --red:          #dc2626;
  --shadow-sm:    0 1px 2px rgba(15,23,42,.04), 0 1px 1px rgba(15,23,42,.03);
  --shadow:       0 4px 12px rgba(15,23,42,.06), 0 2px 4px rgba(15,23,42,.04);
  --radius:       8px;
  --radius-sm:    6px;
}
:root[data-theme="dark"] {
  --bg:           #0b0d12;
  --bg-surface:   #11141b;
  --bg-elevated:  #181c25;
  --bg-hover:     #1f2430;
  --bg-sel:       #29303d;
  --border:       #1f2430;
  --border-mid:   #2a313f;
  --border-hi:    #3b4456;
  --txt:          #e6e9ef;
  --txt-2:        #b6bcc8;
  --txt-dim:      #7d8595;
  --accent:       #e6e9ef;
  --accent-soft:  #c5cad6;
  --blue:         #60a5fa;
  --blue-2:       #3b82f6;
  --green:        #22c55e;
  --amber:        #f59e0b;
  --red:          #f87171;
  --shadow-sm:    0 1px 2px rgba(0,0,0,.4);
  --shadow:       0 8px 24px rgba(0,0,0,.45);
  --radius:       8px;
  --radius-sm:    6px;
}

/* ─── Layout ───────────────────────────────────────────────────────────── */
:root { --rail-w: 210px; }
.app {
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  height: 100vh;
}

/* ─── Navigation rail (dark, fixed width) ────────────────────────────────── */
.rail {
  position: relative;
  z-index: 60;
  width: 100%;
  background: #14161c;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.rail-logo {
  height: 56px; flex: 0 0 56px;
  display: flex; align-items: center; gap: 11px;
  padding: 0 15px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.rail-mark {
  width: auto; height: 28px; flex: 0 0 auto; display: block;
}
.rail-title {
  font-size: 15px; font-weight: 800; color: #fff; white-space: nowrap;
  letter-spacing: -.02em;
}
.rail-title .accent { color: #b98bff; }

/* ─── Brand logo (mark + wordmark), shared ───────────────────────────────── */
.brand-logo { display: flex; align-items: center; gap: 11px; }
.brand-mark { height: 28px; width: auto; flex: 0 0 auto; display: block; }
.brand-word {
  font-size: 20px; font-weight: 800; letter-spacing: -.02em;
  color: var(--txt); white-space: nowrap; line-height: 1;
}
.brand-word > span { color: #9146FF; }
.login-logo { margin: 0 0 4px; }
.login-logo .brand-mark { height: 34px; }
.login-logo .brand-word { font-size: 24px; }
.admin-mark { height: 26px; }

.rail-nav { flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.rail .tab {
  display: flex; align-items: center; gap: 12px;
  width: 100%; height: 40px; padding: 0 10px;
  border: 0; border-radius: 8px; background: transparent;
  color: rgba(255,255,255,.5);
  white-space: nowrap; overflow: hidden;
  transition: background .12s, color .12s;
}
.rail .tab:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.9); }
.rail .tab.active { background: rgba(255,255,255,.12); color: #fff; }
.rail .tab.active .rail-ic { color: var(--blue); }
:root[data-theme="dark"] .rail .tab.active .rail-ic { color: #fff; }
.rail-ic { width: 18px; height: 18px; flex: 0 0 auto; stroke: currentColor; }
.rail-label {
  font-size: 12.5px; font-weight: 500;
}

.rail-foot {
  padding: 10px; border-top: 1px solid rgba(255,255,255,.07);
  display: flex;
}
.rail-foot .lang-btn {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.12);
  color: rgba(255,255,255,.7);
}
.rail-foot .lang-btn:hover { background: rgba(255,255,255,.14); color: #fff; }

/* ─── Accounts toolbar (distributed action zones) ────────────────────────── */
.topbar-title { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; color: var(--txt); }

.acc-toolbar {
  flex: 0 0 auto;
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 8px 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}
.tb-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tb-search .input { width: 140px; height: 32px; }
.tb-filters .filter-btn { min-width: 96px; }
.tb-spacer { flex: 1 1 24px; }
.tb-divider { width: 1px; align-self: stretch; min-height: 24px; background: var(--border-mid); }
.tb-farm { gap: 10px; }
.tb-farm .stagger-control { flex-direction: row; }
.tb-farm .stagger-control .input { width: 60px; }

.settings-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.settings-field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--txt-2); }
.settings-field .input { width: 120px; }

.sidebar {
  display: flex; flex-direction: column;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.brand {
  height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
}
.brand-name { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }

.side-section {
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.actions-section { gap: 8px; }
.actions-section > .btn { width: 100%; }
.acct-actions { display: flex; flex-direction: column; gap: 8px; }
.acct-actions > .btn { width: 100%; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stagger-control {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; font-size: 10px; color: var(--txt-dim);
}
.stagger-control .input { width: 72px; height: 28px; padding: 0 8px; }
.cap {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--txt-dim);
}
.cap-row { display: flex; align-items: center; justify-content: space-between; }
.hr { height: 1px; background: var(--border); }
.hr.small { margin: 6px 0; }
.spacer { flex: 1; }
.status { padding: 10px 14px; font-size: 11px; color: var(--txt-dim); line-height: 1.5; }
.status b { color: var(--txt-2); font-weight: 600; }

/* ─── Inputs ───────────────────────────────────────────────────────────── */
.input, .ta, select {
  display: block; width: 100%;
  background: var(--bg-elevated);
  color: var(--txt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  height: 32px;
  font-size: 13px;
  outline: none;
  transition: border-color .12s, background .12s;
}
.input:focus, .ta:focus, select:focus {
  border-color: var(--border-hi);
  background: var(--bg-surface);
}
.ta {
  height: auto;
  padding: 8px 10px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, "Menlo", "Consolas", monospace;
  font-size: 12px;
}

/* ─── Buttons ──────────────────────────────────────────────────────────────
   One base `.btn` + a small set of intent variants (default / outline /
   primary / accent / danger) and sizes (small / big). Every button shares the
   same height, radius, gap and motion so groups line up pixel-perfect. */
.btn {
  --btn-ring: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--border-mid);
  background: var(--bg-elevated);
  color: var(--txt-2);
  border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
  transition: background .14s ease, border-color .14s ease,
              color .14s ease, box-shadow .14s ease, transform .06s ease;
}
.btn:hover { background: var(--bg-hover); color: var(--txt); border-color: var(--border-hi); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn .ic { width: 14px; height: 14px; }

.btn.outline { background: var(--bg-surface); }

.btn.primary {
  background: var(--accent); color: var(--bg-surface);
  border-color: var(--accent); font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.btn.primary:hover { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--bg-surface); }

.btn.accent { background: transparent; color: var(--blue); border-color: var(--blue); font-weight: 600; }
.btn.accent:hover { background: color-mix(in srgb, var(--blue) 12%, transparent); color: var(--blue-2); border-color: var(--blue-2); }

.btn.danger { background: transparent; color: var(--red); border-color: var(--red); }
.btn.danger:hover { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); border-color: var(--red); }

/* quiet, borderless variant for dense toolbars */
.btn.ghost { background: transparent; border-color: transparent; color: var(--txt-dim); }
.btn.ghost:hover { background: var(--bg-hover); color: var(--txt); border-color: transparent; }

.btn.big { height: 40px; padding: 0 18px; font-size: 13px; }
.btn.small { height: 28px; padding: 0 11px; font-size: 11px; gap: 5px; }
.btn.small .ic { width: 13px; height: 13px; }
.btn.block { width: 100%; }

/* icon-only variant of .btn (square, keeps the same height as siblings) */
.btn.icon { width: 32px; padding: 0; }
.btn.small.icon { width: 28px; }
.btn.big.icon { width: 40px; }

/* horizontal button cluster with a consistent gap */
.btn-group { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn.starting { position: relative; }
.spinner {
  display: inline-block; width: 11px; height: 11px; margin-right: 6px;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; vertical-align: -1px; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.lang-btn {
  height: 24px; padding: 0 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-mid);
  color: var(--txt-2);
  border-radius: var(--radius-sm);
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.06em;
}
.lang-btn:hover { background: var(--bg-hover); color: var(--txt); }

.link-btn {
  background: transparent; border: 0;
  color: var(--txt-dim);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}
.link-btn:hover { background: var(--bg-hover); color: var(--txt); }

.icon-btn {
  background: transparent; border: 1px solid transparent;
  color: var(--txt-dim);
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .14s ease, color .14s ease, border-color .14s ease;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--txt); border-color: var(--border); }
.icon-btn.danger:hover { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); border-color: var(--red); }
.icon-btn .ic { width: 15px; height: 15px; }

/* theme switch (sun/moon) — icon-only toggle in the top bar */
.icon-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-mid);
  color: var(--txt-2);
  border-radius: var(--radius-sm);
  transition: background .14s ease, color .14s ease, border-color .14s ease;
}
.icon-toggle:hover { background: var(--bg-hover); color: var(--txt); border-color: var(--border-hi); }
.icon-toggle .ic { width: 16px; height: 16px; }
.icon-toggle .ic-sun { display: none; }
.icon-toggle .ic-moon { display: block; }
:root[data-theme="dark"] .icon-toggle .ic-sun { display: block; }
:root[data-theme="dark"] .icon-toggle .ic-moon { display: none; }

/* small status dot (replaces emoji indicators) */
.dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; background: var(--border-hi);
  vertical-align: middle; flex: 0 0 auto;
}
.dot.ok { background: var(--green); }
.dot.off { background: var(--border-hi); }
.dot.err { background: var(--red); }
.cell-status { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }

.filter-btn {
  height: 32px;
  padding: 0 12px;
  background: var(--bg-elevated);
  color: var(--txt-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  text-align: left;
  transition: background .12s, border-color .12s;
}
.filter-btn::after {
  content: "▾"; margin-left: auto; opacity: .55; font-size: 9px;
}
.filter-btn { display: flex; align-items: center; }
.filter-btn:hover { background: var(--bg-hover); border-color: var(--border-mid); color: var(--txt); }
.filter-btn.on {
  background: var(--bg-sel);
  color: var(--txt);
  border-color: var(--accent);
  font-weight: 600;
}

/* ─── Main content ─────────────────────────────────────────────────────── */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  height: 56px; flex: 0 0 56px;
  display: flex; align-items: center; justify-content: space-between;
  min-width: 0; gap: 12px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}
.tabs {
  display: flex; align-items: center; gap: 18px;
  min-width: 0; overflow-x: auto;
}
.tab {
  background: transparent; border: 0;
  color: var(--txt-dim);
  font-size: 13px; font-weight: 500;
  padding: 18px 0;
  border-bottom: 2px solid transparent;
}
.tab.active { color: var(--txt); border-bottom-color: var(--accent); font-weight: 600; }
.tab:hover { color: var(--txt); }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--red);
  color: var(--red);
}
.badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--red);
}
.badge.green { color: var(--green); border-color: var(--green); }
.badge.green::before { background: var(--green); animation: pulse 1.4s infinite; }
.badge.red { color: var(--red); border-color: var(--red); }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

.page { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }

/* ─── Accounts split ──────────────────────────────────────────────────── */
.split {
  flex: 1; display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
  min-height: 0;
}
.table-wrap { padding: 16px; overflow: auto; min-width: 0; }
.detail {
  border-left: 1px solid var(--border);
  background: var(--bg-surface);
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
  overflow: hidden;
}
.detail-head {
  flex: 0 0 auto;
  min-width: 0;
  height: 44px;
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.detail-title { font-size: 12px; font-weight: 500; color: var(--txt-2); }
.detail-body {
  padding: 16px; min-width: 0; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; gap: 10px;
}
.d-row {
  display: flex; align-items: center; gap: 8px;
  min-width: 0; flex-wrap: wrap;
}
.d-login {
  min-width: 0; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 18px; font-weight: 700; letter-spacing: -0.01em;
}
.d-role {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--txt-2);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 2px 8px; border-radius: 999px;
}

.d-pct-row { display: flex; align-items: center; gap: 12px; }
.d-pct { font-size: 18px; font-weight: 700; min-width: 50px; }
.d-bar {
  flex: 1; height: 6px;
  background: var(--bg-elevated);
  border-radius: 999px; overflow: hidden;
}
.d-bar-fill {
  height: 100%; width: 0;
  background: var(--accent);
  border-radius: 999px;
  transition: width .3s ease, background-color .2s ease;
}
.d-campaigns-box { display: flex; flex-direction: column; gap: 6px; }
.d-campaigns-list { display: flex; flex-direction: column; gap: 6px; }
.d-campaign {
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}
.d-campaign-head {
  display: flex; justify-content: space-between; gap: 8px;
  min-width: 0; font-size: 12px; font-weight: 600;
}
.d-campaign-head > span:first-child {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.d-campaign-season { margin-top: 2px; color: var(--txt-dim); font-size: 11px; }
.d-campaign .d-bar { margin-top: 5px; height: 4px; }
.d-campaign-drops { display: flex; flex-direction: column; gap: 2px; margin-top: 5px; color: var(--txt-dim); font-size: 10px; }
.d-drop-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; min-width: 0;
}
.d-drop-row > span:first-child {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.d-drop-status {
  display: inline-flex; align-items: center; gap: 4px;
  flex: 0 0 auto; padding: 2px 6px;
  border: 1px solid var(--border); border-radius: 999px;
  color: var(--txt-dim); font-size: 10px; white-space: nowrap;
}
.d-drop-status.claimed { color: var(--green); border-color: var(--green); }
.d-drop-status.ready { color: var(--amber); border-color: var(--amber); }
.d-drop-status.in_progress { color: var(--txt-dim); border-color: var(--border-mid); }
.d-drop-status.awarded { color: var(--blue); border-color: var(--blue); }
.d-awarded { color: var(--txt-dim); font-size: 10px; }
.d-meta { display: flex; min-width: 0; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.d-cname {
  min-width: 0; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13px; font-weight: 500;
}
.d-sea { font-size: 11px; color: var(--txt-dim); }

.cred-row {
  display: flex; align-items: center; gap: 8px;
  min-width: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
}
.cred-label {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--txt-dim);
  flex: 0 0 64px; min-width: 0;
}
.cred-value {
  flex: 1; min-width: 0;
  font-family: ui-monospace, SFMono-Regular, "Menlo", "Consolas", monospace;
  font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--txt);
}
.copy-field {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--txt-2);
  text-align: left;
  cursor: pointer;
}
.copy-field:hover { border-color: var(--border-mid); color: var(--txt); }
.copy-field-value {
  min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, "Menlo", "Consolas", monospace;
  font-size: 11px; color: var(--txt);
}

.drops-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.drops-list { display: flex; flex-direction: column; gap: 4px; }
.drops-list .drop-row { display: flex; justify-content: space-between; font-size: 12px; }
.drops-list .drop-row .v { font-weight: 600; }

.d-actions { display: flex; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.d-actions .btn { flex: 1 1 120px; min-width: 0; }

/* ─── Table ────────────────────────────────────────────────────────────── */
.table {
  width: 100%;
  min-width: 620px;
  border-collapse: separate; border-spacing: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.table thead th {
  position: sticky; top: 0; z-index: 1;
  text-align: left;
  background: var(--bg-elevated);
  color: var(--txt-dim);
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  user-select: none;
}
.table th.num, .table td.num { text-align: center; }
.table th.col-chk, .table td.col-chk { width: 36px; text-align: center; }
.table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
.login-cell { white-space: nowrap; }
.token-tag, .drop-summary {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1.4;
  vertical-align: middle;
}
.token-web { color: var(--amber); border: 1px solid var(--amber); }
.token-mobile { color: var(--txt-dim); border: 1px solid var(--border-mid); }
.token-invalid { color: var(--red); border: 1px solid var(--red); }
.drop-summary { color: var(--txt-dim); border: 1px solid var(--border); }
.table tbody tr {
  transition: background .12s;
  cursor: pointer;
  content-visibility: auto;
  contain-intrinsic-size: auto 44px;
}
.table tbody tr:hover { background: var(--bg-hover); }
.table tbody tr.selected { background: var(--bg-sel); }
.table tbody tr.selected td { color: var(--txt); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .login-cell { font-weight: 600; }
.table .role-pill {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  border-radius: 999px;
  background: var(--bg-elevated); color: var(--txt-2);
  border: 1px solid var(--border);
}
.pct-cell {
  display: inline-flex; align-items: center; gap: 8px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.pct-bar {
  width: 72px; height: 4px;
  background: var(--bg-elevated);
  border-radius: 999px; overflow: hidden;
}
.pct-bar > span {
  display: block; height: 100%;
  background: var(--accent);
  border-radius: 999px;
}
.pct-r { color: var(--red); }
.pct-a { color: var(--amber); }
.pct-g { color: var(--green); }

.empty {
  margin-top: 30px; text-align: center;
  font-size: 13px; color: var(--txt-dim);
}

/* ─── Streamers page ──────────────────────────────────────────────────── */
.streamers-pane {
  flex: 1; min-height: 0; padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
  overflow-y: auto;
}
.proxies-pane {
  flex: 1; min-height: 0; padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
  overflow-y: auto;
}
.proxy-toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.proxy-toolbar .btn { flex: 1; min-width: 120px; }
.proxy-table-wrap {
  flex: 1;
  min-height: 0;
  padding: 0;
  overflow-y: auto;
  overflow-x: auto;
}
.proxy-table .proxy-raw { font-family: ui-monospace, monospace; }
.proxy-status {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  border: 1px solid var(--border); color: var(--txt-dim);
}
.proxy-status.valid { color: var(--green); border-color: var(--green); }
.proxy-status.invalid { color: var(--red); border-color: var(--red); }
.proxy-status.unsupported { color: var(--amber); border-color: var(--amber); }
.streamers-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  flex: 1; min-height: 0;
}
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow-sm);
}
.row.gap { display: flex; gap: 8px; }
.row.gap > .btn { flex: 1; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  height: 26px; padding: 0 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--txt-2);
  transition: all .12s;
}
.pill:hover { background: var(--bg-hover); color: var(--txt); border-color: var(--border-mid); }
.pill.active {
  background: var(--accent); color: var(--bg-surface);
  border-color: var(--accent); font-weight: 600;
}
.pill .pill-menu {
  margin-left: 4px; opacity: .65; padding: 0 2px;
}
.pill .pill-menu:hover { opacity: 1; }

.streamer-list {
  flex: 1; min-height: 200px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: auto;
}
.streamer-list .row-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.streamer-list .row-item:last-child { border-bottom: 0; }
.streamer-list .row-item.checked { background: var(--bg-sel); }
.counter {
  font-size: 11px; color: var(--txt-dim);
}

/* ─── Farm page ────────────────────────────────────────────────────────── */
.convert-pane {
  flex: 1; min-height: 0; padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
  overflow-y: auto;
}
.convert-info { color: var(--txt-dim); margin-bottom: 10px; }
.check-progress-label { color: var(--txt-dim); font-size: 11px; }
.convert-toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.convert-progress-row {
  display: flex; align-items: center; gap: 10px; margin-top: 12px;
}
.convert-progress {
  flex: 1; height: 8px; background: var(--bg-elevated);
  border-radius: 999px; overflow: hidden;
}
.convert-progress span {
  display: block; height: 100%; width: 0;
  background: var(--accent); transition: width .2s;
}
.convert-status {
  color: var(--accent); font-size: 12px; font-weight: 600;
  margin-top: 8px;
}
.convert-counters { color: var(--txt-dim); font-size: 12px; margin-top: 8px; }
.convert-accounts, .convert-results {
  display: flex; flex-direction: column; gap: 4px;
  max-height: 260px; overflow-y: auto;
}
.convert-account {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: var(--radius-sm);
}
.convert-account:hover { background: var(--bg-hover); }
.convert-result {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 5px 8px; border-bottom: 1px solid var(--border);
}
.result-minted { color: var(--green); }
.result-bad_password, .result-error { color: var(--red); }
.result-timeout, .result-2fa { color: var(--amber); }
.farm-pane {
  flex: 1; min-height: 0; padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
  overflow-y: auto;
}
.farm-status {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--txt-2);
}
.farm-status.active { color: var(--green); border-color: var(--green); }
.farm-status.stopped { color: var(--txt-dim); }
.farm-launch-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 20px; margin-left: 8px; padding: 0 6px;
  border-radius: 999px; background: var(--bg-elevated); color: var(--txt-2);
  font-size: 11px; line-height: 1; font-weight: 700;
}
.log-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-family: ui-monospace, SFMono-Regular, "Menlo", "Consolas", monospace;
  font-size: 11px;
  color: var(--txt-2);
  min-height: 72px;
  max-height: 120px;
  overflow-y: auto;
  white-space: pre-wrap;
}
.log-box .l-line { display: flex; gap: 6px; }
.log-box .l-time { color: var(--txt-dim); }
.log-box .l-login { color: var(--blue); }
.log-box .l-msg { color: var(--txt-2); }
.log-box .l-error .l-msg { color: var(--red); }
.log-box .l-warn  .l-msg { color: var(--amber); }
.log-box:empty::before {
  content: attr(data-i18n-ph-value);
  color: var(--txt-dim); font-style: italic;
}
.farm-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.farm-summary {
  grid-column: 1 / -1;
  color: var(--txt-dim);
  font-size: 11px;
  padding: 0 2px;
}
.farm-starting {
  grid-column: 1 / -1; padding: 24px; text-align: center; color: var(--txt-dim);
  border: 1px dashed var(--border-mid); border-radius: var(--radius);
  animation: farmPulse 1.2s ease-in-out infinite;
}
@keyframes farmPulse { 50% { opacity: .45; } }
.f-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 8px;
  box-shadow: var(--shadow-sm);
  transition: border-color .12s;
  cursor: pointer;
}
.f-card:hover { border-color: var(--border-mid); }
.f-card .f-login { font-weight: 600; font-size: 12px; grid-column: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f-card .f-time { font-size: 11px; font-variant-numeric: tabular-nums; color: var(--txt-2); grid-column: 2; grid-row: 1; }
.f-card .f-camp { font-size: 10px; color: var(--txt-dim); grid-column: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f-card .f-pct  { font-size: 10px; font-weight: 600; grid-column: 2; grid-row: 2; min-width: 32px; text-align: right; }
.f-card .f-bar  { grid-column: 1 / span 2; height: 3px; background: var(--bg-elevated); border-radius: 999px; overflow: hidden; }
.f-card .f-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .25s; }
.f-card .f-log  { grid-column: 1 / span 2; font-family: ui-monospace, monospace; font-size: 10px; line-height: 1.35; color: var(--txt-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── Modals ───────────────────────────────────────────────────────────── */
.modal-root { position: fixed; inset: 0; pointer-events: none; z-index: 100; }
.modal-root.active { pointer-events: auto; }
.backdrop {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, .35);
  backdrop-filter: blur(2px);
  animation: fadeIn .15s ease;
}
:root[data-theme="dark"] .backdrop { background: rgba(0,0,0,.55); }
.modal {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: min(92vw, 480px);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  max-height: 86vh;
  animation: scaleIn .15s ease;
}
.modal.wide { width: min(92vw, 560px); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 14px; font-weight: 600; }
.modal-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.modal-foot {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: 0 0 var(--radius) var(--radius);
}
.modal label { font-size: 11px; font-weight: 600; color: var(--txt-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.field { display: flex; flex-direction: column; gap: 4px; }
.fieldset { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@keyframes fadeIn { from {opacity:0} to {opacity:1} }
@keyframes scaleIn { from {opacity:0; transform: translate(-50%, -48%) scale(.97)} to {opacity:1; transform: translate(-50%, -50%) scale(1)} }

/* dropdown menu (filter checkbox menus, pill context menu) */
.menu {
  position: absolute; z-index: 110;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 4px; min-width: 200px;
  display: flex; flex-direction: column; gap: 2px;
  max-height: 320px; overflow-y: auto;
}
.menu .item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 4px;
  background: transparent;
  border: 0; color: var(--txt-2);
  text-align: left;
  cursor: pointer;
}
.menu .item:hover { background: var(--bg-hover); color: var(--txt); }
.menu .item.danger { color: var(--red); }
.menu .item input[type=checkbox] { accent-color: var(--accent); }
.menu .sep { height: 1px; background: var(--border); margin: 4px 0; }

/* ─── Toast ────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 18px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-surface);
  border: 1px solid var(--border-mid);
  color: var(--txt);
  padding: 10px 16px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 200;
  max-width: 80vw;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.error { border-color: var(--red); color: var(--red); }
.toast.success { border-color: var(--green); color: var(--green); }

/* checkbox style */
input[type=checkbox] { accent-color: var(--accent); }

/* responsive */
@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    height: auto; min-height: 100vh;
  }
  .sidebar {
    display: flex;
    max-height: none;
    border-right: 0; border-bottom: 1px solid var(--border);
  }
  .main { min-height: 0; }
  .topbar {
    height: auto; min-height: 56px;
    flex-wrap: wrap; align-items: center;
    padding: 8px 12px;
  }
  .tabs { flex: 1 1 100%; gap: 16px; }
  .topbar-right {
    flex: 1 1 100%;
    justify-content: flex-end; flex-wrap: wrap;
  }
  .page { overflow: visible; }
  .split {
    display: flex; flex-direction: column;
    min-height: 0;
  }
  .split .table-wrap { max-height: 50vh; }
  .detail {
    display: flex;
    border-left: 0; border-top: 1px solid var(--border);
    max-height: none;
  }
  .streamers-grid { grid-template-columns: 1fr; }
  .farm-cards { grid-template-columns: minmax(0, 1fr); }
  .convert-toolbar .btn { flex: 1 1 160px; }
  .campaigns-search-row { flex-wrap: wrap; }
  .campaigns-search-row .btn { flex: 0 0 auto; }
  .campaign-game-title { flex: 1; min-width: 0; }
  .campaign-game-title span { min-width: 0; }
  .campaign-game-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .campaign-game-header { gap: 8px; }
  .admin-shell { padding-left: 12px; padding-right: 12px; }
  .admin-topbar { flex-wrap: wrap; gap: 12px; }
  .admin-brand { min-width: 0; flex-wrap: wrap; }
  .admin-topbar .topbar-right { flex: 1 1 auto; }
  .admin-main .cap-row { align-items: flex-start; gap: 10px; flex-wrap: wrap; }
}

/* ─── Farm cards: вне лимита ─────────────────────────────────────────────── */
.f-card.over-limit {
  opacity: .45;
  filter: grayscale(1);
  pointer-events: none;
  border-style: dashed;
}
.f-card.over-limit .f-camp { color: var(--amber); font-weight: 600; }
.toast.warn { border-color: var(--amber); color: var(--amber); }

/* ─── Farm cards: отфармлено (100%) ─────────────────────────────────────── */
.f-card.farmed {
  border-color: var(--green, #3fb950);
  background: color-mix(in srgb, var(--green, #3fb950) 8%, var(--bg-surface));
  opacity: .8;
  order: 1;
}
.f-card.farmed .f-camp { color: var(--green, #3fb950); font-weight: 700; }
.f-card.farmed .f-bar > span { background: var(--green, #3fb950) !important; }

/* ─── Topbar user badges (main panel) ───────────────────────────────────── */
.topbar-right { display: flex; align-items: center; gap: 10px; }
.me-badge {
  font-size: 12px; color: var(--txt-dim);
  padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px;
  white-space: nowrap;
}
.me-badge.sub-warn { color: var(--amber); border-color: var(--amber); }
.me-badge.sub-expired { color: var(--red); border-color: var(--red); }
.backup-status { font-size: 12px; color: var(--txt-dim); margin-top: 8px; }
.backup-status.warn { color: var(--amber); }
.sub-expired { color: var(--red); }
.sub-warn { color: var(--amber); }

/* ─── Standalone admin panel (/admin) ───────────────────────────────────── */
.admin-body { background: var(--bg); }
.admin-shell { max-width: 1100px; margin: 0 auto; padding: 0 20px 40px; }
.admin-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0; margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg); z-index: 5;
}
.admin-brand { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.admin-brand .admin-sub { font-size: 12px; font-weight: 400; color: var(--txt-dim); align-self: center; }
.admin-main { display: flex; flex-direction: column; gap: 16px; padding-top: 16px; }
.admin-main .card { padding: 16px; }
.admin-main .table-wrap { padding: 0; overflow: auto; }
.row { display: flex; align-items: center; }
.row.gap { gap: 8px; flex-wrap: wrap; }
#admin-body td .row.gap { gap: 6px; }
#admin-audit { max-height: 300px; overflow: auto; font-size: 12px; }
.log-line { padding: 3px 0; border-bottom: 1px solid var(--border); line-height: 1.5; }
.log-ts { color: var(--txt-dim); }
.log-line .muted, .muted { color: var(--txt-dim); }

.campaigns-pane { display: flex; flex-direction: column; gap: 12px; }
.page[data-page="campaigns"] { overflow-y: auto; overflow-x: hidden; padding: 16px; }
.campaigns-search-row { display: flex; align-items: center; gap: 8px; }
.campaigns-search-row .input { flex: 1; min-width: 0; }
.campaign-catalog-list { display: flex; flex-direction: column; gap: 18px; }
.campaign-game-section { display: flex; flex-direction: column; gap: 8px; }
.campaign-game-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
  width: 100%; color: var(--txt); background: transparent; border-left: 0;
  border-right: 0; border-top: 0; text-align: left; cursor: pointer;
}
.campaign-game-header:hover { color: var(--accent); }
.campaign-game-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.campaign-game-title img { width: 42px; height: 56px; object-fit: cover; border-radius: 6px; }
.campaign-game-title span { display: flex; flex-direction: column; gap: 3px; }
.campaign-game-title strong { font-size: 16px; }
.campaign-game-title small { color: var(--txt-dim); }
.campaign-game-caret {
  display: inline-block !important; width: 14px; color: var(--txt-dim);
  font-size: 18px; line-height: 1; transition: transform .15s ease;
}
.campaign-game-header.collapsed .campaign-game-caret { transform: rotate(-90deg); }
.campaign-game-select {
  display: flex; align-items: center; gap: 6px; color: var(--txt-dim);
  font-size: 11px; cursor: pointer;
}
.campaign-game-select input { accent-color: var(--accent); }
.campaign-game-campaigns { display: flex; flex-direction: column; gap: 8px; }
.campaign-game-campaigns.collapsed { display: none; }
.campaign-card {
  display: flex; flex-direction: column; gap: 8px; padding: 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg-surface);
}
.campaign-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.campaign-card-head label { display: flex; align-items: center; gap: 8px; min-width: 0; }
.campaign-card-head strong { overflow: hidden; text-overflow: ellipsis; }
.campaign-card-end { color: var(--txt-dim); font-size: 11px; }
.campaign-rewards-title { color: var(--txt-dim); font-size: 11px; font-weight: 600; }
.campaign-rewards { display: flex; flex-wrap: wrap; gap: 8px; }
.campaign-reward {
  display: flex; flex-direction: column; gap: 3px; width: 84px;
  color: var(--txt-dim); font-size: 10px;
}
.campaign-reward img {
  width: 84px; height: 84px; object-fit: cover; border-radius: 6px;
  background: var(--bg-elevated);
}
.campaign-reward span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.campaign-reward small { color: var(--txt-dim); }
.campaign-card input { accent-color: var(--accent); }
.campaign-card:hover { border-color: var(--accent); }
.campaign-card.selected {
  border-color: var(--accent); background: var(--bg-sel);
}
.campaign-linked { color: var(--green); }
