:root {
  color-scheme: light;
  --bg: #f2f6f4;
  --surface: #ffffff;
  --surface-2: #eaf2ee;
  --surface-3: #f8faf9;
  --text: #17342c;
  --muted: #657a73;
  --primary: #0b6b50;
  --primary-strong: #074b39;
  --primary-soft: #dcefe7;
  --border: #d7e2dd;
  --code-bg: #102a23;
  --code-text: #ddfff1;
  --shadow: 0 18px 55px rgba(16, 64, 49, .09);
  --low: #1d7242;
  --low-bg: #e2f5e9;
  --medium: #916400;
  --medium-bg: #fff2c7;
  --high: #a64a16;
  --high-bg: #ffe8d7;
  --critical: #ae241b;
  --critical-bg: #fee5e2;
  --task: #0b6b50;
  --command: #245ea8;
  --concept: #7751b7;
  --trouble: #b04b1e;
  --path: #987000;
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1714;
  --surface: #14231e;
  --surface-2: #1a2f28;
  --surface-3: #10201a;
  --text: #e8f5ef;
  --muted: #9bb1a8;
  --primary: #55c99e;
  --primary-strong: #8de0c0;
  --primary-soft: #1b4033;
  --border: #29443a;
  --code-bg: #07120f;
  --code-text: #d8fff0;
  --shadow: 0 18px 55px rgba(0, 0, 0, .28);
  --low: #73d296;
  --low-bg: #183a27;
  --medium: #f1cb62;
  --medium-bg: #3d3318;
  --high: #f2a16e;
  --high-bg: #402719;
  --critical: #ff9189;
  --critical-bg: #401e1d;
  --task: #55c99e;
  --command: #7db5ff;
  --concept: #b69aef;
  --trouble: #f2a16e;
  --path: #f1cb62;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 90% 0, color-mix(in srgb, var(--primary) 15%, transparent), transparent 28%),
    var(--bg);
  color: var(--text);
  font-family: Tahoma, Arial, "Segoe UI", sans-serif;
  line-height: 1.7;
  transition: background-color .2s ease, color .2s ease;
}
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 35%, transparent);
  outline-offset: 2px;
}
code, kbd { direction: ltr; unicode-bidi: embed; font-family: Consolas, "Courier New", monospace; }
mark { padding: 0 .12em; border-radius: 4px; background: #ffe58a; color: #302600; }
html[data-theme="dark"] mark { background: #685711; color: #fff4b5; }
[hidden] { display: none !important; }

.skip-link { position: fixed; top: 10px; right: 10px; z-index: 10000; padding: 8px 14px; border-radius: 8px; background: var(--primary); color: #fff; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
.app-shell { width: min(1500px, calc(100% - 32px)); margin: 0 auto; }

.topbar { min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.brand__terminal { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: var(--primary); color: #fff; direction: ltr; font-family: Consolas, monospace; font-weight: 800; box-shadow: 0 10px 25px color-mix(in srgb, var(--primary) 25%, transparent); }
.brand strong, .brand small { display: block; }
.brand small { margin-top: 1px; color: var(--muted); font-size: .76rem; }
.topbar__actions { display: flex; align-items: center; gap: 9px; }
.toolbar-button, .icon-button, .dialog-action, .reset-button, .primary-button, .load-more-button, .open-entity-button, .quick-action-button, .text-button {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.toolbar-button { min-height: 43px; display: flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: 12px; }
.toolbar-button b { min-width: 22px; height: 22px; display: grid; place-items: center; border-radius: 999px; background: var(--primary-soft); color: var(--primary-strong); font-size: .74rem; }
.icon-button { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 12px; font-size: 1.15rem; }
.toolbar-button:hover, .icon-button:hover, .dialog-action:hover, .text-button:hover { border-color: var(--primary); background: var(--primary-soft); }
.icon-button.is-active { border-color: var(--primary); color: var(--primary-strong); background: var(--primary-soft); }

.hero {
  min-height: 390px;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .55fr);
  align-items: center;
  gap: 36px;
  padding: 48px;
  position: relative;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, rgba(5, 57, 42, .99), rgba(10, 112, 82, .95)), var(--primary);
  color: #fff;
  box-shadow: var(--shadow);
  overflow: visible;
}
.hero::before { content: ""; position: absolute; inset: auto auto -130px -120px; width: 330px; height: 330px; border: 55px solid rgba(255,255,255,.05); border-radius: 50%; pointer-events: none; }
.hero__content, .hero__stats { position: relative; z-index: 2; }
.hero__eyebrow { display: inline-block; color: #b9edd9; font-size: .78rem; font-weight: 800; letter-spacing: .03em; }
.hero h1 { max-width: 900px; margin: 7px 0 10px; font-size: clamp(1.8rem, 3.5vw, 3rem); line-height: 1.18; }
.hero p { max-width: 830px; margin: 0; color: rgba(255,255,255,.8); font-size: 1.02rem; }
.search-wrapper { position: relative; max-width: 940px; margin-top: 26px; }
.search-box { min-height: 70px; display: flex; align-items: center; gap: 12px; padding: 0 14px 0 11px; border: 3px solid transparent; border-radius: 18px; background: #fff; color: #17342c; box-shadow: 0 18px 35px rgba(0,0,0,.16); transition: .18s ease; }
.search-box:focus-within { border-color: #8de0c0; box-shadow: 0 18px 40px rgba(0,0,0,.22); }
.search-box__icon { font-size: 1.7rem; color: #0b6b50; transform: rotate(-15deg); }
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: #17342c; font-size: 1.05rem; }
.search-box input::placeholder { color: #758a82; }
.search-box kbd { padding: 4px 8px; border: 1px solid #d6e1dd; border-bottom-width: 2px; border-radius: 7px; background: #f2f5f4; color: #64766f; font-size: .72rem; white-space: nowrap; }
.clear-button { width: 35px; height: 35px; border: 0; border-radius: 50%; background: #e7efec; color: #26483e; font-size: 1.45rem; line-height: 1; }
.suggestions { position: absolute; z-index: 100; top: calc(100% + 8px); right: 0; left: 0; max-height: 390px; overflow-y: auto; padding: 8px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: 0 22px 55px rgba(0,0,0,.2); }
.suggestion { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 11px 12px; border: 0; border-radius: 11px; background: transparent; color: var(--text); text-align: right; }
.suggestion:hover, .suggestion.is-active { background: var(--primary-soft); }
.suggestion strong { display: block; }
.suggestion small { color: var(--muted); }
.suggestion .suggestion-type { align-self: center; padding: 4px 8px; border-radius: 999px; background: var(--surface-2); color: var(--primary-strong); font-size: .72rem; }
.quick-searches { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.quick-searches > span { color: rgba(255,255,255,.67); font-size: .82rem; }
.quick-searches button { padding: 6px 11px; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; background: rgba(255,255,255,.08); color: #fff; }
.quick-searches button:hover { background: rgba(255,255,255,.16); }
.hero__stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.hero__stats article { min-height: 97px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; border: 1px solid rgba(255,255,255,.14); border-radius: 18px; background: rgba(255,255,255,.08); backdrop-filter: blur(8px); text-align: center; }
.hero__stats article:first-child { grid-column: span 2; }
.hero__stats strong { font-size: 1.6rem; }
.hero__stats span { color: rgba(255,255,255,.72); font-size: .82rem; }

.type-explorer, .control-panel, .results-section { margin-top: 24px; padding: 24px; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.section-heading--compact { margin-bottom: 15px; }
.section-heading h2 { margin: 2px 0 0; line-height: 1.35; }
.section-heading p { margin: 5px 0 0; color: var(--muted); font-size: .9rem; }
.eyebrow { display: inline-block; color: var(--primary); font-size: .78rem; font-weight: 800; letter-spacing: .03em; }
.type-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.type-tile { min-width: 0; position: relative; display: grid; justify-items: start; gap: 3px; padding: 18px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface-3); color: var(--text); text-align: right; transition: .18s ease; }
.type-tile:hover { transform: translateY(-3px); border-color: var(--primary); box-shadow: 0 13px 25px rgba(14,62,47,.08); }
.type-tile__icon { width: 38px; height: 38px; display: grid; place-items: center; margin-bottom: 8px; border-radius: 12px; background: var(--primary-soft); color: var(--primary-strong); direction: ltr; font-weight: 800; }
.type-tile strong { font-size: .98rem; }
.type-tile small { color: var(--muted); line-height: 1.55; }
.type-tile b { position: absolute; top: 14px; left: 14px; min-width: 27px; height: 27px; display: grid; place-items: center; border-radius: 999px; background: var(--surface-2); color: var(--primary-strong); font-size: .72rem; }

.view-tabs { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.view-tab { min-height: 42px; padding: 0 15px; border: 1px solid transparent; border-radius: 11px; background: transparent; color: var(--muted); font-weight: 700; }
.view-tab:hover { background: var(--surface-2); }
.view-tab.is-active { border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); background: var(--primary-soft); color: var(--primary-strong); }
.filters { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)) auto; align-items: end; gap: 12px; margin-top: 18px; }
.filters label { display: grid; gap: 6px; }
.filters label > span { color: var(--muted); font-size: .76rem; font-weight: 700; }
select { width: 100%; min-height: 44px; padding: 0 11px; border: 1px solid var(--border); border-radius: 11px; outline: 0; background: var(--surface-3); color: var(--text); }
select:focus { border-color: var(--primary); }
.reset-button { min-height: 44px; padding: 0 17px; border-radius: 11px; color: var(--primary-strong); font-weight: 700; }
.reset-button:hover { background: var(--primary-soft); border-color: var(--primary); }
.layout-buttons { display: flex; gap: 7px; }
.active-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: -5px 0 20px; }
.filter-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: .78rem; }
.filter-chip button { width: 19px; height: 19px; padding: 0; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--text) 9%, transparent); color: var(--text); line-height: 1; }

.results-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px; }
.results-grid.list-view { grid-template-columns: 1fr; }
.results-grid.list-view .entity-card { display: grid; grid-template-columns: minmax(260px,.8fr) minmax(0,1.4fr); column-gap: 24px; }
.results-grid.list-view .entity-card__header, .results-grid.list-view .entity-title, .results-grid.list-view .entity-summary { grid-column: 1; }
.results-grid.list-view .entity-meta, .results-grid.list-view .entity-preview, .results-grid.list-view .entity-card__footer { grid-column: 2; }
.results-grid.list-view .entity-preview { grid-row: 1 / span 3; align-self: center; }
.entity-card { min-width: 0; display: flex; flex-direction: column; padding: 19px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-3); transition: .18s ease; }
.entity-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); box-shadow: 0 15px 28px rgba(14,62,47,.08); }
.entity-card[data-type="command"] { border-top: 4px solid var(--command); }
.entity-card[data-type="concept"] { border-top: 4px solid var(--concept); }
.entity-card[data-type="troubleshooting"] { border-top: 4px solid var(--trouble); }
.entity-card[data-type="learning_path"] { border-top: 4px solid var(--path); }
.entity-card[data-type="task"] { border-top: 4px solid var(--task); }
.entity-card__header { min-width: 0; display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.entity-card__badges { display: flex; flex-wrap: wrap; gap: 6px; }
.type-badge, .category-badge, .meta-badge, .status-badge, .risk-badge { display: inline-flex; align-items: center; width: fit-content; padding: 4px 8px; border-radius: 999px; font-size: .71rem; font-weight: 800; }
.type-badge { background: var(--primary-soft); color: var(--primary-strong); }
.category-badge, .meta-badge { background: var(--surface-2); color: var(--muted); }
.type-badge.type-command { background: color-mix(in srgb, var(--command) 14%, transparent); color: var(--command); }
.type-badge.type-concept { background: color-mix(in srgb, var(--concept) 14%, transparent); color: var(--concept); }
.type-badge.type-troubleshooting { background: color-mix(in srgb, var(--trouble) 14%, transparent); color: var(--trouble); }
.type-badge.type-learning_path { background: color-mix(in srgb, var(--path) 14%, transparent); color: var(--path); }
.favorite-button { flex: 0 0 auto; width: 38px; height: 38px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); color: var(--muted); font-size: 1.4rem; line-height: 1; }
.favorite-button:hover, .favorite-button.is-favorite { border-color: #d1a200; background: #fff5c9; color: #9a7200; }
html[data-theme="dark"] .favorite-button.is-favorite { background: #453a12; color: #ffe27c; }
.entity-title { margin: 13px 0 4px; font-size: 1.12rem; line-height: 1.45; }
.entity-summary { margin: 0 0 13px; color: var(--muted); font-size: .9rem; }
.entity-meta { display: flex; flex-wrap: wrap; gap: 7px; }
.entity-preview { min-width: 0; margin-top: 14px; padding: 13px; border: 1px dashed var(--border); border-radius: 12px; background: var(--surface); }
.entity-preview code { display: block; overflow-x: auto; color: var(--primary-strong); white-space: nowrap; font-size: .82rem; }
.entity-preview p, .entity-preview ul { margin: 0; color: var(--muted); font-size: .83rem; }
.entity-preview ul { padding-right: 18px; }
.entity-card__footer { display: flex; gap: 8px; margin-top: auto; padding-top: 14px; }
.open-entity-button, .quick-action-button { flex: 1; min-height: 40px; border-radius: 10px; font-size: .8rem; font-weight: 700; }
.open-entity-button { border-color: var(--primary); background: var(--primary); color: #fff; }
.quick-action-button:hover { border-color: var(--primary); background: var(--primary-soft); }

.state-card { min-height: 270px; display: grid; place-items: center; align-content: center; padding: 30px; border: 1px dashed var(--border); border-radius: var(--radius-lg); background: var(--surface-3); text-align: center; }
.state-card h3, .state-card p { margin: 3px 0; }
.state-card p { max-width: 650px; color: var(--muted); }
.state-card--error { border-color: color-mix(in srgb, var(--critical) 45%, var(--border)); background: var(--critical-bg); color: var(--critical); }
.state-card__icon { width: 50px; height: 50px; display: grid; place-items: center; margin-bottom: 8px; border-radius: 50%; background: var(--surface-2); color: var(--primary); font-size: 1.6rem; font-weight: 900; }
.loader { width: 42px; height: 42px; margin-bottom: 12px; border: 4px solid var(--surface-2); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.primary-button { min-height: 42px; margin-top: 14px; padding: 0 17px; border-color: var(--primary); border-radius: 11px; background: var(--primary); color: #fff; font-weight: 700; }
.load-more-button { min-height: 46px; display: block; margin: 22px auto 0; padding: 0 24px; border-radius: 12px; color: var(--primary-strong); font-weight: 700; }
.load-more-button:hover { border-color: var(--primary); background: var(--primary-soft); }

.toast { position: fixed; z-index: 3000; left: 22px; bottom: 22px; max-width: min(360px, calc(100% - 44px)); padding: 11px 17px; border-radius: 11px; background: var(--code-bg); color: var(--code-text); box-shadow: var(--shadow); opacity: 0; transform: translateY(18px); pointer-events: none; transition: .2s ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

.entity-dialog { width: min(1020px, calc(100% - 28px)); max-height: min(900px, calc(100vh - 30px)); overflow-y: auto; padding: 0; border: 1px solid var(--border); border-radius: 24px; background: var(--surface); color: var(--text); box-shadow: 0 30px 90px rgba(0,0,0,.38); }
.entity-dialog::backdrop { background: rgba(4,17,13,.69); backdrop-filter: blur(4px); }
.dialog-topbar { position: sticky; top: 0; z-index: 20; min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); }
.dialog-close { width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); color: var(--text); font-size: 1.45rem; }
.dialog-topbar__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dialog-action { min-height: 40px; padding: 0 13px; border-radius: 10px; font-size: .8rem; font-weight: 700; }
.dialog-body { padding: 30px; }
.entity-hero { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: start; padding-bottom: 22px; border-bottom: 1px solid var(--border); }
.entity-hero h2 { margin: 8px 0 7px; font-size: clamp(1.7rem, 4vw, 2.6rem); line-height: 1.3; }
.entity-hero p { margin: 0; color: var(--muted); }
.entity-hero__meta { min-width: 210px; display: grid; gap: 8px; }
.info-pill { display: flex; justify-content: space-between; gap: 12px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-3); font-size: .8rem; }
.info-pill span { color: var(--muted); }
.dialog-section { margin-top: 24px; }
.dialog-section__heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.dialog-section h3 { margin: 0; font-size: 1.12rem; }
.section-note { color: var(--muted); font-size: .8rem; }
.callout { padding: 14px 16px; border-right: 4px solid var(--primary); border-radius: 12px; background: var(--primary-soft); color: var(--text); }
.callout--warning { border-color: var(--high); background: var(--high-bg); color: var(--high); }
.callout--danger { border-color: var(--critical); background: var(--critical-bg); color: var(--critical); }
.variables-grid, .detail-grid, .resource-grid, .examples-grid, .concept-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 11px; }
.variable-field { display: grid; gap: 6px; }
.variable-field span { color: var(--muted); font-size: .78rem; font-weight: 700; }
.variable-field input { min-height: 43px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-3); color: var(--text); outline: 0; direction: ltr; }
.variable-field input:focus { border-color: var(--primary); }
.progress-panel { padding: 13px 15px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-3); }
.progress-panel__header { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: .8rem; }
.progress-track { height: 9px; margin-top: 9px; overflow: hidden; border-radius: 999px; background: var(--surface-2); }
.progress-bar { height: 100%; border-radius: inherit; background: var(--primary); transition: width .2s ease; }
.steps-list { display: grid; gap: 12px; }
.step-card { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface-3); }
.step-card.is-complete { border-color: color-mix(in srgb, var(--low) 55%, var(--border)); background: var(--low-bg); }
.step-check { width: 28px; height: 28px; margin-top: 2px; accent-color: var(--primary); }
.step-card h4 { margin: 0 0 4px; }
.step-card p { margin: 0 0 10px; color: var(--muted); font-size: .87rem; }
.command-box { min-width: 0; display: flex; align-items: stretch; overflow: hidden; border-radius: 11px; background: var(--code-bg); direction: ltr; }
.command-box code { flex: 1; min-width: 0; overflow-x: auto; padding: 13px; color: var(--code-text); white-space: nowrap; font-size: .84rem; }
.command-copy { flex: 0 0 auto; padding: 0 13px; border: 0; border-left: 1px solid rgba(255,255,255,.13); background: rgba(255,255,255,.08); color: #fff; font-weight: 700; }
.expected-result { margin-top: 9px; padding: 9px 11px; border-radius: 9px; background: var(--surface); color: var(--muted); font-size: .8rem; }
.verification-list, .error-list, .option-list, .module-list { display: grid; gap: 10px; }
.verification-item, .error-item, .option-item, .module-item, .resource-card, .concept-card, .example-card { padding: 13px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-3); }
.verification-item h4, .error-item h4, .example-card h4, .concept-card h4 { margin: 0 0 6px; }
.verification-item code, .error-check code, .syntax-box { display: block; overflow-x: auto; margin: 7px 0; padding: 11px; border-radius: 9px; background: var(--code-bg); color: var(--code-text); white-space: nowrap; }
.error-item { border-right: 4px solid var(--high); }
.error-item p, .option-item p, .concept-card p, .example-card p { margin: 4px 0; color: var(--muted); font-size: .85rem; }
.error-item ul, .bullet-list, .rollback-list { margin: 7px 0 0; padding-right: 21px; }
.error-check { margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--border); }
.resource-card code { display: block; overflow-x: auto; margin-top: 4px; color: var(--primary-strong); }
.option-item { display: grid; grid-template-columns: minmax(120px,.35fr) 1fr; gap: 12px; align-items: start; }
.option-item code { color: var(--command); font-weight: 700; }
.example-card .command-box { margin-top: 10px; }
.mental-model { padding: 20px; border: 1px dashed color-mix(in srgb, var(--concept) 50%, var(--border)); border-radius: 15px; background: color-mix(in srgb, var(--concept) 7%, var(--surface)); text-align: center; font-size: 1.02rem; }
.module-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }
.module-number { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%; background: var(--primary-soft); color: var(--primary-strong); font-size: .78rem; font-weight: 800; }
.module-item.is-complete { border-color: var(--low); background: var(--low-bg); }
.module-item h4 { margin: 0; }
.module-item p { margin: 2px 0 0; color: var(--muted); font-size: .82rem; }
.module-actions { display: flex; gap: 7px; }
.module-actions button { min-height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); font-size: .76rem; }

