:root {
  --ink: #17232d;
  --ink-soft: #405361;
  --navy: #1d2a33;
  --graphite: #25333d;
  --accent: #0b5f73;
  --accent-strong: #084f61;
  --accent-soft: #e7f0f2;
  --canvas: #edf0f2;
  --surface: #ffffff;
  --surface-muted: #f6f7f8;
  --line: #c8d1d8;
  --line-soft: #dfe5e9;
  --muted: #5a6975;
  --success: #246647;
  --success-soft: #edf5f0;
  --warning: #8a6100;
  --warning-soft: #fff7df;
  --danger: #9f3027;
  --danger-soft: #fbefed;
  --radius: 3px;
}

html {
  background: var(--canvas);
}

body {
  background: var(--canvas);
  color: var(--ink);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", sans-serif;
}

h1,
h2,
h3 {
  letter-spacing: -0.015em;
}

h1 {
  font-size: clamp(1.45rem, 2.2vw, 1.8rem);
  font-weight: 700;
}

h2 {
  font-size: 1rem;
}

h3 {
  font-size: 0.94rem;
}

.eyebrow,
.brand small {
  display: none;
}

.muted,
.panel-head p,
.page-heading p,
.login-intro {
  color: var(--muted);
}

.button,
input,
select,
textarea {
  border-radius: 3px;
}

.button {
  min-height: 38px;
  padding: 0 15px;
  border-width: 1px;
  font-size: 0.82rem;
  font-weight: 600;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.button:hover {
  transform: none;
}

.button:focus-visible,
.nav-button:focus-visible,
.text-button:focus-visible,
.icon-button:focus-visible,
.recent-item:focus-visible {
  outline: 2px solid #78b7c5;
  outline-offset: 2px;
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
}

.button.primary:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.button.secondary {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink-soft);
}

.button.secondary:hover {
  border-color: #9daab3;
  background: #f4f6f7;
}

.button.danger {
  border-color: #d8aaa5;
  background: var(--danger-soft);
  color: var(--danger);
}

.button.small {
  min-height: 32px;
  padding: 0 10px;
}

.button.wide {
  margin-top: 18px;
}

input,
select,
textarea {
  border-color: #adb9c2;
  background: #fff;
  color: var(--ink);
  font-size: 0.86rem;
}

input,
select {
  height: 40px;
  padding: 0 10px;
}

textarea {
  padding: 9px 10px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(11, 95, 115, 0.15);
}

label {
  color: #344754;
  font-size: 0.78rem;
  font-weight: 600;
}

.form-error {
  border-left: 3px solid var(--danger);
  border-radius: 2px;
  font-size: 0.8rem;
}

/* Login: a system access screen, not a marketing landing page. */
.login-shell {
  grid-template-columns: minmax(360px, 0.9fr) minmax(420px, 1.1fr);
  background: var(--canvas);
}

.login-aside {
  position: relative;
  justify-content: center;
  min-height: 100vh;
  padding: clamp(42px, 7vw, 88px);
  background: #22313b;
}

.login-aside::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 4px;
  background: #2d7c8c;
  content: "";
}

.brand-mark {
  width: 42px;
  height: 42px;
  margin-bottom: 34px;
  border-color: #5b6d78;
  border-radius: 2px;
  background: transparent;
  font-family: Bahnschrift, "Arial Narrow", sans-serif;
  font-size: 0.82rem;
  letter-spacing: 0;
}

.login-aside h1 {
  max-width: 520px;
  margin: 0 0 16px;
  color: #f2f5f6;
  font-size: clamp(1.8rem, 3.6vw, 2.8rem);
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.03em;
}

.login-aside .login-intro {
  max-width: 480px;
  color: #bdc8ce;
  font-size: 0.9rem;
  line-height: 1.7;
}

.flow-line {
  max-width: 480px;
  margin-top: 42px;
  padding-top: 17px;
  border-top: 1px solid #4b5b65;
  color: #d1dade;
  font-size: 0.76rem;
  font-weight: 600;
}

.flow-line i {
  margin: 0 8px;
  background: #697b85;
}

.login-card {
  align-self: center;
  width: min(390px, calc(100% - 48px));
  margin: 40px auto;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  box-shadow: none;
  backdrop-filter: none;
}

.login-card h2 {
  margin-bottom: 6px;
  font-size: 1.35rem;
}

.login-card > label {
  margin-top: 18px;
}

.login-help {
  line-height: 1.5;
}

/* Compact industrial application shell. */
.topbar {
  min-height: 58px;
  padding: 0 clamp(16px, 2.6vw, 36px);
  border-bottom: 3px solid #2d7c8c;
  background: #1d2a33;
  box-shadow: none;
  backdrop-filter: none;
}

.brand {
  gap: 9px;
}

.brand-tile {
  width: 30px;
  height: 30px;
  border: 1px solid #647781;
  border-radius: 2px;
  background: transparent;
  font-family: Bahnschrift, "Arial Narrow", sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0;
}

.brand strong {
  font-size: 0.88rem;
  font-weight: 650;
}

