:root {
  --bg: #f1f2f5;
  --surface: #ffffff;
  --surface-2: #eef2f6;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --text: #202124;
  --muted: #6b7280;
  --primary: #e02e24;
  --primary-strong: #c81e1a;
  --success: #52c41a;
  --warning: #b45309;
  --danger: #e02e24;
  --purple: #6d28d9;
  --shadow: 0 8px 28px rgba(30, 35, 45, 0.08);
  --radius: 4px;
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    "Noto Sans CJK SC",
    Arial,
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  transition: grid-template-columns 0.2s ease;
}

.sidebar {
  background: #252a35;
  color: #f8fafc;
  padding: 20px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  align-items: center;
  padding: 0 22px 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
  height: 42px;
  width: 42px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #ffffff;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-logo {
  background: transparent;
  color: transparent;
  object-fit: cover;
  padding: 0;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 15px;
  line-height: 1.3;
}

.brand span {
  color: #bac4d2;
  margin-top: 4px;
  font-size: 12px;
}

.nav {
  margin-top: 14px;
}

.sidebar-toggle {
  width: calc(100% - 28px);
  min-height: 40px;
  margin: 12px 14px 0;
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  color: #dbe4ee;
  text-align: left;
  padding: 0 12px;
}

.sidebar-toggle:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
}

.nav-group {
  margin: 18px 22px 8px;
  color: #9ca8b8;
  font-size: 12px;
}

.nav-item {
  width: 100%;
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  border: 0;
  border-radius: 4px;
  color: #dbe4ee;
  background: transparent;
  text-align: left;
  padding: 0 18px;
  margin: 2px 0;
  font-size: 16px;
}

.nav-item:hover,
.nav-item.active {
  background: var(--primary);
  color: #ffffff;
}

.nav-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: #a7b4c5;
}

.icon-svg,
.inline-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  display: block;
}

