:root,
:root[data-theme="night"] {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --theme-color: #101116;
  --bg: #101116;
  --panel: #17191f;
  --panel-2: #1e2129;
  --surface-inset: #111319;
  --surface-card: #14161c;
  --surface-raw: #101218;
  --border: #30343f;
  --border-subtle: #282b34;
  --text: #f5f5f7;
  --muted: #a6abb7;
  --placeholder: #777d8b;
  --accent: #d8d9ff;
  --accent-ink: #171827;
  --danger: #ffb9b9;
  --warning: #ffd6a8;
  --review-border: #5b4b40;
  --review-bg: #1d1a18;
  --review-divider: #3c3530;
  --review-badge-bg: #3d2d20;
  --kind-action: #cfd9ff;
  --kind-idea: #e0cfff;
  --kind-thought: #d3e2dc;
  --kind-reference: #d7d7bd;
  --priority-must: #ffd1d1;
  --priority-must-border: #694349;
  --priority-high: #ffd7bd;
  --priority-high-border: #614b3d;
  --date: #cce6da;
  --time-now: #ffd0d0;
  --time-now-border: #7a4448;
  --time-now-bg: #25191b;
  --time-tonight: #d9d2ff;
  --time-tonight-border: #514b76;
  --time-tonight-bg: #1d1b2a;
  --history-raw-text: #d8d9de;
  --nav-bg: #17191f;
  --backdrop: rgba(0,0,0,.66);
  --shadow: rgba(0,0,0,.35);
}

:root[data-theme="day"] {
  color-scheme: light;
  --theme-color: #f5f4f0;
  --bg: #f5f4f0;
  --panel: #ffffff;
  --panel-2: #f1f0ec;
  --surface-inset: #faf9f6;
  --surface-card: #fbfbfa;
  --surface-raw: #f3f2ee;
  --border: #d7d8de;
  --border-subtle: #e5e5e9;
  --text: #202126;
  --muted: #696e79;
  --placeholder: #9297a2;
  --accent: #d9d9ff;
  --accent-ink: #20213d;
  --danger: #8b3036;
  --warning: #7a4d18;
  --review-border: #dfc7ad;
  --review-bg: #fff8ef;
  --review-divider: #ead9c8;
  --review-badge-bg: #f7e7d5;
  --kind-action: #3c4e8d;
  --kind-idea: #67458b;
  --kind-thought: #3f6559;
  --kind-reference: #65603e;
  --priority-must: #8d343b;
  --priority-must-border: #d9b4b8;
  --priority-high: #8a542b;
  --priority-high-border: #dcc2aa;
  --date: #336854;
  --time-now: #8d343b;
  --time-now-border: #d9b4b8;
  --time-now-bg: #fff3f3;
  --time-tonight: #514777;
  --time-tonight-border: #c9c2e4;
  --time-tonight-bg: #f4f1ff;
  --history-raw-text: #3e4148;
  --nav-bg: #ffffff;
  --backdrop: rgba(29,31,37,.38);
  --shadow: rgba(38,40,48,.14);
}

:root[data-theme="oled"] {
  color-scheme: dark;
  --theme-color: #000000;
  --bg: #000000;
  --panel: #07080b;
  --panel-2: #0d0f14;
  --surface-inset: #030406;
  --surface-card: #050609;
  --surface-raw: #020203;
  --border: #252832;
  --border-subtle: #171920;
  --text: #ffffff;
  --muted: #9ea4b0;
  --placeholder: #6f7581;
  --accent: #dddfff;
  --accent-ink: #11121e;
  --danger: #ffc1c1;
  --warning: #ffdaae;
  --review-border: #504238;
  --review-bg: #120f0d;
  --review-divider: #2e2824;
  --review-badge-bg: #2d2119;
  --kind-action: #d4ddff;
  --kind-idea: #e5d4ff;
  --kind-thought: #d4e7df;
  --kind-reference: #e2dfbd;
  --priority-must: #ffd2d2;
  --priority-must-border: #633b40;
  --priority-high: #ffdabf;
  --priority-high-border: #5c4434;
  --date: #d1eadf;
  --time-now: #ffd2d2;
  --time-now-border: #713d43;
  --time-now-bg: #180d0f;
  --time-tonight: #ddd6ff;
  --time-tonight-border: #494368;
  --time-tonight-bg: #12101c;
  --history-raw-text: #e0e1e5;
  --nav-bg: #000000;
  --backdrop: rgba(0,0,0,.78);
  --shadow: rgba(0,0,0,.7);
}


