/* ── User / login ───────────────────────────────── */
#user-btn { gap: 6px; }
#user-btn .user-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 6px rgba(0,255,136,0.5); flex-shrink: 0;
}
#user-btn .user-name { text-transform: none; letter-spacing: 0.04em; }

/* Token notice, sitting in the composer directly above Send. Deliberately NOT
   a permanent meter: a normal user has no idea what an allowance is, so we
   stay silent until they are near it — and then say it where the thing it
   affects actually is. */
.usage-banner {
  display: none; align-items: center; gap: 10px;
  padding: 8px 11px; margin-bottom: 8px; border-radius: 3px;
  border: 1px solid rgba(255,184,108,0.4);
  background: rgba(255,184,108,0.10); color: #ffb86c;
  font-size: 11px; line-height: 1.5; letter-spacing: 0.03em;
}
.usage-banner.visible { display: flex; }
.usage-banner.over { border-color: rgba(255,85,85,0.45); background: rgba(255,85,85,0.10); color: var(--red); }
.usage-banner .usage-banner-icon { font-size: 13px; flex-shrink: 0; }
.usage-banner .usage-banner-text { flex: 1; }
.usage-banner .usage-banner-close {
  border: 0; background: transparent; color: inherit; opacity: 0.7;
  cursor: pointer; font-family: inherit; font-size: 13px; line-height: 1; padding: 0 2px;
}
.usage-banner .usage-banner-close:hover { opacity: 1; }

/* .modal.wide and the admin-table rules went with the modal — the member
   list lives at /manage now (public/pages/manage.html). What is left here is the
   account panel and the auth gate. */

.modal-backdrop {
  display: none; position: fixed; inset: 0; z-index: 60;
  background: rgba(2,4,8,0.72); backdrop-filter: blur(2px);
  align-items: center; justify-content: center; padding: 20px;
}
.modal-backdrop.visible { display: flex; }
.modal {
  width: 340px; max-width: 100%;
  border: 1px solid var(--border-hi); background: rgba(8,10,14,0.98);
  box-shadow: 0 20px 50px rgba(0,0,0,0.5), 0 0 30px var(--accent-glow);
  position: relative;
}
.modal::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent) 40%, transparent);
}
.modal-head {
  padding: 14px 16px 10px; display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
}
.modal-title {
  color: var(--accent); font-size: 10.5px; font-weight: 800;
  letter-spacing: 0.14em; text-transform: uppercase;
}
.modal-close {
  border: 0; background: transparent; color: var(--text-dim); cursor: pointer;
  font-family: inherit; font-size: 14px; line-height: 1; padding: 0 2px;
}
.modal-close:hover { color: var(--red); }
.modal-body { padding: 0 16px 14px; }
.modal-hint {
  color: var(--text-dim); font-size: 10.5px; line-height: 1.6; margin-bottom: 12px;
}
.modal-label {
  display: block; color: var(--text-dim); font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 6px;
}
/* A class, not an id list. The account panel needed three more inputs, and
   styling them by name is how one of them ends up looking like a browser
   default. */
#username-input, .modal-input {
  width: 100%; box-sizing: border-box; padding: 9px 10px;
  background: rgba(0,0,0,0.45); border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  color: var(--text); font-family: inherit; font-size: 12.5px; border-radius: 2px;
}
#username-input:focus, .modal-input:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 10px var(--accent-glow);
}
.modal-input[disabled] { color: var(--text-dim); border-left-color: var(--border); cursor: not-allowed; }
/* The account panel is taller than the picker ever was. */
.modal-body { max-height: 76vh; overflow-y: auto; }
.account-fixed { margin-bottom: 14px; }
.account-row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.account-row .account-k {
  color: var(--text-dim); font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; width: 62px; flex-shrink: 0;
}
.account-row .account-v { font-size: 12px; word-break: break-all; }
.account-sep {
  border: 0; border-top: 1px solid var(--border); margin: 16px 0 14px;
}
.account-ok { color: var(--green); }
.modal-error { color: var(--red); font-size: 10.5px; line-height: 1.5; margin-top: 8px; min-height: 13px; }
.modal-actions { display: flex; gap: 8px; margin-top: 12px; }
.modal-actions .btn { flex: 1; justify-content: center; padding: 8px 12px; }
.user-list { border-top: 1px solid var(--border); }
.user-list-head {
  padding: 10px 16px 6px; color: var(--text-dim);
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
}
.user-row {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 16px; border: 0; border-top: 1px solid var(--border);
  background: transparent; color: var(--text); font-family: inherit;
  font-size: 11.5px; text-align: left; cursor: pointer;
}
.user-row:hover { background: var(--accent-glow); }
.user-row.current { color: var(--accent); cursor: default; }
.user-row.current:hover { background: transparent; }
.user-row .user-tag {
  color: var(--text-dim); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase;
}