.nav-icon .icon-svg,
.nav-icon > svg {
  width: 20px;
  height: 20px;
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon {
  color: #ffffff;
}

.workspace {
  min-width: 0;
}

.sidebar-collapsed .app-shell {
  grid-template-columns: 76px minmax(0, 1fr);
}

.sidebar-collapsed .brand {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 0 12px 18px;
}

.sidebar-collapsed .brand > div:last-child,
.sidebar-collapsed .nav-group,
.sidebar-collapsed .nav-item span:not(.nav-icon),
.sidebar-collapsed .sidebar-toggle span:not(.nav-icon) {
  display: none;
}

.sidebar-collapsed .sidebar-toggle {
  width: 48px;
  grid-template-columns: 1fr;
  justify-items: center;
  margin: 12px 14px 0;
  padding: 0;
}

.sidebar-collapsed .nav-item {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 0;
}

.topbar {
  height: 78px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.subpage-layout .topbar {
  height: 58px;
  padding: 0 18px;
}

.breadcrumb {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
  display: none;
}

.subpage-layout .breadcrumb {
  display: block;
  color: #4b5563;
  font-size: 14px;
  font-weight: 600;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: 24px;
  margin-bottom: 0;
}

.subpage-layout h1 {
  display: none;
}

h2 {
  font-size: 18px;
  margin-bottom: 0;
}

h3 {
  font-size: 16px;
  margin-bottom: 12px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.bell-button,
.topbar-icon-button {
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: #606266;
  display: grid;
  place-items: center;
  border-radius: 4px;
}

.bell-button:hover,
.topbar-icon-button:hover {
  background: #f5f5f5;
  color: var(--primary);
}

.topbar-icon-button {
  cursor: pointer;
}

.topbar-icon-button svg {
  width: 18px;
  height: 18px;
}

.logout-button:hover {
  background: #fff5f4;
  color: var(--primary);
}

.role-switcher {
  height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}

.role-switcher select {
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.user-chip {
  min-width: 170px;
  max-width: 220px;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  align-items: center;
  overflow: hidden;
}

.avatar-dot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  overflow: hidden;
  flex: 0 0 auto;
}

.avatar-dot img,
.table-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-dot.has-image,
.table-avatar.has-image {
  background: #fff5f4;
}

.table-user-cell {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.table-avatar {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  flex: 0 0 auto;
}

.user-chip strong,
.user-chip span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip strong {
  font-size: 14px;
}

.user-chip span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.page-content {
  padding: 28px 28px 56px;
}

.subpage-layout .page-content {
  padding: 14px 16px 56px;
}

.toolbar,
.filter-grid,
.section-header,
.split-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toolbar {
  margin-bottom: 16px;
  flex-wrap: wrap;
}

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

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 22px;
  margin-bottom: 22px;
}

.metric-card {
  min-height: 136px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 24px 28px;
}

.metric-card span {
  color: var(--muted);
  font-size: 18px;
}

.metric-card strong {
  display: block;
  margin-top: 18px;
  font-size: 40px;
  line-height: 1;
}

.metric-card small {
  display: none;
  margin-top: 8px;
  color: var(--muted);
}

.metric-card.metric-muted strong {
  color: #8c8c8c;
}

.metric-card.metric-success strong {
  color: #52c41a;
}

.metric-card.metric-network strong {
  color: #1677ff;
}

.metric-card.metric-danger strong {
  color: var(--primary);
}

.metric-card.metric-warning strong,
.metric-card.metric-review strong {
  color: #fa8c16;
}

.metric-card.metric-review {
  background: #fffbe6;
  border-color: #ffc53d;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  margin-bottom: 22px;
}

.storage-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
  padding: 16px 18px;
  border: 1px solid #b7eb8f;
  border-radius: 4px;
  background: #f6ffed;
}

.storage-banner strong {
  display: block;
  color: #135200;
  font-size: 14px;
}

.storage-banner span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.storage-banner.storage-notice {
  border-color: #ffe58f;
  background: #fffbe6;
}

.storage-banner.storage-warning,
.storage-banner.storage-critical {
  border-color: #ffd591;
  background: #fff7e6;
}

.storage-banner.storage-emergency {
  border-color: #ffccc7;
  background: #fff1f0;
}

.storage-banner.storage-warning strong,
.storage-banner.storage-critical strong {
  color: #ad4e00;
}

.storage-banner.storage-emergency strong {
  color: #a8071a;
}

.storage-meter {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
}

.storage-meter-track {
  width: 132px;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #f0f0f0;
}

.storage-meter-track span {
  display: block;
  height: 100%;
  margin: 0;
  background: var(--primary);
}

.storage-meter b {
  min-width: 44px;
  text-align: right;
}

.panel-header {
  min-height: 66px;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.panel-header-actions {
  min-height: 54px;
  padding: 12px 16px;
  justify-content: flex-start;
}

.panel-header-actions .actions {
  justify-content: flex-start;
}

.panel-title {
  margin: 0;
  font-size: 18px;
}

.panel-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.panel-body {
  padding: 16px;
}

.upload-panel .panel-body {
  padding: 0;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 308px;
  gap: 22px;
}

.dashboard-grid table {
  min-width: 680px;
}

.quick-action-card {
  min-height: 970px;
}

.quick-action-list {
  display: grid;
  gap: 12px;
}

.quick-action-list .primary-button,
.quick-action-list .secondary-button {
  width: 100%;
  min-height: 56px;
  font-size: 16px;
}

.filter-panel {
  padding: 18px 20px;
  border: 0;
  border-radius: 0;
}

.filter-grid {
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px 24px;
}

.field {
  min-width: 0;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.field span {
  flex: none;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  text-align: left;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 0 12px;
  background: #ffffff;
  color: var(--text);
  outline: none;
}

.field textarea {
  height: 74px;
  padding: 10px;
  resize: vertical;
}

.filter-grid > .actions {
  align-self: center;
  grid-column: auto / span 2;
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-grid > .actions .primary-button,
.filter-grid > .actions .secondary-button {
  min-width: 72px;
  min-height: 46px;
  padding: 0 18px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(224, 46, 36, 0.12);
}

.primary-button,
.secondary-button,
.text-button,
.danger-button,
.ghost-button {
  min-height: 36px;
  border-radius: 4px;
  padding: 0 12px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.primary-button .inline-icon,
.secondary-button .inline-icon,
.danger-button .inline-icon,
.ghost-button .inline-icon {
  width: 16px;
  height: 16px;
}

.text-button .inline-icon {
  width: 14px;
  height: 14px;
}

.primary-button {
  background: var(--primary);
  color: #ffffff;
}

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

.secondary-button {
  background: #ffffff;
  color: var(--text);
  border-color: var(--line-strong);
}

.secondary-button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

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

.danger-button {
  background: #fff1f0;
  border-color: #ffa39e;
  color: var(--danger);
}

.text-button {
  padding: 0 6px;
  min-height: 30px;
  background: transparent;
  color: var(--primary);
}

.text-button.danger {
  color: var(--danger);
}

.primary-button:disabled,
.secondary-button:disabled,
.danger-button:disabled,
.ghost-button:disabled,
.text-button:disabled {
  color: #9ca3af;
  background: #f3f4f6;
  border-color: #e5e7eb;
  cursor: not-allowed;
  opacity: 1;
}

.text-button:disabled,
.text-button.danger:disabled {
  background: transparent;
  border-color: transparent;
  color: #9ca3af;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
  color: var(--text);
  display: grid;
  place-items: center;
  padding: 0;
}

.icon-button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-gutter: stable;
}

.table-scrollbar {
  position: fixed;
  right: 18px;
  bottom: 0;
  left: 298px;
  z-index: 20;
  height: 18px;
  overflow-x: auto;
  overflow-y: hidden;
  background: #ffffff;
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 12px rgba(30, 35, 45, 0.08);
}

.sidebar-collapsed .table-scrollbar {
  left: 94px;
}

.table-scrollbar-inner {
  height: 1px;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.pagination-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.pagination-summary {
  min-width: 48px;
  color: #3f5573;
  font-weight: 600;
  white-space: nowrap;
}

.pagination-size-select,
.pagination-jump input,
.pagination-jump-button {
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  outline: 0;
  font-size: 12px;
}

.pagination-size-select {
  min-width: 98px;
  padding: 0 26px 0 10px;
}

.pagination-jump {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #3f5573;
  white-space: nowrap;
}

.pagination-jump label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.pagination-jump input {
  width: 48px;
  padding: 0 6px;
  text-align: center;
}

.pagination-jump-button {
  padding: 0 10px;
  background: #f8fafc;
  color: #3157d5;
  font-weight: 600;
}

.pagination-jump-button:hover {
  border-color: #c7d2fe;
  background: #eef2ff;
}

.pagination-button,
.pagination-number {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 12px;
}

.pagination-button {
  background: #f8fafc;
}

.pagination-button:hover:not(:disabled),
.pagination-number:hover:not(.active) {
  border-color: #c7d2fe;
  color: #3157d5;
}

.pagination-button:disabled {
  color: #cbd5e1;
  cursor: not-allowed;
  background: #f8fafc;
}

.pagination-number.active {
  border-color: #c7d2fe;
  background: #eef2ff;
  color: #3157d5;
  font-weight: 700;
}

.pagination-ellipsis {
  min-width: 14px;
  color: #94a3b8;
  text-align: center;
}

.pagination-button .inline-icon {
  width: 14px;
  height: 14px;
}

.pagination-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 10px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.actions > .pagination-inline:first-child {
  margin-left: 0;
  padding-left: 0;
  border-left: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1320px;
  table-layout: auto;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
  white-space: nowrap;
}

td {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

td:last-child {
  max-width: none;
  overflow: visible;
  text-overflow: clip;
}

th {
  background: #fafafa;
  color: #526071;
  font-weight: 600;
}

.selection-cell {
  width: 42px;
  max-width: 42px;
  text-align: center;
}

.selection-checkbox {
  width: 15px;
  height: 15px;
  margin: 0;
  vertical-align: middle;
  accent-color: var(--primary);
}

.selected-count {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

tbody tr:hover {
  background: #f9fbfd;
}

tfoot td {
  background: #f7f8fa;
  color: #1f2937;
  font-weight: 600;
  border-top: 1px solid var(--line);
}

.table-summary-row td {
  padding-top: 13px;
  padding-bottom: 13px;
}

.table-row-warn {
  background: #fffbe6;
}

.table-row-danger {
  background: #fff1f0;
}

.log-row-failed {
  background: #fff7f7;
}

.log-row-danger {
  background: #fffaf0;
}

.log-level {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 4px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}

.log-level-failed {
  color: #cf1322;
  background: #fff1f0;
  border-color: #ffa39e;
}

.log-level-danger {
  color: #ad4e00;
  background: #fff7e6;
  border-color: #ffd591;
}

.log-level-important {
  color: #0958d9;
  background: #e6f4ff;
  border-color: #91caff;
}

.log-level-normal {
  color: #344054;
  background: #f8fafc;
  border-color: #d0d5dd;
}

.log-level-system {
  color: #531dab;
  background: #f9f0ff;
  border-color: #d3adf7;
}

.compact-table {
  min-width: 760px;
}

.status,
.role-tag,
.scope-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.status.matched,
.status.active,
.status.success,
.status.resolved {
  background: #f6ffed;
  color: var(--success);
  border-color: #b7eb8f;
}

.status.pending,
.status.running {
  background: #fafafa;
  color: #8c8c8c;
  border-color: #d9d9d9;
}

.status.exception,
.status.open,
.status.failed {
  background: #fff1f0;
  color: var(--danger);
  border-color: #ffa39e;
}

.status.duplicate,
.status.paused {
  background: #f5f3ff;
  color: var(--purple);
  border-color: #ddd6fe;
}

.status.retake,
.status.processing {
  background: #fffbeb;
  color: #fa8c16;
  border-color: #ffd591;
}

.ops-summary-grid,
.ops-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.ops-summary-grid {
  grid-template-columns: minmax(320px, 1.3fr) minmax(280px, 1fr);
}

.ops-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 14px;
  min-width: 0;
}

.ops-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 26px;
  margin-bottom: 12px;
}

.ops-card-head strong {
  font-size: 14px;
  line-height: 1.35;
}

.ops-card-head > span:not(.status) {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.ops-kv {
  display: grid;
  gap: 8px;
  margin: 0;
}

.ops-kv div {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.ops-kv dt {
  color: var(--muted);
  font-size: 12px;
}

.ops-kv dd {
  margin: 0;
  min-width: 0;
  color: #344054;
  font-size: 12px;
  line-height: 1.45;
  word-break: break-all;
}

.ops-counts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.ops-counts span {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fafafa;
  padding: 10px 8px;
  text-align: center;
}

.ops-counts b,
.ops-counts small {
  display: block;
}

.ops-counts b {
  font-size: 20px;
  line-height: 1.1;
}

.ops-counts small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.ops-card-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  min-height: 18px;
  word-break: break-word;
}

.switch-line {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.switch-line input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.ops-disk-card {
  min-height: 184px;
}

.ops-meter {
  margin-bottom: 14px;
}

.role-tag {
  background: #eef2f6;
  color: #344054;
  border-color: var(--line);
}

.scope-tag {
  background: #ecfeff;
  color: #d4380d;
  border-color: #ffbb96;
  margin: 2px;
}

.permission-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #bae6fd;
  background: #fff7e6;
  border-radius: 8px;
  margin-bottom: 16px;
}

.permission-banner strong {
  display: block;
  color: #075985;
  margin-bottom: 3px;
}

.permission-banner span {
  color: #ad4e00;
  font-size: 13px;
}

.photo-empty {
  width: 54px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  background: #f7f7f7;
  color: var(--muted);
  font-size: 12px;
}

.preview-photo-stage {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 4px;
  border: 0;
  background: #1f2937;
  display: flex;
  align-items: center;
  justify-content: center;
}

.real-photo-stage {
  background: #111111;
}

.preview-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.preview-empty-state {
  color: #d1d5db;
  font-size: 14px;
}

.preview-empty-state.light {
  color: var(--muted);
}

.correction-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.correction-photo-card {
  display: grid;
  gap: 12px;
}

.correction-photo-stage {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  background: #111827;
  border-radius: 4px;
  overflow: hidden;
}

.correction-photo-stage img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.correction-side-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

.correction-barcode-list {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f8fafc;
}

.correction-barcode-list strong {
  font-size: 13px;
}

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

.correction-barcode-row code {
  min-width: 0;
  padding: 5px 6px;
  border-radius: 3px;
  background: #ffffff;
  border: 1px solid var(--line);
  font-size: 12px;
  word-break: break-all;
}

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

.data-pair {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.data-pair span {
  color: var(--muted);
}

.data-pair strong {
  font-weight: 600;
  word-break: break-all;
}

.exception-pair {
  align-items: start;
}

.exception-text {
  display: grid;
  gap: 4px;
  min-width: 0;
  font-weight: 600;
  line-height: 1.55;
  word-break: break-all;
}

.exception-text span:not(:first-child) {
  color: var(--muted);
  font-weight: 500;
}

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

.queue-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.queue-item strong {
  font-size: 14px;
}

.queue-item span {
  color: var(--muted);
  font-size: 13px;
}

.upload-zone {
  min-height: 120px;
  border: 1px solid #ffccc7;
  border-radius: 4px;
  background: #fffafa;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
}

.upload-zone .primary-button {
  display: none;
}

.review-alert {
  min-height: 48px;
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  padding: 0 16px;
  border: 1px solid #ffe58f;
  background: #fffbe6;
  color: #ad6800;
}

.upload-zone strong {
  display: block;
  font-size: 17px;
  margin-bottom: 8px;
}

.upload-zone p {
  color: var(--muted);
  margin-bottom: 14px;
}

.upload-hint-grid {
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.hint-item {
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
}

.hint-item strong {
  display: block;
  margin-bottom: 4px;
}

.hint-item span {
  color: var(--muted);
  font-size: 12px;
}

.warehouse-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 10px;
}

.warehouse-list {
  display: grid;
  gap: 8px;
}

.warehouse-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
  padding: 6px;
}

.warehouse-select-button {
  min-height: 54px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
}

.warehouse-item.active {
  border-color: #ffccc7;
  background: #fff1f0;
  box-shadow: none;
}

.warehouse-delete-button {
  align-self: center;
  width: 34px;
  height: 34px;
  padding: 0;
  justify-content: center;
}

.warehouse-delete-button span:last-child {
  display: none;
}

.warehouse-list strong,
.warehouse-list span {
  display: block;
}

.warehouse-list span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  min-height: 180px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  padding: 24px;
}

.empty-mark {
  width: 70px;
  height: 52px;
  border: 2px solid var(--line-strong);
  border-radius: 8px;
  margin: 0 auto 12px;
  position: relative;
}

.empty-mark::after {
  content: "";
  width: 24px;
  height: 2px;
  background: var(--line-strong);
  position: absolute;
  left: 22px;
  top: 25px;
}

.state-panel {
  min-height: 360px;
  display: grid;
  place-items: center;
}

.state-content {
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
  color: var(--muted);
}

.state-content strong {
  color: var(--text);
  font-size: 18px;
}

.state-content.error strong {
  color: var(--danger);
}

.state-icon {
  width: 34px;
  height: 34px;
  color: var(--primary);
}

.inline-loading {
  min-height: 160px;
  display: grid;
  place-items: center;
}

.page-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 24;
  display: grid;
  place-items: center;
  pointer-events: none;
}

body.auth-booting .app-shell {
  visibility: hidden;
}

.page-loading-overlay[hidden] {
  display: none;
}

.page-loading-spinner {
  width: 38px;
  height: 38px;
  color: var(--primary);
  filter: drop-shadow(0 4px 10px rgba(224, 46, 36, 0.18));
  animation: page-loading-spin 0.8s linear infinite;
}

.page-loading-ring {
  width: 38px;
  height: 38px;
  border: 3px solid rgba(224, 46, 36, 0.18);
  border-top-color: var(--primary);
  border-radius: 999px;
  filter: drop-shadow(0 4px 10px rgba(224, 46, 36, 0.18));
  animation: page-loading-spin 0.8s linear infinite;
}

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

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 22px;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(640px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
  background: #ffffff;
  border-radius: 4px;
  box-shadow: var(--shadow);
}

.wide-modal {
  width: min(980px, 100%);
}

.large-modal {
  width: min(1180px, 100%);
}

.modal-header,
.modal-footer {
  min-height: 62px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.modal-footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: flex-end;
}

.modal-body {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 3px;
}

.preview-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 0;
  padding: 0;
}

.photo-stage {
  min-width: 0;
  min-height: 560px;
  background: #111111;
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  padding: 26px;
}

.photo-strip {
  grid-column: 1;
  grid-row: 1;
  margin-top: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
}

.photo-strip button {
  width: 92px;
  height: 64px;
  flex: 0 0 auto;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  background: transparent;
}

.photo-strip button.active {
  border-color: var(--primary);
}

.photo-strip img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.compact-empty {
  min-height: 120px;
}

.modal-table {
  max-height: 420px;
  overflow: auto;
}

.error-box {
  border-color: #ffcdd2;
  background: #fff1f0;
  color: #a8071a;
}

.detail-panel {
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  padding: 18px;
}

.summary-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
  color: var(--muted);
  line-height: 1.7;
}

.reason-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.reason-chip-list span {
  border: 1px solid #d7dde8;
  border-radius: 999px;
  background: #f8fafc;
  color: #3f4b5f;
  font-size: 12px;
  line-height: 1;
  padding: 5px 8px;
  white-space: nowrap;
}

.training-editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.training-editor-stage {
  min-width: 0;
}

.annotation-image-wrap {
  position: relative;
  display: inline-block;
  max-width: 100%;
  background: #111827;
  border-radius: 8px;
  overflow: hidden;
}

.annotation-image-wrap img {
  display: block;
  max-width: 100%;
  max-height: 68vh;
  object-fit: contain;
}

.annotation-overlay {
  position: absolute;
  inset: 0;
  cursor: crosshair;
  touch-action: none;
}

.annotation-box {
  position: absolute;
  border: 2px solid #22c55e;
  background: rgba(34, 197, 94, 0.12);
  color: #fff;
  padding: 0;
}

.annotation-box span {
  position: absolute;
  left: 0;
  top: 0;
  min-width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  background: #16a34a;
  font-size: 12px;
  font-weight: 700;
}

.annotation-box.draft {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.16);
  pointer-events: none;
}

.training-editor-side {
  display: grid;
  gap: 12px;
}

.training-editor-side textarea {
  min-height: 76px;
}

@media (max-width: 980px) {
  .training-editor-layout {
    grid-template-columns: 1fr;
  }

  .annotation-image-wrap img {
    max-height: 58vh;
  }
}

.check-row,
.checkbox-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.compact-auth-field {
  align-items: start;
}

.compact-auth-field > span {
  padding-top: 5px;
}

.compact-warehouse-grid {
  grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
  gap: 6px 8px;
  align-items: start;
}

.compact-warehouse-grid label {
  min-width: 0;
  min-height: 30px;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
  font-size: 12px;
  line-height: 1.25;
}

.compact-warehouse-grid label:hover {
  border-color: #91caff;
  background: #f8fbff;
}

.compact-warehouse-grid input[type="checkbox"] {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  margin: 0;
}

.compact-warehouse-grid span {
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.compact-customer-grid label {
  min-height: 34px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: #172033;
  color: #ffffff;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  z-index: 50;
}

.toast[hidden],
.hidden {
  display: none !important;
}

.image-viewer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  grid-template-rows: 1fr;
  background: rgba(15, 23, 42, 0.88);
}

.image-viewer-backdrop[hidden] {
  display: none;
}

.image-viewer {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.image-viewer-toolbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(15, 23, 42, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.image-viewer-toolbar h2 {
  margin: 0;
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
}

.image-viewer-toolbar .icon-button {
  width: 48px;
  height: 48px;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.08);
}

.image-viewer-toolbar .inline-icon {
  width: 22px;
  height: 22px;
}

.image-viewer-toolbar .icon-button:hover,
.image-viewer-actions .icon-button:hover {
  background: rgba(255, 255, 255, 0.16);
}

.image-viewer-stage {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  cursor: grab;
}

.image-viewer-actions {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.78);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.26);
  transform: translateX(-50%);
}

.image-viewer-actions .icon-button {
  width: 48px;
  height: 48px;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.1);
}

