:root {
  --ink: #24342e;
  --muted: #6f786f;
  --line: #d9d8ca;
  --surface: #fffef8;
  --soft: #f3f1e7;
  --page: #ebe8dc;
  --primary: #2f5d50;
  --primary-dark: #21473d;
  --primary-soft: #e2eee7;
  --success: #4f7d60;
  --warning: #b56a34;
  --danger: #a84a43;
  --shadow: 5px 5px 0 rgba(45, 58, 48, .09);
  --radius: 10px;
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--ink); background: var(--page); font-family: var(--font); line-height: 1.55; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
.hidden { display: none !important; }
.mobile-only, .mobile-header, .mobile-nav { display: none !important; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 220px minmax(0, 1fr) 320px; }
.app-nav { position: sticky; top: 0; height: 100vh; padding: 24px 16px; background: #11192b; color: #dbe3f4; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 11px; padding: 5px 9px 26px; color: white; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: linear-gradient(135deg, #6f8dff, #315eeb); font-weight: 800; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; letter-spacing: .02em; }
.brand small { margin-top: 1px; color: #8491aa; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.nav-list { display: grid; gap: 7px; }
.nav-button { width: 100%; border: 0; border-radius: 12px; padding: 12px 13px; background: transparent; color: #9facbf; display: flex; align-items: center; gap: 11px; cursor: pointer; text-align: left; transition: .2s ease; }
.nav-button:hover { background: rgba(255,255,255,.06); color: white; }
.nav-button.active { background: #26365d; color: white; box-shadow: inset 3px 0 #7190ff; }
.nav-icon { flex: 0 0 auto; width: 20px; height: 20px; color: #7f98ed; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: square; stroke-linejoin: miter; }
.conversation-nav { margin-top: 18px; padding-top: 15px; border-top: 1px solid rgba(255,255,255,.09); }
.conversation-nav-heading { display: flex; align-items: center; justify-content: space-between; margin: 0 7px 7px; color: #8d9a91; font-size: 9px; font-weight: 700; letter-spacing: .08em; }
.conversation-nav-heading > div { display: flex; gap: 2px; }
.conversation-nav-heading button { width: 24px; height: 24px; border: 0; border-radius: 4px; background: transparent; color: #b7c0b4; cursor: pointer; }
.conversation-nav-heading button:hover { background: rgba(255,255,255,.08); color: white; }
.conversation-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 4px; margin-bottom: 3px; border-radius: 5px; }
.conversation-row.active { background: rgba(255,254,238,.09); }
.conversation-open { min-width: 0; padding: 8px 7px; border: 0; background: transparent; color: #aeb9b0; cursor: pointer; text-align: left; }
.conversation-open strong, .conversation-open small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-open strong { color: inherit; font-size: 10px; font-weight: 600; }
.conversation-open small { margin-top: 2px; color: #75847a; font-size: 8px; }
.conversation-row.active .conversation-open strong, .conversation-open:hover strong { color: #fff8df; }
.conversation-actions { display: flex; padding-right: 4px; opacity: 0; transition: opacity .15s; }
.conversation-row:hover .conversation-actions, .conversation-row:focus-within .conversation-actions { opacity: 1; }
.conversation-actions button { padding: 3px; border: 0; background: transparent; color: #87968c; cursor: pointer; font-size: 9px; }
.conversation-actions button:hover { color: #e0a27f; }
.nav-note { margin-top: auto; padding: 14px 12px; border: 1px solid rgba(255,255,255,.08); border-radius: 14px; background: rgba(255,255,255,.035); display: grid; grid-template-columns: 9px 1fr; gap: 9px; }
.nav-note p { margin: 0; color: #8491aa; font-size: 11px; }
.nav-note strong { color: #c5cee0; font-weight: 600; }
.status-dot { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: #54d5a1; box-shadow: 0 0 0 4px rgba(84,213,161,.1); }

.workspace-main { min-width: 0; background: #f7f9fd; }
.workspace-view { display: none; min-height: 100vh; padding: 38px clamp(24px, 4vw, 64px) 36px; }
.workspace-view.active { display: flex; flex-direction: column; }
.view-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; max-width: 920px; width: 100%; margin: 0 auto 28px; }
.view-header h1 { margin: 5px 0 6px; font-size: clamp(27px, 3vw, 39px); line-height: 1.18; letter-spacing: -.035em; }
.view-header p { max-width: 660px; margin: 0; color: var(--muted); }
.view-header > button { flex-shrink: 0; white-space: nowrap; }
.eyebrow { color: var(--primary); font-size: 10px; font-weight: 800; letter-spacing: .18em; }

.primary-button, .secondary-button, .ghost-button, .send-button, .text-button, .icon-button { border: 0; cursor: pointer; transition: .2s ease; }
.primary-button, .send-button { border-radius: 11px; padding: 10px 17px; background: var(--primary); color: white; font-weight: 650; box-shadow: 0 7px 18px rgba(49,94,235,.2); }
.primary-button:hover, .send-button:hover { background: var(--primary-dark); transform: translateY(-1px); }
.primary-button:disabled, .send-button:disabled { opacity: .55; cursor: wait; transform: none; }
.secondary-button { border: 1px solid var(--line); border-radius: 11px; padding: 9px 15px; background: white; color: #42506a; font-weight: 600; }
.secondary-button:hover { border-color: #b9c5dc; background: var(--soft); }
.ghost-button { border: 1px dashed #c9d2e2; border-radius: 10px; padding: 9px 12px; background: transparent; color: var(--muted); }
.ghost-button:hover { background: var(--soft); color: var(--ink); }
.text-button { padding: 3px 0; background: transparent; color: var(--primary); font-size: 12px; font-weight: 700; }
.text-button:hover { color: var(--primary-dark); }
.icon-button { display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 9px; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--muted); }
.full-width { width: 100%; }

.chat-stage { flex: 1; width: 100%; max-width: 920px; margin: 0 auto; padding-bottom: 22px; }
.message { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 11px; margin-bottom: 20px; }
.user-message { grid-template-columns: minmax(0, 1fr); justify-items: end; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: #19233b; color: white; font-size: 12px; font-weight: 800; }
.message-content { max-width: min(760px, 100%); }
.assistant-message .message-content { padding: 14px 17px; border: 1px solid var(--line); border-radius: 5px 17px 17px; background: white; box-shadow: 0 6px 18px rgba(28,46,78,.04); }
.user-message .message-content { padding: 12px 16px; border-radius: 17px 17px 5px 17px; background: #23375f; color: white; }
.message-content p { margin: 0 0 9px; white-space: pre-wrap; }
.message-content p:last-child { margin-bottom: 0; }
.message-meta { margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.message-meta span { display: inline-block; margin: 2px 5px 2px 0; padding: 3px 7px; border-radius: 99px; background: var(--soft); }
.welcome-message { margin-top: 6vh; }
.starter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.starter-grid button { padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); color: #45516a; cursor: pointer; text-align: left; font-size: 13px; }
.starter-grid button:hover { border-color: #aabcf1; background: var(--primary-soft); color: var(--primary-dark); }
.starter-heading { grid-column: 1 / -1; margin-bottom: 2px; }
.starter-heading strong, .starter-heading span { display: block; }
.starter-heading strong { color: #3f5148; font-size: 11px; }
.starter-heading span { margin-top: 2px; color: var(--muted); font-size: 9px; }
.starter-grid button small, .starter-grid button span { display: block; }
.starter-grid button small { margin-bottom: 4px; color: #a05b37; font-family: ui-monospace, monospace; font-size: 8px; font-weight: 700; }
.starter-grid button span { color: inherit; }
.loading-dots { display: flex; gap: 5px; padding: 6px 2px; }
.loading-dots i { width: 6px; height: 6px; border-radius: 50%; background: #9eabc1; animation: bounce 1.2s infinite; }
.loading-dots i:nth-child(2) { animation-delay: .15s; }
.loading-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%,70%,100% { transform: translateY(0); opacity: .5; } 35% { transform: translateY(-4px); opacity: 1; } }

.composer { position: sticky; bottom: 0; z-index: 5; width: 100%; max-width: 920px; margin: auto auto 0; padding: 12px 14px 11px; border: 1px solid #d6deeb; border-radius: 17px; background: rgba(255,255,255,.96); box-shadow: 0 14px 34px rgba(28,48,85,.11); backdrop-filter: blur(12px); }
.composer textarea { display: block; width: 100%; max-height: 150px; resize: none; border: 0; outline: 0; padding: 2px 2px 10px; color: var(--ink); background: transparent; }
.composer textarea::placeholder { color: #9aa5b8; }
.composer-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.composer-footer span { color: #9aa5b8; font-size: 10px; }
.send-button { padding: 8px 18px; }

.assessment-banner { width: 100%; max-width: 920px; margin: 0 auto 18px; padding: 15px 16px; border: 1px solid #cbd8ff; border-radius: 14px; background: var(--primary-soft); }
.assessment-banner h3 { margin: 0 0 4px; font-size: 14px; }
.assessment-banner p { margin: 0; color: #53617c; font-size: 12px; }
.assessment-actions { display: flex; gap: 8px; margin-top: 11px; }

.context-panel { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 28px 20px; border-left: 1px solid var(--line); background: white; }
.context-heading { display: flex; justify-content: space-between; align-items: flex-start; margin: 2px 3px 18px; }
.context-heading h2 { margin: 4px 0 0; font-size: 19px; letter-spacing: -.02em; }
.context-card { padding: 15px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 15px; background: white; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.section-title h3 { margin: 0; font-size: 13px; }
.section-title > span { color: var(--muted); font-size: 11px; }
.section-hint { margin: 5px 0 12px; color: #8a95a9; font-size: 10px; }
.profile-empty, .memory-empty, .plan-empty { padding: 13px 0; color: #8994a7; font-size: 12px; }
.profile-line { display: flex; gap: 7px; margin-top: 9px; font-size: 12px; }
.profile-line strong { min-width: 50px; color: #8a95a9; font-weight: 500; }
.profile-line span { color: #35415a; }
.memory-item { position: relative; padding: 10px; margin-bottom: 8px; border-radius: 11px; background: var(--soft); }
.memory-item small { display: block; margin-bottom: 3px; color: var(--primary); font-size: 9px; font-weight: 800; letter-spacing: .08em; }
.memory-item p { padding-right: 38px; margin: 0; color: #3f4c65; font-size: 11px; }
.memory-item-actions { position: absolute; top: 8px; right: 7px; display: flex; gap: 4px; }
.memory-item-actions button { border: 0; background: transparent; color: #929db0; cursor: pointer; font-size: 10px; }
.memory-item-actions button:hover { color: var(--danger); }
.memory-item.inactive { opacity: .62; }
.inactive-memory-section { margin-top: 9px; border-top: 1px solid var(--line); padding-top: 8px; }
.inactive-memory-section summary { margin-bottom: 8px; color: var(--muted); cursor: pointer; font-size: 10px; font-weight: 700; }
.mini-progress { height: 6px; margin: 10px 0 7px; border-radius: 99px; background: #e8edf5; overflow: hidden; }
.mini-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #315eeb, #6a88f5); }
.plan-mini-card p { margin: 0; color: var(--muted); font-size: 11px; }

.memory-candidates { margin-top: 12px; padding: 13px; border: 1px solid #f0d8b5; border-radius: 12px; background: #fffaf2; }
.memory-candidates h4 { margin: 0 0 4px; font-size: 12px; }
.memory-candidates > p { color: #8c6b45; font-size: 10px; }
.candidate-row { display: grid; grid-template-columns: 100px minmax(0,1fr) auto auto; gap: 7px; margin-top: 8px; }
.candidate-row select, .candidate-row input { min-width: 0; padding: 7px 8px; border: 1px solid #e3cfaf; border-radius: 8px; background: white; font-size: 11px; }
.candidate-row button { border: 0; border-radius: 8px; padding: 6px 8px; cursor: pointer; font-size: 10px; }
.profile-conflict-candidate { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 10px; border: 1px solid #ead5b4; border-radius: 10px; background: rgba(255,255,255,.72); }
.candidate-conflict-copy { min-width: 0; flex: 1; }
.candidate-conflict-copy > strong { display: block; margin-bottom: 7px; color: #714f27; font-size: 11px; }
.candidate-conflict-copy p { display: grid; grid-template-columns: 64px minmax(0,1fr); align-items: center; gap: 7px; margin: 4px 0; color: #4a5568; font-size: 10px; }
.candidate-conflict-copy p span { color: #9a774e; }
.candidate-conflict-copy small { display: block; margin-top: 7px; color: #8c6b45; font-size: 9px; }
.candidate-conflict-buttons { display: flex; flex-shrink: 0; gap: 6px; }
.plan-context-warning { margin-top: 12px; padding: 13px; border: 1px solid #cbdcf7; border-radius: 12px; background: #f4f8ff; }
.plan-context-warning > strong { color: #294d83; font-size: 12px; }
.plan-context-warning > p { margin: 5px 0 10px; color: #536782; font-size: 10px; line-height: 1.6; }
.plan-context-warning > div { display: flex; gap: 7px; }
.plan-context-warning button { padding: 6px 9px; font-size: 10px; }
.candidate-confirm { background: #7e5b2d; color: white; }
.candidate-dismiss { background: transparent; color: #9b8060; }

#plan-center { width: 100%; max-width: 920px; margin: 0 auto; }
.plan-hero { padding: 23px; border-radius: var(--radius); background: linear-gradient(135deg, #18233d, #2c4272); color: white; box-shadow: var(--shadow); }
.plan-hero-top { display: flex; justify-content: space-between; gap: 20px; }
.plan-hero h2 { margin: 5px 0 5px; font-size: 24px; }
.plan-hero p { max-width: 650px; margin: 0; color: #becae0; }
.plan-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 20px; }
.plan-stat { padding: 10px 12px; border: 1px solid rgba(255,255,255,.1); border-radius: 11px; background: rgba(255,255,255,.06); }
.plan-stat strong, .plan-stat small { display: block; }
.plan-stat strong { font-size: 17px; }
.plan-stat small { color: #9eabc3; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.plan-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.plan-actions button { box-shadow: none; }
.phase-list { position: relative; margin: 25px 0 0 16px; padding-left: 30px; }
.phase-list::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: #dbe2ef; }
.phase-card { position: relative; padding: 18px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 15px; background: white; }
.phase-card::before { content: ""; position: absolute; left: -31px; top: 23px; width: 12px; height: 12px; border: 3px solid #f7f9fd; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 2px #b8c7f2; }
.phase-card.completed::before { background: var(--success); }
.phase-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.phase-heading h3 { margin: 0; font-size: 15px; }
.phase-heading p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.phase-heading span { color: var(--primary); font-size: 11px; font-weight: 700; }
.task-list { display: grid; gap: 7px; margin-top: 14px; }
.task-item { display: flex; align-items: flex-start; gap: 9px; padding: 9px 10px; border-radius: 9px; background: var(--soft); color: #46536b; font-size: 12px; }
.task-item input { margin-top: 3px; accent-color: var(--primary); }
.task-item.done span { color: #939daf; text-decoration: line-through; }
.history-section { margin-top: 28px; }
.history-section h2 { margin: 0 0 12px; font-size: 16px; }
.history-row { padding: 12px 14px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 11px; background: white; }
.history-row summary { display: flex; justify-content: space-between; gap: 15px; cursor: pointer; list-style: none; }
.history-row summary::-webkit-details-marker { display: none; }
.history-row strong, .history-row small { display: block; }
.history-row small { color: var(--muted); }
.history-detail { display: grid; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.history-detail > div { padding: 10px; border-radius: 9px; background: var(--soft); }
.history-detail strong { margin-bottom: 4px; font-size: 11px; }
.history-detail small { line-height: 1.8; }
.empty-plan-state { padding: 60px 25px; border: 1px dashed #cbd4e4; border-radius: var(--radius); background: rgba(255,255,255,.55); text-align: center; }
.empty-plan-state .empty-icon { display: grid; place-items: center; width: 55px; height: 55px; margin: 0 auto 15px; border-radius: 17px; background: var(--primary-soft); color: var(--primary); font-size: 22px; font-weight: 800; }
.empty-plan-state h2 { margin: 0 0 7px; font-size: 19px; }
.empty-plan-state p { max-width: 450px; margin: 0 auto 18px; color: var(--muted); }

.tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; width: 100%; max-width: 920px; margin: 0 auto; }
.tool-card { position: relative; display: flex; flex-direction: column; min-height: 440px; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: white; color: inherit; text-decoration: none; overflow: hidden; transition: .25s ease; }
.tool-card:hover { transform: translateY(-4px); border-color: #bcc9e3; box-shadow: var(--shadow); }
.tool-illustration { position: relative; display: grid; place-items: center; height: 140px; border-bottom: 1px solid var(--line); overflow: hidden; }
.tool-illustration::before { content: ""; position: absolute; inset: 0; opacity: .35; background-image: linear-gradient(rgba(43,72,58,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(43,72,58,.08) 1px, transparent 1px); background-size: 16px 16px; }
.questionnaire-illustration { background: #e7efe7; color: #315e50; }
.simulator-illustration { background: #eee8f5; color: #68478d; }
.tool-illustration svg { position: relative; width: 180px; height: 100px; fill: rgba(255,255,255,.52); stroke: currentColor; stroke-width: 2.2; stroke-linecap: square; stroke-linejoin: miter; }
.tool-index { position: absolute; z-index: 1; top: 14px; right: 17px; color: currentColor; font-family: ui-monospace, monospace; font-size: 12px; font-weight: 800; opacity: .55; }
.tool-visual-label { position: absolute; z-index: 1; left: 17px; bottom: 13px; padding: 3px 7px; border: 1px solid currentColor; border-radius: 3px; background: rgba(255,255,255,.62); font-family: ui-monospace, monospace; font-size: 9px; font-weight: 700; }
.tool-card-body { flex: 1; padding: 22px 23px 17px; }
.tool-kicker { display: block; margin-bottom: 7px; color: #8b6a56; font-family: ui-monospace, monospace; font-size: 9px; font-weight: 700; }
.tool-card h2 { margin: 0 0 9px; font-size: 21px; }
.tool-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.75; }
.tool-outcome { display: grid; grid-template-columns: auto 1fr; gap: 8px; margin-top: 17px; padding-top: 14px; border-top: 1px dashed #d2d2c7; color: #657168; font-size: 11px; line-height: 1.65; }
.tool-outcome strong { color: var(--primary); }
.tool-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 23px; border-top: 1px solid var(--line); background: #faf9f3; font-size: 11px; }
.tool-footer span { color: var(--muted); }
.tool-footer strong { color: var(--primary); }

.app-dialog { width: min(520px, calc(100vw - 28px)); padding: 0; border: 0; border-radius: 20px; color: var(--ink); box-shadow: 0 30px 90px rgba(16,29,55,.24); }
.app-dialog::backdrop { background: rgba(16,25,43,.52); backdrop-filter: blur(4px); }
.app-dialog form { padding: 26px; }
.app-dialog h2 { margin: 4px 0 5px; font-size: 23px; letter-spacing: -.02em; }
.app-dialog p { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.dialog-conversation-list { display: grid; gap: 6px; margin-top: 17px; }
.dialog-conversation-list .conversation-row { border: 1px solid var(--line); background: #f7f5ec; }
.dialog-conversation-list .conversation-row.active { border-color: #789483; background: #e8efe7; }
.dialog-conversation-list .conversation-open { padding: 10px 11px; color: #58655d; }
.dialog-conversation-list .conversation-open strong { color: #30453b; font-size: 12px; }
.dialog-conversation-list .conversation-open small { color: #899189; font-size: 9px; }
.dialog-conversation-list .conversation-actions { padding-right: 8px; opacity: 1; }
.dialog-conversation-list .conversation-actions button { color: #8a6a59; font-size: 11px; }
.app-dialog label { display: grid; gap: 6px; margin-top: 14px; color: #48546b; font-size: 12px; font-weight: 650; }
.app-dialog input, .app-dialog select, .app-dialog textarea { width: 100%; border: 1px solid #d7deea; border-radius: 10px; padding: 10px 11px; outline: 0; color: var(--ink); background: white; font-weight: 400; }
.app-dialog input:focus, .app-dialog select:focus, .app-dialog textarea:focus { border-color: #8ba3ef; box-shadow: 0 0 0 3px var(--primary-soft); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.dialog-subtitle { margin-top: -2px !important; }
.field-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.app-dialog fieldset { margin: 18px 0 0; padding: 0; border: 0; }
.app-dialog legend { margin-bottom: 8px; color: #48546b; font-size: 12px; font-weight: 650; }
.chip-options { display: flex; flex-wrap: wrap; gap: 7px; }
.chip-options label { display: block; margin: 0; padding: 7px 10px; border: 1px solid var(--line); border-radius: 99px; background: var(--soft); cursor: pointer; font-weight: 500; }
.chip-options input { width: auto; margin: 0 4px 0 0; accent-color: var(--primary); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 23px; }
.split-actions { justify-content: space-between; }
.wide-dialog { width: min(760px, calc(100vw - 28px)); }
.draft-phase { padding: 13px 14px; margin-top: 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--soft); }
.draft-phase h3 { margin: 0 0 6px; font-size: 13px; }
.draft-phase ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 11px; }
.toast-region { position: fixed; z-index: 100; right: 22px; bottom: 22px; display: grid; gap: 8px; }
.toast { max-width: 340px; padding: 11px 14px; border-radius: 11px; background: #19243d; color: white; box-shadow: var(--shadow); font-size: 12px; animation: toast-in .25s ease; }
.toast.error { background: #8e2e3a; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 190px minmax(0, 1fr) 280px; }
  .workspace-view { padding-inline: 28px; }
}

@media (max-width: 900px) {
  .app-shell { display: block; padding: 58px 0 64px; }
  .app-nav { display: none; }
  .mobile-header { position: fixed; z-index: 30; top: 0; left: 0; right: 0; height: 58px; padding: 0 16px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); display: flex !important; align-items: center; justify-content: space-between; backdrop-filter: blur(12px); }
  .mobile-header-actions { display: flex; gap: 6px; }
  .mobile-brand { color: var(--ink); text-decoration: none; font-weight: 800; }
  .mobile-nav { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; height: 64px; padding: 7px 12px max(7px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); display: grid !important; grid-template-columns: repeat(3, 1fr); backdrop-filter: blur(12px); }
  .mobile-nav button { border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 650; }
  .mobile-nav button.active { background: var(--primary-soft); color: var(--primary); }
  .context-panel { position: fixed; z-index: 50; top: 0; right: 0; bottom: 0; width: min(360px, 92vw); height: auto; transform: translateX(105%); box-shadow: -20px 0 60px rgba(20,36,65,.16); transition: transform .25s ease; }
  .context-panel.open { transform: translateX(0); }
  .mobile-only { display: grid !important; }
  .workspace-view { min-height: calc(100vh - 122px); padding: 28px 18px 22px; }
  .welcome-message { margin-top: 2vh; }
}

@media (max-width: 620px) {
  .view-header { display: block; margin-bottom: 22px; }
  .view-header > button { margin-top: 15px; }
  .view-header h1 { font-size: 27px; }
  .chat-header .secondary-button { display: none; }
  .starter-grid, .tool-grid, .plan-stats, .field-row { grid-template-columns: 1fr; }
  .welcome-message { grid-template-columns: 30px minmax(0,1fr); }
  .avatar { width: 30px; height: 30px; }
  .assistant-message .message-content { padding: 12px 13px; }
  .composer { padding: 10px 11px; border-radius: 14px; }
  .composer-footer span { display: none; }
  .composer-footer { justify-content: flex-end; }
  .candidate-row { grid-template-columns: 1fr auto auto; }
  .candidate-row select { grid-column: 1 / -1; }
  .profile-conflict-candidate { display: block; }
  .candidate-conflict-buttons { margin-top: 9px; }
  .plan-hero-top { display: block; }
  .plan-stats { grid-template-columns: repeat(2, 1fr); }
  .phase-list { margin-left: 6px; padding-left: 25px; }
  .phase-card::before { left: -26px; }
  .tool-card { min-height: 0; }
  .app-dialog form { padding: 21px; }
}

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

/* Light pixel-art brand refresh: modern utility first, pixel details second. */
body { background: var(--page); }
.workspace-main {
  background-color: #f8f6ee;
  background-image: linear-gradient(rgba(47,93,80,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(47,93,80,.025) 1px, transparent 1px);
  background-size: 24px 24px;
}
.app-nav { background: #263b33; color: #f3f0df; }
.brand { gap: 12px; }
.brand-mark { width: 42px; height: 42px; border: 2px solid #172820; border-radius: 7px; background: #d9dfc9; box-shadow: 3px 3px 0 #172820; overflow: hidden; }
.brand-mark img, .mobile-brand img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.brand small { color: #aebaa9; letter-spacing: .02em; text-transform: none; }
.nav-button { border-radius: 6px; color: #b7c0b4; }
.nav-button:hover { background: rgba(255,254,238,.08); }
.nav-button.active { background: #f0ead7; color: #233a31; box-shadow: 3px 3px 0 #172820; }
.nav-icon { color: #d87843; }
.nav-note { border-radius: 7px; background: rgba(255,254,238,.04); }
.status-dot { border-radius: 2px; background: #8fb46f; box-shadow: 0 0 0 3px rgba(143,180,111,.12); }
.eyebrow { color: var(--primary); font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 10px; letter-spacing: .08em; text-transform: none; }
.view-header h1 { font-weight: 760; }
.primary-button, .send-button { border: 1px solid #1e463b; border-radius: 6px; background: var(--primary); box-shadow: 3px 3px 0 #b8c2ae; }
.primary-button:hover, .send-button:hover { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 #b8c2ae; }
.secondary-button, .ghost-button, .icon-button { border-radius: 6px; background: #fffef8; }
.secondary-button:hover, .ghost-button:hover { border-color: #96a596; }
.text-button { color: var(--primary); }
.avatar { width: 38px; height: 38px; border: 2px solid #263b33; border-radius: 6px; background: #dbe4d2; box-shadow: 2px 2px 0 #b9b6a7; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.assistant-message .message-content { border-radius: 3px 12px 12px 12px; background: var(--surface); box-shadow: 3px 3px 0 rgba(53,66,56,.07); }
.user-message .message-content { border-radius: 12px 12px 3px 12px; background: #355e51; }
.starter-grid button { border-radius: 6px; background: #f2f0e6; }
.starter-grid button:hover { border-color: #8ca394; background: #e7eee7; color: var(--primary-dark); transform: translateY(-1px); }
.composer { border-radius: 8px; border-color: #c9cabc; background: rgba(255,254,248,.97); box-shadow: 4px 4px 0 rgba(49,66,55,.1); }
.context-panel { background: #f3f0e5; }
.context-card { border-radius: 7px; background: #fffef8; box-shadow: 2px 2px 0 rgba(53,66,56,.05); }
.memory-item { border-radius: 5px; background: #f2f0e6; }
.mini-progress, .route-progress { border-radius: 2px; }
.mini-progress span { border-radius: 2px; background: var(--primary); }

#plan-center { max-width: 980px; }
.plan-dashboard { display: grid; grid-template-columns: 1fr; gap: 14px; }
.plan-overview { position: relative; padding: 27px 29px; border: 1px solid #344d42; border-radius: 8px; background: #fffdf4; box-shadow: 5px 5px 0 #d3d0bf; overflow: hidden; }
.plan-overview::after { content: ""; position: absolute; top: 16px; right: 17px; width: 44px; height: 44px; opacity: .28; background: linear-gradient(90deg, transparent 43%, #d87843 43% 57%, transparent 57%), linear-gradient(transparent 43%, #d87843 43% 57%, transparent 57%); image-rendering: pixelated; }
.plan-overview h2 { max-width: 720px; margin: 7px 60px 12px 0; font-size: clamp(23px, 2.4vw, 30px); line-height: 1.2; letter-spacing: -.035em; }
.plan-goal { display: flex; align-items: flex-start; gap: 9px; max-width: 680px; margin: 0 0 8px; color: #3e4c44; font-weight: 650; }
.plan-goal span { flex: 0 0 auto; margin-top: 2px; padding: 2px 6px; border: 1px solid #c87543; border-radius: 3px; color: #9d4e28; font-family: ui-monospace, monospace; font-size: 9px; }
.plan-summary { max-width: 680px; margin: 0; color: var(--muted); font-size: 12px; }
.route-progress { height: 10px; margin-top: 24px; padding: 2px; border: 1px solid #9da596; background: #e5e2d5; overflow: hidden; }
.route-progress span { display: block; height: 100%; background: repeating-linear-gradient(90deg, #4f7d60 0 8px, #6c9475 8px 11px); }
.plan-progress-meta { display: flex; align-items: baseline; flex-wrap: wrap; gap: 9px 16px; margin-top: 8px; color: var(--muted); font-size: 10px; }
.plan-progress-meta strong { color: var(--primary); font-size: 17px; }
.plan-actions { align-items: center; margin-top: 18px; }
.plan-actions .text-button { margin-left: 3px; color: #8b6d60; font-weight: 600; }
.next-action-card { position: relative; display: grid; grid-template-columns: minmax(170px, .45fr) minmax(0, 1fr); align-items: center; gap: 8px 24px; min-height: 0; padding: 18px 22px; border: 1px solid #bd7045; border-radius: 8px; background: #f8e9d5; box-shadow: 5px 5px 0 #dec5a8; overflow: hidden; }
.next-action-card::after { content: ""; position: absolute; right: -18px; bottom: -20px; width: 86px; height: 86px; background-image: radial-gradient(#c4774c 1.5px, transparent 1.5px); background-size: 8px 8px; opacity: .18; }
.next-action-guide { display: flex; align-items: center; gap: 9px; color: #77452c; font-family: ui-monospace, monospace; font-size: 10px; font-weight: 700; }
.next-action-guide img { width: 38px; height: 38px; border: 2px solid #754832; border-radius: 5px; background: #e6dcc5; object-fit: cover; image-rendering: pixelated; }
.next-action-content { position: relative; z-index: 1; min-width: 0; }
.next-task { display: flex; gap: 10px; margin: 0; color: #3c352f; cursor: pointer; font-size: 16px; font-weight: 750; line-height: 1.4; }
.next-task input { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 3px; accent-color: var(--primary); }
.next-action-content > p { margin: 7px 0 0 28px; color: #8a674f; font-size: 10px; }
.next-action-content > strong { display: block; font-size: 17px; }
.route-section { margin-top: 34px; }
.route-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 15px; }
.route-heading h2 { margin: 4px 0 0; font-size: 20px; }
.route-heading > span { color: var(--muted); font-size: 11px; }
.phase-list { position: relative; margin: 0; padding: 0 0 0 42px; }
.phase-list::before { left: 13px; top: 20px; bottom: 20px; width: 3px; background: repeating-linear-gradient(#98a997 0 7px, transparent 7px 11px); }
.phase-card { position: relative; margin-bottom: 11px; padding: 0; border-radius: 7px; background: #fffef8; box-shadow: 3px 3px 0 rgba(50,64,53,.06); overflow: visible; }
.phase-card::before { content: none; }
.phase-card.current { border-color: #527463; box-shadow: 4px 4px 0 #c7d1c5; }
.phase-card.completed { opacity: .72; }
.phase-heading { position: relative; display: grid; grid-template-columns: 36px minmax(0,1fr) auto; align-items: center; padding: 15px 16px; cursor: pointer; list-style: none; }
.phase-heading::-webkit-details-marker { display: none; }
.phase-heading > div > small { color: #a16c4f; font-family: ui-monospace, monospace; font-size: 9px; }
.phase-heading h3 { margin-top: 1px; }
.phase-heading p { max-width: 650px; }
.phase-pixel { display: grid; place-items: center; width: 25px; height: 25px; border: 2px solid #2f5d50; border-radius: 3px; background: #e5eee4; color: #2f5d50; font-family: ui-monospace, monospace; font-size: 11px; font-weight: 800; box-shadow: 2px 2px 0 #c0c8bb; }
.phase-card .phase-pixel::before { content: ""; position: absolute; left: -37px; width: 10px; height: 10px; border: 2px solid #f8f6ee; background: #76917c; box-shadow: 0 0 0 2px #75917d; }
.phase-card.current .phase-pixel::before { background: #d87843; box-shadow: 0 0 0 2px #b96638; }
.phase-card.completed .phase-pixel { background: #dfe9dd; }
.phase-card .task-list { margin: 0 16px 16px 52px; padding-top: 2px; }
.task-item { border: 1px solid transparent; border-radius: 4px; background: #f3f1e7; }
.task-item:hover { border-color: #c4c8b9; }
.task-item input { accent-color: var(--primary); }
.history-section { padding-top: 10px; border-top: 1px dashed #c5c4b7; }
.history-row, .history-detail > div { border-radius: 5px; background: #fffef8; }
.empty-plan-state { display: grid; grid-template-columns: 190px minmax(0, 420px); justify-content: center; align-items: center; gap: 24px; min-height: 390px; padding: 42px; border: 1px dashed #8fa093; border-radius: 8px; background: rgba(255,253,244,.72); text-align: left; }
.empty-plan-state .empty-guide { width: 190px; max-width: 100%; image-rendering: pixelated; filter: drop-shadow(5px 5px 0 rgba(49,61,52,.12)); }
.empty-plan-state h2 { margin-top: 7px; font-size: 24px; }
.empty-plan-state p { margin: 0 0 18px; }
.empty-plan-state .empty-icon { display: none; }
.tool-card, .app-dialog, .draft-phase { border-radius: 8px; }
.tool-card:hover { transform: translate(-2px,-2px); box-shadow: 5px 5px 0 #d2d1c4; }

.memory-review-candidate { display: block; padding: 11px; border: 1px solid #ddc9a8; border-radius: 6px; background: rgba(255,254,248,.72); }
.candidate-memory-main { display: grid; grid-template-columns: 120px minmax(0,1fr); gap: 10px; align-items: start; }
.candidate-memory-main > div > small { display: block; margin-bottom: 5px; color: #8c6b45; }
.candidate-memory-main input { width: 100%; }
.memory-conflict-note { display: grid; gap: 2px; margin-top: 8px; padding: 8px 9px; border-left: 3px solid #b9683c; background: #f7e6d5; color: #79533d; font-size: 10px; }
.memory-conflict-note strong { color: #8f472b; }
.manual-memory-review { display: grid; gap: 8px; padding: 12px; border: 1px solid #ddc9a8; border-radius: 6px; background: rgba(255,254,248,.8); }
.manual-memory-review > small { color: #8c6b45; line-height: 1.6; }
.manual-memory-normalized { padding: 10px; border: 1px solid #d7d3c5; border-radius: 5px; background: #fffef8; line-height: 1.6; }
.manual-memory-check-ok { margin: 0; color: #52705b; font-size: 11px; }
.candidate-memory-actions { display: flex; justify-content: flex-end; gap: 7px; margin-top: 9px; }
.candidate-memory-actions .candidate-conflict-action { margin-right: auto; max-width: 250px; }

.plan-editor-dialog form { max-height: min(88vh, 900px); overflow-y: auto; }
.plan-editor-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 15px; margin: 23px 0 10px; padding-top: 18px; border-top: 1px dashed var(--line); }
.plan-editor-section-heading strong, .plan-editor-section-heading small { display: block; }
.plan-editor-section-heading small { margin-top: 2px; color: var(--muted); font-size: 10px; }
#plan-editor-phases { display: grid; gap: 11px; }
.plan-editor-phase { padding: 14px; border: 1px solid var(--line); border-radius: 7px; background: #f5f2e8; }
.plan-editor-phase-heading { display: flex; align-items: center; justify-content: space-between; }
.plan-editor-phase-heading strong { color: var(--primary); font-family: ui-monospace, monospace; font-size: 11px; }
.plan-editor-phase label { margin-top: 10px; }
.plan-edit-review { margin-top: 15px; padding: 11px 13px; border: 1px solid #9fb2a3; border-radius: 6px; background: #e8f0e7; }
.plan-edit-review strong { color: var(--primary-dark); font-size: 12px; }
.plan-edit-review p { margin: 3px 0 0; color: #53675a; font-size: 11px; }

.mobile-brand { display: flex; align-items: center; gap: 8px; }
.mobile-brand img { width: 31px; height: 31px; border: 1px solid #263b33; border-radius: 4px; background: #dbe4d2; }

@media (max-width: 900px) {
  .mobile-header, .mobile-nav { background: rgba(248,246,238,.97); }
  .mobile-nav button { border-radius: 5px; }
  .context-panel { background: #f3f0e5; }
  .next-action-card { min-height: 0; }
}

@media (max-width: 620px) {
  .avatar { width: 34px; height: 34px; }
  .plan-overview { padding: 22px 19px; }
  .plan-overview h2 { margin-right: 36px; font-size: 25px; }
  .plan-overview::after { width: 34px; height: 34px; }
  .plan-progress-meta span:last-child { display: none; }
  .next-action-card { padding: 18px; }
  .next-action-card { grid-template-columns: 1fr; gap: 14px; }
  .route-heading { display: block; }
  .route-heading > span { display: block; margin-top: 5px; }
  .phase-list { margin: 0; padding-left: 30px; }
  .phase-list::before { left: 8px; }
  .phase-heading { grid-template-columns: 31px minmax(0,1fr) auto; padding: 13px 11px; }
  .phase-card .phase-pixel::before { left: -27px; }
  .phase-card .task-list { margin: 0 11px 13px 42px; }
  .empty-plan-state { grid-template-columns: 1fr; min-height: 0; padding: 27px 21px; text-align: center; }
  .empty-plan-state .empty-guide { width: 130px; margin: 0 auto; }
  .empty-plan-state p { margin-inline: auto; }
  .candidate-memory-main { grid-template-columns: 1fr; }
  .candidate-memory-actions { flex-wrap: wrap; justify-content: flex-start; }
  .candidate-memory-actions .candidate-conflict-action { width: 100%; max-width: none; margin-right: 0; }
  .plan-editor-section-heading { align-items: flex-start; }
}
