/* Developer console + "allow this app?" page.
   Its own look, not the game's: warm paper (light) or ink (dark) by the system setting, hairline borders, one green accent,
   ink-coloured main buttons, a settings-style left menu, app tiles, a docs-style code box and a centred consent card. */
:root {
  --bg: #f6f6f3; --surface: #ffffff; --surface2: #fafaf7; --ink: #15161a; --muted: #686b74; --line: #e6e5df; --line2: #d3d2c9;
  --accent: #0b8f6c; --accent-soft: #e2f4ee; --accent-ink: #ffffff;
  --warn-bg: #fff6e0; --warn-line: #ecd592; --warn-ink: #7a5600;
  --bad-bg: #fdecea; --bad-line: #f2b7b1; --bad-ink: #a3231b;
  --code-bg: #101216; --code-ink: #d9dce3; --code-dim: #7d8391; --code-hi: #6ee7b7;
  --shadow: 0 1px 2px rgb(20 20 30 / 0.04), 0 8px 24px rgb(20 20 30 / 0.05);
  --focus: #1f6feb;
  /* names the shared connection window already uses */
  --card: var(--surface); --card2: var(--surface2); --card3: var(--line); --fg: var(--ink); --edge: var(--line2); --field: var(--surface2);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0b0d; --surface: #121317; --surface2: #0e0f12; --ink: #ecedf0; --muted: #8e929c; --line: #22252b; --line2: #333740;
    --accent: #34d3a4; --accent-soft: #0e2a22; --accent-ink: #04241a;
    --warn-bg: #2a2310; --warn-line: #5a4a18; --warn-ink: #f2cf72;
    --bad-bg: #2b1313; --bad-line: #6a2a27; --bad-ink: #ffb2ab;
    --code-bg: #07080a; --code-ink: #d9dce3; --code-dim: #6f7583; --code-hi: #6ee7b7;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 10px 30px rgb(0 0 0 / 0.35);
    --focus: #6ea8ff;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
button, input, textarea { font-family: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.sp { flex: 1; }

/* ---- top bar ---- */
.bar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.bar::before { content: ""; position: absolute; inset: 0 0 auto; height: 2px; background: linear-gradient(90deg, #0b8f6c, #2f7bff 55%, #9b5cff); }
.bar-in { max-width: 1180px; margin: 0 auto; padding: 0 24px; height: 58px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font-weight: 700; letter-spacing: -0.01em; }
.mark { width: 28px; height: 28px; border-radius: 8px; display: block; }
.slash { color: var(--line2); font-size: 22px; font-weight: 300; }
.brand-s { color: var(--muted); font-weight: 600; }
.back { color: var(--muted); text-decoration: none; font-size: 14px; white-space: nowrap; }
.back:hover { color: var(--ink); }
.chip { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 13px; font-weight: 600; max-width: 180px; }
.chip i { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font: 800 12px/1 var(--sans); font-style: normal; flex: none; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* language picker (made by the shared script) */
.lang { position: relative; flex: none; }
.lang-btn { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.lang-btn:hover, .lang-btn[aria-expanded="true"] { border-color: var(--line2); }
.flag { width: 20px; height: 14px; border-radius: 2px; object-fit: cover; box-shadow: 0 0 0 1px rgb(0 0 0 / 0.12); flex: none; }
.lang-list { position: absolute; top: calc(100% + 8px); right: 0; z-index: 60; margin: 0; padding: 4px; list-style: none; min-width: 190px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.lang-list[hidden] { display: none; }
.lang-list button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.lang-list button:hover { background: var(--surface2); }
.lang-list button.on { background: var(--accent-soft); font-weight: 600; }

/* ---- shell: left menu + content ---- */
.shell { max-width: 1180px; margin: 0 auto; padding: 36px 24px 60px; display: grid; grid-template-columns: 216px minmax(0, 1fr); gap: 48px; align-items: start; }
.side { position: sticky; top: 94px; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; color: var(--muted); font: 600 14px/1 var(--sans); text-align: left; padding: 10px 12px; border-radius: 8px; cursor: pointer; }
.side nav button svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.side nav button:hover { background: var(--surface); color: var(--ink); }
.side nav button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.side nav button[aria-selected="true"] svg { color: var(--accent); }
.main { min-width: 0; }
.head { margin-bottom: 22px; }
.head h1 { margin: 0; font-size: 30px; line-height: 1.15; letter-spacing: -0.025em; font-weight: 700; }
.head p { margin: 8px 0 0; color: var(--muted); max-width: 620px; }
.msg { min-height: 20px; margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.msg.err { color: var(--bad-ink); }
.msg.ok { color: var(--accent); }
.pane { display: flex; flex-direction: column; gap: 16px; }
.legal { margin-top: 40px; display: flex; gap: 10px; color: var(--muted); font-size: 13px; }
.legal a { color: var(--muted); }
.legal a:hover { color: var(--ink); }

/* ---- cards and rows ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.card-h { padding: 18px 20px 0; }
.card-h h2 { margin: 0; font-size: 16px; letter-spacing: -0.01em; }
.card-h p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.setting { display: flex; align-items: center; gap: 18px; padding: 18px 20px; flex-wrap: wrap; }
.setting + .setting { border-top: 1px solid var(--line); }
.setting .t { flex: 1 1 280px; min-width: 0; }
.setting .t b { display: block; font-size: 15px; letter-spacing: -0.01em; }
.setting .t span { display: block; color: var(--muted); font-size: 14px; margin-top: 2px; }
.status { display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px 3px 8px; border-radius: 999px; font: 700 12px/1.4 var(--sans); background: var(--surface2); color: var(--muted); border: 1px solid var(--line); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--line2); }
.status.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.status.on::before { background: var(--accent); }
.acts { display: flex; flex-wrap: wrap; gap: 8px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line2); background: var(--surface); color: var(--ink); font: 600 14px/1 var(--sans); padding: 10px 15px; border-radius: 9px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover:not(:disabled) { background: var(--surface2); border-color: var(--muted); }
.btn.main { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.main:hover:not(:disabled) { opacity: 0.88; background: var(--ink); }
.btn.warn { color: var(--bad-ink); }
.btn.warn:hover:not(:disabled) { background: var(--bad-bg); border-color: var(--bad-line); }
.btn.small { padding: 7px 11px; font-size: 13px; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* checklist (Vercel-like onboarding) */
.steps { margin: 0; padding: 6px 20px 18px; list-style: none; display: flex; flex-direction: column; }
.steps li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.steps li:first-child { border-top: 0; }
.steps .no { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line2); display: grid; place-items: center; font: 700 12px/1 var(--sans); color: var(--muted); flex: none; }
.steps li.ok .no { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.steps li.ok .tx { color: var(--muted); }
.steps .tx { flex: 1; min-width: 0; }
.bar-p { height: 6px; margin: 14px 20px 4px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar-p i { display: block; height: 100%; background: linear-gradient(90deg, #0b8f6c, #2f7bff); border-radius: 99px; }

/* ---- app tiles (Discord-portal style grid) ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.tile { display: flex; flex-direction: column; gap: 14px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); min-width: 0; }
.tile-top { display: flex; align-items: center; gap: 14px; min-width: 0; }
.tile-top img, .tile-top .ph { width: 52px; height: 52px; border-radius: 13px; object-fit: cover; flex: none; background: var(--accent-soft); }
.ph { display: grid; place-items: center; color: var(--accent); font: 800 21px/1 var(--sans); }
.tile .nm { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.tile .nm b { font-size: 16px; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .nm small { color: var(--muted); font-size: 13px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font: 700 11.5px/1.6 var(--sans); background: var(--surface2); color: var(--muted); border: 1px solid var(--line); }
.pill.ok { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pill.warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-line); }
.pill.bad { background: var(--bad-bg); color: var(--bad-ink); border-color: var(--bad-line); }
.idline { display: flex; align-items: center; gap: 8px; padding: 7px 8px 7px 11px; border-radius: 9px; background: var(--surface2); border: 1px solid var(--line); font: 12.5px/1.2 var(--mono); color: var(--muted); }
.idline span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile.new { align-items: center; justify-content: center; text-align: center; min-height: 190px; border-style: dashed; border-color: var(--line2); background: transparent; box-shadow: none; cursor: pointer; color: var(--muted); font: 600 14px var(--sans); }
.tile.new:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: var(--surface); }
.tile.new:disabled { opacity: 0.5; cursor: default; }
.tile.new svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.hint { margin: 0; color: var(--muted); font-size: 13px; }

/* docs-style box under an app: endpoints and a sample link */
.docs { grid-column: 1 / -1; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); display: flex; flex-direction: column; gap: 14px; }
.docs h3 { margin: 0; font-size: 15px; }
.kv { margin: 0; display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; min-width: 0; font: 12.5px/1.3 var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code { margin: 0; position: relative; border-radius: 10px; background: var(--code-bg); color: var(--code-ink); padding: 14px 16px; font: 12.5px/1.65 var(--mono); overflow-x: auto; white-space: pre; }
.code .c { color: var(--code-dim); }
.code .h { color: var(--code-hi); }
.code-wrap { position: relative; }
.code-wrap .btn { position: absolute; top: 8px; right: 8px; background: rgb(255 255 255 / 0.08); color: #e8eaf0; border-color: rgb(255 255 255 / 0.16); }

/* ---- list rows (allowed apps, team) ---- */
.rows { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; flex-wrap: wrap; }
.row + .row { border-top: 1px solid var(--line); }
.row img, .row .ph { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; flex: none; background: var(--accent-soft); }
.row .nm { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row .nm b { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row .nm small { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.empty { padding: 34px 20px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line2); border-radius: 12px; }

/* ---- dialogs ---- */
.dm-back { position: fixed; inset: 0; z-index: 65; background: rgb(10 12 18 / 0.55); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; }
.dm-dlg { box-sizing: border-box; width: min(480px, 100%); max-height: 100%; overflow: auto; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; padding: 22px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 30px 80px rgb(0 0 0 / 0.3); }
.dm-head { display: flex; align-items: center; justify-content: space-between; }
.dm-head h2 { margin: 0; font-size: 19px; letter-spacing: -0.015em; }
.dm-x { border: 0; background: transparent; color: var(--muted); font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px; border-radius: 6px; }
.dm-x:hover { color: var(--ink); }
.dm-lead { margin: 0; color: var(--muted); font-size: 14px; }
.dm-info { margin: 0; padding: 10px 12px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-size: 13px; }
.dm-err { padding: 10px 12px; border-radius: 9px; background: var(--bad-bg); border: 1px solid var(--bad-line); color: var(--bad-ink); font-size: 14px; }
.dm-field { display: flex; flex-direction: column; gap: 6px; }
.dm-field label { font-size: 13px; font-weight: 600; color: var(--ink); text-transform: none; letter-spacing: 0; }
.dm-help { margin: 0; color: var(--muted); font-size: 12.5px; }
.dm-input, .dm-copy input { box-sizing: border-box; width: 100%; min-width: 0; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line2); background: var(--surface); color: var(--ink); font: 14px var(--sans); }
textarea.dm-input { font-family: var(--mono); font-size: 13px; resize: vertical; }
.dm-input:focus, .dm-copy input:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.dm-code { text-align: center; font: 600 22px/1.2 var(--mono); letter-spacing: 0.25em; padding: 12px; }
.dm-copy { display: flex; gap: 8px; align-items: stretch; }
.dm-copy input { font: 13px var(--mono); text-overflow: ellipsis; }
.dm-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.dm-sp { flex: 1; }
.dm-btn { border: 1px solid var(--line2); border-radius: 9px; background: var(--surface); color: var(--ink); font: 600 14px/1 var(--sans); padding: 11px 16px; cursor: pointer; }
.dm-btn:hover:not(:disabled) { background: var(--surface2); border-color: var(--muted); }
.dm-btn.main { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.dm-btn.main:hover:not(:disabled) { background: var(--ink); opacity: 0.88; }
.dm-btn.small { font-size: 13px; padding: 0 13px; flex: none; }
.dm-btn:disabled { opacity: 0.5; cursor: wait; }
.dm-radio { display: flex; flex-direction: column; gap: 8px; }
.dm-radio label { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid var(--line2); border-radius: 9px; font-weight: 500; cursor: pointer; }
.dm-radio label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.dm-radio input { accent-color: var(--accent); }
.logo-pick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.logo-pick img { width: 48px; height: 48px; border-radius: 12px; object-fit: cover; }
.logo-pick input[type=file] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.logo-pick .pick { border: 1px solid var(--line2); border-radius: 9px; padding: 9px 13px; font: 600 13px var(--sans); cursor: pointer; }
.logo-pick .pick:hover { background: var(--surface2); }
.qr { align-self: center; padding: 8px; background: #fff; border-radius: 12px; border: 1px solid var(--line); line-height: 0; }
.qr canvas { width: 200px; height: 200px; image-rendering: pixelated; }
.codes { margin: 0; padding: 14px; list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; border-radius: 10px; background: var(--code-bg); color: var(--code-ink); font: 14px/1.3 var(--mono); }
.dm-dlg [hidden] { display: none !important; }
@media (max-width: 420px) { .dm-foot .dm-btn { flex: 1 1 100%; } .dm-sp { display: none; } }

/* the shared account-link window (made in connections-ui.js) follows these colours */
.cn-back { background: rgb(10 12 18 / 0.55); }
.cn-dlg { border-radius: 16px; box-shadow: 0 30px 80px rgb(0 0 0 / 0.3); }
.cn-x:hover { color: var(--ink); }
.cn-tile:hover:not(:disabled) { background: var(--surface); border-color: var(--muted); }
.cn-rm:hover { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad-ink); }
.cn-show.on { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.cn-check { color: var(--accent); }
.cn-msg.ok { color: var(--accent); }
.cn-msg.error { color: var(--bad-ink); }

/* ---- consent page ---- */
.stage { min-height: calc(100vh - 60px); display: grid; place-items: center; padding: 28px 16px 48px; background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 22px 22px; }
.consent { width: min(440px, 100%); display: flex; flex-direction: column; gap: 18px; padding: 28px 26px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow), 0 30px 70px rgb(20 20 30 / 0.08); }
.pair { display: flex; align-items: center; justify-content: center; gap: 0; }
.pair .a { width: 64px; height: 64px; border-radius: 16px; overflow: hidden; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font: 800 26px var(--sans); border: 1px solid var(--line); flex: none; }
.pair .a img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pair .a.me { border-radius: 50%; background: var(--ink); color: var(--bg); }
.pair .link { width: 70px; height: 0; border-top: 2px dashed var(--line2); position: relative; }
.pair .link i { position: absolute; left: 50%; top: -13px; transform: translateX(-50%); width: 24px; height: 24px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line2); display: grid; place-items: center; color: var(--accent); }
.pair .link svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.consent h1 { margin: 0; text-align: center; font-size: 21px; line-height: 1.3; letter-spacing: -0.02em; text-wrap: balance; }
.consent .by { margin: -10px 0 0; text-align: center; color: var(--muted); font-size: 13.5px; }
.consent .by a { color: var(--muted); }
.who { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 13.5px; margin-top: -6px; }
.who b { color: var(--ink); }
.perm-t { margin: 2px 0 -6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.perms { margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.perms li { display: flex; gap: 13px; padding: 13px 14px; align-items: flex-start; }
.perms li + li { border-top: 1px solid var(--line); }
.perms .ic { width: 32px; height: 32px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.perms .ic svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.perms b { display: block; font-size: 14.5px; letter-spacing: -0.005em; }
.perms span { display: block; color: var(--muted); font-size: 13px; line-height: 1.4; }
.callout { display: flex; gap: 10px; padding: 11px 13px; border-radius: 10px; font-size: 13.5px; line-height: 1.45; }
.callout.warn { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink); }
.callout.bad { background: var(--bad-bg); border: 1px solid var(--bad-line); color: var(--bad-ink); }
.callout.ok { background: var(--accent-soft); color: var(--accent); }
.callout svg { width: 17px; height: 17px; flex: none; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.goes { margin: 0; text-align: center; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.goes b { color: var(--ink); font-family: var(--mono); font-weight: 600; font-size: 12.5px; }
.cbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cbtns .btn { padding: 13px 14px; font-size: 15px; }
.secure { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: 12px; }
.secure svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.center { text-align: center; }
.homelink { align-self: center; color: var(--muted); font-size: 14px; }

/* ---- small screens: the menu becomes a row of tabs ---- */
@media (max-width: 840px) {
  .shell { grid-template-columns: minmax(0, 1fr); gap: 18px; padding: 20px 16px 48px; }
  .side { position: static; overflow-x: auto; margin: 0 -16px; padding: 0 16px; border-bottom: 1px solid var(--line); }
  .side nav { flex-direction: row; gap: 4px; width: max-content; }
  .side nav button { width: auto; border-radius: 8px 8px 0 0; padding: 10px 12px; white-space: nowrap; }
  .side nav button[aria-selected="true"] { background: transparent; box-shadow: inset 0 -2px 0 var(--accent); }
  .bar-in { padding: 0 16px; gap: 8px; }
  .back, .brand-s, .slash { display: none; }
  .head h1 { font-size: 25px; }
  .kv { grid-template-columns: minmax(0, 1fr) auto; }
  .kv dt { grid-column: 1 / -1; margin-top: 6px; }
  .tiles { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .dm-btn, .tile.new, .side nav button { transition: background 0.12s, border-color 0.12s, color 0.12s, opacity 0.12s; }
}

/* ---- the page to make or change an app ---- */
.ed-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ed-head h2 { margin: 0; font-size: 20px; letter-spacing: -0.015em; }
.card.ed { overflow: hidden; }
.ed-body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 16px; }
.card.ed .card-h { padding-bottom: 0; }
.ed-body .dm-code { max-width: 220px; }
.rlist { display: flex; flex-direction: column; gap: 10px; }
.rrow { display: flex; gap: 8px; align-items: center; }
.rrow .dm-input { flex: 1; font-family: var(--mono); font-size: 13px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); font-size: 20px; padding: 4px 11px; }
.btn.ghost:hover:not(:disabled) { background: var(--surface2); color: var(--ink); }
.logo-pick { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo-big { width: 84px; height: 84px; border-radius: 20px; object-fit: cover; flex: none; border: 1px solid var(--line); background: var(--surface2); display: block; }
.logo-big.ph { display: grid; place-items: center; color: var(--muted); font: 300 34px/1 var(--sans); border-style: dashed; border-color: var(--line2); }
.logo-big.ph[hidden], .logo-big[hidden] { display: none !important; }
.lp-r { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.lp-r .dm-help { max-width: 360px; }
label.btn { cursor: pointer; }
.card.danger { border-color: var(--bad-line); }
.card.danger .card-h h2 { color: var(--bad-ink); }
.btn.warn { border-color: var(--bad-line); }
.btn.main.dark { background: var(--ink); }
.consent h1 + .goes { margin-top: -6px; }

/* logo on the 2FA card */
.sec-logo { display: block; width: 40px; height: 40px; border-radius: 10px; margin-bottom: 10px; }

/* "lost your app?" link under a code field */
.linkbtn { display: block; margin-top: 8px; padding: 0; background: none; border: 0; color: var(--accent); font: inherit; font-size: 13px; text-align: left; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.linkbtn:disabled { color: var(--muted); cursor: default; text-decoration: none; }

/* remember this browser */
.dm-check { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.dm-check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }

/* list of browsers */
.br-list { border-top: 1px solid var(--line); }
.br-row { display: flex; align-items: center; gap: 12px; padding: 14px 20px; }
.br-row + .br-row { border-top: 1px solid var(--line); }
.br-row .t { min-width: 0; flex: 1; }
.br-row .t b { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 15px; letter-spacing: -0.01em; }
.br-row .t span { display: block; color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.br-acts { padding: 14px 20px 6px; }
.br-note { padding: 6px 20px 18px; }
.br-list .hint { padding: 14px 20px; }

/* numbers per app */
.st-nums { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.st-n { background: var(--surface2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.st-n b { display: block; font-size: 26px; line-height: 1.1; letter-spacing: -0.02em; }
.st-n span { display: block; margin-top: 4px; color: var(--muted); font-size: 12.5px; }
.st-bars { display: flex; align-items: flex-end; gap: 3px; height: 96px; padding: 6px 0 0; }
.st-bars i { flex: 1 1 0; min-width: 0; background: var(--accent); border-radius: 3px 3px 1px 1px; }
.st-bars i.z { background: var(--line2); }
.st-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: -6px; }
