/* warbot-saas dashboard. dark, one accent (electric mint). dev-tool vibe, not bootstrap. */

:root {
  --bg:        #0a0c0b;   /* deep near-black, faint cool tint */
  --bg-grad:   #0d100e;
  --surface:   #111513;   /* panel / card */
  --surface-2: #161b18;   /* inputs, raised cells */
  --surface-3: #1b211d;   /* hover */
  --border:    #232a26;
  --border-2:  #2c352f;
  --text:      #e7ede9;
  --muted:     #8a948e;
  --faint:     #5d655f;

  --accent:    #34e5a0;   /* the one confident hue */
  --accent-hi: #57f0b3;
  --accent-dk: #1c8f63;
  --accent-fade:#34e5a022;

  --online:    #34e5a0;
  --offline:   #6b746e;
  --warn:      #f2b341;
  --warn-soft: #f2b34155;
  --error:     #f15a52;
  --error-soft:#f15a5218;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", "Fira Code", ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  background:
    radial-gradient(1100px 600px at 80% -10%, var(--bg-grad), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.mono { font-family: var(--mono); font-feature-settings: "tnum" 1; }

/* view toggling driven by hidden attr on the two roots */
[hidden] { display: none !important; }

/* during the auth-probe, show neither view (avoids a login flash before a valid cookie jumps to dashboard) */
body[data-view="boot"] #login-view { display: none; }

/* ---------- brand mark ---------- */
.brand { display: inline-flex; align-items: center; gap: 9px; }
.brand .mark { color: var(--accent); display: inline-flex; filter: drop-shadow(0 0 6px var(--accent-fade)); }
.wordmark {
  font-weight: 650;
  letter-spacing: -.01em;
  font-size: 15px;
}
.wordmark__sub { color: var(--faint); font-family: var(--mono); font-weight: 500; font-size: .82em; }
.brand--lg .wordmark { font-size: 19px; }

/* ======================= LOGIN ======================= */
.login-wrap {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

.login-card {
  width: 100%;
  max-width: 360px;
  padding: 30px 28px 26px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.login-card .brand { margin-bottom: 2px; }
.login-tagline {
  margin: 0 0 18px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}
.login-card .field { margin-bottom: 14px; }
.login-foot {
  margin: 0;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .02em;
}

/* ======================= FIELDS ======================= */
.field { display: flex; flex-direction: column; gap: 7px; }
.field__label {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}
input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
  transition: border-color .14s ease, box-shadow .14s ease, background .14s ease;
}
input.mono { font-family: var(--mono); }
input::placeholder { color: var(--faint); }
input:focus {
  border-color: var(--accent-dk);
  box-shadow: 0 0 0 3px var(--accent-fade);
  background: var(--surface-3);
}

/* ======================= BUTTONS ======================= */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .14s ease, border-color .14s ease, color .14s ease, opacity .14s ease, transform .04s ease;
}
.btn:active { transform: translateY(1px); }
.btn--block { width: 100%; margin-top: 4px; }

.btn--primary {
  background: var(--accent);
  color: #052016;
  box-shadow: 0 1px 0 0 #ffffff14 inset, 0 0 18px -6px var(--accent);
}
.btn--primary:hover { background: var(--accent-hi); }
.btn--primary:disabled { opacity: .65; cursor: progress; }

.btn--ghost {
  background: transparent;
  border-color: var(--border-2);
  color: var(--muted);
  font-weight: 500;
  padding: 7px 12px;
  font-size: 12.5px;
}
.btn--ghost:hover { color: var(--text); border-color: var(--faint); background: var(--surface-2); }

/* secondary action (register existing): quieter than the mint primary add-bot */
.btn--secondary {
  background: var(--surface-2);
  border-color: var(--border-2);
  color: var(--text);
}
.btn--secondary:hover { background: var(--surface-3); border-color: var(--faint); }
.btn--secondary:disabled { opacity: .65; cursor: progress; }
.btn--secondary .spinner { border-color: var(--muted); border-top-color: transparent; }

/* spinner inside the add button (hidden until .is-busy) */
.spinner {
  width: 13px; height: 13px;
  border-radius: 50%;
  border: 2px solid #052016aa;
  border-top-color: transparent;
  animation: spin .7s linear infinite;
  display: none;
}
.btn.is-busy .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ======================= ERRORS ======================= */
.form-error {
  margin: 8px 0 0;
  color: var(--error);
  font-size: 12.5px;
  font-family: var(--mono);
}

/* ======================= DASHBOARD ======================= */
.dash { max-width: 920px; margin: 0 auto; padding: 28px 22px 64px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 20px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.topbar__right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

/* subscription-lapsed notice: subStatus != "active" on GET /api/me (see I7) */
.sub-banner {
  margin: -8px 0 20px;
  padding: 10px 14px;
  background: var(--warn-soft);
  border: 1px solid #f2b34155;
  border-radius: var(--r-sm);
  color: var(--warn);
  font-size: 13px;
  font-family: var(--mono);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 11px 5px 10px;
}
.chip__k {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--faint);
}
.chip__v { font-size: 12.5px; color: var(--text); }

.dash__main { display: flex; flex-direction: column; gap: 22px; }

/* ----- panels ----- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 18px 20px;
}
.panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}
.panel__title { margin: 0; font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; }
.panel__meta { color: var(--faint); font-size: 12px; }

/* ----- bots list ----- */
.list { display: flex; flex-direction: column; }

.list__head, .bot-row__main {
  display: grid;
  grid-template-columns: 14px minmax(120px, 1.4fr) minmax(110px, 1fr) auto auto 26px 26px 26px;
  align-items: center;
  gap: 14px;
}
.list__head {
  padding: 4px 12px 10px;
  border-bottom: 1px solid var(--border);
}
.list__head span {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--faint);
}
.col-status { text-align: left; }
.col-toggle { text-align: left; }

.bot-row {
  border-bottom: 1px solid var(--border);
}
.bot-row:last-child { border-bottom: none; }
.bot-row__main {
  padding: 13px 12px;
  border-radius: var(--r-sm);
  transition: background .12s ease;
}
.bot-row:hover .bot-row__main { background: var(--surface-2); }

.bot-label { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* name cell: primary display name (nickname || in-game label) + greyed in-game subtitle */
.bot-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bot-name__btn {
  appearance: none; background: transparent; border: 0; padding: 0;
  font: inherit; font-weight: 550; color: var(--text);
  text-align: left; cursor: pointer; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: color .12s ease;
}
.bot-name__btn:hover { color: var(--accent-hi); }
.bot-name__btn::after {
  content: "\270E"; /* pencil */
  margin-left: 6px; font-size: 11px; color: var(--faint);
  opacity: 0; transition: opacity .12s ease;
}
.bot-name__btn:hover::after { opacity: 1; }
.bot-name__sub {
  font-family: var(--mono); font-size: 11px; color: var(--faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* shared inline editor (nickname + proxy) */
.proxy-edit { cursor: pointer; }
.tag-proxy.proxy-edit:hover { border-color: var(--accent); color: var(--accent-hi); }
.tag-noproxy.proxy-edit:hover { filter: brightness(1.15); }
.inline-edit {
  font-family: var(--mono); font-size: 12px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--accent-dk); border-radius: var(--r-sm);
  padding: 3px 7px; outline: none;
  min-width: 120px; max-width: 100%;
  box-shadow: 0 0 0 3px var(--accent-fade);
}
.inline-edit.is-invalid { border-color: var(--error); box-shadow: 0 0 0 3px var(--error-soft); }

.bot-igg { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.bot-status {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .02em;
  text-transform: lowercase;
  color: var(--muted);
}
.bot-status.is-online { color: var(--accent); }
.bot-status.is-error  { color: var(--error); }
.bot-status.is-provisioning { color: var(--warn); }
.bot-status.is-gated  { color: var(--warn); font-weight: 600; }

/* subtle "no creds" pill: bot is registered but not launchable from saas (empty unit) */
.tag-nocreds {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  color: var(--faint);
  font-size: 10px;
  letter-spacing: .05em;
  text-transform: uppercase;
  vertical-align: middle;
}

/* proxy pills: "via <host>" = bot routes through its SOCKS5 proxy; "no proxy" = legacy/missing (red). */
.tag-proxy, .tag-noproxy {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: .04em;
  vertical-align: middle;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tag-proxy {
  background: var(--accent-fade);
  border: 1px solid var(--accent-dk);
  color: var(--accent-hi);
}
.tag-noproxy {
  background: var(--error-soft);
  border: 1px solid #f15a5233;
  color: var(--error);
  text-transform: uppercase;
}

.bot-error {
  grid-column: 2 / -1;
  margin: -4px 12px 10px;
  padding: 8px 11px;
  background: var(--error-soft);
  border: 1px solid #f15a5233;
  border-radius: var(--r-sm);
  color: var(--error);
  font-family: var(--mono);
  font-size: 12px;
  word-break: break-word;
}

/* remove button */
.rm-btn {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  color: var(--faint);
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color .12s ease, background .12s ease, border-color .12s ease;
}
.rm-btn:hover { color: var(--error); background: var(--error-soft); border-color: #f15a5233; }

/* ----- on/off switch (user intent: ON = run, OFF = stop) ----- */
.switch {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-self: start;
}
.switch__track {
  position: relative;
  width: 38px;
  height: 21px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.switch__knob {
  position: absolute;
  top: 50%;
  left: 2px;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--faint);
  transition: left .16s cubic-bezier(.4, .1, .2, 1), background .16s ease;
}
.switch[aria-checked="true"] .switch__track {
  background: var(--accent-fade);
  border-color: var(--accent-dk);
  box-shadow: 0 0 10px -2px var(--accent);
}
.switch[aria-checked="true"] .switch__knob {
  left: 19px;
  background: var(--accent);
}
.switch:hover .switch__track { border-color: var(--faint); }
.switch[aria-checked="true"]:hover .switch__track { border-color: var(--accent); }
.switch:focus-visible { outline: none; }
.switch:focus-visible .switch__track { box-shadow: 0 0 0 3px var(--accent-fade); }
.switch:disabled, .switch.is-busy { cursor: progress; opacity: .55; }
/* a permanently-locked switch (no creds) is not-allowed, not a transient "progress" */
.switch:disabled:not(.is-busy) { cursor: not-allowed; }
.switch.is-busy .switch__knob { animation: switch-busy .7s ease-in-out infinite; }
@keyframes switch-busy {
  0%, 100% { opacity: .45; }
  50%      { opacity: 1; }
}

/* ----- status dot ----- */
.dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 auto;
  background: var(--offline);
}
.dot.online      { background: var(--online); box-shadow: 0 0 7px 0 var(--online); }
.dot.offline     { background: var(--offline); box-shadow: none; }
.dot.error       { background: var(--error);  box-shadow: 0 0 7px 0 var(--error); }
.dot.provisioning{ background: var(--warn);   animation: dot-pulse 1.5s ease-in-out infinite; }
.dot.gated       { background: var(--warn);   box-shadow: 0 0 7px 0 var(--warn); }
@keyframes dot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--warn-soft); opacity: .55; }
  50%      { box-shadow: 0 0 9px 2px var(--warn);  opacity: 1; }
}

/* ----- empty state ----- */
.empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--muted);
}
.empty__mark { color: var(--faint); font-family: var(--mono); font-size: 22px; opacity: .6; }
.empty__title { margin: 12px 0 4px; font-weight: 550; color: var(--text); }
.empty__sub { margin: 0; font-size: 12.5px; color: var(--faint); font-family: var(--mono); }

