/* ==========================================================================
   Onno Modz — design tokens + components

   FIXED PALETTE. Do not introduce another colour, gradient or glow.
   Purple #7C00FF is allowed in exactly three places:
     buttons · focused text boxes/dropdowns · highlighted text.
   Everything else is a dark neutral. See HANDOFF.md §10.

   Depth comes from the three neutral surfaces and 1px borders only — there is no
   elevation effect anywhere. A raised element is one step lighter than what it
   sits on: page #1A1A1A → card #242424 → control/popover #2C2C2C.
   ========================================================================== */

:root {
  /* --- accent (strictly: buttons, focus, highlighted text) ------------- */
  --accent:        #7C00FF;
  --accent-hover:  #6A00DB;   /* button hover (slightly darker) */
  --accent-rgb:    124, 0, 255;

  /* --- neutral surfaces ------------------------------------------------ */
  --bg:            #1A1A1A;   /* page background */
  --surface:       #242424;   /* cards / panels */
  --surface-2:     #2C2C2C;   /* text boxes / dropdowns */
  --surface-3:     #333333;   /* hover fill for neutral controls */
  --border:        #333333;   /* card border */
  --border-2:      #3A3A3A;   /* input border */
  --border-hover:  #484848;

  /* --- text ------------------------------------------------------------ */
  --text:          #FFFFFF;   /* main text */
  --text-dim:      #A0A0A0;   /* secondary text */
  --text-mute:     #6E6E6E;   /* tertiary (placeholders, meta) */

  /* --- status: monochrome only, differentiated by weight/opacity -------
     The palette has no green/red, so "ok" is brighter than "fail". */
  --ok:            #FFFFFF;
  --fail:          #A0A0A0;

  --radius:        10px;      /* buttons, text boxes, dropdowns */
  --radius-sm:     10px;
  --radius-lg:     14px;      /* cards / panels */
  --radius-pill:   999px;     /* internal only: scrollbars */

  /* Buttons and text boxes in the same row share this height. */
  --control-h:     42px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --sidebar-w: 244px;
  --topbar-h:  58px;
  --ease:      cubic-bezier(.2, .7, .2, 1);
}

/* ---- reset ---------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; font-weight: 600; }
a:hover { color: var(--accent-hover); }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.02em; }
p { margin: 0; }
b, strong { font-weight: 600; color: var(--text); }
::selection { background: var(--accent); color: #fff; }

/* Keyboard focus on non-text controls: a neutral ring. Text boxes use the purple
   border instead (see inputs). */
:focus-visible { outline: 2px solid var(--text-dim); outline-offset: 2px; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: none; }

/* scrollbar — neutral, no purple */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #3A3A3A; border-radius: var(--radius-pill); border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #4A4A4A; }

/* ---- buttons -------------------------------------------------------- */
/* One shared height: a button and a text box in the same row must line up. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--control-h);
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: inherit; font-size: 14px; font-weight: 700; letter-spacing: -.005em;
  color: #fff; background: var(--accent);
  cursor: pointer; user-select: none;
  transition: background .15s, border-color .15s, color .15s, transform .08s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { background: var(--accent-hover); color: #fff; }
.btn:active { background: var(--accent-hover); transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
/* Locked by the user's plan. Same treatment as :disabled on purpose — it reads as
   "not for you right now" without inventing a colour. The attribute is set by
   applyEntitlements() from the server's own answer; it is cosmetic, never the gate. */
.btn[data-locked="1"] { opacity: .4; cursor: not-allowed; transform: none; }
.btn svg { width: 16px; height: 16px; flex: none; }

/* neutral buttons: same height, no purple */
.btn-ghost, .btn-secondary {
  background: var(--surface-2); color: var(--text);
  border-color: var(--border-2); font-weight: 600;
}
.btn-ghost:hover, .btn-secondary:hover {
  background: var(--surface-3); border-color: var(--border-hover); color: var(--text);
}
.btn-ghost:active, .btn-secondary:active { background: var(--surface-3); }
.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn-lg { min-height: 48px; padding: 0 24px; font-size: 15px; }

/* spinner */
.spin {
  width: 15px; height: 15px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff; border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- inputs --------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 500; color: var(--text); }
.field-hint { font-size: 12px; color: var(--text-mute); }

.input, .select, .textarea {
  width: 100%;
  min-height: var(--control-h);
  padding: 0 13px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  color: var(--text); font: inherit; font-size: 14px;
  transition: border-color .15s, background .15s;
}
.textarea { padding: 10px 13px; }
.input::placeholder, .textarea::placeholder { color: var(--text-mute); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-hover); }
/* focus = purple border, nothing else */
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.input:disabled, .select:disabled { opacity: .5; cursor: not-allowed; }
.textarea { resize: vertical; min-height: 88px; font-family: var(--mono); font-size: 13px; line-height: 1.5; }