.image-viewer-actions .inline-icon {
  width: 22px;
  height: 22px;
}

.image-viewer-stage.dragging {
  cursor: grabbing;
}

#imageViewerImage {
  max-width: 92vw;
  max-height: calc(100vh - 150px);
  user-select: none;
  transform-origin: center center;
  transition: transform 120ms ease;
  will-change: transform;
}

@media (max-width: 640px) {
  .image-viewer-actions {
    bottom: 14px;
    gap: 8px;
    padding: 8px;
  }

  .image-viewer-actions .icon-button {
    width: 44px;
    height: 44px;
  }
}

[data-image-viewer-src] {
  cursor: zoom-in;
}

/* Compact enterprise admin density, closer to traditional operations consoles. */
body {
  font-size: 12px;
}

.app-shell {
  grid-template-columns: 208px minmax(0, 1fr);
}

.sidebar {
  padding: 10px 0;
}

.brand {
  grid-template-columns: 30px 1fr;
  gap: 8px;
  padding: 0 12px 10px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  font-size: 12px;
}

.brand strong {
  font-size: 12px;
}

.brand span {
  margin-top: 2px;
  font-size: 11px;
}

.nav {
  margin-top: 8px;
}

.nav-group {
  margin: 10px 14px 5px;
  font-size: 11px;
}