/* ----- add-bot grid (2 rows: creds row, then proxy + action) ----- */
.add-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1.3fr auto;
  grid-template-areas:
    "email pw    label  label"
    "proxy proxy proxy  action";
  gap: 14px;
  align-items: end;
}
.add-grid > :nth-child(1) { grid-area: email; }
.add-grid > :nth-child(2) { grid-area: pw; }
.add-grid > :nth-child(3) { grid-area: label; }
.add-grid__proxy { grid-area: proxy; }
.add-grid__action { grid-area: action; display: flex; }
.add-grid__action .btn { width: 100%; white-space: nowrap; }

/* ----- register-existing (secondary block under add-bot) ----- */
.panel__divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0 16px;
}
.register-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 13px;
}
.register-title { margin: 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.register-hint { font-size: 11px; color: var(--faint); }
.field__opt {
  color: var(--faint);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}
.reg-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr auto;
  grid-template-areas:
    "iggid label unit  unit"
    "proxy proxy proxy action";
  gap: 14px;
  align-items: end;
}
.reg-grid > :nth-child(1) { grid-area: iggid; }
.reg-grid > :nth-child(2) { grid-area: label; }
.reg-grid > :nth-child(3) { grid-area: unit; }
.reg-grid__proxy { grid-area: proxy; }
.reg-grid__action { grid-area: action; display: flex; }
.reg-grid__action .btn { width: 100%; white-space: nowrap; }

