:root {
  color-scheme: light;
  font-family: system-ui, sans-serif;
  line-height: 1.5;
}

body {
  margin: 0;
  background: #f6f6f2;
  color: #20231f;
}

header,
main {
  max-width: 70rem;
  margin: 0 auto;
  padding: 1rem 1.5rem;
}

header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

header a,
.link-button {
  color: inherit;
  text-decoration: none;
}

.brand {
  font-weight: 700;
}

header nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

header nav form {
  margin: 0;
}

.primary-nav {
  position: relative;
}

.nav-menu {
  position: relative;
}

.nav-menu > summary {
  cursor: pointer;
  list-style: none;
}

.nav-menu > summary::-webkit-details-marker {
  display: none;
}

.nav-menu > summary::after {
  content: " ▾";
  font-size: 0.8em;
}

.nav-menu[open] > summary::after {
  content: " ▴";
}

.nav-menu-items {
  position: absolute;
  z-index: 20;
  top: calc(100% + 0.45rem);
  left: 0;
  display: grid;
  min-width: 12rem;
  padding: 0.45rem;
  border: 1px solid #d6d9d1;
  border-radius: 0.45rem;
  background: #fff;
  box-shadow: 0 0.7rem 1.8rem rgba(32, 35, 31, 0.12);
}

.nav-menu-items a {
  padding: 0.5rem 0.6rem;
  border-radius: 0.3rem;
  white-space: nowrap;
}

.nav-menu-items a:hover {
  background: #f1f3ee;
}

.link-button {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.form-card {
  max-width: 28rem;
}

.login-shell {
  display: flex;
  justify-content: center;
  padding: clamp(2.5rem, 8vh, 6rem) 0 4rem;
}

.login-card {
  width: min(100%, 28rem);
  padding: 2rem;
  border: 1px solid #d6d9d1;
  border-radius: 0.75rem;
  background: #fff;
  box-shadow: 0 0.8rem 2.2rem rgba(32, 35, 31, 0.08);
}

.login-heading {
  margin-bottom: 1.5rem;
}

.login-heading h1 {
  margin: 0.25rem 0 0.45rem;
}

.login-heading p {
  margin: 0;
  color: #596157;
}

.login-eyebrow {
  color: #3f6543;
  font-size: 0.82rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.login-form .field {
  margin-bottom: 1.1rem;
}

.login-form label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 650;
}

.login-form input[type="email"],
.login-form input[type="text"],
.login-form input[type="password"] {
  box-sizing: border-box;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid #aeb5aa;
  border-radius: 0.4rem;
  background: #fff;
  color: #20231f;
}

.login-form input:focus {
  border-color: #24577a;
  outline: 0.16rem solid rgba(36, 87, 122, 0.16);
  outline-offset: 0.05rem;
}

.login-submit {
  width: 100%;
  margin-top: 0.25rem;
}

.login-error {
  margin-bottom: 1.25rem;
  padding: 0.75rem 0.85rem;
  border-left: 0.25rem solid #b3261e;
  border-radius: 0.35rem;
  background: #fff2f0;
  color: #7f1712;
}

input,
button {
  font: inherit;
}

.error {
  color: #a01919;
}

h1,
h2 {
  line-height: 1.2;
}

a {
  color: #24577a;
}

.prominent-link {
  font-weight: 650;
  text-underline-offset: 0.18em;
}

.prominent-link:hover {
  text-decoration-thickness: 0.12em;
}

.button {
  display: inline-block;
  padding: 0.55rem 0.9rem;
  border: 1px solid #24577a;
  border-radius: 0.35rem;
  background: #24577a;
  color: #fff;
  cursor: pointer;
  font-weight: 650;
  text-decoration: none;
}

.button-secondary {
  border-color: #899287;
  background: #fff;
  color: #20231f;
}

.button-danger-secondary {
  border-color: #b3261e;
  background: #fff;
  color: #8a1c17;
}

.button-danger-secondary:hover {
  background: #fff2f0;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.next-action {
  display: grid;
  gap: 0.45rem;
  margin: 1rem 0 1.5rem;
}

.next-action > span {
  color: #596157;
}

.readiness-next-steps {
  margin: 1rem 0 1.5rem;
  padding: 1rem 1.1rem;
  border: 1px solid #d6d9d1;
  border-radius: 0.5rem;
  background: #fff;
}

.readiness-next-steps h3 {
  margin: 0 0 0.75rem;
}

.readiness-next-steps ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: readiness-step;
}

.readiness-next-steps li {
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem 0;
  counter-increment: readiness-step;
}