.sidebar-toggle {
  min-height: 30px;
  width: calc(100% - 16px);
  margin: 7px 8px 0;
  grid-template-columns: 20px 1fr;
  gap: 6px;
  padding: 0 8px;
  font-size: 12px;
}

.nav-item {
  min-height: 34px;
  grid-template-columns: 20px 1fr;
  gap: 8px;
  padding: 0 12px;
  font-size: 12px;
}

.nav-icon,
.nav-icon .icon-svg,
.nav-icon > svg {
  width: 16px;
  height: 16px;
}

.sidebar-collapsed .app-shell {
  grid-template-columns: 58px minmax(0, 1fr);
}

.sidebar-collapsed .brand {
  padding: 0 8px 10px;
}

.sidebar-collapsed .sidebar-toggle {
  width: 36px;
  min-height: 32px;
  margin: 8px 11px 0;
}

.topbar,
.subpage-layout .topbar {
  height: 42px;
  padding: 0 12px;
}

.subpage-layout .breadcrumb {
  font-size: 12px;
}

h1 {
  font-size: 18px;
}

h2,
.panel-title {
  font-size: 14px;
}

h3 {
  font-size: 14px;
  margin-bottom: 8px;
}

.topbar-actions {
  gap: 8px;
}

.bell-button,
.topbar-icon-button,
.icon-button {
  width: 28px;
  height: 28px;
}