.nav-button {
  min-height: 58px;
  padding: 0 14px;
  border-right: 1px solid #33434e;
  border-radius: 0;
  color: #bec9cf;
  font-size: 0.8rem;
  font-weight: 600;
}

.main-nav {
  align-self: stretch;
  gap: 0;
}

.nav-button:hover,
.nav-button.active {
  background: #293842;
  color: #fff;
}

.nav-button.active {
  box-shadow: inset 0 -3px 0 #6bb3c1;
}

.user-copy strong {
  font-size: 0.8rem;
  font-weight: 600;
}

.user-copy span {
  color: #aab8c0;
}

.icon-button {
  min-height: 30px;
  border-color: transparent;
  border-radius: 2px;
  color: #c2cdd3;
  font-size: 0.75rem;
}

.user-area .icon-button:hover {
  background: #2b3a44;
  color: #fff;
}

.workspace {
  width: min(1600px, calc(100% - 40px));
  padding: 26px 0 48px;
}

.page-heading {
  align-items: center;
  margin-bottom: 18px;
  padding: 1px 0 1px 13px;
  border-left: 3px solid var(--accent);
}

.page-heading h1 {
  margin-bottom: 4px;
}

.page-heading p:last-child {
  font-size: 0.8rem;
}

.shift-chip {
  gap: 0;
  padding: 6px 10px;
  border: 1px solid #bac5cc;
  border-radius: 2px;
  background: #f7f9f9;
  color: #3e5963;
  font-size: 0.74rem;
  font-weight: 600;
}

.live-dot {
  display: none;
}

.panel {
  border-color: var(--line);
  border-radius: 3px;
  background: var(--surface);
  box-shadow: none;
}

.panel-head {
  gap: 14px;
}

.panel-head h2 {
  margin-bottom: 3px;
  font-size: 0.95rem;
}

.panel-head p {
  color: #5d6c77;
  font-size: 0.76rem;
}

.scanner-grid {
  grid-template-columns: minmax(0, 1.75fr) minmax(280px, 0.65fr);
  gap: 14px;
}

.scan-panel,
.recent-panel {
  padding: 18px;
}

.scan-form {
  margin-top: 18px;
  padding: 17px;
  border-color: #c9d3da;
  border-radius: 2px;
  background: #f7f8f9;
}

.action-field {
  max-width: 420px;
}

.barcode-field {
  margin-top: 12px;
}

.scan-input-row {
  gap: 8px;
}

#scanner-input {
  height: 52px;
  padding: 0 14px;
  border-color: #8fa2af;
  font-size: 1.08rem;
  font-weight: 600;
}

.scan-input-row .button {
  min-width: 112px;
  min-height: 52px;
}

.exception-fields {
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
}

.scan-result {
  gap: 12px;
  min-height: 78px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 2px;
  background: #f5f6f7;
}

.scan-result .result-symbol {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
  border-radius: 2px;
  background: #e4e8eb;
  font-family: Bahnschrift, sans-serif;
  font-size: 1rem;
}

.scan-result.success {
  border-color: #9fc3af;
  border-left-color: var(--success);
  background: var(--success-soft);
  color: #315845;
}

.scan-result.success .result-symbol {
  background: var(--success);
}

.scan-result.error {
  border-color: #d9afa9;
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

.scan-result.error .result-symbol {
  background: var(--danger);
}

.scan-result .result-detail,
.cell-sub,
.recent-item strong {
  font-family: "Bahnschrift", Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.recent-list {
  gap: 6px;
  margin-top: 14px;
}

.recent-item {
  padding: 9px 10px;
  border-color: var(--line-soft);
  border-radius: 2px;
  background: #fbfcfc;
  text-align: left;
}

.recent-item:hover {
  border-color: #9caab4;
  background: #f4f7f8;
}

.recent-item span {
  color: #596a75;
  font-size: 0.68rem;
}

.empty-copy {
  margin: 14px 0;
  color: #677681;
  font-size: 0.78rem;
}

.camera-panel {
  gap: 13px;
  margin-top: 14px;
  padding: 12px;
  border-radius: 2px;
  background: #1f2b33;
}

.camera-panel video {
  border-radius: 1px;
}

/* Data tables carry the primary information in this application. */
.filter-bar {
  grid-template-columns: minmax(250px, 1fr) 210px 112px auto;
  gap: 10px;
  margin-bottom: 12px;
  padding: 14px;
}

.table-panel {
  border-radius: 3px;
}

.table-meta {
  padding: 9px 13px;
  background: #f7f8f9;
  color: #52636f;
  font-size: 0.72rem;
}

th,
td {
  padding: 9px 12px;
  border-color: #e2e7ea;
  font-size: 0.78rem;
}

th {
  height: 36px;
  border-bottom: 1px solid #aebbc4;
  background: #e3e8eb;
  color: #2f4552;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
}

#queue-table {
  table-layout: fixed;
}

#queue-table th:nth-child(1) { width: 25%; }
#queue-table th:nth-child(2) { width: 15%; }
#queue-table th:nth-child(3) { width: 12%; }
#queue-table th:nth-child(4) { width: 18%; }
#queue-table th:nth-child(5) { width: 15%; }
#queue-table th:nth-child(6) { width: 15%; }

#queue-table td:nth-child(1),
#queue-table td:nth-child(3),
#queue-table td:nth-child(5) {
  overflow: hidden;
  text-overflow: ellipsis;
}

