/* emma vault · one stylesheet, no inline styles (style-src 'self').
   The tokens and base blocks below are copies of public-site/assets/tokens.css
   and base.css with comments removed and font URLs made absolute, so this page
   still renders when /assets/ is not served (fonts then fall back). Do not edit
   them here: change the public files and copy again. local-mvp/test/vault-shell
   fails while a copy differs. */
/* @tokens:start */
:root {
  color-scheme: light;
  --paper:        #F6EFE3;
  --raised:       #FCF8F0;
  --cream:        #EFE4D2;
  --parchment:    #E9DCC7;
  --dark:         #15131F;
  --dark-2:       #26223A;
  --ink:          #2A1810;
  --cocoa:        #604A3C;
  --muted:        #715B4D;
  --on-dark:      #F7E9D2;
  --on-dark-soft: #D0C3B6;
  --coral:        #F7B653;
  --coral-press:  #F2A440;
  --coral-deep:   #A4521D;
  --coral-ink:    #904514;
  --coral-tint:   #F6DFC0;
  --on-coral:     #2A1810;
  --focus-on-coral:#2A1810;
  --coral-quiet:  #D3713E;
  --brick:        #8f2a1b;
  --brick-tint:   #f8e1dc;
  --on-brick:     #fbf4e4;
  --moss:         #2f5a2d;
  --moss-tint:    #e3ecd9;
  --ochre:        #6b4600;
  --ochre-tint:   #f6e7c3;
  --hairline:     #DCCDB9;
  --line:         #C9B59B;
  --line-strong:  #967456;
  --focus:        #2A1810;
  --focus-on-dark:#F7E9D2;
  --font-display: "Fraunces", "Iowan Old Style", "Charter", Georgia, serif;
  --font-text:    "Source Sans 3", "Source Sans Pro", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono:    ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --display-soft: "SOFT" 100, "WONK" 0;
  --display-soft-word: "SOFT" 100, "WONK" 0;
  --tracking-display: 0;
  --tracking-caps: 0.1em;
  --fs-xs:  0.8125rem;
  --fs-sm:  0.9375rem;
  --fs-md:  1.0625rem;
  --fs-lg:  1.25rem;
  --fs-xl:  1.5rem;
  --fs-2xl: 1.875rem;
  --fs-3xl: clamp(2rem, 1.4rem + 2vw, 2.375rem);
  --fs-4xl: clamp(2.25rem, 1.5rem + 3vw, 3.5rem);
  --lh-tight: 1.1;
  --lh-snug:  1.25;
  --lh-text:  1.55;
  --measure:  64ch;
  --s-1: 0.25rem; --s-2: 0.5rem;  --s-3: 0.75rem; --s-4: 1rem;
  --s-5: 1.25rem; --s-6: 1.5rem;  --s-8: 2rem;    --s-10: 2.5rem;
  --s-12: 3rem;   --s-16: 4rem;   --s-20: 5rem;   --s-24: 6rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --page-max: 72rem;
  --app-max:  80rem;
  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 26px;
  --r-pill: 999px;
  --sh-1: 0 1px 2px rgb(42 24 16 / 0.03);
  --sh-2: 0 14px 44px -28px rgb(42 24 16 / 0.25);
  --sh-3: 0 24px 64px -28px rgb(42 24 16 / 0.35);
  --scrim: rgba(43, 26, 18, 0.5);
  --dur-1: 120ms;
  --dur-2: 220ms;
  --dur-3: 420ms;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-in-out: cubic-bezier(0.45, 0, 0.55, 1);
  --breath: 6s;
}
@media (prefers-reduced-motion: reduce) {
  :root { --dur-1: 0ms; --dur-2: 0ms; --dur-3: 0ms; --breath: 0s; }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #15131F;
    --raised: #1E1B2B;
    --cream: #26223A;
    --parchment: #2E293F;
    --dark: #15131F;
    --dark-2: #26223A;
    --ink: #F7E9D2;
    --cocoa: #D7CBD0;
    --muted: #BCB1C3;
    --on-dark: #F7E9D2;
    --on-dark-soft: #D0C3B6;
    --coral-ink: #FCC867;
    --coral-tint: #3A2B2A;
    --coral-deep: #F2A440;
    --brick: #f0a090;
    --brick-tint: #4a221c;
    --on-brick: #2b1a12;
    --moss: #a9d19e;
    --moss-tint: #263522;
    --ochre: #e8c072;
    --ochre-tint: #3f3014;
    --hairline: #3A3449;
    --line: #54475D;
    --line-strong: #9D8A9F;
    --focus: #F7E9D2;
    --focus-on-dark: #f9e8c7;
    --focus-on-coral: #F7E9D2;
    --sh-1: none;
    --sh-2: 0 14px 44px -28px rgb(9 7 16 / 0.5);
    --sh-3: 0 24px 64px -28px rgb(9 7 16 / 0.65);
    --scrim: rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #15131F;
  --raised: #1E1B2B;
  --cream: #26223A;
  --parchment: #2E293F;
  --dark: #15131F;
  --dark-2: #26223A;
  --ink: #F7E9D2;
  --cocoa: #D7CBD0;
  --muted: #BCB1C3;
  --on-dark: #F7E9D2;
  --on-dark-soft: #D0C3B6;
  --coral-ink: #FCC867;
  --coral-tint: #3A2B2A;
  --coral-deep: #F2A440;
  --brick: #f0a090;
  --brick-tint: #4a221c;
  --on-brick: #2b1a12;
  --moss: #a9d19e;
  --moss-tint: #263522;
  --ochre: #e8c072;
  --ochre-tint: #3f3014;
  --hairline: #3A3449;
  --line: #54475D;
  --line-strong: #9D8A9F;
  --focus: #F7E9D2;
  --focus-on-dark: #f9e8c7;
  --focus-on-coral: #F7E9D2;
  --sh-1: none;
  --sh-2: 0 14px 44px -28px rgb(9 7 16 / 0.5);
  --sh-3: 0 24px 64px -28px rgb(9 7 16 / 0.65);
  --scrim: rgba(0, 0, 0, 0.6);
}
/* @tokens:end */
/* @base:start */
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 300 700; font-display: swap; src: url("/assets/fonts/fraunces-normal-latin.woff2") format("woff2"); }
@font-face { font-family: "Fraunces"; font-style: italic; font-weight: 300 700; font-display: swap; src: url("/assets/fonts/fraunces-italic-latin.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 300 700; font-display: swap; src: url("/assets/fonts/sourcesans-normal-latin.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-style: italic; font-weight: 300 700; font-display: swap; src: url("/assets/fonts/sourcesans-italic-latin.woff2") format("woff2"); }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; font-size: 100%; scroll-padding-top: var(--s-6); }
body {
  margin: 0; min-height: 100vh;
  background: var(--paper); color: var(--ink);
  font-family: var(--font-text); font-size: var(--fs-md); line-height: var(--lh-text);
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, svg, video { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
[hidden] { display: none !important; }
hr { border: 0; border-top: 1px solid var(--hairline); margin: var(--s-6) 0; }
ul, ol { margin: 0; padding-left: 1.25em; }
li + li { margin-top: var(--s-2); }
p { margin: 0; }
p + p { margin-top: var(--s-3); }
strong, b { font-weight: 600; }
small, .small { font-size: var(--fs-sm); }
code, kbd, .mono { font-family: var(--font-mono); font-size: 0.92em; }
abbr[title] { text-decoration: none; }
figure { margin: 0; }
dl, dd { margin: 0; }
table { border-collapse: collapse; }
h1, h2, h3, h4, .display {
  margin: 0; color: var(--ink);
  font-family: var(--font-display); font-weight: 500;
  font-variation-settings: var(--display-soft); font-optical-sizing: auto;
  letter-spacing: var(--tracking-display); line-height: var(--lh-snug);
  text-wrap: balance; hyphens: manual; overflow-wrap: normal;
  font-variant-numeric: lining-nums proportional-nums;
}
h1 { font-size: var(--fs-3xl); line-height: var(--lh-tight); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }
.display-xl { font-size: var(--fs-4xl); line-height: 1.05; }
.lede { font-size: var(--fs-lg); line-height: 1.5; color: var(--cocoa); text-wrap: pretty; max-width: var(--measure); }
.eyebrow { font-size: var(--fs-xs); line-height: 1.3; font-weight: 600; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--muted); }
.caption { font-size: var(--fs-sm); line-height: 1.45; color: var(--muted); }
.muted { color: var(--cocoa); }
.measure { max-width: var(--measure); }
.quote { font-family: var(--font-display); font-style: italic; font-weight: 400; font-variation-settings: "SOFT" 80, "WONK" 0; font-size: 1.1em; line-height: 1.5; quotes: "\201C" "\201D" "\2018" "\2019"; }
.quote::before { content: open-quote; }
.quote::after { content: close-quote; }
.tnum { font-variant-numeric: tabular-nums lining-nums; }
.nowrap { white-space: nowrap; }
.token { font-family: var(--font-mono); font-size: 0.92em; overflow-wrap: anywhere; }
a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.16em; text-decoration-color: var(--line-strong); border-radius: var(--r-xs); }
a:hover { text-decoration-color: currentColor; }
.link-coral { color: var(--coral-ink); text-decoration-color: currentColor; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.on-dark :focus-visible, .on-dark:focus-visible { outline-color: var(--focus-on-dark); }
.btn-primary:focus-visible { outline-color: var(--focus-on-coral); outline-offset: 3px; }
@media (forced-colors: active) {
  :focus-visible { outline: 3px solid CanvasText; }
  .btn, .chip, .state, .check, .input { forced-color-adjust: auto; border: 1px solid CanvasText; }
}
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: var(--s-4); top: var(--s-4); z-index: 60; background: var(--raised); color: var(--ink); padding: var(--s-2) var(--s-4); border-radius: var(--r-md); box-shadow: var(--sh-2); text-decoration: none; font-weight: 600; }
.skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; padding: 0; box-shadow: none; }
.wrap { width: 100%; max-width: var(--page-max); margin-inline: auto; padding-inline: var(--gutter); }
.wrap-app { max-width: var(--app-max); }
.stack > * + * { margin-top: var(--s-4); }
.stack-sm > * + * { margin-top: var(--s-2); }
.stack-lg > * + * { margin-top: var(--s-8); }
.row { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; min-width: 0; }
.row-between { justify-content: space-between; }
.row-end { justify-content: flex-end; }
.grid-2, .grid-3 { display: grid; gap: var(--s-6); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.grid-2 > *, .grid-3 > *, .row > *, .stack > * { min-width: 0; }
.split { display: grid; gap: var(--s-8); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) { .split { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } .split-even { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.split > * { min-width: 0; }
section { min-width: 0; }
.section { padding-block: var(--s-16); }
.section + .section { border-top: 1px solid var(--hairline); }
.section-head { margin-bottom: var(--s-8); max-width: var(--measure); }
.section-head .eyebrow { margin-bottom: var(--s-3); }
.section-head p { margin-top: var(--s-3); }
body { overflow-wrap: break-word; }
@media (max-width: 420px) {
  h1, .display-xl { font-size: clamp(1.25rem, 9vw, 2.375rem); }
  h2 { font-size: clamp(1.125rem, 7.5vw, 1.875rem); }
  h3 { font-size: clamp(1rem, 6.5vw, 1.5rem); }
  h4 { font-size: clamp(1rem, 6vw, 1.25rem); }
  h1, h2, h3, .display { hyphens: auto; }
  .btn { white-space: normal; text-align: center; }
  .wrap { padding-inline: 16px; }
}
.mt-1 { margin-top: var(--s-1); } .mt-2 { margin-top: var(--s-2); } .mt-3 { margin-top: var(--s-3); } .mt-4 { margin-top: var(--s-4); } .mt-6 { margin-top: var(--s-6); } .mt-8 { margin-top: var(--s-8); } .mt-12 { margin-top: var(--s-12); }
.mb-2 { margin-bottom: var(--s-2); } .mb-3 { margin-bottom: var(--s-3); } .mb-4 { margin-bottom: var(--s-4); } .mb-6 { margin-bottom: var(--s-6); } .mb-8 { margin-bottom: var(--s-8); }
.gap-2 { gap: var(--s-2); } .gap-4 { gap: var(--s-4); } .gap-6 { gap: var(--s-6); }
.ta-c { text-align: center; }
.w-full { width: 100%; }
/* @base:end */
/* ---- vault components: the design system's ui.css, as the vault uses it ---- */

.icons { display: none; }
.skip-link { position: absolute; left: var(--s-4); top: var(--s-4); z-index: 60; background: var(--raised); color: var(--ink); padding: var(--s-2) var(--s-4); border-radius: var(--r-md); box-shadow: var(--sh-2); text-decoration: none; font-weight: 600; }
.skip-link:not(:focus) { width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; padding: 0; box-shadow: none; }

/* brand: the flat kit mark and the Fraunces wordmark */
.brand { display: inline-flex; align-items: center; gap: 0.5rem; text-decoration: none; color: var(--ink); min-height: 44px; }
.brand .mark { width: 28px; height: 17.4px; flex: none; }
.brand picture { display: contents; }
.brand .wordmark { height: 1.35rem; width: auto; }

/* app bar: brand · vault and where it lives · state chip · Lock. Never sticks. */
.appbar { background: var(--paper); border-bottom: 1px solid var(--hairline); }
.appbar .wrap { display: flex; align-items: center; gap: var(--s-3) var(--s-5); flex-wrap: wrap; min-height: 68px; padding-block: var(--s-3); }
.appbar .where { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; flex: 1 1 14rem; font-size: var(--fs-sm); line-height: 1.35; color: var(--cocoa); }
.appbar .where b { color: var(--ink); font-weight: 600; font-size: var(--fs-md); }
.appbar .actions { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; margin-left: auto; }
@media (max-width: 520px) { .appbar .actions { margin-left: 0; width: 100%; } }

/* state chip: a word, a glyph and a shape before it is a colour */
.state { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.35rem 0.8rem 0.35rem 0.6rem; border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: var(--raised); color: var(--ink); font-size: var(--fs-sm); font-weight: 600; line-height: 1.3; max-width: 100%; }
.state svg { width: 14px; height: 14px; flex: none; }
.state > span { min-width: 0; }
.state-none { border-style: dashed; color: var(--cocoa); font-weight: 500; }
.state-live { background: var(--coral); border-color: var(--coral-ink); color: var(--on-coral); }
.state-live .pulse, .state-live svg { color: var(--on-coral); }
.state-attn { background: var(--ochre-tint); border-color: var(--ochre); color: var(--ochre); }
.state-locked { background: var(--dark); border-color: var(--dark); color: var(--on-dark); }
.state-demo { background: var(--parchment); border-color: var(--line-strong); color: var(--cocoa); text-transform: uppercase; letter-spacing: 0.05em; font-size: var(--fs-xs); }
@media (max-width: 420px) { .state { border-radius: var(--r-md); white-space: normal; } }

/* live bar: page-level, coral, only while an assistant can read */
.livebar { background: var(--coral); color: var(--on-coral); border-bottom: 1px solid var(--coral-ink); }
.livebar .wrap { display: flex; align-items: center; gap: var(--s-3) var(--s-5); flex-wrap: wrap; padding-block: var(--s-3); }
.livebar .pulse { width: 12px; height: 12px; border-radius: 50%; background: var(--on-coral); flex: none; box-shadow: 0 0 0 3px rgba(66, 36, 22, 0.18); }
.livebar p { flex: 1 1 18rem; min-width: 0; font-weight: 500; color: var(--on-coral); }
.livebar p b { font-weight: 700; }
.livebar .btn-dark { margin-left: auto; }
.livebar :focus-visible { outline-color: var(--on-coral); }
@media (max-width: 520px) { .livebar .btn-dark { margin-left: 0; width: 100%; } }

/* buttons: .btn and the vault's older names map onto the same set */
.btn, .primary, .secondary, .quiet, .danger-button, .icon-button, :where(#main, dialog, .appbar) button:not([class]) {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 44px; padding: 0.6rem 1.15rem;
  border-radius: var(--r-md); border: 1px solid var(--line-strong); background: var(--raised); color: var(--ink);
  font-weight: 600; font-size: var(--fs-sm); line-height: 1.25; text-decoration: none; cursor: pointer; text-align: center;
  transition: background var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out);
}
.btn:hover, .secondary:hover, .icon-button:hover, :where(#main, dialog, .appbar) button:not([class]):hover { background: var(--parchment); }
.btn svg, .primary svg { width: 18px; height: 18px; flex: none; }
.btn-primary, .primary, .btn-primary:hover, .primary:hover { background: var(--coral); border-color: var(--coral-ink); color: var(--on-coral); box-shadow: var(--sh-1); }
.btn-primary:hover:not(:disabled), .primary:hover:not(:disabled) { background: var(--coral-press); }
.primary:focus-visible { outline-color: var(--focus-on-coral); outline-offset: 3px; }
/* While an agent is asking, allowing it is the screen's one coral act: the
   gallery's add buttons step back to the secondary look. */
body[data-state="asking"] :is(#new-memory-button, #empty-add-button), body[data-state="asking"] :is(#new-memory-button, #empty-add-button):hover { background: var(--raised); border-color: var(--line-strong); color: var(--ink); box-shadow: none; }
body[data-state="asking"] :is(#new-memory-button, #empty-add-button):hover:not(:disabled) { background: var(--parchment); }
body[data-state="asking"] :is(#new-memory-button, #empty-add-button):focus-visible { outline-color: var(--focus); outline-offset: 2px; }
.btn-dark, .btn-dark:hover { background: var(--dark); border-color: var(--line-strong); color: var(--on-dark); }
.btn-dark:hover:not(:disabled) { background: var(--dark-2); }
.btn-quiet, .quiet { border-color: transparent; background: transparent; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 0.16em; font-weight: 500; }
.btn-quiet:hover, .quiet:hover { background: var(--parchment); text-decoration-color: currentColor; }
.btn-danger, .danger-button { border-color: var(--brick); color: var(--brick); background: var(--raised); }
.btn-danger:hover, .danger-button:hover { background: var(--brick-tint); }
.btn-sm { min-height: 36px; padding: 0.35rem 0.85rem; font-size: var(--fs-sm); border-radius: var(--r-sm); }
.appbar .btn-sm { min-height: 44px; }
.icon-button { width: 44px; padding: 0; font-size: 1.25rem; line-height: 1; flex: none; }
button:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
button:disabled:hover { background: inherit; }

/* forms */
label { display: block; font-weight: 600; font-size: var(--fs-sm); margin: var(--s-4) 0 var(--s-2); color: var(--ink); }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea { display: block; width: 100%; min-height: 46px; padding: 0.6rem 0.9rem; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--raised); color: var(--ink); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 1px; border-color: var(--ink); }
textarea { resize: vertical; }
input[type="file"] { font-size: var(--fs-sm); padding: 0.45rem; max-width: 100%; }
input[type="file"]::file-selector-button { border: 1px solid var(--line-strong); background: var(--parchment); color: var(--ink); padding: 0.4rem 0.7rem; border-radius: var(--r-sm); margin-right: 0.7rem; cursor: pointer; font: inherit; font-weight: 600; }
input[type="checkbox"], input[type="radio"] { width: 1.25rem; height: 1.25rem; accent-color: var(--ink); flex: none; margin: 0.15rem 0 0; }
[aria-invalid="true"] { border-color: var(--brick) !important; box-shadow: 0 0 0 1px var(--brick); }
.field-error { margin: var(--s-2) 0 var(--s-3); padding-left: var(--s-3); border-left: 3px solid var(--brick); color: var(--brick); font-size: var(--fs-sm); font-weight: 600; overflow-wrap: anywhere; }
.field-help { font-size: var(--fs-sm); line-height: 1.5; color: var(--muted); margin: var(--s-2) 0 var(--s-3); }
details > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 0.5rem; }
details > summary::marker { color: var(--muted); }
code { overflow-wrap: anywhere; background: var(--parchment); padding: 0 0.25em; border-radius: var(--r-xs); }

/* type rhythm inside the vault (base.css zeroes paragraph margins) */
#main p + p, dialog p + p { margin-top: var(--s-3); }
#main li + li { margin-top: var(--s-1); }

/* notices: a word and an edge, never colour alone */
.notice, .error, .warning { padding: var(--s-3) var(--s-4); border-radius: var(--r-md); margin: var(--s-4) 0; font-size: var(--fs-sm); line-height: 1.5; border: 1px solid var(--line); background: var(--parchment); color: var(--ink); overflow-wrap: break-word; }
.error { background: var(--brick-tint); border-color: var(--brick); }
.warning { background: var(--ochre-tint); border-color: var(--ochre); }
.error a, .warning a { color: inherit; }
.collection-flag { color: var(--brick); font-weight: 600; }

/* layout: side nav beside the page once a vault is open; it wraps, never scrolls sideways */
.app { display: grid; gap: var(--s-6); grid-template-columns: minmax(0, 1fr); padding-block: var(--s-6) var(--s-12); }
.app > * { min-width: 0; }
@media (min-width: 960px) { body.vault-open .app { grid-template-columns: 13.5rem minmax(0, 1fr); gap: var(--s-10); } }
.main { min-width: 0; }
.main:focus { outline: none; }
.side { display: flex; flex-wrap: wrap; gap: var(--s-1); min-width: 0; align-content: start; }
@media (min-width: 960px) { .side { flex-direction: column; position: sticky; top: var(--s-6); align-self: start; } }
.side .rail-button { display: inline-flex; gap: 0.55rem; align-items: center; justify-content: flex-start; min-height: 44px; padding: 0.5rem 0.8rem; border-radius: var(--r-md); border: 1px solid transparent; background: transparent; color: var(--cocoa); font-weight: 500; font-size: var(--fs-md); text-align: left; cursor: pointer; }
.side .rail-button svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.side .rail-button:hover { background: var(--parchment); color: var(--ink); }
.side .rail-button[aria-pressed="true"] { background: var(--parchment); color: var(--ink); font-weight: 600; border-color: var(--line-strong); }
.side .rail-button[aria-pressed="true"] svg { color: var(--coral-deep); }

/* first run: facts above the form, then the form, the one coral button */
.first-run .split { align-items: start; }
.first-run-facts > * + * { margin-top: var(--s-8); }
.intro { display: flex; gap: var(--s-6); align-items: center; flex-wrap: wrap; }
.intro > .emma { flex: none; }
.intro > div { flex: 1 1 18rem; min-width: 0; }
.intro .eyebrow { margin-bottom: var(--s-2); }
.intro .lede { margin-top: var(--s-3); }
/* Every still follows the asset map. The calm one is for first run with
   Create only (the approved vault-start screen); the quiet one for the locked
   notice, which heads the locked screen whichever tab is shown (Recover is
   shown first after Lock); the resting one for an empty vault that nothing
   can read. None beside passphrase entry in the entry workspace (the welcome
   still with Open or Recover), beside an error (passphrase, recovery and
   damaged-file screens), or while an agent is asking, connected, live or has
   just expired. */
body[data-state="locked"] #welcome-figure,
#locked-view:has(#create-panel[hidden]) #welcome-figure,
body:not([data-state="private"]) #empty-state .emma,
#main:has(> #error:not([hidden])) .emma { display: none; }
.facts { display: grid; gap: 0; }
.facts > div { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.2rem var(--s-5); padding: var(--s-4) 0; border-top: 1px solid var(--hairline); }
.facts > div:first-child { border-top: 0; padding-top: 0; }
.facts > div:last-child { padding-bottom: 0; }
.facts dt { font-size: var(--fs-sm); font-weight: 600; color: var(--muted); }
.facts dd { margin: 0; min-width: 0; }
@media (min-width: 640px) { .facts > div { grid-template-columns: 10rem minmax(0, 1fr); } .facts dt { padding-top: 0.15rem; } }
.callout { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s-3); padding: var(--s-4); border-radius: var(--r-md); border: 1px solid var(--line); background: var(--parchment); }
.callout > svg { width: 20px; height: 20px; margin-top: 2px; flex: none; }
.callout h2, .callout h3 { font-family: var(--font-text); font-size: var(--fs-md); font-weight: 600; font-variation-settings: normal; margin: 0 0 0.15rem; }
.callout p { font-size: var(--fs-sm); line-height: 1.5; }
.panel { background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-xl); padding: var(--s-6); box-shadow: var(--sh-2); min-width: 0; }
@media (min-width: 760px) { .panel { padding: var(--s-8); } }
.segmented { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--parchment); border-radius: var(--r-md); }
.segmented button { flex: 1 1 auto; min-height: 44px; padding: 0.4rem 0.9rem; border: 1px solid transparent; border-radius: var(--r-sm); background: transparent; color: var(--cocoa); font-weight: 600; font-size: var(--fs-sm); cursor: pointer; }
.segmented button[aria-selected="true"], .segmented button[aria-pressed="true"] { background: var(--raised); color: var(--ink); border-color: var(--line-strong); box-shadow: var(--sh-1); }
.entry-panel { padding-top: var(--s-6); }
.entry-panel h2 { font-size: var(--fs-xl); }
.entry-panel-heading .muted, .entry-panel-heading .field-help { margin-top: var(--s-2); }
.entry-panel fieldset > button { width: 100%; margin-top: var(--s-5); min-height: 52px; font-size: var(--fs-md); }
.passphrase-change { margin-top: var(--s-4); }
.passphrase-change summary { font-size: var(--fs-sm); font-weight: 600; }
.checkpoint-note { margin-top: var(--s-6); font-size: var(--fs-sm); color: var(--muted); max-width: var(--measure); }
.locked-backup { margin-bottom: var(--s-8); display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s-4) var(--s-6); align-items: center; padding: var(--s-6); border-radius: var(--r-xl); background: var(--dark); color: var(--on-dark); }
.locked-backup h2 { color: var(--on-dark); font-size: var(--fs-xl); }
.locked-backup p { color: var(--on-dark-soft); font-size: var(--fs-sm); margin-top: var(--s-2); }
.locked-backup .btn { grid-column: 1 / -1; justify-self: start; background: var(--dark-2); color: var(--on-dark); border-color: var(--on-dark-soft); }
.locked-backup :focus-visible { outline-color: var(--focus-on-dark); }
@media (min-width: 760px) { .locked-backup { grid-template-columns: auto minmax(0, 1fr) auto; } .locked-backup .btn { grid-column: auto; } }

