/* ===== 车辆相册管理系统 - 响应式样式（手机优先） ===== */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --green: #16a34a;
  --red: #dc2626;
  --orange: #d97706;
  --gray: #64748b;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

.container { max-width: 1100px; margin: 0 auto; padding: 14px 14px 60px; }

/* ===== 顶栏 ===== */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 9px 14px;
}
.brand { font-weight: 700; font-size: 18px; color: var(--primary); text-decoration: none; }
.topbar-left { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nav-quick {
  padding: 5px 10px; border-radius: 8px;
  text-decoration: none; color: var(--muted); font-size: 13px;
  background: #f3f4f6; white-space: nowrap;
}
.nav-quick:hover { background: #eff6ff; color: var(--primary); }
.topnav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
/* 导航按钮：统一为「上传车辆」按钮样式（蓝底圆角），整体小一号 */
.topnav a {
  display: inline-block; padding: 5px 13px; border-radius: 8px;
  text-decoration: none; color: #0369a1; font-size: 14px; font-weight: 600;
  background: #dbeafe; white-space: nowrap;
}
.topnav a:hover { background: #93c5fd; color: #1d4ed8; }
.topnav a.active { background: #2563eb; color: #fff !important; }
/* ===== 导航“上传车辆”按钮（基准，略大） ===== */
.topnav a.nav-upload {
  font-weight: 700; font-size: 16px; padding: 7px 16px;
  background: #2563eb; color: #fff !important; border-radius: 8px;
}
.topnav a.nav-upload:hover { background: #1d4ed8; color: #fff !important; }
.topuser { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.topuser a { color: var(--primary); text-decoration: none; }
.role-tag {
  font-size: 12px; padding: 2px 9px; border-radius: 999px;
  background: #dbeafe; color: #1d4ed8; white-space: nowrap;
}
.msg-dot {
  display: inline-block; background: var(--red); color: #fff;
  border-radius: 999px; font-size: 11px; padding: 0 6px; margin-left: 4px;
  min-width: 18px; text-align: center;
}
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 16px 0 4px; }

/* ===== 卡片 ===== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.card-title { margin: 0 0 12px; font-size: 17px; }

/* ===== 按钮 ===== */
.btn {
  display: inline-block; padding: 9px 16px; border-radius: 8px;
  border: none; cursor: pointer; font-size: 14px; text-decoration: none;
  text-align: center; line-height: 1.4; transition: opacity .15s;
}
.btn:active { opacity: .8; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--green); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-outline { background: #fff; border: 1px solid var(--border); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { display: block; width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ===== 表单 ===== */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 15px; background: #fff; color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
/* ===== 审核按钮式单选（隐藏原生圆点） ===== */
.radio {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  margin: 6px 8px 6px 0; padding: 10px 16px;
  border: 1.5px solid var(--border); border-radius: 8px;
  background: #fff; font-size: 14px; cursor: pointer; user-select: none;
  transition: all .15s;
}
.radio input { position: absolute; opacity: 0; width: 0; height: 0; }
.radio:hover {
  background: #eff6ff; border-color: var(--primary);
  color: var(--primary-dark);
}
.radio:has(input:checked), .radio.selected {
  background: var(--primary); border-color: var(--primary);
  color: #fff; font-weight: 600;
}
.radio:has(input:checked):hover, .radio.selected:hover {
  background: var(--primary-dark); border-color: var(--primary-dark);
}

/* ===== 提示 ===== */
.flash { border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-size: 14px; }
.flash-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.flash-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.flash-warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; min-width: 620px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; font-size: 14px; vertical-align: top; }
th { background: #f8fafc; color: var(--muted); font-weight: 600; white-space: nowrap; }
tr:hover td { background: #f8fafc; }
/* 工作量统计表：列宽按表内文字实际宽度自适应（不强制最小宽度） */
.workload-table { min-width: 0; table-layout: auto; }
.workload-table th, .workload-table td { white-space: nowrap; }

/* ===== 徽章 ===== */
.badge { border-radius: 999px; font-size: 12px; padding: 3px 10px; color: #fff; white-space: nowrap; }
.badge-gray { background: var(--gray); }
.badge-orange { background: var(--orange); }
.badge-red { background: var(--red); }
.badge-blue { background: var(--primary); }
.badge-green { background: var(--green); }

/* ===== 统计 ===== */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(108px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 12px 8px; text-align: center; }
.stat b { display: block; font-size: 22px; }
.stat span { color: var(--muted); font-size: 12px; }
a.stat { display: block; text-decoration: none; color: inherit; }
a.stat:hover { border-color: var(--primary); background: #f0f7ff; }
a.stat:hover b { color: var(--primary); }
a.stat { display: block; text-decoration: none; color: inherit; }
a.stat:hover { border-color: var(--primary); background: #f0f7ff; }
a.stat:hover b { color: var(--primary); }

/* ===== 筛选 ===== */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.filters input, .filters select { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; background: #fff; }

/* ===== 分页 ===== */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border); text-decoration: none; color: var(--text); background: #fff; font-size: 14px; }
.pagination .cur { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== 相册卡片 ===== */
.album-list { display: flex; flex-direction: column; gap: 10px; }
.album-card {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: #fff;
}
.album-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.album-plate { font-size: 19px; font-weight: 700; }
a.album-plate { color: inherit; text-decoration: none; }
a.album-plate:hover { color: var(--primary); }
.plate-link { color: var(--primary-dark); text-decoration: none; }
.plate-link:hover { text-decoration: underline; }
.num-link { display: inline-block; min-width: 46px; padding: 6px 8px; margin: 2px; text-align: center; background: #fff; border: 1px solid var(--border); border-radius: 8px; color: var(--primary); font-weight: 700; text-decoration: none; }
.num-link:hover { background: #eff6ff; border-color: var(--primary); }
.col-un { background: #fff6e9; }
.album-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.album-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== 照片墙 ===== */
.grid-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.photo-item { position: relative; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; }
.photo-item img { width: 100%; height: 150px; object-fit: cover; display: block; cursor: zoom-in; }
.photo-meta { font-size: 12px; color: var(--muted); padding: 6px 8px; display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; }
.photo-meta form { display: inline; }

/* ===== 选项卡 ===== */
.tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; border-radius: 8px; text-decoration: none; color: var(--muted); border: 1px solid var(--border); background: #fff; font-size: 14px; }
.tabs a.active { color: var(--primary); border-color: var(--primary); background: #eff6ff; }
.tabs-pane { display: none; }
.tabs-pane.active { display: block; }

/* ===== 上传区 ===== */
.upload-zone { border: 2px dashed #cbd5e1; border-radius: 12px; padding: 18px 14px; text-align: center; background: #f8fafc; }
.upload-zone p { margin: 0 0 10px; color: var(--muted); font-size: 13px; }

/* ===== 已选图片列表（分次凑满 8 张，手机友好） ===== */
.up-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.up-thumb { position: relative; width: 64px; height: 64px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: #fff; }
.up-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.up-rm {
  position: absolute; top: 2px; right: 2px; width: 20px; height: 20px;
  line-height: 18px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(0,0,0,.65); color: #fff; font-size: 14px; cursor: pointer;
}
.up-rm:hover { background: #dc2626; }

/* ===== 灯箱 ===== */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.86); display: none; align-items: center; justify-content: center; z-index: 999; overflow: hidden; }
.lightbox img { max-width: 94vw; max-height: 92vh; border-radius: 8px; transition: transform .12s ease, opacity .15s; transform-origin: center center; cursor: zoom-in; touch-action: none; }
.lightbox img.lb-dragging { cursor: grabbing; transition: none !important; }
.lightbox img.lb-loading { opacity: .25; }
.lb-spinner { position: absolute; left: 50%; top: 50%; width: 36px; height: 36px; margin: -22px 0 0 -22px; border: 4px solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%; display: none; animation: lbspin .8s linear infinite; }
.lightbox img.lb-loading + .lb-spinner { display: block; }
@keyframes lbspin { to { transform: rotate(360deg); } }
.lb-nav {
  position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%);
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px;
  max-width: 96vw;
  background: rgba(15,23,42,.82); border-radius: 999px; padding: 6px 12px;
  color: #fff; font-size: 14px; z-index: 2; white-space: nowrap;
}
.lb-nav button {
  background: rgba(255,255,255,.16); color: #fff; border: none;
  border-radius: 999px; padding: 10px 14px; font-size: 14px; cursor: pointer;
  min-height: 44px; line-height: 1.2; transition: background .12s;
}
.lb-nav button:hover { background: rgba(255,255,255,.30); }
.lb-nav button:active { background: rgba(255,255,255,.40); }
.lb-count { min-width: 62px; text-align: center; font-variant-numeric: tabular-nums; }

/* ===== 消息 ===== */
.msg-list { display: flex; flex-direction: column; gap: 10px; }
.msg-item { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: #fff; }
.msg-content { font-size: 14px; }
.msg-time { color: var(--muted); font-size: 12px; }
.msg-from { color: var(--muted); font-size: 12px; margin-top: 2px; }
/* ===== 消息中心：跳转相册链接 ===== */
.msg-link { margin-top: 6px; }
.msg-link a { color: var(--primary); font-weight: 600; text-decoration: none; }
.msg-link a:hover { text-decoration: underline; }

/* ===== 登录页 ===== */
.login-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; gap: 18px; }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 16px; border: 1px solid var(--border); padding: 28px 24px; box-shadow: 0 8px 24px rgba(0,0,0,.06); }
.login-card h1 { font-size: 21px; text-align: center; margin: 0 0 4px; }
.sub { color: var(--muted); text-align: center; font-size: 13px; margin: 0 0 20px; }

/* ===== 登录页双窗口（登录在上 + 查重在下，强制上下排列，查重卡加底色区分） ===== */
.plate-check-card {
  width: 100%; max-width: 380px; background: #f0fdf4;
  border: 2px solid #bbf7d0; border-radius: 16px; padding: 24px 20px;
  box-shadow: 0 8px 24px rgba(0,0,0,.05);
}
.plate-check-card h2 { margin: 0 0 4px; font-size: 20px; color: #166534; text-align: center; }
.plate-check-card .sub { color: #3f6212; }
.plate-check-card .field label { color: #3f6212; }
.plate-check-card .flash { margin-top: 10px; }

code { background: #f1f5f9; padding: 1px 6px; border-radius: 4px; font-size: 13px; }

/* ===== 手机优化 ===== */
@media (max-width: 640px) {
  body { font-size: 15px; }
  .container { padding: 10px 10px 70px; }
  .login-wrap { flex-direction: column; gap: 16px; }
  .topbar-inner { padding: 8px 10px; gap: 6px 10px; flex-wrap: wrap; }
  .topnav { flex-basis: 100%; width: 100%; }
  .topnav a { padding: 7px 8px; font-size: 13px; }
  .topuser .uname { display: none; }
  .brand { font-size: 16px; }
  .nav-quick { padding: 5px 8px; font-size: 12px; }
  .nav-quick { padding: 5px 8px; font-size: 12px; }
  .grid-photos { grid-template-columns: repeat(auto-fill, minmax(106px, 1fr)); gap: 8px; }
  .photo-item img { height: 106px; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
  .album-card { flex-direction: column; align-items: stretch; }
  .album-actions { justify-content: flex-end; }
  .btn { padding: 10px 14px; }
  .field input, .field select, .field textarea { padding: 12px; font-size: 16px; }
  .login-card { padding: 24px 18px; }
  .topnav a.nav-upload { font-size: 14px; padding: 7px 12px; }
  /* 手机端全部相册表格：隐藏次要列，车牌列加宽 */
  .albums-table th:nth-child(2), .albums-table td:nth-child(2),
  .albums-table th:nth-child(3), .albums-table td:nth-child(3),
  .albums-table th:nth-child(5), .albums-table td:nth-child(5),
  .albums-table th:nth-child(6), .albums-table td:nth-child(6) { display: none; }
  .albums-table th:first-child, .albums-table td:first-child { width: 42%; min-width: 0; }
  .albums-table td:first-child .plate-link { font-size: 17px; display: inline-block; max-width: 100%; word-break: break-all; }
  /* 工作量统计表：手机端恢复全部列显示（!important 覆盖上方隐藏规则），列宽按内容实际宽度自适应 */
  .workload-table th, .workload-table td { display: table-cell !important; }
  .workload-table th:first-child, .workload-table td:first-child { width: auto; min-width: 0; }
  .workload-table td:first-child .plate-link { font-size: 15px; }
}
