/* mem ui. Colors come from tokens, so one rule works in both themes: <html data-theme> forces light or
   dark; without it the system setting decides. Type colors are a validated categorical set, in this order. */

:root {
  color-scheme: light;
  --t-feedback: #2a78d6; --t-reference: #eb6834; --t-project: #1baf7a; --t-user: #eda100;
  --ok: #1f8a5b; --warn: #a8640f; --bad: #c93838;
  --bg: #ffffff; --surface: #ffffff; --panel: #f7f7f8; --ink: #18181b; --ink-2: #52525b; --ink-3: #8b8b94;
  --line: #e5e5e9; --line-soft: #efeff2; --chip: #f1f1f4; --hover: #f2f2f5; --code-bg: #f6f6f8;
  --accent: #5b5bd6; --accent-ink: #ffffff; --accent-soft: rgb(91 91 214 / 0.1);
  --sans: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r-ctl: 8px; --r-card: 12px;
  --shadow-pop: 0 12px 32px rgb(0 0 0 / 0.12), 0 2px 6px rgb(0 0 0 / 0.06);
  --ring: 0 0 0 1px var(--line), 0 1px 2px rgb(0 0 0 / 0.04);
}
/* dark: the same palette stepped for a dark surface (the type colors too) */
:root[data-theme="dark"] {
  color-scheme: dark;
  --t-feedback: #3987e5; --t-reference: #d95926; --t-project: #199e70; --t-user: #c98500;
  --ok: #4cbf86; --warn: #e2a24f; --bad: #e66767;
  --bg: #121214; --surface: #1a1a1d; --panel: #161618; --ink: #ededf0; --ink-2: #b4b4bc; --ink-3: #7b7b85;
  --line: #2a2a2f; --line-soft: #222226; --chip: #26262b; --hover: #1f1f23; --code-bg: #19191c;
  --accent: #8b8bf0; --accent-ink: #0d0d10; --accent-soft: rgb(139 139 240 / 0.16);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --t-feedback: #3987e5; --t-reference: #d95926; --t-project: #199e70; --t-user: #c98500;
    --ok: #4cbf86; --warn: #e2a24f; --bad: #e66767;
    --bg: #121214; --surface: #1a1a1d; --panel: #161618; --ink: #ededf0; --ink-2: #b4b4bc; --ink-3: #7b7b85;
    --line: #2a2a2f; --line-soft: #222226; --chip: #26262b; --hover: #1f1f23; --code-bg: #19191c;
    --accent: #8b8bf0; --accent-ink: #0d0d10; --accent-soft: rgb(139 139 240 / 0.16);
  }
}

/* ------------------------------------------------------------------ base */

*, ::before, ::after { box-sizing: border-box; margin: 0; padding: 0; border: 0 solid; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; background: none; letter-spacing: inherit; }
button { cursor: pointer; text-align: inherit; }
button:disabled { cursor: default; }
ul, ol { list-style: none; }
h1, h2, h3 { font-size: inherit; font-weight: inherit; }
a { color: inherit; text-decoration: none; }
code, kbd, pre { font-family: var(--mono); }
table { border-collapse: collapse; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-soft); }
[hidden] { display: none !important; }
body.resizing { cursor: col-resize; user-select: none; }

.i { width: 1em; height: 1em; flex-shrink: 0; display: block; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes pop { from { opacity: 0; transform: scale(0.96); } }
.truncate { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { flex-shrink: 0; white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.faint { color: var(--ink-3); }
.faint2 { color: var(--ink-2); }
.muted { color: var(--ink-3); font-size: 13px; }
.small { font-size: 12px; }
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }
.bad-text { color: var(--bad) !important; }
.accent { color: var(--accent); }
.count { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.inline-gap { display: flex; align-items: center; gap: 12px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.boot { display: grid; height: 100vh; place-items: center; padding: 24px; text-align: center; color: var(--ink-3); }

/* tooltips: any element with data-tip, after a short pause */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip); position: absolute; z-index: 60; top: calc(100% + 6px); left: 50%; translate: -50% 0;
  padding: 4px 8px; border-radius: 6px; background: var(--ink); color: var(--bg); font-size: 12px; font-weight: 400;
  line-height: 1.4; white-space: nowrap; box-shadow: var(--shadow-pop); pointer-events: none; opacity: 0; transition: opacity .12s;
}
[data-tip-side="right"]::after { top: 50%; left: calc(100% + 8px); translate: 0 -50%; }
[data-tip]:hover::after { opacity: 1; transition-delay: .4s; }
[data-tip]:focus-visible::after { opacity: 1; }

/* ------------------------------------------------------------------ controls */

.btn {
  display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--surface); color: var(--ink);
  font-size: 13px; font-weight: 500; white-space: nowrap; user-select: none; transition: background-color .15s, color .15s, opacity .15s;
}
.btn:hover { background: var(--hover); }
.btn .i { width: 16px; height: 16px; }
.btn:disabled { pointer-events: none; opacity: .5; }
.btn.sm { height: 28px; padding: 0 10px; }
.btn.primary { border-color: transparent; background: var(--accent); color: var(--accent-ink); }
.btn.danger { border-color: transparent; background: var(--bad); color: #fff; }
.btn.primary:hover, .btn.danger:hover { opacity: .9; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--hover); color: var(--ink); }
.btn.icon { width: 28px; height: 28px; padding: 0; }
.btn.icon .i { width: 15px; height: 15px; }
.link-quiet { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-3); }
.link-quiet:hover { color: var(--ink); }
.link-quiet .i { width: 12px; height: 12px; }
.kbd { display: inline-grid; place-items: center; height: 20px; min-width: 20px; padding: 0 4px; border: 1px solid var(--line); border-radius: 4px; font-size: 11px; color: var(--ink-3); }

