:root {
  color-scheme: light;
  /* One height for the top bar and the drawer headers that line up with it. */
  --topbar-height: 65px;
}
body {
  margin: 0;
}
button,
input {
  font: inherit;
}
a {
  color: inherit;
  text-decoration: none;
}
.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 232px;
  background: white;
  border-right: 1px solid #e4ebed;
  z-index: 20;
  display: flex;
  flex-direction: column;
}
.brand {
  height: 90px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
}
.brand-copy {
  min-width: 0;
}
.brand-name {
  /* Match the fixed dark SVG wordmark; its light version is used on the login page. */
  color: #1d3138;
}
.brand-sub {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.3;
  letter-spacing: 1px;
  color: #6c7c83;
}
.sidebar-bottom {
  margin-top: auto;
  padding: 20px;
}
.app-main {
  margin-left: 232px;
}
.topbar {
  /* Stays in view while the page scrolls. */
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--topbar-height);
  padding: 0 36px;
  background: #ffffff;
  border-bottom: 1px solid #e7edef;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}
.topbar > * {
  flex-shrink: 0;
}
.content {
  max-width: 1600px;
  margin: 0 auto;
  padding: 32px 36px 54px;
}
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 27px;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  color: #84959b;
  margin-bottom: 10px;
  font-weight: 650;
}
.muted {
  color: #7c8c92;
  font-size: 13px;
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) var(--dashboard-side);
  gap: 18px;
  margin-bottom: 26px;
}
.metric {
  padding: 22px;
  background: white;
  border: 1px solid #e7edef;
  border-radius: 12px;
}
.metric-number {
  font-size: 32px;
  line-height: 1.5;
  color: #203b42;
  letter-spacing: -1px;
  font-weight: 650;
}
/*
 * The dashboard's side column and the last metric card share one width and the same gap, so
 * the to-do panel always sits exactly under the last card, at a readable width.
 */
:root {
  --dashboard-side: clamp(320px, 22vw, 380px);
}
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--dashboard-side);
  gap: 18px;
  /* Cards in one row share top and bottom edges. */
  align-items: stretch;
}
.dashboard-main {
  min-width: 0;
}
.panel-title {
  /* A fixed height (border included), so card titles match whatever sits on their right. */
  height: var(--topbar-height);
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #edf1f2;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.detail-label {
  font-size: 12px;
  color: #819097;
  margin-bottom: 7px;
}
.detail-value {
  font-size: 14px;
  font-weight: 550;
}
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  padding-top: 9px;
}
.field-grid .wide {
  grid-column: 1 / -1;
}
.empty {
  padding: 52px 24px;
  color: #87989d;
  text-align: center;
}
/* ---- Login ------------------------------------------------------------------------------
   Warm paper page: brand, headline and form on the left; on the right a deep "product window"
   (ledger-ruled) that plays one transaction between two enterprises (.stage-*). Motion: content
   rises in once; the window loops; everything stops under reduced motion. */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(440px, 0.8fr) minmax(0, 1fr);
  gap: 20px;
  padding: 20px;
  background: #f6f5f1;
}
.login-side {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 28px 44px 20px 40px;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.login-main {
  max-width: 460px;
}
.login-headline {
  margin: 0;
  font-size: clamp(34px, 3vw, 46px);
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: -0.6px;
  color: #12201d;
}
.login-lede {
  margin: 18px 0 0;
  max-width: 400px;
  font-size: 15px;
  line-height: 1.85;
  color: #5b6b66;
}
.login-footnote {
  font-size: 12px;
  color: #8a958f;
}
.login-arrow {
  transition: transform 0.2s ease;
}
.MuiButton-root:hover .login-arrow {
  transform: translateX(3px);
}
.login-showcase {
  position: relative;
  display: grid;
  place-items: center;
  padding: 48px;
  border-radius: 10px;
  background-color: #0f2a26;
  /* Faint ledger rules: the window is "the books" both enterprises keep. */
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0 43px,
    rgba(255, 255, 255, 0.04) 43px 44px
  );
  overflow: hidden;
}

