/* Source portals and purchasing workspaces. Load after the shared design layer. */

.portal-shell {
  --portal-accent: #2d6265;
  --portal-dark: #244d50;
  --portal-soft: #edf5f4;
  --portal-line: #dce5e6;
  border: 1px solid var(--portal-line);
  border-radius: 12px;
  overflow: hidden;
  background: #f4f6f8;
  box-shadow: none;
}
.portal-shell:has(.portal-top.mckesson), .portal-shell[data-portal="mckesson"] {
  --portal-accent: #0067a1;
  --portal-dark: #064c78;
  --portal-soft: #edf5fa;
  --portal-line: #d9e4ec;
}
.portal-shell:has(.portal-top.cardinal), .portal-shell[data-portal="cardinal"] {
  --portal-accent: #b72136;
  --portal-dark: #8e1c2e;
  --portal-soft: #fbf1f2;
  --portal-line: #eadde0;
}
.portal-shell:has(.portal-top.prime), .portal-shell[data-portal="prime"] {
  --portal-accent: #575184;
  --portal-dark: #3c385d;
  --portal-soft: #f1f0f8;
  --portal-line: #e0dfea;
}
.portal-shell .portal-disclaimer {
  padding: 10px 24px;
  border: 0;
  border-bottom: 1px solid var(--portal-line);
  background: var(--portal-soft);
  color: #53616c;
  text-align: left;
  font-size: 12px;
  line-height: 1.5;
  font-weight: 550;
  letter-spacing: .025em;
}
.portal-shell .portal-top {
  min-height: 122px;
  gap: 24px;
  padding: 28px 32px;
  border: 0;
  background: var(--portal-dark);
  color: #fff;
}
.portal-shell .portal-top.cardinal {
  background: #fff;
  color: var(--portal-accent);
  border-top: 4px solid var(--portal-accent);
}
.portal-shell .portal-brand {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: clamp(24px, 2.4vw, 31px);
  line-height: 1.12;
  letter-spacing: -.9px;
  font-weight: 760;
}
.portal-shell .portal-brand small {
  margin-top: 11px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: .03em;
  opacity: .82;
}
.portal-shell .portal-account {
  min-width: 0;
  overflow-wrap: anywhere;
  padding: 11px 16px;
  border: 1px solid #ffffff2b;
  border-radius: 10px;
  background: #ffffff08;
  color: inherit;
  font-size: 12px;
  line-height: 1.8;
  letter-spacing: .01em;
}
.portal-shell .cardinal .portal-account {
  color: #5b6962;
  background: #faf8f9;
  border-color: var(--portal-line);
}
.portal-shell .portal-nav {
  gap: 26px;
  padding: 0 32px;
  border-bottom: 1px solid var(--portal-line);
  background: #fff;
  scrollbar-width: thin;
}
.portal-shell .portal-nav button {
  position: relative;
  flex: 0 0 auto;
  white-space: nowrap;
  min-height: 56px;
  padding: 17px 0 15px;
  border-bottom: 3px solid transparent;
  color: #5b6962;
  font-size: 13px;
  font-weight: 550;
  transition: color .15s, border-color .15s;
}
.portal-shell .portal-nav button:hover { color: var(--portal-accent); }
.portal-shell .portal-nav button.active {
  color: var(--portal-accent);
  border-bottom-color: var(--portal-accent);
  font-weight: 700;
}
.portal-shell .portal-content { padding: 28px; }
.portal-shell .portal-content > .metric-grid {
  gap: 0;
  margin: 0 0 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--portal-line);
}
.portal-shell .portal-content .metric {
  padding: 0 22px;
  border: 0;
  border-right: 1px solid var(--portal-line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.portal-shell .portal-content .metric:first-child { padding-left: 0; }
.portal-shell .portal-content .metric:last-child { padding-right: 0; border-right: 0; }
.portal-shell .metric-head { color: #5b6962; font-size: 12px; }
.portal-shell .metric-head svg { color: var(--portal-accent); opacity: .6; }
.portal-shell .portal-content .metric-value {
  color: var(--portal-dark);
  font-size: 29px;
  line-height: 1.25;
  letter-spacing: -.8px;
  font-variant-numeric: tabular-nums;
}
.portal-shell .metric-foot { font-size: 12px; line-height: 1.5; color: #5b6962; }
.portal-shell .portal-content .card {
  border-radius: 10px;
  border-color: var(--portal-line);
  background: #fff;
  box-shadow: 0 2px 4px #17211d02;
}
.portal-shell .card-head { padding: 23px 24px 21px; flex-wrap: wrap; }
.portal-shell .card-head > :is(div,h2) { min-width: 0; }
.portal-shell .portal-content .btn { max-width: 100%; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.portal-shell .stats-list > div { align-items: flex-start; }
.portal-shell .stats-list > div > span { min-width: 0; flex: 1 1 0; overflow-wrap: anywhere; }
.portal-shell .stats-list > div > strong { flex-shrink: 0; }
.portal-shell .stats-list [data-cart-remove] { flex-shrink: 0; }
.portal-shell .portal-content h2 {
  color: #17211d;
  font-size: 18px;
  line-height: 1.35;
  font-weight: 680;
  letter-spacing: -.35px;
}
.portal-shell .portal-content .card-head p { color: #5b6962; font-size: 12px; line-height: 1.6; }
.portal-shell .portal-content th {
  padding: 13px 20px;
  background: #f8f9fb;
  border-color: #e8edef;
  color: #69747d;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .07em;
}
.portal-shell .portal-content td {
  padding: 17px 20px;
  border-bottom-color: #edf0f2;
  font-size: 13px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
}
.portal-shell .portal-content tbody tr { transition: background .12s; }
.portal-shell .portal-content tbody tr:hover { background: #fafbfd; }
.portal-shell .table-title { font-size: 13px; }
.portal-shell .table-sub { color: #65747c; font-size: 13px; line-height: 1.55; margin-top: 4px; }
.portal-shell .badge { border-radius: 5px; font-size: 12px; padding: 4px 7px; }
.portal-shell .portal-content .btn.primary {
  background: var(--portal-accent);
  border-color: var(--portal-accent);
  color: #fff;
  box-shadow: 0 2px 3px #17211d0b;
}
.portal-shell .portal-content .btn.primary:hover { filter: brightness(.94); }
.portal-shell .link { color: var(--portal-accent); }
.portal-shell .card-footer { padding: 16px 23px; border-color: var(--portal-line); }
.portal-shell .notice { background: var(--portal-soft); border-color: var(--portal-line); color: #53616c; font-size: 12px; }
.portal-shell :is(button,a,input,select):focus-visible { outline: 3px solid var(--portal-accent); outline-offset: 3px; }

/* Working tabs prioritize the catalog, queue or document list over account chrome. */
@media (min-width: 641px) {
  .portal-shell[data-section]:not([data-section="overview"]) .portal-top { min-height: 78px; padding: 13px 24px; }
  .portal-shell[data-section]:not([data-section="overview"]) .portal-brand { font-size: 26px; }
  .portal-shell[data-section]:not([data-section="overview"]) .portal-brand small { margin-top: 6px; font-size: 12px; }
  .portal-shell[data-section]:not([data-section="overview"]) .portal-account { padding: 7px 12px; font-size: 12px; }
  .portal-shell[data-section]:not([data-section="overview"]) .portal-nav { padding: 0 26px; }
  .portal-shell[data-section]:not([data-section="overview"]) .portal-nav button { min-height: 46px; padding: 12px 0 10px; }
  .portal-shell[data-section]:not([data-section="overview"]) .portal-content { padding: 18px 22px 22px; }
  .portal-shell[data-section]:not([data-section="overview"]) .portal-content > .metric-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 0; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--portal-line); }
  .portal-shell[data-section]:not([data-section="overview"]) .portal-content .metric { padding: 0 16px; border: 0; border-right: 1px solid var(--portal-line); border-radius: 0; background: transparent; }
  .portal-shell[data-section]:not([data-section="overview"]) .portal-content .metric:first-child { padding-left: 0; }
  .portal-shell[data-section]:not([data-section="overview"]) .portal-content .metric:last-child { border-right: 0; padding-right: 0; }
  .portal-shell[data-section]:not([data-section="overview"]) .metric-head { font-size: 12px; line-height: 1.4; }
  .portal-shell[data-section]:not([data-section="overview"]) .portal-content .metric-value { margin: 6px 0 4px; font-size: 23px; line-height: 1.2; letter-spacing: -.5px; }
  .portal-shell[data-section]:not([data-section="overview"]) .metric-foot { font-size: 12px; line-height: 1.5; }
}

/* Purchasing: restrained overview, legible decisions, detailed evidence on demand. */
.opt-workspace { color: #17211d; }
.opt-workspace .heading { margin-bottom: 18px; }
.opt-workspace .heading h1 { letter-spacing: -.9px; }
.opt-workspace .heading p { max-width: 620px; line-height: 1.65; }
.opt-navigation {
  display: flex;
  overflow: visible;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 14px;
  padding: 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #e0e6e2;
}
.opt-navigation a {
  padding: 9px 13px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #5b6962;
  font-size: 12px;
  font-weight: 550;
}
.opt-navigation a:hover { color: #17634d; background: transparent; }
.opt-navigation a.active { background: transparent; border-bottom-color: #17634d; color: #17634d; font-weight: 650; }
.opt-related { position: relative; margin-left: auto; }
.opt-related > summary { padding: 9px 5px; color: #5b6962; cursor: pointer; font-size: 12px; }
.opt-related[open] > summary { margin-bottom: 0; }
.opt-related > div { position: absolute; right: 0; top: 100%; z-index: 20; display: grid; width: 220px; max-width: calc(100vw - 40px); padding: 6px; border: 1px solid #dfe5e1; border-radius: 8px; background: #fff; box-shadow: 0 6px 18px #17211d12; }
.opt-related > div a { padding: 10px; }
.opt-purchase-context { position: relative; display: grid; grid-template-columns: minmax(130px,.85fr) minmax(150px,1fr) minmax(150px,1fr) auto; align-items: center; gap: 18px; margin-bottom: 18px; padding: 14px 0; border-top: 1px solid #dfe5e1; border-bottom: 1px solid #dfe5e1; }
.opt-available-cash { display: grid; gap: 3px; }
.opt-available-cash > span, .opt-scenario-control > span { color: #5b6962; font-size: 12px; }
.opt-available-cash > strong { color: #17634d; font-size: 21px; line-height: 1.25; letter-spacing: -.45px; font-variant-numeric: tabular-nums; }
.opt-scenario-control { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; min-width: 0; padding: 0; border: 0; text-align: left; background: none; color: #253b2d; cursor: pointer; }
.opt-scenario-control > strong { grid-column: 1/-1; grid-row: 2; font-size: 12px; font-weight: 600; overflow-wrap: anywhere; line-height: 1.45; }
.opt-scenario-control > small { color: #17634d; font-size: 12px; text-decoration: underline; text-underline-offset: 2px; }
.opt-scenario-control:disabled { cursor: default; opacity: .7; }
.opt-context-details > summary { color: #5b6962; font-size: 12px; cursor: pointer; white-space: nowrap; }
.opt-context-details[open] > summary { margin-bottom: 0; }
.opt-context-details > div { position: absolute; right: 0; top: calc(100% - 5px); z-index: 10; display: grid; gap: 9px; max-width: 100%; padding: 16px; border: 1px solid #dfe5e1; border-radius: 8px; background: #fff; box-shadow: 0 6px 18px #17211d12; color: #5b6962; font-size: 12px; }
.opt-context-details strong { color: #253b2d; font-weight: 600; }
.opt-decision-board { margin-top: 0; }
.opt-board-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; padding: 16px 20px 0; }
.opt-board-head h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.3px; }
.opt-board-head > span { color: #5b6962; font-size: 12px; }
.opt-board-head i { margin: 0 5px; font-style: normal; }
.opt-decision-board > .opt-demo-note { margin: 8px 20px 14px; padding: 0; }
.opt-summary {
  display: grid;
  grid-template-columns: 1.45fr 1fr 1.15fr;
  overflow: hidden;
  border: 1px solid #dfe5e1;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 3px 8px #17211d03;
}
.opt-summary-value {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 24px 26px;
  border-right: 1px solid #e8ece9;
  font-variant-numeric: tabular-nums;
}
.opt-summary-value:last-child { border-right: 0; }
.opt-summary-value > span { color: #5b6962; font-size: 12px; font-weight: 550; }
.opt-summary-value > strong { margin: 9px 0 8px; color: #17211d; font-size: 30px; line-height: 1.15; font-weight: 680; letter-spacing: -1px; }
.opt-summary-value > small { color: #5b6962; font-size: 12px; line-height: 1.55; }
.opt-summary-value.is-emphasis { background: #f1f7f3; }
.opt-summary-value.is-emphasis > strong { color: #17634d; }
.opt-context-strip { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; padding: 21px 2px; }
.opt-context-strip > div { display: grid; gap: 5px; }
.opt-context-strip span { color: #5b6962; font-size: 12px; text-transform: uppercase; letter-spacing: .065em; font-weight: 600; }
.opt-context-strip strong { color: #43534a; font-size: 12px; font-weight: 550; }
.opt-context-strip > a { margin-left: auto; }
.opt-demo-note { display: block; margin: 0 0 14px; padding: 0; border: 0; border-radius: 0; color: #5b6962; background: transparent; font-size: 12px; line-height: 1.55; }
.opt-demo-label { white-space: nowrap; color: #4f6357; font-weight: 650; }
.opt-card { border-color: #e0e6e2; border-radius: 10px; box-shadow: none; }
.opt-card .card-head { padding: 18px 20px; align-items: flex-start; }
.opt-card .card-head > div { min-width: 0; }
.opt-card .card-head > .actions { flex-wrap: wrap; gap: 8px; max-width: 100%; }
.opt-card .card-head .btn { max-width: 100%; white-space: normal; }
.opt-row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.opt-row-actions > .btn { max-width: 100%; white-space: normal; }
.opt-card .card-head p:empty { display: none; }
.opt-card .card-head h2 { font-size: 17px; line-height: 1.35; letter-spacing: -.35px; font-weight: 650; }
.opt-card .card-head p { max-width: 660px; font-size: 12px; line-height: 1.6; color: #5b6962; }
.opt-record-count { display: inline-flex; padding: 6px 9px; border: 1px solid #e4e9e5; border-radius: 7px; font-size: 12px; color: #5b6962; white-space: nowrap; }
.opt-decisions { border-top: 1px solid #e8ece9; }
.opt-decision {
  display: grid;
  grid-template-columns: minmax(220px,1.5fr) minmax(120px,.8fr) minmax(170px,1fr) auto;
  align-items: center;
  column-gap: 18px;
  row-gap: 12px;
  padding: 18px 20px 13px;
  border-bottom: 1px solid #e8ece9;
  background: #fff;
}
.opt-decision:last-child { border-bottom: 0; }
.opt-decision:hover { background: #fcfdfc; }
.opt-decision-product { min-width: 0; }
.opt-decision-label { display: flex; align-items: center; gap: 6px 9px; flex-wrap: wrap; margin-top: 7px; color: #5b6962; font-size: 12px; line-height: 1.5; }
.opt-decision-label .badge { font-size: 12px; border-radius: 4px; padding: 3px 6px; }
.opt-package-meta { display: flex; flex-wrap: wrap; gap: 3px 10px; margin-top: 5px; color: #5b6962; font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.opt-decision .table-title { font-size: 14px; line-height: 1.45; color: #23352b; margin-bottom: 5px; font-weight: 650; }
.opt-decision .table-sub { display: block; font-size: 12px; line-height: 1.65; color: #5b6962; }
.opt-decision-value { display: flex; flex-direction: column; gap: 5px; min-width: 0; font-variant-numeric: tabular-nums; }
.opt-decision-value > span:first-child { color: #5b6962; font-size: 12px; letter-spacing: .01em; }
.opt-decision-value > strong { font-size: 18px; line-height: 1.25; font-weight: 640; letter-spacing: -.5px; }
.opt-decision-value > strong > small { font-size: 12px; letter-spacing: 0; font-weight: 500; }
.opt-decision-value > small { font-size: 12px; line-height: 1.5; color: #5b6962; }
.opt-change { color: #17634d; font-size: 12px; font-weight: 650; }
.opt-change.is-negative { color: #8c5632; }
.opt-decision-action .btn { white-space: nowrap; font-size: 13px; padding: 9px 12px; }
.opt-decision.is-ready .opt-decision-action .btn { color: #fff; background: #17634d; border-color: #17634d; }
.opt-decision-foot { grid-column: 1/-1; display: flex; align-items: flex-start; flex-wrap: wrap; gap: 6px 18px; padding-top: 10px; border-top: 1px solid #eef1ee; color: #5b6962; font-size: 12px; line-height: 1.55; }
.opt-stock-basis { margin-left: auto; }
.opt-decision-foot > span:first-child { flex: 0 0 auto; }
.opt-decision-foot i { padding: 0 6px; font-style: normal; opacity: .5; }
.opt-clearance { margin-left: auto; color: #51745e; }
.opt-checks { flex: 1; min-width: 200px; color: #8b6938; }
.opt-checks summary { cursor: pointer; font-size: 12px; line-height: 1.55; }
.opt-checks summary > span { font-weight: 650; }
.opt-checks ul { margin: 9px 0 0; padding-left: 18px; }
.opt-comparison-note { flex-basis: 100%; color: #5b6962; }
.opt-reference .metric-grid { gap: 14px; margin: 22px 0; }
.opt-reference .metric { box-shadow: none; border-color: #e2e7e3; border-radius: 12px; }
.opt-reference-index { display: flex; gap: 6px; flex-wrap: wrap; margin: 16px 0; }
.opt-reference-index button { display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; padding: 8px 10px; color: #53635a; background: transparent; border: 1px solid #e0e6e2; border-radius: 6px; font-size: 12px; font-weight: 550; }
.opt-reference-index button > span { min-width: 0; overflow-wrap: anywhere; }
.opt-reference-index button:hover { border-color: #afc9b8; color: #17634d; }
.opt-reference-index b { flex-shrink: 0; min-width: 20px; padding: 2px 5px; border-radius: 4px; background: #f1f4f2; color: #5b6962; font-size: 12px; font-weight: 600; }
.opt-reference .opt-card { scroll-margin-top: 90px; }
.opt-reference .opt-card:focus-visible { outline: 2px solid #17634d; outline-offset: 4px; }
.opt-card td { font-size: 13px; line-height: 1.6; padding: 18px 20px; }
.opt-card th { padding: 12px 20px; color: #5b6962; font-size: 12px; letter-spacing: .06em; background: #fafbf9; }
.opt-card .table-title { font-size: 13px; line-height: 1.5; }
.opt-card .table-sub { font-size: 13px; line-height: 1.6; color: #5b6962; overflow-wrap: anywhere; }
.opt-reference .opt-card td:first-child { min-width: 190px; }
.opt-lookup { padding: 0 24px 24px; }
.opt-lookup-input { display: flex; align-items: flex-end; gap: 12px; max-width: 760px; }
.opt-lookup-input .form-row { flex: 1; min-width: 0; margin-top: 0; }
.opt-lookup-input .field { min-height: 46px; border-radius: 9px; background: #fbfcfb; font-size: 14px; }
.opt-lookup-input .btn { min-height: 46px; white-space: nowrap; }
#optimization-lookup-result:not(:empty) { margin-top: 18px; }
#optimization-lookup-result .notice { display: block; margin: 0; }

/* Detail dialogs intentionally reveal the decision before its technical evidence. */
.modal:has(.opt-review) { width: 980px; max-width: calc(100vw - 48px); padding: 28px; border-radius: 12px; }
.modal:has(.opt-editor) { width: 700px; max-width: calc(100vw - 48px); padding: 28px; border-radius: 12px; }
.opt-review { color: #17211d; }
.opt-review-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 2px 0 16px; }
.opt-review-heading > div { min-width: 0; }
.opt-review :is(p,dt,dd,blockquote,.table-title), .opt-review-alert li { overflow-wrap: anywhere; }
.opt-review-heading .table-title { font-size: 23px; line-height: 1.3; letter-spacing: -.65px; font-weight: 660; }
.opt-review-heading .table-sub { display: block; font-size: 12px; line-height: 1.8; color: #5b6962; }
.opt-review-badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.modal .opt-review-disclaimer { padding: 12px 14px; border-radius: 8px; background: #f5f7f5; color: #5b6962; font-size: 12px; line-height: 1.65; margin: 0 0 20px; }
.opt-review-alert { padding: 15px 17px; margin-bottom: 20px; border: 1px solid #eadfc9; border-radius: 10px; color: #856435; background: #fcf9f1; font-size: 12px; line-height: 1.6; }
.opt-review-alert strong { color: #745526; font-weight: 650; }
.opt-review-alert ul { padding-left: 18px; margin: 8px 0 0; }
.opt-review-summary { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); border: 1px solid #dfe6e0; border-radius: 12px; overflow: hidden; margin-bottom: 22px; }
.opt-review-summary .opt-summary-value { padding: 18px 17px; }
.opt-review-summary .opt-summary-value > span { font-size: 12px; }
.opt-review-summary .opt-summary-value > strong { font-size: 22px; letter-spacing: -.65px; }
.opt-review-summary .opt-summary-value > small { font-size: 12px; }
.opt-review-panels { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; margin-bottom: 20px; }
.opt-review-panels > section { min-width: 0; padding: 20px; background: #fafbf9; border: 1px solid #e7ece7; border-radius: 11px; }
.opt-review h3 { font-size: 13px; font-weight: 650; margin: 0 0 15px; color: #344c3f; letter-spacing: -.1px; }
.opt-review dl { margin: 0; }
.opt-review dl > div { display: flex; justify-content: space-between; gap: 18px; padding: 7px 0; font-size: 12px; line-height: 1.45; }
.opt-review dt { color: #5b6962; }
.opt-review dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; color: #344c3f; }
.modal .opt-review-panels p { font-size: 12px; color: #5b6962; line-height: 1.6; margin: 14px 0 0; }
.opt-review-panels details { margin-top: 13px; color: #5b6962; font-size: 12px; }
.opt-review-panels details ul { padding-left: 18px; line-height: 1.8; overflow-wrap: anywhere; }
.opt-economics { display: grid; grid-template-columns: 1fr 1.1fr; gap: 32px; padding: 20px; border: 1px solid #e2e8e3; border-radius: 11px; margin-bottom: 20px; }
.modal .opt-economics p { font-size: 12px; line-height: 1.7; color: #5b6962; max-width: 280px; }
.opt-review .opt-total { margin-top: 7px; padding-top: 13px; border-top: 1px solid #dfe6e1; }
.opt-total dt, .opt-total dd { color: #17634d; font-weight: 700; }
.modal .opt-comparison-explanation { padding: 12px 14px; background: #f6f7f5; border-radius: 8px; font-size: 12px; color: #5b6962; line-height: 1.65; }
.opt-detail-section { margin-top: 10px; border: 1px solid #e1e7e2; border-radius: 10px; overflow: hidden; }
.opt-detail-section > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; cursor: pointer; list-style: none; font-size: 12px; font-weight: 600; color: #344c3f; }
.opt-detail-section > summary::-webkit-details-marker { display: none; }
.opt-detail-section > summary::after { content: '+'; color: #7c8b80; font-size: 18px; font-weight: 400; line-height: 1; }
.opt-detail-section[open] > summary::after { content: 'âˆ’'; }
.opt-detail-section > summary small { font-size: 12px; font-weight: 450; color: #5b6962; margin-left: auto; }
.opt-detail-section[open] > summary { margin-bottom: 0; border-bottom: 1px solid #e8ece9; background: #fafbf9; }
.opt-detail-section .opt-card { border: 0; box-shadow: none; margin: 0; border-radius: 0; }
.opt-detail-section .opt-card .card-head { padding: 18px; }
.opt-detail-section .opt-card .card-head h2 { font-size: 14px; }
.opt-detail-section td { font-size: 12px; line-height: 1.6; padding: 13px 15px; }
.opt-detail-section th { font-size: 12px; padding: 11px 15px; }
.opt-detail-section .table-sub { font-size: 12px; line-height: 1.65; }
.opt-source-evidence { padding: 18px; }
.opt-source-evidence blockquote { margin: 0 0 15px; padding: 14px 17px; background: #f6f8f5; border-left: 3px solid #c5d8ca; border-radius: 0 7px 7px 0; color: #526659; font-size: 12px; line-height: 1.8; }
.modal .opt-source-evidence p { font-size: 12px; line-height: 1.75; }
.opt-source-evidence small { color: #5b6962; line-height: 1.8; font-size: 12px; overflow-wrap: anywhere; }
.modal .opt-quote-note { font-size: 12px; color: #5b6962; line-height: 1.7; margin: 19px 2px 10px; overflow-wrap: anywhere; }
.opt-fingerprint .hash { margin: 0; padding: 15px 18px; font-size: 12px; color: #5b6962; background: #fafbf9; border: 0; overflow-wrap: anywhere; }
.opt-approval-panel { margin-top: 22px; padding: 20px; border: 1px solid #cee1d4; border-radius: 12px; background: #f1f7f3; }
.opt-approval-panel .check-confirm { font-size: 12px; line-height: 1.7; color: #456150; }
.opt-approval-panel .actions { margin-top: 17px; }
.opt-approval-panel .primary { min-height: 43px; }
.opt-editor .form-row { min-width: 0; margin-top: 18px; }
.opt-editor .two-col { grid-template-columns: repeat(2,minmax(0,1fr)); }
.opt-editor .two-col > * { min-width: 0; }
.opt-editor .opt-tier-actions { grid-column: 1/-1; display: flex; justify-content: flex-end; }
.opt-editor [data-tier-row] + [data-tier-row] { margin-top: 18px; padding-top: 6px; border-top: 1px solid #e6ece7; }
.opt-editor .form-row label { font-size: 12px; color: #4c5f53; font-weight: 550; }
.opt-editor .field { min-width: 0; max-width: 100%; font-size: 13px; border-radius: 8px; padding: 11px 12px; border-color: #dce5de; line-height: 1.55; }
.opt-editor .field:focus { outline: 2px solid #17634d44; outline-offset: 2px; border-color: #709984; }
.opt-editor .notice { display: block; font-size: 12px; line-height: 1.7; }
.opt-editor [data-hierarchy-row] { min-width: 0; border: 1px solid #dfe7e1; border-radius: 11px; padding: 4px 18px 18px; background: #fafbf9; }
.opt-editor [data-hierarchy-row] legend { max-width: 100%; white-space: normal; overflow-wrap: anywhere; font-size: 12px; font-weight: 650; color: #55715f; padding: 0 8px; }
.opt-editor [data-hierarchy-row] .btn { margin-top: 14px; }
.opt-editor [data-hierarchy-list] { margin-bottom: 14px; }
.opt-editor .check-confirm { margin-top: 18px; font-size: 12px; line-height: 1.7; color: #596d60; }
.opt-editor > .actions:last-child { padding-top: 20px; border-top: 1px solid #e6ece7; }
.opt-workspace :is(button,a,input,select):focus-visible, .opt-review summary:focus-visible { outline: 2px solid #17634d; outline-offset: 3px; }

@media (max-width: 1220px) {
  .opt-decision { grid-template-columns: minmax(180px,1.3fr) minmax(100px,.7fr) minmax(145px,1fr) auto; column-gap: 14px; }
  .opt-decision-action { justify-self: end; }
  .opt-purchase-context { gap: 14px; grid-template-columns: minmax(120px,.85fr) minmax(130px,1fr) minmax(130px,1fr) auto; }
}
@media (max-width: 900px) {
  .portal-shell .portal-content { padding: 20px; }
  .portal-shell .portal-top { padding: 25px; }
  .portal-shell .portal-nav { padding: 0 25px; gap: 22px; }
  .portal-shell .portal-content > .metric-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
  .portal-shell .portal-content .metric { padding: 17px; }
  .portal-shell .portal-content .metric-value { font-size: 25px; }
  .opt-summary-value { padding: 21px; }
  .opt-summary-value > strong { font-size: 27px; }
  .opt-decision { grid-template-columns: minmax(0,1fr) minmax(0,1fr) auto; padding: 18px; }
  .opt-decision-product { grid-column: 1/-1; }
  .opt-decision-action { grid-column: auto; grid-row: auto; }
  .opt-purchase-context { grid-template-columns: 1fr 1fr; gap: 14px 22px; }
  .opt-available-cash { grid-column: 1; grid-row: 1; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
  .opt-context-details { grid-column: 2; grid-row: 1; justify-self: end; }
  .opt-scenario-control { grid-row: 2; }
  .opt-review-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .opt-review-summary .opt-summary-value:nth-child(2) { border-right: 0; }
  .opt-review-summary .opt-summary-value:nth-child(-n+2) { border-bottom: 1px solid #e8ece9; }
}
@media (max-width: 640px) {
  .portal-shell { border-radius: 10px; }
  .portal-shell .portal-disclaimer { padding: 10px 16px; font-size: 12px; line-height: 1.65; }
  .portal-shell .portal-top { align-items: flex-start; flex-direction: column; gap: 20px; padding: 23px 20px; }
  .portal-shell .portal-brand { font-size: 27px; }
  .portal-shell .portal-account { text-align: left; padding: 0; border: 0; border-radius: 0; background: none; font-size: 12px; }
  .portal-shell .cardinal .portal-account { background: none; }
  .portal-shell .portal-nav { padding: 0 20px; gap: 23px; }
  .portal-shell .portal-nav button { font-size: 12px; min-height: 52px; padding: 15px 0 13px; }
  .portal-shell .portal-content { padding: 15px; }
  .portal-shell .portal-content > .metric-grid { grid-template-columns: 1fr; gap: 10px; margin-bottom: 18px; }
  .portal-shell .portal-content .metric { padding: 12px 0; border-right: 0; border-bottom: 1px solid var(--portal-line); }
  .portal-shell .portal-content .metric:last-child { border-bottom: 0; }
  .portal-shell .portal-content .metric-value { margin: 7px 0; font-size: 25px; }
  .portal-shell .card-head { flex-wrap: wrap; padding: 20px 18px; }
  .portal-shell .portal-content h2 { font-size: 17px; }
  .portal-shell .portal-content .table-wrap { max-width: 100%; }
  .portal-shell .portal-content table { min-width: 610px; }
  .portal-shell[data-section]:not([data-section="overview"]) .portal-top { min-height: 0; padding: 15px 17px; gap: 9px; }
  .portal-shell[data-section]:not([data-section="overview"]) .portal-brand { font-size: 24px; }
  .portal-shell[data-section]:not([data-section="overview"]) .portal-brand small { margin-top: 4px; font-size: 12px; line-height: 1.45; }
  .portal-shell[data-section]:not([data-section="overview"]) .portal-account { font-size: 12px; line-height: 1.6; }
  .portal-shell[data-section]:not([data-section="overview"]) .portal-nav { padding: 0 17px; gap: 20px; }
  .portal-shell[data-section]:not([data-section="overview"]) .portal-nav button { min-height: 46px; padding: 12px 0 10px; }
  .portal-shell[data-section]:not([data-section="overview"]) .portal-content { padding: 12px; }
  .portal-shell[data-section]:not([data-section="overview"]) .portal-content > .metric-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 0; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--portal-line); }
  .portal-shell[data-section]:not([data-section="overview"]) .portal-content .metric { position: relative; min-width: 0; min-height: 80px; padding: 4px 8px; border: 0; border-right: 1px solid var(--portal-line); border-radius: 0; background: transparent; }
  .portal-shell[data-section]:not([data-section="overview"]) .portal-content .metric:first-child { padding-left: 0; }
  .portal-shell[data-section]:not([data-section="overview"]) .portal-content .metric:last-child { border-right: 0; padding-right: 0; }
  .portal-shell[data-section]:not([data-section="overview"]) .metric-head { display: block; min-height: 30px; font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
  .portal-shell[data-section]:not([data-section="overview"]) .metric-head svg { display: none; }
  .portal-shell[data-section]:not([data-section="overview"]) .portal-content .metric-value { margin: 7px 0 0; font-size: 22px; line-height: 1.2; letter-spacing: -.65px; white-space: normal; overflow-wrap: anywhere; }
  /* Keep qualifiers in the accessibility tree; the overview shows them in full. */
  .portal-shell[data-section]:not([data-section="overview"]) .metric-foot { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); clip-path: inset(50%); white-space: nowrap; border: 0; }
  .opt-navigation { gap: 4px; margin-bottom: 10px; }
  .opt-navigation > a { padding: 8px 4px; font-size: 12px; }
  .opt-related > summary { padding: 8px 0; font-size: 12px; }
  .opt-purchase-context { gap: 12px 16px; padding: 12px 0; margin-bottom: 14px; }
  .opt-available-cash { display: grid; gap: 2px; }
  .opt-available-cash > strong { font-size: 20px; }
  .opt-scenario-control { grid-template-columns: 1fr; gap: 4px; }
  .opt-scenario-control > small { display: none; }
  .opt-scenario-control > strong { text-decoration: underline; text-underline-offset: 3px; }
  .opt-board-head { padding: 15px 16px 0; gap: 4px; }
  .opt-board-head h2 { font-size: 16px; }
  .opt-board-head > span { font-size: 12px; }
  .opt-decision-board > .opt-demo-note { margin: 7px 16px 13px; }
  .opt-summary { grid-template-columns: 1fr 1fr; border-radius: 10px; }
  .opt-summary > .opt-summary-value:first-child { grid-column: 1/-1; border-right: 0; border-bottom: 1px solid #e2e9e3; }
  .opt-summary-value { padding: 20px; }
  .opt-summary-value > strong { font-size: 26px; }
  .opt-summary-value > span { font-size: 12px; }
  .opt-summary-value > small { font-size: 12px; }
  .opt-context-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 20px 2px; }
  .opt-context-strip > a { grid-column: 1/-1; margin: 0; justify-self: start; }
  .opt-context-strip strong { font-size: 12px; }
  .opt-demo-note { padding: 0; font-size: 12px; }
  .opt-demo-label { display: block; margin-bottom: 4px; }
  .opt-card .card-head { padding: 20px 18px; flex-wrap: wrap; }
  .opt-card .card-head h2 { font-size: 16px; }
  .opt-card .card-head p { font-size: 12px; }
  .opt-decision { grid-template-columns: 1fr 1fr; padding: 16px; column-gap: 16px; row-gap: 13px; }
  .opt-decision-value > strong { font-size: 16px; }
  .opt-decision-value > strong > small { display: block; margin-top: 3px; }
  .opt-decision-value > span:first-child { min-height: 0; line-height: 1.5; }
  .opt-decision-value > small { font-size: 12px; }
  .opt-decision-action { grid-column: 1/-1; justify-self: stretch; }
  .opt-decision-action .btn { width: 100%; justify-content: center; min-height: 40px; }
  .opt-decision-foot { display: block; padding-top: 11px; font-size: 12px; }
  .opt-stock-basis { display: block; margin-top: 7px; }
  .opt-checks, .opt-clearance, .opt-comparison-note { display: block; margin-top: 9px; }
  .opt-reference-index { display: grid; grid-template-columns: 1fr 1fr; }
  .opt-reference-index button { justify-content: space-between; }
  .opt-reference .metric-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .opt-lookup { padding: 0 18px 20px; }
  .opt-lookup-input { align-items: stretch; flex-direction: column; }
  .opt-lookup-input .btn { justify-content: center; }
  .opt-card .table-wrap { max-width: 100%; }
  .opt-reference .opt-card table { min-width: 680px; }
  .modal:has(.opt-review), .modal:has(.opt-editor) { max-width: calc(100vw - 20px); padding: 20px 17px; border-radius: 10px; }
  .opt-review-heading { flex-direction: column; gap: 13px; }
  .opt-review-heading .table-title { font-size: 21px; }
  .opt-review-badges { justify-content: flex-start; }
  .opt-review-summary .opt-summary-value { padding: 15px 13px; }
  .opt-review-summary .opt-summary-value > strong { font-size: 20px; }
  .opt-review-panels, .opt-economics { grid-template-columns: 1fr; gap: 14px; }
  .opt-review-panels > section, .opt-economics { padding: 17px; }
  .opt-economics { gap: 0; }
  .opt-detail-section > summary { flex-wrap: wrap; padding: 14px; gap: 5px 10px; }
  .opt-detail-section > summary small { margin: 0; flex-basis: calc(100% - 24px); order: 2; }
  .opt-detail-section > summary::after { margin-left: auto; }
  .opt-detail-section table { min-width: 620px; }
  .opt-approval-panel { padding: 17px; }
  .opt-approval-panel .primary { width: 100%; justify-content: center; font-size: 12px; }
  .opt-editor .two-col { grid-template-columns: 1fr; gap: 0; }
  .opt-editor .opt-tier-actions { margin-top: 12px; }
  .opt-editor .field, .opt-lookup-input .field { font-size: 16px; }
}
/* Connection accounts are working rows, with intake immediately below the register. */
.connection-workspace .heading { margin-bottom: 16px; }
.connection-disclaimer { margin: 0 0 18px; color: #5b6962; font-size: 13px; line-height: 1.6; max-width: 960px; }
.connection-disclaimer strong { color: #344c3f; font-weight: 600; }
.connection-workspace .card { border: 1px solid #dfe5e1; border-radius: 10px; box-shadow: none; }
.connection-register-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; padding: 16px 20px; border-bottom: 1px solid #e5eae6; }
.connection-workspace h2 { margin: 0; font-size: 17px; line-height: 1.4; letter-spacing: -.25px; font-weight: 650; }
.connection-register-head > span { color: #5b6962; font-size: 13px; }
.connection-row { display: grid; grid-template-columns: minmax(220px,1.6fr) minmax(140px,.85fr) auto; align-items: center; gap: 16px; padding: 16px 20px; border-bottom: 1px solid #e9edea; }
.connection-row:last-child { border-bottom: 0; }
.connection-identity { min-width: 0; }
.connection-name { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 9px; }
.connection-name .supplier-dot { width: 28px; height: 28px; margin: 0; border-radius: 6px; font-size: 12px; }
.connection-name h3 { margin: 0; font-size: 15px; line-height: 1.4; font-weight: 650; letter-spacing: -.15px; overflow-wrap: anywhere; }
.connection-name .badge { padding: 3px 6px; border-radius: 4px; font-size: 12px; font-weight: 500; }
.connection-workspace .connection-portal-name { margin: 6px 0 0; color: #5b6962; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.connection-workspace .connection-coverage { margin: 4px 0 0; color: #344c3f; font-size: 13px; line-height: 1.45; }
.connection-coverage > span { color: #5b6962; margin-right: 5px; }
.connection-account { display: grid; gap: 8px; margin: 0; min-width: 0; }
.connection-account > div { display: grid; gap: 2px; }
.connection-account dt { color: #5b6962; font-size: 12px; line-height: 1.4; }
.connection-account dd { margin: 0; color: #344c3f; font-size: 13px; font-weight: 500; line-height: 1.45; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.connection-controls { display: grid; justify-items: end; min-width: 0; max-width: 100%; gap: 10px; }
.connection-controls > div { display: flex; flex-wrap: wrap; justify-content: flex-end; max-width: 100%; gap: 7px; }
.connection-workspace .btn.small { min-height: 36px; padding: 8px 10px; font-size: 13px; border-radius: 8px; white-space: nowrap; }
.connection-controls .connection-toggle { color: #5b6962; font-size: 13px; }
.connection-controls .connection-toggle:hover { color: #17634d; }
.connection-imports { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(0,1fr); align-items: start; gap: 20px; margin-top: 22px; }
.connection-section-head { padding: 18px 20px 0; }
.connection-section-head p { margin: 6px 0 0; color: #5b6962; font-size: 13px; line-height: 1.6; }
.connection-workspace .upload { min-height: 0; display: grid; grid-template-columns: 26px minmax(0,1fr) auto; gap: 12px; align-items: center; justify-content: stretch; margin: 16px 20px 0; padding: 18px 16px; border-radius: 8px; background: #fafbfa; border-color: #cbd8ce; }
.connection-workspace .upload > svg { width: 24px; height: 24px; color: #65736c; }
.connection-workspace .upload strong { display: block; line-height: 1.5; font-weight: 600; }
.connection-workspace .upload small { display: block; margin-top: 4px; font-size: 12px; line-height: 1.5; }
.connection-workspace .upload .btn { font-size: 13px; padding: 9px 12px; white-space: nowrap; }
.connection-import-help { padding: 15px 20px 20px; }
.connection-import-help > .link { font-size: 13px; }
.connection-import-help p { margin: 12px 0; color: #5b6962; font-size: 13px; line-height: 1.6; }
.connection-import-help details { color: #5b6962; font-size: 13px; }
.connection-import-help summary { cursor: pointer; }
.connection-import-help .mono { overflow-wrap: anywhere; }
.connection-import-row { display: grid; gap: 7px; padding: 16px 20px; border-bottom: 1px solid #e9edea; }
.connection-import-row:last-child { border-bottom: 0; }
.connection-import-row > strong { color: #344c3f; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.connection-import-row > span { color: #5b6962; font-size: 13px; line-height: 1.6; }
.connection-import-row .link { justify-self: start; font-size: 13px; }
.connection-history .empty { padding: 25px 20px; text-align: left; }
.connection-history .empty h3 { font-size: 14px; }
.connection-history .empty p { font-size: 13px; }
.connection-workspace :is(button,a,summary):focus-visible { outline: 2px solid #17634d; outline-offset: 3px; }
@media (max-width: 1100px) {
  .connection-imports { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .connection-row { grid-template-columns: minmax(0,1fr) auto; }
  .connection-account { display: flex; flex-wrap: wrap; gap: 12px 24px; grid-column: 1; }
  .connection-controls { grid-column: 2; grid-row: 1/3; }
}
@media (max-width: 640px) {
  .connection-workspace .heading { margin-bottom: 14px; }
  .connection-disclaimer { margin-bottom: 15px; font-size: 12px; }
  .connection-register-head { padding: 15px 16px; }
  .connection-register-head > span { font-size: 12px; }
  .connection-row { grid-template-columns: minmax(0,1fr); gap: 13px; padding: 17px 16px; }
  .connection-name .badge { margin-left: auto; }
  .connection-account { grid-column: 1; justify-content: space-between; gap: 12px; }
  .connection-controls { grid-column: 1; grid-row: auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
  .connection-controls > div { justify-content: flex-start; gap: 8px; }
  .connection-workspace .btn.small { padding: 8px 9px; font-size: 12px; }
  .connection-controls .connection-toggle { font-size: 12px; }
  .connection-imports { gap: 16px; margin-top: 18px; }
  .connection-section-head { padding: 16px 16px 0; }
  .connection-workspace .upload { grid-template-columns: 24px minmax(0,1fr); margin: 15px 16px 0; padding: 16px; }
  .connection-workspace .upload .btn { grid-column: 1/-1; justify-content: center; }
  .connection-import-help { padding: 15px 16px 18px; }
  .connection-import-row { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .portal-shell *, .opt-workspace *, .opt-review * { transition: none !important; scroll-behavior: auto !important; }
}