.readiness-next-steps li::before {
  content: counter(readiness-step) ".";
  align-self: start;
  font-weight: 700;
}


.readiness-next-steps li + li {
  border-top: 1px solid #e1e3de;
}

.readiness-next-steps .button {
  white-space: nowrap;
}

.readiness-details-title {
  margin-bottom: 0.65rem;
}

@media (max-width: 42rem) {
  .readiness-next-steps li {
    grid-template-columns: 1.6rem minmax(0, 1fr);
  }

  .readiness-next-steps .button {
    grid-column: 2;
    width: max-content;
  }
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.page-heading h1,
.page-heading p {
  margin-top: 0;
}

.card,
.notice,
.empty-state {
  padding: 1.25rem;
  border: 1px solid #d6d9d1;
  border-radius: 0.5rem;
  background: #fff;
}

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 650;
}

.help {
  color: #596157;
  font-size: 0.92rem;
}

.notice {
  margin: 1.25rem 0;
  border-left: 0.3rem solid #b58b17;
  background: #fffaf0;
}

.notice-error,
.message-error {
  border-color: #a01919;
  background: #fff3f3;
}

.message {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid #b9c7b5;
  border-radius: 0.35rem;
  background: #f2f8f0;
}

.message-info {
  border-color: #9bb7ca;
  background: #f0f7fb;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid #e1e3de;
  text-align: left;
  vertical-align: top;
}

th {
  background: #ecefe9;
  white-space: nowrap;
}

.number {
  text-align: right;
}

.result-reason {
  width: 22rem;
  min-width: 18rem;
  max-width: 22rem;
}

.result-reason-preview {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  line-height: 1.35;
}

.result-reason-details {
  margin-top: 0.2rem;
  font-size: 0.9rem;
}

.result-reason-details > summary {
  width: max-content;
  cursor: pointer;
  color: #3f6543;
  font-weight: 650;
}

.result-reason-full {
  margin-top: 0.4rem;
  line-height: 1.4;
}

.inventory-why {
  min-width: 16rem;
  max-width: 24rem;
}

.inventory-why-preview {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  line-height: 1.35;
}

.inventory-why-details {
  margin-top: 0.2rem;
  font-size: 0.9rem;
}

.inventory-why-details > summary {
  width: max-content;
  cursor: pointer;
  color: #3f6543;
  font-weight: 650;
}

.inventory-why-full {
  margin-top: 0.4rem;
  line-height: 1.4;
}

.inventory-why-flags {
  margin-top: 0.4rem;
}

.status,
.severity {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: #e5e8e1;
  font-size: 0.84rem;
  font-weight: 650;
  white-space: nowrap;
}

.status-active {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.status-spinner {
  box-sizing: border-box;
  width: 0.8rem;
  height: 0.8rem;
  flex: 0 0 auto;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: status-spin 0.8s linear infinite;
}

@keyframes status-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .status-spinner {
    animation: none;
  }
}

.status-validated,
.status-imported,
.status-open,
.status-completed,
.status-sent,
.status-normal {
  background: #dcefd8;
  color: #24551e;
}

.status-received {
  background: #dfe7ef;
  color: #27485f;
}

.status-rejected,
.status-failed,
.status-incomplete_data,
.severity-error,
.severity-blocking {
  background: #f5d8d8;
  color: #7b1717;
}

.severity-warning {
  background: #f6e9bd;
  color: #6a4d00;
}

.status-suppressed {
  background: #f6e9bd;
  color: #6a4d00;
}

pre {
  overflow-x: auto;
  padding: 1rem;
  border: 1px solid #d7dbd3;
  border-radius: 0.4rem;
  background: #fff;
  white-space: pre-wrap;
}

.status-high {
  background: #f6e9bd;
  color: #6a4d00;
}

.status-critical {
  background: #f5d8d8;
  color: #7b1717;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.summary-grid div {
  padding: 1rem;
  border: 1px solid #d6d9d1;
  border-radius: 0.5rem;
  background: #fff;
}

.summary-grid dt {
  color: #596157;
  font-size: 0.9rem;
}