.graph-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 16px; background: radial-gradient(circle at center, var(--surface), var(--surface-3)); }
.knowledge-graph { width: 100%; min-width: 700px; height: 390px; display: block; }
.graph-line { stroke: color-mix(in srgb, var(--primary) 38%, var(--border)); stroke-width: 2; }
.graph-node circle { fill: var(--surface); stroke: var(--border); stroke-width: 2; transition: .15s ease; }
.graph-node text { fill: var(--text); font-family: Tahoma, Arial, sans-serif; font-size: 12px; pointer-events: none; }
.graph-node[data-current="true"] circle { fill: var(--primary); stroke: var(--primary); }
.graph-node[data-current="true"] text { fill: #fff; font-weight: 800; }
.graph-node:not([data-current="true"]) { cursor: pointer; }
.graph-node:not([data-current="true"]):hover circle { stroke: var(--primary); fill: var(--primary-soft); }
.related-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.related-button { padding: 7px 11px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-3); color: var(--text); }
.related-button:hover { border-color: var(--primary); background: var(--primary-soft); }

.risk-low { background: var(--low-bg); color: var(--low); }
.risk-medium { background: var(--medium-bg); color: var(--medium); }
.risk-high { background: var(--high-bg); color: var(--high); }
.risk-critical { background: var(--critical-bg); color: var(--critical); }
.footer { display: flex; justify-content: space-between; gap: 20px; padding: 23px 10px 32px; color: var(--muted); font-size: .8rem; }
.footer p { margin: 0; }

