/* ==========================================================
   PC 管理端样式：左侧导航 + 顶栏 + 内容区
   目标分辨率 1366x768：导航 200px，内容区内边距 16px，表格紧凑
   ========================================================== */

body.a-body {
  background: var(--c-bg);
}

/* ---------- 登录遮罩 ---------- */
.a-login {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0D47A1 0%, #1976D2 60%, #42A5F5 100%);
}

.a-login__box {
  width: 340px;
  padding: 28px 26px;
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
}

.a-login__title {
  margin-bottom: 4px;
  font-size: 19px;
  font-weight: 600;
  text-align: center;
}

.a-login__sub {
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--c-text-sub);
  text-align: center;
}

.a-login .form-item__label {
  font-size: 13px;
}

.a-login__tip {
  margin-top: 10px;
  font-size: 12px;
  color: var(--c-text-sub);
  text-align: center;
}

/* ---------- 布局骨架 ---------- */
.a-shell {
  display: flex;
  min-height: 100vh;
}

.a-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 30;
  width: 200px;
  display: flex;
  flex-direction: column;
  background: #0F2740;
  color: #CFD8DC;
}

.a-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 52px;
  padding: 0 14px;
  background: var(--c-primary-dark);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
}

.a-sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.a-sidebar__group {
  padding: 10px 14px 4px;
  font-size: 11px;
  color: #78909C;
  letter-spacing: 1px;
}

.a-sidebar__item {
  display: block;
  padding: 8px 14px;
  color: #CFD8DC;
  font-size: 13px;
  border-left: 3px solid transparent;
}

.a-sidebar__item:hover {
  background: rgba(255, 255, 255, .06);
  color: #fff;
}

.a-sidebar__item.is-active {
  background: rgba(25, 118, 210, .25);
  border-left-color: #42A5F5;
  color: #fff;
  font-weight: 600;
}

.a-sidebar__badge {
  float: right;
  min-width: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--c-danger);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

.a-main {
  flex: 1;
  min-width: 0;
  margin-left: 200px;
  display: flex;
  flex-direction: column;
}

.a-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 52px;
  padding: 0 16px;
  background: #fff;
  border-bottom: 1px solid var(--c-border);
}

.a-topbar__title {
  font-size: 16px;
  font-weight: 600;
}

.a-topbar__crumb {
  font-size: 12px;
  color: var(--c-text-sub);
}

.a-topbar__right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.a-content {
  padding: 16px;
  min-height: calc(100vh - 52px);
}

/* ---------- 筛选区 ---------- */
.a-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
  padding: 12px 14px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

.a-filter__item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.a-filter__item > label {
  font-size: 12px;
  color: var(--c-text-sub);
}

.a-filter__item .input {
  width: 160px;
  min-height: 30px;
  padding: 4px 8px;
  font-size: 13px;
}

.a-filter__item .input--wide {
  width: 220px;
}

.a-filter__actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* ---------- 卡片 / 看板 ---------- */
.a-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.a-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}

.a-card__label {
  font-size: 13px;
  color: var(--c-text-sub);
}

.a-card__value {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.a-card__value--danger {
  color: var(--c-danger);
}

.a-card__value--warning {
  color: var(--c-warning);
}

.a-card__foot {
  margin-top: 6px;
  font-size: 12px;
  color: var(--c-text-sub);
}

.a-panel {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.a-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.a-panel__head h3 {
  font-size: 14px;
}

/* ---------- 表格 ---------- */
.a-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.a-table {
  width: 100%;
  font-size: 13px;
  background: #fff;
}

.a-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 10px;
  background: #F7F9FB;
  border-bottom: 1px solid var(--c-border);
  color: var(--c-text-sub);
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.a-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
}

.a-table tbody tr:nth-child(even) {
  background: #FAFBFC;
}

.a-table tbody tr:hover {
  background: var(--c-primary-light);
}

.a-table tbody tr.row--danger td {
  color: var(--c-danger);
}

/* ---------- A07 改手 / 交接盘 行标记 ----------
   改手=橙 #ED6C02，交接=蓝 #1976D2；两者都有时橙优先（docs/08 §7.5）。
   只设 background 与左边框，不设 color，以便与 .row--danger（红字）叠加共存。 */
.a-table tbody tr.row--rework td {
  background: #FFF3E0;
}
.a-table tbody tr.row--rework td:first-child {
  box-shadow: inset 3px 0 0 #ED6C02;
}
.a-table tbody tr.row--handover td {
  background: #E3F2FD;
}
.a-table tbody tr.row--handover td:first-child {
  box-shadow: inset 3px 0 0 #1976D2;
}

/* 已停用的字典项（字典管理页需要看到它们以便重新启用） */
.a-table tbody tr.row--muted td {
  color: #9E9E9E;
  background: #FAFAFA;
}

.a-table td.num,
.a-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.a-table tfoot td {
  padding: 8px 10px;
  background: #F7F9FB;
  border-top: 1px solid var(--c-border);
  font-weight: 600;
}

.a-table__ops {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.a-table td .btn--text {
  padding: 0 4px;
  font-size: 12px;
}

/* ---------- 分页 ---------- */
.a-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 2px;
  font-size: 13px;
  color: var(--c-text-sub);
}

.a-pager__btn {
  min-width: 30px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
  font-size: 13px;
}

.a-pager__btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.a-pager__btn.is-active {
  background: var(--c-primary);
  border-color: var(--c-primary);
  color: #fff;
}

/* ---------- 弹窗 ---------- */
.a-modal-mask {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
  background: rgba(15, 23, 42, .45);
}

.a-modal {
  width: 560px;
  max-width: 100%;
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: modal-in .16s ease;
}

.a-modal--lg {
  width: 800px;
}

.a-modal--sm {
  width: 420px;
}

.a-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--c-border);
  font-size: 15px;
  font-weight: 600;
}

.a-modal__close {
  border: none;
  background: transparent;
  color: var(--c-text-sub);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}

.a-modal__body {
  padding: 16px;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
}

.a-modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--c-border);
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- 二维码打印（A4） ---------- */
.qr-sheet {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.qr-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 6px;
  border: 1px dashed #B0BEC5;
  border-radius: 6px;
  break-inside: avoid;
}

.qr-item img {
  width: 120px;
  height: 120px;
}

.qr-item__code {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.qr-item__meta {
  font-size: 12px;
  color: var(--c-text-sub);
  text-align: center;
}

@media print {
  body.a-body {
    background: #fff;
  }

  .a-sidebar,
  .a-topbar,
  .a-modal-mask,
  .no-print {
    display: none !important;
  }

  .a-main {
    margin-left: 0;
  }

  .a-content {
    padding: 0;
  }

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

  @page {
    size: A4 portrait;
    margin: 10mm;
  }
}

/* ---------- 1366 及以下微调 ---------- */
@media (max-width: 1366px) {
  .a-filter__item .input {
    width: 140px;
  }

  .a-filter__item .input--wide {
    width: 180px;
  }

  .a-content {
    padding: 12px;
  }
}