.dot { display: inline-block; width: 7px; height: 7px; flex-shrink: 0; border-radius: 50%; background: var(--ink-3); }
.dot.t-feedback { background: var(--t-feedback); } .dot.t-reference { background: var(--t-reference); }
.dot.t-project { background: var(--t-project); } .dot.t-user { background: var(--t-user); }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.off { background: var(--ink-3); }
.type-label { display: inline-flex; align-items: center; gap: 6px; }

.seg { display: inline-flex; padding: 2px; border-radius: 9px; background: var(--chip); }
.seg > button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 7px; font-size: 13px; color: var(--ink-2); transition: color .15s; }
.seg > button:hover { color: var(--ink); }
.seg > button[aria-checked="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--ring); }

.check { display: grid; width: 16px; height: 16px; flex-shrink: 0; place-items: center; border: 1.5px solid var(--ink-3); border-radius: 4px; background: var(--surface); transition: background-color .15s, border-color .15s; }
.check[aria-checked="true"] { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.check .i { width: 12px; height: 12px; }

.switch { display: inline-flex; width: 36px; height: 20px; flex-shrink: 0; align-items: center; padding: 2px; border-radius: 999px; background: var(--line); transition: background-color .15s; }
.switch > span { width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .2); transition: transform .15s; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"] > span { transform: translateX(16px); }

.select { position: relative; display: inline-flex; min-width: 0; }
.select select { appearance: none; height: 32px; width: 100%; min-width: 0; padding: 0 32px 0 12px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--surface); font-size: 13px; text-overflow: ellipsis; cursor: pointer; }
.select select:hover { border-color: var(--ink-3); }
.select .i { position: absolute; top: 50%; right: 10px; width: 14px; height: 14px; translate: 0 -50%; color: var(--ink-3); pointer-events: none; }
.select.place { width: 288px; max-width: 100%; }
.select.wide { width: 288px; }

.input { width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--surface); outline: none; }
.input::placeholder { color: var(--ink-3); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.mono { font-family: var(--mono); font-size: 13px; }

/* menus: popovers placed under their trigger by main.js */
.menu {
  position: fixed; inset: auto; margin: 0; width: 288px; max-height: 360px; overflow: hidden auto; padding: 0;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop);
}
.menu:popover-open { display: flex; flex-direction: column; animation: pop .12s ease-out; }
.menu.narrow { width: 192px; }
.menu-list { padding: 4px; overflow-y: auto; }
.menu-item { display: flex; width: 100%; height: 32px; align-items: center; gap: 10px; padding: 0 8px; border-radius: 6px; font-size: 13px; outline: none; }
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); }
.menu-item.faint { color: var(--ink-3); }
.menu-item .tick { display: grid; width: 16px; height: 16px; flex-shrink: 0; place-items: center; border: 1.5px solid var(--ink-3); border-radius: 4px; }
.menu-item[aria-checked="true"] .tick { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.menu-item .tick .i { width: 12px; height: 12px; }
.menu-item .radio { display: grid; width: 16px; height: 16px; flex-shrink: 0; place-items: center; border: 1.5px solid var(--ink-3); border-radius: 50%; }
.menu-item[aria-checked="true"] .radio { border-color: var(--accent); }
.menu-item .radio i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.menu-item > .i { width: 14px; height: 14px; }
.menu-find { width: 100%; height: 40px; flex-shrink: 0; padding: 0 12px; border-bottom: 1px solid var(--line); font-size: 13px; outline: none; }
.menu-find::placeholder { color: var(--ink-3); }
.menu-empty { padding: 24px 8px; text-align: center; font-size: 13px; color: var(--ink-3); }
.menu-foot { flex-shrink: 0; padding: 4px; border-top: 1px solid var(--line); }
.menu-wide { width: 100%; height: 32px; border-radius: 6px; text-align: center; font-size: 13px; color: var(--ink-2); }
.menu-wide:hover { background: var(--hover); color: var(--ink); }
.menu-range { margin-top: 4px; padding: 10px 8px 8px; border-top: 1px solid var(--line); }
.menu-note { margin-bottom: 6px; font-size: 12px; color: var(--ink-3); }
.range { display: flex; align-items: center; gap: 6px; color: var(--ink-3); }
.range input { height: 32px; min-width: 0; flex: 1; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-size: 12.5px; color: var(--ink); outline: none; }
.range input:focus { border-color: var(--accent); }

/* ------------------------------------------------------------------ the frame */

.shell { display: grid; height: 100dvh; grid-template-columns: 60px minmax(0, 1fr); }
.rail { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 0; border-right: 1px solid var(--line); background: var(--panel); }
.rail .spacer { flex: 1; }
.brand-btn { margin-bottom: 14px; border-radius: 9px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.brand .mark { flex-shrink: 0; }
.brand.phone { display: none; }
.rail-btn { position: relative; display: grid; width: 40px; height: 40px; place-items: center; border-radius: 9px; color: var(--ink-3); transition: background-color .15s, color .15s; }
.rail-btn:hover { background: var(--hover); color: var(--ink); }
.rail-btn[aria-current="page"] { background: var(--surface); color: var(--accent); box-shadow: 0 0 0 1px var(--line); }
.rail-btn .i { width: 19px; height: 19px; }
.rail-btn .badge, .rail-profile .badge { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--panel); }
.rail-profile .badge { top: 5px; right: 5px; }

/* the list is 372, 400 or 440px wide by window size, until its edge is dragged (--list-w);
   whatever the width, the open memory keeps at least 420px */
.mem { display: grid; min-height: 0; grid-template-columns: minmax(0, 1fr); }
.list-pane { position: relative; display: flex; min-height: 0; flex-direction: column; background: var(--panel); }
.read-pane { min-height: 0; overflow-y: auto; }
.read-inner { max-width: 780px; margin: 0 auto; padding: 16px 40px 64px; }
.back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 12px; font-size: 13px; color: var(--ink-3); }
.back:hover { color: var(--ink); }
.back .i { width: 16px; height: 16px; }
.empty-read { padding-top: 96px; text-align: center; color: var(--ink-3); }
.resize { position: absolute; top: 0; right: 0; bottom: 0; z-index: 10; width: 10px; translate: 50% 0; cursor: col-resize; outline: none; }
.resize span { position: absolute; inset: 0 auto 0 50%; width: 2px; translate: -50% 0; transition: background-color .15s; }
.resize:hover span { background: color-mix(in srgb, var(--accent) 60%, transparent); }
.resize:focus-visible span, body.resizing .resize span { background: var(--accent); }