@media (max-width: 1200px) {
  .hero { grid-template-columns: 1fr; }
  .hero__stats { grid-template-columns: repeat(6,1fr); }
  .hero__stats article:first-child { grid-column: auto; }
  .type-grid { grid-template-columns: repeat(3,1fr); }
  .results-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 820px) {
  .app-shell { width: min(100% - 18px,1500px); }
  .topbar { min-height: 70px; }
  .brand small, .toolbar-button > span:not(:first-child) { display: none; }
  .hero { min-height: auto; padding: 29px 20px; border-radius: 20px; }
  .hero h1 { font-size: 2.25rem; }
  .search-box { min-height: 62px; }
  .search-box kbd { display: none; }
  .hero__stats { grid-template-columns: repeat(2,1fr); }
  .hero__stats article:first-child { grid-column: span 2; }
  .type-explorer, .control-panel, .results-section { padding: 15px; border-radius: 19px; }
  .type-grid { grid-template-columns: 1fr 1fr; }
  .filters { grid-template-columns: 1fr 1fr; }
  .reset-button { grid-column: span 2; }
  .results-grid, .results-grid.list-view { grid-template-columns: 1fr; }
  .results-grid.list-view .entity-card { display: flex; }
  .results-grid.list-view .entity-card > * { grid-column: auto; grid-row: auto; }
  .entity-hero { grid-template-columns: 1fr; }
  .entity-hero__meta { min-width: 0; grid-template-columns: repeat(2,1fr); }
  .variables-grid, .detail-grid, .resource-grid, .examples-grid, .concept-grid { grid-template-columns: 1fr; }
  .dialog-body { padding: 20px 16px 28px; }
  .dialog-topbar { align-items: start; }
  .dialog-topbar__actions { justify-content: flex-end; }
  .option-item { grid-template-columns: 1fr; }
  .module-item { grid-template-columns: auto 1fr; }
  .module-actions { grid-column: 2; }
  .footer { flex-direction: column; }
}
@media (max-width: 500px) {
  .type-grid, .filters { grid-template-columns: 1fr; }
  .reset-button { grid-column: auto; }
  .quick-searches button:nth-of-type(n+4) { display: none; }
  .entity-card__footer { flex-direction: column; }
  .dialog-action { padding: 0 9px; }
  .entity-hero__meta { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}


/* ================= Phase 3: Intent Engine ================= */
.intent-panel {
  margin-top: 24px;
  padding: 0;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 11%, var(--surface)), var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border));
  box-shadow: var(--shadow);
  overflow: hidden;
}
.intent-panel__inner { padding: 24px; }
.intent-panel__header { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; }
.intent-panel__identity { display:flex; align-items:flex-start; gap:14px; min-width:0; }
.intent-panel__icon { width:52px; height:52px; flex:0 0 52px; display:grid; place-items:center; border-radius:16px; background:var(--primary); color:#fff; font-size:1.25rem; font-weight:900; box-shadow:0 10px 25px color-mix(in srgb, var(--primary) 24%, transparent); }
.intent-panel h2 { margin:2px 0 3px; font-size:1.25rem; }
.intent-panel p { margin:0; color:var(--muted); }
.intent-confidence { display:inline-flex; align-items:center; gap:6px; padding:6px 10px; border-radius:999px; font-size:.76rem; font-weight:800; white-space:nowrap; }
.intent-confidence--high { background:var(--low-bg); color:var(--low); }
.intent-confidence--medium { background:var(--medium-bg); color:var(--medium); }
.intent-confidence--low { background:var(--surface-2); color:var(--muted); }
.intent-analysis-row { display:flex; flex-wrap:wrap; gap:8px; margin-top:16px; }
.analysis-chip { display:inline-flex; align-items:center; gap:6px; padding:6px 10px; border:1px solid var(--border); border-radius:999px; background:var(--surface); color:var(--text); font-size:.78rem; }
.analysis-chip strong { color:var(--primary-strong); }
.correction-note { margin-top:13px; padding:9px 12px; border-radius:10px; background:var(--medium-bg); color:var(--medium); font-size:.82rem; }
.intent-target { margin-top:18px; padding:16px; border:1px solid var(--border); border-radius:15px; background:var(--surface); }
.intent-target__top { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.intent-target h3 { margin:0; font-size:1rem; }
.intent-target p { margin:3px 0 0; font-size:.86rem; }
.intent-fields { display:grid; grid-template-columns:repeat(4,minmax(130px,1fr)); gap:10px; margin-top:14px; }
.intent-field { display:grid; gap:5px; }
.intent-field span { color:var(--muted); font-size:.74rem; font-weight:700; }
.intent-field input { min-height:42px; padding:0 11px; border:1px solid var(--border); border-radius:10px; background:var(--surface-3); color:var(--text); outline:0; direction:ltr; text-align:left; }
.intent-field input:focus { border-color:var(--primary); box-shadow:0 0 0 3px color-mix(in srgb,var(--primary) 12%,transparent); }
.intent-actions { display:flex; flex-wrap:wrap; gap:9px; margin-top:15px; }
.intent-primary, .intent-secondary, .intent-alt { min-height:42px; padding:0 15px; border-radius:11px; font-weight:800; }
.intent-primary { border:1px solid var(--primary); background:var(--primary); color:#fff; }
.intent-secondary, .intent-alt { border:1px solid var(--border); background:var(--surface); color:var(--text); }
.intent-secondary:hover, .intent-alt:hover { border-color:var(--primary); background:var(--primary-soft); }
.intent-alternatives { margin-top:15px; padding-top:14px; border-top:1px solid var(--border); display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.intent-alternatives > span { color:var(--muted); font-size:.78rem; }
.intent-alt { min-height:34px; padding:0 11px; font-size:.76rem; font-weight:700; }
.intent-reasons { margin-top:12px; color:var(--muted); font-size:.75rem; }
.intent-suggestion { border-right:4px solid var(--primary); }
.intent-suggestion .suggestion-type { background:var(--primary); color:#fff; }
.search-correction { color:var(--medium); font-size:.76rem; }

@media (max-width: 1000px) { .intent-fields { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width: 620px) {
  .intent-panel__header, .intent-target__top { flex-direction:column; align-items:stretch; }
  .intent-fields { grid-template-columns:1fr; }
  .intent-panel__identity { align-items:flex-start; }
  .intent-confidence { width:fit-content; }
  .intent-actions > * { width:100%; }
}

/* =========================================================
   PHASE 4 — LINUX DOCTOR
   ========================================================= */

.toolbar-button--doctor {
  border-color: color-mix(in srgb, #7be0bc 34%, var(--border));
  background: color-mix(in srgb, var(--primary-soft) 76%, var(--surface));
  color: var(--primary-strong);
}

.hero__doctor-action {
  margin-top: 20px;
}

.hero__doctor-action > button {
  width: min(100%, 590px);
  min-height: 68px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 17px;
  background: rgba(255,255,255,.12);
  color: #fff;
  text-align: right;
  backdrop-filter: blur(8px);
}

.hero__doctor-action > button:hover {
  background: rgba(255,255,255,.19);
  transform: translateY(-1px);
}

.hero__doctor-action > button > span:first-child {
  width: 45px;
  height: 45px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: rgba(255,255,255,.14);
  font-size: 1.45rem;
}

.hero__doctor-action strong,
.hero__doctor-action small {
  display: block;
}

.hero__doctor-action small {
  margin-top: 2px;
  color: rgba(255,255,255,.68);
}

.hero__doctor-action b {
  font-size: 1.35rem;
}

.doctor-launch {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr);
  gap: 26px;
  margin-top: 24px;
  padding: 30px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--surface) 94%, var(--primary) 6%),
      var(--surface));
  box-shadow: var(--shadow);
}

.doctor-launch::after {
  content: "";
  position: absolute;
  inset: auto -90px -120px auto;
  width: 330px;
  height: 330px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  pointer-events: none;
}

.doctor-launch__content,
.doctor-launch__visual,
.doctor-launch__examples {
  position: relative;
  z-index: 1;
}

.doctor-launch__content h2 {
  margin: 4px 0 8px;
  font-size: clamp(1.65rem, 3vw, 2.4rem);
}

.doctor-launch__content > p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
}

.doctor-launch__features {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 17px;
}

.doctor-launch__features span {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-size: .78rem;
}

.doctor-launch__content > button {
  min-height: 47px;
  margin-top: 20px;
  padding: 0 20px;
  border: 0;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 12px 28px color-mix(in srgb, var(--primary) 25%, transparent);
}

.doctor-launch__content > button:hover {
  background: var(--primary-strong);
  transform: translateY(-1px);
}

.doctor-launch__visual {
  min-height: 215px;
  display: grid;
  place-items: center;
  align-content: center;
  border: 1px solid color-mix(in srgb, var(--primary) 24%, var(--border));
  border-radius: 22px;
  background:
    radial-gradient(circle at center,
      color-mix(in srgb, var(--primary) 17%, transparent),
      transparent 58%),
    var(--surface-3);
  text-align: center;
}

.doctor-launch__mark {
  position: relative;
  z-index: 2;
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: var(--primary);
  color: #fff;
  font-size: 2rem;
  box-shadow: 0 18px 35px color-mix(in srgb, var(--primary) 25%, transparent);
}

.doctor-launch__visual strong,
.doctor-launch__visual small {
  position: relative;
  z-index: 2;
  display: block;
}

.doctor-launch__visual strong {
  margin-top: 14px;
}

.doctor-launch__visual small {
  max-width: 245px;
  margin-top: 3px;
  color: var(--muted);
}

.doctor-orbit {
  position: absolute;
  border: 1px dashed color-mix(in srgb, var(--primary) 34%, transparent);
  border-radius: 50%;
  animation: doctor-spin 22s linear infinite;
}

.doctor-orbit--one { width: 155px; height: 155px; }
.doctor-orbit--two { width: 205px; height: 205px; animation-direction: reverse; animation-duration: 32s; }

.doctor-orbit::after {
  content: "";
  position: absolute;
  top: -5px;
  left: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
}

@keyframes doctor-spin { to { transform: rotate(360deg); } }

.doctor-launch__examples {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.doctor-launch__examples button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text);
}

.doctor-launch__examples button:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

/* Doctor dialog */
.doctor-dialog {
  width: min(1120px, calc(100% - 28px));
  height: min(890px, calc(100vh - 26px));
  max-height: calc(100vh - 26px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 35px 110px rgba(0,0,0,.4);
}

.doctor-dialog::backdrop {
  background: rgba(4,17,13,.72);
  backdrop-filter: blur(5px);
}

.doctor-dialog__topbar {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px 10px 19px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, var(--primary) 8%);
}

.doctor-dialog__identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}