/* Build 9 R2 — expanded centralized theme registry. Shell geometry is unchanged. */
:root[data-theme="ocean"] {
  color-scheme: dark; --theme-color:#071827; --bg:#071827; --panel:#0c2234; --panel-2:#123049; --surface-inset:#081d2e; --surface-card:#0b263a; --surface-raw:#061722; --border:#28506b; --border-subtle:#173b53; --text:#f1f8ff; --muted:#9fb9cb; --placeholder:#6f92a8; --accent:#81d4ff; --accent-ink:#062033; --danger:#ffb7bd; --warning:#ffd3a6; --review-border:#516056; --review-bg:#15221d; --review-divider:#34473d; --review-badge-bg:#283c32; --kind-action:#9edbff; --kind-idea:#c4c1ff; --kind-thought:#aee8d4; --kind-reference:#e4dda8; --priority-must:#ffc2c7; --priority-must-border:#754451; --priority-high:#ffd0a8; --priority-high-border:#6c523b; --date:#a5e6cd; --time-now:#ffc2c7; --time-now-border:#754451; --time-now-bg:#2a151b; --time-tonight:#c5c0ff; --time-tonight-border:#555487; --time-tonight-bg:#18182c; --history-raw-text:#d7e8f2; --nav-bg:#0c2234; --backdrop:rgba(0,10,18,.72); --shadow:rgba(0,0,0,.42);
}
:root[data-theme="forest"] {
  color-scheme: dark; --theme-color:#0e1914; --bg:#0e1914; --panel:#15251d; --panel-2:#1c3227; --surface-inset:#101f18; --surface-card:#13251c; --surface-raw:#0c1812; --border:#355947; --border-subtle:#294437; --text:#f1f8f3; --muted:#a8bfaf; --placeholder:#789487; --accent:#a6e3b9; --accent-ink:#112719; --danger:#ffb9b9; --warning:#ffd4a9; --review-border:#5b5542; --review-bg:#211f16; --review-divider:#403a2c; --review-badge-bg:#3a3020; --kind-action:#b9d8ff; --kind-idea:#d8c7ff; --kind-thought:#aee4c2; --kind-reference:#e4dfaf; --priority-must:#ffc6c6; --priority-must-border:#704447; --priority-high:#ffd2ae; --priority-high-border:#65503b; --date:#a9e5c0; --time-now:#ffc6c6; --time-now-border:#704447; --time-now-bg:#291719; --time-tonight:#d4cbff; --time-tonight-border:#585477; --time-tonight-bg:#1c1b29; --history-raw-text:#dce9df; --nav-bg:#15251d; --backdrop:rgba(3,10,6,.72); --shadow:rgba(0,0,0,.42);
}
:root[data-theme="ember"] {
  color-scheme: dark; --theme-color:#1b1311; --bg:#1b1311; --panel:#271a17; --panel-2:#34211c; --surface-inset:#211512; --surface-card:#291a16; --surface-raw:#170f0d; --border:#634238; --border-subtle:#4a3029; --text:#fff5ef; --muted:#c8aba0; --placeholder:#9a776c; --accent:#ffb47e; --accent-ink:#32160a; --danger:#ffc0c0; --warning:#ffd2a0; --review-border:#66503b; --review-bg:#2a2117; --review-divider:#4b3a2a; --review-badge-bg:#4a2f20; --kind-action:#cbd7ff; --kind-idea:#e3caff; --kind-thought:#c8e2d2; --kind-reference:#ead8aa; --priority-must:#ffc4c4; --priority-must-border:#7b4547; --priority-high:#ffbd8d; --priority-high-border:#7b5136; --date:#c6e1d0; --time-now:#ffc4c4; --time-now-border:#7b4547; --time-now-bg:#32191a; --time-tonight:#dccaff; --time-tonight-border:#67517a; --time-tonight-bg:#251b2a; --history-raw-text:#ead8d1; --nav-bg:#271a17; --backdrop:rgba(20,8,4,.74); --shadow:rgba(0,0,0,.45);
}
:root[data-theme="plum"] {
  color-scheme: dark; --theme-color:#18111d; --bg:#18111d; --panel:#24192b; --panel-2:#31213b; --surface-inset:#1d1523; --surface-card:#261a2d; --surface-raw:#140f18; --border:#5a4168; --border-subtle:#412f4d; --text:#fbf4ff; --muted:#bea9c8; --placeholder:#8e7599; --accent:#d9a9ff; --accent-ink:#2b123b; --danger:#ffb9c3; --warning:#ffd0a5; --review-border:#635044; --review-bg:#261d18; --review-divider:#48382f; --review-badge-bg:#423126; --kind-action:#c7d6ff; --kind-idea:#e2bfff; --kind-thought:#c6e2d7; --kind-reference:#e7dcad; --priority-must:#ffc4cb; --priority-must-border:#75424e; --priority-high:#ffd0ab; --priority-high-border:#6c5138; --date:#bde2d0; --time-now:#ffc4cb; --time-now-border:#75424e; --time-now-bg:#2d161e; --time-tonight:#e1c4ff; --time-tonight-border:#674f82; --time-tonight-bg:#24182f; --history-raw-text:#e5d8ea; --nav-bg:#24192b; --backdrop:rgba(12,5,16,.74); --shadow:rgba(0,0,0,.45);
}
:root[data-theme="rose"] {
  color-scheme: light; --theme-color:#fff3f5; --bg:#fff3f5; --panel:#fffafb; --panel-2:#fbe8ec; --surface-inset:#fff7f8; --surface-card:#fff9fa; --surface-raw:#f9ecef; --border:#e6c7cf; --border-subtle:#efd9de; --text:#3b252c; --muted:#7c5d67; --placeholder:#a78590; --accent:#ef9db0; --accent-ink:#441b28; --danger:#8d303f; --warning:#7b4c18; --review-border:#dec6ae; --review-bg:#fff8ef; --review-divider:#ead7c5; --review-badge-bg:#f5e3d2; --kind-action:#4a578f; --kind-idea:#77508f; --kind-thought:#486a5d; --kind-reference:#6c633c; --priority-must:#943544; --priority-must-border:#dfb6bf; --priority-high:#8d572f; --priority-high-border:#dec4ad; --date:#3c705c; --time-now:#943544; --time-now-border:#dfb6bf; --time-now-bg:#fff0f3; --time-tonight:#604f81; --time-tonight-border:#d2c7e8; --time-tonight-bg:#f7f2ff; --history-raw-text:#4c363d; --nav-bg:#fffafb; --backdrop:rgba(65,34,44,.35); --shadow:rgba(75,44,54,.13);
}
:root[data-theme="sand"] {
  color-scheme: light; --theme-color:#f4eee2; --bg:#f4eee2; --panel:#fffaf0; --panel-2:#eee3d2; --surface-inset:#faf3e7; --surface-card:#fdf8ee; --surface-raw:#efe6d8; --border:#d2c1aa; --border-subtle:#e2d4c0; --text:#332d24; --muted:#726858; --placeholder:#998d79; --accent:#dfbd7f; --accent-ink:#342511; --danger:#87353a; --warning:#805317; --review-border:#d5bfa1; --review-bg:#fff5e7; --review-divider:#e2cfb5; --review-badge-bg:#f0dfc5; --kind-action:#455d87; --kind-idea:#745284; --kind-thought:#476653; --kind-reference:#6a6038; --priority-must:#8e3439; --priority-must-border:#d7b1b4; --priority-high:#89572b; --priority-high-border:#d5b994; --date:#3d6b55; --time-now:#8e3439; --time-now-border:#d7b1b4; --time-now-bg:#fff0f0; --time-tonight:#5b4f79; --time-tonight-border:#c9c0db; --time-tonight-bg:#f5f0fb; --history-raw-text:#484035; --nav-bg:#fffaf0; --backdrop:rgba(46,38,25,.35); --shadow:rgba(58,48,31,.14);
}
:root[data-theme="slate"] {
  color-scheme: dark; --theme-color:#15191e; --bg:#15191e; --panel:#1e242b; --panel-2:#29313a; --surface-inset:#181e24; --surface-card:#1d242a; --surface-raw:#12171c; --border:#465360; --border-subtle:#343f49; --text:#f3f6f8; --muted:#acb7c0; --placeholder:#7e8b96; --accent:#b5cee6; --accent-ink:#182633; --danger:#ffbaba; --warning:#ffd2a3; --review-border:#5d5545; --review-bg:#211f19; --review-divider:#403b31; --review-badge-bg:#383228; --kind-action:#c7d9ff; --kind-idea:#ddcaff; --kind-thought:#c5dfd5; --kind-reference:#e1dbad; --priority-must:#ffc6c6; --priority-must-border:#70464a; --priority-high:#ffd1aa; --priority-high-border:#67503a; --date:#bfe2d2; --time-now:#ffc6c6; --time-now-border:#70464a; --time-now-bg:#28191b; --time-tonight:#d8ceff; --time-tonight-border:#595574; --time-tonight-bg:#1d1d2a; --history-raw-text:#dce2e6; --nav-bg:#1e242b; --backdrop:rgba(4,7,10,.72); --shadow:rgba(0,0,0,.42);
}
:root[data-theme="mint"] {
  color-scheme: light; --theme-color:#edf8f3; --bg:#edf8f3; --panel:#fbfffd; --panel-2:#e0f1e9; --surface-inset:#f4fbf8; --surface-card:#f9fdfb; --surface-raw:#e6f3ed; --border:#bfd8cc; --border-subtle:#d5e7df; --text:#20352c; --muted:#5e786c; --placeholder:#87a096; --accent:#8fd6b8; --accent-ink:#17382a; --danger:#88343c; --warning:#775018; --review-border:#d7c5ad; --review-bg:#fff8ef; --review-divider:#e5d7c5; --review-badge-bg:#f1e5d4; --kind-action:#455f8c; --kind-idea:#705184; --kind-thought:#3d6d59; --kind-reference:#65613c; --priority-must:#8e3840; --priority-must-border:#d7b7ba; --priority-high:#86582e; --priority-high-border:#d3c09e; --date:#326d56; --time-now:#8e3840; --time-now-border:#d7b7ba; --time-now-bg:#fff1f2; --time-tonight:#594f7d; --time-tonight-border:#c9c4df; --time-tonight-bg:#f5f2fb; --history-raw-text:#35483f; --nav-bg:#fbfffd; --backdrop:rgba(25,55,42,.30); --shadow:rgba(35,65,52,.12);
}
:root[data-theme="sunset"] {
  color-scheme: dark; --theme-color:#21151d; --bg:#21151d; --panel:#2e1d29; --panel-2:#3c2635; --surface-inset:#271922; --surface-card:#301d29; --surface-raw:#1a1117; --border:#684558; --border-subtle:#4f3443; --text:#fff4f2; --muted:#ccb0b3; --placeholder:#9a7b82; --accent:#ffad8f; --accent-ink:#3d1a11; --danger:#ffc0c3; --warning:#ffd19b; --review-border:#6a503c; --review-bg:#2a2018; --review-divider:#4d392d; --review-badge-bg:#4a2f24; --kind-action:#cbd6ff; --kind-idea:#e4c5ff; --kind-thought:#c7dfd3; --kind-reference:#ead7a7; --priority-must:#ffc4c9; --priority-must-border:#7a4650; --priority-high:#ffc893; --priority-high-border:#7a5137; --date:#c3e0cf; --time-now:#ffc4c9; --time-now-border:#7a4650; --time-now-bg:#33191f; --time-tonight:#dfc7ff; --time-tonight-border:#66517b; --time-tonight-bg:#271b2d; --history-raw-text:#ead8da; --nav-bg:#2e1d29; --backdrop:rgba(20,7,14,.74); --shadow:rgba(0,0,0,.46);
}
:root[data-theme="aurora"] {
  color-scheme: dark; --theme-color:#091b1d; --bg:#091b1d; --panel:#0f282a; --panel-2:#153638; --surface-inset:#0c2224; --surface-card:#0e292a; --surface-raw:#071718; --border:#2f5b5c; --border-subtle:#214647; --text:#f2fffd; --muted:#a4c5c0; --placeholder:#739b96; --accent:#9ee8dc; --accent-ink:#0c302c; --danger:#ffb9c2; --warning:#ffd5a2; --review-border:#5d5541; --review-bg:#211f16; --review-divider:#403a2c; --review-badge-bg:#383126; --kind-action:#bcd8ff; --kind-idea:#d6c2ff; --kind-thought:#a8e4d4; --kind-reference:#e3dcaa; --priority-must:#ffc2ca; --priority-must-border:#714550; --priority-high:#ffd1a8; --priority-high-border:#68503a; --date:#a9e5d2; --time-now:#ffc2ca; --time-now-border:#714550; --time-now-bg:#29171d; --time-tonight:#d7c7ff; --time-tonight-border:#57527e; --time-tonight-bg:#1c1b2d; --history-raw-text:#d7e8e5; --nav-bg:#0f282a; --backdrop:rgba(0,13,14,.74); --shadow:rgba(0,0,0,.44);
}