/* ----- status chevron (toggles the per-bot status panel) ----- */
.chev {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  color: var(--faint);
  width: 24px; height: 24px;
  border-radius: var(--r-sm);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  justify-self: start;
  transition: color .12s ease, background .12s ease, transform .16s ease;
}
.chev:hover { color: var(--accent-hi); background: var(--surface-2); }
.chev svg { transition: transform .18s cubic-bezier(.4,.1,.2,1); }
.chev.is-open svg { transform: rotate(180deg); }
.chev.is-open { color: var(--accent); }

/* ======================= PER-BOT STATUS PANEL ======================= */
.bot-status-panel { display: none; }
.bot-status-panel.is-open { display: block; }

.status-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  margin: 2px 12px 12px;
  padding: 11px 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  animation: status-in .16s ease;
}
@keyframes status-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

/* dim the whole strip when the data is stale or there's none yet */
.status-strip.is-stale { opacity: .5; filter: saturate(.6); }
.status-strip.is-empty, .status-strip.is-loading { opacity: .7; }
.status-msg { color: var(--faint); font-size: 12px; }

.status-strip .stat {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
}
.stat__k {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--faint);
}
.stat__v { color: var(--text); font-weight: 600; font-size: 13px; }
.stat__i { color: var(--faint); }
.stat--inf .mono { color: var(--text); }
.stat--name { color: var(--faint); font-family: var(--mono); font-size: 11.5px; }
.stat--name b { color: var(--accent-hi); font-weight: 600; }
.stat--staletag {
  color: var(--warn);
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  border: 1px solid var(--warn-soft); border-radius: 999px; padding: 1px 7px;
}