.doctor-dialog__identity > span {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--primary);
  color: #fff;
  font-size: 1.35rem;
}

.doctor-dialog__identity small,
.doctor-dialog__identity strong {
  display: block;
}

.doctor-dialog__identity small {
  color: var(--muted);
  font-size: .68rem;
  letter-spacing: .04em;
}

.doctor-dialog__identity strong {
  max-width: 560px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doctor-dialog__actions {
  display: flex;
  gap: 7px;
}

.doctor-dialog__actions button {
  min-height: 39px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}

.doctor-dialog__actions button:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.doctor-dialog__actions .doctor-dialog__close {
  width: 41px;
  padding: 0;
  font-size: 1.45rem;
}

.doctor-dialog__content {
  height: calc(100% - 70px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Doctor home */
.doctor-home,
.doctor-setup,
.doctor-session {
  padding: 28px;
}

.doctor-home__intro {
  max-width: 870px;
}

.doctor-kicker {
  color: var(--primary);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .04em;
}

.doctor-home__intro h2,
.doctor-setup h2,
.doctor-question-card h2,
.doctor-result-hero h2 {
  margin: 4px 0 7px;
  line-height: 1.35;
}

.doctor-home__intro > p,
.doctor-setup__hero p,
.doctor-question-card > p,
.doctor-result-hero p {
  margin: 0;
  color: var(--muted);
}

.doctor-safety-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 16px;
  padding: 10px 13px;
  border-right: 4px solid var(--primary);
  border-radius: 11px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: .84rem;
}

.doctor-resume-card {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 13px;
  margin-top: 22px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--primary) 38%, var(--border));
  border-radius: 15px;
  background: color-mix(in srgb, var(--primary-soft) 58%, var(--surface));
}

.doctor-resume-card__icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--primary);
  color: #fff;
  font-size: 1.25rem;
}

.doctor-resume-card span,
.doctor-resume-card strong,
.doctor-resume-card small {
  display: block;
}

.doctor-resume-card span,
.doctor-resume-card small {
  color: var(--muted);
  font-size: .74rem;
}

.doctor-search-box {
  min-height: 55px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-3);
}

.doctor-search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent);
}

.doctor-search-box input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.doctor-home__heading {
  margin: 25px 0 13px;
}

.doctor-home__heading h3 {
  margin: 2px 0 0;
}

.doctor-flow-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 14px;
}

.doctor-flow-card {
  min-width: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 13px;
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: var(--surface-3);
  transition: transform .17s ease, border-color .17s ease, box-shadow .17s ease;
}

.doctor-flow-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--primary) 42%, var(--border));
  box-shadow: 0 14px 28px rgba(14,62,47,.08);
}

.doctor-flow-card__icon {
  width: 47px;
  height: 47px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 1.35rem;
}

.doctor-flow-card__body > span {
  color: var(--primary);
  font-size: .7rem;
  font-weight: 800;
}

.doctor-flow-card h4 {
  margin: 3px 0 5px;
  line-height: 1.45;
}

.doctor-flow-card p {
  margin: 0;
  color: var(--muted);
  font-size: .82rem;
}

.doctor-flow-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.doctor-flow-card__meta small {
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
}

.doctor-flow-card > button {
  grid-column: 1 / -1;
  min-height: 40px;
  border: 1px solid var(--primary);
  border-radius: 11px;
  background: transparent;
  color: var(--primary-strong);
  font-weight: 800;
}

.doctor-flow-card > button:hover {
  background: var(--primary);
  color: #fff;
}

.doctor-empty {
  grid-column: 1 / -1;
  min-height: 190px;
  display: grid;
  place-items: center;
  align-content: center;
  border: 1px dashed var(--border);
  border-radius: 16px;
  text-align: center;
}

.doctor-empty > span { font-size: 1.8rem; color: var(--primary); }
.doctor-empty p { margin: 3px 0; color: var(--muted); }

/* Setup */
.doctor-setup__hero {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.doctor-setup__icon {
  width: 62px;
  height: 62px;
  flex: 0 0 62px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--primary);
  color: #fff;
  font-size: 1.7rem;
}

.doctor-info-grid {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 10px;
  margin-top: 22px;
}

.doctor-info-grid > div {
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-3);
}

.doctor-info-grid span,
.doctor-info-grid strong {
  display: block;
}

.doctor-info-grid span { color: var(--muted); font-size: .72rem; }
.doctor-info-grid strong { margin-top: 3px; }

.doctor-variable-panel,
.doctor-expectation-card {
  margin-top: 20px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-3);
}

.doctor-variable-panel h3,
.doctor-expectation-card h3 {
  margin: 2px 0 3px;
}

.doctor-variable-panel > div:first-child > p {
  margin: 0;
  color: var(--muted);
  font-size: .84rem;
}

.doctor-variable-grid {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 11px;
  margin-top: 14px;
}

.doctor-variable-field {
  display: grid;
  gap: 5px;
}

.doctor-variable-field > span {
  color: var(--muted);
  font-size: .74rem;
  font-weight: 700;
}

.doctor-variable-field input {
  width: 100%;
  min-height: 43px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: 0;
  background: var(--surface);
  color: var(--text);
  direction: ltr;
  text-align: left;
}

.doctor-variable-field input:focus { border-color: var(--primary); }
.doctor-variable-field small { direction: ltr; color: var(--primary); font-family: Consolas, monospace; }

.doctor-expectation-card ol {
  margin: 9px 0 0;
  padding-right: 22px;
  color: var(--muted);
}

.doctor-setup__actions,
.doctor-report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 20px;
}

.doctor-primary-button,
.doctor-ghost-button {
  min-height: 42px;
  padding: 0 15px;
  border-radius: 11px;
  font-weight: 800;
}

.doctor-primary-button {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
}

.doctor-primary-button:hover { background: var(--primary-strong); }

.doctor-primary-button--large {
  min-height: 49px;
  padding: 0 24px;
}

.doctor-ghost-button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.doctor-ghost-button:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

/* Session */
.doctor-session-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.doctor-session-header__identity {
  display: flex;
  align-items: center;
  gap: 9px;
}

