/* ============================================================
   样机资产管理 · 页面特有样式
   共享组件见 shell.css
   ============================================================ */

/* 视图 tab */
.asset-tabs {
  display: flex;
  gap: var(--sp-1);
  margin-bottom: var(--sp-4);
  border-bottom: 2px solid var(--color-border);
}
.asset-tab {
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--fs-body);
  color: var(--color-text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .2s var(--ease);
}
.asset-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 600;
}
.asset-tab:hover:not(.active) { color: var(--color-text-primary); }

/* 样机状态 6 色标签 */
.tag-asset-idle { background: var(--tag-bg-asset-idle); color: var(--asset-idle); }
.tag-asset-reserved { background: var(--tag-bg-asset-reserved); color: var(--asset-reserved); }
.tag-asset-borrowed { background: var(--tag-bg-asset-borrowed); color: var(--asset-borrowed); }
.tag-asset-pending-return { background: var(--tag-bg-asset-pending-return); color: var(--asset-pending-return); }
.tag-asset-repairing { background: var(--tag-bg-asset-repairing); color: var(--asset-repairing); }
.tag-asset-scrapped { background: var(--tag-bg-asset-scrapped); color: var(--asset-scrapped); }

/* 借用记录状态 */
.tag-br-borrowed { background: var(--tag-bg-asset-borrowed); color: var(--asset-borrowed); }
.tag-br-reserved { background: var(--tag-bg-asset-reserved); color: var(--asset-reserved); }
.tag-br-pending-return { background: var(--tag-bg-asset-pending-return); color: var(--asset-pending-return); }
.tag-br-repairing { background: var(--tag-bg-asset-repairing); color: var(--asset-repairing); }
.tag-br-returned { background: var(--tag-bg-asset-idle); color: var(--asset-idle); }

.cell-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.4;
}
.cell-cn {
  color: var(--color-text-primary);
  font-weight: 500;
}
.cell-en {
  font-size: var(--fs-aux);
  color: var(--color-text-tertiary);
}

/* 手机卡片 */
.asset-mc {
  padding: var(--sp-4);
  border-bottom: 1px solid var(--color-border);
}
.asset-mc:last-child { border-bottom: none; }
.amc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}
.amc-name { font-weight: 500; line-height: 1.4; }
.amc-meta {
  font-size: var(--fs-aux);
  color: var(--color-text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-3);
}

/* 确认弹窗（小抽屉） */
.confirm-drawer {
  top: 50%;
  right: auto;
  left: 50%;
  transform: translate(-50%, -50%) scale(.96);
  width: min(420px, 90vw);
  height: auto;
  border-radius: var(--radius-modal);
}
.confirm-drawer:not([hidden]) { transform: translate(-50%, -50%) scale(1); }

/* 配件标签 */
.acc-count {
  font-size: var(--fs-aux);
  color: var(--color-text-secondary);
}

/* 借用记录新增状态：待确认 */
.tag-br-pending { background: rgba(233, 162, 59, .14); color: #B9761B; }

/* tab 行 + 权限小字 */
.asset-tabs-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: 0;
}
.asset-tabs-row .asset-tabs { flex: 1; margin-bottom: var(--sp-4); }
.asset-tabs-row .form-perm-note { margin: 0 0 var(--sp-4); white-space: nowrap; }

/* 申请借用按钮强调 */
.btn-apply {
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(37, 99, 235, .25);
}
.btn-apply-mobile {
  width: 100%;
  justify-content: center;
  height: 44px;
  margin-bottom: var(--sp-3);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(37, 99, 235, .25);
}
.list-card-head-right {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
}
.btn-sm { height: 32px; padding: 0 12px; font-size: var(--fs-aux); }
.action-cell { white-space: nowrap; text-align: right; }
.action-cell .action-link + .action-link { margin-left: 12px; }

/* 表单抽屉：PC 两列 */
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 var(--sp-4);
}

/* 手机卡片：能借/不能借 一眼可见 */
.amc-avail-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}
.amc-avail {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
  padding: 2px 8px;
  line-height: 18px;
}
.amc-avail.yes { color: var(--asset-idle); background: var(--tag-bg-asset-idle); }
.amc-avail.no { color: var(--color-text-tertiary); background: var(--tag-bg-asset-scrapped); }
.amc-reason { font-size: 12px; color: var(--color-text-tertiary); }
.amc-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px dashed var(--color-border);
}
.btn-borrow-this {
  height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-btn);
  background: var(--color-primary);
  color: #fff;
  font-size: var(--fs-aux);
  font-weight: 500;
}
.btn-borrow-this:active { opacity: .85; }