#queue-table td:nth-child(4) .cell-sub {
  margin-top: 3px;
}

.table-action {
  min-width: 48px;
  border-color: #b9c5cc;
  color: #274c56;
}

#queue-table td:last-child {
  padding-right: 9px;
  text-align: right;
}

td {
  height: 41px;
}

tbody tr:nth-child(even) {
  background: #fbfcfc;
}

tbody tr:hover {
  background: #edf4f6;
}

.cell-main {
  font-family: "Bahnschrift", Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.cell-sub {
  margin-top: 2px;
  color: #50636f;
  font-size: 0.68rem;
}

.status-badge {
  min-height: 22px;
  padding: 0 7px;
  border: 1px solid #b9cdd7;
  border-radius: 2px;
  background: #edf5f7;
  color: #315969;
  font-size: 0.68rem;
  font-weight: 650;
}

.status-badge.finished {
  border-color: #b6cfc0;
  background: #eef5f0;
  color: #315f45;
}

.status-badge.paused {
  border-color: #dcc78f;
  background: var(--warning-soft);
  color: var(--warning);
}

.status-badge.overdue {
  border-color: #d7afa9;
  background: var(--danger-soft);
  color: var(--danger);
}

.pagination {
  padding: 10px 13px;
  border-top: 1px solid var(--line-soft);
  background: #f8f9fa;
}

/* Forms and dialogs use the same restrained work-sheet hierarchy. */
.order-layout {
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 14px;
}

.order-main,
.order-side,
.user-form {
  padding: 18px;
}

.three-fields,
.four-fields,
.lens-grid {
  gap: 9px;
}

.item-card {
  padding: 14px;
  border-color: #cbd4da;
  border-radius: 2px;
  background: #f9fafa;
}

.prescription-head {
  margin: 14px 0 8px;
  padding-top: 12px;
}

.lens-side {
  gap: 8px;
  padding: 10px;
  border: 1px solid #d6dde2;
  border-radius: 2px;
  background: #fff;
}

.lens-side b {
  color: #2b5f6c;
}

.order-side {
  top: 74px;
}

.check-list {
  gap: 8px;
  padding-left: 18px;
  font-size: 0.78rem;
}

.created-result {
  border-radius: 2px;
  font-size: 0.78rem;
}

.admin-grid {
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 14px;
}

.detail-dialog {
  border: 1px solid #9fadb6;
  border-radius: 3px;
  box-shadow: 0 18px 50px rgba(22, 34, 43, 0.3);
}

.detail-dialog::backdrop {
  background: rgba(19, 31, 39, 0.66);
  backdrop-filter: none;
}

.dialog-head {
  padding: 15px 18px;
  background: #f2f4f5;
}

.detail-content {
  padding: 18px;
}

.detail-hero {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #f7f8f9;
}

.info-card {
  padding: 13px;
  border-radius: 2px;
}

.timeline {
  padding: 14px;
  border-radius: 2px;
}

.timeline-item {
  grid-template-columns: 140px 1fr auto;
  gap: 10px;
  padding: 0 0 14px 16px;
}

.timeline-item::before {
  width: 7px;
  height: 7px;
  left: -4px;
  background: var(--accent);
  box-shadow: none;
}

.exception-note {
  border-left: 3px solid #b88200;
  border-radius: 2px;
}

/* Messages stay inside the system's visual language. */
.toast-region {
  position: static;
  z-index: auto;
  top: auto;
  right: auto;
  display: block;
  width: 100%;
  margin-bottom: 12px;
}

.toast {
  padding: 9px 12px;
  border: 1px solid #aebcc4;
  border-left: 4px solid var(--accent);
  border-radius: 2px;
  background: #f7fafa;
  color: #294c57;
  box-shadow: none;
  font-size: 0.78rem;
  animation: none;
}

.toast.error {
  border-color: #d1a29c;
  border-left-color: var(--danger);
  background: #fff;
  color: var(--danger);
}

.text-button {
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 650;
}

.check-field input {
  accent-color: var(--accent);
}

/* Precision pass: process context, operational rhythm, and restrained surfaces. */
.process-mobile-summary {
  display: none;
}

.process-rail {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 0 0 14px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  list-style: none;
}

.process-rail li {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1px 8px;
  min-width: 0;
  padding: 11px 13px 12px;
  border-right: 1px solid var(--line-soft);
  color: var(--ink-soft);
}

.process-rail li:last-child {
  border-right: 0;
}

.process-rail .rail-index {
  grid-row: 1 / span 2;
  align-self: start;
  padding-top: 1px;
  color: #758691;
  font-family: Bahnschrift, Consolas, monospace;
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.025em;
}

.process-rail .rail-name {
  overflow: hidden;
  font-size: 0.78rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.process-rail small {
  overflow: hidden;
  color: #6a7983;
  font-size: 0.68rem;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.process-rail li.is-complete {
  background: #f5f8f7;
}

.process-rail li.is-complete .rail-index {
  color: #527a65;
}

.process-rail li.is-current {
  background: var(--accent-soft);
  color: #174f5d;
  box-shadow: inset 0 -3px 0 var(--accent);
}

.process-rail li.is-current .rail-index {
  color: var(--accent);
}

.scan-panel .panel-head {
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line-soft);
}

.scan-form {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1.3fr);
  gap: 12px;
  align-items: end;
}

.scan-form .action-field {
  max-width: none;
}

.scan-form .barcode-field,
.scan-form .exception-fields,
.scan-form > .form-error {
  margin-top: 0;
}

.scan-form .exception-fields,
.scan-form > .form-error {
  grid-column: 1 / -1;
}

.login-card {
  padding: 34px 0;
  border-color: transparent;
  background: transparent;
}

.login-card h2 {
  text-wrap: balance;
}

.login-help {
  color: #65747e;
}

#queue-table tbody tr.is-overdue td:first-child {
  box-shadow: inset 3px 0 0 var(--danger);
}

