/* The Settings page (public/settings.html), laid out like a settings app: a title, a side list of pages, and one
   page at a time of quiet headings and rows (a label and a line of help on the left, the control on the right).
   Choices that are about looks are pictures: the colour mode, the project layout. */
body.sp { min-height: 100dvh; background: var(--ground); color: var(--body); }
.sp-bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  height: var(--bar-h); padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--ground) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.sp-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; color: var(--text); }
.sp-wrap { display: grid; grid-template-columns: 208px minmax(0, 720px); column-gap: var(--s-7); row-gap: var(--s-5); justify-content: center; padding: var(--s-6) 16px var(--s-9); }
.sp-title { grid-column: 1 / -1; font-size: 28px; font-weight: 600; letter-spacing: -0.02em; color: var(--text); }
.sp-side { position: sticky; top: calc(var(--bar-h) + var(--s-5)); align-self: start; display: grid; gap: var(--s-3); max-height: calc(100dvh - var(--bar-h) - var(--s-6)); overflow-y: auto; scrollbar-width: thin; padding: 2px; margin: -2px; }
.sp-nav { display: grid; gap: 2px; }
.sp-nav a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; font-size: 14.5px; color: var(--body); transition: background-color var(--t-1) var(--ease), color var(--t-1) var(--ease); }
.sp-nav a:hover { color: var(--text); background: color-mix(in srgb, var(--text) 5%, transparent); }
.sp-nav a[aria-current] { color: var(--text); font-weight: 500; background: color-mix(in srgb, var(--text) 9%, transparent); }
.sp-nav a:focus-visible { outline: 2px solid var(--text); outline-offset: -2px; }
.sp-nav .ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); transition: color var(--t-1) var(--ease); }
.sp-nav a:hover .ic, .sp-nav a[aria-current] .ic { color: currentColor; }
.sp-main { display: grid; gap: var(--s-6); align-content: start; min-width: 0; }
.sp-page { display: grid; }
.sp-page[hidden] { display: none; }
/* the page's name is for screen readers, and shows while a search lists several pages together */
.sp-page-h { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.is-searching .sp-page-h { position: static; width: auto; height: auto; overflow: visible; clip: auto; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.sp-sec { display: grid; gap: var(--s-3); scroll-margin-top: calc(var(--bar-h) + var(--s-4)); }
.sp-sec + .sp-sec { margin-top: var(--s-5); padding-top: var(--s-6); border-top: 1px solid var(--line); }
.is-searching .sp-page-h + .sp-sec, .sp-sec.is-first { margin-top: var(--s-3); padding-top: 0; border-top: 0; }
.sp-h { font-size: 17px; font-weight: 600; color: var(--text); }
.sp-h:focus { outline: none; }
.sp-msg[data-kind="error"] { color: var(--danger); }
.sp-msg[data-kind="ok"] { color: var(--ok); }
.sp-msg a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.settings-field small { font-size: 13px; }
.sp-end { justify-content: flex-end; }

/* the profile: the picture beside your name, then the fields side by side */
.sp-me { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-2) 0; }
.sp-me-text { display: grid; gap: 4px; min-width: 0; }
.sp-me-name { font-size: 16px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.sp-me-name span { display: block; font-size: 13.5px; font-weight: 400; color: var(--muted); }
.sp-me .settings-note { margin: 0; }
.sp-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }

/* the workspace's icon and the profile's picture */
.sp-av { display: grid; place-items: center; flex: none; width: 64px; height: 64px; border-radius: 20px; overflow: hidden; background: var(--pen); color: #fff; font-size: 24px; font-weight: 600; }
.sp-av:not(:has(img)):not(:empty) { line-height: 1; }
/* a picture or builder avatar shows what is behind it wherever its own pixels are clear (the owner, 12 Nov 2026): no tile */
.sp-av.has-img { background: transparent; }
.sp-av img { width: 100%; height: 100%; object-fit: cover; }
.btn:disabled.btn-quiet { cursor: default; }
.sp-av-round { border-radius: 50%; background: var(--raised); color: var(--text); box-shadow: inset 0 0 0 1px var(--hair-2); }
.sp-av.has-art { background: none; box-shadow: none; }
.sp-av svg, .sp-av.has-img svg { display: block; width: 100%; height: 100%; }
.sp-av-edit { position: relative; padding: 0; border: 0; cursor: pointer; font: inherit; transition: scale var(--t-1) var(--ease); }
.sp-av-edit:active { scale: 0.96; }
.sp-av-art { display: grid; place-items: center; width: 100%; height: 100%; }
.sp-av-art img { width: 100%; height: 100%; object-fit: cover; }
.sp-av-edit::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: rgba(0, 0, 0, 0.5); opacity: 0; transition: opacity var(--t-1) var(--ease); }
.sp-av-pen { position: absolute; inset: 0; z-index: 1; margin: auto; width: 22px !important; height: 22px !important; fill: none; stroke: #fff; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transition: opacity var(--t-1) var(--ease); }
.sp-av-edit:hover::after, .sp-av-edit:focus-visible::after, .sp-av-edit[aria-busy="true"]::after { opacity: 1; }
.sp-av-edit:hover .sp-av-pen, .sp-av-edit:focus-visible .sp-av-pen { opacity: 1; }
.sp-av-edit:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.sp-av-edit[aria-busy="true"] { cursor: progress; }

/* the plan, as a card with Anticode's mark */
.sp-plan { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-4); padding: var(--s-4); border-radius: var(--r-card); background: var(--surface); box-shadow: 0 0 0 1px var(--hair), var(--edge); }
.sp-plan .settings-who { flex: 1 1 200px; }
.sp-plan-mark { display: grid; place-items: center; flex: none; width: 48px; height: 48px; border-radius: 14px; background: var(--raised); }

/* pictures to choose from: each is a small preview with its name under it */
.sp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: var(--s-3); max-width: 520px; }
.sp-card { display: grid; gap: 8px; justify-items: center; padding: 0; border: 0; background: none; cursor: pointer; font: inherit; color: var(--body); }
.sp-shot { display: grid; place-items: center; width: 100%; aspect-ratio: 120 / 76; border-radius: 12px; overflow: hidden; background: var(--surface); box-shadow: 0 0 0 1px var(--hair-2), var(--edge);
  transition: box-shadow var(--t-1) var(--ease), scale var(--t-1) var(--ease); }
