/* Zimac Hub (account.html) + subscribe page (buy.html) — the family look,
   kept in lockstep with the proxy admin console (services/proxy/assets/admin.css)
   and the landing page (the brand gold standard).

   Two layouts share this sheet:
     body.hub  — 248px sidebar + main grid (the hub)
     body.solo — a single centered card (buy.html) */

:root {
  --bg: #0b0d14;
  --bg-2: #0f1117;
  --panel: #1a1d27;
  --panel-2: #232733;
  --border: #2a2e3a;
  --border-soft: rgba(255, 255, 255, 0.06);
  --text: #e4e4e7;
  --muted: #8b8d98;
  --faint: #5e616d;
  --accent: #6c63ff;
  --accent-2: #c084fc;
  --pink: #f472b6;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --grad: linear-gradient(150deg, #6c63ff, #7d76ff 60%, #f472b6);
  --radius: 16px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  --spring: cubic-bezier(0.2, 0.9, 0.25, 1.15);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

/* The UI toggles visibility via the `hidden` attribute. The UA's
   `[hidden]{display:none}` has the same specificity as a class selector, so a
   later author rule like `.login{display:flex}` would override it and leave
   the element visible. Make `hidden` authoritative. */
[hidden] {
  display: none !important;
}

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

body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(108, 99, 255, 0.14) 0%, transparent 55%),
    radial-gradient(900px 500px at 8% 4%, rgba(244, 114, 182, 0.08) 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font: 14px/1.5 "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body.hub {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

/* Grid children default to min-width:auto, which lets wide tables and the
   horizontal mobile nav grow the page itself. Keep overflow inside the
   purpose-built scrollers instead of creating a second, page-level scrollbar. */
.sidebar,
.main {
  min-width: 0;
}

body.solo {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

code {
  font-family: var(--mono);
}

/* Thin dark scrollbars, same as the desktop app */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #3d4252;
}

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

input:focus-visible,
select:focus-visible {
  outline: none;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--panel);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 0 0 10px 0;
  text-decoration: none;
}

.skip-link:focus {
  left: 0;
}

.gradient,
.gradient-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---- Sidebar ---- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 4px;
}

/* The ❖ mark in a rounded gradient box — same treatment as the landing page. */
.brand-mark {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(150deg, rgba(108, 99, 255, 0.9), rgba(244, 114, 182, 0.85));
  color: #fff;
  font-size: 17px;
  line-height: 1;
  box-shadow: 0 0 22px rgba(108, 99, 255, 0.5);
}

.brand-name {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.2px;
}

.brand-sub {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 500;
  background: none;
  border: none;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: color 0.18s, background 0.18s;
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.75;
  transition: opacity 0.18s;
}

.nav-item:hover {
  color: var(--text);
  background: var(--panel-2);
}

.nav-item:hover svg {
  opacity: 1;
}

.nav-item.active {
  color: var(--text);
  background: linear-gradient(90deg, rgba(108, 99, 255, 0.16), rgba(108, 99, 255, 0.03));
}

.nav-item.active svg {
  opacity: 1;
  color: var(--accent-2);
}

/* Gradient rail on the active item — the desktop app's accent treatment. */
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: var(--grad);
  box-shadow: 0 0 12px rgba(108, 99, 255, 0.6);
}

/* Sidebar external link (Docs / Support) — nav-item look, clearly outbound. */
.side-link {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: -14px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
  text-decoration: none;
  transition: color 0.18s, background 0.18s;
}

.side-link + .side-link {
  margin-top: -21px;
}

.side-link:hover {
  color: var(--text);
  background: var(--panel-2);
}

.side-link svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  opacity: 0.75;
}

/* Signed-in chip pinned to the sidebar foot */
.who {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.02);
  min-width: 0;
}

.who-avatar {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, rgba(108, 99, 255, 0.9), rgba(244, 114, 182, 0.8));
}