#queue-table tbody tr.is-paused td:first-child {
  box-shadow: inset 3px 0 0 #b88200;
}

.page-heading h1 {
  font-size: clamp(1.35rem, 1.8vw, 1.65rem);
  line-height: 1.3;
}
@media (max-width: 1040px) {
  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-aside {
    min-height: 320px;
    padding: 36px 28px;
  }

  .login-aside h1 {
    font-size: 2rem;
  }

  .scanner-grid,
  .order-layout,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .order-side {
    position: static;
  }
}

@media (max-width: 720px) {
  .topbar {
    min-height: 52px;
    padding: 0 12px;
    border-bottom-width: 2px;
  }

  .main-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    padding: 0;
  }

  .nav-button {
    min-height: 42px;
    padding: 0 12px;
    border-top: 1px solid #3c4d58;
    border-right: 1px solid #3c4d58;
    border-bottom: 0;
  }

  .nav-button:nth-of-type(even) {
    border-right: 0;
  }

  .nav-button.active {
    box-shadow: inset 0 -2px 0 #6bb3c1;
  }

  .workspace {
    width: calc(100% - 20px);
    padding: 18px 0 32px;
  }

  .page-heading {
    align-items: flex-start;
    gap: 10px;
    padding-left: 10px;
  }

  .page-actions {
    width: 100%;
  }

  .scan-panel,
  .recent-panel,
  .order-main,
  .order-side,
  .user-form {
    padding: 13px;
  }

  .scan-form {
    padding: 12px;
  }

  .process-rail {
    display: none;
  }

  .process-mobile-summary {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: center;
    margin: 0 0 12px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent);
    background: var(--surface);
    color: var(--ink-soft);
    font-size: 0.74rem;
  }

  .process-mobile-summary strong {
    color: var(--ink);
    font-size: 0.82rem;
  }

  .process-mobile-summary span:last-child {
    font-family: Bahnschrift, Consolas, monospace;
    font-variant-numeric: tabular-nums;
  }

  .scan-form,
  .scan-input-row,
  .filter-bar,
  .three-fields,
  .four-fields,
  .lens-grid,
  .detail-columns {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: 22px 18px;
    border-color: var(--line);
    background: var(--surface);
  }

  .scan-input-row .button {
    min-height: 46px;
  }

  #scanner-input {
    height: 48px;
  }

  .login-aside {
    min-height: 250px;
    padding: 28px 20px;
  }

  .login-aside h1 {
    font-size: 1.65rem;
  }

  .login-aside .login-intro,
  .flow-line {
    display: none;
  }

  .login-card {
    width: calc(100% - 28px);
    margin: 18px auto;
    padding: 22px 18px;
  }

  .timeline-item {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Precision frame: optical instrument mark, fixed work rail, aligned work canvas. */
.brand-mark,
.brand-tile {
  position: relative;
  overflow: visible;
  border: 1px solid #8da1a9;
  border-radius: 50%;
  background: transparent;
  color: transparent;
  font-size: 0;
}

.brand-mark::before,
.brand-tile::before {
  position: absolute;
  inset: 7px;
  border: 1px solid #a9bbc1;
  border-radius: 50%;
  content: "";
}

.brand-mark::after,
.brand-tile::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  border: 1px solid #6bb3c1;
  border-radius: 50%;
  background: #24343c;
  transform: translate(-50%, -50%);
  content: "";
}

.brand-mark::before {
  inset: 10px;
}

.nav-section-label {
  display: none;
}