/* the character: rendered stills only, one per screen, never beside consent */
.emma { display: block; margin: 0; }
.emma img { width: 100%; height: auto; display: block; aspect-ratio: 20 / 17; object-fit: cover; object-position: 50% 70%; }
.emma-md { width: min(100%, 14rem); }
.emma-sm { width: min(100%, 8rem); }

/* the open vault */
.vault-heading { display: flex; justify-content: space-between; gap: var(--s-3) var(--s-6); align-items: flex-end; flex-wrap: wrap; margin-bottom: var(--s-5); }
.vault-heading > div:first-child { min-width: 0; flex: 1 1 20rem; }
.vault-heading .eyebrow { margin-bottom: var(--s-2); }
.vault-heading h1 { overflow-wrap: break-word; }
.vault-heading .muted { margin-top: var(--s-2); }
.vault-actions { display: flex; gap: var(--s-3); flex-wrap: wrap; align-items: center; }
.save-bar { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-3); font-size: var(--fs-sm); color: var(--cocoa); background: var(--parchment); border-radius: var(--r-md); margin-bottom: var(--s-6); }
.save-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--moss); flex: none; }
#recovery-warnings ul { margin-top: var(--s-2); }
.library-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-6); align-items: start; }
@media (min-width: 1180px) { .library-layout { grid-template-columns: minmax(0, 1fr) minmax(16rem, 21rem); } }
.library { min-width: 0; }
.explore-toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-4); }
.explore-toolbar input { max-width: 20rem; flex: 1 1 14rem; }
.collection-switch { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--parchment); border-radius: var(--r-md); }
.collection-switch button { min-height: 44px; padding: 0.4rem 0.9rem; border: 1px solid transparent; border-radius: var(--r-sm); background: transparent; color: var(--cocoa); font-weight: 600; font-size: var(--fs-sm); cursor: pointer; }
.collection-switch button[aria-pressed="true"] { background: var(--raised); color: var(--ink); border-color: var(--line-strong); box-shadow: var(--sh-1); }
.collection-switch span { margin-left: 0.25rem; font-weight: 500; }