.role-switcher {
  height: 28px;
  gap: 5px;
  font-size: 12px;
}

.user-chip {
  width: 164px;
  min-width: 164px;
  max-width: 164px;
  grid-template-columns: 28px 1fr;
  gap: 8px;
}

.avatar-dot {
  width: 28px;
  height: 28px;
  font-size: 12px;
}

.user-chip strong {
  font-size: 12px;
}

.user-chip span {
  font-size: 11px;
}

.page-content,
.subpage-layout .page-content {
  padding: 7px 8px 40px;
}

.toolbar {
  margin-bottom: 8px;
}

.actions {
  gap: 5px;
}

.panel {
  margin-bottom: 7px;
  border-radius: 2px;
}

.panel-header {
  min-height: 36px;
  padding: 6px 10px;
}

.panel-subtitle {
  margin-top: 2px;
  font-size: 12px;
}

.panel-body {
  padding: 10px;
}

.metric-grid {
  gap: 8px;
  margin-bottom: 8px;
}

.metric-card {
  min-height: 72px;
  padding: 10px 12px;
}

.metric-card span {
  font-size: 12px;
}

.metric-card strong {
  margin-top: 8px;
  font-size: 24px;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 8px;
}

.quick-action-card {
  min-height: 0;
}

.quick-action-list {
  gap: 6px;
}