@media (max-width: 767px) {
  .asset-tabs-row { flex-direction: column; align-items: flex-start; gap: 0; }
  .asset-tabs-row .form-perm-note { margin: -4px 0 var(--sp-3); }
  .desk-filter-items { display: none !important; }
  .list-card-head-right .list-card-count { display: none; }
  /* 手机端页头只保留全宽「申请借用」，PC 三按钮隐藏 */
  .page-header-right { display: none !important; }
}

/* 借用记录手机卡片 */
.br-mc {
  padding: var(--sp-4);
  border-bottom: 1px solid var(--color-border);
}
.br-mc:last-child { border-bottom: none; }
.bmc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}
.bmc-name { font-weight: 500; line-height: 1.4; }
.bmc-meta {
  font-size: var(--fs-aux);
  color: var(--color-text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-3);
  margin-top: 2px;
}
.bmc-foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px dashed var(--color-border);
}

/* ============ 9b 补齐：逾期 / 已取消 标签 ============ */
.tag-asset-overdue,
.tag-br-overdue { background: rgba(229, 72, 77, .12); color: #C4343A; font-weight: 600; }
.tag-br-cancelled { background: rgba(100, 116, 139, .12); color: #64748B; }

/* ============ 型号行 ============ */
.cell-model {
  font-size: var(--fs-aux);
  color: var(--color-text-secondary);
}

/* ============ 配件展开格 ============ */
.acc-details { position: relative; }
.acc-details > summary {
  list-style: none;
  cursor: pointer;
  font-size: var(--fs-aux);
  color: var(--color-primary);
  user-select: none;
}
.acc-details > summary::-webkit-details-marker { display: none; }
.acc-details > summary::after { content: '展开 ›'; margin-left: 4px; color: var(--color-text-tertiary); }
.acc-details[open] > summary::after { content: '收起 ›'; }
.acc-list {
  margin-top: 4px;
  padding: 5px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--color-bg-subtle, #F8FAFC);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  width: 100%;
  min-width: 0;
  max-width: 260px;
  box-sizing: border-box;
}
.acc-line { font-size: var(--fs-aux); }
.acc-row1 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  line-height: 17px;
}
.acc-name {
  font-weight: 500;
  color: var(--color-text-primary);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.acc-row2 {
  font-size: 11px;
  line-height: 15px;
  color: var(--color-text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.acc-ops {
  flex: 0 0 auto;
  margin-left: 12px;
  white-space: nowrap;
  display: inline-flex;
  gap: 12px;
}
.acc-ops .action-link { font-size: 11px; }
.acc-empty { font-size: var(--fs-aux); color: var(--color-text-tertiary); padding: 2px 0; }
.acc-add-link {
  display: inline-block;
  margin-top: 6px;
  font-size: var(--fs-aux);
  color: var(--color-primary);
  cursor: pointer;
}
.acc-add-link:hover { text-decoration: underline; }
.acc-tag {
  display: inline-block;
  margin: 0 4px 4px 0;
  padding: 1px 8px;
  font-size: 11px;
  border-radius: 4px;
  background: var(--color-bg-subtle, #F1F5F9);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

/* ============ 借用记录：物流列 + 12 列紧排 ============ */
.nowrap { white-space: nowrap; }
.logi-cell { font-size: var(--fs-aux); line-height: 1.5; }
.logi-sub { color: var(--color-text-tertiary); font-size: 11px; }
.logi-pending { color: var(--asset-pending-return); font-weight: 600; }
#borrowTableWrap .data-table { min-width: 800px; }
#borrowTableWrap .data-table th,
#borrowTableWrap .data-table td { padding-left: 6px; padding-right: 6px; }
#borrowTableWrap .data-table tbody td:nth-child(1) { font-size: 12px; white-space: nowrap; }
#borrowTableWrap .nowrap { font-size: 12px; }
#borrowTableWrap .acc-tag { margin-bottom: 2px; padding: 1px 6px; }
#borrowTableWrap .action-cell {
  white-space: normal;
  line-height: 2;
  text-align: right;
}
#borrowTableWrap .action-cell .action-link {
  margin-left: 8px;
  white-space: nowrap;
}

/* ============ 手机卡片补充 ============ */
.amc-model {
  font-size: var(--fs-aux);
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}
.amc-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
  margin-top: var(--sp-2);
}

/* ============ 申请借用：多台勾选清单 ============ */
.pick-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card, 8px);
  padding: 10px 12px;
  max-height: 240px;
  overflow-y: auto;
}
.pick-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-body);
  cursor: pointer;
}
.pick-item input[type="checkbox"] { flex: 0 0 auto; width: 16px; height: 16px; }
.pick-item > span:not(.tag) { display: inline-flex; flex-direction: column; min-width: 0; flex: 1; }
.pick-item > span em {
  font-style: normal;
  font-size: 11px;
  color: var(--color-text-tertiary);
}
.pick-item .tag { margin-left: auto; }
.pick-group {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px dashed var(--color-border);
  border-radius: 6px;
}
.pick-group-title {
  font-size: var(--fs-aux);
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}
.pick-hint {
  margin: 4px 0;
  font-size: var(--fs-aux);
  color: var(--color-text-tertiary);
}