/* the constellation is a dark room in both themes: its canvas draws light stars */
.constellation-stage { position: relative; height: 28rem; border-radius: var(--r-xl); overflow: hidden; margin-bottom: var(--s-8); background: var(--dark); color: var(--on-dark); }
.constellation-stage :focus-visible { outline-color: var(--focus-on-dark); }
.stage-heading { position: absolute; top: var(--s-5); left: var(--s-5); z-index: 1; pointer-events: none; max-width: calc(100% - 2.5rem); }
.stage-heading .eyebrow { color: var(--on-dark-soft); margin-bottom: var(--s-2); }
.stage-heading h2 { color: var(--on-dark); font-size: var(--fs-xl); }
.stage-heading p:last-child { font-size: var(--fs-sm); color: var(--on-dark-soft); max-width: 22rem; margin-top: var(--s-2); }
.constellation-stage canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: pan-y; }
.constellation-stage canvas:active { cursor: grabbing; }
.constellation-stage canvas.node-hover { cursor: pointer; }
.stage-legend { position: absolute; bottom: 4.75rem; left: var(--s-5); display: flex; gap: var(--s-4); flex-wrap: wrap; font-size: var(--fs-xs); color: var(--on-dark-soft); pointer-events: none; }
.stage-legend span { display: flex; gap: 0.4rem; align-items: center; }
.stage-legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.legend-people { background: #e8c88c; }
.legend-tags { background: #80d7e4; }
.stage-controls { position: absolute; bottom: var(--s-4); left: var(--s-4); right: var(--s-4); display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: center; }
.stage-controls .quiet, .stage-controls .icon-button { background: var(--dark-2); color: var(--on-dark); border-color: var(--on-dark-soft); text-decoration: none; }
.stage-controls .quiet:hover, .stage-controls .icon-button:hover { background: var(--dark); }
.stage-hint { display: none; }
/* Narrow screens: the heading, legend and controls stack above and below the
   canvas instead of floating over it, so larger text pushes the stage taller
   rather than drawing over the stars, the drawn memory card or each other. */
@media (max-width: 720px) {
  .constellation-stage { height: auto; display: flex; flex-direction: column; }
  .stage-heading { position: static; max-width: none; padding: var(--s-5) var(--s-5) 0; }
  .constellation-stage canvas { height: 320px; flex: none; }
  .stage-legend { position: static; padding: var(--s-3) var(--s-5) 0; }
  .stage-controls { position: static; padding: var(--s-3) var(--s-4) var(--s-4); }
}

.gallery-heading { display: flex; gap: var(--s-3); align-items: flex-end; justify-content: space-between; flex-wrap: wrap; margin: var(--s-4) 0 var(--s-5); }
.gallery-heading .eyebrow { margin-bottom: var(--s-2); }
.library-heading { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.library-heading h2 { font-size: var(--fs-xl); }
.library-heading .count { display: inline-flex; align-items: center; padding: 0.2rem 0.6rem; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--raised); color: var(--cocoa); font-size: var(--fs-xs); font-weight: 600; }
.library-heading .count:empty { display: none; }
.memory-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-4); }
@media (min-width: 640px) { .memory-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.memory-card { width: 100%; text-align: left; color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--raised); padding: 0; overflow: hidden; display: block; box-shadow: var(--sh-1); cursor: pointer; font: inherit; transition: border-color var(--dur-2) var(--ease-out); }
.memory-card:hover { border-color: var(--line-strong); }
.memory-card[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.card-art { position: relative; height: 8.5rem; overflow: hidden; background: var(--cream); display: flex; align-items: center; justify-content: center; }
.card-orbit { width: 64px; height: 64px; border: 1.5px solid var(--coral-deep); border-radius: 50%; position: relative; transform: rotate(-30deg); }
.card-orbit::before { content: ""; position: absolute; inset: 18px -12px; border: 1.5px solid var(--coral-deep); border-radius: 50%; opacity: 0.6; }
.card-orbit::after { content: ""; position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--coral); border: 1px solid var(--coral-ink); top: 4px; left: 11px; }
.card-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card-kind { position: absolute; left: var(--s-3); bottom: var(--s-2); max-width: calc(100% - 1.5rem); background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0.1rem 0.5rem; color: var(--cocoa); font-size: var(--fs-xs); font-weight: 600; }
.card-body { display: block; padding: var(--s-4); }
.card-title { font-family: var(--font-display); font-variation-settings: var(--display-soft); font-size: var(--fs-lg); font-weight: 500; display: block; line-height: 1.3; margin-bottom: var(--s-2); }
.card-preview { display: block; font-size: var(--fs-sm); line-height: 1.55; color: var(--cocoa); min-height: 2.6em; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-2); font-size: var(--fs-xs); color: var(--muted); margin-top: var(--s-3); }
.consent-badge { display: inline-flex; align-items: center; padding: 0.15rem 0.55rem; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--raised); color: var(--cocoa); font-size: var(--fs-xs); font-weight: 600; line-height: 1.4; }
.consent-badge.granted { background: var(--moss-tint); border-color: var(--moss); color: var(--moss); }
.consent-badge.withdrawn { background: var(--ochre-tint); border-color: var(--ochre); color: var(--ochre); }