/* select with custom caret */
.select {
  appearance: none; cursor: pointer; padding-right: 36px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'><path d='M2.5 4.5L6 8L9.5 4.5' stroke='%23A0A0A0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right 13px center;
}
.select option { background: var(--surface-2); color: var(--text); }

/* Number inputs: drop the native up/down spinner. It renders as a light grey box
   that fights the dark palette and cannot be styled to match. */
.input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.input[type="number"]::-webkit-outer-spin-button,
.input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none; appearance: none; margin: 0;
}

/* ---- checkbox (neutral: checked is white, not purple) ---------------
   The real <input> stays in the DOM for the form logic and is only hidden
   visually; every visible box is a <label for> pointing at it, so several
   boxes (the form row and the Terms popover) always show the same state. */
.check-input {
  position: absolute; width: 1px; height: 1px;
  opacity: 0; pointer-events: none; margin: 0;
}
.check-box {
  position: relative; flex: none;
  width: 18px; height: 18px;
  border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--border-hover);
  transition: background .12s, border-color .12s;
}
.check-box::after {
  content: ""; position: absolute; inset: 0;
  background: var(--bg);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M4.5 9.2l3 3 6-6.4' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M4.5 9.2l3 3 6-6.4' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
  opacity: 0; transform: scale(.6);
  transition: opacity .12s, transform .12s var(--ease);
}
.check-label {
  display: inline-flex; align-items: center; gap: 10px;
  cursor: pointer; user-select: none;
}
.check-label:hover .check-box { border-color: var(--text-mute); }
.check-input:checked ~ .check-label .check-box,
.check-input:checked ~ .tos-anchor .check-box { background: var(--text); border-color: var(--text); }
.check-input:checked ~ .check-label .check-box::after,
.check-input:checked ~ .tos-anchor .check-box::after { opacity: 1; transform: none; }
.check-input:focus-visible ~ .check-label .check-box { border-color: var(--accent); }

/* ---- game icons ------------------------------------------------------
   Real 256x256 inventory previews from the game's own assets, copied into /icons
   by build_icons.py. They are full-colour and sit on the dark surface, so no
   tinting is applied — the art already has its own outline. */
.ic {
  width: 26px; height: 26px; flex: none;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
}
.ic-lg { width: 38px; height: 38px; flex: none; object-fit: contain; }

/* a combo row with an icon keeps the artwork aligned with the label */
.combo-item .ic { margin-right: 9px; }

/* ---- card header icons ----------------------------------------------
   One image per Mod card, from the game's own art, so each section reads at a
   glance the way it does in the game. Populated by decorateIcons() from
   /icons/categories.json; an empty span renders as nothing. */
.card-ic {
  width: 36px; height: 36px; flex: none; display: inline-block;
  padding: 3px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--border-2);
}
.card-ic:empty { display: none; }
.card-ic img { width: 100%; height: 100%; object-fit: contain; display: block; }
.btn-ic { width: 20px; height: 20px; flex: none; display: inline-block; margin-right: 2px; }
.btn-ic:empty { display: none; }
.btn-ic img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* Marks a card whose grant is not confirmed to work yet. Plain text rather than
   another colour: the palette is fixed. */
.wip {
  margin-left: auto;
  font-size: 11px; font-weight: 500; letter-spacing: .3px;
  color: var(--text-dim); text-transform: lowercase;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 2px 9px;
}

/* ---- slider --------------------------------------------------------- */
.slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: var(--radius-pill);
  background: var(--surface-3); outline: none; cursor: pointer;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 3px solid #fff;
  cursor: pointer;
}
.slider::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 3px solid #fff; cursor: pointer;
}
.slider::-moz-range-track { height: 6px; border-radius: var(--radius-pill); background: var(--surface-3); }

/* ---- card ----------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.card-title {
  display: flex; align-items: center; gap: 12px;
  font-size: 15px; font-weight: 600; letter-spacing: -.01em;
  color: var(--text); margin-bottom: 4px;
}
.card-desc { font-size: 13px; color: var(--text-dim); line-height: 1.55; }

/* ---- badge (neutral) ------------------------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  background: var(--surface-2); color: var(--text-dim);
  border: 1px solid var(--border-2);
}
.badge-ok { color: #fff; border-color: var(--text-mute); }
.badge-warn, .badge-danger { color: var(--text-dim); }

/* highlighted text is one of the three allowed purple uses */
.text-accent { color: var(--accent); font-weight: 600; }
mark, .hl { background: transparent; color: var(--accent); padding: 1px 0; }