@media (min-width: 1041px) {
  .topbar {
    position: fixed;
    inset: 0 auto 0 0;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: 218px;
    min-height: 100vh;
    padding: 0;
    border-right: 1px solid #394751;
    border-bottom: 0;
  }

  .brand {
    align-self: stretch;
    min-height: 74px;
    padding: 0 18px;
    border-bottom: 1px solid #34424b;
  }

  .brand-tile {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
  }

  .brand strong {
    display: block;
    max-width: 140px;
    line-height: 1.35;
  }

  .main-nav {
    display: flex;
    align-self: stretch;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 3px;
    padding: 18px 12px;
    overflow: visible;
  }

  .nav-section-label {
    display: block;
    padding: 0 12px 9px;
    color: #7f919b;
    font-family: "Microsoft YaHei UI", sans-serif;
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.08em;
  }

  .nav-button {
    width: 100%;
    min-height: 42px;
    justify-content: flex-start;
    padding: 0 13px;
    border: 0;
    border-left: 3px solid transparent;
    border-radius: 0;
    color: #b7c3c9;
    text-align: left;
  }

  .nav-button:hover {
    background: #25323a;
    color: #fff;
  }

  .nav-button.active {
    border-left-color: #6bb3c1;
    background: #26353d;
    box-shadow: none;
    color: #fff;
  }

  .user-area {
    align-self: end;
    justify-content: space-between;
    padding: 16px 14px 18px 18px;
    border-top: 1px solid #34424b;
  }

  .user-copy {
    text-align: left;
  }

  .user-area .icon-button {
    padding: 0;
    color: #8fa1aa;
  }

  .workspace {
    width: auto;
    max-width: none;
    margin-left: 218px;
    padding: 28px clamp(24px, 3vw, 46px) 54px;
  }

  .page-heading {
    min-height: 48px;
  }

  .toast-region {
    margin-bottom: 10px;
  }
}

@media (max-width: 1040px) {
  .brand-tile {
    flex: 0 0 30px;
  }

  .nav-section-label {
    display: none;
  }
}
/* Keep the scan station controls on one shared baseline and height. */
.scan-form > .action-field select,
.scan-form .scan-input-row input,
.scan-form .scan-input-row .button {
  height: 52px;
  min-height: 52px;
}

.scan-form > .action-field,
.scan-form .barcode-field {
  align-self: end;
}

.scan-form > .action-field select {
  padding-top: 0;
  padding-bottom: 0;
}

@media (max-width: 720px) {
  .scan-form > .action-field select,
  .scan-form .scan-input-row input,
  .scan-form .scan-input-row .button {
    height: 48px;
    min-height: 48px;
  }
}
/* Production data center */
.analytics-actions {
  align-items: center;
  color: var(--muted);
  font-size: 0.72rem;
}

.analytics-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.kpi-card {
  position: relative;
  min-width: 0;
  padding: 15px 16px 14px;
  border-right: 1px solid var(--line-soft);
}

.kpi-card:last-child {
  border-right: 0;
}

.kpi-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: #9aabb4;
  content: "";
}

.kpi-card.danger::before {
  background: var(--danger);
}

.kpi-card.warning::before {
  background: #b88200;
}

.kpi-card.success::before {
  background: var(--success);
}

.kpi-card span,
.kpi-card small,
.kpi-card strong {
  display: block;
}

.kpi-card span {
  color: #4f616d;
  font-size: 0.74rem;
  font-weight: 600;
}

.kpi-card strong {
  margin: 7px 0 4px;
  overflow: hidden;
  color: var(--ink);
  font-family: Bahnschrift, "Arial Narrow", sans-serif;
  font-size: clamp(1.45rem, 2.2vw, 2rem);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kpi-card small {
  color: #6b7982;
  font-size: 0.68rem;
}

.analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.65fr);
  gap: 14px;
  margin-bottom: 14px;
}

.analytics-grid-secondary {
  grid-template-columns: minmax(280px, 0.65fr) minmax(0, 1.35fr);
}

.analytics-panel {
  min-width: 0;
  padding: 17px;
}

.daily-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
  min-height: 210px;
  margin-top: 15px;
  padding: 0 4px;
  border-bottom: 1px solid var(--line);
}

.daily-column {
  display: grid;
  grid-template-rows: 24px 1fr 24px;
  align-items: end;
  justify-items: center;
  min-width: 0;
}