/* ============ 表单通用补充 ============ */
.form-tip {
  margin: 0 0 12px;
  padding: 8px 12px;
  font-size: var(--fs-aux);
  color: var(--asset-pending-return);
  background: rgba(217, 119, 6, .08);
  border-radius: 6px;
  line-height: 1.5;
}
.readonly-ctl {
  background: var(--color-bg-subtle, #F8FAFC);
  color: var(--color-text-secondary);
  cursor: default;
}
.danger-text { color: var(--color-danger) !important; }
.confirm-sub {
  margin: 8px 0 0;
  font-size: var(--fs-aux);
  color: var(--color-text-secondary);
  line-height: 1.7;
}
.df-sub { font-size: var(--fs-aux); color: var(--color-text-tertiary); }
.df-acc { font-size: var(--fs-aux); line-height: 1.8; }
.df-acc em {
  font-style: normal;
  color: var(--color-text-tertiary);
  font-size: 11px;
  margin-left: 6px;
}

/* ============ 申请人/借用人区分标注 ============ */
.form-hint {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--color-text-tertiary);
}
.df-inline-sub {
  font-style: normal;
  font-size: 11px;
  color: var(--color-text-tertiary);
  margin-left: 2px;
}
.bmc-sub {
  font-style: normal;
  font-size: 10px;
  color: var(--color-text-tertiary);
  margin-left: 2px;
}

/* ============ 样机详情图片区（纯本地占位，无外链图片） ============ */
.asset-images {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--color-border);
}
.ai-section-label {
  font-size: var(--fs-aux);
  font-weight: 600;
  color: var(--color-text-secondary);
  margin: 10px 0 8px;
}
.ai-section-label:first-child { margin-top: 0; }
.ai-ph {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: 100%;
  background: var(--color-bg-subtle, #F1F5F9);
  border: 1px dashed var(--color-border);
  border-radius: 8px;
  color: var(--color-text-tertiary);
}
.ai-ph svg { width: 32px; height: 32px; display: block; flex: 0 0 auto; }
.ai-ph span { font-size: 12px; line-height: 1.3; text-align: center; }
.ai-ph-main { height: 168px; }
.ai-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.ai-thumb { width: 88px; min-width: 0; }
.ai-ph-acc {
  height: 68px;
  gap: 4px;
  border-radius: 6px;
}
.ai-ph-acc svg { width: 20px; height: 20px; }
.ai-ph-acc span { font-size: 10px; }
.ai-thumb-name {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.3;
  color: var(--color-text-secondary);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-empty {
  margin: 0;
  font-size: var(--fs-aux);
  color: var(--color-text-tertiary);
}
.ai-note {
  margin: 10px 0 0;
  font-size: 11px;
  line-height: 1.5;
  color: var(--color-text-tertiary);
}
/* 真实图片（/uploads 静态服务）+ 上传/删除操作 */
.ai-ph.has-img {
  justify-content: flex-start;
  background: #fff;
  border-style: solid;
  padding: 0;
  overflow: hidden;
}
.ai-ph-main.has-img { height: auto; }
.ai-ph-acc.has-img { height: auto; gap: 0; }
.ai-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 240px;
  object-fit: contain;
  border-radius: 7px;
}
.ai-ph-acc .ai-img { max-height: 88px; border-radius: 5px; }
.ai-ops {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 5px 1px 1px;
  width: 100%;
}
.ai-btn {
  font-size: 12px;
  line-height: 1.2;
  color: #2563eb;
  cursor: pointer;
}
.ai-btn-del {
  font-size: 12px;
  line-height: 1.2;
  background: none;
  border: none;
  padding: 0;
  color: #dc2626;
  cursor: pointer;
}
.action-link.is-disabled {
  color: var(--color-text-tertiary);
  cursor: default;
}

@media (max-width: 767px) {
  /* 新增配件入口在手机端收敛到每张卡片的「配件」操作 */
  #addAccBtn { display: none; }
  .ai-ph-main { height: 150px; }
  /* 申请人/借用人手机端纵向堆叠，保证借用人提示完整可见 */
  .form-row-applicant { grid-template-columns: 1fr; }
}

/* 借用记录空态（0 单时，PC 整行 / 手机卡片） */
.borrow-empty-cell { padding: 0 !important; }
.borrow-empty {
  border: 1px solid var(--color-border, #e5e9f0);
  border-radius: 10px;
  background: var(--color-surface, #fff);
}
.empty-state .empty-sub {
  margin: -4px 0 0;
  font-size: var(--fs-sm, 13px);
  color: var(--color-text-tertiary, #8a93a5);
}
