/* Message-first entry and a persistent, event-driven agent workspace. */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
#patient-app.landing { max-width: 1080px; }
#patient-app .hero { padding: 64px 0 58px; }
#patient-app .hero h1 { max-width: 14em; font-size: clamp(40px, 5vw, 64px); }
#patient-app .hero-sub { margin-top: 24px; }
#home-composer { width: min(100%, 670px); margin: 36px auto 0; text-align: left; }
.message-composer { background: white; border: 1px solid #dce0e8; border-radius: 20px; box-shadow: 0 3px 5px #0f172a03, 0 12px 40px #0f172a08; padding: 19px 20px 14px; transition: border-color .2s, box-shadow .2s; }
.message-composer:focus-within, .message-composer.drag-over { border-color: #8bb0ff; box-shadow: 0 0 0 3px #2563eb09, 0 12px 40px #0f172a08; }
.message-composer textarea { display: block; width: 100%; min-height: 80px; max-height: 250px; resize: vertical; border: 0; background: transparent; padding: 0; font-size: 16px; line-height: 1.65; outline: 0; }
.message-composer textarea::placeholder { color: #858b97; }
.composer-toolbar { display: flex; gap: 12px; align-items: center; margin-top: 12px; }
.attach-btn { display: inline-flex; align-items: center; gap: 7px; background: #f7f8fa; border: 1px solid #eceef2; border-radius: 9px; min-height: 38px; padding: 0 11px; cursor: pointer; font-size: 13px; }
.attach-btn:hover { background: #eef3ff; border-color: #c7d8fc; }
.composer-formats { font-size: 11px; color: var(--ink-2); }
.send-btn { display: grid; place-items: center; width: 39px; height: 39px; border: 0; border-radius: 11px; background: var(--accent); color: white; margin-left: auto; cursor: pointer; flex: none; transition: transform .15s, background .15s; }
.send-btn:not(:disabled):hover { background: #174bc5; transform: translateY(-1px); }
.send-btn:disabled { background: #e9ecf1; color: #939aaa; cursor: default; }
.composer-hint { color: var(--ink-2); font-size: 11px; margin: 13px 0 0; }
.composer-hint span { margin: 0 7px; color: #aeb5c1; }
.attachment { display: flex; align-items: center; gap: 8px; border: 1px solid #dbe7ff; background: #f4f8ff; border-radius: 9px; padding: 5px 8px; width: fit-content; max-width: 100%; margin-bottom: 10px; font-size: 12px; }
.attachment #file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-icon { color: var(--accent); }
.attachment button { border: 0; background: none; padding: 3px 7px; font-size: 19px; cursor: pointer; }
#patient-app:not(.landing) { max-width: 1160px; padding-top: 28px; }
.agent-topline { display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
.agent-back { color: var(--ink-2); }
.connection-state { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.connection-state::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #9ca3af; }
.connection-state[data-state='connected']::before { background: var(--ok); }
.connection-state[data-state='reconnecting']::before { background: var(--warn); }
.agent-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 30px 0 24px; }
.agent-heading .eyebrow { font-size: 10px; letter-spacing: .12em; color: var(--accent); margin-bottom: 10px; }
.agent-heading h1 { font-size: 34px; letter-spacing: -.035em; }
.agent-heading p:last-child { font-size: 14px; color: var(--ink-2); margin: 8px 0 0; }
.agent-brand-mark { display: grid; place-items: center; width: 54px; height: 54px; flex: none; border: 1px solid #dce7ff; border-radius: 16px; color: var(--accent); background: #f6f9ff; font-size: 32px; font-weight: 600; letter-spacing: -.08em; }
.request-card { display: flex; align-items: center; gap: 13px; padding: 13px 16px; background: #fafbfc; border: 1px solid #eaecf1; border-radius: 12px; margin: 0 0 28px; font-size: 13px; }
.request-avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #e9edf4; color: #5d6879; flex: none; font-size: 10px; font-weight: 500; }
.request-card p { margin: 0; white-space: pre-wrap; max-height: 90px; overflow: auto; overflow-wrap: anywhere; flex: 1; }
.request-file { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); font-size: 11px; }
.journey { overflow-x: auto; margin: 0 0 32px; padding: 2px 0 8px; }
.journey ol { display: grid; grid-template-columns: repeat(5, 1fr); min-width: 740px; list-style: none; padding: 0; margin: 0; }
.journey-step { position: relative; }
.journey-step:not(:last-child)::after { content: ''; position: absolute; height: 1px; left: 42px; right: 14px; top: 17px; background: #e4e8ef; }
.journey-step[data-state='done']::after { background: #b9cffd; }
.journey-button { width: 100%; text-align: left; border: 0; padding: 0; background: none; cursor: pointer; color: inherit; }
.journey-button:disabled { cursor: default; }
.journey-icon { position: relative; z-index: 1; display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid #e4e8ef; border-radius: 11px; background: white; color: #9aa3b2; font: 11px var(--mono); }
.journey-copy { display: grid; gap: 3px; padding-top: 12px; }
.journey-copy b { font-size: 13px; font-weight: 500; }
.journey-tool { font-size: 11px; color: var(--ink-2); }
.journey-status { width: fit-content; font-size: 10px; color: #717b8c; margin-top: 7px; }
.journey-step[data-state='pending'] .journey-copy { opacity: .6; }
.journey-step[data-state='done'] .journey-icon { color: var(--accent); background: #eff5ff; border-color: #dce8ff; font: 16px var(--sans); }
.journey-step[data-state='done'] .journey-status { color: var(--ok); }
.journey-step[data-state='running'] .journey-icon { border-color: var(--accent); background: var(--accent); color: white; box-shadow: 0 0 0 4px #edf3ff; }
.journey-step[data-state='running'] .journey-status { color: var(--accent); }
.journey-step[data-state='running'] .journey-status::before { content: ''; display: inline-block; width: 5px; height: 5px; background: var(--accent); border-radius: 50%; margin-right: 5px; animation: activity-pulse 1.6s infinite; }
.journey-step[data-state='error'] .journey-icon { color: var(--bad); border-color: #fecaca; background: var(--bad-soft); }
.journey-step[data-state='error'] .journey-status { color: var(--bad); }
.journey-step[data-state='waiting'] .journey-status { color: var(--warn); }
#patient-app:not(.landing) .agent-body { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(290px, 1fr); align-items: start; gap: 30px; border-top: 1px solid var(--line); padding-top: 28px; }
#patient-app.landing .agent-body { display: none; }
#agent-content { min-width: 0; }
#agent-content .screen > h1 { font-size: 25px; letter-spacing: -.025em; }
#agent-content .what { font-size: 14px; margin-bottom: 22px; }
#agent-content .bill-image { max-width: 260px; margin-left: auto; margin-right: auto; }
#agent-content .step-foot { padding-top: 18px; margin-top: 24px; }
#agent-content .primary { font-size: 13px; min-width: auto; }
#screen-research .step-foot { flex-wrap: wrap; align-items: center; gap: 16px; }
#screen-research .voice-toggle { margin: 0 auto 0 0; font-size: 12px; }
#agent-content .summary { padding: 18px; box-shadow: none; }
#agent-content .owe b { font-size: 30px; }
#agent-content .doc { box-shadow: none; padding: 20px; }
#agent-content .rung { padding: 12px; }
#agent-content .rung b { font-size: 23px; }
#agent-content .sum-figs { grid-template-columns: 1fr 1fr; }
.analysis-screen { padding: 30px 14px 22px 0; }
.analysis-symbol { display: grid; place-items: center; width: 42px; height: 42px; background: #f0f5ff; border-radius: 13px; margin-bottom: 24px; }
.analysis-screen.is-working .analysis-symbol .mark { animation: activity-pulse 1.8s infinite; }
.analysis-screen .eyebrow { font-size: 10px; letter-spacing: .12em; color: var(--ink-2); }
.analysis-screen h2 { font-size: 24px; letter-spacing: -.03em; margin: 9px 0 12px; }
.analysis-screen > p:not(.eyebrow) { font-size: 15px; color: var(--ink-2); line-height: 1.75; max-width: 36em; }
#agent-composer { margin-top: 26px; }
#agent-composer .message-composer { box-shadow: none; padding: 15px; border-radius: 14px; }
#agent-composer textarea { font-size: 14px; min-height: 70px; }
.activity-panel { position: sticky; top: 24px; border: 1px solid #e4e8ef; border-radius: 15px; overflow: hidden; background: #fff; }
.activity-heading { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 17px 18px 0; font-size: 13px; }
.activity-heading > div { display: flex; align-items: center; gap: 8px; }
.activity-spark { color: var(--accent); font-size: 20px; line-height: 1; }
.activity-state { font-size: 10px; color: #697385; background: #f2f4f8; padding: 3px 7px; border-radius: 5px; white-space: nowrap; }
.activity-state[data-state='running'] { color: var(--accent); background: #edf4ff; }
.activity-state[data-state='done'] { color: var(--ok); background: var(--ok-soft); }
.activity-state[data-state='error'] { color: var(--bad); background: var(--bad-soft); }
.activity-summary { font-size: 12px; color: #637086; margin: 12px 18px 17px; line-height: 1.65; }
.activity-feed { list-style: none; margin: 0; padding: 0 18px; max-height: 420px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.activity-entry { position: relative; padding: 2px 0 20px 19px; border-left: 1px solid #e3eaf6; margin-left: 3px; animation: activity-in .25s ease-out; }
.activity-entry::before { content: ''; position: absolute; top: 8px; left: -3px; width: 5px; height: 5px; background: #8cabdf; border-radius: 50%; box-shadow: 0 0 0 3px white; }
.activity-entry:last-child { border-left-color: transparent; }
.activity-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 9px; }
.activity-tool { font-weight: 600; color: #5b76a8; }
.activity-meta time { font: 9px var(--mono); color: #8992a1; white-space: nowrap; }
.activity-entry p { margin: 5px 0 0; font-size: 12px; color: #4f5a6b; line-height: 1.7; overflow-wrap: anywhere; }
.activity-entry.error::before { background: var(--warn); }
.activity-entry.error p { color: #97601f; }
.activity-entry.result::before { background: var(--ok); }
.activity-entry.result p { color: var(--ok); font-weight: 500; }
.activity-empty { color: #8790a0; font-size: 12px; padding: 8px 18px 24px; }
.activity-footer { display: flex; justify-content: space-between; padding: 12px 18px; font-size: 9px; color: #818b9b; border-top: 1px solid #edf0f5; background: #fcfdfe; }
.agent-case-facts:not(:empty) { padding: 12px 18px; border-top: 1px solid #edf0f5; }
.agent-fact { display: flex; align-items: center; justify-content: space-between; font-size: 11px; margin: 6px 0; color: var(--ink-2); }
.agent-fact b { color: var(--ink); font-variant-numeric: tabular-nums; }
.simulation-note { font-size: 10px; color: var(--ink-2); margin: 10px 0 2px; }
@keyframes activity-pulse { 50% { opacity: .4; } }
@keyframes activity-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 800px) {
  #patient-app:not(.landing) .agent-body { grid-template-columns: 1fr; gap: 24px; }
  .activity-panel { position: static; grid-row: 1; }
  .activity-feed { max-height: 190px; }
  .agent-heading h1 { font-size: 28px; }
  .agent-heading p:last-child { font-size: 13px; }
  .agent-brand-mark { width: 44px; height: 44px; font-size: 26px; }
  .analysis-screen { padding: 8px 0; }
  .request-file { max-width: 100px; }
}
@media (max-width: 520px) {
  #patient-app .hero { padding: 30px 0 42px; }
  #patient-app .hero h1 { font-size: 39px; }
  #patient-app .hero-sub { font-size: 15px; margin-top: 20px; }
  #home-composer { margin-top: 28px; }
  .message-composer { padding: 16px 14px 12px; }
  .message-composer textarea { font-size: 15px; }
  .composer-formats { display: none; }
  #patient-app:not(.landing) { padding: 22px 18px 60px; }
  .agent-brand-mark { display: none; }
  .request-card { flex-wrap: wrap; }
  .request-file { max-width: 100%; margin-left: 43px; }
  .journey { margin-bottom: 18px; }
  .agent-heading { margin-top: 23px; }
  #agent-content .row { flex-direction: column; }
  #agent-content .row .field { flex-basis: auto; }
  #agent-content .rung { padding: 12px 9px; }
  #agent-content .rung b { font-size: 18px; white-space: nowrap; }
  #agent-content .rung span { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