/* ---- tabs (neutral segmented control) ------------------------------- */
.tabs {
  display: flex; gap: 2px; padding: 3px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.tab {
  flex: 1; height: 34px; padding: 0 16px;
  border: 1px solid transparent; border-radius: var(--radius);
  background: transparent; color: var(--text-dim);
  font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface-2); border-color: var(--border-2); color: var(--text); }

/* ---- table ---------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; padding: 10px 12px; color: var(--text-mute);
  font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
}
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); }
.table tr:hover td { background: var(--surface-2); }

/* ---- toast (neutral panel) ------------------------------------------ */
.toasts {
  position: fixed; bottom: 20px; right: 20px; z-index: 9000;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  min-width: 220px; max-width: 360px; padding: 12px 16px 12px 42px;
  border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--border-hover);
  color: var(--text); font-size: 13.5px; font-weight: 500; line-height: 1.4;
  animation: toastIn .22s var(--ease); position: relative;
}
.toast.info { padding-left: 16px; }
/* The icon is a mask filled with currentColor, so it stays inside the palette and
   needs no image request (CSP allows data: for img, and this avoids one entirely). */
.toast.ok, .toast.error, .toast.info, .toast.work { position: relative; }
.toast.error::before {
  content: ''; position: absolute; left: 14px; top: 50%;
  width: 17px; height: 17px; margin-top: -8.5px;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-size: contain; mask-size: contain;
}
.toast.ok { border-color: #2E9E5B; padding-left: 16px; }
/* ⚠️ NO ::before CHECK ICON ON SUCCESS. The success mark is the ✅ emoji the message
   itself carries (one icon, on the owner's call) — a CSS icon here made it two. */
.toast.error { border-color: #B3261E; }
.toast.error::before {
  background: #FF5C52;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='9' fill='none' stroke='%23000' stroke-width='2.5'/%3E%3Cpath d='M7.5 12h9' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='9' fill='none' stroke='%23000' stroke-width='2.5'/%3E%3Cpath d='M7.5 12h9' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E");
}
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* Working: accent border and a spinner. Accent is the right colour here because it
   is the one non-semantic colour in the palette — not green (nothing is finished
   yet) and not red (nothing has failed). */
.toast.work { border-color: var(--accent); }
.toast.work::before {
  content: ''; position: absolute; left: 14px; top: 50%;
  width: 15px; height: 15px; margin-top: -7.5px;
  /* The dim ring is a palette border token, not a translucent accent: the design
     system forbids tinted or derived colours. The solid accent on one side is what
     makes it read as motion. */
  border: 2px solid var(--border-hover);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* ---- modal ---------------------------------------------------------- */
.backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.7);
  z-index: 8000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 460px;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  animation: pop .2s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.985); } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 16px 22px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.modal-body { padding: 22px; }
