/* =========================================================================
 * 资产管理 - 仓库管理 / 直播间总览 / 库存看板 样式
 * ========================================================================= */

/* ---------- 仓库管理 ---------- */
.wh-header, .room-header, .inv-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.wh-header h2, .room-header h2, .inv-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.wh-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.wh-kpi {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}
.wh-kpi-label { font-size: 13px; color: var(--text-muted, #666); margin-bottom: 6px; }
.wh-kpi-value { font-size: 28px; font-weight: 700; }
.wh-kpi.kpi-stock .wh-kpi-value { color: #4f8cf7; }
.wh-kpi.kpi-use .wh-kpi-value { color: #52c41a; }
.wh-kpi.kpi-damage .wh-kpi-value { color: #f5222d; }

.wh-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.wh-filters input[type="text"] {
  flex: 1;
  min-width: 200px;
  padding: 8px 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  font-size: 14px;
}
.wh-filters select {
  padding: 8px 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  font-size: 14px;
  background: var(--card-bg, #fff);
  cursor: pointer;
}

.wh-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: var(--card-bg, #fff);
}
.wh-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.wh-table thead {
  background: var(--bg, #f5f7fa);
  position: sticky;
  top: 0;
}
.wh-table th {
  padding: 12px 10px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted, #666);
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.wh-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border-light, #f0f0f0);
}
.wh-table tbody tr:hover {
  background: var(--hover-bg, #fafafa);
}
.wh-table .code { font-family: monospace; font-size: 12px; color: var(--text-muted, #666); }
.wh-table .name { font-weight: 500; }
.wh-table .ops { white-space: nowrap; }

/* 照片列 */
.wh-photos { width: 90px; }
.wh-photos-box {
  position: relative; width: 56px; height: 44px; border-radius: 6px;
  overflow: hidden; cursor: pointer; border: 1px solid var(--border, #e5e7eb);
  background: #f5f7fa; transition: all .15s;
}
.wh-photos-box:hover { border-color: #4f8cf7; box-shadow: 0 0 0 3px rgba(79, 140, 247, .16); }
.wh-photos-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wh-photos-count {
  position: absolute; right: 2px; bottom: 2px; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 8px; background: rgba(0, 0, 0, .62); color: #fff;
  font-size: 10px; line-height: 16px; text-align: center;
}
.wh-photos-empty { color: #c9cdd4; }
.wh-photos-file {
  font-size: 11px; color: #b58a3a; background: #fff7e6; border: 1px solid #ffe3b0;
  border-radius: 4px; padding: 2px 5px; white-space: nowrap;
}

.tag-cat {
  display: inline-block;
  padding: 2px 8px;
  background: #f0f5ff;
  color: #4f8cf7;
  border-radius: 4px;
  font-size: 12px;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
}
.b-stock { background: #e6f4ff; color: #1677ff; }
.b-use { background: #f6ffed; color: #52c41a; }
.b-damage { background: #fff2f0; color: #f5222d; }
.b-unknown { background: #f5f5f5; color: #999; }

.btn-link {
  background: none;
  border: none;
  color: #4f8cf7;
  cursor: pointer;
  padding: 4px 8px;
  font-size: 13px;
}
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: #f5222d; }

.wh-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding: 12px 0;
}
.wh-info { font-size: 13px; color: var(--text-muted, #666); }

.wh-pages {
  display: flex;
  gap: 6px;
}
.pg-btn {
  padding: 6px 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 4px;
  background: var(--card-bg, #fff);
  cursor: pointer;
  font-size: 13px;
}
.pg-btn:hover:not(:disabled) { background: var(--hover-bg, #fafafa); }
.pg-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.pg-btn.active { background: #4f8cf7; color: #fff; border-color: #4f8cf7; }

/* ---------- 直播间总览 ---------- */
.room-stats {
  display: flex;
  gap: 24px;
}
.stat-item {
  text-align: center;
}
.stat-label { font-size: 13px; color: var(--text-muted, #666); }
.stat-value { font-size: 24px; font-weight: 700; color: #4f8cf7; }

.room-search-bar {
  margin-bottom: 20px;
}
.room-search-bar input {
  width: 100%;
  max-width: 400px;
  padding: 10px 14px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  font-size: 14px;
}

.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.room-card {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  padding: 16px;
  transition: box-shadow 0.2s;
}
.room-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.room-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.room-name {
  font-size: 16px;
  font-weight: 600;
}
.room-count {
  font-size: 13px;
  color: var(--text-muted, #666);
}
.room-card-stats {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}
.mini-stat {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
}
.mini-stat.use { background: #f6ffed; color: #52c41a; }
.mini-stat.damage { background: #fff2f0; color: #f5222d; }

.room-card-body {
  max-height: 280px;
  overflow-y: auto;
}
.device-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 6px;
  margin-bottom: 6px;
  background: var(--bg, #f9f9f9);
}
.device-item.in_use { border-left: 3px solid #52c41a; }
.device-item.in_stock { border-left: 3px solid #4f8cf7; }
.device-item.damaged { border-left: 3px solid #f5222d; }
.device-icon {
  font-size: 20px;
  width: 32px;
  text-align: center;
}
.device-info {
  flex: 1;
  min-width: 0;
}
.device-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.device-meta {
  font-size: 11px;
  color: var(--text-muted, #999);
}
.device-user {
  font-size: 11px;
  color: var(--text-muted, #666);
}
.device-status {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--card-bg, #fff);
}
.no-device {
  text-align: center;
  color: var(--text-muted, #999);
  padding: 20px;
  font-size: 13px;
}
.empty-hint {
  text-align: center;
  color: var(--text-muted, #999);
  padding: 40px;
  font-size: 14px;
  grid-column: 1 / -1;
}

/* ---------- 库存看板 ---------- */
.inv-summary {
  display: flex;
  gap: 20px;
  font-size: 14px;
  color: var(--text-muted, #666);
}
.inv-summary strong {
  color: var(--text, #333);
  font-size: 18px;
}

.inv-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.inv-kpi-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-radius: 10px;
  border: 1px solid var(--border, #e5e7eb);
  background: var(--card-bg, #fff);
}
.inv-kpi-icon {
  font-size: 32px;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}
.inv-kpi-card.stock .inv-kpi-icon { background: #e6f4ff; }
.inv-kpi-card.use .inv-kpi-icon { background: #f6ffed; }
.inv-kpi-card.damage .inv-kpi-icon { background: #fff2f0; }
.inv-kpi-card.unknown .inv-kpi-icon { background: #f5f5f5; }
.inv-kpi-body { flex: 1; }
.inv-kpi-value { font-size: 26px; font-weight: 700; }
.inv-kpi-card.stock .inv-kpi-value { color: #4f8cf7; }
.inv-kpi-card.use .inv-kpi-value { color: #52c41a; }
.inv-kpi-card.damage .inv-kpi-value { color: #f5222d; }
.inv-kpi-label { font-size: 13px; color: var(--text-muted, #666); }
.inv-kpi-pct { font-size: 12px; color: var(--text-muted, #999); }

.inv-charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}
.inv-chart-box {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  padding: 18px;
}
.inv-chart-box h3 {
  margin: 0 0 14px 0;
  font-size: 15px;
  font-weight: 600;
}
.inv-chart {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}
.inv-chart svg { flex-shrink: 0; }
.legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.legend-label { flex: 1; }
.legend-value { color: var(--text-muted, #666); font-variant-numeric: tabular-nums; }

.bar-label {
  font-size: 12px;
  fill: var(--text, #333);
}
.bar-value {
  font-size: 12px;
  fill: var(--text-muted, #666);
  font-variant-numeric: tabular-nums;
}

.inv-unused-section {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  padding: 18px;
}
.inv-unused-section h3 {
  margin: 0 0 14px 0;
  font-size: 15px;
  font-weight: 600;
}
.unused-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.unused-table thead {
  background: var(--bg, #f5f7fa);
}
.unused-table th {
  padding: 10px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted, #666);
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.unused-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border-light, #f0f0f0);
}
.unused-table tbody tr:hover {
  background: var(--hover-bg, #fafafa);
}
.more-hint {
  text-align: center;
  color: var(--text-muted, #999);
  font-size: 13px;
  margin-top: 12px;
}

/* ---------- 操作记录 ---------- */
.logs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}
.logs-header h2 { margin: 0; font-size: 20px; font-weight: 600; }
.logs-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.logs-summary {
  font-size: 13px;
  color: var(--text-muted, #666);
  margin-bottom: 16px;
}
.logs-list {
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: var(--card-bg, #fff);
  max-height: 70vh;
  overflow-y: auto;
}
.log-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light, #f0f0f0);
  font-size: 13px;
}
.log-item:last-child { border-bottom: none; }
.log-item:hover { background: var(--hover-bg, #fafafa); }
.log-time {
  font-family: monospace;
  font-size: 12px;
  color: var(--text-muted, #999);
  white-space: nowrap;
  min-width: 100px;
}
.log-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.log-mod { background: #f0f5ff; color: #4f8cf7; }
.log-module-asset .log-mod { background: #f6ffed; color: #52c41a; }
.log-module-system .log-mod { background: #f5f5f5; color: #999; }
.log-act { background: #fff7e6; color: #fa8c16; }
.log-action-add .log-act { background: #f6ffed; color: #52c41a; }
.log-action-update .log-act { background: #e6f4ff; color: #1677ff; }
.log-action-remove .log-act { background: #fff2f0; color: #f5222d; }
.log-action-import .log-act { background: #f0f5ff; color: #4f8cf7; }
.log-action-export .log-act { background: #f9f0ff; color: #722ed1; }
.log-detail { flex: 1; min-width: 0; color: var(--text, #333); }
.logs-empty {
  text-align: center;
  color: var(--text-muted, #999);
  padding: 60px 20px;
  font-size: 14px;
}
.logs-more {
  text-align: center;
  color: var(--text-muted, #999);
  padding: 12px;
  font-size: 13px;
  border-top: 1px solid var(--border-light, #f0f0f0);
}

/* Excel 导入按钮组 */
.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.btn-import {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px dashed var(--border, #e5e7eb);
  border-radius: 6px;
  background: var(--card-bg, #fff);
  color: var(--text, #333);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.btn-import:hover {
  border-color: #4f8cf7;
  color: #4f8cf7;
}
.btn-import::before {
  content: "📥";
  font-size: 14px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .wh-kpis, .inv-kpis {
    grid-template-columns: repeat(2, 1fr);
  }
  .room-grid {
    grid-template-columns: 1fr;
  }
  .inv-charts-row {
    grid-template-columns: 1fr;
  }
  .inv-chart {
    flex-direction: column;
  }
}