.who-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.who-label {
  color: var(--faint);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.who-mail {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Main / topbar ---- */
.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 32px 16px;
  background: linear-gradient(180deg, rgba(11, 13, 20, 0.92), rgba(11, 13, 20, 0.78));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
}

.topbar h1 {
  font-size: 22px;
  letter-spacing: -0.01em;
  margin: 0;
}

.view-sub {
  margin: 2px 0 0;
  color: var(--faint);
  font-size: 12.5px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.org-pick {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--muted);
}

.org-pick select {
  padding: 7px 10px;
  font-size: 13px;
  border-radius: 9px;
}

.workspace {
  padding: 24px 32px 60px;
  max-width: 1160px;
}

.workspace,
.view {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Views rise in when the router swaps them. */
.view {
  animation: viewIn 0.32s var(--spring) both;
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---- Overview widgets ---- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.stat {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  transition: transform 0.25s var(--spring), border-color 0.2s;
}

.stat::before {
  content: "";
  position: absolute;
  top: -46px;
  right: -46px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(108, 99, 255, 0.2), transparent 70%);
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.3s;
}

.stat:hover {
  transform: translateY(-2px);
  border-color: rgba(108, 99, 255, 0.35);
}

.stat:hover::before {
  opacity: 1;
}

.stat-num {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.quickstart {
  list-style: none;
  counter-reset: qs;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 15px;
  color: var(--muted);
}

.quickstart li {
  counter-increment: qs;
  position: relative;
  padding-left: 40px;
  min-height: 27px;
}

.quickstart li::before {
  content: counter(qs);
  position: absolute;
  left: 0;
  top: 0;
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, rgba(108, 99, 255, 0.85), rgba(244, 114, 182, 0.7));
  box-shadow: 0 0 14px rgba(108, 99, 255, 0.25);
}

.quickstart b {
  color: var(--text);
}

.inline-link {
  color: var(--accent-2);
  text-decoration: none;
  border-bottom: 1px solid rgba(192, 132, 252, 0.4);
  transition: border-color 0.15s;
}

.inline-link:hover {
  border-bottom-color: var(--accent-2);
}

/* ---- Cards ---- */
.card {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 600;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.card-head h2 {
  margin: 0;
}

.card-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.lede {
  color: var(--muted);
  margin: 0 0 16px;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  flex: 1 1 160px;
}

input,
select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.18);
}

.org-row {
  align-items: flex-end;
}

.org-row .btn {
  flex: 0 0 auto;
  height: 40px;
}

.hint {
  color: var(--faint);
  font-size: 12px;
  margin: 8px 0 0;
}

.err-text {
  color: var(--bad);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--grad);
  box-shadow: 0 6px 22px rgba(108, 99, 255, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  cursor: pointer;
  transition: filter 0.15s, transform 0.05s, box-shadow 0.2s;
}

a.btn {
  text-decoration: none;
}

.btn:hover {
  filter: brightness(1.08);
  box-shadow: 0 8px 28px rgba(108, 99, 255, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
  filter: none;
}

.btn.ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
  box-shadow: none;
}

.btn.ghost:hover {
  background: var(--panel-2);
  filter: none;
  box-shadow: none;
}

.btn.link {
  background: none;
  border: none;
  color: var(--accent);
  padding: 4px 8px;
  font-weight: 600;
  box-shadow: none;
}

.btn.link.danger {
  color: var(--bad);
}

.card.danger-zone {
  border-color: rgba(248, 113, 113, 0.45);
}

.btn.danger-solid {
  margin-top: 14px;
  background: linear-gradient(150deg, #dc2626, #ef4444);
  border-color: rgba(248, 113, 113, 0.55);
  box-shadow: 0 6px 22px rgba(248, 113, 113, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn.danger-solid:hover:not(:disabled) {
  filter: brightness(1.1);
}

.btn.lg {
  padding: 13px 22px;
  font-size: 15px;
}

/* iPhone controls render as a quiet "soon" tag until IOS_URL is live */
.btn.soon {
  opacity: 0.6;
  cursor: default;
  pointer-events: none;
}

.btn .ios-glyph {
  width: 15px;
  height: 15px;
  margin-right: 2px;
  vertical-align: -2px;
}

.btn.block {
  width: 100%;
}

/* A small inline button — sits inside a paragraph of hint text (e.g. "Top up now"). */
.btn.sm {
  display: inline-flex;
  padding: 6px 12px;
  font-size: 13px;
  margin-top: 10px;
  text-decoration: none;
}

/* ---- One-time secret reveal ---- */
.reveal {
  border-color: rgba(52, 211, 153, 0.35);
  background:
    linear-gradient(180deg, rgba(52, 211, 153, 0.07), rgba(52, 211, 153, 0.01)),
    linear-gradient(180deg, var(--panel), var(--bg-2));
}

.secret {
  display: block;
  background: rgba(52, 211, 153, 0.05);
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: 10px;
  padding: 13px 15px;
  font-family: var(--mono);
  font-size: 13px;
  word-break: break-all;
  color: var(--good);
  margin-bottom: 12px;
}

.reveal-actions {
  display: flex;
  gap: 10px;
}

/* ---- Alert card: an unmissable "top up first" state (empty org wallet) ---- */
.card.alert {
  border-color: rgba(248, 113, 113, 0.55);
  background:
    linear-gradient(180deg, rgba(248, 113, 113, 0.12), rgba(248, 113, 113, 0.02)),
    linear-gradient(180deg, var(--panel), var(--bg-2));
  box-shadow: var(--shadow), inset 3px 0 0 var(--bad);
}
.card.alert h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fca5a5;
  font-size: 16px;
}
.card.alert h2::before {
  content: "";
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  background: var(--bad);
  -webkit-mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 9v4M12 17h.01'/%3E%3Cpath d='M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z'/%3E%3C/svg%3E");
  mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 9v4M12 17h.01'/%3E%3Cpath d='M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z'/%3E%3C/svg%3E");
}

/* ---- Success card: a top-up landed (Billing return from Stripe) ---- */
.card.success {
  border-color: rgba(52, 211, 153, 0.4);
  background:
    linear-gradient(180deg, rgba(52, 211, 153, 0.12), rgba(52, 211, 153, 0.02)),
    linear-gradient(180deg, var(--panel), var(--bg-2));
}
.card.success h2 {
  color: var(--good);
}

/* The budget window ("/ monthly") trailing a token's spend cap in the table. */
.per {
  color: var(--faint);
  font-size: 12px;
}

/* A horizontal checkbox row (label defaults to a vertical stack). */
.check {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.check input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  padding: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ---- Table ---- */
.table-wrap {
  overflow-x: auto;
  margin: 0 -6px;
}

.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.grid th {
  text-align: left;
  color: var(--faint);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 8px 12px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.grid td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
  vertical-align: middle;
}

.grid tr:last-child td {
  border-bottom: none;
}

.grid tbody tr {
  transition: background 0.15s;
}

.grid tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.grid code {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 3px 7px;
}

/* Seat = avatar + principal (tokens table) */
.seat {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

.avatar {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, rgba(108, 99, 255, 0.9), rgba(244, 114, 182, 0.8));
}

.transaction-credit {
  color: var(--good);
  font-weight: 600;
}

.transaction-debit {
  color: var(--muted);
  font-weight: 600;
}

.license-slots {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.license-device {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 0;
}

.license-device > span {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.license-device .btn.link {
  font-size: 11px;
}

/* Shared live proxy-price card. Values are rendered only from /v1/prices. */
.prices-scroll {
  overflow-x: auto;
}

.live-prices {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.live-prices th,
.live-prices td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}

.live-prices thead th {
  color: var(--faint);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: right;
}

.live-prices thead th:first-child,
.live-prices tbody th {
  text-align: left;
}

.live-prices tbody th {
  color: var(--text);
  font-weight: 500;
}

.live-prices td {
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.live-prices tr:last-child th,
.live-prices tr:last-child td {
  border-bottom: 0;
}

.live-prices tr.unavailable th,
.live-prices tr.unavailable td,
.hint.err {
  color: var(--bad);
}

.prices-note {
  margin-bottom: 0;
}

.actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

/* Row action "⋯" kebab + its body-appended popover menu */
.kebab-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  padding: 2px 10px;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}
.kebab-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}
.row-menu {
  position: fixed;
  z-index: 200;
  min-width: 150px;
  padding: 5px;
  background: rgba(15, 17, 23, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: menuIn 0.18s var(--spring);
}

@keyframes menuIn {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
}

.row-menu-item {
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 10px;
  border-radius: 7px;
}
.row-menu-item:hover {
  background: rgba(255, 255, 255, 0.07);
}
.row-menu-item.danger {
  color: var(--bad);
}
.row-menu-item.danger:hover {
  background: rgba(248, 113, 113, 0.12);
}

/* ---- Tokens: bulk-action bar + select column ---- */
.bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  padding: 8px 12px;
  border: 1px solid rgba(108, 99, 255, 0.3);
  border-radius: 10px;
  background: rgba(108, 99, 255, 0.08);
  animation: menuIn 0.2s var(--spring);
}

.bulk-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.bulk-actions {
  display: flex;
  gap: 8px;
}

.grid th.col-check,
.grid td.col-check {
  width: 1%;
  padding-right: 4px;
}

.grid .tok-check,
#tok-check-all {
  cursor: pointer;
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
}

#tok-check-all:disabled {
  cursor: default;
  opacity: 0.4;
}

/* ---- Pills ---- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  background: rgba(139, 141, 152, 0.1);
  border: 1px solid rgba(139, 141, 152, 0.25);
}

.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.pill.active {
  color: var(--good);
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.3);
}

.pill.revoked {
  color: var(--bad);
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.3);
}

.pill.expired {
  color: var(--warn);
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.3);
}

.pill.role {
  color: var(--accent-2);
  background: rgba(192, 132, 252, 0.1);
  border-color: rgba(192, 132, 252, 0.3);
}

.pill.personal {
  color: var(--good);
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.3);
}

.pill.you {
  color: var(--muted);
  background: rgba(139, 141, 152, 0.12);
  border-color: rgba(139, 141, 152, 0.3);
}

/* ---- Member rows (org cards) ---- */
.m {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--border-soft);
  font-size: 14px;
}

.m-right {
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ---- Org card: profile, panels, settings, invites, activity ---- */
.org-desc {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

/* A disclosed sub-section inside an org card (members / activity / settings). */
.org-panel {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border-soft);
}
.org-panel[hidden] { display: none; }

.org-settings label {
  display: block;
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}
.settings-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.set-out { margin: 8px 0 0; }

.invites-head {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--faint);
  margin-bottom: 2px;
}
.inv-expiry {
  color: var(--faint);
  font-size: 12px;
  margin-left: 6px;
}

.role-select {
  font-size: 12px;
  padding: 3px 6px;
  border-radius: 8px;
  background: var(--panel-2, var(--bg-2));
  color: var(--text);
  border: 1px solid var(--border);
}
.role-select:disabled { opacity: 0.5; }

/* Activity feed rows — lighter than member rows, timestamp on the right. */
.act {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
  border-top: 1px solid var(--border-soft);
  font-size: 13px;
  color: var(--muted);
}
.act b { color: var(--text); font-weight: 600; }

/* ---- Tier cards (hub #/app + buy.html) ---- */
.tiers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}

.card.tier {
  transition: transform 0.25s var(--spring), border-color 0.2s, box-shadow 0.2s;
}

.card.tier:hover {
  transform: translateY(-2px);
  border-color: rgba(108, 99, 255, 0.4);
}

.tier-name {
  font-size: 16px;
  font-weight: 700;
}

.tier-price {
  font-size: 32px;
  font-weight: 700;
  margin: 6px 0 2px;
  letter-spacing: -0.02em;
}

.tier-price small {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}

.tier-line {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

.feat {
  list-style: none;
  margin: 12px 0 18px;
  padding: 0;
}

.feat li {
  padding: 6px 0 6px 24px;
  position: relative;
  color: #cfd1db;
  font-size: 14px;
}

.feat li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--good);
  font-weight: 700;
}