.doctor-session-header__identity > span {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.doctor-session-header__identity small,
.doctor-session-header__identity strong {
  display: block;
}

.doctor-session-header__identity small { color: var(--muted); font-size: .68rem; }

.doctor-progress-label {
  text-align: left;
}

.doctor-progress-label span,
.doctor-progress-label small { display: block; }
.doctor-progress-label span { font-weight: 800; }
.doctor-progress-label small { color: var(--muted); font-size: .7rem; }

.doctor-progress {
  grid-column: 1 / -1;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.doctor-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg,var(--primary),#75dbb4);
  transition: width .25s ease;
}

.doctor-question-card {
  padding: 23px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-3);
}

.doctor-question-card--check {
  border-top: 4px solid var(--primary);
}

.doctor-node-type {
  color: var(--primary);
  font-size: .72rem;
  font-weight: 800;
}

.doctor-help-note,
.doctor-command-explanation,
.doctor-expected {
  margin-top: 13px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: .83rem;
}

.doctor-command-panel {
  overflow: hidden;
  margin-top: 18px;
  border-radius: 14px;
  background: var(--code-bg);
  direction: ltr;
}

.doctor-command-panel__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  color: rgba(255,255,255,.7);
  direction: rtl;
  font-size: .72rem;
}

.doctor-command-panel > code {
  display: block;
  min-height: 60px;
  overflow-x: auto;
  padding: 17px;
  color: var(--code-text);
  white-space: nowrap;
}

.doctor-command-panel > button {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-top: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.08);
  color: #fff;
  font-weight: 800;
}

.doctor-command-panel > button:hover { background: rgba(255,255,255,.15); }

.doctor-risk {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 800;
}

.doctor-risk--low { background: var(--low-bg); color: var(--low); }
.doctor-risk--medium { background: var(--medium-bg); color: var(--medium); }
.doctor-risk--high { background: var(--high-bg); color: var(--high); }
.doctor-risk--critical { background: var(--critical-bg); color: var(--critical); }

.doctor-expected {
  display: grid;
  gap: 3px;
  border-right: 4px solid var(--primary);
}

.doctor-expected strong { color: var(--text); }

.doctor-choice-list {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 10px;
  margin-top: 19px;
}

.doctor-choice {
  min-height: 57px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  text-align: right;
  font-weight: 700;
}

.doctor-choice small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-weight: 400;
}

.doctor-choice:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.doctor-choice--positive { border-right: 4px solid var(--low); }
.doctor-choice--warning { border-right: 4px solid var(--medium); }
.doctor-choice--danger { border-right: 4px solid var(--critical); }

.doctor-variable-drawer {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-3);
}

.doctor-variable-drawer summary {
  color: var(--primary-strong);
  cursor: pointer;
  font-weight: 800;
}

/* Result */
.doctor-result-hero {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  padding: 22px;
  border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border));
  border-radius: 18px;
  background: linear-gradient(135deg,var(--primary-soft),var(--surface-3));
}

.doctor-result-hero__mark {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--primary);
  color: #fff;
  font-size: 1.4rem;
}

.doctor-confidence {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 800;
}

.doctor-confidence--high { background: var(--low-bg); color: var(--low); }
.doctor-confidence--medium { background: var(--medium-bg); color: var(--medium); }
.doctor-confidence--low { background: var(--surface-2); color: var(--muted); }

.doctor-result-section {
  margin-top: 18px;
  padding: 19px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-3);
}

.doctor-result-section__heading {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 12px;
}

.doctor-result-section__heading > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-family: Consolas, monospace;
  font-weight: 800;
}

.doctor-result-section__heading small,
.doctor-result-section__heading h3 {
  display: block;
  margin: 0;
}

.doctor-result-section__heading small { color: var(--muted); font-size: .68rem; }

.doctor-cause-list {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.doctor-cause-list li {
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--surface-2);
}

.doctor-cause-list li::before {
  content: "•";
  margin-left: 7px;
  color: var(--primary);
}

.doctor-action-list,
.doctor-verification-list {
  display: grid;
  gap: 10px;
}

.doctor-action-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 11px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.doctor-action-card > span {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--primary-strong);
  font-family: Consolas, monospace;
  font-weight: 800;
}

.doctor-action-card__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.doctor-action-card p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: .82rem;
}

.doctor-inline-command,
.doctor-verification-list article > div {
  min-width: 0;
  display: flex;
  align-items: stretch;
  overflow: hidden;
  margin-top: 9px;
  border-radius: 10px;
  background: var(--code-bg);
  direction: ltr;
}

.doctor-inline-command code,
.doctor-verification-list code {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  padding: 11px;
  color: var(--code-text);
  white-space: nowrap;
}

.doctor-inline-command button,
.doctor-verification-list button {
  flex: 0 0 auto;
  padding: 0 12px;
  border: 0;
  border-left: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.08);
  color: #fff;
}

.doctor-verification-list article {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.doctor-verification-list article > p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: .8rem;
}

.doctor-safety-result {
  margin-top: 17px;
  padding: 13px 15px;
  border-right: 4px solid var(--high);
  border-radius: 11px;
  background: var(--high-bg);
  color: var(--high);
}

.doctor-safety-result ul { margin: 6px 0 0; }

.doctor-related-section {
  margin-top: 17px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.doctor-related-section h3 { margin: 0 0 10px; }
.doctor-related-section > div { display: flex; flex-wrap: wrap; gap: 8px; }
.doctor-related-section button {
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-3);
  color: var(--primary-strong);
}
.doctor-related-section button:hover { border-color: var(--primary); background: var(--primary-soft); }