/* troops cell: T2/T4/T5 with a hover tooltip listing the full per-type/tier breakdown */
.stat--troops { position: relative; cursor: help; color: var(--text); outline: none; }
.stat--troops .t { color: var(--muted); }
.stat--troops .t b { color: var(--text); font-weight: 600; }
.stat--troops .sep { color: var(--faint); }
.stat--troops .stat__i { margin-right: 2px; }

.troops-tip {
  position: absolute;
  left: 0;
  top: calc(100% + 7px);
  z-index: 20;
  min-width: 150px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  box-shadow: 0 10px 28px -10px #000c, 0 0 0 1px #0006;
  padding: 8px 9px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-3px);
  transition: opacity .12s ease, transform .12s ease, visibility .12s;
}
.stat--troops:hover .troops-tip,
.stat--troops:focus .troops-tip,
.stat--troops:focus-within .troops-tip {
  opacity: 1; visibility: visible; transform: none;
}
.troops-tip table { border-collapse: collapse; width: 100%; }
.troops-tip td { padding: 2px 6px; font-size: 11.5px; }
.troops-tip td.k { color: var(--muted); text-align: left; }
.troops-tip td.v { color: var(--text); text-align: right; font-weight: 600; }
.troops-tip tr + tr td { border-top: 1px solid var(--border); }

/* buff chips: 🛡 shield / 🔥 fury / 📈 sizeboost — active = accent, inactive = grey */
.buffs { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.buff {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--border-2);
  background: var(--surface-3);
}
.buff__t { font-size: 11px; }
.buff.is-active {
  border-color: var(--accent-dk);
  background: var(--accent-fade);
  color: var(--accent-hi);
}
.buff.is-active .buff__t { color: var(--accent-hi); }
.buff.is-inactive { color: var(--faint); }
.buff.is-inactive .buff__t { color: var(--faint); }