.daily-column strong {
  font-family: Bahnschrift, Consolas, monospace;
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.daily-column span {
  color: #64747e;
  font-family: Bahnschrift, Consolas, monospace;
  font-size: 0.66rem;
  font-variant-numeric: tabular-nums;
}

.daily-track {
  display: flex;
  align-items: flex-end;
  width: min(44px, 72%);
  height: 150px;
  background: #f1f4f5;
}

.daily-track i {
  display: block;
  width: 100%;
  min-height: 2px;
  background: var(--accent);
}

.daily-track .level-0 { height: 2px; }
.daily-track .level-1 { height: 10%; }
.daily-track .level-2 { height: 20%; }
.daily-track .level-3 { height: 30%; }
.daily-track .level-4 { height: 40%; }
.daily-track .level-5 { height: 50%; }
.daily-track .level-6 { height: 60%; }
.daily-track .level-7 { height: 70%; }
.daily-track .level-8 { height: 80%; }
.daily-track .level-9 { height: 90%; }
.daily-track .level-10 { height: 100%; }

.load-chart {
  display: grid;
  gap: 15px;
  margin-top: 18px;
}

.load-row > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.load-row strong {
  font-size: 0.8rem;
}

.load-row span {
  color: #63737d;
  font-size: 0.68rem;
}

.load-track,
.status-load-track {
  height: 7px;
  overflow: hidden;
  background: #e7ecee;
}

.load-track i,
.status-load-track i {
  display: block;
  height: 100%;
  min-width: 2px;
  background: var(--accent);
}

.load-track .level-0,
.status-load-track .level-0 { width: 2px; }
.load-track .level-1,
.status-load-track .level-1 { width: 10%; }
.load-track .level-2,
.status-load-track .level-2 { width: 20%; }
.load-track .level-3,
.status-load-track .level-3 { width: 30%; }
.load-track .level-4,
.status-load-track .level-4 { width: 40%; }
.load-track .level-5,
.status-load-track .level-5 { width: 50%; }
.load-track .level-6,
.status-load-track .level-6 { width: 60%; }
.load-track .level-7,
.status-load-track .level-7 { width: 70%; }
.load-track .level-8,
.status-load-track .level-8 { width: 80%; }
.load-track .level-9,
.status-load-track .level-9 { width: 90%; }
.load-track .level-10,
.status-load-track .level-10 { width: 100%; }

.status-distribution {
  display: grid;
  gap: 12px;
  margin-top: 17px;
}

.status-load-row {
  display: grid;
  grid-template-columns: minmax(84px, auto) minmax(70px, 1fr) 30px;
  gap: 10px;
  align-items: center;
  font-size: 0.73rem;
}

.status-load-row > span {
  overflow: hidden;
  color: #435761;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-load-row strong {
  font-family: Bahnschrift, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.risk-panel {
  padding-bottom: 8px;
}

.analytics-table {
  table-layout: fixed;
  margin-top: 12px;
}

.analytics-table th:nth-child(1) { width: 38%; }
.analytics-table th:nth-child(2) { width: 27%; }
.analytics-table th:nth-child(3) { width: 22%; }
.analytics-table th:nth-child(4) { width: 13%; }

.analytics-table td:nth-child(1) {
  overflow: hidden;
  text-overflow: ellipsis;
}

.analytics-table tbody tr.is-overdue td:first-child,
.analytics-table tbody tr.is-paused td:first-child {
  box-shadow: inset 3px 0 0 var(--danger);
}

.analytics-table tbody tr.is-paused td:first-child {
  box-shadow: inset 3px 0 0 #b88200;
}

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

  .kpi-card:nth-child(3) {
    border-right: 0;
  }

  .analytics-grid,
  .analytics-grid-secondary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .analytics-actions {
    width: 100%;
    justify-content: space-between;
  }

  .analytics-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-card:nth-child(3) {
    border-right: 1px solid var(--line-soft);
  }

  .kpi-card:nth-child(odd) {
    border-right: 1px solid var(--line-soft);
  }

  .kpi-card:nth-child(even) {
    border-right: 0;
  }

  .analytics-panel {
    padding: 13px;
  }

  .daily-chart {
    gap: 7px;
    min-height: 180px;
  }

  .daily-track {
    height: 120px;
  }

  .status-load-row {
    grid-template-columns: 82px minmax(60px, 1fr) 28px;
  }
}
@media (max-width: 720px) {
  .analytics-table {
    table-layout: auto;
  }

  .analytics-table thead {
    display: none;
  }

  .analytics-table tbody {
    display: grid;
    gap: 8px;
    padding: 10px;
  }

  .analytics-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px 12px;
    padding: 10px;
    border: 1px solid var(--line-soft);
    background: #fff;
  }

  .analytics-table td {
    display: block;
    height: auto;
    padding: 0;
    border: 0;
    white-space: normal;
  }

  .analytics-table td:nth-child(1) {
    grid-column: 1 / -1;
    overflow: visible;
    text-overflow: clip;
  }

  .analytics-table td:nth-child(1) .cell-main,
  .analytics-table td:nth-child(1) .cell-sub {
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .analytics-table td:nth-child(2) {
    align-self: end;
  }

  .analytics-table td:nth-child(3) {
    align-self: end;
    color: var(--muted);
    font-size: 0.72rem;
    text-align: right;
  }

  .analytics-table td:nth-child(4) {
    grid-column: 1 / -1;
    justify-self: end;
  }
}
/* Authentication bootstrap */
.auth-loading {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #eef1f2;
  color: var(--ink);
}

.auth-loading-mark {
  position: relative;
  width: 46px;
  height: 46px;
  margin-bottom: 8px;
  border: 1px solid #7d919a;
  border-radius: 50%;
}

.auth-loading-mark::before {
  position: absolute;
  inset: 10px;
  border: 1px solid #9babb2;
  border-radius: 50%;
  content: "";
}

.auth-loading-mark::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(-50%, -50%);
  content: "";
}

.auth-loading strong {
  font-size: 0.92rem;
}

