/* ======== 全局 ======== */
:root {
  --sidebar-w: 220px;
  --topbar-h: 56px;
  --bg: #f4f6fb;
  --card-radius: 12px;
  --primary: #4361ee;
  --success: #2ec4b6;
  --warning: #f4a261;
  --danger: #e63946;
}
* { box-sizing: border-box; }
body { background: var(--bg); font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif; margin: 0; color: #333; }

/* ======== 侧边栏 ======== */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: linear-gradient(160deg, #1e2a4a 0%, #2d3e6e 100%);
  color: #fff;
  display: flex; flex-direction: column;
  z-index: 1000;
  transition: transform .3s ease;
}
.sidebar.collapsed { transform: translateX(calc(-1 * var(--sidebar-w))); }
.sidebar-brand {
  padding: 20px 20px 16px;
  font-size: 1.15rem; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-brand i { font-size: 1.5rem; color: #7eb8f7; }
.sidebar-nav { list-style: none; padding: 12px 0; margin: 0; flex: 1; }
.sidebar-nav .nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 22px; cursor: pointer;
  transition: background .2s, padding-left .2s;
  font-size: .94rem; border-left: 3px solid transparent;
}
.sidebar-nav .nav-item:hover { background: rgba(255,255,255,.1); padding-left: 26px; }
.sidebar-nav .nav-item.active {
  background: rgba(255,255,255,.15);
  border-left-color: #7eb8f7; color: #7eb8f7;
}
.sidebar-nav .nav-item i { font-size: 1.1rem; width: 20px; }
/* 日志分组标题 */
.sidebar-nav .nav-group-header {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 22px 4px;
  font-size: .78rem; font-weight: 600; letter-spacing: .08em;
  color: rgba(255,255,255,.45); text-transform: uppercase;
  pointer-events: none; border-left: 3px solid transparent;
}
.sidebar-nav .nav-group-header i { font-size: .9rem; width: 20px; opacity: .6; }
/* 子菜单缩进 */
.sidebar-nav .nav-sub-item {
  padding-left: 38px;
  font-size: .88rem;
}
.sidebar-nav .nav-sub-item:hover { padding-left: 42px; }
/* 工作日志卡片悬浮效果 */
.worklog-card { transition: box-shadow .2s, transform .15s; }
.worklog-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.12); transform: translateY(-2px); }
.sidebar-footer { padding: 14px 20px; font-size: .78rem; color: rgba(255,255,255,.4); border-top: 1px solid rgba(255,255,255,.1); }

/* ======== 主内容 ======== */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  padding-top: var(--topbar-h);
  transition: margin-left .3s ease;
}
.main-content.full { margin-left: 0; }

