:root {
  --pink: #fcc9c9;
  --pink-soft: #fff4f4;
  --accent: #fcc9c9;
  --accent-soft: #fff1f1;
  --ink: #000000;
  --text: #1c1c1c;
  --muted: #666666;
  --line: #e7e2e2;
  --line-strong: #000000;
  --surface: #ffffff;
  --surface-alt: #f7f7f7;
  --green: #5f9e58;
  --green-soft: #eef7ed;
  --red: #d94d4d;
  --red-soft: #fff0f0;
  --amber: #a66a00;
  --amber-soft: #fff6e4;
  --blue: #315f86;
  --blue-soft: #edf5fb;
  --magenta: #b81872;
  --magenta-soft: #fff0f8;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--surface);
  color: var(--text);
  font-family: Montserrat, Arial, sans-serif;
}

body {
  font-size: 13px;
  margin: 0;
  min-width: 320px;
}

html.app-loading,
html.app-loading *,
body.app-booting,
body.app-booting *,
body.app-loading,
body.app-loading * {
  cursor: wait !important;
}

.tonestock-loading-overlay {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(6px);
  display: grid;
  inset: 0;
  isolation: isolate;
  opacity: 0;
  pointer-events: none;
  place-items: center;
  position: fixed;
  transition: opacity 160ms ease, visibility 160ms ease;
  visibility: hidden;
  z-index: 99999;
}

.tonestock-loading-overlay::before,
.tonestock-loading-overlay::after {
  display: none;
  pointer-events: none;
}

body.app-booting .tonestock-loading-overlay,
html.app-nav-loading .tonestock-loading-overlay,
body.app-nav-loading .tonestock-loading-overlay {
  opacity: 1;
  pointer-events: all;
  visibility: visible;
}

.tonestock-loading-overlay video {
  background: transparent;
  border: 0;
  box-shadow: none;
  display: block;
  height: auto;
  max-height: 34vh;
  object-fit: contain;
  outline: 0;
  width: min(240px, 46vw);
}

.tonestock-loading-overlay video::-webkit-media-controls {
  display: none !important;
}

@keyframes tonestock-mobile-loader-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 760px), (hover: none) and (pointer: coarse) {
  .tonestock-loading-overlay {
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(4px);
  }

  .tonestock-loading-overlay video {
    display: none;
  }

  .tonestock-loading-overlay::before {
    animation: tonestock-mobile-loader-spin 900ms linear infinite;
    border: 4px solid rgba(252, 201, 201, 0.72);
    border-radius: 999px;
    border-top-color: var(--ink);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.08);
    content: "";
    display: block;
    height: 68px;
    width: 68px;
  }

  .tonestock-loading-overlay::after {
    background: url("assets/tones-logo-alambre.png") center / contain no-repeat;
    content: "";
    display: block;
    height: 34px;
    inset: 50% auto auto 50%;
    opacity: 0.86;
    position: absolute;
    transform: translate(-50%, -50%);
    width: 34px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tonestock-loading-overlay {
    transition: none;
  }

  .tonestock-loading-overlay::before {
    animation: none;
  }
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.announcement {
  align-items: center;
  background: var(--ink);
  color: var(--surface);
  display: flex;
  font-size: 12px;
  height: 36px;
  justify-content: center;
  text-transform: uppercase;
}

.app-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 12px 20px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.brand {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: 0;
}

.brand-button {
  background: transparent;
  border: 0;
  color: inherit;
  padding: 0;
  text-align: left;
}

.brand-button:hover h1 {
  color: var(--text);
}

.brand img {
  height: 42px;
  object-fit: contain;
  width: 108px;
}

.app-header .brand img {
  height: 58px;
  width: 58px;
}

.eyebrow {
  color: var(--muted);
  font-size: 11px;
  margin: 0 0 4px;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  color: var(--ink);
  font-family: Montserrat, Arial, sans-serif;
  font-weight: 700;
  margin: 0;
}

h1 {
  font-size: 18px;
}

.brand h1 {
  font-family: "Aptos Display", "Segoe UI", Montserrat, Arial, sans-serif;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  text-transform: uppercase;
}

.auth-brand h1 {
  font-size: 22px;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 15px;
}

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

.integration-status-wrap {
  position: relative;
}

.integration-status-button {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  gap: 6px;
  min-height: 34px;
  padding: 0 10px;
  white-space: nowrap;
}

.integration-status-button.connected {
  background: var(--green-soft);
  border-color: #b6dcb2;
  color: #276923;
}

.integration-status-button.not-connected {
  background: var(--red-soft);
  border-color: #f0b8b8;
  color: #9f2828;
}

.integration-status-button.checking {
  background: var(--surface-alt);
  color: var(--muted);
}

.integration-status-icon {
  height: 16px;
  width: 16px;
}

.integration-status-icon path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.integration-status-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 310px;
  padding: 12px;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 1000;
}

.integration-status-panel-heading {
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 8px;
}

.integration-status-panel-heading span {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.integration-status-row {
  align-items: flex-start;
  display: grid;
  gap: 9px;
  grid-template-columns: 9px 1fr;
  padding: 8px 0;
}

.integration-status-row + .integration-status-row {
  border-top: 1px solid var(--line);
}

.integration-status-dot {
  border-radius: 50%;
  height: 9px;
  margin-top: 4px;
  width: 9px;
}

.integration-status-row.connected .integration-status-dot {
  background: var(--green);
}

.integration-status-row.not-connected .integration-status-dot {
  background: var(--red);
}

.integration-status-row strong,
.integration-status-row small {
  display: block;
}

.integration-status-row small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  margin-top: 2px;
}

.integration-status-note {
  border-top: 1px solid var(--line);
  font-size: 11px;
  margin-top: 6px;
  padding-top: 8px;
}

@media (max-width: 720px) {
  .integration-status-panel {
    left: 0;
    min-width: min(310px, calc(100vw - 32px));
    right: auto;
  }
}

.upload-pill,
.primary-button,
.blue-action-button,
.text-button,
.icon-button,
.mini-button {
  align-items: center;
  border: 1px solid var(--ink);
  border-radius: 6px;
  display: inline-flex;
  justify-content: center;
  min-height: 34px;
  white-space: nowrap;
}

.upload-pill {
  background: var(--pink);
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  gap: 6px;
  padding: 0 9px;
  position: relative;
  text-transform: uppercase;
}

.upload-pill.secondary {
  background: var(--surface);
}

.upload-pill input {
  display: none;
}

.blue-action-button {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--surface);
  font-weight: 800;
  padding: 0 14px;
}

.blue-action-button:disabled {
  background: var(--blue-soft);
  border-color: #b8cfe2;
  color: var(--blue);
  cursor: not-allowed;
  opacity: 0.75;
}

.header-sync-status {
  align-items: flex-start;
  border: 1px solid;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  justify-content: center;
  min-height: 38px;
  padding: 5px 11px;
  text-align: left;
}

.header-sync-status span:first-child {
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.header-sync-status span:last-child {
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-sync-status.connected {
  background: #edf7ee;
  border-color: #8bc28d;
  color: #22672b;
}

.header-sync-status.not-connected {
  background: #fff0f0;
  border-color: #df9b9b;
  color: #9a2f2f;
}

.header-sync-status:hover {
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

.utility-hidden {
  display: none !important;
}

[hidden] {
  display: none !important;
}

.auth-shell {
  align-items: center;
  background: linear-gradient(180deg, var(--pink-soft), var(--surface));
  display: flex;
  min-height: calc(100vh - 36px);
  padding: 24px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  margin: 0 auto;
  max-width: 520px;
  padding: 24px;
  width: 100%;
}

.auth-brand {
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
  padding-bottom: 18px;
}

.auth-brand img {
  height: 58px;
  width: 148px;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label,
.dialog-card label,
.production-entry-page label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 700;
  gap: 6px;
  text-transform: uppercase;
}

.auth-form input,
.dialog-card input,
.dialog-card select,
.production-entry-page input,
.production-entry-page select {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  min-height: 34px;
  padding: 7px 9px;
  text-transform: none;
}

.auth-hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin: -4px 0 2px;
}

.auth-form .checkbox-row {
  align-items: center;
  color: var(--text);
  flex-direction: row;
  font-size: 12px;
  font-weight: 600;
  gap: 8px;
  grid-auto-flow: column;
  grid-template-columns: auto 1fr;
  justify-content: start;
  text-transform: none;
}

.auth-form .checkbox-row input {
  min-height: 0;
  width: 16px;
}

.plain-link {
  background: transparent;
  border: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  justify-self: start;
  padding: 0;
  text-decoration: underline;
}

.forgot-link {
  color: var(--muted);
  font-size: 12px;
  justify-self: start;
  margin-top: -8px;
  text-decoration: underline;
}

.auth-status {
  color: var(--muted);
  font-size: 13px;
  margin-top: 16px;
  min-height: 20px;
}

.user-menu {
  position: relative;
}

.user-button {
  align-items: center;
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 999px;
  color: var(--surface);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  height: 34px;
  justify-content: center;
  overflow: hidden;
  padding: 0;
  position: relative;
  width: 34px;
}

.user-avatar-content {
  align-items: center;
  border-radius: 50%;
  display: inline-flex;
  height: 100%;
  justify-content: center;
  overflow: hidden;
  position: relative;
  width: 100%;
}

.user-avatar-initials {
  align-items: center;
  display: inline-flex;
  height: 100%;
  justify-content: center;
  width: 100%;
}

.user-avatar-image {
  height: 100%;
  inset: 0;
  object-fit: cover;
  position: absolute;
  width: 100%;
}

.user-avatar-image[hidden] {
  display: none;
}

.user-menu-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  min-width: 220px;
  padding: 6px;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 120;
}

.user-menu-panel button {
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: var(--text);
  display: block;
  font-size: 13px;
  min-height: 34px;
  padding: 8px 10px;
  text-align: left;
  width: 100%;
}

.user-menu-panel button:hover {
  background: var(--surface-alt);
}

.has-tooltip::after {
  background: var(--ink);
  border-radius: 6px;
  bottom: -12px;
  color: var(--surface);
  content: attr(data-tooltip);
  font-size: 12px;
  font-weight: 400;
  left: 50%;
  line-height: 1.35;
  max-width: min(320px, 80vw);
  opacity: 0;
  padding: 10px 12px;
  pointer-events: none;
  position: absolute;
  text-transform: none;
  transform: translate(-50%, 100%);
  transition: opacity 120ms ease;
  white-space: normal;
  width: max-content;
  z-index: 80;
}

.has-tooltip:hover::after,
.has-tooltip:focus-within::after {
  opacity: 1;
}

.primary-button {
  background: var(--ink);
  color: var(--surface);
  font-weight: 700;
  padding: 0 11px;
}

.text-button {
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
}

.icon-button {
  background: var(--surface);
  color: var(--ink);
  height: 34px;
  min-height: 34px;
  padding: 0;
  width: 34px;
}

.mini-button {
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  min-height: 30px;
  padding: 0 10px;
}

.mini-button.dark {
  background: var(--ink);
  color: var(--surface);
}

.mini-button.order-fulfill-button {
  background: #dff0fb;
  border-color: #a9d4f1;
  color: #1f5f88;
}

.mini-button.order-undo-button {
  background: var(--red-soft);
  border-color: #f0b8b8;
  color: var(--red);
}

.mini-button.shipstation-order-button {
  background: #eef7ff;
  border-color: #bcdcf8;
  color: #236895;
}

.shipstation-order-sent {
  align-items: center;
  background: #edf8ef;
  border: 1px solid #b8dfc0;
  color: #2d7039;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  min-height: 30px;
  padding: 0 10px;
  white-space: nowrap;
}

.mini-button:disabled {
  border-color: var(--line);
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.55;
}

.main-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  overflow-x: visible;
  padding: 0 20px;
  position: sticky;
  top: 83px;
  z-index: 19;
}

.nav-tab,
.category-tab,
.sub-tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  min-height: 36px;
  padding: 0 10px;
  text-decoration: none;
}

.module-nav .nav-tab {
  align-items: center;
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  min-height: 64px;
  min-width: 92px;
  padding: 8px 14px;
}

.nav-icon {
  align-items: center;
  color: currentColor;
  display: inline-flex;
  height: 27px;
  justify-content: center;
  position: relative;
  width: 27px;
}

.nav-icon svg {
  fill: none;
  height: 27px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
  width: 27px;
}

.nav-icon-jar svg {
  stroke-width: 1.55;
}

.nav-icon img {
  display: block;
  height: 29px;
  object-fit: contain;
  width: 29px;
}

.nav-plus {
  align-items: center;
  background: var(--ink);
  border: 2px solid var(--surface);
  border-radius: 999px;
  bottom: -5px;
  color: var(--surface);
  display: inline-flex;
  font-size: 15px;
  font-weight: 900;
  height: 17px;
  justify-content: center;
  line-height: 1;
  position: absolute;
  right: -6px;
  width: 17px;
}

.nav-tab.active,
.category-tab.active,
.sub-tab.active {
  background: var(--accent);
  border-color: var(--ink);
  color: var(--ink);
}

.nav-tab.active {
  box-shadow: inset 0 -2px 0 var(--ink);
}

.module-nav .nav-tab[data-view="production"].active {
  background: #d8c2eb;
  color: var(--ink);
}

.module-nav .nav-tab[data-view="formulas"].active {
  background: #ffe6a3;
  color: var(--ink);
}

.module-nav .nav-tab[data-view="inventory"].active {
  background: #c9ec98;
  color: var(--ink);
}

.module-nav .nav-tab[data-view="customers"].active {
  background: #f3b8d5;
  color: var(--ink);
}

.module-nav .nav-tab[data-view="sales-channels"].active {
  background: #d0f1e9;
  color: var(--ink);
}

.module-nav .nav-tab[data-view="vendors"].active {
  background: #bfd9f4;
  color: var(--ink);
}

.module-nav .nav-tab[data-view="reports"].active {
  background: #bdecef;
  color: var(--ink);
}

main {
  margin: 0 auto;
  max-width: 1480px;
  padding: 14px 16px 32px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.inventory-shell.active {
  margin-bottom: 14px;
}

body.portal-mode .announcement,
body.portal-mode .app-header,
body.portal-mode .module-nav,
body.portal-mode .app-sidebar {
  display: none;
}

body.portal-mode .app-shell {
  background: #fffafa;
  display: block;
}

body.portal-mode .app-main-shell {
  width: 100%;
}

body.portal-mode main {
  max-width: none;
  padding: 0;
}

.portal-launch-button {
  align-items: center;
  background: var(--ink);
  border: 1px solid var(--ink);
  color: var(--surface);
  display: inline-flex;
  font-weight: 800;
  min-height: 42px;
  padding: 0 16px;
  text-decoration: none;
  white-space: nowrap;
}

.portal-launch-button:hover {
  background: var(--surface);
  color: var(--ink);
}

.portal-view.active {
  background: #fffafa;
  display: block;
  min-height: 100vh;
}

.portal-shell {
  color: #181818;
  font-size: 14px;
  min-height: 100vh;
}

.portal-access-panel {
  align-items: center;
  background: #fff7f7;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 32px;
}

.portal-access-card {
  background: #fff;
  border: 1px solid #eadfdf;
  box-shadow: 0 24px 80px rgba(30, 18, 18, 0.08);
  display: grid;
  gap: 22px;
  max-width: 520px;
  padding: 42px;
  width: min(100%, 520px);
}

.portal-access-card img {
  height: 76px;
  object-fit: contain;
  object-position: left center;
  width: 150px;
}

.portal-access-card h2 {
  font-size: 30px;
  margin: 2px 0 4px;
}

.login-entry-header {
  display: grid;
  gap: 14px;
  justify-items: start;
}

.login-entry-header > img {
  justify-self: center;
  object-fit: contain;
  object-position: center;
}

.login-entry-header > div {
  min-width: 0;
  width: 100%;
}

.login-entry-header .login-portal-title {
  color: var(--ink);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.15;
  margin: 0 0 12px;
  overflow-wrap: anywhere;
  text-transform: none;
}

.login-portal-switch {
  align-items: center;
  background: #fff;
  border: 1px solid #d8c9cc;
  border-radius: 4px;
  color: #493a3d;
  display: inline-flex;
  font-size: 13px;
  font-weight: 600;
  gap: 10px;
  justify-content: space-between;
  line-height: 1.3;
  max-width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  text-decoration: none;
}

.login-portal-switch:hover {
  background: #fff2f5;
  border-color: #b18d98;
}

.login-portal-switch:focus-visible {
  outline: 2px solid #493a3d;
  outline-offset: 3px;
}

.login-portal-switch [aria-hidden] {
  flex-shrink: 0;
  font-size: 18px;
}

#portalLoginGate #portalAccessTitle {
  font-size: 20px;
}

@media (max-width: 600px) {
  #portalLoginGate.portal-access-panel {
    padding: 16px;
  }

  #portalLoginGate .portal-access-card {
    padding: 24px;
  }
}

.portal-access-form {
  display: grid;
  gap: 16px;
}

.portal-access-form label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 800;
  gap: 7px;
  text-transform: uppercase;
}

.portal-access-form input {
  border: 1px solid #ddd2d2;
  border-radius: 0;
  color: #111;
  font-size: 16px;
  min-height: 44px;
  padding: 0 12px;
  text-transform: none;
}

.portal-access-link {
  background: transparent;
  border: 0;
  color: #6c5558;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  justify-self: start;
  padding: 0;
  text-decoration: underline;
}

