.app-shell { width: min(1600px, calc(100vw - 32px)); height: 100dvh; min-height: 0; margin: 0 auto; overflow: hidden; border: 1px solid rgba(204, 216, 231, .9); border-radius: 18px; background: var(--paper); box-shadow: var(--shadow); display: flex; flex-direction: column; }
.loading-state, .startup-error { min-height: 60vh; display: grid; place-content: center; color: var(--ink-soft); text-align: center; }
.topbar { height: 64px; flex: 0 0 auto; display: flex; align-items: center; gap: 20px; padding: 0 22px; color: #f4f7fb; background: var(--blue-deep); }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; min-width: 270px; }
.brand > span:last-child { display: grid; gap: 3px; }
.brand strong { font-size: 16px; font-weight: 600; }
.brand small { color: #a7bbda; font-size: 9px; font-weight: 700; letter-spacing: 1.5px; }
.brand small i { font-style: normal; color: #59cfb2; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px 12px 12px 4px; background: linear-gradient(145deg, #39d6c1 0%, #397bd8 55%, #7866c9 100%); box-shadow: 0 5px 16px rgba(30, 106, 198, .3); }
.brand-mark span { width: 12px; height: 12px; transform: rotate(45deg); background: white; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
.topbar-center { margin: 0 auto; color: #c0cee1; padding: 10px 18px; border: 1px solid rgba(191, 208, 233, .17); border-radius: 999px; background: rgba(255,255,255,.055); font-size: 11px; font-weight: 600; }
.topbar-status { display: flex; align-items: center; gap: 8px; color: #c4d2e3; font-size: 12px; white-space: nowrap; }
.status-light, .mode-badge > span { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #56d3b3; box-shadow: 0 0 0 4px rgba(86,211,179,.12); }
.app-body { min-height: 0; flex: 1; display: grid; grid-template-columns: 252px minmax(0, 1fr) 270px; background: #f8fafd; }
.left-rail { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 18px 16px 14px; border-right: 1px solid var(--line); background: #f5f8fc; }
.rail-heading { margin: 0 0 12px; }
.rail-heading h1 { margin: 6px 0 0; font-size: 16px; font-weight: 600; }
.eyebrow { color: #8193ad; font-size: 9px; font-weight: 700; letter-spacing: 1.25px; }
.client-list { display: grid; gap: 10px; }
.conversation { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 12px 22px 10px; }
.conversation-header { display: flex; align-items: center; min-height: 48px; flex: 0 0 auto; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.conversation-header > div { min-width: 0; }
.conversation-header h2 { margin: 4px 0 0; font-family: var(--font-display); font-size: 21px; font-weight: 600; line-height: 1.2; }
.conversation-header .eyebrow i { font-style: normal; color: #b0bdcd; }
.mode-badge { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; padding: 8px 11px; border: 1px solid #d5ece4; border-radius: 999px; background: #edf8f4; color: #25836e; font-size: 10px; white-space: nowrap; }
.mode-badge > span { width: 6px; height: 6px; box-shadow: none; }
.context-panel, .simulation-aside { min-width: 0; min-height: 0; padding: 18px 16px 14px; border-left: 1px solid var(--line); background: #fbfcfe; }
.context-panel { display: flex; flex-direction: column; }
.context-heading { display: flex; justify-content: space-between; align-items: flex-start; }
.context-heading h2, .simulation-aside h2 { margin: 6px 0 18px; font-size: 16px; }
.context-close, .mobile-context-button { display: none; }
.welcome-panel { min-height: 136px; position: relative; overflow: hidden; display: flex; align-items: center; margin: 10px 0 14px; padding: 16px 22px; border: 1px solid #e0e7f2; border-radius: 14px; background: linear-gradient(112deg, #f1f0ff 0%, #eef6ff 56%, #f8fbff 100%); }
.welcome-copy { position: relative; z-index: 1; max-width: 620px; }
.welcome-copy h2 { margin: 8px 0 6px; font-family: var(--font-display); font-size: 28px; font-weight: 600; line-height: 1.12; }
.welcome-copy h2 em { color: #5269c5; font-style: normal; }
.welcome-copy p { max-width: 580px; margin: 0; color: #637691; font-size: 12px; line-height: 1.5; }
.welcome-art { position: absolute; inset: 0 0 0 auto; width: 34%; overflow: hidden; }
.art-ring { position: absolute; right: 12%; top: -95px; width: 220px; aspect-ratio: 1; border: 1px solid rgba(94, 132, 206, .15); border-radius: 50%; box-shadow: 0 0 0 28px rgba(133, 170, 223, .05), 0 0 0 58px rgba(133, 170, 223, .045); }
.art-ring-two { right: 31%; top: auto; bottom: -155px; width: 260px; }
.art-spark { position: absolute; right: 23%; bottom: 16px; width: 52px; height: 52px; display: grid; place-items: center; transform: rotate(-8deg); border-radius: 15px 15px 15px 5px; background: linear-gradient(140deg, #a5e1dc, #a5bafa 58%, #b8a7eb); color: white; font-size: 34px; box-shadow: 0 10px 20px rgba(100, 122, 200, .15); }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 0 0 8px; }
.section-heading h2 { margin: 4px 0 0; font-size: 15px; font-weight: 600; }
.section-heading > span { color: var(--muted); font-size: 11px; }
.action-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.starter-row { margin-top: auto; padding: 12px 0 8px; }
.starter-row > div { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 7px; }
.message-list { min-height: 0; flex: 1 1 0; overflow-y: auto; overscroll-behavior: contain; padding: 12px 4px 10px; scroll-behavior: auto; scrollbar-color: #c5d1e0 transparent; scrollbar-width: thin; }
.message-list--empty { min-height: 0; max-height: none; }
.composer { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 6px 7px 6px 13px; border: 1px solid var(--line-strong); border-radius: 12px; background: white; box-shadow: 0 4px 12px rgba(34, 58, 91, .04); }
.composer textarea { width: 100%; min-height: 24px; max-height: 88px; resize: none; overflow-y: auto; border: 0; outline: 0; color: var(--ink); background: transparent; line-height: 1.45; }
.composer textarea::placeholder { color: #8b9ab0; }
.conversation-footnote { flex: 0 0 auto; margin: 6px 0 0; color: #94a1b4; font-size: 9px; text-align: center; }
.simulation-aside { display: flex; flex-direction: column; gap: 12px; }
.simulation-aside h2 { font-family: var(--font-display); font-size: 20px; }
.simulation-stepper { display: grid; gap: 9px; color: #8d9cb0; font-size: 11px; }
.simulation-stepper i { padding-left: 12px; color: #bcc7d6; font-size: 18px; font-style: normal; }
.simulation-stepper .step-done { color: var(--blue); font-weight: 600; }
.aside-summary { display: grid; grid-template-columns: 1fr; gap: 5px; margin-top: 7px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.aside-summary .eyebrow:not(:first-child) { margin-top: 9px; }
.aside-summary strong { font-size: 12px; }
.aside-notice, .aside-evaluation { margin-top: auto; padding: 14px; border-radius: 12px; background: #f1f4fc; color: #667892; font-size: 11px; line-height: 1.55; }
.aside-evaluation { border: 1px solid #d6ebe3; background: #eef8f4; }
.aside-evaluation strong { color: var(--mint); }
.aside-evaluation p { margin-bottom: 0; }
.return-button { width: 100%; justify-content: center; }
.inline-error { padding: 9px 12px; margin: 0 0 8px; border: 1px solid #f1c8b7; border-radius: 9px; color: #9a492d; background: #fff5f0; font-size: 12px; }
.simulation-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 2px 10px; color: var(--muted); font-size: 11px; }

@media (max-width: 1120px) {
  .app-body { grid-template-columns: 220px minmax(0, 1fr); }
  .context-panel, .simulation-aside { position: fixed; z-index: 5; inset: 64px 0 0 auto; width: min(330px, 88vw); border-left: 1px solid var(--line); box-shadow: -16px 18px 34px rgba(20, 40, 70, .12); transition: transform .2s ease; }
  .context-panel.is-hidden { display: block; transform: translateX(110%); pointer-events: none; }
  .simulation-aside.is-hidden { transform: translateX(110%); pointer-events: none; }
  .context-close { display: inline-grid; }
  .topbar-center { display: none; }
  .topbar-status { margin-left: auto; }
}

@media (max-width: 760px) {
  .app-shell { width: 100%; height: auto; min-height: 100dvh; margin: 0; overflow: visible; border: 0; border-radius: 0; }
  .topbar { height: 62px; gap: 10px; padding: 0 14px; }
  .brand { min-width: 0; gap: 9px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand strong { font-size: 14px; }
  .brand small { font-size: 8px; }
  .topbar-status { display: none; }
  .button-header { margin-left: auto; padding-inline: 9px; }
  .button-header span { display: none; }
  .app-body { display: flex; flex-direction: column; }
  .left-rail { padding: 15px 14px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .rail-heading { margin-bottom: 10px; }
  .rail-heading h1 { margin-top: 4px; font-size: 14px; }
  .client-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
  .client-option { min-height: 58px; padding: 7px; justify-content: center; text-align: center; }
  .client-mark { display: none; }
  .client-option-copy strong { font-size: 10px; }
  .client-option-copy small { font-size: 9px; }
  .client-check { display: none; }
  .fiction-panel { display: none; }
  .conversation { min-height: 65dvh; padding: 12px 14px 12px; }
  .conversation-header { min-height: 50px; padding-bottom: 12px; }
  .conversation-header h2 { font-size: 20px; }
  .conversation-header .eyebrow { font-size: 8px; }
  .mode-badge { display: none; }
  .mobile-context-button { display: inline-flex; margin-left: auto; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--blue); font-size: 11px; }
  .welcome-panel { min-height: 138px; margin: 10px 0 14px; padding: 16px 18px; }
  .welcome-copy h2 { font-size: 25px; }
  .welcome-copy p { max-width: 78%; font-size: 12px; }
  .welcome-art { width: 35%; opacity: .8; }
  .art-spark { right: 12%; width: 52px; height: 52px; font-size: 34px; }
  .section-heading > span { display: none; }
  .action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .action-card { min-height: 155px; padding: 13px; }
  .action-card-title { margin-top: 11px; font-size: 12px; }
  .action-card-description { font-size: 10px; }
  .starter-row { padding-top: 20px; }
  .starter-row > div { gap: 6px; }
  .suggestion-chip { font-size: 10px; }
  .message-list, .message-list--empty { min-height: 100px; max-height: none; }
  .composer { min-height: 50px; }
  .context-panel, .simulation-aside { inset: 62px 0 0 auto; }
  .simulation-aside { width: min(330px, 88vw); }
  .left-rail--simulation { padding-bottom: 14px; }
  .sim-controls { grid-template-columns: 1fr 1fr; }
  .sim-control-group:first-child, .sim-control-group:last-of-type { grid-column: 1 / -1; }
  .profile-grid { grid-template-columns: repeat(4, 1fr); }
  .profile-option { min-height: 39px; padding: 5px; font-size: 10px; }
  .simulation-footer { flex-wrap: wrap; }
}

@media (max-width: 420px) {
  .action-card { min-height: 164px; }
  .welcome-copy p { max-width: 100%; padding-right: 14px; }
  .welcome-art { opacity: .35; }
  .client-option-copy strong { font-size: 9px; }
  .proposal-card { grid-template-columns: 1fr !important; }
  .proposal-cover { min-height: 175px !important; }
}