.auth-loading span {
  color: var(--muted);
  font-size: 0.76rem;
}

.auth-loading i {
  width: 120px;
  height: 2px;
  margin-top: 10px;
  overflow: hidden;
  background: #d7dee2;
}

.auth-loading i::after {
  display: block;
  width: 42%;
  height: 100%;
  background: var(--accent);
  animation: auth-progress 1.1s ease-in-out infinite;
  content: "";
}

@keyframes auth-progress {
  from { transform: translateX(-110%); }
  to { transform: translateX(340%); }
}

@media (prefers-reduced-motion: reduce) {
  .auth-loading i::after {
    width: 100%;
    animation: none;
  }
}
/* Unified queue action cell */
#queue-table th,
#queue-table td {
  vertical-align: middle;
}

#queue-table .actions-heading {
  padding-right: 12px;
  text-align: right;
}

#queue-table .queue-actions {
  padding: 6px 8px;
  text-align: right;
}

.queue-actions-inner {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.queue-actions .button {
  min-height: 30px;
  height: 30px;
}

.queue-actions .table-action {
  min-width: 48px;
}

.delete-action {
  min-width: 48px;
  padding: 0 10px;
  border: 1px solid #d7aaa4;
  background: var(--danger-soft);
  color: var(--danger);
}

.delete-action:hover {
  border-color: #c68c85;
  background: #f7dfdc;
  color: #7a4b00;
}
/* Print only the label layer from the current page. */
.label-print-root {
  display: none;
}

@media print {
  @page {
    size: 60mm 40mm;
    margin: 0;
  }

  html,
  body {
    width: 60mm !important;
    height: 40mm !important;
    margin: 0 !important;
    overflow: hidden !important;
    background: #fff !important;
  }

  body > :not(.label-print-root) {
    display: none !important;
  }

  .label-print-root {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 60mm !important;
    height: 40mm !important;
    margin: 0 !important;
    background: #fff !important;
  }

  .label-print-root svg {
    display: block !important;
    width: 60mm !important;
    height: 40mm !important;
  }
}
/* User administration actions */
.user-actions {
  text-align: right;
}

.user-actions .delete-action {
  min-width: 48px;
  min-height: 30px;
  padding: 0 10px;
}
/* User administration edit dialog */
.user-actions-inner {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.user-edit-dialog {
  width: min(460px, calc(100% - 28px));
}

.user-edit-content {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.user-edit-content .dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.cycle-time {
  font-family: Bahnschrift, Consolas, monospace;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}
/* Urgent order marking and operational alerts */
.urgent-badge {
  display: inline-flex;
  align-items: center;
  height: 19px;
  margin-left: 7px;
  padding: 0 6px;
  border-radius: 2px;
  background: #a15c00;
  color: #fff;
  font-family: "Microsoft YaHei UI", sans-serif;
  font-size: 0.66rem;
  font-weight: 700;
  vertical-align: 1px;
}

#queue-table tbody tr.is-urgent td:first-child {
  box-shadow: inset 3px 0 0 #b36b00;
}

.urgent-action {
  min-width: 50px;
  padding: 0 9px;
  border: 1px solid #d4ad72;
  background: #fff8e7;
  color: #865500;
}

.urgent-action:hover {
  border-color: #c08b35;
  background: #fff0cb;
}

.urgent-action.is-active {
  border-color: #a15c00;
  background: #a15c00;
  color: #fff;
}

.urgent-alert {
  position: fixed;
  z-index: 60;
  right: 18px;
  bottom: 18px;
  width: min(370px, calc(100% - 28px));
  overflow: hidden;
  border: 1px solid #d2b47e;
  border-top: 3px solid #b47100;
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 14px 38px rgba(24, 35, 43, 0.24);
}

.urgent-alert-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 13px;
  border-bottom: 1px solid #ead9bd;
  background: #fff9ec;
}

.urgent-alert-head strong,
.urgent-alert-head span {
  display: block;
}

.urgent-alert-head strong {
  color: #7a4b00;
  font-size: 0.82rem;
}

.urgent-alert-head span {
  margin-top: 2px;
  color: #74634d;
  font-size: 0.68rem;
}

.urgent-alert-head button {
  border: 0;
  background: transparent;
  color: #805f30;
  font-size: 0.72rem;
}

.urgent-alert-list {
  display: grid;
  max-height: 280px;
  overflow-y: auto;
}

.urgent-alert-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 12px;
  padding: 10px 13px;
  border: 0;
  border-bottom: 1px solid #edf0f1;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.urgent-alert-item:last-child {
  border-bottom: 0;
}

.urgent-alert-item:hover {
  background: #fff9ec;
}

.urgent-alert-item span:first-child {
  min-width: 0;
}

.urgent-alert-item strong,
.urgent-alert-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.urgent-alert-item strong {
  font-family: Bahnschrift, Consolas, monospace;
  font-size: 0.76rem;
}

.urgent-alert-item small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.66rem;
}

.urgent-alert-item span:nth-child(2),
.urgent-alert-item time {
  color: #6f5c3e;
  font-size: 0.68rem;
}