@media (max-width: 1050px) {
  .doctor-flow-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .doctor-variable-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 780px) {
  .doctor-launch { grid-template-columns: 1fr; padding: 20px; }
  .doctor-launch__visual { min-height: 190px; }
  .doctor-dialog { width: 100%; height: 100%; max-height: 100%; border: 0; border-radius: 0; }
  .doctor-dialog__identity small { display: none; }
  .doctor-dialog__actions button:not(.doctor-dialog__close) { padding: 0 8px; font-size: .78rem; }
  .doctor-home,.doctor-setup,.doctor-session { padding: 17px; }
  .doctor-flow-grid { grid-template-columns: 1fr; }
  .doctor-info-grid { grid-template-columns: 1fr; }
  .doctor-variable-grid { grid-template-columns: 1fr; }
  .doctor-choice-list { grid-template-columns: 1fr; }
  .doctor-cause-list { grid-template-columns: 1fr; }
  .doctor-resume-card { grid-template-columns: auto 1fr; }
  .doctor-resume-card button { grid-column: auto; }
  .doctor-session-header { grid-template-columns: 1fr; }
  .doctor-progress-label { text-align: right; }
  .doctor-result-hero { padding: 16px; }
  .doctor-action-card__title { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 520px) {
  .toolbar-button--doctor > span:nth-child(2) { display: none; }
  .doctor-dialog__identity strong { max-width: 180px; }
  .doctor-setup__hero { flex-direction: column; }
  .doctor-result-hero { flex-direction: column; }
  .doctor-report-actions { flex-direction: column; }
  .doctor-report-actions button { width: 100%; }
  .doctor-launch__examples button:nth-child(n+4) { display: none; }
}

/* ===== Phase 5: Guided Workflow Runner ===== */
.toolbar-button--workflow{border-color:color-mix(in srgb,#5f5cff 35%,var(--border));background:color-mix(in srgb,#5f5cff 10%,var(--surface))}
.hero__primary-actions{margin-top:18px}.hero-workflow-button{width:min(100%,570px);min-height:70px;display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:13px;padding:12px 17px;border:1px solid #ffffff45;border-radius:17px;background:#ffffff18;color:#fff;text-align:right}.hero-workflow-button span:first-child{width:42px;height:42px;display:grid;place-items:center;border-radius:12px;background:#ffffff1f}.hero-workflow-button strong,.hero-workflow-button small{display:block}.hero-workflow-button small{color:#ffffffb8;font-size:.73rem}
.workflow-launch{margin-top:24px;display:grid;grid-template-columns:1.35fr .65fr;gap:18px;padding:26px;border:1px solid color-mix(in srgb,#5f5cff 30%,var(--border));border-radius:var(--radius-xl);background:radial-gradient(circle at 100% 0,#5f5cff20,transparent 38%),var(--surface);box-shadow:var(--shadow)}.workflow-launch h2{margin:4px 0}.workflow-launch p{margin:0;color:var(--muted)}.workflow-launch__features{display:flex;flex-wrap:wrap;gap:7px;margin-top:14px}.workflow-launch__features span{padding:5px 9px;border-radius:999px;background:color-mix(in srgb,#5f5cff 10%,var(--surface-2));font-size:.72rem;font-weight:700}.workflow-launch__actions{display:flex;gap:8px;margin-top:17px}.workflow-launch__actions button{min-height:43px;padding:0 15px;border:1px solid #5f5cff;border-radius:10px;background:#5f5cff;color:#fff;font-weight:800}.workflow-launch__actions .workflow-secondary-action{background:var(--surface);color:#5f5cff}
.workflow-launch__dashboard{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}.workflow-launch__dashboard article{min-height:91px;display:grid;place-items:center;align-content:center;border:1px solid var(--border);border-radius:14px;background:var(--surface-3)}.workflow-launch__dashboard span{color:var(--muted);font-size:.68rem}.workflow-launch__dashboard strong{font-size:1.5rem;color:#5f5cff}.workflow-resume-summary{grid-column:1/-1;padding:13px;border-radius:12px;background:color-mix(in srgb,#5f5cff 9%,var(--surface-2))}.workflow-resume-summary strong,.workflow-resume-summary span{display:block}.workflow-resume-summary span{color:var(--muted);font-size:.72rem}
.workflow-launch__examples{grid-column:1/-1;display:grid;grid-template-columns:repeat(4,1fr);gap:8px}.workflow-launch__examples button{min-width:0;display:flex;gap:9px;align-items:center;padding:10px;border:1px solid var(--border);border-radius:11px;background:var(--surface-3);color:var(--text);text-align:right}.workflow-launch__examples button>span{width:31px;height:31px;display:grid;place-items:center;border-radius:9px;background:#5f5cff18;color:#5f5cff}.workflow-launch__examples strong,.workflow-launch__examples small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.workflow-launch__examples small{color:var(--muted);font-size:.65rem}
.guided-workflow-entry{display:grid;grid-template-columns:1fr auto;align-items:center;gap:18px;margin-bottom:17px;padding:18px;border:1px solid color-mix(in srgb,#5f5cff 35%,var(--border));border-radius:16px;background:linear-gradient(135deg,#5f5cff12,var(--surface-3))}.guided-workflow-entry h3{margin:3px 0}.guided-workflow-entry p{margin:0;color:var(--muted);font-size:.82rem}.guided-workflow-entry>button{min-height:45px;padding:0 17px;border:0;border-radius:11px;background:#5f5cff;color:#fff;font-weight:800}.guided-workflow-entry__progress{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:7px;margin-top:9px;font-size:.7rem}.guided-workflow-entry__progress>div{height:6px;background:var(--surface-2);border-radius:999px;overflow:hidden}.guided-workflow-entry__progress i{display:block;height:100%;background:#5f5cff}
.workflow-dialog{width:min(1160px,calc(100% - 26px));height:min(870px,calc(100vh - 28px));max-height:calc(100vh - 28px);padding:0;overflow:hidden;border:1px solid var(--border);border-radius:22px;background:var(--surface);color:var(--text);box-shadow:0 30px 90px #0007}.workflow-dialog::backdrop{background:#07110db8;backdrop-filter:blur(4px)}.workflow-dialog__topbar{min-height:68px;display:flex;align-items:center;justify-content:space-between;padding:10px 13px;border-bottom:1px solid var(--border)}.workflow-dialog__identity{display:flex;align-items:center;gap:10px;min-width:0}.workflow-dialog__identity>span{width:41px;height:41px;display:grid;place-items:center;border-radius:12px;background:#5f5cff;color:#fff}.workflow-dialog__identity small,.workflow-dialog__identity strong{display:block}.workflow-dialog__identity small{color:var(--muted);font-size:.63rem}.workflow-dialog__identity strong{max-width:500px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.workflow-dialog__actions{display:flex;gap:6px}.workflow-dialog__actions button{min-height:37px;padding:0 11px;border:1px solid var(--border);border-radius:9px;background:var(--surface-3);color:var(--text)}.workflow-dialog__actions .workflow-dialog__close{width:38px;padding:0;font-size:1.3rem}
.workflow-dialog__shell{height:calc(100% - 68px);display:grid;grid-template-columns:255px 1fr}.workflow-sidebar{overflow-y:auto;padding:14px;border-left:1px solid var(--border);background:var(--surface-3)}.workflow-main{min-width:0;min-height:0;display:grid;grid-template-rows:1fr auto}.workflow-content{overflow-y:auto;padding:25px}.workflow-footer{min-height:64px;display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:15px;padding:9px 16px;border-top:1px solid var(--border)}.workflow-footer button{min-height:41px;padding:0 14px;border:1px solid var(--border);border-radius:10px;background:var(--surface-3);color:var(--text);font-weight:800}.workflow-footer button.primary{background:#5f5cff;color:#fff;border-color:#5f5cff}.workflow-footerStatus,.workflow-footer>div{display:flex;align-items:center;gap:8px;color:var(--muted);font-size:.7rem}.workflow-footer>div i{flex:1;height:6px;border-radius:999px;background:var(--surface-2);overflow:hidden}.workflow-footer>div i b{display:block;height:100%;background:#5f5cff}
.wf-side-label{display:block;margin:4px 4px 8px;color:var(--muted);font-size:.66rem;font-weight:800}.workflow-sidebar>button{width:100%;min-height:42px;display:flex;justify-content:space-between;align-items:center;margin-bottom:6px;padding:7px 9px;border:1px solid transparent;border-radius:10px;background:transparent;color:var(--text)}.workflow-sidebar>button.active,.workflow-sidebar>button:hover{border-color:#5f5cff55;background:#5f5cff12}.workflow-sidebar>button b{min-width:22px;height:22px;display:grid;place-items:center;border-radius:999px;background:var(--surface-2);font-size:.65rem}.workflow-sidebar .wf-resume{justify-content:center;background:#5f5cff;color:#fff}
.wf-progress{display:grid;place-items:center;gap:4px;padding:5px 0 15px}.wf-progress strong{width:82px;height:82px;display:grid;place-items:center;border:8px solid #5f5cff2b;border-top-color:#5f5cff;border-radius:50%;font-size:1.1rem}.wf-progress span{color:var(--muted);font-size:.68rem}.wf-stages{display:grid;gap:6px}.wf-stages button{width:100%;min-height:53px;display:grid;grid-template-columns:32px 1fr;align-items:center;gap:8px;padding:7px;border:1px solid transparent;border-radius:10px;background:transparent;color:var(--text);text-align:right}.wf-stages button.current,.wf-stages button:hover{border-color:#5f5cff55;background:#5f5cff12}.wf-stages button>span{width:30px;height:30px;display:grid;place-items:center;border-radius:9px;background:var(--surface-2);font-size:.7rem;font-weight:900}.wf-stages button.current>span{background:#5f5cff;color:#fff}.wf-stages button.done>span{background:var(--low-bg);color:var(--low)}.wf-stages strong,.wf-stages small{display:block}.wf-stages small{color:var(--muted);font-size:.59rem}.wf-side-meta{display:grid;gap:6px;margin-top:15px;padding-top:12px;border-top:1px solid var(--border)}.wf-side-meta span{display:flex;justify-content:space-between;color:var(--muted);font-size:.67rem}
.wf-library header h2{margin:3px 0}.wf-library header p{margin:0;color:var(--muted)}.wf-library-controls{display:flex;justify-content:space-between;gap:12px;margin:17px 0}.wf-library-controls>input{width:min(430px,100%);min-height:43px;padding:0 11px;border:1px solid var(--border);border-radius:10px;background:var(--surface-3);color:var(--text)}.wf-library-controls>div{display:flex;flex-wrap:wrap;gap:6px}.wf-library-controls button{min-height:37px;padding:0 10px;border:1px solid var(--border);border-radius:9px;background:var(--surface-3);color:var(--muted)}.wf-library-controls button.active{border-color:#5f5cff;color:#5f5cff}.wf-cards{display:grid;grid-template-columns:repeat(2,1fr);gap:11px}.wf-card{padding:15px;border:1px solid var(--border);border-radius:14px;background:var(--surface-3)}.wf-card>header{display:flex;justify-content:space-between;gap:8px}.wf-card>header>div{display:flex;flex-wrap:wrap;gap:5px}.wf-state{padding:4px 7px;border-radius:999px;font-size:.62rem}.wf-state.active{background:#5f5cff16;color:#5f5cff}.wf-state.paused{background:var(--medium-bg);color:var(--medium)}.wf-state.completed{background:var(--low-bg);color:var(--low)}.wf-card h3{margin:11px 0 3px}.wf-card>p{min-height:45px;margin:0;color:var(--muted);font-size:.78rem}.wf-meta{display:flex;gap:5px;flex-wrap:wrap;margin-top:10px}.wf-meta span{padding:4px 7px;border-radius:999px;background:var(--surface-2);font-size:.63rem}.wf-mini{margin-top:10px}.wf-mini span{font-size:.65rem;color:var(--muted)}.wf-mini i{display:block;height:5px;background:var(--surface-2);border-radius:999px;overflow:hidden}.wf-mini i b{display:block;height:100%;background:#5f5cff}.wf-card footer{display:grid;grid-template-columns:1fr auto auto;gap:6px;margin-top:12px}.wf-card footer button{min-height:37px;padding:0 9px;border:1px solid var(--border);border-radius:9px;background:var(--surface);color:var(--text);font-size:.68rem;font-weight:800}.wf-card footer button:first-child{background:#5f5cff;color:#fff;border-color:#5f5cff}.wf-card footer .delete{width:37px;color:var(--critical)}.wf-empty{grid-column:1/-1;min-height:160px;display:grid;place-items:center;border:1px dashed var(--border);border-radius:13px;color:var(--muted)}
.wf-stage{max-width:830px;margin:auto}.wf-heading{margin-bottom:18px}.wf-heading h2{margin:4px 0;font-size:clamp(1.5rem,3vw,2.2rem)}.wf-heading p{margin:0;color:var(--muted)}.wf-goal,.wf-panel,.wf-command,.wf-final,.wf-report{margin-top:14px;padding:16px;border:1px solid var(--border);border-radius:14px;background:var(--surface-3)}.wf-goal p{margin:4px 0;color:var(--muted)}.wf-panel h3{margin:0 0 8px}.wf-panel>p{color:var(--muted);font-size:.75rem}.wf-checklist{display:grid;gap:6px}.wf-checklist label{min-height:45px;display:grid;grid-template-columns:auto 25px 1fr;align-items:center;gap:7px;padding:7px 10px;border:1px solid var(--border);border-radius:9px;background:var(--surface);cursor:pointer}.wf-checklist input{position:absolute;opacity:0}.wf-checklist label>span{width:22px;height:22px;display:grid;place-items:center;border:2px solid var(--border);border-radius:7px;color:transparent}.wf-checklist label.checked{background:var(--low-bg);border-color:var(--low)}.wf-checklist label.checked>span{background:var(--low);border-color:var(--low);color:#fff}.wf-vars{display:grid;grid-template-columns:repeat(2,1fr);gap:9px}.wf-vars label{display:grid;grid-template-columns:1fr auto;gap:5px}.wf-vars label>span{grid-column:1/-1;color:var(--muted);font-size:.7rem}.wf-vars label>span b{color:var(--critical)}.wf-vars input{min-width:0;min-height:42px;padding:0 9px;border:1px solid var(--border);border-radius:9px;background:var(--surface);color:var(--text)}.wf-vars code{align-self:center;padding:4px 6px;border-radius:6px;background:var(--surface-2);font-size:.62rem}.wf-warning,.wf-danger{margin-top:14px;padding:13px;border-right:4px solid var(--medium);border-radius:11px;background:var(--medium-bg);color:var(--medium)}.wf-danger{border-color:var(--critical);background:var(--critical-bg);color:var(--critical)}.wf-warning p,.wf-danger p{margin:3px 0}
.wf-dots{display:flex;gap:6px;overflow-x:auto;margin-bottom:12px}.wf-dots button{width:33px;height:33px;flex:0 0 33px;border:1px solid var(--border);border-radius:9px;background:var(--surface-3);color:var(--muted);font-weight:800}.wf-dots button.current{background:#5f5cff;color:#fff}.wf-dots button.success{background:var(--low-bg);color:var(--low)}.wf-dots button.issue,.wf-dots button.failed{background:var(--critical-bg);color:var(--critical)}.wf-command{border-top:4px solid #5f5cff}.wf-command.success{border-top-color:var(--low)}.wf-command.issue,.wf-command.failed{border-top-color:var(--critical)}.wf-command>header{display:flex;justify-content:space-between;gap:13px}.wf-command>header>div:first-child{display:flex;gap:10px}.wf-command>header>div:first-child>b{width:38px;height:38px;display:grid;place-items:center;border-radius:11px;background:#5f5cff17;color:#5f5cff}.wf-command h3{margin:0}.wf-command header p{margin:2px 0;color:var(--muted)}.wf-command>header>div:last-child{display:flex;gap:5px;flex-wrap:wrap}.wf-command>header span{padding:4px 7px;border-radius:999px;background:var(--surface-2);font-size:.62rem}.wf-code{display:flex;overflow:hidden;margin-top:13px;border-radius:10px;background:var(--code-bg);direction:ltr}.wf-code code{flex:1;min-width:0;overflow-x:auto;padding:13px;color:var(--code-text);white-space:nowrap;font-size:.78rem}.wf-code button{padding:0 12px;border:0;border-left:1px solid #ffffff20;background:#ffffff13;color:#fff;font-weight:800}.wf-unresolved{margin-top:9px;padding:9px;border-radius:9px;background:var(--critical-bg);color:var(--critical);font-size:.7rem}.wf-unresolved button{border:0;background:transparent;color:inherit;font-weight:800}.wf-expected{margin-top:10px;padding:10px;border:1px dashed var(--border);border-radius:9px;background:var(--surface)}.wf-expected p{margin:2px 0}.wf-notes{display:grid;gap:5px;margin-top:11px}.wf-notes span{color:var(--muted);font-size:.68rem}.wf-notes textarea{min-height:72px;resize:vertical;padding:9px;border:1px solid var(--border);border-radius:9px;background:var(--surface);color:var(--text)}.wf-outcomes{display:grid;grid-template-columns:repeat(3,1fr);gap:7px;margin-top:12px}.wf-outcomes.two{grid-template-columns:repeat(2,1fr)}.wf-outcomes button{min-height:64px;display:flex;align-items:center;gap:8px;padding:8px;border:1px solid var(--border);border-radius:10px;background:var(--surface);color:var(--text);text-align:right}.wf-outcomes button>b{width:28px;height:28px;display:grid;place-items:center;border-radius:8px;background:var(--surface-2)}.wf-outcomes span,.wf-outcomes small{display:block}.wf-outcomes small{color:var(--muted);font-size:.59rem}.wf-outcomes .success:hover{background:var(--low-bg);border-color:var(--low)}.wf-outcomes .issue:hover{background:var(--critical-bg);border-color:var(--critical)}.wf-step-list{display:grid;gap:6px;margin-top:13px}.wf-step-list button{display:grid;grid-template-columns:31px 1fr;align-items:center;gap:8px;padding:7px;border:1px solid var(--border);border-radius:9px;background:var(--surface-3);color:var(--text);text-align:right}.wf-step-list button.current{border-color:#5f5cff}.wf-step-list b{width:28px;height:28px;display:grid;place-items:center;border-radius:8px;background:var(--surface-2)}.wf-step-list span,.wf-step-list small{display:block}.wf-step-list small{color:var(--muted);font-size:.6rem}
.wf-verify-tabs{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:10px}.wf-verify-tabs button{min-height:36px;display:flex;align-items:center;gap:6px;padding:5px 8px;border:1px solid var(--border);border-radius:8px;background:var(--surface-3);color:var(--text)}.wf-verify-tabs button.current{border-color:#5f5cff}.wf-verify-tabs b{width:22px;height:22px;display:grid;place-items:center;border-radius:6px;background:var(--surface-2)}
.wf-errors{display:grid;gap:8px}.wf-errors details{border:1px solid var(--border);border-radius:11px;background:var(--surface-3);overflow:hidden}.wf-errors summary{min-height:50px;display:flex;align-items:center;gap:8px;padding:9px 11px;cursor:pointer}.wf-errors summary>b{width:27px;height:27px;display:grid;place-items:center;border-radius:8px;background:var(--critical-bg);color:var(--critical)}.wf-errors details>div{padding:0 14px 14px;border-top:1px solid var(--border)}.wf-errors article{padding:9px;margin-bottom:6px;border:1px solid var(--border);border-radius:9px;background:var(--surface)}.wf-errors article small{display:block;margin-top:4px;color:var(--muted)}.wf-inline,.wf-final-actions{display:flex;gap:7px;flex-wrap:wrap;margin-top:12px}.wf-inline button,.wf-final-actions button{min-height:39px;padding:0 11px;border:1px solid var(--border);border-radius:9px;background:var(--surface-3);color:var(--text);font-weight:800}
.wf-rollback{display:grid;gap:7px;margin-top:13px}.wf-rollback article{display:grid;grid-template-columns:auto 1fr;gap:8px;padding:11px;border:1px solid var(--border);border-radius:10px;background:var(--surface-3)}.wf-rollback article.done{background:var(--low-bg);border-color:var(--low)}.wf-rollback input{width:19px;height:19px}
.wf-final{display:grid;grid-template-columns:48px 1fr;align-items:center;gap:11px}.wf-final>b{width:46px;height:46px;display:grid;place-items:center;border-radius:50%;font-size:1.1rem}.wf-final.ready{background:var(--low-bg);color:var(--low);border-color:var(--low)}.wf-final.ready>b{background:var(--low);color:#fff}.wf-final.gaps{background:var(--medium-bg);color:var(--medium)}.wf-final p{margin:2px 0}.wf-summary{display:grid;grid-template-columns:repeat(4,1fr);gap:7px;margin-top:12px}.wf-summary article{min-height:72px;display:grid;place-items:center;align-content:center;border:1px solid var(--border);border-radius:10px;background:var(--surface-3)}.wf-summary span{color:var(--muted);font-size:.62rem}.wf-report{max-height:270px;overflow:auto;white-space:pre-wrap;direction:rtl;text-align:right;background:var(--code-bg);color:var(--code-text);font-family:Tahoma,Arial,sans-serif;font-size:.73rem}.wf-final-actions .complete{background:var(--low);color:#fff;border-color:var(--low)}
@media(max-width:1050px){.workflow-launch{grid-template-columns:1fr}.workflow-launch__examples{grid-template-columns:repeat(2,1fr)}.workflow-dialog__shell{grid-template-columns:220px 1fr}.wf-cards{grid-template-columns:1fr}}
@media(max-width:760px){.workflow-launch{padding:17px}.workflow-launch__examples{grid-template-columns:1fr}.workflow-dialog{width:100%;height:100%;max-height:100%;border:0;border-radius:0}.workflow-dialog__topbar{min-height:61px;padding:7px}.workflow-dialog__identity small{display:none}.workflow-dialog__identity strong{max-width:165px;font-size:.76rem}.workflow-dialog__actions button:not(.workflow-dialog__close){padding:0 7px;font-size:.63rem}.workflow-dialog__shell{height:calc(100% - 61px);grid-template-columns:1fr;grid-template-rows:auto 1fr}.workflow-sidebar{overflow-x:auto;overflow-y:hidden;padding:7px;border-left:0;border-bottom:1px solid var(--border)}.wf-progress,.wf-side-meta,.wf-side-label,.workflow-sidebar>.wf-resume{display:none}.wf-stages{display:flex;min-width:max-content}.wf-stages button{width:105px;min-height:45px;grid-template-columns:26px 1fr}.wf-stages button>span{width:25px;height:25px}.wf-stages small{display:none}.workflow-sidebar>button{display:inline-flex;width:auto;min-width:100px;margin:0 5px 0 0}.workflow-content{padding:15px 11px}.workflow-footer{gap:6px;padding:7px}.workflow-footer button{padding:0 8px;font-size:.65rem}.wf-library-controls{align-items:stretch;flex-direction:column}.wf-library-controls>input{width:100%}.wf-vars{grid-template-columns:1fr}.wf-command>header{flex-direction:column}.wf-outcomes,.wf-outcomes.two{grid-template-columns:1fr}.wf-summary{grid-template-columns:repeat(2,1fr)}.guided-workflow-entry{grid-template-columns:1fr}.guided-workflow-entry>button{width:100%}}


/* Phase 5 Rebuild — Execution Diagnostic Engine */
.wf-output-analyzer{
  margin-top:14px;overflow:hidden;border:1px solid color-mix(in srgb,#5f5cff 34%,var(--border));
  border-radius:14px;background:color-mix(in srgb,#5f5cff 6%,var(--surface))
}
.wf-output-analyzer>header{min-height:56px;display:flex;align-items:center;justify-content:space-between;gap:14px;padding:10px 13px;border-bottom:1px solid var(--border)}
.wf-output-analyzer>header>div{display:flex;align-items:center;gap:10px}
.wf-output-analyzer>header>div>span{width:34px;height:34px;display:grid;place-items:center;border-radius:10px;background:#5f5cff;color:#fff;font-weight:900}
.wf-output-analyzer>header strong,.wf-output-analyzer>header small{display:block}
.wf-output-analyzer>header small,.wf-output-analyzer>header>b{color:var(--muted);font-size:.67rem}
.wf-output-analyzer textarea,.wf-followup textarea{width:100%;min-height:155px;display:block;resize:vertical;padding:14px;border:0;border-bottom:1px solid var(--border);outline:0;background:var(--code-bg);color:var(--code-text);direction:ltr;text-align:left;font:13px/1.7 Consolas,"Courier New",monospace}
.wf-output-analyzer textarea:focus,.wf-followup textarea:focus{box-shadow:inset 0 0 0 2px color-mix(in srgb,#5f5cff 55%,transparent)}
.wf-analyzer-actions{display:flex;flex-wrap:wrap;gap:7px;padding:10px}
.wf-analyzer-actions button,.wf-followup>button,.wf-diagnosis-actions button{min-height:39px;padding:0 13px;border:1px solid var(--border);border-radius:9px;background:var(--surface);color:var(--text);font-weight:800}
.wf-analyzer-actions .analyze,.wf-followup>button.analyze{border-color:#5f5cff;background:#5f5cff;color:#fff}
.wf-analysis-placeholder{min-height:95px;display:grid;grid-template-columns:42px 1fr;align-items:center;gap:12px;margin-top:13px;padding:14px;border:1px dashed var(--border);border-radius:12px;background:var(--surface)}
.wf-analysis-placeholder>span{width:40px;height:40px;display:grid;place-items:center;border-radius:12px;background:var(--surface-2);color:#5f5cff;font-size:1.15rem}
.wf-analysis-placeholder strong,.wf-analysis-placeholder p{display:block;margin:0}
.wf-analysis-placeholder p{color:var(--muted);font-size:.76rem}
.wf-diagnosis{margin-top:14px;padding:17px;border:1px solid var(--border);border-top:4px solid var(--medium);border-radius:15px;background:var(--surface-3)}
.wf-diagnosis.success{border-top-color:var(--low)}.wf-diagnosis.issue{border-top-color:var(--critical)}
.wf-diagnosis>header{display:grid;grid-template-columns:43px 1fr auto;align-items:center;gap:11px}
.wf-diagnosis>header>span{width:41px;height:41px;display:grid;place-items:center;border-radius:12px;background:var(--medium-bg);color:var(--medium);font-size:1rem;font-weight:900}
.wf-diagnosis.success>header>span{background:var(--low-bg);color:var(--low)}.wf-diagnosis.issue>header>span{background:var(--critical-bg);color:var(--critical)}
.wf-diagnosis>header small,.wf-diagnosis>header h3{display:block;margin:0}.wf-diagnosis>header small{color:var(--muted);font-size:.67rem}
.wf-diagnosis>header>b{padding:5px 8px;border-radius:999px;background:var(--surface-2);color:var(--muted);font-size:.68rem}
.wf-diagnosis-explanation{margin:12px 0 0}.wf-evidence{margin-top:12px}.wf-evidence>strong{display:block;margin-bottom:5px;color:var(--muted);font-size:.71rem}
.wf-evidence pre,.wf-collected-findings pre{max-height:190px;overflow:auto;margin:0;padding:11px;border-radius:9px;background:var(--code-bg);color:var(--code-text);direction:ltr;text-align:left;white-space:pre-wrap;font:12px/1.6 Consolas,"Courier New",monospace}
.wf-diagnosis-list,.wf-fixes{margin-top:13px;padding:12px;border-radius:10px;background:var(--surface)}
.wf-diagnosis-list h4,.wf-fixes h4,.wf-next-checks h4{margin:0 0 7px}.wf-diagnosis-list ul,.wf-fixes ol{margin-bottom:0}
.wf-alternatives{display:flex;flex-wrap:wrap;gap:6px;margin-top:12px}.wf-alternatives>strong{width:100%;color:var(--muted);font-size:.7rem}
.wf-alternatives span{padding:5px 8px;border-radius:999px;background:var(--surface-2);font-size:.69rem}.wf-alternatives span b{color:var(--muted)}
.wf-next-checks{display:grid;gap:8px;margin-top:14px}.wf-next-checks>article{padding:11px;border:1px solid var(--border);border-radius:11px;background:var(--surface)}
.wf-next-checks>article>div:first-child strong,.wf-next-checks>article>div:first-child small{display:block}.wf-next-checks>article>div:first-child small{color:var(--muted);font-size:.69rem}
.wf-next-checks.verification>article{border-color:color-mix(in srgb,var(--low) 34%,var(--border))}
.wf-followup{margin-top:15px;overflow:hidden;padding:13px;border:1px solid color-mix(in srgb,#5f5cff 45%,var(--border));border-radius:13px;background:color-mix(in srgb,#5f5cff 7%,var(--surface))}
.wf-followup>header{display:flex;align-items:center;gap:9px;margin-bottom:8px}.wf-followup>header>span{width:31px;height:31px;display:grid;place-items:center;border-radius:9px;background:#5f5cff;color:#fff}
.wf-followup>header strong,.wf-followup>header small{display:block}.wf-followup>header small,.wf-followup>p{color:var(--muted);font-size:.69rem}
.wf-followup textarea{min-height:120px;margin-top:9px;border:1px solid var(--border);border-radius:9px}.wf-followup>button{margin-top:8px}
.wf-analysis-history{margin-top:13px;border-top:1px solid var(--border);padding-top:10px}.wf-analysis-history summary{cursor:pointer;color:var(--muted);font-size:.75rem;font-weight:800}
.wf-analysis-history article{display:grid;grid-template-columns:28px 1fr;align-items:center;gap:8px;margin-top:6px;padding:7px;border-radius:8px;background:var(--surface)}
.wf-analysis-history article>b{width:26px;height:26px;display:grid;place-items:center;border-radius:7px;background:var(--surface-2);font-size:.67rem}
.wf-analysis-history strong,.wf-analysis-history small{display:block}.wf-analysis-history small{color:var(--muted);font-size:.65rem}
.wf-diagnosis-actions{display:flex;flex-wrap:wrap;gap:7px;margin-top:13px}.wf-diagnosis-actions .accept{border-color:var(--low);background:var(--low);color:#fff}
.wf-collected-findings{display:grid;gap:9px;margin-bottom:17px}.wf-collected-findings>h3{margin-bottom:1px}
.wf-collected-findings>article{padding:12px;border:1px solid var(--border);border-right:4px solid var(--medium);border-radius:11px;background:var(--surface-3)}
.wf-collected-findings>article.issue{border-right-color:var(--critical)}.wf-collected-findings>article.success{border-right-color:var(--low)}
.wf-collected-findings article>header{display:flex;align-items:center;gap:9px}.wf-collected-findings article>header>span{width:30px;height:30px;display:grid;place-items:center;border-radius:9px;background:var(--surface-2);font-weight:900}
.wf-collected-findings article header strong,.wf-collected-findings article header small{display:block}.wf-collected-findings article header small{color:var(--muted);font-size:.66rem}
.wf-collected-findings article>p{margin:8px 0}
@media(max-width:620px){
  .wf-diagnosis>header{grid-template-columns:38px 1fr}.wf-diagnosis>header>b{grid-column:2;justify-self:start}
  .wf-output-analyzer>header{align-items:start}.wf-output-analyzer>header>b{display:none}
  .wf-analyzer-actions{display:grid;grid-template-columns:1fr 1fr}
}


/* Bilingual navigation and native English LTR support */
.language-switch{min-width:42px;height:38px;display:inline-grid;place-items:center;padding:0 10px;border:1px solid var(--border);border-radius:10px;background:var(--surface-3);color:var(--text);font-size:.74rem;font-weight:900;text-decoration:none}
.language-switch:hover{border-color:var(--accent);color:var(--accent)}
html[dir="ltr"] body{direction:ltr;text-align:left}
html[dir="ltr"] .brand,html[dir="ltr"] .topbar__actions,html[dir="ltr"] .hero-workflow-button,html[dir="ltr"] .doctor-launch__content,html[dir="ltr"] .workflow-launch__content,html[dir="ltr"] .entity-card,html[dir="ltr"] .dialog-content,html[dir="ltr"] .workflow-content,html[dir="ltr"] .doctor-dialog__content{text-align:left}
html[dir="ltr"] .filters label,html[dir="ltr"] .variable-field,html[dir="ltr"] .intent-field{text-align:left}
html[dir="ltr"] .hero-workflow-button,html[dir="ltr"] .doctor-launch__content button,html[dir="ltr"] .workflow-launch__actions{direction:ltr}
html[dir="ltr"] .workflow-sidebar{border-left:0;border-right:1px solid var(--border)}
html[dir="ltr"] .dialog-side{border-right:0;border-left:1px solid var(--border)}
html[dir="ltr"] code,html[dir="ltr"] pre,html[dir="ltr"] .command-box,html[dir="ltr"] .wf-code,html[dir="ltr"] .workflow-command-box{direction:ltr;text-align:left}
@media(max-width:760px){html[dir="ltr"] .workflow-sidebar{border-right:0}}
