.portal-body { color-scheme: light; overflow-wrap: anywhere; }
.portal-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 24px 0 40px; }
.portal-login { width: min(480px, calc(100% - 40px)); margin: clamp(32px, 9vh, 88px) auto; padding: clamp(24px, 4vw, 32px); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.portal-order-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.portal-login h1 { margin: 0 0 8px; font-size: clamp(2.2rem, 6vw, 2.8rem); }
.portal-google-control { position: relative; width: min(360px, 100%); height: 44px; margin: 20px auto 12px; }
.portal-google-visual { position: absolute; inset: 0; z-index: 1; display: flex; align-items: center; justify-content: center; gap: 10px; border: 1px solid #747775; border-radius: 4px; background: #fff; color: #1f1f1f; box-shadow: 0 1px 2px rgba(60, 64, 67, .3); font: 500 14px/1 Arial, sans-serif; }
.portal-google-mark { width: 18px; height: 18px; flex: 0 0 auto; }
.portal-google-control:focus-within .portal-google-visual { outline: 3px solid #174d93; outline-offset: 4px; }
.portal-login #googleSignIn { position: absolute; inset: 0; z-index: 2; width: 100%; height: 44px; overflow: hidden; opacity: 0; }
.portal-login #googleSignIn > div { width: 100% !important; max-width: 100%; min-height: 44px; }
.portal-login #googleSignIn iframe { display: block; width: 100% !important; max-width: 100% !important; height: 44px !important; border: 0; }
.portal-order-heading { align-items: center; margin: 0 0 12px; }
.portal-order-heading h2, .portal-order-heading .portal-badge { margin: 0; }
.portal-order-heading h2 { display: inline-flex; align-items: center; gap: 8px; }
.portal-order-heading p:empty { display: none; }
.portal-order-summary h2 { font-size: 1.35rem; }
.portal-order-summary #portalSourceStatus { margin: 0; }
.portal-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: none; padding: 20px; margin: 20px 0; }
.portal-panel h3 { margin-top: 0; font-size: 1.35rem; }
.portal-message-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.portal-message-heading h3 { margin-bottom: 0; }
.portal-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.portal-body a { color: var(--brand-dark); text-underline-offset: 3px; }
.portal-body a.secondary-button { color: var(--ink); text-decoration: none; }
.portal-body button, .portal-body input, .portal-body select, .portal-body textarea { font: inherit; min-height: 44px; }
.portal-body label { display: block; font-weight: 650; margin-bottom: 8px; }
.portal-body input, .portal-body select, .portal-body textarea { display: block; width: 100%; padding: 10px 12px; border: 1px solid var(--muted); border-radius: 5px; background: var(--panel); color: var(--ink); margin: 6px 0 12px; }
.portal-body textarea { resize: vertical; }
.portal-po-editor-tools { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0; }
.portal-po-editor-tools button {
  min-height: 44px;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--muted);
  border-radius: 5px;
  background: var(--panel);
  color: var(--ink);
  font: 650 1rem/1.2 inherit;
  letter-spacing: 0;
  text-transform: none;
}
.portal-po-editor {
  min-height: 7rem;
  margin: 6px 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--muted);
  border-radius: 5px;
  background: var(--panel);
  color: var(--ink);
  overflow: auto;
}
.portal-po-editor ul, .portal-po-editor ol { margin: .4em 0 .4em 1.4em; padding: 0; }
.portal-po-editor a { color: inherit; }
.portal-po-editor[contenteditable="false"] { opacity: .7; }
.portal-body input[type="file"] { max-width: 100%; padding: 8px; }
.portal-body button { cursor: pointer; white-space: normal; }
.portal-body button:disabled { cursor: not-allowed; opacity: .7; }
.portal-body :focus-visible { outline: 3px solid #174d93; outline-offset: 4px; }
.portal-body [role="alert"] { border: 2px solid var(--red); padding: 16px; margin: 16px 0; }
.portal-body [role="status"]:not(:empty) { padding: 12px 0; }
.portal-body .portal-help { color: var(--muted); font-size: 1rem; line-height: 1.5; }
.portal-notice { padding: 18px; border: 2px solid var(--info); background: var(--panel); margin: 20px 0; }
.portal-filters { display: flex; align-items: flex-end; gap: 10px 12px; flex-wrap: nowrap; margin: 0 0 12px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.portal-filters label { flex: 1 1 156px; min-width: 0; margin: 0; }
.portal-filters .portal-filter-search { flex: 1.5 1 230px; }
.portal-filters input, .portal-filters select { margin: 6px 0 0; }
.portal-filters .portal-filter-submit { width: auto; flex: 0 0 auto; min-width: 96px; margin: 0; padding: 0 15px; }
.portal-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 20px; }
.portal-facts > p, .portal-facts > button { grid-column: 1 / -1; }
.portal-facts > button { justify-self: start; }
.portal-badge { padding: 8px 12px; border: 1px solid var(--muted); border-radius: 5px; }
.portal-section-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 16px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
}
.portal-section-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--muted);
  border-radius: 5px;
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
  font-weight: 650;
}
.portal-section-nav a:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
}
.portal-table-scroll { max-width: 100%; overflow-x: auto; }
.portal-body table { width: 100%; min-width: 880px; border-collapse: collapse; text-align: left; font-size: 1rem; }
.portal-body caption { text-align: left; padding: 8px 0 16px; font-weight: 600; }
.portal-body th, .portal-body td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.portal-body th { position: static; z-index: auto; color: var(--muted); border-bottom-width: 2px; background: transparent; font: 800 11px/1.15 var(--font-display); letter-spacing: .04em; text-transform: uppercase; white-space: normal; }
.portal-body th abbr { text-decoration: none; color: inherit; }
.portal-body #portalList table > thead th { font-size: 14px; line-height: 1.1; }
.portal-body td { overflow-wrap: anywhere; }
.portal-body th:first-child, .portal-body td:first-child { position: static; z-index: auto; box-shadow: none; }
.portal-body .primary-button, .portal-body .secondary-button { min-height: 44px; font: 800 16px/1 var(--font-display); letter-spacing: .04em; text-transform: uppercase; }
.portal-body tbody tr td { background: var(--panel); color: var(--ink); }
.portal-body tbody tr:nth-child(even) td { background: var(--panel-soft); }
.portal-body td button { text-align: left; }
.portal-body .portal-orders-table { table-layout: fixed; width: 100%; min-width: 940px; }
.portal-orders-table th, .portal-orders-table td { width: 11.43%; text-align: center; }
.portal-orders-table th:first-child, .portal-orders-table td:first-child { width: 20%; }
.portal-orders-table th:first-child, .portal-orders-table td:first-child { text-align: left; }
.portal-orders-table td .portal-po-block,
.portal-orders-table td .portal-po-tick {
  display: flex;
  width: 100%;
  height: 3.75rem;
  min-height: 3.75rem;
}
.portal-orders-table td:first-child .portal-po-identity > button { width: auto; }
.portal-po-identity {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
}
.portal-po-identity .secondary-button { flex: 1 1 auto; min-width: 0; }
.portal-sales-so .portal-po-identity { width: auto; }
.portal-country-flag {
  flex: 0 0 auto;
  font-style: normal;
  font-size: 1.35rem;
  line-height: 1;
}
.portal-po-block, .portal-po-tick {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 44px;
  min-height: 44px;
  padding: 6px 8px;
  border: 2px solid var(--muted);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  text-align: center;
}
.portal-po-block-code {
  font: 800 11px/1.1 var(--font-display);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.portal-po-block-state { font-size: .85rem; font-weight: 650; }
.portal-po-date { white-space: nowrap; }
.portal-po-block[data-state="present"] .portal-po-block-state {
  font: 800 1.1rem/1.15 var(--font-display);
  letter-spacing: .02em;
}
.portal-po-block[data-state="missing"], .portal-po-tick[data-state="open"] {
  border-style: dashed;
  color: var(--ink);
  background: var(--panel);
}
.portal-po-block[data-state="present"] {
  border-color: var(--ink);
  background: var(--panel-soft);
}
.portal-po-block[data-state="waiting"] {
  border-color: #8a5a00;
  background: #fff4d6;
  color: #5c3d00;
}
.portal-po-block[data-state="confirmed"], .portal-po-tick[data-state="complete"] {
  border-color: var(--green);
  background: #d8f3e3;
  color: #0d4d2a;
}
.portal-po-tick svg { width: 18px; height: 18px; }
.portal-product-message { gap: 8px; min-width: 0; padding: 0 10px; }
.portal-product-message svg { width: 17px; height: 17px; flex: 0 0 auto; }
.portal-product-message-label { overflow: hidden; text-overflow: ellipsis; }
.portal-thread { list-style: none; padding: 0; }
.portal-thread li { padding: 16px 0; border-bottom: 1px solid var(--line); }
.portal-message-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.portal-document { border-bottom: 1px solid var(--line); padding: 16px 0; overflow-wrap: anywhere; }
.portal-document-slot { border: 1px solid var(--line); border-radius: 6px; padding: 16px; margin: 16px 0; }
.portal-document-slot h4 { margin: 0 0 8px; }
.portal-document-slot .portal-document:last-child { border-bottom: 0; padding-bottom: 0; }
.portal-correct { font-weight: 700; }
.portal-skip { position: absolute; top: -100px; left: 12px; padding: 14px; z-index: 20; background: var(--panel); }
.portal-skip:focus { top: 12px; }
.portal-detail-phases {
  display: flex;
  flex-direction: column;
}
.portal-detail-phases > #portalBack { order: 0; }
.portal-detail-phases > .portal-order-summary { order: 1; }
.portal-detail-phases > .portal-panel-po { order: 4; }
.portal-detail-phases > .portal-panel-facts { order: 5; }
.portal-detail-phases > .portal-panel-documents { order: 6; }
.portal-detail-phases > .portal-panel-invoice { order: 7; }
.portal-detail-phases > .portal-panel-products { order: 8; }
.portal-detail-phases > .portal-panel-messages { order: 9; }
.portal-phase-kicker {
  margin: 0 0 8px;
  font: 800 12px/1.2 var(--font-display);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.portal-phase { border-width: 2px; }
.portal-phase-bodytone { border-left: 4px solid var(--brand-button); }
.portal-phase-supplier { border-left: 4px solid var(--ink); }
.portal-phase-later { border-left: 4px solid var(--muted); }
.portal-supplier-uploads {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.portal-supplier-wait {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 16px;
  background: var(--panel-soft);
}
.portal-supplier-wait h4 { margin: 0 0 8px; }
.portal-supplier-wait p { margin: 0; }
.portal-supplier-wait[data-state="missing"] {
  border-style: dashed;
}
.portal-supplier-wait[data-state="waiting"] {
  border-color: #8a5a00;
  background: #fff4d6;
}
.portal-supplier-wait[data-state="confirmed"] {
  border-color: var(--green);
  background: #d8f3e3;
}
.portal-slot-review {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin: 8px 0 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}
.portal-slot-review[data-state="waiting"] {
  border-color: #8a5a00;
  background: #fff4d6;
}
.portal-slot-review[data-state="confirmed"] {
  border-color: var(--green);
  background: #d8f3e3;
}
.portal-slot-review-copy { flex: 1 1 220px; min-width: 0; }
.portal-slot-review-copy p { margin: 0 0 4px; }
.portal-slot-review-copy p:last-child { margin-bottom: 0; }
.portal-slot-review .primary-button { margin: 0; }
.portal-fact-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.portal-resolve {
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}
.portal-resolve > summary {
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  padding: 12px 16px;
  font-weight: 650;
}
.portal-resolve[open] > summary { border-bottom: 1px solid var(--line); }
.portal-resolve[open] form { display: grid; gap: 12px; padding: 16px; }
.portal-fact-code {
  font: 800 11px/1.1 var(--font-display);
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.portal-fact-value { font-weight: 700; }
.portal-fact-flag { color: #5c3d00; font-weight: 650; }
.portal-impersonation-bar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 320px) auto; gap: 10px 16px; align-items: end; margin: 0 0 20px; padding: 14px 16px; color: #fff; background: #172b43; border-radius: 6px; }
.portal-impersonation-bar p { margin: 0; line-height: 1.45; }
.portal-impersonation-title { font: 800 1.15rem/1.1 var(--font-display); letter-spacing: .04em; text-transform: uppercase; }
.portal-impersonation-bar label { margin: 0; }
.portal-impersonation-bar select { margin: 6px 0 0; background: #fff; color: #111; }
.portal-impersonation-bar .secondary-button { background: #fff; color: #111; }
.portal-impersonation-bar :focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
@media (max-width: 900px) {
  .portal-facts, .portal-fact-strip, .portal-supplier-uploads { grid-template-columns: minmax(0, 1fr); }
  .portal-filters { flex-wrap: wrap; }
  .portal-impersonation-bar { grid-template-columns: minmax(0, 1fr); align-items: stretch; }
}
@media (max-width: 600px) {
  .portal-shell { width: calc(100% - 24px); padding: 16px 0 28px; }
  .portal-panel, .portal-login { padding: 16px; }
  .portal-facts, .portal-fact-strip, .portal-supplier-uploads { grid-template-columns: minmax(0, 1fr); }
  .portal-actions > *, .portal-filters > button { max-width: 100%; }
  .portal-filters { align-items: stretch; flex-direction: column; }
  .portal-filters label, .portal-filters .portal-filter-search, .portal-filters .portal-filter-submit { flex-basis: auto; width: 100%; }
  .portal-filters .portal-filter-submit { margin-top: 2px; }
}
@media (forced-colors: active) {
  .portal-body button, .portal-panel, .portal-notice { border: 1px solid ButtonText; }
  .portal-body :focus-visible { outline: 3px solid Highlight; }
  .portal-po-block, .portal-po-tick { border: 2px solid ButtonText; }
  .portal-po-block[data-state="confirmed"], .portal-po-tick[data-state="complete"] { outline: 3px solid Highlight; }
}
@media (prefers-reduced-motion: reduce) { .portal-body * { scroll-behavior: auto; transition: none; animation: none; } }

.portal-document summary { cursor: pointer; padding: 12px 0; font-weight: 700; }
.portal-slot-review details { flex: 1 1 100%; }
.portal-slot-review summary { cursor: pointer; font-weight: 700; }
.portal-document details[open] form,
.portal-slot-review details[open] form { display: grid; gap: 12px; padding: 12px 0; }

.portal-thread { display: grid; gap: 16px; }
.portal-thread li.portal-chat-message { display: flex; gap: 12px; width: min(88%, 760px); padding: 0; border: 0; }
.portal-thread .portal-chat-supplier { justify-self: end; flex-direction: row-reverse; }
.portal-avatar { flex: 0 0 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--ink-strong); color: #fff; font-weight: 800; }
.portal-chat-supplier .portal-avatar { background: var(--brand-button); }
.portal-message-card { min-width: 0; flex: 1; padding: 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-soft); }
.portal-chat-supplier .portal-message-card { background: #fff4ed; border-color: #c9987f; }
.portal-message-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.portal-message-meta time { color: var(--muted); font-size: .9rem; }
.portal-message-author { margin: 4px 0 0; font-weight: 600; }
.portal-message-line { margin: 10px 0 0; font-weight: 600; color: var(--ink); }
.portal-message-body { margin: 12px 0 0; }
@media (max-width: 600px) {
  .portal-thread li.portal-chat-message { width: 100%; gap: 8px; }
  .portal-message-card { padding: 12px; }
}

.portal-field-history { margin-top: 20px; }
.portal-field-history summary { cursor: pointer; font-weight: 650; font-size: 1.1rem; }
.portal-field-history-list { list-style: none; padding: 0; margin: 12px 0 0; }
.portal-field-history-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.portal-field-history-item:last-child { border-bottom: 0; }
.portal-field-history-summary { margin: 0; font-weight: 650; }

#portalSales table { min-width: 760px; }
#portalSales thead th:first-child, #portalSales td:first-child { width: 28%; }
#portalSales thead th:not(:first-child), #portalSales td:not(:first-child) { width: 18%; }
.portal-orders-table thead th, #portalSales thead th { font-size: .875rem; }
#portalSales tbody th.portal-sales-so { padding: 10px 12px; border-bottom-width: 1px; color: var(--ink); text-align: left; font: 400 1rem/1.3 var(--font-body); letter-spacing: 0; text-transform: none; }
#portalSales tbody tr:nth-child(even) th.portal-sales-so { background: var(--panel-soft); }
#portalSales tbody tr:nth-child(odd) th.portal-sales-so { background: var(--panel); }
#portalSales .portal-sales-so-identity { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; min-height: 28px; }
#portalSales .portal-sales-so-number { font: 800 1.1rem/1 var(--font-display); letter-spacing: .02em; text-transform: uppercase; }
#portalSales .portal-sales-so-country { color: var(--muted); font-size: .95rem; }
#portalSales thead th abbr { text-decoration: none; color: inherit; }

/* List cells keep the data readable while leaving identity and actions to lead. */
.portal-orders-table .portal-po-identity { white-space: nowrap; }
.portal-orders-table .portal-po-identity > .secondary-button {
  width: auto;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: none;
  font: 650 1rem/1.15 var(--font-body);
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.portal-orders-table .portal-po-identity > .secondary-button:hover {
  border-color: var(--brand-button);
  color: var(--brand-dark);
}

.portal-orders-table td .portal-po-block,
.portal-orders-table td .portal-po-tick,
#portalSales td .portal-po-block {
  min-width: 0;
  min-height: 3.25rem;
  height: 3.25rem;
  padding: 6px 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.portal-orders-table .portal-po-block .portal-po-block-state,
.portal-orders-table .portal-po-tick .portal-po-block-state,
#portalSales .portal-po-block-state {
  font: 600 1rem/1.2 var(--font-body);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  text-transform: none;
}

.portal-orders-table .portal-po-block[data-state="missing"] .portal-po-block-state,
.portal-orders-table .portal-po-tick[data-state="open"],
#portalSales .portal-po-block[data-state="missing"] .portal-po-block-state {
  color: var(--muted);
}

.portal-orders-table .portal-po-block[data-state="waiting"],
.portal-orders-table .portal-po-block[data-state="confirmed"],
.portal-orders-table .portal-po-tick[data-state="complete"] {
  border: 0;
  background: transparent;
}

.portal-orders-table .portal-po-block[data-state="waiting"] .portal-po-block-state { color: #5c3d00; }
.portal-orders-table .portal-po-tick[data-state="open"]::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 3px;
}
.portal-orders-table .portal-po-block[data-state="confirmed"] .portal-po-block-state,
.portal-orders-table .portal-po-tick[data-state="complete"] { color: #0d4d2a; }

/* Shared top bar of the orders application. The padding keeps its content
   aligned with .portal-shell without an extra wrapper element. */
.portal-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 28px;
  min-height: 64px;
  padding: 8px max(20px, calc((100% - 1180px) / 2));
  border-bottom: 3px solid var(--brand);
  background: var(--ink-strong);
  color: #fff;
}
.portal-brand { display: inline-flex; flex: none; align-items: center; gap: 14px; min-height: 44px; color: #fff; text-decoration: none; }
.portal-body a.portal-brand { color: #fff; text-decoration: none; }
/* Official Bodytone wordmark: black on the sign-in card, white variant on the dark top bar. */
.portal-logo { display: block; width: auto; height: 24px; }
.portal-login-brand .portal-logo { height: 32px; }
.portal-brand-context { padding-left: 14px; border-left: 1px solid rgba(255, 255, 255, .35); color: #d6d8d4; font: 700 12px/1.2 var(--font-data); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.portal-nav { display: flex; align-items: stretch; gap: 4px; margin-right: auto; }
.portal-topbar .portal-nav a { display: inline-flex; flex-shrink: 0; white-space: nowrap; align-items: center; min-height: 44px; padding: 0 12px; border-bottom: 3px solid transparent; color: #e4e5e2; font: 800 16px/1 var(--font-display); letter-spacing: .05em; text-decoration: none; text-transform: uppercase; }
.portal-topbar .portal-nav a:hover { color: #fff; border-bottom-color: rgba(255, 255, 255, .5); }
.portal-topbar .portal-nav a[aria-current="page"] { color: #fff; border-bottom-color: var(--brand-on-dark); }
.portal-account { display: flex; align-items: center; gap: 12px; margin-left: auto; min-width: 0; }
.portal-account-name { overflow: hidden; color: #e4e5e2; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.portal-topbar .secondary-button { flex: none; width: auto; min-height: 40px; padding: 0 12px; border-color: rgba(255, 255, 255, .55); background: transparent; color: #fff; }
.portal-topbar .secondary-button:hover { border-color: #fff; background: rgba(255, 255, 255, .1); color: #fff; }
.portal-topbar :focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
@media (max-width: 760px) {
  .portal-topbar { padding: 8px 12px; gap: 4px 16px; }
  .portal-topbar .portal-logo { height: 22px; }
  .portal-nav { order: 3; flex: 1 1 100%; overflow-x: auto; margin: 0 -4px; }
  .portal-topbar .portal-nav a { padding-inline: 8px; }
  .portal-account-name { max-width: 30vw; font-size: .95rem; }
}
@media (max-width: 480px) {
  .portal-topbar .portal-brand-context, .portal-account-name { display: none; }
}

/* Page headings inside the shell. */
.portal-page-title { margin: 8px 0 16px; font-size: clamp(2rem, 4.5vw, 2.6rem); }
.portal-page-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin: 8px 0 16px; }
.portal-page-heading .portal-page-title { margin: 0; }

/* Supplier introduction: open on first visit, collapsible afterwards. */
.portal-intro { margin: 0 0 20px; border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 6px; background: var(--panel); }
.portal-intro > summary { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 18px; cursor: pointer; font: 800 18px/1.1 var(--font-display); letter-spacing: .04em; text-transform: uppercase; list-style: none; }
.portal-intro > summary::-webkit-details-marker { display: none; }
.portal-intro > summary::after { margin-left: auto; color: var(--muted); content: "Show"; font: 700 12px/1 var(--font-data); letter-spacing: .06em; }
.portal-intro[open] > summary::after { content: "Hide"; }
.portal-intro-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0 18px 18px; list-style: none; counter-reset: portal-step; }
.portal-intro-steps li { padding: 14px; border-radius: 6px; background: var(--panel-soft); counter-increment: portal-step; line-height: 1.45; }
.portal-intro-steps strong { display: block; margin-bottom: 4px; font-size: 1.05rem; }
.portal-intro-who { display: block; margin-bottom: 8px; color: var(--brand-dark); font: 700 12px/1 var(--font-data); letter-spacing: .06em; text-transform: uppercase; }
.portal-intro-who::before { content: counter(portal-step, decimal-leading-zero) " · "; }
@media (max-width: 1000px) { .portal-intro-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .portal-intro-steps { grid-template-columns: minmax(0, 1fr); padding: 0 12px 12px; } .portal-intro > summary { padding: 8px 12px; } }

/* Staff: supplier values waiting for a Bodytone decision. */
.portal-conflicts { margin: 0 0 20px; padding: 14px 18px; border: 1px solid var(--line); border-left: 4px solid var(--amber); border-radius: 6px; background: var(--panel); }
.portal-conflicts h2 { margin: 0 0 8px; font-size: 1.2rem; }
.portal-conflicts ul { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 0; padding: 0; list-style: none; }
.portal-conflicts li { display: flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 600; }

/* Sign-in page. */
.portal-login-body {
  color-scheme: light;
  background-color: #eceeec;
  background-image:
    linear-gradient(rgba(21, 21, 21, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(21, 21, 21, .025) 1px, transparent 1px);
  background-size: 40px 40px;
  border-top: 6px solid var(--brand);
}
.portal-login { width: min(460px, calc(100% - 32px)); }
.portal-login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; color: var(--ink-strong); }
.portal-login-brand .portal-brand-context { border-left-color: #bfc1bd; color: var(--muted); }
.portal-login-lede { margin: 0 0 24px; color: var(--muted); font-size: 1.05rem; line-height: 1.5; }
.portal-login h2.portal-login-step, .portal-login p.portal-login-step { margin: 0 0 12px; font: 700 1.05rem/1.4 var(--font-body); letter-spacing: 0; text-transform: none; }
.portal-login-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0 12px; color: var(--muted); font: 700 12px/1 var(--font-data); letter-spacing: .06em; text-transform: uppercase; }
.portal-login-divider::before, .portal-login-divider::after { flex: 1; height: 1px; background: var(--line); content: ""; }
.portal-login .portal-login-google h2.portal-login-step { font-weight: 600; color: var(--muted); }
.portal-login-secondary { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: 8px; }
.portal-link-button { display: inline-flex; align-items: center; min-height: 44px; padding: 0; border: 0; background: none; color: var(--brand-dark); cursor: pointer; font: 600 1rem/1.2 var(--font-body); text-decoration: underline; text-underline-offset: 3px; }
.portal-body .portal-link-button:disabled { color: var(--muted); text-decoration: none; }
.portal-login-footnote { margin: 24px 0 0; padding-top: 16px; border-top: 1px solid var(--line); }

/* Named employee launchpad and AI access page. */
.agent-page-body, .agent-home-body { color-scheme: light; }
.portal-admin-body { color-scheme: light; }
.agent-page-shell { max-width: 940px; padding-top: clamp(28px, 7vh, 72px); }
.agent-page-heading { max-width: 760px; margin-bottom: 28px; }
.agent-plugin-brand { display: flex; align-items: center; gap: 16px; margin: 8px 0 12px; }
.agent-plugin-brand img { flex: 0 0 64px; }
.agent-page-heading h1 { margin: 4px 0 8px; }
.agent-page-heading > p:last-child { max-width: 64ch; margin: 0; color: var(--muted); font-size: 1.1rem; line-height: 1.55; }
.agent-home-kicker { margin: 0; color: var(--brand-dark); font: 800 12px/1.3 var(--font-data); letter-spacing: .08em; text-transform: uppercase; }
.agent-access-panel, .agent-readonly-note, .agent-examples, .agent-setup-flow, .agent-ready-check {
  padding: clamp(18px, 3vw, 28px);
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}
.agent-access-panel { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 32px; border-left: 4px solid var(--brand); }
.agent-access-panel h2, .agent-readonly-note h2, .agent-examples h2 { margin: 0 0 10px; font-size: 1.35rem; }
.agent-access-panel p { max-width: 62ch; margin: 0; line-height: 1.5; }
.agent-access-panel .agent-identity-name { margin-bottom: 4px; font-size: 1.25rem; font-weight: 750; color: var(--ink-strong); }
.agent-connect-link { display: inline-flex; align-items: center; justify-content: center; min-width: min(270px, 100%); min-height: 48px; padding: 12px 18px; color: #fff !important; text-decoration: none; text-align: center; }
.agent-setup-unavailable { flex-basis: 100%; padding: 12px 14px; border: 2px solid var(--amber); background: var(--panel-soft); }
.agent-readonly-note ul, .agent-examples ul { margin: 0; padding-left: 1.4rem; }
.agent-readonly-note li, .agent-examples li { padding: 4px 0; line-height: 1.55; }
.agent-examples > p { margin-top: 0; color: var(--muted); line-height: 1.5; }
.agent-install { margin: 28px 0 18px; }
.agent-section-heading { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 8px 24px; margin-bottom: 16px; }
.agent-section-heading h2 { margin: 4px 0 0; color: var(--ink-strong); font-size: clamp(1.5rem, 4vw, 1.9rem); }
.agent-section-heading > p { max-width: 38ch; margin: 0; color: var(--muted); line-height: 1.5; }
.agent-install-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.agent-install-card { display: flex; flex-direction: column; min-width: 0; padding: clamp(20px, 3vw, 28px); border: 1px solid var(--line); border-top: 4px solid var(--brand); border-radius: 6px; background: var(--panel); }
.agent-install-card-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.agent-install-card h3 { margin: 3px 0 0; color: var(--ink-strong); font: 800 1.85rem/1.1 var(--font-display); text-transform: uppercase; }
.agent-install-card > p { margin: 0 0 18px; line-height: 1.5; }
.agent-install-download { display: inline-flex; align-items: center; justify-content: center; align-self: flex-start; min-height: 48px; padding: 12px 18px; color: #fff !important; text-align: center; text-decoration: none; }
.agent-copy-field { display: grid; justify-items: start; gap: 7px; margin: 0 0 16px; }
.agent-copy-label { color: var(--ink-strong); font-weight: 700; }
.agent-copy-field code { display: block; width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel-soft); color: var(--ink-strong); font-size: .95rem; overflow-wrap: anywhere; user-select: all; }
.agent-copy-button { min-height: 44px; padding: 9px 14px; }
.agent-copy-status:not(:empty) { color: var(--brand-dark); font-weight: 700; }
.agent-copy-status { display: block; margin-top: 6px; }
.agent-install-steps { margin: 0; padding-left: 1.3rem; }
.agent-install-steps > li { padding-left: 4px; margin-bottom: 22px; line-height: 1.5; }
.agent-install-steps > li:last-child { margin-bottom: 0; }
.agent-install-steps > li::marker { color: var(--brand-dark); font-weight: 800; }
.agent-install-steps p { margin: 6px 0 12px; }
.agent-install-open { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 0 4px; min-height: 44px; padding: 10px 14px; text-align: center; text-decoration: none; white-space: normal; }
.agent-new-tab { font-size: .9em; }
.agent-ready-check h2 { margin: 0 0 12px; font-size: 1.35rem; }
.agent-ready-check p, .agent-setup-flow > p { line-height: 1.55; }
.agent-ready-check blockquote { margin: 16px 0; padding: 14px 18px; border-left: 4px solid var(--brand); background: var(--panel-soft); font-size: 1.1rem; line-height: 1.5; }
.agent-prompt-details { margin-top: 8px; }
.agent-prompt-details summary { min-height: 44px; padding: 10px 0; cursor: pointer; font-weight: 700; }
.agent-prompt-details pre { margin: 0 0 12px; padding: 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel-soft); color: var(--ink-strong); font: 500 .9rem/1.5 var(--font-body); white-space: pre-wrap; overflow-wrap: anywhere; }
.agent-plugin-extra { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.agent-plugin-extra summary { min-height: 44px; padding: 10px 0; cursor: pointer; font-weight: 700; }
.agent-plugin-extra p { margin: 0 0 12px; line-height: 1.5; }
.agent-plugin-extra a { font-weight: 700; }
.agent-setup-flow h2 { margin: 0 0 16px; font-size: 1.35rem; }
.agent-setup-flow ol { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; margin: 0; padding: 0; list-style: none; }
.agent-setup-flow li { display: flex; align-items: flex-start; gap: 12px; line-height: 1.5; }
.agent-flow-step { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 28px; height: 28px; border: 1px solid var(--brand-dark); border-radius: 50%; color: var(--brand-dark); font-weight: 800; }
.agent-home-shell { width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: clamp(28px, 8vh, 84px) 0 28px; }
.agent-home-hero { max-width: 720px; margin-bottom: 32px; }
.agent-home-hero h1 { margin: 6px 0; color: var(--ink-strong); font: 800 clamp(2.5rem, 7vw, 4rem)/.98 var(--font-display); text-transform: uppercase; }
.agent-home-hero > p:last-child { margin: 10px 0 0; color: var(--muted); font-size: 1.1rem; }
.agent-home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 265px), 1fr)); gap: 16px; }
.agent-home-card { display: flex; flex-direction: column; min-height: 230px; padding: 22px; border: 1px solid var(--line); border-top: 4px solid var(--ink-strong); border-radius: 6px; background: var(--panel); color: var(--ink) !important; text-decoration: none; box-shadow: var(--shadow); }
.agent-home-card:hover { border-top-color: var(--brand); }
.agent-home-card-ai { border-top-color: var(--brand); }
.agent-home-card h2 { margin: 5px 0 8px; color: var(--ink-strong); font: 800 1.8rem/1 var(--font-display); text-transform: uppercase; }
.agent-home-card p { margin: 0 0 20px; line-height: 1.5; }
.agent-home-card .agent-home-kicker { color: var(--muted); }
.agent-home-action { display: inline-flex; align-items: center; gap: 8px; margin-top: auto; color: var(--brand-dark); font-weight: 750; }
.agent-home-action b { font: 500 19px/1 var(--font-body); }
.agent-home-empty { grid-column: 1 / -1; padding: 20px; border: 1px solid var(--line); background: var(--panel); }
.agent-home-footer { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: .95rem; }
.agent-page-body :focus-visible, .agent-home-body :focus-visible { outline: 3px solid #174d93; outline-offset: 4px; }
@media (max-width: 600px) {
  .agent-page-shell { padding-top: 28px; }
  .agent-access-panel { align-items: stretch; }
  .agent-connect-link { width: 100%; }
  .agent-install-grid, .agent-setup-flow ol { grid-template-columns: minmax(0, 1fr); }
  .agent-install-download { width: 100%; white-space: normal; text-align: center; overflow-wrap: anywhere; }
  .agent-home-shell { width: min(100% - 28px, 1120px); padding-top: 34px; }
  .agent-home-card { min-height: 195px; }
}

/* Admin: portal status as a compact definition grid. */
.portal-status-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 12px 0 0; }
.portal-status-list dt { color: var(--muted); font: 700 12px/1.2 var(--font-data); letter-spacing: .04em; text-transform: uppercase; }
.portal-status-list dd { margin: 4px 0 0; font-size: 1.2rem; font-weight: 700; }

/* Employee and supplier entry points share the existing light identity. */
.portal-login--choice { width: min(760px, calc(100% - 32px)); }
.portal-login-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.portal-login-choice-link { display: flex; flex-direction: column; gap: 12px; padding: 22px; border: 1px solid var(--line); border-top: 4px solid var(--brand); border-radius: 6px; background: var(--panel-soft); color: var(--ink) !important; text-decoration: none; }
.portal-login-choice-link:hover { border-color: var(--brand-dark); }
.portal-login-choice-title { color: var(--ink-strong); font: 800 1.7rem/1.1 var(--font-display); text-transform: uppercase; }
.portal-login-choice-description { line-height: 1.5; }
.portal-login-choice-action { margin-top: auto; padding-top: 8px; color: var(--brand-dark); font-weight: 700; }
.connections-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0 0 20px; color: var(--muted); }
.connections-breadcrumb a { display: inline-flex; align-items: center; min-height: 44px; }
.connections-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 20px; }
.connections-grid .agent-home-card { max-width: 430px; }
.connections-help { margin-top: 24px; }
@media (max-width: 600px) {
  .portal-login-choice { grid-template-columns: minmax(0, 1fr); }
  .portal-login-brand { flex-wrap: wrap; }
}

/* Employee account access management. */
.portal-users-shell { max-width: 1120px; }
.portal-users-heading { margin: 20px 0 28px; }
.portal-users-heading h1 { margin: 4px 0 10px; }
.portal-users-intro { max-width: 68ch; font-size: 1.15rem; line-height: 1.5; }
.portal-users-invite-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 12px 20px; }
.portal-users-permissions { margin: 16px 0 20px; padding: 16px; border: 1px solid var(--line); border-radius: 6px; }
.portal-users-permissions legend { padding: 0 8px; font-weight: 700; }
.portal-users-permission-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(270px, 100%), 1fr)); gap: 10px; }
.portal-users-body label.portal-users-permission-option { display: flex; align-items: flex-start; gap: 12px; min-height: 60px; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel-soft); cursor: pointer; }
.portal-users-body .portal-users-permission-option input, .portal-users-body .portal-users-zenn-access input { flex: 0 0 22px; width: 22px; height: 22px; min-height: 22px; padding: 0; margin: 2px 0 0; accent-color: var(--brand-dark); }
.portal-users-permission-option strong, .portal-users-permission-option small { display: block; }
.portal-users-permission-option small { margin-top: 3px; color: var(--muted); font-size: .95rem; font-weight: 400; line-height: 1.4; }
.portal-users-list { display: grid; gap: 16px; }
.portal-user-card { padding: 18px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.portal-user-card-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.portal-user-card-heading h3 { margin: 0; }
.portal-user-status { display: inline-block; padding: 5px 10px; border: 1px solid var(--muted); border-radius: 4px; font-weight: 650; }
.portal-user-status--revoked { color: var(--red); border-color: var(--red); }
.portal-user-meta { color: var(--muted); overflow-wrap: anywhere; }
.portal-user-access-summary { margin: 10px 0; line-height: 1.6; }
.portal-user-editor > summary, .portal-users-secondary > summary { min-height: 44px; padding: 10px 0; cursor: pointer; font-weight: 700; }
.portal-users-body label.portal-users-zenn-access { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: 5px; }
.portal-user-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.portal-users-conflict { padding: 16px; border: 2px solid var(--amber); background: var(--panel-soft); margin: 12px 0; }
.portal-users-body .portal-users-access-save { margin-top: 12px; }
@media (max-width: 600px) {
  .portal-users-permissions { padding: 12px; }
  .portal-user-card { padding: 14px; }
  .portal-users-shell .portal-panel { padding: 16px; }
}