.urgent-alert-item time {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  color: #965b00;
  font-family: Bahnschrift, Consolas, monospace;
}

@media (max-width: 720px) {
  .urgent-alert {
    right: 10px;
    bottom: 10px;
    width: calc(100% - 20px);
  }
}
.event-duration {
  color: #8a5b18;
  font-weight: 650;
}

.timeline h4 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.timeline-total {
  color: var(--muted);
  font-family: Bahnschrift, Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 500;
}
/* Prescription data recognition and timeline alignment */
.rx-import {
  display: grid;
  gap: 9px;
  margin: 13px 0 15px;
  padding: 12px;
  border: 1px solid #cad6dd;
  border-left: 3px solid var(--accent);
  background: #f5f9fa;
}

.rx-import-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.rx-import-head strong {
  font-size: 0.82rem;
}

.rx-import-head small {
  color: var(--muted);
  font-size: 0.7rem;
}

.rx-import-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: stretch;
}

.rx-import-controls textarea {
  min-height: 54px;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  cursor: pointer;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.rx-import-status {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.rx-import-status.success {
  color: #246647;
}

.rx-import-status.error {
  color: var(--danger);
}

.timeline-item > small {
  min-width: 150px;
  text-align: right;
}

@media (max-width: 720px) {
  .rx-import-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .rx-import-controls {
    grid-template-columns: 1fr 1fr;
  }

  .rx-import-controls textarea {
    grid-column: 1 / -1;
  }

  .timeline-item > small {
    min-width: 0;
    text-align: left;
  }
}
.single-pd-field {
  width: calc(50% - 6px);
  margin-top: 10px;
}

@media (max-width: 720px) {
  .single-pd-field {
    width: 100%;
  }
}
/* Structured order-entry worksheet */
.order-main {
  padding: 0;
  overflow: hidden;
}

.order-main > .panel-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #f7f8f9;
}

.order-main > .three-fields,
.order-main > label {
  margin-right: 18px;
  margin-left: 18px;
}

.order-main > label,
.user-form > label {
  display: grid;
  gap: 7px;
}

.order-main > .three-fields {
  padding-top: 16px;
}

.order-items {
  margin-top: 16px;
  padding: 0 18px 18px;
}

.item-card {
  padding: 0;
  overflow: hidden;
  border-color: #bfcbd2;
  background: #fff;
}

.item-card-head {
  padding: 13px 15px;
  background: #edf4f6;
}

.item-card-head h3 {
  margin: 2px 0 0;
  font-size: 0.94rem;
}

.item-card-label {
  color: #60717c;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.form-section {
  padding: 15px;
  border-top: 1px solid var(--line-soft);
}

.form-section-title {
  display: grid;
  grid-template-columns: 27px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  margin-bottom: 12px;
}

.form-section-title > span {
  display: grid;
  place-items: center;
  height: 24px;
  border-radius: 2px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: Bahnschrift, Consolas, monospace;
  font-size: 0.66rem;
  font-weight: 700;
}

.form-section-title strong,
.form-section-title small {
  display: block;
}

.form-section-title strong {
  color: var(--ink);
  font-size: 0.84rem;
}

.form-section-title small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.7rem;
}

.prescription-section .rx-import {
  margin: 0 0 12px;
}

.prescription-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 166px;
  gap: 10px;
  align-items: stretch;
}

.prescription-layout .lens-grid {
  margin: 0;
}

.lens-side {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.eye-heading {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 4px;
  border-bottom: 1px solid #dbe3e8;
}

.eye-heading span {
  color: #78909c;
  font-family: Bahnschrift, Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 700;
}

.single-pd-field {
  display: flex;
  width: auto;
  min-width: 0;
  margin: 0;
  flex-direction: column;
  justify-content: center;
  padding: 12px;
  border: 1px solid #b7ced4;
  border-left: 3px solid var(--accent);
  background: #f2f8f9;
}

.single-pd-field > span,
.single-pd-field strong,
.single-pd-field small {
  display: block;
}

.single-pd-field > span,
.single-pd-field small {
  color: var(--muted);
  font-size: 0.68rem;
}

.single-pd-field strong {
  margin: 3px 0 5px;
  color: var(--accent);
  font-family: Bahnschrift, Consolas, monospace;
  font-size: 0.92rem;
}

.single-pd-field input {
  height: 40px;
  font-family: Bahnschrift, Consolas, monospace;
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center;
}

.single-pd-field small {
  margin-top: 5px;
}

.form-section > .processing-note-field {
  display: grid;
  margin-top: 10px;
  gap: 7px;
}

@media (max-width: 900px) {
  .prescription-layout {
    grid-template-columns: 1fr;
  }

  .single-pd-field {
    max-width: 220px;
  }
}

@media (max-width: 720px) {
  .order-main > .three-fields,
  .order-main > label {
    margin-right: 13px;
    margin-left: 13px;
  }

  .order-items {
    padding: 0 13px 13px;
  }

  .lens-side {
    grid-template-columns: 1fr;
  }

  .single-pd-field {
    max-width: none;
  }
}