.summary-grid dd {
  margin: 0.2rem 0 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.summary-grid .summary-text {
  font-size: 1rem;
}

.business-settings-summary dd {
  font-size: 1.2rem;
  line-height: 1.35;
}

.business-settings-summary dt {
  font-size: 0.86rem;
}

.confirmation-form {
  margin: 1.25rem 0;
}

.settings-group {
  margin: 0 0 1.25rem;
}

.settings-group legend {
  padding: 0 0.4rem;
  font-weight: 700;
}

.settings-group input:not([type="checkbox"]),
.settings-group textarea {
  box-sizing: border-box;
  width: min(100%, 32rem);
  padding: 0.45rem;
}

.checkbox-field label {
  display: inline;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 1rem 0;
}

@media (max-width: 42rem) {
  header,
  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

.upload-options {
  display: grid;
  gap: 1.5rem;
}

.upload-option {
  max-width: none;
}

.upload-option > summary {
  cursor: pointer;
}

.upload-option-summary h2 {
  display: inline;
  margin-left: 0.5rem;
  font-size: 1.25rem;
}

.upload-option-body {
  margin-top: 1rem;
}

.upload-option-focused {
  border-color: #24577a;
}

.upload-option-body h2 {
  margin: 0.45rem 0 0;
}

.upload-option-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e1e3de;
}

.upload-current-state {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.9rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid #b9c7b5;
  border-radius: 0.4rem;
  background: #f2f8f0;
  font-size: 0.9rem;
}

.upload-current-state-missing {
  border-color: #d7c891;
  background: #fffaf0;
}

.upload-option-secondary {
  background: #fafbf9;
}

@media (max-width: 42rem) {
  .upload-option-heading {
    flex-direction: column;
  }

  .upload-current-state {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
  }
}

.workflow-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}

.workflow-steps li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.65rem;
  align-items: start;
  padding: 0.85rem;
  border: 1px solid #d6d9d1;
  border-radius: 0.5rem;
  background: #fff;
}

.workflow-step-number {
  display: grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: #e9ece6;
  font-weight: 750;
}

.workflow-steps li div {
  display: grid;
  gap: 0.12rem;
}

.workflow-steps li div span {
  color: #667064;
  font-size: 0.88rem;
}

.workflow-complete {
  border-color: #b9c7b5 !important;
  background: #f5faf3 !important;
}

.workflow-complete .workflow-step-number {
  background: #dcebd8;
}

.workflow-active {
  border-color: #829d84 !important;
  box-shadow: inset 0 0 0 1px #829d84;
}

.workflow-active .workflow-step-number {
  background: #dcebd8;
}

.workflow-waiting {
  opacity: 0.72;
}

.forecast-workspace-card {
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  border: 1px solid #d6d9d1;
  border-radius: 0.6rem;
  background: #fff;
}

.forecast-run-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid #e1e3de;
}

.forecast-run-cta > div {
  display: grid;
  gap: 0.15rem;
}

.forecast-run-cta > div span {
  color: #596157;
}

.forecast-latest-result {
  margin-top: 1.5rem;
}

.section-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 1.4rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #d6d9d1;
}

.section-tabs a {
  padding: 0.45rem 0.65rem;
  border-radius: 0.35rem;
  color: #24577a;
  font-weight: 650;
  text-decoration: none;
}

.section-tabs a[aria-current="page"] {
  background: #24577a;
  color: #fff;
}

.section-tabs a:focus-visible {
  outline: 2px solid #24577a;
  outline-offset: 2px;
}

.section-tabs a:hover:not([aria-current="page"]) {
  background: #edf2f4;
}

.ready2order-tabs {
  gap: 1.35rem;
  padding-bottom: 0;
}

.ready2order-tabs a {
  position: relative;
  padding: 0.5rem 0 0.65rem;
  border-radius: 0;
  background: transparent;
}

.ready2order-tabs a[aria-current="page"] {
  background: transparent;
  color: #20231f;
}

.ready2order-tabs a[aria-current="page"]::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 3px;
  background: #24577a;
  content: "";
}

.ready2order-tabs a:hover:not([aria-current="page"]) {
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

#summary,
#transfers,
#manufacturer-orders,
#inventory-analysis,
#data-issues {
  scroll-margin-top: 1rem;
}

.forecast-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.forecast-primary {
  min-width: 0;
}

.forecast-card-heading,
.forecast-action-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.forecast-card-heading h2,
.forecast-action-heading h2 {
  margin: 0.25rem 0 0;
}

.forecast-run-action {
  margin: 1.75rem 0;
}

.forecast-older-runs {
  margin-top: 1.75rem;
  padding: 1rem;
  border: 1px solid #d6d9d1;
  border-radius: 0.5rem;
  background: #fff;
}

.forecast-older-runs summary {
  cursor: pointer;
  font-weight: 700;
}

@media (max-width: 42rem) {
  .forecast-card-heading,
  .forecast-action-heading,
  .forecast-run-cta {
    flex-direction: column;
    align-items: flex-start;
  }

  .workflow-steps {
    grid-template-columns: 1fr;
  }

  .nav-menu {
    width: 100%;
  }

  .nav-menu-items {
    position: static;
    margin-top: 0.35rem;
    box-shadow: none;
  }
}