@media (min-width: 1024px) {
  .mem { grid-template-columns: min(var(--list-w, 372px), calc(100% - 420px)) minmax(0, 1fr); }
  .list-pane { border-right: 1px solid var(--line); }
  .back { display: none; }
}
@media (min-width: 1280px) { .mem { grid-template-columns: min(var(--list-w, 400px), calc(100% - 420px)) minmax(0, 1fr); } }
@media (min-width: 1536px) { .mem { grid-template-columns: min(var(--list-w, 440px), calc(100% - 420px)) minmax(0, 1fr); } }
@media (max-width: 1023px) {
  .mem.reading .list-pane, .mem:not(.reading) .read-pane, .resize { display: none; }
  .read-inner { padding-inline: 24px; }
}
@media (max-width: 639px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: 52px minmax(0, 1fr); }
  .rail { flex-direction: row; padding: 0 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .rail .spacer { display: none; }
  .brand-btn { margin: 0 auto 0 0; }
  .brand.phone { display: inline-flex; } .brand.desk { display: none; }
  .brand-btn[data-tip]::after, .rail-btn[data-tip]::after { display: none; }
  .read-inner { padding-inline: 16px; }
}

.demo-bar { display: flex; height: 36px; align-items: center; justify-content: center; gap: 16px; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--accent-soft); font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; }
.demo-bar b { font-weight: 600; color: var(--ink); }
.demo-bar span { overflow: hidden; text-overflow: ellipsis; }
.demo-bar a { color: var(--accent); font-weight: 500; }
.demo-bar a:hover { text-decoration: underline; text-underline-offset: 3px; }
.demo-bar + .shell { height: calc(100dvh - 36px); }
@media (max-width: 639px) { .demo-bar { justify-content: flex-start; gap: 12px; } .demo-bar a:last-child { display: none; } }

/* ------------------------------------------------------------------ the list */

.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 10px; }
.list-head h1 { font-size: 15px; font-weight: 600; }
.list-head h1 span { margin-left: 4px; font-weight: 400; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.list-tools { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 0 16px 12px; border-bottom: 1px solid var(--line); }
.list-scroll { min-height: 0; flex: 1; overflow-y: auto; }
.list-foot { padding: 8px 16px; border-top: 1px solid var(--line); }
.unpushed { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--warn); }
.unpushed:hover { text-decoration: underline; }

.search { position: relative; display: block; }
.search > .i { position: absolute; top: 50%; left: 12px; width: 16px; height: 16px; translate: 0 -50%; color: var(--ink-3); pointer-events: none; }
.search input { width: 100%; height: 32px; padding: 0 40px 0 36px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--surface); font-size: 13px; outline: none; }
.search input::placeholder { color: var(--ink-3); }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input::-webkit-search-cancel-button { display: none; }
.search-end { position: absolute; top: 50%; right: 10px; translate: 0 -50%; display: flex; }
.search .clear { display: grid; width: 20px; height: 20px; place-items: center; border-radius: 4px; color: var(--ink-3); }
.search .clear:hover { background: var(--hover); color: var(--ink); }
.search .clear .i { width: 14px; height: 14px; }
.try { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: -4px; font-size: 12px; color: var(--ink-3); }
.try button { padding: 0 8px; border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 6px; line-height: 22px; color: var(--ink-2); }
.try button:hover { border-style: solid; background: var(--accent-soft); color: var(--ink); }

