@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&family=PT+Serif:wght@700&display=swap');

:root {
  color-scheme: light;
  --deep: #0d2f32;
  --deep-2: #174449;
  --ink: #193236;
  --muted: #617477;
  --faint: #6b7c7e;
  --paper: #f5f7f4;
  --surface: #ffffff;
  --surface-soft: #edf2ef;
  --line: #dce5e1;
  --line-soft: #ebf0ed;
  --teal: #218f83;
  --teal-soft: #dff2ed;
  --problem: #c85056;
  --problem-soft: #f8e4e4;
  --capability: #426ac5;
  --capability-soft: #e5ebfa;
  --longevity: #a46f13;
  --longevity-soft: #faedcf;
  --amber: #b97817;
  --amber-soft: #fcedcf;
  --rose: #b94e55;
  --rose-soft: #f8e2e3;
  --shadow: 0 16px 48px rgba(18, 49, 50, .12);
  --font-caption: .875rem;
  --font-small: 1rem;
  --font-ui: 1.0625rem;
  --font-body: 1.1875rem;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body { overflow: hidden; background: var(--paper); color: var(--ink); font-family: "Manrope", Inter, system-ui, -apple-system, sans-serif; font-size: var(--font-ui); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: wait; opacity: .58; }
:focus-visible { outline: 3px solid rgba(66, 106, 197, .4); outline-offset: 2px; }
.hidden { display: none !important; }
.eyebrow { margin: 0 0 7px; color: var(--teal); font-size: var(--font-caption); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.icon-button { width: 48px; height: 48px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 11px; background: transparent; color: inherit; }
.icon-button svg { display: block; }
.primary-button, .secondary-button, .context-button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border-radius: 11px; font-size: var(--font-small); font-weight: 700; }
.primary-button { border: 1px solid var(--deep); background: var(--deep); color: white; }
.primary-button:hover { background: var(--deep-2); }
.secondary-button { border: 1px solid var(--line); background: white; color: #3f5558; }
.secondary-button:hover { border-color: #acc6c0; background: #fbfcfb; }
.text-button { min-height: 40px; padding: 0 6px; border: 0; background: transparent; color: var(--teal); font-size: var(--font-small); font-weight: 700; }
.avatar { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 11px; color: white; font-size: var(--font-caption); font-weight: 700; }
.avatar-anton { background: linear-gradient(135deg, #218f83, #1e6665); }
.avatar-vlad { background: linear-gradient(135deg, #5871aa, #384d7d); }

/* Login */
.login-page { min-height: 100vh; display: grid; place-items: center; position: relative; overflow-x: hidden; overflow-y: auto; padding: 32px; background: #e9f0ec; }
.login-page::before { content: ""; position: absolute; inset: 0; opacity: .35; background-image: linear-gradient(rgba(18,74,71,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(18,74,71,.07) 1px, transparent 1px); background-size: 40px 40px; mask-image: radial-gradient(circle at center, black, transparent 72%); }
.login-ambient { position: absolute; border-radius: 50%; opacity: .85; }
.ambient-one { width: 390px; height: 390px; left: -120px; top: -90px; background: #c9e9de; }
.ambient-two { width: 480px; height: 480px; right: -170px; bottom: -190px; background: #dfe5f4; }
.login-card { position: relative; width: min(460px, 100%); padding: 42px 44px 34px; border: 1px solid rgba(255,255,255,.9); border-radius: 26px; background: rgba(255,255,255,.9); box-shadow: 0 28px 90px rgba(17,52,51,.16); backdrop-filter: blur(18px); }
.login-card h1 { margin: 13px 0 14px; color: var(--deep); font: 700 48px/1 "PT Serif", Georgia, serif; letter-spacing: -.035em; }
.login-lead { margin: 0 0 30px; color: var(--muted); font-size: var(--font-ui); line-height: 1.65; }
.brand-mark { display: flex; gap: 4px; align-items: end; height: 24px; }
.brand-mark span { width: 4px; border-radius: 3px; background: var(--teal); }
.brand-mark span:nth-child(1) { height: 11px; } .brand-mark span:nth-child(2) { height: 22px; } .brand-mark span:nth-child(3) { height: 16px; }
.brand-mark.small { height: 20px; }
.brand-mark.small span { background: #7bd1bf; width: 3px; }
.brand-mark.small span:nth-child(1) { height: 9px; } .brand-mark.small span:nth-child(2) { height: 18px; } .brand-mark.small span:nth-child(3) { height: 13px; }
.field-label { display: block; margin: 18px 0 8px; color: #566a6d; font-size: var(--font-small); font-weight: 700; }
.identity-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.identity { min-height: 67px; display: flex; align-items: center; gap: 10px; padding: 9px; border: 1px solid var(--line); border-radius: 13px; background: white; color: var(--ink); text-align: left; }
.identity.active { border-color: #7ab6ad; box-shadow: 0 0 0 3px rgba(33,143,131,.1); }
.identity strong, .identity small { display: block; }
.identity strong { font-size: var(--font-ui); }
.identity small { margin-top: 3px; color: var(--faint); font-size: var(--font-caption); }
.password-wrap { position: relative; }
.password-wrap input, .form-dialog input, .form-dialog select, .form-dialog textarea { width: 100%; min-height: 48px; padding: 11px 14px; border: 1px solid #cdd8d4; border-radius: 11px; background: white; color: var(--ink); outline: none; }
.password-wrap input { padding-right: 52px; }
.password-wrap input:focus, .form-dialog input:focus, .form-dialog select:focus, .form-dialog textarea:focus { border-color: #66a99f; box-shadow: 0 0 0 3px rgba(33,143,131,.1); }
.reveal { position: absolute; top: 2px; right: 2px; color: var(--faint); }
.form-error { min-height: 20px; margin: 8px 0 0; color: var(--rose); font-size: var(--font-small); }
.login-button { width: 100%; margin-top: 12px; justify-content: space-between; }
.login-footnote { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 24px 0 0; color: var(--faint); font-size: var(--font-caption); }
.status-dot, .pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: #65baa8; box-shadow: 0 0 0 4px rgba(101,186,168,.1); }

/* Shell */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 256px minmax(0, 1fr); }
.sidebar { height: 100vh; position: sticky; top: 0; z-index: 30; display: flex; flex-direction: column; overflow: hidden; padding: 18px 14px 14px; border-right: 1px solid rgba(255,255,255,.05); background: var(--deep); color: #d8e7e4; }
.sidebar-scrim { display: none; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 18px; }
.mini-brand { display: flex; align-items: center; gap: 10px; padding: 0; border: 0; background: transparent; color: white; }
.mini-brand strong { font-size: 1.0625rem; }
.version { width: 20px; height: 20px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.14); border-radius: 6px; color: #87aaa5; font-size: .7rem; }
.sidebar-collapse { display: none; color: #81a09d; font-size: 22px; }
.patient-card { min-height: 56px; display: flex; align-items: center; gap: 9px; padding: 8px; border: 1px solid rgba(255,255,255,.07); border-radius: 10px; background: rgba(255,255,255,.04); }
.patient-card > div { min-width: 0; flex: 1; }
.patient-card small, .patient-card strong { display: block; }
.patient-card small { color: #83a09d; font-size: 10px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }
.patient-card strong { margin-top: 3px; overflow: hidden; color: white; font-size: 13px; white-space: nowrap; text-overflow: ellipsis; }
.chevron { color: #7f9f9b; }
.space-nav { display: grid; gap: 3px; margin-top: 14px; }
.utility-nav { display: grid; gap: 3px; margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.07); }
.nav-item { min-height: 38px; display: flex; align-items: center; gap: 9px; padding: 0 9px; border: 0; border-radius: 8px; background: transparent; color: #a9bfbc; text-align: left; font-size: 14px; }
.nav-item:hover { background: rgba(255,255,255,.045); color: white; }
.nav-item.active { background: rgba(111,194,177,.15); color: white; box-shadow: inset 3px 0 #68c2b1; }
.nav-icon { width: 22px; color: #7da49f; font-size: 18px; text-align: center; }
.nav-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; vertical-align: middle; }
.nav-item.active .nav-icon { color: #7dd0c0; }
.nav-item > span:nth-child(2) { flex: 1; }
.nav-count { color: #779692; font-size: var(--font-caption); }
.sidebar-section-head { display: flex; align-items: center; justify-content: space-between; margin: 22px 10px 8px; color: #8eaaa6; font-size: var(--font-caption); font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.sidebar-projects { min-height: 0; flex: 1; overflow-y: auto; display: grid; align-content: start; gap: 2px; }
.sidebar-project { min-height: 42px; display: grid; grid-template-columns: 9px minmax(0,1fr); gap: 10px; align-items: center; padding: 7px 10px; border: 0; border-radius: 9px; background: transparent; color: #aac1bd; text-align: left; }
.sidebar-project:hover { background: rgba(255,255,255,.055); color: white; }
.sidebar-project-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); }
.sidebar-project-dot.resolve-problem { background: #df7a7d; }
.sidebar-project-dot.gain-capability { background: #86a1e6; }
.sidebar-project-dot.preserve-health { background: #e1b35a; }
.sidebar-project strong, .sidebar-project small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sidebar-project strong { font-size: var(--font-small); font-weight: 600; }
.sidebar-project small { margin-top: 3px; color: #839f9b; font-size: var(--font-caption); }
.sidebar-empty { margin: 10px; color: #829d99; font-size: var(--font-small); }
.sidebar-footer { margin-top: auto; padding-top: 11px; border-top: 1px solid rgba(255,255,255,.07); }
.api-budget { margin-bottom: 7px; padding: 8px 10px; border: 1px solid rgba(255,255,255,.08); border-radius: 9px; background: rgba(255,255,255,.035); }
.api-budget-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #9bb5b1; font-size: .8125rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.api-budget-values { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 5px; }
.api-budget-values > div + div { padding-left: 8px; border-left: 1px solid rgba(255,255,255,.08); }
.api-budget-values small, .api-budget-values strong { display: block; }
.api-budget-values small { color: #8aa7a2; font-size: .8125rem; }
.api-budget-values strong { margin-top: 2px; color: #e8f2f0; font-size: 1rem; }
.api-budget-values[hidden] { display: none; }
.sidebar .api-budget { display: flex; align-items: center; gap: 8px; }
.sidebar .api-budget .api-budget-values { flex: 1; min-width: 0; margin-top: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sidebar .api-budget .api-budget-values > div { flex-direction: column; align-items: flex-start; justify-content: flex-start; }
.sidebar .api-budget-retry { margin-left: auto; }
.api-budget-note { display: block; margin-top: 4px; color: var(--sidebar-muted, #afc5c1); font-size: .75rem; line-height: 1.45; overflow-wrap: anywhere; }
.api-budget-link { display: inline-block; margin-top: 5px; color: var(--sidebar-text, #d7e8e4); font-size: .75rem; text-decoration: underline; text-underline-offset: 3px; }
.api-budget-link:hover { color: #fff; }
.api-budget-retry { display: grid; place-items: center; flex: 0 0 28px; width: 28px; height: 28px; border: 0; border-radius: 5px; background: transparent; color: inherit; font-size: 19px; cursor: pointer; }
.api-budget-retry:hover:not(:disabled) { background: rgba(255,255,255,.08); color: #fff; }
.api-budget-retry:disabled { opacity: .4; cursor: wait; }
.api-budget-retry:focus-visible, .api-budget-link:focus-visible { outline: 2px solid #b8d4ce; outline-offset: 2px; }
@media (max-width: 900px) { .api-budget-retry { flex-basis: 44px; width: 44px; height: 44px; } .api-budget-link { min-height: 32px; padding-block: 7px; } }
.model-state { display: flex; gap: 9px; align-items: center; padding: 9px 10px 12px; }
.model-state strong, .model-state small { display: block; }
.model-state strong { color: #cfe0dd; font-size: var(--font-caption); }
.model-state small { margin-top: 2px; color: #8eaaa6; font-size: var(--font-caption); }
.user-row { width: 100%; display: flex; align-items: center; gap: 9px; padding: 8px 9px; border: 0; border-radius: 10px; background: rgba(255,255,255,.04); color: white; text-align: left; }
.user-row > span:nth-child(2) { flex: 1; }
.user-row strong, .user-row small { display: block; }
.user-row strong { font-size: var(--font-small); }.user-row small { margin-top: 2px; color: #99b3af; font-size: var(--font-caption); }
.logout-button { width: 100%; min-height: 42px; margin-top: 6px; border: 1px solid rgba(255,255,255,.08); border-radius: 8px; background: transparent; color: #a8bfbb; }

.workspace { min-width: 0; height: 100vh; height: var(--app-height, 100dvh); display: flex; flex-direction: column; background: var(--paper); }
.topbar { height: 64px; flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 28px; border-bottom: 1px solid var(--line); background: rgba(247,248,245,.94); backdrop-filter: blur(12px); }
.breadcrumbs { min-width: 0; display: flex; align-items: center; gap: 8px; overflow: hidden; color: var(--faint); font-size: var(--font-small); }
.breadcrumb-item { min-width: 0; display: inline-flex; align-items: center; gap: 8px; }
.breadcrumbs button { max-width: 220px; overflow: hidden; padding: 5px 0; border: 0; background: transparent; color: var(--faint); text-overflow: ellipsis; white-space: nowrap; }
.breadcrumb-current strong { overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; }
.breadcrumbs button:hover { color: var(--teal); }
.breadcrumbs strong { min-width: 0; overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; }
.top-actions, .page-actions { display: flex; gap: 8px; align-items: center; }
.context-button { position: relative; border: 1px solid var(--deep); background: var(--deep); color: white; }
.context-button b { min-width: 22px; height: 22px; display: grid; place-items: center; padding: 0 6px; border-radius: 12px; background: rgba(255,255,255,.12); font-size: var(--font-caption); }
.context-spark { color: #72c6b5; }
.view { min-height: 0; flex: 1; }
.scroll-area { overflow-y: auto; padding: 36px 38px 60px; }
.page-intro { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-intro h1, .empty-area h1, .legacy-chat-head h1 { margin: 0 0 9px; color: var(--deep); font: 700 36px/1.15 "PT Serif", Georgia, serif; letter-spacing: -.025em; }
.page-intro > div > p:last-child, .project-title-block > p, .legacy-chat-head > p:last-child { max-width: 780px; margin: 0; color: var(--muted); font-size: var(--font-ui); line-height: 1.65; }
.board-summary { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-bottom: 20px; color: var(--muted); font-size: var(--font-small); }
.board-summary span { display: inline-flex; align-items: center; gap: 5px; }
.board-summary strong { color: var(--ink); }

/* Health board */
#healthView { min-height: 0; display: flex; flex-direction: column; overflow: hidden; padding: 24px 28px 28px; }
.health-page-head { min-height: 46px; display: flex; align-items: center; margin-bottom: 14px; }
.health-page-head h1 { margin: 0; color: var(--deep); font: 700 32px/1.15 "PT Serif", Georgia, serif; letter-spacing: -.025em; }
.health-board { min-height: 0; flex: 1; display: grid; grid-template-columns: repeat(3, minmax(270px, 1fr)); gap: 14px; align-items: start; }
.direction-lane { min-height: 0; max-height: 100%; display: flex; flex-direction: column; overflow: hidden; border: 0; border-radius: 13px; background: #e9eeeb; }
.lane-1 { --lane: var(--problem); --lane-soft: var(--problem-soft); }
.lane-2 { --lane: var(--capability); --lane-soft: var(--capability-soft); }
.lane-3 { --lane: var(--longevity); --lane-soft: var(--longevity-soft); }
.direction-head { min-height: 58px; display: grid; grid-template-columns: 10px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 11px 14px 9px; }
.direction-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--lane); }
.direction-head h2 { margin: 0; color: var(--ink); font-size: 1.125rem; line-height: 1.3; }
.direction-count { color: var(--faint); font-size: var(--font-caption); font-weight: 600; }
.project-list { min-height: 0; display: grid; align-content: start; gap: 8px; overflow-y: auto; overscroll-behavior: contain; padding: 0 8px 8px; scrollbar-gutter: stable; }
.project-card { width: 100%; min-height: 52px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 9px; padding: 13px 14px; border: 0; border-radius: 10px; background: white; color: inherit; text-align: left; box-shadow: 0 1px 2px rgba(30,57,57,.12); transition: transform .14s ease, box-shadow .14s ease; }
.project-card:hover { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(30,57,57,.12); }
.urgency { display: inline-flex; align-items: center; min-height: 23px; padding: 2px 7px; border-radius: 6px; font-size: .78rem; font-weight: 700; }
.urgency.hot { background: var(--rose-soft); color: var(--rose); }
.urgency.soon { background: var(--amber-soft); color: #956019; }
.urgency.planned { background: var(--surface-soft); color: #61706f; }
.project-card-title { display: block; margin: 0; color: var(--ink); font-size: 1.125rem; line-height: 1.4; }
.add-project-card { min-height: 48px; display: flex; align-items: center; justify-content: flex-start; gap: 7px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: var(--font-small); font-weight: 600; }
.add-project-card > svg { display: block; flex: 0 0 18px; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.add-project-card:hover { color: var(--ink); background: rgba(255,255,255,.7); }

/* Project and task workspace */
.project-page { height: calc(100vh - 64px); min-height: 0; display: grid; grid-template-columns: clamp(260px, var(--project-nav-width, clamp(270px, 21vw, 330px)), min(680px, 58vw)) 8px minmax(0,1fr); overflow: hidden; background: var(--paper); }
.project-scope-nav { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; border-right: 1px solid var(--line); background: #eef2f0; }
.project-nav-head { min-height: 86px; flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 10px 14px 16px; border-bottom: 1px solid var(--line); background: #f7f9f7; }
.project-nav-heading { min-width: 0; }
.project-nav-controls { flex: 0 0 auto; display: flex; align-items: center; gap: 2px; }
.project-direction { display: block; margin-bottom: 4px; color: var(--faint); font-size: var(--font-caption); font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.project-direction.resolve-problem { color: var(--problem); }
.project-direction.gain-capability { color: var(--capability); }
.project-direction.preserve-health { color: var(--longevity); }
.project-nav-head h1 { margin: 0; overflow: hidden; color: var(--deep); font: 700 21px/1.28 "PT Serif", Georgia, serif; text-overflow: ellipsis; white-space: nowrap; }
.project-scope-resizer { position: relative; z-index: 7; width: 8px; min-width: 8px; cursor: col-resize; touch-action: none; background: transparent; }
.project-scope-resizer::before { width: 1px; position: absolute; inset: 0 auto 0 3px; content: ""; background: #d7e0dd; transition: width .14s ease, background-color .14s ease, box-shadow .14s ease; }
.project-scope-resizer:hover::before,
.project-scope-resizer:focus-visible::before,
body.project-scope-resizing .project-scope-resizer::before { width: 3px; left: 2px; background: var(--teal); box-shadow: 0 0 0 2px rgba(16,139,127,.12); }
.project-scope-resizer:focus-visible { outline: 3px solid rgba(66,106,197,.42); outline-offset: -3px; }
body.project-scope-resizing { cursor: col-resize; user-select: none; }
body.project-scope-resizing * { cursor: col-resize !important; }
.scope-nav-list { min-height: 0; flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 10px; scrollbar-gutter: stable; }
.scope-nav-item { width: 100%; min-height: 58px; display: grid; grid-template-columns: 34px minmax(0,1fr); gap: 10px; align-items: center; padding: 7px 10px; border: 1px solid transparent; border-radius: 11px; background: transparent; color: var(--ink); text-align: left; }
.scope-nav-item:hover { background: rgba(255,255,255,.7); }
.scope-nav-item.active { border-color: #cbd9d5; background: white; box-shadow: 0 1px 3px rgba(26,55,55,.08); }
.scope-nav-item.done { color: var(--muted); }
.scope-nav-mark { width: 28px; height: 28px; display: grid; place-items: center; border: 2px solid #a8b7b4; border-radius: 9px; color: #53827b; font-size: var(--font-caption); font-weight: 700; }
.scope-nav-mark.main { border: 0; background: var(--deep); color: white; }
.scope-nav-item.active .scope-nav-mark:not(.main) { border-color: var(--teal); background: var(--teal-soft); }
.scope-nav-copy { min-width: 0; }
.scope-nav-copy strong, .scope-nav-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scope-nav-copy strong { font-size: var(--font-small); line-height: 1.35; }
.scope-nav-copy small { margin-top: 3px; color: var(--faint); font-size: var(--font-caption); }
.scope-section-head { min-height: 48px; display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 0 10px; color: var(--faint); font-size: var(--font-caption); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.scope-section-head b { color: var(--muted); font: inherit; }
.scope-task-list { display: grid; gap: 7px; }
.task-nav-row { position: relative; min-width: 0; border-radius: 11px; }
.task-nav-row .scope-nav-item { min-height: 62px; grid-template-columns: 26px minmax(0,1fr); gap: 10px; align-items: center; padding: 8px 50px 8px 10px; border-color: rgba(204,217,212,.72); border-radius: 11px; background: rgba(255,255,255,.72); box-shadow: 0 1px 2px rgba(25,50,54,.06); transition: border-color .14s ease, background-color .14s ease, box-shadow .14s ease; }
.task-nav-row .scope-nav-item:hover { border-color: #c6d6d1; background: #fff; box-shadow: 0 3px 10px rgba(25,50,54,.07); }
.task-nav-row .scope-nav-item.active { border-color: #91bdb5; background: #fff; box-shadow: inset 3px 0 var(--teal), 0 2px 8px rgba(25,50,54,.08); }
.task-nav-row .scope-nav-mark { width: 25px; height: 25px; border-width: 1.5px; border-color: #aebebb; border-radius: 7px; background: transparent; }
.task-nav-row .scope-nav-item:hover .scope-nav-mark { border-color: #7fa69f; }
.task-nav-row .scope-nav-item.done .scope-nav-mark { border-color: #8bb7ae; background: var(--teal-soft); color: #24746b; }
.task-nav-row .scope-nav-copy strong { display: -webkit-box; overflow: hidden; font-size: .975rem; line-height: 1.32; white-space: normal; text-overflow: clip; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.task-nav-row .scope-nav-copy small { margin-top: 2px; color: #7a8c8e; font-size: .79rem; line-height: 1.3; }
.task-card-menu { width: 44px; height: 44px; position: absolute; z-index: 6; top: 50%; right: 3px; transform: translateY(-50%); }
.task-card-menu > summary { width: 44px; height: 44px; display: grid; place-items: center; position: relative; cursor: pointer; border-radius: 10px; background: transparent; color: var(--muted); font-size: 17px; font-weight: 700; line-height: 1; letter-spacing: 1px; list-style: none; opacity: .58; pointer-events: auto; transition: color .14s ease, opacity .14s ease; }
.task-card-menu > summary::-webkit-details-marker { display: none; }
.task-nav-row:hover .task-card-menu > summary,
.task-nav-row:focus-within .task-card-menu > summary,
.task-card-menu[open] > summary { opacity: 1; pointer-events: auto; }
.task-card-menu > summary:hover,
.task-card-menu[open] > summary { background: linear-gradient(#e5ece9 0 0) center/34px 34px no-repeat; color: var(--deep); outline: none; }
.task-card-menu > summary:focus-visible { background: linear-gradient(#e5ece9 0 0) center/34px 34px no-repeat; color: var(--deep); outline: 3px solid rgba(66,106,197,.48); outline-offset: -3px; }
.task-card-menu-panel { width: 190px; position: absolute; z-index: 10; top: calc(100% + 2px); right: 3px; overflow: hidden; padding: 6px; border: 1px solid #d8e2de; border-radius: 12px; background: white; box-shadow: 0 14px 36px rgba(18,49,50,.16), 0 2px 8px rgba(18,49,50,.08); }
.task-card-menu-panel button { width: 100%; min-height: 40px; padding: 0 11px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font-size: .9rem; font-weight: 600; text-align: left; }
.task-card-menu-panel button:hover { background: var(--surface-soft); }
.task-card-menu-panel button:focus-visible { background: var(--surface-soft); outline: 3px solid rgba(66,106,197,.62); outline-offset: -2px; }
.task-card-menu-panel button.danger { color: #ad444b; }
.task-card-menu-panel button.danger:hover,
.task-card-menu-panel button.danger:focus-visible { background: #fbeded; }
.project-action-menu { position: relative; z-index: 9; }
.project-action-menu > summary { width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer; border-radius: 10px; color: var(--muted); font-size: 17px; font-weight: 700; letter-spacing: 1px; list-style: none; }
.project-action-menu > summary::-webkit-details-marker { display: none; }
.project-action-menu > summary:hover,
.project-action-menu[open] > summary { background: #e5ece9; color: var(--deep); }
.project-action-menu > summary:focus-visible { outline: 3px solid rgba(66,106,197,.48); outline-offset: -3px; }
.project-action-menu .task-card-menu-panel { top: calc(100% + 3px); right: 0; }
.entity-context-menu { width: 224px; max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); overflow-y: auto; overscroll-behavior: contain; position: fixed; z-index: 120; display: grid; gap: 2px; padding: 6px; border: 1px solid #d5e0dc; border-radius: 12px; background: white; box-shadow: 0 18px 48px rgba(11,42,43,.22), 0 3px 10px rgba(11,42,43,.1); }
.entity-context-menu[hidden] { display: none; }
.entity-menu-field { display: grid; gap: 6px; padding: 8px 12px; color: var(--muted); font-size: .8rem; }
.entity-menu-field select { width: 100%; min-height: 38px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: white; color: var(--ink); font: inherit; }
.entity-menu-order { display: grid; grid-template-columns: 1fr 1fr; }
.entity-context-menu button:disabled { opacity: .4; cursor: default; }
@media (pointer: coarse) {
  :where([data-project-context], [data-task-context], [data-treatment-context], [data-chat-context], [data-document-context]) { -webkit-touch-callout: none; user-select: none; }
  :where([data-project-context], [data-task-context], [data-treatment-context], [data-chat-context], [data-document-context]) :is(input, textarea, [contenteditable]) { -webkit-touch-callout: default; user-select: text; }
}
.entity-context-menu button { min-height: 42px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font-size: .9rem; font-weight: 650; text-align: left; }
.entity-context-menu button:hover,
.entity-context-menu button:focus-visible { background: var(--surface-soft); outline: none; }
.entity-context-menu button.danger { color: #ad444b; }
.entity-context-menu button.danger:hover,
.entity-context-menu button.danger:focus-visible { background: #fbeded; }
.add-task-card { width: 100%; min-height: 48px; display: flex; align-items: center; gap: 9px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); text-align: left; }
.add-task-card:hover { background: rgba(255,255,255,.7); color: var(--ink); }
.add-task-card span { color: var(--teal); font-size: 20px; }
.add-task-card strong { font-size: var(--font-small); }
.no-tasks { min-height: 48px; display: flex; align-items: center; margin: 0; padding: 0 10px; color: var(--muted); font-size: var(--font-small); }
.completed-scope-tasks { margin-top: 6px; }
.completed-scope-tasks > summary { min-height: 48px; display: flex; align-items: center; padding: 0 10px; cursor: pointer; border-radius: 10px; color: var(--muted); font-size: var(--font-caption); font-weight: 700; list-style: none; }
.completed-scope-tasks > summary::-webkit-details-marker { display: none; }
.completed-scope-tasks > summary:hover { background: rgba(255,255,255,.65); color: var(--ink); }
.completed-scope-tasks > div { display: grid; gap: 4px; padding-top: 4px; }
.project-scope-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--paper); }
.scope-chat-head { min-height: 86px; position: relative; z-index: 4; flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); }
.scope-heading-copy { min-width: 0; }
.scope-heading-copy > span { display: block; margin-bottom: 3px; color: var(--teal); font-size: var(--font-caption); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.scope-heading-copy h1 { margin: 0; overflow: hidden; color: var(--deep); font-size: 1.45rem; line-height: 1.28; text-overflow: ellipsis; white-space: nowrap; }
.scope-heading-copy p { max-width: 760px; margin: 4px 0 0; overflow: hidden; color: var(--muted); font-size: var(--font-small); line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.scope-head-actions { flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.project-summary-menu { position: relative; }
.project-summary-menu > summary { min-height: 48px; list-style: none; cursor: pointer; }
.project-summary-menu > summary::-webkit-details-marker { display: none; }
.project-summary-menu[open] > summary { border-color: #8db8af; color: var(--teal); }
.project-summary-panel { width: min(430px, calc(100vw - 32px)); max-height: min(640px, calc(100vh - 150px)); position: absolute; z-index: 8; top: calc(100% + 8px); right: 0; overflow-y: auto; padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: white; box-shadow: var(--shadow); }
.project-summary-panel h2 { margin: 0 0 7px; color: var(--deep); font-size: 1.125rem; }
.project-summary-panel > section { padding: 13px 0; border-bottom: 1px solid var(--line-soft); }
.project-summary-panel h3 { margin: 0 0 5px; color: var(--ink); font-size: var(--font-small); }
.project-summary-panel p { margin: 0; color: var(--muted); font-size: var(--font-small); line-height: 1.55; }
.summary-sources { padding-top: 13px; }
.summary-sources > summary { min-height: 48px; display: flex; align-items: center; cursor: pointer; color: var(--teal); font-size: var(--font-small); font-weight: 700; }
.summary-empty { padding-top: 8px; }
.task-info-menu .project-summary-panel { right: 0; }
.task-finish-button { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 14px; border: 1px solid var(--line); border-radius: 11px; background: white; color: var(--muted); font-size: var(--font-small); font-weight: 700; }
.task-finish-button:hover { border-color: #9ebdb7; color: var(--ink); }
.empty-check { width: 18px; height: 18px; border: 2px solid #97aaa6; border-radius: 50%; }
.task-finish-button:hover .empty-check { border-color: var(--teal); background: var(--teal-soft); }
.task-finished-group { display: flex; align-items: center; gap: 6px; }
.task-completed-badge { min-height: 48px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 10px; background: var(--teal-soft); color: #24746b; font-size: var(--font-small); font-weight: 700; }
.project-chat-shell { min-width: 0; min-height: 0; flex: 1; display: flex; flex-direction: column; background: var(--paper); }
.scope-loading { flex: 1; }
.scoped-messages { min-height: 0; flex: 1; overflow-y: auto; padding: 24px max(28px, calc((100% - 860px)/2)); }
.message { display: grid; grid-template-columns: 38px minmax(0,1fr); gap: 13px; margin-bottom: 26px; }
.message.user { margin-left: 8%; }
.message-avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--deep); color: white; font-size: var(--font-caption); font-weight: 700; }
.message.user .message-avatar { background: #6f8e91; }
.message.user .message-body { padding: 15px 17px; border-radius: 14px 14px 3px 14px; background: #e5efec; }
.message-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-bottom: 8px; color: var(--faint); font-size: var(--font-caption); }
.message-meta strong { color: var(--ink); font-size: var(--font-small); }
.message-body { color: #26383a; font-size: 17px; line-height: 1.65; }
.message-body p { margin: 0 0 12px; }.message-body p:last-child { margin-bottom: 0; }
.message-body h2, .message-body h3 { margin: 21px 0 9px; color: var(--deep); font-size: 1.125rem; }
.message-body ul, .message-body ol { margin: 8px 0 14px; padding-left: 23px; }
.message-body code { padding: 2px 4px; border-radius: 4px; background: var(--surface-soft); }
.source-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.source-chip { min-height: 44px; display: inline-flex; align-items: center; gap: 5px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: white; color: var(--muted); font-size: var(--font-caption); text-decoration: none; }
.source-chip:hover { border-color: #a7c9c1; color: var(--teal); }
.chat-empty { min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); text-align: center; }
.chat-empty > span { width: 42px; height: 42px; display: grid; place-items: center; margin-bottom: 10px; border-radius: 13px; background: var(--teal-soft); color: var(--teal); }
.chat-empty p { margin: 5px 0 0; font-size: var(--font-small); }
.scoped-composer-wrap { flex: 0 0 auto; padding: 10px max(28px, calc((100% - 860px)/2)) 16px; border-top: 1px solid var(--line-soft); background: linear-gradient(rgba(245,247,244,.4), var(--paper) 35%); }
.scoped-composer { min-height: 66px; display: grid; grid-template-columns: 48px minmax(0,1fr) 48px 48px; align-items: end; gap: 9px; padding: 8px; border: 1px solid #cdd8d4; border-radius: 16px; background: white; box-shadow: 0 10px 30px rgba(26,55,55,.09); }
.composer-main { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.scoped-composer textarea { min-height: 42px; max-height: 170px; resize: none; padding: 9px 4px; border: 0; outline: 0; color: var(--ink); font-size: var(--font-body); line-height: 1.5; }
.composer-main textarea { width: 100%; }
.scoped-composer textarea::placeholder { color: #98a7a7; }
.chat-model-picker { max-width: 100%; min-height: 36px; display: inline-flex; align-items: center; gap: 3px; margin: -2px 0 1px; padding: 0 4px 0 8px; border-radius: 10px; background: #f0f5f3; color: #47706b; }
.chat-model-picker > span { flex: 0 0 auto; color: var(--teal); font-size: .75rem; }
.chat-model-picker select { min-width: 0; max-width: 100%; height: 36px; padding: 0 3px; border: 0; outline: 0; background: transparent; color: #315754; font-family: inherit; font-size: .8125rem; font-weight: 700; line-height: 1.2; cursor: pointer; }
.chat-model-picker select:focus-visible { border-radius: 6px; box-shadow: 0 0 0 2px rgba(22,143,130,.28); }
.chat-model-picker:has(select:disabled) { opacity: .5; }
.attach-button, .voice-button, .send-button { width: 48px; height: 48px; border-radius: 11px; }
.attach-button { border: 1px solid var(--line); background: white; color: var(--muted); font-size: 20px; }.send-button { border: 0; background: var(--deep); color: white; font-size: 18px; }
.voice-button { position: relative; display: grid; place-items: center; border: 1px solid var(--line); background: white; color: var(--muted); transition: border-color .15s ease, background-color .15s ease, color .15s ease, transform .15s ease; }
.voice-button:hover { border-color: #9fc4bc; background: var(--teal-soft); color: var(--teal); }
.voice-button svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.voice-button.recording { border-color: #d9636c; background: #fbeaec; color: #b13f49; }
.voice-button.recording::before { width: 8px; height: 8px; position: absolute; top: 7px; right: 7px; content: ""; border-radius: 50%; background: #c84652; box-shadow: 0 0 0 0 rgba(200,70,82,.35); animation: voice-recording-pulse 1.35s infinite; }
.voice-button.recording::after, .voice-button.transcribing::after, .voice-button[aria-busy="true"]:not(.transcribing)::after { position: absolute; right: 0; bottom: calc(100% + 9px); padding: 5px 8px; border-radius: 7px; background: var(--deep); color: white; font-size: .72rem; font-weight: 700; line-height: 1; white-space: nowrap; box-shadow: 0 5px 16px rgba(16,45,47,.16); }
.voice-button.recording::after { content: "Запись"; }
.voice-button.transcribing { border-color: #9fc4bc; background: var(--teal-soft); color: var(--teal); opacity: 1; }
.voice-button.transcribing::after { content: "Распознаю…"; }
.voice-button[aria-busy="true"]:not(.transcribing) { opacity: 1; }
.voice-button[aria-busy="true"]:not(.transcribing)::after { content: "Микрофон…"; }
.voice-button.transcribing svg { animation: voice-processing 1s ease-in-out infinite alternate; }
.voice-button.unsupported { cursor: not-allowed; opacity: .42; }
@keyframes voice-recording-pulse { 70% { box-shadow: 0 0 0 7px rgba(200,70,82,0); } 100% { box-shadow: 0 0 0 0 rgba(200,70,82,0); } }
@keyframes voice-processing { to { transform: scale(.82); opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .voice-button.recording::before, .voice-button.transcribing svg { animation: none; } }
.composer-meta { display: flex; justify-content: space-between; gap: 12px; padding: 7px 4px 0; color: var(--faint); font-size: var(--font-caption); }
kbd { padding: 1px 4px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: white; font-size: var(--font-caption); }
.scoped-composer-wrap.suspended { visibility: hidden; pointer-events: none; }
.typing { display: flex; gap: 5px; padding: 8px 0; }.typing span { width: 6px; height: 6px; border-radius: 50%; background: #8ba5a1; animation: bounce 1.2s infinite; }.typing span:nth-child(2) { animation-delay: .15s; }.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%,60%,100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }
.memory-fact { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }.memory-fact:last-child { border: 0; }
.memory-fact strong, .memory-fact span { display: block; }.memory-fact strong { font-size: var(--font-small); }.memory-fact span { margin-top: 4px; color: var(--muted); font-size: var(--font-caption); line-height: 1.5; }
.memory-document { display: grid; grid-template-columns: 24px minmax(0,1fr); gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); color: inherit; text-decoration: none; }
.memory-document:hover strong { color: var(--teal); }.memory-document strong, .memory-document small { display: block; }.memory-document strong { overflow: hidden; font-size: var(--font-small); line-height: 1.4; }.memory-document small { margin-top: 3px; color: var(--faint); font-size: var(--font-caption); }

/* Context */
.panel-scrim { position: fixed; inset: 0; z-index: 69; background: rgba(8,31,33,.2); }
.context-panel { width: min(460px, 100vw); height: 100dvh; position: fixed; z-index: 70; top: 0; right: 0; overflow-y: auto; visibility: hidden; pointer-events: none; border-left: 1px solid var(--line); background: white; box-shadow: -18px 0 52px rgba(17,45,47,.18); transform: translateX(102%); transition: transform .2s ease, visibility 0s linear .2s; }
.context-panel.open { visibility: visible; pointer-events: auto; transform: translateX(0); transition-delay: 0s; }
.context-head { min-height: 88px; display: flex; align-items: center; justify-content: space-between; padding: 19px 22px; border-bottom: 1px solid var(--line-soft); }
.context-head h2 { margin: 0; color: var(--deep); font: 700 24px/1.25 "PT Serif", Georgia, serif; }
.context-content { padding: 22px; }
.empty-context { min-height: 68vh; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); text-align: center; }.empty-context > span { width: 46px; height: 46px; display: grid; place-items: center; margin-bottom: 13px; border-radius: 14px; background: var(--teal-soft); color: var(--teal); }.empty-context strong { color: var(--ink); }.empty-context p { max-width: 280px; font-size: var(--font-small); line-height: 1.6; }
.context-scope { margin-bottom: 13px; padding: 13px; border: 1px solid #cfe3de; border-radius: 11px; background: var(--teal-soft); }.context-scope small, .context-scope strong, .context-scope span { display: block; }.context-scope small { color: #4d7b74; font-size: var(--font-caption); text-transform: uppercase; }.context-scope strong { margin: 4px 0; font-size: var(--font-ui); }.context-scope span { color: var(--muted); font-size: var(--font-caption); }
.context-summary { display: flex; gap: 7px; margin-bottom: 18px; }.context-stat { flex: 1; padding: 10px; border-radius: 10px; background: var(--surface-soft); }.context-stat strong, .context-stat small { display: block; }.context-stat strong { color: var(--deep); font-size: 1.125rem; }.context-stat small { margin-top: 3px; color: var(--muted); font-size: var(--font-caption); }
.context-section { margin-top: 20px; }.context-section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; color: var(--faint); font-size: var(--font-caption); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.domain-pills { display: flex; flex-wrap: wrap; gap: 5px; }.domain-pill { padding: 6px 9px; border-radius: 7px; background: var(--teal-soft); color: #2d726b; font-size: var(--font-caption); font-weight: 700; }
.context-fact, .context-source { padding: 13px 0; border-bottom: 1px solid var(--line-soft); }.context-fact strong, .context-source strong { display: block; font-size: var(--font-ui); line-height: 1.45; }.context-fact p, .context-source p { margin: 5px 0 0; color: var(--muted); font-size: var(--font-small); line-height: 1.55; }.context-source { display: grid; grid-template-columns: 26px 1fr; gap: 9px; }.source-index { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; background: var(--deep); color: white; font-size: var(--font-caption); }.context-source a { color: inherit; text-decoration: none; }.context-source a:hover strong { color: var(--teal); }.quality { display: inline-flex; margin-top: 6px; color: #568079; font-size: var(--font-caption); }

/* Evidence attached to an individual answer. Long imported labels must wrap. */
.message-context-button { min-height: 38px; display: inline-flex; align-items: center; margin-top: 9px; padding: 7px 0; border: 0; background: transparent; color: var(--teal); font: inherit; font-size: var(--font-caption); font-weight: 700; text-align: left; }
.message-context-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.message-context-button:focus-visible, .context-content a:focus-visible, .context-content summary:focus-visible { outline: 2px solid var(--teal); outline-offset: 4px; border-radius: 4px; }
.message-linked { outline: 2px solid #65a99b; outline-offset: 7px; border-radius: 8px; background: #f2f9f5; scroll-margin-block: 70px; }
.source-unavailable { border-style: dashed; cursor: default; }
.context-panel { overscroll-behavior: contain; overflow-x: hidden; }
.context-head { position: sticky; z-index: 1; top: 0; gap: 12px; background: white; }
.context-head > div { min-width: 0; }
.context-head .icon-button { flex-shrink: 0; }
.context-content { min-width: 0; overflow-wrap: anywhere; }
.context-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.context-stat { min-width: 0; }
.context-section-title { gap: 12px; line-height: 1.5; }
.context-source { grid-template-columns: 26px minmax(0, 1fr); }
.context-date { display: block; margin-top: 5px; color: var(--faint); font-size: var(--font-caption); line-height: 1.5; }
.context-detail, .context-empty-section, .context-unavailable, .context-limit { margin: 8px 0; color: var(--muted); font-size: var(--font-small); line-height: 1.55; }
.context-empty-section { padding: 10px 0; }
.context-source .context-unavailable, .context-unavailable { color: #8a6547; }
.context-notice { margin: 16px 0; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-soft); font-size: var(--font-small); line-height: 1.6; }
.context-notice strong { color: var(--ink); }
.context-notice p { margin: 7px 0 0; }
.context-notice-warning { border-color: #ecdab9; background: #fffaf0; }
.context-notice a, .context-route-link { display: inline-block; padding-block: 7px; color: var(--teal); font-size: var(--font-small); font-weight: 650; text-decoration: none; }
.context-notice a:hover, .context-route-link:hover { text-decoration: underline; }
.context-laboratory { min-width: 0; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.context-laboratory > strong { display: block; color: var(--ink); font-size: var(--font-ui); }
.context-laboratory > strong a { padding: 0; color: inherit; font-size: inherit; }
.context-measurements summary { min-height: 42px; display: list-item; align-content: center; color: var(--teal); font-size: var(--font-small); cursor: pointer; }
.context-measurements table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: var(--font-small); }
.context-measurements th, .context-measurements td { padding: 9px 6px; border-bottom: 1px solid var(--line-soft); vertical-align: top; text-align: left; overflow-wrap: anywhere; }
.context-measurements th { color: var(--faint); font-size: var(--font-caption); font-weight: 600; }
.context-measurements th:first-child { width: 43%; }
.context-measurements td strong { font-weight: 650; }
.context-measurements td strong span { color: var(--muted); font-weight: 400; }
.context-point-sources { display: block; margin-top: 5px; font-size: var(--font-caption); }
.context-point-sources a { display: inline-block; padding-block: 4px; color: var(--teal); }
.context-limit { color: #8a6547; }
.context-memory { margin-top: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: #fcfdfc; }
.context-memory > strong { display: block; margin-top: 7px; color: var(--ink); font-size: var(--font-ui); line-height: 1.5; }
.context-evidence { display: block; color: #3d7770; font-size: var(--font-caption); font-weight: 700; line-height: 1.5; }
.context-memory-ai { border-color: #e4d9be; background: #fffdf7; }
.context-memory-ai .context-evidence { color: #8a6547; }
.context-memory-unknown .context-evidence { color: var(--muted); }
.context-memory blockquote { margin: 10px 0; padding-left: 12px; border-left: 2px solid #cbded7; color: #425655; font-size: var(--font-small); line-height: 1.6; white-space: pre-line; }
@media (max-width: 900px) {
  .message-context-button { min-height: 44px; font-size: .75rem; }
  .context-route-link, .context-notice a { min-height: 44px; align-content: center; }
}

/* Base, history, empty area */
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; }
.service-notice { display: grid; grid-template-columns: 40px minmax(0,1fr) auto; gap: 12px; align-items: center; margin-bottom: 16px; padding: 15px; border: 1px solid #ead8b9; border-radius: 13px; background: #fff9ed; }.service-notice > span:first-child { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--amber-soft); color: var(--amber); }.service-notice strong { font-size: var(--font-ui); }.service-notice p { margin: 4px 0 0; color: var(--muted); font-size: var(--font-small); }.service-notice > span:last-child { color: var(--faint); }
.toolbar { display: flex; gap: 8px; margin-bottom: 14px; }.search-input, .filter-select { min-height: 46px; border: 1px solid var(--line); border-radius: 10px; background: white; outline: 0; color: var(--ink); }.search-input { min-width: 200px; flex: 1; padding: 0 13px; }.filter-select { padding: 0 10px; }
.scroll-area#documentsView { min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.base-intro { margin-bottom: 18px; }
.source-inbox-notice { min-width: 0; display: flex; flex: 0 0 auto; align-items: center; gap: 14px; width: 100%; margin: 0 0 14px; padding: 12px 16px; border: 1px solid #ead9ba; border-radius: 12px; background: #fffaf0; color: var(--ink); text-align: left; }
.source-inbox-notice:hover { border-color: #cfa969; background: #fff7e7; }
.source-inbox-number { min-width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; padding-inline: 6px; border-radius: 10px; background: #f8e9cd; color: #865d22; font-size: var(--font-small); font-weight: 650; }
.source-inbox-notice > span:nth-child(2) { min-width: 0; flex: 1; }
.source-inbox-notice strong, .source-inbox-notice > span:nth-child(2) > span { display: block; font-size: var(--font-caption); line-height: 1.4; overflow-wrap: anywhere; }
.source-inbox-notice > span:nth-child(2) > span { margin-top: 3px; color: var(--muted); }
.source-inbox-cta { flex: 0 0 auto; font-size: var(--font-caption); color: #805b29; }
.document-inbox { border-color: #e4d2b5; background: #faf8f1; }
.document-inbox > .document-group-head { border-color: #e8decc; }
.document-inbox > .document-group-head b { color: #865d22; }
.document-review-open { border: 0; padding: 0; background: transparent; }
.document-review-reason { margin: 8px 0 0; font-size: var(--font-caption); color: var(--muted); line-height: 1.45; }
.source-inbox-empty { min-width: 0; padding: 28px 10px; color: var(--muted); text-align: center; }
.source-inbox-empty > span { display: block; margin-bottom: 10px; font-size: 24px; color: var(--teal); }
.source-inbox-empty strong { font-size: var(--font-caption); font-weight: 500; }
.source-inbox-empty p { margin: 8px 0 0; font-size: var(--font-caption); line-height: 1.45; }
@media (max-width: 900px) {
  #documentsView .base-intro { margin-bottom: 12px; }
  #documentsView .base-intro .eyebrow, #documentsView .base-intro > div > p:last-child { display: none; }
  #documentsView .base-intro h1 { margin: 0; font-size: 26px; }
  #documentsView .document-dropzone { min-height: 64px; padding: 10px 12px; gap: 10px; margin-bottom: 10px; }
  #documentsView .document-dropzone > span > span { font-size: 12px; line-height: 1.4; }
  .source-inbox-notice { gap: 10px; padding: 10px 12px; }
  .source-inbox-cta { font-size: 0; }
  .source-inbox-cta > span { font-size: 20px; }
  .source-inbox-notice > span:nth-child(2) > span { display: none; }
}
.document-dropzone { width: 100%; min-height: 100px; display: flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: 16px; margin-bottom: 16px; padding: 20px; border: 1px dashed #9dbdb5; border-radius: 13px; background: #f9fcfa; color: var(--teal); font: inherit; text-align: left; cursor: pointer; transition: background .15s, border-color .15s; }
.document-dropzone > svg { width: 28px; height: 28px; flex: 0 0 auto; pointer-events: none; }
.document-dropzone > span { min-width: 0; display: grid; gap: 5px; pointer-events: none; }
.document-dropzone strong { color: var(--ink); font-size: var(--font-ui); line-height: 1.4; }
.document-dropzone span > span { color: var(--muted); font-size: var(--font-small); line-height: 1.5; }
.document-dropzone:hover, .document-dropzone.is-dragover { border-color: var(--teal); background: var(--teal-soft); }
.document-dropzone.is-dragover { border-style: solid; box-shadow: inset 0 0 0 1px var(--teal); }
.document-dropzone:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }
.document-dropzone.is-uploading > svg { opacity: .6; }
@media (max-width: 600px) { .document-dropzone { gap: 12px; padding: 16px; } }
.base-search { min-width: 0; display: flex; flex: 1 1 240px; }
.base-search .search-input { min-width: 0; width: 100%; }
.document-groups { min-height: 0; display: flex; flex: 1; align-items: stretch; gap: 12px; overflow-x: auto; overflow-y: hidden; padding: 12px; border: 1px solid var(--line); border-radius: 15px; background: #edf2ef; scroll-snap-type: x proximity; scrollbar-gutter: stable; }
.document-group { width: clamp(286px,22vw,340px); min-width: clamp(286px,22vw,340px); min-height: 0; display: flex; flex-direction: column; overflow: hidden; border: 1px solid #d6e0dc; border-radius: 12px; background: #f7f9f7; scroll-snap-align: start; }
.document-group-head { min-height: 54px; display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.document-group-head strong { min-width: 0; overflow: hidden; color: var(--ink); font-size: 1rem; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.document-group-head b { min-width: 30px; height: 30px; display: grid; flex: 0 0 auto; place-items: center; padding: 0 8px; border-radius: 15px; background: white; color: var(--muted); font-size: var(--font-caption); }
/* Cards keep their content height; only the column scrolls vertically. */
.document-card-list { min-width: 0; min-height: 0; flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); grid-auto-rows: max-content; align-content: start; gap: 10px; overflow-x: hidden; overflow-y: auto; padding: 10px; scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: #a5b5af transparent; }
.document-card { min-width: 0; min-height: 116px; position: relative; display: flex; flex-direction: column; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: white; box-shadow: 0 1px 2px rgba(18,49,50,.045); overflow-wrap: anywhere; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.document-card > :not(.document-card-hit) { min-width: 0; flex-shrink: 0; }
.document-card.is-clickable { cursor: pointer; }
.document-card.is-clickable:hover { border-color: #a7c7c0; box-shadow: 0 5px 15px rgba(18,49,50,.075); transform: translateY(-1px); }
.document-card-hit { position: absolute; z-index: 1; inset: 0; border-radius: inherit; }
.document-card-hit:focus-visible { outline: 3px solid rgba(66,106,197,.4); outline-offset: 2px; }
.document-card-top { min-height: 24px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; margin-bottom: 8px; color: var(--faint); font-size: var(--font-caption); line-height: 1.4; }
.document-card-top > :last-child:not(:first-child) { margin-left: auto; white-space: nowrap; }
.document-kind { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 8px; border-radius: 999px; background: var(--surface-soft); color: #536b6c; font-weight: 700; }
.document-kind.conclusion { background: var(--teal-soft); color: #276e67; }
.document-kind.recording { background: var(--capability-soft); color: #4563a9; }
.document-card > strong { color: var(--ink); font-size: 1rem; line-height: 1.42; }
.document-card-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 8px; margin-top: auto; padding-top: 11px; color: var(--faint); font-size: var(--font-caption); line-height: 1.4; }
.document-state { display: inline-flex; align-items: center; gap: 6px; color: var(--faint); }
.document-state i { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #6a9f94; }
.document-state.review { color: #96651d; }.document-state.review i, .document-state.processing i { background: #d39a3a; }
.document-state.failed { color: var(--rose); }.document-state.failed i { background: var(--rose); }
.document-state.archive i { background: #81908d; }
.document-no-source { color: var(--faint); }
.document-source-choices { position: relative; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); color: var(--faint); font-size: var(--font-caption); line-height: 1.4; }
.document-source-choices > span { margin-right: auto; white-space: nowrap; }
.document-source-choices a { min-width: 32px; height: 32px; display: grid; flex: 0 0 auto; place-items: center; padding: 0 6px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfb; color: #356c66; font-size: var(--font-caption); font-weight: 700; text-decoration: none; }
.document-source-choices a:hover { border-color: #8db9b0; background: var(--teal-soft); }
.base-empty, .table-empty { padding: 34px; border: 1px dashed var(--line); border-radius: 13px; color: var(--muted); text-align: center; }
.base-empty strong { display: block; color: var(--ink); }
.base-empty p { margin: 5px 0 0; }
.history-list { display: grid; gap: 9px; }.history-row { min-height: 100px; display: grid; grid-template-columns: 44px minmax(0,1fr) auto; gap: 14px; align-items: center; padding: 15px 17px; border: 1px solid var(--line); border-radius: 13px; background: white; color: inherit; text-align: left; }.history-row:hover { border-color: #acc8c2; box-shadow: 0 6px 20px rgba(30,57,57,.06); }.history-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; background: var(--surface-soft); color: var(--muted); }.history-mark.project { background: var(--capability-soft); color: var(--capability); }.history-mark.task { background: var(--teal-soft); color: var(--teal); }.history-row small, .history-row strong, .history-row p { display: block; }.history-row small { color: var(--teal); font-size: var(--font-caption); }.history-row strong { margin-top: 3px; font-size: var(--font-ui); }.history-row p { margin: 5px 0 0; overflow: hidden; color: var(--muted); font-size: var(--font-small); text-overflow: ellipsis; white-space: nowrap; }.history-meta { color: var(--faint); font-size: var(--font-caption); }
.trash-section { margin-bottom: 28px; padding: 15px; border: 1px solid #e4d9d6; border-radius: 15px; background: #fbf8f7; }
.conversation-history { margin-top: 8px; }
.history-section-head { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.history-section-head h2 { margin: 0; color: var(--deep); font: 700 1.4rem/1.2 "PT Serif", Georgia, serif; }
.history-section-head p { margin: 4px 0 0; color: var(--muted); font-size: var(--font-small); }
.history-section-head > b { min-width: 32px; height: 32px; display: grid; place-items: center; padding: 0 8px; border-radius: 16px; background: white; color: var(--muted); font-size: var(--font-caption); }
.trash-list { display: grid; gap: 8px; }
.trash-row { min-height: 86px; display: grid; grid-template-columns: 44px minmax(0,1fr) auto; gap: 13px; align-items: center; padding: 12px 13px; border: 1px solid #e3d8d5; border-radius: 12px; background: white; }
.trash-copy { min-width: 0; }
.trash-copy small, .trash-copy strong, .trash-copy p { display: block; }
.trash-copy small { color: #96615d; font-size: var(--font-caption); }
.trash-copy strong { margin-top: 3px; overflow: hidden; color: var(--ink); font-size: var(--font-ui); text-overflow: ellipsis; white-space: nowrap; }
.trash-copy p { margin: 4px 0 0; color: var(--faint); font-size: var(--font-caption); }
.restore-button { min-width: 128px; }
.restore-button:disabled { cursor: not-allowed; opacity: .48; }
.trash-empty { padding: 22px; border: 1px dashed #ddcfcb; border-radius: 11px; color: var(--muted); text-align: center; }
.scoped-chat-page { min-height: 0; display: flex; flex-direction: column; }.legacy-chat-head { flex: 0 0 auto; padding: 28px max(32px,calc((100% - 900px)/2)) 20px; border-bottom: 1px solid var(--line); }.legacy-chat-head h1 { font-size: 30px; }
.empty-area { max-width: 780px; margin: 9vh auto 0; }.empty-area-index { display: inline-flex; margin-bottom: 38px; padding: 6px 9px; border-radius: 7px; background: var(--surface-soft); color: var(--faint); font-size: var(--font-caption); font-weight: 700; text-transform: uppercase; }.empty-area h1 { font-size: 54px; }.empty-area > p:not(.eyebrow) { max-width: 680px; margin: 0 0 30px; color: var(--muted); font-size: var(--font-body); line-height: 1.7; }.empty-area-note { display: grid; gap: 7px; margin-bottom: 25px; padding: 20px; border-left: 4px solid var(--teal); background: white; }.empty-area-note span { color: var(--teal); font-size: var(--font-caption); font-weight: 700; text-transform: uppercase; }.empty-area-note strong { line-height: 1.5; }

.health-page-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.health-page-actions > .secondary-button { min-height: 42px; }

/* Dialogs and toasts */
.form-dialog { width: min(560px, calc(100vw - 30px)); padding: 0; border: 0; border-radius: 18px; background: white; color: var(--ink); box-shadow: var(--shadow); }.form-dialog::backdrop { background: rgba(8,31,33,.42); backdrop-filter: blur(2px); }.form-dialog form { padding: 24px; }.dialog-head { display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }.dialog-head h2 { margin: 0; color: var(--deep); font: 700 27px/1.2 "PT Serif", Georgia, serif; }.dialog-head .icon-button { margin: -8px -8px 0 0; }.form-dialog textarea { resize: vertical; line-height: 1.5; }.dialog-actions { display: flex; justify-content: end; gap: 8px; margin-top: 20px; }
.toast-region { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: grid; gap: 8px; max-width: min(480px, calc(100vw - 40px)); max-height: 45dvh; overflow-y: auto; padding: 3px; }
.toast { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 11px; background: var(--deep); color: white; box-shadow: var(--shadow); font-size: var(--font-small); animation: toast-in .2s ease-out; }
.toast-message { flex: 1; min-width: 0; overflow-wrap: anywhere; line-height: 1.5; }
.toast-actionable .toast-message { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.toast-action, .toast-dismiss { flex: 0 0 auto; min-height: 40px; border: 0; border-radius: 6px; color: white; background: transparent; font: inherit; cursor: pointer; }
.toast-action { padding: 6px 10px; background: #ffffff20; font-weight: 600; }
.toast-dismiss { width: 32px; padding: 0; font-size: 24px; }
.toast-action:hover, .toast-dismiss:hover { background: #ffffff30; }
.toast button:focus-visible { outline: 2px solid white; outline-offset: 2px; }
.toast button:disabled { opacity: .55; cursor: wait; }
.toast.error { background: #793f45; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
.archive-dialog { position: fixed; inset: 0 0 0 auto; width: min(560px, 100%); max-width: 100%; height: 100dvh; max-height: 100dvh; margin: 0; padding: 0; border: 0; border-radius: 16px 0 0 16px; color: var(--ink); background: var(--paper); box-shadow: -12px 0 48px #163b3020; }
.archive-dialog[open] { display: flex; flex-direction: column; }
.archive-dialog::backdrop { background: #102f3338; }
.archive-dialog-head { display: flex; flex: 0 0 auto; align-items: flex-start; gap: 18px; padding: 26px 24px 20px; border-bottom: 1px solid var(--line); }
.archive-dialog-head h2 { margin: 0 0 8px; font-size: 26px; font-weight: 600; }
.archive-dialog-head p { margin: 0; color: var(--muted); font-size: 16px; line-height: 1.5; }
.archive-close { flex: 0 0 40px; min-height: 40px; display: grid; place-items: center; margin-left: auto; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; cursor: pointer; }
.archive-close svg { display: block; }
.archive-close:hover { background: var(--surface-soft); }
.archive-list { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 24px; align-content: start; }
.archive-list .trash-row { grid-template-columns: 32px minmax(0, 1fr) auto; align-items: start; gap: 10px; padding: 16px; }
.archive-list .history-mark { width: 32px; height: 32px; }
.archive-list .trash-copy strong { font-size: 17px; font-weight: 550; overflow-wrap: anywhere; white-space: normal; }
.archive-list .restore-button { min-width: 0; min-height: 40px; padding: 8px 12px; font-size: 14px; }
.archive-restore-note { color: var(--muted); }
.archive-toast-region { display: grid; flex: 0 0 auto; gap: 8px; padding: 0 16px 16px; }
.archive-toast-region:empty { display: none; }
@media (max-width: 600px) {
  .archive-dialog { border-radius: 0; }
  .archive-dialog-head { padding: 20px 16px 16px; }
  .archive-list { padding: 12px 16px; }
  .archive-list .trash-row { grid-template-columns: minmax(0, 1fr) auto; }
  .archive-list .history-mark { display: none; }
  .toast { gap: 7px; padding: 10px; }
  .toast-action { padding-inline: 8px; }
  .toast-region { max-width: calc(100vw - 20px); }
}
.mobile-only, .mobile-bottom-nav, .project-scope-scrim, .mobile-health-kicker { display: none; }
.topbar svg, .mobile-chat-back svg, .mobile-bottom-item svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 1380px) {
  .app-shell { grid-template-columns: 284px minmax(0,1fr); }
  .health-board { grid-template-columns: repeat(3, minmax(260px,1fr)); overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; }
  .direction-lane { scroll-snap-align: start; }
}

@media (max-width: 1080px) {
  .project-page { height: calc(100dvh - 64px); }
  .scope-chat-head { padding-left: 18px; padding-right: 18px; }
}

@media (max-width: 900px) {
  :root { --mobile-bottom-nav-height: 68px; }
  body { overflow: hidden; }
  .app-shell { display: block; }
  .sidebar { width: 300px; height: 100dvh; position: fixed; left: 0; transform: translateX(-102%); transition: transform .2s ease; box-shadow: 16px 0 40px rgba(9,35,36,.24); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 29; display: block; background: rgba(8,31,33,.32); }
  .sidebar-collapse { display: grid; }
  .workspace { height: 100dvh; padding-bottom: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom)); }
  .mobile-bottom-nav { height: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom)); position: fixed; z-index: 28; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 4px 8px env(safe-area-inset-bottom); border-top: 1px solid rgba(193,208,203,.9); background: rgba(255,255,255,.96); box-shadow: 0 -8px 24px rgba(18,49,50,.08); backdrop-filter: blur(16px); }
  .mobile-bottom-item { min-width: 0; min-height: 58px; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 5px 3px 4px; border: 0; border-radius: 10px; background: transparent; color: #718184; font-size: .75rem; font-weight: 600; line-height: 1.15; }
  .mobile-bottom-item::before { content: ""; width: 28px; height: 3px; position: absolute; top: -4px; left: 50%; border-radius: 0 0 3px 3px; background: transparent; transform: translateX(-50%); }
  .mobile-bottom-item svg { width: 24px; height: 24px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .mobile-bottom-item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-bottom-item:hover { background: var(--surface-soft); color: var(--ink); }
  .mobile-bottom-item.active { color: var(--teal); }
  .mobile-bottom-item.active::before { background: var(--teal); }
  .mobile-bottom-item:focus-visible { outline-offset: -3px; }
  .toast-region { bottom: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom) + 12px); }
  .mobile-only { display: grid; }
  .mobile-route-title, .mobile-chat-back, .mobile-chat-menu, .mobile-scope-close, .mobile-project-tools, .mobile-health-tabs, .mobile-health-add { display: none; }
  .topbar { padding: 0 13px; }
  .topbar > .mobile-only { flex: 0 0 auto; }
  .topbar #globalUpload { width: 48px; min-width: 48px; padding: 0; overflow: hidden; font-size: 0; }
  .topbar #globalUpload > span { font-size: 20px; }
  .scroll-area { padding: 24px 16px 44px; }
  #healthView { overflow-y: auto; padding: 18px 16px 20px; }
  .health-board { min-height: 540px; flex: 0 0 auto; grid-template-columns: repeat(3, minmax(300px, 84vw)); margin-right: -16px; padding-right: 16px; }
  .project-page { height: 100%; grid-template-columns: 280px minmax(0,1fr); }
  .toolbar { flex-wrap: wrap; }.base-search { flex-basis: 100%; }
  .history-row { grid-template-columns: 44px minmax(0,1fr); }.history-meta { grid-column: 2; }.history-row p { white-space: normal; }
}

@media (max-width: 760px) {
  .project-page { display: flex; flex-direction: column; }
  .project-scope-nav { flex: 0 0 auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .project-nav-head { min-height: 58px; padding: 8px 12px; }
  .project-nav-head h1 { font-size: 1.125rem; }
  .project-direction { margin-bottom: 1px; font-size: .75rem; }
  .scope-nav-list { min-height: 64px; display: flex; flex: 0 0 auto; align-items: center; gap: 6px; overflow-x: auto; overflow-y: hidden; padding: 7px 8px; scrollbar-gutter: auto; }
  .scope-nav-item { width: auto; max-width: 230px; min-height: 48px; flex: 0 0 auto; grid-template-columns: 26px minmax(0,1fr); gap: 7px; padding: 5px 9px; }
  .scope-nav-mark { width: 24px; height: 24px; border-radius: 7px; }
  .scope-nav-copy strong { font-size: .9375rem; }
  .scope-nav-copy small { display: none; }
  .scope-section-head { display: none; }
  .scope-task-list { display: flex; flex: 0 0 auto; gap: 6px; }
  .task-nav-row { flex: 0 0 auto; }
  .task-nav-row .scope-nav-item { width: min(244px, 76vw); max-width: min(244px, 76vw); min-height: 54px; padding: 6px 45px 6px 8px; }
  .task-nav-row .scope-nav-copy strong { font-size: .925rem; -webkit-line-clamp: 1; line-clamp: 1; }
  .task-nav-row .scope-nav-copy small { display: block; margin-top: 1px; font-size: .75rem; }
  .task-card-menu { right: 1px; }
  .task-card-menu > summary { opacity: .72; pointer-events: auto; }
  .task-card-menu-panel { width: min(220px, calc(100vw - 24px)); position: fixed; top: 132px; right: 12px; }
  .no-tasks { min-height: 48px; padding: 0 8px; white-space: nowrap; }
  .add-task-card { width: 48px; min-width: 48px; flex: 0 0 48px; justify-content: center; padding: 0; }
  .add-task-card strong { display: none; }
  .completed-scope-tasks { flex: 0 0 auto; margin: 0; }
  .completed-scope-tasks > summary { min-height: 48px; padding: 0 10px; white-space: nowrap; }
  .completed-scope-tasks > div { display: flex; gap: 6px; padding: 4px 0 0; }
  .project-scope-pane { flex: 1; }
  .scope-chat-head { min-height: 76px; padding: 9px 12px; }
  .scope-heading-copy h1 { font-size: 1.25rem; }
  .scope-heading-copy p { max-width: 52vw; }
}

@media (max-width: 600px) {
  .topbar { height: 64px; }.breadcrumbs .breadcrumb-item:not(:last-child) { display: none; }.breadcrumbs button, .breadcrumb-current strong { max-width: 42vw; }.context-button { width: 46px; padding: 0; }.context-button > span:nth-child(2) { display: none; }.context-button b { position: absolute; margin: -26px 0 0 29px; background: var(--teal); }
  .health-page-head h1 { font-size: 29px; }
  .project-page { height: 100%; }
  .scope-chat-head { gap: 8px; padding: 8px 10px; }
  .scope-heading-copy > span { font-size: .75rem; }
  .scope-heading-copy h1 { font-size: 1.125rem; }
  .scope-heading-copy p { display: none; }
  .scope-head-actions { gap: 5px; }
  .scope-head-actions .secondary-button { padding: 0 11px; }
  .project-summary-panel { position: fixed; top: 132px; right: 10px; left: 10px; width: auto; }
  .task-finish-button { width: 48px; padding: 0; overflow: hidden; color: transparent; font-size: 0; gap: 0; }
  .task-finish-button .empty-check { flex: 0 0 auto; }
  .scoped-messages { padding: 18px 14px; }.message { grid-template-columns: 34px minmax(0,1fr); gap: 9px; }.message-avatar { width: 32px; height: 32px; }.message.user { margin-left: 0; }
  .scoped-composer-wrap { padding: 8px 10px 10px; }.composer-meta { display: none; }.scoped-composer textarea { font-size: 1rem; }
  .form-dialog form { padding: 20px; }
  .identity-switch { grid-template-columns: 1fr; }
  .login-page { padding: 14px; }.login-card { padding: 30px 22px 26px; border-radius: 20px; }
  .empty-area { margin-top: 5vh; }.empty-area h1 { font-size: 42px; }
  .base-intro { align-items: flex-start; }.base-intro > div > p:last-child { line-height: 1.5; }.base-intro .primary-button { min-width: 48px; padding: 0 12px; }
  .base-toolbar .filter-select { min-width: 0; flex: 1 1 45%; }
  .document-groups { margin-right: -16px; padding-right: 16px; border-right: 0; border-radius: 14px 0 0 14px; }
  .document-group { width: min(82vw,320px); min-width: min(82vw,320px); }
  .trash-section { padding: 11px; }
  .trash-row { grid-template-columns: 38px minmax(0,1fr); }
  .trash-row .history-mark { width: 36px; height: 36px; }
  .restore-button { min-width: 0; grid-column: 2; justify-self: start; }
}

/* Mobile is a dedicated app layout, not a compressed desktop workspace. */
@media (max-width: 900px) {
  :root {
    --mobile-header: 56px;
    --mobile-nav: 62px;
    --font-body: 1rem;
    --font-ui: 1rem;
  }

  body { overscroll-behavior: none; background: #f3f6f4; }
  .app-shell, .workspace { width: 100%; height: var(--app-height, 100dvh); min-height: 0; padding-bottom: 0; }
  .sidebar { height: var(--app-height, 100dvh); padding-top: max(18px, env(safe-area-inset-top)); padding-bottom: max(14px, env(safe-area-inset-bottom)); }

  .topbar {
    min-height: calc(var(--mobile-header) + env(safe-area-inset-top));
    height: calc(var(--mobile-header) + env(safe-area-inset-top));
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    gap: 4px;
    padding: env(safe-area-inset-top) 8px 0;
    border-bottom: 0;
    background: #0a5b54;
    color: white;
    box-shadow: 0 1px 0 rgba(0,0,0,.08);
    backdrop-filter: none;
  }
  .mobile-topbar-leading { grid-column: 1; display: grid; place-items: center; }
  .mobile-route-title, .mobile-chat-back, .mobile-chat-menu, .mobile-scope-close, .mobile-health-tabs, .mobile-health-add { display: grid; }
  .mobile-topbar-leading .icon-button { width: 44px; height: 44px; border-radius: 12px; color: white; }
  .mobile-route-title { min-width: 0; grid-column: 2; display: block; overflow: hidden; align-self: center; color: white; font-size: 1.0625rem; font-weight: 700; line-height: 1.25; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
  .breadcrumbs { display: none; }
  .top-actions { min-width: 0; grid-column: 3; justify-self: end; }
  .topbar #globalUpload { width: 44px; min-width: 44px; min-height: 44px; padding: 0; border-color: rgba(255,255,255,.2); border-radius: 12px; overflow: hidden; background: rgba(255,255,255,.1); color: white; font-size: 0; }
  .topbar #globalUpload > span { font-size: 24px; font-weight: 400; }
  .topbar #openContext { display: none !important; }
  body[data-route-mode="health"] .topbar #globalUpload,
  body[data-route-mode="documents"] .topbar #globalUpload,
  body[data-route-mode="history"] .topbar #globalUpload,
  body[data-route-mode="area"] .topbar #globalUpload { visibility: hidden; pointer-events: none; }

  .mobile-bottom-nav {
    min-height: calc(var(--mobile-nav) + env(safe-area-inset-bottom));
    position: relative;
    z-index: 20;
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 5px 5px env(safe-area-inset-bottom);
    border-top: 1px solid #dce5e1;
    background: rgba(255,255,255,.96);
    box-shadow: 0 -8px 24px rgba(22,51,50,.05);
    backdrop-filter: blur(16px);
  }
  .mobile-bottom-item { min-width: 0; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 3px 2px; border: 0; border-radius: 12px; background: transparent; color: #7b8988; }
  .mobile-bottom-item svg { width: 23px; height: 23px; stroke-width: 1.9; }
  .mobile-bottom-item span { overflow: hidden; max-width: 100%; font-size: .6875rem; font-weight: 650; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-bottom-item.active { background: #e1f1ed; color: #087d70; }
  body[data-route-mode="project"] .topbar,
  body[data-route-mode="task"] .topbar,
  body[data-route-mode="project"] .mobile-bottom-nav,
  body[data-route-mode="task"] .mobile-bottom-nav,
  body[data-route-mode="biomarker"] .mobile-bottom-nav,
  body[data-route-mode="legacy-chat"] .mobile-bottom-nav { display: none; }
  body.keyboard-open .mobile-bottom-nav { display: none; }

  .view { width: 100%; min-width: 0; }
  .scroll-area { padding: 20px 14px calc(28px + env(safe-area-inset-bottom)); }

  /* Health: one Trello-like lane fills the remaining viewport. */
  #healthView { min-height: 0; overflow: hidden; padding: 0; background: #f3f6f4; }
  .health-page-head { min-height: 64px; flex: 0 0 auto; justify-content: space-between; margin: 0; padding: 10px 14px 6px; }
  .health-page-head h1 { display: none; }
  .mobile-health-kicker { display: block; color: var(--deep); font-size: 1.25rem; font-weight: 750; letter-spacing: -.015em; }
  .mobile-health-add { width: 44px; height: 44px; border: 1px solid #d6e2de; border-radius: 13px; background: white; color: #087d70; font-size: 24px; box-shadow: 0 2px 8px rgba(18,49,50,.05); }
  .mobile-health-tabs { min-height: 46px; flex: 0 0 auto; display: flex; gap: 4px; overflow-x: auto; padding: 0 10px 6px; scrollbar-width: none; }
  .mobile-health-tabs::-webkit-scrollbar, .health-board::-webkit-scrollbar { display: none; }
  .mobile-health-tabs button { min-width: max-content; min-height: 40px; flex: 1 0 auto; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 0 11px; border: 0; border-radius: 11px; background: transparent; color: #667a7c; font-size: .8125rem; font-weight: 700; white-space: nowrap; }
  .mobile-health-tabs button.active { background: white; color: var(--deep); box-shadow: 0 2px 10px rgba(18,49,50,.08); }
  .mobile-health-tabs .direction-dot { width: 7px; height: 7px; background: var(--lane); }
  .mobile-health-tabs small { min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 5px; border-radius: 10px; background: #edf2ef; color: #6d7e7e; font-size: .6875rem; }
  .health-board { min-height: 0; flex: 1; display: flex; gap: 10px; overflow-x: auto; overflow-y: hidden; margin: 0; padding: 2px 12px 12px; scroll-padding-left: 12px; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-inline: contain; }
  .direction-lane { width: auto; min-width: 0; height: 100%; max-height: none; flex: 0 0 calc(100vw - 24px); border: 1px solid #dde6e2; border-radius: 16px; background: #e9efec; scroll-snap-align: start; scroll-snap-stop: always; }
  .direction-head { min-height: 54px; padding: 10px 14px; }
  .direction-head h2 { font-size: 1rem; }
  .project-list { min-height: 0; flex: 1; gap: 9px; padding: 0 9px 10px; scrollbar-gutter: auto; }
  .project-card { min-height: 62px; padding: 12px 14px; border: 1px solid rgba(214,225,221,.9); border-radius: 12px; box-shadow: 0 2px 6px rgba(24,54,53,.06); }
  .project-card-title { font-size: 1rem; line-height: 1.38; }
  .add-project-card { min-height: 52px; }

  /* Project and task routes are true full-screen chats. */
  body[data-route-mode="project"] .workspace,
  body[data-route-mode="task"] .workspace { height: var(--app-height, 100dvh); }
  .project-page { width: 100%; height: 100%; min-height: 0; position: relative; display: block; overflow: hidden; }
  .project-scope-resizer { display: none; }
  .project-scope-scrim { position: absolute; z-index: 49; inset: 0; display: block; padding: 0; border: 0; background: rgba(6,32,34,.42); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
  .project-scope-scrim.open { opacity: 1; pointer-events: auto; }
  .project-scope-nav { width: min(88vw, 360px); height: 100%; min-height: 0; position: absolute; z-index: 50; inset: 0 auto 0 0; display: flex; flex-direction: column; overflow: hidden; border: 0; border-right: 1px solid var(--line); background: #f1f5f3; box-shadow: 18px 0 48px rgba(8,35,36,.22); transform: translateX(-104%); transition: transform .22s ease; }
  .project-scope-nav.mobile-open { transform: translateX(0); }
  .project-nav-head { min-height: calc(70px + env(safe-area-inset-top)); flex: 0 0 auto; flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 10px 10px 15px; background: #0a5b54; }
  .project-nav-heading { min-width: 0; }
  .project-nav-head h1 { color: white; font: 700 1.125rem/1.3 "Manrope", sans-serif; }
  .project-nav-head .project-direction { color: #a9ddd4; font-size: .6875rem; }
  .project-action-menu > summary { color: white; }
  .project-action-menu > summary:hover,
  .project-action-menu[open] > summary { background: rgba(255,255,255,.14); color: white; }
  .mobile-scope-close { width: 44px; height: 44px; flex: 0 0 auto; color: white; }
  .scope-nav-list { min-height: 0; flex: 1; display: block; overflow-x: hidden; overflow-y: auto; padding: 12px; scrollbar-gutter: auto; }
  .scope-nav-list > .scope-nav-item { margin-bottom: 12px; }
  .scope-nav-item { width: 100%; max-width: none; min-height: 56px; grid-template-columns: 32px minmax(0,1fr); gap: 10px; padding: 7px 10px; }
  .scope-nav-mark { width: 28px; height: 28px; }
  .scope-nav-copy strong { font-size: .9375rem; }
  .scope-nav-copy small { display: block; font-size: .75rem; }
  .scope-section-head { display: flex; margin-top: 2px; padding: 0 4px; }
  .scope-task-list { display: grid; gap: 8px; }
  .task-nav-row { width: 100%; }
  .task-nav-row .scope-nav-item { width: 100%; max-width: none; min-height: 60px; padding: 7px 48px 7px 9px; }
  .task-nav-row .scope-nav-copy strong { -webkit-line-clamp: 2; line-clamp: 2; }
  .task-card-menu-panel { width: min(220px, calc(100vw - 40px)); position: absolute; top: calc(100% + 2px); right: 3px; }
  .add-task-card { width: 100%; min-width: 0; min-height: 50px; justify-content: flex-start; padding: 0 10px; }
  .add-task-card strong { display: block; }
  .completed-scope-tasks { margin-top: 8px; }
  .completed-scope-tasks > div { display: grid; gap: 7px; }
  .mobile-project-tools { flex: 0 0 auto; display: grid; gap: 8px; padding: 9px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: white; }
  .mobile-context-action { width: 100%; min-height: 46px; justify-content: flex-start; }
  .mobile-context-action > span:nth-child(2) { flex: 1; text-align: left; }
  .mobile-context-action b { min-width: 24px; height: 24px; display: grid; place-items: center; border-radius: 12px; background: var(--teal-soft); color: var(--teal); font-size: .75rem; }
  .mobile-scope-actions { display: flex; gap: 7px; }
  .mobile-scope-actions > * { min-width: 0; flex: 1; }
  .mobile-scope-actions .project-summary-menu { position: static; }
  .mobile-scope-actions .project-summary-menu > summary,
  .mobile-scope-actions .task-finish-button { width: 100%; min-height: 46px; }
  .mobile-scope-actions .project-summary-panel { max-height: 56%; position: absolute; inset: auto 12px calc(112px + env(safe-area-inset-bottom)); width: auto; padding: 16px; }

  .project-scope-pane { width: 100%; height: 100%; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
  .scope-chat-head { min-height: calc(var(--mobile-header) + env(safe-area-inset-top)); height: calc(var(--mobile-header) + env(safe-area-inset-top)); display: grid; grid-template-columns: 44px minmax(0,1fr) 44px; gap: 4px; padding: env(safe-area-inset-top) 6px 0; border-bottom: 1px solid #dfe7e4; background: rgba(255,255,255,.97); backdrop-filter: blur(16px); }
  .mobile-chat-back, .mobile-chat-menu { width: 44px; height: 44px; align-self: center; border-radius: 12px; color: var(--deep); }
  .mobile-chat-menu { font-size: 19px; font-weight: 750; letter-spacing: 1px; }
  .scope-heading-copy { min-width: 0; align-self: center; text-align: center; }
  .scope-heading-copy > span { margin: 0 0 1px; color: #5b7b78; font-size: .625rem; letter-spacing: .08em; }
  .scope-heading-copy h1 { font-size: 1rem; line-height: 1.25; }
  .scope-heading-copy p, .desktop-scope-actions { display: none; }
  .project-chat-shell { min-height: 0; flex: 1; overflow: hidden; background: #f8faf9; }
  .scoped-messages { min-height: 0; flex: 1; overflow-x: hidden; overflow-y: auto; padding: 18px 14px 16px; overscroll-behavior: contain; scroll-padding-bottom: 20px; }
  .message { grid-template-columns: 28px minmax(0,1fr); gap: 9px; margin-bottom: 24px; }
  .message-avatar { width: 28px; height: 28px; border-radius: 9px; font-size: .6875rem; }
  .message-meta { gap: 6px; margin-bottom: 6px; font-size: .6875rem; }
  .message-meta strong { font-size: .8125rem; }
  .message-body { overflow-wrap: anywhere; color: #26383a; font-size: 1rem; line-height: 1.58; }
  .message-body p { margin-bottom: 10px; }
  .message-body h2, .message-body h3 { margin: 18px 0 7px; font-size: 1.0625rem; }
  .message.user { display: flex; justify-content: flex-end; margin-left: 0; }
  .message.user .message-avatar { display: none; }
  .message.user > div { max-width: 88%; }
  .message.user .message-meta { justify-content: flex-end; padding-right: 3px; }
  .message.user .message-meta strong { display: none; }
  .message.user .message-body { padding: 11px 14px; border-radius: 18px 18px 5px 18px; background: #e2efeb; }
  .source-chips { gap: 6px; }
  .source-chip { max-width: 100%; min-height: 40px; padding: 7px 9px; overflow: hidden; font-size: .75rem; text-overflow: ellipsis; white-space: nowrap; }
  .chat-empty { min-height: 100%; padding: 24px; }
  .scoped-composer-wrap { flex: 0 0 auto; padding: 7px 9px calc(7px + env(safe-area-inset-bottom)); border-top: 0; background: linear-gradient(rgba(248,250,249,0), #f8faf9 18%); }
  .scoped-composer { min-height: 56px; grid-template-columns: 44px minmax(0,1fr) 44px 44px; gap: 4px; align-items: end; padding: 5px; border-color: #cbd8d4; border-radius: 21px; box-shadow: 0 7px 24px rgba(22,52,51,.12); }
  .scoped-composer textarea { min-height: 44px; max-height: min(144px, 35dvh); padding: 10px 5px; font-size: 1rem; line-height: 1.5; }
  .chat-model-picker { min-height: 38px; margin-left: 1px; }
  .chat-model-picker select { height: 38px; font-size: .8125rem; }
  .attach-button, .voice-button, .send-button { width: 44px; height: 44px; border-radius: 16px; }
  .attach-button { border: 0; background: #f0f4f2; }
  .send-button { background: #0a5b54; }
  .composer-meta { display: none; }

  .context-panel { width: 100vw; height: var(--app-height, 100dvh); border-left: 0; }
  .context-head { min-height: calc(66px + env(safe-area-inset-top)); padding: calc(12px + env(safe-area-inset-top)) 15px 12px; }
  .context-content { padding: 16px 15px calc(24px + env(safe-area-inset-bottom)); }
  .legacy-chat-head { display: none; }
  .scoped-chat-page .scoped-messages { flex: 1; }

  .form-dialog { width: calc(100vw - 20px); max-height: calc(var(--app-height, 100dvh) - 20px); margin: auto 10px max(10px, env(safe-area-inset-bottom)); border-radius: 20px; }
  .toast-region { right: 10px; bottom: calc(var(--mobile-nav) + env(safe-area-inset-bottom) + 10px); left: 10px; }
  body[data-route-mode="project"] .toast-region,
  body[data-route-mode="task"] .toast-region,
  body[data-route-mode="biomarker"] .toast-region { bottom: calc(10px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }
}

@media (max-width: 359px) {
  .health-board { padding-right: 9px; padding-left: 9px; scroll-padding-left: 9px; }
  .direction-lane { flex-basis: calc(100vw - 18px); }
  .scoped-messages { padding-right: 11px; padding-left: 11px; }
  .scoped-composer-wrap { padding-right: 6px; padding-left: 6px; }
}

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

/* Tasks are independent cards; chats have their own navigation underneath. */
.sidebar-new-chat { width: 32px; height: 32px; display: grid; place-items: center; margin-right: -7px; border: 0; border-radius: 8px; background: transparent; color: #b8d0ca; font-size: 23px; }
.sidebar-new-chat:hover, .sidebar-new-chat:focus-visible { background: rgba(255,255,255,.1); color: white; }
.sidebar-chats .sidebar-project.active { background: rgba(255,255,255,.095); color: white; }
.scope-section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.scope-board-link { padding: 6px 0; color: var(--teal); font-size: .75rem; font-weight: 600; text-decoration: none; text-transform: none; letter-spacing: 0; }
.project-chats-heading { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.project-chat-list { display: grid; gap: 5px; }
.project-chat-item { min-height: 48px; }
.task-nav-row .task-scope-card { position: relative; width: 100%; max-width: none; min-height: 48px; grid-template-columns: 16px minmax(0, 1fr); gap: 7px; padding: 10px 10px 10px 8px; border: 1px solid #dfe5e2; border-radius: 8px; background: #fff; box-shadow: 0 1px 1px #163b3010; cursor: grab; }
.task-nav-row .task-scope-card:hover { border-color: #b2c3bc; box-shadow: 0 2px 5px #163b3012; }
.task-nav-row .scope-nav-copy strong { font-size: 13px; font-weight: 500; line-height: 1.5; -webkit-line-clamp: 3; line-clamp: 3; }
.task-nav-row { border-radius: 8px; cursor: grab; }
.task-nav-row .task-scope-card.done .scope-nav-copy strong { color: #71827e; text-decoration: line-through; }
.task-drag-handle { width: 16px; min-height: 28px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 4px; background: transparent; color: #91a099; font-size: 18px; cursor: grab; touch-action: none; opacity: .35; }
.task-nav-row:hover .task-drag-handle, .task-drag-handle:focus-visible { opacity: 1; }
.task-drag-handle:hover { color: #3d6c5b; }
.task-drag-handle:focus-visible { outline: 2px solid #77a89b; outline-offset: 1px; }
.task-nav-row .task-card-menu { width: 28px; height: 28px; right: 4px; }
.task-nav-row .task-card-menu > summary { width: 28px; height: 28px; border-radius: 5px; font-size: 13px; opacity: 0; }
.task-nav-row:hover .task-card-menu > summary, .task-nav-row:focus-within .task-card-menu > summary, .task-nav-row .task-card-menu[open] > summary { opacity: 1; }
.task-done-mark { position: absolute; top: 4px; right: 7px; color: var(--teal); font-size: .65rem; }
.scope-task-list { min-height: 12px; gap: 6px; }
.scope-nav-list { padding: 12px 12px 24px; scrollbar-width: thin; scrollbar-color: #bacac2 transparent; }
.scope-section-head { min-height: 36px; margin-top: 0; padding: 0 3px; font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; color: #586e65; }
.scope-section-head b { margin-left: 5px; color: #8c9a94; }
.scope-board-link { font-size: 11px; font-weight: 500; color: #768980; }
.project-chats-heading { margin-top: 24px; padding-top: 16px; border-top: 1px solid #e0e7e3; }
.project-chat-list { gap: 3px; }
.project-chat-item { min-height: 36px; grid-template-columns: 20px minmax(0,1fr); gap: 7px; padding: 6px 8px; border: 0; border-radius: 7px; }
.project-chat-item.active { border: 0; background: #e0e9e4; box-shadow: none; }
.project-chat-item .scope-nav-mark.main { width: 20px; height: 20px; border: 0; border-radius: 0; background: transparent; color: #7c958b; font-size: 15px; }
.project-chat-item .scope-nav-copy strong { font-size: 13px; font-weight: 500; }
.scope-nav-list .add-task-card { min-height: 36px; margin-top: 5px; padding: 5px 8px; gap: 7px; font-size: 12px; border-radius: 7px; }
.scope-nav-list .add-task-card strong { font-weight: 500; }
.scope-nav-list .add-task-card:hover { background: #e4ebe6; }
.project-nav-head { min-height: 78px; padding: 14px 12px 14px 16px; background: #f5f7f4; }
.project-nav-head h1 { font-family: inherit; font-size: 16px; font-weight: 600; line-height: 1.4; }
.project-direction { margin-bottom: 5px; font-size: 10px; font-weight: 600; letter-spacing: .035em; }
.scope-task-list.is-sorting .task-card-menu { pointer-events: none; }
.task-nav-row[draggable="true"] { cursor: grab; }
.message-actions { display: flex; flex-wrap: wrap; gap: 0 17px; }
.message-created-tasks { display: grid; gap: 5px; margin-top: 6px; }
.message-created-tasks a { display: block; width: fit-content; max-width: 100%; padding: 8px 10px; border: 1px solid #bfd9ce; border-radius: 8px; background: #eff8f2; color: #2b6c53; font-size: var(--font-small); text-decoration: none; overflow-wrap: anywhere; }
#taskProject, #taskDescription { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--ink); font: inherit; font-size: var(--font-small); }
#taskDescription { resize: vertical; min-height: 100px; max-height: 250px; }
.task-dialog-note { display: block; margin-top: 7px; color: var(--muted); line-height: 1.5; }
@media (max-width: 900px) {
  .mobile-bottom-nav { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .scope-task-list { display: grid; gap: 7px; }
  .task-nav-row { width: 100%; }
  .task-nav-row .task-scope-card { width: 100%; max-width: none; min-height: 52px; grid-template-columns: 22px minmax(0,1fr); padding: 8px 38px 8px 7px; }
  .task-nav-row .scope-nav-copy strong { -webkit-line-clamp: 3; line-clamp: 3; white-space: normal; }
  .sidebar-new-chat { width: 44px; height: 44px; }
  .scope-board-link { min-height: 44px; align-content: center; }
}
@media (pointer: coarse) {
  .sidebar .nav-item { min-height: 44px; }
  .task-drag-handle { width: 22px; min-height: 36px; opacity: .7; }
  .task-nav-row .task-card-menu { width: 36px; height: 40px; }
  .task-nav-row .task-card-menu > summary { width: 36px; height: 40px; opacity: .7; }
  .project-chat-item, .scope-nav-list .add-task-card { min-height: 44px; }
}
.project-task-composer { margin-top: 7px; padding: 10px; border: 1px solid #a9c4b7; border-radius: 8px; background: white; box-shadow: 0 3px 10px #163b3010; }
.project-task-composer textarea { width: 100%; min-height: 64px; resize: vertical; padding: 2px; border: 0; outline-offset: 3px; font: inherit; font-size: 13px; line-height: 1.5; color: var(--ink); }
.project-task-composer-controls { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.project-task-composer button { min-height: 32px; padding: 5px 10px; border: 0; border-radius: 6px; font-size: 12px; }
.project-task-composer button[type="submit"] { background: var(--deep); color: white; }
.project-task-composer button[type="button"] { background: transparent; color: var(--muted); }
.project-task-composer p { margin: 6px 0 0; font-size: 12px; color: var(--rose); }