.modal-body .card-desc.mb { margin-bottom: 16px; }
.modal-x {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 1px solid transparent; border-radius: var(--radius);
  color: var(--text-dim); cursor: pointer; font-size: 20px; line-height: 1;
  transition: background .15s, color .15s;
}
.modal-x:hover { color: #fff; background: var(--surface-2); border-color: var(--border-2); }

/* ---- layout --------------------------------------------------------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: none;
  background: var(--bg); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand {
  height: var(--topbar-h); flex: none;
  display: flex; align-items: center;
  padding: 0 22px; border-bottom: 1px solid var(--border);
  font-size: 17px; font-weight: 800; letter-spacing: -.025em;
}
.brand-onno { color: var(--accent); }
.nav { flex: 1; padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-label {
  padding: 14px 10px 6px; font-size: 11px; font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase; color: var(--text-mute);
}
.nav-label:first-child { padding-top: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  height: 38px; padding: 0 11px; border-radius: var(--radius);
  color: var(--text-dim); font-weight: 500; cursor: pointer; user-select: none;
  border: 1px solid transparent;
  transition: background .14s, color .14s, border-color .14s;
}
.nav-item:hover { background: var(--surface); color: #fff; }
.nav-item.active { background: var(--surface-2); border-color: var(--border-2); color: #fff; }
.nav-item svg { width: 18px; height: 18px; flex: none; }
.side-foot { padding: 12px; border-top: 1px solid var(--border); }
.side-action {
  width: 100%; display: flex; align-items: center; gap: 11px;
  height: 38px; padding: 0 11px;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius);
  color: var(--text-dim); font: inherit; font-weight: 500; cursor: pointer;
  transition: background .14s, color .14s;
}
.side-action:hover { background: var(--surface); color: #fff; }
.side-action svg { width: 18px; height: 18px; flex: none; }

.content { flex: 1; min-width: 0; }
.topbar {
  height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 0 32px; border-bottom: 1px solid var(--border); background: var(--bg);
  position: sticky; top: 0; z-index: 100;
}
.topbar-title { font-size: 14px; font-weight: 600; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-sep { width: 1px; height: 20px; background: var(--border); flex: none; }
.topbar-user { font-size: 13px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.page { padding: 36px 40px 72px; max-width: 1180px; margin: 0 auto; }
.page-title { font-size: 26px; font-weight: 700; letter-spacing: -.03em; line-height: 1.2; margin-bottom: 6px; }
.page-sub { color: var(--text-dim); font-size: 14.5px; margin-bottom: 28px; }

/* ---- searchable combo (custom dropdown) ----------------------------- */
.combo { position: relative; }
.combo-input { width: 100%; padding-right: 36px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236E6E6E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><path d='m20 20-3.5-3.5'/></svg>");
  background-repeat: no-repeat; background-position: right 13px center; }
.combo-input.open { border-color: var(--accent); }
.combo-list {
  display: none; position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 300;
  max-height: 232px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface-2); border: 1px solid var(--border-hover);
  border-radius: var(--radius); padding: 4px;
}
.combo-list.open { display: block; animation: fade .1s ease; }
.combo-item {
  padding: 8px 10px; cursor: pointer; font-size: 13px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  color: var(--text-dim); transition: background .1s, color .1s;
}
.combo-item:hover, .combo-item.active { background: var(--surface-3); color: #fff; }
.combo-item .cn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.combo-item .cid { color: var(--text-mute); font-family: var(--mono); font-size: 11px; flex: none; }
.combo-empty { padding: 10px; color: var(--text-mute); font-size: 13px; text-align: center; }
/* items we cannot give yet: neutral + dimmed, and not clickable */
.combo-item.unavailable { opacity: .45; cursor: default; }
.combo-item.unavailable:hover { background: transparent; }
.combo-list::-webkit-scrollbar { width: 8px; }
.combo-list::-webkit-scrollbar-thumb { background: #3A3A3A; border-radius: var(--radius-pill); border: 2px solid var(--surface-2); }
.combo-list::-webkit-scrollbar-thumb:hover { background: #4A4A4A; }

/* ---- activity log (neutral; ok/fail differ by weight, not colour) ---- */
.modlog {
  max-height: 340px; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px;
  font-family: var(--mono); font-size: 12px;
}
.modlog::-webkit-scrollbar-thumb { border-color: var(--bg); }
.modlog-empty { color: var(--text-mute); padding: 22px 12px; text-align: center; font-family: var(--font); font-size: 13px; }
.logrow {
  padding: 9px 11px; border-radius: var(--radius);
  border-left: 2px solid var(--border-2); background: var(--surface);
  margin-bottom: 4px;
}
.logrow:last-child { margin-bottom: 0; }
.logrow.ok { border-left-color: #fff; }
.logrow.fail { border-left-color: var(--text-mute); }
.logrow .lhead { display: flex; justify-content: space-between; gap: 10px; color: #fff; font-weight: 600; }
.logrow.fail .lhead { color: var(--text-dim); font-weight: 500; }
.logrow .ltime { color: var(--text-mute); font-weight: 400; flex: none; }
.logrow .lbody { color: var(--text-dim); margin-top: 4px; white-space: pre-wrap; word-break: break-all; }
.logrow .lresp { color: #fff; margin-top: 4px; white-space: pre-wrap; word-break: break-all; }
.logrow .lerr  { color: var(--text-dim); margin-top: 4px; }

/* ---- accounts header ------------------------------------------------ */
.acct-hero {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px 24px; padding: 22px 24px;
}
.acct-hero-text { min-width: 0; flex: 1 1 320px; }
.acct-hero-text .card-desc { max-width: 520px; }
.acct-hero-side { display: flex; align-items: center; gap: 24px; }
.stat { text-align: right; }
.stat-n { font-size: 24px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-k { font-size: 11px; font-weight: 600; color: var(--text-mute); text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }

/* ---- account card: name / id / level -------------------------------- */
#acct-list { gap: 10px; }
.acct-row { display: flex; align-items: center; gap: 16px; }
.card.acct-row { padding: 16px 18px 16px 16px; transition: border-color .15s; }
.card.acct-row:hover { border-color: var(--border-hover); }
.acct-row .card-title { margin-bottom: 2px; }
.acct-avatar {
  width: 44px; height: 44px; flex: none;
  border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--border-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; letter-spacing: .02em; color: #fff;
}
.acct-main { flex: 1; min-width: 0; }
.acct-main .card-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-level {
  text-align: right; flex: none; padding: 0 18px 0 4px; margin-right: 2px;
  border-right: 1px solid var(--border);
}
.lookup-meta .acct-level { border-right: 0; }
.acct-level .n { font-size: 20px; font-weight: 700; line-height: 1.1; color: #fff; font-variant-numeric: tabular-nums; }
.acct-level .k {
  color: var(--text-mute); font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; margin-top: 2px;
}

/* ---- live progress grid (get_progress) ------------------------------ */
.progress-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-top: 16px; }
.pstat {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px;
}
.pstat .k { color: var(--text-mute); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.pstat .v { font-size: 16px; font-weight: 700; margin-top: 3px; word-break: break-word; color: #fff; font-variant-numeric: tabular-nums; }
.progress-note { grid-column: 1 / -1; color: var(--text-dim); font-size: 12px; }
.progress-note:empty { display: none; }

/* status line for the live session — collapses when there is nothing to say */
.status-line { color: var(--text-dim); margin: 0; }
.status-line.is-on { color: #fff; }
.status-line:empty { display: none; }

/* Ban display. Red is the one deliberate exception to the fixed palette: a ban
   has to read as a warning at a glance. Nothing else may introduce a colour. */
.acct-row.is-banned, .card.is-banned { border-color: #B3261E; }
.ban-tag {
  display: inline-block; margin-top: 6px; padding: 2px 8px;
  border-radius: var(--radius); font-size: 10.5px; font-weight: 700;
  letter-spacing: .06em; color: #FF5C52;
  background: #2A1614; border: 1px solid #B3261E;
}

/* ---- player lookup cards --------------------------------------------- */
.lookup-card { display: block; }
.lookup-meta {
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
  flex: none;
}
.lookup-meta .acct-level { padding: 0; }
.tag {
  display: inline-block; padding: 2px 8px; border-radius: var(--radius);
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.tag-live { color: var(--accent); border: 1px solid; border-color: var(--accent); }
.tag-cached { color: var(--text-mute); border: 1px solid var(--border-2); }
.lookup-note { grid-column: 1 / -1; padding: 12px 16px; color: var(--text-dim); font-size: 12.5px; }

/* coins/gems summary in the lookup card header */
.lookup-money { display: flex; flex-direction: column; gap: 2px; }
.lookup-money-line {
  display: flex; justify-content: flex-end; gap: 8px;
  font-size: 12px; color: var(--text-dim);
}
.lookup-money-line span:first-child {
  color: var(--text-mute); font-size: 10px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
}
.lookup-money-line span:last-child { color: #fff; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---- mod panel ------------------------------------------------------- */
#mod-actions { gap: 14px; }
#mod-actions > .card { display: flex; flex-direction: column; }
#mod-actions > .card > .card-title { margin-bottom: 0; }
#mod-actions > .card > .field.mt { margin-top: 18px; margin-bottom: 0; }
#mod-actions > .card > .row.mt { margin-top: 12px; }
#mod-actions > .card > .card-title + .row.mt { margin-top: 18px; }
#mod-actions > .card > .row.mt + .field.mt { margin-top: 12px; }
#mod-actions > .card > .btn:last-child { margin-top: 12px; align-self: flex-start; }
#mod-connect-card .select { flex: 1; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ⭐ Danger button — red on the owner's explicit request (Wipe account). Scoped to this
   class; the palette stays fixed everywhere else. */
.btn-danger {
  background: #2A1614; border: 1px solid #B3261E; color: #FF5C52; font-weight: 600;
}
.btn-danger:hover { background: #3A1C19; color: #FF5C52; }
.btn-danger:active { background: #3A1C19; }

/* collapsed developer tool */
.dev-tool { padding: 0; }
.dev-tool > summary {
  cursor: pointer; font-weight: 600; color: var(--text-dim);
  list-style: none; display: flex; align-items: center; gap: 10px;
  padding: 16px 20px; border-radius: var(--radius-lg);
  transition: color .14s;
}
.dev-tool > summary::-webkit-details-marker { display: none; }
.dev-tool > summary::before {
  content: ""; width: 14px; height: 14px; flex: none; background: var(--text-mute);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform .15s var(--ease);
}
.dev-tool[open] > summary::before { transform: rotate(90deg); }
.dev-tool > summary:hover { color: #fff; }
.dev-tool[open] > summary { border-bottom: 1px solid var(--border); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.dev-tool[open] { padding-bottom: 20px; }
.dev-tool > :not(summary) { margin-left: 20px; margin-right: 20px; }

/* ---- pricing / plans ------------------------------------------------- */
.plan-badge {
  display: inline-flex; align-items: center; gap: 7px;
  height: 28px; padding: 0 11px;
  font-size: 12px; font-weight: 600; letter-spacing: .01em; white-space: nowrap;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-2); background: var(--surface); color: var(--text-dim);
}
.plan-badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; flex: none;
  background: currentColor;
}
.plan-badge.plan-active { border-color: #2E9E5B; color: #6FD79A; }
.plan-badge.plan-credits { border-color: #C8A24A; color: #E7C877; }

.pricing-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  flex-wrap: wrap; gap: 18px 24px; margin-bottom: 18px;
}
.pricing-head .page-sub { margin-bottom: 0; }

/* informational strip: neutral border, an "i" mark, collapses when empty */
.notice {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; margin-bottom: 22px;
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-dim); font-size: 13px;
}
.notice::before {
  content: ""; width: 16px; height: 16px; flex: none; background: var(--text-mute);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5M12 7.5v.01'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5M12 7.5v.01'/%3E%3C/svg%3E") center / contain no-repeat;
}
.notice:empty { display: none; }

.seg {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.seg-btn {
  height: 34px; padding: 0 16px;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius);
  color: var(--text-dim); cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600;
  transition: background .14s, color .14s, border-color .14s;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--surface-3); border-color: var(--border-hover); color: var(--text); }

.plan-grid { gap: 16px; align-items: stretch; }

/* A plan card is laid out by CSS order, so the renderer's element order does not
   matter: name → blurb → price + period on one line → CTA → feature list. */
.plan-card {
  position: relative;
  display: flex; flex-wrap: wrap; align-items: baseline; align-content: flex-start;
  padding: 24px;
}
.plan-card > * { flex: 0 0 100%; min-width: 0; }
.plan-card > .card-title { order: 1; margin: 0; font-size: 15px; }
.plan-card > .card-desc { order: 2; margin-top: 4px; }
.plan-card > .plan-price {
  order: 3; flex: 0 0 auto;
  margin-top: 22px; font-size: 38px; font-weight: 700; line-height: 1;
  letter-spacing: -.035em; font-variant-numeric: tabular-nums;
}
.plan-card > .dim.small { order: 4; flex: 0 0 auto; margin-left: 8px; font-size: 13px; white-space: nowrap; }
.plan-card > .btn { order: 5; margin-top: 22px; }
.plan-card > .plan-feats { order: 6; }
.plan-feats {
  list-style: none; margin: 22px 0 0; padding: 20px 0 0;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px;
}
.plan-feats li {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 0; color: var(--text-dim); font-size: 13.5px; line-height: 1.45;
}
.plan-feats li::before {
  content: ""; width: 16px; height: 16px; flex: none; margin-top: 1px; background: var(--text);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* The recommended plan (Professional, the middle tier): lighter surface, stronger
   border and a label. Purple stays on its button only — the other plans' buttons
   go neutral so the recommendation is the one purple action on the row. */
#plan-grid .plan-card:nth-child(2) { background: var(--surface-2); border-color: var(--text-mute); }
#plan-grid .plan-card:nth-child(2) .plan-feats { border-top-color: var(--border-hover); }
#plan-grid .plan-card:nth-child(2)::after {
  content: "Most popular";
  position: absolute; top: -12px; right: 20px;
  padding: 3px 9px; border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 600; letter-spacing: .02em; line-height: 1.5;
  color: var(--text); background: var(--surface-3); border: 1px solid var(--border-hover);
}
#plan-grid .plan-card:not(:nth-child(2)) > .btn,
#credit-grid .plan-card > .btn {
  background: var(--surface-2); border-color: var(--border-2); color: var(--text); font-weight: 600;
}
#plan-grid .plan-card:not(:nth-child(2)) > .btn:hover,
#credit-grid .plan-card > .btn:hover { background: var(--surface-3); border-color: var(--border-hover); }

.pricing-section { margin-top: 44px; }
.section-head { margin-bottom: 16px; }
.section-title { font-size: 17px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 4px; }
.section-desc { color: var(--text-dim); font-size: 13.5px; max-width: 620px; }
.section-note { color: var(--text-mute); font-size: 12.5px; margin-top: 12px; }
.section-note:empty { display: none; }

#credit-grid .plan-card { padding: 20px; }
#credit-grid .plan-card > .plan-price { font-size: 28px; margin-top: 14px; }
#credit-grid .plan-card > .btn { margin-top: 18px; }

/* cost list: two columns of label / value rows. The rows carry a TOP border and
   the list is clipped by 1px, which hides the first border in each column. */
.cost-card { padding: 4px 24px; }
.cost-table {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 48px;
  clip-path: inset(1px 0 0 0);
}
.cost-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: 12px 0; border-top: 1px solid var(--border);
  font-size: 13.5px; color: var(--text-dim);
}
.cost-row > span:first-child { display: inline-block; }
.cost-row > span:first-child::first-letter { text-transform: uppercase; }
.cost-val { color: var(--text); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* checkout status: a quiet strip with a lock mark */
.checkout-card {
  display: grid; grid-template-columns: auto 1fr; column-gap: 14px; align-items: start;
  margin-top: 24px; padding: 16px 20px;
  background: transparent;
}
.checkout-card::before {
  content: ""; grid-row: span 2; width: 18px; height: 18px; margin-top: 1px; background: var(--text-dim);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4.5' y='10.5' width='15' height='10' rx='2'/%3E%3Cpath d='M8 10.5V7.5a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4.5' y='10.5' width='15' height='10' rx='2'/%3E%3Cpath d='M8 10.5V7.5a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E") center / contain no-repeat;
}
.checkout-card:empty { display: none; }
.checkout-card .card-title { font-size: 14px; margin-bottom: 2px; }

/* ---- terms text (signup popover) ------------------------------------ */
.tos-h { font-weight: 600; font-size: 13px; color: var(--text); margin: 18px 0 6px; }
.tos-h:first-child { margin-top: 0; }
.tos-p { margin: 0 0 8px; color: var(--text-dim); font-size: 12.5px; line-height: 1.65; }

/* ---- auth / landing ------------------------------------------------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 48px 20px; position: relative;
}
.auth-shell { width: 100%; max-width: 404px; }
.auth-brand {
  font-size: 20px; font-weight: 800; letter-spacing: -.025em;
  text-align: center; margin-bottom: 26px;
}
.auth-card {
  position: relative; width: 100%;
  background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 32px;
}
.auth-title { font-size: 22px; font-weight: 700; letter-spacing: -.025em; margin-bottom: 6px; }
.auth-sub { color: var(--text-dim); margin-bottom: 26px; font-size: 14px; }
.auth-card .btn-block[type="submit"] { margin-top: 6px; }
.auth-foot { text-align: center; margin-top: 22px; color: var(--text-dim); font-size: 13.5px; }
.error-box {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--surface-2); border: 1px solid var(--border-hover);
  color: var(--text); padding: 10px 12px; border-radius: var(--radius); font-size: 13px; margin-bottom: 16px;
}
.error-box::before {
  content: ""; width: 16px; height: 16px; flex: none; margin-top: 1px; background: var(--text-dim);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7.5v5.5M12 16.5v.01'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7.5v5.5M12 16.5v.01'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Terms agreement row on signup. Hovering (or focusing) "Terms of Service" opens a
   scrollable panel with the full text and its own checkbox; both boxes are labels
   for the same input, so ticking either one ticks the other. */
.tos-row {
  display: flex; align-items: center; flex-wrap: wrap;
  margin: 2px 0 22px; font-size: 13.5px; color: var(--text-dim);
}
.tos-row .check-label { gap: 10px; }
.tos-anchor { display: inline; margin-left: 4px; }
.tos-trigger {
  color: var(--accent); font-weight: 600; cursor: help;
  border-radius: 4px;
}
.tos-trigger:hover { color: var(--accent-hover); }
/* The panel is anchored to the auth card (the nearest positioned box), inset 12px,
   and ends just above the agreement row: the bottom offset is what sits under the
   row — the row + its margin 22 + the button 42 + card padding 32 — plus a gap.
   So it covers the form like a sheet while the row and the button stay visible. */
.tos-pop {
  position: absolute; left: 12px; right: 12px; top: 12px; bottom: 134px; z-index: 60;
  display: flex; flex-direction: column;
  background: var(--surface-2); border: 1px solid var(--border-hover);
  border-radius: var(--radius-lg);
  opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: opacity .16s ease .18s, transform .16s ease .18s, visibility 0s linear .34s;
  cursor: auto;
}
/* invisible bridge over the gap, so moving the pointer up into the panel keeps it open */
.tos-pop::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 22px; }
.tos-anchor:hover .tos-pop,
.tos-anchor:focus-within .tos-pop {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity .16s ease, transform .16s var(--ease), visibility 0s;
}
.tos-pop-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--border-hover);
}
.tos-pop-title { font-size: 14px; font-weight: 700; color: var(--text); }
.tos-pop-meta { font-size: 11.5px; color: var(--text-mute); white-space: nowrap; }
.tos-pop-body {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 16px 18px 10px;
}
.tos-pop-body::-webkit-scrollbar-thumb { border-color: var(--surface-2); }
.tos-pop-foot { padding: 10px; border-top: 1px solid var(--border-hover); }
.tos-accept {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 10px; border-radius: var(--radius);
  font-size: 13.5px; font-weight: 600; color: var(--text);
  cursor: pointer; user-select: none; transition: background .12s;
}
.tos-accept:hover { background: var(--surface-3); }
.tos-accept:hover .check-box { border-color: var(--text-mute); }

/* landing */
.landing { min-height: 100vh; display: flex; flex-direction: column; }
.landing-top {
  height: 68px; flex: none; display: flex; align-items: center;
  padding: 0 32px; border-bottom: 1px solid var(--border);
}
.wordmark { font-size: 17px; font-weight: 800; letter-spacing: -.025em; }
.landing-hero {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 72px 20px 96px;
}
.landing-title {
  max-width: 720px; font-size: clamp(34px, 5.2vw, 56px); font-weight: 800;
  line-height: 1.06; letter-spacing: -.04em;
}
.landing-sub {
  max-width: 500px; margin-top: 20px;
  color: var(--text-dim); font-size: 16.5px; line-height: 1.6;
}
.landing-cta { display: flex; gap: 12px; margin-top: 36px; flex-wrap: wrap; justify-content: center; }
.landing-foot {
  flex: none; display: flex; justify-content: space-between; gap: 16px;
  padding: 20px 32px; border-top: 1px solid var(--border);
  color: var(--text-mute); font-size: 12.5px;
}

/* ---- misc ----------------------------------------------------------- */
.row { display: flex; gap: 12px; }
.row-center { align-items: center; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.spacer { flex: 1; }
.dim { color: var(--text-dim); }
.mute { color: var(--text-mute); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }

/* ---- lookup ---------------------------------------------------------- */
#lookup-panel > .card > .row { margin-top: 14px; }

/* ---- responsive ----------------------------------------------------- */
@media (max-width: 1180px) {
  .plan-card { padding: 20px; }
  .plan-card > .plan-price { font-size: 32px; }
  #credit-grid .plan-card > .plan-price { font-size: 24px; }
}
@media (max-width: 1000px) {
  .grid-3 { grid-template-columns: 1fr; }
  #credit-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .page { padding: 28px 24px 64px; }
  .topbar { padding: 0 24px; }
}
/* Below tablet width the sidebar becomes a top bar with a scrolling tab strip,
   so navigation is never lost on a phone. */
@media (max-width: 800px) {
  .shell { flex-direction: column; }
  .sidebar {
    position: relative; width: 100%; height: auto;
    flex-direction: row; align-items: center; flex-wrap: wrap;
    border-right: 0; border-bottom: 1px solid var(--border);
  }
  .brand { border-bottom: 0; height: 56px; padding: 0 16px; flex: 1; }
  .side-foot { border-top: 0; padding: 0 10px; }
  .side-action span { display: none; }
  .side-action { width: 40px; justify-content: center; padding: 0; }
  .nav {
    order: 3; flex: 0 0 100%; flex-direction: row; gap: 4px;
    padding: 8px 12px; overflow-x: auto; border-top: 1px solid var(--border);
  }
  .nav-label { display: none; }
  .nav-item { flex: none; height: 34px; }
  .topbar { padding: 0 16px; height: 52px; }
  .topbar-title { display: none; }
  .topbar-right { width: 100%; justify-content: space-between; }
  .topbar-sep { display: none; }
  .page { padding: 22px 16px 56px; }
  .page-title { font-size: 22px; }
  .grid-2, .grid-3, #credit-grid { grid-template-columns: 1fr; }
  .cost-table { grid-template-columns: 1fr; }
  .cost-card { padding: 4px 18px; }
  .acct-hero-side { width: 100%; justify-content: space-between; }
  .stat { text-align: left; }
  .card.acct-row { flex-wrap: wrap; }
  .acct-level { border-right: 0; padding-right: 4px; }
  .landing-top, .landing-foot { padding-left: 16px; padding-right: 16px; }
  .auth-card { padding: 24px 20px; }
  .tos-pop { left: 8px; right: 8px; top: 8px; bottom: 126px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