.filters { container-type: inline-size; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.type-toggle { display: flex; width: 100%; padding: 2px; border-radius: 9px; background: var(--chip); }
.type-toggle > button { display: inline-flex; min-width: 0; height: 28px; flex: auto; align-items: center; justify-content: center; gap: 6px; padding: 0 6px; border-radius: 7px; font-size: 13px; color: var(--ink-2); text-transform: capitalize; transition: color .15s; }
.type-toggle > button:first-child { padding: 0 8px; }
.type-toggle > button:hover { color: var(--ink); }
.type-toggle > button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--ring); }
.type-toggle > button.faint { opacity: .5; }
.type-toggle span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin-left: -10px; }
.narrow-only { display: none; }
@container (max-width: 20.5rem) { .wide-only { display: none; } .narrow-only { display: contents; } }
.chip { display: inline-flex; height: 32px; align-items: center; border-radius: var(--r-ctl); }
.chip:hover, .chip:has(.menu:popover-open) { background: var(--hover); }
.chip.set, .chip.set:hover { background: var(--accent-soft); }
.chip-btn { display: inline-flex; height: 32px; align-items: center; gap: 6px; padding: 0 8px 0 10px; border-radius: var(--r-ctl); font-size: 13px; color: var(--ink-3); }
.chip-btn .i { width: 14px; height: 14px; }
.chip-value { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.chip.set .chip-btn { padding-right: 4px; color: var(--accent); }
.chip.set .chip-value { color: var(--accent); font-weight: 600; }
.chip-x { display: grid; width: 24px; height: 24px; margin-right: 4px; place-items: center; border-radius: 6px; color: var(--accent); }
.chip-x:hover { background: var(--accent-soft); }
.chip-x .i { width: 14px; height: 14px; }
.clear-all { height: 28px; padding: 0 8px; border-radius: 6px; font-size: 13px; color: var(--accent); }
.clear-all:hover { background: var(--accent-soft); }

.list-bar { position: sticky; top: 0; z-index: 1; display: flex; height: 36px; align-items: center; justify-content: space-between; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--panel); font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.sort-btn { display: inline-flex; height: 28px; align-items: center; gap: 4px; margin-right: -8px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.sort-btn:hover { background: var(--hover); color: var(--ink); }
.sort-btn .i { width: 14px; height: 14px; }
.list-group { padding: 20px 16px 8px; border-bottom: 1px solid var(--line-soft); font-size: 12px; font-weight: 600; color: var(--ink-3); }
.row { position: relative; display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); cursor: pointer; outline: none; transition: background-color .12s; }
.row:hover { background: var(--hover); }
.row.open { background: var(--surface); box-shadow: inset 2px 0 0 var(--accent); }
.row.cursor { box-shadow: inset 2px 0 0 var(--ink-3); }
.row.picked { background: var(--chip); }
.row-check { display: flex; height: 21px; align-items: center; opacity: 0; transition: opacity .12s; }
.row:hover .row-check, .row:focus-within .row-check, .row-check.shown { opacity: 1; }
@media (max-width: 1023px) { .row-check:not(.shown) { display: none; } }
.row-main { min-width: 0; flex: 1; }
.row-title { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-weight: 600; line-height: 21px; }
.row-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12px; color: var(--ink-3); }
.row-snip { margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: var(--ink-3); }
.list-empty { padding: 64px 24px; text-align: center; color: var(--ink-3); }
.list-empty .btn { margin-top: 12px; }
mark { padding: 0 1px; border-radius: 3px; background: color-mix(in srgb, var(--accent) 20%, transparent); color: inherit; }

/* ------------------------------------------------------------------ a memory */