/* The product window. */
.stage {
  width: min(820px, 100%);
  color: #e8f1ee;
}
.stage-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.stage-title {
  font-size: 15px;
  letter-spacing: 0.12em;
  color: #a9c3bb;
}
.stage-live {
  font-size: 12px;
  color: #a9c3bb;
}
.stage-live i {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  background: #7fd1b9;
  vertical-align: middle;
  animation: stage-live 2s ease-in-out infinite;
}
.stage-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px minmax(0, 1fr);
  align-items: center;
}
.stage-card {
  padding: 20px 20px 18px;
  border-radius: 8px;
  background: #fff;
  color: #12201d;
  transition: box-shadow 0.4s ease;
}
.stage-card.is-active {
  box-shadow: 0 0 0 2px #7fd1b9;
}
.stage-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.stage-card-side {
  font-size: 15px;
  font-weight: 700;
}
.stage-card-role {
  padding: 0 6px;
  border: 1px solid #d9dee2;
  border-radius: 4px;
  font-size: 12px;
  color: #5b6b66;
}
.stage-order {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 0;
  border-top: 1px solid #edf0ef;
  border-bottom: 1px solid #edf0ef;
}
.stage-order-no {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.stage-order-item {
  margin-top: 2px;
  font-size: 12px;
  color: #5b6b66;
}
.stage-chip {
  flex: none;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  animation: stage-chip 0.35s ease;
}
.stage-chip.tone-wait {
  background: #fff1d6;
  color: #9a5b00;
}
.stage-chip.tone-ok {
  background: #e7f4ec;
  color: #1d7348;
}
.stage-chip.tone-move {
  background: #e6f0f7;
  color: #2c6489;
}
.stage-stock {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 14px;
}
.stage-stock-label {
  font-size: 12px;
  color: #5b6b66;
}
.stage-stock-value {
  font-size: 30px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.stage-stock-value small {
  font-size: 13px;
  font-weight: 400;
  color: #5b6b66;
}
.stage-stock-note {
  margin-top: 2px;
  font-size: 12px;
  text-align: right;
  color: #5b6b66;
}
.stage-link {
  position: relative;
  height: 100%;
  min-height: 60px;
}
.stage-link-line {
  position: absolute;
  top: 50%;
  left: 10px;
  right: 10px;
  height: 1px;
  background-image: repeating-linear-gradient(
    to right,
    rgba(255, 255, 255, 0.4) 0 6px,
    transparent 6px 12px
  );
}
.stage-link-flow {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
}
.stage-link-dot {
  position: absolute;
  top: -5px;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 50%;
  background: #7fd1b9;
}
.dir-right .stage-link-dot {
  animation: stage-move-right 1.4s ease-in-out infinite;
}
.dir-left .stage-link-dot {
  animation: stage-move-left 1.4s ease-in-out infinite;
}
.dir-both .stage-link-dot {
  left: 50%;
  animation: stage-pulse 1.4s ease-in-out infinite;
}
.stage-link-label {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 12px;
  white-space: nowrap;
  animation: stage-chip 0.35s ease;
}
.stage-settle {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-top: 18px;
  padding: 14px 18px;
  border-radius: 8px;
  background: #fff;
  color: #12201d;
  font-size: 13px;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
}
.stage-settle.is-on {
  opacity: 1;
  transform: none;
}
.stage-settle b {
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}
.stage-settle-ok {
  margin-left: auto;
  padding: 3px 8px;
  border-radius: 4px;
  background: #e7f4ec;
  color: #1d7348;
  font-size: 12px;
  font-weight: 600;
}
.stage-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}
.stage-steps li {
  font-size: 12px;
  color: #7f9b93;
  transition: color 0.3s ease;
}
.stage-steps li.is-done {
  color: #cfe3dd;
}
.stage-steps li.is-now {
  color: #fff;
  font-weight: 600;
}
.stage-step-bar {
  position: relative;
  display: block;
  height: 2px;
  margin-bottom: 9px;
  background: rgba(255, 255, 255, 0.15);
  overflow: hidden;
}
.stage-steps li.is-done .stage-step-bar {
  background: #7fd1b9;
}
.stage-step-fill {
  position: absolute;
  inset: 0;
  background: #7fd1b9;
  transform-origin: left;
  animation: stage-fill 2.8s linear forwards;
}
@keyframes stage-live {
  50% {
    opacity: 0.35;
  }
}
@keyframes stage-chip {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}
@keyframes stage-move-right {
  from {
    left: 8%;
  }
  to {
    left: 92%;
  }
}
@keyframes stage-move-left {
  from {
    left: 92%;
  }
  to {
    left: 8%;
  }
}
@keyframes stage-pulse {
  50% {
    transform: scale(1.6);
    opacity: 0.6;
  }
}
@keyframes stage-fill {
  from {
    transform: scaleX(0);
  }
}

/* Content rises in once, staggered by --d. */
.rise {
  opacity: 0;
  transform: translateY(12px);
  animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  animation-delay: var(--d, 0ms);
}
@keyframes rise {
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .rise {
    opacity: 1;
    transform: none;
    animation: none;
  }
  .stage-live i,
  .stage-chip,
  .stage-link-label,
  .stage-link-dot,
  .stage-step-fill {
    animation: none;
  }
}
@media (max-width: 1100px) {
  .login-page {
    grid-template-columns: 1fr;
  }
  .login-showcase {
    display: none;
  }
  .login-side {
    padding: 24px;
    gap: 48px;
  }
}
.print-only {
  display: none;
}
@media (max-width: 1150px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .app-sidebar {
    width: 200px;
  }
  .app-main {
    margin-left: 200px;
  }
  .content {
    padding: 25px 22px;
  }
  .topbar {
    padding: 0 22px;
  }
}
@media (max-width: 800px) {
  .app-sidebar {
    width: 70px;
  }
  .brand {
    padding: 0;
    justify-content: center;
  }
  .brand-copy,
  .nav-label,
  .nav-text,
  .sidebar-bottom {
    display: none;
  }
  .nav-item {
    justify-content: center;
  }
  .nav-item .MuiListItemIcon-root {
    min-width: 0;
  }
  .app-main {
    margin-left: 70px;
  }
  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }
  .topbar {
    height: auto;
    min-height: var(--topbar-height);
    padding: 12px 18px;
    flex-wrap: wrap;
  }
  .content {
    padding: 24px 16px;
  }
  .page-heading {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .detail-grid {
    grid-template-columns: 1fr 1fr;
  }
}
/* Picking board: the focus panel's content eases in when the order changes. */
.board-enter {
  animation: board-enter 0.5s ease;
}
@keyframes board-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .board-enter {
    animation: none;
  }
}
/* A printed order sheet (PrintSheet): hidden on screen; when printing, it is the only thing
   on the paper. */
.print-sheet {
  display: none;
}
@media print {
  .app-sidebar,
  .topbar,
  .no-print {
    display: none !important;
  }
  .app-main {
    margin: 0;
  }
  .content {
    padding: 0;
  }
  body {
    background: white;
  }
  .print-only {
    display: block;
  }
  @page {
    size: A4;
    margin: 14mm;
  }
  body.printing-sheet #root {
    display: none !important;
  }
  body.printing-sheet .print-sheet {
    display: block;
    color: #000;
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
  }
}