.memory-detail { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--raised); padding: var(--s-5); box-shadow: var(--sh-1); min-width: 0; }
@media (min-width: 1180px) { .memory-detail { position: sticky; top: var(--s-6); max-height: calc(100vh - 3rem); overflow: auto; } }
.memory-detail:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.inspector-eyebrow { font-size: var(--fs-xs); font-weight: 600; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--muted); margin-bottom: var(--s-4); }
.detail-placeholder { padding: var(--s-6) 0; }
.detail-placeholder .emma-orb { display: none; }
.detail-placeholder h2 { font-size: var(--fs-xl); }
.detail-placeholder p { font-size: var(--fs-sm); color: var(--cocoa); margin-top: var(--s-2); }
.detail-top { display: flex; gap: var(--s-3); align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: var(--s-3); }
.detail-top h2 { font-size: var(--fs-xl); overflow-wrap: break-word; min-width: 0; flex: 1 1 12rem; }
.story-text { font-family: var(--font-display); font-style: italic; font-weight: 400; font-variation-settings: "SOFT" 80, "WONK" 0; font-size: var(--fs-md); line-height: 1.65; white-space: pre-wrap; overflow-wrap: break-word; margin: var(--s-5) 0; color: var(--ink); }
.tags { display: flex; gap: var(--s-1); flex-wrap: wrap; margin: var(--s-3) 0; }
.tag { font-size: var(--fs-xs); border-radius: var(--r-sm); background: var(--parchment); padding: 0.15rem 0.55rem; color: var(--cocoa); font-weight: 600; }
.memory-metadata { border-top: 1px solid var(--hairline); padding-top: var(--s-4); }
.memory-metadata h3 { font-family: var(--font-text); font-variation-settings: normal; font-weight: 600; font-size: var(--fs-sm); margin-bottom: var(--s-3); }
.metadata-list { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-1) var(--s-4); font-size: var(--fs-sm); line-height: 1.5; }
@media (min-width: 420px) { .metadata-list { grid-template-columns: 7rem minmax(0, 1fr); } }
.metadata-list dt { color: var(--muted); font-weight: 600; }
.metadata-list dd { margin: 0 0 var(--s-1); white-space: pre-wrap; overflow-wrap: break-word; color: var(--cocoa); min-width: 0; }
.attachment-list { display: grid; gap: var(--s-3); margin-bottom: var(--s-5); }
.attachment { margin: 0; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.attachment img, .attachment video { display: block; width: 100%; max-height: 15rem; object-fit: contain; background: var(--parchment); }
.attachment audio { display: block; width: 100%; padding: var(--s-2); }
.attachment figcaption { font-size: var(--fs-xs); color: var(--muted); padding: var(--s-2) var(--s-3); overflow-wrap: anywhere; }
.detail-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; justify-content: flex-end; padding-top: var(--s-4); margin-top: var(--s-4); border-top: 1px solid var(--hairline); }
.empty-state { padding: var(--s-8); text-align: center; border-radius: var(--r-xl); background: var(--cream); display: grid; justify-items: center; gap: var(--s-3); }
.empty-state h3 { font-size: var(--fs-xl); }
.empty-state p { color: var(--cocoa); max-width: 32rem; }
.empty-search { padding: var(--s-6) 0; color: var(--cocoa); }
.memory-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin: var(--s-6) 0; }
.toolbar-note { font-size: var(--fs-sm); color: var(--muted); }
.trash-note { font-size: var(--fs-sm); color: var(--cocoa); padding: var(--s-3) var(--s-4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--parchment); }