.sp-shot svg { display: block; width: 100%; height: 100%; }
.sp-shot .f2 { fill: color-mix(in srgb, var(--text) 10%, transparent); }
.sp-shot .f3 { fill: color-mix(in srgb, var(--text) 24%, transparent); }
.sp-shot .fp { fill: var(--pen); }
.sp-card-l { font-size: 13.5px; }
.sp-card:hover .sp-shot { box-shadow: 0 0 0 1px var(--muted); }
.sp-card:active .sp-shot { scale: 0.98; }
.sp-card[aria-checked="true"] .sp-shot, .sp-card:has(input:checked) .sp-shot { box-shadow: 0 0 0 2px var(--pen); }
.sp-card[aria-checked="true"] .sp-card-l, .sp-card:has(input:checked) .sp-card-l { color: var(--text); font-weight: 500; }
.sp-card:focus-visible { outline: none; }
.sp-card:focus-visible .sp-shot, .sp-card:has(input:focus-visible) .sp-shot { outline: 2px solid var(--text); outline-offset: 3px; }
.sp-aa { font-size: 30px; font-weight: 500; line-height: 1; color: var(--text); }
.sp-aa-sm { font-size: 15px; color: var(--muted); }
/* colour swatches */
.sp-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.sp-swatch { position: relative; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; color: var(--muted); transition: scale var(--t-1) var(--ease); }
.sp-dot { display: block; width: 30px; height: 30px; border-radius: 50%; transition: box-shadow var(--t-1) var(--ease); }
.sp-dot svg { display: block; width: 100%; height: 100%; }
.sp-swatch:hover .sp-dot { box-shadow: 0 0 0 2px var(--ground), 0 0 0 3px var(--muted); }
.sp-swatch:active { scale: 0.92; }
.sp-swatch:has(input:checked) .sp-dot { box-shadow: 0 0 0 2px var(--ground), 0 0 0 4px var(--pen); }
.sp-swatch:has(input:focus-visible) .sp-dot { outline: 2px solid var(--text); outline-offset: 5px; }

/* deleting the account */
.sp-danger-btn { color: var(--danger); }
.sp-danger-solid { background: var(--danger); color: #fff; }
.sp-danger-solid:not(:disabled):hover { box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 30%, transparent); }