.tier.pro {
  border-color: rgba(108, 99, 255, 0.55);
  box-shadow: 0 8px 30px rgba(108, 99, 255, 0.18);
}

.tier.pro:hover {
  border-color: rgba(108, 99, 255, 0.75);
  box-shadow: 0 12px 38px rgba(108, 99, 255, 0.26);
}

.tier .btn {
  width: 100%;
}

/* ---- Buy page (body.solo) ---- */
.solo-card {
  width: 680px;
  max-width: 100%;
  padding: 36px 38px 30px;
  animation: popIn 0.4s var(--spring);
}

.solo-card h1 {
  font-size: 30px;
  margin: 14px 0 8px;
  letter-spacing: -0.01em;
}

.sub {
  color: var(--muted);
  margin: 0 0 22px;
}

.keybox {
  margin: 8px 0 12px;
  padding: 16px;
  border-radius: 12px;
  text-align: center;
  background: var(--panel-2);
  border: 1px dashed var(--accent-2);
  font: 600 20px/1.4 var(--mono);
  letter-spacing: 0.08em;
  user-select: all;
}

.msg {
  min-height: 22px;
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.msg.err {
  color: var(--bad);
}

.msg.ok {
  color: var(--good);
}

.foot {
  margin-top: 22px;
  color: var(--muted);
  font-size: 13px;
}

.foot a {
  color: var(--accent-2);
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 70;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 380px;
  padding: 12px 16px 12px 14px;
  background: rgba(26, 29, 39, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-left: 3px solid var(--good);
  border-radius: 12px;
  box-shadow: var(--shadow);
  animation: toastIn 0.3s var(--spring);
}

.toast svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--good);
}