/* ======================= RESPONSIVE ======================= */
@media (max-width: 720px) {
  .add-grid { grid-template-columns: 1fr 1fr; }
  .add-grid__action { grid-column: 1 / -1; }
  .reg-grid { grid-template-columns: 1fr 1fr; }
  .reg-grid__action { grid-column: 1 / -1; }

  .list__head { display: none; }
  .bot-row__main {
    grid-template-columns: 14px 1fr auto auto auto auto;
    grid-template-areas:
      "dot label  toggle creds chev rm"
      "dot igg    status status status status";
    row-gap: 4px;
  }
  .bot-row__main .dot     { grid-area: dot; align-self: start; margin-top: 5px; }
  .bot-label              { grid-area: label; }
  .bot-igg                { grid-area: igg; }
  .bot-status             { grid-area: status; text-align: right; }
  .switch                 { grid-area: toggle; justify-self: end; align-self: center; }
  .creds-btn              { grid-area: creds; justify-self: end; }
  .chev                   { grid-area: chev; justify-self: end; }
  .rm-btn                 { grid-area: rm; justify-self: end; }

  /* on mobile the troops tooltip would overflow the viewport edge: pin it to the strip width */
  .troops-tip { left: 0; right: auto; min-width: 60vw; max-width: 80vw; }
}
@media (max-width: 460px) {
  .add-grid { grid-template-columns: 1fr; }
  .reg-grid { grid-template-columns: 1fr; }
  .dash { padding: 20px 14px 48px; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .topbar__right { width: 100%; }
}

/* ======================= LOGIN <-> SIGN-UP TOGGLE ======================= */
.login-toggle {
  margin: 12px 0 0;
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
}
.login-toggle a { color: var(--accent-hi); text-decoration: none; }
.login-toggle a:hover { text-decoration: underline; }

/* ======================= ONBOARDING WIZARD ======================= */
.wizard-card { padding: 30px 28px 26px; display: flex; flex-direction: column; gap: 6px; }
.wizard-card .brand { margin-bottom: 2px; }
.wizard-card #kyc-form .field { margin-bottom: 14px; }
.wizard-msg { padding: 6px 0 4px; color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.wizard-card .btn--ghost { margin-top: 14px; align-self: center; }

/* ======================= SMALL BUTTON VARIANT (admin controls) ======================= */
.btn--sm { padding: 6px 11px; font-size: 12px; }

/* ======================= GENERIC FIELD GRID (admin forms: variable field count) ======================= */
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  align-items: end;
}
.field-grid__action { grid-column: 1 / -1; display: flex; }
.field-grid__action .btn { white-space: nowrap; }
.field-grid__wide { grid-column: 1 / -1; }

/* ======================= OPERATOR ADMIN SECTION ======================= */
#admin-root { display: flex; flex-direction: column; gap: 22px; }

.admin-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.admin-row:last-child { border-bottom: none; }
.admin-row__name { font-weight: 600; }
.admin-row__idtag { margin-left: 8px; color: var(--faint); font-family: var(--mono); font-size: 11px; }
.admin-row__chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.admin-row__actions { display: flex; gap: 8px; margin-top: 10px; }

/* per-tenant subscription editor: status + expiry + limit + submit, inline */
.sub-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.sub-form select, .sub-form input {
  width: auto;
  padding: 7px 9px;
  font-size: 12px;
}
.sub-form .sub-expiry { min-width: 130px; }
.sub-form .sub-limit { width: 90px; }

/* "reset requested" badge on the users list */
.tag-reset {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--warn-soft);
  border: 1px solid var(--warn);
  color: var(--warn);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* tamper-score chip variants (green low / amber mid / red high / grey n-a) — reuses .chip */
.chip.score-low  { border-color: var(--accent-dk); background: var(--accent-fade); }
.chip.score-low .chip__v  { color: var(--accent-hi); }
.chip.score-mid  { border-color: var(--warn); background: var(--warn-soft); }
.chip.score-mid .chip__v  { color: var(--warn); }
.chip.score-high { border-color: #f15a5233; background: var(--error-soft); }
.chip.score-high .chip__v { color: var(--error); font-weight: 700; }
.chip.score-na .chip__v   { color: var(--faint); }

/* ---- KYC review item: tenant + phone + score, then ID photo + forensics heatmap side by side ---- */
.kyc-item { padding: 16px 0; border-bottom: 1px solid var(--border); }
.kyc-item:last-child { border-bottom: none; }
.kyc-item__head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.kyc-item__imgs { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 12px; }
.kyc-fig { margin: 0; }
.kyc-fig img {
  display: block;
  max-width: 260px;
  max-height: 260px;
  width: auto;
  height: auto;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.kyc-fig figcaption {
  margin-top: 5px;
  text-align: center;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--faint);
}
.kyc-item__actions { display: flex; gap: 8px; }

@media (max-width: 460px) {
  .kyc-fig img { max-width: 100%; }
}

/* payment-link generator output (D-lite) */
.pay-link-out { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; }
.pay-link-out a { word-break: break-all; }

/* ============================ IMPORT FROM BACKUP ============================ */
.dropzone {
  border: 1.5px dashed var(--border-2);
  border-radius: var(--r-md);
  background: var(--surface-2);
  padding: 26px 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent-dk); outline: none; }
.dropzone.is-drag { border-color: var(--accent); background: var(--accent-fade); }
.dropzone__mark { font-size: 26px; color: var(--accent); line-height: 1; }
.dropzone__title { margin: 8px 0 2px; color: var(--text); font-weight: 600; }
.dropzone__sub { margin: 0; color: var(--muted); font-size: 13px; }
.linklike {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--accent); text-decoration: underline; font: inherit;
}
.import-status { margin: 10px 2px 0; color: var(--muted); font-size: 13px; }

