:root {
  --portal-bg: var(--cmg-bg, #f8fafc);
  --portal-panel: var(--cmg-surface, #ffffff);
  --portal-ink: var(--cmg-text, #111827);
  --portal-muted: var(--cmg-muted, #6b7280);
  --portal-line: var(--cmg-border, #e5e7eb);
  --portal-blue: var(--cmg-navy, #0f172a);
  --portal-blue-dark: #172554;
  --portal-green: var(--cmg-success, #16a34a);
  --portal-cyan: var(--cmg-cyan, #00b8d9);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--portal-bg);
  color: var(--portal-ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
}

a {
  color: inherit;
  text-decoration: none;
}

.portal-auth-shell {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 0%, rgba(0, 184, 217, .08), transparent 30%),
    var(--portal-bg);
}

.portal-login {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 18px;
  align-items: stretch;
}

.portal-login__brand,
.portal-login__panel,
.portal-card,
.portal-hero,
.portal-metrics article {
  background: var(--portal-panel);
  border: 1px solid var(--portal-line);
  border-radius: 8px;
  box-shadow: var(--cmg-shadow-card, 0 2px 10px rgba(15, 23, 42, .06));
}

.portal-login__brand {
  min-height: 420px;
  padding: 32px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: linear-gradient(145deg, #ffffff, #f5f9fd);
  color: var(--portal-ink, #111827);
}

.portal-login__brand img,
.portal-brand img {
  width: 34px;
  height: 22px;
  object-fit: contain;
}

.portal-login__brand span,
.portal-brand span {
  font-weight: 800;
  font-size: 16px;
}

.portal-login__panel {
  padding: 28px;
}

.portal-eyebrow {
  margin: 0 0 4px;
  color: var(--portal-cyan);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.05;
}

h2 {
  font-size: 14px;
}

.portal-muted,
.portal-hero p,
.portal-list-row span,
.portal-item small {
  color: var(--portal-muted);
}

.portal-form {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.portal-form label {
  display: grid;
  gap: 6px;
  color: #3a526c;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.portal-form input,
.portal-form textarea,
.portal-form-grid input,
.portal-form-grid textarea,
.portal-item__order input,
.portal-notes textarea,
.portal-form button,
.portal-primary-action,
.portal-secondary-action,
.portal-nav a,
.portal-nav button {
  min-height: 38px;
  border-radius: 7px;
  border: 1px solid var(--portal-line);
  font: inherit;
  font-weight: 800;
}

.portal-form input {
  padding: 0 12px;
  background: #f8fbfd;
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
}

.portal-form button,
.portal-primary-action,
.portal-secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  background: var(--portal-blue);
  border-color: var(--portal-blue);
  color: #fff;
  cursor: pointer;
}

.portal-secondary-action {
  background: #f8fbfd;
  border-color: var(--portal-line);
  color: var(--portal-ink);
}

.portal-demo-note,
.portal-alert,
.portal-flash {
  margin-top: 14px;
  padding: 12px;
  border-radius: 7px;
  border: 1px solid var(--portal-line);
  background: #f6fafc;
}

.portal-demo-note {
  display: grid;
  gap: 4px;
}

.portal-alert,
.portal-flash--error {
  border-color: #f2b9b9;
  background: #fff3f3;
}

.portal-flash--success {
  border-color: #bce8d8;
  background: #f0fff9;
}

.portal-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 max(16px, calc((100vw - 1320px) / 2));
  background: #071826;
  color: #fff;
  box-shadow: 0 12px 32px rgba(7, 24, 38, .2);
}

.portal-brand,
.portal-nav,
.portal-nav form {
  display: flex;
  align-items: center;
  gap: 10px;
}

.portal-nav a,
.portal-nav button {
  min-height: 30px;
  padding: 0 10px;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  border-color: rgba(255, 255, 255, .16);
  cursor: pointer;
}

.portal-page {
  width: min(1320px, calc(100% - 32px));
  margin: 16px auto 40px;
  display: grid;
  gap: 12px;
}

.portal-hero {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.portal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.portal-hero h1 {
  font-size: 20px;
}

.portal-hero p {
  margin: 6px 0 0;
}

.portal-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.portal-metrics article {
  padding: 14px;
}

.portal-metrics span,
.portal-card__head span {
  color: var(--portal-muted);
}

.portal-metrics strong {
  display: block;
  margin-top: 5px;
  font-size: 18px;
}

.portal-suppliers {
  padding: 14px;
}

.portal-supplier-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  padding-top: 12px;
}

.portal-supplier-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px;
  border: 1px solid #d6e5f0;
  border-radius: 9px;
  background: #fbfdff;
  text-align: left;
}

.portal-supplier-card.is-active {
  border-color: #75cfbd;
  background: linear-gradient(135deg, #f3fffb, #f7fcff);
  box-shadow: inset 4px 0 0 var(--portal-green);
}

.portal-supplier-logo {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #cfe3f0;
  border-radius: 8px;
  background: #eef7fc;
}

.portal-supplier-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

.portal-supplier-logo span {
  color: #075f96;
  font-size: 13px;
  font-weight: 950;
}

.portal-supplier-meta,
.portal-supplier-balance {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.portal-supplier-meta strong,
.portal-supplier-meta span,
.portal-supplier-meta small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-supplier-meta strong {
  font-size: 13px;
}

.portal-supplier-meta span,
.portal-supplier-meta small,
.portal-supplier-balance span,
.portal-supplier-balance small {
  color: var(--portal-muted);
  font-size: 11px;
  font-weight: 800;
}

.portal-supplier-balance {
  justify-items: end;
  white-space: nowrap;
}

.portal-supplier-balance strong {
  font-size: 13px;
}

.portal-supplier-card button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--portal-blue);
  border-radius: 7px;
  background: var(--portal-blue);
  color: #fff;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.portal-supplier-card button:disabled {
  border-color: #bfead8;
  background: #e9fbf4;
  color: #157655;
  cursor: default;
}

.portal-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 12px;
}

.portal-card {
  padding: 14px;
  overflow: hidden;
}

.portal-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e3ebf2;
}

.portal-card__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.portal-table {
  overflow-x: auto;
}

.portal-table-link {
  color: #075f96;
  font-weight: 950;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.portal-table table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

.portal-table th,
.portal-table td {
  padding: 10px 8px;
  border-bottom: 1px solid #e9eff5;
  text-align: left;
  white-space: nowrap;
}

.portal-table th {
  color: #38536f;
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.portal-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid #c9d9e7;
  border-radius: 999px;
  background: #f6fafc;
  font-size: 10px;
  font-weight: 800;
}

.portal-status--paid {
  border-color: #bfead8;
  background: #effdf7;
  color: #137b54;
}

.portal-status--due {
  border-color: #f1d1a2;
  background: #fff8e8;
  color: #9a5b00;
}

.portal-statement-bar {
  display: grid;
  grid-template-columns: auto minmax(140px, 1fr) minmax(140px, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin: 12px 0;
  padding: 10px;
  border: 1px solid #d9e9f2;
  border-radius: 8px;
  background: #f7fcff;
}

.portal-statement-bar strong {
  align-self: center;
  color: #0c4064;
}

.portal-statement-bar label {
  display: grid;
  gap: 4px;
  color: #38536f;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.portal-statement-bar input,
.portal-statement-bar button {
  min-height: 34px;
  border: 1px solid var(--portal-line);
  border-radius: 7px;
  font: inherit;
  font-weight: 850;
}

.portal-statement-bar input {
  padding: 0 9px;
  background: #fff;
}

.portal-statement-bar button {
  padding: 0 12px;
  background: var(--portal-blue);
  border-color: var(--portal-blue);
  color: #fff;
  cursor: pointer;
}

.portal-inline-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.portal-inline-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid #bcd3e6;
  border-radius: 999px;
  background: #f7fbfe;
  color: #075f96;
  font-weight: 900;
}

.portal-list {
  display: grid;
  gap: 8px;
  padding-top: 12px;
}

.portal-list-row {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid #e3ebf2;
  border-radius: 7px;
  background: #fbfdff;
}

.portal-team {
  display: grid;
  gap: 8px;
  padding-top: 12px;
}

.portal-payment-note,
.portal-payment-cta,
.portal-address-block,
.portal-cart-governance {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid #d9e9f2;
  border-radius: 8px;
  background: #f8fcff;
}

.portal-payment-note span,
.portal-payment-cta span,
.portal-address-block span,
.portal-cart-governance span {
  color: var(--portal-muted);
}

.portal-cart-governance {
  margin-bottom: 10px;
  border-color: #cfe3f0;
  background: #f5fbff;
}

.portal-payment-note--connected {
  border-color: #bfead8;
  background: #f0fff8;
}

.portal-payment-note--pending {
  border-color: #f1d6a7;
  background: #fffaf0;
}

.portal-invite-form {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e3ebf2;
}

.portal-invite-form label,
.portal-catalog-toolbar label {
  display: grid;
  gap: 5px;
  color: #38536f;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.portal-invite-form input,
.portal-invite-form select,
.portal-catalog-toolbar input,
.portal-catalog-toolbar select {
  width: 100%;
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid var(--portal-line);
  border-radius: 8px;
  background: #f8fbfd;
  color: var(--portal-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

.portal-checkbox {
  display: flex !important;
  align-items: center;
  gap: 8px !important;
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid #d9e9f2;
  border-radius: 8px;
  background: #f8fcff;
  color: var(--portal-ink) !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

.portal-checkbox input {
  width: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
}

.portal-list-row small {
  color: #075f96;
  font-weight: 850;
}

.portal-alert--rules {
  display: grid;
  gap: 5px;
  margin-top: 0;
  border-color: #cfe3f0;
  background: #f5fbff;
}

.portal-alert--rules span {
  color: var(--portal-muted);
  font-weight: 800;
}

.portal-catalog-toolbar {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(180px, 260px) auto;
  gap: 12px;
  align-items: end;
  padding: 12px 0 0;
}

.portal-catalog-toolbar > span {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #cce2f3;
  border-radius: 999px;
  background: #f4fbff;
  color: #075f96;
  font-weight: 900;
  white-space: nowrap;
}

.portal-quick-order {
  display: grid;
  grid-template-columns: minmax(190px, .7fr) minmax(260px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid #cfe3f0;
  border-radius: 9px;
  background: #f5fbff;
}

.portal-quick-order strong,
.portal-quick-order span,
.portal-quick-order small {
  display: block;
}

.portal-quick-order strong {
  font-size: 13px;
  font-weight: 950;
}

.portal-quick-order span,
.portal-quick-order small {
  color: var(--portal-muted);
  font-size: 12px;
  font-weight: 800;
}

.portal-quick-order textarea {
  width: 100%;
  min-height: 68px;
  padding: 9px 10px;
  border: 1px solid var(--portal-line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--portal-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  resize: vertical;
}

.portal-quick-order button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--portal-blue);
  border-radius: 8px;
  background: var(--portal-blue);
  color: #ffffff;
  font: inherit;
  font-size: 13px;
  font-weight: 950;
  cursor: pointer;
}

.portal-quick-order__actions {
  display: flex;
  align-items: stretch;
  gap: 8px;
  flex-wrap: wrap;
}

.portal-quick-order__actions .portal-secondary-action {
  min-height: 40px;
  cursor: pointer;
}

.portal-quick-order small {
  grid-column: 2 / -1;
}

.portal-buy-again {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #cfe3f0;
  border-radius: 10px;
  background: #f7fcff;
}

.portal-buy-again__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
}

.portal-buy-again__head strong,
.portal-buy-again__head span {
  display: block;
}

.portal-buy-again__head strong {
  font-size: 14px;
  font-weight: 950;
}

.portal-buy-again__head span,
.portal-buy-again__item small {
  color: var(--portal-muted);
  font-size: 12px;
  font-weight: 800;
}

.portal-buy-again__head a {
  color: var(--portal-blue);
  font-size: 12px;
  font-weight: 950;
  text-decoration: none;
  white-space: nowrap;
}

.portal-buy-again__list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.portal-buy-again__item {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) minmax(96px, auto);
  gap: 9px;
  align-items: center;
  min-height: 78px;
  padding: 8px;
  border: 1px solid #dce9f1;
  border-radius: 8px;
  background: #ffffff;
}

.portal-buy-again__image {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: #eaf3f8;
  color: var(--portal-blue);
  font-weight: 950;
  cursor: zoom-in;
}

.portal-buy-again__image:disabled {
  cursor: default;
}

.portal-buy-again__image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.portal-buy-again__item strong,
.portal-buy-again__item small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-buy-again__item strong {
  font-size: 13px;
  font-weight: 950;
}

.portal-buy-again__order {
  display: grid;
  grid-template-columns: 1fr 54px;
  gap: 6px;
  align-items: center;
}

.portal-buy-again__order span {
  grid-column: 1 / -1;
  color: var(--portal-ink);
  font-size: 13px;
  font-weight: 950;
  text-align: right;
}

.portal-buy-again__order input {
  width: 54px;
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid var(--portal-line);
  border-radius: 7px;
  font: inherit;
  font-weight: 850;
}

.portal-buy-again__order button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--portal-blue);
  border-radius: 7px;
  background: var(--portal-blue);
  color: #ffffff;
  font: inherit;
  font-size: 12px;
  font-weight: 950;
  cursor: pointer;
}

.portal-buy-again__order button:disabled {
  border-color: #c8d6df;
  background: #d8e2e9;
  color: #617489;
  cursor: not-allowed;
}

.portal-search-results {
  position: relative;
  z-index: 6;
  display: grid;
  gap: 6px;
  max-height: 340px;
  margin-top: 8px;
  padding: 8px;
  overflow: auto;
  border: 1px solid #b9d8eb;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 18px 36px rgba(10, 38, 58, .16);
}

.portal-search-results[hidden] {
  display: none;
}

.portal-search-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 52px;
  width: 100%;
  padding: 6px;
  border: 1px solid #d7e7f1;
  border-radius: 9px;
  background: #fbfdff;
  color: var(--portal-ink);
  text-align: left;
  cursor: pointer;
}

.portal-search-row:hover,
.portal-search-row:focus-visible {
  border-color: #49b6d4;
  background: #effaff;
  outline: none;
}

.portal-search-row strong,
.portal-search-row small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-search-row small {
  color: var(--portal-muted);
  font-size: 11px;
  font-weight: 800;
}

.portal-search-thumb {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border: 1px solid #d5e5ee;
  border-radius: 8px;
  background: #edf5fa;
  color: #0878b6;
  font-weight: 950;
}

.portal-search-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.portal-search-empty {
  padding: 10px;
  color: var(--portal-muted);
  font-weight: 800;
}

.portal-catalog {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding-top: 12px;
}

.portal-item {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 12px;
  min-height: 154px;
  padding: 10px;
  border: 1px solid #e3ebf2;
  border-radius: 7px;
  background: #fbfdff;
}

.portal-item[hidden],
.portal-search-results[hidden] {
  display: none !important;
}

.portal-item.is-highlighted {
  border-color: #18a9cb;
  box-shadow: 0 0 0 3px rgba(24, 169, 203, .14);
}

.portal-item__image {
  display: grid;
  place-items: center;
  min-height: 132px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: linear-gradient(135deg, #eff5f9, #dce8f1);
  cursor: zoom-in;
  overflow: hidden;
}

.portal-item__image:disabled {
  cursor: default;
}

.portal-item__image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.portal-item__image span {
  color: #1688ca;
  font-size: 24px;
  font-weight: 900;
}

.portal-image-modal {
  width: min(1100px, calc(100vw - 28px));
  height: min(820px, calc(100vh - 28px));
  padding: 0;
  border: 0;
  background: transparent;
}

.portal-image-modal::backdrop {
  background: rgba(7, 24, 38, .62);
  backdrop-filter: blur(4px);
}

.portal-image-modal__panel {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 10px;
  height: 100%;
  padding: 18px;
  border: 1px solid #c8dcea;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 26px 70px rgba(7, 24, 38, .28);
}

.portal-image-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  min-width: 78px;
  min-height: 38px;
  border: 1px solid #b9d8eb;
  border-radius: 999px;
  background: #ffffff;
  color: var(--portal-ink);
  font-weight: 950;
  cursor: pointer;
}

.portal-image-modal__stage {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 0;
  overflow: auto;
  padding: 16px;
  border: 1px solid #d8e8f1;
  border-radius: 12px;
  background: #f5fafc;
}

.portal-image-modal__stage img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(min(816px, 100vh - 28px) - 150px);
  object-fit: contain;
  transform-origin: center center;
}

.portal-image-modal__panel > strong {
  min-width: 0;
  overflow: hidden;
  color: var(--portal-ink);
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-image-modal__tools {
  display: grid;
  grid-template-columns: 44px minmax(90px, 1fr) 44px minmax(110px, 160px);
  gap: 8px;
  align-items: center;
}

.portal-image-modal__tools button,
.portal-image-modal__tools span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid #b9d8eb;
  border-radius: 8px;
  background: #f5fbff;
  color: var(--portal-ink);
  font-weight: 950;
}

.portal-image-modal__tools button {
  background: var(--portal-blue);
  border-color: var(--portal-blue);
  color: #ffffff;
  cursor: pointer;
}

.portal-item div:last-child {
  display: grid;
  align-content: start;
  gap: 6px;
}

.portal-item strong {
  font-size: 14px;
  line-height: 1.2;
}

.portal-item span {
  font-weight: 900;
}

.portal-item em {
  color: var(--portal-muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.portal-item__order {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
  margin-top: 4px;
}

.portal-item__order label {
  display: grid;
  gap: 3px;
  color: #38536f;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.portal-item__order input {
  width: 100%;
  padding: 0 8px;
  background: #fff;
}

.portal-item__order button,
.portal-modal__actions button,
.portal-cart-row button {
  min-height: 38px;
  border-radius: 7px;
  border: 1px solid var(--portal-line);
  background: #fff;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.portal-item__order button {
  align-self: end;
  background: var(--portal-blue);
  border-color: var(--portal-blue);
  color: #fff;
}

.portal-item__order button:disabled {
  cursor: not-allowed;
  background: #d8e5ee;
  border-color: #d8e5ee;
  color: #5e7184;
}

.portal-invoice-hero h1 {
  font-size: 26px;
}

.portal-invoice-shell {
  display: grid;
  grid-template-columns: 1.35fr .9fr;
  gap: 12px;
}

.portal-invoice-summary {
  display: grid;
  gap: 12px;
}

.portal-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.portal-detail-grid > div {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid #e3ebf2;
  border-radius: 7px;
  background: #fbfdff;
}

.portal-detail-grid span {
  color: #38536f;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.portal-table--invoice table {
  min-width: 760px;
}

.portal-table--invoice td:first-child {
  white-space: normal;
}

.portal-table--invoice td small {
  display: block;
  margin-top: 3px;
  color: var(--portal-muted);
}

.portal-cart-open span {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  min-height: 22px;
  margin-left: 8px;
  border-radius: 999px;
  background: #fff;
  color: var(--portal-blue);
}

.portal-modal {
  width: min(920px, calc(100% - 24px));
  max-height: min(860px, calc(100vh - 24px));
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
}

.portal-modal::backdrop {
  background: rgba(6, 21, 34, .48);
  backdrop-filter: blur(4px);
}

.portal-modal__panel {
  display: grid;
  gap: 14px;
  max-height: min(860px, calc(100vh - 24px));
  padding: 16px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--portal-line);
  border-radius: 10px;
  box-shadow: 0 26px 70px rgba(7, 24, 38, .28);
}

.portal-modal__head,
.portal-modal__actions,
.portal-cart-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.portal-modal__head {
  padding-bottom: 10px;
  border-bottom: 1px solid #e3ebf2;
}

.portal-modal__head button {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--portal-line);
  border-radius: 7px;
  background: #f8fbfd;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.portal-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.portal-form-grid label,
.portal-notes {
  display: grid;
  gap: 5px;
  color: #38536f;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.portal-form-grid input,
.portal-form-grid textarea,
.portal-notes textarea {
  width: 100%;
  padding: 0 10px;
  background: #f8fbfd;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.portal-form-grid textarea,
.portal-notes textarea {
  min-height: 76px;
  padding-top: 10px;
  resize: vertical;
}

.portal-span-2 {
  grid-column: span 2;
}

.portal-cart-lines {
  display: grid;
  gap: 8px;
}

.portal-cart-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #e3ebf2;
  border-radius: 8px;
  background: #fbfdff;
}

.portal-cart-row span {
  display: block;
  margin-top: 3px;
  color: var(--portal-muted);
}

.portal-cart-total {
  padding: 12px;
  border: 1px solid #e3ebf2;
  border-radius: 8px;
  background: #f8fbfd;
}

.portal-cart-total strong {
  font-size: 18px;
}

@media (max-width: 860px) {
  .portal-login {
    grid-template-columns: 1fr;
  }

  .portal-login__brand {
    min-height: 92px;
  }

  .portal-topbar,
  .portal-hero {
    align-items: flex-start;
    flex-direction: column;
    height: auto;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .portal-page {
    width: min(100% - 16px, 680px);
    margin-top: 8px;
  }

  .portal-metrics,
  .portal-grid,
  .portal-invoice-shell,
  .portal-catalog,
  .portal-catalog-toolbar,
  .portal-supplier-list,
  .portal-quick-order,
  .portal-buy-again__list {
    grid-template-columns: 1fr;
  }

  .portal-supplier-card {
    grid-template-columns: 42px minmax(0, 1fr) auto;
  }

  .portal-supplier-balance {
    grid-column: 2 / -1;
    justify-items: start;
  }

  .portal-quick-order small {
    grid-column: auto;
  }

  .portal-buy-again__head {
    align-items: flex-start;
    flex-direction: column;
  }

  .portal-buy-again__item {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .portal-buy-again__order {
    grid-column: 1 / -1;
    grid-template-columns: 80px 1fr;
  }

  .portal-buy-again__order span {
    grid-column: 1 / -1;
    text-align: left;
  }

  .portal-statement-bar,
  .portal-detail-grid {
    grid-template-columns: 1fr;
  }

  .portal-table table {
    min-width: 720px;
  }

  .portal-actions,
  .portal-primary-action,
  .portal-secondary-action {
    width: 100%;
  }

  .portal-item {
    grid-template-columns: 96px 1fr;
    min-height: 132px;
  }

  .portal-item__image {
    min-height: 110px;
  }

  .portal-search-results {
    max-height: 280px;
  }

  .portal-image-modal {
    width: calc(100vw - 16px);
    height: calc(100dvh - 16px);
  }

  .portal-image-modal__panel {
    padding: 12px;
  }

  .portal-image-modal__stage {
    padding: 12px;
  }

  .portal-image-modal__stage img {
    max-height: calc(100dvh - 170px);
  }

  .portal-image-modal__tools {
    grid-template-columns: 44px 1fr 44px;
  }

  .portal-image-modal__tools button:last-child {
    grid-column: 1 / -1;
  }

  .portal-form-grid,
  .portal-cart-row {
    grid-template-columns: 1fr;
  }

  .portal-inline-actions {
    flex-wrap: wrap;
  }

  .portal-span-2 {
    grid-column: auto;
  }
}