* { box-sizing: border-box; }
html { width: 100%; max-width: 100%; background: var(--bg); }
body { margin: 0; min-width: 320px; width: 100%; max-width: 100%; background: var(--bg); color: var(--text); overflow-x: hidden; overscroll-behavior-x: none; -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; }
#app { min-height: 100%; background: var(--bg); transform: none; contain: none; }
button, input, textarea, select { font: inherit; }
button { color: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.boot-message { padding: 2rem; color: var(--muted); }
.ram-scroll-region { width: 100%; min-height: 100svh; overflow: visible; transform: none; contain: none; }
.ram-content { width: min(100%, 1040px); margin: 0 auto; padding: 18px 18px calc(104px + env(safe-area-inset-bottom, 0px)); }
.topbar { --header-rest-offset: 0px; position: relative; z-index: 30; width: 100%; box-sizing: border-box; background: var(--bg); background-image: none; border-bottom: 1px solid var(--border-subtle); backdrop-filter: none; -webkit-backdrop-filter: none; filter: none; padding-top: calc(12px + env(safe-area-inset-top, 0px) + var(--header-rest-offset)); min-height: calc(68px + env(safe-area-inset-top, 0px)); transform: none; contain: none; }
.topbar::before { content: ""; position: absolute; left: 0; right: 0; top: calc(-1 * env(safe-area-inset-top, 0px)); height: env(safe-area-inset-top, 0px); background: var(--bg); background-image: none; filter: none; backdrop-filter: none; -webkit-backdrop-filter: none; pointer-events: none; }
.topbar > * { position: relative; z-index: 1; }
.topbar-inner { width: min(100%, 1040px); margin: 0 auto; padding: 0 18px calc(12px - var(--header-rest-offset)); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.ram-brand-copy { min-width: 0; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; font-synthesis: none; }
.ram-brand-line { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.ram-brand-copy h1 { margin: 0; color: var(--text); font-size: 1.02rem; line-height: 1.15; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; text-shadow: none; }
.ram-header-build { color: var(--muted); font-size: .72rem; line-height: 1.2; font-weight: 500; letter-spacing: 0; white-space: nowrap; }
.ram-header-maker { margin: 4px 0 0; color: var(--muted); font-size: .61rem; line-height: 1.15; font-weight: 800; letter-spacing: .18em; white-space: nowrap; text-transform: uppercase; text-shadow: none; }
.topbar-action { flex: 0 0 auto; }
.tagline { margin: 0 0 18px; color: var(--muted); font-size: .92rem; line-height: 1.45; }
.icon-button { width: 44px; height: 44px; border: 1px solid var(--border); background: var(--panel); border-radius: 14px; cursor: pointer; font-size: 1.15rem; }
.settings-icon { width: 22px; height: 22px; display: block; margin: auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.capture-card, .smart-area, .immediate-review { border: 1px solid var(--border); background: var(--panel); border-radius: 22px; }
.capture-card { padding: 18px; }
.capture-heading, .smart-heading, .review-now-heading, .dialog-heading, .view-summary { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.eyebrow { margin: 0 0 4px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; font-weight: 800; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.02em; }
h1 { font-size: clamp(1.35rem, 4vw, 1.8rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }
h4 { font-size: 1rem; }
.local-pill, .count-pill { border: 1px solid var(--border); background: var(--panel-2); color: var(--muted); border-radius: 999px; padding: 5px 9px; font-size: .75rem; white-space: nowrap; }

#brain-dump { width: 100%; margin-top: 16px; resize: vertical; min-height: 118px; border: 1px solid var(--border); background: var(--surface-inset); color: var(--text); border-radius: 16px; padding: 15px 16px; font-size: 1rem; line-height: 1.45; }
#brain-dump::placeholder { color: var(--placeholder); }
.capture-actions { display: flex; gap: 14px; justify-content: space-between; align-items: center; margin-top: 12px; }
.capture-actions p { margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.4; }
.primary-button, .secondary-button, .small-button, .text-button, .file-button { min-height: 44px; border-radius: 13px; cursor: pointer; border: 1px solid var(--border); }
.primary-button { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 800; padding: 0 18px; }
.primary-button:disabled { opacity: .55; cursor: default; }
.secondary-button, .file-button { background: var(--panel-2); padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; }
.text-button { min-height: 36px; background: transparent; border-color: transparent; color: var(--accent); padding: 0 6px; }
.capture-status { min-height: 1.3em; margin-top: 10px; color: var(--muted); font-size: .84rem; }

.immediate-review { margin-top: 16px; padding: 17px; border-color: var(--review-border); background: var(--review-bg); }
.review-now-heading { margin-bottom: 10px; }
.quick-review-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--review-divider); }
.quick-review-row:first-child { border-top: 0; }
.quick-review-row div { min-width: 0; }
.quick-review-row strong, .quick-review-row small { display: block; }
.quick-review-row small { color: var(--muted); margin-top: 4px; }

.smart-area { margin-top: 16px; padding: 17px; }
.smart-heading { margin-bottom: 12px; }
.smart-nav { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.smart-nav::-webkit-scrollbar { display: none; }
.view-chip { min-height: 38px; border: 1px solid var(--border); background: transparent; border-radius: 999px; padding: 0 12px; white-space: nowrap; cursor: pointer; color: var(--muted); }
.view-chip.active { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 800; }
.view-summary { align-items: center; padding: 10px 2px 13px; }
.view-summary p { margin: 4px 0 0; color: var(--muted); font-size: .84rem; }
.entry-list { display: grid; gap: 10px; }
.entry-card { display: flex; gap: 14px; justify-content: space-between; border: 1px solid var(--border); background: var(--surface-card); border-radius: 16px; padding: 14px; }
.entry-main { min-width: 0; flex: 1; }
.entry-title-row { display: flex; gap: 8px; align-items: center; }
.entry-title-row h4 { overflow-wrap: anywhere; }
.review-badge { border-radius: 999px; padding: 3px 7px; font-size: .68rem; background: var(--review-badge-bg); color: var(--warning); white-space: nowrap; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.badge { border: 1px solid var(--border); border-radius: 999px; padding: 3px 7px; color: var(--muted); font-size: .7rem; }
.kind-task, .kind-shopping { color: var(--kind-action); }
.kind-idea { color: var(--kind-idea); }
.priority-must { color: var(--priority-must); border-color: var(--priority-must-border); }
.priority-high { color: var(--priority-high); border-color: var(--priority-high-border); }
.date-badge { color: var(--date); }
.inline-suggestion { display: block; margin-top: 10px; border: 0; padding: 0; background: transparent; color: var(--warning); font-size: .78rem; text-align: left; cursor: pointer; }
.entry-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-content: flex-start; gap: 6px; max-width: 190px; }
.small-button { min-height: 36px; padding: 0 10px; background: var(--panel-2); color: var(--text); }
.small-button.subtle { color: var(--muted); background: transparent; }
.empty-state { padding: 28px 14px; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: 14px; line-height: 1.5; }

.sheet-dialog { width: min(calc(100% - 24px), 660px); max-height: calc(100% - 28px); overflow: auto; border: 1px solid var(--border); border-radius: 22px; padding: 18px; background: var(--panel); color: var(--text); }
.sheet-dialog::backdrop { background: var(--backdrop); }
.sheet-dialog label { display: grid; gap: 7px; margin-top: 14px; color: var(--muted); font-size: .82rem; }
.sheet-dialog input:not([type="checkbox"]), .sheet-dialog textarea, .sheet-dialog select { width: 100%; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-raw); color: var(--text); padding: 11px 12px; min-height: 44px; font-size: 1rem; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.check-row { grid-template-columns: 22px 1fr !important; align-items: center; }
.check-row input { width: 20px; height: 20px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.suggestion-box { margin-top: 12px; border: 1px solid var(--review-border); background: var(--review-bg); border-radius: 12px; padding: 11px; color: var(--warning); display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.settings-group { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 16px; }
.settings-group:first-of-type { border-top: 0; margin-top: 8px; }
.switch-row { grid-template-columns: minmax(0,1fr) auto !important; align-items: center; gap: 14px !important; padding: 10px 0; }
.switch-row strong, .switch-row small { display: block; }
.switch-row strong { color: var(--text); font-size: .94rem; }
.switch-row small { margin-top: 3px; line-height: 1.4; }
.switch-row input { width: 22px; height: 22px; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.file-button input { display: none; }
.muted { color: var(--muted); font-size: .85rem; }
.build-note { color: var(--muted); font-size: .76rem; text-align: center; margin-top: 20px; }
.hidden { display: none !important; }

@media (max-width: 640px) {
  .ram-content { padding-left: 12px; padding-right: 12px; }
  .tagline { max-width: 270px; }
  .capture-card, .smart-area, .immediate-review { border-radius: 18px; }
  .capture-actions { align-items: stretch; flex-direction: column; }
  .primary-button { width: 100%; }
  .entry-card { flex-direction: column; }
  .entry-actions { max-width: none; justify-content: flex-start; }
  .field-grid { grid-template-columns: 1fr; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .primary-button, .dialog-actions .secondary-button { width: 100%; }
}

/* Build 1 R1: live semantic sorting + persistent quick navigation */
.live-sort { margin-top: 10px; border: 1px solid var(--border); background: var(--surface-card); border-radius: 14px; overflow: hidden; }
.live-sort-heading { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.live-sort-heading strong { font-size: .82rem; }
.live-sort-heading small { color: var(--muted); font-size: .7rem; text-align: right; }
.live-sort-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px; border-top: 1px solid var(--border-subtle); }
.live-sort-row:nth-child(2) { border-top: 0; }
.live-sort-title { min-width: 0; overflow-wrap: anywhere; font-size: .86rem; color: var(--text); }
.live-sort-tags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.live-sort-more { display: block; padding: 8px 12px 10px; color: var(--muted); }
.time-now { color: var(--time-now); border-color: var(--time-now-border); background: var(--time-now-bg); }
.time-tonight { color: var(--time-tonight); border-color: var(--time-tonight-border); background: var(--time-tonight-bg); }
.bottom-nav { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; width: 100%; max-width: none; margin: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); border: 0; border-top: 1px solid var(--border-subtle); border-radius: 0; background: var(--bg); box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; transform: none; contain: none; }
.bottom-nav-button { min-width: 0; min-height: 48px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; align-content: center; gap: 2px; padding: 5px 3px; }
.bottom-nav-button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .73rem; font-weight: 750; }
.bottom-nav-button small { font-size: .65rem; color: inherit; opacity: .8; }
.bottom-nav-button.active { background: var(--accent); color: var(--accent-ink); }

@media (max-width: 640px) {
  .live-sort-heading { align-items: flex-start; flex-direction: column; gap: 3px; }
  .live-sort-heading small { text-align: left; }
  .live-sort-row { grid-template-columns: 1fr; }
  .live-sort-tags { justify-content: flex-start; }
  .bottom-nav { left: 0; right: 0; bottom: 0; border-radius: 0; }
  .bottom-nav-button span { font-size: .68rem; }
}

/* Build 1 R2: atomic memories + History spine */
.capture-card, .smart-area, .immediate-review, .history-area { border: 1px solid var(--border); background: var(--panel); border-radius: 22px; }
.kind-action, .kind-shopping { color: var(--kind-action); }
.kind-thought { color: var(--kind-thought); }
.kind-reference, .kind-media { color: var(--kind-reference); }
.history-area { margin-top: 16px; padding: 17px; }
.history-intro { margin: -2px 0 14px; color: var(--muted); font-size: .84rem; line-height: 1.45; }
.history-list { display: grid; gap: 10px; }
.history-card { border: 1px solid var(--border); background: var(--surface-card); border-radius: 16px; padding: 14px; }
.history-card-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.history-card-heading strong { font-size: .84rem; }
.history-card-heading small, .history-event-count { color: var(--muted); font-size: .7rem; }
.history-raw { margin-top: 10px; padding: 11px 12px; border-radius: 12px; background: var(--surface-raw); color: var(--history-raw-text); font-size: .84rem; line-height: 1.48; white-space: pre-wrap; overflow-wrap: anywhere; }
.history-extracted { display: grid; gap: 6px; margin-top: 10px; }
.history-item-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border-subtle); }
.history-item-row:first-child { border-top: 0; }
.history-item-row > span:first-child { min-width: 0; overflow-wrap: anywhere; font-size: .82rem; }
.history-event-count { display: block; margin-top: 8px; }

@media (max-width: 640px) {
  .capture-card, .smart-area, .immediate-review, .history-area { border-radius: 18px; }
  .history-card-heading { align-items: flex-start; flex-direction: column; gap: 3px; }
  .history-item-row { align-items: flex-start; }
}


/* Build 1 R3: centralized theme foundation + Nivareq maker attribution */
.theme-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.theme-choice { min-height: 64px; border: 1px solid var(--border); border-radius: 14px; background: var(--panel-2); color: var(--text); cursor: pointer; padding: 10px 12px; text-align: left; }
.theme-choice strong, .theme-choice small { display: block; }
.theme-choice strong { font-size: .9rem; }
.theme-choice small { margin-top: 4px; color: var(--muted); font-size: .72rem; }
.theme-choice.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.theme-choice.active strong { color: var(--text); }
.about-group .muted { line-height: 1.5; }
.maker-attribution { margin: 15px 0 0; color: var(--muted); font-size: .78rem; font-weight: 750; letter-spacing: .02em; }
.about-group .build-note { margin-top: 8px; text-align: left; }

@media (max-width: 440px) {
  .theme-options { grid-template-columns: 1fr; }
  .theme-choice { min-height: 54px; }
}


/* Build 1 R26 — single-source installed top rest offset.
   The header stays in normal document flow and moves with the page. Installed
   mode shifts the header content row exactly 10px downward by transferring
   10px from the row's bottom spacing to the header's top spacing, preserving
   the original total header height. No fixed/sticky header or content spacer. */
html.ram-installed .topbar { --header-rest-offset: 10px; }

/* R14 lower-shell foundation retained through R26.
   The page remains normal document flow with the accepted fixed full-width bottom
   navigation at bottom:0. R26 intentionally changes only the top positioning from
   sticky/fixed behavior to normal flow; installed detection is used only for the
   single 10px header-content rest offset and existing PWA behavior. */
.maker-footer { margin: 18px 0 2px; padding: 10px 4px; color: var(--muted); text-align: center; font-size: .7rem; font-weight: 750; letter-spacing: .035em; }

.sheet-dialog {
  max-height: calc(100svh - env(safe-area-inset-top, 0px) - 24px);
  overscroll-behavior: contain;
}

.sheet-dialog .dialog-heading {
  position: sticky;
  z-index: 3;
  top: -18px;
  margin: -18px -18px 14px;
  padding: 18px 18px 12px;
  background: var(--panel);
  border-radius: 22px 22px 0 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Build 2 R1 — specialized To Do experience. Content-only rules; the accepted
   Build 1 R26 header and bottom-navigation shell above remains untouched. */
.now-experience { margin-top: 16px; padding: 17px; border: 1px solid var(--border); background: var(--panel); border-radius: 22px; }
.space-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.space-hero p:not(.eyebrow) { margin: 5px 0 0; max-width: 620px; color: var(--muted); font-size: .84rem; line-height: 1.45; }
.quick-now-form { margin-top: 16px; padding: 14px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface-inset); }
.quick-now-form > label { display: block; margin-bottom: 8px; font-size: .78rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.quick-now-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
#quick-now-input { width: 100%; min-height: 44px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-raw); color: var(--text); padding: 0 13px; font-size: 1rem; }
#quick-now-input::placeholder { color: var(--placeholder); }
.quick-now-form > small { display: block; margin-top: 8px; color: var(--muted); font-size: .72rem; line-height: 1.4; }
.quick-now-button { min-width: 76px; }
.todo-groups { display: grid; gap: 16px; margin-top: 16px; }
.todo-group { border-top: 1px solid var(--border-subtle); padding-top: 14px; }
.todo-group:first-child { border-top: 0; padding-top: 0; }
.todo-group-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.todo-group-heading p { margin: 3px 0 0; color: var(--muted); font-size: .76rem; }
.todo-entry-list .entry-card { background: var(--surface-card); }

@media (max-width: 640px) {
  .now-experience { border-radius: 18px; }
  .space-hero { align-items: flex-start; }
  .quick-now-row { grid-template-columns: 1fr; }
  .quick-now-button { width: 100%; }
}


/* Build 2 R2 — uniform app-level surface behavior.
   More/Settings now uses the same document-flow surface system as Capture,
   Now, Spaces, and History. The accepted Build 1 R26 physical shell above,
   including header and bottom-navigation geometry, remains unchanged. */
.settings-surface {
  margin-top: 16px;
  padding: 17px;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 22px;
}
.settings-surface .smart-heading { margin-bottom: 4px; }
.settings-surface .smart-heading + .settings-group {
  border-top: 0;
  margin-top: 12px;
  padding-top: 0;
}
.settings-surface label {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  color: var(--muted);
  font-size: .82rem;
}

@media (max-width: 640px) {
  .settings-surface { border-radius: 18px; }
}

/* Build 2 — Shopping as a specialized derived Space.
   Content-only rules appended after the accepted Build 2 R3 shell. The R26/R3
   top and bottom shell contracts above are intentionally untouched. */
.shopping-experience { padding-top: 6px; }
.shopping-hero { margin: 2px 2px 14px; }
.quick-shopping-form { margin-bottom: 16px; padding: 14px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface-inset); }
.quick-shopping-form > label { display: block; margin-bottom: 8px; font-size: .78rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.quick-shopping-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
#quick-shopping-input { width: 100%; min-height: 44px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-raw); color: var(--text); padding: 0 13px; font-size: 1rem; }
#quick-shopping-input::placeholder { color: var(--placeholder); }
.quick-shopping-form > small { display: block; margin-top: 8px; color: var(--muted); font-size: .72rem; line-height: 1.4; }
.quick-shopping-button { min-width: 76px; }
.shopping-entry-list .entry-card { background: var(--surface-card); }

@media (max-width: 640px) {
  .quick-shopping-row { grid-template-columns: 1fr; }
  .quick-shopping-button { width: 100%; }
}

/* Build 2 — Thought Journal specialized Space. Content-only additions. */
.journal-experience { padding-top: 6px; }
.journal-hero { margin: 2px 2px 14px; }
.quick-thought-form { margin-bottom: 16px; padding: 14px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface-inset); }
.quick-thought-form > label { display: block; margin-bottom: 8px; font-size: .78rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.quick-thought-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: stretch; }
#quick-thought-input { width: 100%; min-height: 88px; resize: vertical; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-raw); color: var(--text); padding: 11px 13px; font-size: 1rem; line-height: 1.4; }
#quick-thought-input::placeholder { color: var(--placeholder); }
.quick-thought-form > small { display: block; margin-top: 8px; color: var(--muted); font-size: .72rem; line-height: 1.4; }
.quick-thought-button { min-width: 76px; }
.journal-list { display: grid; gap: 10px; }
.journal-card { border: 1px solid var(--border); background: var(--surface-card); border-radius: 16px; padding: 14px; }
.journal-meta { margin-bottom: 6px; color: var(--muted); font-size: .72rem; }
.journal-body { margin: 8px 0 0; color: var(--muted); font-size: .84rem; line-height: 1.5; white-space: pre-wrap; }
.journal-actions { margin-top: 12px; max-width: none; justify-content: flex-start; }

@media (max-width: 640px) {
  .quick-thought-row { grid-template-columns: 1fr; }
  .quick-thought-button { width: 100%; }
}


/* Build 7 R1 — Capture Intelligence v3. Accepted shell geometry remains frozen. */
.danger-group { border-color: color-mix(in srgb, var(--danger, #c94a4a) 35%, var(--line)); }
.danger-button {
  min-height: 44px;
  border: 1px solid color-mix(in srgb, #d94b4b 65%, var(--line));
  border-radius: 14px;
  padding: 10px 14px;
  background: color-mix(in srgb, #d94b4b 12%, var(--panel));
  color: inherit;
  font: inherit;
  font-weight: 700;
}
.danger-button:active { transform: translateY(1px); }

/* Build 7 R2 — About help/testing surfaces. App-shell geometry remains untouched. */
.help-details {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
  overflow: hidden;
}
.help-details summary {
  cursor: pointer;
  padding: 13px 14px;
  font-weight: 800;
  list-style-position: inside;
}
.help-body {
  padding: 0 14px 14px;
  color: var(--muted);
  line-height: 1.55;
}
.help-body p { margin: 8px 0; }
.help-body ol { margin: 8px 0 0; padding-left: 22px; }
.help-body li + li { margin-top: 8px; }
.testing-checklist {
  display: grid;
  gap: 10px;
}
.testing-checklist label {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
}
.testing-checklist input { margin-top: 4px; }

/* Build 9 R1 — Recall Search v1. Content-only History additions; accepted shell geometry stays frozen. */
.recall-search-card { margin: 0 0 14px; padding: 14px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface-inset); }
.recall-search-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.recall-search-heading h3 { font-size: 1rem; }
.recall-search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 12px; }
#recall-search-input { width: 100%; min-height: 44px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-raw); color: var(--text); padding: 0 13px; font-size: 1rem; }
#recall-search-input::placeholder { color: var(--placeholder); }
.recall-search-card > small { display: block; margin-top: 8px; color: var(--muted); font-size: .72rem; line-height: 1.4; }
.recall-results { display: grid; gap: 10px; margin-top: 12px; }
.recall-result-card { border: 1px solid var(--border); background: var(--surface-card); border-radius: 16px; padding: 14px; }
.recall-result-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.recall-result-heading > div { min-width: 0; }
.recall-result-heading strong, .recall-result-heading small { display: block; overflow-wrap: anywhere; }
.recall-result-heading small { margin-top: 4px; color: var(--muted); font-size: .7rem; }
.recall-match-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.recall-match-chip { display: inline-flex; align-items: center; min-height: 24px; border: 1px solid var(--border); border-radius: 999px; padding: 2px 7px; color: var(--muted); font-size: .68rem; }
.recall-match-chip.match-exact { color: var(--accent); }
.recall-match-chip.match-semantic { color: var(--kind-idea); }
.recall-result-body { margin: 10px 0 0; color: var(--muted); font-size: .84rem; line-height: 1.5; white-space: pre-wrap; }
.recall-source-context { margin-top: 11px; padding: 10px 11px; border: 1px solid var(--border-subtle); border-radius: 12px; background: var(--surface-raw); }
.recall-source-context small { display: block; margin-bottom: 5px; color: var(--muted); font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.recall-source-context div { color: var(--history-raw-text); font-size: .82rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.recall-result-actions { display: flex; gap: 8px; margin-top: 11px; }

@media (max-width: 640px) {
  .recall-search-row { grid-template-columns: 1fr; }
  #recall-clear-button { width: 100%; }
  .recall-result-heading { align-items: flex-start; }
}


/* Build 9 R2 — Help & Guides and deliberate Full Reset. Content-only; shell frozen. */
.help-guides-dialog { width: min(92vw, 680px); }
.reset-dialog { width: min(92vw, 560px); }
.reset-warning { border: 1px solid color-mix(in srgb, var(--danger) 40%, var(--border)); border-radius: 14px; padding: 14px; background: color-mix(in srgb, var(--danger) 8%, var(--panel)); }
.reset-warning strong { color: var(--danger); }
.reset-warning p { margin: 8px 0 0; color: var(--muted); line-height: 1.45; }
.reset-ack, .reset-phrase { display: grid; gap: 8px; margin-top: 16px; color: var(--muted); font-size: .84rem; }
.reset-ack { grid-template-columns: auto 1fr; align-items: start; }
.reset-ack input { margin-top: 3px; }
.reset-phrase input { width: 100%; min-height: 44px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-raw); color: var(--text); padding: 0 13px; font-size: 1rem; letter-spacing: .06em; }
.danger-button:disabled { opacity: .45; cursor: not-allowed; }
.setting-select-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; }
.setting-select-row > span { display: grid; gap: 4px; min-width: 0; }
.setting-select-row small { color: var(--muted); }
.setting-select-row select { min-width: 150px; max-width: 46%; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-raw); color: var(--text); padding: 10px 12px; min-height: 44px; }
@media (max-width: 560px) { .setting-select-row { align-items: stretch; flex-direction: column; } .setting-select-row select { width: 100%; max-width: none; } }

/* Build 10 R1 — Related + Resurfacing and small accepted Beta UX refinements.
   Content-only rules; accepted shell geometry remains frozen. */
.settings-disclosure { border: 0; }
.settings-disclosure > summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 52px; cursor: pointer; list-style: none; }
.settings-disclosure > summary::-webkit-details-marker { display: none; }
.settings-disclosure > summary > span:first-child { display: grid; gap: 4px; min-width: 0; }
.settings-disclosure > summary small { color: var(--muted); font-size: .74rem; font-weight: 600; }
.disclosure-cue { flex: 0 0 auto; color: var(--accent); font-size: .76rem; font-weight: 800; }
.settings-disclosure[open] .disclosure-cue::after { content: ' · Close'; }
.settings-disclosure-body { padding-top: 4px; }

#quick-now-input { padding: 10px 13px; line-height: 1.4; resize: none; overflow-y: hidden; }
.auto-grow-textarea { resize: none; overflow-y: hidden; line-height: 1.45; }
.quick-now-row { align-items: end; }

.resurface-card { margin: 0 0 14px; padding: 14px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface-inset); }
.resurface-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.resurface-heading h3 { font-size: 1rem; }
.resurface-card > .muted { margin: 7px 0 0; font-size: .76rem; line-height: 1.45; }
.resurface-lenses { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.resurface-results { display: grid; gap: 9px; margin-top: 10px; }
.resurface-result-card { border: 1px solid var(--border); border-radius: 14px; padding: 12px; background: var(--surface-card); }
.resurface-result-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.resurface-result-heading > div { min-width: 0; }
.resurface-result-heading strong, .resurface-result-heading small { display: block; overflow-wrap: anywhere; }
.resurface-result-heading small { margin-top: 3px; color: var(--muted); font-size: .68rem; }
.resurface-reason { margin: 8px 0 0; color: var(--accent); font-size: .75rem; font-weight: 700; line-height: 1.4; }
.resurface-source { margin-top: 8px; color: var(--muted); font-size: .78rem; line-height: 1.42; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; }
.compact-empty { margin-top: 0; padding: 12px; }

.related-dialog { width: min(92vw, 720px); }
.related-seed-card { border: 1px solid var(--border); border-radius: 16px; padding: 14px; background: var(--surface-inset); }
.related-seed-heading, .related-result-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.related-seed-heading > div, .related-result-heading > div { min-width: 0; }
.related-seed-heading strong, .related-seed-heading small, .related-result-heading strong, .related-result-heading small { display: block; overflow-wrap: anywhere; }
.related-seed-heading small, .related-result-heading small { margin-top: 4px; color: var(--muted); font-size: .7rem; }
.related-source-context { margin-top: 11px; padding: 10px 11px; border: 1px solid var(--border-subtle); border-radius: 12px; background: var(--surface-raw); }
.related-source-context > small, .related-section-label { display: block; margin-bottom: 5px; color: var(--muted); font-size: .67rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.related-source-context > div { color: var(--history-raw-text); font-size: .82rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.related-evolution { margin-top: 12px; }
.related-event { padding: 8px 0; border-top: 1px solid var(--border-subtle); }
.related-event:first-of-type { border-top: 0; }
.related-event > span { font-size: .76rem; font-weight: 750; }
.related-event > small { margin-left: 8px; color: var(--muted); font-size: .66rem; }
.related-event > p { margin: 4px 0 0; color: var(--muted); font-size: .75rem; line-height: 1.4; }
.related-results { display: grid; gap: 10px; margin-top: 12px; }
.related-result-card { border: 1px solid var(--border); border-radius: 14px; padding: 12px; background: var(--surface-card); }
.related-reasons { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.related-result-source { margin-top: 9px; color: var(--muted); font-size: .77rem; line-height: 1.42; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; }

@media (max-width: 640px) {
  .resurface-heading, .resurface-result-heading, .related-seed-heading, .related-result-heading { align-items: flex-start; }
  .resurface-lenses { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
  .resurface-lenses::-webkit-scrollbar { display: none; }
  .resurface-lenses .view-chip { flex: 0 0 auto; }
/* Build 11 R2 — Capture truth + History control. Content-only additions; accepted shell geometry remains frozen. */
.history-mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 16px;
}
.history-mode-tabs .view-chip { min-height: 38px; }
.history-item-tags {
  display: inline-flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.deleted-memory-row { opacity: .72; }
.deleted-memory-row > span:first-child { text-decoration: line-through; text-decoration-thickness: 1px; }
.deleted-badge {
  border-color: color-mix(in srgb, var(--danger, #c94a4a) 38%, var(--border));
  background: color-mix(in srgb, var(--danger, #c94a4a) 10%, var(--panel-2));
  color: var(--muted);
}
.muted-badge { color: var(--muted); }
.removed-capture-card { border-style: dashed; }
.removed-capture-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.compact-danger { min-height: 36px; padding: 7px 10px; font-size: .82rem; }
.capture-manage-dialog { width: min(calc(100% - 24px), 700px); }
.capture-manage-copy { margin: 8px 0 10px; color: var(--muted); line-height: 1.5; }
.capture-manage-raw {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-inset);
  line-height: 1.45;
}
.capture-manage-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}
.capture-manage-section > .muted { margin: 6px 0 12px; }
.manage-memory-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border-subtle);
}
.manage-memory-row:first-of-type { border-top: 0; }
.manage-memory-row > div { display: grid; gap: 3px; min-width: 0; }
.manage-memory-row strong { overflow-wrap: anywhere; font-size: .86rem; }
.manage-memory-row small { color: var(--muted); }
.capture-removal-options { display: grid; gap: 8px; }
.capture-removal-option {
  display: grid !important;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 10px !important;
  margin: 0 !important;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-inset);
  color: var(--text) !important;
}
.capture-removal-option input { margin-top: 3px; }
.capture-removal-option span { display: grid; gap: 3px; }
.capture-removal-option small { color: var(--muted); line-height: 1.4; }
.capture-removal-chooser {
  display: grid;
  gap: 7px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 13px;
  background: var(--panel-soft);
}
.capture-removal-chooser.hidden { display: none; }
.capture-memory-check {
  display: grid !important;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 9px !important;
  margin: 0 !important;
  color: var(--text) !important;
  font-size: .82rem !important;
}
.capture-memory-check input { margin-top: 2px; }
.capture-remove-action { display: flex; justify-content: flex-end; margin-top: 14px; }

@media (max-width: 640px) {
  .history-item-row { gap: 8px; }
  .history-item-tags { justify-content: flex-start; }
  .manage-memory-row { align-items: flex-start; }
  .capture-remove-action .danger-button { width: 100%; }
  .removed-capture-actions { display: grid; }
}