/* modal */
.modal {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.6); padding: 20px;
}
.modal__box {
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--r-lg); width: 100%; max-width: 620px;
  max-height: 86vh; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 8px; }
.modal__title { margin: 0; font-size: 17px; }
.modal__x { background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 4px 8px; border-radius: var(--r-sm); }
.modal__x:hover { color: var(--text); background: var(--surface-2); }
.modal__note { margin: 0 18px 8px; color: var(--muted); font-size: 13px; }
.modal__warn { margin: 0 18px 8px; color: var(--warn); font-size: 12px; }
.import-list__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 18px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  color: var(--faint); font-size: 12px;
}
.import-all { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); cursor: pointer; }
.import-list { overflow-y: auto; padding: 4px 10px; flex: 1; }
.import-row {
  display: grid; grid-template-columns: 20px 96px minmax(0,1fr) minmax(0,150px) auto;
  align-items: center; gap: 10px;
  padding: 9px 8px; border-radius: var(--r-sm); cursor: pointer;
}
.import-row:hover { background: var(--surface-2); }
.import-row.is-disabled { opacity: .55; cursor: default; }
.import-row__igg { color: var(--text); }
.import-row__name { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-row__proxy { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 170px; }
.import-row .dim { color: var(--faint); }
.import-badge {
  font-size: 11px; color: var(--muted); background: var(--surface-3);
  border-radius: 999px; padding: 2px 8px; white-space: nowrap;
}
.import-badge--warn { color: var(--warn); background: var(--warn-soft); }
.import-badge--bad  { color: var(--error); background: var(--error-soft); }
.import-badge--ok   { color: var(--accent); background: var(--accent-fade); }
.import-empty { color: var(--muted); text-align: center; padding: 18px; }
.modal__foot { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-top: 1px solid var(--border); }
.modal__meta { color: var(--muted); font-size: 13px; }
.modal__actions { display: flex; gap: 8px; }

/* floating capacity banner */
.cap-banner {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 18px; z-index: 50; max-width: 92%;
  padding: 11px 18px; border-radius: 999px; font-size: 13px; font-weight: 600;
  box-shadow: 0 8px 30px rgba(0,0,0,.45); border: 1px solid transparent;
}
.cap-banner--yellow { background: #2a2412; color: var(--warn); border-color: var(--warn-soft); }
.cap-banner--red    { background: #2a1513; color: var(--error); border-color: var(--error-soft); }

/* ============================ OPERATOR VIEW NAV ============================ */
.view-nav{display:flex;gap:2px;background:var(--surface-2);border:1px solid var(--border);
  border-radius:10px;padding:3px}
.view-nav__btn{background:none;border:none;color:var(--muted);font:inherit;font-weight:600;
  font-size:13px;padding:6px 18px;border-radius:7px;cursor:pointer;transition:.12s}
.view-nav__btn:hover{color:var(--text)}
.view-nav__btn.is-active{background:var(--surface);color:var(--accent)}
.chip--manage{background:var(--accent-fade);border-color:var(--accent-dk)}
.chip__back{color:var(--accent);margin-left:8px;font-size:12px}
.chip__back:hover{text-decoration:underline}
/* admin tenant row: manage-fleet action */
.admin-row__actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-top:8px}
.admin-row__hint{color:var(--faint);font-size:12px}

/* per-bot "refresh creds" icon button (⟳) */
.creds-btn{background:none;border:none;color:var(--faint);cursor:pointer;font-size:15px;
  padding:2px 6px;border-radius:var(--r-sm);line-height:1;transition:color .12s,background .12s}
.creds-btn:hover{color:var(--accent);background:var(--surface-2)}

/* email-verify wizard step */
.wizard-hint{color:var(--muted);font-size:13px;margin-top:10px}
.wizard-hint .linklike{font-size:13px}

/* signup pricing note */
.signup-note{color:var(--muted);font-size:12.5px;line-height:1.45;margin:2px 0 10px;text-align:left}
.signup-note strong{color:var(--text)}

/* emblem logo (replaces the inline SVG mark) */
.brand-logo{width:24px;height:24px;border-radius:6px;display:block;flex:none;filter:drop-shadow(0 0 6px var(--accent-fade))}
.brand-logo--lg{width:30px;height:30px}
