:root {
  color-scheme: light;
  --bg: #f2f5f7;
  --bg-soft: #f8fafb;
  --panel: #ffffff;
  --panel-soft: #fbfcfd;
  --line: #d8e2e6;
  --line-strong: #c1ced5;
  --text: #14201f;
  --muted: #61706f;
  --muted-strong: #42514f;
  --primary: #0b746b;
  --primary-strong: #075d57;
  --primary-soft: #e8f6f3;
  --accent: #245fa8;
  --accent-soft: #edf5ff;
  --danger: #b42318;
  --danger-soft: #fff1ef;
  --warn: #b45309;
  --warn-soft: #fff7e6;
  --ok: #15803d;
  --ok-soft: #edfdf3;
  --info: #2563eb;
  --info-soft: #eff6ff;
  --sidebar: #10211f;
  --sidebar-soft: #19322f;
  --shadow-sm: 0 1px 2px rgba(15, 32, 30, .06);
  --shadow-md: 0 10px 28px rgba(15, 32, 30, .08);
  --shadow-focus: 0 0 0 3px rgba(11, 116, 107, .16);
  --radius-sm: 6px;
  --radius: 8px;
  --control-h: 38px;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #edf3f6 0, #f7f9fa 320px, var(--bg) 100%);
  color: var(--text);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}