/* your own background (Appearance): a preview drawn exactly as the page draws it, with sample text over it, and its
   controls beside it; under 560px they stack */
.sp-bg { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: var(--s-4); align-items: start; }
.sp-bg-shot { position: relative; isolation: isolate; aspect-ratio: 16 / 10; border-radius: 12px; overflow: hidden; background: var(--ground);
  box-shadow: 0 10px 28px -12px rgba(0, 0, 0, 0.45), 0 2px 8px -2px rgba(0, 0, 0, 0.2); transition: box-shadow var(--t-1) var(--ease); }
.sp-bg-shot[data-empty="true"] { background: var(--surface); box-shadow: inset 0 1px 6px rgba(0, 0, 0, 0.12); }
.sp-bg-shot.is-over { box-shadow: 0 0 0 2px var(--pen), 0 10px 28px -12px rgba(0, 0, 0, 0.45); }
.sp-bg-shot[aria-busy="true"] { cursor: progress; }
.sp-bg-shot[aria-busy="true"] .sp-bg-sample { opacity: 0.6; }
.sp-bg-sample { position: absolute; z-index: 1; left: 16px; right: 16px; bottom: 14px; display: grid; gap: 2px; }
.sp-bg-shot[data-empty="true"] .sp-bg-sample { display: none; }
.sp-bg-h { font-size: 15px; font-weight: 600; color: var(--text); }
.sp-bg-p { font-size: 12.5px; color: var(--muted); }
.sp-bg-none { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; margin: 0; padding: var(--s-4); text-align: center; font-size: 13.5px; color: var(--muted); }
.sp-bg-none[hidden] { display: none; }
.sp-bg-side { display: grid; gap: var(--s-4); min-width: 0; }
.sp-bg-side .settings-actions { flex-wrap: wrap; }
.sp-bg-side .btn[hidden] { display: none; }
.sp-bg-dim { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px var(--s-3); }
.sp-bg-dim[hidden] { display: none; }
.sp-bg-dim .settings-note { grid-column: 1 / -1; margin: 0; }
.sp-range { width: 100%; min-height: 44px; margin: 0; accent-color: var(--pen); cursor: pointer; }
.sp-range:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 4px; }
.sp-bg-val { min-width: 4ch; text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; color: var(--text); }

@media (max-width: 860px) {
  .sp-wrap { grid-template-columns: minmax(0, 1fr); row-gap: var(--s-4); padding-top: var(--s-5); }
  .sp-title { font-size: 24px; }
  .sp-side { position: static; max-height: none; overflow: visible; }
  .sp-nav { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 4px; scrollbar-width: none; }
  .sp-nav::-webkit-scrollbar { display: none; }
  .sp-nav a { flex: none; white-space: nowrap; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--hair-2); }
  .sp-nav a[aria-current] { box-shadow: none; background: color-mix(in srgb, var(--text) 12%, transparent); color: var(--text); }
  .sp-nav .ic { display: none; }
}
@media (max-width: 560px) {
  .sp-fields { grid-template-columns: minmax(0, 1fr); }
  .sp-bg { grid-template-columns: minmax(0, 1fr); }
  .sp-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .sp-cards:has(> :nth-child(4)) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sp-plan .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .sp-nav a, .sp-av-edit, .sp-av-edit::after, .sp-av-pen, .sp-shot, .sp-swatch, .sp-dot { transition: none; } }

/* the same pages as a pop-up in the dashboard, from the account icon (settings-page.js open) */
.sp-dialog { width: min(980px, calc(100vw - 32px)); height: min(780px, calc(100dvh - 32px)); max-width: none; max-height: none; margin: auto; padding: 0; border: 0;
  border-radius: var(--r-panel); background: var(--ground); color: var(--body); box-shadow: 0 0 0 1px var(--hair-2), 0 40px 100px -20px rgba(0, 0, 0, 0.7); overflow: hidden; }