.toast.err {
  border-left-color: var(--bad);
}

.toast.err svg {
  color: var(--bad);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
}

/* ---- Login overlay ---- */
.login {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow: hidden;
  background:
    radial-gradient(900px 500px at 70% -10%, rgba(108, 99, 255, 0.16) 0%, transparent 60%),
    radial-gradient(700px 460px at 12% 100%, rgba(244, 114, 182, 0.08) 0%, transparent 60%),
    var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
}

/* Slow-drifting gradient orbs behind the card. */
.login::before,
.login::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
}

.login::before {
  width: 420px;
  height: 420px;
  top: -130px;
  right: -90px;
  background: rgba(108, 99, 255, 0.28);
  animation: drift 11s ease-in-out infinite alternate;
}

.login::after {
  width: 340px;
  height: 340px;
  bottom: -110px;
  left: -70px;
  background: rgba(244, 114, 182, 0.18);
  animation: drift 14s ease-in-out infinite alternate-reverse;
}

@keyframes drift {
  to {
    transform: translate(-42px, 30px) scale(1.08);
  }
}

.login-card {
  position: relative;
  z-index: 1;
  max-width: 460px;
  width: 100%;
  text-align: left;
  padding: 32px;
  border-color: rgba(108, 99, 255, 0.28);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5), 0 0 60px rgba(108, 99, 255, 0.08);
  animation: popIn 0.4s var(--spring);
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }
}