.quick-action-list .primary-button,
.quick-action-list .secondary-button {
  min-height: 32px;
  font-size: 13px;
}

.filter-panel {
  padding: 8px 10px;
  border: 1px solid var(--line);
}

.filter-panel::before {
  content: "查询条件";
  display: block;
  margin: -1px 0 7px;
  color: #111827;
  font-size: 12px;
  font-weight: 700;
}

.filter-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 7px 12px;
  align-items: center;
}

.field {
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 6px;
}

.field span {
  color: #1f2937;
  font-size: 12px;
  font-weight: 600;
  text-align: right;
}

.field input,
.field select,
.field textarea {
  height: 28px;
  border-radius: 2px;
  padding: 0 7px;
  font-size: 12px;
}

.field textarea {
  height: 60px;
  padding: 6px 8px;
}

.filter-grid > .actions {
  grid-column: 5;
  grid-row: 1;
  justify-content: flex-end;
  align-self: center;
  padding-left: 4px;
  gap: 5px;
}

.filter-grid > .actions:nth-child(9) {
  grid-row: 1 / span 2;
  align-self: end;
}

.filter-grid > .actions .primary-button,
.filter-grid > .actions .secondary-button {
  min-width: 56px;
  min-height: 28px;
  padding: 0 9px;
}

.filter-wide {
  grid-column: 1 / span 4;
  min-width: 0;
}