/* ======== 顶部栏 ======== */
.topbar {
  position: fixed;
  top: 0; left: var(--sidebar-w); right: 0;
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid #e8ecf0;
  display: flex; align-items: center;
  padding: 0 24px;
  z-index: 999;
  transition: left .3s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.topbar.full { left: 0; }
.topbar-title { font-size: 1.05rem; font-weight: 600; color: #1e2a4a; }

/* ======== 页面切换 ======== */
.page { display: none; padding: 24px; }
.page.active { display: block; }

/* ======== 统计卡片 ======== */
.stat-card {
  border-radius: var(--card-radius);
  padding: 20px;
  display: flex; align-items: center; gap: 16px;
  color: #fff;
  box-shadow: 0 4px 15px rgba(0,0,0,.1);
}
.stat-card.total    { background: linear-gradient(135deg, #4361ee, #7b9cf7); }
.stat-card.instock  { background: linear-gradient(135deg, #2ec4b6, #4de0d5); }
.stat-card.borrowed { background: linear-gradient(135deg, #f4a261, #f7c28c); }
.stat-card.repair   { background: linear-gradient(135deg, #e63946, #f26b75); }
.stat-icon { font-size: 2.2rem; opacity: .85; }
.stat-num { font-size: 2rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: .85rem; opacity: .9; margin-top: 4px; }

/* ======== 卡片 ======== */
.card {
  border: none !important;
  border-radius: var(--card-radius) !important;
  box-shadow: 0 2px 12px rgba(0,0,0,.06) !important;
}
.card-header {
  background: #fff !important;
  border-bottom: 1px solid #f0f0f0 !important;
  padding: 14px 20px !important;
  border-radius: var(--card-radius) var(--card-radius) 0 0 !important;
}

/* ======== 表格（统一所有页面） ======== */
.table { font-size: .92rem; }
.table thead th {
  font-weight: 600;
  white-space: nowrap;
  background: #f8f9fd;
  border-bottom: 2px solid #dee2e6;
  padding: .72rem .6rem;
  vertical-align: middle;
}
.table tbody td {
  vertical-align: middle;
  padding: .65rem .6rem;
  border-color: #f0f0f0;
}
.table-hover tbody tr:hover { background: #f0f5ff; cursor: pointer; }
.table-striped > tbody > tr:nth-of-type(odd) > * { background-color: #fafbfd; }

/* ======== 状态徽章 ======== */
.badge-status { padding: 4px 10px; border-radius: 20px; font-size: .78rem; font-weight: 600; }
.badge-在库  { background: #e8f8f5; color: #2ec4b6; }
.badge-借出  { background: #fff4e6; color: #f4a261; }
.badge-维修  { background: #ffeef0; color: #e63946; }
.badge-报废  { background: #f0f0f0; color: #888; }

/* ======== 领用回库子标签页 ======== */
.borrow-sub-tab {
  flex: 1;
  text-align: center;
  padding: 10px 16px;
  border-radius: 10px;
  background: #fff;
  border: 2px solid #e9ecef;
  font-size: 14px;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  transition: all .2s;
  user-select: none;
}
.borrow-sub-tab:hover { border-color: var(--primary); color: var(--primary); }
.borrow-sub-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.shots-bar .progress { height: 6px; border-radius: 3px; }

/* ======== 分页 ======== */
.pagination .page-link { border-radius: 6px !important; margin: 0 2px; border: 1px solid #dee2e6; }
.pagination .page-item.active .page-link { background: var(--primary); border-color: var(--primary); }

/* ======== 模具编号加粗加大 ======== */
.mold-no {
  font-size: 1.05rem !important;
  font-weight: 700 !important;
  color: var(--primary) !important;
  background: transparent !important;
  padding: 0 !important;
  white-space: nowrap !important;
}

/* ======== 模态框 ======== */
.modal-content { border: none !important; border-radius: 14px !important; box-shadow: 0 20px 60px rgba(0,0,0,.2) !important; }
.modal-header { border-bottom: 1px solid #f0f0f0 !important; }
.modal-footer { border-top: 1px solid #f0f0f0 !important; }

/* ======== 详情面板 ======== */
.detail-field label { font-size: .78rem; color: #999; margin-bottom: 2px; }
.detail-field p { margin: 0; font-weight: 500; }
.detail-section-title { font-weight: 700; color: #1e2a4a; border-left: 4px solid var(--primary); padding-left: 10px; margin-bottom: 14px; }

/* ======== 侧边栏遮罩层（移动端） ======== */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.45);
  z-index: 999;
}
.sidebar-overlay.show { display: block; }

/* ======== 响应式 ======== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .topbar { left: 0; }
  .page { padding: 14px; }
}

/* ======== 登录页 ======== */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e2a4a 0%, #2d3e6e 40%, #4361ee 100%);
  padding: 20px;
}
.login-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  width: 100%;
  max-width: 400px;
  overflow: hidden;
}
.login-header {
  background: linear-gradient(135deg, #1e2a4a, #2d3e6e);
  color: #fff;
  padding: 30px 24px 24px;
  text-align: center;
}
.login-header i {
  font-size: 2.5rem;
  color: #7eb8f7;
  margin-bottom: 8px;
}
.login-header h4 {
  margin: 0 0 4px;
  font-weight: 700;
}
.login-body {
  padding: 28px 24px;
}
.login-hint {
  text-align: center;
}

/* ======== 用户管理 ======== */
.role-badge-admin {
  background: #fff3cd;
  color: #856404;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: .78rem;
  font-weight: 600;
}
.role-badge-operator {
  background: #d4edda;
  color: #155724;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: .78rem;
  font-weight: 600;
}
.role-badge-user {
  background: #d1ecf1;
  color: #0c5460;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: .78rem;
  font-weight: 600;
}
.status-active { color: #2ec4b6; font-weight: 600; }
.status-disabled { color: #e63946; font-weight: 600; }

/* ======== 系统设置预览 ======== */
.preview-box {
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
  transition: all .2s;
}
