:root {
  color-scheme: light;
  --paper: #f8f7f3;
  --surface: #fffefa;
  --ink: #26352e;
  --muted: #758078;
  --line: #e6e8e1;
  --soft: #f0f2eb;
  --accent: #426b58;
  --accent-dark: #315441;
  --lime: #d4e5a2;
  --sidebar-width: 252px;
  --insights-width: 340px;
  --serif: "Fraunces", Georgia, serif;
  --sans: "DM Sans", ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--paper); color: var(--ink); font-family: var(--sans); }
body { min-height: 100dvh; }
button, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid #a8c276; outline-offset: 3px; }
.app-shell { height: 100dvh; min-height: 0; display: grid; grid-template-columns: 252px minmax(0, 1fr) minmax(290px, 340px); overflow: hidden; touch-action: manipulation; }
.app-shell[hidden] { display: none; }
.auth-screen { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth-screen[hidden] { display: none; }
.auth-card { width: min(100%, 410px); padding: 32px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 16px 50px rgb(42 58 46 / 7%); }
.auth-card h1 { margin-top: 38px; font-size: 38px; }
.auth-card > p { color: #59675c; font-size: 16px; line-height: 1.6; }
.auth-card form { display: grid; gap: 9px; margin-top: 24px; }
.auth-card label { color: #59675c; font-size: 16px; font-weight: 600; }
.auth-card input { min-height: 44px; padding: 0 12px; border: 1px solid #dfe3da; border-radius: 8px; background: white; color: var(--ink); font: inherit; }
#auth-invite-wrap { display: grid; gap: 9px; }
#auth-invite-wrap[hidden] { display: none; }
.auth-hint { margin: 0; color: #59675c; font-size: 14px; }
.auth-submit { min-height: 44px; margin-top: 8px; border: 0; border-radius: 8px; background: var(--accent); color: white; font-weight: 600; }
.auth-toggle { margin-top: 16px; padding: 8px 0; border: 0; background: transparent; color: var(--accent); font-size: 16px; font-weight: 600; }
.auth-storage-note { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 14px !important; }
.auth-error { color: #9a3f32 !important; }
.account-tools { display: grid; gap: 8px; padding: 8px 10px 14px; border-bottom: 1px solid #e2e5dd; color: #59675c; font-size: 14px; overflow-wrap: anywhere; }
.import-button { width: fit-content; min-height: 44px; display: inline-flex; align-items: center; color: var(--accent-dark); cursor: pointer; font-weight: 600; }
.import-help { max-width: 260px; color: #59675c; font-size: 14px; line-height: 1.55; }
.import-help summary { width: fit-content; color: var(--accent); cursor: pointer; }
.import-help ol { display: grid; gap: 5px; padding-left: 19px; }
.import-help p { margin: 8px 0 0; }
.import-help a { color: var(--accent); }
.import-help code { font-size: 14px; }
.account-tools button { width: fit-content; min-height: 44px; padding: 4px 0; border: 0; background: transparent; color: #46574b; font: inherit; text-align: left; }
.account-tools #app-lock-toggle:not([hidden]) { color: var(--accent); font-weight: 600; }
.account-link { width: fit-content; min-height: 44px; display: inline-flex; align-items: center; color: var(--accent-dark); text-decoration: none; font-weight: 600; }
.account-tools .delete-account { color: #96584e; }
#import-status { color: var(--accent); }
.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; overflow-y: auto; padding: 30px 18px 22px; background: #f2f3ed; border-right: 1px solid #e8eae3; }
.brand { display: inline-flex; align-items: center; gap: 10px; width: fit-content; color: var(--ink); text-decoration: none; font-size: 19px; font-weight: 700; letter-spacing: -0.8px; }
.brand-mark { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 10px 10px 10px 3px; background: var(--accent); color: white; font-family: var(--serif); font-size: 21px; font-style: italic; line-height: 1; }
.brand-dot { color: var(--accent); }
.send-button:hover { background: var(--accent-dark); transform: translateY(-1px); }
.section-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 9px 4px 11px; }
.section-heading .nav-label { color: #68766c; font-size: 13px; font-weight: 600; letter-spacing: .2px; }
.nav-label { padding: 0; color: #59675c; font-size: 12px; font-weight: 700; letter-spacing: 1.1px; }
.add-topic { width: 44px; height: 44px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #405949; font-size: 22px; }
.add-topic:hover { background: #e6eae1; color: var(--accent); }
.topic-list, .chat-list { display: flex; flex-direction: column; gap: 2px; }
.chat-list { gap: 0; }
.topic-row, .sidebar-chat { display: flex; align-items: center; min-width: 0; border-radius: 7px; }
.topic-row:hover, .sidebar-chat:hover, .topic-row.selected, .sidebar-chat.current { background: #e8ebe3; }
.topic-item { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 44px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: #46574b; text-align: left; font-size: 15px; }
.topic-item > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topic-item.selected { background: #e8ebe3; color: var(--accent-dark); font-weight: 600; }
.topic-glyph { width: 15px; flex: 0 0 15px; color: #809081; text-align: center; font-size: 14px; }
.topic-row.selected .topic-item { color: var(--accent-dark); font-weight: 600; }
.topic-remove, .sidebar-chat-remove { width: 44px; height: 44px; flex: 0 0 44px; padding: 0; border: 0; background: transparent; color: #59675c; font-size: 20px; opacity: 0; }
.topic-row:hover .topic-remove, .sidebar-chat:hover .sidebar-chat-remove, .topic-row:focus-within .topic-remove, .sidebar-chat:focus-within .sidebar-chat-remove { opacity: 1; }
.topic-form { display: flex; gap: 4px; margin: 4px 2px 10px; }
.topic-form[hidden] { display: none; }
.topic-form input { width: 100%; min-width: 0; padding: 7px 8px; border: 1px solid #dce1d8; border-radius: 6px; background: white; color: var(--ink); font-size: 11px; }
.topic-form button { width: 29px; flex: 0 0 29px; border: 0; border-radius: 6px; background: var(--accent); color: white; }
.recent-heading { margin-top: 12px; }
.sidebar-chat { min-width: 0; min-height: 44px; padding: 0; border-radius: 8px; transition: background .15s; }
.sidebar-chat-open { flex: 1; min-width: 0; min-height: 44px; overflow: hidden; padding: 0 9px; border: 0; border-radius: 8px; background: transparent; color: #46574b; text-align: left; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; line-height: 1.25; }
.sidebar-chat.current .sidebar-chat-open { color: var(--accent-dark); font-weight: 600; }
.sidebar-empty { margin: 7px 10px; color: #59675c; font-size: 14px; line-height: 1.5; }
.insights-panel { position: sticky; top: 0; height: 100dvh; overflow-y: auto; padding: 30px 20px 24px; border-left: 1px solid #e4e8df; background: #f2f3ed; }
.insights-panel-heading { display: flex; align-items: flex-start; justify-content: flex-end; gap: 10px; min-height: 0; margin-bottom: 8px; }
.insights-close { display: none; border: 0; background: transparent; color: var(--muted); font-size: 25px; }
.insights-close, .settings-close { min-width: 44px; min-height: 44px; }
.insights-note { margin: 3px 0 12px; color: #59675c; font-size: 14px; line-height: 1.5; }
.relationship-map { margin: 0 0 18px; padding: 12px; overflow: hidden; border: 1px solid #e8ebe4; border-radius: 16px; background: linear-gradient(145deg, #f8f9f4, #fffefa 72%); box-shadow: 0 2px 8px rgb(52 69 54 / 3%); }
.relationship-graph { margin: 0; }
.relationship-network { display: grid; justify-items: center; gap: 0; }
.relationship-person { position: relative; display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 44px; padding: 7px 10px; border: 1px solid #e9ece5; border-radius: 14px; background: rgb(255 254 250 / 82%); color: #59675c; box-shadow: 0 1px 5px rgb(52 69 54 / 3%); text-align: left; }
button.relationship-person { cursor: pointer; }
button.relationship-person:hover { border-color: #d5ded0; background: #f8f9f4; }
.relationship-person > span:last-child { display: grid; gap: 1px; min-width: 0; }
.relationship-person strong { overflow-wrap: break-word; word-break: normal; color: #4b5c50; font-size: 14px; font-weight: 650; line-height: 1.25; }
.relationship-person small { overflow-wrap: break-word; word-break: normal; color: #78847b; font-size: 12px; line-height: 1.25; }
.relationship-orbit { display: grid; width: 27px; height: 27px; flex: 0 0 27px; place-items: center; border-radius: 50%; background: #f0f3ec; color: #668272; font-family: var(--serif); font-size: 15px; font-style: normal; font-weight: 600; }
.relationship-person-you { min-width: 92px; min-height: 40px; justify-content: center; border-color: #e4e9df; background: #f6f8f2; }
.relationship-person-you .relationship-orbit { background: #ebf0e7; }
.relationship-connector { width: 1px; height: 12px; background: #d9e0d4; }
.relationship-people { position: relative; display: grid; width: 100%; max-width: 440px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding-top: 12px; }
.relationship-people::before { position: absolute; top: 0; left: 25%; width: 50%; height: 1px; background: #d9e0d4; content: ""; }
.relationship-person-branch { position: relative; justify-self: stretch; width: 100%; max-width: none; flex-direction: row; justify-content: flex-start; gap: 7px; min-height: 58px; padding: 8px; text-align: left; }
.relationship-person-branch > span:last-child { justify-items: start; }
.relationship-person-branch::before { position: absolute; top: -13px; left: 50%; width: 1px; height: 12px; background: #d9e0d4; content: ""; }
.relationship-people-single { grid-template-columns: minmax(0, 230px); justify-content: center; }
.relationship-people-single::before { left: 50%; width: 1px; }
.relationship-network-empty { max-width: 270px; margin: 0; color: #59675c; font-size: 14px; line-height: 1.4; text-align: center; }
.insights-section { margin: 0 0 18px; }
.insights-section[hidden] { display: none; }
.insights-section-heading { margin: 0 0 9px; color: #78847a; font-size: 11px; font-weight: 700; letter-spacing: .09em; line-height: 1.35; text-transform: uppercase; }
.insight-list { display: grid; gap: 10px; }
.insights-empty { margin: 0; color: #78847a; font-size: 14px; line-height: 1.45; }
.insight-card { border: 1px solid #e1e5db; border-radius: 10px; background: rgb(255 254 250 / 82%); }
.insight-card summary { display: grid; gap: 6px; padding: 12px 14px; cursor: pointer; list-style: none; }
.insight-card summary::-webkit-details-marker { display: none; }
.insight-relationship { width: fit-content; max-width: 100%; padding: 4px 8px; border: 1px solid #dce6d2; border-radius: 999px; background: #f1f6e9; color: #496654; font-size: 12px; font-weight: 700; line-height: 1.2; }
.insight-title { color: #34483b; font-size: 16px; font-weight: 600; line-height: 1.45; }
.insight-card[open] { background: #fffefa; }
.insight-body { padding: 0 14px 14px; color: #46574b; font-size: 16px; line-height: 1.6; }
.insight-body p { margin: 0 0 8px; }
.insight-sources { display: grid; gap: 4px; padding-top: 7px; border-top: 1px solid #edf0e8; }
.insight-source { padding: 0; border: 0; background: transparent; color: var(--accent); font: inherit; text-align: left; cursor: pointer; }
.try-next-list { display: grid; gap: 8px; }
.try-next-card { display: grid; gap: 8px; padding: 11px 12px; border: 1px solid #e8ebe4; border-radius: 11px; background: #f8f9f4; }
.try-next-card p { margin: 0; color: #46574b; font-size: 15px; line-height: 1.5; }
.try-next-empty { margin: 0; color: #78847a; font-size: 14px; line-height: 1.45; }
.insights-refresh { margin: 14px 0 0; padding: 8px 0; border: 0; background: transparent; color: var(--accent-dark); font: inherit; font-size: 16px; font-weight: 600; text-align: left; }
.insights-refresh:disabled { opacity: .55; cursor: wait; }
.settings-panel { position: fixed; z-index: 7; top: 0; right: 0; display: none; width: min(420px, calc(100vw - 32px)); height: 100dvh; overflow-y: auto; padding: 30px 20px 24px; border-left: 1px solid #e4e8df; background: #f2f3ed; box-shadow: -15px 20px 35px rgb(28 41 31 / 15%); }
.settings-panel.is-open { display: block; }
.settings-panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 20px; }
.settings-panel-heading h2 { margin: 8px 0 0; color: var(--ink); font-family: var(--serif); font-size: 24px; font-weight: 500; line-height: 1.2; }
.settings-close { display: block; border: 0; background: transparent; color: var(--muted); font-size: 25px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 11px; border: 0; border-radius: 8px; background: transparent; color: #46574b; text-align: left; font-size: 15px; }
.nav-item:hover { background: #e9ece4; }
.nav-item span { width: 17px; color: #647a6c; font-size: 18px; }
.sidebar-bottom { margin-top: auto; }
.privacy-note { display: flex; gap: 10px; padding: 14px 11px; border-top: 1px solid #e2e5dd; }
.privacy-icon { color: var(--accent); font-size: 16px; }
.privacy-note div { display: grid; gap: 4px; }
.privacy-note strong { font-size: 14px; font-weight: 600; }
.privacy-note div span { color: #59675c; font-size: 14px; line-height: 1.5; }
.facts { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 10px; }
.facts:empty { display: none; }
.fact { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 999px; background: white; color: #405949; font-size: 14px; }
.remove { border: 0; background: transparent; color: #97a098; font-size: 11px; }
.main-panel { height: 100dvh; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.mobile-top { display: none; }
.page-wrap { width: min(100% - 64px, 720px); height: 0; min-height: 0; flex: 1 1 0; display: flex; flex-direction: column; overflow: hidden; margin: 0 auto; padding: 76px 0 24px; }
.page-wrap.is-empty { min-height: 0; }
.eyebrow { display: flex; align-items: center; gap: 8px; color: #59675c; font-size: 12px; font-weight: 700; letter-spacing: 1.1px; text-transform: uppercase; }
.eyebrow[hidden] { display: none; }
.eyebrow-dot { width: 7px; height: 7px; border-radius: 50%; background: #a3bd6b; box-shadow: 0 0 0 3px #e7eed6; }
.welcome { margin-top: 25px; }
h1 { margin: 0; color: var(--ink); font-family: var(--serif); font-size: clamp(39px, 5.3vw, 59px); font-weight: 500; letter-spacing: -2.3px; line-height: 1.07; }
h1 em { color: var(--accent); font-weight: 500; }
.intro { max-width: 530px; margin: 19px 0 28px; color: #46574b; font-size: 16px; line-height: 1.65; }
.starter-card { position: relative; max-width: 650px; padding: 18px 20px 17px; border: 1px solid #e9e8df; border-radius: 11px; background: #fffefa; box-shadow: 0 7px 20px rgb(52 69 54 / 3%); }
.starter-top { display: flex; align-items: center; gap: 9px; color: #59675c; font-size: 12px; font-weight: 700; letter-spacing: 1px; }
.starter-icon { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: #edf2e2; color: var(--accent); font-size: 15px; }
.starter-hint { margin: 12px 0 0 31px; color: #59675c; font-size: 14px; line-height: 1.5; }
.thread { min-height: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 22px; width: 100%; overflow-x: hidden; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; padding: 30px 0 250px; }
.thread:empty { display: none; }
.turn { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; max-width: 88%; }
.turn.user { align-self: flex-end; align-items: flex-end; max-width: 80%; }
.bubble { margin: 0; white-space: pre-wrap; font-size: 16px; line-height: 1.65; }
.bubble.user { max-width: 100%; padding: 13px 17px; border: 1px solid #e7e9e1; border-radius: 15px 15px 4px 15px; background: #eef1e9; color: #314038; }
.bubble.assistant { padding: 2px 0; color: #38463d; }
.assistant-label { display: flex; align-items: center; gap: 8px; color: #59675c; font-size: 12px; font-weight: 700; letter-spacing: 1px; }
.sparkle { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: #eaf0dc; color: var(--accent); font-size: 14px; }
.turn .remove { align-self: flex-start; padding: 3px 0; opacity: 0; transition: opacity .15s; }
.turn:hover .remove, .turn:focus-within .remove { opacity: 1; }
.waiting { color: #839084 !important; animation: breathe 1.3s ease-in-out infinite alternate; }
@keyframes breathe { to { opacity: .5; } }
.composer-wrap { position: fixed; z-index: 4; right: calc(var(--insights-width) + 32px); bottom: 0; left: calc(var(--sidebar-width) + 32px); width: auto; max-width: 720px; margin: 0 auto; padding: 10px 0 4px; background: var(--paper); }
.composer { display: grid; gap: 4px; padding: 7px 10px 8px 12px; border: 1px solid #dfe3da; border-radius: 12px; background: #fffefa; box-shadow: 0 9px 26px rgb(52 69 54 / 7%); }
.composer textarea { display: block; box-sizing: border-box; width: 100%; min-height: 44px; max-height: 120px; resize: none; overflow-y: hidden; padding: 10px 2px 6px; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 16px; line-height: 1.4; vertical-align: top; }
.composer-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid #eef0ea; padding-top: 10px; }
.composer-actions { display: flex; width: 100%; align-items: center; gap: 8px; }
.composer-control { min-height: 44px; box-sizing: border-box; }
.response-mode-select { min-width: 104px; margin-right: auto; padding: 0 30px 0 12px; appearance: none; border: 1px solid #e4e7df; border-radius: 8px; background-color: #fffefa; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='m2.5 4.5 3.5 3 3.5-3' fill='none' stroke='%235e7062' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5'/%3E%3C/svg%3E"); background-position: right 10px center; background-repeat: no-repeat; color: #46574b; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease; }
.response-mode-select:hover { border-color: #b8c6b7; background-color: #f8f9f4; }
.response-mode-select:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgb(62 112 91 / 18%); }
.voice-button, .send-button { display: grid; width: 40px; min-width: 40px; height: 40px; min-height: 40px; place-items: center; padding: 0; border-radius: 50%; }
.voice-button { border: 1px solid #e4e7df; background: #fffefa; color: #5e7062; }
.voice-button:hover { background: #f3f5ef; }
.voice-button svg, .send-button svg { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.voice-button.listening { border-color: var(--accent); background: var(--accent); color: white; }
.send-button { border: 0; background: var(--accent); color: white; transition: background .18s, transform .18s; }
.send-button:hover { background: #315f4b; }
.send-button:disabled, .voice-button:disabled { opacity: .5; cursor: wait; }
.gentle-reminder { margin: 8px 0 0; color: #59675c; text-align: center; font-size: 14px; }
.heard { margin: 10px 0 0; color: #46574b; font-size: 14px; line-height: 1.5; }
.composer[hidden] { display: none !important; }
.thread.is-list { flex: 1; padding-top: 0; }
.list-heading { padding: 25px 0 18px; border-bottom: 1px solid var(--line); }
.list-heading h1 { margin-top: 19px; font-size: 43px; }
.list-heading p { margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.chat-row { display: flex; align-items: center; gap: 12px; padding: 15px 10px; border-bottom: 1px solid var(--line); transition: background .15s; }
.chat-row:hover { background: #f1f3ec; }
.chat-icon { display: grid; flex: 0 0 33px; width: 33px; height: 33px; place-items: center; border-radius: 10px; background: #ecf0e4; color: var(--accent); }
.chat-open { flex: 1; padding: 8px 0; border: 0; background: transparent; color: var(--ink); text-align: left; font-size: 16px; line-height: 1.5; }
.chat-open[aria-current="true"] { color: var(--accent); font-weight: 700; }
.empty-history { display: grid; justify-items: center; gap: 8px; padding: 62px 20px; color: #829084; text-align: center; }
.empty-history > span { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; background: #edf2e2; color: var(--accent); font-size: 21px; }
.empty-history strong { margin-top: 4px; color: var(--ink); font-family: var(--serif); font-size: 20px; font-weight: 500; }
.empty-history p { margin: 0; font-size: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.native-share { padding: 2px 0; border: 0; background: transparent; color: var(--accent); font-size: 11px; font-weight: 600; }
.app-lock-screen { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 24px; background: var(--paper); }
.app-lock-screen[hidden] { display: none; }
.app-lock-card { width: min(100%, 380px); display: grid; justify-items: center; gap: 12px; padding: 36px 28px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); text-align: center; }
.app-lock-card h1 { margin-top: 12px; font-size: 30px; letter-spacing: -1px; }
.app-lock-card p { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.app-lock-card button { min-height: 44px; padding: 0 20px; border: 0; border-radius: 9px; background: var(--accent); color: white; font-weight: 600; }

@media (max-width: 950px) {
  html, body { width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; }
  body { position: fixed; inset: 0; }
  .app-shell { position: fixed; top: 0; right: 0; left: 0; height: var(--app-screen-height, 100vh); display: block; }
  .sidebar { position: fixed; z-index: 5; top: calc(59px + env(safe-area-inset-top)); left: 0; display: none; width: min(300px, 86vw); height: calc(100dvh - 59px - env(safe-area-inset-top)); box-shadow: 15px 20px 35px rgb(28 41 31 / 15%); }
  .sidebar.is-open { display: flex; }
  .sidebar > .brand { display: none; }
  .main-panel { position: relative; height: var(--app-screen-height, 100vh); min-height: 0; overflow: hidden; }
  .mobile-top { position: relative; z-index: 3; display: flex; flex: 0 0 auto; min-width: 0; align-items: center; justify-content: space-between; gap: 8px; padding: calc(env(safe-area-inset-top) + 12px) 12px 11px; border-bottom: 1px solid #e9ebe4; background: rgb(248 247 243 / 95%); backdrop-filter: blur(12px); }
  .mobile-top > .brand { min-width: 0; flex: 1 1 auto; gap: 8px; overflow: hidden; font-size: 17px; white-space: nowrap; }
  .brand-mark { width: 26px; height: 26px; font-size: 19px; }
  .mobile-actions { display: flex; flex: 0 0 auto; gap: 4px; }
  .icon-button { width: 44px; height: 44px; flex: 0 0 44px; padding: 0; border: 1px solid #e4e7df; border-radius: 9px; background: #fffefa; color: #405949; font-size: 18px; }
  .icon-button svg { display: block; width: 16px; height: 16px; margin: auto; }
  .composer-wrap { position: fixed; right: auto; bottom: var(--keyboard-inset, 0px); left: 50%; width: min(calc(100vw - 28px), 560px); max-width: none; transform: translateX(-50%); padding-top: 11px; padding-bottom: calc(2px + env(safe-area-inset-bottom)); }
  .page-wrap { height: 0; min-height: 0; flex: 1 1 0; overflow: hidden; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .topic-form input { font-size: 16px; }
  .insights-panel { position: fixed; z-index: 6; top: calc(59px + env(safe-area-inset-top)); right: 0; display: none; width: 100vw; max-width: none; height: calc(100dvh - 59px - env(safe-area-inset-top)); padding: 22px 18px; border: 1px solid #e4e8df; border-right: 0; border-radius: 0; box-shadow: none; }
  .insights-panel.is-open { display: block; }
  .insights-close { display: block; }
  .settings-panel { top: calc(59px + env(safe-area-inset-top)); width: min(380px, 92vw); height: calc(100dvh - 59px - env(safe-area-inset-top)); padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); border-right: 0; border-radius: 16px 0 0 16px; }
  .page-wrap { width: min(100% - 38px, 560px); min-height: 0; padding: 34px 0 calc(12px + env(safe-area-inset-bottom)); }
  .welcome { margin-top: 23px; }
  h1 { font-size: clamp(39px, 10.4vw, 53px); letter-spacing: -1.8px; }
  .intro { margin: 14px 0 21px; font-size: 16px; line-height: 1.6; }
  .starter-card { padding: 14px 14px 13px; }
  .starter-hint { margin-top: 9px; font-size: 14px; }
  .thread { min-height: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; gap: 20px; padding: 25px 0 calc(250px + env(safe-area-inset-bottom)); }
  .turn, .turn.user { max-width: 94%; }
  .bubble { font-size: 16px; line-height: 1.6; }
  .bubble.user { padding: 11px 13px; }
  .composer { padding: 10px 11px 9px 13px; }
  .composer textarea { min-height: 44px; max-height: 120px; font-size: 16px; }
  .voice-button, .send-button { width: 40px; min-width: 40px; height: 40px; min-height: 40px; padding: 0; }
  .gentle-reminder { font-size: 14px; }
}

@media (min-width: 951px) and (max-width: 1120px) {
  :root { --sidebar-width: 220px; --insights-width: 290px; }
  .app-shell { grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--insights-width); }
  .sidebar { padding-right: 14px; padding-left: 14px; }
  .insights-panel { padding-right: 16px; padding-left: 16px; }
}

@media (max-width: 370px) {
  .response-mode-select { min-width: 96px; font-size: 12px; padding-right: 26px; background-position: right 8px center; }
}