.sp-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); animation: sp-in 220ms var(--ease-reveal); }
.sp-dialog::backdrop { background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
@keyframes sp-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.sp-dialog-head { display: flex; align-items: center; justify-content: space-between; padding: var(--s-4) var(--s-4) var(--s-3) var(--s-5); border-bottom: 1px solid var(--line); }
.sp-dialog-head h2 { font-size: 18px; font-weight: 600; color: var(--text); }
.sp-x { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--muted); }
.sp-x:hover { background: var(--surface); color: var(--text); }
.sp-x:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
.sp-x svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.sp-scroll { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.sp-pad { padding: var(--s-5); }
.sp-dialog .sp-wrap { grid-template-columns: 188px minmax(0, 1fr); column-gap: var(--s-6); padding: var(--s-5) var(--s-5) var(--s-6); }
.sp-dialog .sp-side { top: var(--s-5); max-height: calc(min(780px, 100dvh - 32px) - 120px); }
.sp-dialog .sp-sec { scroll-margin-top: var(--s-4); }
@media (max-width: 860px) {
  .sp-dialog { width: 100vw; height: 100dvh; border-radius: 0; }
  .sp-dialog .sp-wrap { grid-template-columns: minmax(0, 1fr); padding: var(--s-3) 16px var(--s-6); }
  .sp-dialog .sp-side { position: sticky; top: 0; z-index: 2; margin: 0 -16px; padding: 4px 16px 8px; background: var(--ground); max-height: none; }
  .sp-dialog .sp-nav { margin: 0 -16px; }
}
@media (prefers-reduced-motion: reduce) { .sp-dialog[open] { animation: none; } }

/* the settings and two-factor pieces (also in anticode.css, for the home page's Settings panel), so the page and the
   dashboard's pop-up need only this file */
.settings-note { font-size: 13.5px; color: var(--muted); }
.settings-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3); }
.settings-who { display: grid; gap: 2px; min-width: 0; }
.settings-who b { font-size: 15px; color: var(--text); overflow-wrap: anywhere; }
.settings-who span { font-size: 13.5px; color: var(--muted); }
.settings-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.settings-form { display: grid; gap: var(--s-3); }
.settings-field { display: grid; gap: 6px; font-size: 14px; color: var(--body); }
.settings-field input { width: 100%; min-height: 44px; padding: 0 12px; border-radius: var(--r-menu); border: 1px solid var(--hair-2); box-shadow: var(--edge-in); background: var(--ground); color: var(--text); font: 400 16px/1 var(--font); }
.settings-field input:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
.mfa-steps { display: grid; gap: var(--s-4); margin: 0; padding-left: 1.2em; }
.mfa-steps li { display: grid; gap: var(--s-2); }
.mfa-steps li > span { color: var(--muted); font-size: 14px; }
.mfa-key { justify-self: start; font: 600 15px/1.4 var(--mono); letter-spacing: 0.06em; padding: 8px 12px; border-radius: var(--r-menu); background: var(--surface); color: var(--text); user-select: all; overflow-wrap: anywhere; }
.mfa-field { display: grid; gap: 6px; font-size: 14px; color: var(--body); }
.mfa-field input { width: min(220px, 100%); min-height: 40px; padding: 0 12px; border-radius: var(--r-menu); border: 1px solid var(--hair-2); box-shadow: var(--edge-in); background: var(--ground); color: var(--text); font: 500 16px/1 var(--font); font-variant-numeric: tabular-nums; letter-spacing: 0.12em; }
.mfa-field input:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
.mfa-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; margin: 0; padding-left: 1.4em; font-variant-numeric: tabular-nums; }
.mfa-codes code { font: 14px/1.5 var(--mono); color: var(--text); }
[data-mfa-msg][data-kind="error"] { color: var(--danger); }
.mfa-choice { display: grid; gap: var(--s-2); margin: 0; padding: 0; border: 0; }
.mfa-choice legend { margin-bottom: var(--s-2); padding: 0; font-size: 14px; color: var(--body); }
.mfa-opt { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: var(--r-menu); border: 1px solid var(--hair-2); cursor: pointer; }
.mfa-opt:has(input:checked) { border-color: var(--text); }
.mfa-opt:has(input:focus-visible) { outline: 2px solid var(--text); outline-offset: 1px; }
.mfa-opt input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--text); }
.mfa-opt span { display: grid; gap: 2px; }
.mfa-opt b { font-size: 14.5px; font-weight: 600; color: var(--text); }
.mfa-opt small { font-size: 13px; color: var(--muted); }
.mfa-opt.is-off { opacity: 0.55; cursor: default; }
.mfa-devices-wrap { display: grid; gap: var(--s-2); margin-top: var(--s-2); padding-top: var(--s-3); border-top: 1px solid var(--line); }
.mfa-sub { font-size: 14px; font-weight: 600; color: var(--text); }
.mfa-devices { display: grid; gap: var(--s-2); margin: 0; padding: 0; list-style: none; }
.mfa-devices li { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.mfa-this { margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--surface); font-size: 12px; font-weight: 500; color: var(--muted); }