a { color: var(--primary-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 236px;
  overflow-y: auto;
  background: linear-gradient(180deg, #0d1e1c 0, var(--sidebar) 48%, #132827 100%);
  color: #eef8f5;
  padding: 18px 14px 22px;
  border-right: 1px solid rgba(255, 255, 255, .06);
  box-shadow: 8px 0 26px rgba(15, 23, 42, .12);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 8px 18px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(222, 243, 238, .1);
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #0f766e, #2563eb);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(11, 116, 107, .24);
}
.brand strong {
  display: block;
  color: #f7fffd;
  font-size: 16px;
  letter-spacing: 0;
}
.brand span {
  display: block;
  color: #9fb9b2;
  margin-top: 2px;
  font-size: 12px;
}
nav {
  display: grid;
  gap: 4px;
}
nav a {
  text-decoration: none;
}
.sidebar nav {
  gap: 6px;
}
.sidebar nav a {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 10px 12px 10px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: #d7e9e5;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}
.sidebar nav a:hover {
  background: rgba(255, 255, 255, .07);
  color: #fff;
  text-decoration: none;
}
.sidebar nav a.active {
  background: rgba(255, 255, 255, .11);
  border-color: rgba(197, 241, 232, .18);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .02);
}
.sidebar nav a.active::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 999px;
  background: #4fd1c5;
}
.mobile-quicknav {
  display: none;
}

.main {
  margin-left: 236px;
  padding: 24px 30px 42px;
}
.login-main {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(145deg, rgba(11, 116, 107, .08), transparent 42%),
    linear-gradient(180deg, #eef4f7 0, #f8fafb 100%);
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(193, 206, 213, .72);
}
.page-heading {
  min-width: 0;
}
.topbar h1 {
  margin: 0;
  color: #101b1a;
  font-size: 25px;
  font-weight: 700;
  line-height: 1.25;
}
.topbar p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.userbar {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.user-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .78);
  color: var(--muted-strong);
  box-shadow: var(--shadow-sm);
}

.panel,
.metric,
.login-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.panel {
  padding: 18px;
  margin-bottom: 16px;
}
.panel-head,
.toolbar,
.form-actions,
.quick-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.panel-head { margin-bottom: 14px; }
.panel h2,
.panel-head h2 {
  margin: 0;
  color: #172321;
  font-size: 16px;
  font-weight: 700;
}
.section-label {
  display: inline-block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 4px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.metric {
  position: relative;
  overflow: hidden;
  min-height: 112px;
  padding: 18px 18px 16px;
}
.metric::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}
.metric span {
  display: block;
  color: var(--muted);
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
}
.metric strong {
  color: #0f1b1a;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.15;
}
.split {
  display: grid;
  grid-template-columns: minmax(280px, .8fr) minmax(360px, 1.2fr);
  gap: 16px;
}
.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  gap: 16px;
}
.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.status-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 54px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  color: var(--text);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.status-chip:hover {
  border-color: rgba(11, 116, 107, .34);
  box-shadow: 0 8px 20px rgba(15, 32, 30, .06);
  text-decoration: none;
  transform: translateY(-1px);
}
.status-chip strong {
  color: var(--primary-strong);
  font-size: 18px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.table-scroll {
  overflow-x: auto;
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.record-table {
  min-width: 1900px;
}
.approval-record-table {
  min-width: 1180px;
}
.detail-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.detail-actions form {
  margin: 0;
}
.detail-toggle {
  width: 28px;
  min-width: 28px;
  padding: 0;
  color: var(--primary-strong);
  font-size: 14px;
  font-weight: 700;
}
.detail-toggle[aria-expanded="true"] {
  border-color: #b8d7d2;
  background: #edf7f5;
}
.record-detail-row td {
  padding-top: 0;
  background: #fbfdfc;
}
.record-detail {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 10px 12px;
}
.record-detail summary {
  cursor: pointer;
  color: var(--primary-strong);
  font-weight: 600;
}
.record-detail .kv {
  margin-top: 10px;
}
.record-kv {
  grid-template-columns: 108px 1fr;
}
.compact-table {
  margin-top: 12px;
}
th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
th {
  color: var(--muted-strong);
  font-weight: 700;
  background: #f6f9fa;
  font-size: 12px;
  letter-spacing: 0;
  white-space: nowrap;
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr:hover td {
  background: #f9fcfb;
}
.dense th,
.dense td { padding: 9px 8px; }
.empty {
  color: var(--muted);
  text-align: center;
  padding: 26px 18px;
  line-height: 1.55;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-h);
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease, color .16s ease, transform .16s ease;
}
.button:hover {
  border-color: var(--line-strong);
  box-shadow: 0 4px 12px rgba(15, 32, 30, .07);
  text-decoration: none;
  transform: translateY(-1px);
}
.button.primary {
  background: linear-gradient(180deg, #0f8378, var(--primary));
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 8px 16px rgba(11, 116, 107, .16);
}
.button.primary:hover {
  border-color: var(--primary-strong);
  background: linear-gradient(180deg, #0b746b, var(--primary-strong));
}
.button.danger {
  border-color: #efc4be;
  background: #fffafa;
  color: var(--danger);
}
.button.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.button.ghost {
  border-color: transparent;
  background: rgba(255, 255, 255, .58);
  color: var(--muted-strong);
}
.button.small,
.button.tiny {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 12px;
}
.button.tab-button {
  min-width: 70px;
  background: #f8fbfa;
}
.button.tab-button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.button.tab-button.inbound.active {
  background: var(--ok);
  border-color: var(--ok);
}
.button.tab-button.outbound.active {
  background: var(--info);
  border-color: var(--info);
}
.button.tab-button.scrap {
  border-color: #f2c8c3;
  color: var(--danger);
}
.button.tab-button.scrap.active {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.toolbar {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .78);
  box-shadow: var(--shadow-sm);
}

.filters,
.inline-form,
.row-form {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  justify-content: flex-end;
}
.actions.wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}
input,
select,
textarea {
  width: 100%;
  min-height: var(--control-h);
  border: 1px solid #cad7dc;
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 8px 11px;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
input:hover,
select:hover,
textarea:hover {
  border-color: var(--line-strong);
}
input:focus,
select:focus,
textarea:focus {
  border-color: rgba(11, 116, 107, .55);
  background: #fff;
  outline: none;
  box-shadow: var(--shadow-focus);
}
textarea { min-height: 82px; resize: vertical; }
.filters input { width: 280px; }
.filters select { width: 158px; }
.inline-form input,
.inline-form select { width: 190px; }
.row-form input { width: 110px; }
.row-form select { width: 96px; }
.form label,
.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted-strong);
  font-weight: 600;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
}
.form-grid .wide { grid-column: 1 / -1; }
.approval-form {
  display: grid;
  gap: 16px;
  max-width: 1060px;
}
.form-section {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid #e1ebe7;
  border-radius: var(--radius);
  background: var(--panel-soft);
}
.form-section.danger-section {
  border-color: #f1c6c0;
  background: var(--danger-soft);
}
.form-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.form-section-head h2 {
  margin: 2px 0 0;
  font-size: 15px;
}
.approval-form .form-actions {
  justify-content: flex-end;
}
.field-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}
.settings-page {
  display: grid;
  gap: 16px;
  max-width: 1120px;
}
.settings-page .panel {
  margin-bottom: 0;
}
.settings-form {
  align-items: start;
}
.settings-threshold-form {
  grid-template-columns: repeat(2, minmax(240px, 1fr));
}
.settings-bot-add-form {
  grid-template-columns: minmax(220px, .9fr) minmax(320px, 1.35fr) minmax(220px, .75fr);
}
.settings-form .form-actions {
  justify-content: flex-end;
}
.toggle-form-field {
  display: grid;
  gap: 6px;
  color: #34423e;
  font-weight: 600;
}
.form-field-label {
  line-height: 1.35;
}
.toggle-field {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #d7e4df;
  border-radius: 6px;
  background: #fbfdfc;
  color: #34423e;
  cursor: pointer;
}
.toggle-copy {
  min-width: 0;
  line-height: 1.35;
}
.toggle-switch {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 24px;
}
.toggle-switch input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.toggle-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #cbd5d1;
  transition: background .15s ease;
}
.toggle-slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(18, 35, 31, .18);
  transition: transform .15s ease;
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--primary);
}
.toggle-switch input:checked + .toggle-slider::after {
  transform: translateX(20px);
}
.toggle-switch input:focus-visible + .toggle-slider {
  outline: 2px solid rgba(15, 118, 110, .3);
  outline-offset: 2px;
}
.bot-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}
.bot-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}
.bot-card-head,
.bot-card-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.bot-card-head div {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.bot-form {
  grid-template-columns: minmax(180px, .8fr) minmax(240px, 1fr) minmax(220px, .8fr);
}
.bot-card-footer {
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.bot-card-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}
.bot-card-buttons .delete-form {
  margin: 0;
}

.flash-wrap { margin-bottom: 14px; }
.flash {
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
}
.flash.success { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
.flash.error { border-color: #fecaca; background: #fef2f2; color: #991b1b; }

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e8f0ee;
  color: #34423e;
  font-size: 12px;
  white-space: nowrap;
}
.badge.IN_STOCK { background: #dcfce7; color: #166534; }
.badge.PARTIAL_OUT { background: #fef3c7; color: #92400e; }
.badge.OUTBOUND { background: #e0e7ff; color: #3730a3; }
.badge.PENDING_SCRAP { background: #ffedd5; color: #9a3412; }
.badge.SCRAPPED,
.badge.ABNORMAL { background: #fee2e2; color: #991b1b; }
.badge.order-DRAFT { background: #f1f5f9; color: #334155; }
.badge.order-SUBMITTED { background: #fef3c7; color: #92400e; }
.badge.order-APPROVED { background: #dbeafe; color: #1d4ed8; }
.badge.order-COMPLETED { background: #dcfce7; color: #166534; }
.badge.order-REJECTED { background: #fee2e2; color: #991b1b; }
.badge.order-CANCELLED { background: #e5e7eb; color: #374151; }
.badge.test-ok { background: #dcfce7; color: #166534; }
.badge.priority-use { background: #fde68a; color: #78350f; }

.priority-reel-row td {
  background: #fff7d6;
}
.priority-reel-row:hover td {
  background: #ffefb3;
}

.alert-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.alert-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}
.alert-stat:hover {
  border-color: #b8c7c2;
  text-decoration: none;
}
.alert-stat strong { font-size: 22px; }
.alert-stat.danger { border-color: #fecaca; background: #fff7f6; }
.alert-stat.warn { border-color: #fde68a; background: #fffaf0; }
.alert-stat.info { border-color: #bfdbfe; background: #f7fbff; }
.alert-list {
  display: grid;
  gap: 8px;
}
.alert-list.compact { margin-top: 2px; }
.alert-row {
  display: grid;
  grid-template-columns: 10px 1fr;
  align-items: start;
  gap: 8px;
  padding: 8px 0;
  color: var(--text);
  border-top: 1px solid var(--line);
}
.alert-row:hover { text-decoration: none; }
.alert-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}
.alert-severity {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 999px;
  vertical-align: middle;
  background: var(--muted);
}
.alert-severity.danger { background: var(--danger); }
.alert-severity.warn { background: var(--warn); }
.alert-severity.info { background: #2563eb; }
.alert-section { scroll-margin-top: 14px; }
.alert-action-cell {
  min-width: 150px;
}
.resolve-box {
  margin-top: 8px;
}
.resolve-box summary {
  color: var(--primary-strong);
  cursor: pointer;
  font-size: 12px;
}
.resolve-form {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  min-width: 220px;
}
.resolve-form textarea {
  min-height: 64px;
}
.receipt-form {
  margin-bottom: 12px;
}
.receipt-list,
.attachment-list {
  margin-top: 12px;
}
.attachment-form input[type="file"] {
  padding: 8px;
}
.inventory-evidence {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.inventory-evidence h3 {
  margin: 0;
  font-size: 14px;
}
.compact-empty {
  padding: 10px;
}
.inventory-table {
  min-width: 1120px;
}
.inventory-entry-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(112px, 1fr));
  gap: 8px;
  min-width: 300px;
}
.inventory-entry-form label,
.evidence-form label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.inventory-entry-form input,
.inventory-entry-form select,
.evidence-form input {
  width: 100%;
  color: var(--text);
  font-size: 14px;
  font-weight: 400;
}
.inventory-remark-field {
  grid-column: span 2;
}
.inventory-save-field {
  display: flex;
  align-items: end;
}
.evidence-cell {
  min-width: 220px;
}
.evidence-form {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
}
.evidence-form input[type="file"] {
  width: 100%;
  font-size: 12px;
}
.evidence-links {
  display: grid;
  gap: 4px;
}
.batch-panel .panel-head {
  align-items: flex-start;
}
.quality-check {
  align-content: end;
  min-height: 60px;
}
.reel-select {
  width: auto;
}
.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}
.overview-grid div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbfa;
}
.overview-grid span {
  display: block;
  color: var(--muted);
  margin-bottom: 6px;
}
.overview-grid strong {
  font-size: 18px;
}
.bar-chart {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}
.bar-row {
  display: grid;
  gap: 6px;
}
.bar-row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.bar-row-head span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-row-head strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.bar-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf3f1;
}
.bar-fill {
  height: 100%;
  min-width: 8px;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f766e, #2563eb);
}
.form-summary {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid #b8d7d2;
  border-radius: 6px;
  background: #f3fbf9;
}
.form-summary span {
  color: var(--muted);
  font-weight: 400;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(300px, .8fr);
  gap: 16px;
}
.kv {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 8px 12px;
  margin: 0;
}
.kv.single { grid-template-columns: 96px 1fr; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.summary-kv {
  grid-template-columns: 92px minmax(0, 1fr) 92px minmax(0, 1fr);
}
.selected-reel-panel,
.previous-reel-panel {
  max-width: 1060px;
}
.quick-actions { justify-content: flex-start; margin-top: 16px; }
.flow-actions {
  display: grid;
  gap: 10px;
  align-items: start;
}
.hint {
  margin: 0;
  color: var(--muted);
}

.operation-switch {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  max-width: 1060px;
}
.operation-switch h2 {
  margin: 0 0 4px;
  font-size: 18px;
}
.operation-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.operation-layout {
  display: grid;
  grid-template-columns: minmax(560px, 1fr) 260px;
  gap: 16px;
  align-items: start;
  max-width: 1060px;
}
.operation-layout > * {
  min-width: 0;
}
.operation-map-panel {
  padding: 18px;
}
.map-head {
  align-items: flex-start;
}
.map-head .hint {
  margin-top: 4px;
}
.map-search-form {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto auto minmax(180px, auto);
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid #dce8e4;
  border-radius: 8px;
  background: #fbfdfc;
}
.map-search-form label {
  display: grid;
  gap: 6px;
  color: #34423e;
  font-weight: 600;
}
.search-result-hint {
  align-self: center;
  color: var(--muted);
  font-size: 12px;
}
.operation-side-panel {
  display: grid;
  gap: 14px;
}
.operation-side-panel h2 {
  margin: 0;
}
.operation-facts {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 8px 10px;
  margin: 0;
}
.operation-facts dt {
  color: var(--muted);
}
.operation-facts dd {
  margin: 0;
  font-weight: 600;
}
.operation-note {
  padding: 12px;
  border: 1px solid #cde9e3;
  border-radius: 8px;
  background: #f3fbf9;
  color: #25433d;
  line-height: 1.5;
}
.operation-note.danger {
  border-color: #f1c6c0;
  background: var(--danger-soft);
  color: var(--danger);
}

.location-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}
.location-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 156px;
  padding: 12px;
}
.location-card.occupied { border-color: #9fd4ce; }
.location-card header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}
.location-card header span { color: var(--muted); font-size: 12px; }
.reel-mini {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 6px;
  background: #eef8f5;
  color: var(--text);
}
.reel-mini small,
.reel-mini span { color: var(--muted); }
.empty-slot {
  display: grid;
  place-items: center;
  min-height: 92px;
  border: 1px dashed #c7d5d1;
  border-radius: 6px;
  color: var(--muted);
}

.outbound-map-panel {
  max-width: 750px;
  padding: 18px;
}
.location-map-scroll {
  overflow-x: auto;
  padding: 12px;
  border: 1px solid #dbe5ef;
  border-radius: 8px;
  background: #f3f6fa;
}
.location-map-grid {
  display: grid;
  grid-template-columns: repeat(5, 132px);
  grid-auto-rows: 104px;
  gap: 10px;
  min-width: 710px;
}
.location-tile {
  position: relative;
  display: grid;
  grid-template-rows: auto auto auto auto;
  align-content: start;
  gap: 4px;
  padding: 10px 11px;
  border: 2px solid #d9e0e7;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  overflow: hidden;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
  transition: border-color .14s ease, box-shadow .14s ease, transform .14s ease;
}
.location-spacer {
  min-height: 104px;
}
.location-tile:hover {
  text-decoration: none;
  border-color: #1677ff;
  box-shadow: 0 6px 16px rgba(22, 119, 255, .16);
  transform: translateY(-1px);
}
.location-tile.occupied {
  border-color: #1677ff;
  background: #e8f2ff;
}
.location-tile.selected,
.tile-reel-link.selected {
  outline: 3px solid rgba(15, 118, 110, .26);
  border-color: var(--primary);
}
.location-tile.disabled,
.tile-reel-link.disabled {
  cursor: default;
}
.location-tile.disabled:hover {
  border-color: #1677ff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
  transform: none;
}
.location-tile.priority {
  padding-right: 42px;
  border-color: #f59e0b;
  background: #fff4c4;
  box-shadow: 0 4px 12px rgba(180, 110, 0, .16);
}
.priority-flag {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 6px;
  border-radius: 999px;
  background: #f59e0b;
  color: #fff7ed;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(146, 64, 14, .22);
}
.location-tile.empty {
  position: relative;
  display: grid;
  place-items: center;
  color: #8a949e;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .02);
}
.location-tile.empty:hover {
  border-color: #d9dde2;
  box-shadow: none;
  transform: none;
}
.location-tile.empty.clickable:hover {
  border-color: #1677ff;
  box-shadow: 0 4px 12px rgba(22, 119, 255, .14);
  transform: translateY(-1px);
}
.location-tile.empty.move-target {
  border-color: #f0a000;
  background: #fff5d6;
  color: #92400e;
}
.location-tile.empty.move-target:hover {
  border-color: #d97706;
  box-shadow: 0 6px 16px rgba(217, 119, 6, .18);
}
.location-tile.outbound-target {
  border-color: var(--info);
  background: var(--info-soft);
}
.location-tile.outbound-target:hover,
.tile-reel-link.outbound-target:hover {
  border-color: #1d4ed8;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .16);
}
.location-tile.scrap-target {
  border-color: #e69a93;
  background: var(--danger-soft);
}
.location-tile.scrap-target:hover,
.tile-reel-link.scrap-target:hover {
  border-color: var(--danger);
  box-shadow: 0 6px 16px rgba(180, 35, 24, .14);
}
.location-tile.priority.outbound-target,
.location-tile.priority.scrap-target {
  border-color: #f59e0b;
  background: #fff4c4;
}
.location-tile.empty.inbound-target {
  border-color: #a7d9c6;
  background: var(--ok-soft);
  color: var(--ok);
}
.location-tile.empty.inbound-target:hover {
  border-color: var(--ok);
  box-shadow: 0 6px 16px rgba(21, 128, 61, .14);
}
.location-map-grid.move-pick-mode .location-tile.occupied:not(.selected) {
  opacity: .58;
}
.location-map-grid.search-active .location-tile.search-dimmed,
.location-map-grid.search-active .tile-reel-link.search-dimmed,
.location-map-grid.search-active .location-spacer {
  opacity: .28;
  filter: grayscale(.75);
}
.location-map-grid.search-active .location-tile.search-hit,
.location-map-grid.search-active .tile-reel-link.search-hit {
  opacity: 1;
  filter: none;
}
.location-map-grid.search-active .location-tile.search-hit {
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .18), 0 8px 18px rgba(15, 118, 110, .14);
}
.location-map-grid.search-active .tile-reel-link.search-hit {
  background: rgba(255, 255, 255, .82);
  box-shadow: inset 0 0 0 2px rgba(15, 118, 110, .22);
}
.location-code {
  color: #006dff;
  font-weight: 700;
  font-size: 12px;
  line-height: 1;
}
.location-tile.empty .location-code {
  position: absolute;
  top: 10px;
  left: 11px;
}
.location-reel-name,
.tile-reel-link strong {
  color: #111827;
  font-size: 13px;
  line-height: 1.25;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.location-meta,
.location-tile small,
.tile-reel-link small {
  color: #354454;
  font-size: 12px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.location-tile.multi {
  gap: 3px;
  padding: 8px 9px;
}
.location-tile.multi.priority {
  padding-right: 9px;
}
.tile-reel-link {
  position: relative;
  display: grid;
  gap: 2px;
  color: var(--text);
  border-radius: 5px;
  padding: 3px 4px;
}
.tile-reel-link.priority {
  padding-right: 36px;
  border-color: #f59e0b;
  background: #fff7d6;
}
.tile-reel-link .priority-flag {
  top: 4px;
  right: 4px;
  color: #fff7ed;
  font-size: 10px;
  line-height: 1.3;
}
.tile-reel-link:hover {
  background: rgba(255, 255, 255, .65);
  text-decoration: none;
}
.label-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.label-card {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 10px;
  min-height: 118px;
  padding: 10px;
  border: 1px solid #202a27;
  border-radius: 6px;
  background: #fff;
  break-inside: avoid;
}
.label-qr img {
  display: block;
  width: 88px;
  height: 88px;
}
.label-info {
  display: grid;
  align-content: center;
  gap: 4px;
}
.label-info strong { font-size: 18px; }
.label-info span,
.label-info small { color: #263430; }

.mobile-shell {
  max-width: 760px;
}
.mobile-shell .panel {
  margin-bottom: 12px;
}
.mobile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.mobile-operation-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.mobile-operation-tabs .button {
  min-width: 0;
  padding-inline: 8px;
}
.mobile-card {
  display: grid;
  gap: 12px;
}
.mobile-action-hub {
  gap: 14px;
}
.mobile-scan-button {
  width: 100%;
  min-height: 42px;
}
.mobile-section-head {
  display: grid;
  gap: 2px;
}
.mobile-section-head h2 {
  margin: 0;
  font-size: 17px;
}
.mobile-order-form {
  display: grid;
  gap: 12px;
}
.mobile-form-section {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}
.mobile-form-section.danger-section {
  border-color: #f1c6c0;
  background: var(--danger-soft);
}
.mobile-form-grid {
  display: grid;
  gap: 10px;
}
.mobile-form-grid label {
  display: grid;
  gap: 6px;
  color: #34423e;
  font-weight: 600;
}
.mobile-form-grid .wide {
  grid-column: 1 / -1;
}
.mobile-limit-note {
  padding: 10px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: var(--info-soft);
  color: #1d4ed8;
  line-height: 1.45;
}
.mobile-sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  gap: 10px;
  padding: 10px 0 0;
  background: linear-gradient(180deg, rgba(244, 247, 246, 0), var(--bg) 32%);
}
.mobile-sticky-actions .button {
  min-height: 42px;
}
.mobile-status-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.mobile-status-card h2 {
  margin: 0;
}
.mobile-summary-kv {
  margin-top: 8px;
}
.mobile-search,
.mobile-check-form,
.mobile-form {
  display: grid;
  gap: 10px;
}
.mobile-form label {
  display: grid;
  gap: 6px;
  color: #34423e;
  font-weight: 600;
}
.mobile-list {
  display: grid;
  gap: 10px;
}
.mobile-item {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}
.mobile-item span,
.mobile-item small,
.muted-line {
  color: var(--muted);
}
.mobile-item .actions {
  margin-top: 4px;
}
.movement-card,
.order-item-card {
  border-left: 4px solid var(--primary);
}
.mobile-kv {
  grid-template-columns: 82px 1fr;
}
.mobile-selected p {
  margin: 8px 0 0;
}
.search-result-list {
  margin-top: 12px;
}
.mobile-inventory-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.mobile-inventory-card p {
  margin: 8px 0;
}

.quality-category {
  padding: 0;
  overflow: hidden;
}
.quality-category-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  cursor: pointer;
  list-style: none;
}
.quality-category-summary::-webkit-details-marker {
  display: none;
}
.quality-category-summary h2 {
  margin: 0;
}
.quality-toggle {
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.quality-category[open] .quality-toggle::before {
  content: "收起";
}
.quality-category:not([open]) .quality-toggle::before {
  content: "展开";
}
.quality-toggle {
  font-size: 0;
}
.quality-category .table-scroll {
  padding: 0 16px 16px;
}
.inventory-review-panel {
  max-width: 1120px;
}
.inventory-review-list {
  display: grid;
  gap: 12px;
}
.inventory-review-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}
.inventory-review-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.inventory-review-card header div {
  display: grid;
  gap: 4px;
}
.inventory-review-card header span {
  color: var(--muted);
}
.annual-test-reel-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}
.annual-test-reel-meta > div {
  min-width: 0;
  padding: 8px 10px;
  background: #fff;
}
.annual-test-reel-meta > div.wide {
  grid-column: span 2;
}
.annual-test-reel-meta > div.full {
  grid-column: 1 / -1;
}
.annual-test-reel-meta dt {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 12px;
}
.annual-test-reel-meta dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.inventory-edit-box {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.inventory-edit-box summary {
  color: var(--primary-strong);
  cursor: pointer;
  font-weight: 700;
  margin-bottom: 10px;
}

.login-panel {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 28px;
  width: min(760px, 100%);
  padding: 28px;
}
.login-copy h1 { margin: 0 0 10px; font-size: 30px; }
.login-copy p { margin: 0; color: var(--muted); }
.login-form { display: grid; gap: 14px; }
.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
}
.check input { width: auto; }

/* Enterprise UI refinement layer */
.panel > .table-scroll {
  margin: -2px 0 0;
}
.table-scroll table {
  margin: 0;
}
.ledger-table {
  min-width: 1480px;
}
.record-table {
  min-width: 1900px;
}
.approval-record-table {
  min-width: 1180px;
}
td a {
  font-weight: 600;
}
.detail-actions {
  justify-content: flex-end;
}
.detail-toggle {
  background: var(--primary-soft);
}
.detail-toggle[aria-expanded="true"] {
  border-color: rgba(11, 116, 107, .34);
  background: #dff4ef;
  color: var(--primary-strong);
}
.record-detail-row td,
.record-detail {
  background: var(--panel-soft);
}
.record-detail {
  border-radius: var(--radius);
}
.flash-wrap {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}
.flash {
  padding: 11px 13px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.flash.success {
  border-color: #a9e7bf;
  background: var(--ok-soft);
  color: #166534;
}
.flash.error {
  border-color: #f2b7af;
  background: var(--danger-soft);
  color: #991b1b;
}
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #eef3f4;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
}
.badge.IN_STOCK,
.badge.order-COMPLETED,
.badge.test-ok {
  border-color: #bbf0cc;
  background: var(--ok-soft);
  color: #166534;
}
.badge.PARTIAL_OUT,
.badge.order-SUBMITTED,
.badge.priority-use {
  border-color: #f8da92;
  background: var(--warn-soft);
  color: #854d0e;
}
.badge.OUTBOUND,
.badge.order-APPROVED {
  border-color: #bfdbfe;
  background: var(--info-soft);
  color: #1d4ed8;
}
.badge.PENDING_SCRAP {
  border-color: #fed7aa;
  background: #fff3e8;
  color: #9a3412;
}
.badge.SCRAPPED,
.badge.ABNORMAL,
.badge.order-REJECTED {
  border-color: #fecaca;
  background: var(--danger-soft);
  color: #991b1b;
}
.badge.order-DRAFT {
  border-color: #d7e0e5;
  background: #f5f7f9;
  color: #334155;
}
.badge.order-CANCELLED {
  border-color: #d1d5db;
  background: #f3f4f6;
  color: #374151;
}
.priority-reel-row td {
  background: #fff8df;
}
.priority-reel-row:hover td {
  background: #fff0bd;
}
.alert-strip {
  gap: 12px;
  margin-bottom: 14px;
}
.alert-stat {
  min-height: 66px;
  padding: 14px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff, #fbfcfd);
  box-shadow: var(--shadow-sm);
}
.alert-stat:hover {
  border-color: rgba(11, 116, 107, .3);
  box-shadow: 0 8px 22px rgba(15, 32, 30, .08);
  transform: translateY(-1px);
}
.alert-stat span {
  color: var(--muted-strong);
  font-weight: 700;
}
.alert-stat strong {
  color: #0f1b1a;
  font-size: 24px;
  line-height: 1;
}
.alert-stat.danger {
  border-color: #f6c3bd;
  background: linear-gradient(180deg, #fff, var(--danger-soft));
}
.alert-stat.warn {
  border-color: #f6d487;
  background: linear-gradient(180deg, #fff, var(--warn-soft));
}
.alert-stat.info {
  border-color: #b9d4fb;
  background: linear-gradient(180deg, #fff, var(--info-soft));
}
.alert-row {
  grid-template-columns: 12px 1fr;
  gap: 10px;
  padding: 10px 0;
}
.alert-row strong {
  color: #172321;
}
.alert-row small,
.muted-line {
  color: var(--muted);
}
.alert-severity {
  width: 9px;
  height: 9px;
  margin-top: 5px;
}
.overview-grid {
  gap: 12px;
}
.overview-grid div {
  padding: 14px;
  border-color: var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}
.overview-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.overview-grid strong {
  color: #101b1a;
  font-size: 19px;
}
.bar-chart {
  gap: 14px;
}
.bar-row {
  gap: 7px;
}
.bar-row-head span {
  color: var(--muted-strong);
  font-weight: 600;
}
.bar-row-head strong {
  color: var(--muted);
}
.bar-track {
  height: 10px;
  background: #e7edf0;
}
.bar-fill {
  background: linear-gradient(90deg, var(--primary), var(--accent));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22);
}
.form-summary,
.operation-note,
.mobile-limit-note {
  border-radius: var(--radius);
  background: var(--primary-soft);
}
.detail-grid {
  gap: 18px;
}
.kv {
  gap: 9px 14px;
}
.kv dt {
  color: var(--muted);
  font-weight: 600;
}
.kv dd {
  color: var(--text);
  min-width: 0;
  overflow-wrap: anywhere;
}
.summary-kv {
  padding: 2px 0;
}
.quick-actions {
  gap: 9px;
}
.flow-actions form {
  display: grid;
  gap: 9px;
}
.hint {
  color: var(--muted);
  line-height: 1.55;
}
.settings-page {
  gap: 18px;
}
.toggle-field,
.bot-card,
.inventory-review-card {
  border-radius: var(--radius);
  background: var(--panel-soft);
}
.toggle-field:hover {
  border-color: rgba(11, 116, 107, .28);
}
.toggle-slider {
  background: #b9c7c4;
}
.bot-card {
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.operation-switch,
.operation-layout {
  max-width: 1160px;
}
.operation-switch {
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .8);
  box-shadow: var(--shadow-sm);
}
.operation-switch h2 {
  color: #111d1b;
  font-size: 19px;
}
.operation-tabs {
  gap: 9px;
}
.operation-layout {
  grid-template-columns: minmax(600px, 1fr) 280px;
  gap: 18px;
}
.operation-map-panel {
  padding: 20px;
}
.map-search-form {
  padding: 12px;
  border-color: var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}
.map-search-form label,
.mobile-form-grid label,
.mobile-form label,
.inventory-entry-form label,
.evidence-form label {
  color: var(--muted-strong);
}
.location-grid {
  gap: 14px;
}
.location-card {
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.location-card.occupied {
  border-color: rgba(11, 116, 107, .36);
}
.reel-mini {
  border: 1px solid #d6ebe6;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
}
.empty-slot {
  border-color: #c8d6dc;
  border-radius: var(--radius-sm);
  background: #fbfcfd;
}
.location-map-scroll {
  padding: 14px;
  border-color: #d4e0e7;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #f6f8fb, #edf3f7);
}
.location-map-grid {
  gap: 11px;
}
.location-tile {
  border-color: #d6e0e7;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.location-tile:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 18px rgba(36, 95, 168, .14);
}
.location-tile.occupied {
  border-color: #7fb3eb;
  background: #edf6ff;
}
.location-tile.selected,
.tile-reel-link.selected {
  outline: 3px solid rgba(11, 116, 107, .22);
  border-color: var(--primary);
}
.location-tile.priority {
  border-color: #f59e0b;
  background: #fff4c4;
}
.location-tile.empty {
  background: #fff;
}
.location-tile.empty.clickable:hover {
  border-color: var(--accent);
  box-shadow: 0 7px 16px rgba(36, 95, 168, .13);
}
.location-tile.empty.move-target {
  border-color: #f0a000;
  background: #fff6dc;
}
.location-tile.outbound-target {
  border-color: var(--info);
  background: var(--info-soft);
}
.location-tile.scrap-target {
  border-color: #e79a93;
  background: var(--danger-soft);
}
.location-tile.empty.inbound-target {
  border-color: #9fd7bd;
  background: var(--ok-soft);
}
.location-map-grid.search-active .location-tile.search-hit {
  box-shadow: 0 0 0 3px rgba(11, 116, 107, .18), 0 10px 20px rgba(11, 116, 107, .14);
}
.location-code {
  color: var(--accent);
}
.location-reel-name,
.tile-reel-link strong {
  color: #111827;
  font-weight: 700;
}
.tile-reel-link {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
}
.tile-reel-link:hover {
  border-color: rgba(36, 95, 168, .22);
  background: rgba(255, 255, 255, .82);
}
.label-card {
  border-radius: var(--radius-sm);
}
.login-panel {
  position: relative;
  overflow: hidden;
  grid-template-columns: 1fr 340px;
  width: min(820px, 100%);
  padding: 34px;
  border-color: rgba(193, 206, 213, .88);
  box-shadow: var(--shadow-md);
}
.login-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}
.login-copy {
  display: grid;
  align-content: center;
  gap: 10px;
  min-width: 0;
}
.login-copy h1 {
  margin: 0;
  color: #101b1a;
  font-size: 31px;
  line-height: 1.22;
}
.login-copy p {
  max-width: 360px;
  color: var(--muted);
  line-height: 1.7;
}
.login-form {
  align-content: center;
}
.mobile-shell {
  max-width: 780px;
}
.mobile-shell .panel {
  margin-bottom: 14px;
}
.mobile-card {
  gap: 14px;
}
.mobile-action-hub {
  gap: 16px;
}
.mobile-scan-button {
  min-height: 46px;
  font-size: 15px;
}
.mobile-operation-tabs {
  gap: 9px;
}
.mobile-operation-tabs .button {
  min-height: 40px;
}
.mobile-section-head h2 {
  color: #111d1b;
  font-size: 18px;
}
.mobile-form-section {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}
.mobile-sticky-actions {
  padding: 12px 0 0;
  background: linear-gradient(180deg, rgba(242, 245, 247, 0), var(--bg) 38%);
}
.mobile-sticky-actions .button {
  min-height: 46px;
}
.mobile-status-card {
  padding: 2px;
}
.mobile-list {
  gap: 11px;
}
.mobile-item {
  gap: 6px;
  padding: 13px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff, #fbfcfd);
  box-shadow: var(--shadow-sm);
}
.mobile-item:hover {
  border-color: rgba(11, 116, 107, .28);
  text-decoration: none;
}
.mobile-item strong {
  color: #111d1b;
}
.movement-card,
.order-item-card {
  border-left-color: var(--primary);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
  .button:hover,
  .status-chip:hover,
  .alert-stat:hover,
  .location-tile:hover {
    transform: none;
  }
}

@media (max-width: 960px) {
  .sidebar {
    position: static;
    width: auto;
    padding: 12px 16px;
    box-shadow: none;
  }
  .sidebar nav {
    display: none;
  }
  .brand {
    padding: 2px 2px 8px;
    margin-bottom: 0;
    border-bottom: 0;
  }
  .mobile-quicknav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 16px;
  }
  .mobile-quicknav a {
    display: grid;
    place-items: center;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
  }
  .mobile-quicknav a:hover {
    text-decoration: none;
  }
  .mobile-quicknav a.active {
    border-color: rgba(11, 116, 107, .38);
    background: var(--primary-soft);
    color: var(--primary-strong);
  }
  .main { margin-left: 0; padding: 16px; }
  .topbar {
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 14px;
  }
  .topbar h1 {
    font-size: 22px;
  }
  .topbar p {
    font-size: 13px;
  }
  .userbar {
    flex-wrap: wrap;
    white-space: normal;
  }
  .user-chip {
    width: 100%;
    justify-content: center;
  }
  .panel {
    padding: 16px;
  }
  .metric {
    min-height: 96px;
  }
  .metrics,
  .split,
  .report-grid,
  .detail-grid,
  .operation-layout,
  .form-grid,
  .login-panel,
  .summary-kv { grid-template-columns: 1fr; }
  .topbar,
  .operation-switch,
  .map-head,
  .form-section-head { flex-direction: column; }
  .operation-switch,
  .map-head,
  .form-section-head { align-items: stretch; }
  .operation-tabs { justify-content: flex-start; }
  .map-search-form {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .toolbar,
  .panel-head,
  .form-actions,
  .quick-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .filters,
  .inline-form,
  .row-form,
  .actions {
    width: 100%;
  }
  .filters input,
  .filters select,
  .inline-form input,
  .inline-form select,
  .row-form input,
  .row-form select {
    width: 100%;
  }
  .table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .panel > table,
  table.inventory-table { display: block; max-width: 100%; overflow-x: auto; }
  .mobile-shell {
    max-width: none;
  }
  .inventory-review-card header,
  .mobile-status-card,
  .bot-card-head,
  .bot-card-footer {
    flex-direction: column;
  }
  .settings-page {
    max-width: none;
  }
  .settings-form .form-actions {
    justify-content: stretch;
  }
  .bot-card-buttons {
    width: 100%;
  }
  .bot-card-buttons .button,
  .bot-card-buttons .delete-form {
    flex: 1 1 0;
  }
  .bot-card-buttons .delete-form .button {
    width: 100%;
  }
  .inventory-entry-form {
    grid-template-columns: 1fr;
    min-width: 0;
  }
  .inventory-remark-field {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 13px;
  }
  .sidebar {
    padding-inline: 14px;
  }
  .main {
    padding: 14px;
  }
  .brand-mark {
    width: 36px;
    height: 36px;
  }
  .mobile-quicknav {
    gap: 6px;
  }
  .mobile-quicknav a {
    min-height: 42px;
    padding-inline: 4px;
    font-size: 12px;
  }
  .topbar h1 {
    font-size: 20px;
  }
  .metrics {
    gap: 10px;
  }
  .metric strong {
    font-size: 24px;
  }
  .toolbar,
  .panel {
    padding: 14px;
  }
  .toolbar .button,
  .form-actions .button,
  .quick-actions .button,
  .mobile-actions .button,
  .mobile-scan-button {
    width: 100%;
  }
  .mobile-sticky-actions .button {
    width: 100%;
  }
  .kv,
  .mobile-kv {
    grid-template-columns: 86px minmax(0, 1fr);
  }
  .bar-row-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }
  .bar-row-head span,
  .bar-row-head strong {
    white-space: normal;
  }
}

.role-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.role-summary-card {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft, #f8fafc);
}

.role-summary-card span {
  color: var(--muted);
  line-height: 1.55;
}

.user-toolbar {
  align-items: end;
}

.user-table td:nth-child(3) {
  min-width: 180px;
}

.badge.role-badge {
  background: #e0f2fe;
  color: #075985;
}

.role-badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 150px;
}

.permission-selector {
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 0;
  min-width: 0;
  padding: 10px 12px 12px;
}

.permission-selector legend {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  padding: 0 6px;
}

.permission-option-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.form-grid .permission-option {
  align-items: center;
  background: var(--panel-soft, #f8fafc);
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  display: flex;
  flex-direction: row;
  gap: 9px;
  min-height: 42px;
  padding: 8px 10px;
}

.permission-option:has(input:checked) {
  background: #ecfeff;
  border-color: #67e8f9;
  color: #155e75;
}

.permission-option input {
  accent-color: var(--primary, #0f766e);
  height: 18px;
  margin: 0;
  width: 18px;
}

.badge.active {
  background: #dcfce7;
  color: #166534;
}

.badge.inactive {
  background: #e5e7eb;
  color: #475569;
}

.badge.deleted {
  background: #fee2e2;
  color: #991b1b;
}

.account-toggle {
  align-items: center;
  align-self: end;
  cursor: pointer;
  display: inline-flex;
  gap: 12px;
  justify-self: start;
  min-height: 46px;
  width: auto;
}

.account-toggle > input {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.account-toggle-track {
  background: #cbd5e1;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .08);
  flex: 0 0 auto;
  height: 28px;
  position: relative;
  transition: background .18s ease;
  width: 50px;
}

.account-toggle-track::after {
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(15, 23, 42, .24);
  content: "";
  height: 22px;
  left: 3px;
  position: absolute;
  top: 3px;
  transition: transform .18s ease;
  width: 22px;
}

.account-toggle > input:checked + .account-toggle-track {
  background: var(--primary, #0f766e);
}

.account-toggle > input:checked + .account-toggle-track::after {
  transform: translateX(22px);
}

.account-toggle > input:focus-visible + .account-toggle-track {
  outline: 3px solid rgba(37, 99, 235, .24);
  outline-offset: 2px;
}

.account-toggle-copy {
  display: grid;
  gap: 2px;
}

.account-toggle-copy small {
  color: var(--muted);
  font-weight: 400;
}

.user-row-actions {
  flex-wrap: nowrap;
}

.user-row-actions form {
  margin: 0;
}

.workflow-config-list,
.workflow-step-editor-list,
.approval-timeline {
  display: grid;
  gap: 12px;
}

.workflow-config-card {
  align-items: center;
  background: var(--panel-soft, #f8fafc);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 13px 15px;
}

.workflow-config-card > div:first-child {
  display: grid;
  gap: 4px;
}

.workflow-config-card span,
.workflow-config-card small {
  color: var(--muted);
}

.workflow-create-form {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 18px;
}

.workflow-warning {
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: 10px;
  color: #9a3412;
  padding: 12px 14px;
}

.workflow-warning ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.workflow-editor {
  display: grid;
  gap: 20px;
}

.workflow-step-editor {
  align-items: start;
  background: var(--panel-soft, #f8fafc);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: grid;
  gap: 12px;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  padding: 14px;
}

.workflow-step-number,
.approval-timeline-marker {
  align-items: center;
  background: var(--primary, #0f766e);
  border-radius: 50%;
  color: #fff;
  display: flex;
  font-weight: 800;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.workflow-step-fields {
  display: grid;
  gap: 10px;
  grid-template-columns: 100px minmax(180px, 1fr) minmax(220px, 1fr);
}

.workflow-step-fields label,
.workflow-new-step label,
.approval-route-selector label {
  display: grid;
  gap: 6px;
}

.workflow-step-fields .wide {
  grid-column: 1 / -1;
}

.workflow-new-step {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 14px;
}

.workflow-new-step h3,
.approval-round h3 {
  margin-top: 0;
}

.approval-route-selector {
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  border-radius: 12px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.approval-route-head,
.approval-timeline-head {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.approval-route-head span,
.approval-step-label {
  color: var(--muted);
  font-size: 13px;
}

.approval-round + .approval-round {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 18px;
}

.approval-timeline-step {
  display: grid;
  gap: 12px;
  grid-template-columns: 36px minmax(0, 1fr);
  position: relative;
}

.approval-timeline-step.status-waiting .approval-timeline-marker,
.approval-timeline-step.status-cancelled .approval-timeline-marker {
  background: #94a3b8;
}

.approval-timeline-step.status-approved .approval-timeline-marker {
  background: #16a34a;
}

.approval-timeline-step.status-rejected .approval-timeline-marker {
  background: #dc2626;
}

.approval-timeline-copy {
  background: var(--panel-soft, #f8fafc);
  border: 1px solid var(--line);
  border-radius: 11px;
  display: grid;
  gap: 6px;
  padding: 11px 13px;
}

.approval-timeline-copy > span,
.approval-timeline-copy > small {
  color: var(--muted);
}

.approval-comment {
  background: #fff7ed;
  border-radius: 7px;
  color: #9a3412 !important;
  padding: 6px 8px;
}

.badge.approval-PENDING {
  background: #fef3c7;
  color: #92400e;
}

.badge.approval-APPROVED {
  background: #dcfce7;
  color: #166534;
}

.badge.approval-REJECTED {
  background: #fee2e2;
  color: #991b1b;
}

.badge.approval-WAITING,
.badge.approval-CANCELLED {
  background: #e2e8f0;
  color: #475569;
}

.approval-reassign-form {
  margin-top: 5px;
}

@media (max-width: 800px) {
  .annual-test-reel-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .workflow-step-editor {
    grid-template-columns: 36px minmax(0, 1fr);
  }
  .workflow-step-editor > .button {
    grid-column: 2;
    justify-self: start;
  }
  .workflow-step-fields {
    grid-template-columns: 1fr;
  }
  .workflow-step-fields .wide {
    grid-column: auto;
  }
}

.badge.warning,
.scope-readonly .priority-flag {
  background: #d8dee6;
  color: #52606d;
}

.scope-readonly {
  cursor: not-allowed;
  background: #edf0f3 !important;
  border-color: #c8d0d9 !important;
  box-shadow: none !important;
  color: #7b8794 !important;
  filter: grayscale(1) !important;
  opacity: .72;
}

.scope-readonly .location-code,
.scope-readonly .location-reel-name,
.scope-readonly strong,
.scope-readonly small,
.scope-readonly .location-meta {
  color: #7b8794 !important;
}

.scope-readonly:hover {
  background: #edf0f3 !important;
  border-color: #c8d0d9 !important;
  box-shadow: none !important;
  transform: none !important;
}

@media print {
  .sidebar,
  .topbar,
  .toolbar,
  .flash-wrap,
  .no-print {
    display: none !important;
  }
  .main {
    margin: 0;
    padding: 0;
  }
  body {
    background: #fff;
  }
  .label-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8mm;
  }
  .label-card {
    min-height: 34mm;
    border-radius: 0;
    box-shadow: none;
  }
}