.settings-horizon-card {
  display: grid;
  gap: 0.25rem;
  margin: 1rem 0 1.5rem;
  padding: 1rem 1.1rem;
  border: 1px solid #b9c7b5;
  border-radius: 0.5rem;
  background: #f2f8f0;
}

.settings-horizon-card strong {
  font-size: 1.05rem;
}

.settings-advanced {
  margin: 1.5rem 0;
  padding: 1rem;
  border: 1px solid #d6d9d1;
  border-radius: 0.5rem;
  background: #fff;
}

.settings-advanced > summary {
  cursor: pointer;
  font-weight: 700;
}

.history-older {
  margin-top: 1.5rem;
  padding: 1rem;
  border: 1px solid #d6d9d1;
  border-radius: 0.5rem;
  background: #fff;
}

.history-older > summary {
  cursor: pointer;
  font-weight: 700;
}

.upload-option[id] {
  scroll-margin-top: 1rem;
}


.result-audit-details {
  margin: 1.5rem 0;
}

.result-audit-details > summary {
  cursor: pointer;
  font-weight: 700;
}

.result-audit-details .summary-text {
  overflow-wrap: anywhere;
}

.inventory-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: 0.75rem 1rem;
  margin: 1rem 0;
}

.inventory-filter-field label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 600;
}

.inventory-filter-field input,
.inventory-filter-field select {
  box-sizing: border-box;
  width: 100%;
  min-height: 2.5rem;
  padding: 0.5rem;
  font: inherit;
}

.inventory-filter-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}


.sync-error-details {
  margin-top: 0.35rem;
  max-width: 28rem;
}

.sync-error-details > summary {
  width: max-content;
  cursor: pointer;
  color: #8b2c2c;
  font-weight: 650;
}

.sync-error-details p {
  margin: 0.35rem 0 0;
}

.settings-exclusions {
  margin: 2rem 0;
}

.settings-exclusion-form {
  display: grid;
  grid-template-columns: minmax(12rem, 0.8fr) minmax(16rem, 1.4fr) auto;
  gap: 1rem;
  align-items: start;
  margin-top: 1rem;
}

.settings-exclusion-form input {
  box-sizing: border-box;
  width: 100%;
  min-height: 2.55rem;
  padding: 0.45rem;
}

.settings-exclusion-form .field {
  margin: 0;
}

.settings-exclusion-action {
  padding-top: 1.75rem;
}

.settings-exclusion-action .button {
  min-height: 2.55rem;
  white-space: nowrap;
}

@media (max-width: 52rem) {
  .settings-exclusion-form {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .settings-exclusion-action {
    padding-top: 0;
  }
}

.global-rules-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  margin-top: 2rem;
}

.global-rules-card h2,
.global-rules-card p {
  margin-top: 0;
}

.global-rules-card p:last-child {
  margin-bottom: 0;
}

.exclusions-heading {
  margin-bottom: 0.75rem;
}

@media (max-width: 42rem) {
  .global-rules-card {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.75rem;
  }
}


.wide-table {
  min-width: 0;
}

.wide-table-scroll-top {
  position: sticky;
  top: 0.5rem;
  z-index: 3;
  width: 100%;
  max-width: 100%;
  min-height: 1.25rem;
  overflow-x: scroll;
  overflow-y: hidden;
  background: #fff;
}

.wide-table-scroll-top[hidden] {
  display: none;
}

.wide-table-scroll-top > div {
  height: 1px;
}

.wide-table-scroll-top:focus-visible,
.wide-table > .table-wrap:focus-visible {
  outline: 2px solid #3f6543;
  outline-offset: 2px;
}

.wide-result-table th {
  min-width: 5rem;
  max-width: 10rem;
  white-space: normal;
}

.wide-result-table td:first-child {
  min-width: 10rem;
  max-width: 16rem;
  overflow-wrap: anywhere;
}

.wide-result-table .result-reason {
  width: 18rem;
  min-width: 15rem;
  max-width: 18rem;
}

.issue-group {
  margin: 0.65rem 0;
  padding: 0.85rem 1rem;
  border: 1px solid #d6d9d1;
  border-radius: 0.4rem;
  background: #fff;
  overflow-wrap: anywhere;
}

.issue-group > summary {
  cursor: pointer;
  line-height: 1.7;
}

.issue-group-count {
  color: #596157;
  margin-left: 0.6rem;
}

.issue-group p {
  margin: 0.65rem 0;
}

#issue-details {
  scroll-margin-top: 1rem;
}

.section-heading-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.section-heading-actions h2 {
  margin-bottom: 0.5rem;
}