/* ---------- the settings rows (public/prefs.js CATALOG, drawn by settings-page.js) ---------- */
.sp-off { display: none !important; }
.sp-search { position: relative; display: flex; align-items: center; }
.sp-search svg { position: absolute; left: 12px; width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; pointer-events: none; }
.sp-search input { width: 100%; min-height: 40px; padding: 0 12px 0 36px; border-radius: var(--r-control); border: 1px solid var(--hair-2); box-shadow: var(--edge-in); background: var(--surface); color: var(--text); font: 400 15px/1 var(--font); }
.sp-search input::placeholder { color: var(--muted); }
.sp-search input:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
.sp-count { margin: -4px 12px 0; font-size: 12.5px; color: var(--muted); }
.sp-count:empty { display: none; }
.sp-empty { padding: var(--s-6) var(--s-4); text-align: center; }
.sp-blurb { margin-top: calc(var(--s-2) * -1); }
.sp-sub { margin-top: var(--s-2); padding-top: var(--s-4); border-top: 1px solid var(--line); font-size: 15px; font-weight: 600; color: var(--text); }
.sr-list { display: grid; }
.sr-list:empty { display: none; }
/* a section ends on its last visible row's text, not its padding, so every section is the same 24px from the next divider */
.sp-sec > .sr-list:last-child > .sr:nth-last-child(1 of :not([hidden])) { padding-bottom: 0; }
.sr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px var(--s-4); padding: 14px 0; border-top: 1px solid var(--line); }
/* no line between a heading (or its note) and the first row under it */
:is(.sp-h, .sp-blurb) + .sr, :is(.sp-h, .sp-blurb) + .sr-list > .sr:first-child, :is(.sp-h, .sp-blurb) + .sr-list.sp-off + .sr { border-top: 0; padding-top: 4px; }
.sr-stack { grid-template-columns: minmax(0, 1fr); gap: var(--s-3); }
.sr-panel { padding-top: var(--s-2); }
.sr-panel[hidden] { display: none; }
.sr[hidden] { display: none; }
.sr-text { display: grid; gap: 3px; min-width: 0; }
.sr-label { font-size: 15px; font-weight: 500; color: var(--text); }
.sr-desc { font-size: 13.5px; line-height: 1.45; color: var(--muted); }
.sr-scope { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, var(--text) 8%, transparent); font-size: 12px; color: var(--body); white-space: nowrap; vertical-align: 1px; }
.sr-saved { justify-self: start; font-size: 12.5px; font-weight: 500; color: var(--ok); opacity: 0; transition: opacity var(--t-2) var(--ease); }
.sr.is-saved .sr-saved { opacity: 1; }
.sr-label .sr-saved { margin-left: 10px; }
.sr-ctl { position: relative; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s-2); }
.sr > :not(.sr-text):not(.sr-ctl) { grid-column: 1 / -1; }
.sr-msg[data-kind="error"] { color: var(--danger); }
.sr-msg[data-kind="ok"] { color: var(--ok); }
.sr-msg a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

/* a switch: flat; the knob's place and the fill both say on or off */
.sr-switch { appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 46px; height: 28px; margin: 0; border-radius: 999px; cursor: pointer;
  background: transparent; box-shadow: inset 0 0 0 1.5px var(--muted); transition: background-color var(--t-1) var(--ease), box-shadow var(--t-1) var(--ease); }