/* owner tools: profile, proposals, local access, wishes */
.owner-tools { margin-top: var(--s-10); border-top: 1px solid var(--hairline); padding-top: var(--s-8); scroll-margin-top: var(--s-6); }
.section-intro { max-width: var(--measure); margin-bottom: var(--s-6); }
.section-intro .eyebrow { margin-bottom: var(--s-2); }
.section-intro p { color: var(--cocoa); margin-top: var(--s-3); }
.agent-panel, .identity-panel, .proposal-panel, #legacy-panel details { margin: var(--s-4) 0; padding: var(--s-5); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--raised); box-shadow: var(--sh-1); scroll-margin-top: var(--s-6); overflow-wrap: break-word; min-width: 0; }
.agent-panel > summary, .identity-panel > summary, #legacy-panel details > summary { font-family: var(--font-display); font-variation-settings: var(--display-soft); font-size: var(--fs-lg); font-weight: 500; color: var(--ink); }
.agent-panel[open] > summary, .identity-panel[open] > summary, #legacy-panel details[open] > summary { margin-bottom: var(--s-3); }
.agent-panel > p, .identity-panel > p, .proposal-panel > p { max-width: 80ch; }
.proposal-panel h2 { font-size: var(--fs-xl); margin-bottom: var(--s-3); }
/* selection: every memory listed; ineligible ones with the reason, never hidden, never red */
.agent-memory-choices { display: grid; gap: var(--s-3); margin: var(--s-4) 0; }
.select-list { display: grid; gap: var(--s-2); margin: 0; padding: 0; list-style: none; }
#main .select-list li { margin: 0; }
.agent-memory-choice, .select-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.2rem var(--s-3); align-items: start; padding: var(--s-3) var(--s-4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--raised); margin: 0; font-weight: 600; font-size: var(--fs-md); cursor: pointer; }
.agent-memory-choice:hover { background: var(--parchment); }
.agent-memory-choice:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); background: var(--cream); }
.agent-memory-choice .why { grid-column: 2; font-size: var(--fs-sm); font-weight: 400; line-height: 1.45; color: var(--muted); }
#agent-document-choices .agent-memory-choice { font-weight: 500; }
.select-row.is-ineligible { display: block; background: var(--paper); cursor: default; color: var(--ochre); font-weight: 600; font-size: var(--fs-sm); border-left: 3px solid var(--ochre); }
.agent-hidden-note { font-size: var(--fs-sm); color: var(--cocoa); }
.agent-hidden-note p { margin-bottom: var(--s-2); }
#agent-grant-facts { margin: var(--s-3) 0 var(--s-4); padding: var(--s-4); background: var(--coral-tint); border: 1px solid var(--coral-ink); border-radius: var(--r-md); }
.facts-tight > div { padding: var(--s-2) 0; }
.livebar .tnum { font-variant-numeric: tabular-nums lining-nums; }
.agent-session { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) 0; flex-wrap: wrap; border-top: 1px solid var(--hairline); }
.agent-document-selection { max-width: 45rem; padding-top: var(--s-3); border-top: 1px solid var(--hairline); }
.identity-actions, .proposal-source-controls { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: flex-end; }
.proposal-source-controls > div { flex: 1 1 15rem; }
.proposal-source-controls label { margin-top: 0; }
.identity-list, .proposal-list { display: grid; gap: var(--s-3); margin: var(--s-4) 0; }
.identity-card, .proposal-card { padding: var(--s-4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--paper); overflow-wrap: break-word; min-width: 0; }
.proposal-card { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
.identity-card h3, .proposal-card h3 { font-size: var(--fs-lg); margin-bottom: var(--s-2); }
.identity-choice, .proposal-choice, #legacy-panel label:has(input[type="checkbox"]) { display: flex; align-items: flex-start; gap: var(--s-3); margin: var(--s-4) 0; line-height: 1.5; font-weight: 500; }
.identity-choice .field-help { display: block; margin: var(--s-1) 0; }
.identity-text, #legacy-history-text { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 20rem; overflow: auto; min-width: 0; padding: var(--s-4); border-radius: var(--r-md); border-left: 3px solid var(--line-strong); background: var(--parchment); color: var(--ink); line-height: 1.6; font: inherit; font-size: var(--fs-sm); }
.identity-text:empty { display: none; }
.proposal-destination { padding: var(--s-3) var(--s-4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--parchment); overflow-wrap: break-word; }
#legacy-panel textarea { min-height: 9rem; }
#legacy-panel label { line-height: 1.6; }
#legacy-panel button { margin: var(--s-2) var(--s-2) 0 0; }
.example-controls { font-size: var(--fs-sm); line-height: 1.6; margin: var(--s-4) 0; color: var(--cocoa); }
.example-controls summary { font-weight: 600; color: var(--ink); }
.metadata-fields { border-top: 1px solid var(--hairline); padding-top: var(--s-3); margin-top: var(--s-5); }
.metadata-fields summary { font-size: var(--fs-sm); font-weight: 600; color: var(--ink); }

/* footer: dark, with the character disclaimer */
.foot { background: var(--dark); color: var(--on-dark); margin-top: var(--s-12); }
.foot .wrap { padding-block: var(--s-8); display: grid; gap: var(--s-3); }
.foot p { color: var(--on-dark); }
.foot .fine { font-size: var(--fs-sm); line-height: 1.5; color: var(--on-dark-soft); max-width: 72ch; }
.foot a { color: var(--on-dark); text-decoration-color: var(--on-dark-soft); }
.foot details, .foot details summary { color: var(--on-dark-soft); }
.foot details p + p { margin-top: var(--s-2); }
.foot :focus-visible { outline-color: var(--focus-on-dark); }
.foot code { background: var(--dark-2); }

/* dialogs: centred card, bottom sheet on phones; the safe choice first */
dialog { border: 1px solid var(--line); border-radius: var(--r-xl); padding: var(--s-8); width: min(40rem, calc(100% - 2rem)); max-height: calc(100vh - 3rem); color: var(--ink); background: var(--raised); box-shadow: var(--sh-3); overflow: auto; }
dialog::backdrop { background: var(--scrim); }
@media (max-width: 639px) { dialog { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: var(--r-xl) var(--r-xl) 0 0; padding: var(--s-6) var(--s-5) var(--s-5); max-height: 94vh; } }
.dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-4); flex-wrap: wrap; margin-bottom: var(--s-4); }
.dialog-heading > div { min-width: 0; flex: 1 1 14rem; }
.dialog-heading h2 { font-size: var(--fs-xl); }
.dialog-heading .eyebrow { margin-bottom: var(--s-2); }
.dialog-utility { display: flex; flex-direction: column; gap: var(--s-2); align-items: flex-end; }
.dialog-utility .quiet { white-space: nowrap; }
.capture-brand { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.capture-progress { display: flex; flex-wrap: wrap; list-style: none; margin: var(--s-5) 0 var(--s-6); padding: 0; gap: var(--s-1) var(--s-5); border-bottom: 1px solid var(--hairline); }
.capture-progress li { font-size: var(--fs-sm); color: var(--muted); padding: 0 0 var(--s-2); border-bottom: 2px solid transparent; margin: 0; }
.capture-progress li[aria-current="step"] { color: var(--ink); font-weight: 600; border-color: var(--ink); }
.capture-progress li.complete { color: var(--cocoa); }
.capture-step h3 { font-size: var(--fs-xl); margin-bottom: var(--s-2); }
.capture-step > .muted { margin-bottom: var(--s-4); }
.capture-step .metadata-fields:first-of-type { margin-top: var(--s-1); border-top: 0; padding-top: 0; }
.capture-review { background: var(--parchment); border-radius: var(--r-md); padding: var(--s-5); }
.capture-review h4 { font-size: var(--fs-lg); margin-bottom: var(--s-3); overflow-wrap: break-word; }
.capture-review p { white-space: pre-wrap; overflow-wrap: break-word; line-height: 1.6; color: var(--cocoa); }
.capture-review .metadata-list { border-top: 1px solid var(--hairline); padding-top: var(--s-3); margin-top: var(--s-3); }
.form-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 var(--s-4); }
@media (min-width: 640px) { .form-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.form-actions { display: flex; gap: var(--s-3); flex-wrap: wrap; justify-content: flex-end; border-top: 1px solid var(--hairline); padding-top: var(--s-5); margin-top: var(--s-6); }
@media (max-width: 639px) { .form-actions { flex-direction: column; align-items: stretch; } }
.dialog-error { margin: 0 0 var(--s-4); }
#trash-memory-name { font-family: var(--font-display); font-size: var(--fs-lg); overflow-wrap: break-word; margin-bottom: var(--s-3); }
#discard-draft-dialog { max-width: 32rem; }
#identity-import-dialog h3 { margin-top: var(--s-5); font-size: var(--fs-lg); }
#identity-history-metadata { margin-top: var(--s-5); }
#proposal-source { margin-top: var(--s-4); }

/* programmatic focus targets after vault actions; the ring shows for keyboard users */
#vault-title:focus-visible, #library-title:focus-visible, #error:focus-visible, .dialog-error:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
#vault-title:focus:not(:focus-visible), #error:focus:not(:focus-visible) { outline: none; }
.library, .constellation-stage, #library-title, #legacy-panel { scroll-margin-top: var(--s-6); }

/* phone width with large text: nothing stays on one line by force */
@media (max-width: 420px) {
  .state, .nowrap, .dialog-utility .quiet { white-space: normal; }
  .appbar .where, .livebar p { flex-basis: 100%; }
  .panel, .callout, .agent-panel, .identity-panel, .proposal-panel, #legacy-panel details, .memory-detail, .empty-state, .locked-backup, .capture-review { padding: 12px; }
  dialog { padding: 16px; }
  .btn, .primary, .secondary, .quiet, .danger-button { padding-inline: var(--s-3); }
  .appbar .wrap, .livebar .wrap { padding-inline: 16px; }
  .locked-backup { grid-template-columns: minmax(0, 1fr); }
}

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

/* Forced colours (Windows High Contrast). The browser replaces author colours
   with system colours and keeps only alpha, so state shown by a tint, a faint
   border or opacity alone disappears. Use system colours for focus, selection,
   disabled controls and control edges. */
@media (forced-colors: active) {
  button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, canvas:focus-visible, [tabindex]:focus-visible { outline: 2px solid Highlight !important; outline-offset: 3px; }
  button:not(.memory-card) { border-style: solid !important; border-width: 1px !important; border-color: ButtonText !important; }
  /* forced-color-adjust:none drops the Canvas backplate the browser draws behind text, which would hide HighlightText; only system colours are used. */
  .entry-option[aria-selected="true"], .rail-button[aria-pressed="true"], .collection-switch button[aria-pressed="true"] { forced-color-adjust: none; background: Highlight !important; border-color: Highlight !important; }
  .entry-option[aria-selected="true"], .entry-option[aria-selected="true"] *, .rail-button[aria-pressed="true"], .rail-button[aria-pressed="true"] *, .collection-switch button[aria-pressed="true"], .collection-switch button[aria-pressed="true"] * { color: HighlightText !important; }
  .memory-card { border-color: CanvasText; }
  .memory-card[aria-pressed="true"] { border: 3px solid Highlight !important; }
  .capture-progress li[aria-current="step"] { border-bottom: 3px solid Highlight; }
  button:disabled, button:disabled * { color: GrayText !important; border-color: GrayText !important; }
  [aria-invalid="true"] { border: 2px dashed CanvasText !important; }
  .notice, .error, .warning, .save-bar, .state, .livebar, .callout, .panel, .locked-backup, .empty-state { border: 1px solid CanvasText; }
  .livebar { border-width: 0 0 3px; }
  /* Legend dots and the constellation keep their own colours: the canvas is not recoloured. */
  .stage-legend i, .save-dot { forced-color-adjust: none; }
}

/* Make the existing entry tabs and passphrase form the clear next action.
   The full custody facts remain available without lengthening first-run. */
.first-run-facts > * + * { margin-top: var(--s-5); }
.entry-essentials { display: grid; gap: var(--s-3); }
.entry-essentials p { margin: 0; }
.entry-essentials strong, .entry-essentials span { display: block; }
.entry-essentials strong { color: var(--ink); font-size: var(--fs-md); }
.entry-essentials span { color: var(--cocoa); font-size: var(--fs-sm); }
.entry-details { border-block: 1px solid var(--hairline); color: var(--cocoa); font-size: var(--fs-sm); }
.entry-details summary { min-height: 48px; align-content: center; color: var(--ink); font-weight: 600; cursor: pointer; }
.entry-details .facts { padding-block: var(--s-3) var(--s-5); }
.entry-details .facts > div { grid-template-columns: minmax(0, 1fr); gap: var(--s-1); padding-block: var(--s-3); }
.entry-details .facts dt { color: var(--ink); }
.entry-workspace { box-shadow: var(--sh-1); }
.owner-tools > .section-intro { max-width: 44rem; margin-bottom: var(--s-6); }
.owner-tools > .section-intro h2 { font-size: var(--fs-xl); }
.owner-tools > .section-intro p { color: var(--cocoa); font-size: var(--fs-sm); }
@media (forced-colors: active) { .entry-details { border-color: CanvasText; } }
/* @app-look:start — web-brand, 2026-11-04 ----
 * The app's look (work/native/iOS/EmmaPrivateTheme.swift), laid over this page:
 * Paper / Dusk colours, Apple's own serif and sans (the vendored faces stay as the
 * fallback elsewhere), capsule buttons (one amber
 * primary, raised outlined secondary, accent text buttons), 24px cards and
 * 16px fields, no shadows. Look only: no markup, copy or behaviour changes.
 * The amber pill keeps the old coral as its background colour under the app's
 * gradient, so tests that find the one primary by its fill still find it.
 * The token copies above stay identical to public-site/assets/tokens.css. */
:root { --paper:#F6EFE3;--raised:#FFFBF4;--cream:#EFE5D5;--parchment:#EFE5D5;--ink:#2A2730;--cocoa:#5E554C;--muted:#5E554C;
  --coral:#F7B653;--coral-press:#F7B653;--coral-deep:#9C4A0E;--coral-ink:#9C4A0E;--coral-tint:#FBE3C2;--on-coral:#2A1810;--coral-quiet:#9C4A0E;
  --moss:#33693F;--ochre:#80550C;--hairline:#E3D4C0;--line:#E3D4C0;--line-strong:#8F806D;
  --focus:#9C4A0E;--focus-on-coral:#2A2730;--sh-1:none;--sh-2:0 14px 44px -28px rgb(42 39 48 / .22);
  --font-display:ui-serif,"Fraunces","Newsreader",Georgia,"Times New Roman",serif;
  --font-text:system-ui,-apple-system,"SF Pro Text","Source Sans 3","Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  --display-soft:normal;--display-soft-word:normal;--r-sm:12px;--r-md:16px;--r-lg:24px;--r-xl:24px;
  --app-fill:linear-gradient(to bottom,#FFD08A,#F3A14A);--app-on-fill:#2A1608;--app-glow:0 6px 12px rgb(243 161 74 / .25);--app-edge:rgb(42 22 8 / .2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --paper:#15131F;--raised:#1F1C2B;--cream:#100E18;--parchment:#100E18;--ink:#F4EBDD;--cocoa:#B9AE9F;--muted:#B9AE9F;
  --coral-deep:#F5AE5C;--coral-ink:#F5AE5C;--coral-tint:#4A3935;--coral-quiet:#F5AE5C;
  --moss:#7BC48F;--ochre:#E7B566;--hairline:#332E3A;--line:#332E3A;--line-strong:#736A7C;
  --focus:#F5AE5C;--focus-on-coral:#F4EBDD;--sh-2:0 14px 44px -28px rgb(9 7 16 / .5); } }
:root[data-theme="dark"] { --paper:#15131F;--raised:#1F1C2B;--cream:#100E18;--parchment:#100E18;--ink:#F4EBDD;--cocoa:#B9AE9F;--muted:#B9AE9F;
  --coral-deep:#F5AE5C;--coral-ink:#F5AE5C;--coral-tint:#4A3935;--coral-quiet:#F5AE5C;
  --moss:#7BC48F;--ochre:#E7B566;--hairline:#332E3A;--line:#332E3A;--line-strong:#736A7C;
  --focus:#F5AE5C;--focus-on-coral:#F4EBDD;--sh-2:0 14px 44px -28px rgb(9 7 16 / .5); }
h1, h2, h3, h4, .display, .brand { font-weight: 400; font-variation-settings: normal; letter-spacing: 0; }
h3, h4 { font-family: var(--font-text); font-weight: 600; }
.eyebrow { color: var(--cocoa); letter-spacing: 1.2px; }
button:where(:not([role=tab]):not(.icon-button)), .btn { border-radius: 999px; min-height: 44px; padding-inline: 1.25rem; font-family: var(--font-text); font-weight: 600; background: var(--raised); color: var(--ink); border: 1.5px solid var(--line-strong); box-shadow: none; text-decoration: none; }
button:where(:not([role=tab]):not(.icon-button)):hover:not(:disabled), .btn:hover:not(:disabled) { background: var(--cream); }
.btn-sm { border-radius: 999px; min-height: 44px; }
.btn-primary, .primary, button.primary, #invite-form button[type=submit], button[data-key=approve], #connect, .entry-primary, .btn-primary:hover:not(:disabled), .primary:hover:not(:disabled), button.primary:hover:not(:disabled), #invite-form button[type=submit]:hover:not(:disabled), button[data-key=approve]:hover:not(:disabled), #connect:hover:not(:disabled), .entry-primary:hover:not(:disabled) { background: var(--app-fill) var(--coral); color: var(--on-coral); border: 1px solid var(--app-edge); box-shadow: var(--app-glow); }
.btn-primary:hover:not(:disabled), .primary:hover:not(:disabled), button.primary:hover:not(:disabled), #invite-form button[type=submit]:hover:not(:disabled), button[data-key=approve]:hover:not(:disabled), #connect:hover:not(:disabled), .entry-primary:hover:not(:disabled) { border-color: rgb(42 22 8 / .6); }
.btn-dark, #lock, .btn-dark:hover:not(:disabled), #lock:hover:not(:disabled) { background: var(--raised); color: var(--ink); border: 1.5px solid var(--line-strong); }
.btn-quiet, .quiet, button.secondary, button.link { background: transparent; border-color: transparent; color: var(--coral-ink); text-decoration: none; }
.btn-quiet:hover:not(:disabled), .quiet:hover:not(:disabled), button.secondary:hover:not(:disabled), button.link:hover:not(:disabled) { background: transparent; text-decoration: underline; text-underline-offset: .18em; }
.btn-danger, .danger-button, button.danger { color: var(--brick); border-color: var(--brick); background: var(--raised); }
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]), select, textarea { border-radius: 16px; border: 1px solid var(--line-strong); background: var(--raised); min-height: 48px; }
.panel, .card, .room-row, .account { border-radius: 24px; border-color: var(--line); box-shadow: none; }
a { text-decoration-color: var(--line-strong); }
.state-live { background: var(--coral-tint); color: var(--ink); border-color: var(--coral-ink); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
@media (prefers-reduced-motion: no-preference) { .btn-primary, .primary, button.primary, #invite-form button[type=submit], button[data-key=approve], #connect, .entry-primary { transition: transform 450ms cubic-bezier(.2,.8,.2,1); } .btn-primary:active:not(:disabled), .primary:active:not(:disabled), button.primary:active:not(:disabled), #invite-form button[type=submit]:active:not(:disabled), button[data-key=approve]:active:not(:disabled), #connect:active:not(:disabled), .entry-primary:active:not(:disabled) { transform: scale(.97); } }
@media (prefers-contrast: more) { .panel, .card, .room-row, .account { border-color: var(--line-strong); } .btn-primary, .primary, button.primary, #invite-form button[type=submit], button[data-key=approve], #connect, .entry-primary { box-shadow: none; } }
@media (forced-colors: active) { button:where(:not([role=tab]):not(.icon-button)), .btn, .btn-primary, .primary, button.primary, #invite-form button[type=submit], button[data-key=approve], #connect, .entry-primary { border: 1px solid ButtonText; background: ButtonFace; color: ButtonText; box-shadow: none; } :focus-visible { outline-color: CanvasText; } }
/* The character stills are the app's amber ember (public-site/assets/character), no filter needed. */
/* Footers sit on the canvas like the app, not on a dark band. */
.foot { background: var(--paper); color: var(--cocoa); border-top: 1px solid var(--hairline); --on-dark: var(--ink); --on-dark-soft: var(--cocoa); --focus-on-dark: var(--focus); }
/* Top bars: no rule under them; their links read as the app's accent words. */
header { border-bottom-color: transparent; }
header nav a, .appbar nav a { color: var(--coral-ink); font-weight: 600; text-decoration: none; }
header nav a:hover, .appbar nav a:hover { text-decoration: underline; text-underline-offset: .18em; }
/* @app-look:end */
