/* Loop hub. Warm white and brown, centered 720px column, serif wordmark, floating bottom nav. */
:root {
  --bg: light-dark(#FDFCFB, #1A1614); --ink: light-dark(#3F2C2A, #F1E5E4); --text: light-dark(#4D3533, #E6D8D6); --muted: light-dark(#6F5A57, #C3AEAA); --soft: light-dark(#7E6865, #B49F9C);
  --line: light-dark(#E8DFDC, #36312F); --card: light-dark(#fff, #241F1E); --card-line: light-dark(#EFE7E4, #2D2927); --tint: light-dark(#F5EFED, #252120); --tint2: light-dark(#F7F2F0, #211F1E);
  --brown: light-dark(#4D3533, #E6D8D6); --brown-2: light-dark(#64494A, #CEBFBF); --ok: light-dark(#3F7556, #87B89A); --ok-bg: light-dark(#E9F2EC, #202522); --warn: light-dark(#8E5B22, #D19F6E); --warn-bg: light-dark(#FBF1E4, #241F18);
  --no: light-dark(#A3412F, #F0907D); --no-bg: light-dark(#FBEBE7, #2A211F); --info: light-dark(#4B5E86, #A1B5DD); --info-bg: light-dark(#ECEFF6, #222427);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; min-height: 100vh; }
a { color: inherit; text-decoration-color: light-dark(#CDBDB9, #605451); text-underline-offset: 2px; }
a:hover { text-decoration-color: currentColor; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea { font: inherit; color: var(--ink); }
ul, ol { list-style: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brown); outline-offset: 2px; border-radius: 6px; }
h1:focus, main:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.offscreen { position: fixed; left: -9999px; top: 0; opacity: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 80; background: var(--brown); color: var(--bg); padding: 10px 14px; border-radius: 10px; text-decoration: none; }
.skip:focus { top: 12px; }

.wrap { width: 760px; max-width: calc(100% - 40px); margin: 0 auto; padding: 0 0 150px; }
.wrap:has(#auth-form input[autocomplete="current-password"], #loop-auth-screen) {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: 1fr auto auto 1fr;
  padding: 0;
}
.wrap:has(#auth-form input[autocomplete="current-password"], #loop-auth-screen) > main {
  grid-row: 3;
  padding-block: 16px;
}
.top { position: relative; height: 92px; display: flex; align-items: center; justify-content: center; }
.logo { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; padding: 4px 10px; }
.logo-img { display: block; height: 38px; width: auto; }
.top-title { margin: 0; font-family: var(--serif); font-size: 30px; font-weight: 500; line-height: 1.1; color: var(--ink); }
.logo[hidden], .top-title[hidden] { display: none; }
/* Narrow windows have no side menu: on a Library page the title opens a short menu of the Library parts. */
.top-part { display: none; position: relative; }
.top-part-btn { display: inline-flex; align-items: baseline; gap: 8px; height: 44px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: var(--ink); font: inherit; cursor: pointer; }
.top-part-btn:hover { background: var(--tint); }
.top-part-t { font-family: var(--serif); font-size: 24px; font-weight: 500; line-height: 44px; }
.top-part-now { font-size: 14px; color: var(--muted); }
.top-part-now:not(:empty)::before { content: '· '; }
.top-part-btn svg { align-self: center; color: var(--muted); }
.top-part-menu { left: 50%; right: auto; transform: translateX(-50%); min-width: 200px; }
.top-part-menu .top-more-i[aria-current=page] { font-weight: 600; }
.top-part-menu .top-more-i[aria-current=page]::after { content: '✓'; margin-left: auto; color: var(--muted); }
@media (max-width: 979px) {
  .top-part:not([hidden]) { display: block; }
  .top-part:not([hidden]) ~ .top-title, .top:has(.top-part:not([hidden])) .top-title { display: none; }
}
.back, .toplink { position: absolute; top: 50%; transform: translateY(-50%); font-size: 14px; color: var(--soft); text-decoration: none; padding: 8px 4px; min-height: 40px; display: inline-flex; align-items: center; gap: 4px; max-width: 34%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back { left: 0; }
.back .back-ic { flex: none; margin-left: -4px; transition: transform .18s cubic-bezier(.2, .8, .2, 1); }
.back:hover .back-ic { transform: translateX(-2px); }
@media (prefers-reduced-motion: reduce) { .back .back-ic { transition: none; } }
.toplink { right: 0; }
.back:hover, .toplink:hover, .toplink[aria-current] { color: var(--ink); }

/* type */
h1 { font-size: 26px; line-height: 1.25; font-weight: 600; color: var(--ink); margin-top: 18px; letter-spacing: -.2px; }
.hero { text-align: center; }
.hero h1 { font-family: var(--serif); font-weight: 500; font-size: 28px; margin-top: 4px; }
.intro { color: var(--muted); font-size: 15px; line-height: 22px; margin: 8px auto 0; max-width: 520px; }
.lead { font-size: 15px; color: var(--muted); margin-top: 6px; line-height: 22px; max-width: 600px; }
.kicker { font-size: 12px; color: var(--soft); text-transform: uppercase; letter-spacing: .08em; margin-top: 18px; }
.kicker + h1 { margin-top: 4px; }
h2 { font-size: 17px; font-weight: 600; color: var(--ink); margin: 44px 0 8px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
h2 small { font-size: 13px; font-weight: 400; color: var(--soft); }
h2.flat { margin: 0 0 10px; }
h2.center, .center { text-align: center; justify-content: center; }
.sub { font-size: 13.5px; color: var(--muted); margin: -2px 0 10px; line-height: 20px; }
.meta { font-size: 13px; color: var(--soft); margin-top: 8px; }
.d { font-size: 13.5px; color: var(--muted); line-height: 19px; }
.d.sm, .sm.d { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 12.5px; color: var(--muted); word-break: break-all; }
.pre { white-space: pre-wrap; word-break: break-word; }
.summary { font-size: 16px; line-height: 24px; color: var(--ink); margin-top: 18px; }
.h1row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.h1row h1 { margin-top: 0; }
.ok { color: var(--ok); } .no { color: var(--no); } .warn { color: var(--warn); }

/* rows and lists */
.list > li { border-bottom: 1px dashed var(--line); }
.row { display: flex; align-items: center; gap: 16px; padding: 14px 4px; text-decoration: none; color: inherit; border-radius: 10px; }
.row.click:hover { background: light-dark(rgba(245, 239, 237, .55), rgba(37, 33, 32, 0.55)); }
.row.click:hover .t { text-decoration: underline; text-decoration-color: light-dark(#D9CBC7, #4D4542); }
.txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.t { font-size: 15px; color: var(--ink); line-height: 21px; }
.txt .d { overflow-wrap: anywhere; }
.ic { width: 40px; height: 40px; border-radius: 10px; flex: none; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; color: light-dark(#fff, #241F1E); background: var(--brown); }
.ic.big { width: 52px; height: 52px; border-radius: 14px; font-size: 20px; }
.ic.line { background: var(--tint); color: var(--text); }
.av0 { background: light-dark(#4D3533, #E6D8D6); } .av1 { background: light-dark(#8A5A44, #CF9F89); } .av2 { background: light-dark(#5E7A66, #8EA895); } .av3 { background: light-dark(#6B5B8E, #B2A4D6); } .av4 { background: light-dark(#A0603A, #CD906D); } .av5 { background: light-dark(#3F5F7A, #9DBCD7); }
.chev { color: light-dark(#A8958F, #867671); font-size: 22px; line-height: 1; flex: none; }
.go { font-size: 13px; color: var(--soft); white-space: nowrap; }
.price { text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 84px; }
.p { font-size: 15px; color: var(--ink); font-weight: 500; }
.pill { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px 4px; font-size: 12.5px; color: var(--muted); background: var(--tint); border-radius: 12px; padding: 4px 10px; flex: none; white-space: nowrap; }
.pill b { color: var(--text); font-weight: 600; }
.pill.warn { color: var(--warn); background: var(--warn-bg); font-weight: 500; }
.pill.no { color: var(--no); background: var(--no-bg); font-weight: 500; }
.pill.muted { color: var(--soft); background: var(--tint); }
.row-title { display: inline-flex; align-items: center; gap: 7px; flex-wrap: wrap; }

/* Keep dashboard content between the header and bottom navigation. */
/* A page is drawn out of sight (.view.is-staged, app.js) before it replaces the page on screen.
   Rules that ask which page is there say :where(.view:not(.is-staged)), so the page still on screen
   keeps its layout until the swap. */
body:has(.nav:not([hidden])) .wrap {
  height: 100dvh;
  padding-bottom: calc(68px + max(24px, env(safe-area-inset-bottom)));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}
body:has(.nav:not([hidden])) main {
  grid-row: 3;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0 4px 4px;
}
.vault-editor > summary { cursor: pointer; font-weight: 600; }
.vault-editor[open] > summary { margin-bottom: 10px; }
.cat-groups[aria-label="Agents"] { overflow: clip; }
.connections-list { border: 1px solid var(--card-line); border-radius: 15px; overflow: clip; margin-top: 16px; }
.connections-list > .conn-card { border: 0; border-radius: 0; }
.connections-list > .conn-card + .conn-card { border-top: 1px solid var(--card-line); }
.wrap:has(:where(.view:not(.is-staged)) .home-connections) .view {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}
.home-connections {
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.home-connections > :last-child {
  overflow-y: auto;
  overscroll-behavior: contain;
}
.cat-groups { margin-top: 4px; border: 1px solid var(--card-line); border-radius: 15px; }
.cat-groups > .cat-group { border: 0; border-bottom: 1px solid var(--card-line); border-radius: 0; }
.cat-groups > .cat-add-trigger { width: 100%; }
.cat-group {
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: 15px;
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.cat-group:hover { border-color: light-dark(#DDD0CC, #47403D); }
.cat-group.open { border-color: light-dark(#D9C9C4, #504643); box-shadow: 0 3px 12px light-dark(rgba(77, 53, 51, .04), rgba(0, 0, 0, 0.18)); }
.cat-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px;
  text-align: left;
  transition: background .15s;
}
.cat-head:hover { background: light-dark(rgba(245, 239, 237, .45), rgba(37, 33, 32, 0.45)); }
.cat-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cat-title { font-size: 15.5px; font-weight: 600; color: var(--ink); line-height: 21px; }
.cat-right { display: inline-flex; align-items: center; gap: 8px; flex: none; }
.cat-items { border-top: 1px dashed var(--line); background: light-dark(#FCF9F7, #1A1918); padding: 2px 12px 4px; }
.cat-items > li:last-child { border-bottom: 0; }
.cat-items .row { padding: 12px 6px; }
.cat-items .row.is-off .t { color: var(--muted); }
.cat-empty { padding: 14px 6px; font-size: 13.5px; color: var(--muted); }

/* Agents page: one row per agent; opening a row shows its setup, settings and activity */
.agent-body { border-top: 1px dashed var(--line); background: light-dark(#FCF9F7, #1A1918); padding: 2px 16px 18px; }
.agent-facts { font-size: 13px; color: var(--muted); line-height: 19px; margin-top: 14px; overflow-wrap: anywhere; }
.agent-body .conn-drawer { border-top: 0; background: none; padding: 0; }
.agent-body .list > li:last-child { border-bottom: 0; }
.agent-row.is-off .cat-title { color: var(--muted); }
.agent-add { background: transparent; border-style: dashed; }
.agent-add .cat-title { font-weight: 500; }
.cat-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 6px 10px;
  border-top: 1px dashed var(--line);
}

/* Add new category dashed card & inline composer */
.cat-add-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 16px;
  border-radius: 15px;
  border: 1.5px dashed light-dark(#E1D5D1, #423A38);
  background: transparent;
  text-align: left;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.cat-add-trigger:hover {
  border-color: light-dark(#C7B6B2, #685A57);
  background: light-dark(#FAF6F4, #1D1B1A);
  transform: translateY(-1px);
}
.cat-add-plus {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--tint);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  transition: background .16s ease, color .16s ease;
}
.cat-add-trigger:hover .cat-add-plus {
  background: var(--brown);
  color: var(--bg);
}
.cat-add-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.cat-add-title { font-size: 14.5px; font-weight: 600; color: var(--ink); line-height: 20px; }
.cat-add-card {
  background: var(--card);
  border: 1px solid light-dark(#DFD2CE, #453D3B);
  border-radius: 16px;
  padding: 18px 18px 16px;
  box-shadow: 0 6px 22px light-dark(rgba(77, 53, 51, .06), rgba(0, 0, 0, 0.23));
}
.cat-add-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.cat-add-head h3 { font-size: 15.5px; font-weight: 600; color: var(--ink); margin: 0; }
.cat-pick-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.cat-pick-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 148px;
  overflow-y: auto;
  padding: 2px 0;
}
.cat-pick {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  padding: 5px 10px;
  border-radius: 14px;
  border: 1px solid light-dark(#EAE0DC, #352F2D);
  background: var(--tint2);
  color: var(--text);
  transition: background .14s, border-color .14s, color .14s;
}
.cat-pick:hover { border-color: light-dark(#C7B6B2, #685A57); background: var(--tint); }
.cat-pick[aria-pressed=true] {
  background: var(--brown);
  border-color: var(--brown);
  color: var(--bg);
}
.held { color: var(--warn); }
.tag { display: inline-block; font-size: 11.5px; font-weight: 500; border-radius: 10px; padding: 2px 8px; vertical-align: 1px; white-space: nowrap; }
.tag.ok { color: var(--ok); background: var(--ok-bg); }
.tag.warn { color: var(--warn); background: var(--warn-bg); }
.tag.no { color: var(--no); background: var(--no-bg); }
.tag.info { color: var(--info); background: var(--info-bg); }
.tag.muted, .tag.brown { color: light-dark(#7A5F55, #C1A69C); background: light-dark(#F3ECE9, #282422); }
.statusline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 28px; }
.stats a { display: flex; flex-direction: column; gap: 2px; height: 100%; background: var(--card); border: 1px solid var(--card-line); border-radius: 14px; padding: 14px; text-decoration: none; transition: border-color .15s, transform .15s, box-shadow .15s; }
.stats a:hover { border-color: light-dark(#D3C3BF, #574D4B); transform: translateY(-1px); box-shadow: 0 4px 14px light-dark(rgba(77, 53, 51, .06), rgba(0, 0, 0, 0.23)); }
.stats a.hot { border-color: light-dark(#E6C9A4, #56442C); background: light-dark(#FFFBF5, #191714); }
.stats b { font-size: 22px; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.stats span { font-size: 12.5px; color: var(--muted); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 14px; font-weight: 500; border-radius: 9px; padding: 9px 14px; min-height: 40px; border: 1px solid light-dark(#E0D5D1, #413B39); background: var(--card); color: var(--text); white-space: nowrap; text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s; }
.btn:hover { border-color: light-dark(#C7B6B2, #685A57); }
.btn.fill { background: var(--brown); border-color: var(--brown); color: var(--bg); }
.btn.fill:hover { background: light-dark(#3A2826, #F6EBE9); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); background: var(--tint); }
.btn.sm { min-height: 34px; padding: 6px 12px; font-size: 13px; }
.btn.big { width: 100%; padding: 14px; font-size: 16px; border-radius: 12px; min-height: 50px; }
.btn.danger { background: var(--no); border-color: var(--no); color: light-dark(#fff, #241F1E); }
.btn.danger-outline { color: var(--no); border-color: light-dark(#E7C3BB, #5A433E); }
.btn.danger-outline:hover { background: var(--no-bg); }
.btn:disabled, .btn[aria-disabled=true] { opacity: .55; cursor: not-allowed; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: center; }
.acts.center { justify-content: center; }
.acts.stack { flex-direction: column; }
.saved { font-size: 13px; color: var(--ok); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.chip { font-size: 13px; color: var(--muted); border: 1px solid light-dark(#EDE4E1, #312B2A); background: var(--card); border-radius: 16px; padding: 6px 12px; min-height: 34px; }
.chip span { color: var(--soft); margin-left: 2px; }
.chip[aria-pressed=true] { background: var(--brown); border-color: var(--brown); color: var(--bg); }
.chip[aria-pressed=true] span { color: light-dark(#E2D4D0, #433B38); }

/* cards, notes, callouts */
.card { margin-top: 20px; border: 1px solid var(--card-line); background: var(--card); border-radius: 16px; padding: 20px 22px; }
.note { background: var(--tint2); border-radius: 14px; padding: 16px 18px; font-size: 13.5px; color: var(--muted); line-height: 20px; margin-top: 28px; }
.note .acts { margin-top: 10px; }
.callout { display: block; margin-top: 18px; background: var(--tint2); border: 1px solid light-dark(#EEE4E0, #312B29); border-radius: 12px; padding: 13px 16px; font-size: 13.5px; color: var(--text); line-height: 20px; }
.callout .acts { margin-top: 10px; }
.callout.warn { background: var(--warn-bg); border-color: light-dark(#F0DDC2, #3D3221); color: light-dark(#6E4718, #D4C0AB); }
.callout.bad { background: var(--no-bg); border-color: light-dark(#F0CFC7, #4B3733); color: light-dark(#7E2F22, #E8BDB5); }
.callout .spin.sm { vertical-align: -3px; margin-right: 6px; }
.banner-slot:empty { display: none; }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--info-bg); color: light-dark(#36466A, #C5CFE2); border-radius: 12px; padding: 10px 14px; font-size: 13.5px; margin-top: 4px; }
.banner.warn { background: var(--warn-bg); color: light-dark(#6E4718, #D4C0AB); }

/* forms */
.lbl { display: block; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 16px 0 6px; }
.card > .lbl:first-child, form > .lbl:first-child { margin-top: 0; }
input[type=text], input[type=number], input[type=search], input:not([type]), textarea { width: 100%; border: 1px solid light-dark(#E3D9D5, #3D3735); background: light-dark(#fff, #241F1E); border-radius: 10px; padding: 11px 13px; font-size: 15px; line-height: 21px; transition: border-color .15s, box-shadow .15s; }
textarea { resize: vertical; min-height: 84px; }
input:focus, textarea:focus { outline: none; border-color: light-dark(#B9A39E, #7A6864); box-shadow: 0 0 0 3px light-dark(rgba(77, 53, 51, .12), rgba(230, 216, 214, 0.12)); }
input[aria-invalid=true] { border-color: var(--no); }
.hint { font-size: 12.5px; color: var(--soft); margin-top: 8px; line-height: 18px; }
.field-err { font-size: 13px; color: var(--no); margin-top: 8px; }
.search { margin-top: 22px; border: 1px solid light-dark(#EDE4E1, #312B2A); background: light-dark(#fff, #241F1E); border-radius: 12px; padding: 0 14px; display: flex; gap: 10px; align-items: center; }
.search:focus-within { border-color: light-dark(#B9A39E, #7A6864); box-shadow: 0 0 0 3px light-dark(rgba(77, 53, 51, .12), rgba(230, 216, 214, 0.12)); }
.search input { border: 0; padding: 13px 0; background: none; box-shadow: none !important; }
.sicon { color: light-dark(#A8958F, #867671); font-size: 18px; }

/* code blocks */
.code { font-family: var(--mono); font-size: 12.5px; line-height: 19px; background: light-dark(#FAF6F4, #1D1B1A); border: 1px solid light-dark(#EFE6E2, #2F2A27); border-radius: 10px; padding: 12px 14px; overflow: auto; max-height: 420px; white-space: pre; color: light-dark(#3F2C2A, #F1E5E4); text-align: left; }
.code.mini { max-height: 180px; white-space: pre-wrap; }
.code.result { max-height: 520px; }
.codewrap { position: relative; }
.codewrap .code { padding-right: 76px; white-space: pre-wrap; word-break: break-all; }
.copybtn { position: absolute; top: 8px; right: 8px; }
h3.lbl { margin-top: 18px; }

/* tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.tab { font-size: 13.5px; color: var(--muted); border: 1px solid light-dark(#EDE4E1, #312B2A); background: var(--card); border-radius: 16px; padding: 7px 14px; min-height: 36px; }
.tab[aria-selected=true] { background: var(--brown); border-color: var(--brown); color: var(--bg); }
.tabpanel { margin-top: 12px; }

/* agent header and danger */
.ah { display: flex; align-items: center; gap: 16px; margin-top: 18px; }
.ah h1 { margin-top: 0; }
.danger { margin-top: 44px; padding-top: 4px; }
.danger h2 { color: var(--no); margin-top: 0; }

/* empty, loading */
.empty { text-align: center; background: var(--tint2); border-radius: 16px; padding: 28px 22px; margin-top: 14px; }
.empty .et { font-size: 16px; font-weight: 600; color: var(--ink); margin: 0; }
.empty h1.et { font-size: 20px; }
.empty .ed { font-size: 13.5px; color: var(--muted); margin: 6px auto 0; max-width: 440px; line-height: 20px; }
.empty.err { background: var(--no-bg); }
.loading { text-align: center; padding: 48px 0; color: var(--soft); font-size: 14px; }
.spin { width: 28px; height: 28px; border-radius: 50%; border: 3px solid light-dark(#EDE4E1, #312B2A); border-top-color: var(--brown); animation: spin .8s linear infinite; margin: 10px auto; }
.spin.sm { display: inline-block; width: 14px; height: 14px; border-width: 2px; margin: 0; vertical-align: -2px; }
.btn.fill .spin.sm { border-color: light-dark(rgba(255, 255, 255, .35), rgba(36, 31, 30, 0.35)); border-top-color: light-dark(#fff, #241F1E); }

/* nav */
.nav { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(24px, env(safe-area-inset-bottom)); background: light-dark(var(--brown), #3A2F2D); border-radius: 26px; padding: 7px; display: flex; gap: 4px; box-shadow: 0 8px 24px light-dark(rgba(77, 53, 51, .25), rgba(0, 0, 0, 0.6)); z-index: 20; }
.nav a { position: relative; height: 40px; padding: 0 12px; border-radius: 20px; display: flex; align-items: center; gap: 6px; color: #E9DEDB; font-size: 13px; text-decoration: none; transition: background .15s; white-space: nowrap; }
.nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav a[aria-current=page] { background: light-dark(var(--brown-2), rgba(255, 255, 255, .16)); color: #fff; }
.nav a:focus-visible { outline-color: #fff; }
.nav svg { flex: none; }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: light-dark(#E8A65B, #8A5401); color: light-dark(#3F2C2A, #F1E5E4); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }

/* toast */
/* Messages show at the bottom, just above the bottom menu, so they never cover the search box or the title. */
.toast { position: fixed; left: 50%; top: auto; bottom: calc(max(24px, env(safe-area-inset-bottom)) + 68px); transform: translateX(-50%); max-width: calc(100% - 32px); background: var(--ink); color: var(--bg); font-size: 14px; padding: 12px 18px; border-radius: 12px; box-shadow: 0 10px 30px light-dark(rgba(0, 0, 0, .2), rgba(0, 0, 0, 0.58)); z-index: 60; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, -4px); }
.toast.ok { background: light-dark(#2F4F3D, #C3D3C9); }
.toast.err { background: light-dark(#7E2F22, #E8BDB5); }
.noscript { text-align: center; padding: 40px; }

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .wrap { max-width: calc(100% - 32px); padding-bottom: 130px; }
  .top { height: 76px; }
  .logo-img { height: 32px; }
  .back, .toplink { font-size: 13px; }
  h1 { font-size: 23px; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .stats a { padding: 10px 6px; overflow-wrap: anywhere; }
  .grid { grid-template-columns: 1fr; }
  .card { padding: 18px 16px; }
  .row { gap: 12px; }
  .pill { max-width: 46%; }
  .appr-side { align-items: stretch; flex-basis: 100%; }
  .appr-amt { align-items: flex-start; flex-direction: row; gap: 8px; align-items: baseline; }
  .appr-acts { justify-content: flex-start; }
  .li { flex-direction: column; gap: 2px; }
  .li dd { text-align: left; }
  .nav { left: 12px; right: 12px; transform: none; justify-content: space-between; border-radius: 22px; padding: 6px; bottom: max(12px, env(safe-area-inset-bottom)); }
  .nav a { flex: 1; flex-direction: column; justify-content: center; gap: 2px; height: 50px; padding: 0 2px; font-size: 11px; border-radius: 16px; }
  .nav .badge { position: absolute; top: 3px; right: calc(50% - 22px); }
  .amt { font-size: 36px; }
}
@media (max-width: 380px) {
  .stats b { font-size: 19px; }
  .go { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: .001s !important; animation-iteration-count: 1 !important; }
}
@media (forced-colors: active) {
  .radio, .btn, .chip, .tab { border: 1px solid ButtonText; }
  .offer input:checked + label .radio { background: Highlight; }
}

/* Loop Gateway components */
input[type=url], input[type=password], select {
  width: 100%;
  border: 1px solid light-dark(#E3D9D5, #3D3735);
  background: light-dark(#fff, #241F1E);
  color: var(--ink);
  font: inherit;
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 15px;
  line-height: 21px;
  transition: border-color .15s, box-shadow .15s;
}
select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--soft) 50%), linear-gradient(135deg, var(--soft) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}
select:focus { outline: none; border-color: light-dark(#B9A39E, #7A6864); box-shadow: 0 0 0 3px light-dark(rgba(77, 53, 51, .12), rgba(230, 216, 214, 0.12)); }

.inline-code {
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--tint);
  padding: 1px 6px;
  border-radius: 6px;
  color: var(--ink);
}

.form-grid { display: grid; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; min-width: 0; }
.field .lbl { margin: 0 0 6px; }
.code-input { font-family: var(--mono); font-size: 13px; line-height: 1.5; }

.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; }

.seg {
  display: inline-flex;
  background: var(--tint);
  border: 1px solid light-dark(#EAE0DC, #352F2D);
  border-radius: 11px;
  padding: 3px;
  gap: 3px;
}
.seg + .form-grid { margin-top: 16px; }
.seg-btn {
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  transition: background .15s, color .15s, box-shadow .15s;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn[aria-pressed=true] {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 1px 3px light-dark(rgba(77, 53, 51, .1), rgba(0, 0, 0, 0.33));
}

/* Home connect card */
.connect-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.connect-head h2 { margin: 0; }
.profile-pick {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.profile-pick select {
  width: auto;
  min-width: 132px;
  padding: 6px 30px 6px 11px;
  font-size: 13.5px;
  border-radius: 9px;
}
.endpoint-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: light-dark(#FAF6F4, #1D1B1A);
  border: 1px solid light-dark(#EFE6E2, #2F2A27);
  border-radius: 10px;
  padding: 7px 8px 7px 13px;
  margin-top: 12px;
}
.endpoint-url {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink);
  overflow-x: auto;
  white-space: nowrap;
}

/* Transport & profile tags */
.tag.transport {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--tint);
}
.tag.transport.stdio { color: var(--muted); background: var(--tint); }
.tag.profile { color: var(--muted); background: var(--tint); }

/* Connections action bar & cards */
.bar-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
}
.bar-actions h2 { margin: 0; }
.bar-btns { display: flex; gap: 8px; flex-wrap: wrap; }

.conn-list { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.conn-card {
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: 16px;
  overflow: hidden;
  transition: border-color .15s;
}
.conn-card:hover { border-color: light-dark(#DFD2CE, #453D3B); }
.conn-card.disabled .conn-title { color: var(--muted); }
.conn-head { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.conn-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.conn-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.conn-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.conn-title { font-size: 15.5px; font-weight: 600; color: var(--ink); }
.conn-desc { font-size: 13.5px; color: var(--text); line-height: 19px; }
.conn-sub { font-family: var(--mono); font-size: 12.5px; color: var(--muted); word-break: break-all; }
.drawer-desc-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.drawer-desc-form input { flex: 1; min-width: 220px; }
.conn-err {
  font-size: 13px;
  color: var(--no);
  background: var(--no-bg);
  border: 1px solid light-dark(#F0CFC7, #4B3733);
  border-radius: 8px;
  padding: 7px 10px;
  line-height: 18px;
}
.conn-acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* Connection expandable drawer */
.conn-drawer {
  border-top: 1px dashed var(--line);
  background: light-dark(#FCF9F7, #1A1918);
  padding: 16px 18px 18px;
}
.drawer-sec { margin-top: 16px; }
.drawer-sec:first-child { margin-top: 0; }
.drawer-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--soft);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Tool toggle rows & inline tester */
.tool-list { display: flex; flex-direction: column; gap: 8px; }
.tool-item {
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: 12px;
  padding: 11px 13px;
}
.tool-item.off { background: var(--tint2); }
.tool-item.off .tool-name { color: var(--soft); text-decoration: line-through; text-decoration-color: light-dark(#CDBDB9, #605451); }
.import-row.off .tool-name { text-decoration: none; }
.tool-row { display: flex; align-items: flex-start; gap: 10px; }
.tool-check {
  width: 17px;
  height: 17px;
  margin-top: 2px;
  accent-color: var(--brown);
  cursor: pointer;
  flex: none;
}
.tool-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tool-name { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--ink); word-break: break-word; }
.tool-desc { font-size: 13px; color: var(--muted); line-height: 18px; }

.tool-tester {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.schema-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.schema-param {
  background: var(--tint2);
  border: 1px solid light-dark(#EAE0DC, #352F2D);
  border-radius: 7px;
  padding: 2px 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
}
.schema-param .req { color: var(--no); font-weight: 600; }
.tester-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tester-out { margin-top: 2px; }

/* Vault list */
.secret-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 4px;
  flex-wrap: wrap;
}
.secret-acts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.oauth-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
  .conn-head, .conn-drawer { padding-left: 14px; padding-right: 14px; }
  .conn-info { flex-basis: 100%; }
}

/* Agents tab and import-from-agents panel */
fieldset.field { border: 0; padding: 0; margin: 0; min-width: 0; }
label.tool-row, label.tool-item { cursor: pointer; }
label.tool-item.off { cursor: default; }
.tool-name .tag { margin-left: 4px; }
.tool-desc.mono { word-break: break-all; }

/* Sign-in and secret viewing */
.nav[hidden], .toplink[hidden] { display: none; }
#loop-auth-screen { width: min(100%, 460px); margin-inline: auto; }
#loop-clerk-mount { display: grid; place-items: center; margin-top: 22px; }
#loop-clerk-mount > * { max-width: 100%; }
#loop-clerk-mount .loop-clerk-title { font-family: var(--serif); }
#loop-auth-screen .acts { margin-top: 16px; }
.secret-row { flex-wrap: wrap; }
.secret-row.focus { outline: 2px solid var(--brown); outline-offset: 2px; border-radius: 12px; }
.reveal-box { flex-basis: 100%; margin-top: 12px; }
.reveal-box .code { word-break: break-all; white-space: pre-wrap; }

/* Live approval banner floats above page content so arriving approvals never shift the page or side menu. */
.approval-banner {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 45;
  width: min(620px, calc(100vw - 32px));
  background: var(--warn-bg);
  border: 1px solid light-dark(#EACBA2, #544127);
  border-radius: 16px;
  padding: 14px 16px;
  margin: 0;
  color: light-dark(#5C3A12, #E3D0BE);
  box-shadow: 0 10px 30px light-dark(rgba(74, 48, 18, .18), rgba(0, 0, 0, 0.45));
}
.approval-banner-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--warn);
}
.approval-banner.is-collapsed {
  padding: 10px 14px;
}
.approval-banner.is-collapsed .approval-banner-head {
  margin-bottom: 0;
}
.approval-banner-head-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.approval-banner-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-transform: none;
  letter-spacing: 0;
}
.hm-bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 6px;
  border-radius: 10px;
  background: var(--warn-bg);
  border: 1px solid light-dark(#EACBA2, #544127);
}
.hm-bulk-note {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--warn);
}
.approval-count {
  background: light-dark(#F3DEC0, #3C301E);
  color: light-dark(#6E4718, #D4C0AB);
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 10px;
  padding: 2px 8px;
  text-transform: none;
  letter-spacing: 0;
}
.approval-list {
  display: flex;
  flex-direction: column;
}
/* Many approvals at once never push the page away: the banner stops at about a third of the
   window and its list scrolls, with the heading and count always in view. */
body:has(.nav:not([hidden])) .approval-banner { display: flex; flex-direction: column; max-height: max(180px, 34vh); }
body:has(.nav:not([hidden])) .approval-banner-head { flex: none; }
body:has(.nav:not([hidden])) .approval-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; margin-right: -8px; padding-right: 8px; }
.approval-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px dashed light-dark(#E4C49A, #5D492D);
}
.approval-item:first-child { border-top: 0; padding-top: 2px; }
.approval-item:last-child { padding-bottom: 2px; }
.approval-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.approval-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.approval-agent {
  background: light-dark(#F2DBBA, #40321E);
  color: light-dark(#6B4315, #D9C3AF);
}
.approval-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 20px;
  overflow-wrap: anywhere;
}
.approval-reason {
  font-size: 13.5px;
  color: light-dark(#6E4718, #D4C0AB);
  line-height: 19px;
}
.approval-detail {
  font-size: 12px;
  color: light-dark(#5C3A12, #E3D0BE);
  background: light-dark(rgba(255, 252, 246, .78), rgba(24, 22, 19, 0.78));
  border: 1px solid light-dark(#EDD3AE, #4A3A23);
  border-radius: 8px;
  padding: 6px 9px;
  line-height: 17px;
  overflow-wrap: anywhere;
}
.approval-acts {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  flex-wrap: wrap;
}
/* Four actions would squeeze the request: they wrap into two rows beside it instead. They
   stay beside it (not under it) because the banner scrolls and they must stay in view. */
@media (min-width: 641px) {
  .approval-item.is-wide .approval-acts { flex: 0 1 300px; justify-content: flex-end; }
}
.approval-item.is-wide .approval-acts .btn { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* Compact selects */
select.select-sm {
  width: auto;
  min-width: 118px;
  padding: 5px 28px 5px 10px;
  font-size: 13px;
  line-height: 18px;
  min-height: 34px;
  border-radius: 9px;
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
}

/* Skills browser */
.skill-group { margin-top: 28px; }
.skill-group:first-child { margin-top: 18px; }
.skill-group > h2 { margin: 0 0 12px; }
.snippet-code {
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 480px;
  line-height: 1.55;
}
.codewrap .code.snippet-code { word-break: break-word; }
.skill-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.skill-drawer-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--muted);
  padding: 6px 0;
}

/* Typed vault badges */
.secret-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.tag.vault-type { color: light-dark(#6B534B, #CDB4AC); background: var(--tint); }
.tag.vault-payment { color: light-dark(#6E4718, #D4C0AB); background: light-dark(#F5E7D3, #30281D); }
.tag.vault-login { color: var(--info); background: var(--info-bg); }
.tag.vault-api_key { color: light-dark(#7A5F55, #C1A69C); background: light-dark(#F3ECE9, #282422); }
.tag.vault-note { color: var(--muted); background: var(--tint2); }

/* Connection & tool approval controls */
.drawer-rule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: 12px;
  padding: 11px 13px;
}
.drawer-rule-copy {
  flex: 1;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.drawer-rule-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.tool-acts {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
/* The rule of one tool: quiet while it follows the default, ink with a rule of its own. */
select.cp-tool-rule, .st-root.xp-panel select.cp-tool-rule {
  width: auto;
  min-height: 28px;
  padding: 2px 10px;
  border: 0;
  border-radius: 999px;
  background: light-dark(rgba(77, 53, 51, .07), rgba(230, 216, 214, 0.07));
  color: var(--soft);
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
  text-align-last: center;
}
select.cp-tool-rule:hover { color: var(--ink); }
select.cp-tool-rule.is-own, .st-root.xp-panel select.cp-tool-rule.is-own { color: var(--ink); font-weight: 600; }
select.cp-tool-rule.is-guard, .st-root.xp-panel select.cp-tool-rule.is-guard { background: var(--brown); color: light-dark(#fff, #241F1E); }
select.cp-tool-rule:disabled { opacity: .55; cursor: not-allowed; }

/* Settings approval rules */
.policy-list { margin-top: 4px; }
.policy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px dashed var(--line);
  flex-wrap: wrap;
}
.policy-row:last-child { border-bottom: 0; padding-bottom: 2px; }
.policy-copy {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.policy-name { font-size: 14.5px; font-weight: 500; color: var(--ink); }
.policy-row select.select-sm { min-width: 142px; }

@media (max-width: 640px) {
  body:has(.nav:not([hidden])) .approval-banner { max-height: max(220px, 46vh); }
  .approval-item { flex-direction: column; }
  .approval-acts { order: -1; width: 100%; }
  .policy-row select.select-sm,
  .drawer-rule-row select.select-sm { width: 100%; }
}

/* ===========================
   One-line rows, shared by Vault and Settings.
   An icon, what it is, then one value, switch or chevron. The same lane, text and 48px as Home's rows.
   =========================== */
.ln { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 48px; padding: 0 10px; border-radius: 10px; color: var(--text); text-align: left; text-decoration: none; }
.ln-ic { width: 32px; flex: none; display: grid; place-items: center; color: var(--muted); }
.ln-tx { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 12px; text-align: left; color: inherit; }
.ln-t { flex: 0 1 auto; min-width: 0; font-size: 13.5px; line-height: 18px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ln-d, .ln-v { font-size: 12.5px; line-height: 18px; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ln-d { flex: 1 1 0; min-width: 0; }
.ln-d.is-warn, .ln-v .is-warn { color: var(--warn); }
.ln-v { flex: none; max-width: 50%; }
.ln-v .is-ok { color: var(--ok); }
.ln-chev { flex: none; color: var(--soft); opacity: .7; transition: transform .18s; }
details[open] > .ln .ln-chev, .ln[aria-expanded=true] .ln-chev { transform: rotate(90deg); }
summary.ln, button.ln, a.ln { cursor: pointer; list-style: none; transition: background .12s; }
summary.ln::-webkit-details-marker { display: none; }
@media (hover: hover) { summary.ln:hover, button.ln:hover, a.ln:hover { background: var(--tint2); } }
.ln:focus-visible, .ln-tx:focus-visible, .vd-act:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; border-radius: 10px; }
.ln.is-no, .ln.is-no .ln-ic { color: var(--no); }
.ln.is-no .ln-chev { display: none; }
/* A choice: a native menu that reads as plain text with a small arrow. */
.ln-sel { position: relative; flex: 0 1 auto; min-width: 0; display: inline-flex; align-items: center; }
.ln-sel select { max-width: 100%; min-width: 0; height: 40px; padding: 0 20px 0 8px; border: 0; border-radius: 8px; background: transparent; box-shadow: none; color: var(--soft); font: 400 12.5px/18px var(--sans); text-align: right; text-align-last: right; text-overflow: ellipsis; -webkit-appearance: none; appearance: none; cursor: pointer; }
.ln-sel select:hover { color: var(--ink); }
.ln-sel .ln-chev { position: absolute; right: 2px; transform: rotate(90deg); pointer-events: none; }

/* Approval modes. The rule is on the section heading; its
   three choices open under it on one tint. */
.vault-group h2 > .vm-head { display: inline-flex; align-items: center; gap: 7px; margin-left: auto; margin-right: 0; padding: 0 2px; border-radius: 8px; font-size: 13px; line-height: 18px; font-weight: 400; color: var(--soft); }
.vault-group h2 > .vm-head:hover { color: var(--ink); text-decoration: none; }
.vault-group h2 > .vm-head.is-guard { font-weight: 600; color: var(--ink); }
.vault-group h2 > .vm-head.is-unavailable { font-weight: 600; color: var(--no); }
.vault-group h2 > .vm-head + button { margin-left: 12px; }
.vm-head:focus-visible, .vm-opt:focus-visible, .vm-seg button:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.vm-g { flex: none; width: 15px; height: 15px; }
.vm-chev { flex: none; opacity: .7; transition: transform .18s; }
.vm-head[aria-expanded=true] .vm-chev { transform: rotate(180deg); }
.vm-list { margin: 4px 0 8px; padding: 2px 0; border-radius: 14px; background: var(--tint2); }
.vm-cap { margin: 0; padding: 10px 14px 0 53px; font-size: 12.5px; line-height: 18px; color: var(--soft); text-wrap: pretty; }
.vm-opt { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 56px; padding: 0 14px 0 10px; border-radius: 12px; text-align: left; color: var(--text); cursor: pointer; transition: background .12s; }
.vm-opt + .vm-opt { position: relative; }
.vm-opt + .vm-opt::before { content: ''; position: absolute; top: 0; left: 53px; right: 14px; border-top: 1px dotted light-dark(rgba(77, 53, 51, .14), rgba(230, 216, 214, 0.14)); }
.vm-ic { width: 32px; flex: none; display: grid; place-items: center; color: var(--muted); }
.vm-opt.is-guard .vm-ic { color: var(--ink); }
.vm-tx { flex: 1; min-width: 0; padding: 9px 0; }
.vm-t, .vm-l { display: block; line-height: 18px; }
.vm-t { font-size: 13.5px; font-weight: 500; }
.vm-l { font-size: 12.5px; color: var(--soft); }
.vm-check { flex: none; visibility: hidden; }
.vm-opt[aria-checked=true] .vm-check { visibility: visible; }
.vm-opt:disabled { cursor: default; }
.vm-opt:disabled .vm-ic, .vm-opt:disabled .vm-t { opacity: .45; }
@media (hover: hover) { .vm-opt:not(:disabled):hover { background: light-dark(rgba(77, 53, 51, .04), rgba(230, 216, 214, 0.04)); } }
.vm-item { padding: 4px 0 10px; }
.vm-item + .vd-row { border-top: 1px dotted light-dark(rgba(77, 53, 51, .14), rgba(230, 216, 214, 0.14)); }
.vm-seg { display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: light-dark(rgba(77, 53, 51, .08), rgba(230, 216, 214, 0.08)); }
.vm-seg button { flex: 1 1 0; min-width: 0; height: 38px; border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--soft); cursor: pointer; transition: background .15s, color .15s; }
.vm-seg button:hover { color: var(--ink); }
.vm-seg button[aria-checked=true] { background: light-dark(var(--card), rgba(255, 255, 255, .13)); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px light-dark(rgba(77, 53, 51, .12), rgba(0, 0, 0, 0.38)); }
.vm-seg button.is-guard[aria-checked=true] { background: var(--brown); color: light-dark(#fff, #241F1E); box-shadow: none; }
.vm-hint { margin: 8px 2px 0; font-size: 12.5px; line-height: 18px; color: var(--soft); text-wrap: pretty; }
.vm-own { color: var(--soft); }
.vm-own.is-guard { font-weight: 600; color: var(--ink); }
.vm-list.is-busy, .vm-item.is-busy > .vm-seg { cursor: progress; }
/* The password, asked in place. */
.vm-pass { display: block; margin: 0; }
.vm-list > .vm-pass { padding: 4px 12px 12px 53px; }
.vm-item > .vm-pass { margin-top: 10px; }
.vd-cred > .vm-pass { padding: 0 0 12px; }
.cp-approval > .vm-pass, .cp-tool-item > .vm-pass, .cp-credential > .vm-pass { padding: 10px 0 4px; }
.cp-rowrules-edit { display: grid; gap: 8px; padding: 8px 0 12px; }
.cp-rowrules-edit textarea { font-family: var(--mono, ui-monospace, monospace); font-size: 13px; line-height: 18px; }
.cp-approval:last-child > .st-rule, .cp-approval:has(> .vm-pass) > .st-rule { border-bottom: 0; }
.vm-msg { margin: 0 2px 8px; font-size: 12.5px; line-height: 18px; color: var(--text); text-wrap: pretty; }
.vm-msg a { font-weight: 600; color: var(--ink); }
.vm-pass .vf-f { background: light-dark(rgba(77, 53, 51, .07), rgba(230, 216, 214, 0.07)); }
.vm-pass .vf-f:focus-within { background: light-dark(rgba(77, 53, 51, .1), rgba(230, 216, 214, 0.1)); }
.vm-pass .vf-f > input { flex: 1; min-width: 0; width: 100%; height: 46px; padding: 0; border: 0; background: transparent; box-shadow: none; outline: 0; font: inherit; font-size: 16px; color: var(--ink); }
.vm-pass .vf-f > input::placeholder { color: var(--muted); opacity: 1; }
.vm-pass:invalid .vf-go { background: light-dark(rgba(77, 53, 51, .2), rgba(230, 216, 214, 0.2)); }
.vm-err { margin: 8px 2px 0; font-size: 12.5px; line-height: 18px; color: var(--no); }
.vm-big { width: 100%; min-height: 48px; margin-top: 10px; justify-content: center; }
@media (max-width: 420px) {
  .vm-list > .vm-pass { padding: 4px 12px 12px; }
  .vault-group h2 > .vm-head + button { margin-left: 8px; }
}
.vault-tools .ln .ln-chev { transform: rotate(90deg); }
.vault-tools .ln[aria-expanded=true] .ln-chev { transform: rotate(-90deg); }
.vault-tools .ln[aria-expanded=true] { border-radius: 14px 14px 0 0; background: var(--tint2); }
.vault-tools .vm-list { margin-top: 0; border-radius: 0 0 14px 14px; }
.vault-group.is-empty + .vault-tools { margin-top: 34px; }

.vault-group { margin: 0 0 34px; }
.vault-group h2 { margin: 0 0 4px; align-items: center; font-size: 16px; }
.vault-group h2 button { min-height: 40px; padding: 0 4px; margin-right: -4px; font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; }
.vault-group h2 button:hover { text-decoration: underline; text-decoration-color: light-dark(rgba(77, 53, 51, .3), rgba(230, 216, 214, 0.3)); text-underline-offset: 3px; }
.vault-group.is-empty { margin: 0; }
.vault-group.is-empty h2 { margin: 0; font-weight: 500; color: var(--soft); }
.vault-group li + li { border-top: 1px dotted light-dark(rgba(77, 53, 51, .14), rgba(230, 216, 214, 0.14)); }
/* A category inside a kind: a small heading over its items. */
.vault-group li.vault-sub { padding: 16px 10px 2px 53px; font-size: 12px; line-height: 16px; font-weight: 400; color: var(--soft); }
.vault-group li.vault-sub + li { border-top: 0; }
.vault-group .secret-row { display: block; padding: 0; }
.vault-group .secret-row.focus { outline: 0; }
.vault-group .ln-d { text-align: right; }
/* A detail with less than 72px drops to a second line, which the row does not show. */
.vault-group .ln-tx { flex-wrap: wrap; height: 18px; overflow: hidden; }
.vault-group .ln-t { max-width: 100%; }
.vault-group .ln-d { flex: 1 1 72px; }
/* An open item: one tint, flat lines, no cards or buttons with borders. */
.vault-group .secret-row[open] { margin: 4px 0; border-radius: 14px; background: var(--tint2); }
.vault-group .secret-row[open] > .ln:hover { background: transparent; }
.vd { padding: 0 10px 8px 53px; }
.vd-note { margin: 0; padding: 2px 0 10px; font-size: 12.5px; line-height: 18px; color: var(--soft); overflow-wrap: anywhere; }
.vd-note.mono { font-family: var(--mono); font-size: 12px; }
.vd-row { display: flex; align-items: center; gap: 12px; min-height: 42px; border-top: 1px dotted light-dark(rgba(77, 53, 51, .14), rgba(230, 216, 214, 0.14)); font-size: 13px; line-height: 18px; }
.vd-k { flex: none; color: var(--soft); }
.vd-v { flex: 1; min-width: 0; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vd-row > .ln-sel { margin-left: auto; }
.vd-row > .ln-sel select { color: var(--text); font-size: 13px; }
.vd-act { flex: none; min-height: 40px; padding: 0; font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; }
.vd-act:hover { text-decoration: underline; text-decoration-color: light-dark(rgba(77, 53, 51, .3), rgba(230, 216, 214, 0.3)); text-underline-offset: 3px; }
.vd-act.is-no { color: var(--no); }
/* The allowed places of a Vault item for tool arguments (public/views/vault-kinds.js). */
.vd-binds { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding-top: 10px; border-top: 1px dotted light-dark(rgba(77, 53, 51, .14), rgba(230, 216, 214, 0.14)); font-size: 13px; line-height: 18px; }
.vd-binds > .vd-k { padding-bottom: 2px; }
.vd-bind-list { list-style: none; margin: 0; padding: 0; width: 100%; }
.vd-bind-list li { display: flex; align-items: center; gap: 12px; }
.vd-bind-list .vd-v { text-align: left; font-family: var(--mono); font-size: 12px; }
.vd-bind-form { width: 100%; padding-top: 6px; }
.vd-in { flex: 1; min-width: 0; height: 34px; padding: 0 4px; border: 0; border-radius: 8px; background: transparent; text-align: right; font: inherit; font-size: 13px; color: var(--text); }
.vd-in::placeholder { color: var(--muted); opacity: 1; }
.vd-in:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.vd-note.is-err { color: var(--no); }
/* Fleets (public/fleets-view.js): a copy has a name, not an id; "Most copies" is a short number at the right. */
.vd-bind-list.fl-copies .vd-v { font-family: inherit; font-size: 13px; }
.vd-row > input.fl-num { flex: 0 0 88px; width: 88px; margin-left: auto; padding: 6px 10px; border-radius: 8px; font-size: 13px; line-height: 18px; text-align: right; }
.vd-act:disabled { opacity: .5; }
.vd-foot { display: flex; align-items: center; gap: 4px 20px; flex-wrap: wrap; border-top: 1px dotted light-dark(rgba(77, 53, 51, .14), rgba(230, 216, 214, 0.14)); padding-top: 2px; }
.vd-when { margin-left: auto; font-size: 12px; color: var(--soft); }
.vd .reveal-box { display: flex; align-items: center; gap: 12px; margin: 0; padding: 0 0 10px; }
.vd .reveal-box input { flex: 1; min-width: 0; height: 38px; padding: 0 12px; border: 1px solid light-dark(rgba(77, 53, 51, .16), rgba(230, 216, 214, 0.16)); border-radius: 10px; background: var(--card); font: inherit; font-size: 16px; color: var(--ink); }
.vd .reveal-box.is-shown { flex-wrap: wrap; gap: 0 16px; }
.vd .reveal-box .code { flex: 1 1 100%; margin: 0; padding: 10px 12px; border: 0; border-radius: 10px; background: var(--card); font-size: 12px; }
.vd .reveal-box .vd-when { margin-left: 0; margin-right: auto; }
@media (max-width: 420px) { .vd { padding-left: 14px; padding-right: 14px; } }

.payment-dialog {
  margin: auto; width: min(520px, calc(100% - 28px)); max-height: calc(100dvh - 28px);
  overflow: auto; border: 0; border-radius: 14px; background: var(--bg); color: var(--text);
  box-shadow: 0 16px 48px light-dark(#35232330, rgba(0, 0, 0, 0.551));
}
.payment-dialog::backdrop { background: light-dark(rgb(57 37 35 / 36%), rgba(248, 235, 234, 0.36)); }

.connection-summary {
  width: 100%; display: flex; align-items: center; gap: 8px; min-height: 38px;
  padding: 4px 12px; text-align: left;
}
.connection-summary .conn-title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.connection-summary:hover { background: var(--tint); }
.connection-summary:focus-visible { outline-offset: -3px; }
.connection-chevron { font-size: 20px; color: var(--soft); }
.connection-summary[aria-expanded="true"] .connection-chevron { transform: rotate(90deg); }
.conn-head .conn-meta:empty { display: none; }

.memory-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.memory-toolbar input[type="search"] { flex: 1 1 200px; min-width: 0; }

.loop-dialog {
  margin: auto; width: min(520px, calc(100% - 28px)); max-height: calc(100dvh - 28px);
  overflow: auto; border: 0; border-radius: 14px; padding: 28px;
  color: var(--text); background: var(--bg); box-shadow: 0 16px 48px light-dark(#35232330, rgba(0, 0, 0, 0.551));
}
.loop-dialog::backdrop { background: light-dark(rgb(57 37 35 / 36%), rgba(248, 235, 234, 0.36)); }
.loop-dialog > h2 { justify-content: center; margin: 0 0 24px; font: 500 25px var(--serif); }
.loop-dialog .acts { justify-content: flex-end; }
.loop-dialog .acts > .danger { margin-top: 0; }
.agent-command { overflow-wrap: anywhere; padding: 14px; background: var(--tint); border-radius: 10px; }

.agent-setup-heading, .agent-setup-box { display: flex; align-items: flex-start; gap: 12px; justify-content: space-between; }
.agent-setup-heading { flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.agent-setup-heading h2 { font-size: 16px; margin: 0; }
.agent-setup-switch { display: flex; padding: 3px; border-radius: 8px; background: var(--tint); }
.agent-setup-switch button { padding: 4px 9px; border-radius: 6px; font-size: 13px; }
.agent-setup-switch [aria-pressed="true"] { background: var(--card); box-shadow: 0 1px 3px light-dark(#35232320, rgba(0, 0, 0, 0.394)); }
.agent-setup-box { padding: 14px; border: 1px solid var(--card-line); border-radius: 10px; background: var(--card); }
.agent-setup-box .agent-command { padding: 0; min-width: 0; background: transparent; font: 14px/1.6 var(--mono); }

/* ==========================================================================
   Layout refinement (2026-11-20).
   One quiet 720px column, list-first, dotted hairlines, no boxed cards or chip soup,
   floating nav pill with labels. Overrides only; delete this block to revert.
   ========================================================================== */
:root {
  --ink: light-dark(#4D3533, #E6D8D6); --text: light-dark(#4D3533, #E6D8D6); --muted: light-dark(#5C4745, #D0C5C3); --soft: light-dark(#6D5855, #C5B0AC);
  --hair: light-dark(rgba(77, 53, 51, .16), rgba(230, 216, 214, 0.16)); --line: light-dark(rgba(77, 53, 51, .16), rgba(230, 216, 214, 0.16));
}
body { font-size: 14px; line-height: 21px; letter-spacing: -.15px; color: var(--ink); }

/* header: small centered wordmark; Settings is the text link at the top right */
.top { height: 64px; }
.logo-img { height: 28px; }
.back { font-size: 13px; }

/* type */
h1 { font-size: 22px; }
h2 { font-size: 17px; font-weight: 600; margin: 56px 0 4px; min-height: 32px; align-items: center; justify-content: flex-start; gap: 8px; }
h2 small { font-size: 13px; color: var(--soft); }
.sub, .lead, .intro, .d { color: var(--muted); font-size: 14px; }
.d.sm, .sm.d { font-size: 13px; }
.t { font-size: 14px; line-height: 21px; color: var(--ink); }
.meta { font-size: 13px; color: var(--soft); }
.kicker { text-transform: none; letter-spacing: 0; font-size: 13px; }

/* rows: quiet list rhythm */
.list > li { border-bottom: 1px dotted var(--hair); }
.list > li:last-child { border-bottom: 0; }
.row { padding: 16px 0; gap: 16px; border-radius: 0; }
.row.click:hover { background: transparent; }
.row.click:hover .t { text-decoration: underline; text-decoration-color: light-dark(rgba(77, 53, 51, .3), rgba(230, 216, 214, 0.3)); text-underline-offset: 3px; }
.chev { color: var(--soft); font-size: 18px; }

/* status labels: quiet text, colored only when it matters */
.pill, .tag { background: transparent !important; padding: 0; border-radius: 0; font-size: 13px; font-weight: 400; color: var(--soft); }
.pill b { font-weight: 400; color: inherit; }
.pill.warn, .tag.warn { color: var(--warn); }
.pill.no, .tag.no { color: var(--no); }
.tag.ok { color: var(--ok); }
.pill.warn::before, .pill.no::before, .tag.warn::before, .tag.no::before, .tag.ok::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: 1px; }

/* buttons: small pills */
.btn { min-height: 32px; padding: 6px 14px; font-size: 13px; font-weight: 600; border-radius: 999px; border-color: light-dark(rgba(77, 53, 51, .18), rgba(230, 216, 214, 0.18)); background: transparent; color: var(--ink); }
.btn:hover { border-color: light-dark(rgba(77, 53, 51, .4), rgba(230, 216, 214, 0.4)); }
.btn.fill { background: var(--brown); border-color: var(--brown); color: light-dark(#fff, #241F1E); }
.btn.sm { min-height: 30px; padding: 5px 12px; font-size: 13px; }
.btn.ghost { border-color: transparent; }
.btn.big { border-radius: 999px; min-height: 44px; font-size: 14px; }

/* filter chips: text tabs instead of boxed chips */
.chips { gap: 18px; margin-top: 24px; }
.chip { border: 0; background: transparent; padding: 4px 0; min-height: 0; border-radius: 0; font-size: 14px; color: var(--soft); }
.chip[aria-pressed=true] { background: transparent; color: var(--ink); font-weight: 600; box-shadow: inset 0 -1.5px 0 var(--ink); }
.chip[aria-pressed=true] span, .chip span { color: var(--soft); font-weight: 400; }

/* unbox every card/list container */
.card { border: 0; background: transparent; border-radius: 0; padding: 0; margin-top: 40px; }
.cat-groups, .connections-list { border: 0; border-radius: 0; background: transparent; margin-top: 4px; overflow: visible; }
.cat-groups > .cat-group, .cat-group, .conn-card, .connections-list > .conn-card { border: 0; border-bottom: 1px dotted var(--hair); border-radius: 0; background: transparent; box-shadow: none; }
.connections-list > .conn-card + .conn-card { border-top: 0; }
.cat-group:hover, .cat-group.open, .conn-card:hover { border-color: var(--hair); box-shadow: none; }
.cat-head, .connection-summary { padding: 16px 0; gap: 16px; background: transparent !important; }
.cat-head:hover .cat-title, .connection-summary:hover .conn-title { text-decoration: underline; text-decoration-color: light-dark(rgba(77, 53, 51, .3), rgba(230, 216, 214, 0.3)); text-underline-offset: 3px; }
.cat-title, .conn-title { font-size: 14px; font-weight: 400; line-height: 21px; color: var(--ink); }
.cat-items { border-top: 0; background: transparent; padding: 0 0 8px 56px; }
.cat-items .row { padding: 12px 0; }
.agent-add { border: 0; }
.agent-add .cat-title { font-weight: 400; color: var(--muted); }

/* add-category trigger: a quiet "+" row */
.cat-add-trigger { border: 0 !important; background: transparent !important; padding: 16px 0; border-radius: 0; }
.cat-add-plus { background: transparent !important; border: 0 !important; width: 40px; height: 40px; color: var(--ink); }
.cat-add-title { font-weight: 400; font-size: 14px; }

/* empty states: plain tertiary text like "No cards saved" */
.empty { text-align: left; background: transparent; border-radius: 0; padding: 12px 0 0; margin-top: 0; }
.empty .et { font-size: 14px; font-weight: 400; color: var(--soft); }
.empty .ed { font-size: 14px; color: var(--soft); margin-top: 2px; }
.empty .acts { justify-content: flex-start; }

/* inputs: underline search */
.memory-toolbar { margin-top: 40px; gap: 12px; }
.memory-toolbar input[type="search"], input[type="search"] { border: 0; border-bottom: 1px dotted light-dark(rgba(77, 53, 51, .3), rgba(230, 216, 214, 0.3)); border-radius: 0; background: transparent; padding: 8px 0; min-height: 40px; box-shadow: none; }
/* A search line shows where the keyboard is: the dotted line turns solid and dark. */
.memory-toolbar input[type="search"]:focus-visible, input[type="search"]:focus-visible { outline: none; border-bottom: 1.5px solid var(--ink); }
.memory-toolbar input[type="search"]:focus { outline: none; border-bottom-color: var(--ink); }

/* home */
.home-lede { margin-top: 40px; font-size: 14px; color: var(--muted); }
.home-lede a { text-decoration: none; color: inherit; }
.home-lede a:hover { color: var(--ink); text-decoration: underline; text-decoration-color: light-dark(rgba(77, 53, 51, .3), rgba(230, 216, 214, 0.3)); }
.home-lede b { color: var(--ink); font-weight: 600; }
.home-lede .warn { color: var(--warn); }
.home-sec h2, .home-connections h2 { justify-content: flex-start; }
.home-add { margin-left: auto; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 300; color: var(--ink); text-decoration: none; border-radius: 999px; }
.home-add:hover { background: light-dark(rgba(77, 53, 51, .06), rgba(230, 216, 214, 0.06)); }
.home-ic { width: 40px; height: 40px; flex: none; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); }
.home-ic.mark { border-radius: 8px; background: light-dark(#F1EEEC, #252422); font-size: 15px; font-weight: 600; }
.home-ic.mark.claude { background: light-dark(#F6E7E1, #2E2623); color: light-dark(#C8613F, #CF7253); }
.home-ic.mark.logo { background: none; }
.home-ic.mark.logo img { width: 26px; height: 26px; display: block; }
/* Brand marks drawn in black or near-black only: in the dark theme they turn light, so they do not vanish into the background. */
:root[data-dark] .home-ic.mark.logo:is(.opencode, .windsurf, .grok, .kimi, .codex, .cursor) img { filter: invert(1) hue-rotate(180deg) brightness(.92); }
/* An agent's own picture, or its first letter on a tint. Always round. */
.home-ic.mark.pic, .home-ic.mark.pic[class] { border-radius: 50%; overflow: hidden; color: light-dark(#fff, #241F1E); }
.home-ic.mark.pic > img { width: 100%; height: 100%; display: block; object-fit: cover; }
.home-ic.mark.pic.is-blue { background: light-dark(#4B5E86, #A1B5DD); }
.home-ic.mark.pic.is-green { background: light-dark(#3F7556, #87B89A); }
.home-ic.mark.pic.is-amber { background: light-dark(#A9711F, #BC8946); }
.home-st { font-size: 13px; color: var(--soft); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; flex: none; }
.home-st i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.home-st.ok { color: var(--ok); }
.home-st.warn { color: var(--warn); }
.home-rows .row .btn { pointer-events: none; }
.cat-head .home-ic { margin: -9px 0; }

/* nav: warm espresso floating pill with always-readable labels */
.nav { height: 54px; padding: 0 8px; gap: 4px; align-items: center; border-radius: 27px; box-shadow: 0 8px 24px light-dark(rgba(77, 53, 51, .18), rgba(0, 0, 0, 0.53)); }
.nav a { width: auto; min-width: 68px; height: 44px; flex: none; padding: 0 12px; gap: 6px; justify-content: center; border-radius: 22px; color: rgba(255, 255, 255, .82); }
.nav a:hover { background: rgba(255, 255, 255, .10); color: #fff; }
.nav a[aria-current=page] { background: rgba(255, 255, 255, .16); color: #fff; }
.nav svg { width: 17px; height: 17px; flex: none; }
.nav .nl { position: static; transform: none; background: transparent; color: inherit; font-size: 13px; font-weight: 500; line-height: 1; padding: 0; border-radius: 0; box-shadow: none; opacity: 1; pointer-events: auto; white-space: nowrap; }
@media (max-width: 640px) {
  .nav a { min-width: 56px; padding: 0 10px; flex-direction: column; gap: 2px; }
  .nav .nl { font-size: 10.5px; }
  .cat-items { padding-left: 0; }
}
/* home is one scrolling column now, not a fixed stats + scroller grid */
.wrap:has(:where(.view:not(.is-staged)) .home-connections) .view { height: auto; display: block; }
.home-connections { display: block; }
.home-connections > :last-child { overflow: visible; }
.home-lede + .home-sec > h2 { margin-top: 40px; }
/* section "+" buttons sit at the right edge, count stays next to the title */
h2 > button, h2 > .btn, h2 > a:last-child { margin-left: auto; }
.empty .ed { margin-left: 0; margin-right: 0; text-align: left; }
.agent-row .cat-head { gap: 16px; }
.agent-row .cat-head .home-ic { margin: -9px 0; }
.agent-body { padding: 0 0 16px 56px; }
/* memory scope filters: text tabs, not filled pills */
/* settings labels: sentence case */
.lbl { text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 600; color: var(--muted); }
input:not([type=checkbox]):not([type=radio]):not([type=search]), select, textarea { border-color: light-dark(rgba(77, 53, 51, .18), rgba(230, 216, 214, 0.18)); }
@media (max-width: 640px) { .agent-body { padding-left: 0; } }

/* Connections category filter: one line, scrolls sideways when it overflows */
.chips.chips-scroll { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; overscroll-behavior-x: contain; padding-bottom: 2px; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
.chips.chips-scroll.at-end { -webkit-mask-image: none; mask-image: none; }
.chips.chips-scroll::-webkit-scrollbar { display: none; }
.chips.chips-scroll .chip { flex: 0 0 auto; white-space: nowrap; }

/* Category pills (Connections filter) */
.chips.chips-scroll { gap: 8px; margin-top: 22px; padding: 2px 0 4px; }
.chips.chips-scroll .chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 13px; border-radius: 999px;
  border: 1px solid var(--hair); background: transparent;
  color: var(--muted); font-size: 13.5px; font-weight: 500; box-shadow: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.chips.chips-scroll .chip span {
  margin: 0; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--tint2); color: var(--soft); font-size: 12px; font-weight: 500;
}
.chips.chips-scroll .chip:hover { border-color: var(--soft); color: var(--ink); }
.chips.chips-scroll .chip[aria-pressed=true] { background: var(--ink); border-color: var(--ink); color: var(--bg); font-weight: 600; box-shadow: none; }
.chips.chips-scroll .chip[aria-pressed=true] span { background: light-dark(rgba(255,255,255,.16), rgba(36, 31, 30, 0.16)); color: var(--bg); }
.chips.chips-scroll .chip:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Category pills: always-visible thin scrollbar instead of the edge fade */
.chips.chips-scroll { scrollbar-width: auto; -webkit-mask-image: none; mask-image: none; padding-bottom: 10px; }
.chips.chips-scroll::-webkit-scrollbar { display: block; height: 6px; }
.chips.chips-scroll::-webkit-scrollbar-track { background: var(--tint2); border-radius: 999px; }
.chips.chips-scroll::-webkit-scrollbar-thumb { background: light-dark(rgba(77, 53, 51, .35), rgba(230, 216, 214, 0.35)); border-radius: 999px; }
.chips.chips-scroll::-webkit-scrollbar-thumb:hover { background: light-dark(rgba(77, 53, 51, .55), rgba(230, 216, 214, 0.55)); }
@supports not selector(::-webkit-scrollbar) {
  .chips.chips-scroll { scrollbar-width: thin; scrollbar-color: light-dark(rgba(77, 53, 51, .35), rgba(230, 216, 214, 0.35)) var(--tint2); }
}

/* Category pills: thin scrollbar only on hover; edge fade hints at more when idle */
.chips.chips-scroll { padding-bottom: 8px; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
.chips.chips-scroll.at-end, .chips.chips-scroll:hover { -webkit-mask-image: none; mask-image: none; }
.chips.chips-scroll::-webkit-scrollbar { height: 4px; }
.chips.chips-scroll::-webkit-scrollbar-track, .chips.chips-scroll::-webkit-scrollbar-thumb { background: transparent; }
.chips.chips-scroll:hover::-webkit-scrollbar-track { background: var(--tint2); }
.chips.chips-scroll:hover::-webkit-scrollbar-thumb { background: light-dark(rgba(77, 53, 51, .35), rgba(230, 216, 214, 0.35)); }
.chips.chips-scroll:hover::-webkit-scrollbar-thumb:hover { background: light-dark(rgba(77, 53, 51, .55), rgba(230, 216, 214, 0.55)); }
@supports not selector(::-webkit-scrollbar) {
  .chips.chips-scroll { scrollbar-color: transparent transparent; }
  .chips.chips-scroll:hover { scrollbar-color: light-dark(rgba(77, 53, 51, .35), rgba(230, 216, 214, 0.35)) var(--tint2); }
}

/* ===== Home: control panel (master switch, agent and connection switches) ===== */
.sw { position: relative; flex: none; width: 40px; height: 24px; border-radius: 999px; background: light-dark(rgba(77, 53, 51, .18), rgba(230, 216, 214, 0.18)); transition: background .18s ease; cursor: pointer; }
.sw .sw-knob { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: light-dark(#fff, #241F1E); box-shadow: 0 1px 3px light-dark(rgba(53, 35, 35, .25), rgba(0, 0, 0, 0.6)); transition: transform .18s ease; }
.sw.on { background: var(--ok); }
.sw.on .sw-knob { transform: translateX(16px); }
.sw:hover { filter: brightness(.96); }
.sw:disabled { opacity: .5; cursor: progress; }
.sw:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 999px; }

.ctl-master { margin-top: 32px; display: flex; align-items: center; gap: 20px; padding: 20px 22px; border-radius: 18px; background: var(--ok-bg); border: 1px solid light-dark(rgba(63, 117, 86, .18), rgba(135, 184, 154, 0.18)); }
.ctl-master.is-paused { background: var(--warn-bg); border-color: light-dark(rgba(142, 91, 34, .22), rgba(209, 159, 110, 0.22)); }
.ctl-master-copy { flex: 1; min-width: 0; }
.ctl-master-title { display: flex; align-items: center; gap: 9px; font-family: var(--serif); font-size: 22px; line-height: 28px; color: var(--ink); }
.ctl-master .d { margin-top: 4px; }
.ctl-master .d b { color: var(--ink); font-weight: 600; }
.ctl-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px light-dark(rgba(63, 117, 86, .16), rgba(135, 184, 154, 0.16)); }
.ctl-master.is-paused .ctl-dot { background: var(--warn); box-shadow: 0 0 0 4px light-dark(rgba(142, 91, 34, .16), rgba(209, 159, 110, 0.16)); }
.ctl-master .sw { width: 52px; height: 30px; }
.ctl-master .sw .sw-knob { width: 24px; height: 24px; }
.ctl-master .sw.on .sw-knob { transform: translateX(22px); }

.ctl-sec.is-dim { opacity: .55; }
.ctl-sec h2 { margin-top: 44px; }
.ctl-row { padding: 12px 0; gap: 14px; }
.ctl-row > .txt { flex: 1; min-width: 0; text-decoration: none; color: inherit; display: block; }
.ctl-row > .txt:hover .t { text-decoration: underline; text-decoration-color: light-dark(rgba(77, 53, 51, .3), rgba(230, 216, 214, 0.3)); text-underline-offset: 3px; }
.ctl-row.is-off .t, .ctl-row.is-off .home-ic { opacity: .55; }
.ctl-st { display: block; font-size: 13px; line-height: 18px; color: var(--soft); }
.ctl-st.warn { color: var(--warn); }
.ctl-st.no { color: var(--no); }
.ctl-search { width: 100%; margin-top: 6px; }
.ctl-chips { margin-top: 14px !important; }
.chips.chips-scroll .chip.warn:not([aria-pressed=true]) { color: var(--warn); border-color: light-dark(rgba(142, 91, 34, .35), rgba(209, 159, 110, 0.35)); }
.ctl-group { margin-top: 18px; }
.ctl-group-head { display: flex; align-items: center; gap: 10px; padding: 8px 0 2px; border-bottom: 1px solid var(--hair); }
.ctl-group-title { font-size: 12.5px; font-weight: 600; letter-spacing: .02em; color: var(--muted); text-transform: uppercase; }
.ctl-group-count { font-size: 12.5px; color: var(--soft); }
.ctl-bulk { margin-left: auto; font-weight: 500 !important; color: var(--soft) !important; }
.ctl-bulk:hover { color: var(--ink) !important; }
@media (max-width: 640px) {
  .ctl-master { padding: 16px; gap: 14px; }
  .ctl-master-title { font-size: 19px; }
}

/* ===== Memory: the brain graph ===== */
.mem-stage { margin-top: 14px; }
.mem-brain-shell { position: relative; height: 420px; border-radius: 18px; border: 1px solid var(--card-line); background: light-dark(#FAF6F4, #1D1B1A); overflow: hidden; box-shadow: inset 0 1px 0 light-dark(rgba(255, 255, 255, .7), rgba(36, 31, 30, 0.7)); }
.mem-brain-canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.mem-brain-canvas[data-cursor="grab"] { cursor: grab; }
.mem-brain-canvas[data-cursor="grabbing"] { cursor: grabbing; }
.mem-brain-canvas[data-cursor="pointer"] { cursor: pointer; }
.mem-brain-zoom { position: absolute; right: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 999px; background: light-dark(rgba(255, 253, 249, .92), rgba(23, 22, 20, 0.92)); border: 1px solid var(--card-line); backdrop-filter: blur(8px); }
.mem-zoom-btn { min-width: 28px; height: 28px; padding: 0 7px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; }
.mem-zoom-btn:hover { background: var(--tint); }
.mem-zoom-fit { font-size: 12px; padding: 0 10px; }
.mem-zoom-wide { padding: 0; width: 28px; }
.mem-brain-zoom .mem-pill-r[hidden], .mem-pill .mem-pill-r[hidden] { display: none; }
.mem-node-acts { position: absolute; left: 0; top: 0; z-index: 2; padding: 4px; will-change: transform; }
.mem-node-acts.is-card { width: min(300px, calc(100% - 32px)); padding: 0; border-radius: 12px; background: light-dark(rgba(255, 253, 249, .98), rgba(23, 22, 20, 0.98)); border: 1px solid var(--card-line); box-shadow: 0 12px 28px -12px light-dark(rgba(77, 53, 51, .28), rgba(0, 0, 0, 0.6)), 0 1px 3px light-dark(rgba(77, 53, 51, .06), rgba(0, 0, 0, 0.23)); }
.mem-node-acts.is-card { max-height: calc(100% - 112px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; animation: mem-card-in .32s .14s cubic-bezier(.2, .8, .2, 1) backwards; }
.mem-node-acts.is-card.is-sheet { width: 100%; max-height: 50%; border-width: 1px 0 0; border-radius: 18px 18px 0 0; box-shadow: 0 -10px 28px -18px light-dark(rgba(63, 44, 42, .28), rgba(0, 0, 0, 0.6)); }
.mem-node-acts.is-sheet .mem-node-text { max-height: 96px; }
.mem-brain-shell.has-sheet .mem-brain-zoom { display: none; }
@keyframes mem-card-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .mem-node-acts.is-card { animation: none; } }
.mem-feed-btn.mem-back { position: absolute; top: 12px; left: 12px; z-index: 3; padding: 0 13px 0 8px; gap: 5px; }
.mem-feed-btn.mem-back[hidden] { display: none; }
/* The pill is at the top left. While a memory is open, the back button takes that corner. */
.mem-brain-shell:has(> .mem-back:not([hidden])) .mem-pill { display: none; }
.mem-node-links { margin: 12px -14px 0; padding: 10px 14px 0; border-top: 1px dotted light-dark(rgba(77, 53, 51, .16), rgba(230, 216, 214, 0.16)); }
.mem-node-links[hidden] { display: none; }
.mem-node-links-h { margin-bottom: 4px; font-size: 11.5px; color: var(--soft); }
.mem-node-links-list { max-height: 160px; margin: 0 -8px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.is-sheet .mem-node-links-list { max-height: none; }
.is-sheet .mem-node-btns { position: sticky; bottom: 0; background: light-dark(#FFFDF9, #171614); }
.mem-node-link { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 32px; padding: 0 8px; border-radius: 8px; text-align: left; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.mem-node-link:hover { background: var(--tint); color: var(--ink); }
.mem-node-link:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.mem-node-link i { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--mem-c, var(--soft)); }
.mem-node-link span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mem-node-card { padding: 12px 14px 0; }
.mem-node-text { margin: 0; max-height: 220px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; font-size: 13px; line-height: 19px; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.mem-node-meta { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 8px; font-size: 11.5px; color: var(--soft); }
.mem-node-kind { color: var(--muted); }
.mem-node-kind::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--mem-c, var(--soft)); vertical-align: 1px; }
.mem-node-tidy { margin-top: 10px; padding-top: 10px; border-top: 1px dotted light-dark(rgba(77, 53, 51, .16), rgba(230, 216, 214, 0.16)); }
.mem-node-tidy[hidden] { display: none; }
.mem-node-tidy-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mem-node-tidy-q { margin-top: 6px; font-size: 12.5px; font-weight: 600; line-height: 17px; color: var(--ink); }
.mem-node-tidy-why { margin-top: 2px; font-size: 11.5px; line-height: 16px; color: var(--soft); }
.mem-node-tidy-others { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.mem-node-tidy-other { display: block; width: 100%; padding: 6px 8px; border-radius: 8px; background: var(--tint2); border: 1px solid light-dark(rgba(77, 53, 51, .08), rgba(230, 216, 214, 0.08)); text-align: left; font-size: 12px; line-height: 17px; color: var(--muted); cursor: pointer; overflow-wrap: anywhere; }
.mem-node-tidy-other:hover { color: var(--ink); border-color: light-dark(rgba(77, 53, 51, .22), rgba(230, 216, 214, 0.22)); background: var(--tint); }
.mem-node-tidy-nav-btns { display: inline-flex; align-items: center; gap: 4px; }
.mem-node-tidy .mem-tidy-yn { margin-top: 8px; }
.mem-node-btns { display: flex; gap: 6px; }
.is-card .mem-node-btns { justify-content: flex-end; margin-top: 10px; padding: 8px 10px 10px; border-top: 1px dotted light-dark(rgba(77, 53, 51, .14), rgba(230, 216, 214, 0.14)); }
.is-card .mem-node-del { box-shadow: none; }
.mem-node-del.mem-node-copy { color: var(--ink); }
.mem-node-del.mem-node-copy:hover { color: var(--ink); border-color: light-dark(rgba(77, 53, 51, .3), rgba(230, 216, 214, 0.3)); }
.mem-node-del { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 999px; background: light-dark(rgba(255, 253, 249, .96), rgba(23, 22, 20, 0.96)); border: 1px solid var(--card-line); box-shadow: 0 2px 10px light-dark(rgba(77, 53, 51, .1), rgba(0, 0, 0, 0.33)); font-size: 12px; font-weight: 500; color: var(--muted); }
.mem-node-del:hover { color: var(--no); border-color: light-dark(#F0CFC7, #4B3733); }
.mem-node-del.is-armed { color: light-dark(#fff, #241F1E); background: var(--no); border-color: var(--no); }
.mem-node-del:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.mem-brain-notice { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; }
.mem-brain-notice > .d { max-width: 360px; }
.mem-empty-ic { display: inline-flex; width: 52px; height: 52px; border-radius: 16px; align-items: center; justify-content: center; background: var(--tint); color: var(--ink); }
.mem-empty-title { justify-content: center; margin: 14px 0 4px; font-family: var(--serif); font-weight: 500; font-size: 21px; min-height: 0; }
.mem-off-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 20px; }

.s-global { --mem-c: light-dark(#8A5A44, #CF9F89); }
.s-preference { --mem-c: light-dark(#4B5E86, #A1B5DD); }
.s-project { --mem-c: light-dark(#3F7556, #87B89A); }
.s-fact { --mem-c: light-dark(#B07A2A, #B2823E); }

/* The Library on the map of memories (library-map.js): sources, notes, tasks and people as layers.
   Colour says the group and shape says the kind, the same as on the canvas (memory-graph.js). */
.k-sources { --mem-c: light-dark(#3F5F7A, #9DBCD7); }
.k-notes { --mem-c: light-dark(#6B5B8E, #B2A4D6); }
.k-tasks { --mem-c: light-dark(#A0603A, #CD906D); }
.k-people { --mem-c: light-dark(#4D3533, #E6D8D6); }
.lib-mark { flex: none; display: inline-block; box-sizing: border-box; width: 9px; height: 9px; border-radius: 50%; background: var(--mem-c, var(--soft)); }
.mem-node-link i.lib-mark { width: 9px; height: 9px; }
.lib-mark[data-kind=saved] { border-radius: 3px; }
.lib-mark[data-kind=file], .mem-node-link i.lib-mark[data-kind=file] { width: 8px; height: 10px; border-radius: 1px; clip-path: polygon(0 0, 62% 0, 100% 34%, 100% 100%, 0 100%); }
.lib-mark[data-kind=task] { border-radius: 1.5px; transform: rotate(45deg) scale(.84); }
.lib-mark[data-kind=agent], .mem-node-link i.lib-mark[data-kind=agent] { width: 10px; height: 10px; border-radius: 0; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.lib-mark[data-kind=person] { background: transparent; border: 2px solid var(--mem-c, var(--soft)); }

/* The layers control at the map's lower left: what shows beside memories. It is also the key to the shapes. */
.lib-layers { position: absolute; left: 12px; bottom: 12px; z-index: 2; display: inline-flex; align-items: center; gap: 2px; max-width: calc(100% - 192px); padding: 3px; overflow-x: auto; scrollbar-width: none; border-radius: 999px; background: light-dark(rgba(255, 253, 249, .92), rgba(23, 22, 20, 0.92)); border: 1px solid var(--card-line); backdrop-filter: blur(8px); }
.lib-layer { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; font-weight: 500; color: var(--soft); cursor: pointer; transition: background .15s, color .15s; }
.lib-layer:hover { background: light-dark(rgba(77, 53, 51, .045), rgba(230, 216, 214, 0.045)); color: var(--ink); }
.lib-layer:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.lib-layer[aria-pressed=true] { background: var(--tint); color: var(--ink); }
.lib-layer .lib-mark { opacity: .5; transition: opacity .15s; }
.lib-layer[aria-pressed=true] .lib-mark, .lib-layer:hover .lib-mark { opacity: 1; }
.lib-layer[data-lib-layer=saved] { --mem-c: light-dark(#6B5B8E, #B2A4D6); }
.lib-layer[data-lib-layer=files] { --mem-c: light-dark(#3F5F7A, #9DBCD7); }
.lib-layer[data-lib-layer=tasks] { --mem-c: light-dark(#A0603A, #CD906D); }
.lib-layer[data-lib-layer=people] { --mem-c: light-dark(#4D3533, #E6D8D6); }
.lib-layer-n { font-size: 11.5px; font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
.mem-brain-shell.has-sheet .lib-layers { display: none; }
/* On the expanded map the nav is along the bottom, so the control sits above the zoom buttons. */
.mem-brain-shell.is-wide .lib-layers { left: auto; right: 12px; bottom: 54px; max-width: calc(100% - 24px); }
.mem-brain-shell.is-wide .mem-node-acts.is-card:not(.is-sheet) { max-height: calc(100% - 156px); }
/* A narrow window: the control stays in the row of the zoom buttons, so the map keeps its room.
   It shows no numbers there, and it scrolls to the side when the row is too short for it. */
@media (max-width: 640px) {
  .lib-layers { max-width: calc(100% - 136px); }
  .lib-layer { padding: 0 9px; }
  .lib-layer-n { display: none; }
  .mem-brain-shell.is-wide .lib-layers { bottom: calc(142px + env(safe-area-inset-bottom)); max-width: calc(100% - 24px); }
}

/* The card of an item that is not a memory: its title, then what it says. */
.mem-node-card.is-item .mem-node-text { max-height: none; overflow: visible; font-size: 14px; font-weight: 600; line-height: 20px; white-space: normal; }
.lib-read { max-height: 260px; margin-top: 8px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; font-size: 13px; line-height: 19px; color: var(--ink); overflow-wrap: anywhere; }
.lib-read[hidden] { display: none; }
.is-sheet .lib-read { max-height: 120px; }
.lib-read-p { margin: 0 0 6px; white-space: pre-wrap; }
.lib-read-p.is-soft { color: var(--soft); font-size: 12px; }
.lib-read-p b { font-weight: 600; color: var(--muted); }
.lib-read-pre { margin: 0 0 6px; padding: 8px 10px; border-radius: 8px; background: var(--tint2); font: 11.5px/16px ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.lib-read-md.skill-markdown { padding: 0; font-size: 13px; line-height: 19px; }
.lib-read-md.skill-markdown > :first-child { padding-right: 0; }
.lib-read-md.skill-markdown :is(h1, h2, h3, h4) { margin: .9em 0 .3em; font-size: 13.5px; font-weight: 600; }
.lib-read-md.skill-markdown h1 { font-size: 14.5px; }
.lib-read-md.skill-markdown :is(ul, ol) { padding-left: 1.3em; }
.lib-url { display: inline-block; max-width: 100%; margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--muted); text-decoration: underline; text-decoration-color: light-dark(rgba(77, 53, 51, .25), rgba(230, 216, 214, 0.25)); text-underline-offset: 2px; }
.lib-url:hover { color: var(--ink); }
.lib-ref { display: inline-block; max-width: 100%; padding: 0 5px; line-height: inherit; text-align: left; vertical-align: baseline; border-radius: 5px; background: var(--tint); font: inherit; font-weight: 500; color: var(--ink); cursor: pointer; box-shadow: inset 0 -1.5px 0 var(--mem-c, var(--soft)); }
.lib-ref:hover { background: var(--tint2); }
.lib-ref:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }

/* The links of an item, in its card: what a person or an agent linked, then what Loop put near it. */
.lib-links-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; }
.lib-near-h { margin-top: 10px; }
.lib-links-tools { display: inline-flex; align-items: center; gap: 2px; margin-right: -6px; }
.lib-links-btn { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 500; color: var(--muted); cursor: pointer; }
.lib-links-btn:hover { background: var(--tint); color: var(--ink); }
.lib-links-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.lib-link-row { display: flex; align-items: center; }
.lib-link-row .mem-node-link { flex: 1; min-width: 0; }
.lib-rel { flex: none; font-style: normal; font-size: 11px; color: var(--soft); }
.mem-node-link:hover .lib-rel { color: var(--muted); }
.lib-link-x { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; color: var(--soft); opacity: 0; cursor: pointer; transition: opacity .15s; }
.lib-link-row:hover .lib-link-x, .lib-link-row:focus-within .lib-link-x { opacity: 1; }
.lib-link-x:hover { background: var(--tint); color: var(--no); }
.lib-link-x:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
@media (hover: none) { .lib-link-x { opacity: 1; } }
.lib-link-form { display: flex; flex-direction: column; gap: 8px; }
.lib-link-form-top { display: flex; gap: 6px; }
select.lib-link-rel { flex: none; width: 116px; height: 32px; padding: 0 24px 0 10px; border-radius: 8px; font-size: 12.5px; line-height: 18px; background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%; }
input.lib-link-q { flex: 1; min-width: 0; width: auto; height: 32px; padding: 0 10px; border-radius: 8px; font-size: 13px; line-height: 18px; }
/* While the form for a new link shows, the page of the item gives its room to the form. */
.mem-node-card.is-linking .lib-read { display: none; }
.lib-find { max-height: 176px; margin: 0 -8px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.lib-find-none { margin: 0; padding: 8px; font-size: 12.5px; color: var(--soft); }
.lib-link-form-foot { display: flex; justify-content: flex-end; margin-right: -6px; }

/* Gather: some items on one page, in a dialog. */
.loop-dialog.lib-gather { width: min(860px, calc(100vw - 32px)); }
/* In the page, under the map: the buttons stay clear of the bar along the bottom. */
dialog.xp-dialog.lib-gather[open] { margin-bottom: calc(96px + env(safe-area-inset-bottom)); }
.lib-gather-cols { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: 14px; margin: 14px 0 16px; }
.lib-gather-items { margin: 0; padding: 0; max-height: min(46vh, 420px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; list-style: none; }
.lib-gather-item { display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 4px 8px; border-radius: 8px; font-size: 12.5px; color: var(--ink); cursor: pointer; }
.lib-gather-item:hover { background: var(--tint); }
.lib-gather-item input { flex: none; width: 15px; height: 15px; margin: 0; accent-color: var(--brown); }
.lib-gather-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-gather-item:has(input:not(:checked)) > :is(span, em, i) { opacity: .45; }
.lib-gather-preview.skill-markdown { max-height: min(46vh, 420px); padding: 14px 16px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; border-radius: 12px; border: 1px solid var(--card-line); background: var(--card); font-size: 13.5px; }
.lib-gather-preview.skill-markdown > :first-child { padding-right: 0; }
@media (max-width: 700px) {
  .lib-gather-cols { grid-template-columns: minmax(0, 1fr); }
  .lib-gather-items { max-height: 150px; }
  .lib-gather-preview.skill-markdown { max-height: 34vh; }
}

/* The pill at the map's top right: expand or collapse, Review while items wait, and on narrow windows the filter. */
.mem-pill { position: absolute; top: 12px; left: 12px; z-index: 5; display: inline-flex; align-items: center; gap: 2px; max-width: calc(100% - 24px); height: 38px; padding: 2px; border-radius: 999px; background: light-dark(rgba(255, 253, 249, .96), rgba(23, 22, 20, 0.96)); border: 1px solid var(--card-line); backdrop-filter: blur(8px); box-shadow: 0 2px 10px light-dark(rgba(77, 53, 51, .08), rgba(0, 0, 0, 0.28)); white-space: nowrap; }
.mem-pill-b { flex: none; display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--ink); cursor: pointer; transition: background .15s; }
.mem-pill-b[hidden] { display: none; }
.mem-pill-b:hover { background: light-dark(rgba(77, 53, 51, .045), rgba(230, 216, 214, 0.045)); }
.mem-pill-b[aria-expanded=true] { background: var(--tint); }
.mem-pill-b:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.mem-pill-b svg { flex: none; color: var(--muted); }
.mem-pill-b.mem-pill-f { flex: 0 1 auto; min-width: 0; }
.mem-pill-l { min-width: 0; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.mem-pill-n { font-size: 12px; font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
.mem-pill-chev { transition: transform .2s; }
.mem-pill-f[aria-expanded=true] .mem-pill-chev { transform: rotate(180deg); }
.mem-pill-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; box-sizing: border-box; border: 1.5px solid var(--muted); }
.mem-pill[data-filter=global] .mem-pill-dot { border: 0; background: light-dark(#8A5A44, #CF9F89); }
.mem-pill[data-filter=preference] .mem-pill-dot { border: 0; background: light-dark(#4B5E86, #A1B5DD); }
.mem-pill[data-filter=project] .mem-pill-dot { border: 0; background: light-dark(#3F7556, #87B89A); }
.mem-pill[data-filter=fact] .mem-pill-dot { border: 0; background: light-dark(#B07A2A, #B2823E); }
.mem-pill[data-filter=tag] .mem-pill-dot { display: none; }
.mem-pill-x { width: 28px; padding: 0; justify-content: center; }
.mem-pill-i { flex: none; width: 32px; padding: 0; justify-content: center; }
.mem-pill-r { flex: none; width: 1px; height: 16px; margin: 0 2px; background: var(--card-line); }
.mem-pill-in, .mem-brain-shell.is-wide .mem-pill-out { display: none; }
.mem-brain-shell.is-wide .mem-pill-in { display: block; }
@media (min-width: 980px) {
  .mem-pill :is(.mem-pill-f, .mem-pill-x, .mem-pill-fr) { display: none; }
  /* With the side menu, a pill with no Review or Gather has nothing to show. */
  .mem-pill.is-bare { display: none; }
}
/* The pill's menu: the side menu's rows, in the place the memory card and Review also use. */
.mem-menu { position: absolute; top: 60px; left: 12px; z-index: 4; width: 300px; max-height: calc(100% - 120px); padding: 16px 10px 14px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; border-radius: 14px; background: light-dark(rgba(255, 253, 249, .985), rgba(23, 22, 20, 0.985)); border: 1px solid var(--card-line); box-shadow: 0 12px 32px light-dark(rgba(77, 53, 51, .1), rgba(0, 0, 0, 0.33)); visibility: hidden; opacity: 0; transform: translateY(-6px) scale(.985); transform-origin: 0 0; transition: opacity .16s, transform .2s cubic-bezier(.2, .8, .2, 1), visibility 0s .2s; }
.mem-menu.is-open { visibility: visible; opacity: 1; transform: none; transition: opacity .2s, transform .28s cubic-bezier(.2, .8, .2, 1); }
.mem-menu .hm-jump > .mem-jump-l { flex: 1; }
.mem-menu .mem-rail-k2 { margin-top: 18px; margin-bottom: 10px; }
.mem-menu-tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 6px; }
.mem-menu.is-sheet { top: auto; left: 0; right: 0; bottom: 0; z-index: 6; width: auto; max-height: calc(100% - 64px); padding: 18px 14px 22px; border-width: 1px 0 0; border-radius: 20px 20px 0 0; box-shadow: none; transform: translateY(40px); transform-origin: 50% 100%; }
.mem-menu.is-sheet.is-open { transform: none; }
.mem-menu.is-sheet .hm-jump { height: 44px; }
.mem-menu.is-sheet .mem-mchip { height: 40px; padding: 0 14px; }
@media (prefers-reduced-motion: reduce) { .mem-menu, .mem-menu.is-open, .mem-pill-chev { transition: none; } }
/* Expanded: the map is the whole window, edge to edge, behind the nav. On wide windows the Loop title,
   the side menu and the profile stay exactly where they are and sit flush on it, also while the map
   grows or shrinks. On narrow windows the header makes way for the pill. */
.mem-brain-shell.is-wide, .mem-brain-shell.is-moving { position: fixed; z-index: 15; }
.mem-brain-shell.is-wide, .mem-brain-shell.is-wide.has-sheet { inset: 0; width: auto; height: auto; min-height: 0; border-color: transparent; border-radius: 0; box-shadow: none; }
.mem-top, .top { transition: opacity .2s, visibility 0s; }
body:has(:where(.view:not(.is-staged)) .mem-brain-shell.is-wide) .mem-top { opacity: 0; visibility: hidden; transition: opacity .2s, visibility 0s .2s; }
.mem-stage:has(> .mem-brain-shell:is(.is-wide, .is-moving)) > .hm-rail.mem-rail { z-index: 16; pointer-events: none; }
.mem-stage:has(> .mem-brain-shell:is(.is-wide, .is-moving)) > .hm-rail.mem-rail > *,
.mem-stage:has(> .mem-brain-shell:is(.is-wide, .is-moving)) > .hm-rail.mem-rail > .hm-rail-list > * { pointer-events: auto; }
.mem-stage:has(> .mem-brain-shell:is(.is-wide, .is-moving)) > .hm-rail.mem-rail > .hm-rail-list { pointer-events: none; }
@media (max-width: 979.98px) {
  body:has(:where(.view:not(.is-staged)) .mem-brain-shell.is-wide) .top { opacity: 0; visibility: hidden; transition: opacity .2s, visibility 0s .2s; }
}
/* Paper with soft edges, so map labels and memories fade out behind the side menu and the title.
   --rail-r: the side menu's right edge on the map (memory-view.js). While the map moves, holdPaper
   there keeps the paper still in the window, so the map's edge is all that shows or hides it. */
@media (min-width: 980px) {
  .mem-brain-shell:is(.is-wide, .is-moving)::before, .mem-brain-shell:is(.is-wide, .is-moving)::after { content: ''; position: absolute; z-index: 1; pointer-events: none; }
  .mem-brain-shell:is(.is-wide, .is-moving)::before { top: 0; bottom: 0; left: calc(var(--rail-r, 0px) - 288px); width: 304px; background: linear-gradient(90deg, light-dark(rgba(250, 246, 244, 0), rgba(29, 27, 26, 0)), light-dark(#FAF6F4, #1D1B1A) 32px, light-dark(#FAF6F4, #1D1B1A) calc(100% - 24px), light-dark(rgba(250, 246, 244, 0), rgba(29, 27, 26, 0))); }
  .mem-brain-shell:is(.is-wide, .is-moving)::after { top: 0; left: 0; right: 0; height: 76px; background: linear-gradient(light-dark(#FAF6F4, #1D1B1A) 46px, light-dark(rgba(250, 246, 244, 0), rgba(29, 27, 26, 0))); }
  .mem-brain-shell.is-wide .mem-pill { top: 13px; left: calc(var(--rail-r, 0px) + 16px); }
  .mem-brain-shell.is-wide .mem-back { top: 16px; left: 16px; }
  body:has(:where(.view:not(.is-staged)) .mem-brain-shell:is(.is-wide, .is-moving)) .top { pointer-events: none; }
  body:has(:where(.view:not(.is-staged)) .mem-brain-shell:is(.is-wide, .is-moving)) .top > * { pointer-events: auto; }
}
body:has(:where(.view:not(.is-staged)) .mem-brain-shell.is-wide) .banner-slot:not(:empty) { position: fixed; z-index: 16; left: 50%; bottom: 92px; transform: translateX(-50%); width: min(720px, calc(100% - 64px)); max-height: 40vh; overflow-y: auto; }
.mem-brain-shell.is-wide .mem-side { bottom: 64px; }
.mem-feed-btn { position: relative; display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px 0 11px; border-radius: 999px; background: light-dark(rgba(255, 253, 249, .94), rgba(23, 22, 20, 0.94)); border: 1px solid var(--card-line); backdrop-filter: blur(8px); box-shadow: 0 2px 10px light-dark(rgba(77, 53, 51, .08), rgba(0, 0, 0, 0.28)); font-size: 13px; font-weight: 500; color: var(--ink); cursor: pointer; transition: border-color .15s, background .15s; }
.mem-feed-btn:hover { border-color: light-dark(rgba(77, 53, 51, .3), rgba(230, 216, 214, 0.3)); background: light-dark(#fff, #241F1E); }
.mem-feed-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.mem-feed-btn svg { color: var(--muted); }
.mem-feed-btn-n { height: 18px; padding: 0 7px; margin-right: -4px; border-radius: 999px; background: var(--brown); color: var(--bg); font-size: 11px; line-height: 18px; }
.mem-side { position: absolute; top: 60px; right: 12px; bottom: 58px; z-index: 4; width: clamp(280px, 36%, 360px); display: flex; flex-direction: column; pointer-events: none; }
.mem-feed.is-open { flex: 0 1 auto; min-height: 120px; }
.mem-feed { position: relative; display: flex; flex-direction: column; min-height: 0; border-radius: 14px; overflow: hidden; background: light-dark(rgba(255, 253, 249, .985), rgba(23, 22, 20, 0.985)); border: 1px solid var(--card-line); box-shadow: 0 12px 32px light-dark(rgba(77, 53, 51, .1), rgba(0, 0, 0, 0.33)); opacity: 0; transform: translateY(-6px) scale(.985); transform-origin: 100% 0; pointer-events: none; transition: opacity .18s ease-out, transform .22s cubic-bezier(.2, .8, .2, 1); }
.mem-feed.is-open { opacity: 1; transform: none; pointer-events: auto; }
@media (prefers-reduced-motion: reduce) { .mem-feed { transition: none; } }
.mem-feed-head { flex: none; display: flex; align-items: center; gap: 8px; padding: 7px 5px 5px 13px; border-bottom: 1px dotted light-dark(rgba(77, 53, 51, .14), rgba(230, 216, 214, 0.14)); }
.mem-feed-ht { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.mem-feed-t { margin: 0; min-height: 0; font-family: var(--serif); font-size: 17px; font-weight: 500; line-height: 1.2; color: var(--ink); }
.mem-feed-sub { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--soft); }
.mem-feed-x { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 8px; color: var(--muted); cursor: pointer; }
.mem-feed-x:hover { background: var(--tint2); color: var(--ink); }
.mem-feed-scroll { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; -webkit-mask-image: linear-gradient(#000 calc(100% - 48px), transparent); mask-image: linear-gradient(#000 calc(100% - 48px), transparent); }
.mem-feed-scroll.is-end { -webkit-mask-image: none; mask-image: none; }
.mem-act-h { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12.5px; color: var(--soft); }
.mem-act-h .home-ic.mark.mem-act-av, .mem-tidy-row .home-ic.mark.mem-act-av { flex: none; width: 18px; height: 18px; border-radius: 5px; font-size: 10px; }
.mem-act-h .home-ic.mark.logo.mem-act-av img, .mem-tidy-row .home-ic.mark.logo.mem-act-av img { width: 13px; height: 13px; }
.mem-act-who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; color: var(--ink); }
.mem-act-h time { flex: none; font-size: 12px; white-space: nowrap; }
.mem-act-q { flex: 1; min-width: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; font-size: 12px; line-height: 17px; color: var(--soft); }

/* Review deck: standalone one-at-a-time cycling Yes/No card with Prev/Next stepper and Set aside drawer. */
/* Review: a panel over the map's right side, each item laid out like an approval request. */
.mem-review { flex: none; display: flex; flex-direction: column; border-bottom: 1px dotted light-dark(rgba(77, 53, 51, .14), rgba(230, 216, 214, 0.14)); }
.mem-review:not(.is-open) { display: none; }
.mem-tidy-deck { flex: none; display: flex; flex-direction: column; gap: 3px; padding: 8px 13px; cursor: pointer; transition: background .14s ease-out; }
.mem-tidy-deck:hover { background: light-dark(rgba(77, 53, 51, .05), rgba(230, 216, 214, 0.05)); }
.mem-tidy-deck.is-current { background: var(--tint); }
.mem-tidy-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mem-tidy-row .mem-act-av { flex: none; }
.mem-tidy-who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; color: var(--ink); }
.mem-tidy-op { flex: none; padding: 1px 7px; border-radius: 6px; background: var(--tint); font-family: var(--mono, ui-monospace, monospace); font-size: 11.5px; color: var(--muted); }
.mem-tidy-op.is-warn { background: var(--warn-bg); color: var(--warn); }
.mem-tidy-foot { display: flex; align-items: center; gap: 8px; min-width: 0; margin-top: 5px; }
.mem-tidy-foot .mem-tidy-yn { margin-left: auto; gap: 5px; }
.mem-tidy-foot .mem-tidy-yn-btn svg { width: 11px; height: 11px; }
.mem-tidy-count { font-size: 12px; color: var(--soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mem-tidy-step { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 8px; color: var(--muted); cursor: pointer; transition: color .14s, background .14s; }
.mem-tidy-step:hover:not(:disabled) { background: var(--tint2); color: var(--ink); }
.mem-tidy-step:disabled { opacity: .35; cursor: default; }
.mem-tidy-step:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.mem-tidy-body { flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; display: flex; flex-direction: column; gap: 3px; }
.mem-tidy-why { margin: 1px 0 0; font-size: 12px; line-height: 17px; color: var(--soft); }
.mem-tidy-reason { display: block; margin-top: 2px; font-size: 12px; line-height: 16px; color: var(--muted); }
.mem-tidy-text { margin: 0; min-width: 0; font-size: 13px; line-height: 19px; color: var(--ink); overflow-wrap: anywhere; white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.mem-tidy-yn { display: flex; flex: none; gap: 6px; }
.mem-tidy-yn-btn { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; font-size: 12px; font-weight: 600; border-radius: 999px; border: 1px solid var(--card-line); cursor: pointer; transition: background .14s, border-color .14s, transform .08s; }
.mem-tidy-yn-btn:active:not(:disabled) { transform: scale(.985); }
.mem-tidy-yn-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.mem-tidy-yn-btn:disabled { opacity: .5; cursor: default; }
.mem-tidy-yn-top { display: inline-flex; align-items: center; gap: 5px; font-size: 13.5px; font-weight: 600; line-height: 18px; }
.mem-tidy-yn-sub { font-size: 11px; line-height: 14px; opacity: .78; }
.mem-tidy-yn-btn.is-no { background: light-dark(#fff, #241F1E); color: var(--ink); border-color: light-dark(rgba(77, 53, 51, .18), rgba(230, 216, 214, 0.18)); }
.mem-tidy-yn-btn.is-no svg { color: var(--no); }
.mem-tidy-yn-btn.is-no:hover:not(:disabled) { background: var(--no-bg); border-color: light-dark(rgba(163, 65, 47, .35), rgba(240, 144, 125, 0.35)); }
.mem-tidy-yn-btn.is-yes { background: var(--brown); border-color: var(--brown); color: var(--bg); }
.mem-tidy-yn-btn.is-yes:hover:not(:disabled) { background: var(--ink); border-color: var(--ink); }
.mem-tidy-yn.is-compact { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 0; }
.mem-tidy-yn.is-compact .mem-tidy-yn-btn { flex-direction: column; gap: 1px; width: auto; height: auto; padding: 6px 8px; border-radius: 9px; }
.mem-tidy-yn.is-compact .mem-tidy-yn-top { font-size: 12.5px; line-height: 16px; }
.mem-tidy-yn.is-compact .mem-tidy-yn-sub { font-size: 10.5px; }


.mem-tidy-done { display: flex; align-items: center; gap: 8px; padding: 10px 14px 10px 18px; font-size: 12.5px; color: var(--muted); }
.mem-tidy-done-ic { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 999px; background: var(--ok-bg); color: var(--ok); flex: none; }
.mem-tidy-done-ic svg { width: 12px; height: 12px; }
.mem-tidy-done-t { flex: 1; min-width: 0; }
.mem-tidy-done-x { font-size: 12px; font-weight: 500; color: var(--ink); cursor: pointer; }
.mem-tidy-done-x:hover { text-decoration: underline; text-underline-offset: 2px; }
.mem-tidy-rep-drawer { flex: none; border-top: 1px dotted light-dark(rgba(77, 53, 51, .14), rgba(230, 216, 214, 0.14)); background: light-dark(rgba(247, 242, 240, .45), rgba(33, 31, 30, 0.45)); }
.mem-tidy-rep-sum { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 16px 9px 18px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; list-style: none; }
.mem-tidy-rep-sum::-webkit-details-marker { display: none; }
.mem-tidy-rep-sum:hover { color: var(--ink); }
.mem-tidy-rep-n { font-weight: 400; color: var(--soft); }
.mem-tidy-rep-list { list-style: none; margin: 0; padding: 0 10px 10px; max-height: 160px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.mem-tidy-rep-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 10px; padding: 7px 8px; }
.mem-tidy-rep-q { grid-column: 1; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12.5px; line-height: 18px; color: var(--muted); text-decoration: line-through; text-decoration-color: light-dark(rgba(77, 53, 51, .3), rgba(230, 216, 214, 0.3)); overflow-wrap: anywhere; }
.mem-tidy-rep-m { grid-column: 1; font-size: 11.5px; color: var(--soft); }
.mem-tidy-undo { grid-column: 2; grid-row: 1 / span 2; flex: none; height: 26px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--card-line); background: light-dark(#fff, #241F1E); font-size: 12px; font-weight: 500; color: var(--ink); cursor: pointer; }
.mem-tidy-undo:hover { border-color: light-dark(rgba(77, 53, 51, .32), rgba(230, 216, 214, 0.32)); }
.mem-tidy-undo:disabled { opacity: .5; cursor: default; }

/* Wide windows: Memory uses the same 720px column as Home, Vault and Settings (and slides with it
   the same way, so the title never jumps between tabs). The graph fills that column down to the nav. */
@media (min-width: 980px) {
  .wrap:has(:where(.view:not(.is-staged)) .mem-stage) > main { --hm-shift: max(0px, calc(248px - (100vw - 760px) / 2)); margin-left: var(--hm-shift); margin-right: calc(-1 * min(var(--hm-shift), (100vw - 760px) / 2 - 20px)); }
  .wrap:has(:where(.view:not(.is-staged)) .mem-stage) .view { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); }
  body:has(.nav:not([hidden])) .wrap:has(:where(.view:not(.is-staged)) .mem-stage) main { overflow: visible; min-width: 0; }
  .mem-stage { position: relative; min-height: 0; padding-bottom: 4px; }
  .mem-brain-shell { height: 100%; min-height: 200px; }
}
/* Mid-size windows (no side menu): the graph also fills the page down to the nav, not a fixed 420px. */
@media (min-width: 641px) and (max-width: 979.98px) {
  .wrap:has(:where(.view:not(.is-staged)) .mem-stage) .view { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); }
  .mem-stage { min-height: 0; padding-bottom: 4px; }
  .mem-brain-shell { height: 100%; min-height: 340px; }
}
/* The side menu: Home's rail exactly, in the same box as on Home, Vault and Settings.
   Hidden below 980px with every rail. */
.mem-rail .hm-jump > .mem-jump-l { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Review in Memory's side menu opens the panel on the graph's right side. */
/* The 12px icon takes the place of a 7px kind dot, so the labels line up with All memories. */
.mem-panel-jump svg { flex: none; width: 12px; height: 12px; margin: 0 -3px 0 -2px; color: var(--muted); }
.mem-panel-jump .mem-panel-n { min-width: 0; height: 18px; padding: 0 7px; border-radius: 999px; background: var(--brown); color: var(--bg); font-size: 11px; line-height: 18px; text-align: center; }
.mem-panel-jump .hm-jump-n[hidden] { display: none; }
@media (max-width: 640px) {
  .mem-brain-shell { height: 340px; }
  .mem-side, .mem-brain-shell.is-wide .mem-side { top: 58px; right: 0; bottom: 0; z-index: 6; width: 100%; }
  .mem-feed { border: 0; border-radius: 0; }
  .mem-feed.is-open { flex: 1 1 0; }
  .mem-pill { height: 42px; max-width: calc(100% - 68px); }
  .mem-brain-shell.is-wide .mem-brain-zoom { bottom: calc(96px + env(safe-area-inset-bottom)); }
  .mem-pill-b { height: 36px; padding: 0 10px; }
  .mem-pill-i { width: 36px; padding: 0; }
  .mem-pill-x { width: 30px; padding: 0; }
  .mem-pill-t, .mem-pill-r:not(.mem-pill-fr) { display: none; }
  body:has(:where(.view:not(.is-staged)) .mem-brain-shell.is-wide) .banner-slot:not(:empty) { top: 64px; bottom: auto; width: calc(100% - 24px); }
  .mem-pill-l { max-width: 108px; }
  .mem-brain-shell.is-wide .mem-pill-t { display: none; }
  .mem-feed-btn.mem-back { top: 15px; width: 36px; height: 36px; padding: 0; justify-content: center; }
  .mem-back span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  /* A sheet, or Review, needs the bottom of the screen on an expanded phone map. */
  .mem-brain-shell.is-wide, .mem-brain-shell.is-wide.has-sheet { border: 0; }
  body:has(:where(.view:not(.is-staged)) .mem-brain-shell.is-wide:is(.has-sheet, .feed-open)) .nav, body:has(:where(.view:not(.is-staged)) .mem-brain-shell.is-wide .mem-menu.is-sheet.is-open) .nav { display: none; }
}
.ctl-sec.ctl-first > h2 { margin-top: 32px; }
/* Home: category pills sit in the Connections heading, between the title and the + */
h2.ctl-head { gap: 14px; flex-wrap: nowrap; }
h2.ctl-head .ctl-chips { flex: 1 1 auto; min-width: 0; margin: 0 !important; padding-top: 8px; font-size: 13.5px; }
h2.ctl-head .home-add { flex: none; }
.ctl-head + .ctl-search { margin-top: 10px; }
h2.ctl-head .ctl-chips { padding-top: 10px !important; padding-bottom: 6px !important; } /* + the 4px hover scrollbar = pills centered on the + */
/* Home: search sits above the Connections heading */
.home-connections > .ctl-search { margin-top: 32px; }
.vault-intro { margin: 12px 0 0; font-size: 13px; line-height: 19px; color: var(--muted); text-wrap: pretty; }
.vault-intro b { font-weight: 500; color: var(--ink); }
/* "Agent changes: Allow": the rule button says what it is about. */
.vm-head .vm-pre { margin-right: 2px; color: var(--soft); font-weight: 400; }
.vm-head .vm-pre::after { content: ':'; }
.home-connections > .ctl-search + h2.ctl-head { margin-top: 16px; }

/* Structured approval details (every field visible, no sibling truncation) */
.approval-kv {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.approval-kv-row {
  display: grid;
  grid-template-columns: minmax(110px, max-content) minmax(0, 1fr);
  gap: 4px 10px;
  align-items: baseline;
}
.approval-kv-row dt {
  font-weight: 600;
  color: light-dark(#7C4F19, #DDAF81);
  overflow-wrap: anywhere;
}
.approval-kv-row dd {
  margin: 0;
  color: light-dark(#4A2D0C, #F2E1D2);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.approval-kv-group {
  margin-top: 4px;
  padding-top: 5px;
  border-top: 1px dashed light-dark(#E8CA9D, #564327);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.approval-kv-group:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.approval-kv-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: light-dark(#8E5B22, #D19F6E);
}
.approval-kv-secrets {
  background: light-dark(#F9E8CE, #302718);
  border-radius: 6px;
  padding: 4px 7px;
  margin-top: 2px;
}
.approval-kv-secrets dt,
.approval-kv-secrets dd {
  color: light-dark(#5C3308, #EBD4C1);
  font-weight: 600;
}
@media (max-width: 640px) {
  .approval-kv-row {
    grid-template-columns: 1fr;
    gap: 1px;
  }
}

/* Connections: Probe-first Add Connection panel, collapsible Advanced, Import summary */
.conn-panel-card {
  margin-top: 16px;
  padding: 20px 22px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--card-line);
  box-shadow: 0 6px 24px light-dark(rgba(77, 53, 51, .05), rgba(0, 0, 0, 0.205));
}
.add-conn-step {
  margin-top: 0;
}
.add-conn-step p {
  margin: 0;
}
.advanced-details {
  border-top: 1px dotted var(--hair);
  padding-top: 10px;
}
.advanced-details > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
.advanced-details > summary::-webkit-details-marker {
  display: none;
}
.advanced-details > summary::before {
  content: '›';
  display: inline-block;
  font-size: 16px;
  line-height: 1;
  transition: transform .15s ease;
}
.advanced-details[open] > summary::before {
  transform: rotate(90deg);
}
.advanced-details > summary:hover {
  color: var(--ink);
}
.advanced-details .advanced-body {
  margin-top: 14px;
}
.advanced-local-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--tint2);
}
.probe-key-field {
  margin-top: 10px;
}
.import-summary-callout {
  margin-bottom: 16px;
}
.import-summary-group {
  margin-top: 8px;
}
.import-summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.import-summary-list {
  margin: 8px 0 0 18px;
  list-style: disc;
  font-size: 13px;
  line-height: 19px;
}
.import-summary-list li + li {
  margin-top: 3px;
}
/* Connections list: search and filter pills stay put; the rows scroll in their own box below them */
body:has(.nav:not([hidden])) .wrap:has(:where(.view:not(.is-staged)) .home-connections) main { overflow: visible; min-width: 0; }
.wrap:has(:where(.view:not(.is-staged)) .home-connections) .view { height: 100%; }
.home-connections { display: flex; flex-direction: column; height: 100%; min-height: 0; min-width: 0; }
.home-connections > * { flex: none; }
.home-connections > .ctl-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin-right: -16px; padding-right: 16px; padding-bottom: 24px; }
.home-connections > .ctl-scroll > .ctl-group:first-child { margin-top: 10px; }
/* The page lists scroll inside the page: their scroll bar is thin and quiet, not a grey system bar beside the content. */
.ctl-scroll { scrollbar-width: thin; scrollbar-color: light-dark(rgba(77, 53, 51, .18), rgba(230, 216, 214, .14)) transparent; }
/* Rows run down behind the nav pill and fade out above it instead of stopping at a gap */
body:has(.nav:not([hidden])) .wrap:has(:where(.view:not(.is-staged)) .home-connections) { padding-bottom: 0; }
.home-connections > .ctl-scroll {
  padding-bottom: calc(86px + max(24px, env(safe-area-inset-bottom)));
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 104px), transparent calc(100% - 62px));
  mask-image: linear-gradient(to bottom, #000 calc(100% - 104px), transparent calc(100% - 62px));
}
/* ===== Home at scale: Profile Switcher, folding groups, Jump to rail ===== */
.hm-bar { position: relative; z-index: 20; display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.hm-meta { flex: 1; min-width: 0; text-align: right; font-size: 13px; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-fold { flex: none; font-size: 13px; font-weight: 500; color: var(--muted); padding: 6px 0; }
.hm-fold:hover { color: var(--ink); }

.hm-menu { position: absolute; top: calc(100% + 8px); left: 0; z-index: 30; width: 300px; max-height: min(460px, 60vh); overflow-y: auto; padding: 8px; background: var(--card); border: 1px solid light-dark(rgba(77, 53, 51, .14), rgba(230, 216, 214, 0.14)); border-radius: 14px; box-shadow: 0 18px 40px -12px light-dark(rgba(63, 44, 42, .28), rgba(0, 0, 0, 0.6)), 0 2px 6px light-dark(rgba(63, 44, 42, .06), rgba(0, 0, 0, 0.23)); }
.hm-menu-q { width: 100%; margin: 0 0 6px; font-size: 13.5px; }
.hm-menu-k { padding: 10px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); }
.hm-menu-empty { padding: 10px; font-size: 13px; color: var(--soft); }
.hm-opt { display: flex; align-items: center; gap: 10px; width: 100%; height: 40px; padding: 0 10px; border-radius: 9px; font-size: 13.5px; color: var(--ink); text-align: left; }
.hm-opt:hover, .hm-opt:focus-visible { background: var(--tint2); outline: none; }
.hm-opt[aria-selected=true], .pf-opt[aria-checked=true] { background: var(--tint); }
.hm-opt-name { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm-opt-n { font-size: 12px; color: var(--soft); white-space: nowrap; }
.hm-opt-check { flex: none; color: var(--brown); visibility: hidden; }
.hm-opt[aria-selected=true] .hm-opt-check { visibility: visible; }
.hm-menu-foot { display: flex; align-items: center; gap: 6px; margin-top: 6px; padding: 8px 4px 2px; border-top: 1px dotted var(--hair); }
.hm-menu-a { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer; }
.hm-menu-a:hover, .hm-menu-a:focus-visible { background: var(--tint2); color: var(--ink); outline: none; }

/* Profile Switcher & Copy Connection bar */
.pf-bar { display: inline-flex; align-items: center; gap: 8px; flex: none; }
.pf-wrap { position: relative; flex: none; }
.pf-btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px 0 14px; border: 1px solid var(--hair); border-radius: 999px; background: var(--card); font-size: 13.5px; color: var(--ink); cursor: pointer; transition: border-color .15s, background .15s; }
.pf-btn:hover { border-color: light-dark(rgba(77, 53, 51, .34), rgba(230, 216, 214, 0.34)); }
.pf-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.pf-ic { display: inline-flex; align-items: center; justify-content: center; color: var(--muted); flex: none; }
.pf-k { color: var(--soft); }
.pf-name { font-weight: 600; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-chev { color: var(--muted); transition: transform .15s; flex: none; }
.pf-tile, .pf-sub { display: none; }
.pf-c { display: contents; }
.pf-btn[aria-expanded=true] .pf-chev { transform: rotate(180deg); }
.pf-connect { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border: 1px solid var(--hair); border-radius: 999px; background: var(--tint); font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; cursor: pointer; transition: background .15s, border-color .15s; }
.pf-connect:hover { background: light-dark(#EDE3DF, #322C2A); border-color: light-dark(rgba(77, 53, 51, .3), rgba(230, 216, 214, 0.3)); }
.pf-connect:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.pf-menu { left: auto; right: 0; width: 300px; }
.pf-check { flex: none; display: inline-flex; align-items: center; color: var(--brown); visibility: hidden; }
.pf-opt[aria-checked=true] .pf-check { visibility: visible; }
.pf-menu-manage { margin-left: auto; max-width: 165px; overflow: hidden; }
.pf-menu-manage span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Scoped profile banner, add hints & inline profile chips */
.pf-scope-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding: 10px 14px; border-radius: 12px; background: var(--tint2); font-size: 13px; line-height: 19px; color: var(--muted); }
.pf-scope-bar b { color: var(--ink); font-weight: 600; }
.pf-add-hint { margin: 0 0 12px; padding: 8px 12px; border-radius: 10px; background: var(--tint2); font-size: 13px; color: var(--muted); }
.pf-add-hint strong { color: var(--ink); font-weight: 600; }
.pf-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pf-chip { display: inline-flex; align-items: center; gap: 5px; min-height: 30px; max-width: 100%; padding: 4px 12px; border-radius: 15px; border: 1px solid var(--hair); background: var(--card); font-size: 13px; line-height: 20px; font-weight: 500; text-align: left; color: var(--muted); cursor: pointer; transition: background .14s, border-color .14s, color .14s; }
.pf-chip:hover { border-color: light-dark(rgba(77, 53, 51, .38), rgba(230, 216, 214, 0.38)); color: var(--ink); }
.pf-chip[aria-pressed=true] { background: var(--brown); border-color: var(--brown); color: var(--bg); }
.pf-chip:disabled { opacity: .55; cursor: progress; }
.pf-chip-ic { display: inline-flex; align-items: center; }
.pf-chip-ic:empty { display: none; }

/* Profile Manager dialog */
.pf-mgr-head-acts { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.cat-add-head:has(> .pf-mgr-head-acts) { flex-wrap: wrap; }
.cat-add-head > .pf-mgr-head-acts { flex: 0 1 auto; flex-wrap: wrap; }
.cat-add-head:has(> .pf-mgr-head-acts) h3 { flex: 1 1 190px; min-width: 0; overflow-wrap: anywhere; }
.pf-mgr-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; padding-bottom: 12px; border-bottom: 1px dotted var(--hair); }
.pf-mgr-tab { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--hair); background: transparent; font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer; }
.pf-mgr-tab:hover { border-color: light-dark(rgba(77, 53, 51, .35), rgba(230, 216, 214, 0.35)); color: var(--ink); }
.pf-mgr-tab[aria-selected=true] { background: var(--tint); border-color: light-dark(rgba(77, 53, 51, .28), rgba(230, 216, 214, 0.28)); color: var(--ink); font-weight: 600; }
.pf-mgr-counts { margin: 0 0 14px; font-size: 13px; color: var(--soft); }
.pf-mgr-sec { margin-top: 22px; padding-top: 18px; border-top: 1px dotted var(--hair); }
.pf-mgr-sec h4 { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink); }
.pf-mgr-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.pf-key-list { margin: 0; padding: 0; list-style: none; }
.pf-key-list > li + li { border-top: 1px dotted var(--hair); }
.pf-key-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-radius: 10px; text-align: left; cursor: pointer; transition: background .12s; }
.pf-key-row:hover { background: var(--tint2); }
.pf-key-row.is-off .pf-key-n { opacity: .6; }
.pf-key-row .home-ic.pf-key-av { width: 30px; height: 30px; border-radius: 8px; font-size: 12px; }
.pf-key-row .home-ic.mark.logo.pf-key-av img { width: 18px; height: 18px; }
.pf-key-c { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pf-key-n { font-size: 13.5px; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-key-st { font-size: 12px; color: var(--soft); }
.pf-key-st.is-ok { color: var(--ok); }
.pf-mgr-danger h4 { color: var(--no); margin-bottom: 6px; }
.pf-mgr-confirm { margin-top: 12px; }
.pf-mgr-confirm p { margin: 0; }
.st-rule-acts { display: inline-flex; align-items: center; gap: 8px; flex: none; flex-wrap: wrap; }

.hm > .hm-body { flex: 1 1 auto; min-height: 0; position: relative; display: flex; flex-direction: column; margin-top: 8px; }
.hm-body > .ctl-scroll { position: relative; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin-right: -16px; padding-right: 16px; padding-bottom: calc(86px + max(24px, env(safe-area-inset-bottom))); -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 104px), transparent calc(100% - 62px)); mask-image: linear-gradient(to bottom, #000 calc(100% - 104px), transparent calc(100% - 62px)); }
.hm-group.is-open + .hm-group, .hm-group + .hm-group.is-open { margin-top: 22px; }
.hm-head { display: flex; align-items: center; gap: 10px; width: 100%; height: 46px; padding: 0 2px; border-bottom: 1px dotted light-dark(rgba(77, 53, 51, .22), rgba(230, 216, 214, 0.22)); text-align: left; cursor: pointer; }
.hm-head:disabled { cursor: default; opacity: 1; }
.hm-head:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
.hm-chev { flex: none; color: var(--muted); transition: transform .15s; }
.hm-head[aria-expanded=false] .hm-chev { transform: rotate(-90deg); }
.hm-head-l { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm-head[aria-expanded=false] .hm-head-l { font-weight: 500; color: var(--muted); }
.hm-head:hover .hm-head-l { color: var(--ink); }
.hm-head-n { flex: none; font-size: 13px; color: var(--soft); }
.hm-head.is-warn .hm-head-l, .hm-head.is-warn .hm-chev, .hm-head.is-warn .hm-head-n { color: var(--warn); }
.hm-note { padding: 10px 2px 0; font-size: 13px; line-height: 19px; color: var(--soft); }
.hm-note a { color: var(--muted); }

/* The side menu is one box of a fixed height, centred in the side column, the same on every tab
   (alignSideColumn in app.js sets its top and, in a short window, a smaller height). The page's
   name stays at the top; the rows scroll under it in .hm-rail-list. An edge of the list with more
   rows past it fades (data-more), and a small button counts the rows below (markSideScroll). */
@property --rail-fade-up { syntax: "<length>"; inherits: false; initial-value: 0px; }
@property --rail-fade-down { syntax: "<length>"; inherits: false; initial-value: 0px; }
.hm-rail { display: none; flex-direction: column; position: absolute; top: 0; right: calc(100% + 32px); width: 200px; height: 440px; }
.hm-rail-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; padding: 8px 0;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 var(--rail-fade-up), #000 calc(100% - var(--rail-fade-down)), transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 var(--rail-fade-up), #000 calc(100% - var(--rail-fade-down)), transparent);
  transition: --rail-fade-up .15s ease, --rail-fade-down .15s ease; }
.hm-rail-list::-webkit-scrollbar { display: none; }
.hm-rail[data-more~=up] > .hm-rail-list { --rail-fade-up: 24px; }
.hm-rail[data-more~=down] > .hm-rail-list { --rail-fade-down: 78px; padding-bottom: 52px; }
.hm-rail-k { display: flex; align-items: baseline; gap: 8px; margin: 0 10px 6px; padding: 0 0 8px; border-bottom: 1px solid var(--hair); font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .01em; color: var(--muted); }
.hm-rail-k > span { flex: 1; }
.hm-rail-a { font-size: 12px; font-weight: 400; color: var(--soft); text-decoration: underline; text-decoration-color: var(--hair); text-underline-offset: 3px; }
.hm-rail-a:hover { color: var(--ink); }
.hm-rail-a[hidden] { display: none; }
/* The page's name: its text starts where the row labels start. The rows' thin line starts below
   it, at the top of the list; the name itself has no line beside it. */
.hm-rail > .hm-rail-k { flex: none; margin: 0 0 0 10px; padding: 1px 14px 9px 11px; border-bottom: 0; border-left: 1px solid transparent; font-family: var(--serif); font-size: 17px; line-height: 22px; font-weight: 500; letter-spacing: 0; color: var(--ink); }
.hm-rail > .hm-rail-k + .hm-rail-list { padding-top: 0; }
.hm-rail-k > .hm-rail-kn { flex: none; font-family: var(--sans); font-size: 12px; line-height: 16px; font-weight: 400; letter-spacing: -.15px; color: var(--muted); }
/* A label over a group of rows in the list. */
.hm-rail-list > .hm-rail-k { margin: 0 0 0 10px; padding: 6px 14px 4px 11px; border-bottom: 0; border-left: 1px solid var(--hair); }
.hm-rail-list > .hm-jump ~ .hm-rail-k { padding-top: 20px; }
.hm-rail-next { position: absolute; left: 10px; bottom: 0; display: flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px 0 8px; border-radius: 999px; background: light-dark(#fff, #241F1E); box-shadow: 0 0 0 1px light-dark(rgba(77, 53, 51, .14), rgba(230, 216, 214, 0.14)), 0 2px 6px light-dark(rgba(77, 53, 51, .08), rgba(0, 0, 0, 0.28)); font-size: 12px; color: var(--muted); }
.hm-rail-next:hover { color: var(--ink); }
.hm-rail-next[hidden] { display: none; }
.hm-jump { position: relative; display: flex; align-items: center; gap: 8px; width: 100%; height: 30px; padding: 0 10px; border-radius: 8px; font-size: 13.5px; color: var(--muted); text-align: left; }
.hm-jump > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm-jump-n { font-size: 12px; color: var(--soft); }
.hm-jump:hover { color: var(--ink); background: light-dark(rgba(77, 53, 51, .035), rgba(230, 216, 214, 0.035)); }
/* You are here: the tint and a short brown bar, the same on every tab. */
.hm-jump[aria-current=true] { background: var(--tint); color: var(--ink); font-weight: 500; }
.hm-jump[aria-current=true]::after { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--brown); }
.hm-jump[aria-current=true] .hm-jump-n { color: var(--muted); }
.hm-jump.is-warn, .hm-jump.is-warn .hm-jump-n { color: var(--warn); }
.hm-jump.is-empty:not([aria-current=true]), .hm-jump.is-empty:not([aria-current=true]) .hm-jump-n { color: var(--soft); }
/* Memory: each kind's dot is its colour on the map; All memories gets a hollow one so labels line up. */
.hm-jump[data-mark]::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; box-sizing: border-box; }
.hm-jump[data-mark=all]::before { border: 1.5px solid var(--muted); }
.hm-jump[data-mark=global]::before { background: light-dark(#8A5A44, #CF9F89); }
.hm-jump[data-mark=preference]::before { background: light-dark(#4B5E86, #A1B5DD); }
.hm-jump[data-mark=project]::before { background: light-dark(#3F7556, #87B89A); }
.hm-jump[data-mark=fact]::before { background: light-dark(#B07A2A, #B2823E); }
/* Memory's built-in branches: the centre ring of the map, and pins that wait for you. */
.hm-jump[data-mark=startup]::before { border: 1.5px dashed var(--muted); }
.hm-jump[data-mark=approval]::before { border: 1.5px solid var(--warn); }
/* In the side menu the rows sit on a thin line; the selected row's part of the line is brown. */
.hm-rail-list > .hm-jump { width: calc(100% - 10px); margin-left: 10px; padding: 0 14px 0 11px; border-left: 1px solid var(--hair); border-radius: 0 8px 8px 0; }
.hm-rail-list > .hm-jump[aria-current=true] { background: transparent; }
.hm-rail-list > .hm-jump[aria-current=true]:hover { background: light-dark(rgba(77, 53, 51, .035), rgba(230, 216, 214, 0.035)); }
.hm-rail-list > .hm-jump[aria-current=true]::after { left: -1px; top: 0; bottom: 0; border-radius: 1px; }
/* The rail needs about 248px left of the 720px column. Where the window is too narrow to center
   both, the column slides right just enough to make room; from about 1180px wide it is centered again. */
@media (min-width: 980px) {
  .hm-rail { display: flex; }
  .wrap:has(:where(.view:not(.is-staged)) .hm-rail) > main { --hm-shift: max(0px, calc(248px - (100vw - 760px) / 2)); margin-left: var(--hm-shift); margin-right: calc(-1 * min(var(--hm-shift), (100vw - 760px) / 2 - 20px)); }
}
@media (max-width: 640px) {
  .hm-meta { display: none; }
  .hm-bar { gap: 10px; }
  .lib-top { flex-wrap: wrap; align-items: flex-start; gap: 12px; }
  .pf-bar { flex-wrap: wrap; }
  .pf-k { display: none; }
  .pf-btn { padding-left: 12px; }
  .pf-name { max-width: 120px; }
  .pf-menu { left: 0; right: auto; width: min(300px, calc(100vw - 32px)); }
  .hm-fold { display: none; }
  .hm-menu { width: min(300px, calc(100vw - 32px)); }
}

/* Connection logos: the connection's own logo, or a letter tile, with a corner badge for where it runs. */
.conn-logo { position: relative; flex: none; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; }
.conn-logo > img, .conn-logo-letter { width: 32px; height: 32px; border-radius: 8px; }
.conn-logo > img { display: block; object-fit: contain; background: #fff; box-shadow: inset 0 0 0 1px var(--card-line); padding: 3px; }
.conn-logo-letter { display: inline-flex; align-items: center; justify-content: center; background: var(--tile, light-dark(#8A5A44, #CF9F89)); color: light-dark(#fff, #241F1E); font-size: 15px; font-weight: 600; line-height: 1; }
.conn-tile-0 { --tile: light-dark(#8A5A44, #CF9F89); }
.conn-tile-1 { --tile: light-dark(#4B5E86, #A1B5DD); }
.conn-tile-2 { --tile: light-dark(#3F7556, #87B89A); }
.conn-tile-3 { --tile: light-dark(#9A6B2F, #BF935F); }
.conn-tile-4 { --tile: light-dark(#7A4E6E, #D1A4C4); }
.conn-tile-5 { --tile: light-dark(#4E6E6A, #95B3AF); }
.conn-tile-6 { --tile: light-dark(#8C4A3C, #E4A091); }
.conn-tile-7 { --tile: light-dark(#5B5B84, #AEAFD8); }
.conn-logo-badge { position: absolute; right: -1px; bottom: -1px; width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--bg); color: var(--muted); box-shadow: 0 0 0 1px var(--line); }
.conn-logo-badge svg { width: 11px; height: 11px; display: block; }
.ctl-row.is-off .conn-logo { opacity: .55; }
.conn-card .connection-summary .conn-logo { width: 32px; height: 32px; }
.conn-card .connection-summary .conn-logo > img, .conn-card .connection-summary .conn-logo-letter { width: 26px; height: 26px; border-radius: 7px; font-size: 13px; }
.conn-card .connection-summary .conn-logo-badge { width: 15px; height: 15px; }
.conn-card .connection-summary .conn-logo-badge svg { width: 9px; height: 9px; }
.logo-dialog-now { display: flex; align-items: center; gap: 12px; margin: 4px 0 18px; font-size: 14px; color: var(--muted); }
.logo-dialog .hint { margin: -4px 0 0; font-size: 13px; color: var(--soft); }
.logo-dialog .acts { flex-wrap: wrap; gap: 8px; }

/* Jump to: keep the counts off the rail's edge. */
.hm-jump { padding: 0 14px 0 10px; }
.hm-jump-n { flex: none; min-width: 2ch; text-align: right; font-variant-numeric: tabular-nums; }

/* Home: Needs you approvals, Activity, Your Loop, and skills inside each category.
   Every row keeps the 40px icon lane connection logos use, so the lists line up. */
.hm-lane { flex: none; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.hm-lane.is-warn { color: var(--warn); }
.hm-acts { flex: none; display: flex; align-items: center; gap: 8px; }
/* What the owner decides about is never cut. */
.hm-libpage .ctl-row.hm-need .t { white-space: normal; overflow: visible; overflow-wrap: anywhere; }
/* Four actions do not fit beside the request: they go on their own line under it. */
.ctl-row.hm-need.is-wide { flex-wrap: wrap; }
.ctl-row.hm-need.is-wide > .txt { flex: 1 1 calc(100% - 54px); }
.ctl-row.hm-need.is-wide > .hm-acts { margin-left: 54px; flex: 0 1 auto; flex-wrap: wrap; max-width: calc(100% - 54px); }
.ctl-row.hm-need.is-wide > .hm-acts .btn { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.hm-need-more { margin-top: 6px; font-size: 13px; color: var(--muted); }
.hm-need-more summary { display: inline-block; cursor: pointer; font-weight: 500; list-style: none; }
.hm-need-more summary::-webkit-details-marker { display: none; }
.hm-need-more summary:hover { color: var(--ink); }
.hm-need-more[open] summary { margin-bottom: 6px; }
.hm-need-more p { margin: 0 0 6px; line-height: 19px; }

.hm-head-static { cursor: default; padding-left: 2px; }
.hm-head-a { flex: none; font-size: 13px; font-weight: 500; color: var(--muted); text-decoration: none; }
.hm-head-a:hover { color: var(--ink); text-decoration: underline; }
.hm-feed { margin: 0; padding: 6px 0 2px; }
.hm-ev { display: flex; align-items: center; gap: 14px; min-height: 40px; font-size: 13.5px; color: var(--muted); }
.hm-ev-lane { flex: none; width: 40px; display: inline-flex; justify-content: center; }
.hm-ev-t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-ev-t b { font-weight: 600; color: var(--ink); }
.hm-ev.is-failed .hm-ev-t { color: var(--no); }
.hm-ev-at { flex: none; font-size: 12px; color: var(--soft); font-variant-numeric: tabular-nums; }

.hm-hub { color: inherit; text-decoration: none; }
.hm-hub .t, .hm-hub .ctl-st { display: block; }
.hm-hub:hover .t { text-decoration: underline; text-decoration-color: light-dark(rgba(77, 53, 51, .3), rgba(230, 216, 214, 0.3)); text-underline-offset: 3px; }
.hm-hub-m { flex: none; font-size: 13px; color: var(--muted); white-space: nowrap; }
.hm-hub-m.is-warn { color: var(--warn); }
.hm-go { flex: none; display: inline-flex; color: var(--soft); }

.hm-lib { display: flex; align-items: center; gap: 12px; margin: 40px 0 8px; }
.hm-lib .hm-lib-t { flex: 1; margin: 0; font-size: 17px; font-weight: 600; color: var(--ink); }
/* A section's own action ends on the same edge as the rows below it. */
.hm-lib > .btn.ghost { margin-right: -12px; }
.seg.hm-kinds { flex: none; border-radius: 999px; }
.hm-kinds .seg-btn { border-radius: 999px; padding: 6px 14px; font-size: 13px; }
.hm-kinds .seg-btn span { margin-left: 4px; font-weight: 400; color: var(--soft); }
.hm-kinds .seg-btn:disabled { opacity: .45; cursor: default; }
.hm-kinds .seg-btn:disabled:hover { color: var(--muted); }
.hm-jump.is-lib-first { margin-top: 12px; }

.hm-skill .hm-lane { color: var(--soft); }
.hm-skill.is-member { padding-left: 28px; }
.hm-fam { text-align: left; }
.hm-fam:hover .t { text-decoration: underline; text-decoration-color: light-dark(rgba(77, 53, 51, .3), rgba(230, 216, 214, 0.3)); text-underline-offset: 3px; }
.hm-fam-n { margin-left: 6px; font-size: 12px; font-weight: 500; color: var(--soft); }
.hm-fam-chev { flex: none; display: inline-flex; color: var(--muted); }
.hm-fam-chev .hm-chev { transform: rotate(-90deg); }
.hm-fam[aria-expanded=true] + .hm-fam-chev .hm-chev { transform: none; }
.hm-more { display: flex; align-items: center; width: 100%; min-height: 44px; padding: 4px 4px 4px 58px; font-size: 13px; font-weight: 500; color: var(--muted); text-decoration: none; text-align: left; }
.hm-more:hover { color: var(--ink); }

@media (max-width: 640px) {
  .hm-acts .btn { padding-left: 10px; padding-right: 10px; }
  .hm-need { flex-wrap: wrap; }
  .hm-libpage .ctl-row.hm-need > .txt { flex: 1 1 calc(100% - 54px); }
  .hm-libpage .ctl-row.hm-need > .hm-acts { margin-left: 43px; flex: 0 1 auto; flex-wrap: wrap; max-width: calc(100% - 43px); }
  .hm-hub-m { display: none; }
  .hm-lib { flex-wrap: wrap; }
  /* A section name stays on one line; its filter drops the counts to leave room for it. */
  .hm-lib .hm-lib-t { white-space: nowrap; }
  .hm-kinds .seg-btn span { display: none; }
}

/* Home rows: a soft rounded tint on hover that reaches past the text edges without moving anything. */
.hm .list > li > .ctl-row, .hm-ev { position: relative; isolation: isolate; }
.hm .list > li > .ctl-row::before, .hm-ev::before {
  content: ''; position: absolute; inset: 1px -12px; z-index: -1;
  border-radius: 10px; background: light-dark(rgba(77, 53, 51, .06), rgba(230, 216, 214, 0.06)); opacity: 0; transition: opacity .12s;
}
.hm .list > li > .ctl-row:hover::before, .hm-ev:hover::before,
.hm .list > li > .ctl-row:focus-within::before { opacity: 1; }
@media (max-width: 640px) {
  .hm .list > li > .ctl-row::before, .hm-ev::before { inset: 1px -8px; }
}

/* Header Settings: plain text with a quiet underline, so it reads as a link. */
.toplink {
  font-size: 13.5px; font-weight: 500; color: var(--muted);
  text-decoration: underline; text-decoration-color: light-dark(rgba(77, 53, 51, .28), rgba(230, 216, 214, 0.28));
  text-decoration-thickness: 1px; text-underline-offset: 4px;
  transition: color .15s, text-decoration-color .15s;
}
.toplink:hover, .toplink[aria-current] { color: var(--ink); text-decoration-color: currentColor; }

/* ---------- Settings popup ----------
   A centered popup over the current page. A menu on the left splits it into sections so
   none of them scrolls. Opens with a short fade and rise; closes the same way. */
html.st-lock, html.st-lock body { overflow: hidden; }
.st-root { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; --st-dot: var(--bg); }
.st-veil { position: absolute; inset: 0; background: light-dark(rgba(63, 44, 42, .26), rgba(241, 229, 228, 0.26)); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); opacity: 0; transition: opacity .18s ease-out; }
.st-sheet {
  position: relative; display: flex; width: min(780px, calc(100vw - 32px)); height: 560px; max-height: calc(100vh - 32px);
  background: var(--bg); border-radius: 18px; overflow: hidden;
  box-shadow: 0 24px 60px light-dark(rgba(63, 44, 42, .22), rgba(0, 0, 0, 0.6)), 0 2px 8px light-dark(rgba(63, 44, 42, .08), rgba(0, 0, 0, 0.28));
  opacity: 0; transform: translateY(10px) scale(.98);
  transition: opacity .2s ease-out, transform .22s cubic-bezier(.2, .8, .2, 1);
}
.st-root.is-open .st-veil { opacity: 1; }
.st-root.is-open .st-sheet { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .st-veil, .st-sheet { transition: none; transform: none; }
}

.st-side { width: 210px; flex: none; display: flex; flex-direction: column; padding: 22px 14px 16px; border-right: 1px dotted light-dark(rgba(77, 53, 51, .16), rgba(230, 216, 214, 0.16)); }
.st-ttl { margin: 0; padding: 0 10px 16px; font-family: var(--serif); font-size: 22px; font-weight: 500; line-height: 1.2; color: var(--ink); display: block; }
.st-tabs { display: flex; flex-direction: column; gap: 2px; }
.st-tab { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: 9px; font-size: 13.5px; color: light-dark(rgba(77, 53, 51, .7), rgba(230, 216, 214, 0.7)); text-align: left; }
.st-tab svg { flex: none; }
.st-tab:hover { color: var(--ink); background: light-dark(rgba(77, 53, 51, .04), rgba(230, 216, 214, 0.04)); }
.st-tab[aria-selected=true] { background: var(--tint); color: var(--ink); font-weight: 500; --st-dot: var(--tint); }
.st-foot { margin: auto 0 0; padding: 0 10px; font-size: 12px; color: light-dark(rgba(77, 53, 51, .5), rgba(230, 216, 214, 0.5)); }

.st-body { flex: 1; min-width: 0; position: relative; overflow-y: auto; }
.st-pane { padding: 22px 28px 18px; }
.st-pane[hidden] { display: none; }
.st-wait { display: grid; place-items: center; height: 100%; }
.st-x { position: absolute; right: 14px; top: 14px; width: 32px; height: 32px; border-radius: 999px; display: grid; place-items: center; color: light-dark(rgba(77, 53, 51, .6), rgba(230, 216, 214, 0.6)); z-index: 1; }
.st-x:hover { background: var(--tint); color: var(--ink); }

.st-h { margin: 0; font-size: 17px; line-height: 22px; font-weight: 600; color: var(--ink); }
.st-sub { margin: 3px 0 0; padding-right: 32px; font-size: 13px; line-height: 18px; color: light-dark(rgba(77, 53, 51, .65), rgba(230, 216, 214, 0.65)); }
.st-narrow { max-width: 440px; }
.st-grp { margin: 14px 0 2px; font-size: 12.5px; line-height: 16px; font-weight: 600; color: light-dark(rgba(77, 53, 51, .55), rgba(230, 216, 214, 0.55)); }
.st-rt { display: block; font-size: 13.5px; line-height: 18px; color: var(--ink); }
.st-rs { display: block; margin: 1px 0 0; font-size: 12.5px; line-height: 16px; color: light-dark(rgba(77, 53, 51, .6), rgba(230, 216, 214, 0.6)); }
.st-rs a { color: inherit; text-decoration: underline; text-decoration-color: light-dark(rgba(77, 53, 51, .3), rgba(230, 216, 214, 0.3)); text-underline-offset: 3px; }
.st-rs a:hover { color: var(--ink); }
.st-after { margin-top: 8px; }
.st-before { margin: 0 0 10px; }
.st-note { font-size: 12.5px; color: light-dark(rgba(77, 53, 51, .55), rgba(230, 216, 214, 0.55)); }

.st-rule { display: flex; align-items: center; gap: 16px; min-height: 44px; padding: 4px 0; border-bottom: 1px dotted light-dark(rgba(77, 53, 51, .14), rgba(230, 216, 214, 0.14)); }
.st-rules > .st-rule:last-child, .st-grp + .st-rule { border-bottom: 0; }
.st-rule-c { flex: 1; min-width: 0; }

.st-seg { display: inline-flex; flex: none; gap: 2px; padding: 3px; border-radius: 999px; background: var(--tint); }
.st-seg button { padding: 3px 11px; line-height: 18px; border-radius: 999px; font-size: 12.5px; font-weight: 500; color: light-dark(rgba(77, 53, 51, .62), rgba(230, 216, 214, 0.62)); transition: background .15s, color .15s, box-shadow .15s; }
.st-seg button:hover { color: var(--ink); }
.st-seg button[aria-pressed=true] { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px light-dark(rgba(77, 53, 51, .12), rgba(0, 0, 0, 0.38)); }
.st-seg-lg button { padding: 5px 14px; font-size: 13px; }

.st-opts { margin-top: 6px; }
.st-opt { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 11px 0; text-align: left; border-bottom: 1px dotted light-dark(rgba(77, 53, 51, .14), rgba(230, 216, 214, 0.14)); }
.st-opt:last-child { border-bottom: 0; }
.st-opt-c { flex: 1; min-width: 0; }
.st-radio { width: 18px; height: 18px; flex: none; margin-top: 1px; border-radius: 999px; border: 1.5px solid light-dark(rgba(77, 53, 51, .35), rgba(230, 216, 214, 0.35)); transition: border .15s; }
.st-opt:hover .st-radio { border-color: light-dark(rgba(77, 53, 51, .6), rgba(230, 216, 214, 0.6)); }
.st-opt[aria-checked=true] .st-radio { border: 5px solid var(--brown); }

.st-check { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; cursor: pointer; }
.st-check input { margin-top: 3px; accent-color: var(--brown); }

.st-form { max-width: 360px; margin-top: 8px; }
.st-field { display: block; margin-top: 16px; }
.st-lbl { display: block; margin-bottom: 6px; font-size: 12.5px; font-weight: 500; color: light-dark(rgba(77, 53, 51, .7), rgba(230, 216, 214, 0.7)); }
.st-field input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid light-dark(rgba(77, 53, 51, .16), rgba(230, 216, 214, 0.16)); border-radius: 10px; background: var(--card); font: inherit; font-size: 13.5px; color: var(--ink); }
.st-field input:focus { outline: none; border-color: light-dark(rgba(77, 53, 51, .45), rgba(230, 216, 214, 0.45)); box-shadow: 0 0 0 3px light-dark(rgba(77, 53, 51, .08), rgba(230, 216, 214, 0.08)); }
.st-acts { margin-top: 20px; }

.st-acct { display: flex; align-items: center; gap: 14px; margin-top: 24px; padding: 14px 0; border-top: 1px dotted light-dark(rgba(77, 53, 51, .14), rgba(230, 216, 214, 0.14)); border-bottom: 1px dotted light-dark(rgba(77, 53, 51, .14), rgba(230, 216, 214, 0.14)); }
.st-plan-bar { margin-top: 14px; }
.st-plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin-top: 10px; }
.st-plan-card { padding: 12px 14px; border: 1px solid light-dark(rgba(77, 53, 51, .14), rgba(230, 216, 214, 0.14)); border-radius: 10px; background: light-dark(rgba(255, 255, 255, .45), rgba(36, 31, 30, 0.45)); }
.st-plan-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.st-plan-price { font-size: 12px; font-weight: 600; color: light-dark(rgba(77, 53, 51, .68), rgba(230, 216, 214, 0.68)); white-space: nowrap; }
.st-av { width: 40px; height: 40px; flex: none; border-radius: 999px; background: var(--tint); display: grid; place-items: center; color: var(--ink); }

/* Phones: the section menu becomes a row of tabs above the content. */
@media (max-width: 640px) {
  .st-root { padding: 10px; align-items: end; }
  .st-sheet { flex-direction: column; width: calc(100vw - 20px); height: min(720px, calc(100vh - 20px)); border-radius: 18px; }
  .st-side { width: auto; padding: 18px 14px 8px; border-right: 0; border-bottom: 1px dotted light-dark(rgba(77, 53, 51, .16), rgba(230, 216, 214, 0.16)); }
  .st-ttl { padding: 0 6px 10px; font-size: 20px; }
  .st-tabs { flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .st-tabs::-webkit-scrollbar { display: none; }
  .st-tab { flex: none; height: 32px; padding: 0 10px; }
  .st-tab svg { display: none; }
  .st-foot { display: none; }
  .st-pane { padding: 18px 18px 16px; }
  .st-x { top: 12px; right: 10px; }
}

/* ===========================
   Home agents, Library page, agent popups
   =========================== */
/* Home: agents are rows like the rest; a row opens that agent's popup. */
.hm-agent { width: 100%; text-align: left; color: inherit; cursor: pointer; }
.hm-agent .txt { display: block; }
.hm-agent .t, .hm-agent .ctl-st { display: block; }
.hm-agent:hover .t { text-decoration: underline; text-decoration-color: light-dark(rgba(77, 53, 51, .3), rgba(230, 216, 214, 0.3)); text-underline-offset: 3px; }
.hm-agent:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 8px; }
.hm-agent .ctl-st.is-ok { color: var(--ok); }
.hm-agent.is-off .t, .hm-agent.is-off .home-ic { opacity: .55; }
.hm-agent-add .t { color: var(--muted); }
.hm-agent-add:hover .t { color: var(--ink); }
.hm-inline { padding: 0; font: inherit; font-weight: 500; color: var(--ink); text-decoration: underline; text-decoration-color: light-dark(rgba(77, 53, 51, .3), rgba(230, 216, 214, 0.3)); text-underline-offset: 3px; cursor: pointer; }

/* Page header shared by Home, Memory and Vault: title, one line, Profile Switcher on the right. */
.lib-top { position: relative; z-index: 20; display: flex; align-items: flex-end; gap: 16px; margin-top: 28px; }
.lib-top-c { flex: 1; min-width: 0; }
.lib-t { margin: 0; font-family: var(--serif); font-size: 34px; font-weight: 500; line-height: 1.1; color: var(--ink); }
.lib-sub { margin: 6px 0 0; font-size: 13.5px; color: var(--muted); }
.lib-top-r { flex: none; }
/* With the rail beside the list, the bar under search has nothing left to show. */
@media (min-width: 980px) {
  .hm-libpage .hm-bar:not(:has(.hm-fold)) { display: none; }
}
.hm-libpage > .ctl-search { margin-top: 20px; }
.hm-libpage .ctl-scroll > .hm-lib:first-child { margin-top: 18px; }

/* Agent popup: the Settings sheet with the agent in the side column. */
.ap-in { display: contents; }
.ap-who { display: flex; align-items: center; gap: 10px; padding: 0 6px 18px; }
.ap-who .home-ic.ap-mark { width: 36px; height: 36px; border-radius: 11px; }
.ap-who .home-ic.mark.logo.ap-mark img { width: 24px; height: 24px; }
.ap-who-c { min-width: 0; }
.ap-name { margin: 0; font-family: var(--serif); font-size: 17px; font-weight: 500; line-height: 1.2; color: var(--ink); overflow-wrap: anywhere; }
.ap-st { margin-top: 2px; font-size: 12px; color: var(--soft); }
.ap-st.is-ok { color: var(--ok); }
.ap-st i { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: var(--ok); vertical-align: 1px; }
.ap-side-foot { margin-top: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 0 10px; }
.ap-side-a { padding: 0; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.ap-side-a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.ap-side-a.is-no { color: var(--no); }
.ap-msg { flex: 1; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 40px; text-align: center; color: var(--muted); font-size: 14px; }
.ap-after { margin-top: 10px; }
.ap-after a { color: inherit; }

.ap-feed { margin-top: 14px; }
.ap-ev { display: flex; align-items: center; gap: 12px; min-height: 38px; border-bottom: 1px dotted light-dark(rgba(77, 53, 51, .12), rgba(230, 216, 214, 0.12)); font-size: 13px; color: var(--ink); }
.ap-ev:last-child { border-bottom: 0; }
.ap-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--ok); }
.ap-dot.is-no { background: var(--no); }
.ap-ev-t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-ev-t em { font-style: normal; color: light-dark(rgba(77, 53, 51, .6), rgba(230, 216, 214, 0.6)); }
.ap-ev-at { flex: none; font-size: 12.5px; color: light-dark(rgba(77, 53, 51, .55), rgba(230, 216, 214, 0.55)); white-space: nowrap; }
.ap-link { margin-top: 10px; padding: 0; font-size: 13px; color: var(--muted); text-decoration: underline; text-decoration-color: light-dark(rgba(77, 53, 51, .3), rgba(230, 216, 214, 0.3)); text-underline-offset: 3px; cursor: pointer; }
.ap-link:hover { color: var(--ink); }
.ap-empty { margin: 18px 0 0; font-size: 13.5px; line-height: 20px; color: var(--muted); }

/* "If the app has its own tools": a group that opens. Its heading is a flex row, so it gets its own chevron. */
.ap-mounts > summary.st-grp { cursor: pointer; list-style: none; }
.ap-mounts > summary.st-grp::-webkit-details-marker { display: none; }
.ap-mounts > summary.st-grp::after { content: '›'; display: inline-block; margin-left: 8px; transition: transform .15s ease; }
.ap-mounts[open] > summary.st-grp::after { transform: rotate(90deg); }
.ap-mounts > summary.st-grp:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; border-radius: 6px; }
.ap-mounts .st-rule > .ap-select { flex: none; width: auto; min-width: 130px; padding-right: 30px; }
@media (prefers-reduced-motion: reduce) { .ap-mounts > summary.st-grp::after { transition: none; } }
.ap-select { height: 30px; padding: 0 10px; border: 1px solid light-dark(rgba(77, 53, 51, .18), rgba(230, 216, 214, 0.18)); border-radius: 999px; background: var(--card); font: inherit; font-size: 12.5px; color: var(--ink); }
.ap-secrets { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 20px; margin-top: 6px; }
.ap-secret { display: flex; align-items: center; gap: 10px; min-height: 30px; font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 12.5px; color: var(--ink); cursor: pointer; min-width: 0; }
.ap-secret span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-secret input { flex: none; width: 16px; height: 16px; margin: 0; accent-color: var(--brown); }

.ap-tabs { margin-top: 18px; }
.ap-code { position: relative; margin-top: 12px; border-radius: 12px; background: light-dark(#3F2C2A, #110E0D); }
.ap-code pre { margin: 0; padding: 16px 84px 16px 16px; max-height: 280px; overflow: auto; font: 12.5px/1.6 ui-monospace, 'SF Mono', Menlo, monospace; color: #F3EAE7; white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; }
.ap-copy { position: absolute; right: 10px; top: 10px; height: 28px; padding: 0 12px; border-radius: 999px; background: rgba(255, 255, 255, .14); color: #fff; font-size: 12.5px; font-weight: 500; cursor: pointer; }
.ap-copy:hover { background: rgba(255, 255, 255, .22); }
.ap-warn { margin-top: 10px; }
.ap-key { display: flex; align-items: center; gap: 14px; margin-top: 22px; padding-top: 14px; border-top: 1px dotted light-dark(rgba(77, 53, 51, .14), rgba(230, 216, 214, 0.14)); }
.ap-wait-sm { height: 120px; }

/* Connect an agent: one column, steps on top, buttons pinned at the bottom. */
.ap-flow .ap-in { display: flex; flex: 1; min-width: 0; min-height: 0; }
.ap-flow-in { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; }
.ap-flow-top { padding: 24px 28px 0; }
.ap-steps { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0 40px 0 0; font-size: 12px; color: light-dark(rgba(77, 53, 51, .55), rgba(230, 216, 214, 0.55)); }
.ap-steps li + li::before { content: '·'; margin-right: 6px; }
.ap-steps li[aria-current=step] { color: var(--ink); font-weight: 500; }
.ap-flow-t { margin: 8px 0 0; font-family: var(--serif); font-size: 26px; font-weight: 500; line-height: 1.15; color: var(--ink); }
.ap-flow-body { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 28px 16px; }
.ap-flow-foot { display: flex; align-items: center; gap: 10px; padding: 14px 28px 18px; border-top: 1px dotted light-dark(rgba(77, 53, 51, .14), rgba(230, 216, 214, 0.14)); }
.ap-grow { flex: 1; }
.ap-back { padding-left: 0; border-color: transparent; }
.ap-lbl { margin: 0 0 8px; font-size: 12.5px; font-weight: 500; color: light-dark(rgba(77, 53, 51, .55), rgba(230, 216, 214, 0.55)); }
.ap-grid + .ap-lbl { margin-top: 20px; }
.ap-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.ap-app { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 12px; border: 1px solid light-dark(rgba(77, 53, 51, .12), rgba(230, 216, 214, 0.12)); border-radius: 12px; text-align: left; color: var(--ink); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.ap-app:hover { border-color: light-dark(rgba(77, 53, 51, .3), rgba(230, 216, 214, 0.3)); }
.ap-app[aria-pressed=true] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.ap-app:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.ap-app .home-ic.ap-mark-sm { width: 30px; height: 30px; border-radius: 9px; font-size: 12px; }
.ap-app .home-ic.mark.logo.ap-mark-sm img { width: 22px; height: 22px; }
.ap-app-c { flex: 1; min-width: 0; }
.ap-app-n { display: block; font-size: 14px; font-weight: 500; }
.ap-app-d { display: block; font-size: 12px; color: light-dark(rgba(77, 53, 51, .55), rgba(230, 216, 214, 0.55)); }
.ap-name-f { margin-top: 0; }
/* One-screen Connect: the sheet hugs the command, no footer until the agent checks in. */
.st-sheet.ap-quick { width: min(640px, calc(100vw - 32px)); height: auto; max-height: min(560px, calc(100vh - 48px)); }
.ap-quick .ap-flow-body { padding-bottom: 24px; }
.ap-quick .ap-waitrow { margin-top: 12px; }
.ap-flow-rules { margin-top: 10px; }
.ap-flow-rules .st-rule { min-height: 56px; }
.ap-waitrow { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--tint); font-size: 13.5px; color: var(--ink); }
.ap-pulse { width: 10px; height: 10px; flex: none; border-radius: 50%; background: light-dark(#C9A77A, #7F633D); box-shadow: 0 0 0 4px light-dark(rgba(201, 167, 122, .25), rgba(127, 99, 61, 0.25)); animation: ap-pulse 1.6s ease-in-out infinite; }
.ap-waitrow.is-ok .ap-pulse { background: var(--ok); box-shadow: 0 0 0 4px light-dark(rgba(63, 117, 86, .18), rgba(135, 184, 154, 0.18)); animation: none; }
@keyframes ap-pulse { 50% { box-shadow: 0 0 0 7px light-dark(rgba(201, 167, 122, .08), rgba(127, 99, 61, 0.08)); } }
@media (prefers-reduced-motion: reduce) { .ap-pulse { animation: none; } }

/* A long project name must not squeeze the words beside the menu. */
.st-rule > [data-ap-select] { flex: 0 1 auto; width: auto; max-width: 50%; text-overflow: ellipsis; }

@media (max-width: 640px) {
  .st-rule > [data-ap-select] { flex: 1 1 100%; max-width: 100%; }
  .ap-who { padding: 0 34px 12px 6px; }
  .ap-side-foot { flex-direction: row; gap: 16px; margin-top: 10px; padding: 0 6px; }
  .xp-panel .st-rule { flex-wrap: wrap; row-gap: 8px; padding: 8px 0; }
  .xp-panel .st-rule-c { flex: 1 1 170px; }
  .xp-panel .st-rule > .st-seg { margin-left: auto; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .xp-panel .st-rule > .st-seg button { flex: 1 0 auto; white-space: nowrap; }
  .ap-secrets, .ap-grid { grid-template-columns: 1fr; }
  .ap-flow-top { padding: 20px 18px 0; }
  .ap-flow-body { padding: 16px 18px; }
  .ap-flow-foot { padding: 12px 18px 16px; }
  .ap-flow-t { font-size: 22px; }
  .st-rule .st-seg { flex-wrap: wrap; justify-content: flex-end; }
  .lib-t { font-size: 28px; }
}

#vault-list-slot > .vault-group:first-child { margin-top: 19px; }

/* Settings as a page laid out like Home: header, then the sections in one scrolling list with a
   side menu. Where Home has its search box, Settings leaves the same room, so both menus line up. */
.st-page { --st-dot: var(--bg); }
.st-page > .hm-body { margin-top: 62px; }
.st-page .st-body { overflow: visible; padding-top: 28px; }
.st-page .st-h { font-size: 16px; }
.st-page .st-pane { padding: 0 0 44px; }
.st-page .st-sub { padding-right: 0; }
.st-page .st-wait { min-height: 200px; }

/* Settings rows run the full width like Home's: what it is on the left, the control on the right. */
.st-rule-wide { margin-top: 14px; border-top: 1px dotted light-dark(rgba(77, 53, 51, .14), rgba(230, 216, 214, 0.14)); border-bottom: 0; padding-top: 14px; }
.st-check-row { cursor: pointer; }
.st-check-row input { flex: none; width: 18px; height: 18px; accent-color: var(--brown); }

/* ===========================
   Top header chrome (Profile Switcher left + Connect pill right)
   =========================== */
.top { position: relative; height: 64px; display: flex; align-items: center; justify-content: center; z-index: 30; }
.top-left { position: absolute; left: 4px; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; }
.top-left .pf-btn { height: 34px; padding: 0 10px 0 12px; font-size: 13px; gap: 6px; }
.top-left .pf-menu { left: 0; right: auto; }
/* The ⋯ menu at the top right: Settings and Sign out. */
.top-right { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; }
.top-right[hidden] { display: none; }
.top-more { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; color: var(--muted); background: transparent; border: 1px solid transparent; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.top-more:hover, .top-more[aria-expanded=true] { color: var(--ink); background: var(--tint); border-color: var(--card-line); }
.top-more:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.top-more-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 31; min-width: 180px; padding: 5px; background: var(--card); border: 1px solid light-dark(rgba(77, 53, 51, .14), rgba(230, 216, 214, 0.14)); border-radius: 12px; box-shadow: 0 18px 40px -12px light-dark(rgba(63, 44, 42, .28), rgba(0, 0, 0, 0.6)), 0 2px 6px light-dark(rgba(63, 44, 42, .06), rgba(0, 0, 0, 0.23)); animation: top-more-in .16s cubic-bezier(.2, .8, .2, 1); }
.top-more-menu[hidden] { display: none; }
.top-more-i { display: flex; align-items: center; width: 100%; height: 34px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font: inherit; font-size: 14px; text-align: left; text-decoration: none; cursor: pointer; }
.top-more-i:hover, .top-more-i:focus-visible { background: var(--tint); outline: none; }
.top-more-i.is-no { color: light-dark(#A2483B, #E39A8C); }
@keyframes top-more-in { from { opacity: 0; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .top-more-menu { animation: none; } }
/* Profile in the side column, beside the page title and above the side menu (Jump to).
   A quiet select, not a pill: the same width and edge as the side menu below it. */
.pf-side { display: none; }
@media (min-width: 980px) {
  /* Wide windows: the side column is just the side menu and the profile, the same on every tab.
     Loop stays centred in the header and the selected tab names the page, so the page title and
     count line are kept for screen readers only. The menu is the same box at the same height on
     every tab, so it stays in place from tab to tab; alignSideColumn in app.js centres it between
     the line of the search box and the profile. The profile sits at the bottom of the column,
     level with the nav bar, and its menu opens upward. */
  .wrap:has(:where(.view:not(.is-staged)) .hm-rail) .view .lib-top { height: 0; margin-top: 16px; }
  .wrap:has(:where(.view:not(.is-staged)) .hm-rail) .lib-top-c { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .wrap:has(:where(.view:not(.is-staged)) .hm-rail) .lib-top-r { position: absolute; top: 0; right: 0; }
  .wrap:has(:where(.view:not(.is-staged)) .hm-rail) .hm-libpage > .ctl-search { margin-top: 0; }
  .wrap:has(:where(.view:not(.is-staged)) .hm-rail) .mem-stage { margin-top: 0; }
  .wrap:has(:where(.view:not(.is-staged)) .hm-rail) .st-page > .hm-body { margin-top: 0; }
  .wrap:has(:where(.view:not(.is-staged)) .hm-rail) .st-page .st-body { padding-top: 6px; }
  .wrap:has(:where(.view:not(.is-staged)) .hm-rail) .pf-side { top: auto; bottom: 26px; background: var(--bg); border-radius: 12px; }
  .wrap:has(:where(.view:not(.is-staged)) .hm-rail) .pf-side .pf-menu { top: auto; bottom: calc(100% + 6px); }
  /* Memory's map box ends 92px above the others' lists, so the profile reaches past it to the same row.
     alignSideColumn in app.js then centres the profile on the nav pill exactly; these are the fallback. */
  .wrap:has(:where(.view:not(.is-staged)) .hm-rail) .mem-stage > .pf-side { bottom: -66px; }
  .wrap:has(:where(.view:not(.is-staged)) .hm-rail) .mem-stage:has(> .mem-brain-shell:is(.is-wide, .is-moving)) > .pf-side { background: transparent; }
  /* Lists fade out on an ease and are gone right at the nav pill's top edge, so the pill and the
     profile beside it sit on a clean band of background with nothing half-visible next to them. */
  .wrap:has(:where(.view:not(.is-staged)) .hm-rail) .hm-body > .ctl-scroll,
  .wrap:has(:where(.view:not(.is-staged)) .hm-rail) .home-connections > .ctl-scroll {
    --fade-end: calc(52px + max(24px, env(safe-area-inset-bottom)) - 4px);
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - var(--fade-end) - 84px), rgba(0,0,0,.94) calc(100% - var(--fade-end) - 70px), rgba(0,0,0,.8) calc(100% - var(--fade-end) - 56px), rgba(0,0,0,.58) calc(100% - var(--fade-end) - 42px), rgba(0,0,0,.34) calc(100% - var(--fade-end) - 28px), rgba(0,0,0,.13) calc(100% - var(--fade-end) - 14px), transparent calc(100% - var(--fade-end)));
    mask-image: linear-gradient(to bottom, #000 calc(100% - var(--fade-end) - 84px), rgba(0,0,0,.94) calc(100% - var(--fade-end) - 70px), rgba(0,0,0,.8) calc(100% - var(--fade-end) - 56px), rgba(0,0,0,.58) calc(100% - var(--fade-end) - 42px), rgba(0,0,0,.34) calc(100% - var(--fade-end) - 28px), rgba(0,0,0,.13) calc(100% - var(--fade-end) - 14px), transparent calc(100% - var(--fade-end)));
  }
  .pf-side { display: block; position: absolute; right: calc(100% + 32px); width: 200px; z-index: 25; }
  .pf-side .pf-wrap { display: block; }
  /* Bare text line, JumpItem height: no label, icon, border or fill at rest */
  .pf-side .pf-btn { width: 100%; height: 44px; padding: 0 10px 0 6px; gap: 10px; border: 0; border-radius: 12px; background: transparent; font-size: 13.5px; font-weight: 500; color: var(--ink); }
  .pf-side .pf-btn:hover, .pf-side .pf-btn[aria-expanded=true] { background: var(--tint); }
  .pf-side .pf-tile { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 8px; background: var(--brown); color: var(--bg); font-size: 13px; font-weight: 600; }
  .pf-side .pf-c { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.25; text-align: left; }
  .pf-side .pf-sub { display: block; font-size: 12px; font-weight: 400; color: var(--soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pf-side .pf-ic { display: none; }
  .pf-side .pf-name { min-width: 0; max-width: none; font-weight: 500; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pf-side .pf-chev { color: var(--soft); }
  .pf-side .pf-btn[aria-expanded=true] .pf-chev { transform: none; }
  .pf-side .pf-menu { top: calc(100% + 6px); left: 0; right: auto; width: 220px; padding: 4px; border-radius: 12px; border-color: var(--hair); box-shadow: 0 8px 24px light-dark(rgba(63, 44, 42, .10), rgba(0, 0, 0, 0.33)); }
  .pf-side .pf-menu .hm-menu-k { display: none; }
  .pf-side .pf-opt { height: 30px; gap: 8px; padding: 0 8px; border-radius: 6px; font-size: 13px; }
  .pf-side .pf-opt .hm-opt-name { font-weight: 400; }
  .pf-side .pf-opt[aria-checked=true] .hm-opt-name { font-weight: 500; }
  .pf-side .pf-opt .pf-check { display: none; }
  .pf-side .hm-menu-foot { flex-direction: column; align-items: stretch; gap: 0; margin-top: 4px; padding: 4px 0 0; border-top: 1px solid var(--hair); }
  .pf-side .hm-menu-a { height: 28px; padding: 0 8px; border-radius: 6px; font-weight: 400; }
  .pf-side .hm-menu-a svg { display: none; }
  .pf-side .pf-menu-manage { margin-left: 0; max-width: none; }
}

@media (max-width: 640px) {
  .top { height: 60px; }
  .logo-img { height: 24px; }
  .top-left .pf-btn { padding: 0 8px 0 10px; font-size: 12.5px; }
  /* The page's name is centred between the project and the search button: a long project name stops before it. */
  .top-left .pf-btn { max-width: calc(50vw - 86px); }
  .top-left .pf-name { min-width: 0; max-width: 96px; }
  /* A picked category takes the place of the project icon, so that its name has room. */
  .top-left .pf-btn.has-cat { max-width: calc(50vw - 62px); }
  .top-left .pf-btn.has-cat .pf-ic { display: none; }
  .top-left .pf-btn.has-cat .pf-name { max-width: none; }
}

/* ===========================
   Compact, balanced Home rows (.hm-libpage)
   =========================== */
.mem-top .lib-top { margin-top: 16px; }
.hm-libpage .lib-top { margin-top: 16px; }
.hm-libpage > .ctl-search { margin-top: 14px; }
.hm-libpage .list > li { border-bottom: 1px dotted light-dark(rgba(77, 53, 51, .12), rgba(230, 216, 214, 0.12)); }
.hm-libpage .list > li:last-child { border-bottom: 0; }
.hm-libpage .list > li > .ctl-row::before { display: none; }
.hm-libpage .ctl-row { padding: 8px 10px; gap: 11px; min-height: 46px; border-radius: 10px; transition: background .12s; }
.hm-libpage .ctl-row:hover { background: var(--tint2); }
.hm-libpage .conn-logo { width: 32px; height: 32px; }
.hm-libpage .conn-logo > img,
.hm-libpage .conn-logo-letter { width: 28px; height: 28px; border-radius: 7px; font-size: 13px; }
.hm-libpage .conn-logo-badge { width: 15px; height: 15px; right: -2px; bottom: -2px; }
.hm-libpage .conn-logo-badge svg { width: 9px; height: 9px; }
.hm-libpage .hm-lane { width: 32px; height: 32px; }
.hm-libpage .ctl-row .txt { flex: 1; min-width: 0; text-align: left; cursor: pointer; }
.hm-libpage .ctl-row .t { font-size: 13.5px; line-height: 18px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-libpage .ctl-st { display: block; font-size: 12px; line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.hm-libpage .hm-lib { margin: 22px 0 4px; }
.hm-libpage .ctl-scroll > .hm-lib:first-child { margin-top: 20px; }
.hm-libpage .hm-lib .hm-lib-t { font-size: 16px; font-weight: 600; }
.hm-libpage .hm-kinds .seg-btn { padding: 4px 11px; font-size: 12px; }
.hm-libpage .hm-more { min-height: 36px; padding: 4px 10px 4px 53px; font-size: 12.5px; }
.hm-libpage .hm-skill.is-member { padding-left: 22px; }

.hm-conn-row { width: 100%; text-align: left; cursor: pointer; }
.hm-conn-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 11px; text-align: left; cursor: pointer; }
.hm-conn-row .txt, .hm-conn-main .txt { display: block; }
.hm-conn-row .t, .hm-conn-main .t { display: block; }
.hm-conn-row:hover .t, .hm-conn-main:hover .t { text-decoration: underline; text-decoration-color: light-dark(rgba(77, 53, 51, .3), rgba(230, 216, 214, 0.3)); text-underline-offset: 3px; }
.hm-conn-row:focus-visible, .hm-conn-main:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; border-radius: 10px; }

/* ===========================
   Profile Manager items & tabs
   =========================== */
.pf-mgr-sec-tabs { margin: 2px 0 14px; border-radius: 999px; }
.pf-mgr-sec-tabs .seg-btn { border-radius: 999px; padding: 5px 13px; font-size: 12.5px; }
.pf-mgr-body { min-height: 160px; }
.pf-mgr-search { width: 100%; margin-top: 8px; font-size: 13px; min-height: 34px !important; padding: 5px 0 !important; }
.pf-mgr-items { max-height: 320px; overflow-y: auto; margin-top: 8px; padding-bottom: 20px; -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent); }
.pf-mgr-items-group { padding: 12px 2px 4px; font-size: 12.5px; font-weight: 600; color: var(--soft); display: flex; align-items: center; justify-content: space-between; }
.pf-mgr-items-group:first-child { padding-top: 2px; }
.pf-mgr-item { display: flex; align-items: center; gap: 10px; padding: 6px 2px; border-bottom: 1px dotted light-dark(rgba(77, 53, 51, .12), rgba(230, 216, 214, 0.12)); font-size: 13px; cursor: pointer; }
.pf-mgr-item:last-child { border-bottom: 0; }
.pf-mgr-item input { accent-color: var(--brown); width: 15px; height: 15px; flex: none; }
.pf-mgr-item-n { flex: 1; min-width: 0; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-mgr-item-m { flex: none; font-size: 11.5px; color: var(--soft); white-space: nowrap; }
.pf-mgr-items-empty { padding: 10px 2px; }

/* ===========================
   Connection Popup (.cp-*)
   =========================== */
.cp-sheet { width: min(720px, calc(100vw - 32px)); height: auto; max-height: min(680px, calc(100vh - 32px)); }
.cp-add-sheet { width: min(620px, calc(100vw - 32px)); height: min(620px, calc(100vh - 32px)); }
.cp-in { display: contents; }
.cp-add-sheet .cp-in { display: flex; flex: 1; min-width: 0; min-height: 0; }
.cp-one { display: flex; flex-direction: column; }
.cp-top { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 14px; padding: 24px 64px 16px 28px; background: var(--bg); }
.cp-top-c { flex: 1; min-width: 0; }
.cp-name { margin: 0; font-family: var(--serif); font-size: 24px; font-weight: 500; line-height: 1.15; color: var(--ink); overflow-wrap: anywhere; }
.cp-st { margin-top: 3px; }
.cp-top-r { flex: none; display: flex; align-items: center; gap: 8px; }
/* The logo is the Change logo button: press it to pick another. */
.cp-logo-btn { position: relative; flex: none; padding: 0; border-radius: 14px; cursor: pointer; }
.cp-logo-btn .conn-logo { width: 56px; height: 56px; }
.cp-logo-btn .conn-logo > img,
.cp-logo-btn .conn-logo-letter { width: 52px; height: 52px; border-radius: 13px; font-size: 21px; }
.cp-logo-btn .conn-logo > img { padding: 5px; }
.cp-logo-btn .conn-logo-badge { width: 20px; height: 20px; }
.cp-logo-btn .conn-logo-badge svg { width: 12px; height: 12px; }
.cp-logo-edit { position: absolute; left: -3px; top: -3px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--bg); opacity: 0; transform: scale(.85); transition: opacity .14s ease, transform .14s ease; }
.cp-logo-btn:hover .cp-logo-edit, .cp-logo-btn:focus-visible .cp-logo-edit { opacity: 1; transform: none; }
.cp-logo-btn:hover .conn-logo > img, .cp-logo-btn:hover .conn-logo-letter { filter: brightness(.94); }
.cp-pane { padding: 0 28px 24px; }
.cp-sec-t { margin: 0; font-size: 13px; font-weight: 600; line-height: 18px; color: var(--ink); }
.cp-count { margin-left: 6px; font-weight: 400; color: var(--soft); font-variant-numeric: tabular-nums; }
.cp-tools-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-top: 4px; }
.cp-refresh { margin: 0; font-size: 12.5px; }
.cp-one .st-rule .ap-select { width: auto; min-width: 170px; flex: none; }
/* More settings: a select keeps to the right of its rule, as in the popup (a global rule makes each select full width). */
.cp-rules .st-rule > .ap-select { width: auto; min-width: 170px; max-width: 55%; flex: none; text-overflow: ellipsis; }
.cp-prof-rule { align-items: flex-start; padding: 10px 0; }
.cp-prof-rule .pf-chips { margin-top: 0; justify-content: flex-end; max-width: 60%; }
.cp-details > summary { list-style: none; display: flex; align-items: center; gap: 6px; cursor: pointer; color: var(--muted); }
.cp-details > summary::-webkit-details-marker { display: none; }
.cp-details > summary::after { content: ''; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); margin-left: 2px; transition: transform .15s ease; }
.cp-details[open] > summary::after { transform: rotate(45deg); }
.cp-details > summary:hover { color: var(--ink); }
.cp-desc-t { margin-top: 14px; }
.cp-details .cp-meta { margin-top: 16px; }
.cp-remove { margin-top: 18px; color: var(--no); text-decoration-color: light-dark(rgba(160, 60, 50, .35), rgba(245, 146, 133, 0.35)); }
.cp-st.is-warn { color: var(--warn); }
.cp-st.is-no { color: var(--no); }
.cp-alert { margin: 0 0 16px; padding: 12px 14px; border-radius: 12px; background: var(--warn-bg); color: var(--ink); font-size: 13px; line-height: 19px; }
.cp-alert.is-no, .cp-alert.bad { background: var(--no-bg); }
.cp-alert.cp-signin-saved { background: var(--ok-bg, var(--tint2)); }
.cp-alert-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cp-alert-copy { flex: 1; min-width: 180px; }
.cp-alert-copy strong { display: block; font-size: 13.5px; color: var(--ink); }
.cp-alert-sub { margin: 2px 0 0; font-size: 12.5px; line-height: 18px; color: var(--muted); }
.cp-app-url { margin: 8px 0 0; font-size: 12px; line-height: 17px; color: var(--muted); overflow-wrap: anywhere; }
.cp-signin-card { background: var(--tint2); }
.cp-signin-card.bad { background: var(--no-bg); }
.cp-signin-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.cp-signin-hide { flex: none; font-size: 12px; margin-top: 2px; }
.cp-signin-tabs { margin-top: 10px; }
.cp-signin-form { margin-top: 12px; gap: 10px; }
.cp-signin-form input, .cp-signin-form select { height: 36px; padding: 6px 10px; font-size: 13px; }
.cp-key-row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.cp-key-token-field { flex: 1 1 220px; min-width: 0; }
.cp-key-header-field { flex: 0 0 156px; }
.cp-callback-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); padding: 6px 10px; border-radius: 8px; background: var(--bg); }
.cp-callback-lbl { font-weight: 500; color: var(--soft); }
.cp-callback-row .inline-code { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cp-agent-chips { margin-top: 4px; }
.cp-signin-acts { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.cp-signin-saved-acts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cp-alt-bar { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px; margin: 0 0 14px; font-size: 12.5px; color: var(--muted); }
.cp-alt-bar .ap-link { font-size: 12.5px; margin: 0; }
.cp-rules { margin-top: 14px; }
.cp-sec { margin-top: 18px; padding-top: 16px; border-top: 1px dotted light-dark(rgba(77, 53, 51, .14), rgba(230, 216, 214, 0.14)); }
.cp-sec > .st-grp:first-child { margin-top: 0; }
.cp-hint { margin-top: 6px; }
.cp-desc-form, .cp-key-form { margin-top: 10px; }
.cp-desc-form input, .cp-key-form input { height: 36px; padding: 6px 11px; font-size: 13px; }
.cp-meta { display: grid; gap: 8px; margin-top: 10px; }
.cp-meta-row { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 8px 12px; align-items: baseline; font-size: 13px; }
.cp-meta-row dt { color: var(--soft); font-weight: 500; }
.cp-meta-row dd { margin: 0; color: var(--ink); word-break: break-word; }
.cp-reauth { margin: 0 0 0 8px; font-size: 12.5px; }
.cp-tools-top, .cp-tool-bar { display: flex; align-items: center; gap: 10px; margin: 12px 0; }
.cp-tool-search { width: 100%; font-size: 13px; min-height: 36px !important; padding: 6px 0 !important; }
.cp-tool-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.cp-tool-list > li, .cp-tool-item { border: 0; border-radius: 0; background: transparent; border-bottom: 1px dotted light-dark(rgba(77, 53, 51, .12), rgba(230, 216, 214, 0.12)); padding: 9px 0; }
.cp-tool-list > li:last-child, .cp-tool-item:last-child { border-bottom: 0; }
.cp-tool-item.off { background: transparent; opacity: .72; }
.cp-tool-head, .cp-tool-row { display: flex; align-items: flex-start; gap: 10px; }
.cp-tool-info { flex: 1; min-width: 0; }
.cp-tool-title { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.cp-tool-name { font-family: var(--mono); font-size: 12.5px; font-weight: 600; color: var(--ink); word-break: break-word; }
/* Two lines say what a tool does; all of its text shows while you test it. */
.cp-tool-item .tool-desc { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.cp-tool-item:has(.cp-tool-test) .tool-desc { display: block; }
.cp-tool-desc { font-size: 12px; line-height: 17px; color: var(--muted); margin-top: 2px; }
.cp-tool-acts { flex: none; display: inline-flex; align-items: center; gap: 6px; }
.cp-tool-test { margin-top: 10px; padding: 12px; border-radius: 10px; background: var(--tint2); border-top: 0; }
.cp-tool-out { margin-top: 8px; padding: 10px; border-radius: 8px; background: light-dark(#3F2C2A, #110E0D); color: #F3EAE7; font: 12px/1.5 var(--mono); max-height: 180px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.cp-url { padding: 8px 10px; border-radius: 8px; background: var(--tint2); font-family: var(--mono); font-size: 12px; color: var(--muted); word-break: break-all; margin-top: 8px; }
.cp-confirm { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--no-bg); font-size: 12.5px; width: 100%; }
.cp-confirm-t { margin: 0 0 8px; font-weight: 500; color: var(--no); line-height: 17px; }
.cp-confirm-acts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cp-confirm-rules { margin-top: 14px; }
.cp-oauth-acts { margin-top: 18px; }
.ap-tabs.cp-add-tabs { margin-top: 14px; }
.cp-empty { padding: 12px 0; }
.cp-ann { font-size: 11px; }

@media (max-width: 640px) {
  .cp-sheet, .cp-add-sheet { width: calc(100vw - 20px); height: min(720px, calc(100vh - 20px)); }
  .cp-top { padding: 18px 56px 12px 18px; }
  .cp-pane { padding: 0 18px 20px; }
  .cp-prof-rule { flex-wrap: wrap; }
  .cp-prof-rule .pf-chips { max-width: none; justify-content: flex-start; }
  .cp-meta-row { grid-template-columns: 1fr; gap: 2px; }
  .cp-tool-row, .cp-tool-head { flex-wrap: wrap; }
  .cp-tool-acts { width: 100%; justify-content: flex-end; }
}
@media (max-width: 360px) {
  .cp-tool-acts { gap: 0; }
}

/* ---- Profile sharing (share.js) and connection switches in New profile ---- */
.share-dialog { width: min(560px, calc(100vw - 32px)); }
.share-dialog .sub { margin: 2px 0 16px; color: var(--muted); }
.share-opts { display: grid; gap: 10px; }
.share-opt { display: flex; gap: 14px; align-items: flex-start; text-align: left; width: 100%; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; cursor: pointer; }
.share-opt[aria-checked="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.share-radio { width: 18px; height: 18px; border-radius: 99px; border: 1.5px solid var(--line); flex: none; margin-top: 2px; }
.share-opt[aria-checked="true"] .share-radio { border: 5px solid var(--ink); }
.share-ot { display: block; font-weight: 600; font-size: 14.5px; }
.share-od { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; line-height: 1.45; }
.share-link { display: flex; align-items: center; gap: 10px; margin-top: 18px; padding: 6px 6px 6px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); }
.share-url { flex: 1; min-width: 0; font: 13px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; user-select: all; }
.share-members { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 12px; }
.share-mh { font-size: 12.5px; font-weight: 600; color: var(--soft); margin-bottom: 6px; }
.share-mh span { font-weight: 400; margin-left: 4px; }
.share-member { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px dotted var(--line); }
.share-member:last-child { border-bottom: 0; }
.share-av { width: 28px; height: 28px; border-radius: 99px; background: var(--brown); color: var(--bg); display: grid; place-items: center; font-size: 13px; font-weight: 600; flex: none; }
.share-mn { flex: 1; min-width: 0; font-size: 14px; }
.share-me, .share-ma { color: var(--soft); font-size: 12.5px; }
.share-ma { display: block; margin-top: 1px; }
.pf-new-conns .lbl { display: flex; justify-content: space-between; }
.pf-new-count { font-weight: 400; color: var(--soft); }
.pf-new-list { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.pf-new-row { display: flex; align-items: center; gap: 12px; padding: 0 14px; height: 44px; border-bottom: 1px dotted var(--line); cursor: pointer; }
.pf-new-row:last-child { border-bottom: 0; }
.pf-new-n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.pf-new-sw { appearance: none; -webkit-appearance: none; width: 34px; height: 20px; border-radius: 99px; background: var(--line); position: relative; margin: 0; flex: none; cursor: pointer; transition: background .15s; }
.pf-new-sw::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 99px; background: light-dark(#fff, #241F1E); transition: left .15s; box-shadow: 0 1px 2px light-dark(rgb(0 0 0 / 15%), rgba(0, 0, 0, 0.455)); }
.pf-new-sw:checked { background: var(--ok); }
.pf-new-sw:checked::after { left: 16px; }
.pf-new-sw:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Mobile nav: compact centered pill like desktop, and no hover tooltips on touch screens (iOS keeps :hover after a tap, so the label got stuck). */
@media (hover: none), (pointer: coarse) {
  .nav .nl { display: none; }
  .nav a:hover { background: transparent; color: rgba(255, 255, 255, .72); }
  .nav a[aria-current=page], .nav a[aria-current=page]:hover { background: rgba(255, 255, 255, .12); color: #fff; }
}
@media (max-width: 640px) {
  .nav { left: 50%; right: auto; transform: translateX(-50%); justify-content: center; gap: 6px; padding: 0 6px; height: 56px; border-radius: 28px; bottom: max(16px, env(safe-area-inset-bottom)); }
  .nav a { width: 56px; height: 44px; }
  .nav svg { width: 22px; height: 22px; }
}

/* ---- Loop Text (iMessage) SMS Agent Card ---- */
.home-ic.mark.imessage {
  background: var(--ok-bg);
  color: var(--ok);
}
.sms-agent-card {
  margin: 4px 0 18px;
  padding: 18px 20px;
}
.sms-agent-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.sms-agent-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sms-agent-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.sms-agent-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  line-height: 22px;
}
.sms-agent-sub {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 19px;
}
.sms-agent-phone {
  font-size: 13px;
  color: var(--soft);
}
.sms-agent-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.sms-agent-usage {
  font-size: 12px;
  padding: 2px 9px;
}
.sms-agent-upgrade {
  margin-top: 14px;
}
.sms-agent-unlinked-acts {
  margin-top: 14px;
}
.sms-agent-link-box {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--tint2);
  border: 1px solid light-dark(#EEE4E0, #312B29);
}
.sms-agent-link-intro {
  font-size: 13.5px;
  color: var(--text);
  margin-bottom: 10px;
}
.sms-agent-link-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sms-agent-copy-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: 10px;
  padding: 7px 8px 7px 12px;
}
.sms-agent-copy-lbl {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--soft);
  min-width: 38px;
}
.sms-agent-code {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  overflow-x: auto;
  white-space: nowrap;
  user-select: all;
}
.sms-agent-auth-warn {
  margin-top: 14px;
}
.sms-agent-brain {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.sms-agent-brain > .lbl {
  margin-top: 0;
}
.sms-agent-modes {
  display: flex;
  flex-wrap: wrap;
  width: fit-content;
  max-width: 100%;
}
.sms-agent-brain-hint {
  margin-top: 10px;
}
.sms-agent-vault-empty {
  margin-top: 12px;
}
.sms-agent-byo-form {
  margin-top: 12px;
}
.sms-agent-cli-panel {
  margin-top: 10px;
}
.sms-agent-cli-active {
  color: var(--text);
}
.sms-agent-oauth {
  margin-top: 14px;
}
.sms-agent-oauth-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sms-agent-oauth-inst {
  margin-top: 6px;
  margin-bottom: 10px;
}
.sms-agent-oauth .sms-agent-copy-row {
  margin-top: 10px;
}
.sms-agent-hb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.sms-agent-hb-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.sms-agent-hb-title > .lbl {
  margin: 0;
}
.sms-agent-hb-acts {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.sms-agent-hb-hint {
  margin-top: 6px;
}
.sms-agent-dream {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.sms-agent-dream-form {
  margin-top: 10px;
}
.sms-agent-dream-check {
  margin-top: 2px;
}
.sms-agent-dream-queue {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dotted var(--line);
}
.sms-agent-dream-qhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.sms-agent-dream-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sms-agent-dream-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--tint);
  flex-wrap: wrap;
}
.sms-agent-dream-copy {
  flex: 1 1 220px;
  min-width: 0;
}
.sms-agent-dream-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12px;
}
.sms-agent-dream-text {
  margin: 6px 0 0;
  font-size: 13.5px;
  color: var(--text);
}
.sms-agent-dream-ev {
  margin-top: 4px;
}
.sms-agent-foot {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  display: flex;
  justify-content: flex-end;
}
@media (max-width: 640px) {
  .sms-agent-card { padding: 16px; }
  .sms-agent-modes { width: 100%; }
  .sms-agent-modes .seg-btn { flex: 1 1 auto; text-align: center; padding: 7px 10px; font-size: 12.5px; }
  .sms-agent-copy-row { flex-wrap: wrap; }
}

/* Home top actions, first-run welcome, Vault labeled controls, Memory controls & mobile polish */
.oauth-try { display: flex; align-items: center; gap: 12px; max-width: 520px; margin: 18px auto 6px; padding: 12px 12px 12px 16px; border-radius: 12px; background: var(--tint); text-align: left; font-size: 14px; color: var(--ink); }
.oauth-try span { flex: 1; min-width: 0; }
/* Get started: three steps for a new account, in the app's row style. */
.gs { margin: 10px 0 26px; padding: 18px 20px 6px; border-radius: 16px; background: var(--card); box-shadow: inset 0 0 0 1px var(--hair); }
.gs-head { display: flex; align-items: baseline; gap: 10px; }
.gs .gs-title { margin: 0; padding: 0; font: 400 24px/1.2 var(--serif); letter-spacing: -.01em; color: var(--ink); }
.gs-count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.gs-hide { margin-left: auto; padding: 4px 6px; border: 0; background: none; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; border-radius: 8px; }
.gs-hide:hover { color: var(--ink); background: var(--tint); }
.gs-bar { height: 3px; margin: 12px 0 4px; border-radius: 3px; background: var(--tint); overflow: hidden; }
.gs-bar span { display: block; width: 0; height: 100%; border-radius: 3px; background: var(--brown); transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.gs-bar-1 span { width: 33.333%; }
.gs-bar-2 span { width: 66.667%; }
.gs-bar-3 span { width: 100%; }
.gs-lede { margin: 12px 0 2px; font-size: 14px; color: var(--muted); }
.gs-list { list-style: none; margin: 6px 0 0; padding: 0; }
.gs-step { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px dotted var(--hair); }
.gs-step:first-child { border-top: 0; }
.gs-n { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; font-size: 13px; font-weight: 600; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); font-variant-numeric: tabular-nums; }
.gs-step.is-done .gs-n { color: var(--ok); background: var(--ok-bg); box-shadow: none; }
.gs-step .t { font-size: 15px; color: var(--ink); }
.gs-step.is-done .t { color: var(--muted); }
.gs-s { font-size: 13px; line-height: 1.45; color: var(--muted); overflow-wrap: anywhere; }
.gs-ok { flex: none; font-size: 13px; color: var(--ok); }
.gs-acts { flex: none; display: flex; gap: 6px; }
.gs-step > .btn { flex: none; }
@media (max-width: 560px) {
  .gs { padding: 16px 14px 4px; }
  .gs-step { flex-wrap: wrap; }
  .gs-step .txt { flex: 1 1 calc(100% - 42px); }
  .gs-step > .btn, .gs-step > .gs-acts { margin-left: 42px; }
}
.vault-act-lbl { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.vault-act-k { font-weight: 500; }
.search input[type="search"] { border: 0; border-bottom: 0; border-radius: 0; }
.mem-mchip { flex: none; display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line); background: light-dark(#fff, #241F1E); color: var(--muted); font-size: 12.5px; font-weight: 500; cursor: pointer; }
.mem-mchip[aria-pressed="true"] { background: var(--brown); border-color: var(--brown); color: light-dark(#fff, #241F1E); }
.mem-mchip span { opacity: .75; font-size: 11.5px; }
.mem-ed-check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--ink); cursor: pointer; }
.mem-ed-check input { width: 16px; height: 16px; margin-top: 2px; flex: none; accent-color: var(--brown); }
@media (max-width: 640px) {
  .nav { padding: 4px 8px; height: 58px; gap: 4px; }
  .nav a { width: auto; min-width: 64px; height: 48px; padding: 0 10px; flex-direction: column; gap: 2px; border-radius: 22px; }
  /* The :hover and :focus-visible tooltip rules outrank .nav .nl, and iOS keeps :hover after a tap; name them here so the label stays centred. */
  .nav .nl, .nav a:hover .nl, .nav a:focus-visible .nl { display: block; position: static; transform: none; transition: none; opacity: 1; background: none; color: inherit; box-shadow: none; padding: 0; font-size: 10.5px; line-height: 1.1; font-weight: 500; pointer-events: auto; }
  .mem-brain-shell:not(.is-wide) { height: min(56vh, 440px); min-height: 360px; }
  .mem-brain-shell.has-sheet:not(.is-wide) { height: min(64vh, 560px); }
}

/* ===========================
   Settings v6: one line per setting.
   The rows are .ln, above. Help and forms open under their row.
   =========================== */
.st-page > .hm-body { margin-top: 20px; }
.st-page .st-body { max-width: 720px; }
.st-page .st-pane { padding: 0 0 34px; }
.st-page .st-sh { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 40px; }
.st-page .st-h { font-size: 16px; line-height: 24px; font-weight: 600; color: var(--ink); }
.st-page .st-cap { padding-right: 10px; font-size: 12.5px; color: var(--soft); white-space: nowrap; }
.st-page .st-grp { display: flex; justify-content: space-between; margin: 14px 0 0; padding: 0 10px 0 53px; font-size: 12px; line-height: 18px; font-weight: 400; color: var(--soft); }
.st-page .st-list { display: block; }
.st-page .st-list > * + * { border-top: 1px dotted light-dark(rgba(77, 53, 51, .14), rgba(230, 216, 214, 0.14)); border-top-left-radius: 0; border-top-right-radius: 0; }
.st-page .st-list > .ln:has(+ *) { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.st-page .st-row .ln-d { text-align: left; }
.st-page .ln-tx[data-st-help] { min-height: 46px; align-items: center; cursor: pointer; }
/* Help opens under the name, on its own lines. */
.st-page .ln-tx[aria-expanded=true] { flex-wrap: wrap; gap: 2px 12px; padding: 13px 0 11px; }
.st-page .ln-tx[aria-expanded=true] .ln-t { flex-basis: 100%; }
.st-page .ln-tx[aria-expanded=true] .ln-d { flex: 1 1 100%; white-space: normal; }
.st-page .st-rs { display: block; margin: 0; font-size: 12.5px; line-height: 18px; color: var(--soft); overflow-wrap: anywhere; }

/* Buttons inside the small forms. */
.st-page .st-btn { flex: none; min-height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--text); font-size: 13px; font-weight: 600; transition: border-color .15s, background .15s; }
.st-page .st-btn:hover { border-color: light-dark(rgba(77, 53, 51, .3), rgba(230, 216, 214, 0.3)); }
.st-page .st-btn-dark { background: var(--brown); border-color: var(--brown); color: var(--bg); }
.st-page .st-btn-dark:hover { background: light-dark(#3A2826, #F6EBE9); }

/* Switch (approvals, agent key). The button is 44px wide for the thumb; the track is drawn smaller. */
.st-page .st-sw { position: relative; flex: none; width: 36px; height: 44px; border: 0; background: none; cursor: pointer; -webkit-appearance: none; appearance: none; margin: 0; }
.st-page .st-sw::before { content: ""; position: absolute; inset: 11px 0; border-radius: 999px; background: light-dark(rgba(77, 53, 51, .18), rgba(230, 216, 214, 0.18)); transition: background .18s; }
.st-page .st-sw::after { content: ""; position: absolute; top: 13px; left: 2px; width: 18px; height: 18px; border-radius: 999px; background: light-dark(#fff, #241F1E); box-shadow: 0 1px 2px light-dark(rgba(0, 0, 0, .16), rgba(0, 0, 0, 0.48)); transition: transform .18s; }
.st-page .st-sw[aria-checked=true]::before, .st-page .st-sw-input:checked::before { background: var(--brown); }
.st-page .st-sw[aria-checked=true]::after, .st-page .st-sw-input:checked::after { transform: translateX(14px); }
.st-page .st-sw:focus-visible { outline: 2px solid var(--ink); outline-offset: -4px; border-radius: 999px; }
.st-page .st-sw:disabled { opacity: .55; cursor: default; }

/* Selects inside the small forms. */
.st-page .st-select { position: relative; display: flex; align-items: center; }
.st-page .st-select select { width: 100%; height: 40px; padding: 0 30px 0 12px; border: 1px solid light-dark(rgba(77, 53, 51, .16), rgba(230, 216, 214, 0.16)); border-radius: 10px; background: var(--card); color: var(--ink); font: inherit; font-size: 13.5px; -webkit-appearance: none; appearance: none; cursor: pointer; }
.st-page .st-select .ln-chev { position: absolute; right: 12px; transform: rotate(90deg); pointer-events: none; }

/* What opens under a row: one tint, flat, in line with the row's text. */
.st-page .st-fold-b, .st-page .st-inline-form { max-width: none; margin: 0 0 8px; padding: 14px 16px 16px 53px; border-radius: 14px; background: var(--tint2); }
.st-page .st-inline-form[hidden] { display: none; }
.st-page .st-list > .st-inline-form { border-top: 0; border-radius: 14px; }
.st-page .st-inline-form .st-field, .st-page .st-fold-b .st-field { max-width: 360px; margin-top: 12px; }
.st-page .st-fold-b .st-form { max-width: none; margin-top: 14px; }
.st-page .st-form-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 12px; }
.st-page .st-form-row .st-field { max-width: none; }
.st-page .st-acts { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: 12px; }
.st-page .st-fold-b > .st-acts { margin-top: 4px; }
.st-page .st-field input { font-size: 16px; }

/* A choice of a few words at the end of a row: on a phone it leaves room for the name. */
.st-fb-seg { flex: none; width: clamp(96px, 100vw - 222px, 168px); }
.st-fb-seg button { height: 32px; padding: 0; font-size: 12.5px; }
/* Feedback that agents sent about Loop. */
.st-fb > li + li { margin-top: 8px; padding-top: 12px; border-top: 1px dotted var(--hair); }
.st-fb-t { margin: 0; font-size: 13.5px; line-height: 19px; color: var(--text); white-space: pre-line; overflow-wrap: anywhere; }
.st-page .st-fb .st-acts { flex-wrap: nowrap; align-items: center; justify-content: space-between; margin-top: 0; }
.st-fb .st-rs { min-width: 0; overflow-wrap: anywhere; }
.st-fb .vd-act { flex: none; }

/* People: an invite is made on one tint; a row opens on one tint, like an item of the Vault. */
.pp-add { min-height: 40px; padding: 0 4px; margin-right: -4px; font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.pp-add[aria-expanded=true] { color: var(--muted); font-weight: 500; }
.pp-add:hover, .pp-inline:hover { text-decoration: underline; text-decoration-color: light-dark(rgba(77, 53, 51, .3), rgba(230, 216, 214, 0.3)); text-underline-offset: 3px; }
.pp-add:focus-visible, .pp-inline:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; border-radius: 10px; }
.pp-inline { padding: 0 2px; font-weight: 600; color: var(--ink); cursor: pointer; }
.pp-none { margin: 2px 0 0; font-size: 13.5px; line-height: 19px; color: var(--soft); text-wrap: pretty; }
.pp-k { margin: 18px 0 2px; font-size: 13px; line-height: 18px; color: var(--soft); }
.pp-m { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; color: light-dark(#fff, #241F1E); font-size: 12px; line-height: 1; font-weight: 600; }
.pp-m.is-green { background: light-dark(#3F7556, #87B89A); }
.pp-m.is-blue { background: light-dark(#4B5E86, #A1B5DD); }
.pp-m.is-amber { background: light-dark(#A9711F, #BC8946); }
.pp-m.is-soft { background: light-dark(rgba(77, 53, 51, .1), rgba(230, 216, 214, 0.1)); color: var(--ink); }
.pp-panel { --pad: 14px; overflow: clip; margin: 4px 0 14px; padding: 14px var(--pad); border-radius: 16px; background: var(--tint2); }
.pp-head { margin: 0; }
.pp-t { flex: 1; min-width: 0; margin: 0; font: 500 18px/24px var(--serif); color: var(--ink); overflow-wrap: anywhere; outline: none; }
.pp-panel .vf-f, .pp-link, .pp-form .vf-f { flex: none; background: light-dark(rgba(77, 53, 51, .07), rgba(230, 216, 214, 0.07)); }
.pp-panel .vf-f:focus-within { background: light-dark(rgba(77, 53, 51, .11), rgba(230, 216, 214, 0.11)); }
.pp-who { position: sticky; top: 0; z-index: 2; background: var(--tint2); }
.pp-panel > .pp-who { margin: calc(var(--pad) * -1) calc(var(--pad) * -1) 0; padding: var(--pad) var(--pad) 0; }
.pp-who > .vf-f { width: 100%; padding-right: 5px; }
.pp-whoic { flex: none; margin-right: 10px; color: var(--muted); }
.pp-who-t { display: flex; align-items: center; gap: 12px; min-height: 46px; }
.pp-who .vm-err { margin: 6px 4px 0; }
.pp-go { position: relative; flex: none; height: 36px; margin-left: 8px; padding: 0 16px; border-radius: 999px; background: var(--brown); color: light-dark(#fff, #241F1E); font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; transition: background .15s; }
.pp-go::after { content: ''; position: absolute; inset: -5px; }
.pp-go:hover { background: light-dark(#3A2826, #F6EBE9); }
.pp-go:disabled { background: light-dark(rgba(77, 53, 51, .2), rgba(230, 216, 214, 0.2)); cursor: default; }
.pp-go:focus-visible, .pp-tick:focus-visible, .pp-all:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.pp-subrow { display: flex; align-items: center; gap: 14px; min-height: 40px; padding: 0 4px; }
.pp-subrow .aa-sub { flex: 1; min-width: 0; margin: 4px 0; text-wrap: pretty; }
.pp-panel .vf-f > input { flex: 1; min-width: 0; width: 100%; height: 46px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; outline: 0; font: 400 16px/22px var(--sans); color: var(--ink); text-overflow: ellipsis; }
.pp-panel .vf-f > input::placeholder { color: var(--muted); opacity: 1; }
.pp-pick .oc-find { gap: 14px; }
.pp-find { flex: none; margin: 0 -4px 0 4px; color: var(--muted); }
.pp-pick .oc-find > input[type=search] { flex: 1; min-width: 0; height: 42px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; outline: none; font: 400 16px/22px var(--sans); color: var(--ink); }
.pp-proj { position: relative; flex: none; display: flex; align-items: center; gap: 6px; min-height: 40px; font-size: 13px; font-weight: 500; color: var(--ink); cursor: pointer; }
.pp-proj select { position: absolute; inset: 0; width: 100%; opacity: 0; font-size: 16px; cursor: pointer; }
.pp-proj:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 8px; }
.pp-pick .oc-lines.pp-lines, .pp-items.oc-lines { padding: 0; }
.pp-pick .oc-group { border-top: 1px dotted light-dark(rgba(77, 53, 51, .24), rgba(230, 216, 214, 0.24)); }
.pp-c-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 44px; text-align: left; cursor: pointer; }
.pp-c-main:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; border-radius: 8px; }
/* Two columns, so that eight connections are four lines. The choice of one opens under its line. */
.pp-lines.oc-lines { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: row dense; column-gap: 20px; }
.oc-lines.pp-lines > li + li { border-top: 0; }
.pp-c .oc-line { min-height: 44px; padding: 0 4px; gap: 8px; border-radius: 10px; cursor: default; }
.pp-c .oc-line-ic { width: 26px; }
.pp-c-tx { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; }
.pp-c-tx .oc-line-t { flex: 0 1 auto; max-width: 100%; }
.pp-c-tx .oc-line-v { max-width: 100%; font-size: 12px; line-height: 15px; }
.pp-tick { position: relative; flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px light-dark(rgba(77, 53, 51, .28), rgba(230, 216, 214, 0.28)); color: transparent; cursor: pointer; transition: background .15s, box-shadow .15s; }
.pp-tick::after { content: ''; position: absolute; inset: -11px -8px; }
.pp-tick[aria-checked=true] { background: var(--brown); box-shadow: none; color: light-dark(#fff, #241F1E); }
.pp-how { grid-column: 1 / -1; padding: 2px 0 10px; }
.pp-how .vm-seg { border-radius: 999px; }
.pp-how .vm-seg button { height: 36px; border-radius: 999px; }
.pp-all { min-height: 40px; padding: 0 4px; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; }
@media (hover: hover) { .pp-c .oc-line:hover { background: light-dark(rgba(77, 53, 51, .04), rgba(230, 216, 214, 0.04)); } }
@media (max-width: 359px) { .pp-lines.oc-lines { grid-template-columns: minmax(0, 1fr); } }
.pp-hint { margin: 8px 4px 0; font-size: 12.5px; line-height: 18px; color: var(--soft); text-wrap: pretty; }
.pp-at { color: var(--ink); overflow-wrap: anywhere; }
.pp-hint.pp-later { margin: 6px 4px 0; }
.pp-say { margin: 10px 0 0; font-size: 14px; line-height: 20px; color: var(--text); text-wrap: pretty; }
.pp-mid { margin: 12px 0 8px; font-size: 13px; line-height: 18px; color: var(--soft); text-align: center; }
.pp-mid:last-child { margin-bottom: 0; }
.pp-gap { margin-top: 10px; }
.pp-cut { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-p[open] { margin: 4px 0; border-radius: 14px; background: var(--tint2); }
.pp-p[open] > .ln:hover { background: transparent; }
.st-page .pp-list .st-list > .pp-p[open], .st-page .pp-list .st-list > .pp-p[open] + * { border-top-color: transparent; }
.pp-p .oc-line { cursor: default; }
.pp-p .vd-act { display: inline-flex; align-items: center; min-height: 44px; }
.pp-newlink { padding: 8px 0 0; }
.vd-note.pp-note { padding: 10px 0 12px; }
.pp-acts { display: flex; gap: 10px; padding-bottom: 6px; }
.pp-soft { flex: 1 1 0; min-width: 0; min-height: 44px; padding: 0 12px; border-radius: 999px; background: light-dark(rgba(77, 53, 51, .08), rgba(230, 216, 214, 0.08)); font-size: 13.5px; font-weight: 600; color: var(--ink); cursor: pointer; }
.pp-soft:hover { background: light-dark(rgba(77, 53, 51, .13), rgba(230, 216, 214, 0.13)); }
.pp-soft.is-no { color: var(--no); }
.pp-soft:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.pp-p:has(.pp-form) { overflow: clip; }
.pp-p .pp-form { --pad: 0px; padding: 2px 0 4px; }

/* Home: what an invite still waits for, and what somebody offers. */
.hm-left { margin: 0 0 14px; padding: 14px 16px 6px; border-radius: 16px; background: var(--tint2); }
.hm-left > h2 { margin: 0 0 2px; font-size: 14px; line-height: 20px; font-weight: 600; color: var(--ink); }
.hm-left .oc-lines { padding: 0; }
.hm-left .oc-line { cursor: default; min-height: 52px; }
.hm-left-tx { flex: 1; min-width: 0; padding: 6px 0; }
.hm-left-tx .oc-line-t { display: block; }
.hm-left-h { display: block; font-size: 12px; line-height: 16px; color: var(--soft); overflow-wrap: anywhere; }
.hm-left .xp-panel { width: auto; margin-inline: -16px; }
.hm-left-go { flex: none; min-height: 38px; padding: 0 18px; border-radius: 999px; background: light-dark(rgba(77, 53, 51, .08), rgba(230, 216, 214, 0.08)); font-size: 13.5px; font-weight: 600; color: var(--ink); cursor: pointer; }
.hm-left-go:hover { background: light-dark(rgba(77, 53, 51, .13), rgba(230, 216, 214, 0.13)); }
.hm-left-go.is-first { background: var(--brown); color: var(--bg); }
.hm-left-go.is-first:hover { background: light-dark(#3A2826, #F6EBE9); }
/* One brown button in view: an open panel has its own. */
.ctl-scroll:has(.xp-panel) .hm-left-go.is-first { background: light-dark(rgba(77, 53, 51, .08), rgba(230, 216, 214, 0.08)); color: var(--ink); }
.hm-left-go:disabled { opacity: .55; cursor: default; }
.hm-left-go:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Text agent: the fold's own line is its header. */
.st-page #st-sms-agent .sms-agent-card { border: 0; box-shadow: none; background: transparent; padding: 0; margin: 0; }

@media (max-width: 640px) {
  /* No room for help beside the name: it opens when you tap the row. Screen readers still get it. */
  .st-page .st-row .ln-d { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .st-page .ln-tx[aria-expanded=true] .ln-d { position: static; width: auto; height: auto; clip-path: none; }
  .st-page .st-row { position: relative; }
  .st-page .st-fold-b, .st-page .st-inline-form { padding-left: 14px; padding-right: 14px; }
  .st-page .st-form-row { grid-template-columns: 1fr; gap: 0; }
}

/* Text agent: the fold's line already says what it is and which phone. */
.st-page #st-sms-agent .sms-agent-card[data-sms-agent-card="linked"] .sms-agent-head > .mark,
.st-page #st-sms-agent .sms-agent-card[data-sms-agent-card="linked"] .sms-agent-title-row,
.st-page #st-sms-agent .sms-agent-card[data-sms-agent-card="unlinked"] .sms-agent-head > .mark,
.st-page #st-sms-agent .sms-agent-card[data-sms-agent-card="unlinked"] .sms-agent-title { display: none; }
.st-page #st-sms-agent .sms-agent-sub, .st-page #st-sms-agent .sms-agent-link-intro { font-size: 12.5px; line-height: 18px; color: var(--soft); }
.st-page #st-sms-agent .sms-agent-link-box { background: transparent; border: 0; padding: 12px 0 0; border-radius: 0; }
.st-page #st-sms-agent .sms-agent-copy-row { border-radius: 10px; border-color: light-dark(rgba(77, 53, 51, .11), rgba(230, 216, 214, 0.11)); }
.st-page #st-sms-agent .sms-agent-foot { flex-wrap: wrap; justify-content: flex-start; gap: 0 20px; }
.st-page #st-sms-agent .sms-agent-foot .btn { min-height: 40px; height: auto; padding: 0; border: 0; background: none; box-shadow: none; font-size: 13px; font-weight: 600; }


.sms-agent-traces { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.sms-agent-traces-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
/* Traces: one row per text, a quiet dotted timeline when opened. */
.tr-acts { display: flex; align-items: center; gap: 16px; }
.tr-link { font-size: 13px; color: light-dark(rgba(77, 53, 51, .7), rgba(230, 216, 214, 0.7)); padding: 6px 0; }
.tr-link:hover, .tr-link[aria-pressed="true"] { color: var(--ink); text-decoration: underline; text-decoration-color: light-dark(rgba(77, 53, 51, .3), rgba(230, 216, 214, 0.3)); text-underline-offset: 3px; }
.tr-link:disabled { opacity: .5; cursor: default; }
.tr-count, .tr-empty { font-size: 13px; color: light-dark(rgba(77, 53, 51, .5), rgba(230, 216, 214, 0.5)); margin: 4px 0; }
.tr-empty { font-size: 14px; }
.tr-list > li { border-bottom: 1px dotted light-dark(rgba(77, 53, 51, .16), rgba(230, 216, 214, 0.16)); }
.tr-list > li:last-child { border-bottom: 0; }
.tr-row { width: 100%; display: grid; grid-template-columns: 16px minmax(0, 1fr) auto 16px; align-items: start; column-gap: 12px; padding: 16px 0; text-align: left; color: var(--ink); }
.tr-row:hover .tr-q { text-decoration: underline; text-decoration-color: light-dark(rgba(77, 53, 51, .3), rgba(230, 216, 214, 0.3)); text-underline-offset: 3px; }
.tr-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); margin: 8px 0 0 5px; }
.tr-turn[data-status="error"] .tr-dot { background: var(--no); }
.tr-body-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tr-q { font-size: 14px; line-height: 21px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-sum { font-size: 14px; line-height: 21px; color: light-dark(rgba(77, 53, 51, .7), rgba(230, 216, 214, 0.7)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-turn[data-status="error"] .tr-sum { color: var(--no); }
.tr-meta { font-size: 13px; line-height: 21px; color: light-dark(rgba(77, 53, 51, .5), rgba(230, 216, 214, 0.5)); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tr-chev { color: light-dark(rgba(77, 53, 51, .5), rgba(230, 216, 214, 0.5)); margin-top: 3px; transition: transform .2s; }
.tr-row[aria-expanded="true"] .tr-chev { transform: rotate(90deg); }
.tr-detail { padding: 0 0 14px 28px; }
.tr-note { font-size: 13px; color: light-dark(rgba(77, 53, 51, .5), rgba(230, 216, 214, 0.5)); margin-bottom: 10px; }
.tr-step { display: grid; grid-template-columns: 16px minmax(0, 1fr); column-gap: 12px; }
.tr-rail { position: relative; display: flex; justify-content: center; }
.tr-rail::after { content: ''; position: absolute; top: 18px; bottom: -4px; left: 7.5px; border-left: 1px dotted light-dark(rgba(77, 53, 51, .25), rgba(230, 216, 214, 0.25)); }
.tr-step[data-last="yes"] .tr-rail::after { display: none; }
.tr-node { width: 7px; height: 7px; border-radius: 50%; margin-top: 7px; border: 1px solid light-dark(rgba(77, 53, 51, .45), rgba(230, 216, 214, 0.45)); background: var(--bg); }
.tr-step[data-kind="reply"] .tr-node { background: var(--brown); border-color: var(--brown); }
.tr-step[data-kind="error"] .tr-node { background: var(--no); border-color: var(--no); }
.tr-c { padding-bottom: 16px; min-width: 0; }
.tr-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.tr-lbl { font-size: 14px; line-height: 21px; font-weight: 600; }
.tr-step[data-kind="thought"] .tr-lbl { font-weight: 400; color: light-dark(rgba(77, 53, 51, .5), rgba(230, 216, 214, 0.5)); }
.tr-step[data-kind="error"] .tr-lbl, .tr-step[data-kind="error"] .tr-d { color: var(--no); }
.tr-m { font-size: 13px; color: light-dark(rgba(77, 53, 51, .5), rgba(230, 216, 214, 0.5)); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tr-d { font-size: 14px; line-height: 21px; color: light-dark(rgba(77, 53, 51, .7), rgba(230, 216, 214, 0.7)); margin-top: 2px; white-space: pre-wrap; overflow-wrap: anywhere; }
.tr-step[data-kind="reply"] .tr-d { color: var(--ink); }
.tr-mono { font-family: var(--mono); font-size: 12.5px; }
.tr-code { margin: 6px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--tint2); font-family: var(--mono); font-size: 12px; line-height: 1.5; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 280px; overflow: auto; }
.tr-more { margin-top: 4px; }
.tr-more > summary { display: inline-block; list-style: none; font-size: 13px; color: light-dark(rgba(77, 53, 51, .5), rgba(230, 216, 214, 0.5)); text-decoration: underline; text-decoration-color: light-dark(rgba(77, 53, 51, .25), rgba(230, 216, 214, 0.25)); text-underline-offset: 3px; cursor: pointer; }
.tr-more > summary::-webkit-details-marker { display: none; }
.tr-more[open] > summary { color: var(--ink); }
.tr-foot { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding-left: 28px; font-size: 13px; color: light-dark(rgba(77, 53, 51, .5), rgba(230, 216, 214, 0.5)); }
.tr-foot .tr-link { padding: 0; }
@media (max-width: 640px) {
  .tr-row { grid-template-columns: 16px minmax(0, 1fr) 16px; }
  .tr-meta { grid-column: 2; grid-row: 2; }
  .tr-chev { grid-column: 3; grid-row: 1; }
  .tr-detail { padding-left: 0; }
  .tr-foot { padding-left: 28px; }
}

/* ===========================
   Inline expansion (inline-expand.js): no pop-ups over the page. A connection, an agent, a
   profile or a form opens under the row that was clicked and folds back up the same way.
   =========================== */
.st-root.xp-panel {
  position: relative; inset: auto; z-index: auto; display: grid; grid-template: 0fr / minmax(0, 1fr); place-items: stretch;
  padding: 0; transition: grid-template-rows .28s cubic-bezier(.32, .72, 0, 1), padding .28s cubic-bezier(.32, .72, 0, 1);
}
.st-root.xp-panel.is-open { grid-template-rows: 1fr; padding: 6px 0 18px; }
.st-root.xp-panel > .st-veil { display: none; }
.st-root.xp-panel > .st-sheet {
  position: relative; width: auto; height: auto; max-height: none; min-height: 0; overflow: hidden;
  border-radius: 14px; background: var(--tint2); box-shadow: none;
  opacity: 0; transform: translateY(-4px); transition: opacity .2s ease-out, transform .28s cubic-bezier(.32, .72, 0, 1);
}
.st-root.xp-panel.is-open > .st-sheet { opacity: 1; transform: none; }
.st-root.xp-panel.is-open.is-done > .st-sheet { overflow: visible; }
.st-root.xp-panel .st-side { background: transparent; }
.st-root.xp-panel .ap-flow-body, .st-root.xp-panel .st-body { overflow: visible; }
.st-root.xp-panel .st-x { top: 12px; right: 12px; }
/* The row that is open reads as the top of its panel. */
.xp-anchor { position: relative; }
.xp-anchor, .xp-anchor + .xp-panel { scroll-margin-top: 16px; }
.row.xp-anchor, .st-row.xp-anchor { border-bottom-color: transparent; }

dialog.xp-dialog[open] {
  position: static; inset: auto; display: block; margin: 6px 0 18px; width: auto; max-width: none; max-height: none;
  overflow: visible; border-radius: 14px; background: var(--tint2); color: var(--text); box-shadow: none;
  animation: xp-in .28s cubic-bezier(.32, .72, 0, 1);
}
dialog.xp-dialog > h2, dialog.xp-dialog header h2 { justify-content: flex-start; min-height: 0; text-align: left; font-size: 20px; line-height: 24px; }
dialog.xp-dialog > h2:has(+ .sub) { margin-bottom: 5px; }
dialog.xp-dialog > h2 + .sub { margin: 0 0 16px; font-size: 13px; line-height: 18px; }
/* Vault add forms: soft filled fields under the section heading, no lines, no labels and no footer. The
   check in the last field saves; the heading's + Add becomes the cross. 16px keeps iOS from zooming in. */
dialog.vf.xp-dialog[open] { width: auto; margin: 2px 0 14px; padding: 0; border-radius: 0; background: none; }
.vf .pf-add-hint { margin: 0; padding: 0 0 8px; border-radius: 0; background: none; font-size: 13px; line-height: 18px; }
.vf-g { display: flex; flex-wrap: wrap; gap: 8px; }
.vf-f { flex: 1 1 0; min-width: 0; display: flex; align-items: center; height: 46px; padding: 0 14px; border-radius: 13px; background: light-dark(#F3EDEA, #272322); transition: background .15s; }
.vf-f[hidden] { display: none; }
.vf-f:focus-within { background: light-dark(#EBE3DF, #322D2B); }
.vf-f:has(> .vf-go) { flex-grow: 1.4; padding-right: 6px; }
.vf-f.is-short { flex-grow: .8; }
.vault-editor .vf-f:has(> .vf-go) { flex-grow: 1.1; }
dialog.vf.xp-dialog .vf-g .vf-f > input { flex: 1; min-width: 0; width: 100%; height: 46px; padding: 0; border: 0; border-radius: 0; background-color: transparent; box-shadow: none; outline: none; font: 400 16px/22px var(--sans, inherit); letter-spacing: normal; color: var(--ink); text-overflow: ellipsis; }
dialog.vf.xp-dialog .vf-g .vf-f > input::placeholder { color: var(--muted); opacity: 1; }
.vf-go { position: relative; flex: none; display: grid; place-items: center; width: 34px; height: 34px; margin-left: 8px; border-radius: 50%; background: var(--brown); color: light-dark(#fff, #241F1E); transition: background .15s; }
.vf-go::after { content: ''; position: absolute; inset: -6px; }
.vf-go:hover { background: light-dark(#3A2826, #F6EBE9); }
.vf-form:invalid .vf-go { background: light-dark(rgba(77, 53, 51, .2), rgba(230, 216, 214, 0.2)); }
.vf.is-busy .vf-go { opacity: .5; pointer-events: none; }
.vf-go, .vault-group h2 button { -webkit-tap-highlight-color: transparent; }
.va-close, .xp-opener > .va-add { display: none; }
.xp-opener > .va-close { display: grid; place-items: center; }
.vault-group h2 button.xp-opener { min-width: 40px; margin-right: -13px; color: var(--muted); }
.vault-group.is-empty h2:has(> .xp-opener) { color: var(--ink); }
@media (max-width: 640px) { .vf-f.is-wide { flex-basis: 100%; } }
@media (max-width: 359px) {
  .vf-f { padding: 0 10px; }
}
@media (min-width: 641px) { .payment-dialog .vf-f.is-wide { flex-grow: 2.2; } }
@keyframes xp-in {
  from { opacity: 0; transform: translateY(-6px); clip-path: inset(0 0 100% 0 round 14px); }
  to { opacity: 1; transform: none; clip-path: inset(0 0 0 0 round 14px); }
}
@media (prefers-reduced-motion: reduce) {
  .st-root.xp-panel, .st-root.xp-panel > .st-sheet { transition: none; }
  dialog.xp-dialog[open] { animation: none; }
}
@media (max-width: 640px) {
  .st-root.xp-panel > .st-sheet { width: auto; height: auto; flex-direction: column; }
}
/* Inside a panel the row above already names the thing: headers sit flat and smaller, without the
   space that a section heading keeps above it. */
.st-root.xp-panel h2 { margin-top: 0; min-height: 0; }
.st-root.xp-panel .cp-top, .st-root.xp-panel .ap-flow-top { position: static; background: transparent; }
.st-root.xp-panel .cp-top { padding-top: 18px; }
.st-root.xp-panel .cp-logo-btn { transform: scale(.72); transform-origin: left center; margin-right: -14px; }
.st-root.xp-panel .cp-top h2, .st-root.xp-panel .cp-top .cp-name, .st-root.xp-panel .ap-flow-t, .st-root.xp-panel #ap-title, .st-root.xp-panel #cp-title { font-size: 20px; }
.st-root.xp-panel .st-side { border-right-color: light-dark(rgba(77, 53, 51, .12), rgba(230, 216, 214, 0.12)); }
.st-root.xp-panel input:not([type=checkbox]):not([type=radio]), .st-root.xp-panel select, .st-root.xp-panel textarea,
dialog.xp-dialog input:not([type=checkbox]):not([type=radio]), dialog.xp-dialog select, dialog.xp-dialog textarea { background: var(--card); }
/* A search line inside a panel is the same underline as the page's own search, not a white box. */
.st-root.xp-panel input[type=search].cp-tool-search { background: transparent; }
.st-root.xp-panel .vm-pass input[type=password], dialog.xp-dialog .vm-pass input[type=password] { background: transparent; }
/* The clicked row and its panel read as one piece that grew open. */
.xp-anchor:not(h2, h3, .hm-lib) { background: var(--tint2); border-radius: 14px 14px 0 0; transition: background .2s; }
.xp-anchor:not(h2, h3, .hm-lib) + .st-root.xp-panel.is-open { padding-top: 0; }
.xp-anchor:not(h2, h3, .hm-lib) + .st-root.xp-panel > .st-sheet { border-top-left-radius: 0; border-top-right-radius: 0; }
.xp-anchor:not(h2, h3, .hm-lib) + dialog.xp-dialog[open] { margin-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }
/* Memory fills the window with its map; a panel opened from its header takes a row above the map. */
.wrap:has(:where(.view:not(.is-staged)) .mem-stage) .view:has(> .xp-panel) { grid-template-rows: auto auto minmax(0, 1fr); }
.wrap:has(:where(.view:not(.is-staged)) .mem-stage) .view > dialog.xp-dialog[open] { max-height: 70vh; overflow: auto; }

/* Loop Text invite-friends share bar */
.sms-agent-invite {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sms-agent-invite-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.sms-agent-invite-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.sms-agent-invite-count {
  font-size: 12.5px;
  color: var(--muted);
}
.sms-agent-invite-row {
  justify-content: space-between;
}
.sms-agent-invite-url {
  font-size: 12.5px;
  font-weight: 500;
}
.sms-agent-invite-acts {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
.st-page #st-sms-agent .sms-agent-invite {
  margin-left: 60px;
  border-top: 1px dotted light-dark(rgba(77, 53, 51, .14), rgba(230, 216, 214, 0.14));
}
.st-page #st-sms-agent .sms-agent-invite-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.st-page #st-sms-agent .sms-agent-invite-count {
  font-size: 13px;
  color: light-dark(rgba(77, 53, 51, .6), rgba(230, 216, 214, 0.6));
}
@media (max-width: 640px) {
  .st-page #st-sms-agent .sms-agent-invite { margin-left: 0; }
  .sms-agent-invite-acts { width: 100%; justify-content: flex-end; }
}

/* ===== OAuth Connect Agent screen (.oc-*) ===== */
.oc-hero {
  padding-top: clamp(44px, 14vh, 124px);
  transition: padding-top .34s cubic-bezier(.22, 1, .36, 1);
}
.oc-hero.is-expanded {
  padding-top: 12px;
}
.oc-origin {
  margin: 10px auto 0;
  max-width: 520px;
  font-size: 13px;
  color: var(--soft);
  overflow-wrap: anywhere;
}
.oc-origin strong { color: var(--ink); font-weight: 600; }
.oc-acts {
  margin-top: 22px;
  gap: 12px;
  align-items: center;
}
.oc-acts .btn {
  min-width: 108px;
}
.oc-or {
  font-size: 13px;
  color: var(--soft);
  user-select: none;
}
.oc-expand-wrap {
  margin-top: 16px;
  display: flex;
  justify-content: center;
}
.oc-expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--muted);
  border: 1px solid transparent;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}
.oc-expand-btn:hover {
  color: var(--ink);
  background: var(--tint);
  border-color: var(--card-line);
}
.oc-expand-chev {
  flex: none;
  transition: transform .26s cubic-bezier(.22, 1, .36, 1);
}
.oc-expand-btn[aria-expanded="true"] .oc-expand-chev {
  transform: rotate(180deg);
}

.oc-drawer {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transform: translateY(-6px);
  margin-top: 0;
  transition:
    grid-template-rows .34s cubic-bezier(.22, 1, .36, 1),
    opacity .24s ease,
    transform .3s cubic-bezier(.22, 1, .36, 1),
    margin-top .34s cubic-bezier(.22, 1, .36, 1);
}
.oc-drawer.is-open {
  grid-template-rows: 1fr;
  opacity: 1;
  transform: translateY(0);
  margin-top: 26px;
}
.oc-drawer-in {
  overflow: hidden;
  min-height: 0;
}

.oc-panel {
  border-top: 1px solid var(--line);
  padding-top: 20px;
}
.oc-single-grant {
  display: grid;
  gap: 12px;
}
.oc-single-grant .oc-profile-sel { width: 100%; min-width: 0; }
.oc-single-grant .oc-note { margin: 0; }
.oc-single-grant .btn { justify-self: start; }
.oc-action-list { display: grid; gap: 8px; max-height: 19rem; overflow-y: auto; }
.oc-action-list label { display: flex; align-items: baseline; gap: 8px; overflow-wrap: anywhere; }
.oc-action-list label[hidden] { display: none; }
.oc-action-list small { display: block; color: var(--soft); }
.oc-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 36px 0;
  font-size: 14px;
  color: var(--muted);
}
.oc-empty {
  text-align: center;
  padding: 28px 0;
  color: var(--muted);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.oc-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.oc-mode {
  border-radius: 999px;
}
.oc-mode .seg-btn {
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 13.5px;
}
.oc-toolbar-right {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.oc-connect-btn {
  margin-left: auto;
}
.oc-code-card {
  max-width: 520px;
  margin: 20px auto 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.oc-code-hint {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
}
.oc-code-card .acts {
  flex-wrap: wrap;
}
.dc-entry-card { max-width: 440px; }
.dc-form { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.dc-code-input { width: 100%; max-width: 240px; text-align: center; font: 600 20px/1.4 ui-monospace, 'SF Mono', Menlo, monospace; letter-spacing: .12em; text-transform: uppercase; padding: 10px 14px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); }
.dc-code-pill { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--tint); border: 1px solid var(--line); font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-weight: 600; letter-spacing: .06em; color: var(--ink); }
.lc-pair-code { display: inline-block; font-family: var(--mono); font-size: 15px; font-weight: 600; padding: 6px 10px; border-radius: 8px; background: var(--tint); color: var(--ink); }
.dc-agents-wrap { max-width: 720px; margin: 0 auto 14px; padding: 0 20px; }
.dc-agents { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.dc-agent-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 13px; color: var(--ink); cursor: pointer; }
.dc-agent-chip input { width: 15px; height: 15px; margin: 0; accent-color: var(--brown); }
/* Connect an agent on this Mac: flat rows with one checkbox lane. The button stays in view while the
   rows scroll: --stick lifts it to where the page list starts to fade out above the nav, and
   --stick-fade is the height of that fade. */
.ap-quick, .aa-sheet { --stick: 0px; --stick-fade: calc(24px + max(24px, env(safe-area-inset-bottom))); }
.st-root.xp-panel > .st-sheet.ap-quick, .st-root.xp-panel.is-open.is-done > .st-sheet.ap-quick { overflow: clip; }
.st-root.xp-panel .ap-quick .ap-flow-top { padding: 18px 24px 0; }
.st-root.xp-panel .ap-quick .ap-flow-t { line-height: 24px; }
.st-root.xp-panel .ap-quick .ap-flow-body { padding: 14px 24px 20px; }
.ap-quick .ap-tabs { margin-top: 0; }
.xp-panel .ap-tabs > .st-seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; background: light-dark(rgba(77, 53, 51, .06), rgba(230, 216, 214, 0.06)); }
.xp-panel .ap-tabs > .st-seg::-webkit-scrollbar { display: none; }
.xp-panel .ap-tabs > .st-seg button { flex: 1 0 auto; }
.ap-inst-list { margin-top: 8px; }
.ap-inst-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 0; cursor: pointer; }
.ap-inst-row + .ap-inst-row { border-top: 1px dotted light-dark(rgba(77, 53, 51, .18), rgba(230, 216, 214, 0.18)); }
.ap-inst-row .home-ic.ap-inst-ic { width: 24px; height: 24px; border-radius: 7px; font-size: 12px; }
.ap-inst-row .home-ic.mark:not(.logo).ap-inst-ic { background: light-dark(rgba(77, 53, 51, .08), rgba(230, 216, 214, 0.08)); }
.ap-inst-row .home-ic.mark.logo.ap-inst-ic img { width: 22px; height: 22px; }
.ap-inst-main { display: block; flex: 1; min-width: 0; }
.ap-inst-l { display: flex; align-items: baseline; gap: 8px; }
.ap-inst-name { min-width: 0; font-size: 14px; line-height: 19px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-inst-state { flex: none; font-size: 12px; line-height: 16px; color: var(--muted); }
.ap-inst-state.is-ok { color: var(--ok); }
.ap-inst-state.is-warn { color: var(--warn); }
.ap-inst-state.is-no, .ap-inst-err { color: var(--no); }
.ap-inst-path, .ap-inst-err { display: block; font-size: 12.5px; line-height: 17px; }
.ap-inst-path { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-inst-err { overflow-wrap: anywhere; }
.ap-inst-row input { flex: none; -webkit-appearance: none; appearance: none; width: 20px; height: 20px; margin: 0; border: 1.5px solid light-dark(rgba(77, 53, 51, .5), rgba(230, 216, 214, 0.5)); border-radius: 6px; cursor: pointer; scroll-margin-bottom: calc(var(--stick) + 180px); }
.ap-inst-row:hover input { border-color: var(--ink); }
.ap-inst-row input:checked { border-color: var(--brown); background: var(--brown) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23FDFCFB' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 6.2l2.4 2.4 4.6-5'/%3E%3C/svg%3E") center / 12px no-repeat; }
.ap-inst-row input:disabled { opacity: .5; cursor: default; }
@media (forced-colors: active) { .ap-inst-row input { -webkit-appearance: auto; appearance: auto; } }
.ap-inst-foot, .ap-inst-acts { display: flex; align-items: center; gap: 8px; }
.ap-inst-foot { gap: 24px; }
.ap-inst-foot > .st-rs { flex: 1; min-width: 0; line-height: 17px; }
.ap-inst-foot .btn { flex: none; }
/* The bar that stays in view, and the strip under it that hides the rows passing behind. */
.ap-inst-foot { position: sticky; bottom: var(--stick); margin-top: 4px; padding-top: 14px; background: linear-gradient(transparent, var(--tint2) 12px); }
.ap-inst-foot::after { content: ''; position: absolute; left: -24px; right: -24px; top: calc(100% - 1px); height: var(--stick-fade); background: var(--tint2); pointer-events: none; }
@media (min-width: 980px) { .ap-quick, .aa-sheet { --stick: 46px; --stick-fade: 84px; } }
@media (max-width: 640px) {
  .st-root.xp-panel .ap-quick .ap-flow-top { padding: 16px 16px 0; }
  .st-root.xp-panel .ap-quick .ap-flow-body { padding: 14px 16px 16px; }
  .xp-panel .ap-tabs > .st-seg { display: flex; }
  .xp-panel .ap-tabs > .st-seg button { padding: 3px 8px; }
  /* Only the button stays in view; the note is the last line of the list. */
  .ap-inst-foot { display: contents; }
  .ap-inst-foot::after { content: none; }
  .ap-inst-foot > .st-rs { margin-top: 8px; }
  .ap-inst-acts { position: sticky; bottom: var(--stick); padding-top: 14px; background: linear-gradient(transparent, var(--tint2) 12px); }
  .ap-inst-acts::after { content: ''; position: absolute; left: -16px; right: -16px; top: calc(100% - 1px); height: var(--stick-fade); background: var(--tint2); pointer-events: none; }
  .ap-inst-acts .btn { flex: 1; height: 44px; }
}
.oc-code-box {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--tint);
  border: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--ink);
  overflow-wrap: anywhere;
  user-select: all;
}
.oc-select-all {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
}
.oc-check-box {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--line);
  background: var(--card);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--bg);
  transition: background .14s ease, border-color .14s ease;
}
.oc-select-all.is-checked .oc-check-box {
  background: var(--ink);
  border-color: var(--ink);
}
.oc-select-all[aria-checked="mixed"] .oc-check-box {
  border-color: var(--ink);
  color: var(--ink);
}
.oc-profile-sel {
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 13px;
  color: var(--ink);
}

.oc-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}
.oc-search {
  flex: 1 1 auto;
  margin-top: 0 !important;
}
.oc-jump-sel {
  display: none;
  flex: none;
  max-width: 140px;
}

.oc-body {
  display: grid;
  grid-template-columns: 186px minmax(0, 1fr);
  gap: 26px;
  margin-top: 16px;
  align-items: start;
}
.oc-rail {
  position: sticky;
  top: 12px;
  max-height: 54vh;
  overflow-y: auto;
  scrollbar-width: none;
  padding: 2px 0 12px;
}
.oc-rail::-webkit-scrollbar { display: none; }

.oc-scroll {
  min-width: 0;
  max-height: 54vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 6px;
  padding-bottom: 24px;
}

.oc-head-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px dotted light-dark(rgba(77, 53, 51, .22), rgba(230, 216, 214, 0.22));
}
.oc-head-row .hm-head {
  flex: 1 1 auto;
  min-width: 0;
  border-bottom: 0;
}
.oc-head-row .sw {
  flex: none;
  margin-right: 2px;
}

.oc-row {
  cursor: pointer;
  user-select: none;
}
.oc-row:hover {
  background: light-dark(rgba(77, 53, 51, .025), rgba(230, 216, 214, 0.025));
  border-radius: 10px;
}
.oc-row.oc-row-mem {
  cursor: default;
}
.oc-row.oc-row-mem:hover {
  background: transparent;
}
/* The mount of a service in App tools: a short select at the end of its row, so that its text keeps the room. */
.oc-row .oc-mount-sel {
  flex: 0 0 auto;
  width: auto;
  min-width: 128px;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--soft) 50%), linear-gradient(135deg, var(--soft) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.oc-tag {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  color: var(--soft);
  background: var(--tint);
  vertical-align: 1px;
}
.oc-mem-seg {
  flex: none;
  border-radius: 999px;
}
.oc-mem-seg .seg-btn {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
}

.oc-details {
  margin: 28px auto 0;
  max-width: 520px;
  text-align: center;
  font-size: 12.5px;
  color: var(--soft);
}
.oc-details > summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  color: var(--soft);
}
.oc-details > summary::-webkit-details-marker { display: none; }
.oc-details > summary:hover { color: var(--ink); }
.oc-details-body {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--card-line);
  background: var(--card);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.oc-detail-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.oc-detail-row .lbl {
  font-size: 11px;
  color: var(--soft);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.oc-detail-row code {
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  .oc-body {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .oc-rail {
    display: none;
  }
  .oc-jump-sel {
    display: block;
  }
  .oc-scroll {
    max-height: 58vh;
  }
  .oc-row.oc-row-mem {
    flex-wrap: wrap;
  }
}
@media (prefers-reduced-motion: reduce) {
  .oc-hero, .oc-drawer, .oc-expand-chev {
    transition: none;
  }
}


/* ===========================
   Add agent (add-agent.js). One panel, four short steps.
   In a wide panel the face and the list stand side by side.
   =========================== */
.st-root.xp-panel > .st-sheet.aa-sheet, .st-root.xp-panel.is-open.is-done > .st-sheet.aa-sheet { overflow: clip; }
.st-sheet.aa-sheet { container: aa / inline-size; }
.aa-sheet .ap-in { display: block; flex: 1; min-width: 0; }
.aa-sheet .st-wait { min-height: 180px; }
/* "Close" in the section heading closes the panel, so the panel needs no cross of its own. */
.hm-lib:has(> .xp-opener) + .aa-root .st-x { display: none; }
.aa-root .st-x { z-index: 2; }
.aa { --pad: 20px; }
.aa > section, .aa-cols { display: none; }
.aa[data-step="1"] > .aa-s1, .aa[data-step="4"] > .aa-s4, .aa[data-step="5"] > .aa-s4, .aa[data-step="6"] > .aa-s4 { display: block; }
.aa[data-step="2"] > .aa-cols, .aa[data-step="3"] > .aa-cols { display: block; }
.aa[data-step="2"] .aa-share, .aa[data-step="3"] .aa-me { display: none; }
.aa-head { display: flex; align-items: flex-start; gap: 10px; padding: 18px calc(var(--pad) + var(--x, 0px)) 0 var(--pad); }
.aa-head-c { flex: 1; min-width: 0; }
.st-root.xp-panel .aa-head .ap-flow-t { margin: 0; font-size: 20px; line-height: 26px; overflow-wrap: anywhere; outline: none; }
.aa-sub { margin: 4px 0 0; font-size: 13px; line-height: 18px; color: var(--muted); }
.aa-back { flex: none; display: grid; place-items: center; width: 32px; height: 32px; margin: -3px -4px -3px -8px; border-radius: 50%; color: var(--text); cursor: pointer; }
.aa-back:hover { background: light-dark(rgba(77, 53, 51, .07), rgba(230, 216, 214, 0.07)); }
.aa-back:focus-visible, .aa-link:focus-visible, .aa-copy:focus-visible, .aa-pen:focus-visible, .aa-pics button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.aa-steps { flex: none; display: flex; align-items: center; gap: 5px; padding-top: 6px; }
.aa-steps b { margin-right: 4px; font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.aa-steps i { width: 15px; height: 2px; border-radius: 1px; background: light-dark(rgba(77, 53, 51, .2), rgba(230, 216, 214, 0.2)); }
.aa-steps i.is-on { background: var(--muted); }
.aa-steps i.is-now { width: 22px; background: var(--ink); }
.aa-root:not(.hm-lib:has(> .xp-opener) + .aa-root) { --x: 36px; }
.aa-in { padding: 18px var(--pad) 20px; }
.aa-back + .aa-head-c { padding-top: 0; }

/* Step 1 */
.aa-k { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; font-size: 13px; line-height: 18px; color: var(--soft); }
.aa-list + .aa-k { margin-top: 18px; }
.aa-link { min-height: 32px; padding: 0; font-size: 13px; color: var(--muted); cursor: pointer; }
.aa-link:hover { color: var(--ink); }
.aa-list { list-style: none; margin: 0; padding: 0; }
.aa-list > li + li { border-top: 1px dotted light-dark(rgba(77, 53, 51, .18), rgba(230, 216, 214, 0.18)); }
.aa-list .ln { width: calc(100% + 20px); margin: 0 -10px; }
.aa-list .ln:hover { background: light-dark(rgba(77, 53, 51, .05), rgba(230, 216, 214, 0.05)); }
.aa-list .ln-chev { display: grid; }
.aa-list .ln-v.is-no { color: var(--no); }
.aa .home-ic.aa-mk { width: 24px; height: 24px; border-radius: 7px; font-size: 12px; }
.aa .home-ic.mark:not(.logo, .pic, .imessage).aa-mk { background: light-dark(rgba(77, 53, 51, .08), rgba(230, 216, 214, 0.08)); }
.aa .home-ic.mark.logo.aa-mk img { width: 22px; height: 22px; }
.aa .home-ic.mark.imessage.aa-mk svg { width: 15px; height: 15px; }
.aa [data-aa-loop] .ln-chev { transition: transform .16s ease; }
.aa [data-aa-loop][aria-expanded=true] .ln-chev { transform: rotate(180deg); }
.aa-hint.aa-addr { margin: 16px 0 0; padding-top: 14px; border-top: 1px dotted light-dark(rgba(77, 53, 51, .24), rgba(230, 216, 214, 0.24)); font-size: 13px; }
.aa-in > .aa-addr + .aa-linkrow { margin-top: 10px; }
.aa-chan { margin: 0 0 4px 36px; scroll-margin-bottom: 120px; border-top: 1px dotted light-dark(rgba(77, 53, 51, .18), rgba(230, 216, 214, 0.18)); }

/* Step 2 */
.aa-pic { position: relative; width: 88px; margin: 6px auto 18px; }
.aa-pic-now { display: block; }
.aa .home-ic.aa-xl { width: 88px; height: 88px; border-radius: 50%; font-size: 34px; }
.aa .home-ic.mark:not(.pic, .imessage).aa-xl { background: light-dark(rgba(77, 53, 51, .07), rgba(230, 216, 214, 0.07)); }
.aa .home-ic.mark.logo.aa-xl img { width: 44px; height: 44px; }
.aa .home-ic.mark.logo.loop.aa-xl { background: none; border-radius: 0; }
.aa .home-ic.mark.logo.loop.aa-xl img { width: 72px; height: 72px; }
.aa-say { max-width: 320px; margin: 0 auto 20px; font-size: 14.5px; line-height: 21px; color: var(--text); text-align: center; text-wrap: balance; }
.aa-hint.aa-mid { text-align: center; }
.aa .home-ic.mark.imessage.aa-xl svg { width: 44px; height: 44px; }
.aa-pen { position: absolute; right: -4px; bottom: -2px; display: grid; place-items: center; width: 30px; height: 30px; border: 3px solid var(--tint2); border-radius: 50%; background: var(--brown); color: light-dark(#fff, #241F1E); cursor: pointer; }
.aa-pen::after { content: ''; position: absolute; inset: -8px; }
.aa-pics { display: flex; justify-content: center; gap: 10px; margin: 0 0 18px; }
.aa-pics[hidden] { display: none; }
.aa-pics button { flex: 0 1 44px; min-width: 0; aspect-ratio: 1; padding: 0; border-radius: 50%; cursor: pointer; }
.aa-pics button[aria-pressed=true] { box-shadow: 0 0 0 2px var(--tint2), 0 0 0 4px var(--ink); }
.aa .home-ic.aa-md { width: 100%; height: 100%; border-radius: 50%; font-size: 17px; }
.aa .home-ic.mark:not(.pic, .imessage).aa-md { background: light-dark(rgba(77, 53, 51, .07), rgba(230, 216, 214, 0.07)); }
.aa .home-ic.mark.logo.aa-md img { width: 24px; height: 24px; }
.aa-up { display: grid; place-items: center; background: light-dark(rgba(77, 53, 51, .07), rgba(230, 216, 214, 0.07)); color: var(--text); }
.aa-f { width: 100%; margin-top: 8px; background: light-dark(rgba(77, 53, 51, .07), rgba(230, 216, 214, 0.07)); }
.aa-f:focus-within { background: light-dark(rgba(77, 53, 51, .11), rgba(230, 216, 214, 0.11)); }
.st-root.xp-panel .aa-f > input[type=text] { flex: 1; min-width: 0; width: 100%; height: 46px; padding: 0; border: 0; background: transparent; box-shadow: none; outline: none; font: 400 16px/22px var(--sans); color: var(--ink); }
.aa-f > input::placeholder { color: var(--muted); opacity: 1; }
.aa-proj { position: relative; cursor: pointer; }
.aa-f-ic { flex: none; display: grid; place-items: center; width: 24px; margin: 0 10px 0 -2px; color: var(--muted); }
.aa-f-l { flex: none; font-size: 13.5px; font-weight: 500; color: var(--text); }
.st-root.xp-panel .aa-proj select { flex: 1; min-width: 0; height: 46px; margin-right: -14px; padding: 0 34px 0 12px; border: 0; border-radius: 13px; background: transparent; box-shadow: none; outline: none; font: 400 13px/18px var(--sans); color: var(--soft); text-align: right; text-align-last: right; text-overflow: ellipsis; -webkit-appearance: none; appearance: none; cursor: pointer; }
.aa-f-chev { position: absolute; right: 14px; display: grid; color: var(--soft); pointer-events: none; }
.aa-hint { margin: 10px 4px 0; font-size: 12.5px; line-height: 18px; color: var(--soft); text-wrap: pretty; }
.aa-big { width: 100%; min-height: 48px; margin-top: 18px; border-radius: 999px; }
.aa-share-wide { display: none; }
.aa-err { margin: 10px 4px 0; font-size: 13px; line-height: 18px; color: var(--no); }

/* Step 3: the access picker, one line per item. "Add all" has one list for every app. */
.aa-faces { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 16px var(--pad) 4px; }
.aa .home-ic.mark.aa-fc { width: 38px; height: 38px; border-radius: 11px; background: var(--card); font-size: 14px; }
.aa .home-ic.mark.logo.aa-fc img { width: 22px; height: 22px; }
.aa-share > #oc-picker { padding: 10px var(--pad) 0; }
.oc-find { display: flex; align-items: center; gap: 12px; border-bottom: 1px dotted light-dark(rgba(77, 53, 51, .24), rgba(230, 216, 214, 0.24)); }
.st-root.xp-panel .oc-find > input[type=search] { flex: 1; min-width: 0; height: 44px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; outline: none; font: 400 16px/22px var(--sans); color: var(--ink); }
.oc-find > input::placeholder { color: var(--muted); opacity: 1; }
.oc-bulk { flex: none; min-height: 40px; font-size: 13px; font-weight: 500; color: var(--ink); cursor: pointer; }
.oc-bulk:hover { text-decoration: underline; text-decoration-color: light-dark(rgba(77, 53, 51, .3), rgba(230, 216, 214, 0.3)); text-underline-offset: 3px; }
.oc-inline .oc-group + .oc-group, .oc-inline .is-later + .oc-group { border-top: 1px dotted light-dark(rgba(77, 53, 51, .24), rgba(230, 216, 214, 0.24)); }
.oc-inline .oc-head-row { border-bottom: 0; min-height: 46px; }
.oc-inline .oc-head-row .sw { margin-right: 0; }
.oc-head { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 46px; text-align: left; color: var(--ink); cursor: pointer; }
.oc-head.is-plain { cursor: default; padding-left: 22px; }
.oc-chev { flex: none; color: var(--soft); transition: transform .18s; }
.oc-head[aria-expanded=true] .oc-chev { transform: rotate(90deg); }
.oc-head-l { min-width: 0; font-size: 14px; line-height: 19px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oc-head-n { flex: none; font-size: 13px; line-height: 19px; color: var(--soft); }
.oc-lines { list-style: none; margin: 0; padding: 0 0 8px 22px; }
.oc-lines > li + li { border-top: 1px dotted light-dark(rgba(77, 53, 51, .18), rgba(230, 216, 214, 0.18)); }
.oc-line { display: flex; align-items: center; gap: 12px; min-height: 48px; cursor: pointer; }
.oc-line-ic { flex: none; width: 28px; display: grid; place-items: center; color: var(--muted); }
.oc-line .conn-logo { width: 26px; height: 26px; }
.oc-line .conn-logo > img, .oc-line .conn-logo-letter { width: 24px; height: 24px; border-radius: 6px; font-size: 12px; }
.oc-line-t { flex: 1; min-width: 0; font-size: 13.5px; line-height: 18px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oc-line-v { flex: none; max-width: 45%; font-size: 12.5px; line-height: 18px; color: var(--soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oc-line-v.is-warn { color: var(--warn); }
/* Of a long host the end stays in view: that part says whose it is. */
.oc-line-v.is-host { direction: rtl; text-align: left; }
.oc-line.is-off .oc-line-ic, .oc-line.is-off .oc-line-t { opacity: .55; }
.oc-inline .sw { width: 36px; height: 22px; }
.oc-inline .sw .sw-knob { width: 16px; height: 16px; }
.oc-inline .sw.on { background: var(--brown); }
.oc-inline .sw.on .sw-knob { transform: translateX(14px); }
.oc-inline .sw.is-some { background: light-dark(rgba(77, 53, 51, .55), rgba(230, 216, 214, 0.55)); }
.oc-inline .sw.is-some .sw-knob { transform: translateX(7px); }
.oc-seg { display: flex; gap: 2px; margin: 0 0 14px; padding: 3px; border-radius: 999px; background: light-dark(rgba(77, 53, 51, .08), rgba(230, 216, 214, 0.08)); }
.oc-seg button { flex: 1 1 auto; min-width: 0; min-height: 38px; padding: 0 8px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--soft); white-space: nowrap; cursor: pointer; }
.oc-seg button:hover { color: var(--ink); }
.oc-seg button[aria-pressed=true] { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px light-dark(rgba(77, 53, 51, .12), rgba(0, 0, 0, 0.38)); }
.oc-note { margin: 0 0 12px 22px; font-size: 12.5px; line-height: 18px; color: var(--soft); text-wrap: pretty; }
.oc-note.is-first { margin: 10px 0 14px; }
.oc-note.is-later { margin: 4px 0 14px; padding-top: 10px; border-top: 1px dotted light-dark(rgba(77, 53, 51, .24), rgba(230, 216, 214, 0.24)); }
.oc-head:focus-visible, .oc-bulk:focus-visible, .oc-seg button:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; border-radius: 8px; }
/* The button stays in view while the list scrolls; the strip under it hides the rows that pass behind. */
.aa-bar { position: sticky; bottom: var(--stick); z-index: 1; padding: 12px var(--pad) 20px; background: linear-gradient(transparent, var(--tint2) 12px); }
.aa-bar::after { content: ''; position: absolute; left: 0; right: 0; top: calc(100% - 1px); height: var(--stick-fade); background: var(--tint2); pointer-events: none; }
.aa-bar .aa-big { margin-top: 0; }

/* Step 4 */
.aa-face { display: flex; align-items: center; gap: 14px; }
.aa .home-ic.aa-lg { width: 48px; height: 48px; border-radius: 50%; font-size: 19px; }
.aa .home-ic.mark:not(.pic, .imessage).aa-lg { background: light-dark(rgba(77, 53, 51, .07), rgba(230, 216, 214, 0.07)); }
.aa .home-ic.mark.logo.aa-lg img { width: 26px; height: 26px; }
.aa-face-c { min-width: 0; }
.aa-face-n { font-size: 16px; line-height: 21px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.aa-face-d { font-size: 13px; line-height: 18px; color: var(--muted); }
.aa-or { display: flex; align-items: center; gap: 12px; margin: 20px 0 8px; font-size: 13px; line-height: 18px; color: var(--soft); }
.aa-or::before, .aa-or::after { content: ''; flex: 1; border-top: 1px dotted light-dark(rgba(77, 53, 51, .3), rgba(230, 216, 214, 0.3)); }
.aa-linkrow { gap: 12px; padding-right: 6px; }
.aa-url { flex: 1; min-width: 0; font-size: 13.5px; line-height: 18px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aa-copy { flex: none; min-height: 40px; padding: 0 8px; border-radius: 9px; font-size: 13.5px; font-weight: 600; color: var(--ink); cursor: pointer; }
.aa-in > .aa-linkrow:not(.aa-or + *) { margin-top: 18px; }
.aa-wait.ap-waitrow { margin-top: 16px; padding: 12px 14px; background: light-dark(rgba(77, 53, 51, .06), rgba(230, 216, 214, 0.06)); font-size: 13px; line-height: 18px; }

@container aa (min-width: 680px) {
  .aa { --pad: 24px; }
  .aa[data-step="2"] > .aa-cols, .aa[data-step="3"] > .aa-cols { display: grid; grid-template-columns: 272px minmax(0, 1fr); }
  .aa[data-step="2"] .aa-share, .aa[data-step="3"] .aa-me, .aa[data-step] .aa-me { display: block; }
  .aa-me { border-right: 1px dotted light-dark(rgba(77, 53, 51, .24), rgba(230, 216, 214, 0.24)); }
  .aa-me > * { position: sticky; }
  .aa-me { --x: 0px; }
  /* The name column's title stays on top with the panel's own colour, so text under it never shows through. */
  .aa-me .aa-head { top: 0; z-index: 2; background: var(--tint2); padding-bottom: 8px; }
  .aa-me .aa-in { top: 62px; }
  .aa-me .aa-steps, .aa-share-head .aa-back, .aa-next, .aa-bar { display: none; }
  .aa-me .aa-sub, .aa-share-head .aa-sub { display: none; }
  .aa-share-wide { display: flex; }
  .aa-share { padding-bottom: 24px; }
  .aa-s1 .aa-in, .aa-s4 .aa-in { max-width: 560px; }
  .aa.is-all[data-step] > .aa-cols { grid-template-columns: minmax(0, 1fr); }
  .aa.is-all[data-step] .aa-me { display: none; }
  .aa.is-all .aa-share { padding-bottom: 0; }
  .aa.is-all .aa-share-head .aa-back { display: grid; }
  .aa.is-all .aa-share-head .aa-sub, .aa.is-all .aa-bar { display: block; }
}

/* Compact profile switcher: the built-in All scope is selectable, never editable. */
.pf-wrap .pf-menu { width: min(232px, calc(100vw - 24px)); padding: 5px; }
.pf-wrap .pf-menu .hm-menu-k { display: block; padding: 6px 9px 4px; font-size: 12px; text-transform: none; letter-spacing: normal; }
.pf-row { display: flex; align-items: center; border-radius: 7px; }
.pf-row[data-selected=true], .pf-row:hover { background: var(--tint); }
.pf-row .pf-opt { flex: 1; min-width: 0; height: 32px; gap: 8px; background: none; }
.pf-wrap .pf-opt .pf-check { display: inline-flex; }
.pf-more { flex: none; width: 31px; height: 28px; border-radius: 6px; color: var(--muted); font-size: 11px; letter-spacing: 1px; }
.pf-more:hover, .pf-more[aria-expanded=true] { background: var(--tint2); }
.pf-badge { display: inline-grid; flex: none; place-items: center; width: 19px; height: 19px; border-radius: 50%; font-size: 17px; line-height: 1; }
.pf-color-slate { color: light-dark(#535762, #B8BCC7); background: light-dark(#ebecef, #262628); }
.pf-color-blue { color: light-dark(#235892, #8FC1FC); background: light-dark(#deebfa, #232A32); }
.pf-color-green { color: light-dark(#39654e, #9BC5AD); background: light-dark(#e0efe5, #222B25); }
.pf-color-purple { color: light-dark(#72469b, #C79FF3); background: light-dark(#eee4fa, #2D2733); }
.pf-color-rose { color: light-dark(#974567, #E392B0); background: light-dark(#fae4ec, #302429); }
.pf-color-amber { color: light-dark(#805721, #D3AA7B); background: light-dark(#f8edce, #2B2513); }
.pf-side .pf-btn .pf-tile { background: transparent; }
.pf-tile .pf-badge { width: 27px; height: 27px; font-size: 20px; }
/* Home's categories in the switcher, on narrow windows: the name, the count, then the check. */
.pf-wrap .pf-menu .pf-cats-k { margin-top: 6px; }
.pf-wrap .pf-cat .hm-jump-n { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.pf-wrap .pf-cat.is-warn, .pf-wrap .pf-cat.is-warn .hm-jump-n { color: var(--warn); }
/* Agent logos in the Settings list of agents. */
.st-agent-ic .home-ic.pf-agent-mark { display: inline-grid; flex: none; place-items: center; width: 22px; height: 22px; min-width: 0; border-radius: 6px; font-size: 12px; overflow: hidden; }
.st-agent-ic .home-ic.pf-agent-mark img { display: block; width: 22px; height: 22px; max-width: none; object-fit: contain; }
.pf-wrap .hm-menu-foot { margin: 4px 0 0; padding: 4px 0 0; border-top: 1px solid var(--hair); }
.pf-wrap .hm-menu-a { width: 100%; gap: 9px; }
.pf-wrap .hm-menu-a svg { display: inline-block; }
.pf-actions { position: fixed; z-index: 45; width: min(184px, calc(100vw - 12px)); padding: 5px; border: 1px solid var(--hair); border-radius: 12px; background: var(--card); color: var(--ink); box-shadow: 0 8px 24px light-dark(rgba(63,44,42,.16), rgba(0, 0, 0, 0.48)); max-height: calc(100dvh - 12px); overflow: auto; }
.pf-actions button { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 33px; padding: 5px 8px; border-radius: 6px; font-size: 13px; text-align: left; }
.pf-actions button:hover, .pf-actions button:focus-visible { background: var(--tint); }
.pf-actions button > span:first-child { min-width: 16px; text-align: center; }
.pf-actions button > svg:last-child { margin-left: auto; color: var(--soft); }
.pf-actions button[data-action=name], .pf-actions button[data-action=delete] { border-radius: 0; }
.pf-actions button[data-action=name] { margin-bottom: 3px; border-bottom: 1px solid var(--hair); }
.pf-actions button[data-action=delete] { margin-top: 3px; border-top: 1px solid var(--hair); color: var(--muted); }
.pf-actions label { display: block; padding: 4px; font-size: 12px; }
.pf-actions input { width: 100%; margin-top: 4px; }

/* System playbooks form one compact list rather than a stack of action cards. */
.sys-list { border: 1px solid var(--line); background: var(--card); border-radius: 13px; overflow: hidden; }
.sys-list > article + article { border-top: 1px solid var(--line); }
.sys-row { display: flex; width: 100%; align-items: center; gap: 11px; padding: 10px 12px; border: 0; background: transparent; color: var(--ink); text-align: left; font: inherit; cursor: pointer; }
.sys-row:hover, .sys-row[aria-expanded="true"] { background: var(--tint2); }
.sys-row:focus-visible { outline-offset: -3px; }
.sys-icon { display: grid; place-items: center; flex: 0 0 35px; height: 35px; border-radius: 9px; background: linear-gradient(160deg, #68c5ee, #1777ae); color: white; }
.sys-icon svg { width: 23px; height: 23px; }
.sys-copy { display: grid; min-width: 0; gap: 2px; }
.sys-copy strong, .sys-copy > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sys-copy strong { font-size: 14px; font-weight: 600; }
.sys-copy > span { color: var(--muted); font-size: 12px; }

.skill-markdown { padding: 14px 18px; line-height: 1.55; overflow-wrap: anywhere; min-width: 0; }
.skill-markdown :is(h1,h2,h3,h4) { margin: 1em 0 .4em; line-height: 1.25; }
.skill-markdown h1 { font-size: 1.35rem; } .skill-markdown h2 { font-size: 1.12rem; }
.skill-markdown > :first-child { margin-top: 0; padding-right: 3rem; }
.skill-markdown p { margin: .55em 0; } .skill-markdown :is(ul,ol) { padding-left: 1.6em; }
.skill-markdown ul { list-style: disc; } .skill-markdown ol { list-style: decimal; }
.skill-markdown pre { padding: .75em; overflow-x: auto; background: var(--tint); border-radius: 6px; }
.skill-markdown table { display:block; overflow:auto; border-collapse:collapse; } .skill-markdown :is(td,th) { padding:.3em .6em; border:1px solid light-dark(#8885, rgba(143, 137, 135, 0.333)); overflow-wrap: normal; word-break: normal; }
.saved-sched-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.saved-sched-field > span { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.saved-sched-msg { flex: 1; }

/* Portable tools, Cloud/Local home badges, and Advanced Network Settings */
.hm-loc-pill,
.cp-loc-pill {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
  vertical-align: 1px;
  border: 1px solid var(--line);
  background: var(--tint);
  color: var(--soft);
}
.hm-loc-pill.is-cloud,
.cp-loc-pill.is-cloud {
  border-color: light-dark(rgba(23, 119, 174, .22), rgba(96, 171, 223, 0.22));
  background: light-dark(rgba(23, 119, 174, .09), rgba(96, 171, 223, 0.09));
  color: light-dark(#17618d, #83C0EC);
}
.hm-loc-pill.is-local,
.cp-loc-pill.is-local {
  border-color: light-dark(rgba(57, 101, 78, .22), rgba(155, 197, 173, 0.22));
  background: light-dark(rgba(57, 101, 78, .08), rgba(155, 197, 173, 0.08));
  color: light-dark(#2f5e45, #B2C8BA);
}
.hm-setup-row {
  justify-content: space-between;
  gap: 12px;
}
.hm-setup-row .hm-conn-main {
  cursor: default;
}
.hm-setup-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.cp-portable-card {
  padding: 10px 0;
  border-top: 1px dotted light-dark(rgba(77, 53, 51, .14), rgba(230, 216, 214, 0.14));
}
.cp-portable-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}
.cp-portable-head > div {
  flex: 1 1 180px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.cp-portable-form {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--hair);
}
.cp-danger-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 14px;
}
.st-adv-net {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  padding: 8px 14px;
}
.st-adv-net > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}
.st-adv-net > summary::-webkit-details-marker { display: none; }
.st-adv-net > summary:hover { color: var(--ink); }
.st-adv-net-body {
  padding-top: 10px;
  border-top: 1px solid var(--hair);
  margin-top: 8px;
}
.st-net-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink);
  margin-top: 6px;
}
.st-net-check input {
  width: auto;
}
.st-badge-default {
  background: light-dark(rgba(23, 119, 174, .12), rgba(96, 171, 223, 0.12));
  color: light-dark(#17618d, #83C0EC);
}

/* Page turns (turnPage in app.js): the old page fades into the new one. Loop, the side menu's
   place, the profile and the nav are the same in both pictures, so they do not move or blink. */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .2s; animation-timing-function: ease; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* The Home decision and text fallback describe the same category changes. */
.organize-approval { margin: 10px 0; white-space: normal; color: var(--ink); font-size: 13px; overflow-wrap: anywhere; }
.organize-approval p { margin: 0 0 8px; }
.organize-approval table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.organize-approval td, .organize-approval th { padding: 6px 5px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.organize-approval small { display: block; color: var(--muted); font-weight: normal; }

.context-guide { margin-block: .5rem; }
.context-guide summary { cursor: pointer; }
.context-guide pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 22rem; overflow: auto; }

/* Connections and skills add menu (Connection, Skill, Category): available on both desktop and phone. */
.hm-add { display: block; margin-top: 18px; }
.hm-add > .hm-lib { flex-wrap: nowrap; }
.hm-add-panel { margin: 4px 0 14px; padding: 18px 20px 8px; border-radius: 16px; background: var(--tint2); scroll-margin-bottom: 128px; }
.hm-add-t { margin: 0; font: 500 20px/26px var(--serif); color: var(--ink); overflow-wrap: anywhere; }
.hm-add-s { margin: 2px 0 0; font-size: 13px; line-height: 18px; color: var(--muted); text-wrap: pretty; }
.hm-add-noagent { display: flex; align-items: center; gap: 16px; margin: 14px 0 4px; padding: 14px 16px; border-radius: 13px; background: light-dark(rgba(77, 53, 51, .07), rgba(230, 216, 214, 0.07)); }
.hm-add-noagent > .hm-add-s { flex: 1; margin: 0; color: var(--ink); }
.hm-add-noagent > .btn { flex: none; }
.hm-add-noagent + .hm-add-n { text-align: left; margin-top: 14px; }
/* The words to paste: a quote with a bar on the left, so it does not look like a field to type in. */
.hm-add-prompt { margin: 16px 0 0; padding: 4px 0 4px 14px; border-radius: 0; background: transparent; border: 0; border-left: 3px solid var(--hair); font-family: var(--serif); font-style: italic; font-size: 16px; line-height: 23px; color: var(--ink); overflow-wrap: anywhere; user-select: all; }
.hm-add-copy { width: 100%; min-height: 48px; margin-top: 12px; border-radius: 999px; }
.hm-add-n { margin: 10px 0 8px; font-size: 13px; line-height: 18px; text-align: center; color: var(--muted); }
.hm-add-list { list-style: none; margin: 0; padding: 0; }
.hm-add-list > li + li, .hm-add-n + .hm-add-list > li:first-child { border-top: 1px dotted light-dark(rgba(77, 53, 51, .24), rgba(230, 216, 214, 0.24)); }
.hm-add-opt { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 48px; padding: 0; border: 0; background: none; text-align: left; font: inherit; font-size: 14px; font-weight: 500; color: var(--ink); cursor: pointer; }
.hm-add-opt:hover > span { text-decoration: underline; text-decoration-color: light-dark(rgba(77, 53, 51, .3), rgba(230, 216, 214, 0.3)); text-underline-offset: 3px; }
.hm-add-opt:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; border-radius: 8px; }
.hm-add-form { padding: 4px 0 12px; max-width: 360px; }
.hm-add-form label { display: block; margin: 0 0 5px; font-size: 12.5px; color: var(--muted); }
.hm-add-form input, .hm-add-form select { width: 100%; margin: 0 0 12px; font-size: 14px; }
.hm-add-form .field-err { margin: 0 0 10px; }
@media (max-width: 640px) {
  .hm-home .lib-top { height: 0; margin: 0; }
  .hm-home .lib-top-c { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  /* The other pages' name takes the Loop logo's place at the top. */
  body:has(.view:not(.is-staged) :is(.mem-top, .hm-libpage:not(.hm-home)) .lib-top) .top > .logo { visibility: hidden; }
  :is(.mem-top, .hm-libpage:not(.hm-home)) .lib-top { position: absolute; top: 0; left: 0; right: 0; z-index: 31; height: 60px; margin: 0; flex-wrap: nowrap; align-items: center; justify-content: center; pointer-events: none; }
  :is(.mem-top, .hm-libpage:not(.hm-home)) .lib-top-c { flex: none; max-width: calc(100% - 40px); }
  :is(.mem-top, .hm-libpage:not(.hm-home)) .lib-t { font-size: 24px; }
  :is(.mem-top, .hm-libpage:not(.hm-home)) .lib-sub { display: none; }
  .st-page > .hm-body { margin-top: 0; }
  /* The map fills the screen down to the nav. */
  .wrap:has(:where(.view:not(.is-staged)) .mem-stage) .view { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); }
  .mem-stage { min-width: 0; }
  .mem-brain-shell:not(.is-wide), .mem-brain-shell.has-sheet:not(.is-wide) { height: 100%; min-height: 360px; }
  .hm-home > .ctl-search { margin-top: 12px; }
  .hm-add { margin-top: 0; }
  /* 16px keeps iOS from zooming in on the field. */
  .hm-add-form { max-width: none; }
  .hm-add-form input, .hm-add-form select { font-size: 16px; }
}

/* Needs you: a category an agent asked for. */
.hm-libpage .hm-catreq .t, .hm-libpage .hm-catreq .ctl-st { white-space: normal; }
.ctl-row.hm-catreq { align-items: flex-start; }
.hm-catreq > .txt { cursor: default; }
.ctl-row.hm-catreq > .txt:hover .t { text-decoration: none; }
.hm-libpage .ctl-row.hm-catreq > .hm-acts { margin: 4px 0 0 43px; }
.hm-catreq-why { margin: 4px 0 0; font-size: 13px; line-height: 18px; color: var(--muted); overflow-wrap: anywhere; }
.hm-catreq-items { list-style: none; margin: 0; padding: 0; font-size: 13px; line-height: 20px; color: var(--ink); }
.hm-catreq-items span { color: var(--muted); }
.hm-catreq .field-err { margin: 6px 0 0; }

/* The section scrubber (home-scrubber.js). It shows wherever the side menu (.hm-rail) does not: narrow windows. */
.hm-scrub { display: none; }
@media (min-width: 980px) {
  .hm-scrub { display: none !important; }
}
@media all {
  .hm-scrub:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 12; pointer-events: none; transition: z-index 0s .18s; }
  .hm-scrub.is-open { z-index: 40; transition: none; }
  .hm-scrub-scrim { position: absolute; inset: 0; background: linear-gradient(90deg, light-dark(rgba(253, 252, 251, .9), rgba(26, 22, 20, 0.9)), light-dark(rgba(253, 252, 251, .86), rgba(26, 22, 20, 0.86)) 45%, light-dark(rgba(253, 252, 251, .5), rgba(26, 22, 20, 0.5))); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); opacity: 0; touch-action: none; transition: opacity .18s ease; }
  .hm-scrub.is-open > .hm-scrub-scrim { opacity: 1; pointer-events: auto; }
  .hm-scrub-grip { position: absolute; left: 0; width: 22px; padding: 0; border: 0; border-radius: 0; background: none; pointer-events: auto; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
  .hm-scrub:not(.is-open) > .hm-scrub-grip:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; border-radius: 6px; }
  .hm-scrub.is-open > .hm-scrub-grip { outline: none; }
  .hm-scrub-ticks, .hm-scrub-mark { transition: opacity .12s ease; }
  .hm-scrub.is-open > :is(.hm-scrub-ticks, .hm-scrub-mark) { opacity: 0; }
  .hm-scrub-ticks > i { position: absolute; left: 2px; top: 0; width: 6px; height: 2.5px; border-radius: 2px; background: var(--muted); pointer-events: none; }
  .hm-scrub-mark { position: absolute; left: 0; top: 0; width: 10px; height: 2.5px; border-radius: 2px; background: var(--ink); pointer-events: none; }
  .hm-scrub-ticks > i.is-warn, .hm-scrub-mark.is-warn { background: var(--warn); }
  .hm-scrub-list { position: absolute; left: 0; width: min(300px, 80vw); overflow: hidden; overscroll-behavior: contain; scrollbar-width: none; user-select: none; -webkit-user-select: none; visibility: hidden; opacity: 0; transform: translateX(-8px); transition: opacity .18s ease, transform .18s ease, visibility 0s .18s; }
  .hm-scrub-list::-webkit-scrollbar { display: none; }
  .hm-scrub-list.is-scrolling { overflow-y: auto; touch-action: pan-y; -webkit-mask-image: linear-gradient(transparent, #000 22px, #000 calc(100% - 22px), transparent); mask-image: linear-gradient(transparent, #000 22px, #000 calc(100% - 22px), transparent); }
  .hm-scrub.is-open > .hm-scrub-list { visibility: visible; opacity: 1; transform: none; pointer-events: auto; transition: opacity .18s ease, transform .18s ease; }
  .hm-scrub-row { position: relative; display: flex; align-items: center; width: 100%; height: var(--row, 30px); padding: 0 12px 0 32px; border: 0; background: none; font: inherit; font-size: 13.5px; text-align: left; color: var(--muted); -webkit-tap-highlight-color: transparent; }
  .hm-scrub-row > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hm-scrub-row.is-warn { color: var(--warn); }
  .hm-scrub-row[aria-pressed=true] { color: var(--ink); font-weight: 600; }
  .hm-scrub-row.is-warn[aria-pressed=true] { color: var(--warn); }
  .hm-scrub-row[aria-pressed=true]::before { content: ''; position: absolute; left: 8px; top: calc(50% - 1.5px); width: 15px; height: 3px; border-radius: 2px; background: currentColor; }
  /* On Memories, a short line parts the parts of Library from what the map can show. */
  .hm-scrub-row.is-sep::after { content: ''; position: absolute; left: 32px; top: 0; width: 22px; height: 1px; background: var(--card-line); }
  .hm-scrub-row:focus-visible { outline: 2px solid var(--ink); outline-offset: -3px; border-radius: 8px; }
  @media (prefers-reduced-motion: reduce) { .hm-scrub-scrim, .hm-scrub-list { transition: none !important; } }
}
@media (max-width: 640px) {
  .hm-home > .hm-bar { display: none; }
  .hm-sec + .hm-sec > .hm-group:first-child { margin-top: 22px; }
  .hm-sec > .hm-group:not(:has(> .hm-lib)) > .hm-head, .hm-sec > .hm-lib, .hm-sec > .hm-group > .hm-lib, .hm-sec .system-skills > h2 { position: sticky; top: 0; z-index: 4; background: var(--bg); }
  .hm-sec .system-skills { margin-top: 22px; }
  .hm-libpage, .st-page { padding-left: 4px; }
}


/* ==========================================================================
   Phase 2 UX Upgrades: Command Palette (Cmd+K), Skeleton Loader, Memory List View
   ========================================================================== */
.cmdk-dialog {
  width: min(560px, calc(100vw - 24px));
  margin: min(14vh, 110px) auto auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 24px 64px light-dark(rgba(63, 44, 42, .22), rgba(0, 0, 0, 0.6)), 0 2px 8px light-dark(rgba(63, 44, 42, .08), rgba(0, 0, 0, 0.28));
  overflow: hidden;
}
.cmdk-dialog::backdrop { background: light-dark(rgba(63, 44, 42, .28), rgba(241, 229, 228, 0.28)); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.cmdk-box { display: flex; flex-direction: column; max-height: 70vh; }
.cmdk-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--card-line); }
.cmdk-ic { flex: none; color: var(--soft); }
.cmdk-input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 15px; color: var(--ink); outline: none; }
.cmdk-input::placeholder { color: var(--soft); }
.cmdk-kbd { flex: none; font-family: var(--mono); font-size: 11px; color: var(--soft); background: var(--tint); border-radius: 6px; padding: 2px 6px; }
.cmdk-list { flex: 1; overflow-y: auto; padding: 6px; max-height: 52vh; }
.cmdk-group { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--soft); padding: 10px 10px 4px; }
.cmdk-row { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px; border-radius: 10px; text-align: left; color: var(--ink); transition: background .1s; }
.cmdk-row:hover, .cmdk-row.is-active { background: var(--tint); }
.cmdk-main { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 1px; }
.cmdk-t { font-size: 14px; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-s { font-size: 12px; color: var(--soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-badge { flex: none; font-size: 11.5px; color: var(--muted); background: var(--card); border: 1px solid var(--card-line); border-radius: 999px; padding: 2px 8px; }
.cmdk-empty { padding: 28px 16px; text-align: center; font-size: 13.5px; color: var(--soft); }
.cmdk-foot { display: flex; align-items: center; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--card-line); background: var(--tint2); font-size: 11.5px; color: var(--soft); }
.cmdk-foot kbd { font-family: var(--mono); font-size: 11px; color: var(--muted); background: var(--card); border: 1px solid var(--card-line); border-radius: 4px; padding: 0 4px; margin-right: 3px; }

.cmd-confirm-dlg { width: min(420px, calc(100vw - 28px)); padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--ink); box-shadow: 0 20px 54px light-dark(rgba(63, 44, 42, .2), rgba(0, 0, 0, 0.58)); }
.cmd-confirm-dlg::backdrop { background: light-dark(rgba(63, 44, 42, .28), rgba(241, 229, 228, 0.28)); }
/* A message with lines (the text of a Task to trust) keeps its lines, and a long word of a payload wraps. */
.cmd-confirm-dlg .sub { white-space: pre-line; overflow-wrap: anywhere; }

.loading-skeleton { display: flex; flex-direction: column; gap: 12px; padding: 24px 4px; }
.skel-bar, .skel-row { background: linear-gradient(90deg, var(--tint) 25%, var(--tint2) 50%, var(--tint) 75%); background-size: 200% 100%; border-radius: 10px; animation: loopSkel 1.2s ease-in-out infinite; }
.skel-title { width: 160px; height: 22px; margin-bottom: 6px; }
.skel-row { width: 100%; height: 48px; }
@keyframes loopSkel { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skel-bar, .skel-row { animation: none; } }

/* OAuth callback URL clean wrap & subtle neutral search clear control */
.oc-cb-url { word-break: normal; overflow-wrap: anywhere; }
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; filter: grayscale(1) opacity(0.55); }

/* Memory Header Controls & Accessible List View */
.mem-toolbar { display: flex; align-items: center; gap: 12px; margin: 10px 0 14px; }
.mem-search-bar { flex: 1 1 auto; min-width: 0; margin: 0; }
.mem-search-spacer { flex: 1 1 auto; }
.mem-search { width: 100%; margin: 0; text-overflow: ellipsis; }
.mem-top-acts { flex: none; display: inline-flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.mem-view-seg { display: inline-flex; padding: 2px; border-radius: 999px; background: var(--tint); border: 1px solid var(--card-line); }
.mem-view-btn { height: 28px; padding: 0 11px; border-radius: 999px; font-size: 12.5px; font-weight: 500; color: var(--muted); transition: background .12s, color .12s; }
.mem-view-btn[aria-pressed=true] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px light-dark(rgba(63, 44, 42, .1), rgba(0, 0, 0, 0.33)); }
@media (min-width: 980px) {
  .mem-top .lib-top { display: none; }
  .mem-toolbar { margin: 14px 0 16px; }
}
@media (max-width: 640px) {
  /* Memory title stays centered in the 60px top bar; toolbar sits cleanly below it with full pointer events. */
  .mem-toolbar { margin: 12px 0 14px; gap: 10px; }
  .mem-top-acts { flex-flow: row nowrap; }
  .btn.mem-top-add { width: 34px; height: 34px; padding: 0; justify-content: center; font-size: 17px; }
  .mem-top-add > span { display: none; }
}
.mem-brain-shell.is-list { overflow-y: auto; background: transparent; border: 0; padding: 0; }
.mem-list-wrap { display: flex; flex-direction: column; gap: 14px; padding: 4px 0 32px; }
.mem-list-review { background: var(--warn-bg); border: 1px solid light-dark(rgba(138, 84, 28, .25), rgba(217, 164, 116, 0.25)); border-radius: 14px; padding: 14px 16px; }
.mem-list-review-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; color: var(--ink); }
.mem-list-review-items { display: flex; flex-direction: column; gap: 10px; }
.mem-list-review-card { background: var(--card); border: 1px solid var(--card-line); border-radius: 12px; padding: 12px 14px; }
.mem-list-review-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.mem-review-compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.mem-review-pane { background: var(--tint2); border-radius: 9px; padding: 9px 11px; font-size: 13px; line-height: 1.45; color: var(--ink); }
.mem-review-pane.is-other { background: light-dark(#FDF7F4, #1D1A18); border: 1px dashed var(--line); }
.mem-review-lbl { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--soft); margin-bottom: 4px; }
.mem-list-ul { display: flex; flex-direction: column; border-top: 1px dotted var(--hair); }
.mem-list-item { padding: 13px 4px; border-bottom: 1px dotted var(--hair); display: flex; flex-direction: column; gap: 6px; }
.mem-list-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.mem-scope-pill { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--tint); color: var(--ink); }
.mem-scope-pill[data-scope=global] { background: light-dark(#F5E8E2, #2D2623); color: light-dark(#6E3F2C, #DBC1B7); }
.mem-scope-pill[data-scope=preference] { background: var(--info-bg); color: var(--info); }
.mem-scope-pill[data-scope=project] { background: var(--ok-bg); color: var(--ok); }
.mem-scope-pill[data-scope=fact] { background: var(--warn-bg); color: var(--warn); }
.mem-list-who { font-weight: 600; color: var(--ink); }
.mem-list-time { margin-left: auto; color: var(--soft); font-size: 12px; }
.mem-list-text { font-size: 14px; line-height: 1.5; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.mem-list-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.mem-list-tag { font-size: 11.5px; color: var(--muted); background: var(--tint2); border-radius: 8px; padding: 2px 7px; }
.mem-list-acts { display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.mem-list-acts .btn.sm { min-height: 30px; padding: 4px 10px; font-size: 12.5px; }
.danger-text { color: var(--no) !important; }
.acts-end { justify-content: flex-end; }
.mem-list-item.is-focused { background: var(--tint2); border-radius: 12px; padding: 13px 12px; box-shadow: inset 0 0 0 1px var(--line); }

.approval-focus-dialog { width: min(460px, calc(100% - 24px)); padding: 24px; }
.hm-home .approval-focus-dialog.xp-panel { scroll-margin-top: 46px; } /* clear of the Needs you heading, which stays in view */
.approval-focus-dialog.xp-dialog.is-done[open] { animation: none; } /* Home puts it back when it is drawn again */
/* A request on Guard (confirmation page behind the link). */
.apg-k { display: flex; align-items: center; gap: 8px; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink); }
.approval-focus-dialog .apg-h { margin: 12px 0 20px; min-height: 0; justify-content: flex-start; font: 500 25px/32px var(--serif); text-align: left; color: var(--ink); overflow-wrap: anywhere; text-wrap: balance; }
.apg-rows { margin: 0; border-bottom: 1px dotted light-dark(rgba(77, 53, 51, .2), rgba(230, 216, 214, 0.2)); }
.apg-row { display: flex; gap: 16px; padding: 12px 0; border-top: 1px dotted light-dark(rgba(77, 53, 51, .2), rgba(230, 216, 214, 0.2)); font-size: 13.5px; line-height: 18px; }
.apg-row dt { flex: none; color: var(--soft); }
.apg-row dd { flex: 1; min-width: 0; margin: 0; text-align: right; font-weight: 500; color: var(--text); overflow-wrap: anywhere; }
.apg-more { margin: 4px 0 0; font-size: 13px; }
.apg-more > summary { min-height: 40px; display: flex; align-items: center; color: var(--soft); cursor: pointer; }
.apg-more > p { margin: 0 0 8px; color: var(--muted); }
.apg [data-apg-pass] { margin-top: 18px; }
.apg-acts { display: grid; margin-top: 8px; }
.apg-acts .btn { min-height: 44px; justify-content: center; border-color: transparent; background: none; box-shadow: none; font-weight: 600; }
.apg-foot { margin: 8px 0 0; text-align: center; font-size: 12.5px; line-height: 18px; color: var(--soft); }
.apf-card { display: flex; flex-direction: column; gap: 12px; }
.apf-kicker { font-size: 12.5px; font-weight: 600; color: var(--soft); }
.apf-card h2 { margin: 0; font: 600 20px/1.3 var(--sans); color: var(--ink); min-height: 0; }
.apf-card h2.is-ok { color: var(--ok); }
.apf-title { margin: 0; font-weight: 600; color: var(--ink); }
.apf-sub { margin: 0; font-size: 14px; color: var(--muted); }
.apf-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; font-size: 13px; }
.apf-lbl { color: var(--soft); font-weight: 600; min-width: 78px; }
.apf-detail { background: var(--tint2); border-radius: 10px; padding: 10px 12px; font-size: 13px; max-height: 220px; overflow: auto; }
.apf-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.apf-choices .btn { min-height: 44px; justify-content: center; font-weight: 600; }
.apf-extra { display: flex; flex-wrap: wrap; gap: 8px; }
.apf-acts { display: flex; justify-content: flex-end; margin-top: 6px; }
@media (max-width: 480px) {
  .apf-choices { grid-template-columns: 1fr; }
}
.jr-stack { display: flex; flex-direction: column; gap: 10px; }
.jr-stack.is-row { flex-direction: row; flex-wrap: wrap; align-items: center; }
.jr-alert { border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.45; background: var(--tint2); color: var(--ink); }
.jr-alert.is-danger { background: light-dark(rgba(184, 58, 45, .1), rgba(245, 127, 110, 0.1)); color: var(--no); }
.jr-alert.is-warn { background: var(--warn-bg); color: var(--warn); }
.jr-facts { display: flex; flex-direction: column; gap: 6px; }
.jr-details summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--soft); }
.jr-code { margin: 8px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--tint2); font: 12.5px/1.45 var(--mono); white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow: auto; }
.jr-field { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; }
.jr-field-lbl { font-weight: 600; color: var(--ink); font-size: 13px; }
.jr-select, .jr-input { width: 100%; font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--card-line); border-radius: 10px; padding: 9px 11px; }
.jr-toggle { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; cursor: pointer; }
.jr-toggle input { margin-top: 3px; accent-color: var(--ink); }
.jr-toggle-copy { display: flex; flex-direction: column; gap: 2px; }
.jr-toggle-lbl { font-weight: 600; color: var(--ink); }
.jr-hint { font-size: 12px; color: var(--soft); }
.jr-actions-stack { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.jr-actions-stack .btn { min-height: 42px; justify-content: center; font-weight: 600; width: 100%; }
.jr-fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.jr-choice { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--card-line); border-radius: 10px; cursor: pointer; }

/* ---------------- Library: one flat list of its parts ---------------- */
.hm-jump[data-mark=brain]::before { background: var(--brown); }
.hm-rail-list > .hm-rail-k.brain-rail-k { padding-left: 12px; font-family: inherit; font-size: 12px; color: var(--soft); }
@media (max-width: 359px) { :is(.mem-top, .hm-libpage:not(.hm-home)) .lib-t { font-size: 20px; } .top-left .pf-btn { max-width: calc(50vw - 76px); } }
/* ---------------- Saved, Files, Schedules & extended json-render display components ---------------- */
.saved-page { display: flex; flex-direction: column; gap: 16px; padding: 4px 0 24px; }
.saved-page.vault-group { margin: 0; }
.saved-page.vault-group > h2 { margin: 0; }
.saved-composer { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.saved-composer > .vf-f { flex: none; width: 100%; }
.saved-composer .vf-f > input { flex: 1; min-width: 0; width: 100%; height: 46px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; outline: 0; font: 400 16px/22px var(--sans, inherit); color: var(--ink); text-overflow: ellipsis; }
.saved-composer .vf-f > input::placeholder { color: var(--muted); opacity: 1; }
.saved-composer:invalid .vf-go { background: light-dark(rgba(77, 53, 51, .2), rgba(230, 216, 214, 0.2)); }
.saved-composer-row { display: flex; gap: 8px; align-items: center; }
.saved-input { flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--card-line); border-radius: 10px; padding: 10px 12px; font-size: 14.5px; color: var(--ink); }
.saved-input.sm { padding: 8px 10px; font-size: 13.5px; }
.saved-composer-extra { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.saved-composer-extra[hidden] { display: none; }
.saved-composer-extra > :last-child { grid-column: 1 / -1; }
.saved-more-btn { font-size: 12.5px; color: var(--soft); padding: 2px 4px; }
.saved-more-btn:hover { color: var(--ink); }
.saved-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.saved-pill { font-size: 12.5px; padding: 5px 11px; border-radius: 999px; background: var(--tint); color: var(--muted); border: 1px solid transparent; transition: background .15s, color .15s; }
.saved-pill:hover { color: var(--ink); }
.saved-pill.is-active { background: var(--brown); color: var(--bg); font-weight: 500; }
.saved-list { display: flex; flex-direction: column; border: 1px solid var(--card-line); border-radius: 15px; background: var(--card); overflow: hidden; }
.saved-card { border-bottom: 1px solid var(--card-line); }
.saved-card:last-child { border-bottom: 0; }
.saved-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 13px 15px; }
.saved-card-main { flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 12px; text-align: left; }
.saved-glyph { width: 32px; height: 32px; border-radius: 9px; flex: none; display: inline-flex; align-items: center; justify-content: center; background: var(--tint); color: var(--ink); font-size: 14px; font-weight: 600; margin-top: 2px; }
.saved-glyph.is-card { background: var(--brown); color: var(--bg); }
.saved-card-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.saved-meta { font-size: 12px; color: var(--soft); }
.saved-title { font-size: 15px; font-weight: 600; color: var(--ink); line-height: 1.35; overflow-wrap: anywhere; }
.saved-title-row { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.saved-proj-badge { font-size: 11px; font-weight: 500; color: var(--muted); background: var(--tint2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; line-height: 1.4; white-space: nowrap; }
.saved-proj-badge.is-other { color: var(--ink); }
.saved-trust-badge { font-size: 11px; font-weight: 500; color: var(--warn); background: var(--warn-bg); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; line-height: 1.4; white-space: nowrap; }
.saved-pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 4px 2px; }
.saved-note { font-size: 13.5px; color: var(--text); line-height: 1.4; overflow-wrap: anywhere; }
.saved-summary { font-size: 13px; color: var(--muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.saved-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 3px; }
.saved-card-acts { display: flex; align-items: center; gap: 6px; flex: none; }
/* An Offer opened to read in full, before the owner accepts or declines it. */
.offer-detail { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 8px 0 2px 30px; font-size: 13px; }
.offer-detail dt { color: var(--muted); }
.offer-detail dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.saved-card-body { border-top: 1px dashed var(--line); background: light-dark(#FCF9F7, #1A1918); padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.saved-md { font-size: 13.5px; line-height: 1.55; color: var(--text); max-height: 360px; overflow: auto; padding: 10px 12px; background: var(--card); border: 1px solid var(--card-line); border-radius: 10px; }
.saved-md pre { overflow: auto; background: var(--tint2); padding: 8px 10px; border-radius: 8px; }
.saved-edit-form { display: flex; flex-direction: column; gap: 8px; }
.saved-edit-acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.saved-empty { padding: 28px 18px; text-align: center; background: var(--card); border: 1px solid var(--card-line); border-radius: 15px; display: flex; flex-direction: column; gap: 6px; }
.saved-sched-form { background: var(--card); border: 1px solid var(--card-line); border-radius: 15px; padding: 12px; display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.saved-sched-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr .9fr; gap: 8px; }
.saved-setup-fold { margin-top: 18px; background: transparent; border: 0; padding: 0; }
.saved-setup-fold > summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; font-size: 13px; font-weight: 400; color: var(--muted); text-decoration: underline; text-decoration-color: var(--hair); text-underline-offset: 3px; }
.saved-setup-fold > summary::-webkit-details-marker { display: none; }
.saved-setup-fold > summary:hover { color: var(--ink); }
.saved-setup-fold[open] > summary { margin-bottom: 10px; }
.saved-setup-fold[open] { padding: 12px 15px; border: 1px solid var(--card-line); border-radius: 15px; background: var(--card); }
.saved-setup-body { margin-top: 12px; display: flex; flex-direction: column; gap: 14px; }
.saved-setup-item { display: flex; flex-direction: column; gap: 6px; }
.saved-setup-acts { display: flex; flex-wrap: wrap; gap: 8px; }

/* Library part_of tree view and expanded hierarchy controls */
.saved-tree-wrap { display: flex; flex-direction: column; gap: 10px; }
.saved-tree-hint { padding: 12px 14px; border: 1px dashed var(--line); border-radius: 12px; background: var(--tint); }
.saved-tree-section-k { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--soft); padding: 4px 2px 0; }
.saved-tree-list { display: flex; flex-direction: column; border: 1px solid var(--card-line); border-radius: 15px; background: var(--card); overflow: hidden; list-style: none; margin: 0; padding: 0; }
.saved-tree-item { border-bottom: 1px solid var(--card-line); }
.saved-tree-item:last-child { border-bottom: 0; }
.saved-tree-caret { width: 22px; height: 26px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; color: var(--soft); font-size: 12px; }
.saved-tree-caret:hover { background: var(--tint2); color: var(--ink); }
.saved-tree-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; }
.saved-tree-row:hover { background: var(--tint); }
.saved-tree-btn { flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 10px; text-align: left; text-decoration: none; color: inherit; }
.saved-tree-glyph { width: 26px; height: 26px; border-radius: 8px; flex: none; display: inline-flex; align-items: center; justify-content: center; background: var(--tint); color: var(--ink); font-size: 12.5px; font-weight: 600; margin-top: 1px; }
.saved-tree-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.saved-tree-title { font-size: 14px; font-weight: 600; color: var(--ink); line-height: 1.35; overflow-wrap: anywhere; }
.saved-tree-sub { font-size: 12.5px; color: var(--muted); line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saved-tree-badges { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.saved-tree-children { list-style: none; margin: 0 0 8px 26px; padding: 0 0 0 12px; border-left: 1px dashed var(--line); display: flex; flex-direction: column; }
.saved-tree-children > .saved-tree-item { border-bottom: 0; }
.saved-tree-stale { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; color: var(--warn); background: var(--tint2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; white-space: nowrap; }
.saved-stale-note { font-size: 12.5px; color: var(--ink); background: var(--tint2); border: 1px solid var(--line); border-left: 3px solid var(--warn); border-radius: 9px; padding: 8px 11px; display: flex; flex-direction: column; gap: 6px; }
.saved-stale-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.saved-stale-act { flex: none; }
.saved-stale-list { margin-top: 2px; }
.saved-md-input { font-family: var(--mono, ui-monospace, monospace); font-size: 12.5px; line-height: 1.5; }
.saved-tree-bar { display: flex; flex-direction: column; gap: 8px; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
.saved-tree-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.saved-tree-lbl { font-size: 11.5px; font-weight: 600; color: var(--soft); margin-right: 2px; }
.saved-tree-chip { display: inline-flex; align-items: center; gap: 2px; background: var(--card); border: 1px solid var(--card-line); border-radius: 999px; padding: 2px 8px; font-size: 12px; color: var(--ink); }
.saved-tree-chip-go { font-size: 12px; color: var(--ink); font-weight: 500; }
.saved-tree-chip-go:hover { text-decoration: underline; }
.saved-tree-chip-x { font-size: 13px; line-height: 1; color: var(--soft); padding: 0 2px 0 4px; }
.saved-tree-chip-x:hover { color: var(--no); }
.saved-parent-form { display: flex; align-items: center; gap: 6px; max-width: 360px; }
.saved-parent-select { flex: 1; min-width: 0; height: 32px; padding: 4px 8px; font-size: 12.5px; }

/* Read-only json-render Saved card components */
.jr-link { display: flex; flex-direction: column; gap: 2px; padding: 9px 11px; border: 1px solid var(--card-line); border-radius: 10px; background: var(--card); text-decoration: none; }
.jr-link:hover { border-color: var(--brown); background: var(--tint2); }
.jr-link-title { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.jr-link-desc { font-size: 12.5px; color: var(--muted); }
.jr-metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.jr-metric { background: var(--card); border: 1px solid var(--card-line); border-radius: 10px; padding: 9px 11px; display: flex; flex-direction: column; gap: 2px; }
.jr-metric-lbl { font-size: 11.5px; color: var(--soft); }
.jr-metric-val { font-size: 18px; font-weight: 700; color: var(--ink); }
.jr-metric-chg { font-size: 11.5px; color: var(--ok); }
.jr-metric.is-warn .jr-metric-chg { color: var(--warn); }
.jr-metric.is-danger .jr-metric-chg { color: var(--no); }
.jr-list { padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; color: var(--text); list-style: disc; }
ol.jr-list { list-style: decimal; }
.jr-checklist { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; }
.jr-check-item { display: flex; align-items: baseline; gap: 8px; color: var(--text); }
.jr-check-item.is-done { color: var(--muted); text-decoration: line-through; }
.jr-check-mark { font-weight: 700; color: var(--ok); width: 14px; flex: none; }
.jr-table-wrap { overflow-x: auto; border: 1px solid var(--card-line); border-radius: 10px; background: var(--card); }
.jr-table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; }
.jr-table th { background: var(--tint2); color: var(--ink); font-weight: 600; padding: 7px 10px; border-bottom: 1px solid var(--card-line); }
.jr-table td { padding: 7px 10px; border-bottom: 1px solid var(--card-line); color: var(--text); }
.jr-table tr:last-child td { border-bottom: 0; }
.jr-divider { border: 0; border-top: 1px dashed var(--line); margin: 4px 0; }
@media (max-width: 640px) {
  .saved-card-head:has(.saved-card-acts > :nth-child(2)) { flex-wrap: wrap; }
  .saved-card-head:has(.saved-card-acts > :nth-child(2)) > .saved-card-main { flex-basis: 100%; }
  .saved-card-head:has(.saved-card-acts > :nth-child(2)) > .saved-card-acts { padding-left: 44px; }
  .saved-composer-extra, .saved-sched-grid { grid-template-columns: 1fr; }

}

/* Look: System, Light or Dark (theme-boot.js). Colors are light-dark() pairs made by core/tone.js;
   write new colors the same way. Images need their own rule. */
:root { color-scheme: light dark; }
:root[data-theme-switch] *, :root[data-theme-switch] *::before, :root[data-theme-switch] *::after { transition: none !important; }
.st-look { flex: none; width: 216px; max-width: 58%; }
.st-look button { height: 32px; font-size: 12.5px; }
:root[data-dark] img[src$="logo.svg"] { filter: brightness(0) invert(.9) sepia(.12); }

/* Categories on Home (wide windows): one pill (or More menu row) shows one category. The pills take the
   place of the side list and wrap, with the last ones under More. Narrow windows use the scrubber instead. */
.hm-cat-pills { display: flex; align-items: center; margin: 14px 0 4px; }
.hm-cat-pill { flex: none; min-height: 32px; padding: 6px 14px; font-size: 13.5px; white-space: nowrap; }
.hm-cat-pill.is-warn:not(.is-active) { color: var(--warn); }
.hm-cat-more { position: relative; }
.hm-cat-menu { width: 240px; }
.hm-cat-menu .hm-opt { height: 36px; }
.hm-cat-menu .hm-opt-name { flex: 1; }
.hm-cat-menu .hm-opt.is-warn .hm-opt-name { color: var(--warn); }
.hm-cat-menu .pf-check { display: inline-flex; width: 14px; visibility: hidden; color: var(--ink); }
.hm-cat-menu [aria-checked=true] .pf-check { visibility: visible; }
.hm-cat-menu [aria-checked=true] { background: var(--tint); }
@media (min-width: 980px) {
  .hm-cat-pill.is-extra { display: none; }
}
@media (max-width: 979px) {
  .hm-cat-pills { display: none; }
}

/* Connection panel: Accounts (each sign-in of one service) and who uses each */
.cp-accounts { margin-bottom: 18px; }
.cp-acc-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cp-acc-addbtn { font-size: 12.5px; font-weight: 500; color: var(--ink); padding: 4px 10px; border-radius: 999px; background: var(--tint); }
.cp-acc-addbtn:hover { background: light-dark(rgba(77, 53, 51, .1), rgba(230, 216, 214, .12)); }
.cp-acc-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; }
.cp-acc-item { display: flex; align-items: center; gap: 6px; border-radius: 10px; }
.cp-acc-item.is-here { background: var(--tint); }
.cp-acc-item .cp-acc { flex: 1; min-width: 0; }
.cp-acc-item.is-here .cp-acc { background: transparent; }
.cp-acc { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 7px 10px; border-radius: 10px; text-align: left; color: var(--ink); background: transparent; }
button.cp-acc:hover, label.cp-acc:hover { background: var(--tint); }
.cp-acc.is-here { background: var(--tint); cursor: default; }
.cp-acc-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: light-dark(rgba(77, 53, 51, .25), rgba(230, 216, 214, .3)); }
.cp-acc-dot.is-ok { background: var(--ok); }
.cp-acc-dot.is-warn { background: var(--warn); }
.cp-acc-check-ic { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; color: var(--ok); }
.cp-acc-tx { flex: 1; min-width: 0; display: grid; gap: 1px; }
.cp-acc-l { font-size: 13.5px; font-weight: 500; line-height: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-acc-l small { margin-left: 6px; font-size: 11px; font-weight: 500; padding: 1px 6px; border-radius: 999px; background: var(--bg); color: var(--muted); vertical-align: 1px; }
.cp-acc-d { font-size: 12px; line-height: 16px; color: var(--muted); }
.cp-acc-d.is-warn { color: var(--warn); }
.cp-acc-row-acts { flex: none; display: inline-flex; align-items: center; gap: 4px; padding-right: 8px; }
.cp-acc-link { font-size: 12px; font-weight: 500; color: var(--muted); padding: 4px 8px; border-radius: 999px; background: transparent; }
.cp-acc-link:hover { color: var(--ink); background: light-dark(rgba(77, 53, 51, .08), rgba(230, 216, 214, .1)); }
.cp-acc-link.is-no:hover { color: var(--no); }
.cp-acc-who { flex: none; display: inline-flex; align-items: center; font-size: 12px; color: var(--muted); }
.cp-acc-who > span:last-child { margin-left: 6px; }
.cp-acc-who .cp-acc-mark + .cp-acc-mark { margin-left: -6px; }
.cp-acc .home-ic.cp-acc-mark { width: 20px; height: 20px; border-radius: 6px; font-size: 10px; box-shadow: 0 0 0 2px var(--card); }
.cp-acc .home-ic.cp-acc-mark img { width: 14px; height: 14px; }
.cp-acc .home-ic.cp-acc-mark.pic img { width: 100%; height: 100%; }
.cp-acc .home-ic.cp-acc-mark.is-lead { width: 26px; height: 26px; border-radius: 8px; box-shadow: none; }
.cp-acc .home-ic.cp-acc-mark.is-lead img { width: 16px; height: 16px; }
.cp-acc-chev { flex: none; color: var(--muted); }
.cp-acc-note { margin: 8px 2px 0; font-size: 12px; line-height: 16px; color: var(--muted); }
.cp-acc-used { margin-top: 14px; }
.cp-acc-k { margin: 0 2px; font-size: 11.5px; font-weight: 600; letter-spacing: .02em; color: var(--muted); }
.cp-acc-add, .cp-acc-pick { margin-top: 10px; padding: 12px; border-radius: 12px; background: var(--tint); display: grid; gap: 10px; }
.cp-acc-inline { display: flex; align-items: center; gap: 8px; }
.cp-acc-inline input[type="text"] { flex: 1; min-width: 0; min-height: 38px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: 13.5px; }
.cp-acc-inline .btn { flex: none; border-radius: 999px; min-height: 38px; padding: 0 16px; }
.cp-acc-add input[type="text"] { width: 100%; min-height: 38px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: 13.5px; }
.cp-acc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cp-acc-chips .saved-pill { background: var(--card); }
.cp-acc-acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cp-exists-card { display: grid; gap: 10px; }
.cp-exists-card p { margin: 0; }
.cp-acc-pick h4 { margin: 0; font-size: 14px; font-weight: 600; }
.cp-acc-pick .cp-acc-list { margin-top: 0; }
.cp-acc-pick label.cp-acc:hover { background: var(--card); }
.cp-acc-check { cursor: pointer; }
.cp-acc-check input { flex: none; width: 18px; height: 18px; accent-color: var(--ink); }
.cp-acc-check.is-off { opacity: .55; cursor: not-allowed; }

/* ===========================
   Connection page (connection-popup.js): a connection opens as its own page over the dashboard,
   with the back arrow at the top left. The bottom nav stays on top of it.
   =========================== */
.st-root.cp-page {
  position: fixed; inset: 0; z-index: 44; display: block; padding: 0; place-items: initial;
  background: var(--bg); overflow-y: auto; scrollbar-gutter: stable both-edges; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  opacity: 0; transition: opacity .18s ease-out;
}
.st-root.cp-page.is-open { opacity: 1; }
/* The bar is a copy of the header at the same place, so the logo does not move.
   Only the back arrow and the content come in. They animate when they are put on the page,
   so content that loads after the page opens still slides in. A status refresh does not animate. */
.cp-page .cp-back.is-in { animation: cp-back-in .34s cubic-bezier(.22, 1, .36, 1) both; }
.cp-page .cp-pg.is-fwd { animation: cp-in-fwd .32s cubic-bezier(.22, 1, .36, 1) both; }
.cp-page .cp-pg.is-bwd { animation: cp-in-bwd .32s cubic-bezier(.22, 1, .36, 1) both; }
@keyframes cp-back-in { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: none; } }
@keyframes cp-in-fwd { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes cp-in-bwd { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .st-root.cp-page { transition: none; }
  .cp-page .cp-back.is-in, .cp-page .cp-pg.is-fwd, .cp-page .cp-pg.is-bwd { animation: none; }
}
.cp-page .cp-in { display: block; min-height: 100%; }
.cp-page .ap-msg { max-width: 600px; margin: 32px auto 0; padding: 0 24px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cp-page .ap-msg p { flex-basis: 100%; }
.cp-pg-bar {
  position: sticky; top: 0; z-index: 2; height: 64px;
  display: flex; align-items: center; justify-content: center; background: var(--bg);
}
.cp-back {
  position: absolute; left: max(12px, env(safe-area-inset-left)); top: 50%; margin-top: -20px;
  display: inline-flex; align-items: center; gap: 2px; height: 40px; padding: 0 10px 0 4px;
  border: 0; border-radius: 10px; background: none; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 500; color: var(--soft); max-width: calc(50vw - 56px);
  -webkit-tap-highlight-color: transparent;
}
.cp-back span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-back svg { flex: none; width: 22px; height: 22px; transition: transform .2s cubic-bezier(.22, 1, .36, 1); }
.cp-back:hover { color: var(--ink); }
.cp-back:hover svg { transform: translateX(-2px); }
.cp-back:active svg { transform: translateX(-3px); }
.cp-back:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.cp-pg-logo { display: inline-flex; align-items: center; padding: 4px 10px; }
.cp-pg-logo img { display: block; height: 28px; width: auto; }
.cp-pg { max-width: 640px; margin: 0 auto; padding: 6px 24px calc(124px + env(safe-area-inset-bottom)); }
.cp-page .cp-top.cp-ph { position: static; padding: 8px 0 4px; background: none; gap: 14px; }
.cp-page .cp-name { font-family: var(--sans); font-size: 22px; font-weight: 600; line-height: 28px; letter-spacing: -.2px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.cp-page .cp-name .cp-loc-pill { margin: 0; }
.cp-page .cp-st { font-size: 14px; line-height: 20px; }
.cp-page .cp-st.is-warn i { background: var(--warn); }
.cp-page .cp-st.is-no i { background: var(--no); }
/* The page covers the dashboard header; the bottom nav stays on top of it. */
body:has(> .cp-page) .nav { z-index: 46; }
.cp-page .cp-top-r .btn { white-space: nowrap; }
.cp-page .cp-sec { margin-top: 28px; padding-top: 0; border-top: 0; }
.cp-page .cp-accounts { margin-bottom: 0; }
.cp-page .cp-alert, .cp-page .cp-alt-bar { margin-top: 16px; }
.cp-pg-h { padding: 8px 0 6px; }
.cp-pg-t { margin: 0; font-size: 22px; font-weight: 600; line-height: 28px; letter-spacing: -.2px; color: var(--ink); }
.cp-pg-sub { margin: 3px 0 0; font-size: 14px; line-height: 20px; color: var(--muted); }
.cp-page .cp-tools-h { margin-top: 14px; }

/* One 48px line: icon lane, name, quiet value, tail. */
.cp-lines { margin-top: 6px; }
.cp-line {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 0 6px 0 2px;
  border-top: 1px dotted light-dark(rgba(77, 53, 51, .14), rgba(230, 216, 214, .14));
  background: none; color: var(--ink); text-align: left; font: inherit; font-size: 14.5px;
}
.cp-lines > .cp-line:first-child { border-top: 0; }
button.cp-line { cursor: pointer; border-radius: 0; }
button.cp-line:hover { background: var(--tint); border-radius: 10px; }
button.cp-line:hover + .cp-line, button.cp-line:hover + .cp-line-x { border-top-color: transparent; }
.cp-line-ic { flex: none; width: 32px; display: flex; justify-content: center; color: var(--muted); }
.cp-line-n { flex: 1; min-width: 0; font-weight: 500; }
.cp-line-v { flex: 0 1 auto; min-width: 0; max-width: 58%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; color: var(--muted); }
.cp-line-v.mono { font-family: var(--mono); font-size: 12.5px; }
.cp-line-chev { flex: none; color: var(--muted); }
.cp-line.is-no, .cp-line.is-no .cp-line-ic { color: var(--no); }
.cp-line .sw { flex: none; }
.cp-line-x { margin: 0 0 8px; padding: 12px; border-radius: 12px; background: var(--tint); }
.cp-line-x .st-rule { padding: 0; border: 0; }
.cp-err { display: grid; gap: 10px; }
.cp-err-msg { margin: 0; max-height: 180px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono); font-size: 12px; line-height: 17px; color: var(--ink); }
.cp-lines .cp-confirm { margin: 4px 0 8px; }
/* Same size as the header (.top and .logo-img) on a phone. */
@media (max-width: 640px) {
  .cp-pg-bar { height: 60px; }
  .cp-pg-logo img { height: 24px; }
}

@media (min-width: 760px) {
  .cp-back { left: 20px; }
  .cp-pg { padding-top: 18px; }
}



/* Home: a category's skills as one row (app.js skillsRowHtml). It opens Library's Skills on that category. */
.hm-skills-row { text-decoration: none; color: inherit; }
.hm-libpage .hm-skills-row .hm-lane { width: 32px; height: 32px; border-radius: 8px; background: var(--tint); color: var(--muted); }
.hm-skills-row .hm-skills-n { margin-left: auto; font-size: 13px; color: var(--soft); font-variant-numeric: tabular-nums; }
.hm-skills-row .ln-chev { flex: none; margin-left: 8px; color: var(--soft); }
.hm-skills-row:hover .hm-skills-n, .hm-skills-row:hover .ln-chev { color: var(--ink); }

/* ---------------- Center Loop nav mark & Loop Specialist chat (#loop) ---------------- */

@media (max-width: 640px) {
  .nav a .nl { font-size: 10px; }
}

/* Full #loop specialist chat page */
.wrap:has(:where(.view:not(.is-staged)) .lc-page) > main {
  max-width: min(1240px, 100%);
}
.lc-page {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  height: calc(100dvh - 168px);
  min-height: 440px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}
.lc-page.is-split {
  max-width: 1220px;
  grid-template-columns: minmax(360px, 1fr) minmax(360px, 1.05fr);
}
.lc-shell {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-radius: 18px;
  border: 1px solid var(--card-line);
  background: light-dark(#fff, #1E1B1A);
  overflow: hidden;
  box-shadow: 0 10px 32px light-dark(rgba(77, 53, 51, .06), rgba(0, 0, 0, .35));
}
.lc-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--hair);
  flex-wrap: wrap;
}
.lc-head-l, .lc-head-r { display: flex; align-items: center; gap: 6px; min-width: 0; }
.lc-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--card-line);
  background: transparent;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  max-width: 240px;
}
.lc-pill-btn > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-pill-btn:hover { background: var(--tint); }
.lc-pill-btn.is-on { background: var(--brown); border-color: var(--brown); color: var(--bg); }
.lc-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--card-line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.lc-icon-btn:hover { background: var(--tint); }

/* Inline drawers (threads & runners — no popups) */
.lc-drawer, .lc-threads {
  flex: none;
  padding: 12px 14px;
  border-bottom: 1px solid var(--hair);
  background: var(--tint);
  max-height: 44%;
  overflow-y: auto;
}
.lc-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--ink);
}
.lc-close-btn {
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--card-line);
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  cursor: pointer;
}
.lc-close-btn:hover { background: var(--tint2); }
.lc-drawer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.lc-drawer-col { display: flex; flex-direction: column; gap: 8px; }
.lc-drawer-k { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--soft); }
.lc-runner-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid var(--card-line);
  background: light-dark(#fff, #241F1E);
}
.lc-runner-row.is-on { border-color: var(--brown); }
.lc-runner-info { display: flex; flex-direction: column; min-width: 0; }
.lc-runner-name { font-size: 12.5px; font-weight: 500; color: var(--ink); }
.lc-runner-st { font-size: 11px; color: var(--soft); }
.lc-runner-st.is-ok { color: var(--ok); }
.lc-row-acts { display: flex; gap: 4px; flex: none; }
.lc-runner-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lc-opt { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--muted); }
.lc-opt select, .lc-form input, .lc-form select {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid var(--card-line);
  background: light-dark(#fff, #1B1817);
  color: var(--ink);
  font-size: 12.5px;
}
.lc-form { display: flex; flex-direction: column; gap: 6px; }
.lc-form-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.lc-api-list { display: flex; flex-direction: column; gap: 5px; }

.lc-thread-list { display: flex; flex-direction: column; gap: 4px; }
.lc-thread-row {
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 2px 4px;
}
.lc-thread-row.is-on { background: light-dark(#fff, #241F1E); border-color: var(--card-line); }
.lc-thread-pick {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  background: transparent;
  border: 0;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.lc-thread-t { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-thread-m { font-size: 11.5px; color: var(--soft); flex: none; }
.lc-thread-del {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--soft);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.lc-thread-del:hover { background: var(--no-bg); color: var(--no); }

/* Chat message stream */
.lc-feed {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overscroll-behavior: contain;
}
.lc-empty {
  margin: auto;
  max-width: 460px;
  text-align: center;
  padding: 20px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.lc-empty-mark {
  width: 48px;
  height: 32px;
  border-radius: 999px;
  background: var(--tint);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.lc-empty-h { margin: 0; font-family: var(--serif); font-size: 24px; font-weight: 500; color: var(--ink); }
.lc-empty-p { margin: 0; font-size: 13.5px; line-height: 20px; color: var(--muted); }
.lc-empty-sub { margin: 0; font-size: 12.5px; color: var(--soft); }
.lc-starters { display: flex; flex-direction: column; gap: 7px; width: 100%; margin-top: 6px; }
.lc-starter {
  padding: 9px 13px;
  border-radius: 12px;
  border: 1px solid var(--card-line);
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background .14s, border-color .14s;
}
.lc-starter:hover { background: var(--tint); border-color: var(--brown); }

.lc-msg { display: flex; flex-direction: column; gap: 6px; max-width: 100%; }
.lc-msg.is-user { align-items: flex-end; }
.lc-msg.is-user .lc-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px 16px 4px 16px;
  background: var(--brown);
  color: var(--bg);
}
.lc-user-txt { margin: 0; font-size: 14px; line-height: 20px; white-space: pre-wrap; overflow-wrap: anywhere; }
.lc-msg.is-ai .lc-bubble {
  padding: 2px 2px;
  color: var(--ink);
  font-size: 14px;
  line-height: 21px;
}
.lc-md > :first-child { margin-top: 0; }
.lc-md > :last-child { margin-bottom: 0; }
.lc-thinking { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; padding: 6px 0; }
.lc-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--brown);
  animation: lcPulse 1.1s ease-in-out infinite;
}
@keyframes lcPulse { 0%, 100% { opacity: .35; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.1); } }

/* Tool steps */
.lc-steps { display: flex; flex-direction: column; gap: 4px; }
.lc-step {
  border-radius: 10px;
  border: 1px solid var(--hair);
  background: var(--tint);
  overflow: hidden;
}
.lc-step-sum {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
}
.lc-step-sum::-webkit-details-marker { display: none; }
.lc-step-dot { width: 7px; height: 7px; border-radius: 999px; background: var(--soft); flex: none; }
.lc-step.is-ok .lc-step-dot { background: var(--ok); }
.lc-step.is-err .lc-step-dot { background: var(--no); }
.lc-step.is-run .lc-step-dot { background: var(--warn); animation: lcPulse 1s infinite; }
.lc-step-name { font-family: var(--mono); font-size: 11.5px; color: var(--ink); flex: none; }
.lc-step-arg { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; color: var(--soft); }
.lc-step-ms { flex: none; font-size: 11px; color: var(--soft); font-variant-numeric: tabular-nums; }
.lc-step-body { padding: 8px 10px; border-top: 1px solid var(--hair); display: flex; flex-direction: column; gap: 6px; }
.lc-step-pre {
  margin: 0;
  max-height: 180px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 16px;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.lc-step-pre.is-out { color: var(--muted); border-top: 1px dotted var(--hair); padding-top: 6px; }

/* Created node chips, approvals & flag controls */
.lc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.lc-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--card-line);
  background: var(--tint);
  color: var(--ink);
  font-size: 12px;
  cursor: pointer;
}
.lc-chip:hover { border-color: var(--brown); background: var(--tint2); }
.lc-chip-k { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--soft); }
.lc-approval {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--warn);
  background: var(--warn-bg);
}
.lc-approval-txt { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: var(--ink); }
.lc-approval-acts { display: flex; gap: 6px; flex: none; }
.lc-msg-foot { display: flex; align-items: center; gap: 8px; }
.lc-flag-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--soft);
  font-size: 11.5px;
  cursor: pointer;
}
.lc-flag-btn:hover { background: var(--tint); color: var(--ink); }
.lc-flag-btn.is-flagged { color: var(--no); background: var(--no-bg); }
.lc-flag-form {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--card-line);
  background: var(--tint);
}
.lc-flag-form input {
  flex: 1;
  min-width: 180px;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--card-line);
  background: light-dark(#fff, #1B1817);
  color: var(--ink);
  font-size: 12.5px;
}
.lc-flag-note { margin: 0; font-size: 12px; color: var(--no); }

/* Composer */
.lc-foot {
  flex: none;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--hair);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.lc-focus-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--tint);
  border: 1px solid var(--card-line);
  color: var(--muted);
  font-size: 11.5px;
  width: fit-content;
}
.lc-focus-x { border: 0; background: transparent; color: var(--soft); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px; }
.lc-focus-x:hover { color: var(--ink); }
.lc-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 6px 6px 6px 12px;
  border-radius: 14px;
  border: 1px solid var(--card-line);
  background: light-dark(#FDFCFB, #181514);
}
.lc-composer:focus-within { border-color: var(--brown); }
.lc-composer textarea {
  flex: 1;
  min-height: 28px;
  max-height: 180px;
  resize: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  line-height: 20px;
  padding: 4px 0;
  outline: none;
}
.lc-send {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 0;
  background: var(--brown);
  color: var(--bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.lc-send[hidden] { display: none; }
.lc-send:hover { background: var(--ink); }
.lc-send.is-stop { background: var(--no); color: light-dark(#FDFCFB, #1B1817); }

/* Split live mind map pane */
.lc-map-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-radius: 18px;
  border: 1px solid var(--card-line);
  background: light-dark(#FAF7F5, #191615);
  overflow: hidden;
}
.lc-map-bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--hair);
}
.lc-map-title { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.lc-map-bar-r { display: flex; align-items: center; gap: 8px; }
.lc-map-open { font-size: 12px; color: var(--muted); text-decoration: none; }
.lc-map-open:hover { color: var(--ink); text-decoration: underline; }
.lc-map-fit {
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--card-line);
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  cursor: pointer;
}
.lc-map-fit:hover { background: var(--tint); }
.lc-map-stage { position: relative; flex: 1; min-height: 260px; }
.lc-map-layers { position: absolute; left: 10px; bottom: 10px; z-index: 4; }
.lc-map-layers .lib-layers { position: static; }

@media (max-width: 900px) {
  .lc-page.is-split {
    grid-template-columns: 1fr;
    height: auto;
  }
  .lc-page.is-split .lc-shell { height: 62dvh; }
  .lc-page.is-split .lc-map-pane { height: 46dvh; }
}

/* Loop chat on the right side of the Library map (map-chat.js). The map and the chat read as one box. */
.mem-stage:has(> .mem-chat) { display: flex; align-items: stretch; }
.mem-stage:has(> .mem-chat) > .mem-brain-shell { flex: 1; min-width: 0; border-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.mem-chat { flex: none; width: clamp(240px, 34%, 330px); min-height: 0; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--card-line); border-radius: 0 18px 18px 0; background: light-dark(#FAF6F4, #1D1B1A); }
.mc-head { flex: none; display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 8px 0 14px; border-bottom: 1px solid var(--card-line); }
.mc-mark { display: inline-flex; color: var(--ink); }
.mc-title { flex: 1; margin: 0; font-size: 14px; font-weight: 500; color: var(--ink); }
.mc-icon { flex: none; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; text-decoration: none; }
.mc-icon:hover { background: var(--tint); color: var(--ink); }
.mc-icon:focus-visible, .mc-send:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.mc-log { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.mc-empty { margin: auto 0; padding: 0 8px; font-size: 13px; line-height: 1.55; color: var(--soft); text-align: center; }
.mc-empty a, .mc-note a { color: var(--ink); }
.mc-msg { font-size: 13px; line-height: 1.55; color: var(--ink); overflow-wrap: anywhere; }
.mc-msg.is-user { align-self: flex-end; max-width: 88%; padding: 7px 11px; border-radius: 14px 14px 4px 14px; background: var(--tint); }
.mc-msg.is-user p { margin: 0; white-space: pre-wrap; }
.mc-msg .lc-md { font-size: 13px; }
.mc-msg .lc-md table { display: block; max-width: 100%; overflow-x: auto; font-size: 12px; }
.mc-msg .lc-md :is(th, td) { padding: 5px 8px; }
.mc-steps { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font-size: 11.5px; color: var(--soft); }
.mc-steps.is-run i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: mc-pulse 1s ease-in-out infinite; }
.mc-typing { display: flex; gap: 4px; margin: 2px 0; }
.mc-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--soft); animation: mc-pulse 1.1s ease-in-out infinite; }
.mc-typing i:nth-child(2) { animation-delay: .15s; }
.mc-typing i:nth-child(3) { animation-delay: .3s; }
.mc-note { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.mc-form { flex: none; display: flex; align-items: flex-end; gap: 6px; margin: 0 10px 10px; padding: 6px 6px 6px 12px; border: 1px solid var(--card-line); border-radius: 16px; background: light-dark(#fff, #241F1E); }
.mc-form:focus-within { border-color: light-dark(rgba(77, 53, 51, .34), rgba(230, 216, 214, .3)); }
.mem-chat .mc-input { flex: 1; min-width: 0; height: 28px; min-height: 28px; max-height: 132px; padding: 4px 0; border: 0; resize: none; background: transparent; color: var(--ink); font: inherit; font-size: 13px; line-height: 20px; outline: none; }
.mc-input::placeholder { color: var(--soft); }
.mc-send { flex: none; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 999px; background: var(--ink); color: var(--bg); cursor: pointer; }
.mc-send:disabled { opacity: .3; cursor: default; }
@keyframes mc-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .mc-steps.is-run i, .mc-typing i { animation: none; } }
/* Phones: the map has no room beside it; the Loop logo at the top opens the full chat. */
@media (max-width: 640px) {
  .mem-chat { display: none; }
  .mem-stage:has(> .mem-chat) > .mem-brain-shell { border-right: 1px solid var(--card-line); border-radius: 18px; }
}

/* Library map page: no search above it, and the map fills the window. Its gap to each side and to the
   title above is the same 22px as the gap above the bottom nav. On wide windows it starts after the side menu. */
@media (min-width: 641px) {
  .wrap:has(:where(.view:not(.is-staged)) .mem-stage) { width: auto; max-width: none; margin: 0 22px; }
  .wrap:has(:where(.view:not(.is-staged)) .mem-stage) > main#main { padding-left: 0; padding-right: 0; }
  .wrap:has(:where(.view:not(.is-staged)) .mem-stage) .mem-stage { margin-top: 7px; }
  /* The page's heading is for screen readers only; its row takes no room. */
  .wrap:has(:where(.view:not(.is-staged)) .mem-stage) .mem-top { height: 0; min-height: 0; overflow: hidden; }
}
@media (min-width: 980px) {
  .wrap:has(:where(.view:not(.is-staged)) .mem-stage) > main { --hm-shift: 0px; margin-left: 232px; margin-right: 0; }
}

/* The full-screen map below desktop size: the bottom nav fades out and drops a little as the map
   grows, and comes back after the map is back in place. `translate` adds to the nav's own centring
   transform. On desktop the map opens full screen and the nav stays on it. */
.nav { transition: opacity .26s cubic-bezier(.2, .8, .2, 1), translate .26s cubic-bezier(.2, .8, .2, 1), visibility 0s; }
@media (max-width: 979.98px) {
  body:has(:where(.view:not(.is-staged)) .mem-brain-shell:is(.is-wide, .is-moving)) .nav { opacity: 0; translate: 0 12px; visibility: hidden; pointer-events: none; transition: opacity .2s ease, translate .2s ease, visibility 0s .2s; }
}
@media (prefers-reduced-motion: reduce) {
  .nav, body:has(:where(.view:not(.is-staged)) .mem-brain-shell:is(.is-wide, .is-moving)) .nav { translate: none; }
}

/* Full screen: the Loop chat stays on the right side, and the map fills the rest of the window.
   While the map grows or shrinks, the chat moves with it (setWide, memory-view.js). */
@media (min-width: 641px) {
  .mem-stage:has(> .mem-chat) { --mc-wide: 340px; }
  .mem-stage:has(> .mem-chat) > .mem-brain-shell.is-wide { right: var(--mc-wide); }
  .mem-stage:has(> .mem-brain-shell:is(.is-wide, .is-moving)) > .mem-chat { position: fixed; z-index: 15; }
  .mem-stage:has(> .mem-brain-shell.is-wide) > .mem-chat { top: 0; right: 0; bottom: 0; width: var(--mc-wide); border-width: 0 0 0 1px; border-radius: 0; }
}
/* Wide windows keep the top bar in full screen: the chat's header makes room for the ⋯ button and
   lines up with it. */
@media (min-width: 980px) {
  .mem-stage:has(> .mem-brain-shell.is-wide) > .mem-chat .mc-head { height: 64px; padding-right: 64px; }
}

/* The parts of Loop on the map (lib/loop-map.mjs): connections, skills, schedules, Vault entries, and
   any kind of item that an agent added (a tag type-<kind>). Colours match the canvas (memory-graph.js). */
.k-connections { --mem-c: light-dark(#2F6F6A, #86C2BC); }
.k-skills { --mem-c: light-dark(#6E7A34, #B8C47C); }
.k-vault { --mem-c: light-dark(#8A6D2C, #D2B46F); }
.k-typed { --mem-c: light-dark(#7A4E7E, #C59BC9); }
.lib-mark[data-kind=connection], .mem-node-link i.lib-mark[data-kind=connection] { width: 12px; height: 7px; border-radius: 4px; }
.lib-mark[data-kind=skill], .mem-node-link i.lib-mark[data-kind=skill] { width: 10px; height: 9px; border-radius: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.lib-mark[data-kind=schedule], .mem-node-link i.lib-mark[data-kind=schedule] { width: 10px; height: 9px; border-radius: 0; clip-path: polygon(0 0, 100% 0, 50% 100%); }
.lib-mark[data-kind=secret], .mem-node-link i.lib-mark[data-kind=secret] { width: 10px; height: 10px; border-radius: 0; clip-path: polygon(25% 0, 75% 0, 100% 50%, 50% 100%, 0 50%); }
.hm-jump[data-mark=connections]::before { width: 10px; height: 6px; border-radius: 3px; background: light-dark(#2F6F6A, #86C2BC); }
.hm-jump[data-mark=people]::before { border-radius: 0; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: light-dark(#4D3533, #E6D8D6); }
.hm-jump[data-mark=skills]::before { border-radius: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); background: light-dark(#6E7A34, #B8C47C); }
.hm-jump[data-mark=vault]::before { border-radius: 0; clip-path: polygon(25% 0, 75% 0, 100% 50%, 50% 100%, 0 50%); background: light-dark(#8A6D2C, #D2B46F); }
.hm-jump[data-mark=tasks]::before { border-radius: 1px; transform: rotate(45deg) scale(.84); background: light-dark(#A0603A, #CD906D); }
.hm-jump[data-mark=notes]::before { border-radius: 2px; background: light-dark(#6B5B8E, #B2A4D6); }
.hm-jump[data-mark=sources]::before { border-radius: 2px; background: light-dark(#3F5F7A, #9DBCD7); }
.hm-jump[data-mark=typed]::before { border-radius: 2px; background: light-dark(#7A4E7E, #C59BC9); }
.k-apps { --mem-c: light-dark(#7A4E7E, #C59BC9); }
.lib-mark[data-kind=app] { border-radius: 3px; width: 10px; height: 10px; }
.hm-jump[data-mark=apps]::before { border-radius: 2px; width: 8px; height: 8px; background: light-dark(#7A4E7E, #C59BC9); }

/* Apps (app-view.js): the apps that the Loop chat built, with their own tables and records. */
.ap-page { max-width: 1080px; margin: 0 auto; padding: 8px 0 120px; }
.ap-back { display: inline-flex; align-items: center; gap: 2px; margin-left: -6px; padding: 4px 8px 4px 2px; border-radius: 8px; color: var(--muted); font-size: 13.5px; text-decoration: none; }
.ap-back:hover { color: var(--ink); background: var(--tint); }
.ap-h { margin: 10px 0 4px; font-family: var(--serif, Georgia, serif); font-weight: 400; font-size: 30px; line-height: 1.15; color: var(--ink); }
.ap-sub { margin: 0 0 18px; font-size: 14px; line-height: 1.5; color: var(--soft); max-width: 640px; }
.ap-head { display: flex; align-items: flex-start; gap: 12px; }
.ap-head-t { flex: 1; min-width: 0; }
.ap-head .btn { margin-top: 14px; }
.ap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-top: 18px; }
.ap-card { display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 1px solid var(--card-line); border-radius: 16px; background: var(--card); color: var(--ink); text-decoration: none; transition: border-color .15s, transform .15s; }
.ap-card:hover { border-color: var(--line); transform: translateY(-1px); }
.ap-card-n { font-size: 16px; font-weight: 600; }
.ap-card-d { font-size: 13px; line-height: 1.45; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ap-card-m { margin-top: auto; font-size: 12px; color: var(--soft); }
.ap-none { margin-top: 18px; padding: 28px; border: 1px dashed var(--line); border-radius: 16px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.55; }
.ap-none p { margin: 0 0 8px; }
.ap-none .btn { margin-top: 6px; }
.ap-tabs { display: flex; gap: 4px; margin: 4px 0 12px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.ap-tab { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 12px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; color: var(--muted); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.ap-tab span { font-size: 12px; color: var(--soft); font-variant-numeric: tabular-nums; }
.ap-tab[aria-selected=true] { color: var(--ink); border-bottom-color: var(--ink); }
.ap-bar { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; flex-wrap: wrap; }
.ap-search { flex: 1 1 200px; min-width: 0; height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); font: inherit; font-size: 13.5px; }
.ap-search:focus { outline: none; border-color: var(--soft); }
.ap-seg { display: inline-flex; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.ap-seg button { height: 28px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.ap-seg button[aria-pressed=true] { background: var(--tint); color: var(--ink); font-weight: 500; }
.ap-count { font-size: 12.5px; color: var(--soft); font-variant-numeric: tabular-nums; }
.ap-table-wrap { overflow-x: auto; border: 1px solid var(--card-line); border-radius: 14px; background: var(--card); }
.ap-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ap-table th { position: sticky; top: 0; padding: 10px 12px; text-align: left; font-size: 12px; font-weight: 500; color: var(--soft); background: var(--card); border-bottom: 1px solid var(--line); white-space: nowrap; }
.ap-table td { padding: 10px 12px; border-bottom: 1px solid var(--card-line); color: var(--ink); vertical-align: top; max-width: 280px; }
.ap-table tr:last-child td { border-bottom: 0; }
.ap-table tbody tr { cursor: pointer; transition: background .12s; }
.ap-table tbody tr:hover, .ap-table tbody tr:focus-visible { background: var(--tint); outline: none; }
.ap-table td.is-first { font-weight: 500; }
.ap-table .t-number, .ap-table .t-money { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ap-table .t-date { white-space: nowrap; font-variant-numeric: tabular-nums; }
.ap-empty { color: var(--soft); }
.ap-yes { color: var(--ok); font-weight: 500; }
.ap-clip { color: var(--muted); }
.ap-link { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 2px; }
.ap-chip { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--chip-bg, var(--tint)); color: var(--chip-c, var(--ink)); }
.ap-chip[data-opt="0"] { --chip-bg: light-dark(#E9EEF6, #273140); --chip-c: light-dark(#3F5F7A, #A9C4DD); }
.ap-chip[data-opt="1"] { --chip-bg: light-dark(#F6EEDF, #3A3022); --chip-c: light-dark(#8A6D2C, #D8BC7C); }
.ap-chip[data-opt="2"] { --chip-bg: light-dark(#E6F1EA, #233429); --chip-c: light-dark(#3F7556, #96C7A8); }
.ap-chip[data-opt="3"] { --chip-bg: light-dark(#F3E6EE, #3A2533); --chip-c: light-dark(#7A4E7E, #D1A6D4); }
.ap-chip[data-opt="4"] { --chip-bg: light-dark(#F6E7E2, #3D2723); --chip-c: light-dark(#A0603A, #DDA283); }
.ap-chip[data-opt="5"] { --chip-bg: light-dark(#E5F0EF, #20322F); --chip-c: light-dark(#2F6F6A, #8CC8C1); }
.ap-chip[data-opt="6"] { --chip-bg: light-dark(#EFEFE3, #2F3022); --chip-c: light-dark(#6E7A34, #BDC88A); }
.ap-chip[data-opt="7"] { --chip-bg: light-dark(#ECE8F4, #2C2838); --chip-c: light-dark(#5A5A8C, #B5B5E0); }
.ap-ref { display: inline-flex; align-items: center; gap: 6px; height: 24px; margin: 0 4px 4px 0; padding: 0 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink); font: inherit; font-size: 12.5px; cursor: pointer; }
.ap-ref:hover { background: var(--tint); }
.ap-ref em { font-style: normal; color: var(--soft); font-size: 11.5px; }
.ap-board { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding-bottom: 8px; }
.ap-col { flex: 0 0 250px; display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 14px; background: var(--tint); min-height: 120px; transition: box-shadow .15s; }
.ap-col.is-over { box-shadow: inset 0 0 0 2px var(--soft); }
.ap-col-h { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 2px; font-size: 12px; font-weight: 500; color: var(--soft); }
.ap-col-list { display: flex; flex-direction: column; gap: 8px; }
.ap-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; padding: 10px 12px; border: 1px solid var(--card-line); border-radius: 12px; background: var(--card); color: var(--ink); font: inherit; text-align: left; cursor: grab; }
.ap-tile:hover { border-color: var(--line); }
.ap-tile.is-drag { opacity: .45; }
.ap-tile-t { font-size: 13.5px; font-weight: 500; }
.ap-tile-f { font-size: 12.5px; color: var(--muted); }
.ap-scrim { position: fixed; inset: 0; z-index: 40; background: light-dark(rgba(0, 0, 0, .18), rgba(0, 0, 0, .45)); }
.ap-panel { position: fixed; top: 12px; right: 12px; bottom: 12px; z-index: 41; width: min(420px, calc(100vw - 24px)); display: flex; border: 1px solid var(--card-line); border-radius: 18px; background: var(--card); box-shadow: 0 18px 48px light-dark(rgba(0, 0, 0, .22), rgba(0, 0, 0, .55)); animation: ap-in .2s cubic-bezier(.2, .8, .2, 1); }
@keyframes ap-in { from { opacity: 0; transform: translateX(16px); } }
@media (prefers-reduced-motion: reduce) { .ap-panel { animation: none; } }
.ap-form { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ap-form-h { display: flex; align-items: center; gap: 8px; padding: 16px 16px 10px 20px; }
.ap-form-h h2 { flex: 1; margin: 0; font-size: 17px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-x { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 999px; background: none; color: var(--muted); cursor: pointer; }
.ap-x:hover { background: var(--tint); color: var(--ink); }
.ap-form-b { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 20px 12px; display: flex; flex-direction: column; gap: 14px; }
.ap-f { display: flex; flex-direction: column; gap: 6px; }
.ap-l { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.ap-l span { font-weight: 400; color: var(--soft); }
.ap-i { display: flex; align-items: center; gap: 8px; }
.ap-i input:not([type=checkbox]), .ap-i select, .ap-i textarea { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); font: inherit; font-size: 14px; }
.ap-i textarea { resize: vertical; min-height: 84px; line-height: 1.45; }
.ap-i input:focus, .ap-i select:focus, .ap-i textarea:focus { outline: none; border-color: var(--soft); }
.ap-unit { font-size: 12px; color: var(--soft); }
.ap-check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); }
.ap-hint { margin: 0; font-size: 13px; color: var(--soft); }
.ap-backs { display: flex; flex-wrap: wrap; }
.ap-err { margin: 0; font-size: 13px; color: var(--no); }
.ap-form-f { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--card-line); }
.ap-gap { flex: 1; }
@media (max-width: 640px) {
  .ap-h { font-size: 26px; }
  .ap-panel { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 86vh; }
  .ap-col { flex-basis: 78vw; }
}

/* The map's layout in the side menu: its name, Default, its groups (each with its colour), and the kept layouts. */
.hm-rail-list > .hm-rail-k.mem-lay-k { align-items: center; }
.mem-lay-k > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.mem-lay-x { flex: none; margin: -3px 0; padding: 2px 8px; border: 1px solid var(--hair); border-radius: 999px; background: transparent; font: inherit; font-size: 11.5px; font-weight: 500; color: var(--muted); cursor: pointer; }
.mem-lay-x:hover { color: var(--ink); border-color: var(--line, var(--hair)); }
.mem-lay-x:focus-visible { outline: 2px solid var(--focus, currentColor); outline-offset: 2px; }
.mem-lay-note { margin: -2px 12px 6px; font-size: 12px; color: var(--soft); }
.hm-jump[data-mark=layout]::before { width: 8px; height: 8px; border-radius: 2px; background: var(--lay, var(--muted)); }
.mem-lay-use .hm-jump-n { color: var(--soft); }
.mem-lay-use::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 2px; box-sizing: border-box; border: 1.5px dashed var(--muted); }
.mem-lay-row { display: flex; align-items: center; gap: 2px; }
.mem-lay-row > .hm-jump { flex: 1; min-width: 0; }
.mem-lay-del { flex: none; width: 22px; height: 22px; margin-right: 4px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 999px; background: transparent; color: var(--soft); cursor: pointer; opacity: .55; }
.mem-lay-del:hover { opacity: 1; background: var(--tint); color: var(--ink); }

/* The pictures of the map that the agent looked at, in the map chat. */
.mc-pics { display: grid; gap: 6px; margin: 0 0 8px; }
.mc-pics.is-many { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mc-pic { margin: 0; }
.mc-pic.is-gone { display: none; }
.mc-pic-open { display: block; width: 100%; padding: 0; border: 1px solid var(--card-line); border-radius: 8px; overflow: hidden; background: var(--tint); cursor: zoom-in; aspect-ratio: 16 / 10; }
.mc-pic-open img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mc-pic-open:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.mc-pic figcaption { margin-top: 3px; font-size: 11px; color: var(--soft); }
.mc-pic-full { max-width: min(92vw, 1500px); max-height: 92vh; padding: 8px; border: 0; border-radius: 10px; background: var(--card); cursor: zoom-out; }
.mc-pic-full::backdrop { background: light-dark(rgba(0, 0, 0, .55), rgba(0, 0, 0, .72)); }
.mc-pic-full img { display: block; max-width: 100%; max-height: calc(92vh - 50px); margin: 0 auto; border-radius: 6px; }
.mc-pic-full p { margin: 6px 0 0; font-size: 12px; color: var(--soft); text-align: center; }
/* The frame that shows where Loop looked on the map. */
.mem-seen { position: absolute; pointer-events: none; border: 2px solid light-dark(#C96442, #E0896B); border-radius: 10px; animation: mem-seen 1.8s ease-out forwards; z-index: 3; }
.mem-seen span { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); padding: 3px 10px; border-radius: 999px; background: light-dark(#C96442, #E0896B); color: light-dark(#FFFDF9, #1C1B1A); font-size: 12px; font-weight: 600; white-space: nowrap; }
@keyframes mem-seen { 0% { opacity: 0; } 12% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .mem-seen { animation: none; } }

/* Map view mode switcher (Kind / Projects / Categories), search bar, hover preview, inspector badges, legend, and collapsible chat. */
.mem-lay-modes { display: grid; grid-template-columns: auto auto 1fr; gap: 2px; margin: 4px 0 8px 10px; padding: 2px; border-radius: 9px; background: var(--tint); border: 1px solid var(--card-line); }
.mem-lay-m { height: 24px; padding: 0 6px; border: 0; border-radius: 7px; background: transparent; font: inherit; font-size: 10.5px; font-weight: 500; color: var(--soft); cursor: pointer; white-space: nowrap; transition: background .12s, color .12s; }
/* The zoom bar and the map key sit above the bottom menu at every width (they were under it on wide windows). */
.mem-stage:has(.mem-chat):not(.is-chat-closed) .mem-brain-zoom { bottom: 84px; }
.mem-stage:has(.mem-chat):not(.is-chat-closed) .mem-legend { bottom: 128px; }
.mem-lay-m:hover { color: var(--ink); }
.mem-lay-m[aria-pressed=true] { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px light-dark(rgba(77, 53, 51, .1), rgba(0, 0, 0, .35)); }

/* Quick real-Loop spotlight pills in the left rail (Needs attention, Vault keys, Agents). */
.mem-spotlights { display: flex; flex-direction: column; gap: 3px; margin: 2px 6px 10px; }
.mem-spot-btn { display: flex; align-items: center; gap: 7px; width: 100%; height: 28px; padding: 0 9px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-size: 12px; font-weight: 500; text-align: left; cursor: pointer; transition: background .12s, color .12s, border-color .12s; }
.mem-spot-btn:hover { background: var(--tint); color: var(--ink); }
.mem-spot-btn[aria-pressed=true] { background: var(--tint); border-color: var(--card-line); color: var(--ink); }
.mem-spot-btn i { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.mem-spot-btn.is-warn i { background: light-dark(#D48A28, #F0B254); }
.mem-spot-btn.is-key i { background: light-dark(#9A7222, #DFB85F); }
.mem-spot-btn.is-agent i { background: light-dark(#4D3533, #E6D8D6); }
.mem-spot-btn span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mem-spot-btn b { flex: none; font-weight: 600; font-size: 11px; padding: 1px 6px; border-radius: 999px; background: var(--tint); color: var(--muted); font-variant-numeric: tabular-nums; }
.mem-spot-btn.is-warn b { background: light-dark(#F8EFE0, #392E1D); color: light-dark(#9A6416, #F0B862); }
.mem-spot-btn.is-key b { background: light-dark(#F6EEDF, #3A3022); color: light-dark(#8A6D2C, #DFB85F); }
.mem-proj-cta { display: inline-flex; align-items: center; gap: 6px; width: calc(100% - 12px); margin: 0 6px 8px; padding: 6px 10px; border: 1px dashed var(--card-line); border-radius: 9px; background: var(--tint); color: var(--ink); font: inherit; font-size: 11.5px; font-weight: 500; cursor: pointer; }
.mem-proj-cta:hover { background: var(--tint2); border-color: var(--line); }
.mem-hl-step { display: inline-flex; align-items: center; gap: 1px; padding: 0 2px; border-left: 1px solid var(--card-line); border-right: 1px solid var(--card-line); }
.mem-hl-nav { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; }
.mem-hl-nav:hover { background: var(--tint); color: var(--ink); }
.mem-zoom-pct { min-width: 36px; padding: 0 3px; font-size: 11.5px; font-weight: 500; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; user-select: none; }
.mem-zoom-groups { gap: 5px; padding: 0 9px; font-size: 12px; }
.mem-zoom-lbl { font-size: 11.5px; font-weight: 500; white-space: nowrap; }

/* Floating centered canvas toolbar (Search & Jump + Active Filter/Highlight stepper pill).
   Sits cleanly below Library on desktop and below .mem-pill / #mem-back on narrow or embedded layouts so nothing ever overlaps. */
.mem-top-bar { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); z-index: 6; display: flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: calc(100% - 24px); pointer-events: none; }
@media (min-width: 980px) {
  .mem-brain-shell.is-wide .mem-top-bar { top: 56px; left: calc(50% + var(--rail-r, 0px) / 2); max-width: calc(100% - var(--rail-r, 0px) - 32px); flex-wrap: nowrap; }
}
@media (max-width: 979.98px) {
  .mem-top-bar { top: 58px; left: 12px; right: 12px; transform: none; max-width: none; justify-content: flex-start; }
  .mem-find-wrap { flex: 1 1 160px; width: auto; max-width: 280px; }
}
.mem-feed-btn.mem-back { max-width: min(210px, calc(100% - 24px)); }
.mem-feed-btn.mem-back > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
dialog.mem-editor-dialog[data-modal="keep"]::backdrop { background: light-dark(rgba(45, 34, 32, .32), rgba(0, 0, 0, .58)); backdrop-filter: blur(4px); }
.mem-find-wrap { pointer-events: auto; position: relative; display: flex; align-items: center; gap: 6px; width: clamp(190px, 24vw, 290px); height: 34px; padding: 0 8px 0 11px; border-radius: 999px; background: light-dark(rgba(255, 253, 249, .94), rgba(23, 22, 20, .94)); border: 1px solid var(--card-line); backdrop-filter: blur(10px); box-shadow: 0 2px 10px light-dark(rgba(77, 53, 51, .08), rgba(0, 0, 0, .3)); transition: border-color .15s, box-shadow .15s; }
.mem-find-wrap:focus-within { border-color: light-dark(rgba(77, 53, 51, .34), rgba(230, 216, 214, .34)); box-shadow: 0 4px 16px light-dark(rgba(77, 53, 51, .12), rgba(0, 0, 0, .42)); }
.mem-find-ic { flex: none; display: inline-flex; color: var(--soft); }
.mem-find-wrap input.mem-find-input { flex: 1; min-width: 0; width: 100%; height: 28px; min-height: 0; padding: 0; margin: 0; border: 0; border-bottom: 0; border-radius: 0; box-shadow: none; background: transparent; color: var(--ink); font: inherit; font-size: 12.5px; line-height: 28px; outline: none; }
.mem-find-wrap input.mem-find-input:focus { border: 0; box-shadow: none; outline: none; }
.mem-find-input::placeholder { color: var(--soft); }
.mem-find-input::-webkit-search-cancel-button { display: none; }
.mem-find-kbd { flex: none; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--card-line); background: var(--tint); font-family: inherit; font-size: 10.5px; font-weight: 500; color: var(--soft); line-height: 16px; }
.mem-find-clear { flex: none; width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 999px; background: var(--tint); color: var(--muted); cursor: pointer; }
.mem-find-clear:hover { color: var(--ink); background: var(--line); }
.mem-find-clear[hidden], .mem-find-kbd[hidden] { display: none; }
.mem-find-menu { position: absolute; top: calc(100% + 6px); left: 0; right: 0; min-width: 268px; max-height: 310px; overflow-y: auto; padding: 5px; border-radius: 14px; background: light-dark(rgba(255, 253, 249, .98), rgba(24, 22, 21, .98)); border: 1px solid var(--card-line); box-shadow: 0 14px 34px light-dark(rgba(77, 53, 51, .16), rgba(0, 0, 0, .52)); backdrop-filter: blur(12px); }
.mem-find-menu[hidden] { display: none; }
.mem-find-opt { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 34px; padding: 5px 9px; border: 0; border-radius: 9px; background: transparent; color: var(--ink); font: inherit; font-size: 12.5px; text-align: left; cursor: pointer; }
.mem-find-opt:hover, .mem-find-opt.is-active { background: var(--tint); }
.mem-find-opt-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.mem-find-opt-k { flex: none; font-size: 11px; color: var(--soft); white-space: nowrap; }
.mem-find-empty { padding: 10px 12px; font-size: 12.5px; color: var(--soft); text-align: center; }

.mem-hl-pill { pointer-events: auto; display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 6px 0 12px; border-radius: 999px; background: light-dark(rgba(255, 253, 249, .95), rgba(23, 22, 20, .95)); border: 1px solid var(--card-line); backdrop-filter: blur(10px); box-shadow: 0 2px 10px light-dark(rgba(77, 53, 51, .1), rgba(0, 0, 0, .32)); font-size: 12px; font-weight: 500; color: var(--ink); white-space: nowrap; }
.mem-hl-pill[hidden] { display: none; }
.mem-hl-dot { width: 7px; height: 7px; border-radius: 50%; background: light-dark(#C96442, #E0896B); flex: none; }
.mem-hl-x { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border: 0; border-radius: 999px; background: var(--tint); color: var(--ink); font: inherit; font-size: 11.5px; font-weight: 500; cursor: pointer; }
.mem-hl-x:hover { background: var(--line); }

/* Lightweight floating hover preview tooltip (replaces jarring hover delete button). */
.mem-hover-tip { position: absolute; left: 0; top: 0; z-index: 7; max-width: 268px; padding: 8px 11px; border-radius: 11px; pointer-events: none; background: light-dark(rgba(255, 253, 249, .97), rgba(24, 22, 21, .97)); border: 1px solid var(--card-line); backdrop-filter: blur(10px); box-shadow: 0 10px 26px light-dark(rgba(77, 53, 51, .14), rgba(0, 0, 0, .48)); will-change: transform; }
.mem-hover-tip[hidden] { display: none; }
.mem-tip-h { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.mem-tip-t { font-size: 12.5px; font-weight: 600; color: var(--ink); line-height: 1.3; overflow-wrap: anywhere; }
.mem-tip-sub { margin: 4px 0 0; font-size: 11.5px; line-height: 1.4; color: var(--muted); }

/* Upgraded Node Inspector Card header, health badges, category/project chips, and actions. */
.mem-node-head { display: flex; align-items: flex-start; gap: 8px; }
.mem-node-mark { margin-top: 5px; }
.mem-node-acts.is-card { width: min(316px, calc(100% - 32px)); }
.mem-brain-shell.is-wide .mem-node-acts.is-card:not(.is-sheet) { max-height: calc(100% - 208px); }
.mem-node-acts.is-card .mem-node-btns { flex-wrap: wrap; justify-content: flex-start; gap: 5px; }
.mem-node-del.mem-node-copy.mem-node-ask { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.mem-node-del.mem-node-copy.mem-node-ask svg { color: var(--bg); }
.mem-node-del.mem-node-copy.mem-node-ask:hover { opacity: .88; background: var(--ink); color: var(--bg); border-color: var(--ink); }
.mem-status-pill { display: inline-flex; align-items: center; gap: 5px; height: 19px; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 500; white-space: nowrap; }
.mem-status-pill i { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.mem-status-pill.is-ok { background: light-dark(#E5F2EA, #1F3227); color: light-dark(#2C6B48, #83CE9F); }
.mem-status-pill.is-ok i { background: light-dark(#3B7D58, #6EC292); }
.mem-status-pill.is-warn { background: light-dark(#F8EFE0, #392E1D); color: light-dark(#9A6416, #F0B862); }
.mem-status-pill.is-warn i { background: light-dark(#D48A28, #F0B254); }
.mem-status-pill.is-err { background: light-dark(#F9E8E5, #3B2320); color: light-dark(#A83A28, #F08A79); }
.mem-status-pill.is-err i { background: light-dark(#C94A38, #EB7A68); }
.mem-status-pill.is-off { background: var(--tint); color: var(--soft); }
.mem-status-pill.is-off i { background: var(--soft); }
.mem-meta-chip { display: inline-flex; align-items: center; height: 19px; padding: 0 7px; border-radius: 999px; background: var(--tint); color: var(--muted); font-size: 11px; font-weight: 500; white-space: nowrap; }
.mem-meta-chip.is-proj { background: light-dark(#EAEFF6, #252E3A); color: light-dark(#3E5A7A, #9EC0E2); }

/* Map Key & Shortcuts popover anchored above the bottom-right zoom dock. */
.mem-legend { position: absolute; right: 12px; bottom: 54px; z-index: 8; width: 292px; padding: 12px 14px; border-radius: 14px; background: light-dark(rgba(255, 253, 249, .98), rgba(24, 22, 21, .98)); border: 1px solid var(--card-line); backdrop-filter: blur(12px); box-shadow: 0 14px 36px light-dark(rgba(77, 53, 51, .16), rgba(0, 0, 0, .54)); font-size: 12px; color: var(--ink); }
.mem-legend[hidden] { display: none; }
.mem-legend-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.mem-legend-head strong { font-size: 12.5px; font-weight: 600; }
.mem-legend-x { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; }
.mem-legend-x:hover { background: var(--tint); color: var(--ink); }
.mem-legend-sec { padding-top: 8px; margin-top: 8px; border-top: 1px dotted var(--card-line); }
.mem-legend-sec:first-of-type { padding-top: 0; margin-top: 0; border-top: 0; }
.mem-legend-k { margin-bottom: 6px; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--soft); }
.mem-legend-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 8px; }
.mem-legend-i { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.mem-legend-bub { width: 10px; height: 10px; border-radius: 50%; flex: none; background: light-dark(#6E7A34, #B8C47C); box-shadow: 0 0 0 2px light-dark(rgba(110, 122, 52, .24), rgba(184, 196, 124, .28)); }
.mem-leg-unused-key { width: 10px; height: 10px; flex: none; box-sizing: border-box; border: 1.5px dashed light-dark(#A67A24, #E0B45C); border-radius: 2px; transform: rotate(45deg) scale(.82); }
.mem-leg-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.mem-leg-dot.is-ok { background: light-dark(#3B7D58, #6EC292); }
.mem-leg-dot.is-warn { background: light-dark(#D48A28, #F0B254); }
.mem-leg-dot.is-err { background: light-dark(#C94A38, #EB7A68); }
.mem-leg-dot.is-off { background: var(--soft); }
.mem-leg-line { width: 14px; height: 2px; border-radius: 2px; flex: none; }
.mem-leg-line.is-key { background: light-dark(#9A7222, #DFB85F); }
.mem-leg-line.is-reach { height: 0; border-top: 1.5px dotted var(--muted); }
.mem-leg-line.is-link { background: var(--muted); }
.mem-legend-keys { display: flex; flex-wrap: wrap; gap: 5px 10px; font-size: 11px; color: var(--muted); }
.mem-legend-keys kbd { display: inline-block; padding: 0 5px; margin-right: 2px; border-radius: 4px; border: 1px solid var(--card-line); background: var(--tint); font-family: inherit; font-size: 10.5px; color: var(--ink); line-height: 16px; }
.mem-legend-tip { margin: 7px 0 0; font-size: 11px; line-height: 1.45; color: var(--soft); }

/* Collapsible Map Chat Drawer + Reopen pill + Welcome starters + Focused node chip. */
.mem-stage.is-chat-closed > .mem-chat { display: none; }
.mem-stage.is-chat-closed > .mem-brain-shell { border-right: 1px solid var(--card-line); border-radius: 18px; }
.mem-stage.is-chat-closed > .mem-brain-shell.is-wide { right: 0; border-right: 0; border-radius: 0; }
.mem-chat-reopen { position: absolute; top: 14px; right: 14px; z-index: 7; display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--card-line); background: light-dark(rgba(255, 253, 249, .95), rgba(23, 22, 20, .95)); backdrop-filter: blur(10px); box-shadow: 0 2px 12px light-dark(rgba(77, 53, 51, .1), rgba(0, 0, 0, .34)); color: var(--ink); font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; }
.mem-chat-reopen:hover { background: var(--card); border-color: light-dark(rgba(77, 53, 51, .3), rgba(230, 216, 214, .3)); }
.mem-chat-reopen[hidden] { display: none; }
@media (min-width: 980px) {
  .mem-brain-shell.is-wide .mem-chat-reopen { top: 15px; right: 64px; }
}
.mc-welcome { margin: auto 0; padding: 12px 6px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.mc-welcome-mark { display: inline-flex; width: 38px; height: 38px; border-radius: 12px; align-items: center; justify-content: center; background: var(--tint); color: var(--ink); }
.mc-welcome-t { margin: 2px 0 0; font-size: 14px; font-weight: 600; color: var(--ink); }
.mc-welcome-sub { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--soft); max-width: 260px; }
.mc-starters { display: flex; flex-direction: column; gap: 6px; width: 100%; margin-top: 6px; }
.mc-starter { width: 100%; padding: 8px 11px; border-radius: 11px; border: 1px solid var(--card-line); background: light-dark(#fff, #241F1E); color: var(--ink); font: inherit; font-size: 12.5px; font-weight: 500; text-align: left; cursor: pointer; transition: border-color .14s, background .14s; }
.mc-starter:hover { background: var(--tint); border-color: light-dark(rgba(77, 53, 51, .28), rgba(230, 216, 214, .28)); }
.mc-focus { flex: none; display: flex; align-items: center; gap: 6px; margin: 0 10px 6px; padding: 5px 6px 5px 10px; border-radius: 10px; background: var(--tint); border: 1px solid var(--card-line); font-size: 11.5px; color: var(--ink); }
.mc-focus[hidden] { display: none; }
.mc-focus-chip { flex: 1; min-width: 0; display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.mc-focus-chip > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-focus-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; background: light-dark(#C96442, #E0896B); }
.mc-focus-btn { flex: none; height: 22px; padding: 0 8px; border: 1px solid var(--card-line); border-radius: 999px; background: var(--card); color: var(--ink); font: inherit; font-size: 11px; font-weight: 500; cursor: pointer; }
.mc-focus-btn:hover { background: var(--tint2); }
.mc-focus-x { flex: none; width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 999px; background: transparent; color: var(--soft); cursor: pointer; }
.mc-focus-x:hover { background: var(--line); color: var(--ink); }

.mem-node-close { position: absolute; top: 8px; right: 8px; z-index: 2; width: 24px; height: 24px; display: none; align-items: center; justify-content: center; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; }
.mem-node-acts.is-card .mem-node-close { display: inline-flex; }
.mem-node-close:hover { background: var(--tint); color: var(--ink); }
.mem-node-acts.is-card .mem-node-text { padding-right: 26px; }
.mc-steps-fold { margin: 0 0 6px; }
.mc-steps-fold > summary { cursor: pointer; list-style: none; user-select: none; }
.mc-steps-fold > summary::-webkit-details-marker { display: none; }
.mc-steps-fold > summary::after { content: " ▾"; font-size: 10px; opacity: .65; }
.mc-steps-fold[open] > summary::after { content: " ▴"; }
.mc-steps-list { margin: 4px 0 6px; padding: 6px 8px; list-style: none; border-radius: 8px; background: var(--tint); font-size: 11.5px; display: flex; flex-direction: column; gap: 3px; }
.mc-steps-list li { display: flex; align-items: center; gap: 6px; color: var(--soft); }
.mc-steps-list li.is-ok span { color: var(--ok); }
.mc-steps-list li.is-err span { color: var(--no); }
.mc-steps-list code { font-size: 11px; color: var(--ink); }

/* ===========================
   LOOP TEAM & ARTIFACT ACCESS
   =========================== */
.tm-count { font-size: 12px; color: var(--muted); }
.tm-intro { margin: 6px 0 14px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.tm-notice { margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: light-dark(rgba(217, 119, 6, .08), rgba(245, 158, 11, .14)); font-size: 12.5px; line-height: 1.45; }
.tm-notice strong { font-weight: 600; }
.tm-notice-more { margin-top: 6px; color: var(--muted); }
.tm-notice-more > summary { cursor: pointer; width: fit-content; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--hair); }
.tm-notice-more[open] > summary { margin-bottom: 4px; }
.tm-name-form { display: flex; gap: 8px; align-items: flex-end; margin: 0 0 16px; }
.tm-add-form { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface, transparent); margin: 0 0 16px; }
.tm-add-grid { display: grid; grid-template-columns: 1.3fr 1fr 120px; gap: 8px; }
@media (max-width: 640px) { .tm-add-grid { grid-template-columns: 1fr; } }
.tm-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tm-field-grow { flex: 1; }
.tm-lbl { font-size: 11.5px; font-weight: 500; color: var(--muted); }
.tm-field input, .tm-field select { height: 34px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: inherit; font: inherit; font-size: 13px; }
.tm-add-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tm-hint { margin: 0; font-size: 12px; color: var(--muted); }
.tm-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tm-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.tm-row.is-revoked { opacity: .6; }
.tm-avatar { width: 30px; height: 30px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 600; background: light-dark(rgba(77, 53, 51, .1), rgba(230, 216, 214, .14)); flex: none; }
.tm-avatar.is-joined { background: light-dark(rgba(37, 99, 235, .14), rgba(96, 165, 250, .2)); }
.tm-who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.tm-who-name { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-who-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-ctl { display: flex; align-items: center; gap: 6px; flex: none; }
.tm-role-select { height: 30px; padding: 0 8px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: inherit; font: inherit; font-size: 12.5px; }
.tm-joined { margin-top: 18px; }
.tm-view-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.tm-view-head h2 { display: flex; align-items: center; gap: 8px; margin: 0; }
.tm-view-sub { margin: 4px 0 0; }
.tm-role-pill { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.tm-role-pill.is-owner { border-color: light-dark(rgba(22, 163, 74, .4), rgba(74, 222, 128, .4)); color: light-dark(#15803d, #86efac); }
.tm-role-pill.is-admin { border-color: light-dark(rgba(37, 99, 235, .4), rgba(96, 165, 250, .4)); color: light-dark(#1d4ed8, #93c5fd); }
.tm-vis-badge { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 500; border: 1px solid var(--border); }
.tm-vis-badge.is-people { border-color: light-dark(rgba(37, 99, 235, .35), rgba(96, 165, 250, .4)); color: light-dark(#1d4ed8, #93c5fd); }
.tm-vis-badge.is-team { border-color: light-dark(rgba(22, 163, 74, .35), rgba(74, 222, 128, .4)); color: light-dark(#15803d, #86efac); }
.tm-vis-box { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.tm-vis-head { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.tm-vis-mode-field { flex: 1; min-width: 180px; }
.tm-vis-people { display: flex; flex-direction: column; gap: 8px; }
.tm-vis-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.tm-vis-check { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 12.5px; cursor: pointer; }
.tm-vis-email { color: var(--muted); font-size: 11.5px; }
.tm-vis-edit-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.tm-create-form { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 14px; }
.tm-readonly-note { margin: 8px 0 0; opacity: .75; }
.tm-home-card { margin: 0 0 18px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; }
.tm-home-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 13px; }
.tm-home-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tm-home-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; }
.tm-home-link { display: flex; flex-direction: column; text-decoration: none; color: inherit; min-width: 0; flex: 1; }
.tm-home-title { font-size: 13.5px; font-weight: 500; }
.tm-home-meta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
