/* ForQ Studio: Settings (settings.js), ported from the ForQ app's settings.css, settings-shell, settings-rail and
   components/ui/settings-list. Every colour is a studio.css token: cl-bg → --page, cl-grouped → --raised,
   cl-active → --block, cl-border → --line, cl-text → --ink, cl-text2 → --body, cl-muted → --muted,
   cl-blue → --accent, cl-danger → --bad. */

.shell[data-tab="settings"] .column { max-width: 1120px; }
@media (min-width: 1000px) { .shell[data-tab="settings"] .column { padding-top: 96px; } }
@media (min-width: 900px) and (max-width: 1439px) {
  .shell[data-tab="settings"]:not(.has-drawer) .column { max-width: min(1120px, calc(100% - 204px)); }
}
.settings { gap: 0; color: rgb(var(--body)); font-family: var(--sans); }
.settings a { color: inherit; text-decoration: none; }
.st-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; margin: 0; }
.st-icon { flex: none; color: rgb(var(--muted)); }

/* ── The find field, in the bar's middle where the topic pill sits elsewhere; not on a phone ── */
.st-find { display: none; }
@media (min-width: 1000px) {
  .shell[data-tab="settings"] .who-pill { display: none; }
  .shell[data-tab="settings"] .st-find {
    display: block; position: fixed; left: 50%; top: 18px; z-index: 30; transform: translateX(-50%);
    width: min(340px, 40vw); height: 36px; border-radius: 999px; padding: 0 16px; font-size: 14px;
    background: rgb(var(--raised)); border: 1px solid var(--line); color: rgb(var(--ink));
  }
  .shell[data-tab="settings"] .st-find::placeholder { color: rgb(var(--muted)); }
  .shell[data-tab="settings"] .st-find:focus { outline: 2px solid rgb(var(--accent) / 0.5); outline-offset: 1px; }
}

/* ── The page and its rail ─────────────────────────────────────────────── */
.st-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; align-items: start; }
.st-page { min-width: 0; max-width: 720px; width: 100%; }
.st-rail { display: none; }
@media (min-width: 1200px) {
  .st-layout { grid-template-columns: minmax(0, 1fr) 320px; }
  .st-rail { display: flex; flex-direction: column; gap: 28px; position: sticky; top: 96px; }
}
.st-stack { display: flex; flex-direction: column; gap: 28px; }
.st-loading { padding: 0 16px; }

/* Tabs across the top: General, Memory, About. Not on a phone, where General lists them. */
.st-tabs { display: none; }
@media (min-width: 1000px) {
  .st-tabs { display: flex; gap: 4px; margin-bottom: 32px; border-bottom: 1px solid var(--line); }
  .st-tab { padding: 4px 12px 12px; font-size: 15.5px; color: rgb(var(--muted)); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color 0.15s; }
  .st-tab:hover { color: rgb(var(--ink)); }
  .st-tab[aria-current="page"] { color: rgb(var(--ink)); border-bottom-color: rgb(var(--ink)); }
}
.st-heading { margin-bottom: 28px; }
.st-back { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: rgb(var(--muted)); margin-bottom: 8px; }
.st-back:hover { color: rgb(var(--ink)); }
.st-back .st-icon { color: currentColor; }
.st-heading h1 { margin: 0; font-size: 22px; font-weight: 600; }

/* ── Sections and rows ─────────────────────────────────────────────────── */
.st-section { display: flex; flex-direction: column; }
.st-header { padding: 0 16px 6px; font-size: 13px; font-weight: 500; color: rgb(var(--muted)); }
.st-card { display: flex; flex-direction: column; border-radius: 14px; background: rgb(var(--raised)); overflow: hidden; }
.st-footer { margin: 6px 0 0; padding: 0 16px; font-size: 13px; line-height: 18px; color: rgb(var(--muted)); }
.st-row {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 8px 16px;
  border: 0; background: none; border-radius: 0; text-align: left; font: inherit; font-size: 15px; color: rgb(var(--ink)); cursor: pointer;
  transition: background-color 0.12s, opacity 0.15s;
}
.st-row.still { cursor: default; }
.st-row:not(.still):hover { background: rgb(var(--ink) / 0.05); }
.st-row:disabled { cursor: not-allowed; opacity: 0.5; }
/* Dividers inset 16px on each side, between rows only. */
.st-card > .st-row + .st-row::before { content: ""; position: absolute; top: 0; left: 16px; right: 16px; height: 1px; background: var(--line); }
.st-row.tall { min-height: 60px; }
.st-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-label.centered { text-align: center; }
.st-row.tall .st-label { display: flex; flex-direction: column; gap: 1px; white-space: normal; }
.st-title { font-size: 15px; color: rgb(var(--ink)); }
.st-desc { font-size: 13px; line-height: 18px; color: rgb(var(--muted)); }
.st-value { flex: none; max-width: 65%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: rgb(var(--muted)); }
.st-row.destructive { color: rgb(var(--bad)); }
.st-row.dim { opacity: 0.4; cursor: not-allowed; }
.st-row.dim:hover { background: none; }
.st-btns { display: inline-flex; gap: 6px; flex: none; }
@media (min-width: 1000px) {
  /* Desktop: no dividers; the card is a grouped surface and a row deepens under the pointer. */
  .st-card { border-radius: 18px; }
  .st-card > .st-row + .st-row::before { display: none; }
  .st-row:not(.still):hover { background: rgb(var(--block)); }
}
.st-phone { display: flex; }
.st-desk { display: none; }
@media (min-width: 1000px) {
  .st-phone { display: none; }
  .st-desk { display: flex; }
}