/* ── Auth gate (remote mode only) ─────────────────────────────────────────
   A full-screen surface rather than the small #user-modal: remote mode has a
   real logged-out state, and nothing behind it is usable until you are
   through. Three panels, one at a time — sign in, set a password, pay. */
.auth-gate {
  display: none; position: fixed; inset: 0; z-index: 90;
  background: radial-gradient(circle at 50% 0%, rgba(69,183,207,0.06), transparent 60%), var(--bg);
  align-items: center; justify-content: center; padding: 24px; overflow: auto;
}
.auth-gate.visible { display: flex; }
.auth-card {
  width: 380px; max-width: 100%;
  border: 1px solid var(--border-hi); background: rgba(8,10,14,0.98);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 40px var(--accent-glow);
  position: relative; padding: 22px 22px 20px;
}
.auth-card.wide { width: 560px; }
.auth-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent) 40%, transparent);
}
.auth-brand {
  display: flex; align-items: center; gap: 8px; margin-bottom: 20px;
  color: var(--accent); font-size: 11px; font-weight: 800;
  letter-spacing: 0.18em; text-transform: uppercase;
}
.auth-card h2 {
  margin: 0 0 8px; font-size: 17px; font-weight: 600; letter-spacing: 0.01em; color: var(--text);
}
.auth-card p.auth-lede { margin: 0 0 18px; color: var(--text-dim); font-size: 11.5px; line-height: 1.7; }
.auth-field { margin-bottom: 12px; }
.auth-field label {
  display: block; color: var(--text-dim); font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 6px;
}
.auth-field input {
  width: 100%; box-sizing: border-box; padding: 9px 10px;
  background: rgba(0,0,0,0.45); border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  color: var(--text); font-family: inherit; font-size: 12.5px; border-radius: 2px;
}
.auth-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 10px var(--accent-glow); }
.auth-msg { font-size: 10.5px; line-height: 1.6; margin: 8px 0 0; min-height: 13px; color: var(--text-dim); }
.auth-msg.error { color: var(--red); }
.auth-msg.ok { color: var(--green); }
.auth-actions { display: flex; gap: 8px; margin-top: 14px; }
.auth-actions .btn { flex: 1; justify-content: center; padding: 9px 12px; }
.auth-foot {
  margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border);
  color: var(--text-dim); font-size: 10px; line-height: 1.7;
}
.auth-foot .auth-link {
  background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer;
  font-family: inherit; font-size: 10px; text-decoration: underline;
}
.auth-panel { display: none; }
.auth-panel.active { display: block; }
.welcome-note {
  border-left: 2px solid var(--accent); background: rgba(69,183,207,0.06);
  color: var(--text-dim); font-size: 11px; line-height: 1.7;
  padding: 9px 12px; margin-bottom: 16px;
}
.welcome-note b { color: var(--text); }

/* Plan cards — one row each: name and description left, price right */
.plan-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.plan-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; text-align: left; padding: 11px 12px; cursor: pointer;
  border: 1px solid var(--border); background: rgba(0,0,0,0.3);
  color: var(--text); font-family: inherit; border-radius: 2px;
}
.plan-card:hover { border-color: var(--border-hi); background: var(--accent-glow); }
.plan-card.selected { border-color: var(--accent); border-left-width: 2px; box-shadow: 0 0 12px var(--accent-glow); }
.plan-card .plan-name { font-size: 12.5px; font-weight: 600; }
.plan-card .plan-desc { color: var(--text-dim); font-size: 10px; line-height: 1.5; margin-top: 3px; }
.plan-card .plan-price { font-size: 13px; color: var(--accent); white-space: nowrap; }
/* Stripe injects an iframe here; it needs a home with a little breathing room */
#payment-element { margin: 4px 0 6px; min-height: 40px; }

/* The simulated card form. It is deliberately indistinguishable from a real
   one — the whole point is to rehearse the real thing, and the notice that
   used to sit here was plumbing detail in front of a customer. Which mode a
   deployment is in is an *administrator's* concern, so it is on /manage. */
.sim-field { margin-bottom: 9px; }
.sim-field label {
  display: block; color: var(--text-dim); font-size: 9px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 4px;
}
.sim-field input {
  width: 100%; box-sizing: border-box; padding: 8px 9px; border-radius: 2px;
  background: rgba(0,0,0,0.45); border: 1px solid var(--border);
  border-left: 2px solid var(--accent-dim);
  color: var(--text); font-family: inherit; font-size: 12.5px;
}
.sim-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 10px var(--accent-glow); }
.sim-field input.bad { border-color: var(--red); border-left-color: var(--red); }
.sim-row { display: flex; gap: 8px; }
.sim-row .sim-field { flex: 1; }
