/* Work Guide styles ported from the previous PI application. */
.figure-description { margin: 8px 0; line-height: 1.5; color: #52606d; }
.source-page-button { margin-top: 5px; }
.training-preview-note { line-height: 1.5; }
.app.training-mode {
  grid-template-columns: var(--left-column-width) var(--resizer-width) minmax(0, 1fr);
}
:root {
      color-scheme: light;
      --bg: #f2f5f7;
      --panel: #ffffff;
      --panel-2: #f7f9fb;
      --panel-3: #edf1f5;
      --line: #e1e7ec;
      --line-strong: #cbd5df;
      --text: #101820;
      --muted: #455361;
      --soft: #607080;
      --blue: #1f66d1;
      --blue-2: #e9f2ff;
      --green: #177245;
      --green-2: #e7f7ee;
      --amber: #996515;
      --amber-2: #fff4d8;
      --red: #b33a32;
      --red-2: #fff0ee;
      --teal: #087f70;
      --teal-2: #e1f7f2;
      --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      --sans: "Segoe UI Variable Text", Aptos, "Segoe UI", ui-sans-serif, system-ui, sans-serif;
      --brand-font: Bahnschrift, "Helvetica Neue", Arial, sans-serif;
      --training-font: "Segoe UI Variable Text", Aptos, "Segoe UI", var(--sans);
      --shadow-sm: 0 1px 2px rgba(23, 33, 43, .05), 0 1px 5px rgba(23, 33, 43, .035);
      --shadow-md: 0 8px 24px rgba(23, 33, 43, .08);
    }
    * { box-sizing: border-box; }
    html, body { height: 100%; min-width: 0; }
    html:has(.figure-viewer[open]) { overflow: hidden; }
    body {
      display: flex;
      flex-direction: column;
      margin: 0;
      color: var(--text);
      background: var(--bg);
      font-family: var(--sans);
      font-size: 14px;
      line-height: 1.45;
      overflow-x: hidden;
    }
    * {
      scrollbar-width: thin;
      scrollbar-color: #c5ced8 transparent;
    }
    *::-webkit-scrollbar { width: 9px; height: 9px; }
    *::-webkit-scrollbar-thumb {
      border: 2px solid transparent;
      border-radius: 999px;
      background: #c5ced8;
      background-clip: padding-box;
    }
    button, input, select {
      font: inherit;
      transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
    }
    button {
      border: 1px solid var(--line-strong);
      color: var(--text);
      background: var(--panel);
      border-radius: 8px;
      padding: 8px 12px;
      cursor: pointer;
      font-weight: 600;
    }
    button:hover { border-color: var(--blue); }
    button:focus-visible,
    input:focus-visible,
    select:focus-visible {
      outline: 3px solid rgba(31, 102, 209, .2);
      outline-offset: 2px;
    }
    button.primary {
      color: white;
      border-color: var(--blue);
      background: var(--blue);
    }
    header {
      flex-shrink: 0;
      height: 66px;
      display: grid;
      grid-template-columns: minmax(240px, 1fr) auto;
      gap: 18px;
      align-items: center;
      padding: 7px 20px;
      border-bottom: 1px solid var(--line);
      background: var(--panel);
      position: sticky;
      top: 0;
      z-index: 5;
      box-shadow: var(--shadow-sm);
    }
    .brand {
      display: flex;
      align-items: center;
      gap: 11px;
      min-width: 0;
    }
    .brand-logo {
      width: 40.8px;
      height: 30px;
      flex: 0 0 40.8px;
      position: relative;
      overflow: hidden;
    }
    .brand-logo img {
      /* Hide the supplied image's white margins without changing the artwork. */
      position: absolute;
      width: 60px;
      max-width: none;
      height: auto;
      left: -12px;
      top: -10.8px;
      display: block;
    }
    .brand-copy { min-width: 0; }
    .brand h1 {
      margin: 0;
      font-family: var(--brand-font);
      font-size: 20px;
      font-weight: 600;
      line-height: 1.2;
      letter-spacing: 0;
      overflow-wrap: anywhere;
    }
    .brand span {
      color: var(--muted);
      display: block;
      font-size: 11px;
      margin-top: 2px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .doc-picker {
      display: grid;
      grid-template-columns: auto minmax(260px, 1fr) auto;
      gap: 10px;
      align-items: center;
    }
    .doc-picker select {
      min-width: 0;
      width: 100%;
      max-width: 48vw;
      border: 1px solid var(--line-strong);
      background: var(--panel);
      color: var(--text);
      border-radius: 8px;
      padding: 8px 34px 8px 11px;
      min-height: 40px;
      box-shadow: var(--shadow-sm);
    }
    .sr-only {
      position: absolute !important;
      width: 1px !important;
      height: 1px !important;
      padding: 0 !important;
      margin: -1px !important;
      overflow: hidden !important;
      clip: rect(0, 0, 0, 0) !important;
      white-space: nowrap !important;
      border: 0 !important;
    }
    .manual-picker {
      position: relative;
      min-width: 0;
      width: min(360px, 48vw);
    }
    .manual-picker-button {
      position: relative;
      width: 100%;
      min-height: 40px;
      padding: 8px 38px 8px 12px;
      overflow: hidden;
      border-color: var(--line-strong);
      background: var(--panel);
      box-shadow: var(--shadow-sm);
      color: var(--text);
      text-align: left;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .manual-picker-button::after {
      content: "";
      position: absolute;
      top: 50%;
      right: 15px;
      width: 7px;
      height: 7px;
      border-right: 2px solid #667486;
      border-bottom: 2px solid #667486;
      transform: translateY(-70%) rotate(45deg);
      transition: transform 160ms ease;
    }
    .manual-picker-button[aria-expanded="true"]::after {
      transform: translateY(-25%) rotate(225deg);
    }
    .manual-picker-menu {
      position: absolute;
      top: calc(100% + 8px);
      right: 0;
      z-index: 20;
      width: min(420px, calc(100vw - 32px));
      max-height: min(480px, calc(100vh - 92px));
      padding: 7px;
      overflow: auto;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: rgba(255, 255, 255, .98);
      box-shadow: 0 18px 48px rgba(23, 33, 43, .16), 0 3px 10px rgba(23, 33, 43, .08);
    }
    .manual-picker-menu[hidden] { display: none; }
    .manual-group-label {
      padding: 9px 10px 5px;
      color: var(--muted);
      font-size: 10px;
      font-weight: 750;
      letter-spacing: 0;
      text-transform: uppercase;
    }
    .manual-option {
      width: 100%;
      min-height: 40px;
      display: grid;
      grid-template-columns: minmax(0, 1fr) 12px;
      gap: 12px;
      align-items: center;
      border: 0;
      padding: 9px 10px;
      background: transparent;
      color: #273544;
      text-align: left;
      font-weight: 550;
    }
    .manual-option:hover,
    .manual-option:focus-visible {
      background: #eef4fb;
      color: #174f9f;
    }
    .manual-option::after {
      content: "";
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: transparent;
    }
    .manual-option[aria-checked="true"] {
      background: #e8f1fd;
      color: #174f9f;
      font-weight: 680;
    }
    .manual-option[aria-checked="true"]::after {
      background: var(--blue);
      box-shadow: 0 0 0 3px #d8e7fa;
    }
    .doc-picker label {
      font-size: 12px;
      font-weight: 650;
    }
    #copyLinkBtn {
      min-height: 40px;
      border-color: transparent;
      background: var(--panel-3);
      color: #314052;
    }
    #copyLinkBtn:hover {
      border-color: #c5d0dc;
      background: #e4eaf0;
    }
    #copyLinkBtn.copied {
      color: var(--green);
      background: var(--green-2);
    }
    .app {
      --left-column-width: 310px;
      --right-column-width: 360px;
      --resizer-width: 8px;
      height: auto;
      flex: 1;
      display: grid;
      grid-template-columns:
        var(--left-column-width)
        var(--resizer-width)
        minmax(420px, 1fr)
        var(--resizer-width)
        var(--right-column-width);
      min-height: 0;
    }
    aside, main {
      min-height: 0;
      min-width: 0;
      max-width: 100%;
      overflow: auto;
    }
    .left {
      background: #fbfcfd;
    }
    .right {
      background: #fbfcfd;
    }
    main {
      display: flex;
      flex-direction: column;
      overflow: hidden;
      background: var(--bg);
    }
    [hidden] { display: none !important; }
    .content-tabs {
      display: flex;
      flex: 0 0 auto;
      gap: 24px;
      padding: 0 28px;
      border-bottom: 1px solid var(--line);
      background: var(--panel);
    }
    .content-tab {
      min-height: 52px;
      padding: 14px 0 12px;
      border: 0;
      border-bottom: 3px solid transparent;
      border-radius: 0;
      background: transparent;
      color: var(--muted);
      font-size: 13px;
      white-space: nowrap;
    }
    .content-tab:hover { color: var(--text); border-bottom-color: var(--line-strong); }
    .content-tab[aria-selected="true"] { color: var(--teal); border-bottom-color: var(--teal); }
    .column-resizer {
      position: relative;
      min-width: var(--resizer-width);
      background: #edf1f4;
      cursor: col-resize;
      touch-action: none;
      outline: none;
    }
    .column-resizer::after {
      content: "";
      position: absolute;
      inset: 0 auto 0 50%;
      width: 1px;
      background: var(--line-strong);
      transform: translateX(-50%);
      transition: width 120ms ease, background 120ms ease;
    }
    .column-resizer:hover::after,
    .column-resizer:focus-visible::after,
    .column-resizer.active::after {
      width: 3px;
      background: var(--blue);
    }
    body.resizing-columns {
      cursor: col-resize;
      user-select: none;
    }
    .content {
      flex: 1;
      min-height: 0;
      overflow: auto;
      width: 100%;
      max-width: 1120px;
      margin: 0 auto;
      padding: 22px 22px 36px;
    }
    .section {
      padding: 18px;
      border-bottom: 1px solid var(--line);
    }
    .section.tight { padding: 14px 16px; }
    .right .section { border-bottom: 0; }
    .section h2,
    .section h3 {
      margin: 0 0 10px;
      font-size: 12px;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0;
      font-weight: 700;
    }
    .summary-title {
      font-family: var(--brand-font);
      font-size: 22px;
      font-weight: 500;
      line-height: 1.35;
      letter-spacing: 0;
      overflow-wrap: anywhere;
      margin-bottom: 12px;
    }
    .muted { color: var(--muted); }
    .mono {
      font-family: var(--mono);
      font-size: 12px;
    }
    .stats {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 6px;
      background: transparent;
    }
    .stat {
      padding: 10px 6px;
      border: 1px solid var(--line);
      border-radius: 7px;
      background: var(--panel);
      min-width: 0;
    }
    .stat b {
      display: block;
      font-size: 20px;
      font-weight: 720;
      line-height: 1;
    }
    .stat span {
      display: block;
      color: var(--muted);
      font-size: 10px;
      margin-top: 5px;
      letter-spacing: 0;
      text-transform: none;
      white-space: nowrap;
    }
    .search {
      width: 100%;
      border: 1px solid var(--line-strong);
      border-radius: 8px;
      padding: 10px 12px;
      background: var(--panel);
      color: var(--text);
      box-shadow: var(--shadow-sm);
    }
    .tree {
      display: grid;
      gap: 4px;
    }
    .proc {
      min-width: 0;
    }
    .proc-row {
      display: grid;
      grid-template-columns: 36px minmax(0, 1fr) 30px;
      align-items: stretch;
      min-height: 54px;
      border: 1px solid transparent;
      border-radius: 7px;
      transition: background .16s ease, border-color .16s ease, box-shadow .16s ease;
    }
    .proc-row:hover {
      background: #f5f8fb;
      border-color: #e4e9ef;
    }
    .proc.active > .proc-row {
      border-color: #b9d3f4;
      background: #eaf3ff;
      box-shadow: inset 3px 0 0 var(--blue);
    }
    .proc.has-active-descendant > .proc-row {
      background: #f5f9fe;
      border-color: #e1eaf5;
    }
    .section-number {
      display: flex;
      align-items: flex-start;
      justify-content: center;
      padding-top: 12px;
      color: #52708f;
      font-size: 11px;
      font-weight: 760;
      line-height: 1;
      font-variant-numeric: tabular-nums;
    }
    .proc.active > .proc-row .section-number {
      color: #1255ad;
    }
    .proc-head {
      width: 100%;
      border: 0;
      background: transparent;
      text-align: left;
      padding: 9px 4px 9px 0;
      border-radius: 0;
      min-width: 0;
    }
    .proc-title {
      color: var(--text);
      font-weight: 650;
      line-height: 1.3;
      overflow-wrap: anywhere;
    }
    .proc.active > .proc-row .proc-title { color: #114f9e; }
    .proc-meta {
      color: var(--muted);
      font-size: 11px;
      margin-top: 4px;
      line-height: 1.25;
    }
    .section-toggle {
      position: relative;
      width: 30px;
      min-width: 30px;
      border: 0;
      border-radius: 6px;
      background: transparent;
      color: #60758c;
    }
    .section-toggle:hover { background: rgba(31, 102, 209, .08); }
    .section-toggle::before {
      content: "";
      position: absolute;
      top: 21px;
      left: 10px;
      width: 7px;
      height: 7px;
      border-right: 1.7px solid currentColor;
      border-bottom: 1.7px solid currentColor;
      transform: rotate(-45deg);
      transition: transform .16s ease, top .16s ease;
    }
    .section-toggle[aria-expanded="true"]::before {
      top: 19px;
      transform: rotate(45deg);
    }
    .section-toggle-spacer {
      width: 30px;
    }
    .task-list {
      display: grid;
      gap: 3px;
      padding: 3px 0 5px 9px;
    }
    .proc-children {
      display: none;
      margin-left: 17px;
      padding: 3px 0 3px 10px;
      border-left: 1px solid #dce4ed;
    }
    .proc-children.open { display: block; }
    .proc-children > .proc + .proc { margin-top: 3px; }
    .proc-children .proc-row {
      grid-template-columns: 36px minmax(0, 1fr) 30px;
      min-height: 50px;
    }
    .proc-children .section-number { padding-top: 11px; }
    .proc-children .section-toggle::before { top: 19px; }
    .proc-children .section-toggle[aria-expanded="true"]::before { top: 17px; }
    .task-list + .proc { margin-top: 3px; }
    .flat-navigation { padding: 6px 0 8px 8px; }
    .flat-navigation .task-list { padding: 2px 0 8px; }
    .nav-group-heading, .nav-context-label {
      display: flex;
      align-items: baseline;
      gap: 8px;
      width: 100%;
      padding: 9px 8px 5px;
      border: 0;
      border-radius: 4px;
      background: transparent;
      text-align: left;
      overflow-wrap: anywhere;
    }
    .nav-group-heading { font-size: 13px; font-weight: 700; }
    .nav-group-heading .section-number { padding: 0; flex: 0 0 auto; }
    .nav-context-label { font-size: 12px; color: var(--muted); font-weight: 500; }
    .nav-group-heading.active { color: #174f9f; background: #e9f2ff; }
    .task-empty {
      color: var(--muted);
      font-size: 11px;
      padding: 6px 9px 7px;
    }
    .task-btn {
      border: 0;
      background: transparent;
      text-align: left;
      padding: 8px 9px;
      border-radius: 7px;
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 8px;
      align-items: start;
      font-weight: 500;
    }
    .task-btn:hover,
    .task-btn.active {
      background: #e4effd;
      color: #174f9f;
    }
    .task-btn span:first-child {
      line-height: 1.35;
      overflow-wrap: anywhere;
    }
    .task-btn .pill {
      align-self: start;
      justify-self: end;
    }
    .pill-row {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      align-items: center;
    }
    .pill {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      min-height: 22px;
      padding: 3px 8px;
      border: 1px solid var(--line);
      border-radius: 999px;
      background: var(--panel-2);
      color: var(--muted);
      font-size: 11px;
      font-weight: 650;
      line-height: 1.2;
      white-space: nowrap;
    }
    .pill.good { color: var(--green); border-color: #b8dfc9; background: var(--green-2); }
    .pill.review { color: var(--amber); border-color: #ead28f; background: var(--amber-2); }
    .pill.blocked { color: var(--red); border-color: #efbbb6; background: var(--red-2); }
    .pill.blue { color: #1b58ad; border-color: #c6daf6; background: var(--blue-2); }
    .pill.teal { color: var(--teal); border-color: #addfd5; background: var(--teal-2); }
    .hero {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      align-items: start;
      gap: 8px 16px;
      padding: 2px 0 8px;
      border-bottom: 1px solid var(--line-strong);
      background: transparent;
    }
    .hero h2 {
      margin: 0;
      font-size: 28px;
      font-weight: 720;
      letter-spacing: 0;
      line-height: 1.2;
      overflow-wrap: anywhere;
    }
    .hero .sub {
      color: var(--muted);
      font-size: 13px;
      line-height: 1.5;
    }
    .hero .release-section {
      margin: 3px 0 0;
      text-align: right;
      white-space: nowrap;
    }
    .grid {
      display: grid;
      gap: 14px;
    }
    .grid.two {
      grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
    .panel {
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel);
      overflow: hidden;
      box-shadow: var(--shadow-sm);
    }
    .panel-head {
      display: flex;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 12px;
      align-items: center;
      padding: 11px 14px;
      border-bottom: 1px solid var(--line);
      background: var(--panel);
    }
    .panel-head h3 {
      margin: 0;
      font-size: 14px;
      font-weight: 700;
      text-transform: none;
      letter-spacing: 0;
      color: var(--text);
    }
    .panel-body {
      padding: 12px 14px;
    }
    .safety-panel {
      border-left: 4px solid var(--red);
    }
    .instructions-panel .panel-body {
      padding: 0 14px;
    }
    .instruction-preparation { padding: 12px 0; border-bottom: 1px solid var(--line); }
    .instruction-preparation .context-group h4 { margin-bottom: 4px; }
    .steps {
      display: grid;
      gap: 0;
      margin: 0;
      padding: 0;
      list-style: none;
    }
    .step {
      display: grid;
      grid-template-columns: 30px minmax(0, 1fr);
      gap: 10px;
      align-items: start;
      padding: 12px 0;
      border-bottom: 1px solid var(--line);
      background: transparent;
      min-width: 0;
    }
    .step:last-child { border-bottom: 0; }
    .step-num {
      width: 28px;
      height: 28px;
      border-radius: 6px;
      background: #e7f0fc;
      color: #1b58ad;
      display: grid;
      place-items: center;
      font-weight: 700;
      font-size: 13px;
      font-family: var(--sans);
      box-shadow: inset 0 0 0 1px #d1e0f3;
    }
    .step-text {
      color: var(--text);
      font-size: 16px;
      line-height: 1.6;
      overflow-wrap: anywhere;
    }
    /* Sub-procedure / Branching scenario cards */
    .step-branch-item {
      list-style: none;
      padding: 12px 0;
      border-bottom: 1px solid var(--line);
    }
    .step-branch-item:last-child {
      border-bottom: 0;
    }
    .step-branch-card {
      background: var(--panel-2, #f8fafc);
      border: 1px solid rgba(13, 148, 136, 0.3);
      border-left: 4px solid var(--teal, #0d9488);
      border-radius: 8px;
      padding: 14px 16px;
    }
    .step-branch-header {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 12px;
      font-size: 15px;
      font-weight: 700;
      color: var(--teal, #0f766e);
    }
    .step-branch-pill {
      background: rgba(13, 148, 136, 0.15);
      color: var(--teal, #0d9488);
      font-size: 11.5px;
      font-weight: 700;
      padding: 3px 8px;
      border-radius: 4px;
      letter-spacing: 0.3px;
      white-space: nowrap;
    }
    .branch-substeps-list {
      display: flex;
      flex-direction: column;
      gap: 10px;
      margin: 0;
      padding: 0;
      list-style: none;
    }
    .branch-substep-item {
      display: grid;
      grid-template-columns: 24px minmax(0, 1fr);
      gap: 10px;
      align-items: start;
    }
    .branch-substep-letter {
      width: 22px;
      height: 22px;
      border-radius: 50%;
      background: #ffffff;
      border: 1px solid #99f6e4;
      color: #0f766e;
      display: grid;
      place-items: center;
      font-weight: 700;
      font-size: 12px;
      box-shadow: 0 1px 2px rgba(0,0,0,0.05);
      margin-top: 2px;
    }
    .sim-branch-header {
      display: flex;
      align-items: center;
      gap: 8px;
      margin: 12px 0 6px 0;
      padding: 6px 10px;
      background: rgba(13, 148, 136, 0.08);
      border-left: 3px solid var(--teal, #0d9488);
      border-radius: 4px;
      font-size: 12.5px;
      color: #0f766e;
    }
    .sim-substep-item {
      margin-left: 14px;
      border-left: 2px solid #99f6e4;
    }
    .prerequisites-panel .panel-body {
      font-size: 16px;
      line-height: 1.6;
    }
    .prerequisites-panel .context-group ul {
      font-size: inherit;
      line-height: inherit;
    }
    .procedure-source {
      justify-self: start;
      padding: 6px 0 12px;
      font-size: 13px;
    }
    .reference-instructions { margin: 0; padding: 12px 0 12px 22px; }
    .reference-instructions li + li { margin-top: 10px; }
    .substeps {
      display: grid;
      gap: 8px;
      margin-top: 10px;
      padding-left: 12px;
      border-left: 2px solid #cbd9e8;
    }
    .substep {
      padding: 9px 10px;
      border: 0;
      border-radius: 7px;
      background: var(--panel-2);
    }
    .substep-head {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 5px;
    }
    .source-link,
    .node-link {
      color: var(--blue);
      text-decoration: none;
      cursor: pointer;
    }
    button.node-link {
      border: 0;
      border-radius: 0;
      padding: 0;
      background: transparent;
      text-align: left;
    }
    .source-link:hover,
    .node-link:hover {
      text-decoration: underline;
    }
    .source-list {
      display: grid;
      gap: 8px;
    }
    .source {
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 12px;
      background: var(--panel-2);
    }
    .source .txt {
      line-height: 1.45;
      margin-top: 6px;
      color: #344054;
    }
    .finding-list {
      display: grid;
      gap: 8px;
      max-height: 220px;
      overflow: auto;
    }
    .finding {
      border: 1px solid var(--line);
      border-left-width: 4px;
      border-radius: 8px;
      padding: 9px 10px;
      background: var(--panel-2);
    }
    .finding.error { border-left-color: var(--red); }
    .finding.warning { border-left-color: var(--amber); }
    .kv {
      display: grid;
      grid-template-columns: 120px minmax(0, 1fr);
      gap: 6px 10px;
      font-size: 12px;
    }
    .kv dt {
      margin: 0;
      color: var(--muted);
    }
    .kv dd {
      margin: 0;
      min-width: 0;
      word-break: break-word;
    }
    pre.raw {
      margin: 0;
      white-space: pre-wrap;
      word-break: break-word;
      font-family: var(--mono);
      font-size: 11px;
      line-height: 1.45;
      color: #243042;
    }
    .tabs {
      display: flex;
      gap: 6px;
      margin: 16px 0 14px;
      border-bottom: 1px solid var(--line);
    }
    .tab {
      border: 0;
      border-bottom: 2px solid transparent;
      background: transparent;
      border-radius: 0;
      padding: 9px 10px;
      color: var(--muted);
    }
    .tab.active {
      color: var(--blue);
      border-bottom-color: var(--blue);
    }
    .figure-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
      gap: 12px;
    }
    figure {
      margin: 0;
      min-width: 0;
    }
    figure img {
      width: 100%;
      height: 190px;
      object-fit: contain;
      display: block;
      background: #fff;
      border: 1px solid var(--line);
      border-radius: 8px;
      box-shadow: var(--shadow-sm);
    }
    .figure-preview {
      display: block;
      width: 100%;
      padding: 0;
      border: 0;
      background: transparent;
      cursor: zoom-in;
    }
    .figure-preview:hover img { border-color: var(--blue); }
    .figure-viewer {
      position: fixed;
      inset: 0;
      width: 100%;
      max-width: none;
      height: 100dvh;
      max-height: none;
      margin: 0;
      padding: 0;
      border: 0;
      color: var(--text);
      background: var(--panel-2);
      overscroll-behavior: contain;
    }
    .figure-viewer[open] {
      display: grid;
      grid-template-rows: auto minmax(0, 1fr);
    }
    .figure-viewer-head {
      display: flex;
      align-items: center;
      gap: 16px;
      padding: 12px 16px;
      border-bottom: 1px solid var(--line);
      background: var(--panel);
    }
    .figure-viewer-back {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      flex: 0 0 auto;
      min-height: 42px;
    }
    .figure-viewer-back span { font-size: 26px; line-height: 1; }
    .figure-viewer-heading { min-width: 0; }
    .figure-viewer-heading h2 { margin: 0; font-size: 16px; overflow-wrap: anywhere; }
    .figure-viewer-heading p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
    .figure-viewer-stage { min-width: 0; min-height: 0; padding: 20px; }
    .figure-viewer-stage img {
      display: block;
      width: 100%;
      height: 100%;
      object-fit: contain;
    }
    figcaption {
      padding: 9px 2px 0;
      color: var(--muted);
      font-size: 12px;
      line-height: 1.35;
    }
    .figure-caption-head {
      display: grid;
      gap: 6px;
      margin-bottom: 5px;
    }
    .figure-caption-head strong {
      color: var(--text);
      font-size: 13px;
      line-height: 1.4;
    }
    .context-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
      gap: 18px;
    }
    .context-group h4 {
      margin: 0 0 8px;
      font-size: 12px;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0;
      font-weight: 700;
    }
    .context-group ul {
      margin: 0;
      padding-left: 19px;
      color: #1f2933;
      line-height: 1.6;
    }
    .training-heading {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin: 18px 0 14px;
      font-family: var(--training-font);
    }
    .training-heading h2 { margin: 0; font-size: 14px; }
    .training-stack {
      display: grid;
      gap: 14px;
      perspective: 1200px;
    }
    .training-card {
      border: 0;
      border-radius: 8px;
      background: transparent;
      cursor: pointer;
      font-family: var(--training-font);
      outline: none;
      perspective: 1200px;
    }
    .training-card:focus-visible {
      box-shadow: 0 0 0 3px rgba(37, 99, 235, .24);
    }
    .training-card-inner {
      display: grid;
      transform-style: preserve-3d;
      transition: transform 420ms cubic-bezier(.2, .75, .25, 1);
    }
    .training-card.is-flipped .training-card-inner {
      transform: rotateY(180deg);
    }
    .training-card-face {
      grid-area: 1 / 1;
      min-height: 206px;
      display: flex;
      flex-direction: column;
      padding: 16px;
      border: 1px solid var(--line);
      border-top: 3px solid var(--teal);
      border-radius: 8px;
      background: var(--panel);
      box-shadow: 0 5px 16px rgba(16, 24, 40, .07);
      -webkit-backface-visibility: hidden;
      backface-visibility: hidden;
      transition: border-color 140ms ease, box-shadow 140ms ease;
    }
    .training-card:hover .training-card-face {
      border-color: #b8c6d8;
      box-shadow: 0 9px 24px rgba(16, 24, 40, .11);
    }
    .training-card-back {
      border-top-color: var(--blue);
      background: #f8fbff;
      transform: rotateY(180deg);
    }
    .training-card h3,
    .training-card-answer {
      margin: 20px 0 12px;
      color: var(--text);
      font-size: 16px;
      font-weight: 650;
      line-height: 1.45;
      letter-spacing: 0;
      text-transform: none;
    }
    .training-card-answer {
      margin-top: 0;
      padding-top: 16px;
      border-top: 1px solid var(--line);
      font-weight: 500;
      color: var(--text);
    }
    .training-card h3,
    .training-card-answer {
      overflow-wrap: anywhere;
    }
    .training-card-label {
      margin-top: auto;
      padding-top: 12px;
      border-top: 1px solid var(--line);
      color: var(--muted);
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0;
      text-transform: uppercase;
    }
    .training-card-wrap {
      display: grid;
      gap: 8px;
    }
    .field-notes {
      border: 0;
      border-radius: 0;
      background: transparent;
    }
    .helpful-panel .context-grid + .field-notes { margin-top: 12px; border-top: 1px solid var(--line); }
    .field-notes-head {
      min-height: 34px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding: 5px 0;
    }
    .field-notes-title {
      color: var(--text);
      font-size: 13px;
      font-weight: 600;
    }
    .field-notes-edit {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 5px;
      min-height: 30px;
      padding: 4px 8px;
      flex-shrink: 0;
      border: 1px solid var(--line-strong);
      border-radius: 6px;
      background: #fff;
      color: #315d55;
      font-size: 12px;
      line-height: 1.2;
      cursor: pointer;
    }
    .field-notes-edit:hover { background: #eaf4f1; }
    .field-notes-edit .note-icon { width: 14px; font-size: 14px; line-height: 1; text-align: center; }
    .field-notes-body { padding: 4px 0 0; }
    .field-note-list { display: grid; gap: 9px; }
    .field-note-item {
      padding-left: 10px;
      border-left: 3px solid #76a99e;
    }
    .field-note-text {
      color: #162b25;
      font-size: 13px;
      line-height: 1.5;
      white-space: pre-wrap;
      overflow-wrap: anywhere;
    }
    .field-note-meta {
      margin-top: 4px;
      color: var(--muted);
      font-size: 11px;
    }
    .field-notes-empty {
      color: var(--muted);
      font-size: 12px;
      line-height: 1.45;
    }
    .field-note-editor { display: grid; gap: 8px; }
    .field-note-editor textarea {
      width: 100%;
      min-height: 92px;
      resize: vertical;
      padding: 10px;
      border: 1px solid #afc8c2;
      border-radius: 6px;
      background: #fff;
      color: var(--text);
      font: inherit;
      font-size: 13px;
      line-height: 1.45;
    }
    .field-note-editor textarea:focus {
      outline: 0;
      border-color: var(--teal);
      box-shadow: 0 0 0 3px rgba(49, 93, 85, .14);
    }
    .field-note-actions {
      display: flex;
      justify-content: flex-end;
      gap: 8px;
    }
    .field-note-actions button {
      min-height: 34px;
      padding: 7px 12px;
      border: 1px solid #bdd2cd;
      border-radius: 6px;
      background: #fff;
      color: #315d55;
      font-weight: 700;
      cursor: pointer;
    }
    .field-note-actions .save-note {
      border-color: #315d55;
      background: #315d55;
      color: #fff;
    }
    .field-note-actions button:disabled { cursor: wait; opacity: .65; }
    .field-note-error {
      color: #a43f35;
      font-size: 12px;
      line-height: 1.4;
    }
    @media (prefers-reduced-motion: reduce) {
      .training-card-inner { transition: none; }
    }
    .empty {
      color: var(--muted);
      padding: 18px;
      border: 1px dashed #cbd5df;
      border-radius: 8px;
      background: var(--panel-2);
    }
    .mini-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 12px;
    }
    .mini-table th,
    .mini-table td {
      text-align: left;
      vertical-align: top;
      border-bottom: 1px solid var(--line);
      padding: 9px 8px;
    }
    .mini-table th {
      color: var(--muted);
      font-weight: 650;
      background: var(--panel-2);
      position: sticky;
      top: 0;
    }
    .raw-search-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 8px;
      margin-bottom: 12px;
    }
    .chat-panel {
      display: grid;
      grid-template-rows: auto minmax(0, 1fr) auto;
      overflow: hidden;
      background: var(--panel);
    }
    .chat-head {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 12px;
      padding: 15px 16px;
      border-bottom: 1px solid var(--line);
      background: #fbfcfd;
    }
    .chat-head-main { flex: 1; min-width: 0; }
    .chat-head h2 { margin: 0; font-size: 16px; }
    .chat-context {
      margin-top: 3px;
      color: var(--muted);
      font-size: 11px;
      overflow-wrap: anywhere;
    }
    .chat-messages {
      min-height: 0;
      overflow: auto;
      overscroll-behavior: contain;
      padding: 16px;
      background: var(--panel-2);
    }
    .chat-message { margin-bottom: 14px; }
    .chat-message.user { display: flex; justify-content: flex-end; }
    .chat-bubble {
      max-width: 88%;
      padding: 10px 12px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel);
      box-shadow: var(--shadow-sm);
      overflow-wrap: anywhere;
    }
    .chat-message.user .chat-bubble {
      color: #fff;
      border-color: #1f66d1;
      background: #1f66d1;
    }
    .chat-answer-summary { font-weight: 400; margin-bottom: 10px; line-height: 1.6; }
    .chat-answer-section { margin: 10px 0; }
    .chat-answer-section h3 { margin: 0 0 6px; font-size: 13px; font-weight: 650; }
    .chat-answer-list { margin: 0; padding-left: 20px; line-height: 1.6; }
    .chat-answer-list li + li { margin-top: 7px; }
    .chat-answer-warning { border-left: 3px solid var(--red); padding-left: 10px; }
    .chat-answer-block {
      padding: 9px 0;
      border-top: 1px solid var(--line);
      line-height: 1.5;
    }
    .chat-answer-figure {
      display: block;
      width: 100%;
      margin-top: 9px;
      padding: 0;
      overflow: hidden;
      border: 1px solid var(--line);
      border-radius: 6px;
      background: #fff;
      cursor: zoom-in;
    }
    .chat-answer-figure img {
      display: block;
      width: 100%;
      height: 280px;
      max-height: 280px;
      object-fit: contain;
      background: #fff;
    }
    .chat-answer-diagrams { display: grid; gap: 12px; margin-top: 10px; }
    .chat-answer-diagrams figure { width: 100%; }
    .chat-citations { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
    .chat-sources { margin-top: 10px; color: var(--muted); font-size: 12px; }
    .chat-sources summary { width: fit-content; cursor: pointer; }
    .chat-citation { padding: 4px 7px; font-size: 10px; color: var(--blue); background: var(--blue-2); }
    .chat-feedback { display: flex; gap: 6px; margin-top: 8px; }
    .chat-feedback button { padding: 5px 8px; font-size: 11px; }
    .chat-follow-ups { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
    .chat-follow-ups button {
      padding: 6px 8px;
      color: #174f49;
      border-color: #b8d7d2;
      background: #f3faf8;
      font-size: 10px;
      text-align: left;
    }
    .chat-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
    .chat-actions button {
      padding: 6px 9px;
      border-color: #a9c4c0;
      background: #f5fbfa;
      color: #174f49;
      font-size: 11px;
      font-weight: 700;
    }
    .chat-empty { color: var(--muted); text-align: center; padding: 32px 18px; }
    .chat-starters { display: grid; gap: 8px; padding: 0 6px 14px; }
    .chat-starters p { margin: 0 0 2px; color: var(--muted); font-size: 12px; }
    .chat-starters button {
      padding: 10px 12px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel);
      color: var(--blue);
      font: inherit;
      font-size: 13px;
      line-height: 1.45;
      text-align: left;
    }
    .chat-starters button:hover { background: #eaf2fc; border-color: #b8cee9; }
    .chat-composer {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 8px;
      padding: 12px;
      border-top: 1px solid var(--line);
      background: var(--panel);
    }
    .chat-composer input {
      min-width: 0;
      border: 1px solid var(--line-strong);
      border-radius: 8px;
      padding: 10px 11px;
      background: #fff;
    }
    .chat-send { min-width: 72px; }
    .split-actions {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
    }
    @media (max-width: 1180px) {
      .app {
        --left-column-width: 270px;
        --right-column-width: 310px;
      }
    }
    @media (max-width: 960px) {
      body { display: block; height: auto; min-height: 100dvh; }
      header { grid-template-columns: 1fr; height: auto; padding: 12px 16px; }
      .doc-picker { grid-template-columns: auto minmax(0, 1fr) auto; }
      .manual-picker { width: 100%; max-width: none; }
      .app { width: 100%; height: auto; display: block; overflow-x: hidden; }
      .column-resizer { display: none; }
      .left, .right, main { width: 100%; max-width: 100%; overflow-x: hidden; }
      .left, .right { border: 0; }
      .left { max-height: 52vh; border-bottom: 1px solid var(--line); }
      .right { border-top: 1px solid var(--line); height: 70dvh; min-height: 420px; }
      main { overflow: visible; }
      .grid.two { grid-template-columns: 1fr; }
      .content { flex: none; overflow: visible; padding: 24px 20px 40px; }
      .content-tabs { padding: 0 20px; }
    }
    @media (max-width: 560px) {
      header { width: 100%; overflow: hidden; }
      .brand { align-items: center; flex-direction: row; gap: 10px; }
      .brand span { white-space: normal; }
      .doc-picker { width: 100%; min-width: 0; grid-template-columns: minmax(0, 1fr); }
      .doc-picker button { width: 100%; }
      .manual-picker-button span { display: block; overflow: hidden; text-overflow: ellipsis; }
      .manual-picker-menu { left: 0; right: auto; }
      .left .section { width: 100%; overflow: hidden; }
      .summary-title { overflow-wrap: anywhere; }
      .task-btn { grid-template-columns: minmax(0, 1fr); }
      .task-btn .pill { justify-self: start; }
      .content { padding: 20px 14px 32px; }
      .hero h2 { font-size: 24px; }
      .panel-head, .panel-body { padding-left: 14px; padding-right: 14px; }
      .step { grid-template-columns: 28px minmax(0, 1fr); gap: 8px; }
      .step-text { font-size: 16px; }
      .pill { white-space: normal; }
      .stat { padding: 8px 6px; }
      .stat span { font-size: 8px; }
      .doc-picker,
      .manual-picker,
      .manual-picker-button,
      .stats,
      .section,
      .panel,
      .hero {
        min-width: 0;
        max-width: 100%;
      }
      .stats { gap: 5px; }
      .stat { min-width: 0; }
      .stat span { overflow-wrap: anywhere; }
      .content-tabs { padding: 0 14px; gap: 20px; }
      .figure-viewer-head { padding: 10px; gap: 10px; }
      .figure-viewer-heading h2 { font-size: 14px; }
      .figure-viewer-stage { padding: 10px; }
    }
.citation-highlight {
  outline: 3px solid #10a899;
  outline-offset: 4px;
  background-color: #e4faf5;
  border-radius: 8px;
}
.release-section { color: #26756c; font-size: 13px; font-weight: 600; margin: 8px 0; }
.demo-notice { flex-shrink: 0; padding: 9px 20px; border-top: 1px solid var(--line); background: var(--panel-2); color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.demo-notice p { max-width: 1800px; margin: 0 auto; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; }
.manual-context { display: flex; gap: 10px; align-items: center; }
.manual-context > span { color: var(--muted); font-size: 12px; font-weight: 600; }
.manual-context > div { min-width: 200px; padding: 8px 14px; border: 1px solid var(--line-strong, #cbd5df); border-radius: 8px; background: var(--panel, #fff); font-weight: 600; font-size: 13px; color: var(--ink, #1e293b); box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05); }
@media (max-width: 760px) { .manual-context { display: none; } }
.site-switch { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 12px; min-height: 40px; border: 1px solid #b9cec9; border-radius: 8px; color: #32695f; background: #f4f8f7; text-decoration: none; font-size: 13px; font-weight: 600; white-space: nowrap; }
.site-switch:hover { border-color: #087f70; background: #e1f7f2; }
.site-switch:focus-visible { outline: 3px solid rgba(31,102,209,.2); outline-offset: 2px; }
@media (max-width: 960px) { .header-actions { justify-content: flex-start; flex-wrap: wrap; } }

/* Workflow Engine API & Simulation */
.api-switch {
  background: #f0fdf4;
  border-color: #86efac;
  color: #166534;
  cursor: pointer;
  border-style: solid;
}
.api-switch:hover {
  background: #dcfce7;
  border-color: #4ade80;
  color: #14532d;
}
.compliance-badge {
  margin-top: 10px;
  padding: 8px 10px;
  background: rgba(13, 148, 136, 0.08);
  border: 1px solid rgba(13, 148, 136, 0.25);
  border-radius: 6px;
  font-size: 11.5px;
  color: var(--teal, #0d9488);
  line-height: 1.35;
}
.compliance-badge-title {
  font-weight: 700;
  margin-bottom: 2px;
}
.compliance-badge-desc {
  color: var(--muted, #475569);
  font-size: 11px;
}

/* API Viewer Modal Dialog */
.api-viewer-modal {
  width: 92vw;
  max-width: 860px;
  max-height: 88vh;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  background: var(--bg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}
.api-viewer-modal::backdrop {
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
}
.api-viewer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.api-viewer-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #0d9488;
  margin-bottom: 3px;
}
.api-viewer-head h2 {
  margin: 0;
  font-size: 18px;
  color: var(--text);
}
.api-viewer-close {
  background: transparent;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0 6px;
}
.api-viewer-close:hover {
  color: var(--text);
}
.api-viewer-nav {
  display: flex;
  gap: 10px;
  padding: 10px 24px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}
.api-viewer-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.api-viewer-tab.active {
  background: var(--panel);
  color: var(--text);
  border-color: var(--line);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.api-viewer-body {
  padding: 20px 24px;
  max-height: calc(88vh - 140px);
  overflow-y: auto;
}
.api-tab-pane {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sim-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.sim-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}
.sim-wo-pill {
  background: #e0f2fe;
  color: #0369a1;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
}
.sim-status {
  font-size: 12px;
  color: #16a34a;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}
.sim-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #16a34a;
}
.sim-step-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  margin-bottom: 8px;
  background: var(--panel-2);
  transition: all 0.15s ease;
  cursor: pointer;
}
.sim-step-item:hover {
  border-color: #94a3b8;
}
.sim-step-item.checked {
  background: #f0fdf4;
  border-color: #86efac;
}
.sim-step-item input[type="checkbox"] {
  margin-top: 3px;
  cursor: pointer;
  width: 17px;
  height: 17px;
}
.sim-step-content {
  flex: 1;
}
.sim-step-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}
.sim-step-text {
  font-size: 13.5px;
  color: var(--text);
  margin-top: 2px;
  line-height: 1.45;
}
.sim-step-item.checked .sim-step-text {
  color: #15803d;
}
.sim-safety-gate {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 12.5px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.4;
}
.sim-action-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  flex-wrap: wrap;
  gap: 10px;
}
.sim-complete-btn {
  background: #0d9488;
  color: white;
  border: none;
  padding: 9px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.sim-complete-btn:hover {
  background: #0f766e;
}
.sim-toast {
  padding: 8px 14px;
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
}
.api-code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}
.api-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}
.api-copy-btn:hover {
  background: var(--panel-2);
  border-color: var(--line-strong);
}
.api-curl-box {
  background: #1e293b;
  color: #38bdf8;
  padding: 12px 14px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 12.5px;
  overflow-x: auto;
  line-height: 1.4;
}
.api-json-pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 14px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 12px;
  line-height: 1.5;
  max-height: 380px;
  overflow: auto;
  white-space: pre;
}