.portal-access-actions {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.portal-access-status {
  color: #555;
  font-size: 13px;
  min-height: 18px;
}

.portal-access-status.error {
  color: #c62828;
}

.portal-access-status.success {
  color: #236b35;
}

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

.portal-header {
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid #eadfdf;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 32px 12px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.portal-header-main {
  align-items: center;
  display: grid;
  gap: 20px;
  grid-template-columns: auto minmax(280px, 640px) auto;
}

.portal-logo {
  align-items: center;
  display: inline-flex;
  text-decoration: none;
}

.portal-logo img {
  height: 58px;
  object-fit: contain;
  width: 112px;
}

.sr-only {
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.portal-search-form {
  align-items: stretch;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  max-width: 640px;
  width: 100%;
}

.portal-search-form input {
  background: #fff;
  border: 1px solid #d8d0d0;
  border-right: 0;
  border-radius: 0;
  color: #111;
  font-size: 14px;
  min-height: 42px;
  min-width: 0;
  padding: 0 14px;
}

.portal-search-form button {
  background: #111;
  border: 1px solid #111;
  border-radius: 0;
  color: #fff;
  font-weight: 900;
  min-height: 42px;
  padding: 0 18px;
}

.portal-category-nav {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  overflow: visible;
  padding: 4px 0;
}

.portal-category-group {
  position: relative;
}

.portal-category-button {
  background: transparent;
  border: 1px solid transparent;
  color: #282828;
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 800;
  gap: 8px;
  min-height: 42px;
  padding: 7px 12px;
  text-align: left;
  white-space: nowrap;
}

.portal-category-parent::after {
  border-bottom: 1.5px solid #777;
  border-right: 1.5px solid #777;
  content: "";
  display: inline-block;
  height: 6px;
  margin-top: -3px;
  transform: rotate(45deg);
  width: 6px;
}

.portal-category-button.active,
.portal-category-button:hover,
.portal-category-group:focus-within > .portal-category-button,
.portal-category-group:hover > .portal-category-button {
  background: #f8d4d8;
  border-color: #f1bec5;
}

.portal-category-button.portal-category-button-inverse {
  background: #111;
  border-color: #111;
  color: #fff;
}

.portal-category-button.portal-category-button-inverse.active,
.portal-category-button.portal-category-button-inverse:hover,
.portal-category-button.portal-category-button-inverse:focus-visible {
  background: #2b2b2b;
  border-color: #111;
  color: #fff;
}

.portal-category-dropdown {
  background: #fff;
  border: 1px solid #e4d8d8;
  box-shadow: var(--shadow);
  display: none;
  left: 0;
  min-width: 220px;
  padding: 8px;
  position: absolute;
  top: calc(100% + 4px);
  z-index: 70;
}

.portal-category-group:hover .portal-category-dropdown,
.portal-category-group:focus-within .portal-category-dropdown {
  display: grid;
  gap: 2px;
}

.portal-category-dropdown button {
  background: transparent;
  border: 0;
  color: #1f1f1f;
  font-size: 13px;
  font-weight: 800;
  padding: 10px 9px;
  text-align: left;
  width: 100%;
}

.portal-category-dropdown button:hover,
.portal-category-dropdown button.active {
  background: #fff1f3;
}

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

.portal-cart-button,
.portal-account-button,
.portal-primary-action,
.portal-card-controls button,
.portal-cart-clear,
.portal-whatsapp-placeholder {
  border-radius: 0;
  font-weight: 800;
}

.portal-cart-button {
  background: #fff;
  border: 1px solid #111;
  color: #111;
  min-height: 42px;
  padding: 0 14px;
}

.portal-cart-button span {
  background: #111;
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  justify-content: center;
  margin-left: 6px;
  min-width: 22px;
  padding: 3px 7px;
}

.portal-account {
  position: relative;
}

.portal-account-button {
  align-items: center;
  background: #111;
  border: 1px solid #111;
  color: #fff;
  display: inline-flex;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.portal-account-menu {
  background: #fff;
  border: 1px solid #e1dada;
  box-shadow: var(--shadow);
  min-width: 190px;
  padding: 8px;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 50;
}

.portal-account-menu button {
  background: transparent;
  border: 0;
  display: block;
  font-weight: 700;
  padding: 10px 8px;
  text-align: left;
  width: 100%;
}

.portal-account-menu button:hover {
  background: #fff1f1;
}

.portal-top-banner {
  align-items: stretch;
  background: #111;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  color: #fff;
  display: grid;
  gap: 28px;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
  padding: 54px 48px;
}

.portal-top-banner h2 {
  color: #fff;
  font-size: clamp(34px, 5vw, 72px);
  line-height: 0.95;
  max-width: 860px;
}

.portal-top-banner p {
  color: #f5dede;
  font-size: 16px;
  line-height: 1.6;
  max-width: 640px;
}

.portal-eyebrow {
  color: #a57878;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.portal-top-banner .portal-eyebrow {
  color: #f8c4c7;
}

.portal-home-feature .portal-eyebrow {
  color: #111;
  font-size: 24px;
  letter-spacing: 0;
  line-height: 1.15;
  margin-bottom: 0;
}

.portal-primary-action {
  background: #f8d4d8;
  border: 1px solid #f8d4d8;
  color: #111;
  margin-top: 8px;
  min-height: 46px;
  padding: 0 18px;
}

.portal-banner-card {
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 280px;
  overflow: hidden;
  padding: 24px;
  text-align: center;
  text-decoration: none;
}

.portal-banner-card:not([href]) {
  cursor: default;
}

.portal-banner-card.has-image {
  background: rgba(255, 255, 255, 0.03);
  padding: 0;
}

.portal-banner-card.has-image img {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.portal-banner-card span {
  font-size: 54px;
  font-weight: 300;
  letter-spacing: 0.28em;
}

.portal-banner-card strong {
  color: #f8d4d8;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.portal-main-grid {
  display: grid;
  gap: 26px;
  grid-template-columns: minmax(0, 1fr) 360px;
  padding: 30px 32px 80px;
}

.portal-page-panel {
  padding: 30px 32px 80px;
}

.portal-section-heading {
  align-items: end;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.portal-section-heading h3 {
  font-size: 26px;
}

.portal-muted {
  color: #6d6262;
  margin: 0;
}

.portal-product-tools {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.portal-sort-control {
  align-items: center;
  background: #fff;
  border: 1px solid #eadada;
  display: inline-flex;
  gap: 7px;
  min-height: 36px;
  padding: 0 9px;
}

.portal-sort-control svg {
  fill: none;
  height: 17px;
  stroke: #5d5555;
  stroke-linecap: round;
  stroke-width: 2;
  width: 17px;
}

.portal-sort-control select {
  background: transparent;
  border: 0;
  color: #201b1b;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  min-height: 34px;
  outline: 0;
  text-transform: uppercase;
}

.portal-tier-note {
  align-items: center;
  background: #fff;
  border: 1px solid #eadada;
  display: inline-flex;
  gap: 12px;
  margin-bottom: 22px;
  padding: 12px 14px;
}

.portal-tier-note strong {
  font-size: 15px;
}

.portal-tier-note span {
  color: #5e5454;
}

.portal-featured-categories {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 30px;
}

.portal-feature-card {
  background: #fff;
  border: 1px solid #eadada;
  min-height: 122px;
  padding: 16px;
  text-align: left;
}

.portal-feature-card:hover {
  border-color: #111;
}

.portal-feature-card span,
.portal-feature-card small {
  color: #7a6b6b;
  display: block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.portal-feature-card strong {
  display: block;
  font-size: 19px;
  margin: 10px 0;
}

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

.portal-product-pagination {
  background: #fff;
  box-shadow: none;
}

.portal-product-card {
  background: #fff;
  border: 1px solid #e8dddd;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.portal-product-image {
  align-items: center;
  aspect-ratio: 1 / 1;
  background: #f7f4f4;
  display: flex;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.portal-product-image-button {
  border: 0;
  color: inherit;
  cursor: zoom-in;
  padding: 0;
  width: 100%;
}

.portal-product-image-button:focus-visible {
  outline: 2px solid #ad6b79;
  outline-offset: 3px;
}

.portal-product-image img,
.portal-cart-thumb img {
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.portal-product-placeholder {
  align-items: center;
  background: #fff;
  border: 1px solid #e6dfdf;
  color: #111;
  display: flex;
  height: 72%;
  justify-content: center;
  width: 72%;
}

.portal-product-placeholder span {
  font-size: 18px;
  letter-spacing: 0.16em;
}

.portal-product-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px;
}

.portal-product-category,
.portal-product-sku,
.portal-msrp {
  color: #777;
  font-size: 11px;
  margin: 0;
}

.portal-msrp.compare-at {
  text-decoration: none;
}

.portal-product-category {
  font-weight: 800;
  text-transform: uppercase;
}

.portal-product-card h4 {
  font-size: 15px;
  line-height: 1.3;
  margin: 7px 0 6px;
}

.portal-product-purchase {
  margin-top: 14px;
}

.portal-price-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 38px;
}

.portal-card-price {
  font-size: 18px;
  font-weight: 900;
}

.portal-sold-out {
  background: rgba(205, 46, 46, 0.92);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  left: 12px;
  letter-spacing: 0.04em;
  padding: 7px 10px;
  position: absolute;
  text-transform: uppercase;
  top: 12px;
}

.portal-coming-soon {
  background: rgba(115, 63, 214, 0.94);
}

.portal-preorder-now-badge {
  background: rgba(126, 63, 203, 0.96);
}

.portal-catalog-banner {
  color: #111;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  max-width: 58%;
  overflow: hidden;
  padding: 7px 10px;
  position: absolute;
  right: 12px;
  text-overflow: ellipsis;
  text-transform: uppercase;
  top: 12px;
  white-space: nowrap;
}

.portal-catalog-banner-yellow { background: rgba(245, 202, 75, 0.96); }
.portal-catalog-banner-green { background: rgba(44, 139, 83, 0.95); color: #fff; }
.portal-catalog-banner-orange { background: rgba(220, 109, 35, 0.95); color: #fff; }
.portal-catalog-banner-blue { background: rgba(37, 106, 168, 0.95); color: #fff; }

.portal-preorder-note {
  color: #9a2f2f !important;
  display: block;
  font-size: 11px;
  font-weight: 900;
  margin-top: 6px;
  text-transform: uppercase;
}

.tier-price-helper {
  color: #1f6fbf;
  display: block;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: none;
}

.tier-price-helper.manual {
  color: var(--muted);
}

.portal-price-locked {
  color: #777;
  font-weight: 800;
}

.portal-card-controls {
  display: grid;
  gap: 8px;
  grid-template-columns: 70px 1fr;
  margin-top: 12px;
}

.portal-card-controls input,
.portal-cart-line-controls input {
  border: 1px solid #d8d0d0;
  min-height: 38px;
  padding: 0 10px;
}

.portal-card-controls button {
  background: #111;
  border: 1px solid #111;
  color: #fff;
}

.portal-card-controls button:disabled,
.portal-card-controls input:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.portal-qty-break-hint {
  align-self: start;
  background: #fff4cf;
  border: 1px solid #efd477;
  color: #6e4d00;
  font-size: 11px;
  font-weight: 900;
  grid-column: 1 / -1;
  line-height: 1.25;
  padding: 6px 8px;
}

.portal-qty-break-hint[hidden] {
  display: none;
}

#portalProductDetailDialog {
  width: min(1180px, calc(100vw - 40px));
}

.portal-product-detail-dialog::backdrop {
  background: rgba(0, 0, 0, 0.46);
}

#portalOrderThanksDialog {
  box-sizing: border-box;
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid #e4d9d9;
  border-radius: 8px;
  color: #171717;
  background: #fff;
  overflow-y: auto;
}

.portal-order-thanks-content { margin: 0; padding: 24px; }
.portal-order-thanks-number { margin: 0 0 12px; color: #74364a; font-size: 12px; font-weight: 700; overflow-wrap: anywhere; }
.portal-order-thanks-content h2 { margin: 0 0 12px; font-size: 22px; line-height: 1.25; }
.portal-order-thanks-content p { line-height: 1.55; }
#portalOrderThanksEnglish { margin: 0; font-size: 15px; }
.portal-order-thanks-spanish { margin-top: 20px; padding-top: 16px; border-top: 1px solid #eadfdf; font-size: 13px; color: #555; }
.portal-order-thanks-spanish p { margin: 6px 0 0; font-size: inherit; }
.portal-order-thanks-actions { display: flex; justify-content: flex-end; margin-top: 22px; }
.portal-order-thanks-actions button { min-height: 42px; max-width: 100%; white-space: normal; }

.portal-product-detail-card {
  background: #fff;
  border: 1px solid #e4d9d9;
  border-radius: 8px;
  max-height: min(90vh, 860px);
  overflow: hidden;
  padding: 0;
  position: relative;
}

.portal-product-detail-close {
  background: transparent;
  border: 0;
  color: #111;
  font-size: 24px;
  line-height: 1;
  padding: 16px;
  position: absolute;
  right: 8px;
  top: 4px;
  z-index: 3;
}

.portal-product-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  min-height: clamp(560px, 76vh, 760px);
}

.portal-product-detail-media {
  align-items: center;
  background: #fbf9f9;
  border-right: 1px solid #eadfdf;
  display: flex;
  justify-content: center;
  padding: 42px;
}

.portal-product-detail-image {
  align-items: center;
  aspect-ratio: 1 / 1;
  background: #fff;
  display: flex;
  justify-content: center;
  max-height: 640px;
  overflow: hidden;
  position: relative;
  width: 100%;
}

.portal-product-detail-image img {
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.portal-product-detail-image .portal-product-placeholder {
  height: 72%;
  width: 72%;
}

.portal-product-detail-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 52px 44px 38px;
}

.portal-product-detail-info h3 {
  font-size: 26px;
  line-height: 1.15;
  margin: 8px 32px 10px 0;
}

.portal-detail-price-stack {
  display: grid;
  gap: 3px;
  margin: 20px 0 16px;
}

.portal-detail-price {
  font-size: 28px;
  font-weight: 900;
}

.portal-product-detail-description {
  color: #111;
  font-size: 14px;
  line-height: 1.45;
  max-height: 300px;
  overflow: auto;
  padding-right: 6px;
}

.portal-product-detail-description p {
  margin: 0 0 12px;
}

.portal-product-detail-description ul,
.portal-product-detail-description ol {
  margin: 10px 0 0;
  padding-left: 20px;
}

.portal-detail-controls {
  display: grid;
  gap: 12px;
  grid-template-columns: 90px 1fr;
  margin-top: 24px;
}

.portal-detail-controls input {
  border: 1px solid #d8d0d0;
  min-height: 48px;
  padding: 0 14px;
}

.portal-detail-controls button {
  background: #111;
  border: 1px solid #111;
  color: #fff;
  font-weight: 900;
}

.portal-detail-controls .portal-qty-break-hint {
  font-size: 12px;
  padding: 7px 9px;
}

.portal-detail-controls button:disabled,
.portal-detail-controls input:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

@media (max-width: 900px) {
  #portalProductDetailDialog {
    width: min(720px, calc(100vw - 24px));
  }

  .portal-product-detail-card {
    max-height: 92vh;
    overflow: auto;
  }

  .portal-product-detail-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .portal-product-detail-media {
    border-right: 0;
    border-bottom: 1px solid #eadfdf;
    padding: 24px;
  }

  .portal-product-detail-info {
    padding: 30px 22px 24px;
  }

  .portal-product-detail-info h3 {
    font-size: 22px;
  }

  .portal-product-detail-description {
    max-height: none;
  }

  .portal-detail-controls {
    grid-template-columns: 78px 1fr;
  }
}

.portal-cart-panel {
  align-self: start;
  background: #fff;
  border: 1px solid #e6dcdc;
  box-shadow: 0 18px 35px rgba(0, 0, 0, 0.06);
  padding: 18px;
  position: sticky;
  top: 96px;
}

.portal-cart-heading,
.portal-cart-total {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.portal-cart-clear {
  background: transparent;
  border: 0;
  color: #8a6262;
  padding: 6px;
}

.portal-cart-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 18px 0;
  max-height: 52vh;
  overflow: auto;
}

.portal-cart-line {
  border-bottom: 1px solid #eee6e6;
  display: grid;
  gap: 10px;
  grid-template-columns: 58px 1fr auto;
  padding-bottom: 12px;
}

.portal-cart-thumb {
  align-items: center;
  aspect-ratio: 1 / 1;
  background: #f7f4f4;
  display: flex;
  justify-content: center;
  overflow: hidden;
}

.portal-cart-thumb .portal-product-placeholder {
  height: 100%;
  width: 100%;
}

.portal-cart-thumb .portal-product-placeholder span {
  font-size: 9px;
}

.portal-cart-line-main strong {
  display: block;
  font-size: 12px;
  line-height: 1.3;
}

.portal-cart-line-main span {
  color: #777;
  display: block;
  font-size: 11px;
  margin-top: 3px;
}

.portal-cart-line-controls {
  align-items: center;
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.portal-cart-line-controls input {
  min-height: 32px;
  width: 68px;
}

.portal-cart-line-controls button {
  background: transparent;
  border: 0;
  color: #9b3434;
  font-size: 11px;
  font-weight: 800;
  padding: 0;
}

.portal-cart-line-price,
.portal-cart-total strong {
  font-weight: 900;
}

.portal-cart-line-price {
  display: grid;
  gap: 2px;
  justify-items: end;
  text-align: right;
}

.portal-review-order-button,
.portal-submit-button,
.portal-secondary-button {
  border-radius: 0;
  font-weight: 900;
  min-height: 42px;
}

.portal-review-order-button,
.portal-submit-button {
  background: #111;
  border: 1px solid #111;
  color: #fff;
  margin-top: 16px;
  width: 100%;
}

.portal-review-order-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.portal-submit-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.portal-secondary-button {
  background: #fff;
  border: 1px solid #111;
  color: #111;
  padding: 0 14px;
}

.portal-page-card {
  background: #fff;
  border: 1px solid #eadada;
  box-shadow: 0 18px 35px rgba(0, 0, 0, 0.04);
  padding: 22px;
}

.portal-page-heading {
  align-items: center;
  border-bottom: 1px solid #eadada;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 14px;
}

.portal-page-heading h2 {
  font-size: 28px;
}

.portal-review-list {
  display: grid;
  gap: 10px;
}

.portal-review-line {
  align-items: center;
  border: 1px solid #eee1e1;
  display: grid;
  gap: 14px;
  grid-template-columns: 72px minmax(240px, 1fr) minmax(120px, 0.45fr) minmax(70px, 0.25fr) minmax(110px, 0.35fr);
  padding: 12px;
}

.portal-review-thumb {
  align-items: center;
  aspect-ratio: 1 / 1;
  background: #f7f4f4;
  display: flex;
  justify-content: center;
  overflow: hidden;
}

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

.portal-review-line span,
.portal-submit-footer span,
.portal-order-summary-grid span {
  color: #706565;
  display: block;
  font-size: 12px;
}

.portal-submit-footer {
  align-items: center;
  border-top: 1px solid #eadada;
  display: flex;
  gap: 18px;
  justify-content: flex-end;
  margin-top: 18px;
  padding-top: 18px;
}

.portal-submit-footer strong {
  display: block;
  font-size: 26px;
}

.portal-submit-button {
  margin-top: 0;
  max-width: 240px;
}

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

.portal-history-table {
  border-collapse: collapse;
  width: 100%;
}

.portal-history-table th,
.portal-history-table td {
  border-bottom: 1px solid #eadada;
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
}

.portal-history-table th {
  color: #5f5757;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.portal-order-check {
  color: #4e9a57;
  font-size: 21px;
  font-weight: 900;
}

.portal-order-neutral {
  color: #9a8e8e;
}

.portal-invoice-status {
  border: 1px solid transparent;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  min-height: 24px;
  padding: 0 10px;
  text-transform: uppercase;
  white-space: nowrap;
}

.portal-invoice-status.pending {
  background: #fff5d6;
  border-color: #f1d58c;
  color: #8a620e;
}

.portal-invoice-status.paid {
  background: #e6f6ea;
  border-color: #9bd5aa;
  color: #28733a;
}

.portal-invoice-status.cancelled {
  background: #f1f1f2;
  border-color: #d4d6dc;
  color: #62666f;
}

.portal-invoice-status-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.portal-history-actions,
.portal-order-invoice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.portal-history-actions .mini-button,
.portal-order-invoice-actions .mini-button {
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  text-decoration: none;
  white-space: nowrap;
}

.portal-invoice-download-button {
  background: #f7f8fa;
  border-color: #d9dde4;
  color: #2f3a4a;
  gap: 5px;
  padding: 0 9px;
}

.portal-invoice-download-button svg {
  fill: none;
  height: 14px;
  flex: 0 0 auto;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
  width: 14px;
}

.portal-invoice-download-button span {
  font-size: 11px;
  font-weight: 900;
}

.portal-invoice-pay-button {
  background: #edf8f0;
  border-color: #a8dcb5;
  color: #226b35;
}

.portal-invoice-pay-button:hover,
.portal-invoice-download-button:hover {
  filter: brightness(0.98);
}

.portal-order-invoice-actions {
  justify-content: flex-end;
  margin: -4px 0 14px;
}

.portal-order-summary-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 14px;
}

.portal-order-summary-grid > div {
  background: #fbf8f8;
  border: 1px solid #eadada;
  padding: 12px;
}

.portal-order-help {
  background: #fff6f7;
  border: 1px solid #f0c2c9;
  margin-bottom: 16px;
  padding: 14px;
}

.portal-order-help p {
  color: #5f5353;
  margin: 6px 0 0;
}

.portal-order-help a {
  color: #111;
  font-weight: 800;
}

.portal-order-indicator {
  align-items: center;
  background: #e9f4ff;
  border: 1px solid #bcd7ef;
  border-radius: 5px;
  color: #1f6fbf;
  display: inline-flex;
  height: 20px;
  justify-content: center;
  margin-left: 6px;
  margin-right: 0;
  vertical-align: middle;
  width: 20px;
}

.portal-order-indicator svg {
  fill: none;
  height: 14px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 14px;
}

.portal-empty,
.portal-empty-cart {
  background: #fff;
  border: 1px dashed #d8caca;
  color: #746969;
  padding: 22px;
}

.portal-help-button {
  align-items: center;
  background: #111;
  border: 1px solid #111;
  border-radius: 50%;
  bottom: 22px;
  box-shadow: var(--shadow);
  color: #fff;
  display: flex;
  font-size: 20px;
  font-weight: 900;
  height: 54px;
  justify-content: center;
  position: fixed;
  right: 22px;
  width: 54px;
  z-index: 80;
}

.portal-help-button.has-avatar {
  background: #fff;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.18);
  height: 112px;
  overflow: visible;
  padding: 0;
  width: 112px;
}

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

.portal-help-bubble {
  display: block;
  filter: drop-shadow(0 12px 24px rgba(68, 55, 58, 0.14));
  height: 66px;
  left: -172px;
  pointer-events: none;
  position: absolute;
  top: -62px;
  width: 180px;
  z-index: 2;
}

.portal-help-bubble svg {
  display: block;
  height: 100%;
  overflow: visible;
  width: 100%;
}

.portal-help-bubble path {
  fill: #fff;
  stroke: #f0b8c8;
  stroke-linejoin: miter;
  stroke-miterlimit: 6;
  stroke-width: 2;
}

.portal-help-bubble text {
  fill: #252023;
  font-family: Montserrat, Arial, sans-serif;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0;
}

.portal-help-button.has-avatar img {
  background: #fff;
  border-radius: 50%;
  display: block;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  position: relative;
  transform: none;
  width: 100%;
  z-index: 1;
}

.portal-announcement {
  background: #fff3f5;
  border: 1px solid #f0c2c9;
  color: #5f2a31;
  font-size: 12px;
  font-weight: 800;
  margin-top: 8px;
  padding: 9px 12px;
  text-align: center;
  transition: opacity 180ms ease, transform 180ms ease;
}

.portal-announcement.is-changing {
  animation: portalAnnouncementFade 420ms ease;
}

@keyframes portalAnnouncementFade {
  0% {
    opacity: 0;
    transform: translateY(-4px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.portal-preview-pill {
  background: var(--blue-soft);
  border: 1px solid #bcd7ef;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  padding: 3px 8px;
  text-transform: uppercase;
}

.portal-help-card {
  background: #fff;
  border: 1px solid #eadada;
  bottom: 88px;
  box-shadow: var(--shadow);
  max-width: 280px;
  padding: 16px;
  position: fixed;
  right: 22px;
  z-index: 80;
}

.portal-help-button.has-avatar + .portal-help-card {
  bottom: 166px;
}

.portal-help-card strong {
  font-size: 16px;
}

.portal-help-card p {
  color: #625858;
  line-height: 1.45;
  margin: 8px 0;
}

.portal-help-card a {
  color: #111;
  display: block;
  font-weight: 800;
  margin-top: 10px;
}

.portal-whatsapp-placeholder {
  background: #f8d4d8;
  border: 1px solid #f1bec5;
  margin-top: 12px;
  min-height: 38px;
  width: 100%;
}

@media (max-width: 1180px) {
  .portal-product-grid,
  .portal-featured-categories {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .portal-main-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .portal-cart-panel {
    position: static;
  }
}

@media (max-width: 820px) {
  .portal-top-banner {
    grid-template-columns: 1fr;
  }

  .portal-header {
    padding: 14px 18px;
    position: static;
    top: auto;
  }

  .portal-header-main {
    grid-template-columns: 1fr;
  }

  .portal-header-actions {
    justify-content: space-between;
  }

  .portal-top-banner,
  .portal-main-grid,
  .portal-page-panel {
    padding-left: 18px;
    padding-right: 18px;
  }

  .portal-product-grid,
  .portal-featured-categories {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portal-review-line,
  .portal-order-summary-grid {
    grid-template-columns: 1fr;
  }

  .portal-submit-footer,
  .portal-page-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .portal-help-button {
    bottom: 14px;
    font-size: 16px;
    height: 42px;
    right: 14px;
    width: 42px;
  }

  .portal-help-button.has-avatar {
    bottom: 14px;
    height: 64px;
    right: 14px;
    width: 64px;
  }

  .portal-help-bubble {
    height: 44px;
    left: -112px;
    top: -38px;
    width: 120px;
  }

  .portal-help-bubble text {
    font-size: 15px;
  }

  .portal-help-card {
    bottom: 66px;
    max-width: min(260px, calc(100vw - 28px));
    right: 14px;
  }

  .portal-help-button.has-avatar + .portal-help-card {
    bottom: 88px;
  }
}

@media (max-width: 560px) {
  .portal-product-grid,
  .portal-featured-categories {
    grid-template-columns: 1fr;
  }

  .portal-help-button.has-avatar {
    height: 56px;
    width: 56px;
  }

  .portal-help-bubble {
    height: 40px;
    left: -102px;
    top: -34px;
    width: 108px;
  }

  .portal-help-bubble text {
    font-size: 14px;
  }

  .portal-help-button.has-avatar + .portal-help-card {
    bottom: 80px;
  }
}

.inventory-blank-panel {
  display: none;
}

.inventory-blank-panel.active {
  display: block;
}

.section-heading {
  align-items: end;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.heading-actions {
  align-items: center;
  display: flex;
  gap: 9px;
  justify-content: flex-end;
}

.inventory-items-heading-actions {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, max-content);
  justify-content: end;
}

.inventory-items-heading-actions .subtle {
  grid-column: 1 / -1;
  justify-self: end;
  text-align: right;
}

.inventory-items-heading-actions > button {
  align-items: center;
  border-radius: 5px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  justify-content: center;
  line-height: 1;
  min-height: 38px;
  padding: 0 16px;
  white-space: nowrap;
}

.inventory-items-heading-actions #saveItemSettings,
.inventory-items-heading-actions #bulkAddItemsButton {
  background: var(--surface);
  border: 1px solid #a9a9a4;
  color: var(--ink);
}

.inventory-items-heading-actions #newItemButton {
  border: 1px solid var(--ink);
}

.subtle {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
  max-width: 540px;
}

.import-summary {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  display: none;
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 18px;
  padding: 12px 14px;
}

.import-summary.active {
  display: block;
}

.import-summary strong {
  color: var(--ink);
}

.category-tabs,
.sub-tabs {
  align-items: stretch;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 0;
  display: inline-flex;
  max-width: 100%;
  overflow: hidden;
}

.category-tab,
.sub-tab {
  align-items: center;
  border: 0;
  border-radius: 0;
  display: inline-flex;
  gap: 8px;
  justify-content: center;
  line-height: 1.2;
  min-height: 44px;
  padding: 0 14px;
  white-space: nowrap;
}

.category-tab.active,
.sub-tab.active {
  background: var(--pink);
}

.sub-tabs {
  margin-bottom: 14px;
  overflow-x: auto;
  width: auto;
}

.icon-tabs .sub-tab {
  align-items: center;
  display: inline-flex;
  gap: 8px;
}

.tab-count-badge {
  align-items: center;
  background: var(--blue);
  border-radius: 999px;
  color: var(--surface);
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  height: 20px;
  justify-content: center;
  line-height: 1;
  min-width: 20px;
  padding: 0 6px;
}

.tab-count-badge.has-pending {
  background: var(--red);
}

.icon-tabs svg {
  flex: 0 0 auto;
  fill: none;
  height: 17px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
  width: 17px;
}

.icon-tabs img {
  flex: 0 0 auto;
  height: 20px;
  object-fit: contain;
  pointer-events: none;
  width: 20px;
}

.icon-tabs svg,
.icon-tabs svg * {
  pointer-events: none;
}

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

.production-metrics {
  margin-left: auto;
  margin-right: auto;
  max-width: 1280px;
  width: 100%;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  min-height: 66px;
  padding: 10px;
}

.metric-title {
  color: var(--ink);
  display: block;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.1;
}

.metric strong {
  display: block;
  font-size: 22px;
  line-height: 1;
}

.metric-helper {
  color: var(--muted);
  display: block;
  font-size: 11.5px;
  line-height: 1.25;
}

.metric.emphasis {
  background: var(--pink-soft);
  border-color: var(--pink);
}

.home-metrics {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  margin-bottom: 16px;
}

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

.home-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  padding: 14px;
}

.home-panel-stats {
  display: grid;
  gap: 8px;
}

.home-panel-stats span {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 13px;
  gap: 8px;
}

.home-panel-stats strong {
  color: var(--ink);
  font-size: 18px;
}

.toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.toolbar-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.compact-date-filter {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 11px;
  font-weight: 700;
  gap: 6px;
  text-transform: uppercase;
}

.compact-date-filter input {
  min-height: 34px;
  min-width: 138px;
}

.invoice-date-presets {
  align-items: center;
  display: flex;
}

.invoice-mtd-total {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  display: grid;
  gap: 1px;
  min-width: 148px;
  padding: 6px 10px;
  text-align: right;
}

.invoice-mtd-total span,
.invoice-mtd-total small {
  font-size: 10px;
  font-weight: 800;
  line-height: 1.15;
  text-transform: uppercase;
}

.invoice-mtd-total strong {
  color: var(--text);
  font-size: 16px;
  line-height: 1.2;
}

.spend-range-bar {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin: -4px 0 14px;
}

.spend-range-bar > div,
.spend-range-bar label {
  align-items: flex-start;
  display: grid;
  gap: 4px;
}

.spend-preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.spend-preset-buttons .mini-button.active {
  background: #f8c7cf;
  border-color: #ef9aa8;
  color: var(--ink);
}

.spend-range-bar label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.spend-range-bar input {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  min-height: 32px;
  padding: 0 8px;
}

.toolbar-search-stack {
  align-items: flex-start;
  display: grid;
  gap: 6px;
  width: min(460px, 100%);
}

.toolbar-search-stack .search-wrap {
  width: 100%;
}

.toolbar .secondary-filter {
  color: var(--muted);
  font-size: 12px;
  min-height: 28px;
  min-width: 0;
  width: fit-content;
}

.toolbar-right-controls {
  align-items: flex-end;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin-left: auto;
}

.compact-select-label {
  align-items: flex-start;
  color: var(--muted);
  display: grid;
  font-size: 10px;
  font-weight: 800;
  gap: 4px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.compact-select-label select {
  min-width: 110px;
}

.row-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sales-order-actions-cell {
  position: relative;
}

.sales-order-actions {
  min-width: 0;
  position: relative;
}

.sales-order-actions.has-issue {
  padding-right: 28px;
}

.sales-order-actions .order-fulfillment-issue-icon {
  margin-left: 0;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}

.order-fulfillment-issue-icon {
  align-items: center;
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 999px;
  color: #b91c1c;
  cursor: help;
  display: inline-flex;
  font-size: 14px;
  font-weight: 900;
  height: 22px;
  justify-content: center;
  line-height: 1;
  margin-left: 2px;
  position: relative;
  width: 22px;
}

.order-fulfillment-issue-icon.has-tooltip::after {
  max-width: min(420px, 80vw);
  white-space: pre-line;
}

.search-wrap {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 8px;
  min-height: 32px;
  padding: 0 8px;
  width: min(460px, 100%);
}

.search-wrap span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.search-wrap input {
  border: 0;
  flex: 1;
  min-width: 120px;
  outline: 0;
}

.toolbar select,
table select,
table input,
dialog input,
dialog select {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  min-height: 32px;
  padding: 0 8px;
}

.toolbar select {
  min-width: 160px;
}

.drop-upload {
  align-items: center;
  background: var(--surface);
  border: 1px dashed var(--ink);
  border-radius: 8px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 12px;
}

.drop-upload.drag-active {
  background: var(--pink-soft);
  border-style: solid;
}

.drop-upload strong,
.drop-upload span {
  display: block;
}

.drop-upload span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.drop-upload input {
  display: none;
}

.upload-status {
  color: var(--muted);
  font-size: 12px;
  min-height: 18px;
  margin: -7px 0 12px;
}

.vendor-panel {
  margin-top: 14px;
}

.compact-heading {
  margin-bottom: 12px;
}

.vendor-groups,
.po-list {
  display: grid;
  gap: 12px;
}

.inbound-metric-row {
  display: grid;
  grid-template-columns: minmax(220px, 320px);
  margin: 10px 0;
}

.inbound-purchased-metric {
  background: var(--pink-soft);
}

.inbound-purchased-metric strong {
  font-size: 28px;
  line-height: 1;
}

.formula-panel,
.production-panel {
  display: grid;
  gap: 12px;
}

.production-action-band {
  align-items: center;
  background: var(--pink-soft);
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: center;
  margin: 0 0 14px;
  padding: 22px 14px;
}

.production-entry-button {
  border-radius: 8px;
  font-size: 17px;
  min-height: 60px;
  min-width: min(100%, 300px);
  padding: 0 28px;
}

.production-entry-button:hover {
  background: #2b2b2b;
}

.pagination-bar {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  margin-top: 12px;
  padding: 10px 12px;
}

.pagination-summary,
.pagination-controls,
.page-size-control {
  align-items: center;
  display: flex;
  gap: 10px;
}

.item-page-jump-label {
  align-items: center;
  display: inline-flex;
  gap: 6px;
}

.item-page-jump-input {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  min-height: 30px;
  padding: 0 6px;
  text-align: center;
  width: 64px;
}

.item-page-jump-input:focus {
  border-color: var(--ink);
  outline: 2px solid rgba(252, 201, 201, 0.75);
  outline-offset: 1px;
}

.pagination-summary,
.page-size-control {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.page-size-control select {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 32px;
  padding: 0 8px;
}

.vendor-group,
.po-block,
.table-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.settings-panel {
  overflow-x: hidden;
}

.settings-panel table {
  min-width: 0;
  table-layout: fixed;
  width: 100%;
}

.settings-panel th:nth-child(1),
.settings-panel td:nth-child(1) {
  width: 2.4%;
}

.settings-panel th:nth-child(2),
.settings-panel td:nth-child(2) {
  width: 4.2%;
}

.settings-panel th:nth-child(3),
.settings-panel td:nth-child(3) {
  width: 7.5%;
}

.settings-panel th:nth-child(4),
.settings-panel td:nth-child(4) {
  width: 6.6%;
}

.settings-panel th:nth-child(5),
.settings-panel td:nth-child(5) {
  text-align: center;
  width: 3.6%;
}

.settings-panel th:nth-child(6),
.settings-panel td:nth-child(6) {
  width: 16.2%;
}

.settings-panel th:nth-child(7),
.settings-panel td:nth-child(7) {
  width: 7.2%;
}

.settings-panel th:nth-child(8),
.settings-panel td:nth-child(8) {
  width: 8.2%;
}

.settings-panel th:nth-child(9),
.settings-panel td:nth-child(9) {
  width: 5%;
}

.settings-panel th:nth-child(10),
.settings-panel td:nth-child(10) {
  width: 4.8%;
}

.settings-panel th:nth-child(11),
.settings-panel td:nth-child(11) {
  width: 5%;
}

.settings-panel th:nth-child(12),
.settings-panel td:nth-child(12) {
  width: 9%;
}

.settings-panel th:nth-child(13),
.settings-panel td:nth-child(13),
.settings-panel th:nth-child(14),
.settings-panel td:nth-child(14) {
  width: 4.3%;
}

.settings-panel th:nth-child(15),
.settings-panel td:nth-child(15) {
  width: 4.2%;
}

.settings-panel th:nth-child(16),
.settings-panel td:nth-child(16) {
  width: 3.5%;
}

.settings-panel th,
.settings-panel td {
  box-sizing: border-box;
  font-size: 11px;
  padding-left: 4px;
  padding-right: 4px;
}

.settings-panel th {
  vertical-align: bottom;
}

.settings-panel th > span {
  display: block;
  margin-bottom: 5px;
}

.sort-header-button {
  align-items: center;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 800;
  gap: 4px;
  justify-content: flex-end;
  padding: 0;
  text-transform: inherit;
  width: 100%;
}

.sort-header-button span {
  display: inline;
  margin: 0;
}

.sort-header-button.active {
  color: var(--text);
}

.settings-panel select {
  max-width: 100%;
  width: 100%;
}

.settings-panel .item-name,
.settings-panel .vendor-wrap {
  line-height: 1.24;
  min-width: 0;
  white-space: normal;
}

.settings-panel .sku,
.settings-panel .barcode-cell {
  font-size: 10.5px;
  overflow-wrap: normal;
  white-space: nowrap;
  word-break: normal;
}

.settings-panel .item-photo,
.settings-panel .item-photo-placeholder {
  height: 32px;
  width: 32px;
}

.settings-panel .mini-button {
  font-size: 11px;
  min-height: 28px;
  padding: 0 7px;
}

.column-filter-control {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  font-size: 11px;
  min-height: 28px;
  padding: 3px 6px;
  width: 100%;
}

.column-filter-control::placeholder {
  color: #9a9a9a;
}

.settings-panel .mini-input {
  max-width: none;
  width: 76px;
}

.sku-merge-help-button {
  background: var(--surface);
  border: 1px solid var(--pink);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  min-height: 36px;
  padding: 0 14px;
  text-transform: uppercase;
}

#view-sku-merge .settings-panel {
  display: grid;
  gap: 18px;
  overflow-x: visible;
}

.sku-merge-workflow,
.sku-merge-stage-card,
.sku-merge-item-card,
.sku-merge-history-table,
.sku-merge-info-card {
  background: var(--surface);
  border: 1px solid var(--line);
}

.sku-merge-workflow {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.sku-merge-stepper {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: auto minmax(24px, 1fr) auto minmax(24px, 1fr) auto minmax(24px, 1fr) auto;
}

.sku-merge-step {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  gap: 7px;
  text-transform: uppercase;
  white-space: nowrap;
}

.sku-merge-step-number {
  align-items: center;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  font-size: 10px;
  height: 24px;
  justify-content: center;
  min-width: 24px;
  padding: 0 4px;
}

.sku-merge-step.active {
  color: var(--ink);
}

.sku-merge-step.active .sku-merge-step-number,
.sku-merge-step.complete .sku-merge-step-number {
  background: var(--pink);
  border-color: var(--pink);
  color: var(--ink);
}

.sku-merge-step-line {
  background: var(--line);
  display: block;
  height: 1px;
}

.sku-merge-step-line.complete {
  background: var(--pink);
}

.sku-merge-selection-grid {
  align-items: stretch;
  display: grid;
  gap: 26px;
  grid-template-columns: minmax(0, 1fr) 112px minmax(0, 1fr);
}

.sku-merge-item-card {
  display: grid;
  gap: 14px;
  grid-template-rows: auto auto auto 1fr;
  min-width: 0;
  padding: 18px;
}

.sku-merge-item-card.keep {
  background: linear-gradient(180deg, #fbfffa 0%, var(--surface) 42%);
  border-color: #b9d9b8;
}

.sku-merge-item-card.merge {
  background: linear-gradient(180deg, #fffaf3 0%, var(--surface) 42%);
  border-color: #f0bc78;
}

.sku-merge-card-head,
.sku-merge-stage-head,
.sku-merge-actions,
.sku-merge-table-footer {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.sku-merge-card-head h3,
.sku-merge-stage-head h3 {
  font-size: 13px;
  font-weight: 600;
  margin: 3px 0 0;
}

.sku-merge-item-card.keep .sku-merge-card-head {
  color: #174f22;
}

.sku-merge-item-card.merge .sku-merge-card-head {
  color: #7a4300;
}

.sku-merge-capsule {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  font-size: 10px;
  font-weight: 800;
  min-height: 22px;
  padding: 0 8px;
  text-transform: uppercase;
  white-space: nowrap;
}

.sku-merge-capsule.active {
  background: var(--green-soft);
  border-color: #bcdcb7;
  color: var(--green);
}

.sku-merge-capsule.warning {
  background: var(--amber-soft);
  border-color: #f1d6a6;
  color: var(--amber);
}

.sku-merge-capsule.danger {
  background: var(--red-soft);
  border-color: #f3bcbc;
  color: var(--red);
}

.sku-merge-capsule.neutral {
  background: var(--surface-alt);
  color: var(--muted);
}

.sku-merge-search-label {
  display: grid;
  gap: 6px;
}

.sku-merge-search-area {
  position: relative;
}

.sku-merge-search-label span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.sku-merge-search-label input,
.sku-merge-confirm-input input {
  border: 1px solid var(--line);
  min-height: 38px;
  padding: 0 10px;
  width: 100%;
}

.sku-merge-search-wrap {
  display: block;
  position: relative;
}

.sku-merge-search-wrap input {
  padding-right: 40px;
}

.sku-merge-search-wrap svg {
  fill: none;
  height: 18px;
  pointer-events: none;
  position: absolute;
  right: 12px;
  stroke: var(--ink);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
}

.sku-merge-results {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 16px 24px rgba(0, 0, 0, 0.06);
  display: none;
  left: 0;
  max-height: 242px;
  overflow-y: auto;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 4;
}

.sku-merge-results.active {
  display: grid;
}

.sku-merge-result {
  align-items: center;
  background: var(--surface);
  border: 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: 54px minmax(0, 1fr);
  min-height: 70px;
  padding: 9px;
  text-align: left;
}

.sku-merge-result:last-child {
  border-bottom: 0;
}

.sku-merge-result:hover,
.sku-merge-result:focus-visible,
.sku-merge-result.selected {
  background: var(--pink-soft);
}

.sku-merge-result-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.sku-merge-result-main strong,
.sku-merge-selected-copy h4 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sku-merge-result-main span,
.sku-merge-identity {
  color: var(--muted);
  font-size: 11px;
}

.sku-merge-card-photo {
  align-items: center;
  display: flex;
  height: 54px;
  justify-content: center;
  width: 54px;
}

.sku-merge-card-photo .item-photo-button,
.sku-merge-card-photo .item-photo,
.sku-merge-card-photo .item-photo-placeholder,
.sku-merge-card-photo.placeholder {
  height: 54px;
  width: 54px;
}

.sku-merge-selected-item {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  display: grid;
  gap: 16px;
  grid-template-columns: 96px minmax(0, 1fr) 34px;
  min-height: 108px;
  padding: 10px 12px;
}

.sku-merge-selected-photo .sku-merge-card-photo,
.sku-merge-selected-photo .item-photo-button,
.sku-merge-selected-photo .item-photo,
.sku-merge-selected-photo .item-photo-placeholder,
.sku-merge-selected-photo .sku-merge-card-photo.placeholder {
  height: 82px;
  width: 82px;
}

.sku-merge-selected-photo .item-photo,
.sku-merge-selected-photo .item-photo-placeholder {
  object-fit: contain;
}

.sku-merge-selected-copy h4 {
  font-size: 17px;
  margin: 0 0 5px;
}

.sku-merge-identity {
  display: grid;
  gap: 8px;
}

.sku-merge-clear {
  align-self: start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: transparent;
  cursor: pointer;
  font-size: 0;
  height: 34px;
  justify-self: end;
  line-height: 1;
  width: 34px;
}

.sku-merge-clear::before {
  color: var(--ink);
  content: "\00d7";
  font-size: 24px;
  line-height: 1;
}

.sku-merge-clear:hover,
.sku-merge-clear:focus-visible {
  border-color: var(--ink);
}

.sku-merge-empty-selection {
  align-items: center;
  background: var(--surface);
  border: 1px dashed var(--line);
  color: var(--muted);
  display: grid;
  gap: 14px;
  grid-template-columns: 82px minmax(0, 1fr);
  min-height: 108px;
  padding: 12px;
}

.sku-merge-empty-photo {
  align-items: center;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  color: var(--muted);
  display: inline-flex;
  font-size: 10px;
  height: 82px;
  justify-content: center;
  text-transform: uppercase;
  width: 82px;
}

.sku-merge-detail-grid {
  display: grid;
  gap: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
}

.sku-merge-detail-grid div {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  margin-bottom: -1px;
  margin-right: -1px;
  min-height: 58px;
  padding: 9px 10px;
}

.sku-merge-detail-grid dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.sku-merge-detail-grid dd {
  font-weight: 800;
  margin: 4px 0 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.sku-merge-transfer {
  align-items: center;
  display: grid;
  font-size: 10px;
  font-weight: 800;
  gap: 8px;
  justify-items: center;
  margin-top: 126px;
  min-width: 0;
  place-self: start stretch;
  text-align: center;
  text-transform: uppercase;
}

.sku-merge-transfer .text-button {
  justify-content: center;
  min-width: 104px;
  padding-left: 10px;
  padding-right: 10px;
  white-space: nowrap;
}

.sku-merge-transfer strong {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--ink);
  border-radius: 999px;
  color: var(--ink);
  display: inline-flex;
  font-size: 34px;
  font-weight: 600;
  height: 64px;
  justify-content: center;
  line-height: 1;
  width: 64px;
}

.sku-merge-info-strip {
  align-items: center;
  background: #fbfdff;
  border: 1px solid #d7e0ec;
  color: #4c5865;
  display: flex;
  font-size: 12px;
  gap: 9px;
  line-height: 1.35;
  padding: 11px 13px;
}

.sku-merge-info-strip span {
  align-items: center;
  border: 1px solid #7aa4db;
  border-radius: 999px;
  color: #2f70bf;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 800;
  height: 18px;
  justify-content: center;
  width: 18px;
}

.sku-merge-actions .primary-button {
  min-height: 40px;
  min-width: 170px;
}

.sku-merge-warning,
.sku-merge-final-warning,
.sku-merge-preview-note {
  background: var(--red-soft);
  border: 1px solid #f3bcbc;
  color: var(--red);
  font-weight: 800;
  padding: 10px 12px;
}

.sku-merge-stage-card {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.sku-merge-review-grid {
  align-items: center;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) 92px minmax(0, 1fr);
}

.sku-merge-review-card {
  border: 1px solid var(--line);
  display: grid;
  min-width: 0;
}

.sku-merge-review-card.keep {
  border-color: #bfd9bf;
}

.sku-merge-review-card.merge {
  border-color: #f0c28c;
}

.sku-merge-review-card-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 14px;
}

.sku-merge-review-card.keep .sku-merge-review-card-head {
  background: #f4faf3;
  border-bottom-color: #d5e8d3;
}

.sku-merge-review-card.merge .sku-merge-review-card-head {
  background: #fff7eb;
  border-bottom-color: #f3d3a9;
}

.sku-merge-review-title {
  align-items: center;
  display: inline-flex;
  font-size: 11px;
  font-weight: 900;
  gap: 8px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sku-merge-review-icon {
  align-items: center;
  display: inline-flex;
  height: 18px;
  justify-content: center;
  width: 18px;
}

.sku-merge-review-icon svg {
  fill: none;
  height: 18px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 18px;
}

.sku-merge-review-card.keep .sku-merge-review-title {
  color: var(--green);
}

.sku-merge-review-card.merge .sku-merge-review-title {
  color: var(--amber);
}

.sku-merge-review-body {
  align-items: center;
  display: grid;
  gap: 16px;
  grid-template-columns: 86px minmax(0, 1fr);
  min-height: 114px;
  padding: 12px 18px;
}

.sku-merge-review-photo .sku-merge-card-photo,
.sku-merge-review-photo .item-photo-button,
.sku-merge-review-photo .item-photo,
.sku-merge-review-photo .item-photo-placeholder {
  height: 76px;
  width: 76px;
}

.sku-merge-review-photo .item-photo,
.sku-merge-review-photo .item-photo-placeholder {
  object-fit: contain;
}

.sku-merge-review-copy {
  min-width: 0;
}

.sku-merge-review-copy h4 {
  font-size: 17px;
  margin: 0 0 10px;
  overflow-wrap: anywhere;
}

.sku-merge-review-copy p {
  font-size: 12px;
  margin: 5px 0;
}

.sku-merge-review-stats {
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.sku-merge-review-stats div {
  border-right: 1px solid var(--line);
  display: grid;
  gap: 5px;
  min-height: 48px;
  padding: 10px 12px;
}

.sku-merge-review-stats div:last-child {
  border-right: 0;
}

.sku-merge-review-stats span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.sku-merge-review-stats strong {
  font-size: 12px;
  overflow-wrap: anywhere;
}

.sku-merge-review-direction {
  align-items: center;
  color: var(--text);
  display: grid;
  gap: 8px;
  justify-items: center;
  text-align: center;
}

.sku-merge-review-direction span {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--ink);
  border-radius: 999px;
  display: inline-flex;
  font-size: 38px;
  height: 70px;
  justify-content: center;
  line-height: 1;
  width: 70px;
}

.sku-merge-review-direction strong {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

#view-sku-merge .settings-panel table {
  min-width: 760px;
  table-layout: auto;
  width: 100%;
}

#view-sku-merge .settings-panel th,
#view-sku-merge .settings-panel td {
  font-size: 12px;
  line-height: 1.3;
  padding: 8px;
  text-align: left;
  vertical-align: top;
  width: auto;
}

#view-sku-merge .settings-panel th {
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.sku-merge-history-panel {
  box-shadow: none;
}

.sku-merge-history-panel .compact-heading h3 {
  font-size: 13px;
  margin: 0;
  text-transform: uppercase;
}

.sku-merge-history-panel .compact-heading p {
  color: var(--muted);
  font-size: 12px;
  margin: 4px 0 0;
}

.sku-merge-history-panel .icon-button svg {
  fill: none;
  height: 16px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 16px;
}

.sku-merge-compare-table th:nth-child(2),
.sku-merge-compare-table td:nth-child(2) {
  background: #fbfffa;
  border-left: 1px solid #e0eee0;
  border-right: 1px solid #e0eee0;
}

.sku-merge-compare-table th:nth-child(2) {
  background: #f2faf1 !important;
  color: var(--green) !important;
}

.sku-merge-compare-table th:nth-child(3),
.sku-merge-compare-table td:nth-child(3) {
  background: #fffaf2;
  border-left: 1px solid #f1dfc6;
  border-right: 1px solid #f1dfc6;
}

.sku-merge-compare-table th:nth-child(3) {
  background: #fff4e5 !important;
  color: var(--amber) !important;
}

.sku-merge-source-note {
  color: var(--muted);
  display: block;
  font-size: 10px;
  margin-top: 3px;
}

.sku-merge-compare-image {
  align-items: center;
  display: flex;
  gap: 8px;
}

.sku-merge-toggle {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  gap: 7px;
}

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

.sku-merge-impact-card,
.sku-merge-confirm-grid article,
.sku-merge-history-detail-grid article {
  border: 1px solid var(--line);
  display: grid;
  gap: 6px;
  padding: 12px;
}

.sku-merge-impact-card span,
.sku-merge-confirm-grid article span,
.sku-merge-history-detail-grid article span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.sku-merge-impact-card strong {
  font-size: 22px;
}

.sku-merge-impact-card p {
  color: var(--muted);
  line-height: 1.35;
  margin: 0;
}

.sku-merge-preview-note {
  background: var(--pink-soft);
  border-color: var(--pink);
  color: var(--ink);
}

.sku-merge-impact-workspace {
  background: var(--surface);
  border: 1px solid var(--line);
  display: grid;
  gap: 14px;
  padding: 16px;
}

.sku-merge-impact-stage-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.sku-merge-impact-review-layout {
  align-items: stretch;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(250px, 30%) minmax(0, 1fr);
}

.sku-merge-impact-nav {
  border: 1px solid var(--line);
  display: grid;
  max-height: 590px;
  overflow-y: auto;
}

.sku-merge-impact-nav-item {
  align-items: center;
  background: var(--surface);
  border: 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  display: grid;
  gap: 10px;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  min-height: 58px;
  padding: 9px 10px;
  text-align: left;
}

.sku-merge-impact-nav-item:last-child {
  border-bottom: 0;
}

.sku-merge-impact-nav-item:hover,
.sku-merge-impact-nav-item:focus-visible {
  background: var(--surface-alt);
}

.sku-merge-impact-nav-item.active {
  background: var(--pink-soft);
  box-shadow: inset 3px 0 0 var(--pink);
}

.sku-merge-impact-nav-item.requires-review {
  background: #fff6f7;
}

.sku-merge-impact-nav-item.active.requires-review {
  background: #fff0f3;
}

.sku-merge-impact-icon {
  align-items: center;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  display: inline-flex;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.sku-merge-impact-icon svg {
  fill: none;
  height: 17px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 17px;
}

.sku-merge-impact-nav-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.sku-merge-impact-nav-copy strong {
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.sku-merge-impact-nav-copy span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.sku-merge-impact-nav-copy b {
  color: var(--ink);
  font-size: 18px;
  margin-right: 5px;
}

.sku-merge-impact-detail-panel {
  border: 1px solid var(--line);
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 14px;
}

.sku-merge-impact-detail-head {
  align-items: start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.sku-merge-impact-detail-title {
  align-items: start;
  display: flex;
  gap: 12px;
  min-width: 0;
}

.sku-merge-impact-detail-title .sku-merge-impact-icon {
  flex: 0 0 auto;
}

.sku-merge-impact-detail-title h3 {
  font-size: 18px;
  margin: 2px 0 5px;
  text-transform: uppercase;
}

.sku-merge-impact-detail-title p {
  color: var(--muted);
  margin: 0;
}

.sku-merge-impact-summary-strip {
  border: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.sku-merge-impact-summary-strip div {
  border-right: 1px solid var(--line);
  display: grid;
  gap: 5px;
  min-height: 58px;
  padding: 10px 12px;
}

.sku-merge-impact-summary-strip div:last-child {
  border-right: 0;
}

.sku-merge-impact-summary-strip strong {
  font-size: 24px;
}

.sku-merge-impact-summary-strip span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.sku-merge-impact-table-wrap {
  border: 1px solid var(--line);
}

.sku-merge-mapping-table {
  min-width: 920px;
}

.sku-merge-mapping-table tr.needs-review td {
  background: #fff7f8;
}

.sku-merge-mapping-warning-row td {
  background: #fff7f8 !important;
  border-top: 0 !important;
  padding: 0 10px 10px !important;
}

.sku-merge-mapping-warning {
  align-items: start;
  border: 1px solid #f3b7c1;
  color: var(--ink);
  display: grid;
  gap: 8px 14px;
  grid-template-columns: minmax(170px, 1.2fr) repeat(3, minmax(120px, 1fr));
  padding: 12px;
}

.sku-merge-mapping-warning p {
  color: var(--muted);
  margin: 0;
}

.sku-merge-mapping-warning span,
.sku-merge-mapping-warning b {
  display: block;
}

.sku-merge-mapping-warning b {
  color: var(--muted);
  font-size: 10px;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.sku-merge-impact-review-actions {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.sku-merge-impact-review-actions span,
.sku-merge-impact-next span {
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
}

.sku-merge-impact-explainer {
  color: var(--muted);
  margin: 0;
}

.sku-merge-impact-bottom-note {
  align-items: center;
  background: #fbfdff;
  border: 1px solid #cbd9ea;
  display: grid;
  gap: 12px;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  padding: 12px;
}

.sku-merge-impact-bottom-note > span {
  align-items: center;
  border: 1px solid #7aa4db;
  border-radius: 999px;
  color: #2f70bf;
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  height: 22px;
  justify-content: center;
  width: 22px;
}

.sku-merge-impact-bottom-note strong {
  display: block;
  margin-bottom: 3px;
}

.sku-merge-impact-bottom-note p {
  color: var(--muted);
  margin: 0;
}

.sku-merge-impact-help-panel {
  background: var(--surface);
  border: 1px solid #cbd9ea;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.08);
  display: grid;
  gap: 12px;
  padding: 16px 46px 16px 16px;
  position: relative;
}

.sku-merge-impact-help-panel h4 {
  font-size: 16px;
  margin: 2px 0 6px;
}

.sku-merge-impact-help-panel p {
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
}

.sku-merge-impact-help-close {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  font-size: 22px;
  height: 30px;
  justify-content: center;
  line-height: 1;
  position: absolute;
  right: 12px;
  top: 12px;
  width: 30px;
}

.sku-merge-impact-help-close:hover,
.sku-merge-impact-help-close:focus-visible {
  border-color: var(--ink);
}

.sku-merge-impact-help-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.sku-merge-impact-help-grid span {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  padding: 9px 10px;
}

.sku-merge-impact-help-grid strong {
  color: var(--ink);
  margin-right: 6px;
}

.sku-merge-impact-next {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.sku-merge-confirm-grid,
.sku-merge-history-detail-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sku-merge-impact-strip {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.sku-merge-impact-strip span {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 800;
  padding: 8px;
  text-transform: uppercase;
}

.sku-merge-confirm-input {
  display: grid;
  gap: 6px;
  max-width: 320px;
}

.sku-merge-info-card {
  max-width: 720px;
}

.sku-merge-history-dialog-card {
  max-width: 900px;
}

.sku-merge-info-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 18px;
}

@media (max-width: 1100px) {
  .sku-merge-selection-grid,
  .sku-merge-review-grid,
  .sku-merge-impact-review-layout,
  .sku-merge-confirm-grid,
  .sku-merge-history-detail-grid {
    grid-template-columns: 1fr;
  }

  .sku-merge-transfer {
    margin-top: 0;
    order: 2;
  }

  .sku-merge-item-card.merge {
    order: 3;
  }

  .sku-merge-impact-grid,
  .sku-merge-impact-strip,
  .sku-merge-impact-summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sku-merge-impact-nav {
    max-height: none;
  }
}

@media (max-width: 760px) {
  .sku-merge-stepper {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .inventory-items-heading-actions {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .inventory-items-heading-actions .subtle {
    grid-column: 1;
    justify-self: stretch;
    text-align: left;
  }

  .sku-merge-step-line {
    display: none;
  }

  .sku-merge-detail-grid,
  .sku-merge-review-stats,
  .sku-merge-impact-grid,
  .sku-merge-impact-strip,
  .sku-merge-impact-summary-strip,
  .sku-merge-mapping-warning {
    grid-template-columns: 1fr;
  }

  .sku-merge-impact-nav-item {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .sku-merge-impact-nav-item .sku-merge-capsule {
    grid-column: 2;
    justify-self: start;
  }

  .sku-merge-impact-help-grid {
    grid-template-columns: 1fr;
  }

  .sku-merge-impact-detail-head,
  .sku-merge-impact-review-actions,
  .sku-merge-impact-next {
    align-items: stretch;
    flex-direction: column;
  }

  .sku-merge-impact-bottom-note {
    grid-template-columns: 22px minmax(0, 1fr);
  }

  .sku-merge-impact-bottom-note .text-button {
    grid-column: 2;
    justify-self: start;
  }

  .sku-merge-selected-item,
  .sku-merge-empty-selection {
    grid-template-columns: 72px minmax(0, 1fr) 34px;
  }

  .sku-merge-empty-selection {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .sku-merge-selected-photo .sku-merge-card-photo,
  .sku-merge-selected-photo .item-photo-button,
  .sku-merge-selected-photo .item-photo,
  .sku-merge-selected-photo .item-photo-placeholder,
  .sku-merge-selected-photo .sku-merge-card-photo.placeholder,
  .sku-merge-empty-photo {
    height: 64px;
    width: 64px;
  }

  .sku-merge-review-body {
    grid-template-columns: 76px minmax(0, 1fr);
  }
}

.stock-history-link {
  background: transparent;
  border: 0;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 0;
  text-align: right;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.stock-history-link.on-hand-pill {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  display: inline-flex;
  justify-content: center;
  line-height: 1.15;
  min-height: 26px;
  min-width: 64px;
  padding: 4px 8px;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}

.stock-history-link.on-hand-pill.positive {
  background: #edf8ee;
  border-color: #bddfbe;
  color: #246c31;
}

.stock-history-link.on-hand-pill.zero {
  background: #fff0f0;
  border-color: #f0b9b9;
  color: #a92f2f;
}

.stock-history-link.on-hand-pill.kit {
  background: #f4ecff;
  border-color: #d6b8f3;
  color: #6f35a5;
}

.stock-history-link:hover,
.stock-history-link:focus-visible {
  color: #1f5f88;
}

.stock-history-panel {
  display: grid;
  gap: 14px;
}

.stock-history-header {
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 18px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  padding: 18px;
}

.stock-history-header h3 {
  font-size: 1.35rem;
  margin: 0;
}

.stock-history-current {
  border-left: 1px solid var(--line);
  display: grid;
  gap: 4px;
  min-width: 160px;
  padding-left: 18px;
  text-align: right;
}

.stock-history-current span,
.stock-history-meta {
  color: var(--muted);
  display: block;
  font-size: 0.72rem;
}

.stock-history-current strong {
  font-size: 1.35rem;
}

.stock-history-table-panel {
  overflow-x: hidden;
}

.stock-history-table {
  table-layout: fixed;
  width: 100%;
}

.stock-history-table th:nth-child(1),
.stock-history-table td:nth-child(1) {
  width: 18%;
}

.stock-history-table th:nth-child(2),
.stock-history-table td:nth-child(2) {
  width: 23%;
}

.stock-history-table th:nth-child(3),
.stock-history-table td:nth-child(3) {
  width: 15%;
}

.stock-history-table th:nth-child(4),
.stock-history-table td:nth-child(4) {
  width: 14%;
}

.stock-history-table th:nth-child(5),
.stock-history-table td:nth-child(5),
.stock-history-table th:nth-child(6),
.stock-history-table td:nth-child(6) {
  width: 15%;
}

.stock-history-change-filter {
  align-items: center;
  display: flex;
  gap: 8px;
}

.stock-history-change-filter span {
  flex: 0 0 auto;
}

.stock-history-change-filter select {
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  max-width: 150px;
  min-width: 92px;
  padding: 4px 26px 4px 8px;
}

.stock-history-type {
  display: block;
  font-weight: 700;
}

.stock-history-change.positive {
  color: #247a3b;
  font-weight: 800;
}

.stock-history-change.negative {
  color: #aa3434;
  font-weight: 800;
}

.property-pill {
  align-items: center;
  border-radius: 4px;
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  justify-content: center;
  min-width: 34px;
  padding: 4px 6px;
}

.property-pill.fg {
  background: var(--green-soft);
  color: var(--green);
}

.property-pill.rm {
  background: var(--blue-soft);
  color: var(--blue);
}

.property-pill.wip {
  background: var(--amber-soft);
  color: var(--amber);
}

.property-pill.vi {
  background: var(--magenta-soft);
  color: var(--magenta);
}

.item-photo,
.item-photo-placeholder {
  align-items: center;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  display: inline-flex;
  height: 42px;
  justify-content: center;
  object-fit: contain;
  padding: 2px;
  width: 42px;
}

.item-photo {
  background: #fff;
}

.item-photo-button {
  appearance: none;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: zoom-in;
  display: inline-flex;
  line-height: 0;
  padding: 0;
  vertical-align: middle;
}

.item-photo-button:focus-visible {
  outline: none;
}

#itemImagePreviewDialog {
  max-width: calc(100vw - 24px);
  overflow: hidden;
  width: min(1120px, calc(100vw - 48px));
}

#itemImagePreviewDialog .item-image-preview-dialog-card {
  box-sizing: border-box;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: min(840px, calc(100vh - 48px));
  max-height: calc(100vh - 48px);
  max-width: none;
  overflow: hidden;
  width: 100%;
}

#itemImagePreviewDialog .dialog-header {
  gap: 12px;
}

#itemImagePreviewDialog .dialog-header > div {
  min-width: 0;
}

#itemImagePreviewDialog .dialog-header h3 {
  line-height: 1.2;
  overflow-wrap: anywhere;
}

#itemImagePreviewDialog .dialog-header .icon-button {
  flex: 0 0 34px;
}

.item-image-preview-frame {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
  padding: 14px;
}

.item-image-preview-frame img {
  display: block;
  height: 100%;
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  object-position: center center;
  width: 100%;
}

.item-image-field {
  display: grid;
  gap: 6px;
}

.item-image-field > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.image-drop-zone {
  align-items: center;
  background: #fff;
  border: 1px dashed #cfc7c7;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  min-height: 82px;
  overflow: hidden;
  padding: 8px;
  text-align: center;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.image-drop-zone:hover,
.image-drop-zone:focus-visible,
.image-drop-zone.drag-over {
  background: var(--pink-soft);
  border-color: var(--ink);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.06);
  outline: none;
}

.image-drop-zone img {
  max-height: 96px;
  max-width: 100%;
  object-fit: contain;
}

.image-drop-text {
  color: var(--muted);
  display: grid;
  font-size: 11px;
  gap: 2px;
}

.image-drop-text strong {
  color: var(--ink);
}

.item-image-field .mini-button {
  justify-self: start;
}

.item-category-cell,
.vendor-wrap {
  white-space: normal;
}

.tones-manufactured-vendor {
  color: #8a8a8a;
  font-weight: 600;
}

.select-column {
  text-align: center;
  width: 34px;
}

.select-column input {
  height: 17px;
  width: 17px;
}

.bulk-action-bar {
  align-items: center;
  background: rgba(247, 247, 247, 0.96);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 0;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  padding: 10px;
  position: sticky;
  top: 154px;
  z-index: 18;
}

.compact-bulk-bar {
  justify-content: space-between;
  padding: 8px;
}

.bulk-action-bar[hidden] {
  display: none;
}

.bulk-action-bar strong {
  align-self: center;
  margin-right: 4px;
}

.bulk-selection-summary {
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.bulk-action-bar label {
  color: var(--muted);
  display: grid;
  font-size: 11px;
  font-weight: 700;
  gap: 4px;
  text-transform: uppercase;
}

.bulk-action-bar input,
.bulk-action-bar select {
  min-height: 30px;
  min-width: 118px;
}

.bulk-edit-dialog-card {
  min-width: min(420px, calc(100vw - 32px));
}

.inline-apply-row {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.inline-apply-row input,
.inline-apply-row select {
  width: 100%;
}

.barcode-cell {
  color: var(--muted);
  font-size: 12px;
  word-break: break-word;
}

.formula-table-panel table {
  min-width: 900px;
}

.formula-table-panel .kit-formula-table {
  min-width: 980px;
}

.production-table-panel table {
  min-width: 940px;
}

.formula-table-panel th:nth-child(1),
.formula-table-panel td:nth-child(1) {
  width: 32%;
}

.formula-table-panel th:nth-child(4),
.formula-table-panel td:nth-child(4) {
  width: 28%;
}

.formula-table-panel .kit-formula-table th:nth-child(1),
.formula-table-panel .kit-formula-table td:nth-child(1) {
  width: 30%;
}

.formula-table-panel .kit-formula-table th:nth-child(4),
.formula-table-panel .kit-formula-table td:nth-child(4) {
  width: 130px;
}

.formula-table-panel .kit-formula-table th:nth-child(5),
.formula-table-panel .kit-formula-table td:nth-child(5) {
  text-align: center;
  width: 150px;
}

.formula-table-panel .kit-formula-table th:nth-child(6),
.formula-table-panel .kit-formula-table td:nth-child(6) {
  width: 160px;
}

.kit-count-cell {
  text-align: center;
}

.kit-row-actions {
  flex-wrap: nowrap;
  justify-content: flex-start;
}

.inventory-use-calculator {
  background: #f7f5f4;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  padding: 12px;
}

.calculator-heading {
  align-items: end;
  background: var(--ink);
  border: 0;
  border-radius: 8px;
  color: var(--surface);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 14px;
}

.calculator-heading h3 {
  color: var(--surface);
}

.calculator-heading .eyebrow,
.calculator-heading .subtle {
  color: rgba(255, 255, 255, 0.72);
}

.calculator-heading .subtle {
  max-width: 560px;
  text-align: right;
}

.formula-use-lines {
  display: grid;
  gap: 12px;
}

.formula-use-line {
  align-items: start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: 34px minmax(250px, 1.35fr) minmax(150px, 0.45fr) minmax(150px, 0.45fr) auto;
  padding: 10px;
}

.formula-use-line-number {
  align-items: center;
  background: var(--ink);
  border-radius: 8px;
  color: var(--surface);
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.formula-use-picker {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.formula-use-selected {
  background: var(--pink-soft);
  border: 1px solid var(--pink);
  border-radius: 8px;
  display: grid;
  gap: 2px;
  padding: 7px 9px;
}

.formula-use-selected strong {
  font-size: 12px;
  text-transform: uppercase;
}

.formula-use-selected span {
  color: var(--muted);
  font-size: 12px;
}

.formula-use-yield-hint {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 3px;
  min-height: 58px;
  padding: 8px 10px;
}

.formula-use-yield-hint span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.formula-use-yield-hint strong {
  color: var(--ink);
  font-size: 15px;
}

.formula-use-suggestions {
  grid-column: auto;
  max-height: 250px;
}

.calculator-actions {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  padding: 10px;
}

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

.inventory-use-tree,
.formula-use-node-list,
.formula-use-child-list {
  display: grid;
  gap: 10px;
}

.formula-use-request-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid #9abf8f;
  border-radius: 8px;
  padding: 12px;
}

.formula-use-request-card.order {
  border-left-color: #d95f5f;
}

.formula-use-request-card.ordered {
  border-left-color: #d9a23a;
}

.formula-use-request-heading {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 10px;
}

.formula-use-request-heading h3 {
  font-size: 18px;
  margin: 0;
}

.formula-use-request-heading span {
  color: var(--muted);
  font-size: 12px;
}

.formula-use-node {
  background: #f8fcf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-left: calc(var(--depth, 0) * 18px);
  padding: 10px;
}

.formula-use-node.order {
  background: #fff7f7;
}

.formula-use-node.ordered {
  background: #fffaf0;
}

.formula-use-node-grid {
  align-items: start;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(220px, 1.6fr) repeat(3, minmax(110px, 0.7fr)) minmax(110px, 0.6fr);
}

.formula-use-node-grid span {
  color: var(--muted);
  display: block;
  font-size: 11px;
  margin-bottom: 3px;
}

.formula-use-node-grid strong {
  font-size: 13px;
}

.formula-use-material strong {
  font-size: 14px;
}

.formula-use-source-heading {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text) !important;
  display: inline-flex !important;
  font-size: 11px !important;
  margin-top: 6px;
  padding: 3px 7px;
}

.formula-use-child-list {
  border-left: 2px solid var(--line);
  margin-top: 10px;
  padding-left: 12px;
}

.formula-use-child-heading {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.formula-use-node-note {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  margin-top: 10px;
  padding-top: 8px;
}

@media (max-width: 980px) {
  .formula-use-node-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.inventory-use-inbound-line {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 500;
  margin-top: 5px;
}

.formula-use-source {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  margin: 2px;
  padding: 4px 8px;
}

.group-header,
.po-header {
  align-items: center;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding: 8px 10px;
}

.group-title,
.po-title {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.group-title strong,
.po-title strong {
  font-size: 15px;
}

.po-register-header,
.po-register-row {
  display: grid;
  gap: 4px;
  /* Tightened so the row fits on one line: vendor no longer over-grows, status
     sits right beside it, and the freed width goes to the action column now
     that Edit/Email are icons. */
  grid-template-columns: minmax(104px, 0.8fr) 68px minmax(118px, 0.95fr) 96px 84px 84px 84px minmax(176px, 1.1fr);
}

.po-register-header {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  padding: 8px 10px;
  text-transform: uppercase;
}

.po-header.po-register-row {
  align-items: center;
  display: grid;
  justify-content: initial;
}

.po-cell {
  min-width: 0;
}

.po-date-cell {
  font-variant-numeric: tabular-nums;
}

.po-vendor-cell {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.po-total-cell {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.vendor-name-cell {
  font-weight: 700;
}

.po-table-input,
.po-status-select {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  min-height: 28px;
  padding: 0 6px;
  width: 100%;
}

.po-table-input:disabled {
  background: var(--green-soft);
  border-color: #bcdcb7;
  color: var(--green);
  cursor: not-allowed;
  font-weight: 700;
}

.po-read-text,
.po-text-button {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--text);
  display: inline-flex;
  font: inherit;
  min-height: 28px;
  padding: 0;
  text-align: left;
}

.po-text-button {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 4px;
}

.po-text-button:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.po-text-button.muted-link {
  color: var(--muted);
  font-size: 12px;
}

.po-tracking-edit {
  min-height: 16px;
}

.po-tracking-more {
  font-size: 11px;
  min-height: 16px;
}

.po-quick-edit-card {
  max-width: 100%;
}

#poQuickEditDialog {
  width: min(920px, calc(100vw - 28px));
}

.po-tracking-edit-panel {
  display: grid;
  gap: 12px;
}

.po-tracking-edit-rows {
  display: grid;
  gap: 10px;
}

.po-tracking-edit-row {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(170px, 1fr) minmax(130px, 0.75fr) minmax(300px, 1.45fr) auto;
}

.po-tracking-edit-row label {
  margin: 0;
}

.po-tracking-edit-row label span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.po-tracking-edit-footer {
  align-items: center;
  display: flex;
  gap: 10px;
}

.po-tracking-edit-footer .icon-only svg,
.po-tracking-edit-row .icon-only svg {
  fill: none;
  height: 14px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 14px;
}

.po-tracking-edit-row .muted-remove {
  color: var(--muted);
  opacity: 0.45;
}

@media (max-width: 760px) {
  .po-tracking-edit-row {
    grid-template-columns: 1fr;
  }

  .po-tracking-edit-row .icon-only {
    justify-self: start;
  }
}

.po-read-text.received-date {
  color: var(--green);
  font-weight: 700;
}

.po-status-select {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.po-status-select.ordered {
  background: var(--amber-soft);
  border-color: #f1d6a6;
  color: var(--amber);
}

.po-status-select.watch {
  background: var(--blue-soft);
  border-color: #b8d2e6;
  color: var(--blue);
}

.po-status-select.stable {
  background: var(--green-soft);
  border-color: #bcdcb7;
  color: var(--green);
}

.po-status-select.discontinued {
  background: var(--red-soft);
  border-color: #f3bcbc;
  color: var(--red);
}

.inline-status-select {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  min-height: 30px;
  padding: 0 8px;
  text-transform: uppercase;
  width: min(150px, 100%);
}

.inline-status-select.inline-status-pending {
  background: var(--amber-soft);
  border-color: #f1d6a6;
  color: var(--amber);
}

.inline-status-select.inline-status-pre-order {
  background: #f0e7ff;
  border-color: #d3b9ff;
  color: #6d35b8;
}

.inline-status-select.inline-status-draft {
  background: var(--amber-soft);
  border-color: #f1d6a6;
  color: var(--amber);
}

.inline-status-select.inline-status-sent {
  background: var(--blue-soft);
  border-color: #b8d2e6;
  color: var(--blue);
}

.inline-status-select.inline-status-accepted {
  background: var(--green-soft);
  border-color: #bcdcb7;
  color: var(--green);
}

.inline-status-select.inline-status-rejected {
  background: var(--red-soft);
  border-color: #f3b9b5;
  color: var(--red);
}

.inline-status-select.inline-status-archived {
  background: var(--surface-alt);
  border-color: var(--line);
  color: var(--muted);
}

.inline-status-select.inline-status-complete {
  background: var(--green-soft);
  border-color: #bcdcb7;
  color: var(--green);
}

.inline-status-select.inline-status-open {
  background: var(--blue-soft);
  border-color: #b8d2e6;
  color: var(--blue);
}

.inline-status-select.inline-status-shipped {
  background: var(--green-soft);
  border-color: #bcdcb7;
  color: var(--green);
}

.inline-status-select.inline-status-canceled {
  background: var(--red-soft);
  border-color: #f3b9b5;
  color: var(--red);
}

.po-eta-cell {
  display: grid;
  gap: 4px;
}

.po-eta-cell span {
  color: var(--muted);
  font-size: 11px;
}

.po-eta-cell.manual-eta .po-text-button {
  color: var(--blue);
  font-weight: 800;
}

.po-eta-cell.manual-eta span {
  color: var(--ink);
  font-weight: 700;
}

.po-eta-cell.received span {
  color: var(--green);
  font-weight: 700;
}

.po-tracking-cell {
  align-items: center;
  display: grid;
  gap: 4px;
  grid-template-columns: minmax(84px, 1fr) auto;
}

.po-tracking-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
}

.po-tracking-stack {
  align-items: start;
  display: grid;
  gap: 2px;
  justify-items: start;
  min-width: 0;
}

.po-tracking-carrier {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.1;
}

.group-meta {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 8px;
}

.badge {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  display: inline-flex;
  font-size: 11px;
  font-weight: 700;
  min-height: 21px;
  padding: 0 7px;
  text-transform: uppercase;
}

.badge.order {
  background: var(--red-soft);
  border-color: #f3b5b5;
  color: var(--red);
}

.badge.gap {
  background: var(--amber-soft);
  border-color: #f1c27a;
  color: var(--amber);
}

.badge.production {
  background: var(--pink-soft);
  border-color: var(--pink);
  color: var(--ink);
}

.badge.add {
  background: var(--pink-soft);
  border-color: var(--pink);
  color: var(--ink);
}

.badge.count {
  background: var(--amber-soft);
  border-color: #f1d6a6;
  color: var(--amber);
}

.badge.watch {
  background: var(--blue-soft);
  border-color: #b8d2e6;
  color: var(--blue);
}

.badge.stable {
  background: var(--green-soft);
  border-color: #bcdcb7;
  color: var(--green);
}

.badge.service {
  background: var(--surface-alt);
  border-color: var(--line);
  color: var(--muted);
}

.badge.ordered {
  background: var(--amber-soft);
  border-color: #f1d6a6;
  color: var(--amber);
}

.badge.discontinued {
  background: var(--red-soft);
  border-color: #f3bcbc;
  color: var(--red);
}

.badge.flip-fbm {
  background: var(--red-soft);
  border-color: #f3bcbc;
  color: var(--red);
}

.badge.upcoming {
  background: #f0e7ff;
  border-color: #d3b9ff;
  color: #6d35b8;
}

.badge.preorder {
  background: #f0e7ff;
  border-color: #d3b9ff;
  color: #6d35b8;
}

.badge.to-discontinue {
  background: #fff3d5;
  border-color: #f2c36f;
  color: var(--amber);
}

.status-capsule {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  display: inline-flex;
  font-size: 11px;
  font-weight: 700;
  min-height: 21px;
  padding: 0 9px;
  text-transform: uppercase;
}

.status-capsule.active {
  background: var(--green-soft);
  border-color: #bcdcb7;
  color: var(--green);
}

.status-capsule.archived {
  background: var(--red-soft);
  border-color: #f3bcbc;
  color: var(--red);
}

.status-capsule.draft {
  background: var(--blue-soft);
  border-color: #b8d2e6;
  color: var(--blue);
}

.inventory-status-badge {
  line-height: 1.1;
  max-width: 100%;
  text-align: center;
  white-space: normal;
}

#itemLifecycleStatus.status-active {
  background: var(--green-soft);
  border-color: #bcdcb7;
  color: var(--green);
  font-weight: 800;
}

#itemLifecycleStatus.status-upcoming {
  background: #f0e7ff;
  border-color: #d3b9ff;
  color: #6d35b8;
  font-weight: 800;
}

#itemLifecycleStatus.status-sunset {
  background: var(--amber-soft);
  border-color: #f2c36f;
  color: var(--amber);
  font-weight: 800;
}

#itemLifecycleStatus.status-discontinued {
  background: var(--red-soft);
  border-color: #f3bcbc;
  color: var(--red);
  font-weight: 800;
}

td .badge + .badge {
  margin-left: 6px;
  margin-top: 4px;
}

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

#dataHealthDialog,
#homeFgOosDialog {
  max-width: none;
  width: min(1360px, calc(100vw - 24px));
}

.data-health-dialog-card,
.home-fg-oos-dialog-card {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  max-height: min(92vh, 920px);
  overflow: hidden;
  width: 100%;
}

.data-health-dialog-summary {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.data-health-dialog-summary > div {
  background: #fbfafa;
  border: 1px solid #e8e1e1;
  border-radius: 5px;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
}

.data-health-dialog-summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.data-health-dialog-summary strong {
  color: #111;
  font-size: 20px;
  font-weight: 900;
}

.data-health-dialog-table-wrap {
  max-height: min(64vh, 680px);
  overflow-x: hidden;
  overflow-y: auto;
}

.data-health-dialog-table {
  min-width: 0;
  table-layout: fixed;
  width: 100%;
}

.data-health-dialog-table th,
.data-health-dialog-table td {
  overflow-wrap: anywhere;
  white-space: normal;
}

.data-health-dialog-table th {
  color: #4f545a;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.data-health-dialog-table td {
  font-size: 12px;
  vertical-align: middle;
}

.data-health-dialog-table th:nth-child(1),
.data-health-dialog-table td:nth-child(1) {
  width: 14%;
}

.data-health-dialog-table th:nth-child(2),
.data-health-dialog-table td:nth-child(2) {
  width: 10%;
}

.data-health-dialog-table th:nth-child(3),
.data-health-dialog-table td:nth-child(3) {
  width: 24%;
}

.data-health-dialog-table th:nth-child(4),
.data-health-dialog-table td:nth-child(4) {
  width: 12%;
}

.data-health-dialog-table th:nth-child(5),
.data-health-dialog-table td:nth-child(5) {
  width: 9%;
}

.data-health-dialog-table th:nth-child(6),
.data-health-dialog-table td:nth-child(6),
.data-health-dialog-table th:nth-child(7),
.data-health-dialog-table td:nth-child(7) {
  width: 7%;
}

.data-health-dialog-table th:nth-child(8),
.data-health-dialog-table td:nth-child(8) {
  width: 8%;
}

.data-health-dialog-table th:nth-child(9),
.data-health-dialog-table td:nth-child(9) {
  width: 9%;
}

.home-fg-oos-dialog-table th:nth-child(1),
.home-fg-oos-dialog-table td:nth-child(1) {
  width: 29%;
}

.home-fg-oos-dialog-table th:nth-child(2),
.home-fg-oos-dialog-table td:nth-child(2) {
  width: 13%;
}

.home-fg-oos-dialog-table th:nth-child(3),
.home-fg-oos-dialog-table td:nth-child(3) {
  width: 13%;
}

.home-fg-oos-dialog-table th:nth-child(4),
.home-fg-oos-dialog-table td:nth-child(4) {
  width: 13%;
}

.home-fg-oos-dialog-table th:nth-child(5),
.home-fg-oos-dialog-table td:nth-child(5) {
  width: 18%;
}

.home-fg-oos-dialog-table th:nth-child(6),
.home-fg-oos-dialog-table td:nth-child(6) {
  width: 14%;
}

.home-fg-oos-backorder-badge {
  margin-left: 7px;
}

.home-fg-oos-po-cell .home-order-link {
  margin: 2px 5px 2px 0;
}

.data-health-row-note {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.3;
  margin-top: 3px;
}

.data-health-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.data-health-dialog-actions {
  align-items: center;
}

.contact-table {
  min-width: 980px;
}

.portal-admin-panel {
  display: grid;
  gap: 14px;
}

.portal-account-table {
  min-width: 1120px;
}

.portal-account-table td,
.portal-account-table th {
  vertical-align: middle;
}

.portal-account-actions {
  flex-wrap: wrap;
  gap: 6px;
}

.danger-outline {
  background: #fff;
  border-color: #f0a6a6;
  color: #b73737;
}

.portal-audit-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.portal-audit-list {
  display: grid;
  gap: 8px;
}

.portal-audit-row {
  align-items: center;
  background: #fbfafa;
  border: 1px solid #eee5e5;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 9px 10px;
}

.portal-audit-row strong,
.portal-audit-row span,
.portal-audit-row small {
  display: block;
}

.portal-audit-row small {
  color: var(--muted);
  text-align: right;
}

.compact-empty {
  padding: 12px;
}

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

.portal-settings-card {
  align-content: start;
}

.portal-settings-card:nth-child(1),
.portal-settings-card:nth-child(5) {
  grid-column: 1 / -1;
}

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

.portal-announcement-fields {
  display: grid;
  gap: 8px;
}

.portal-settings-fields label,
.portal-account-dialog-grid label {
  color: var(--muted);
  display: grid;
  font-size: 11px;
  font-weight: 800;
  gap: 5px;
  text-transform: uppercase;
}

.portal-settings-fields input,
.portal-account-dialog-grid input,
.portal-account-dialog-grid select {
  min-width: 0;
}

.portal-upload-tile {
  border: 1px dashed #cfc5c5;
  cursor: pointer;
  min-height: 94px;
  padding: 12px;
}

.portal-upload-tile:hover {
  border-color: var(--ink);
}

.portal-upload-tile input {
  font-size: 11px;
}

.portal-upload-tile small,
.portal-rules-list span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  text-transform: none;
}

.portal-toggle-grid,
.portal-rules-list {
  display: grid;
  gap: 8px;
}

.portal-account-dialog-card {
  max-width: min(980px, 94vw);
  width: min(980px, 94vw);
}

.portal-account-dialog-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.portal-account-dialog-grid .wide-field,
.portal-account-dialog-grid .full-span,
.portal-settings-fields .full-span {
  grid-column: 1 / -1;
}

.portal-account-dialog-grid .po-match-list {
  max-height: 210px;
  overflow: auto;
}

.portal-account-dialog-grid .po-match-option:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.sales-order-table {
  min-width: 900px;
}

.customer-invoice-table {
  min-width: 1120px;
}

.fulfillment-dialog-card {
  max-width: min(1180px, calc(100vw - 44px));
  width: min(1180px, calc(100vw - 44px));
}

#customerFulfillmentDialog {
  max-width: calc(100vw - 28px);
  width: min(1320px, calc(100vw - 28px));
}

#customerFulfillmentDialog .fulfillment-dialog-card {
  max-width: 100%;
  width: 100%;
}

.fulfillment-summary-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 14px;
}

.fulfillment-summary-grid > div {
  background: #fbfafa;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 4px;
  padding: 10px;
}

.fulfillment-summary-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.fulfillment-summary-grid strong {
  font-size: 13px;
}

.fulfillment-lot-table {
  min-width: 0;
  table-layout: fixed;
  width: 100%;
}

.fulfillment-lot-table-wrap {
  overflow-x: visible;
}

.fulfillment-lot-table td,
.fulfillment-lot-table th {
  vertical-align: top;
  white-space: normal;
  word-break: break-word;
}

.fulfillment-lot-table .fulfillment-col-item { width: 29%; }
.fulfillment-lot-table .fulfillment-col-sku { width: 10%; }
.fulfillment-lot-table .fulfillment-col-used { width: 14%; }
.fulfillment-lot-table .fulfillment-col-lot { width: 13%; }
.fulfillment-lot-table .fulfillment-col-date { width: 11%; }
.fulfillment-lot-table .fulfillment-col-location { width: 13%; }
.fulfillment-lot-table .fulfillment-col-qty { width: 10%; }

.fulfillment-lot-table .sku,
.fulfillment-lot-table .num {
  white-space: normal;
}

.fulfillment-lot-table .item-name {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.fulfillment-lot-table .item-name strong {
  font-size: 13px;
}

.cost-metrics {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.cost-top-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.cost-toolbar {
  align-items: end;
}

.cost-table {
  min-width: 1120px;
}

.cost-table th:first-child,
.cost-table td:first-child {
  width: 42px;
}

.cost-table th:nth-child(2),
.cost-table td:nth-child(2) {
  width: 118px;
}

.cost-table th:nth-child(3),
.cost-table td:nth-child(3) {
  min-width: 280px;
}

.cost-table th:nth-child(4),
.cost-table td:nth-child(4) {
  min-width: 180px;
}

.cost-row-detailed .cost-value-cell {
  font-weight: 700;
}

.cost-breakdown-row > td {
  background: #fbfaf9;
  padding: 10px;
}

.cost-detail {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 14px;
  padding: 14px;
}

.cost-detail-heading {
  align-items: flex-start;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

.cost-detail-heading h3 {
  font-size: 1rem;
  line-height: 1.25;
}

.cost-total-strip {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 8px 12px;
  justify-content: flex-end;
  text-align: right;
}

.cost-total-strip strong {
  color: var(--ink);
}

.cost-parent-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
}

.cost-parent-grid label {
  color: var(--muted);
  display: grid;
  font-size: 11px;
  font-weight: 800;
  gap: 5px;
  text-transform: uppercase;
}

.cost-parent-grid .mini-input,
.cost-component-row .mini-input {
  max-width: none;
  width: 100%;
}

.cost-component-table {
  display: grid;
  gap: 6px;
}

.cost-component-header,
.cost-component-row {
  align-items: center;
  display: grid;
  gap: 6px;
  grid-template-columns:
    minmax(96px, 0.7fr)
    minmax(120px, 0.8fr)
    minmax(240px, 1.8fr)
    minmax(110px, 0.7fr)
    minmax(86px, 0.55fr)
    minmax(86px, 0.55fr)
    minmax(82px, 0.5fr)
    minmax(92px, 0.55fr)
    34px;
  min-width: 980px;
}

.cost-component-header {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
}

[data-cost-component-rows] {
  display: grid;
  gap: 0;
  overflow-x: auto;
}

.cost-component-row {
  border-top: 1px solid var(--line);
  padding: 6px 0;
}

.cost-component-row:first-child {
  border-top: 0;
}

.cost-component-row .num,
.cost-component-header span:nth-child(n + 5) {
  text-align: right;
}

.cost-detail-actions {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.cost-toggle-button {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.cost-unit-label {
  color: var(--muted);
  font-weight: 700;
  text-transform: none;
}

.cost-money-cell {
  display: grid;
  gap: 2px;
}

.cost-unit-hint {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-align: right;
}

.cost-calculator-launch {
  background: #ffd6e6;
  border-color: #f0a5c1;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  gap: 8px;
  min-height: 36px;
  padding: 0 13px;
}

.cost-calculator-launch svg {
  fill: none;
  height: 18px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 18px;
}

.cost-calculator-launch:hover {
  background: #ffc4db;
  border-color: #e786ac;
}

.cost-calculator-panel {
  display: grid;
  gap: 14px;
}

.cost-calculator-heading {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  padding-bottom: 10px;
}

.cost-calculator-card,
.cost-calculator-saved {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 12px;
  padding: 12px;
}

.cost-calculator-table-wrap {
  display: grid;
  gap: 6px;
  overflow: visible;
}

.cost-calculator-header,
.cost-calculator-row {
  align-items: start;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(260px, 2fr) minmax(105px, 0.62fr) minmax(130px, 0.7fr) minmax(118px, 0.62fr) minmax(92px, 0.48fr) minmax(105px, 0.52fr) 34px;
  min-width: 960px;
}

.cost-calculator-header {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.cost-calculator-row {
  border-top: 1px solid var(--line);
  padding-top: 8px;
  position: relative;
  z-index: 1;
}

.cost-calculator-row:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.cost-calculator-row:focus-within {
  z-index: 30;
}

.cost-calculator-row input {
  width: 100%;
}

.cost-calculator-item-cell {
  position: relative;
}

.cost-calculator-match-list {
  left: 0;
  position: absolute;
  right: 0;
  top: calc(100% + 2px);
  z-index: 40;
}

.cost-calculator-custom-option {
  border-top: 1px solid var(--line);
  margin-top: 2px;
}

.cost-calculator-footer {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.cost-calculator-total {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  gap: 12px;
  margin-left: auto;
  padding: 8px 12px;
}

.cost-calculator-total span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.cost-calculator-total strong {
  font-size: 20px;
}

.distributor-order-toolbar {
  align-items: center;
}

.distributor-order-action-band {
  margin-bottom: 14px;
}

.customer-order-card .new-po-meta-grid {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.customer-order-address-grid {
  grid-template-columns: 1.1fr 1fr 1fr;
}

.customer-subaccount-note {
  margin: 8px 0 18px;
}

.customer-subaccount-picker {
  color: var(--muted);
  display: grid;
  font-size: 11px;
  font-weight: 800;
  gap: 6px;
  max-width: 420px;
  text-transform: uppercase;
}

.customer-subaccount-picker select {
  appearance: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  min-height: 34px;
  padding: 7px 9px;
  text-transform: none;
}

.customer-document-notes {
  color: var(--muted);
  display: grid;
  font-size: 11px;
  font-weight: 800;
  gap: 6px;
  margin: 14px 0;
  text-transform: uppercase;
}

.customer-document-notes textarea {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  line-height: 1.45;
  min-height: 76px;
  padding: 9px 10px;
  resize: vertical;
  text-transform: none;
  width: 100%;
}

.customer-document-notes textarea:focus {
  border-color: var(--pink-dark);
  box-shadow: 0 0 0 3px rgba(252, 201, 201, 0.35);
  outline: none;
}

.customer-order-lines-heading,
.customer-order-line {
  grid-template-columns: minmax(280px, 1.65fr) minmax(120px, 0.65fr) minmax(130px, 0.75fr) minmax(110px, 0.65fr) minmax(130px, 0.75fr) minmax(110px, 0.65fr) 42px;
}

.sales-order-lines-heading,
[data-customer-order-lines] .customer-order-line {
  grid-template-columns: minmax(280px, 1.65fr) minmax(112px, 0.58fr) minmax(120px, 0.68fr) minmax(102px, 0.58fr) minmax(122px, 0.68fr) minmax(86px, 0.46fr) 70px;
}

[data-customer-order-lines] .customer-order-line-subtotal strong {
  white-space: nowrap;
}

.customer-order-total-actions {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(120px, 160px) minmax(120px, 160px) minmax(160px, 220px);
  justify-content: end;
  margin-top: 18px;
}

#confirmedSaveStatus {
  box-sizing: border-box;
  width: max-content;
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2147483640;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 24px);
  padding: 8px 12px;
  border: 1px solid #b8c8bd;
  background: #eff8f1;
  color: #16452a;
  font-size: 12px;
  box-shadow: 0 2px 8px #0002;
}
#confirmedSaveStatus[data-status="pending"] { background: #fff5f7; border-color: #e4b9c4; color: #713349; }
#confirmedSaveStatus[data-status="error"] { background: #fff0f0; border-color: #ce6c6c; color: #8a1f1f; }
#confirmedSaveStatus button { flex-shrink: 0; font-size: 12px; }
#confirmedSaveStatus > span { min-width: 0; overflow-wrap: anywhere; }
#confirmedSaveStatus button { max-width: 100%; white-space: normal; }
.save-recovery-dialog { width: min(760px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; }
.save-recovery-dialog .dialog-card { width: 100%; min-width: 0; padding: 20px; }
.save-recovery-dialog h3 { font-size: 20px; }
.save-recovery-entry { border-top: 1px solid #ddd; padding: 16px 0; overflow-wrap: anywhere; }
.save-recovery-entry h4 { margin: 0 0 8px; font-size: 15px; }
.save-recovery-entry p { margin: 6px 0; font-size: 13px; }
.save-recovery-dialog .dialog-actions { flex-wrap: wrap; }
.recovery-check-page main { max-width: 820px; margin: 24px auto; padding: 24px; }
.recovery-check-logo { display: block; width: 100px; height: 80px; object-fit: contain; margin-bottom: 24px; }
.recovery-check-page h1 { font-size: 24px; margin: 0 0 16px; }
.recovery-check-page h2 { font-size: 16px; margin: 0 0 8px; }
.recovery-check-page .dialog-actions { flex-wrap: wrap; justify-content: flex-start; }
.recovery-check-page #recoveryCheckStatus { line-height: 1.6; margin-bottom: 24px; }
.save-pending-label { display: block; margin-top: 4px; color: #7b3145; font-size: 11px; }

.customer-order-grand-total {
  border: 1px solid var(--line);
  padding: 10px 12px;
}

@media (min-width: 981px) {
  .customer-invoice-card .customer-order-total-actions {
    grid-template-columns: repeat(3, minmax(120px, 160px)) minmax(160px, 220px);
  }
}

.customer-order-grand-total span {
  color: var(--muted);
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.customer-order-grand-total strong {
  display: block;
  font-size: 1.15rem;
  margin-top: 4px;
}

.readonly-value {
  align-items: center;
  background: #f8f8f8;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  display: flex;
  font-weight: 800;
  min-height: 34px;
  padding: 7px 9px;
}

.customer-order-readonly .po-builder-row {
  align-items: start;
}

.customer-order-view-item {
  display: grid;
  gap: 3px;
}

.customer-order-view-item > strong {
  font-size: 0.95rem;
  line-height: 1.25;
}

.customer-order-view-item > small,
.readonly-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.customer-order-line-lots {
  display: grid;
  gap: 3px;
  margin-top: 5px;
}

.fulfilled-lot-line {
  align-items: start;
  color: #15803d;
  display: flex;
  gap: 5px;
  line-height: 1.25;
}

.fulfilled-lot-line > span {
  background: #dcfce7;
  border: 1px solid #86efac;
  border-radius: 999px;
  color: #15803d;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 9px;
  font-weight: 900;
  height: 15px;
  justify-content: center;
  line-height: 1;
  margin-top: 1px;
  width: 15px;
}

.fulfilled-lot-line small {
  color: #166534;
  font-size: 0.72rem;
}

.fulfilled-lot-line em {
  color: #4b5563;
  display: block;
  font-style: normal;
  margin-top: 1px;
}

.contact-edit-card {
  border-radius: 6px;
  box-shadow: none;
  gap: 14px;
  max-width: none;
  padding: 16px;
}

.contact-edit-sections {
  display: grid;
  gap: 12px;
}

.contact-edit-card .new-po-document-header {
  align-items: start;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding-bottom: 12px;
}

.contact-edit-card .new-po-heading-line {
  margin-top: 8px;
}

.contact-edit-card .new-po-heading-line h3 {
  font-size: 22px;
  line-height: 1.15;
  margin: 2px 0 0;
}

.contact-edit-card .item-edit-card {
  border-radius: 6px;
  gap: 12px;
  padding: 14px;
}

.contact-edit-card .item-edit-card-heading {
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.subaccount-section-heading {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.subaccount-table {
  table-layout: fixed;
  width: 100%;
}

.subaccount-table th,
.subaccount-table td {
  overflow-wrap: anywhere;
  vertical-align: top;
  white-space: normal;
}

.subaccount-table .row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mini-button.danger-outline {
  background: #fff;
  border-color: #efb4b4;
  color: #b42318;
}

.mini-button.danger-outline:hover {
  background: #fff5f5;
}

.customer-subaccount-dialog-card {
  max-width: min(980px, calc(100vw - 36px));
  width: min(980px, calc(100vw - 36px));
}

.customer-subaccount-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.customer-subaccount-grid label {
  min-width: 0;
}

.customer-subaccount-grid .wide-field {
  grid-column: span 2;
}

.customer-subaccount-grid .full-span {
  grid-column: 1 / -1;
}

.customer-subaccount-grid textarea {
  min-height: 84px;
  resize: vertical;
}

.contact-invoice-history-heading {
  align-items: end;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.contact-invoice-summary-controls {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.contact-invoice-range {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.contact-invoice-range label {
  color: var(--muted);
  display: grid;
  font-size: 10px;
  font-weight: 800;
  gap: 3px;
  text-transform: uppercase;
}

.contact-invoice-range input {
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  min-height: 30px;
  padding: 5px 8px;
  width: 140px;
}

.contact-invoice-total {
  border: 1px solid var(--line);
  border-radius: 6px;
  min-width: 150px;
  padding: 7px 10px;
  text-align: right;
}

.contact-invoice-total span {
  color: var(--muted);
  display: block;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.contact-invoice-total strong {
  display: block;
  font-size: 18px;
  margin-top: 2px;
}

.contact-edit-card .item-edit-card-heading h4 {
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.contact-edit-grid {
  display: grid;
  gap: 10px 12px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  padding: 0;
}

.contact-edit-grid label {
  color: var(--muted);
  display: grid;
  font-size: 11px;
  font-weight: 800;
  gap: 5px;
  grid-column: span 3;
  min-width: 0;
  text-transform: uppercase;
}

.contact-edit-grid .contact-readonly-value {
  color: var(--muted);
  display: grid;
  font-size: 11px;
  font-weight: 800;
  gap: 5px;
  grid-column: span 3;
  min-width: 0;
  text-transform: uppercase;
}

.contact-readonly-value strong {
  color: var(--text);
  display: block;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  min-height: 22px;
  overflow-wrap: anywhere;
  text-transform: none;
}

.contact-readonly-value small {
  text-transform: none;
}

.contact-readonly-tier strong {
  align-items: center;
  display: flex;
  min-height: 26px;
}

.contact-edit-grid .wide-field {
  grid-column: span 6;
}

.contact-edit-grid input,
.contact-edit-grid select {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  min-height: 34px;
  min-width: 0;
  padding: 7px 9px;
  text-transform: none;
  width: 100%;
}

.contact-edit-grid select {
  appearance: auto;
}

.contact-edit-grid input:focus,
.contact-edit-grid select:focus {
  border-color: var(--ink);
  outline: 2px solid rgba(0, 0, 0, 0.08);
  outline-offset: 1px;
}

.contact-edit-grid input[readonly],
.contact-edit-grid select:disabled {
  background: #fafafa;
  border-color: #e6e1dd;
  color: var(--text);
  cursor: default;
}

.contact-edit-grid.terms-grid label:first-child {
  grid-column: span 4;
}

.contact-edit-grid.terms-grid .contact-readonly-value:first-child {
  grid-column: span 4;
}

.contact-edit-grid.terms-grid label:nth-child(2) {
  grid-column: span 2;
}

.contact-edit-grid.terms-grid .contact-readonly-value:nth-child(2) {
  grid-column: span 2;
}

.contact-edit-grid.terms-grid label:nth-child(3),
.contact-edit-grid.terms-grid label:nth-child(4) {
  grid-column: span 3;
}

.contact-edit-grid.terms-grid .contact-readonly-value:nth-child(3),
.contact-edit-grid.terms-grid .contact-readonly-value:nth-child(4) {
  grid-column: span 3;
}

.contact-edit-grid.template-defaults-grid label,
.contact-edit-grid.template-defaults-grid .contact-readonly-value {
  grid-column: span 4;
}

.contact-template-defaults-note {
  margin: 10px 0 0;
}

.tier-helper {
  color: #2d7039;
  display: block;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  margin-top: 2px;
  text-transform: none;
}

.tier-capsule {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  height: 26px;
  justify-content: center;
  min-width: 34px;
  padding: 0 10px;
}

.tier-capsule.tier-1 {
  background: #fff3c4;
  border-color: #e0b64b;
  color: #7d5700;
}

.tier-capsule.tier-2 {
  background: #eceff3;
  border-color: #b7bec7;
  color: #4c5663;
}

.tier-capsule.tier-color-gold {
  background:
    linear-gradient(112deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.82) 28%, rgba(255, 255, 255, 0.08) 38%, rgba(255, 255, 255, 0) 58%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.78) 0%, rgba(255, 245, 189, 0.24) 42%, rgba(128, 79, 0, 0.16) 100%),
    linear-gradient(135deg, #fff4bc 0%, #ffd967 31%, #d69a1e 62%, #8f5f0a 100%);
  border-color: #c4921c;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -1px 0 rgba(93, 57, 0, 0.28), 0 1px 5px rgba(185, 134, 29, 0.2);
  color: #4d3000;
  text-shadow: 0 1px 0 rgba(255, 246, 205, 0.55);
}

.tier-capsule.tier-color-bronze {
  background:
    linear-gradient(112deg, rgba(255, 255, 255, 0) 0%, rgba(255, 235, 199, 0.72) 29%, rgba(255, 255, 255, 0.08) 40%, rgba(255, 255, 255, 0) 60%),
    linear-gradient(180deg, rgba(255, 239, 214, 0.58) 0%, rgba(181, 103, 42, 0.2) 46%, rgba(83, 39, 13, 0.22) 100%),
    linear-gradient(135deg, #f4d2a1 0%, #dc9b54 32%, #a75f2a 66%, #603014 100%);
  border-color: #9b5a25;
  box-shadow: inset 0 1px 0 rgba(255, 239, 214, 0.78), inset 0 -1px 0 rgba(61, 27, 7, 0.28), 0 1px 5px rgba(123, 66, 27, 0.2);
  color: #321706;
  text-shadow: 0 1px 0 rgba(255, 231, 198, 0.45);
}

.tier-capsule.tier-color-silver {
  background:
    linear-gradient(112deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 28%, rgba(255, 255, 255, 0.12) 39%, rgba(255, 255, 255, 0) 60%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(206, 214, 225, 0.28) 43%, rgba(78, 88, 104, 0.16) 100%),
    linear-gradient(135deg, #ffffff 0%, #e7ebf1 28%, #bbc4cf 60%, #7c8796 100%);
  border-color: #aeb8c6;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.96), inset 0 -1px 0 rgba(72, 82, 98, 0.24), 0 1px 5px rgba(76, 86, 99, 0.18);
  color: #28313d;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.tier-capsule.tier-color-copper {
  background:
    linear-gradient(112deg, rgba(255, 255, 255, 0) 0%, rgba(255, 225, 203, 0.72) 28%, rgba(255, 255, 255, 0.08) 39%, rgba(255, 255, 255, 0) 60%),
    linear-gradient(180deg, rgba(255, 225, 203, 0.58) 0%, rgba(198, 93, 54, 0.2) 46%, rgba(89, 30, 16, 0.24) 100%),
    linear-gradient(135deg, #ffd1b4 0%, #e28b60 31%, #b65333 64%, #672414 100%);
  border-color: #a94e31;
  box-shadow: inset 0 1px 0 rgba(255, 231, 214, 0.78), inset 0 -1px 0 rgba(68, 20, 10, 0.3), 0 1px 5px rgba(131, 53, 31, 0.2);
  color: #311006;
  text-shadow: 0 1px 0 rgba(255, 219, 198, 0.48);
}

.tier-capsule.tier-color-diamond {
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 255, 255, 0.82) 24%, rgba(198, 236, 255, 0.7) 38%, rgba(255, 220, 251, 0.72) 52%, rgba(229, 255, 221, 0.66) 66%, rgba(255, 255, 255, 0.9) 100%),
    linear-gradient(135deg, #ffffff 0%, #e7f3ff 45%, #ffffff 100%);
  border-color: #aebdd0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.96), inset 0 -1px 0 rgba(115, 131, 153, 0.18), 0 1px 5px rgba(92, 132, 184, 0.18);
  color: #233142;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.82);
}

.tier-capsule.empty {
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 11px;
  min-width: 0;
}

.contact-edit-card .table-scroll {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.compact-contact-table th,
.compact-contact-table td {
  padding: 10px 12px;
}

.compact-contact-table thead th {
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.compact-contact-table tbody tr + tr {
  border-top: 1px solid var(--line);
}

.compact-pagination {
  margin-top: 8px;
}

.compact-actions {
  margin: 0;
}

.contact-edit-card > .dialog-actions:last-child {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

@media (max-width: 900px) {
  .customer-subaccount-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.invoice-action {
  align-items: center;
  background: transparent;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  height: 38px;
  justify-content: center;
  padding: 0;
  width: 38px;
}

.invoice-action img {
  display: block;
  height: 30px;
  object-fit: contain;
  width: 30px;
}

.invoice-action.invoiced {
  background: transparent;
  border: 0;
  color: #1f6fbf;
  font-size: 1.6rem;
  font-weight: 900;
}

.qb-action {
  align-items: center;
  background: transparent;
  border: 0;
  color: #44515c;
  cursor: pointer;
  display: inline-flex;
  font-size: 1.2rem;
  height: 30px;
  justify-content: center;
  padding: 0;
  width: 30px;
}

.qb-action svg {
  fill: none;
  height: 20px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
  width: 20px;
}

.qb-action.sent {
  color: var(--green);
  font-size: 1.35rem;
  font-weight: 900;
}

.customer-invoice-customer-picker {
  margin: 10px 0 14px;
  max-width: 520px;
}

.customer-invoice-meta-grid {
  grid-template-columns: repeat(4, minmax(140px, 1fr));
}

.integration-panel {
  max-width: none;
  width: 100%;
}

.integration-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 14px;
  padding: 16px;
}

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

.integration-metrics > div,
.integration-metrics > button {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 4px;
  padding: 12px;
}

.integration-metrics > button {
  color: inherit;
  text-align: left;
}

.amazon-fba-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.amazon-integration-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.amazon-summary-action-card:hover,
.amazon-summary-action-card:focus-visible {
  border-color: #f2a8b4;
  box-shadow: 0 10px 24px rgba(17, 17, 17, 0.07);
  outline: none;
}

.integration-metrics span,
.integration-next-steps strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.integration-metrics strong {
  color: var(--ink);
  font-size: 22px;
}

.integration-metrics small,
.integration-next-steps span {
  color: var(--muted);
  line-height: 1.45;
}

.integration-next-steps {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 4px;
  padding: 12px;
}

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

.integration-settings-grid label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 800;
  gap: 5px;
  text-transform: uppercase;
}

.integration-settings-grid input {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  min-height: 34px;
  padding: 0 9px;
}

.integration-settings-grid .wide {
  grid-column: 1 / -1;
}

.toggle-line {
  align-items: center;
  display: grid;
  gap: 4px 10px;
  grid-template-columns: auto 1fr;
}

.toggle-line input {
  height: 18px;
  margin: 0;
  width: 18px;
}

.toggle-line span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  grid-column: 2;
  text-transform: none;
}

.integration-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.integration-actions .subtle {
  margin-right: auto;
}

.integration-actions.compact {
  justify-content: flex-end;
}

.sales-channel-panel {
  max-width: none;
  width: 100%;
}

.sales-channel-toolbar {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 14px 16px;
}

.sales-channel-toolbar h3,
.sales-channel-empty-card h3 {
  margin: 0;
}

.amazon-fba-summary {
  margin-bottom: 12px;
}

.amazon-sales-tabs {
  margin-bottom: 12px;
}

.amazon-sales-panel {
  display: grid;
  gap: 12px;
}

.amazon-sales-channel-filter-row {
  margin-bottom: 12px;
}

.amazon-sales-sync-status {
  margin-top: 10px;
}

.amazon-fba-listing-item {
  align-items: flex-start;
  display: flex;
  gap: 10px;
  min-width: 0;
}

.amazon-fba-row-checkbox {
  flex: 0 0 auto;
  height: 16px;
  margin: 2px 0 0;
  width: 16px;
}

.amazon-fba-listing-copy {
  min-width: 0;
}

.amazon-fba-listing-copy strong {
  display: block;
}

.amazon-fba-sort-header {
  min-width: 0;
  text-align: right;
  white-space: normal;
}

.amazon-fba-sort-header:hover,
.amazon-fba-sort-header:focus-visible {
  color: var(--ink);
  outline: none;
}

.amazon-report-import-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  margin: 14px 0;
  padding: 14px;
}

.amazon-report-import-card h4 {
  margin: 0;
}

.amazon-report-import-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.file-upload-action {
  cursor: pointer;
}

.amazon-import-summary {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.amazon-import-summary strong {
  color: var(--ink);
  display: block;
  font-size: 13px;
}

.amazon-unmatched-panel {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  padding-top: 12px;
}

.amazon-fba-table th,
.amazon-fba-table td,
.amazon-fba-shipments-table th,
.amazon-fba-shipments-table td,
.amazon-mapping-table th,
.amazon-mapping-table td,
.amazon-unmatched-table th,
.amazon-unmatched-table td {
  white-space: nowrap;
}

.amazon-fba-table thead th {
  background: var(--surface);
  box-shadow: 0 1px 0 var(--line), 0 6px 12px rgba(17, 17, 17, 0.04);
  position: sticky;
  top: 0;
  z-index: 4;
}

.amazon-fba-table td:nth-child(2),
.amazon-fba-shipments-table td:first-child,
.amazon-unmatched-table td:nth-child(3),
.amazon-unmatched-table td:nth-child(6) {
  min-width: 260px;
  white-space: normal;
}

.amazon-mapping-table td:first-child,
.amazon-mapping-table td:nth-child(4) {
  min-width: 220px;
  white-space: normal;
}

.amazon-mapping-table td:nth-child(2),
.amazon-mapping-table th:nth-child(2) {
  min-width: 104px;
  width: 104px;
}

.amazon-mapping-table td:nth-child(4) {
  min-width: 280px;
}

.amazon-mapping-input-stack {
  display: grid;
  gap: 6px;
  min-width: 180px;
  position: relative;
}

.amazon-mapping-input-stack input,
.amazon-listing-status-select,
.compact-number-input {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  min-height: 34px;
  padding: 0 9px;
  width: 100%;
}

.amazon-listing-status-select {
  min-width: 98px;
}

.amazon-listing-status-select.status-flipping_to_fbm {
  border-color: #f2c36f;
  color: var(--amber);
  font-weight: 800;
}

.compact-number-input {
  min-width: 82px;
}

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

.dymo-preview-field {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 4px;
  padding: 10px;
}

.dymo-preview-field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.dymo-preview-field strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.quickbooks-mapping-panel {
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 12px;
  padding: 14px;
}

.quickbooks-settings-tabs {
  margin-top: 2px;
}

.quickbooks-mapping-type-tabs {
  margin-top: -2px;
}

.quickbooks-settings-panel {
  display: grid;
  gap: 14px;
}

.quickbooks-mapping-type-panel {
  display: grid;
  gap: 14px;
}

.shipstation-settings-panel {
  display: grid;
  gap: 14px;
}

.mapping-panel-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.shipstation-sync-grid {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(160px, 220px)) auto;
}

.shipstation-sync-grid label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 800;
  gap: 5px;
  text-transform: uppercase;
}

.shipstation-sync-grid input,
.shipstation-mapping-table input {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 34px;
  padding: 0 9px;
}

.shipstation-mapping-table input {
  width: 100%;
}

.shipstation-reconciliation-table {
  min-width: 1120px;
}

.shipstation-reconciliation-table th {
  vertical-align: top;
}

.shipstation-date-filter-stack {
  display: grid;
  gap: 4px;
  margin-top: 5px;
}

.shipstation-reconciliation-table .column-filter-control {
  margin-top: 5px;
  min-height: 28px;
  min-width: 128px;
  width: 100%;
}

#shipstationMappingDialog {
  width: min(1440px, 80vw);
}

.shipstation-mapping-dialog-card {
  max-width: none;
  width: 100%;
}

.shipstation-map-flow {
  align-items: start;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}

.shipstation-map-flow label {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.shipstation-map-flow input {
  width: 100%;
}

.shipstation-map-arrow {
  align-items: center;
  color: var(--ink);
  display: flex;
  height: 48px;
  justify-content: center;
  margin-top: 24px;
  min-width: 48px;
}

.shipstation-map-arrow svg {
  fill: none;
  height: 30px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
  width: 30px;
}

.shipstation-map-match-list {
  max-height: min(48vh, 440px);
  overflow: auto;
}

.reconciliation-action-header {
  align-items: flex-start;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  min-width: 138px;
}

.reconciliation-action-header .mini-button {
  min-height: 30px;
  white-space: nowrap;
}

.shipstation-approve-progress {
  align-items: center;
  background: transparent;
  border: 0;
  box-shadow: none;
  display: grid;
  gap: 7px;
  opacity: 0;
  padding: 0;
  pointer-events: none;
  position: fixed;
  bottom: 28px;
  right: 28px;
  transform: translateY(14px);
  transition: opacity 180ms ease, transform 220ms ease;
  width: 96px;
  z-index: 9998;
}

.shipstation-approve-progress.active {
  opacity: 1;
  transform: translateY(0);
}

.shipstation-approve-progress.hiding {
  opacity: 0;
  transform: translateY(14px);
}

.shipstation-approve-progress-label {
  color: var(--ink);
  font-size: 10px;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
}

.shipstation-approve-progress-track {
  background: rgba(255, 244, 244, 0.82);
  border: 1px solid rgba(226, 125, 145, 0.45);
  border-radius: 999px;
  height: 132px;
  justify-self: center;
  overflow: hidden;
  position: relative;
  width: 14px;
}

.shipstation-approve-progress-fill {
  background: linear-gradient(180deg, #ffd5dd 0%, var(--pink) 42%, #e27d91 100%);
  border-radius: 999px;
  bottom: 0;
  height: 0;
  left: 0;
  position: absolute;
  transition: height 180ms ease;
  width: 100%;
}

.shipstation-approve-progress.complete .shipstation-approve-progress-fill {
  background: linear-gradient(180deg, #ffd5dd 0%, var(--pink) 42%, #e27d91 100%);
}

.shipstation-approve-progress-count {
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9);
}

.shipstation-approve-progress-detail {
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9);
}

.quickbooks-mapping-search {
  max-width: 520px;
}

.mapping-filter-row {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.mapping-view-filter {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 800;
  gap: 6px;
  text-transform: uppercase;
}

.mapping-view-filter select {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  min-height: 36px;
  min-width: 190px;
  padding: 0 10px;
}

@media (max-width: 760px) {
  .shipstation-map-flow {
    grid-template-columns: 1fr;
  }

  .shipstation-map-arrow {
    margin-top: 0;
    transform: rotate(90deg);
    width: 48px;
  }
}

.quickbooks-manual-mapping-table,
.shipstation-mapping-table {
  min-width: 1040px;
  table-layout: fixed;
}

.quickbooks-log-table {
  min-width: 1180px;
  table-layout: fixed;
}

.quickbooks-log-table th:nth-child(1),
.quickbooks-log-table td:nth-child(1) { width: 14%; }

.quickbooks-log-table th:nth-child(2),
.quickbooks-log-table td:nth-child(2) { width: 12%; }

.quickbooks-log-table th:nth-child(3),
.quickbooks-log-table td:nth-child(3) { width: 14%; }

.quickbooks-log-table th:nth-child(4),
.quickbooks-log-table td:nth-child(4) { width: 20%; }

.quickbooks-log-table th:nth-child(5),
.quickbooks-log-table td:nth-child(5) { width: 10%; }

.quickbooks-log-table th:nth-child(6),
.quickbooks-log-table td:nth-child(6) { width: 20%; }

.quickbooks-log-table th:nth-child(7),
.quickbooks-log-table td:nth-child(7) { width: 6%; }

.quickbooks-log-table th:nth-child(8),
.quickbooks-log-table td:nth-child(8) {
  text-align: right;
  width: 4%;
}

.quickbooks-log-table td {
  vertical-align: top;
}

.quickbooks-log-detail {
  color: var(--muted);
  line-height: 1.35;
}

.quickbooks-log-table .mini-button {
  margin-top: 6px;
}

/* Its own widths rather than the mapping table's — that one is tuned for a
   SKU column, and the purpose column here needs room for the help line. */
.quickbooks-chart-table {
  min-width: 760px;
  table-layout: fixed;
}

.quickbooks-chart-table th:nth-child(1),
.quickbooks-chart-table td:nth-child(1) { width: 40%; }

.quickbooks-chart-table th:nth-child(2),
.quickbooks-chart-table td:nth-child(2) { width: 44%; }

.quickbooks-chart-table th:nth-child(3),
.quickbooks-chart-table td:nth-child(3) { width: 16%; }

.quickbooks-chart-table select {
  width: 100%;
  max-width: 100%;
}

.quickbooks-manual-mapping-table th:first-child,
.quickbooks-manual-mapping-table td:first-child,
.shipstation-mapping-table th:first-child,
.shipstation-mapping-table td:first-child {
  width: 34%;
}

.quickbooks-manual-mapping-table th:nth-child(2),
.quickbooks-manual-mapping-table td:nth-child(2),
.shipstation-mapping-table th:nth-child(2),
.shipstation-mapping-table td:nth-child(2) {
  width: 44%;
}

.quickbooks-manual-mapping-table th:nth-child(3),
.quickbooks-manual-mapping-table td:nth-child(3),
.shipstation-mapping-table th:nth-child(3),
.shipstation-mapping-table td:nth-child(3) {
  width: 22%;
}

.quickbooks-customer-mapping-table th:first-child,
.quickbooks-customer-mapping-table td:first-child {
  width: 36%;
}

.quickbooks-customer-mapping-table th:nth-child(2),
.quickbooks-customer-mapping-table td:nth-child(2) {
  width: 42%;
}

.quickbooks-customer-mapping-table th:nth-child(3),
.quickbooks-customer-mapping-table td:nth-child(3) {
  width: 22%;
}

.quickbooks-manual-mapping-table input {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 34px;
  padding: 0 9px;
  width: 100%;
}

.mapping-input-cell {
  align-items: center;
  display: flex;
  gap: 8px;
  min-width: 0;
  position: relative;
}

.mapping-input-cell input {
  flex: 1;
  min-width: 0;
}

.mapping-input-cell .mapping-suggestion-list,
.amazon-mapping-input-stack .mapping-suggestion-list {
  left: 0;
  margin-top: 0;
  max-height: 220px;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 45;
}

.mapping-suggestion-option strong {
  color: var(--ink);
}

.mapping-suggestion-empty {
  padding: 8px;
}

.platform-sku-cell {
  align-items: center;
  display: inline-flex;
  gap: 7px;
  max-width: 100%;
}

.mapping-mismatch-icon {
  align-items: center;
  background: #fff7ed;
  border: 1px solid #f97316;
  border-radius: 999px;
  color: #9a3412;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 900;
  height: 18px;
  justify-content: center;
  line-height: 1;
  width: 18px;
}

.quickbooks-map-meta {
  color: var(--muted);
  display: block;
  font-size: 11px;
  margin-top: 3px;
}

.sync-message.unsaved {
  color: #9a3412;
  font-weight: 800;
}

.mapping-panel-header {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.mapping-panel-header h4 {
  margin: 0;
}

.quickbooks-record-summary,
.quickbooks-mapping-summary {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.quickbooks-record-types {
  margin: 0;
}

.quickbooks-match-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.quickbooks-match-grid > div {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.quickbooks-match-grid span {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.quickbooks-match-grid strong {
  color: var(--ink);
  display: block;
  font-size: 20px;
  margin-top: 3px;
}

.quickbooks-unmatched-list {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 6px;
  color: #9a3412;
  margin-top: 10px;
  padding: 10px 12px;
}

.quickbooks-unmatched-list ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.qb-action.sending {
  color: #1d3557;
  cursor: wait;
  overflow: visible;
}

.qb-plane-loader {
  display: inline-block;
  height: 30px;
  overflow: visible;
  position: relative;
  width: 34px;
}

.qb-action .qb-plane-loader-icon {
  animation: qbPlaneFlight 1.05s cubic-bezier(0.37, 0, 0.63, 1) infinite;
  filter: drop-shadow(0 3px 3px rgba(29, 53, 87, 0.2));
  height: 24px;
  left: 4px;
  position: absolute;
  top: 2px;
  transform-origin: 55% 55%;
  width: 30px;
}

.qb-plane-loader-shadow {
  animation: qbPlaneShadow 1.05s ease-in-out infinite;
  background: rgba(29, 53, 87, 0.18);
  border-radius: 999px;
  bottom: 1px;
  display: block;
  filter: blur(1px);
  height: 4px;
  left: 10px;
  position: absolute;
  width: 16px;
}

.qb-plane-loader-dot {
  animation: qbPlaneTrail 1.05s ease-in-out infinite;
  background: #4cc9f0;
  border-radius: 999px;
  box-shadow: 0 0 5px rgba(76, 201, 240, 0.45);
  height: 4px;
  left: 5px;
  position: absolute;
  top: 15px;
  width: 4px;
}

.qb-plane-loader-dot.dot-two {
  animation-delay: 0.18s;
  height: 3px;
  left: 1px;
  top: 18px;
  width: 3px;
}

@keyframes qbPlaneFlight {
  0% {
    transform: translate(-5px, 3px) rotate(-18deg) scale(0.9);
  }

  32% {
    transform: translate(2px, -1px) rotate(-7deg) scale(1.02);
  }

  64% {
    transform: translate(7px, -4px) rotate(16deg) scale(1.06);
  }

  100% {
    transform: translate(-5px, 3px) rotate(-18deg) scale(0.9);
  }
}

@keyframes qbPlaneTrail {
  0% {
    opacity: 0;
    transform: translate(10px, 1px) scale(0.6);
  }

  25% {
    opacity: 0.8;
  }

  100% {
    opacity: 0;
    transform: translate(-10px, 5px) scale(0.25);
  }
}

@keyframes qbPlaneShadow {
  0%,
  100% {
    opacity: 0.12;
    transform: translateX(-2px) scaleX(0.72);
  }

  54% {
    opacity: 0.28;
    transform: translateX(4px) scaleX(1.05);
  }
}

.distributor-match-list {
  margin-top: 10px;
  position: static;
}

@media (max-width: 980px) {
  .customer-order-card .new-po-meta-grid,
  .customer-invoice-meta-grid,
  .integration-metrics,
  .integration-settings-grid,
  .quickbooks-match-grid,
  .customer-order-address-grid,
  .contact-edit-grid,
  .customer-order-total-actions {
    grid-template-columns: 1fr;
  }

  .contact-edit-grid label {
    grid-column: auto;
  }

  .contact-edit-grid .wide-field {
    grid-column: auto;
  }

  .customer-order-lines-heading {
    display: none;
  }
}

.item-dialog-card label {
  font-size: 10px;
  gap: 4px;
}

.item-dialog-card input,
.item-dialog-card select {
  min-height: 28px;
  padding: 4px 7px;
}

.item-identity-grid .full-span {
  grid-column: span 2;
}

.vendor-contact-table table {
  min-width: 1040px;
}

.vendor-contact-table th:first-child,
.vendor-contact-table td:first-child {
  width: 82px;
}

.vendor-contact-table th:nth-child(2),
.vendor-contact-table td:nth-child(2) {
  min-width: 190px;
}

.vendor-contact-table th:nth-child(4),
.vendor-contact-table td:nth-child(4) {
  min-width: 180px;
}

.vendor-contact-table th:nth-child(8),
.vendor-contact-table td:nth-child(8) {
  min-width: 210px;
}

.vendor-contact-table th select {
  font-size: 11px;
  margin-top: 4px;
  min-height: 28px;
  padding: 0 6px;
  width: 100%;
}

.vendor-type-pill {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  display: inline-flex;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.1;
  max-width: 76px;
  padding: 4px 6px;
  text-transform: uppercase;
  white-space: normal;
}

.vendor-email-stack {
  display: grid;
  font-size: 11px;
  gap: 2px;
  line-height: 1.25;
}

.vendor-email-stack a {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.vendor-preferred-note {
  color: var(--green);
  display: block;
  font-size: 10px;
  font-weight: 700;
  margin-top: 2px;
  text-transform: uppercase;
}

.vendor-description-cell {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  white-space: normal;
}

.preferred-vendor-row {
  background: rgba(155, 201, 137, 0.09);
}

table {
  border-collapse: collapse;
  font-size: 12px;
  min-width: 100%;
  width: 100%;
}

th {
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  padding: 7px 8px;
  text-align: left;
  text-transform: uppercase;
}

.column-filter-row th {
  background: var(--surface-alt);
  padding: 6px;
}

.column-filter-row input,
.column-filter-row select {
  font-size: 12px;
  min-height: 30px;
  padding: 0 8px;
  width: 100%;
}

td {
  border-top: 1px solid var(--line);
  padding: 7px 8px;
  vertical-align: middle;
}

tr:first-child td {
  border-top: 0;
}

.sku {
  color: var(--ink);
  font-weight: 700;
  white-space: nowrap;
}

.item-name {
  min-width: 140px;
}

.item-link {
  background: transparent;
  border: 0;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  padding: 0;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: var(--pink);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  white-space: normal;
}

.item-link:hover {
  text-decoration-color: var(--ink);
}

tr.row-highlight {
  outline: 2px solid var(--pink);
  outline-offset: -2px;
}

.muted {
  color: var(--muted);
}

.num {
  text-align: right;
  white-space: nowrap;
}

.mini-input {
  max-width: 92px;
}

.quick-count {
  align-items: center;
  display: flex;
  gap: 5px;
}

.quick-count input {
  width: 72px;
}

.split-cell {
  display: grid;
  gap: 3px;
}

.delta.bad {
  color: var(--red);
  font-weight: 700;
}

.delta.good {
  color: var(--green);
  font-weight: 700;
}

.po-lines {
  display: grid;
  gap: 0;
  overflow-x: auto;
}

.po-line {
  align-items: center;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 6px;
  grid-template-columns: 96px minmax(190px, 1fr) repeat(3, minmax(74px, 96px)) minmax(88px, 110px) minmax(92px, 118px);
  min-width: 760px;
  padding: 8px 10px;
}

.po-line:first-child {
  border-top: 0;
}

.po-line input {
  width: 100%;
}

.po-line-meta {
  color: var(--muted);
  display: block;
  font-size: 10px;
  line-height: 1.25;
  margin-top: 2px;
}

.po-block.collapsed .po-header {
  border-bottom: 2px solid #2d2d2d;
}

.po-toggle-icon {
  align-items: center;
  background: transparent;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  height: 26px;
  justify-content: center;
  min-height: 26px;
  padding: 0;
  width: 26px;
}

.po-toggle-triangle {
  height: 0;
  width: 0;
}

.po-line-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.po-block.collapsed .po-toggle-triangle {
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid var(--ink);
}

.po-block:not(.collapsed) .po-toggle-triangle {
  border-bottom: 8px solid var(--ink);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
}

.po-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.settings-flags {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 220px;
}

.settings-flags label {
  align-items: center;
  display: inline-flex;
  gap: 4px;
  white-space: nowrap;
}

.settings-flags input {
  min-height: auto;
}

.settings-status-control select {
  min-height: 30px;
  min-width: 170px;
  padding: 0 8px;
}

.erp-settings-section {
  display: grid;
  gap: 12px;
}

.erp-settings-tabs {
  align-self: start;
  flex-wrap: wrap;
  overflow-x: hidden;
}

.erp-settings-panels {
  display: grid;
  gap: 12px;
}

.erp-settings-section h4 {
  font-size: 14px;
  margin: 0 0 4px;
}

.erp-settings-heading-row {
  align-items: start;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

.compact-button {
  min-height: 34px;
  padding: 7px 12px;
}

.erp-category-list {
  display: grid;
  gap: 8px;
  max-height: min(48vh, 420px);
  overflow: auto;
}

.erp-category-row {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.erp-price-tier-table-wrap {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow-x: hidden;
  overflow-y: visible;
  width: 100%;
}

.erp-price-tier-table {
  border-collapse: collapse;
  min-width: 0;
  table-layout: fixed;
  width: 100%;
}

.erp-price-tier-table th,
.erp-price-tier-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
  overflow-wrap: anywhere;
  white-space: normal;
}

.erp-price-tier-table tr:last-child td {
  border-bottom: 0;
}

.erp-price-tier-table td:first-child {
  display: grid;
  gap: 2px;
}

.price-tier-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.price-tier-discount-input {
  max-width: 110px;
  min-height: 34px;
  width: 100%;
}

#priceTierEditorDialog {
  width: min(1200px, calc(100vw - 40px));
}

.price-tier-editor-card {
  gap: 14px;
  width: 100%;
}

.price-tier-editor-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.price-tier-editor-grid > label {
  grid-column: span 2;
}

.price-tier-type-field,
.price-tier-color-field {
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 10px;
}

.price-tier-type-field {
  grid-column: span 2;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.price-tier-color-field {
  grid-column: span 4;
}

.price-tier-type-field legend,
.price-tier-color-field legend {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  padding: 0 4px;
  text-transform: uppercase;
}

.price-tier-color-options {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
}

.price-tier-color-option {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: inline-flex;
  gap: 8px;
  justify-content: flex-start;
  min-height: 36px;
  padding: 7px 9px;
  text-transform: none;
}

.price-tier-color-option input {
  min-height: 0;
}

.price-tier-color-option:has(input:checked) {
  border-color: #ff9caf;
  box-shadow: 0 0 0 2px rgba(255, 156, 175, 0.16);
}

.price-tier-advanced-builder {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
}

.price-tier-builder-heading h4 {
  margin: 0 0 4px;
}

.price-tier-builder-heading {
  align-items: start;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
}

.price-tier-order-minimum {
  display: grid;
  gap: 5px;
}

.price-tier-order-minimum small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.25;
  text-transform: none;
}

.price-tier-builder-layout {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(360px, 0.46fr) minmax(0, 1fr);
}

.price-tier-target-browser,
.price-tier-rule-panel {
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 10px;
  min-height: 420px;
  padding: 12px;
}

.price-tier-target-browser {
  align-content: start;
  max-height: min(62vh, 680px);
  overflow: auto;
}

.price-tier-rule-panel {
  max-height: min(62vh, 680px);
  overflow: auto;
}

.price-tier-all-products {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.price-tier-category-targets,
.price-tier-rule-rows {
  display: grid;
  gap: 10px;
}

.price-tier-category-target {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.price-tier-category-head {
  align-items: center;
  background: var(--surface-alt);
  display: grid;
  gap: 8px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  padding: 8px;
}

.price-tier-category-head small,
.price-tier-target-item small,
.price-tier-target-overflow {
  color: var(--muted);
  font-size: 11px;
}

.price-tier-target-items {
  display: grid;
  gap: 6px;
  padding: 8px;
}

.price-tier-target-item {
  align-items: start;
  border: 1px solid transparent;
  border-radius: 6px;
  display: grid;
  gap: 8px;
  grid-template-columns: auto minmax(0, 1fr);
  padding: 6px;
  text-transform: none;
}

.price-tier-target-item:hover {
  border-color: var(--line);
  background: var(--surface-alt);
}

.price-tier-rule-row {
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.price-tier-rule-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.price-tier-rule-head > div {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.price-tier-breaks {
  display: grid;
  gap: 8px;
}

.price-tier-break-row {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(140px, 0.38fr) minmax(140px, 0.38fr) auto;
}

.price-tier-empty,
.price-tier-target-overflow {
  background: var(--surface-alt);
  border-radius: 6px;
  color: var(--muted);
  padding: 10px;
}

@media (max-width: 980px) {
  #priceTierEditorDialog {
    width: min(760px, calc(100vw - 24px));
  }

  .price-tier-editor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .price-tier-editor-grid > label,
  .price-tier-type-field,
  .price-tier-color-field {
    grid-column: span 2;
  }

  .price-tier-builder-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .price-tier-builder-heading {
    grid-template-columns: minmax(0, 1fr);
  }

  .price-tier-target-browser,
  .price-tier-rule-panel {
    max-height: none;
    min-height: 0;
  }
}

@media (max-width: 560px) {
  #priceTierEditorDialog {
    width: calc(100vw - 18px);
  }

  .price-tier-editor-card {
    padding: 14px;
  }

  .price-tier-editor-grid,
  .price-tier-type-field {
    grid-template-columns: minmax(0, 1fr);
  }

  .price-tier-editor-grid > label,
  .price-tier-type-field,
  .price-tier-color-field {
    grid-column: span 1;
  }

  .price-tier-break-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

dialog {
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 0;
  width: min(460px, calc(100vw - 28px));
}

dialog,
dialog * {
  box-sizing: border-box;
  min-width: 0;
}

dialog .dialog-card {
  max-width: 100%;
  overflow-x: hidden;
}

#erpSettingsDialog {
  width: min(980px, calc(100vw - 24px));
}

#itemDialog {
  width: min(1320px, calc(100vw - 18px));
}

.item-dialog-card {
  gap: 8px;
  max-height: min(94vh, 940px);
  overflow: auto;
  padding: 12px;
  scroll-behavior: auto;
}

.item-edit-sections {
  display: grid;
  gap: 8px;
}

.item-edit-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 8px;
  padding: 9px 10px;
}

.item-edit-card-heading {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.item-edit-card-heading h4 {
  font-size: 12px;
  letter-spacing: 0;
  margin: 0;
}

.item-identity-layout {
  align-items: start;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) minmax(170px, 220px);
}

.item-identity-grid {
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.item-identity-grid .full-span {
  grid-column: span 2;
}

.item-dialog-card label {
  font-size: 10px;
  gap: 4px;
}

.item-dialog-card input,
.item-dialog-card select {
  min-height: 28px;
  padding: 4px 7px;
}

.item-identity-toggle-list {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 0;
  overflow: hidden;
}

.item-identity-toggle-list.full-span {
  grid-column: 1 / -1;
}

.item-toggle-row {
  align-items: center;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  font-size: 11px;
  font-weight: 800;
  gap: 14px;
  justify-content: space-between;
  letter-spacing: 0;
  line-height: 1.2;
  min-height: 44px;
  padding: 10px 12px;
  position: relative;
  text-transform: none;
  transition: background-color 0.16s ease, color 0.16s ease;
  user-select: none;
}

.item-toggle-row + .item-toggle-row {
  border-top: 1px solid var(--line);
}

.item-toggle-row:hover {
  background: var(--surface-alt);
}

.item-toggle-label {
  min-width: 0;
}

.item-toggle-row input {
  height: 1px;
  min-height: auto;
  opacity: 0;
  padding: 0;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
}

.item-toggle-switch {
  background: #e5e7eb;
  border: 1px solid #c8ccd2;
  border-radius: 999px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
  flex: 0 0 auto;
  height: 22px;
  position: relative;
  transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
  width: 42px;
}

.item-toggle-switch::after {
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  content: "";
  height: 16px;
  left: 2px;
  position: absolute;
  top: 2px;
  transition: transform 0.16s ease;
  width: 16px;
}

.item-toggle-row:has(input:checked) {
  color: var(--ink);
}

.item-toggle-row input:checked + .item-toggle-switch {
  background: var(--pink);
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(255, 154, 172, 0.16);
}

.item-toggle-row input:checked + .item-toggle-switch::after {
  transform: translateX(20px);
}

.item-toggle-row:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  z-index: 1;
}

.reorder-star-marker {
  color: #d99a00;
  display: inline-block;
  font-size: 13px;
  line-height: 1;
  margin-left: 4px;
  vertical-align: baseline;
}

.commercial-grid {
  align-items: end;
  grid-template-columns: minmax(130px, 190px) minmax(0, 1fr);
}

.future-price-note {
  align-self: center;
  color: var(--muted);
  font-size: 12px;
}

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

.conversion-column {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 7px;
  padding: 8px;
}

.conversion-grid small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-transform: none;
}

.conversion-subvalue {
  color: var(--muted);
  display: block;
  font-size: 10px;
  font-weight: 700;
  margin-top: 2px;
  text-transform: none;
}

#itemPurchaseUnitCostDisplay {
  background: #f7f7f7;
  color: var(--muted);
}

.inventory-planning-grid {
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.catalog-edit-grid {
  align-items: start;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
}

.catalog-description-field {
  display: grid;
  gap: 5px;
}

.catalog-description-field > span,
.catalog-banner-swatches legend {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.catalog-editor-toolbar {
  align-items: center;
  display: flex;
  gap: 5px;
}

.catalog-editor-toolbar .icon-only {
  align-items: center;
  display: inline-flex;
  height: 28px;
  justify-content: center;
  min-height: 28px;
  padding: 0;
  width: 30px;
}

.catalog-description-editor {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.4;
  max-height: 150px;
  min-height: 96px;
  overflow: auto;
  padding: 8px;
  text-transform: none;
}

.catalog-description-editor:focus {
  border-color: var(--ink);
  outline: 2px solid rgba(173, 107, 121, 0.16);
}

.catalog-description-editor p {
  margin: 0 0 8px;
}

.catalog-description-editor ul,
.catalog-description-editor ol {
  margin: 6px 0;
  padding-left: 18px;
}

.catalog-banner-settings {
  display: grid;
  gap: 8px;
}

.catalog-banner-swatches {
  border: 0;
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.catalog-banner-swatches legend {
  flex: 0 0 100%;
  margin-bottom: 2px;
}

.catalog-color-swatch {
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55);
  height: 28px;
  padding: 0;
  width: 28px;
}

.catalog-color-swatch[aria-pressed="true"] {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px rgba(17, 17, 17, 0.12), inset 0 0 0 2px rgba(255, 255, 255, 0.6);
}

.swatch-yellow { background: #f5ca4b; }
.swatch-green { background: #2c8b53; }
.swatch-orange { background: #dc6d23; }
.swatch-blue { background: #256aa8; }

@media (max-width: 760px) {
  .catalog-edit-grid {
    grid-template-columns: 1fr;
  }

  .catalog-banner-swatches {
    flex-wrap: wrap;
  }
}

.vendor-planning-row {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.tones-manufactured-check {
  align-items: center;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: inline-flex !important;
  gap: 7px !important;
  min-height: 30px;
  padding: 6px 8px;
  white-space: nowrap;
}

.tones-manufactured-check input {
  min-height: auto;
  width: auto;
}

.tones-manufactured-input {
  background: #f6f6f6;
  color: #737373;
}

.stock-lots-heading {
  align-items: end;
}

.stock-lot-total {
  align-items: end;
  display: grid;
  gap: 2px;
  justify-items: end;
}

.stock-lot-total span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.stock-lot-total strong {
  font-size: 15px;
}

.stock-lot-table {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.stock-lot-table table {
  border-collapse: collapse;
  width: 100%;
}

.stock-lot-table th,
.stock-lot-table td {
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

.stock-lot-table th {
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.stock-lot-table tr:last-child td {
  border-bottom: 0;
}

.stock-lot-empty {
  color: var(--muted);
  text-align: center;
}

.stock-lot-edit-button {
  background: #eaf4ff;
  border-color: #9dccf7;
  color: #1f5f99;
}

#itemStockLotDialog {
  max-width: calc(100vw - 32px);
  overflow-x: hidden;
  width: min(1040px, 88vw);
}

#itemStockLotDialog .stock-lot-dialog-card {
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
  width: 100%;
}

#itemStockLotDialog .dialog-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
}

#itemStockLotDialog label,
#itemStockLotDialog input {
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
}

.item-hidden-fields {
  display: none !important;
}

#poDialog {
  width: min(1660px, calc(100vw - 28px));
}

#usersDialog,
#syncDialog {
  width: min(980px, calc(100vw - 28px));
}

#formulaDialog {
  width: min(1120px, calc(100vw - 28px));
}

#formulaEditDialog {
  width: min(1680px, calc(100vw - 18px));
}

.formula-edit-dialog-card {
  gap: 10px;
  max-height: min(95vh, 980px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 14px;
  width: 100%;
}

.formula-edit-grid {
  display: grid;
  gap: 9px;
  grid-template-columns:
    minmax(260px, 1.4fr)
    minmax(140px, 0.55fr)
    minmax(130px, 0.5fr)
    minmax(520px, 2.5fr)
    minmax(90px, 0.35fr)
    minmax(110px, 0.45fr);
}

.formula-edit-grid label {
  min-width: 0;
}

.formula-edit-name-field {
  grid-column: 1;
}

.formula-edit-category-field {
  grid-column: 2;
}

.formula-edit-status-field {
  grid-column: 3;
}

.formula-edit-result-field {
  grid-column: 4;
}

.formula-edit-yield-field {
  grid-column: 5;
}

.formula-edit-yield-unit-field {
  grid-column: 6;
}

.formula-edit-default-location-field {
  grid-column: 4 / 7;
}

#formulaEditCategoryWrap[hidden] ~ .formula-edit-status-field {
  grid-column: 2;
}

#formulaEditCategoryWrap[hidden] ~ .formula-edit-result-field {
  grid-column: 3 / 5;
}

.formula-edit-result-picker,
.formula-edit-picker {
  position: relative;
}

.formula-edit-result-picker input,
.formula-edit-picker input {
  width: 100%;
}

.formula-edit-components-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 10px;
}

.formula-edit-section-heading {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.formula-edit-section-heading h4 {
  font-size: 16px;
  margin: 2px 0 0;
}

.formula-edit-component-header,
.formula-edit-component-row {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(560px, 2.4fr) minmax(120px, 0.45fr) minmax(120px, 0.42fr) minmax(90px, 0.32fr) 36px;
  min-width: 0;
}

.formula-edit-component-header {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.formula-edit-component-rows {
  display: grid;
  gap: 6px;
}

.formula-edit-component-footer {
  display: flex;
  justify-content: flex-start;
  padding-top: 4px;
}

.formula-edit-actions {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.formula-edit-component-row {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px;
}

.formula-edit-suggestions {
  grid-column: auto;
  left: 0;
  max-height: 260px;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
}

.formula-edit-component-row .formula-edit-suggestions {
  top: calc(100% + 3px);
}

#workOrderDialog {
  width: min(1120px, calc(100vw - 28px));
}

.receiving-panel {
  display: grid;
  gap: 12px;
}

.receiving-record {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  padding: 16px;
}

.receiving-topbar,
.receiving-title,
.receiving-actions {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.receiving-title h3 {
  font-size: 24px;
  margin: 0;
}

.receiving-id {
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 700;
  padding: 8px 10px;
}

.receiving-instruction {
  background: var(--surface-alt);
  border-left: 3px solid var(--text);
  color: var(--muted);
  margin: 0;
  padding: 10px 12px;
}

.receiving-meta-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.receiving-meta-grid > div,
.receiving-meta-grid label {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 5px;
  padding: 10px;
}

.receiving-meta-grid span,
.receiving-signature-card span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.status-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 9px;
  text-transform: uppercase;
}

.status-pill.stable {
  background: var(--green-soft);
  border-color: #bcdcb7;
  color: var(--green);
}

.status-pill.draft {
  background: var(--amber-soft);
  border-color: #f1d6a6;
  color: var(--amber);
}

.status-pill.sent {
  background: var(--blue-soft);
  border-color: #b8d2e6;
  color: var(--blue);
}

.status-pill.accepted {
  background: var(--green-soft);
  border-color: #bcdcb7;
  color: var(--green);
}

.status-pill.rejected {
  background: var(--red-soft);
  border-color: #f3b9b5;
  color: var(--red);
}

.status-pill.archived {
  background: var(--surface-alt);
  border-color: var(--line);
  color: var(--muted);
}

.status-pill.ordered {
  background: var(--amber-soft);
  border-color: #f1d6a6;
  color: var(--amber);
}

.status-pill.preorder {
  background: #f0e7ff;
  border-color: #d3b9ff;
  color: #6d35b8;
}

.status-pill.bo-type-backorder {
  background: #eef7ff;
  border-color: #b9daf3;
  color: #1f5f88;
}

.status-pill.bo-type-presale {
  background: #fff2cf;
  border-color: #f1d183;
  color: #88620d;
}

.status-pill.bo-type-fulfilled {
  background: var(--green-soft);
  border-color: #bcdcb7;
  color: var(--green);
}

.home-fg-oos-backorder-badge {
  text-decoration: none;
}

.home-fg-oos-backorder-badge:hover {
  border-color: #7db8df;
  color: #174a6d;
}

@keyframes boPresaleRouteFlash {
  0%, 100% {
    background: transparent;
  }
  30%, 70% {
    background: #fff5bf;
  }
}

.bo-presale-route-highlight > td {
  animation: boPresaleRouteFlash 1.25s ease-in-out 3;
}

.bo-presale-table,
.bo-presale-detail-table,
.bo-presale-preview-table {
  min-width: 1080px;
}

.bo-presale-table td,
.bo-presale-detail-table td,
.bo-presale-preview-table td {
  vertical-align: top;
}

.bo-presale-actions {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  position: relative;
}

.bo-presale-action-menu {
  position: relative;
}

.bo-presale-action-menu summary {
  cursor: pointer;
  list-style: none;
}

.bo-presale-action-menu summary::-webkit-details-marker {
  display: none;
}

.bo-presale-action-menu-panel {
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.12);
  display: grid;
  gap: 8px;
  min-width: 220px;
  padding: 12px;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
}

.bo-presale-action-menu-panel .mini-button {
  justify-content: center;
  width: 100%;
}

#customerBackOrderDialog {
  width: min(1320px, calc(100vw - 32px));
}

.bo-presale-dialog-card {
  max-width: 100%;
  width: 100%;
}

.bo-presale-dialog-card .table-scroll {
  overflow-x: hidden;
}

.bo-presale-dialog-card .bo-presale-preview-table {
  min-width: 0;
  table-layout: fixed;
  width: 100%;
}

.bo-presale-dialog-card .bo-presale-preview-table th,
.bo-presale-dialog-card .bo-presale-preview-table td {
  overflow-wrap: anywhere;
  padding-left: 10px;
  padding-right: 10px;
  white-space: normal;
}

.bo-presale-dialog-card .bo-presale-preview-table th:nth-child(1),
.bo-presale-dialog-card .bo-presale-preview-table td:nth-child(1) {
  width: 38%;
}

.bo-presale-dialog-card .bo-presale-preview-table th:nth-child(2),
.bo-presale-dialog-card .bo-presale-preview-table td:nth-child(2) {
  width: 15%;
}

.bo-presale-dialog-card .bo-presale-preview-table th:nth-child(3),
.bo-presale-dialog-card .bo-presale-preview-table td:nth-child(3) {
  width: 14%;
}

.bo-presale-dialog-card .bo-presale-preview-table th:nth-child(4),
.bo-presale-dialog-card .bo-presale-preview-table td:nth-child(4) {
  width: 12%;
}

.bo-presale-dialog-card .bo-presale-preview-table th:nth-child(5),
.bo-presale-dialog-card .bo-presale-preview-table td:nth-child(5) {
  width: 10%;
}

.bo-presale-dialog-card .bo-presale-preview-table th:nth-child(6),
.bo-presale-dialog-card .bo-presale-preview-table td:nth-child(6) {
  width: 11%;
}

.bo-presale-preview-table .compact-number-input {
  min-width: 0;
  width: 100%;
}

.customer-order-line-actions {
  align-items: center;
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  min-width: 0;
}

.bo-line-button {
  background: #e8f4ff;
  border-color: #8fc7f0;
  color: #0969a8;
  font-size: 11px;
  font-weight: 800;
  min-height: 28px;
  min-width: 34px;
  padding: 5px 6px;
}

.customer-order-line-actions .po-remove-line {
  flex: 0 0 28px;
}

.danger-mini {
  background: #fff;
  border-color: #f0a6a6;
  color: #b73737;
}

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

.receiving-warning-box,
.receiving-inline-warning {
  background: var(--red-soft);
  border: 1px solid #f1b8b8;
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
}

.receiving-warning-box ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.work-order-edit-controls {
  display: grid;
  gap: 8px;
}

.work-order-edit-banner {
  align-items: center;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 10px 12px;
}

.work-order-edit-banner span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.work-order-edit-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 12px;
  padding: 12px;
}

.work-order-edit-notes,
.work-order-edit-row label,
.work-order-edit-pull-row label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 700;
  gap: 5px;
  text-transform: uppercase;
}

.work-order-edit-subsection {
  display: grid;
  gap: 8px;
}

.work-order-edit-subheading {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.work-order-edit-row,
.work-order-edit-pull-row {
  align-items: end;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 8px;
  padding: 10px;
}

.work-order-edit-row {
  grid-template-columns: minmax(240px, 1.45fr) minmax(110px, 0.45fr) minmax(130px, 0.55fr) minmax(140px, 0.6fr);
}

.work-order-edit-pull-row {
  grid-template-columns: minmax(280px, 1.6fr) minmax(120px, 0.55fr) minmax(110px, 0.5fr) 32px;
}

.work-order-edit-row span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-bottom: 3px;
  text-transform: uppercase;
}

.work-order-edit-row strong {
  color: var(--text);
  font-size: 14px;
}

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

.receiving-checklist .wide-field,
.receiving-signature-card {
  grid-column: 1 / -1;
}

.receiving-check-row {
  align-items: center;
  display: flex;
  gap: 10px;
}

.receiving-check-row input {
  height: 22px;
  width: 22px;
}

.receiving-initial-check-row {
  min-height: 66px;
}

.receiving-initial-check-row .check-initial-button:disabled {
  cursor: default;
  opacity: 1;
}

.receiving-signature-card {
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr);
  justify-items: start;
  max-width: 520px;
  padding: 10px;
}

.receiving-signature-footer {
  justify-self: start;
  width: min(520px, 100%);
}

.receiving-signature-card .production-signature-status {
  width: 100%;
}

.receiving-lines {
  display: grid;
  gap: 12px;
}

.receiving-line-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.receiving-line-head {
  align-items: start;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.receiving-line-head strong,
.receiving-line-head span {
  display: block;
}

.receiving-line-head span,
.receiving-line-metrics span {
  color: var(--muted);
  font-size: 13px;
}

.receiving-line-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: end;
}

.receiving-line-metrics strong {
  color: var(--text);
  display: inline;
}

.danger-text {
  color: var(--red) !important;
}

.receiving-lot-header,
.receiving-lot-row {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(94px, 0.8fr)) minmax(150px, 1.1fr) minmax(130px, 0.9fr) 36px;
}

.receiving-lot-header {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.receiving-lot-row input,
.receiving-checklist select,
.receiving-checklist textarea,
.receiving-meta-grid input {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 34px;
  padding: 7px 8px;
  width: 100%;
}

.receiving-lot-row input[data-receiving-location]::placeholder {
  color: var(--muted);
  opacity: 0.55;
}

.receiving-quantity-field {
  display: block;
  position: relative;
}

.receiving-quantity-field input {
  padding-right: 42px;
}

.receiving-quantity-field span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  max-width: 36px;
  overflow: hidden;
  pointer-events: none;
  position: absolute;
  right: 9px;
  text-overflow: ellipsis;
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
}

.receiving-checklist textarea {
  min-height: 76px;
  resize: vertical;
}

#productionDialog {
  width: min(620px, calc(100vw - 28px));
}

#signatureDialog {
  width: min(680px, calc(100vw - 28px));
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
}

.dialog-card {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.pdf-template-layout {
  display: grid;
  gap: 12px;
}

.pdf-template-layout textarea {
  min-height: 96px;
}

.pdf-template-presets {
  gap: 12px;
}

.pdf-template-type-list,
.pdf-template-version-list {
  display: grid;
  gap: 8px;
}

.pdf-template-type-row,
.pdf-template-version-row {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 10px 12px;
}

.pdf-template-type-row div,
.pdf-template-version-row div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.pdf-template-type-row strong,
.pdf-template-version-row strong {
  font-size: 13px;
}

.pdf-template-type-row span,
.pdf-template-version-row span,
.pdf-template-version-row small,
.pdf-template-type-row small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.pdf-template-version-panel {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  padding-top: 12px;
}

.pdf-template-download-options {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 8px;
  padding: 10px 12px;
}

.pdf-template-download-options label {
  display: grid;
  gap: 5px;
}

.pdf-template-folder-control {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.pdf-template-folder-control > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.pdf-template-folder-control span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.pdf-template-folder-actions {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.pdf-template-version-head {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.pdf-template-version-head h5 {
  font-size: 13px;
  margin: 0;
}

.pdf-template-active-choice {
  align-items: center;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  gap: 6px;
  white-space: nowrap;
}

.pdf-template-active-choice input {
  min-height: auto;
}

.pdf-template-version-dialog {
  width: min(1160px, calc(100vw - 28px));
}

.pdf-template-version-card {
  max-height: min(92vh, 900px);
  overflow: auto;
}

.pdf-template-editor-meta {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(260px, 1fr) auto;
}

.pdf-template-active-toggle {
  align-items: center;
  min-height: 38px;
}

.pdf-template-version-card .tox-tinymce {
  border-color: var(--line);
  border-radius: 6px;
}

.po-dialog-card {
  max-height: min(86vh, 820px);
  overflow: auto;
}

.formula-dialog-card {
  max-height: min(86vh, 820px);
  overflow: auto;
}

.work-order-dialog-card {
  max-height: min(88vh, 860px);
  overflow: auto;
}

.warning-count-badge {
  align-items: center;
  background: var(--red);
  border: 1px solid var(--red);
  border-radius: 999px;
  color: var(--surface);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  height: 26px;
  justify-content: center;
  line-height: 1;
  min-width: 26px;
  padding: 0 7px;
}

.warning-count-badge:hover {
  filter: brightness(0.95);
}

.work-order-warning-box {
  background: var(--red-soft);
  border: 1px solid #f1b8b8;
  border-radius: 8px;
  color: var(--text);
  display: grid;
  gap: 7px;
  padding: 10px 12px;
}

.work-order-warning-box strong {
  color: var(--red);
}

.work-order-warning-box ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
}

.work-order-approval-section {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  padding-top: 12px;
}

.quality-approval-checks {
  display: grid;
  gap: 8px;
}

.quality-approval-check {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 10px;
  padding: 10px;
}

.quality-approval-check input {
  height: 18px;
  width: 18px;
}

.quality-approval-signoff {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(160px, 220px) minmax(160px, 1fr);
}

.quality-approval-complete {
  background: var(--green-soft);
  border: 1px solid #bddfc7;
  border-radius: 8px;
  color: var(--green);
  display: grid;
  gap: 3px;
  padding: 10px;
}

.production-choice-card {
  gap: 14px;
}

.production-choice-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.production-choice-button {
  background: var(--surface);
  border: 1px solid var(--ink);
  border-radius: 8px;
  color: var(--ink);
  display: grid;
  gap: 7px;
  min-height: 112px;
  padding: 18px;
  text-align: left;
}

.production-choice-button:hover {
  background: var(--pink-soft);
}

.production-choice-button strong {
  font-size: 20px;
}

.production-choice-button span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.production-entry-page {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 14px;
  padding-top: 14px;
}

.production-entry-header {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.production-entry-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.production-step-card {
  align-items: end;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 16px;
}

.production-step-card .upload-status {
  grid-column: 1 / -1;
  margin: 0;
}

.batch-formula-entry {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr);
}

#batchFormulaEnter {
  grid-column: 2;
  grid-row: 1;
}

.formula-suggestion-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 0;
  grid-column: 1 / -1;
  max-height: 280px;
  overflow: auto;
}

.formula-suggestion-list button {
  background: var(--surface);
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  text-align: left;
}

.formula-suggestion-list button:last-child {
  border-bottom: 0;
}

.formula-suggestion-list button:hover,
.formula-suggestion-list button:focus {
  background: var(--pink-soft);
}

.formula-suggestion-list span {
  color: var(--muted);
  font-size: 12px;
}

.material-picker {
  display: grid;
  flex: 1;
  gap: 6px;
  min-width: 190px;
}

.assembly-formula-picker {
  display: grid;
  flex: 1;
  gap: 6px;
  min-width: 220px;
}

.material-suggestion-list {
  grid-column: auto;
  max-height: 240px;
}

.assembly-suggestion-list {
  grid-column: auto;
  max-height: 240px;
}

.selected-material-pill,
.picker-warning,
.suggestion-empty {
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.35;
  padding: 8px 10px;
}

.selected-material-pill {
  background: var(--green-soft);
  color: var(--green);
  font-weight: 700;
}

.picker-warning {
  background: var(--amber-soft);
  color: var(--amber);
  font-weight: 700;
}

.suggestion-empty {
  background: var(--surface-alt);
  color: var(--muted);
}

.production-entry-panel,
.production-pull-list,
.assembly-line-list,
.production-questionnaire-footer,
.production-draft-danger-actions,
.production-checks,
.production-checks > div {
  display: grid;
  gap: 10px;
}

.production-draft-danger-actions {
  justify-items: start;
  margin-top: 2px;
}

.danger-soft-button {
  align-items: center;
  background: var(--red-soft);
  border: 1px solid #f3b5b5;
  border-radius: 6px;
  color: var(--red);
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
}

.danger-soft-button:hover,
.danger-soft-button:focus {
  background: #ffe3e3;
}

.production-lines-heading,
.production-yield-row,
.production-pull-row,
.assembly-line-row,
.inline-actions {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.production-pull-row,
.assembly-line-row,
.production-yield-row {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.material-picker label,
.assembly-formula-picker label,
.assembly-line-row label:first-child {
  flex: 1;
}

.recommendation-box,
.production-summary-box {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  min-height: 44px;
  padding: 7px 9px;
}

.recommendation-box span,
.production-yield-row span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.recommendation-box small {
  color: var(--muted);
  font-size: 11px;
}

.production-entry-meta {
  color: var(--muted);
  display: block;
  font-size: 11px;
  line-height: 1.25;
  margin-top: 4px;
}

.production-output-location-field {
  display: grid;
  gap: 4px;
  min-width: 150px;
}

.production-output-location-field input::placeholder {
  color: var(--muted);
  opacity: 0.55;
}

#productionNotesLabel.notes-required {
  background: var(--red-soft);
  border: 1px solid #f3b5b5;
  border-radius: 8px;
  padding: 10px;
}

#productionNotesLabel.notes-required textarea {
  border-color: var(--red);
}

.field-error {
  background: var(--red-soft) !important;
  border-color: var(--red) !important;
  box-shadow: 0 0 0 2px rgba(217, 77, 77, 0.12);
}

.field-error-label {
  color: var(--red) !important;
}

.assembly-line-row.row-field-error {
  border-top-color: #f3b5b5;
}

.production-summary-box span {
  color: var(--muted);
  display: block;
  font-size: 13px;
}

.production-summary-header {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
}

.assembly-pull-sections {
  display: grid;
  gap: 12px;
}

.assembly-pull-section {
  background: var(--surface);
  border: 1px solid #cfc8c2;
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.assembly-pull-section.confirmed {
  border-color: #9fcdaa;
}

.assembly-pull-section-header {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
}

.assembly-pull-section-header > div {
  display: grid;
  gap: 3px;
}

.assembly-output-location-summary {
  min-width: min(220px, 100%);
}

.assembly-pull-section-header span {
  color: var(--muted);
  font-size: 12px;
}

.assembly-verification-note {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  margin: 0;
}

.assembly-material-list {
  display: grid;
  gap: 6px;
}

.assembly-material-header,
.assembly-material-row {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(220px, 1.4fr) minmax(120px, 0.6fr) minmax(130px, 0.65fr) minmax(104px, 0.45fr);
}

.assembly-material-header {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.assembly-material-row {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}

.assembly-material-row.confirmed {
  background: var(--green-soft);
  border-color: #bddfc7;
}

.assembly-material-row span,
.assembly-material-row label > span {
  color: var(--muted);
  display: block;
  font-size: 11px;
  text-transform: uppercase;
}

.assembly-material-row strong {
  display: block;
}

.assembly-system-lot small {
  color: var(--muted);
  display: block;
  font-size: 10px;
  margin-top: 2px;
}

.assembly-material-row input[type="text"] {
  min-height: 34px;
}

.assembly-verify-cell {
  align-items: center;
  display: grid;
  gap: 2px;
  justify-items: center;
  text-align: center;
}

.assembly-verify-cell input[type="checkbox"] {
  height: 28px;
  margin: 0;
  width: 28px;
}

.assembly-verify-cell strong {
  font-size: 12px;
}

.assembly-verify-cell small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
  min-height: 24px;
}

.assembly-overall-verification {
  background: var(--surface-alt);
  margin-top: 2px;
}

.assembly-overall-verification.signed {
  background: var(--green-soft);
  color: var(--green);
}

.production-initials-row {
  align-items: end;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 10px;
  padding: 10px;
}

.production-work-order-number-row {
  align-items: end;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(160px, 240px) 1fr;
  padding: 10px;
}

.production-work-order-number-row label {
  display: grid;
  gap: 6px;
}

.production-work-order-number-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.production-work-order-number-row input {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 15px;
  font-weight: 700;
  height: 38px;
  padding: 8px 10px;
}

.production-work-order-number-row small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.production-signature-status {
  align-items: center;
  display: flex;
  flex: 1;
  gap: 12px;
  min-width: 0;
}

.production-signature-status strong,
.production-signature-status span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.production-signature-preview,
.production-signature-stamp {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: contain;
}

.production-signature-preview {
  height: 44px;
  width: 132px;
}

.production-signature-stamp {
  height: 36px;
  width: 74px;
}

.production-check-row {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text) !important;
  display: flex !important;
  flex-direction: row;
  font-size: 13px !important;
  font-weight: 600 !important;
  gap: 10px !important;
  padding: 10px !important;
  text-transform: none !important;
}

.production-check-row.signed {
  background: var(--green-soft);
  border-color: rgba(95, 158, 88, 0.35);
}

.production-check-row strong,
.production-check-row span {
  display: block;
}

.production-check-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  margin-top: 3px;
}

.check-initial-button {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--ink);
  border-radius: 8px;
  color: var(--ink);
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  justify-content: center;
  min-height: 46px;
  min-width: 78px;
  padding: 0 12px;
  text-transform: uppercase;
}

.production-check-row.signed .check-initial-button {
  background: var(--surface);
  color: var(--ink);
  font-size: 18px;
  padding: 6px;
}

.signature-dialog-card {
  max-height: min(88vh, 760px);
  overflow: auto;
}

.signature-pad-wrap {
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    repeating-linear-gradient(45deg, #f5f5f5 0, #f5f5f5 10px, #ffffff 10px, #ffffff 20px) border-box;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 10px;
}

#signatureCanvas {
  background: var(--surface);
  border-radius: 6px;
  cursor: crosshair;
  display: block;
  height: 220px;
  touch-action: none;
  width: 100%;
}

.dialog-card textarea,
.production-entry-page textarea {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  padding: 10px;
  resize: vertical;
}

.error-text {
  color: var(--red);
}

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

.assembly-draft-summary {
  margin-bottom: 10px;
}

.formula-detail-summary div {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  min-height: 64px;
  padding: 10px;
}

.formula-detail-summary .manufacturing-multiplier-card {
  align-items: center;
  grid-template-columns: minmax(88px, 118px) minmax(110px, 1fr);
}

.manufacturing-multiplier-card label {
  display: grid;
  gap: 6px;
}

.manufacturing-multiplier-card .mini-input {
  font-size: 15px;
  min-height: 40px;
  width: 100%;
}

.multiplier-yield-guide {
  align-content: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  min-height: 48px;
  padding: 8px 10px;
}

.formula-detail-summary strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.formula-detail-summary span,
.block-text {
  color: var(--muted);
  display: block;
  font-size: 12px;
}

.work-order-summary {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.work-order-summary div {
  min-height: 54px;
  padding: 8px;
}

.work-order-summary strong {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
}

.summary-status-card {
  align-content: start;
}

.summary-status-card .badge {
  justify-self: start;
}

.work-order-notes {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.work-order-notes:empty {
  display: none;
}

.work-order-notes strong {
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.work-order-notes p {
  color: var(--muted);
  margin: 0;
}

.work-order-detail-grid,
.work-order-detail-section {
  display: grid;
  gap: 10px;
}

.work-order-detail-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
}

.work-order-detail-heading h4 {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0;
  text-transform: uppercase;
}

.work-order-detail-row,
.work-order-check-detail {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 10px;
}

.work-order-detail-row:first-child,
.work-order-check-detail:first-child {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.work-order-detail-row-3 {
  grid-template-columns: minmax(180px, 1fr) minmax(110px, 0.4fr) minmax(130px, 0.5fr);
}

.work-order-detail-row-4 {
  grid-template-columns: minmax(190px, 1.2fr) minmax(96px, 0.4fr) minmax(96px, 0.4fr) minmax(116px, 0.4fr);
}

.work-order-output-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 10px;
}

.work-order-output-section + .work-order-output-section {
  margin-top: 10px;
}

.work-order-output-header {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(220px, 1fr) minmax(105px, 0.32fr) minmax(120px, 0.34fr) minmax(130px, 0.36fr);
  padding: 10px;
}

.work-order-material-list {
  display: grid;
  gap: 7px;
}

.work-order-material-row {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(220px, 1fr) minmax(110px, 0.35fr) minmax(110px, 0.35fr);
  padding: 8px 6px;
}

.work-order-material-row:last-child {
  border-bottom: 0;
}

.work-order-output-confirmation,
.inline-warning {
  color: var(--muted);
  font-size: 12px;
}

.inline-warning {
  color: var(--red);
}

.work-order-check-detail {
  align-items: center;
  grid-template-columns: minmax(210px, 1fr) minmax(120px, 0.4fr) minmax(150px, 0.6fr);
}

.work-order-detail-row span,
.work-order-output-header span,
.work-order-material-row span,
.work-order-check-detail span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 3px;
}

.work-order-detail-row strong,
.work-order-output-header strong,
.work-order-material-row strong,
.work-order-check-detail strong {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}

.work-order-signature {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  height: 48px;
  object-fit: contain;
  width: 128px;
}

.work-order-initials-pill {
  align-items: center;
  background: var(--green-soft);
  border: 1px solid rgba(95, 158, 88, 0.35);
  border-radius: 999px;
  color: var(--green);
  display: inline-flex !important;
  font-size: 14px !important;
  font-weight: 800;
  justify-content: center;
  margin: 0 !important;
  min-height: 38px;
  min-width: 72px;
  padding: 8px 14px;
  text-transform: uppercase;
}

#manufacturingFormulaSummary {
  gap: 8px;
  grid-template-columns: minmax(86px, 0.65fr) minmax(150px, 1.25fr) minmax(100px, 0.75fr) minmax(160px, 1.25fr) minmax(70px, 0.5fr);
}

#manufacturingFormulaSummary div {
  min-height: 40px;
  padding: 6px 7px;
}

#manufacturingFormulaSummary span {
  font-size: 11px;
  line-height: 1.2;
  text-transform: uppercase;
}

#manufacturingFormulaSummary strong {
  font-size: 13px;
  line-height: 1.25;
}

.dialog-grid {
  align-items: start;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dialog-grid .wide-field {
  grid-column: 1 / -1;
}

.dialog-grid .full-span,
.full-span {
  grid-column: 1 / -1;
}

#vendorContactDialog {
  width: min(980px, calc(100vw - 32px));
}

#vendorContactDialog .dialog-card {
  max-width: 100%;
  overflow-x: hidden;
  width: 100%;
}

#organizationDialog .dialog-card {
  gap: 9px;
  padding: 16px 18px;
  width: min(430px, calc(100vw - 32px));
}

#organizationDialog .dialog-grid {
  grid-template-columns: 1fr;
  gap: 9px;
}

#organizationDialog textarea {
  height: 82px;
  line-height: 1.25;
  min-height: 0;
  resize: none;
}

#organizationDialog .subtle {
  font-size: 12px;
  margin: 0;
}

#organizationDialog .dialog-actions {
  margin-top: 2px;
}

.dialog-header {
  align-items: start;
  display: flex;
  justify-content: space-between;
}

.dialog-card label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  gap: 6px;
  text-transform: uppercase;
}

.dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}

.dialog-actions-split {
  align-items: center;
  justify-content: space-between;
}

.dialog-action-group {
  display: flex;
  gap: 8px;
}

.danger-outline-button {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--red);
  border-radius: 6px;
  color: var(--red);
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
}

.danger-outline-button:hover,
.danger-outline-button:focus {
  background: var(--red-soft);
}

.po-danger-actions {
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-start;
  padding: 10px 14px;
}

.po-form-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 118px minmax(170px, 1fr) 118px minmax(150px, 0.8fr);
}

.po-builder {
  border-bottom: 1px dashed var(--line);
  border-top: 1px dashed var(--line);
  display: grid;
  gap: 8px;
  padding: 10px 0 12px;
}

.po-builder-lines {
  display: grid;
  gap: 0;
}

.po-builder-row {
  align-items: end;
  display: grid;
  gap: 7px;
  grid-template-columns: minmax(280px, 1.9fr) minmax(128px, 0.65fr) minmax(82px, 0.45fr) minmax(82px, 0.45fr) minmax(92px, 0.5fr) minmax(92px, 0.5fr) 28px;
  padding: 7px 0;
}

.po-builder-row + .po-builder-row {
  border-top: 1px solid var(--line);
}

.po-builder-item input,
.po-builder-item select {
  width: 100%;
}

.po-workflow-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 14px;
  padding: 14px;
}

.po-create-card {
  background: var(--surface);
  gap: 18px;
  padding: 18px;
}

.po-document-card label {
  color: var(--muted);
  display: grid;
  font-size: 11px;
  font-weight: 700;
  gap: 6px;
  text-transform: uppercase;
}

.po-document-card input,
.po-document-card select {
  background: var(--surface);
  border: 1px solid #cfc8c8;
  border-radius: 2px;
  color: var(--text);
  min-height: 31px;
  padding: 6px 8px;
  width: 100%;
}

.po-document-card input:focus,
.po-document-card select:focus {
  border-color: var(--ink);
  outline: 1px solid var(--ink);
}

.new-po-document-header,
.new-po-heading-line,
.new-po-total {
  align-items: center;
  display: flex;
  gap: 10px;
}

.new-po-document-header {
  justify-content: space-between;
}

.new-po-heading-line {
  margin-top: 8px;
}

.new-po-heading-line h3 {
  font-size: 18px;
  letter-spacing: 0;
}

.new-po-total {
  color: var(--muted);
  justify-content: flex-end;
  text-align: right;
  text-transform: uppercase;
}

.new-po-total strong {
  color: #1f67b1;
  min-width: 80px;
}

.new-po-address-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) minmax(220px, 1fr);
}

.po-address-card {
  display: grid;
  gap: 8px;
}

.po-address-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.po-vendor-select-wrap {
  max-width: 380px;
}

.po-address-lines {
  color: var(--text);
  display: grid;
  font-size: 12px;
  gap: 3px;
  line-height: 1.35;
  min-height: 86px;
}

.po-address-lines strong {
  font-size: 13px;
}

.new-po-meta-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(170px, 0.8fr) minmax(170px, 0.8fr) minmax(240px, 1.1fr);
}

.field-hint {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.new-po-lines-heading {
  color: var(--muted);
  display: grid;
  font-size: 11px;
  font-weight: 800;
  gap: 7px;
  grid-template-columns: minmax(280px, 1.9fr) minmax(128px, 0.65fr) minmax(82px, 0.45fr) minmax(82px, 0.45fr) minmax(92px, 0.5fr) minmax(92px, 0.5fr) 28px;
  text-transform: uppercase;
}

.po-match-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 2px;
  margin-top: 4px;
  max-height: 190px;
  overflow-y: auto;
  padding: 4px;
}

.po-match-option {
  background: transparent;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  display: grid;
  gap: 2px;
  padding: 7px;
  text-align: left;
}

.po-match-option:hover {
  background: var(--surface-alt);
}

.po-match-option span,
.po-match-empty {
  color: var(--muted);
  font-size: 12px;
}

.po-builder-page {
  background: var(--surface);
  border-bottom: 1px dashed var(--line);
  border-radius: 0;
  border-top: 1px dashed var(--line);
  padding: 14px 0 12px;
}

.po-builder-page .po-builder-row {
  background: var(--surface);
  border: 0;
  border-radius: 0;
  padding: 10px 0;
}

.po-builder-page .po-builder-row + .po-builder-row {
  border-top: 1px solid var(--line);
  margin-top: 0;
}

.po-builder-footer {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding-top: 6px;
}

.po-builder-summary {
  align-items: center;
  color: var(--muted);
  display: flex;
  gap: 14px;
  justify-content: flex-end;
}

.po-builder-summary strong {
  color: var(--ink);
  font-size: 16px;
}

.po-pdf-button {
  background: #fff1f1;
  border: 1px solid #f3caca;
  border-radius: 4px;
  color: #9b3f3f;
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  padding: 4px 5px;
}

.po-pdf-button:hover {
  background: #ffe7e7;
  border-color: #e7a9a9;
}

.invoice-paid-toggle {
  background: #f4f5f6;
  border-color: #d8dde2;
  color: #7d858d;
  margin-left: 4px;
}

.invoice-paid-toggle:hover {
  background: #eceff2;
  border-color: #cbd2d9;
}

.invoice-paid-toggle.paid {
  background: #e5f6e8;
  border-color: #a8d9b3;
  color: #267544;
}

.invoice-paid-toggle.paid:hover {
  background: #d9f0de;
  border-color: #90cda0;
}

.document-number-cell {
  white-space: nowrap;
}

.document-number-cell > span {
  margin-right: 8px;
}

.unit-input {
  display: grid;
  grid-template-columns: minmax(62px, 1fr) auto;
}

.unit-input input {
  border-radius: 6px 0 0 6px;
}

.unit-input span {
  align-items: center;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 6px 6px 0;
  color: var(--muted);
  display: inline-flex;
  font-size: 12px;
  padding: 0 6px;
}

.currency-input {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
}

.currency-input > span {
  align-items: center;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 6px 0 0 6px;
  color: var(--muted);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  justify-content: center;
  min-width: 28px;
  padding: 0 8px;
}

.currency-input input {
  border-left: 0;
  border-radius: 0 6px 6px 0;
  min-width: 0;
}

.po-readonly {
  display: grid;
  gap: 5px;
  min-height: 50px;
}

.po-readonly span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.po-readonly .tier-price-helper {
  color: #1f6fbf;
  font-size: 11px;
  font-weight: 800;
  margin-top: -2px;
  text-transform: none;
}

.po-readonly .tier-price-helper.manual {
  color: var(--muted);
}

.po-readonly strong {
  align-items: center;
  display: flex;
  min-height: 30px;
}

.po-remove-line {
  align-self: end;
  border-color: transparent;
  color: var(--red);
}

.po-builder-footer {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding-top: 6px;
}

.po-builder-summary {
  align-items: center;
  color: var(--muted);
  display: flex;
  gap: 14px;
  justify-content: flex-end;
}

.po-builder-summary span {
  color: var(--muted);
  font-size: 12px;
}

.po-builder-summary strong {
  color: var(--ink);
  font-size: 16px;
}

.profile-summary,
.sync-status-panel,
.audit-report-panel,
.report-panel {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.report-panel {
  background: var(--surface);
  margin-top: 14px;
}

.report-action-row {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.report-action-row h3 {
  margin: 0;
}

.operational-report-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.operational-report-grid .secondary-button {
  justify-content: center;
  min-height: 34px;
}

.profile-summary > div {
  display: grid;
  gap: 4px;
}

.profile-avatar-setting {
  grid-column: 1 / -1;
}

.profile-avatar-control {
  align-items: center;
  display: flex;
  gap: 14px;
}

.profile-avatar-preview {
  align-items: center;
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 50%;
  color: var(--surface);
  display: flex;
  flex: 0 0 52px;
  font-size: 13px;
  font-weight: 900;
  height: 52px;
  justify-content: center;
  overflow: hidden;
  width: 52px;
}

.profile-avatar-upload {
  min-height: 34px;
}

.profile-avatar-status {
  font-size: 12px;
  margin: 6px 0 0;
}

.profile-devices {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
}

.profile-devices-head {
  align-items: baseline;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.profile-devices-head h4 {
  margin: 0;
}

.profile-devices-hint {
  font-size: 12px;
  line-height: 1.45;
  margin: 0;
}

.devices-list {
  display: grid;
  gap: 8px;
}

.device-row {
  align-items: center;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 10px 12px;
}

.device-info {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.device-info strong {
  align-items: center;
  display: flex;
  gap: 8px;
}

.device-info small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-current {
  background: var(--accent-soft, rgba(64, 120, 255, 0.14));
  border-radius: 999px;
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  text-transform: uppercase;
}

.device-revoke {
  flex: 0 0 auto;
}

.sync-message,
.sync-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.invoice-qb-feedback {
  margin: 8px 0 12px;
}

.sync-topline {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.sync-status-wrap {
  align-items: flex-start;
  display: grid;
  gap: 6px;
}

.sync-status-pill {
  border: 1px solid;
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  padding: 7px 11px;
  text-transform: uppercase;
  width: max-content;
}

.sync-status-pill.connected {
  background: #edf7ee;
  border-color: #8bc28d;
  color: #22672b;
}

.sync-status-pill.not-connected {
  background: #fff0f0;
  border-color: #df9b9b;
  color: #9a2f2f;
}

.sync-timestamps {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  text-align: right;
}

.sync-timestamps > div {
  display: grid;
  gap: 3px;
  min-width: 130px;
}

.sync-timestamps span {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.sync-timestamps strong {
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
}

.sync-controls {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sync-controls label {
  min-width: 130px;
}

.admin-actions,
.audit-controls {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-dialog .table-panel {
  max-height: 280px;
  overflow: auto;
}

.compact-table table {
  min-width: 680px;
}

.audit-controls label {
  min-width: 130px;
}

.audit-preview {
  color: var(--muted);
  font-size: 13px;
  min-height: 20px;
}

.audit-hint {
  cursor: help;
  text-decoration: underline dotted var(--muted);
  text-underline-offset: 3px;
}

.audit-tooltip {
  background: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  box-shadow: var(--shadow);
  color: var(--surface);
  font-size: 12px;
  line-height: 1.45;
  max-width: 300px;
  opacity: 0;
  padding: 9px 11px;
  pointer-events: none;
  position: fixed;
  transform: translateY(3px);
  transition: opacity 120ms ease, transform 120ms ease;
  white-space: pre-line;
  z-index: 500;
}

.audit-tooltip.show {
  opacity: 1;
  transform: translateY(0);
}

#toast {
  background: var(--ink);
  box-sizing: border-box;
  border-radius: 8px;
  bottom: 24px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.26);
  color: var(--surface);
  font-size: 13px;
  font-weight: 800;
  left: 50%;
  line-height: 1.35;
  max-width: min(680px, calc(100vw - 32px));
  width: max-content;
  overflow-wrap: anywhere;
  opacity: 0;
  padding: 12px 16px;
  pointer-events: none;
  position: fixed;
  text-align: center;
  transform: translate(-50%, 6px);
  transition: opacity 160ms ease, transform 160ms ease;
  white-space: normal;
  z-index: 2147483000;
}

#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.empty-state {
  color: var(--muted);
  padding: 34px 18px;
  text-align: center;
}

@media (max-width: 980px) {
  .app-header,
  .section-heading,
  .heading-actions,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .main-nav {
    top: 162px;
  }

  .bulk-action-bar {
    top: 232px;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-grid {
    grid-template-columns: 1fr;
  }

  .category-tabs,
  .sub-tabs {
    overflow-x: auto;
  }

  .dialog-grid {
    grid-template-columns: 1fr;
  }

  .item-identity-layout,
  .conversion-grid,
  .commercial-grid,
  .inventory-planning-grid,
  .vendor-planning-row {
    grid-template-columns: 1fr;
  }

  .stock-lots-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .stock-lot-total {
    justify-items: start;
  }

  .formula-detail-summary {
    grid-template-columns: 1fr;
  }

  .work-order-detail-row-3,
  .work-order-detail-row-4,
  .work-order-output-header,
  .work-order-material-row,
  .assembly-material-header,
  .assembly-material-row,
  .work-order-check-detail {
    grid-template-columns: 1fr;
  }

  #manufacturingFormulaSummary {
    grid-template-columns: 1fr;
  }

  .production-choice-grid,
  .production-step-card,
  .batch-formula-entry,
  .formula-edit-grid,
  .formula-edit-component-header,
  .formula-edit-component-row,
  .formula-use-line,
  .inventory-use-summary {
    grid-template-columns: 1fr;
  }

  .formula-edit-component-header {
    display: none;
  }

  .formula-edit-name-field,
  .formula-edit-category-field,
  .formula-edit-status-field,
  .formula-edit-result-field,
  .formula-edit-yield-field,
  .formula-edit-yield-unit-field,
  .formula-edit-default-location-field,
  #formulaEditCategoryWrap[hidden] ~ .formula-edit-status-field,
  #formulaEditCategoryWrap[hidden] ~ .formula-edit-result-field {
    grid-column: 1;
  }

  .formula-edit-component-row {
    align-items: stretch;
  }

  .cost-metrics,
  .cost-parent-grid {
    grid-template-columns: 1fr;
  }

  .cost-detail-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .cost-total-strip {
    justify-content: flex-start;
    text-align: left;
  }

  .calculator-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .calculator-heading .subtle {
    text-align: left;
  }

  .formula-use-yield-hint,
  .formula-use-suggestions {
    grid-column: auto;
  }

  #batchFormulaEnter {
    grid-column: auto;
    grid-row: auto;
  }

  .production-entry-header {
    align-items: stretch;
    flex-direction: column;
  }

  .production-initials-row,
  .production-pull-row,
  .assembly-line-row,
  .production-yield-row {
    align-items: stretch;
    flex-direction: column;
  }

  .production-signature-status {
    align-items: stretch;
    flex-direction: column;
  }

  .production-signature-preview {
    width: 100%;
  }

  .po-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .new-po-meta-grid,
  .new-po-address-grid,
  .new-po-lines-heading,
  .po-builder-row,
  .work-order-edit-row,
  .work-order-edit-pull-row {
    grid-template-columns: 1fr;
  }

  .new-po-lines-heading {
    display: none;
  }

  .sync-topline {
    align-items: stretch;
    flex-direction: column;
  }

  .sync-timestamps {
    justify-content: flex-start;
    text-align: left;
  }
}

@media (max-width: 620px) {
  .announcement {
    font-size: 11px;
  }

  .sync-timestamps {
    display: grid;
    grid-template-columns: 1fr;
  }

  .po-form-grid {
    grid-template-columns: 1fr;
  }

  .app-header,
  .main-nav,
  main {
    padding-left: 12px;
    padding-right: 12px;
  }

  .brand img {
    height: 40px;
    width: 102px;
  }

  .auth-brand img {
    height: 52px;
    width: 132px;
  }

  h1 {
    font-size: 18px;
  }

  h2 {
    font-size: 19px;
  }

  .main-nav {
    top: 168px;
  }

  .bulk-action-bar {
    top: 238px;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .group-header {
    align-items: stretch;
    flex-direction: column;
  }

  .po-register-header {
    display: none;
  }

  .po-header.po-register-row {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .po-cell:not(.po-title) {
    display: grid;
    gap: 6px;
    grid-template-columns: 106px minmax(0, 1fr);
  }

  .po-cell:not(.po-title)::before {
    color: var(--muted);
    content: attr(data-label);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
  }

  .po-tracking-cell {
    grid-template-columns: 106px minmax(0, 1fr);
  }

  .po-tracking-actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .po-eta-cell span {
    grid-column: 2;
  }

  .po-actions {
    justify-content: flex-start;
  }
}

/* Final ToneStock ERP theme overrides: keep this at the end. */
.announcement { display: none; }
.app-shell {
  background: var(--surface-alt);
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
}
.app-main-shell { min-width: 0; }
.app-sidebar {
  background: #020202;
  border-right: 1px solid #181818;
  color: var(--surface);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 22px;
  height: 100vh;
  padding: 28px 20px;
  position: sticky;
  top: 0;
  width: 260px;
  z-index: 35;
}
.sidebar-brand {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--surface);
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 0 0 22px;
  text-align: center;
  width: 100%;
}
.sidebar-brand img { height: 82px; object-fit: contain; width: 152px; }
.sidebar-brand img { filter: invert(1) grayscale(1) brightness(2.4); }
.sidebar-brand span { font-size: 11px; font-weight: 700; letter-spacing: 4px; }
.app-sidebar .main-nav {
  align-content: start;
  background: transparent;
  border: 0;
  display: grid;
  gap: 8px;
  overflow: visible;
  padding: 0;
  position: static;
  top: auto;
}
.module-nav .nav-tab,
.app-sidebar .nav-tab {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  box-shadow: none;
  color: #f4f4ef;
  display: grid;
  flex-direction: row;
  font-size: 14px;
  font-weight: 600;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  justify-items: start;
  min-height: 48px;
  min-width: 0;
  padding: 0 12px;
  text-align: left;
  text-transform: none;
  width: 100%;
}
.app-sidebar .nav-tab:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}
.app-sidebar .nav-tab.active,
.module-nav .nav-tab[data-view].active {
  background: var(--pink-soft);
  border-color: #ffd0d9;
  box-shadow: inset 4px 0 0 var(--pink);
  color: var(--ink);
}
.app-sidebar .nav-tab[data-view="home"].active {
  background: #fff0f4;
  border-color: #f8c7d4;
  box-shadow: inset 4px 0 0 #f0a6bb;
}
.app-sidebar .nav-tab[data-view="production"].active {
  background: #eee2f7;
  border-color: #d9b9ef;
  box-shadow: inset 4px 0 0 #9b63c7;
}
.app-sidebar .nav-tab[data-view="formulas"].active {
  background: #fff3c7;
  border-color: #f6d977;
  box-shadow: inset 4px 0 0 #e5b51e;
}
.app-sidebar .nav-tab[data-view="inventory"].active {
  background: #e8f6d9;
  border-color: #bde38e;
  box-shadow: inset 4px 0 0 #75b843;
}
.app-sidebar .nav-tab[data-view="customers"].active {
  background: #fbe1ef;
  border-color: #f2add0;
  box-shadow: inset 4px 0 0 #d44c92;
}
.app-sidebar .nav-tab[data-view="sales-channels"].active {
  background: #dff8f1;
  border-color: #aee6d5;
  box-shadow: inset 4px 0 0 #28a88b;
}
.app-sidebar .nav-tab[data-view="vendors"].active {
  background: #e0effc;
  border-color: #acd2f4;
  box-shadow: inset 4px 0 0 #3f8ed6;
}
.app-sidebar .nav-tab[data-view="reports"].active {
  background: #dcf7f8;
  border-color: #a5e5e8;
  box-shadow: inset 4px 0 0 #37b9c3;
}
.app-sidebar .nav-tab[data-view="integrations"].active {
  background: #f4f4ef;
  border-color: #d8d8cf;
  box-shadow: inset 4px 0 0 #a9a9a0;
}
.nav-icon { color: currentColor; height: 26px; width: 26px; }
.nav-icon img {
  filter: invert(1) grayscale(1) brightness(2.1) drop-shadow(0 0 0 currentColor) drop-shadow(0.7px 0 0 currentColor);
  height: 26px;
  width: 26px;
}
.nav-tab.active .nav-icon img { filter: grayscale(1) contrast(2.2) drop-shadow(0.7px 0 0 currentColor); }
.nav-icon svg { height: 26px; stroke-width: 2.35; width: 26px; }
.sidebar-help-card {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  color: var(--surface);
  display: grid;
  gap: 4px;
  padding: 14px;
  text-decoration: none;
}
.sidebar-help-card strong { font-size: 13px; }
.sidebar-help-card span { color: #e4e4df; font-size: 12px; text-decoration: underline; }
.app-header {
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(260px, 560px) 1fr;
  gap: 18px;
  min-height: 78px;
  padding: 14px 30px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.global-search {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  max-width: 560px;
  min-height: 44px;
  padding: 0 14px;
}
.global-search span { color: var(--muted); font-size: 22px; line-height: 1; }
.global-search input {
  background: transparent;
  border: 0;
  color: var(--text);
  min-height: 40px;
  outline: 0;
  width: 100%;
}
.header-actions { gap: 10px; }
.upload-pill,
.primary-button,
.text-button,
.icon-button,
.mini-button,
.portal-launch-button,
.danger-soft-button,
.danger-outline-button {
  border-radius: 5px;
  font-weight: 900;
}
.upload-pill {
  background: var(--pink);
  border-color: #e27d91;
  min-height: 42px;
  padding: 0 18px;
}
.upload-pill.secondary {
  background: var(--surface);
  border-color: var(--ink);
}
.primary-button,
.portal-launch-button {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
  min-height: 42px;
  padding: 0 18px;
  text-decoration: none;
}
.text-button,
.mini-button {
  background: var(--surface);
  border-color: #a9a9a4;
  color: var(--ink);
}
.header-sync-status,
.header-sync-status.connected {
  background: var(--green-soft);
  border-color: #a9d6b2;
  border-radius: 5px;
  color: var(--green);
  min-height: 42px;
  min-width: 240px;
  padding: 6px 14px;
}
.header-sync-status span:first-child::before {
  background: var(--green);
  border-radius: 50%;
  content: "";
  display: inline-block;
  height: 8px;
  margin-right: 8px;
  width: 8px;
}
.user-button { border-radius: 50%; height: 42px; width: 42px; }
main { margin: 0; max-width: none; padding: 24px 30px 40px; }
.view { max-width: 1680px; }
body.portal-mode main {
  padding: 0;
}

body.portal-mode .portal-view {
  max-width: none;
  width: 100%;
}

body.portal-mode .portal-shell {
  width: 100%;
}

body.portal-mode .portal-access-panel {
  width: 100%;
}

body.portal-mode .portal-storefront {
  margin: 0 auto;
  max-width: 1680px;
  width: min(100%, 1680px);
}

.section-heading { align-items: end; margin-bottom: 22px; }
.eyebrow { color: var(--muted); font-size: 12px; font-weight: 850; letter-spacing: 0; }
h1, h2, h3, h4 { color: var(--ink); letter-spacing: 0; }
h2 { font-size: 30px; line-height: 1.05; }
.subtle { color: var(--muted); font-size: 14px; }
.metrics,
.home-metrics {
  gap: 16px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 22px;
}
.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  box-shadow: none;
  gap: 8px;
  min-height: 118px;
  padding: 22px;
  position: relative;
}
.metric.emphasis {
  background: linear-gradient(135deg, var(--pink-soft), var(--surface) 72%);
  border-color: #ffafbf;
  box-shadow: inset 0 -4px 0 var(--pink);
}
.metric-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}
.metric strong { font-size: 32px; font-weight: 950; }
.metric-helper { color: var(--text); font-size: 13px; }
.home-grid { gap: 18px; }
.home-panel,
.table-panel,
.report-panel,
.settings-panel,
.production-action-band,
.formula-use-entry-card,
.formula-use-empty-state,
.formula-use-summary-strip,
.mapping-panel,
.integration-card,
.portal-admin-card,
.distributor-panel > .table-panel,
.contact-edit-card .item-edit-card,
.item-edit-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  box-shadow: none;
}
.home-panel { padding: 18px; }
.home-panel-wide { grid-column: span 2; }
.home-panel-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}
.home-panel-heading h3 {
  font-size: 14px;
  text-transform: uppercase;
}
.home-panel-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.category-tabs,
.sub-tabs {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px 5px 0 0;
  box-shadow: none;
}
.category-tab,
.sub-tab {
  border-right: 1px solid var(--line);
  color: var(--text);
  font-size: 14px;
  min-height: 58px;
  padding: 0 24px;
}
.category-tab.active,
.sub-tab.active {
  background: var(--pink-soft);
  border-bottom: 2px solid var(--pink);
  box-shadow: none;
}
.tab-count-badge,
.tab-count-badge.has-pending { background: #444; color: white; }
.toolbar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px 5px 0 0;
  gap: 14px;
  margin-bottom: 0;
  padding: 18px;
}
.search-wrap { border-color: var(--line); border-radius: 5px; min-height: 42px; }
.search-wrap span { color: var(--muted); font-size: 0; }
.search-wrap span::before { content: "⌕"; font-size: 20px; }
.toolbar select,
.toolbar input,
dialog input,
dialog select,
dialog textarea,
.dialog-card input,
.dialog-card select,
.dialog-card textarea,
.production-entry-page input,
.production-entry-page select,
.production-entry-page textarea {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text);
  min-height: 40px;
}
.table-panel { border-radius: 5px; overflow: hidden; }
table { border-collapse: collapse; width: 100%; }
th {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  height: 44px;
  text-transform: uppercase;
}
td {
  border-bottom: 1px solid #ecece8;
  color: var(--text);
  font-size: 13px;
  height: 54px;
}
tbody tr:hover { background: #fafafa; }
.badge,
.status-pill {
  border-radius: 5px;
  font-size: 11px;
  font-weight: 900;
  padding: 4px 9px;
  text-transform: uppercase;
}
.badge.stable,
.status-pill.stable {
  background: var(--green-soft);
  border-color: #a5d7ad;
  color: var(--green);
}

.badge.ordered,
.badge.count,
.badge.gap,
.badge.to-discontinue {
  background: var(--amber-soft);
  border-color: #f2c36f;
  color: var(--amber);
}

.badge.watch {
  background: var(--blue-soft);
  border-color: #b8d2e6;
  color: var(--blue);
}

.badge.order {
  background: var(--pink-soft);
  border-color: #ffa9bb;
  color: #d53355;
}

.badge.production {
  background: var(--pink-soft);
  border-color: var(--pink);
  color: var(--ink);
}

.badge.upcoming {
  background: #f0e7ff;
  border-color: #d3b9ff;
  color: #6d35b8;
}

.badge.service,
.status-pill.ordered {
  background: var(--surface-alt);
  border-color: var(--line);
  color: var(--muted);
}

.badge.discontinued {
  background: var(--red-soft);
  border-color: #f3bcbc;
  color: var(--red);
}

.badge.flip-fbm {
  background: var(--red-soft);
  border-color: #f3bcbc;
  color: var(--red);
}
.production-action-band {
  align-items: center;
  display: flex;
  justify-content: center;
  margin: 0 auto 24px;
  min-height: 116px;
  padding: 24px;
  width: min(760px, 100%);
}
.production-entry-button {
  font-size: 18px;
  min-height: 64px;
  min-width: min(620px, 100%);
}
.production-table-panel { border-top-left-radius: 0; }
#formulaCount {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text);
  min-width: 420px;
  padding: 18px 22px;
}
#formulaBomPanel .toolbar,
#formulaKitsPanel .toolbar { border-top: 0; }
.disassembly-controls {
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(280px, 1fr) minmax(170px, 220px) auto;
  padding: 18px;
}
.disassembly-parent-picker { position: relative; }
.disassembly-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.disassembly-summary { margin-bottom: 12px; }
.disassembly-selected-formula {
  margin: 12px 0;
}
.disassembly-formula-choice {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 5px;
  display: grid;
  gap: 8px;
  margin: 12px 0;
  padding: 12px;
}
.disassembly-formula-choice-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.disassembly-component-table {
  margin-top: 12px;
}
.disassembly-component-table input {
  max-width: 150px;
}
.disassembly-confirmation-summary {
  background: var(--green-soft);
  border: 1px solid #a5d7ad;
  border-radius: 5px;
  color: var(--green);
  font-weight: 800;
  margin-top: 12px;
  padding: 12px 14px;
}
.disassembly-history {
  margin-top: 18px;
}
dialog::backdrop {
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(1px);
}
dialog { border: 0; padding: 0; }
dialog .dialog-card,
.dialog-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow-strong);
  max-height: min(92vh, 980px);
}
.item-dialog-card {
  max-width: min(1320px, calc(100vw - 120px));
  width: min(1320px, calc(100vw - 120px));
}
.dialog-header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}
.dialog-header .icon-button { border: 0; font-size: 24px; }
.item-edit-sections { gap: 8px; }
.item-edit-card { padding: 12px 14px; }
.item-edit-card-heading { margin-bottom: 10px; }
.image-drop-zone {
  border: 1px dashed #ff9caf;
  border-radius: 5px;
  min-height: 150px;
}
#itemLifecycleStatus.status-active {
  background: var(--green-soft);
  border-color: #a5d7ad;
  color: var(--green);
  font-weight: 900;
}
.dialog-actions {
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 14px;
}
.item-dialog-card > .dialog-actions:last-child {
  background: rgba(255, 255, 255, 0.96);
  bottom: 0;
  margin: 0 -18px -18px;
  padding: 14px 18px;
  position: sticky;
}
.formula-use-banner {
  align-items: center;
  background: var(--ink);
  border-radius: 5px;
  color: var(--surface);
  display: flex;
  justify-content: space-between;
  margin: 18px 0 14px;
  padding: 24px 30px;
}
.formula-use-banner .eyebrow { color: var(--pink); }
.formula-use-banner h3 { color: var(--surface); font-size: 24px; }
.formula-use-banner p {
  color: #f2f2ef;
  margin: 0;
  max-width: 620px;
  text-align: right;
}
.formula-use-lines {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 24px;
}
.formula-use-line {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  grid-template-columns: 50px minmax(260px, 1fr) 220px 260px auto;
  padding: 8px 0 20px;
}
.formula-use-line-number {
  background: var(--ink);
  border-radius: 5px;
  color: var(--surface);
}
.formula-use-yield-hint {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 5px;
}
.formula-use-empty-state {
  border-style: dashed;
  display: grid;
  justify-items: center;
  margin-top: 14px;
  min-height: 250px;
  padding: 54px 24px;
  text-align: center;
}
.formula-use-empty-state strong { font-size: 18px; }
.formula-use-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-top: 18px;
}
.formula-use-summary-item {
  align-items: center;
  border-right: 1px solid var(--line);
  display: grid;
  gap: 4px;
  grid-template-columns: 48px 1fr;
  padding: 18px 24px;
}
.formula-use-summary-item:last-child { border-right: 0; }
.formula-use-summary-icon {
  align-items: center;
  background: var(--pink-soft);
  border-radius: 50%;
  color: var(--ink);
  display: inline-flex;
  height: 42px;
  justify-content: center;
  width: 42px;
}
.formula-use-summary-item strong { display: block; font-size: 20px; }
.formula-use-summary-item span,
.formula-use-summary-item small { color: var(--muted); }
.formula-use-summary-item small { display: block; line-height: 1.35; }
@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar { height: auto; position: static; }
  .app-sidebar .main-nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .app-header { grid-template-columns: 1fr; position: static; }
  .disassembly-controls { grid-template-columns: 1fr; }
  .metrics,
  .home-metrics,
  .home-grid,
  .formula-use-summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .production-action-band { margin: 0 0 18px; width: auto; }
}
@media (max-width: 720px) {
  main { padding: 18px; }
  .app-sidebar { padding: 18px; }
  .app-sidebar .main-nav,
  .metrics,
  .home-metrics,
  .home-grid,
  .formula-use-summary-strip { grid-template-columns: 1fr; }
  .header-actions { justify-content: flex-start; }
  .item-dialog-card {
    max-width: calc(100vw - 24px);
    width: calc(100vw - 24px);
  }
  .formula-use-line { grid-template-columns: 1fr; }
}

/* Compact ERP density pass. Keep this last so shared tables/cards stay tight. */
.app-shell {
  grid-template-columns: 232px minmax(0, 1fr);
}

.app-sidebar {
  gap: 18px;
  padding: 22px 16px;
  width: 232px;
}

.sidebar-brand {
  gap: 8px;
  padding-bottom: 18px;
}

.sidebar-brand img {
  height: 72px;
  width: 138px;
}

.sidebar-brand span {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 4px;
}

.app-sidebar .main-nav {
  gap: 4px;
}

.module-nav .nav-tab,
.app-sidebar .nav-tab {
  font-size: 13px;
  font-weight: 560;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  min-height: 42px;
  padding: 0 10px;
}

.nav-icon,
.nav-icon img,
.nav-icon svg {
  height: 22px;
  width: 22px;
}

.sidebar-help-card {
  gap: 2px;
  padding: 10px;
}

.app-header {
  gap: 12px;
  min-height: 62px;
  padding: 8px 24px;
}

.global-search {
  border-radius: 4px;
  grid-template-columns: 20px 1fr;
  max-width: 520px;
  min-height: 36px;
  padding: 0 10px;
}

.global-search input {
  min-height: 34px;
}

.global-search span {
  font-size: 18px;
}

.header-actions {
  gap: 8px;
}

.upload-pill,
.primary-button,
.text-button,
.mini-button,
.portal-launch-button,
.danger-soft-button,
.danger-outline-button {
  border-radius: 4px;
  font-size: 12px;
  min-height: 32px;
  padding: 0 12px;
}

.upload-pill,
.primary-button,
.portal-launch-button {
  min-height: 36px;
  padding: 0 14px;
}

.header-sync-status,
.header-sync-status.connected {
  min-height: 36px;
  min-width: 210px;
  padding: 4px 10px;
}

.user-button {
  height: 38px;
  width: 38px;
}

main {
  padding: 18px 24px 32px;
}

.section-heading {
  margin-bottom: 16px;
}

h2 {
  font-size: 28px;
}

.subtle {
  font-size: 12px;
  line-height: 1.35;
}

.metrics,
.home-metrics {
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  gap: 5px;
  min-height: 92px;
  padding: 16px 18px;
}

.metric-title {
  font-size: 11px;
  letter-spacing: 0;
}

.metric strong {
  font-size: 29px;
  line-height: 0.98;
}

.metric-helper {
  font-size: 12px;
  line-height: 1.25;
}

.home-grid {
  gap: 12px;
}

.home-panel {
  gap: 10px;
  padding: 14px 16px;
}

.home-panel-heading {
  margin-bottom: 6px;
}

.home-panel-heading h3 {
  font-size: 12px;
}

.home-panel-stats {
  gap: 5px;
}

.home-panel-stats span {
  font-size: 12px;
  gap: 7px;
}

.home-panel-stats strong {
  font-size: 17px;
}

.category-tabs,
.sub-tabs {
  border-radius: 3px 3px 0 0;
}

.category-tab,
.sub-tab {
  font-size: 12px;
  gap: 6px;
  min-height: 42px;
  padding: 0 14px;
}

.toolbar {
  border-radius: 4px 4px 0 0;
  gap: 8px;
  padding: 10px 12px;
}

.toolbar-actions,
.toolbar-right-controls,
.row-actions,
.po-actions {
  gap: 5px;
}

.search-wrap {
  border-radius: 4px;
  min-height: 34px;
  padding: 0 8px;
}

.toolbar select,
.toolbar input,
table select,
table input,
dialog input,
dialog select,
dialog textarea,
.dialog-card input,
.dialog-card select,
.dialog-card textarea,
.production-entry-page input,
.production-entry-page select,
.production-entry-page textarea {
  border-radius: 4px;
  min-height: 32px;
  padding: 0 8px;
}

.drop-upload {
  border-radius: 4px;
  margin-bottom: 10px;
  padding: 8px 10px;
}

.table-panel,
.vendor-group,
.po-block,
.home-panel,
.report-panel,
.settings-panel,
.portal-admin-card,
.integration-card,
.mapping-panel,
.production-action-band,
.formula-use-entry-card,
.formula-use-empty-state,
.formula-use-summary-strip {
  border-radius: 4px;
}

table {
  font-size: 12px;
}

th {
  font-size: 10.5px;
  height: 34px;
  line-height: 1.15;
  padding: 5px 9px;
}

td {
  font-size: 12px;
  height: 42px;
  line-height: 1.25;
  padding: 6px 9px;
}

.column-filter-row th {
  padding: 4px 5px;
}

.column-filter-row input,
.column-filter-row select,
.column-filter-control {
  font-size: 11px;
  min-height: 26px;
  padding: 2px 5px;
}

.settings-panel th,
.settings-panel td {
  font-size: 10.5px;
  padding-left: 3px;
  padding-right: 3px;
}

.contact-table th,
.contact-table td,
.compact-contact-table th,
.compact-contact-table td,
.portal-account-table th,
.portal-account-table td,
.vendor-contact-table th,
.vendor-contact-table td,
.shipstation-reconciliation-table th,
.shipstation-reconciliation-table td,
.stock-history-table th,
.stock-history-table td,
.stock-lot-table th,
.stock-lot-table td,
.erp-price-tier-table th,
.erp-price-tier-table td {
  padding: 6px 8px;
}

.badge,
.status-pill,
.property-pill,
.tier-pill,
.count-pill {
  border-radius: 4px;
  font-size: 10px;
  padding: 3px 7px;
}

.stock-history-link.on-hand-pill {
  border-radius: 4px;
  min-height: 22px;
  min-width: 56px;
  padding: 2px 6px;
}

.pagination-bar {
  border-radius: 4px;
  margin-top: 8px;
  padding: 7px 9px;
}

.po-line {
  gap: 5px;
  padding: 6px 8px;
}

.po-toggle-icon {
  height: 22px;
  min-height: 22px;
  width: 22px;
}

.empty-state {
  padding: 24px 14px;
}

/* Home dashboard redesign */
#view-home {
  max-width: 1640px;
}

.home-heading {
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.home-heading h2 {
  font-size: 25px;
  font-weight: 900;
  line-height: 1.05;
  margin: 2px 0 4px;
}

.home-heading-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  min-height: 30px;
}

.home-date-stamp,
.home-refresh-button {
  align-items: center;
  color: var(--text);
  display: inline-flex;
  font-size: 12px;
  gap: 6px;
}

.home-refresh-button {
  background: transparent;
  border: 0;
  cursor: pointer;
  font-weight: 850;
  padding: 4px 0;
}

.home-refresh-button:hover {
  color: var(--ink);
}

.home-icon {
  align-items: center;
  display: inline-flex;
  flex: 0 0 auto;
  justify-content: center;
}

.home-icon svg {
  fill: none;
  height: 20px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 20px;
}

.home-kpi {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  box-shadow: none;
  display: grid;
  gap: 12px;
  grid-template-columns: auto 1fr;
  min-height: 96px;
  padding: 14px 16px;
}

.home-kpi[data-home-action] {
  cursor: pointer;
}

.home-kpi[data-home-action]:hover,
.home-kpi[data-home-action]:focus-visible {
  border-color: #f2a8b4;
  box-shadow: 0 10px 24px rgba(17, 17, 17, 0.07);
  outline: none;
}

.home-kpi.emphasis {
  background: linear-gradient(135deg, #fff0f3 0%, #fff8f9 74%);
  border-color: #ff9eb0;
  box-shadow: inset 0 -4px 0 #ff9eb0;
}

.home-kpi .home-icon {
  background: #f8f8f8;
  border: 1px solid #e7e3e3;
  border-radius: 4px;
  color: #111;
  height: 38px;
  width: 38px;
}

.home-kpi.emphasis .home-icon {
  background: #ffb4c1;
  border-color: #ffa2b3;
}

.home-kpi-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.home-kpi .metric-title {
  color: #4f545a;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.1;
  text-transform: uppercase;
}

.home-kpi strong {
  color: #050505;
  font-size: 28px;
  font-weight: 900;
  line-height: .98;
}

.home-kpi .metric-helper {
  color: var(--text);
  font-size: 11px;
  line-height: 1.2;
}

.home-kpi.out-of-stock {
  background: #fff6f7;
  border-color: #efb7c1;
}

.home-kpi.out-of-stock .home-icon {
  color: #a12c42;
}

.home-kpi.recommend-discontinue {
  background: #fff6f7;
  border-color: #efb7c1;
}

.home-kpi.recommend-discontinue .home-icon {
  background: #f8f8f8;
  border-color: #e7e3e3;
  color: #a12c42;
}

.home-metrics {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  margin-bottom: 14px;
}

.home-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

.home-analytics-row,
.home-summary-row {
  display: grid;
  gap: 12px;
  grid-template-columns: 1.05fr 1.1fr .9fr .85fr;
}

.home-summary-row {
  grid-template-columns: 1.15fr 1fr 1.08fr;
}

.home-panel {
  background: var(--surface);
  border: 1px solid #dedede;
  border-radius: 5px;
  box-shadow: none;
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px 16px;
}

.home-clickable-panel {
  cursor: pointer;
}

.home-clickable-panel:hover,
.home-clickable-panel:focus-visible {
  border-color: #f2a8b4;
  box-shadow: 0 10px 24px rgba(17, 17, 17, 0.07);
  outline: none;
}

.home-panel-heading {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin: 0;
}

.home-panel-heading h3 {
  color: #111;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
  margin: 0;
  text-transform: uppercase;
}

.home-panel-heading h3 span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.home-view-button {
  background: transparent;
  border: 0;
  color: #4f4f4f;
  cursor: pointer;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 850;
  padding: 0;
}

.home-view-button:hover {
  color: var(--ink);
  text-decoration: underline;
}

.home-order-link {
  background: transparent;
  border: 0;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: inherit;
  padding: 0;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
}

.home-order-link:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.home-order-link:focus-visible {
  border-radius: 3px;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.home-health-layout {
  align-items: center;
  display: grid;
  gap: 16px;
  grid-template-columns: 150px 1fr;
}

.home-donut {
  align-items: center;
  border-radius: 50%;
  display: flex;
  height: 142px;
  justify-content: center;
  position: relative;
  width: 142px;
}

.home-donut::after {
  background: var(--surface);
  border-radius: 50%;
  content: "";
  height: 64px;
  position: absolute;
  width: 64px;
}

.home-donut span {
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  left: 82%;
  position: absolute;
  text-align: center;
  top: 66%;
  transform: translate(-50%, -50%);
  width: 44px;
  z-index: 2;
}

.home-health-legend {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.home-health-row {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: auto minmax(92px, 1fr) auto auto;
}

.home-health-dot {
  border-radius: 50%;
  height: 11px;
  width: 11px;
}

.home-health-dot.tone-1 {
  background: #111;
}

.home-health-dot.tone-2 {
  background: #ff94a9;
}

.home-health-dot.tone-3 {
  background: #d9d9d9;
}

.home-health-dot.tone-4 {
  background: #8a8f98;
}

.home-health-row strong,
.home-health-row span,
.home-health-row b {
  font-size: 12px;
}

.home-health-row span {
  color: var(--text);
}

.home-health-total {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding-top: 10px;
}

.home-health-total span,
.home-value-footer span,
.home-value-footer small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.home-health-total strong,
.home-value-footer strong {
  color: #111;
  font-size: 17px;
  font-weight: 900;
}

.home-data-health-panel {
  align-content: start;
}

.home-data-health-layout {
  grid-template-columns: 142px 1fr;
}

.home-data-health-score-block {
  align-items: center;
  display: grid;
  gap: 8px;
  justify-items: center;
}

.home-data-health-donut::after {
  height: 78px;
  width: 78px;
}

.home-data-health-donut span {
  color: #111;
  font-size: 20px;
  left: auto;
  line-height: 1;
  position: relative;
  top: auto;
  transform: none;
  width: auto;
}

.home-data-health-score-copy {
  display: grid;
  gap: 2px;
  text-align: center;
}

.home-data-health-score-copy strong {
  color: #111;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.home-data-health-score-copy small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.3;
}

.home-data-health-issues {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding-top: 10px;
}

.home-data-health-issue {
  align-items: center;
  background: #fbfafa;
  border: 1px solid #e3dddd;
  border-radius: 5px;
  color: #111;
  cursor: pointer;
  display: flex;
  font-size: 11px;
  font-weight: 850;
  justify-content: space-between;
  min-height: 34px;
  padding: 8px 10px;
  text-align: left;
}

.home-data-health-issue:hover,
.home-data-health-issue:focus-visible {
  border-color: #f2a8b4;
  box-shadow: 0 0 0 3px rgba(252, 201, 201, 0.22);
  outline: none;
}

.home-data-health-issue strong {
  font-size: 14px;
  font-weight: 900;
}

.home-data-health-issue.is-clear {
  background: #f5fbf7;
  border-color: #cae8d2;
}

.home-data-health-issue.is-clear strong {
  color: #2f7d4f;
}

.home-amazon-fba-panel {
  align-content: start;
  gap: 12px;
}

.home-amazon-fba-main {
  align-items: end;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding-bottom: 10px;
}

.home-amazon-fba-main div,
.home-amazon-fba-stats div,
.home-amazon-fba-stats button {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.home-amazon-fba-main span,
.home-amazon-fba-stats span {
  color: #4f545a;
  font-size: 10.5px;
  font-weight: 900;
  line-height: 1.15;
  text-transform: uppercase;
}

.home-amazon-fba-main strong {
  color: #111;
  font-size: 30px;
  font-weight: 900;
  line-height: .95;
}

.home-amazon-fba-main small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  text-align: right;
}

.home-amazon-fba-stats {
  display: grid;
  gap: 7px;
  grid-template-columns: 1fr;
}

.home-amazon-fba-stats div,
.home-amazon-fba-stats button {
  align-items: center;
  background: #fbfafa;
  border: 1px solid #e3dddd;
  border-radius: 5px;
  color: #111;
  display: flex;
  justify-content: space-between;
  min-height: 34px;
  padding: 8px 10px;
  text-align: left;
}

.home-amazon-fba-stats button {
  cursor: pointer;
  font: inherit;
}

.home-amazon-fba-stats button:hover,
.home-amazon-fba-stats button:focus-visible {
  border-color: #f2a8b4;
  box-shadow: 0 0 0 3px rgba(252, 201, 201, 0.22);
  outline: none;
}

.home-amazon-fba-stats strong {
  color: #111;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  margin-left: 10px;
}

.home-select-pill {
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  padding: 5px 9px;
}

.home-value-heading-controls {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.home-value-grouping-control {
  align-items: center;
  display: inline-flex;
  gap: 6px;
}

.home-value-grouping-control span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.home-value-grouping-control select {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  min-width: 88px;
  padding: 5px 8px;
}

.home-value-grouping-control select:focus-visible {
  border-color: #f2a8b4;
  box-shadow: 0 0 0 3px rgba(252, 201, 201, 0.22);
  outline: none;
}

.home-line-chart {
  display: block;
  height: auto;
  margin: 2px 0 0;
  width: 100%;
}

.home-chart-line {
  fill: none;
  stroke: #101010;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.home-chart-gridline {
  fill: none;
  stroke: #e4e4e4;
  stroke-width: 1;
}

.home-chart-point {
  fill: #101010;
}

.home-chart-axis {
  fill: #555;
  font-size: 11px;
}

.home-value-footer {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 4px;
  padding-top: 8px;
}

.home-value-footer small {
  color: #4f545a;
  text-transform: none;
}

.home-urgency-list {
  display: grid;
  gap: 11px;
  padding-top: 6px;
}

.home-urgency-row {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: 64px 1fr 62px;
}

.home-urgency-row span,
.home-urgency-row strong {
  font-size: 12px;
}

.home-urgency-track {
  background: #f0f0f0;
  border-radius: 999px;
  height: 7px;
  overflow: hidden;
}

.home-urgency-track span {
  background: #ff9eb0;
  display: block;
  height: 100%;
}

.home-urgency-total {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding-top: 10px;
}

.home-table-scroll {
  overflow-x: visible;
}

.home-table {
  table-layout: fixed;
  width: 100%;
}

.home-table th,
.home-table td {
  font-size: 11.5px;
  padding: 7px 6px;
  vertical-align: middle;
}

.home-table th {
  color: #4f545a;
  font-size: 10.5px;
  font-weight: 900;
  text-transform: uppercase;
}

.home-category-name {
  align-items: center;
  display: inline-flex;
  gap: 8px;
}

.home-category-name .home-icon {
  color: #111;
}

.home-category-name .home-icon-flask {
  color: #ff7e98;
}

.home-category-name .home-icon-package {
  color: #777;
}

.home-total-row td {
  border-top: 1px solid #d7d7d7;
  font-weight: 900;
}

.home-stock-alerts {
  align-items: center;
  display: grid;
  gap: 14px;
  grid-template-columns: 1.55fr repeat(4, minmax(130px, 1fr)) auto;
  padding: 14px 16px;
}

.home-stock-alert-lead {
  align-items: center;
  display: flex;
  gap: 12px;
}

.home-stock-alert-lead .home-icon {
  color: #ff7d96;
}

.home-stock-alert-lead .home-icon svg {
  height: 30px;
  stroke-width: 1.6;
  width: 30px;
}

.home-stock-alert-lead h3,
.home-stock-alert-item strong {
  color: #111;
  font-size: 12px;
  font-weight: 900;
  margin: 0;
  text-transform: uppercase;
}

.home-stock-alert-lead span,
.home-stock-alert-item span {
  color: var(--text);
  font-size: 12px;
}

.home-stock-alert-item {
  border-left: 2px solid #ff9eb0;
  display: grid;
  gap: 4px;
  padding-left: 12px;
}

.home-stock-alerts .home-view-button {
  border: 1px solid #ff9eb0;
  border-radius: 4px;
  color: #111;
  min-height: 28px;
  padding: 0 14px;
}

@media (max-width: 1180px) {
  .home-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .home-analytics-row,
  .home-summary-row {
    grid-template-columns: 1fr;
  }

  .home-stock-alerts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .home-heading,
  .home-heading-actions {
    align-items: flex-start;
    justify-content: flex-start;
  }

  .home-heading {
    display: grid;
  }

  .home-metrics,
  .home-health-layout,
  .home-stock-alerts {
    grid-template-columns: 1fr;
  }

  .home-data-health-issues,
  .home-amazon-fba-stats,
  .data-health-dialog-summary {
    grid-template-columns: 1fr;
  }
}

.bug-report-button {
  background: var(--pink);
  border: 1px solid #ff9eb0;
  border-radius: 6px;
  color: #111;
  font-size: 12px;
  font-weight: 850;
  min-height: 34px;
  padding: 0 14px;
  white-space: nowrap;
}

.bug-report-button:hover,
.bug-report-button:focus-visible {
  background: #ffd7d7;
  box-shadow: 0 0 0 3px rgba(252, 201, 201, 0.35);
}

#bugReportDialog {
  max-width: calc(100vw - 32px);
  width: min(1680px, calc(100vw - 32px));
}

.bug-report-dialog-card,
.bug-report-admin-dialog-card {
  max-width: 100%;
  overflow-x: hidden;
  width: 100%;
}

.bug-report-dialog-card {
  gap: 10px;
  grid-template-columns: minmax(0, 1.18fr) minmax(360px, 0.82fr);
  max-height: calc(100vh - 28px);
  overflow: hidden;
  padding: 14px;
}

.bug-report-dialog-card .dialog-header,
.bug-report-admin-dialog-card .dialog-header {
  align-items: flex-start;
  gap: 16px;
}

.bug-report-dialog-card .dialog-header {
  grid-column: 1;
  grid-row: 1;
}

.bug-report-summary-row {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 14px;
}

.bug-report-dialog-card .bug-report-summary-row {
  align-self: center;
  grid-column: 2;
  grid-row: 1;
  margin: 0;
}

.bug-report-summary-card {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  min-height: 64px;
  padding: 11px 14px;
}

.bug-report-summary-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.bug-report-summary-card strong {
  color: #111;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
}

.bug-report-summary-card.pink {
  background: var(--pink-soft);
  border-color: #ffb4c1;
}

.bug-report-summary-card.peach {
  background: var(--amber-soft);
  border-color: #f2d8a9;
}

.bug-report-summary-card.green {
  background: var(--green-soft);
  border-color: #bfe0c5;
}

.bug-report-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  margin-top: 0;
  padding: 12px;
}

.bug-report-dialog-card .bug-report-section:nth-of-type(1) {
  grid-column: 1 / -1;
  grid-row: 2;
}

.bug-report-dialog-card .bug-report-section:nth-of-type(2) {
  grid-column: 1;
  grid-row: 3;
}

.bug-report-dialog-card .bug-report-section:nth-of-type(3) {
  align-self: start;
  grid-column: 2;
  grid-row: 3;
}

.bug-report-section-title {
  color: #111;
  font-size: 14px;
  font-weight: 900;
}

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

.bug-report-grid.four-column {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.bug-report-dialog-card textarea {
  min-height: 96px;
  resize: vertical;
}

.bug-report-dialog-card label {
  gap: 5px;
}

.bug-report-dialog-card input,
.bug-report-dialog-card select,
.bug-report-dialog-card textarea {
  min-height: 34px;
}

.bug-report-dialog-card input[readonly],
.bug-report-dialog-card select:disabled {
  background: #fafafa;
  color: #4f545a;
}

.required-dot {
  color: #ff6f8e;
}

.bug-report-upload {
  margin: 0;
  min-height: 74px;
}

.bug-report-upload:hover,
.bug-report-upload:focus-within {
  background: var(--pink-soft);
  border-color: #ff9eb0;
}

.bug-report-attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 22px;
}

.bug-report-dialog-card #bugReportFeedback {
  grid-column: 1 / -1;
  margin: 0;
  min-height: 18px;
}

.bug-report-dialog-card > .dialog-actions {
  grid-column: 1 / -1;
  margin-top: 0;
  padding-top: 10px;
}

.bug-report-attachment-pill {
  align-items: center;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  gap: 8px;
  max-width: 100%;
  padding: 5px 8px 5px 12px;
}

.bug-report-attachment-pill span {
  font-weight: 800;
  max-width: min(320px, 56vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bug-report-attachment-pill small {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.bug-report-admin-detail {
  display: grid;
  gap: 14px;
}

.bug-report-admin-detail section {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 12px;
}

.bug-report-admin-detail h4 {
  font-size: 13px;
  margin: 0;
  text-transform: uppercase;
}

.bug-report-admin-detail p {
  line-height: 1.45;
  margin: 0;
  white-space: pre-wrap;
}

.bug-report-admin-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.bug-report-admin-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 6px;
  padding: 10px 12px;
}

.bug-report-admin-grid span {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 850;
  text-transform: uppercase;
}

.bug-report-admin-grid strong {
  color: #111;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.status-badge.severity-low,
.status-badge.severity-medium,
.status-badge.severity-high,
.status-badge.bug-status-new,
.status-badge.bug-status-in-review,
.status-badge.bug-status-waiting,
.status-badge.bug-status-resolved,
.status-badge.bug-status-closed {
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  padding: 5px 9px;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-badge.severity-low,
.status-badge.bug-status-resolved,
.status-badge.bug-status-closed {
  background: var(--green-soft);
  border-color: #add9b6;
  color: var(--green);
}

.status-badge.severity-medium,
.status-badge.bug-status-new {
  background: var(--pink-soft);
  border-color: #ffb1bf;
  color: #9c4556;
}

.status-badge.severity-high {
  background: var(--red-soft);
  border-color: #efb6b6;
  color: var(--red);
}

.status-badge.bug-status-in-review {
  background: var(--blue-soft);
  border-color: #bfd9ed;
  color: var(--blue);
}

.status-badge.bug-status-waiting {
  background: var(--amber-soft);
  border-color: #efd49e;
  color: var(--amber);
}

.upcoming-releases-panel {
  display: grid;
  gap: 10px;
}

.upcoming-releases-scroll {
  border: 1px solid var(--line);
  border-radius: 6px;
  max-height: calc(100vh - 270px);
  overflow: auto;
}

.upcoming-releases-table {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 2160px;
  table-layout: fixed;
  width: 100%;
}

.upcoming-releases-table th,
.upcoming-releases-table td {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-sizing: border-box;
  font-size: 12px;
  line-height: 1.2;
  overflow: hidden;
  padding: 7px 6px;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.upcoming-releases-table tbody tr:nth-child(even) td {
  background: #fffafa;
}

.upcoming-releases-table thead th {
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 11px;
  position: sticky;
  text-transform: uppercase;
  top: 0;
  z-index: 4;
}

.upcoming-releases-table th.progress-column,
.upcoming-releases-table td.progress-column {
  width: 82px;
}

.upcoming-releases-table .progress-column {
  left: 0;
  min-width: 82px;
  position: sticky;
  z-index: 4;
}

.upcoming-releases-table thead .progress-column {
  z-index: 6;
}

.upcoming-releases-table .launch-name-col {
  left: 82px;
  min-width: 250px;
  width: 250px;
}

.upcoming-releases-table .launch-sku-col {
  left: 332px;
  min-width: 118px;
  width: 118px;
}

.upcoming-releases-table .sticky-launch-col {
  position: sticky;
  z-index: 3;
}

.upcoming-releases-table thead .sticky-launch-col {
  z-index: 5;
}

.upcoming-releases-table .item-name {
  font-weight: 800;
  white-space: normal;
}

.upcoming-release-item-link {
  appearance: none;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  display: inline;
  font: inherit;
  font-weight: inherit;
  line-height: inherit;
  padding: 0;
  text-align: left;
}

.upcoming-release-item-link:hover,
.upcoming-release-item-link:focus-visible {
  color: var(--pink);
  text-decoration: underline;
}

.upcoming-releases-table .sku {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.upcoming-shopify-url-cell {
  align-items: center;
  display: inline-flex;
  gap: 6px;
  max-width: 100%;
  white-space: nowrap;
}

.upcoming-shopify-url-link {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upcoming-shopify-url-edit,
.upcoming-shopify-url-add {
  white-space: nowrap;
}

.launch-progress-cell {
  align-items: center;
  display: grid;
  gap: 4px;
}

.launch-progress-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.launch-progress-track {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 999px;
  display: block;
  height: 7px;
  overflow: hidden;
  width: 100%;
}

.launch-progress-fill {
  display: block;
  height: 100%;
}

.launch-progress-fill.danger {
  background: var(--red);
}

.launch-progress-fill.warning {
  background: var(--amber);
}

.launch-progress-fill.success {
  background: var(--green);
}

.launch-input,
.launch-select {
  border: 1px solid var(--line);
  border-radius: 5px;
  box-sizing: border-box;
  display: block;
  font: inherit;
  min-height: 30px;
  min-width: 0;
  padding: 5px 6px;
  width: 100%;
}

.launch-input[type="number"] {
  min-width: 0;
}

.launch-input[type="date"] {
  min-width: 0;
}

.launch-input[type="url"] {
  min-width: 0;
}

.launch-select {
  font-size: 10px;
  font-weight: 900;
  min-width: 0;
  padding-right: 3px;
  text-transform: uppercase;
}

.launch-select-ordered {
  background: var(--amber-soft);
  border-color: #f1d6a6;
  color: var(--amber);
}

.launch-select-stable {
  background: var(--green-soft);
  border-color: #a5d7ad;
  color: var(--green);
}

.launch-select-watch {
  background: var(--blue-soft);
  border-color: #b8d2e6;
  color: var(--blue);
}

.launch-select-service {
  background: var(--surface-alt);
  border-color: var(--line);
  color: var(--muted);
}

.launch-status-badge {
  box-sizing: border-box;
  display: inline-flex;
  font-size: 10px;
  justify-content: center;
  max-width: 100%;
  min-width: 0;
  padding-left: 7px;
  padding-right: 7px;
  white-space: nowrap;
  width: 100%;
}

@media (max-width: 980px) {
  .bug-report-summary-row,
  .bug-report-grid.four-column,
  .bug-report-admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  #bugReportDialog {
    max-width: calc(100vw - 24px);
    width: calc(100vw - 24px);
  }

  .bug-report-dialog-card,
  .bug-report-admin-dialog-card {
    max-width: calc(100vw - 24px);
    width: calc(100vw - 24px);
  }

  .bug-report-summary-row,
  .bug-report-grid,
  .bug-report-grid.four-column,
  .bug-report-admin-grid {
    grid-template-columns: 1fr;
  }
}

/* Inventory image preview overrides live at the end to beat generic button/dialog rules. */
.settings-panel .item-photo-button,
.item-photo-button {
  appearance: none;
  background: transparent;
  border: 0 !important;
  box-shadow: none !important;
  cursor: zoom-in;
  display: inline-flex;
  line-height: 0;
  margin: 0;
  outline: 0 !important;
  padding: 0;
  vertical-align: middle;
}

.settings-panel .item-photo-button:hover,
.settings-panel .item-photo-button:focus,
.settings-panel .item-photo-button:focus-visible,
.item-photo-button:hover,
.item-photo-button:focus,
.item-photo-button:focus-visible {
  background: transparent;
  border: 0 !important;
  box-shadow: none !important;
  outline: 0 !important;
}

.settings-panel .item-photo-button .item-photo,
.item-photo-button .item-photo {
  border: 1px solid var(--line) !important;
  box-shadow: none !important;
}

#itemImagePreviewDialog {
  max-width: calc(100vw - 24px);
  overflow: hidden;
  width: min(1120px, calc(100vw - 48px));
}

#itemImagePreviewDialog .item-image-preview-dialog-card {
  box-sizing: border-box;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: min(840px, calc(100vh - 48px));
  max-height: calc(100vh - 48px);
  max-width: none;
  overflow: hidden !important;
  width: 100%;
}

#itemImagePreviewDialog .dialog-header {
  gap: 12px;
}

#itemImagePreviewDialog .dialog-header > div {
  min-width: 0;
}

#itemImagePreviewDialog .dialog-header h3 {
  line-height: 1.2;
  overflow-wrap: anywhere;
}

#itemImagePreviewDialog .dialog-header .icon-button {
  flex: 0 0 34px;
}

#itemImagePreviewDialog .item-image-preview-frame {
  min-height: 0;
  overflow: hidden !important;
}

#itemImagePreviewDialog .item-image-preview-frame img {
  height: 100%;
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  object-position: center center;
  width: 100%;
}

/* Quote/order status select colors live last so table and form-control rules cannot flatten them. */
.inline-status-select.inline-status-draft,
table .inline-status-select.inline-status-draft {
  background: var(--amber-soft);
  border-color: #f1d6a6;
  color: var(--amber);
}

.inline-status-select.inline-status-sent,
table .inline-status-select.inline-status-sent,
.inline-status-select.inline-status-open,
table .inline-status-select.inline-status-open {
  background: var(--blue-soft);
  border-color: #b8d2e6;
  color: var(--blue);
}

.inline-status-select.inline-status-accepted,
table .inline-status-select.inline-status-accepted,
.inline-status-select.inline-status-complete,
table .inline-status-select.inline-status-complete,
.inline-status-select.inline-status-shipped,
table .inline-status-select.inline-status-shipped {
  background: var(--green-soft);
  border-color: #bcdcb7;
  color: var(--green);
}

.inline-status-select.inline-status-rejected,
table .inline-status-select.inline-status-rejected,
.inline-status-select.inline-status-canceled,
table .inline-status-select.inline-status-canceled {
  background: var(--red-soft);
  border-color: #f3b9b5;
  color: var(--red);
}

.inline-status-select.inline-status-archived,
table .inline-status-select.inline-status-archived {
  background: var(--surface-alt);
  border-color: var(--line);
  color: var(--muted);
}

.inline-status-select.inline-status-pre-order,
table .inline-status-select.inline-status-pre-order {
  background: #f0e7ff;
  border-color: #d3b9ff;
  color: #6d35b8;
}

/* Inventory Items table: keep the final data columns left-aligned with their headers. */
.settings-panel th:nth-child(n+9):nth-child(-n+15),
.settings-panel td:nth-child(n+9):nth-child(-n+15) {
  text-align: left;
}

/* Item edit currency fields keep the prefix visually attached after generic dialog input rules. */
.item-dialog-card .currency-input > span,
dialog .currency-input > span {
  border-radius: 6px 0 0 6px;
}

.item-dialog-card .currency-input input,
dialog .currency-input input {
  border-left: 0;
  border-radius: 0 6px 6px 0;
  min-width: 0;
}

/* Item edit dialog switch rows keep their layout after generic dialog rules. */
.item-dialog-card label.item-toggle-row {
  align-items: center;
  color: var(--ink);
  display: flex;
  font-size: 11px;
  gap: 14px;
  text-transform: none;
}

.item-dialog-card .item-toggle-row input {
  border: 0;
  height: 1px;
  min-height: auto;
  opacity: 0;
  padding: 0;
  width: 1px;
}

/* ---------------------------------------------------------------------------
   Email modal + floating (non-modal) dialogs. Floating dialogs use .show()
   instead of .showModal() so TinyMCE's body-level popups stay interactive;
   the backdrop div stands in for ::backdrop.
--------------------------------------------------------------------------- */
.floating-dialog-backdrop {
  background: rgba(20, 18, 17, 0.45);
  inset: 0;
  position: fixed;
  z-index: 299;
}

dialog.floating-dialog[open] {
  left: 50%;
  margin: 0;
  max-height: 92vh;
  overflow: auto;
  position: fixed;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 300;
}

dialog.floating-dialog.on-top[open] {
  z-index: 320;
}

/* TinyMCE dropdowns/menus must clear the floating dialogs. */
.tox-tinymce-aux {
  z-index: 400 !important;
}

/* The <dialog> itself carries the width; without an explicit width it collapses
   to the content-minimum and the message-body editor becomes unreadably narrow. */
dialog.email-dialog.floating-dialog[open] {
  width: min(1200px, 96vw);
}

.email-dialog-card {
  max-width: 100%;
  width: 100%;
}

.email-grid {
  display: grid;
  gap: 12px;
}

.email-row {
  align-items: start;
  display: grid;
  gap: 12px;
  grid-template-columns: 110px 1fr;
}

.email-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding-top: 8px;
  text-transform: uppercase;
}

.email-from-display {
  font-weight: 600;
  padding-top: 8px;
}

.chip-field {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: text;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 38px;
  padding: 5px 8px;
}

.chip-field input {
  background: transparent;
  border: 0;
  flex: 1 1 160px;
  min-height: 26px;
  min-width: 140px;
  outline: none;
  padding: 2px 4px;
}

.chip-field input.input-invalid {
  color: var(--red);
}

.email-chip {
  align-items: center;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  font-size: 13px;
  gap: 6px;
  padding: 3px 6px 3px 10px;
}

.email-chip-remove {
  background: transparent;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px 5px;
}

.email-chip-remove:hover {
  background: var(--line);
  color: var(--text);
}

.email-options {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 6px;
}

/* Beat the generic `.dialog-card label { display:grid }` rule. */
.dialog-card label.checkbox-inline,
.checkbox-inline {
  align-items: center;
  color: var(--text);
  display: inline-flex;
  flex-direction: row;
  font-size: 13px;
  font-weight: 600;
  gap: 7px;
  grid-auto-flow: column;
  text-transform: none;
}

.dialog-card label.checkbox-inline input,
.checkbox-inline input {
  min-height: 0;
  width: auto;
}

.email-attach-block {
  display: grid;
  gap: 8px;
}

.email-attach-hint {
  font-size: 12px;
  margin-left: 8px;
}

.email-attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.email-attachment-list:empty {
  display: none;
}

.email-attachment-pill {
  align-items: center;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: inline-flex;
  font-size: 13px;
  gap: 6px;
  padding: 4px 6px 4px 10px;
}

.email-template-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.email-template-row select {
  flex: 1 1 260px;
  max-width: 420px;
}

.email-row-editor {
  align-items: start;
}

.email-editor-wrap {
  min-width: 0;
}

.email-preview-block {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  padding-top: 14px;
}

.email-preview-block h4 {
  margin: 0;
}

.email-preview-head {
  align-items: baseline;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

.email-pdf-preview {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 6px;
  max-height: 520px;
  overflow: auto;
  width: 100%;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.email-pdf-page {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  max-width: 100%;
}

.email-preview-fallback {
  color: var(--muted);
  font-size: 13px;
  padding: 24px;
  text-align: center;
}

.email-footer {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 14px;
}

.email-footer .upload-status {
  flex: 1;
  text-align: right;
}

.po-emailed-note {
  color: var(--muted);
  display: block;
  font-size: 11px;
  margin-top: 4px;
  white-space: nowrap;
}

/* Templates dialog tabs */
dialog#pdfTemplatesDialog.floating-dialog[open] {
  width: min(1080px, calc(100vw - 32px));
}

.email-templates-card {
  max-height: min(92vh, 900px);
  overflow: auto;
  width: 100%;
}

.templates-tab-bar {
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
}

.templates-tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
}

.templates-tab.active {
  border-bottom-color: var(--ink);
  color: var(--text);
}

.email-template-toolbar {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(260px, 0.95fr) minmax(260px, 1.05fr) auto;
  margin-bottom: 12px;
}

.email-template-toolbar label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 700;
  gap: 6px;
  text-transform: uppercase;
}

.email-template-toolbar-buttons {
  display: flex;
  gap: 8px;
}

.email-template-fields {
  display: grid;
  gap: 12px;
}

.email-template-fields .tox-tinymce {
  width: 100% !important;
}

.email-template-meta-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: space-between;
}

.email-merge-picker {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  gap: 8px;
  text-transform: uppercase;
}

@media (max-width: 760px) {
  .email-row {
    grid-template-columns: 1fr;
  }
  .email-label {
    padding-top: 0;
  }
  .email-template-toolbar {
    grid-template-columns: 1fr;
  }
}


/* QuickBooks mapping prompt — shown only when an export has unresolved records */
.qb-map-dialog {
  border: none;
  border-radius: 14px;
  padding: 0;
  max-width: 640px;
  width: calc(100vw - 32px);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
}
.qb-map-dialog::backdrop { background: rgba(15, 23, 42, 0.45); }
.qb-map-prompt { padding: 22px 24px 18px; display: flex; flex-direction: column; gap: 14px; }
.qb-map-prompt h3 { margin: 0; font-size: 1.1rem; }
.qb-map-prompt .subtle { margin: 0; font-size: 0.9rem; }
.qb-map-rows { display: flex; flex-direction: column; gap: 12px; max-height: 52vh; overflow-y: auto; }
.qb-map-row { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(220px, 1.4fr); gap: 12px; align-items: center; }
.qb-map-label { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.qb-map-label strong { overflow-wrap: anywhere; font-size: 0.92rem; }
.qb-map-label small { text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.68rem; opacity: 0.65; }
.qb-map-row select { width: 100%; }
.qb-map-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }
@media (max-width: 560px) {
  .qb-map-row { grid-template-columns: 1fr; gap: 4px; }
}

/* Exported-to-QuickBooks state on the PO register row */
.mini-button.qb-exported { color: var(--green, #0a7444); border-color: currentColor; }
.mini-button.qb-exported.qb-dirty {
  background: #fff7e6;
  border-color: #f0b44f;
  color: #9a5b00;
}

/* Purchased register: compact rows and icon actions */
.po-sort-header {
  background: none; border: none; padding: 0; font: inherit; color: inherit;
  cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
}
.po-sort-header:hover { text-decoration: underline; }
.po-sort-header.active { font-weight: 700; }
.po-sort-arrow { font-size: 0.8em; opacity: 0.75; }
.mini-button.icon-only {
  padding: 3px 6px; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
}
.mini-button.icon-only svg {
  width: 14px; height: 14px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: block;
}
.po-tracking-actions { gap: 4px; }
.qb-map-empty { display: block; margin-top: 4px; opacity: 0.75; line-height: 1.35; }

/* Invoice register: the Customer column absorbed all slack, leaving a wide gap
   before Status. Constrain it (full name still available on hover) and give the
   Actions cell room for Edit + Delete. */
.customer-invoice-table .invoice-customer-cell {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.customer-invoice-table .invoice-qb-cell {
  min-width: 92px;
  white-space: nowrap;
}
.customer-invoice-table .invoice-actions-cell {
  display: flex;
  gap: 6px;
  align-items: center;
  white-space: nowrap;
}
.mini-button.danger-outline-button {
  color: var(--red, #b02214);
  border-color: currentColor;
  background: transparent;
}
.mini-button.danger-outline-button:hover { background: rgba(176, 34, 20, 0.08); }