.login-brand {
  margin-bottom: 22px;
}

.login-title {
  font-size: 26px;
  line-height: 1.25;
  margin: 0 0 12px;
}

.login-lede {
  color: var(--muted);
  margin: 0 0 24px;
}

.login-notice {
  color: var(--bad);
  font-size: 13.5px;
  margin: 0 0 18px;
  white-space: pre-wrap;
}

.login .btn.lg {
  width: 100%;
  justify-content: center;
}

.login-btn {
  gap: 10px;
}

.login-btn:hover svg {
  transform: translateX(3px);
}

.login-btn svg {
  transition: transform 0.2s var(--spring);
}

.login-alt {
  margin: 14px 0 0;
  font-size: 13.5px;
  color: var(--muted);
  text-align: center;
}

.login-alt .btn.link {
  color: var(--accent-2);
  text-decoration: underline;
  padding: 0 2px;
  font-size: inherit;
}

.login-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--faint);
  font-size: 12px;
  margin-top: 18px;
}

.login-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 8px var(--good);
}

.login-legal {
  position: relative;
  z-index: 1;
  color: var(--faint);
  font-size: 12px;
}

/* Unlike the proxy console, the hub keeps navigation usable on small screens:
   the sidebar collapses into a top bar and the nav becomes a horizontal,
   scrollable strip instead of disappearing. */
@media (max-width: 760px) {
  body.hub {
    grid-template-columns: 1fr;
    /* Pin the (now horizontal) sidebar row to its content height — auto rows
       otherwise stretch to split the 100vh min-height and open a huge gap. */
    grid-template-rows: auto 1fr;
  }
  .sidebar {
    position: static;
    width: 100%;
    max-width: 100vw;
    height: auto;
    overflow: visible;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 14px 16px;
    gap: 12px;
  }
  .nav {
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    padding-bottom: 2px;
  }
  .nav-item {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .nav-item.active::before {
    display: none;
  }
  .side-link,
  .who {
    display: none;
  }
  .topbar {
    flex-wrap: wrap;
    gap: 10px;
    padding: 16px 18px 12px;
  }
  .workspace {
    padding: 18px 16px 44px;
  }
  .main {
    width: 100%;
    max-width: 100vw;
  }
  .solo-card {
    padding: 26px 22px 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
