:root {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #202936; background: #f7f8fa; font-synthesis: none;
    --ink: #202936; --muted: #657080; --line: #e2e6ec; --accent: #245bcc;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 19px; font-weight: 650; }
h2 { font-size: 18px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
p { line-height: 1.55; }
small, time { font-size: 12px; color: var(--muted); }
input, textarea { border: 1px solid #cbd2dc; border-radius: 6px; background: #fff; color: var(--ink); padding: 10px 12px; min-width: 0; }
textarea { resize: vertical; min-height: 80px; width: 100%; line-height: 1.5; }
label { display: grid; gap: 8px; font-size: 14px; }
.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.quiet { background: none; border: 0; border-radius: 4px; color: var(--muted); padding: 6px 8px; font-size: 13px; }
.quiet:hover { background: #edf0f5; color: var(--ink); }
.primary, .secondary { border-radius: 6px; padding: 9px 18px; font-weight: 600; font-size: 14px; }
.primary { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
.primary:hover:not(:disabled) { background: #1b49a8; }
.secondary { background: #fff; border: 1px solid #cbd2dc; color: var(--ink); }
.secondary:hover:not(:disabled) { background: #f0f3f7; }
.small { padding: 6px 12px; font-size: 13px; }
.icon-button { display: grid; place-items: center; background: transparent; border: 0; border-radius: 5px; width: 32px; height: 32px; color: var(--muted); font-size: 24px; flex-shrink: 0; }
.icon-button:hover { background: #edf0f5; }
.app-shell { height: 100dvh; display: flex; flex-direction: column; }

.workspace { display: grid; --chat-width: clamp(400px, 48vw, 690px); grid-template-columns: minmax(0, 1fr) var(--chat-width); flex: 1; min-height: 0; position: relative; }
.work-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; position: relative; background: #fff; }
.view-tabs { display: flex; gap: 0; justify-content: space-between; overflow-x: auto; padding: 8px 12px 0; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.view-tabs button { border: 0; border-bottom: 2px solid transparent; background: transparent; padding: 10px 8px 12px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.view-tabs button.active { color: var(--accent); border-color: var(--accent); font-weight: 600; }
.work-columns { display: grid; grid-template-columns: minmax(0, min(680px, calc(100vw - var(--chat-width) - 240px))) minmax(0, 1fr); min-height: 0; flex: 1; }
.list-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: #fafbfd; }
.search-field { padding: 16px 12px 12px; }
.search-field input { width: 100%; font-size: 13px; padding: 9px 10px; }
.work-scroll { min-height: 0; overflow: auto; padding: 0 8px 60px; flex: 1; }
.work-row { display: flex; align-items: baseline; gap: 8px; width: 100%; border: 0; border-radius: 5px; background: transparent; padding: 11px 10px; text-align: left; font-size: 14px; color: var(--ink); }
.work-row:hover { background: #edf1f7; }
.work-row.selected { background: #e6eefc; color: #17499f; box-shadow: inset 3px 0 var(--accent); }
.work-row.context { color: var(--muted); }
.item-title { min-width: 0; overflow-wrap: anywhere; flex: 1; line-height: 1.45; }
.item-symbol { color: #778599; flex-shrink: 0; font-size: 13px; }
.tree-children { margin-left: 14px; padding-left: 4px; border-left: 1px solid var(--line); }
.tree-children:empty { display: none; }
.priority { display: inline-block; font-size: 16px; font-weight: 750; flex-shrink: 0; }
.priority.low { color: #2678c9; } .priority.high { color: #c62f35; }
.detail-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.detail-heading { display: flex; align-items: center; justify-content: space-between; padding: 12px 24px 0; flex-shrink: 0; }
.item-type { color: var(--muted); font-size: 12px; }
.detail-scroll { overflow: auto; padding: 12px 24px 32px; min-height: 0; }
.detail-scroll > h2 { font-size: 22px; line-height: 1.35; overflow-wrap: anywhere; margin-bottom: 20px; }
.description { font-size: 14px; margin-bottom: 20px; }
.detail-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 20px; font-size: 13px; margin: 0 0 26px; }
.detail-facts dt { color: var(--muted); } .detail-facts dd { margin: 0; overflow-wrap: anywhere; }
.overdue, .danger { color: #b62a31; }
.notes-section { border-top: 1px solid var(--line); padding-top: 20px; margin-top: 24px; }
.notes-section > h3 { margin-bottom: 12px; }
.empty-notes { color: var(--muted); font-size: 13px; margin: 12px 0; }
.note { margin: 12px 0; padding: 12px; border: 1px solid var(--line); border-radius: 6px; }
.note p { font-size: 14px; }
.note-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.note-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; font-size: 12px; }
.note-composer { display: grid; gap: 8px; margin-top: 14px; }
.note-composer textarea { font-size: 14px; min-height: 84px; }
.note textarea + .note-actions { margin-top: 8px; }
.history { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 20px; font-size: 13px; }
.history summary { cursor: pointer; font-weight: 600; } .history summary span { color: var(--muted); font-weight: 400; }
.history article { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.history-diff { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-top: 12px; }
.history-diff h4 { color: var(--muted); font-size: 11px; margin-bottom: 10px; }
.empty-state { color: var(--muted); padding: 40px 20px; font-size: 14px; text-align: center; }
.empty-state h3 { color: var(--ink); margin-bottom: 8px; }
.detail-placeholder { margin: auto; max-width: 340px; color: #9aa3af; }
.chat-panel { border-left: 1px solid var(--line); background: #f7f8fb; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.activity { color: var(--muted); font-size: 12px; }
.messages { flex: 1; min-height: 0; overflow: auto; padding: 20px 18px; display: flex; flex-direction: column; gap: 16px; overflow-anchor: none; }
.chat-welcome { margin: auto; padding: 32px 12px; }
.message { max-width: 94%; align-self: flex-start; min-width: 0; }
.message.user { align-self: flex-end; max-width: 88%; }
.bubble { padding: 11px 14px; background: #e9edf3; border-radius: 14px 14px 14px 4px; font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.user .bubble { background: var(--accent); color: #fff; border-radius: 14px 14px 4px 14px; }
.error .bubble { background: #fff0ef; color: #a5272f; }
.markdown p + p, .markdown ul, .markdown ol { margin-top: 8px; }
.markdown ul, .markdown ol { padding-left: 22px; margin-bottom: 0; }
.markdown a { color: #164fae; } .markdown pre { overflow: auto; padding: 8px; background: #fff8; border-radius: 4px; }
.markdown code { font-size: .9em; } .markdown h1, .markdown h2, .markdown h3 { font-size: 15px; margin: 12px 0 6px; }
.message.proposal { width: 100%; max-width: 100%; }
.proposal-widget { display: grid; gap: 8px; width: 100%; text-align: left; border: 1px solid #dfc471; border-radius: 8px; background: #fff8df; padding: 14px; color: #614c0c; }
.proposal-widget strong { font-size: 14px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.proposal-widget > span { font-size: 12px; }
.proposal-widget.committed { background: #edf8f0; border-color: #a4ceb2; color: #25613c; }
.proposal-widget.superseded, .proposal-widget.stale { background: #f0f2f5; border-color: #d5dbe3; color: #647080; }
.composer { display: flex; align-items: flex-end; gap: 8px; margin: 0 16px 16px; padding: 8px; background: #fff; border: 1px solid #bac4d2; border-radius: 10px; flex-shrink: 0; }
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.composer textarea { min-height: 36px; max-height: 160px; border: 0; outline: none; resize: none; padding: 7px 6px; background: transparent; flex: 1; font-size: 14px; }
.send { display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; background: var(--accent); color: #fff; border: 0; border-radius: 6px; }
.older { align-self: center; }
.proposal-overlay { position: absolute; inset: 12px; z-index: 2; display: flex; flex-direction: column; overflow: hidden; background: #fff; border: 1px solid #cbd2dc; border-radius: 8px; box-shadow: 0 6px 24px #1a294028; }
.proposal-overlay > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 24px 12px; }
.proposal-overlay h2 { margin-top: 6px; font-size: 20px; overflow-wrap: anywhere; }
.proposal-meta { display: flex; align-items: center; gap: 12px; padding: 0 24px 18px; font-size: 12px; color: var(--muted); }
.status-badge { padding: 4px 8px; border-radius: 4px; background: #f0f2f5; color: #586477; }
.status-badge.pending { background: #fff4cd; color: #735900; } .status-badge.committed { background: #e4f3e8; color: #24603a; }
.diff-head, .diff-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.diff-head { border-block: 1px solid var(--line); background: #f7f8fa; font-size: 12px; color: var(--muted); }
.diff-head > * { padding: 12px 20px; }
.diff-scroll { overflow: auto; min-height: 0; flex: 1; }
.diff-row { border-bottom: 1px solid var(--line); }
.diff-row > div { padding: 20px; min-width: 0; overflow-wrap: anywhere; }
.diff-row > div + div { border-left: 1px solid var(--line); }
.preview-item h3 { font-size: 15px; margin: 8px 0; overflow-wrap: anywhere; }
.preview-item p { font-size: 13px; }
.preview-item dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 7px 12px; font-size: 12px; overflow-wrap: anywhere; }
.preview-item dt { color: var(--muted); } .preview-item dd { margin: 0; }
.proposal-overlay footer { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: flex-end; gap: 16px; background: #fff; }
.proposal-overlay footer p { color: var(--muted); font-size: 13px; flex: 1; }
.error-banner { display: flex; justify-content: space-between; gap: 16px; padding: 10px 24px; background: #fff0ef; color: #a5272f; font-size: 13px; }
.error-banner button { border: 0; background: none; color: inherit; }
.login-card { width: min(380px, calc(100% - 32px)); margin: 14vh auto; padding: 32px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.login-card h1 { font-size: 24px; margin-bottom: 8px; }
.login-card p { color: var(--muted); font-size: 14px; margin-bottom: 28px; }
.login-card form { display: grid; gap: 20px; } .login-card .error { color: #a5272f; }
.mobile-navigation, .back-to-list { display: none; }
@media (min-width: 1800px) { .work-columns { grid-template-columns: 680px minmax(0, 1fr); } .detail-scroll { padding-inline: 36px; } }
@media (max-width: 1100px) and (min-width: 901px) {


    .detail-scroll, .detail-heading { padding-inline: 16px; }
    .view-tabs { gap: 16px; }
}
@media (max-width: 900px) {

    .mobile-navigation { display: flex; background: #fff; border-bottom: 1px solid var(--line); flex-shrink: 0; }
    .mobile-navigation button { flex: 1; padding: 12px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-size: 14px; }
    .mobile-navigation .active { color: var(--accent); border-color: var(--accent); font-weight: 600; }
    .workspace { display: flex; flex-direction: column; }
    .work-panel, .chat-panel { flex: 1; height: 100%; }
    .chat-panel { border-left: 0; }
    .work-active .chat-panel, .chat-active .work-panel { display: none; }
    .view-tabs { padding-inline: 16px; gap: 20px; }
    .work-columns { grid-template-columns: minmax(220px, 35%) minmax(0, 1fr); }
    .proposal-overlay { inset: 0; border-radius: 0; border: 0; }
    .review-open.chat-active .work-panel { display: flex; position: absolute; top: 0; width: 100%; height: 55%; z-index: 2; border-bottom: 1px solid #bac4d2; }
    .review-open.chat-active .work-columns { visibility: hidden; }
    .review-open.chat-active .chat-panel { position: absolute; bottom: 0; width: 100%; height: 45%; }
    .proposal-overlay > header { padding: 12px 16px 8px; }
    .proposal-overlay h2 { font-size: 17px; }
    .proposal-meta { padding: 0 16px 10px; }
    .diff-head > *, .diff-row > div { padding: 10px 12px; }
    .proposal-overlay footer { padding: 10px 12px; }
    .composer { margin: 0 12px max(12px, env(safe-area-inset-bottom)); }
}
@media (max-width: 600px) {
    .work-columns { display: flex; }
    .list-pane, .detail-pane { width: 100%; border: 0; }
    .work-columns:not(.has-selection) .detail-pane, .work-columns.has-selection .list-pane { display: none; }
    .back-to-list { display: block; margin-left: -8px; }
    .close-details { display: none; }
    .detail-heading { padding: 12px 20px 0; }
    .detail-scroll { padding: 16px 20px 28px; }
    .detail-scroll > h2 { font-size: 21px; }
    .view-tabs { gap: 18px; }
    .messages { padding: 16px 12px; }
    .preview-item dl { grid-template-columns: minmax(0, 1fr); gap: 3px; }
    .preview-item dd { margin-bottom: 6px; }
    .review-open .proposal-overlay h2 { font-size: 16px; }
    .proposal-overlay footer p { font-size: 12px; }
    .composer textarea { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

.settings-button { position: fixed; bottom: 12px; left: 12px; z-index: 3; width: 36px; height: 36px; background: #fafbfd; border: 1px solid var(--line); }
.settings-dialog { padding: 0; width: min(720px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); border: 1px solid var(--line); border-radius: 10px; color: var(--ink); box-shadow: 0 20px 60px #14233d40; }
.settings-dialog::backdrop { background: #15233c55; }
.settings-dialog > header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.settings-columns { display: grid; grid-template-columns: 190px minmax(0, 1fr); min-height: 320px; }
.settings-columns nav { background: #f7f8fa; border-right: 1px solid var(--line); padding: 12px; }
.settings-columns nav button { width: 100%; text-align: left; padding: 10px 12px; border: 0; border-radius: 5px; background: #e6eefc; color: #17499f; font-size: 14px; }
.settings-columns section { padding: 24px; }
.settings-columns h3 { font-size: 18px; margin-bottom: 24px; }
.message.failed .bubble { background: #fce9e9; color: #7f252c; }
.message-failure { color: #b32c37; font-size: 12px; margin: 6px 4px 0; }
.message-failure p { font-size: 12px; }
.retry-message { background: transparent; border: 0; padding: 4px 0; color: #a0232d; font-weight: 600; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.activity { display: flex; align-items: center; gap: 8px; padding: 4px; }
.activity-dot { width: 7px; height: 7px; border-radius: 50%; background: #7a879a; }
.review-summary { padding: 12px 20px; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line); }
.task-review { border-bottom: 1px solid #cbd2dc; }
.task-review > summary { padding: 16px 20px; cursor: pointer; background: #f7f8fa; overflow-wrap: anywhere; }
.review-task-label { font-size: 11px; text-transform: uppercase; color: var(--muted); margin-right: 8px; }
.task-review > summary strong { font-size: 15px; }
.review-path { display: block; margin: 0 0 6px 16px; color: var(--muted); font-size: 12px; }
.review-count { display: block; margin: 6px 0 0 16px; font-size: 12px; color: var(--muted); }
.review-section-label { margin: 16px 20px 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.review-item { margin-left: 0; padding: 8px 0 12px; border-top: 1px solid var(--line); }
.review-item > header { display: flex; align-items: baseline; gap: 10px; padding: 6px 20px 10px; font-size: 13px; overflow-wrap: anywhere; }
.review-item.context-only { color: var(--muted); padding-bottom: 0; }
.review-item.context-only > header { padding-bottom: 4px; }
.change-label { font-size: 11px; font-weight: 600; padding: 3px 6px; border-radius: 4px; background: #eaf0fb; color: #2456a5; flex-shrink: 0; }
.change-label.added { background: #e6f3e9; color: #24603a; }
.change-label.removed { background: #fce9e9; color: #a0232d; }
.review-field-name { padding: 6px 20px; color: var(--muted); font-size: 11px; }
.review-values { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); font-size: 13px; }
.review-values > div { padding: 8px 20px; min-width: 0; }
.before-value { background: #fff3f2; }
.after-value { background: #eef8f0; border-left: 1px solid var(--line); }
@media (max-width: 900px) { .settings-button { bottom: 12px; } .chat-active .composer { margin-left: 58px; } }
@media (max-width: 600px) { .settings-columns { grid-template-columns: 120px minmax(0, 1fr); } .settings-columns section { padding: 20px 16px; } .review-values > div, .review-field-name, .review-item > header { padding-inline: 12px; } .view-tabs { gap: 0; padding-inline: 4px; } .view-tabs button { font-size: 12px; padding-inline: 6px; } }.review-item > header { padding-left: calc(20px + min(calc(var(--depth) * 18px), 90px)); }
.review-presence > div { display: flex; align-items: baseline; gap: 10px; padding-left: calc(20px + min(calc(var(--depth) * 18px), 90px)); }
.review-presence strong { overflow-wrap: anywhere; min-width: 0; }
.absent-value { color: #a3abb7; }