/* ── Buttons, fields and messages ──────────────────────────────────────── */
.st-btn { display: inline-flex; align-items: center; justify-content: center; height: 28px; padding: 0 10px; border-radius: 8px; font: inherit; font-size: 13px; font-weight: 500; white-space: nowrap; cursor: pointer; transition: background-color 0.15s, opacity 0.15s; }
.st-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.st-btn.primary { border: 0; background: rgb(var(--accent)); color: #fff; }
.st-btn.primary:hover:not(:disabled) { background: rgb(var(--accent) / 0.88); }
.st-btn.secondary { border: 1px solid var(--line-strong); background: none; color: rgb(var(--ink)); }
.st-btn.secondary:hover:not(:disabled) { background: rgb(var(--ink) / 0.05); }
.st-btn.danger { border: 0; background: rgb(var(--bad)); color: #fff; }
.st-btn.danger:hover:not(:disabled) { background: rgb(var(--bad) / 0.88); }
.st-input, .settings input.st-input, .settings select.st-input { height: 36px; border-radius: 8px; border: 1px solid var(--line-strong); background: rgb(var(--page)); padding: 0 12px; font: inherit; font-size: 15px; color: rgb(var(--ink)); min-width: 0; }
.st-input:focus { outline: 2px solid rgb(var(--accent) / 0.5); outline-offset: 0; }
.st-input.grow { flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13.5px; }
.st-message { margin: 0; padding: 0 16px; font-size: 13px; line-height: 18px; color: rgb(var(--muted)); }
.st-message.bad, .st-hint.bad { color: rgb(var(--bad)); }
.st-hint { margin: 6px 0 0; padding: 0 4px; font-size: 13px; line-height: 18px; color: rgb(var(--muted)); }
.st-field { display: flex; flex-direction: column; }
.st-field .st-input { width: 100%; }
.st-acts { display: flex; justify-content: flex-end; margin-top: 16px; }
.st-keyform { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px; }
.st-range { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 12px 16px; }
.st-range label { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; font-size: 13px; color: rgb(var(--muted)); }
.st-prose { margin: 0; padding: 0 16px; display: flex; flex-direction: column; gap: 10px; font-size: 15px; line-height: 22px; }
.st-prose .st-input { width: 100%; }
.st-lead { margin: 0; color: rgb(var(--ink)); }
.st-prose p { margin: 0; }
.st-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }

/* ── The profile header ────────────────────────────────────────────────── */
.st-profile { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.st-avatar-wrap { position: relative; margin-bottom: 10px; }
.st-avatar-btn { position: relative; display: block; border: 0; padding: 0; background: none; border-radius: 999px; cursor: pointer; }
.st-avatar { display: flex; align-items: center; justify-content: center; width: 88px; height: 88px; border-radius: 999px; overflow: hidden; background: rgb(var(--chip)); border: 1px solid var(--line-strong); color: rgb(var(--ink)); font-size: 34px; font-weight: 500; }
.st-avatar-wrap.big .st-avatar { width: 128px; height: 128px; font-size: 48px; }
.st-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.st-edit { position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); padding: 2px 10px; border-radius: 999px; background: rgb(var(--card)); border: 1px solid var(--line-strong); font-size: 13px; font-weight: 500; color: rgb(var(--accent)); }
.st-photo-menu.menu { top: calc(100% + 12px); width: 200px; }
.st-danger { color: rgb(var(--bad)); }
.st-name { margin: 6px 0 0; font-size: 18px; font-weight: 500; color: rgb(var(--ink)); }
.st-email { margin: 0; font-size: 14px; color: rgb(var(--muted)); }
.st-profile .st-message { margin-top: 6px; }

/* ── The appearance picker: the Studio drawn in each scheme ────────────── */
.st-appearance { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px 16px; }
.st-appearance > .st-label { font-size: 15px; color: rgb(var(--ink)); }
.st-schemes { display: flex; gap: 20px; }
.st-scheme { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 96px; border: 0; padding: 0; background: none; cursor: pointer; font: inherit; }
.st-scheme-pic { display: block; width: 96px; border-radius: 13px; overflow: hidden; outline: 1px solid var(--line-strong); outline-offset: 0; transition: outline-color 0.15s; }
.st-scheme-pic.on { outline: 3px solid rgb(var(--accent)); outline-offset: 2px; }
.st-scheme:focus-visible .st-scheme-pic { outline: 3px solid rgb(var(--accent) / 0.6); outline-offset: 2px; }
.st-scheme-label { font-size: 13px; color: rgb(var(--body)); }
.st-scheme[aria-checked="true"] .st-scheme-label { color: rgb(var(--accent)); }
.ap { display: block; width: 100%; height: auto; }
/* Each picture keeps its own scheme's colours whatever the page's, mirroring studio.css's two palettes. */
.ap-dark { --w: rgb(13 13 12); --win: rgb(16 16 15); --side: rgb(21 21 20); --ln: rgb(165 164 158 / 0.45); --st: rgb(244 243 238 / 0.85); --card: rgb(25 25 24); --srch: rgb(31 31 30); --acc: rgb(74 148 245); }
.ap-light { --w: rgb(230 229 223); --win: rgb(255 255 255); --side: rgb(241 240 235); --ln: rgb(107 106 101 / 0.4); --st: rgb(26 26 25 / 0.8); --card: rgb(245 245 247); --srch: rgb(239 238 233); --acc: rgb(47 125 232); }
.ap .wall { fill: var(--w); }
.ap .win { fill: var(--win); }
.ap .side { fill: var(--side); }
.ap .line { fill: var(--ln); }
.ap .line.faint { opacity: 0.6; }
.ap .strong { fill: var(--st); }
.ap .card { fill: var(--card); }
.ap .search { fill: var(--srch); }
.ap .blue, .ap .accent { fill: var(--acc); }
.ap .green { fill: #1baf7a; }
.ap .dot-red { fill: #ff5f57; }
.ap .dot-amber { fill: #febc2e; }
.ap .dot-green { fill: #28c840; }

/* ── The rail ──────────────────────────────────────────────────────────── */
.st-rail h2 { margin: 0 0 6px; padding: 0 16px; font-family: var(--sans); font-size: 13px; font-weight: 500; letter-spacing: 0; color: rgb(var(--muted)); }
.st-rail-card { display: flex; flex-direction: column; border-radius: 18px; background: rgb(var(--raised)); overflow: hidden; }
.st-rail-row { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 16px; border: 0; background: none; text-align: left; font: inherit; font-size: 15px; color: rgb(var(--body)); cursor: pointer; }
.st-rail-row:hover { background: rgb(var(--block)); color: rgb(var(--ink)); }
.st-rail-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-rail-empty { margin: 0; padding: 0 16px; font-size: 13px; line-height: 18px; color: rgb(var(--muted)); }

/* ── Search results ────────────────────────────────────────────────────── */
.st-noresults { padding: 64px 16px; text-align: center; }
.st-noresults p { margin: 0; }
.st-noresults .big { font-size: 17px; font-weight: 600; color: rgb(var(--ink)); }

/* ── Dialogs: confirm, and the photo cropper ───────────────────────────── */
.st-dialog { width: min(360px, calc(100vw - 32px)); border: 1px solid var(--line-strong); border-radius: 20px; background: rgb(var(--card)); color: rgb(var(--body)); padding: 20px; box-shadow: 0 16px 48px -12px rgb(0 0 0 / 0.45); font-family: var(--sans); }
.st-dialog::backdrop { background: rgb(0 0 0 / 0.45); }
.st-dialog h2 { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.st-dialog p { margin: 0; font-size: 14px; line-height: 20px; }
.st-dialog-acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.st-cropper { width: min(328px, calc(100vw - 32px)); }
.st-crop-body { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 10px; }
.st-crop { position: relative; width: 280px; height: 280px; overflow: hidden; border-radius: 12px; background: rgb(var(--block)); cursor: grab; touch-action: none; user-select: none; }
.st-crop:active { cursor: grabbing; }
.st-crop:focus-visible { outline: 2px solid rgb(var(--accent)); outline-offset: 2px; }
.st-crop-img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; pointer-events: none; opacity: 0; }
.st-crop-img.ready { opacity: 1; }
.st-crop-ring { position: absolute; inset: 0; border-radius: 999px; box-shadow: 0 0 0 9999px rgb(0 0 0 / 0.5); outline: 1px solid rgb(255 255 255 / 0.6); pointer-events: none; }
.st-zoom { width: 100%; accent-color: rgb(var(--accent)); }