.quick-range {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.segmented-button {
  height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  padding: 0 10px;
  background: #ffffff;
  color: #374151;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.segmented-button.active,
.segmented-button:hover {
  border-color: var(--primary);
  background: rgba(224, 46, 36, 0.08);
  color: var(--primary);
}

.primary-button,
.secondary-button,
.danger-button,
.ghost-button {
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
  gap: 4px;
}

.text-button {
  min-height: 24px;
  padding: 0 4px;
  font-size: 12px;
  gap: 3px;
}

.primary-button .inline-icon,
.secondary-button .inline-icon,
.danger-button .inline-icon,
.ghost-button .inline-icon,
.text-button .inline-icon,
.inline-icon {
  width: 13px;
  height: 13px;
}

.table-scrollbar {
  left: 216px;
  right: 8px;
  height: 14px;
}

.sidebar-collapsed .table-scrollbar {
  left: 66px;
}

.table-wrap {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.table-wrap::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.table-scrollbar {
  scrollbar-color: #9ca3af #f3f4f6;
}

.table-scrollbar::-webkit-scrollbar {
  height: 12px;
}

.table-scrollbar::-webkit-scrollbar-track {
  background: #f3f4f6;
}

.table-scrollbar::-webkit-scrollbar-thumb {
  background: #9ca3af;
  border: 3px solid #f3f4f6;
  border-radius: 999px;
}

.table-scrollbar::-webkit-scrollbar-thumb:hover {
  background: #6b7280;
}

table {
  min-width: 1260px;
}

th,
td {
  padding: 6px 9px;
  font-size: 12px;
}

th {
  color: #111827;
  background: #f3f4f6;
}

.table-empty-cell {
  height: 78px;
  color: #6b7280;
  text-align: center;
  font-size: 12px;
  font-weight: 400;
}

.status,
.role-tag,
.scope-tag {
  min-height: 20px;
  padding: 0 7px;
  font-size: 11px;
}

.permission-banner {
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: 2px;
}

.photo-empty {
  width: 44px;
  height: 30px;
  font-size: 11px;
}

.upload-zone {
  min-height: 82px;
  padding: 14px;
}

.upload-zone strong {
  font-size: 14px;
  margin-bottom: 4px;
}

.upload-zone p {
  margin-bottom: 8px;
}

.review-alert {
  min-height: 34px;
  margin-bottom: 8px;
  padding: 0 12px;
}

.warehouse-layout {
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 8px;
}

.warehouse-list {
  gap: 6px;
}

.warehouse-select-button {
  min-height: 42px;
  padding: 7px 10px;
}

.warehouse-list span {
  font-size: 12px;
}

.empty-state {
  min-height: 120px;
  border-radius: 2px;
  padding: 16px;
}

.empty-mark {
  width: 52px;
  height: 38px;
  margin-bottom: 8px;
}

.empty-mark::after {
  left: 15px;
  top: 18px;
}

.modal-header,
.modal-footer {
  min-height: 44px;
  padding: 8px 12px;
}

.modal-body {
  padding: 12px;
  gap: 10px;
}

.summary-box {
  border-radius: 2px;
  padding: 8px 10px;
  line-height: 1.5;
}

/* Reference-style collapsible sidebar: expanded menu panel, collapsed icon rail. */
:root {
  --sidebar-expanded-width: 216px;
  --sidebar-collapsed-width: 44px;
  --sidebar-active: #4db6f2;
  --sidebar-blue: #1677ff;
}

.app-shell {
  grid-template-columns: var(--sidebar-expanded-width) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 0;
  overflow: hidden auto;
  background: #ffffff;
  color: #111827;
  border-right: 1px solid #e5e7eb;
  box-shadow: 2px 0 8px rgba(15, 23, 42, 0.05);
}

.brand {
  min-height: 58px;
  padding: 12px 48px 10px 14px;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 8px;
  border-bottom: 1px solid #eef0f4;
}

.brand .brand-logo {
  width: 42px;
  height: 42px;
}

.brand strong {
  color: var(--sidebar-blue);
  font-size: 14px;
  font-weight: 600;
}

.brand span {
  color: #64748b;
}

.sidebar-toggle {
  position: absolute;
  top: 18px;
  right: 8px;
  width: 34px;
  min-height: 30px;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  border: 1px solid #dbe3ef;
  border-radius: 2px;
  background: #ffffff;
  color: #111827;
}

.sidebar-toggle span:not(.nav-icon) {
  display: none;
}

.sidebar-toggle:hover {
  border-color: var(--sidebar-blue);
  background: #f8fbff;
  color: var(--sidebar-blue);
}

.nav {
  margin-top: 6px;
  padding: 0 10px 14px;
}

.nav-group {
  margin: 11px 8px 6px;
  color: #6b7280;
  font-size: 11px;
}

.nav-item {
  min-height: 38px;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  padding: 0 14px;
  margin: 2px 0;
  border-radius: 4px;
  color: #111827;
  background: #ffffff;
  font-size: 13px;
  font-weight: 500;
}

.nav-item span:not(.nav-icon) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-icon,
.nav-icon .icon-svg,
.nav-icon > svg {
  color: #64748b;
}

.nav-item:hover,
.nav-item.active {
  background: var(--sidebar-active);
  color: #ffffff;
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon,
.nav-item.active .nav-icon .icon-svg,
.nav-item:hover .nav-icon .icon-svg {
  color: #ffffff;
}

.sidebar-collapsed .app-shell {
  grid-template-columns: var(--sidebar-collapsed-width) minmax(0, 1fr);
}

.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-width);
  overflow: hidden;
  box-shadow: 2px 0 8px rgba(15, 23, 42, 0.05);
}

.sidebar-collapsed .brand,
.sidebar-collapsed .nav,
.sidebar-collapsed .nav-group {
  display: none;
}

.sidebar-collapsed .sidebar-toggle {
  position: static;
  width: var(--sidebar-collapsed-width);
  min-height: 42px;
  margin: 14px 0 0;
  border: 0;
  border-radius: 0;
  background: #ffffff;
  color: #111827;
}

.sidebar-collapsed .sidebar-toggle:hover {
  background: #f3f7fb;
  color: var(--sidebar-blue);
}

.table-scrollbar {
  left: calc(var(--sidebar-expanded-width) + 8px);
}

.sidebar-collapsed .table-scrollbar {
  left: calc(var(--sidebar-collapsed-width) + 8px);
}

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(420px, 0.95fr) minmax(420px, 1.05fr);
  background: #f4f7fb;
}

.login-visual {
  min-height: 100vh;
  padding: 42px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #ffffff;
  background:
    linear-gradient(rgba(37, 42, 53, 0.82), rgba(37, 42, 53, 0.82)),
    linear-gradient(135deg, #252a35, #e02e24 58%, #fa8c16);
}

.login-visual .brand {
  border-bottom: 0;
  padding: 0;
}

.login-visual-copy {
  max-width: 520px;
}

.login-visual-copy h1 {
  font-size: 38px;
  line-height: 1.18;
  margin-bottom: 16px;
}

.login-visual-copy p {
  color: #dbe4ee;
  line-height: 1.8;
}

.login-card-wrap {
  display: grid;
  place-items: center;
  padding: 42px;
}

.login-card {
  width: min(430px, 100%);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 30px;
}

.login-card h2 {
  font-size: 24px;
  margin-bottom: 8px;
}

.login-card p {
  color: var(--muted);
  line-height: 1.7;
}

.qr-panel {
  margin: 24px auto 18px;
  width: 210px;
  height: 210px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
}

.live-qr-panel {
  width: 236px;
  height: 236px;
  display: grid;
  place-items: center;
}

.qr-image {
  width: 100%;
  height: 100%;
  display: block;
}

.qr-loading,
.qr-fallback {
  min-height: 100%;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.qr-fallback {
  gap: 8px;
  padding: 12px;
}

.qr-fallback strong,
.qr-fallback span {
  display: block;
}

.qr-fallback span {
  max-width: 190px;
  word-break: break-all;
}

.qr-code {
  width: 100%;
  height: 100%;
  background:
    conic-gradient(from 90deg at 18% 18%, #111 0 25%, transparent 0 100%),
    conic-gradient(from 90deg at 82% 18%, #111 0 25%, transparent 0 100%),
    conic-gradient(from 90deg at 18% 82%, #111 0 25%, transparent 0 100%),
    repeating-linear-gradient(90deg, #111 0 8px, transparent 8px 14px),
    repeating-linear-gradient(0deg, rgba(17, 17, 17, 0.75) 0 6px, transparent 6px 13px);
  background-blend-mode: normal;
  border: 12px solid #ffffff;
}

.login-status {
  border: 1px solid #bae6fd;
  background: #f0f9ff;
  color: #0369a1;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 18px;
}

.login-status.success {
  border-color: #b7eb8f;
  background: #f6ffed;
  color: #237804;
}

.login-status.warning {
  border-color: #ffe58f;
  background: #fffbe6;
  color: #ad6800;
}

.login-status.error {
  border-color: #ffa39e;
  background: #fff1f0;
  color: var(--danger);
}

.login-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.api-base-field {
  margin-top: 10px;
}

.web-login-card .field {
  grid-template-columns: 64px minmax(0, 1fr);
}

.login-card .primary-button {
  width: 100%;
  text-decoration: none;
}

.login-meta {
  margin-top: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.pdf-login-page {
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  background: #f3f3f3;
  position: relative;
}

.pdf-login-page .login-card {
  width: 460px;
  padding: 54px 44px;
  border-radius: 4px;
}

.login-brand-row {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: center;
  width: max-content;
  margin: 0 auto 34px;
}

.login-brand-row .brand-logo {
  width: 42px;
  height: 42px;
}

.login-brand-row strong,
.login-brand-row span {
  display: block;
}

.login-brand-row strong {
  font-size: 16px;
}

.login-brand-row span {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.pdf-login-page .field {
  margin-bottom: 20px;
}

.pdf-login-page .primary-button {
  width: 100%;
  min-height: 48px;
  margin-top: 4px;
  text-decoration: none;
}

.login-footer {
  position: fixed;
  right: 0;
  bottom: 24px;
  left: 0;
  text-align: center;
  color: #b0b0b0;
  font-size: 12px;
}

@media (max-width: 1180px) {
  .filter-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .metric-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .dashboard-grid,
  .warehouse-layout,
  .ops-summary-grid,
  .preview-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .login-page {
    grid-template-columns: 1fr;
  }

  .login-visual {
    min-height: 360px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .table-scrollbar,
  .sidebar-collapsed .table-scrollbar {
    left: 16px;
    right: 16px;
  }

  .topbar {
    height: auto;
    min-height: 76px;
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .page-content {
    padding: 16px;
  }

  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .ops-grid {
    grid-template-columns: 1fr;
  }

  .upload-hint-grid,
  .checkbox-grid {
    grid-template-columns: 1fr;
  }

  .correction-layout,
  .correction-form-grid,
  .correction-barcode-row {
    grid-template-columns: 1fr;
  }

  .correction-photo-stage {
    aspect-ratio: 4 / 3;
  }
}

@media (max-width: 560px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .ops-kv div {
    grid-template-columns: 70px minmax(0, 1fr);
  }

  .ops-counts {
    gap: 8px;
  }

  .field {
    width: 100%;
  }

  .filter-grid {
    grid-template-columns: 1fr;
  }

  .filter-grid > .actions {
    grid-column: auto;
  }

  .field {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .actions {
    width: 100%;
  }

  .pagination-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .pagination-controls,
  .pagination-jump {
    justify-content: flex-end;
  }

  .pagination-inline {
    width: 100%;
    justify-content: flex-end;
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
  }

  .primary-button,
  .secondary-button,
  .danger-button,
  .ghost-button {
    flex: 1 1 auto;
  }
}
