:root {
  --app-blue: #2563eb;
  --app-blue-50: #eff6ff;
  --app-green: #16865c;
  --app-green-50: #edf9f4;
  --app-yellow: #b77907;
  --app-yellow-50: #fff8e6;
  --app-red: #d14343;
  --app-red-50: #fff1f1;
  --app-ai: var(--ai-600, #7043bd);
  --app-ai-dark: var(--ai-700, #5b32a3);
  --app-ai-50: var(--ai-50, #f8f5fd);
  --app-ai-100: var(--ai-100, #efe8fa);
  --app-ai-border: var(--ai-border, #d7c7ee);
  --app-border: #dde4ee;
  --app-text: #1d2939;
  --app-muted: #667085;
  --app-shadow: 0 3px 14px rgba(31, 42, 68, .06);
}

.app-adapter-shell { min-width: 0; }
.app-adapter-shell button { font-family: inherit; }
.app-page { padding-top: 18px; }
.app-page .page-heading { margin-bottom: 18px; }
.app-page .page-heading h1 { letter-spacing: -.02em; }
.app-page .page-heading p { max-width: 800px; }
.app-main-grid { align-items: start; }
.app-span-2 { grid-column: span 2; min-width: 0; }
.app-col-2 { grid-column: span 2; }

.app-console {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 45;
  width: min(860px, calc(100vw - 40px));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}
.app-toolbar {
  width: 100%;
  max-height: calc(100dvh - 110px);
  overflow-y: auto;
  padding: 16px;
  color: var(--app-text);
  background: rgba(255, 255, 255, .97);
  border: 1px solid var(--app-border);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(31, 42, 68, .14);
  backdrop-filter: blur(12px);
  visibility: hidden;
  opacity: 0;
  clip-path: inset(0 0 0 100% round 12px);
  transition: clip-path .24s ease, opacity .2s ease, visibility .24s;
}
.app-console.is-open .app-toolbar { visibility: visible; opacity: 1; clip-path: inset(-40px round 12px); pointer-events: auto; }
.app-console__heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-bottom: 12px; }
.app-console__heading strong { font-size: 15px; }
.app-console__heading span { color: var(--app-muted); font-size: 12px; }
.app-console__toggle { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px 15px; border: 1px solid var(--app-ai-border); border-radius: 24px; background: #fff; color: var(--app-ai-dark); box-shadow: 0 4px 16px rgba(31, 42, 68, .12); font-size: 13px; font-weight: 700; cursor: pointer; pointer-events: auto; }
.app-console__toggle:hover { background: var(--app-ai-50); }
.app-console__toggle small { font-size: 11px; font-weight: 500; color: var(--app-muted); }
.app-console__arrow { font-size: 24px; line-height: 16px; transition: transform .24s ease; }
.app-console.is-open .app-console__arrow { transform: rotate(180deg); }
.app-console button:focus-visible { outline: 2px solid var(--app-ai); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
  .app-toolbar, .app-console__arrow { transition: none; }
}
.app-toolbar__top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; min-height: 46px; }
.app-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.app-brand__mark { padding: 5px 7px; color: #fff; background: var(--app-ai); border-radius: 4px; font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.app-brand div { display: grid; gap: 2px; }
.app-brand strong { font-size: 14px; line-height: 1.2; }
.app-brand small { color: var(--app-muted); font-size: 11px; }
.app-engine-status { display: inline-flex; align-items: center; gap: 7px; flex: 0 0 auto; padding: 6px 9px; border: 1px solid var(--app-border); border-radius: 5px; color: var(--app-muted); background: #fff; font-size: 12px; }
.app-engine-status i { width: 8px; height: 8px; border-radius: 50%; background: #98a2b3; }
.app-engine-status.ready { color: #087553; border-color: #a9dfca; background: var(--app-green-50); }
.app-engine-status.ready i { background: #12a16f; box-shadow: 0 0 0 3px rgba(18, 161, 111, .12); }
.app-engine-status.warning { color: #9b6400; border-color: #efd390; background: var(--app-yellow-50); }
.app-engine-status.warning i { background: #d69211; }
.app-engine-status.offline { color: #b23434; border-color: #efb4b4; background: var(--app-red-50); }
.app-engine-status.offline i { background: var(--app-red); }
.app-engine-status.checking i { animation: app-pulse 1.2s infinite; }
.app-toolbar__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex-basis: 100%; }
.app-toolbar__actions .btn { min-height: 30px; white-space: nowrap; }
.app-toolbar__actions .danger { color: #b23434; }
.app-scenes { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-top: 12px; }
.app-scene { position: relative; display: grid; gap: 1px; padding: 8px 9px 9px; color: var(--app-muted); background: transparent; border: 0; border-bottom: 3px solid transparent; cursor: pointer; text-align: left; }
.app-scene::before { content: ''; position: absolute; top: 16px; left: -5px; width: 10px; border-top: 1px solid #d4dbe5; }
.app-scene:first-child::before { display: none; }
.app-scene span { color: #475467; font-size: 12px; font-weight: 700; }
.app-scene small { font-size: 11px; }
.app-scene:hover { background: #f7f9fc; }
.app-scene.active { color: var(--app-blue); background: var(--app-blue-50); border-bottom-color: var(--app-blue); }
.app-scene.active span { color: var(--app-blue); }
.app-scene.current::after { content: ''; position: absolute; top: 8px; right: 8px; width: 5px; height: 5px; border-radius: 50%; background: var(--app-ai); }
.app-toolbar.is-offline .app-scenes { opacity: .72; }

.app-offline { display: grid; grid-template-columns: max-content 1fr; align-items: center; gap: 5px 14px; margin: 18px 0; padding: 12px 14px; border: 1px solid #eab0b0; border-left: 4px solid var(--app-red); border-radius: 6px; background: var(--app-red-50); }
.app-offline span { grid-row: span 2; color: #a62e2e; font-weight: 800; }
.app-offline p, .app-offline small { margin: 0; }
.app-offline p { color: #674444; font-size: 13px; }
.app-offline small { color: #996c6c; font-size: 11px; }
.app-offline.is-render-error { border-color: #ead18f; border-left-color: #d69211; background: var(--app-yellow-50); }
.app-offline.is-render-error span { color: #8f5c00; }
.app-offline.is-render-error p { color: #64522f; }
.app-offline.is-render-error small { color: #8a744d; }

.app-metrics { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px; }
.app-metrics .metric-card { min-height: 96px; border-top: 3px solid #84a8e8; }
.app-metrics .metric-card.red { border-top-color: var(--app-red); }
.app-metrics .metric-card.orange { border-top-color: #d89114; }
.app-metrics .metric-card.green { border-top-color: var(--app-green); }
.app-metrics .metric-card.purple { border-top-color: var(--app-ai); }
.app-metrics .metric-card strong { font-variant-numeric: tabular-nums; }

.app-patient-strip { display: grid; grid-template-columns: auto minmax(210px, 1.25fr) 3fr; align-items: center; gap: 14px; margin-bottom: 16px; padding: 14px 16px; }
.app-avatar { display: grid; place-items: center; width: 44px; height: 44px; color: #fff; background: #4e77bf; border-radius: 7px; font-size: 18px; font-weight: 800; }
.app-patient-main { display: grid; gap: 4px; min-width: 0; }
.app-patient-main strong { color: var(--app-text); font-size: 16px; }
.app-patient-main strong small { color: var(--app-muted); font-size: 12px; font-weight: 500; }
.app-patient-main span { overflow: hidden; color: var(--app-muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.app-patient-strip dl { display: grid; grid-template-columns: repeat(5, minmax(90px, 1fr)); gap: 10px; margin: 0; }
.app-patient-strip dl > div { padding-left: 10px; border-left: 1px solid var(--app-border); }
.app-patient-strip dt { margin-bottom: 5px; color: var(--app-muted); font-size: 11px; }
.app-patient-strip dd { margin: 0; color: var(--app-text); font-size: 13px; font-weight: 650; }

.app-storyline { display: grid; grid-template-columns: repeat(7, 1fr); padding: 12px 2px 4px; }
.app-storyline button { position: relative; display: grid; justify-items: center; gap: 4px; color: var(--app-muted); background: transparent; border: 0; cursor: pointer; }
.app-storyline button::after { content: ''; position: absolute; top: 14px; left: calc(50% + 18px); right: calc(-50% + 18px); border-top: 2px solid #dbe2ec; }
.app-storyline button:last-child::after { display: none; }
.app-storyline i { z-index: 1; display: grid; place-items: center; width: 28px; height: 28px; color: #667085; background: #f2f4f7; border: 2px solid #d0d5dd; border-radius: 50%; font-style: normal; font-weight: 700; }
.app-storyline strong { font-size: 12px; }
.app-storyline small { font-size: 10px; }
.app-storyline button.active i { color: #fff; background: var(--app-blue); border-color: var(--app-blue); box-shadow: 0 0 0 4px var(--app-blue-50); }
.app-storyline button.active strong { color: var(--app-blue); }

.app-item-list, .app-alert-list, .app-run-events { margin: 0; list-style: none; }
.app-item-list { padding: 0 14px; }
.app-alert-list { padding: 12px 14px 6px; }
.app-item-list li { display: flex; align-items: center; gap: 9px; padding: 10px 0; border-bottom: 1px solid #edf0f5; }
.app-item-list li:last-child { border-bottom: 0; }
.app-item-list li > i { display: grid; place-items: center; width: 20px; height: 20px; color: #ae7411; background: #fff6dd; border: 1px solid #ead18f; border-radius: 50%; font-style: normal; }
.app-item-list li > i.done { color: #087553; background: #e9f8f2; border-color: #acdcca; }
.app-item-list li > div { display: grid; flex: 1; gap: 3px; min-width: 0; }
.app-item-list strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.app-item-list small { color: var(--app-muted); font-size: 11px; }
.app-item-list .text-link { flex: 0 0 auto; }

.app-alert-list li { display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 9px; padding: 10px; margin-bottom: 8px; border: 1px solid #f0d9a3; border-left: 3px solid #d69211; border-radius: 5px; background: var(--app-yellow-50); }
.app-alert-list li.red { border-color: #efc4c4; border-left-color: var(--app-red); background: var(--app-red-50); }
.app-alert-list li.green { border-color: #b6dfcf; border-left-color: var(--app-green); background: var(--app-green-50); }
.app-alert-list li > i { display: grid; place-items: center; width: 20px; height: 20px; color: #fff; background: #d69211; border-radius: 3px; font-style: normal; font-weight: 800; }
.app-alert-list li.red > i { background: var(--app-red); }
.app-alert-list li.green > i { background: var(--app-green); }
.app-alert-list strong { font-size: 13px; }
.app-alert-list p { margin: 3px 0; color: #5d4a2a; font-size: 12px; }
.app-alert-list small { color: var(--app-muted); font-size: 10px; }
.app-message-preview { margin-top: 12px; padding: 10px; border: 1px solid var(--app-ai-border); border-radius: 5px; background: var(--app-ai-50); }
.app-message-preview span { color: var(--app-ai-dark); font-size: 11px; font-weight: 700; }
.app-message-preview p { margin: 5px 0 0; color: #43365d; font-size: 12px; }

.app-run-panel { overflow: hidden; padding: 0 !important; border-color: var(--app-ai-border) !important; background: #fff !important; box-shadow: var(--app-shadow); }
.app-ai-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 16px 12px; background: var(--app-ai-50); border-bottom: 1px solid #eee8f6; }
.app-ai-head > div { display: grid; gap: 8px; min-width: 0; }
.app-ai-head h2 { margin: 0; color: var(--app-ai-dark); font-size: 16px; }
.app-agent-name { display: inline-flex; align-items: center; gap: 6px; color: var(--app-ai-dark); font-size: 12px; font-weight: 600; }
.app-agent-name i { font-size: 13px; font-style: normal; }
.app-ai-brief { padding: 12px 16px 16px; }
.app-ai-brief p { margin: 0 0 10px; color: #475467; font-size: 12px; line-height: 1.7; }
.app-ai-brief small { color: var(--app-muted); font-size: 11px; }
.app-ai-query { display: grid; gap: 6px; margin: 0 16px 14px; color: #475467; font-size: 12px; }
.app-ai-query textarea { width: 100%; min-height: 88px; resize: vertical; font: inherit; line-height: 1.6; }
.app-run-panel { min-width: 0; align-self: start; }
.app-run-panel .app-ai-head .tag { white-space: nowrap; }
.app-ai-wait { margin: 0 16px 14px; color: var(--app-muted); font-size: 12px; line-height: 1.6; }
.app-ai-availability { display: block; margin: -4px 16px 14px; color: var(--app-muted); font-size: 11px; line-height: 1.6; }
.app-ai-availability[hidden] { display: none; }
.app-run-details { border-top: 1px solid #eee8f6; }
.app-run-details summary { padding: 10px 16px; color: var(--app-muted); font-size: 11px; cursor: pointer; }
.app-run-question { margin: 10px 14px; color: var(--app-muted); font-size: 11px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.app-run-panel button:focus-visible, .app-run-details summary:focus-visible { outline: 2px solid var(--app-ai); outline-offset: -3px; }
.app-ai-empty { display: grid; justify-items: center; gap: 8px; padding: 28px 18px 20px; text-align: center; }
.app-ai-empty > span { display: grid; place-items: center; width: 46px; height: 46px; color: #fff; background: var(--app-ai); border-radius: 8px; font-size: 15px; font-weight: 800; }
.app-ai-empty p { margin: 0; color: var(--app-muted); font-size: 12px; line-height: 1.65; }
.app-run-panel > .btn-block { width: calc(100% - 30px); margin: 0 15px 14px; }
.app-ai-disclaimer { display: block; padding: 9px 14px; color: #786b8f; background: var(--app-ai-50); border-top: 1px solid var(--app-ai-border); font-size: 10px; line-height: 1.5; }
.app-run-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; padding: 9px 14px; color: var(--app-muted); background: #fcfbfe; border-bottom: 1px solid #eee8f6; font-size: 10px; overflow-wrap: anywhere; }
.app-run-pulse { display: flex; align-items: center; gap: 8px; margin: 12px 14px 4px; padding: 9px 10px; color: var(--app-ai-dark); background: var(--app-ai-50); border: 1px solid var(--app-ai-border); border-radius: 5px; font-size: 11px; }
.app-run-pulse i { width: 8px; height: 8px; border-radius: 50%; background: var(--app-ai); animation: app-pulse 1.05s infinite; }
.app-run-events { padding: 10px 14px; }
.app-run-event { display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 8px; padding: 8px 0; border-bottom: 1px solid #efeaf6; }
.app-run-event:last-child { border-bottom: 0; }
.app-run-event > i { display: grid; place-items: center; width: 20px; height: 20px; color: var(--app-ai-dark); background: var(--app-ai-100); border-radius: 50%; font-size: 10px; font-style: normal; font-weight: 800; }
.app-run-event > div { display: grid; gap: 3px; }
.app-run-event strong { color: #45375f; font-size: 11px; }
.app-run-event span, .app-run-event small { color: var(--app-muted); font-size: 10px; line-height: 1.45; }
.app-run-result { display: grid; gap: 12px; margin: 0 14px 14px; padding: 12px; color: #3f3550; background: var(--app-ai-50); border: 1px solid var(--app-ai-border); border-radius: 5px; }
.app-run-result h4 { margin: 0 0 6px; color: var(--app-ai-dark); font-size: 12px; }
.app-run-result ul, .app-run-result ol { display: grid; gap: 4px; margin: 0; padding-left: 18px; font-size: 11px; line-height: 1.5; }
.app-result-summary span { color: var(--app-ai-dark); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.app-result-summary p { margin: 5px 0 0; font-size: 12px; line-height: 1.65; }
.app-evidence { display: flex; flex-wrap: wrap; gap: 6px; }
.app-evidence h4 { flex-basis: 100%; }
.app-evidence span { padding: 4px 7px; color: var(--app-ai-dark); background: #fff; border: 1px solid var(--app-ai-border); border-radius: 4px; font-size: 10px; }
.app-result-warnings { padding: 8px; color: #8c5b03; background: var(--app-yellow-50); border-left: 3px solid #d69211; }
.app-result-warnings strong { font-size: 11px; }
.app-result-warnings p { margin: 4px 0 0; font-size: 10px; }
.app-run-error { margin: 0 14px 14px; padding: 12px; color: #9d3434; background: var(--app-red-50); border: 1px solid #efbbbb; border-radius: 5px; }
.app-run-error p { margin: 5px 0 9px; font-size: 11px; }
.app-run-error.muted { color: var(--app-muted); background: #f7f8fa; border-color: var(--app-border); }

.app-proposal { margin: 0 14px 14px; padding: 12px; border: 1px solid var(--app-ai-border); border-left: 4px solid var(--app-ai); border-radius: 5px; background: #fff; }
.app-proposal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.app-proposal__head > div { display: grid; gap: 5px; }
.app-proposal__head h4 { margin: 0; color: var(--app-text); font-size: 12px; }
.app-proposal__actions { display: grid; gap: 8px; }
.app-proposal__actions article { display: grid; gap: 6px; padding: 9px; background: var(--app-ai-50); border: 1px solid #e8ddf5; border-radius: 4px; }
.app-proposal__actions label { display: grid; gap: 4px; color: var(--app-muted); font-size: 10px; }
.app-proposal__actions article > span { color: var(--app-ai-dark); font-family: ui-monospace, Consolas, monospace; font-size: 10px; }
.app-proposal__actions .input { min-height: 32px; font-size: 11px; }
.app-proposal__footer { display: flex; justify-content: flex-end; gap: 7px; margin-top: 10px; }
.app-proposal > small { display: block; margin-top: 8px; color: var(--app-muted); font-size: 9px; line-height: 1.45; }
.app-proposal.is-loading, .app-proposal.is-confirmed, .app-proposal.is-rejected, .app-proposal.is-stale { display: grid; gap: 4px; color: var(--app-muted); font-size: 11px; }

.app-search-panel { margin-bottom: 14px; padding: 14px; }
.app-search-box { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; }
.app-search-box > span { color: #667085; font-size: 22px; }
.app-search-box .input { min-width: 0; }
.app-filter-chips { display: flex; gap: 6px; margin-top: 10px; }
.app-filter-chips button { padding: 5px 10px; color: var(--app-muted); background: #fff; border: 1px solid var(--app-border); border-radius: 4px; cursor: pointer; font-size: 12px; }
.app-filter-chips button.active { color: var(--app-blue); background: var(--app-blue-50); border-color: #9cb9ea; }
.app-page .data-table tr.selected { background: var(--app-blue-50); }
.app-page .data-table td small { display: block; margin-top: 3px; color: var(--app-muted); font-size: 10px; }
.app-table-empty { padding: 26px !important; color: var(--app-muted); text-align: center; }
.app-selection-note { display: flex; align-items: center; gap: 14px; margin-top: 14px; padding: 12px 14px; border-left: 4px solid var(--app-blue); }
.app-selection-note span { color: var(--app-muted); font-size: 12px; }

.app-steps { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 15px; padding: 12px 16px; background: #fff; border: 1px solid var(--app-border); border-radius: 6px; }
.app-steps button { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--app-muted); background: transparent; border: 0; cursor: pointer; }
.app-steps button::after { content: ''; position: absolute; top: 50%; left: calc(50% + 58px); right: calc(-50% + 20px); border-top: 1px solid #d6dde7; }
.app-steps button:last-child::after { display: none; }
.app-steps i { z-index: 1; display: grid; place-items: center; width: 24px; height: 24px; background: #f2f4f7; border: 1px solid #cdd5df; border-radius: 50%; font-size: 11px; font-style: normal; }
.app-steps span { font-size: 12px; font-weight: 650; }
.app-steps button.active { color: var(--app-blue); }
.app-steps button.active i { color: #fff; background: var(--app-blue); border-color: var(--app-blue); }
.app-steps button.done i { color: #fff; background: var(--app-green); border-color: var(--app-green); }
.app-form .panel-head { margin-bottom: 14px; }
.app-form .form-grid { padding: 0 16px; }
.app-form-actions { display: flex; justify-content: flex-end; gap: 8px; margin: 18px 14px 0; padding: 13px 0 14px; border-top: 1px solid var(--app-border); }
.app-human-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.panel > .app-human-grid, .panel > .app-resource-grid, .panel > .app-path-cards { margin: 0 14px; }
.app-human-grid article { display: grid; gap: 9px; padding: 14px; background: #fafbfc; border: 1px solid var(--app-border); border-radius: 5px; }
.app-human-grid article > span { color: var(--app-text); font-size: 13px; font-weight: 750; }
.app-human-grid article > small { color: var(--app-muted); font-size: 10px; }
.app-tone-selector { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.app-tone-selector button { min-height: 34px; color: #475467; background: #fff; border: 1px solid #d8dee8; border-radius: 4px; cursor: pointer; font-size: 12px; }
.app-tone-selector button:hover { border-color: #98a2b3; }
.app-tone-selector .tone-green.active { color: #087553; background: var(--app-green-50); border-color: #73c2a5; box-shadow: inset 0 -2px 0 var(--app-green); }
.app-tone-selector .tone-yellow.active { color: #946000; background: var(--app-yellow-50); border-color: #e4bd62; box-shadow: inset 0 -2px 0 #d69211; }
.app-tone-selector .tone-red.active { color: #ae3333; background: var(--app-red-50); border-color: #e79797; box-shadow: inset 0 -2px 0 var(--app-red); }
.app-resource-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.app-resource-card { display: grid; gap: 7px; padding: 14px; border: 1px solid var(--app-border); border-radius: 5px; background: #fff; }
.app-resource-card.selected { border-color: #8eadde; box-shadow: inset 3px 0 0 var(--app-blue); }
.app-resource-card > span { color: var(--app-blue); font-size: 10px; font-weight: 700; }
.app-resource-card h3, .app-resource-card p { margin: 0; }
.app-resource-card h3 { font-size: 13px; }
.app-resource-card p, .app-resource-card small { color: var(--app-muted); font-size: 11px; line-height: 1.5; }
.app-path-cards { display: grid; gap: 10px; }
.app-path-cards article { padding: 14px; border: 1px solid var(--app-border); border-radius: 5px; }
.app-path-cards article.active { border-color: #8eadde; background: var(--app-blue-50); box-shadow: inset 3px 0 0 var(--app-blue); }
.app-path-cards article > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.app-path-cards h3 { margin: 0; font-size: 14px; }
.app-path-cards span { color: var(--app-blue); font-size: 10px; font-weight: 700; }
.app-path-cards p { color: var(--app-muted); font-size: 11px; }
.app-mini-timeline { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.app-mini-timeline i { padding: 6px; color: #526174; background: #fff; border: 1px solid #d5deea; border-radius: 3px; font-size: 10px; font-style: normal; text-align: center; }

.app-records { display: grid; padding: 0 14px; }
.app-records article { display: grid; grid-template-columns: 120px 1fr; gap: 14px; padding: 11px 0; border-bottom: 1px solid #edf0f5; }
.app-records article > span { color: var(--app-muted); font-size: 11px; }
.app-records strong { font-size: 13px; }
.app-records p { margin: 4px 0 0; color: #526174; font-size: 11px; line-height: 1.55; }
.app-empty { display: grid; justify-items: center; gap: 4px; padding: 24px 16px; color: var(--app-muted); text-align: center; }
.app-empty.compact { padding: 14px 10px; }
.app-empty strong { color: #475467; font-size: 13px; }
.app-empty p { margin: 0; font-size: 11px; }

.app-channel-panel { padding: 14px; }
.app-channel-tabs { display: flex; gap: 3px; margin: -14px -14px 12px; padding: 0 14px; border-bottom: 1px solid var(--app-border); }
.app-channel-tabs button { padding: 11px 14px 9px; color: var(--app-muted); background: transparent; border: 0; border-bottom: 3px solid transparent; cursor: pointer; font-size: 12px; }
.app-channel-tabs button.active { color: var(--app-blue); border-bottom-color: var(--app-blue); font-weight: 700; }
.app-chat-log { display: grid; align-content: start; gap: 12px; min-height: 310px; max-height: 470px; padding: 14px; overflow-y: auto; background: #f7f9fc; border: 1px solid #e5eaf1; border-radius: 5px; }
.app-chat-log article { display: flex; max-width: 72%; }
.app-chat-log article.outgoing { justify-self: end; }
.app-chat-log article > div { display: grid; gap: 4px; }
.app-chat-log span, .app-chat-log small { color: var(--app-muted); font-size: 10px; }
.app-chat-log article.outgoing span, .app-chat-log article.outgoing small { text-align: right; }
.app-chat-log p { margin: 0; padding: 9px 11px; color: #344054; background: #fff; border: 1px solid #dfe5ee; border-radius: 3px 7px 7px 7px; font-size: 12px; line-height: 1.65; }
.app-chat-log article.outgoing p { color: #174a94; background: var(--app-blue-50); border-color: #b9cdec; border-radius: 7px 3px 7px 7px; }
.app-compose { display: grid; gap: 8px; margin-top: 10px; }
.app-compose textarea { resize: vertical; }
.app-compose > div { display: flex; align-items: center; justify-content: space-between; }
.app-compose small { color: var(--app-muted); font-size: 10px; }
.app-sms-preview { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 14px; margin-bottom: 14px; padding: 16px; background: #f7f9fc; border: 1px solid var(--app-border); border-radius: 5px; }
.app-sms-preview > span { color: var(--app-muted); font-size: 11px; }
.app-sms-preview > div { padding: 14px; background: #fff; border: 1px solid #dbe2eb; border-radius: 7px; box-shadow: var(--app-shadow); }
.app-sms-preview p { color: #344054; font-size: 12px; line-height: 1.7; }
.app-sms-preview small { color: var(--app-muted); font-size: 10px; }
.app-call { display: grid; gap: 15px; padding: 18px; background: #f7f9fc; border: 1px solid var(--app-border); border-radius: 5px; }
.app-call__person { display: flex; align-items: center; gap: 10px; }
.app-call__person > span { display: grid; place-items: center; width: 42px; height: 42px; color: #fff; background: var(--app-blue); border-radius: 50%; font-weight: 800; }
.app-call__person > div { display: grid; flex: 1; gap: 3px; }
.app-call__person small { color: var(--app-muted); font-size: 10px; }
.app-wave { display: flex; align-items: center; justify-content: center; gap: 3px; height: 58px; padding: 0 12px; background: #fff; border: 1px solid #e1e6ee; border-radius: 4px; }
.app-wave i { width: 3px; min-height: 5px; background: #7198d6; border-radius: 2px; opacity: .75; }
.app-call__controls { display: flex; justify-content: center; gap: 8px; }
.app-transcript { display: grid; gap: 9px; margin-top: 12px; }
.app-transcript .panel-head { min-height: 0; margin: 0; padding: 0 0 7px; border: 0; }
.app-last-record { margin-top: 10px; padding: 8px 10px; color: #087553; background: var(--app-green-50); border: 1px solid #b7dece; font-size: 11px; }

.app-alert-cards { display: grid; gap: 9px; }
.panel > .app-alert-cards, .panel > .app-thresholds { margin: 12px 14px 14px; }
.app-alert-cards article { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px; padding: 12px; background: var(--app-yellow-50); border: 1px solid #ecd18f; border-left: 4px solid #d69211; border-radius: 5px; }
.app-alert-cards article.red { background: var(--app-red-50); border-color: #edb8b8; border-left-color: var(--app-red); }
.app-alert-cards article.green { background: var(--app-green-50); border-color: #b9ddce; border-left-color: var(--app-green); }
.app-alert-cards article.closed { opacity: .65; background: #f7f8fa; border-color: #d9dee6; }
.app-alert-level { display: grid; place-items: center; width: 32px; height: 32px; color: #fff; background: #d69211; border-radius: 4px; font-size: 12px; font-weight: 800; }
.app-alert-cards article.red .app-alert-level { background: var(--app-red); }
.app-alert-cards article.green .app-alert-level { background: var(--app-green); }
.app-alert-cards article > div:nth-child(2) > div { display: flex; align-items: center; gap: 8px; }
.app-alert-cards strong { font-size: 13px; }
.app-alert-cards p { margin: 4px 0; color: #5d4a2a; font-size: 11px; }
.app-alert-cards small { color: var(--app-muted); font-size: 10px; }
.app-alert-actions { display: grid; gap: 6px; width: 245px; }
.app-alert-actions label { display: grid; gap: 3px; color: var(--app-muted); font-size: 10px; }
.app-alert-actions .input { min-height: 32px; font-size: 11px; }
.app-alert-actions .btn { justify-self: end; }
.app-thresholds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.app-thresholds label { display: grid; gap: 5px; color: var(--app-muted); font-size: 11px; }

.app-agent-network { overflow: hidden; }
.app-network { position: relative; display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; min-height: 330px; padding: 20px 10px; }
.app-network::before { content: ''; position: absolute; inset: 50% 14%; border-top: 1px dashed #bba7dc; }
.app-network article { z-index: 1; display: grid; align-content: start; gap: 8px; padding: 13px; background: var(--app-ai-50); border: 1px solid var(--app-ai-border); border-radius: 5px; box-shadow: var(--app-shadow); }
.app-network article:nth-child(1), .app-network article:nth-child(2), .app-network article:nth-child(3) { grid-column: span 2; }
.app-network article:nth-child(4) { grid-column: 2 / span 2; }
.app-network article:nth-child(5) { grid-column: 4 / span 2; }
.app-network article > i { display: grid; place-items: center; width: 29px; height: 29px; color: #fff; background: var(--app-ai); border-radius: 5px; font-style: normal; font-weight: 800; }
.app-network article strong { color: var(--app-ai-dark); font-size: 13px; }
.app-network article p { margin: 5px 0; color: #5f5371; font-size: 10px; line-height: 1.45; }
.app-network article small { color: var(--app-muted); font-size: 9px; }
.app-network__hub { position: absolute; top: 50%; left: 50%; z-index: 2; display: grid; place-items: center; width: 62px; height: 62px; transform: translate(-50%, -50%); color: #fff; background: var(--app-ai-dark); border: 6px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px var(--app-ai-border); font-size: 11px; font-weight: 800; text-align: center; }
.app-consult-question { display: flex; align-items: center; gap: 16px; padding: 14px; background: var(--app-ai-50); border-left: 4px solid var(--app-ai); }
.app-consult-question p { flex: 1; margin: 0; color: #514565; font-size: 12px; line-height: 1.6; }
.app-governance { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.panel > .app-governance { margin: 14px; }
.app-governance > div { display: grid; gap: 5px; padding: 12px; border: 1px solid var(--app-border); border-radius: 4px; }
.app-governance strong { font-size: 12px; }
.app-governance span { color: var(--app-muted); font-size: 10px; line-height: 1.45; }

.app-education-layout { display: grid; grid-template-columns: .85fr 1.15fr; gap: 14px; }
.panel > .app-education-layout { margin: 14px; }
.app-material-list { display: grid; align-content: start; gap: 8px; }
.app-material-list article { display: grid; grid-template-columns: auto 1fr; gap: 9px; padding: 10px; border: 1px solid var(--app-border); border-radius: 4px; }
.app-material-list article > span { align-self: start; padding: 3px 5px; color: var(--app-blue); background: var(--app-blue-50); border-radius: 3px; font-size: 9px; }
.app-material-list h3, .app-material-list p { margin: 0; }
.app-material-list h3 { font-size: 12px; }
.app-material-list p { margin-top: 4px; color: var(--app-muted); font-size: 10px; line-height: 1.45; }
.app-education-preview { display: grid; align-content: start; gap: 9px; padding: 14px; background: var(--app-ai-50); border: 1px solid var(--app-ai-border); border-top: 4px solid var(--app-ai); border-radius: 5px; }
.app-education-preview h3 { margin: 0; color: var(--app-ai-dark); font-size: 14px; }
.app-education-preview textarea { background: #fff; line-height: 1.7; resize: vertical; }
.app-education-preview > small { color: var(--app-muted); font-size: 10px; }

.app-closure-checks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.panel > .app-closure-checks { margin: 14px; }
.app-closure-checks article { display: flex; align-items: center; gap: 10px; padding: 13px; background: #fafbfc; border: 1px solid var(--app-border); border-radius: 5px; }
.app-closure-checks i { display: grid; place-items: center; width: 28px; height: 28px; color: #fff; background: var(--app-green); border-radius: 50%; font-style: normal; font-weight: 800; }
.app-closure-checks div { display: grid; gap: 3px; }
.app-closure-checks strong { font-size: 12px; }
.app-closure-checks span { color: var(--app-muted); font-size: 10px; }
.app-close-action { display: grid; gap: 9px; margin: 15px 14px 0; padding: 13px 0 14px; border-top: 1px solid var(--app-border); }
.app-close-action label { display: grid; gap: 5px; color: var(--app-muted); font-size: 11px; }
.app-close-action .btn { justify-self: end; }

.app-bars { display: grid; gap: 11px; }
.panel > .app-bars { margin: 14px; }
.app-nl-query { display: grid; grid-template-columns: max-content 1fr max-content; align-items: center; gap: 10px; margin-bottom: 16px; padding: 12px 14px; background: var(--app-ai-50); border: 1px solid var(--app-ai-border); border-left: 4px solid var(--app-ai); border-radius: 5px; }
.app-nl-query .input { min-width: 0; background: #fff; border-color: var(--app-ai-border); }
.app-nl-query .input:focus { border-color: var(--app-ai); box-shadow: 0 0 0 3px rgba(112, 67, 189, .1); }
.app-bars > div { display: grid; grid-template-columns: 100px 1fr 60px; align-items: center; gap: 10px; }
.app-bars span, .app-bars b { font-size: 11px; }
.app-bars b { color: var(--app-muted); text-align: right; }
.app-bars i { position: relative; height: 9px; overflow: hidden; background: #edf0f5; border-radius: 3px; }
.app-bars i::after { content: ''; display: block; width: var(--value); height: 100%; background: linear-gradient(90deg, #7c55bd, var(--app-ai)); }
.app-donut-card { display: flex; align-items: center; justify-content: center; gap: 18px; }
.app-donut-card, .app-event-card { padding: 16px; }
.app-donut { position: relative; display: grid; place-items: center; width: 116px; height: 116px; border-radius: 50%; background: conic-gradient(var(--app-ai) calc(var(--done) * 1%), #ebe7f1 0); }
.app-donut::after { content: ''; position: absolute; inset: 15px; background: #fff; border-radius: 50%; }
.app-donut strong, .app-donut span { z-index: 1; }
.app-donut strong { margin-top: 18px; color: var(--app-ai-dark); font-size: 21px; }
.app-donut span { align-self: start; color: var(--app-muted); font-size: 9px; }
.app-event-stream { display: grid; gap: 8px; margin-top: 10px; }
.app-event-stream div { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid #edf0f5; }
.app-event-stream i { width: 7px; height: 7px; background: var(--app-blue); border-radius: 50%; }
.app-event-stream span { font-size: 11px; }
.app-event-stream small { color: var(--app-muted); font-size: 9px; }

.app-resource-wrapper { position: relative; }
.app-resource-side { display: grid; align-content: start; gap: 14px; min-width: 0; }
@media (min-width: 1200px) {
  .app-resource-wrapper .resource-layout,
  .app-resource-wrapper .knowledge-layout { grid-template-columns: 160px minmax(0, 1fr) 300px; }
  .app-resource-wrapper .resource-layout > .app-run-panel,
  .app-resource-wrapper .knowledge-layout > .app-run-panel { grid-column: auto; }
}
.app-resource-dock { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 16px 20px; padding: 13px 15px !important; border-color: var(--app-ai-border) !important; background: var(--app-ai-50) !important; }
.app-resource-dock > div:first-child { display: grid; grid-template-columns: max-content 1fr; align-items: center; gap: 4px 10px; }
.app-resource-dock p { grid-column: 2; margin: 0; color: #675979; font-size: 11px; }
.app-resource-dock strong { color: var(--app-ai-dark); font-size: 13px; }
.app-resource-dock > div:last-child { display: flex; gap: 7px; }
.app-resource-wrapper > .app-run-panel { width: min(430px, calc(100% - 40px)); margin: 0 20px 20px auto; }

.app-page button.is-loading { cursor: wait; opacity: .72; }
.app-page button:disabled, .app-toolbar button:disabled { cursor: not-allowed; opacity: .55; }

@keyframes app-pulse {
  0%, 100% { opacity: .45; transform: scale(.85); }
  50% { opacity: 1; transform: scale(1.15); }
}

@media (max-width: 1450px) {
  .app-patient-strip { grid-template-columns: auto 1fr; }
  .app-patient-strip dl { grid-column: 1 / -1; }
  .app-metrics { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
}

@media (max-width: 1120px) {
  .app-main-grid { grid-template-columns: 1fr !important; }
  .app-span-2 { grid-column: auto; }
  .app-metrics { grid-template-columns: repeat(3, 1fr); }
  .app-human-grid, .app-thresholds { grid-template-columns: 1fr; }
  .app-patient-strip dl { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 760px) {
  .app-console { right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); width: calc(100vw - 24px); }
  .app-scenes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .app-scene::before { display: none; }
  .app-metrics { grid-template-columns: repeat(2, 1fr); }
  .app-patient-strip dl, .app-resource-grid, .app-education-layout, .app-closure-checks { grid-template-columns: 1fr; }
  .app-storyline { overflow-x: auto; grid-template-columns: repeat(7, minmax(90px, 1fr)); }
  .app-steps { overflow-x: auto; grid-template-columns: repeat(4, minmax(125px, 1fr)); }
  .app-form .form-grid, .app-form .form-grid.cols-2 { grid-template-columns: 1fr; }
  .app-col-2 { grid-column: auto; }
  .app-chat-log article { max-width: 92%; }
  .app-network { grid-template-columns: 1fr; }
  .app-network article, .app-network article:nth-child(n) { grid-column: auto; }
  .app-network__hub, .app-network::before { display: none; }
  .app-governance { grid-template-columns: 1fr; }
  .app-alert-cards article { grid-template-columns: auto 1fr; }
  .app-alert-cards article > button { grid-column: 2; justify-self: start; }
  .app-alert-actions { grid-column: 2; width: 100%; }
  .app-bars > div { grid-template-columns: 80px 1fr 52px; }
  .app-nl-query { grid-template-columns: 1fr; }
  .app-resource-dock { align-items: stretch; flex-direction: column; }
}