.sr-switch::before { content: ""; position: absolute; top: 5px; left: 5px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: translate var(--t-2) var(--ease-snap), background-color var(--t-1) var(--ease); }
.sr-switch:checked { background: var(--pen); box-shadow: inset 0 0 0 1.5px var(--pen); }
.sr-switch:checked::before { translate: 18px 0; background: #fff; }
.sr-switch:hover { box-shadow: inset 0 0 0 1.5px var(--text); }
.sr-switch:checked:hover { box-shadow: inset 0 0 0 1.5px var(--pen), 0 0 0 3px color-mix(in srgb, var(--pen) 25%, transparent); }
.sr-switch:active::before { scale: 0.9; }
.sr-switch:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

/* a pop-up menu: the browser's own select, with one chevron */
.sr-select { appearance: none; -webkit-appearance: none; min-width: 150px; max-width: 240px; min-height: 36px; padding: 0 34px 0 14px; border-radius: 12px; border: 1px solid var(--hair-2); box-shadow: var(--edge-in);
  background: var(--ground); color: var(--text); font: 400 14px/1.2 var(--font); cursor: pointer; text-overflow: ellipsis; }
.sr-select:hover { border-color: var(--muted); }
.sr-select:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
.sr-ctl:has(.sr-select)::after { content: ""; position: absolute; right: 10px; top: 50%; width: 16px; height: 16px; margin-top: -8px; background: var(--muted); pointer-events: none;
  transition: transform 240ms var(--ease-reveal);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8l4 4 4-4'/%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 20 20' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E") center / contain no-repeat; }
/* the set's chevron (icons.js) steps down when the list is hovered or focused */
.sr-ctl:has(.sr-select:is(:hover, :focus-visible))::after { transform: translateY(1.5px); }

/* keyboard shortcuts */
.sr-keys { display: inline-flex; align-items: center; gap: 6px; }
.sr-keys kbd { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 7px; border: 1px solid var(--hair-2); box-shadow: var(--edge); background: var(--ground);
  font: 500 13px/1 var(--font); color: var(--text); }
.sr-then { font-size: 12.5px; color: var(--muted); }

/* lists inside a row: signed-in devices, tokens */
.sr-items { display: grid; margin: var(--s-2) 0 0; padding: 0; list-style: none; border-radius: var(--r-menu); box-shadow: 0 0 0 1px var(--hair); }
.sr-items li { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: 12px 14px; border-top: 1px solid var(--line); }
.sr-items li:first-child { border-top: 0; }
.sr-items li.settings-note { display: block; }
.sr-inline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s-2) var(--s-3); margin-top: var(--s-2); }
.sr-inline .settings-field { flex: 1 1 220px; }
.sr-token { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin-top: 6px; }
.sr-token code { flex: 1 1 260px; min-width: 0; padding: 10px 12px; border-radius: 12px; background: var(--ground); box-shadow: inset 0 0 0 1px var(--hair-2), var(--edge); font: 13px/1.4 var(--mono); color: var(--text); overflow-wrap: anywhere; user-select: all; }
.sr code { font-family: var(--mono); font-size: 0.92em; }
@media (max-width: 560px) {
  .sr-select { min-width: 0; max-width: 46vw; }
  .sr-action { grid-template-columns: minmax(0, 1fr); }
  .sr-action .sr-ctl { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) { .sr-switch, .sr-switch::before, .sr-saved { transition: none; } }

/* inside a Run desk window (desk-embed.js): the window's bar replaces the page's own, and Settings keeps its sections */
html.in-desk .sp-bar { display: none; }
html.in-desk .sp-side { top: var(--s-5); max-height: calc(100dvh - var(--s-6)); }
html.in-desk .sp-wrap { padding-top: var(--s-5); }

/* ---------- Billing (public/billing-tab.js) ---------- */
/* the parts that don't apply to this account are hidden; their own display rules mustn't bring them back */
#pg-billing [hidden] { display: none !important; }
.bl-acts, .bl-row-acts { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.bl-row-acts { justify-content: flex-end; }
.bl-credits { display: grid; gap: var(--s-2); padding: var(--s-4); border-radius: var(--r-card); background: var(--surface); box-shadow: var(--edge); }
.bl-meter-h { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-1) var(--s-3); font-size: 13.5px; color: var(--muted); }
.bl-meter-h b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.bl-meter { height: 6px; border-radius: 999px; background: var(--raised); overflow: hidden; }
.bl-meter > span { display: block; height: 100%; border-radius: inherit; background: var(--text); }
.bl-change { display: grid; gap: var(--s-4); padding: var(--s-4); border-radius: var(--r-card); background: var(--surface); box-shadow: var(--edge); }
.bl-plans { border: 0; margin: 0; padding: 0; min-width: 0; }
.bl-plan-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: var(--s-2); }
.bl-plan { position: relative; display: grid; gap: 4px; padding: 14px; border-radius: 16px; background: var(--raised); box-shadow: inset 0 0 0 1px var(--line-2); cursor: pointer; transition: box-shadow var(--t-1) var(--ease), background var(--t-1) var(--ease); }
.bl-plan:hover { background: color-mix(in srgb, var(--raised) 80%, var(--text) 6%); }
.bl-plan:has(input:checked) { box-shadow: inset 0 0 0 2px var(--text); }
.bl-plan:has(input:focus-visible) { outline: 2px solid var(--pen); outline-offset: 2px; }
.bl-plan.is-current { cursor: default; opacity: .7; }
.bl-plan.is-current:hover { background: var(--raised); }
.bl-plan-n { display: flex; align-items: center; gap: var(--s-2); font-size: 15px; font-weight: 600; color: var(--text); }
.bl-plan-n em { font-style: normal; font-size: 11.5px; font-weight: 500; padding: 2px 8px; border-radius: 999px; background: var(--btn-soft); color: var(--body); }
.bl-plan-p { font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }
.bl-plan-p small { font-size: 12.5px; color: var(--muted); }
.bl-plan-d { font-size: 12.5px; color: var(--muted); }
.bl-quote { display: grid; gap: var(--s-2); padding-top: var(--s-3); border-top: 1px solid var(--line-2); font-size: 14px; color: var(--body); }
.bl-quote b { color: var(--text); }
.bl-due { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); }
.bl-due b { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bl-lines summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.bl-lines ul { list-style: none; margin: var(--s-2) 0 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.bl-lines li { display: flex; justify-content: space-between; gap: var(--s-3); color: var(--muted); }
.bl-lines li span:last-child { font-variant-numeric: tabular-nums; color: var(--body); white-space: nowrap; }
.bl-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-4); }
.bl-line .settings-who { flex: 1 1 200px; }
.bl-card-mark { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--raised); color: var(--text); }
.bl-card-mark .ic { width: 20px; height: 20px; }
.bl-card-form { display: grid; gap: var(--s-3); padding: var(--s-4); border-radius: var(--r-card); background: var(--surface); box-shadow: var(--edge); }
.bl-element { min-height: 120px; }
.bl-packs { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.bl-invoices { overflow-x: auto; }
.bl-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.bl-table th { text-align: left; font-size: 12.5px; font-weight: 500; color: var(--muted); padding: 0 var(--s-3) var(--s-2) 0; }
.bl-table td { padding: 12px var(--s-3) 12px 0; border-top: 1px solid var(--line-2); color: var(--body); white-space: nowrap; }
.bl-st { font-size: 12.5px; padding: 2px 8px; border-radius: 999px; background: var(--btn-soft); color: var(--body); }
.bl-st[data-st="paid"] { color: var(--ok); }
.bl-st[data-st="open"], .bl-st[data-st="uncollectible"] { color: var(--warn); }
.bl-links { text-align: right; }
.bl-links a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; margin-left: var(--s-3); }
.bl-details { padding: var(--s-4); border-radius: var(--r-card); background: var(--surface); box-shadow: var(--edge); }
.bl-wide { grid-column: 1 / -1; }
.bl-link { padding: 0; border: 0; background: none; font: inherit; color: var(--text); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
@media (max-width: 560px) {
  .bl-acts { width: 100%; }
  .bl-acts .btn { flex: 1 1 0; }
  .bl-row-acts .btn { flex: 1 1 0; }
  .bl-plan-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bl-table th:nth-child(3), .bl-table td:nth-child(3) { display: none; }
}
@media (prefers-reduced-motion: reduce) { .bl-plan { transition: none; } }
/* downgrading to Free, step 2 of 2: the code emailed to the account (public/billing-tab.js) */
.bl-code { display: grid; gap: 8px; margin-top: var(--s-3); }
.bl-code label { font-size: 14px; color: var(--body); }
.bl-code input { max-width: 180px; min-height: 44px; padding: 0 14px; border-radius: var(--r-control); border: 0; background: var(--raised); color: var(--text); font: inherit; font-size: 20px; letter-spacing: 0.3em; font-variant-numeric: tabular-nums; }
.bl-code input:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