.memory, .memory-form { min-width: 0; }
.memory-bar { display: flex; height: 32px; align-items: center; gap: 4px; }
.file-path { min-width: 0; margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.memory-bar [data-tip]::after { left: auto; right: 0; translate: 0 0; }
.memory-title { margin-top: 12px; font-size: 21px; font-weight: 600; line-height: 1.375; letter-spacing: -0.015em; }
.memory-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.memory-meta .sep { color: var(--ink-3); }
.memory-meta .where { display: inline-flex; min-width: 0; align-items: center; gap: 6px; }
.memory-meta .where .i { width: 14px; height: 14px; color: var(--ink-3); }
.keywords { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.kw { padding: 0 8px; border-radius: 6px; background: var(--chip); font-size: 12px; line-height: 22px; color: var(--ink-2); }
.kw:hover { background: var(--accent-soft); color: var(--ink); }
.kw.on { background: var(--ink); color: var(--bg); }
.callout { display: flex; gap: 10px; margin-top: 16px; padding: 10px 12px; border-radius: var(--r-ctl); font-size: 13px; color: var(--ink-2); }
.callout.warn { background: color-mix(in srgb, var(--warn) 10%, transparent); }
.callout.warn > .i { margin-top: 2px; width: 16px; height: 16px; color: var(--warn); }
.callout.bad { margin: 0 0 12px; background: color-mix(in srgb, var(--bad) 10%, transparent); }
.callout.bad .callout-title { color: var(--bad); }
.callout-title { font-weight: 500; color: var(--ink); }
.callout ul { margin-top: 4px; padding-left: 16px; list-style: disc; }
.callout pre { max-height: 160px; margin-top: 8px; overflow: auto; font-size: 12px; white-space: pre-wrap; color: var(--ink-2); }
.tabs { display: flex; gap: 20px; margin-top: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.tabs button { margin-bottom: -1px; padding-bottom: 8px; border-bottom: 2px solid transparent; font-size: 13px; color: var(--ink-3); }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { border-color: var(--ink); color: var(--ink); font-weight: 600; }
.raw { overflow-x: auto; padding: 12px 16px; border-radius: var(--r-ctl); background: var(--code-bg); font-size: 12.5px; line-height: 1.625; white-space: pre-wrap; color: var(--ink-2); }
.raw.tall { max-height: 320px; overflow: auto; font-size: 12px; }
.facts { margin-top: 32px; }
.facts:first-of-type { margin-top: 36px; }
.facts h2 { margin-bottom: 10px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.pairs { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 20px; font-size: 13px; }
.pairs dt { color: var(--ink-3); }
.pairs dd { overflow-wrap: anywhere; font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }
.similar h2 { margin-bottom: 4px; }
.similar button { display: flex; width: 100%; align-items: baseline; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line-soft); font-size: 13.5px; }
.similar button:hover .grow { text-decoration: underline; text-underline-offset: 3px; }

/* rendered memory bodies */
.md { font-size: 15px; line-height: 1.7; overflow-wrap: anywhere; }
.md.small { font-size: 14px; }
.md > * + * { margin-top: 0.8em; }
.md h1, .md h2, .md h3, .md h4 { margin-top: 1.3em; font-weight: 600; line-height: 1.35; }
.md h1 { font-size: 17px; } .md h2 { font-size: 16px; } .md h3, .md h4 { font-size: 15px; }
.md ul { padding-left: 1.4em; list-style: disc; } .md ol { padding-left: 1.4em; list-style: decimal; }
.md li + li { margin-top: 0.25em; }
.md hr { border-top: 1px solid var(--line); }
.md code { padding: 1px 5px; border-radius: 5px; background: var(--chip); font-size: 13px; }
.md pre { overflow-x: auto; padding: 12px 14px; border-radius: 8px; background: var(--code-bg); }
.md pre code { padding: 0; background: none; }
.md blockquote { padding-left: 12px; border-left: 3px solid var(--line); color: var(--ink-2); }
.md strong { font-weight: 600; }
.md a { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); text-underline-offset: 3px; cursor: pointer; }
.md-table { overflow-x: auto; }
.md table { font-size: 13px; }
.md th, .md td { padding: 4px 8px; border: 1px solid var(--line); text-align: left; vertical-align: top; }

/* the form */
.fields { display: grid; gap: 20px; margin-top: 16px; }
.field { display: block; }
.field-label { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.field-label .hint { font-weight: 400; font-variant-numeric: tabular-nums; }
.field-label .hint.bad { color: var(--bad); }
.caps .seg > button { text-transform: capitalize; }
.field input.input { margin-top: 8px; }
.input.desc { resize: vertical; font-size: 15px; font-weight: 500; }
.input.body { min-height: 288px; resize: vertical; line-height: 1.625; }
.form-bar { position: sticky; bottom: 0; display: flex; align-items: center; gap: 8px; margin-top: 20px; padding: 12px 0; border-top: 1px solid var(--line); background: var(--bg); }
.form-error { flex: 1; font-size: 13px; color: var(--bad); }

/* ------------------------------------------------------------------ insights and settings pages */

.page { min-height: 0; overflow-y: auto; }
.page-head { position: sticky; top: 0; z-index: 10; display: flex; height: 56px; align-items: center; gap: 12px; padding: 0 32px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px); }
.page-head h1 { flex: 1; font-size: 15px; font-weight: 600; }
.page-body { max-width: 1180px; margin: 0 auto; padding: 24px 32px 64px; }
@media (max-width: 639px) { .page-head { height: 48px; padding: 0 16px; } .page-body { padding: 16px 16px 64px; } }

.insights { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 768px) { .insights { grid-template-columns: repeat(2, minmax(0, 1fr)); } .span2, .stats { grid-column: span 2; } }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 1280px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { padding: 16px 20px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); }
.stat-k { font-size: 12.5px; color: var(--ink-2); }
.stat-v { margin-top: 6px; font-size: 30px; font-weight: 600; line-height: 1.2; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; }
.stat-s { margin-top: 2px; font-size: 12px; color: var(--ink-3); }
.stat-s.link-quiet:hover { color: var(--accent); }
.card { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); }
.card h2 { margin-bottom: 12px; font-size: 13.5px; font-weight: 600; }
.card-note { margin: -8px 0 8px; font-size: 12.5px; color: var(--ink-3); }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2 { margin-bottom: 2px; }
.card-head .card-note { margin: 0; }
@media (max-width: 639px) { .stat { padding: 12px 16px; } .stat-v { font-size: 24px; } .card { padding: 16px; } .select.wide { width: 100%; } }
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) 32px; align-items: center; gap: 12px; font-size: 13px; }
.bar-label { display: inline-flex; min-width: 0; align-items: center; gap: 6px; color: var(--ink-2); }
.bar-label .i { width: 14px; height: 14px; color: var(--ink-3); }
.bar-row:hover .bar-label { color: var(--ink); }
.bar { height: 8px; overflow: hidden; border-radius: 4px; background: var(--chip); }
.bar span { display: block; height: 100%; border-radius: 4px; background: var(--ink-2); }
.bar-row:hover .bar span { background: var(--accent); }
.bar-n { text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pair { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.card-note + .pair { border-top: 0; }
.pair-text { display: grid; min-width: 0; flex: 1; gap: 2px; font-size: 13px; }
.meter-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.meter { width: 176px; height: 6px; flex-shrink: 0; overflow: hidden; border-radius: 4px; background: var(--chip); }
.meter span { display: block; height: 100%; border-radius: 4px; background: var(--ink-2); }
.meter span.warn { background: var(--warn); }
.tidy { display: flex; width: 100%; align-items: flex-start; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.tidy:first-of-type { border-top: 0; }
.tidy .dot { margin-top: 7px; }
.tidy .grow { display: grid; }
.tidy .t { font-size: 13.5px; }
.tidy .faint { font-size: 12px; }
.tidy:hover .t { text-decoration: underline; }

.chart { position: relative; min-width: 0; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin-bottom: 12px; font-size: 12.5px; color: var(--ink-2); }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend .dot { width: 8px; height: 8px; }
.legend b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.legend .link-quiet { margin-left: auto; }
.chart-box svg { display: block; overflow: visible; }
.chart .grid-line { stroke: var(--line-soft); }
.chart .base-line { stroke: var(--line); }
.chart .axis { fill: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .week { fill: transparent; }
.chart .week.on { fill: var(--hover); }
.chart-empty { padding: 40px 0; text-align: center; font-size: 13px; color: var(--ink-3); }
.chart-tip { position: absolute; top: 32px; z-index: 10; width: 170px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--surface); font-size: 12px; box-shadow: var(--shadow-pop); pointer-events: none; }
.chart-tip-title { margin-bottom: 4px; font-weight: 500; }
.chart-tip-row { display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
.chart-tip-row b { font-weight: 400; color: var(--ink); font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
table.nums { width: 100%; font-size: 12.5px; font-variant-numeric: tabular-nums; }
table.nums th { padding: 4px 8px; font-weight: 500; text-align: right; color: var(--ink-3); }
table.nums td { padding: 4px 8px; border-top: 1px solid var(--line-soft); text-align: right; color: var(--ink-2); }
table.nums th:first-child, table.nums td:first-child { padding-left: 0; text-align: left; color: var(--ink); }
table.nums td:last-child { color: var(--ink); }

/* settings: the open profile as a hero, with its picture blurred into a glow of its own colours behind it; a few
   quiet rows of preferences; the installation as one line. Controls here are pills. */
.settings { --glow: .62; --glow-w: 600px; --glow-h: 400px; --glow-top: -150px; --glow-sat: 1.15;
  --pic-shadow: drop-shadow(0 10px 22px rgb(60 50 120 / .16)) drop-shadow(0 1px 2px rgb(0 0 0 / .08));
  width: 100%; max-width: 680px; margin: 16px auto 0; }
:root[data-theme="dark"] .settings { --glow: .3; --glow-w: 380px; --glow-h: 280px; --glow-top: -40px; --glow-sat: 2.8; --pic-shadow: drop-shadow(0 10px 24px rgb(0 0 0 / .45)); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .settings { --glow: .3; --glow-w: 380px; --glow-h: 280px; --glow-top: -40px; --glow-sat: 2.8; --pic-shadow: drop-shadow(0 10px 24px rgb(0 0 0 / .45)); }
}
.settings .btn { height: 32px; padding: 0 14px; border-radius: 999px; font-weight: 500; }
.settings .btn .i { width: 15px; height: 15px; }
.settings .btn.ghost { padding: 0 10px; }
.settings .input { height: 36px; font-size: 13px; }
.settings .seg { padding: 3px; border-radius: 999px; }
.settings .seg > button { padding: 0 13px; border-radius: 999px; }
.settings .switch { width: 38px; height: 22px; }
.settings .switch > span { width: 18px; height: 18px; }

.hero { position: relative; isolation: isolate; overflow: hidden; border: 1px solid var(--line-soft); border-radius: calc(var(--r-card) * 1.5);
  background: var(--surface); box-shadow: 0 1px 2px rgb(0 0 0 / .03), 0 8px 32px -12px rgb(40 30 90 / .08); }
.hero-glow { position: absolute; z-index: -1; top: var(--glow-top); left: 50%; width: var(--glow-w); height: var(--glow-h); translate: -50% 0; border-radius: 50%;
  overflow: hidden; filter: blur(60px) saturate(var(--glow-sat)); opacity: var(--glow); pointer-events: none; }
.hero-glow svg { display: block; width: 100%; height: 100%; }
.hero-main { display: flex; flex-direction: column; align-items: center; padding: 48px 32px 36px; text-align: center; }
.pavatar.hero-pic { width: 88px; height: 88px; filter: var(--pic-shadow); }
.hero-name { margin-top: 20px; font-size: 34px; font-weight: 650; line-height: 1.15; letter-spacing: -0.024em; }
.hero-sub { margin-top: 6px; font-size: 13.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.hero-sub .sep { margin: 0 6px; color: var(--ink-3); }
.hero-meta { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 20px; margin-top: 20px; }
.hero-meta-item { position: relative; display: inline-flex; min-width: 0; max-width: 100%; align-items: center; gap: 7px; font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }
.hero-meta-item > .i { width: 14px; height: 14px; color: var(--ink-3); }
.hero-meta-item .v { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-meta-item .k { font-family: var(--sans); color: var(--ink-3); }
button.hero-meta-item { border-radius: 6px; transition: color .15s; }
button.hero-meta-item:hover { color: var(--ink); }
.hero-meta-item > .copy-hint { position: absolute; right: -20px; width: 13px; height: 13px; opacity: 0; transition: opacity .15s; }
button.hero-meta-item:hover .copy-hint, button.hero-meta-item:focus-visible .copy-hint { opacity: 1; }
.hero-link { flex-shrink: 0; margin-left: -2px; padding: 2px 6px; border-radius: 6px; font-family: var(--sans); font-size: 12.5px; font-weight: 500; color: var(--accent); }
.hero-link:hover { background: var(--accent-soft); }
.hero-note { margin-top: 12px; font-size: 12.5px; color: var(--ok); }
.hero-note.bad { color: var(--bad); }
.remote-edit { width: 100%; max-width: 520px; margin-top: 16px; padding: 12px; border-radius: var(--r-card); background: color-mix(in srgb, var(--surface) 70%, transparent);
  box-shadow: var(--ring); text-align: left; animation: rise .15s ease-out; }
.remote-edit label { display: block; margin: 0 0 6px 2px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.remote-edit-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.sync-pill { display: inline-flex; max-width: 100%; height: 38px; align-items: center; margin-top: 24px; padding: 0 4px 0 14px; border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 78%, transparent); box-shadow: var(--ring); backdrop-filter: blur(6px); font-size: 13px; white-space: nowrap; }
.sync-pill.solo { padding-right: 14px; }
.sync-state { display: inline-flex; min-width: 0; align-items: center; gap: 8px; overflow: hidden; color: var(--ink-3); text-overflow: ellipsis; }
.sync-state b { font-weight: 500; color: var(--ink); }
.sync-sep { width: 1px; height: 18px; flex-shrink: 0; margin: 0 4px 0 12px; background: var(--line); }
.sync-btn { display: inline-flex; flex-shrink: 0; height: 30px; align-items: center; gap: 6px; padding: 0 12px; border-radius: 999px; font-weight: 500; color: var(--ink-2); transition: background-color .15s, color .15s; }
.sync-btn:hover { background: var(--hover); color: var(--ink); }
.sync-btn .i { width: 14px; height: 14px; }

.dock { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 14px 12px 20px; border-top: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--panel) 72%, transparent); }
.dock-label { margin-right: 4px; font-size: 12.5px; color: var(--ink-3); }
.pchip { display: inline-flex; height: 34px; align-items: center; gap: 8px; padding: 0 13px 0 5px; border-radius: 999px; background: var(--surface); box-shadow: var(--ring);
  font-size: 13.5px; font-weight: 500; transition: background-color .15s; }
.pchip:hover { background: var(--hover); }
.pchip:disabled { opacity: .6; }
.pchip[aria-pressed="true"] { box-shadow: 0 0 0 1.5px var(--accent), 0 0 0 4px var(--accent-soft); cursor: default; }
.pchip[aria-pressed="true"]:hover { background: var(--surface); }
.pchip .pavatar { width: 24px; height: 24px; }
.pchip .n { font-size: 12px; font-weight: 400; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.pchip.add { background: transparent; box-shadow: none; font-weight: 400; color: var(--ink-2); }
.pchip.add:hover { background: var(--hover); color: var(--ink); }
.pchip.add .plus { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 7px; background: var(--chip); color: var(--ink-2); }
.pchip.add .plus .i { width: 14px; height: 14px; }
.dock-remove { height: 30px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; color: var(--ink-3); transition: color .15s, background-color .15s; }
.dock-remove:hover { background: color-mix(in srgb, var(--bad) 9%, transparent); color: var(--bad); }
.pform { padding: 20px; border-top: 1px solid var(--line-soft); background: color-mix(in srgb, var(--panel) 72%, transparent); animation: rise .15s ease-out; }
.pform-top { display: flex; align-items: center; gap: 12px; }
.pform-top .pavatar { width: 44px; height: 44px; filter: drop-shadow(0 4px 10px rgb(60 50 120 / .14)); }
.pform-name { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.pform-note { font-size: 12.5px; color: var(--ink-3); }
.pform-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 12px; margin-top: 16px; }
.pfield { display: grid; gap: 6px; }
.pfield span { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.pfield span i { font-style: normal; font-weight: 400; }
.pform-error { margin-top: 12px; font-size: 13px; color: var(--bad); }
.pform-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.prefs { margin-top: 40px; }
.pref { display: flex; min-height: 64px; align-items: center; gap: 24px; padding: 14px 4px; }
.pref + .pref, .pref + .callout, .callout + .pref { border-top: 1px solid var(--line-soft); }
.prefs .callout { margin: 0; }
.pref-text { display: grid; flex: 1 0 auto; gap: 1px; }
.pref-label { font-size: 14px; font-weight: 500; }
.pref-sub { font-size: 12.5px; color: var(--ink-3); }
.pref-ctl { display: flex; flex: 0 1 auto; min-width: 0; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.pref-ctl > .btn.ghost { margin-right: -10px; }
.tag { display: inline-flex; height: 28px; align-items: center; gap: 2px; padding: 0 3px 0 11px; border-radius: 999px; background: var(--chip); font-size: 13px; }
.tag button { display: grid; width: 22px; height: 22px; place-items: center; border-radius: 50%; color: var(--ink-3); }
.tag button:hover { background: var(--hover); color: var(--ink); }
.tag .i { width: 12px; height: 12px; }
.tag-add { display: inline-flex; height: 28px; align-items: center; gap: 4px; padding: 0 10px 0 8px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-3); cursor: text; }
.tag-add:focus-within { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-soft); }
.tag-add .i { width: 13px; height: 13px; }
.tag-add input { width: 84px; font-size: 13px; outline: none; color: var(--ink); }
.tag-add input::placeholder { color: var(--ink-3); }
.code-copy { display: inline-flex; max-width: 100%; height: 28px; align-items: center; gap: 8px; padding: 0 10px; border-radius: 999px; background: var(--chip); font-family: var(--mono); font-size: 12px; color: var(--ink-2); overflow-wrap: anywhere; }
.code-copy:hover { color: var(--ink); }
.code-copy .i { width: 13px; height: 13px; }

.doctor { display: flex; flex-direction: column; align-items: center; margin-top: 40px; }
.doctor-line { display: inline-flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 2px; font-size: 12.5px; color: var(--ink-3); }
.doctor-line .sep { margin: 0 4px; }
.doctor-line button { display: inline-flex; height: 28px; align-items: center; gap: 7px; padding: 0 8px; border-radius: 999px; transition: background-color .15s, color .15s; }
.doctor-line button:hover { background: var(--hover); color: var(--ink); }
.doctor-sum { color: var(--ink-2); }
.doctor-sum.warn { color: var(--warn); }
.doctor-line .i { width: 13px; height: 13px; }
.doctor-sum .chev { transition: transform .15s; }
.doctor-sum .chev.turned { transform: rotate(180deg); }
.checks { width: 100%; margin-top: 12px; padding: 16px 20px 18px; border-radius: var(--r-card); background: var(--panel); animation: rise .15s ease-out; }
.checks-note { margin-bottom: 10px; font-size: 12px; color: var(--ink-3); }
.checks-note code { font-size: 11.5px; color: var(--ink-2); }
.checks ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 24px; }
.checks li { display: flex; min-width: 0; align-items: flex-start; gap: 8px; font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.checks li .i { width: 14px; height: 14px; margin-top: 2px; color: var(--ok); }
.checks li.bad { color: var(--ink); }
.checks li.bad .i { color: var(--warn); }

/* profiles: a picture (avatar.js) is drawn from the name; CSS gives it a size */
.pavatar { display: block; width: 28px; height: 28px; flex-shrink: 0; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.rail-profile { position: relative; display: grid; width: 40px; height: 40px; place-items: center; border-radius: 9px; transition: background-color .15s, box-shadow .15s; }
.rail-profile:hover { background: var(--hover); }
.rail-profile[aria-current="page"] { background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.rail-profile .pavatar { width: 26px; height: 26px; }
@media (max-width: 639px) {
  .settings { margin-top: 4px; }
  .hero-main { padding: 40px 20px 28px; }
  .pavatar.hero-pic { width: 80px; height: 80px; }
  .hero-name { margin-top: 18px; font-size: 28px; }
  .hero-meta { flex-direction: column; gap: 6px; }
  .hero-glow { width: min(var(--glow-w), 460px); }
  .sync-pill .wide-only { display: none; }
  .dock { padding: 12px 12px 12px 16px; }
  .dock-label { flex: 1 0 50%; margin: 0; }  /* the label and Remove share the first line, the chips the next */
  .dock-remove { order: 1; margin-right: -6px; }
  .dock .grow { display: none; }
  .dock .pchip { order: 2; }
  .pform { padding: 18px 16px; }
  .pform-fields { grid-template-columns: minmax(0, 1fr); }
  .prefs { margin-top: 28px; }
  .pref { flex-wrap: wrap; gap: 10px 16px; min-height: 60px; padding-inline: 2px; }
  .pref-text { flex: 1 1 auto; }
  .pref.wrap .pref-ctl { flex-basis: 100%; justify-content: flex-start; }
  .checks { padding: 14px 16px; }
  .checks ul { grid-template-columns: minmax(0, 1fr); }
  .rail-profile[data-tip]::after { display: none; }
}

/* ------------------------------------------------------------------ floating */

.selection { position: fixed; bottom: 24px; left: 50%; z-index: 40; translate: -50% 0; display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 16px; border-radius: var(--r-card); background: var(--ink); color: var(--bg); box-shadow: var(--shadow-pop); animation: rise .16s ease-out; }
.selection-n { margin-right: 4px; font-size: 13px; font-weight: 600; }
.selection button { height: 28px; padding: 0 10px; border: 1px solid color-mix(in srgb, var(--bg) 25%, transparent); border-radius: 6px; font-size: 13px; }
.selection button:hover { background: color-mix(in srgb, var(--bg) 15%, transparent); }
.selection button.danger { border: 0; background: var(--bad); color: #fff; font-weight: 500; }
.selection button.danger:hover { opacity: .9; }
.toasts { position: fixed; bottom: 24px; left: 50%; z-index: 50; translate: -50% 0; display: grid; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 16px; padding: 10px 16px; border-radius: 10px; background: var(--ink); color: var(--bg); font-size: 13px; box-shadow: var(--shadow-pop); pointer-events: auto; animation: rise .16s ease-out; }
.toast.bad { background: var(--bad); color: #fff; }
.toast button { font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

.dialog { width: min(440px, calc(100vw - 32px)); margin: auto; padding: 20px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop); }
.dialog[open] { animation: pop .14s ease-out; }
.dialog::backdrop { background: rgb(0 0 0 / .3); }
.dialog-title { font-size: 15px; font-weight: 600; }
.dialog-body { margin-top: 8px; font-size: 13.5px; white-space: pre-line; color: var(--ink-2); }
.sline { display: grid; grid-template-columns: auto auto; justify-content: start; margin-top: 14px; font-size: 12px; color: var(--ink-3); }
.sline > span { padding-right: 14px; }
.sline > .next:not(.sline-name) { padding-left: 14px; border-left: 1.5px dashed var(--ink-3); }
.sline > .sline-name.next { padding-left: 15.5px; }
.sline > .sline-when { padding-bottom: 4px; }
.sline-msgs { display: flex; align-items: center; gap: 5px; height: 22px; }
.sline-msgs i { width: 20px; height: 11px; border-radius: 6px; overflow: hidden; box-shadow: 0 0 0 0.5px var(--line); }
.sline-msgs i svg { display: block; width: 100%; height: 100%; }
.sline-msgs b { font-weight: 400; margin-left: 2px; }
.sline-name { display: flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--ink-2); }
.sline-name .pavatar { width: 16px; height: 16px; }
.dialog-check { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding: 0; border: 0; background: none; color: var(--ink-2); font: inherit; font-size: 13px; cursor: pointer; }
.dialog-check[aria-checked="true"] .check { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.dialog.wide { width: min(1040px, calc(100vw - 32px)); max-height: min(760px, calc(100vh - 48px)); padding: 0; }
.dialog.wide[open] { display: flex; flex-direction: column; }
.dialog-head { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.dialog-head .dialog-title { flex: 1; }
.compare { display: grid; min-height: 0; flex: 1; grid-template-columns: minmax(0, 1fr); overflow: auto; }
@media (min-width: 768px) { .compare { grid-template-columns: repeat(2, minmax(0, 1fr)); } .compare section + section { border-left: 1px solid var(--line); } }
@media (max-width: 767px) { .compare section + section { border-top: 1px solid var(--line); } }
.compare section { display: flex; min-width: 0; flex-direction: column; padding: 20px; }
.compare h3 { font-size: 16px; font-weight: 600; line-height: 1.375; }
.compare-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--ink-3); }
.compare .md { margin-top: 16px; flex: 1; }
.compare-actions { display: flex; gap: 8px; margin-top: 20px; }

@media (prefers-reduced-motion: reduce) { *, ::before, ::after { animation: none !important; transition: none !important; } }
