/* ======== 全局重置 ======== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
  font-size: 14px;
  color: #333;
  background: #f0f2f5;
  display: flex;
}
a { color: #1a5ca8; text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, textarea, button { font-family: inherit; font-size: 13px; }

/* ======== 左侧边栏 ======== */
.sidebar {
  width: 220px;
  min-height: 100vh;
  background: #1e222d;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

/* 品牌区 */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  flex-shrink: 0;
}
.brand-icon {
  width: 34px; height: 34px;
  background: #2563a8;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px; font-weight: 900;
  flex-shrink: 0;
  letter-spacing: 0;
}
.brand-name {
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
}
.brand-sub {
  color: rgba(255,255,255,.5);
  font-size: 12px;
  margin-top: 2px;
}

/* 导航主体 */
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }

/* ---- 一级模块 ---- */
.nav-module { margin-bottom: 0; }
.nav-module-header {
  display: flex;
  align-items: center;
  padding: 0 20px;
  height: 50px;
  color: #c2c7cc;
  font-size: 14px;
  font-weight: 400;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
  cursor: pointer;
  user-select: none;
  background: #252a37;
  transition: color .15s, background .15s;
  letter-spacing: 0;
  text-transform: none;
}
.nav-module-header:hover { color: #fff; background: rgba(255,255,255,.04); }
.nav-module-header.active-group { color: #fff; }
.nav-icon { width: 18px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; opacity: .75; }
.nav-module-header .nav-icon { display: none; }
.nav-module-title { flex: 1; }
.nav-module-arrow {
  transition: transform .22s;
  display: flex;
  align-items: center;
  color: rgba(255,255,255,.3);
  margin-left: auto;
}
.nav-module.collapsed .nav-module-arrow { transform: rotate(-90deg); }
.nav-module-body { overflow: hidden; }
.nav-module.collapsed .nav-module-body { display: none; }

/* ---- 二级项 ---- */
.nav-l2 {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 20px 0 40px;
  height: 44px;
  color: #c2c7cc;
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
  font-weight: 400;
  border-left: none;
  transition: background .12s, color .12s;
  background: #161a24;
  text-decoration: none;
  line-height: 1;
}
.nav-l2:hover { background: rgba(255,255,255,.04); color: #fff; text-decoration: none; }
.nav-l2 .nav-icon { display: none; }
.nav-l2.active { background: #066cf1; color: #fff; font-weight: 400; border-left: none; }

/* 分类条目（各品类）：缩进与二级功能入口一致 */
.nav-l2.nav-cat { padding-left: 40px; background: #161a24; }
.nav-l2.nav-cat:hover { background: rgba(255,255,255,.04); color: #fff; }
.nav-l2.nav-cat.active { background: #066cf1; color: #fff; }

/* 管理入口（分类管理/用户管理） */
.nav-l2.nav-mgmt {
  border-top: 1px solid rgba(255,255,255,.07);
  color: rgba(194,199,204,.7);
  margin-top: 2px;
  padding-left: 40px;
}
.nav-l2.nav-mgmt:hover { color: #fff; background: rgba(255,255,255,.04); }
.nav-l2.nav-mgmt.active { background: #066cf1; color: #fff; }

/* 底部用户区 */
.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
  background: rgba(0,0,0,.15);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  min-width: 0;
  flex: 1;
}
.sidebar-user:hover { text-decoration: none; }
.sidebar-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(77,159,255,.25);
  border: 1px solid rgba(77,159,255,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #90bbf3;
}
.user-name { color: rgba(255,255,255,.85); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user:hover .user-name { color: #fff; }
.logout-btn {
  color: rgba(255,255,255,.35);
  white-space: nowrap;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 5px;
  border-radius: 4px;
  transition: color .15s, background .15s;
}
.logout-btn:hover { color: #fff; background: rgba(255,255,255,.08); text-decoration: none; }

/* ======== 主内容区 ======== */
.main-wrap {
  margin-left: 220px;
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.main-content {
  flex: 1;
  padding: 24px 28px;
  max-width: 1300px;
  width: 100%;
}

/* ======== 登录页 ======== */
.login-body {
  background: #0d1b2e;
  display: flex;
  align-items: stretch;
  min-height: 100vh;
  width: 100%;
  flex-direction: row;
  overflow: hidden;
}
.login-body .sidebar,
.login-body .main-wrap { display: none; }

/* 左侧品牌区 */
.login-left {
  flex: 1;
  background: #0d1b2e;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-width: 0;
  overflow: hidden;
}
/* 背景视频 */
.login-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}
/* 视频遮罩：加深让文字清晰 */
.login-left::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(5,15,30,.75) 0%, rgba(10,40,90,.5) 100%);
  z-index: 1;
}
.login-left-content {
  position: relative;
  z-index: 2;
  text-align: center;
  color: #fff;
  padding: 40px;
}
.login-left-logo {
  height: 72px;
  object-fit: contain;
  margin-bottom: 20px;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,.4));
}
.login-left-title {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: 6px;
  text-shadow: 0 2px 12px rgba(0,0,0,.4);
  margin-bottom: 8px;
}
.login-left-sub {
  font-size: 16px;
  color: rgba(255,255,255,.7);
  letter-spacing: 3px;
  margin-bottom: 32px;
}
.login-left-desc {
  font-size: 14px;
  color: rgba(255,255,255,.5);
  line-height: 2;
  border-top: 1px solid rgba(255,255,255,.15);
  padding-top: 24px;
  letter-spacing: 1px;
}

/* 右侧登录区 */
.login-right {
  width: 420px;
  flex-shrink: 0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: -8px 0 40px rgba(0,0,0,.2);
  position: relative;
}
.login-clock {
  position: absolute;
  top: 32px;
  left: 48px;
}
.login-box {
  width: 100%;
  padding: 60px 48px;
}
.login-box-header { margin-bottom: 32px; }
.login-clock { display:flex; align-items:baseline; gap:10px; }
.clock-day { font-size:13px; color:#888; font-weight:500; }
.clock-time { font-size:32px; font-weight:700; color:#15253d; letter-spacing:2px; font-variant-numeric:tabular-nums; }
.login-box-title { font-size: 26px; font-weight: 800; color: #15253d; margin-bottom: 6px; }
.login-box-sub { font-size: 13px; color: #999; }
.login-box .form-group { margin-bottom: 20px; }
.login-box .form-label { display:block; font-size:13px; font-weight:600; color:#555; margin-bottom:6px; }
.login-box .form-control {
  width: 100%;
  border: 1.5px solid #e0e4ed;
  border-radius: 6px;
  padding: 11px 14px;
  font-size: 14px;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
  background: #f8fafc;
}
.login-box .form-control:focus {
  border-color: #1a5ca8;
  box-shadow: 0 0 0 3px rgba(26,92,168,.1);
  background: #fff;
}
.login-submit {
  margin-top: 8px;
  padding: 13px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 4px;
  border-radius: 6px;
  background: linear-gradient(135deg, #1a5ca8, #2d7dd2);
  box-shadow: 0 4px 16px rgba(26,92,168,.35);
  transition: box-shadow .2s, transform .1s;
}
.login-submit:hover { box-shadow: 0 6px 20px rgba(26,92,168,.5); transform: translateY(-1px); opacity:1; }
.login-box-footer { text-align:center; color:#ccc; font-size:12px; margin-top:32px; }

/* ======== 页面标题 ======== */
.page-title { font-size: 18px; color: #1a2f4e; font-weight: 700; margin-bottom: 16px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-header .page-title { margin-bottom: 0; }

/* ======== 卡片 ======== */
.card { background: #fff; border-radius: 6px; padding: 20px; margin-bottom: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.card-title { font-size: 15px; font-weight: 700; color: #1a2f4e; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid #e8ecf2; }

/* ======== 统计卡 ======== */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 14px; margin-bottom: 16px; }
.stat-card { background: #fff; border-radius: 6px; padding: 22px 20px; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.stat-num { font-size: 38px; font-weight: 700; color: #1a2f4e; }
.stat-label { font-size: 13px; color: #888; margin-top: 6px; }
.alert-card .stat-num { color: #d93025; }

/* ======== 分类概况 ======== */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 10px; }
.cat-card { background: #f5f8ff; border: 1px solid #d0dcf0; border-radius: 6px; padding: 14px; text-align: center; }
.cat-name { font-weight: 700; color: #1a2f4e; font-size: 14px; }
.cat-count { color: #666; font-size: 12px; margin-top: 4px; }
.cat-alert { color: #d93025; font-size: 12px; margin-top: 4px; font-weight: 700; }

/* ======== 报表网格 ======== */
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px,1fr)); gap: 16px; }

/* ======== 表格 ======== */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { background: #1a2f4e; color: #fff; padding: 9px 12px; text-align: left; white-space: nowrap; font-weight: 600; }
.table td { padding: 8px 12px; border-bottom: 1px solid #eef0f4; vertical-align: middle; }
.table tr:hover td { background: #f5f8ff; }
.alert-row td { background: #fff5f5 !important; }
.alert-row:hover td { background: #ffe8e8 !important; }
.empty { text-align: center; color: #aaa; padding: 40px !important; }

/* ======== 筛选条 ======== */
.filter-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; background: #fff; padding: 12px 16px; border-radius: 6px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.filter-bar input[type=text],
.filter-bar input[type=date],
.filter-bar select { border: 1px solid #d0d7e3; border-radius: 4px; padding: 6px 10px; height: 34px; min-width: 100px; }

/* ======== 按钮 ======== */
.btn { display: inline-block; padding: 7px 16px; border-radius: 4px; font-size: 13px; border: none; cursor: pointer; line-height: 1.4; white-space: nowrap; text-align: center; transition: opacity .15s; }
.btn:hover { opacity: .85; text-decoration: none; }
.btn-primary { background: #1a5ca8; color: #fff; }
.btn-danger   { background: #d93025; color: #fff; }
.btn-success  { background: #1a9c3e; color: #fff; }
.btn-outline { background: #fff; color: #1a5ca8; border: 1px solid #1a5ca8; }
.btn-block   { display: block; width: 100%; }

/* ======== 表单 ======== */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; color: #555; font-size: 13px; margin-bottom: 5px; font-weight: 600; }
.form-group input[type=text],
.form-group input[type=number],
.form-group input[type=password],
.form-group input[type=date],
.form-group select,
.form-group textarea { width: 100%; border: 1px solid #d0d7e3; border-radius: 4px; padding: 8px 10px; font-size: 13px; line-height: 1.5; transition: border-color .2s; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: #1a5ca8; outline: none; }
.form-group textarea { resize: vertical; min-height: 60px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; }
.req { color: #d93025; }
.hint { font-size: 12px; color: #1a5ca8; margin: -8px 0 10px; padding: 6px 10px; background: #e8f0ff; border-radius: 4px; display: inline-block; }

/* ======== 徽标 ======== */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; line-height: 1.6; }
.badge-green { background: #e6f4ea; color: #1e7e34; }
.badge-red   { background: #fce8e6; color: #c0392b; }
.badge-blue  { background: #e8f0fe; color: #1a56a8; }
.badge-gray  { background: #f0f0f0; color: #666; }

/* ======== 文字颜色 ======== */
.text-red { color: #d93025; }

/* ======== 提示框 ======== */
.alert { padding: 10px 16px; border-radius: 4px; margin-bottom: 14px; font-size: 13px; }
.alert-success { background: #e6f4ea; color: #1e7e34; border-left: 4px solid #34a853; }
.alert-error,
.alert-danger  { background: #fce8e6; color: #c0392b; border-left: 4px solid #d93025; }


/* ======== 操作按钮（材质书/列表行内操作）======== */
.op-btn { display:inline-block; padding:3px 10px; border-radius:4px; font-size:12px; line-height:1.6; white-space:nowrap; transition:opacity .15s; text-decoration:none; font-weight:500; }
.op-btn:hover { opacity:.8; text-decoration:none; }
.op-detail { background:#e8f0fe; color:#1a5ca8; }
.op-edit   { background:#fff7e0; color:#b07c00; }
.op-in     { background:#e6f7ee; color:#1a9c3e; }
.op-out    { background:#fff2e8; color:#c05a00; }
.op-del    { background:#fce8e6; color:#d93025; }

/* 移动端全屏背景视频（桌面端隐藏） */
.login-video-mobile,
.login-video-mobile-overlay { display: none; }

/* 移动端专属登录页（桌面隐藏） */
.login-mobile { display: none; }

/* ======== 移动端自适应 ======== */

/* 顶部导航栏（仅移动端显示） */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
  background: #1e222d;
  z-index: 200;
  align-items: center;
  padding: 0 14px;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.mobile-menu-btn {
  background: none;
  border: none;
  color: #c2c7cc;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  border-radius: 4px;
  transition: background .15s;
}
.mobile-menu-btn:hover { background: rgba(255,255,255,.08); }
.mobile-title {
  flex: 1;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
}
.mobile-logout {
  color: rgba(255,255,255,.5);
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 4px;
  transition: color .15s;
}
.mobile-logout:hover { color: #fff; text-decoration: none; }

/* 遮罩层 */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 149;
}
.sidebar-overlay.active { display: block; }

/* 移动端按钮补充 */
.btn-secondary {
  background: #3a3f4e;
  color: #c2c7cc;
  border: 1px solid rgba(255,255,255,.1);
}
.btn-secondary:hover { background: #444; color: #fff; }

/* ---- 移动端断点 ---- */
@media (max-width: 768px) {
  /* 显示顶部栏 */
  .mobile-topbar { display: flex; }

  /* 侧边栏默认隐藏，滑入式 */
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 150;
  }
  .sidebar.sidebar-open {
    transform: translateX(0);
  }

  /* 主内容区不再偏移 */
  .main-wrap {
    margin-left: 0;
    padding-top: 52px;
  }

  /* 内容区内边距缩小 */
  .main-content {
    padding: 16px 12px;
  }

  /* 页面标题行 */
  .page-header {
    flex-wrap: wrap;
    gap: 10px;
  }
  .page-header h2 {
    font-size: 16px;
  }

  /* 卡片内边距 */
  .card {
    padding: 14px 12px;
  }

  /* 表格横向滚动 */
  .table-wrap, .card > div[style*="overflow"] {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* 表单grid变单列 */
  .form-row { grid-template-columns: 1fr; }

  /* 统计卡 */
  .stat-cards { grid-template-columns: repeat(2, 1fr); }

  /* 分类grid */
  .cat-grid { grid-template-columns: repeat(2, 1fr); }

  /* 报表grid */
  .report-grid { grid-template-columns: 1fr; }

  /* 筛选栏 */
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar input, .filter-bar select { width: 100%; }

  /* 按钮组 */
  .form-actions { flex-wrap: wrap; }

  /* 登录页移动端：隐藏桌面版，显示移动版 */
  .login-left  { display: none; }
  .login-right { display: none; }

  /* 移动端全屏背景视频（隐藏） */
  .login-video-mobile { display: none !important; }
  .login-video-mobile-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #0a1628 0%, #0d2b5e 50%, #1a4a8a 100%);
    z-index: 1;
  }

  /* 移动端登录页主体 */
  .login-mobile {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0;
    z-index: 2;
  }
  /* 左上角品牌 */
  .login-mobile-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 0;
  }
  /* 居中区域 */
  .login-mobile-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
  }
  /* 登录卡片 */
  .login-mobile-box {
    width: 100%;
    max-width: 360px;
    background: rgba(10,22,40,.95);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 16px;
    padding: 32px 24px;
  }
  .login-mobile-input {
    background: #1a2a45 !important;
    border: 1px solid rgba(255,255,255,.15) !important;
    border-radius: 6px !important;
    color: #fff !important;
    font-size: 16px !important;
  }
  .login-mobile-input::placeholder { color: rgba(255,255,255,.35) !important; }
  .login-mobile-input:focus {
    border-color: #066cf1 !important;
    background: #1e3255 !important;
    box-shadow: none !important;
  }
}

@media (max-width: 480px) {
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .main-content { padding: 12px 10px; }
  .card { padding: 12px 10px; }
}
