/* ==========================================================================
   驾驶员上传系统 —— 共享样式
   设计令牌 + 基础组件 + 页面模块
   ========================================================================== */

:root {
  /* 主色与语义色 */
  --c-primary: #2563eb;
  --c-primary-dark: #1d4ed8;
  --c-primary-light: #eff6ff;
  --c-success: #16a34a;
  --c-success-light: #f0fdf4;
  --c-warn: #d97706;
  --c-warn-light: #fffbeb;
  --c-danger: #dc2626;
  --c-danger-light: #fef2f2;

  /* 中性色 */
  --c-bg: #f4f6fa;
  --c-surface: #ffffff;
  --c-surface-2: #f9fafb;
  --c-border: #e3e7ee;
  --c-border-strong: #cbd5e1;
  --c-text: #101828;
  --c-text-2: #475467;
  --c-text-3: #98a2b3;

  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow: 0 4px 12px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.12);

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;

  --header-h: 60px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--c-primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   顶栏
   -------------------------------------------------------------------------- */
.topbar {
  height: var(--header-h);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  color: var(--c-text);
  white-space: nowrap;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--c-primary), #7c3aed);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 15px;
  flex: 0 0 auto;
}

.topnav {
  display: flex;
  gap: 4px;
  margin-left: 8px;
}

.topnav a {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--c-text-2);
  font-weight: 500;
  white-space: nowrap;
}
/* 窄屏改用短标签，见文件末尾的响应式区块 */
.topnav .nav-short {
  display: none;
}
.topnav a:hover {
  background: var(--c-surface-2);
  text-decoration: none;
}
.topnav a.active {
  background: var(--c-primary-light);
  color: var(--c-primary);
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 6px;
  border: 1px solid var(--c-border);
  border-radius: 999px;
  background: var(--c-surface);
}

.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--c-primary-light);
  color: var(--c-primary);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
  flex: 0 0 auto;
}

.user-chip .u-name {
  font-weight: 600;
}
.user-chip .u-role {
  font-size: 12px;
  color: var(--c-text-3);
}

/* --------------------------------------------------------------------------
   布局
   -------------------------------------------------------------------------- */
.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}
.page.wide {
  max-width: 1600px;
}

.page-head {
  margin-bottom: 20px;
}
.page-head h1 {
  margin: 0 0 4px;
  font-size: 22px;
  letter-spacing: -0.01em;
}
.page-head p {
  margin: 0;
  color: var(--c-text-2);
}

.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
  overflow: hidden;
}

.card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--c-surface);
}

.card-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
}

.card-head .sub {
  font-size: 12px;
  color: var(--c-text-3);
  font-weight: 400;
}

.card-head .right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 18px;
}

/* --------------------------------------------------------------------------
   表单控件
   -------------------------------------------------------------------------- */
.field {
  margin-bottom: 16px;
}

.field > label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text-2);
  margin-bottom: 6px;
}

.field .hint {
  font-size: 12px;
  color: var(--c-text-3);
  margin-top: 5px;
}

input[type='text'],
input[type='password'],
input[type='tel'],
input[type='search'],
input[type='number'],
input[type='date'],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--c-text);
  background: var(--c-surface);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

input:disabled,
input[readonly],
select:disabled,
textarea[readonly] {
  background: var(--c-surface-2);
  color: var(--c-text-2);
  cursor: default;
}

textarea {
  resize: vertical;
  min-height: 72px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 600;
  color: var(--c-text);
  background: var(--c-surface);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  background: var(--c-surface-2);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--c-primary);
  border-color: var(--c-primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--c-primary-dark);
  border-color: var(--c-primary-dark);
}

.btn-danger {
  background: var(--c-danger);
  border-color: var(--c-danger);
  color: #fff;
}
.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--c-text-2);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--c-surface-2);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
  padding: 11px 16px;
  font-size: 15px;
}

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   提交区（照片 / 备注之后，车辆选择之前）
   -------------------------------------------------------------------------- */
.submit-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.submit-summary {
  font-size: 13px;
  color: var(--c-text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.submit-summary b {
  color: var(--c-text);
  font-weight: 600;
}
/* 未选车辆时把「未选择」标出来，免得以为可以直接提交 */
.submit-summary.is-empty b {
  color: var(--c-warn);
}
.submit-bar .btn-block {
  max-width: 320px;
}

/* --------------------------------------------------------------------------
   标签 / 徽章
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-blue {
  background: var(--c-primary-light);
  color: var(--c-primary);
}
.badge-green {
  background: var(--c-success-light);
  color: var(--c-success);
}
.badge-amber {
  background: var(--c-warn-light);
  color: var(--c-warn);
}
.badge-red {
  background: var(--c-danger-light);
  color: var(--c-danger);
}
.badge-gray {
  background: var(--c-surface-2);
  color: var(--c-text-2);
  border-color: var(--c-border);
}

/* --------------------------------------------------------------------------
   提示条
   -------------------------------------------------------------------------- */
.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid;
  margin-bottom: 16px;
  display: flex;
  gap: 9px;
  align-items: flex-start;
}
.alert-info {
  background: var(--c-primary-light);
  border-color: #bfdbfe;
  color: #1e40af;
}
.alert-warn {
  background: var(--c-warn-light);
  border-color: #fde68a;
  color: #92400e;
}
.alert-danger {
  background: var(--c-danger-light);
  border-color: #fecaca;
  color: #991b1b;
}
.alert-success {
  background: var(--c-success-light);
  border-color: #bbf7d0;
  color: #166534;
}
.alert .ico {
  flex: 0 0 auto;
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   只读信息展示
   -------------------------------------------------------------------------- */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px 20px;
}

.info-item .k {
  font-size: 12px;
  color: var(--c-text-3);
  margin-bottom: 3px;
}
.info-item .v {
  font-weight: 600;
  word-break: break-all;
}
.info-item .v.empty {
  color: var(--c-text-3);
  font-weight: 400;
}

/* --------------------------------------------------------------------------
   可搜索下拉（车辆选择）
   -------------------------------------------------------------------------- */
.combo {
  position: relative;
}

.combo-input {
  padding-right: 34px !important;
}

.combo-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--c-text-3);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 4px;
  border-radius: 4px;
}
.combo-clear:hover {
  background: var(--c-surface-2);
  color: var(--c-text);
}

.combo-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 300px;
  overflow-y: auto;
  background: var(--c-surface);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 60;
  display: none;
}
.combo-list.open {
  display: block;
}

.combo-opt {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--c-surface-2);
}
.combo-opt:last-child {
  border-bottom: none;
}
.combo-opt:hover,
.combo-opt.hl {
  background: var(--c-primary-light);
}
.combo-opt .o-main {
  font-weight: 600;
}
.combo-opt .o-sub {
  font-size: 12px;
  color: var(--c-text-3);
}
.combo-opt.empty {
  color: var(--c-text-3);
  cursor: default;
  text-align: center;
  padding: 16px;
}

/* --------------------------------------------------------------------------
   照片上传
   -------------------------------------------------------------------------- */
.upload-zone {
  border: 1.5px dashed var(--c-border-strong);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
  background: var(--c-surface-2);
  transition: border-color 0.15s, background 0.15s;
}
.upload-zone.drag {
  border-color: var(--c-primary);
  background: var(--c-primary-light);
}
.upload-zone .uz-title {
  font-weight: 600;
  margin-bottom: 4px;
}
.upload-zone .uz-sub {
  font-size: 12px;
  color: var(--c-text-3);
  margin-bottom: 14px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.photo-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--c-border);
  background: var(--c-surface-2);
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-item .ph-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(16, 24, 40, 0.66);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  display: grid;
  place-items: center;
}
.photo-item .ph-del:hover {
  background: var(--c-danger);
}

.photo-item .ph-state {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  font-size: 11px;
  padding: 2px 6px;
  background: rgba(16, 24, 40, 0.66);
  color: #fff;
  text-align: center;
}
.photo-item .ph-state.err {
  background: var(--c-danger);
}
.photo-item .ph-state.ok {
  background: rgba(22, 163, 74, 0.88);
}

.photo-item .ph-spin {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  color: var(--c-text-2);
}

/* --------------------------------------------------------------------------
   表格（管理后台）
   -------------------------------------------------------------------------- */
.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 300px);
  background: var(--c-surface);
  border-radius: 0 0 var(--radius) var(--radius);
}

table.grid {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 13px;
  min-width: 900px;
}

table.grid th,
table.grid td {
  border-bottom: 1px solid var(--c-border);
  border-right: 1px solid var(--c-border);
  padding: 8px 10px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

table.grid thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--c-surface-2);
  font-weight: 650;
  color: var(--c-text-2);
  user-select: none;
  border-bottom: 1px solid var(--c-border-strong);
}

table.grid thead tr.filter-row th {
  top: 37px;
  z-index: 2;
  background: var(--c-surface);
  padding: 5px 6px;
}

table.grid thead th.sortable {
  cursor: pointer;
}
table.grid thead th.sortable:hover {
  background: #eef2f7;
}

th .th-inner {
  display: flex;
  align-items: center;
  gap: 5px;
}

.sort-ind {
  color: var(--c-text-3);
  font-size: 10px;
  line-height: 1;
  display: flex;
  flex-direction: column;
}
.sort-ind .on {
  color: var(--c-primary);
}

.filter-input {
  width: 100%;
  min-width: 80px;
  padding: 4px 7px !important;
  font-size: 12px !important;
  border-color: var(--c-border) !important;
}

.filter-date {
  display: flex;
  gap: 3px;
  align-items: center;
}
.filter-date input {
  min-width: 0;
  padding: 4px 4px !important;
  font-size: 11px !important;
}

table.grid tbody tr:hover {
  background: #fafbfc;
}
table.grid tbody tr.selected {
  background: var(--c-primary-light);
}

td.col-check,
th.col-check {
  width: 38px;
  text-align: center;
}
td.col-idx {
  color: var(--c-text-3);
  text-align: right;
  width: 52px;
}

.cell-photos {
  display: flex;
  align-items: center;
  gap: 5px;
}
.cell-photos img {
  width: 30px;
  height: 30px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--c-border);
  cursor: zoom-in;
}
/* 「+N」查看剩余照片：必须看得出可点，否则等同于没有入口 */
.cell-photos .more {
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 12px;
  line-height: 1;
  color: var(--c-text-2);
  background: var(--c-surface);
  border: 1px dashed var(--c-border-strong);
  border-radius: 4px;
  cursor: pointer;
}
.cell-photos .more:hover {
  color: var(--c-primary);
  border-style: solid;
  border-color: var(--c-primary);
  background: var(--c-primary-light);
}
.cell-photos .more:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: 1px;
}

/* 点击即复制的单元格（车牌号 / 驾驶员姓名） */
.cell-copy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: -1px -4px;
  padding: 1px 4px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.cell-copy:hover {
  background: var(--c-primary-light);
  color: var(--c-primary);
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}
.cell-copy:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: 1px;
}
/* 悬停时露出的复制图标；复制成功后变成对勾 */
.cell-copy::after {
  content: '⧉';
  font-size: 11px;
  line-height: 1;
  opacity: 0;
  color: var(--c-text-3);
  transition: opacity 0.15s;
}
.cell-copy:hover::after {
  opacity: 1;
}
.cell-copy.copied {
  background: var(--c-success-light);
  color: var(--c-success);
}
.cell-copy.copied::after {
  content: '✓';
  opacity: 1;
  color: var(--c-success);
}

/* 录入情况开关 */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  user-select: none;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.switch .track {
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--c-border-strong);
  transition: background 0.18s;
  flex: 0 0 auto;
  position: relative;
}
.switch .track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s;
  box-shadow: var(--shadow-sm);
}
.switch input:checked + .track {
  background: var(--c-success);
}
.switch input:checked + .track::after {
  transform: translateX(16px);
}
.switch .switch-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--c-text-2);
}
.switch input:checked ~ .switch-label {
  color: var(--c-success);
}

/* --------------------------------------------------------------------------
   工具栏 / 分页
   -------------------------------------------------------------------------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface);
}

.toolbar .grow {
  flex: 1 1 220px;
  min-width: 180px;
}

.toolbar input[type='search'] {
  max-width: 340px;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.kpi {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 13px 15px;
  box-shadow: var(--shadow-sm);
}
.kpi .k {
  font-size: 12px;
  color: var(--c-text-3);
  margin-bottom: 3px;
}
.kpi .v {
  font-size: 23px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}
.kpi .v small {
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text-3);
}
.kpi.accent .v {
  color: var(--c-primary);
}
.kpi.ok .v {
  color: var(--c-success);
}
.kpi.warn .v {
  color: var(--c-warn);
}

.pager {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--c-border);
  flex-wrap: wrap;
  background: var(--c-surface);
}
.pager .info {
  color: var(--c-text-2);
  font-size: 13px;
}
.pager .spacer {
  margin-left: auto;
}
.pager select {
  width: auto;
}

/* 批量操作条 */
.bulkbar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  background: var(--c-primary-light);
  border-bottom: 1px solid #bfdbfe;
  font-size: 13px;
  color: #1e40af;
}
.bulkbar.show {
  display: flex;
}
.bulkbar .spacer {
  margin-left: auto;
}

/* --------------------------------------------------------------------------
   实时更新：连接状态点 + 更新提示条
   -------------------------------------------------------------------------- */
/* 显隐由 JS 写内联 style.display 控制（与项目里其它显隐一致，也便于无头环境断言），
   所以这里**不能**写 display:none —— 否则 JS 清空内联值时会回落到 CSS 的隐藏规则，
   提示条就再也显示不出来（这是一个很容易踩的坑）。 */
.live-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  background: var(--c-warn-light);
  border-bottom: 1px solid #fde68a;
  font-size: 13px;
  color: #92400e;
}
.live-hint .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c-warn);
  flex: none;
}
.live-hint .spacer {
  margin-left: auto;
}

/* 连接状态点：让"实时推送到底连上没有"在界面上可见，而不是只能靠抓包确认 */
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: var(--c-text-3);
  transition: background 0.2s ease;
}
.live-dot[data-state='on'] {
  background: var(--c-success);
}
.live-dot[data-state='connecting'] {
  background: var(--c-warn);
}
.live-dot[data-state='err'] {
  background: var(--c-danger);
}

/* --------------------------------------------------------------------------
   记录卡片（驾驶员端）
   -------------------------------------------------------------------------- */
.rec-list {
  display: grid;
  gap: 14px;
}

.rec {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.rec-head {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface-2);
}
.rec-head .t {
  font-weight: 650;
}
.rec-head .right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.rec-body {
  padding: 14px 16px;
}

.thumb-strip {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}
.thumb-strip .thumb {
  width: 84px;
  height: 84px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--c-border);
  cursor: zoom-in;
  background: var(--c-surface-2);
}
.thumb-strip .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s;
}
.thumb-strip .thumb:hover img {
  transform: scale(1.06);
}

/* --------------------------------------------------------------------------
   登录页
   -------------------------------------------------------------------------- */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(160deg, #eef3fb 0%, #f4f6fa 45%, #f7f4fb 100%);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 30px 28px;
}

.auth-head {
  text-align: center;
  margin-bottom: 22px;
}
.auth-head .logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--c-primary), #7c3aed);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 24px;
  margin: 0 auto 12px;
}
.auth-head h1 {
  margin: 0 0 5px;
  font-size: 20px;
}
.auth-head p {
  margin: 0;
  color: var(--c-text-2);
  font-size: 13px;
}

.steps {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 12px;
  color: var(--c-text-3);
}
.steps .st {
  display: flex;
  align-items: center;
  gap: 5px;
}
.steps .num {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
}
.steps .st.active .num {
  background: var(--c-primary);
  color: #fff;
  border-color: var(--c-primary);
}
.steps .st.active {
  color: var(--c-primary);
  font-weight: 600;
}
.steps .sep {
  flex: 1;
  height: 1px;
  background: var(--c-border);
}

.driver-preview {
  background: var(--c-success-light);
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  margin-bottom: 16px;
  font-size: 13px;
}
.driver-preview .dp-name {
  font-weight: 700;
  color: #166534;
}
.driver-preview .dp-meta {
  color: #15803d;
  font-size: 12px;
  margin-top: 2px;
}

.demo-box {
  margin-top: 20px;
  padding: 12px 14px;
  background: var(--c-surface-2);
  border: 1px dashed var(--c-border-strong);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--c-text-2);
}
.demo-box b {
  color: var(--c-text);
}
.demo-box code {
  font-family: var(--font-mono);
  background: var(--c-surface);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--c-border);
}

/* 备案信息：按工信部要求需在页面公示备案号；公安备案需带图标，同排展示 */
.auth-foot {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--c-border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 14px;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  color: var(--c-text-3);
}
.auth-foot a {
  color: inherit;
  text-decoration: none;
}
.auth-foot a:hover {
  color: var(--c-text-2);
  text-decoration: underline;
}

/* 公安备案：图标 + 备案号，一起作为可点击区域 */
.auth-foot-police {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.auth-foot-police-ico {
  width: 16px;
  height: 16px;
  flex: none;
}

/* --------------------------------------------------------------------------
   灯箱 / 弹层 / 提示
   -------------------------------------------------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.88);
  display: none;
  place-items: center;
  z-index: 200;
  padding: 32px;
}
.lightbox.open {
  display: grid;
}
.lightbox img {
  max-width: 92vw;
  max-height: 86vh;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  transition: transform 0.25s ease;
}
/* 转 90°/270° 后视觉宽高互换，尺寸约束要跟着换，否则竖图转横会顶出视口 */
.lightbox img.lb-side {
  max-width: 86vh;
  max-height: 92vw;
}
.lightbox .lb-close {
  position: absolute;
  top: 18px;
  right: 22px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}
.lightbox .lb-close:hover {
  background: rgba(255, 255, 255, 0.3);
}
/* 旋转工具：排布在关闭按钮左侧，外观与关闭按钮统一 */
.lightbox .lb-tools {
  position: absolute;
  top: 18px;
  right: 70px;
  display: flex;
  gap: 8px;
}
.lightbox .lb-rotate {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.lightbox .lb-rotate:hover {
  background: rgba(255, 255, 255, 0.3);
}
.lightbox .lb-rotate:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.75);
  outline-offset: 2px;
}
/* 前后翻页：多张照片时必须能翻到后面那些，否则等同于只显示第一张 */
.lightbox .lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.lightbox .lb-nav:hover {
  background: rgba(255, 255, 255, 0.32);
}
.lightbox .lb-nav:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.75);
  outline-offset: 2px;
}
/* 已经翻到头：弱化提示。按钮仍可点 —— 点击是给出"已是最后一张"提示的唯一入口 */
.lightbox .lb-nav.lb-edge {
  opacity: 0.32;
  cursor: default;
}
.lightbox .lb-nav.lb-edge:hover {
  background: rgba(0, 0, 0, 0.45);
}
.lightbox .lb-prev {
  left: 20px;
}
.lightbox .lb-next {
  right: 20px;
}
.lightbox .lb-info {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
  text-align: center;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
}

.toast-host {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 9px;
  align-items: center;
  pointer-events: none;
}

.toast {
  min-width: 200px;
  max-width: 460px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  font-weight: 500;
  color: #fff;
  background: #344054;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toast-in 0.18s ease-out;
}
.toast.ok {
  background: var(--c-success);
}
.toast.err {
  background: var(--c-danger);
}
.toast.warn {
  background: var(--c-warn);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 加载态 */
.loading {
  padding: 40px;
  text-align: center;
  color: var(--c-text-3);
}
.spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid var(--c-border-strong);
  border-top-color: var(--c-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 10px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.empty {
  padding: 44px 20px;
  text-align: center;
  color: var(--c-text-3);
}
.empty .e-ico {
  font-size: 34px;
  margin-bottom: 8px;
  opacity: 0.5;
}
.empty .e-title {
  font-weight: 600;
  color: var(--c-text-2);
  margin-bottom: 4px;
}

/* --------------------------------------------------------------------------
   单选卡片（登录方式等）
   -------------------------------------------------------------------------- */
.radio-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.radio-card {
  flex: 1 1 130px;
  border: 1.5px solid var(--c-border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  background: var(--c-surface);
  transition: border-color 0.15s, background 0.15s;
}
.radio-card:hover {
  border-color: var(--c-primary);
}
.radio-card.on {
  border-color: var(--c-primary);
  background: var(--c-primary-light);
}
.radio-card .rc-t {
  font-weight: 650;
}
.radio-card .rc-s {
  font-size: 12px;
  color: var(--c-text-3);
}

/* --------------------------------------------------------------------------
   响应式
   -------------------------------------------------------------------------- */
@media (max-width: 760px) {
  .topbar {
    padding: 0 12px;
    gap: 8px;
  }
  .brand span {
    display: none;
  }
  .topnav {
    min-width: 0;
  }
  .topnav a {
    padding: 6px 9px;
    font-size: 13px;
    white-space: nowrap;
  }
  .topbar-right {
    min-width: 0;
    gap: 8px;
  }
  /* 用户名过长时省略，而不是把整条顶栏挤成两行 */
  .user-chip,
  .user-chip > div:last-child {
    min-width: 0;
  }
  .user-chip .u-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .user-chip .u-role {
    display: none;
  }
  .page {
    padding: 16px 12px 48px;
  }
  .card-body {
    padding: 14px;
  }
  .table-wrap {
    max-height: none;
  }
  .toolbar input[type='search'] {
    max-width: none;
  }
}

/* --------------------------------------------------------------------------
   小屏（iPhone SE / 常见安卓机 375、360、320）
   目标是「拍照 → 备注 → 提交」尽量一屏装下，所以这里同时做两件事：
   1) 把每处会折行的文字收掉（顶栏、卡片副标题、页面说明）
   2) 压缩留白与网格列宽
   -------------------------------------------------------------------------- */
@media (max-width: 560px) {
  .topbar {
    padding: 0 10px;
    gap: 6px;
  }
  .brand-mark {
    width: 26px;
    height: 26px;
    font-size: 13px;
    border-radius: 7px;
  }
  .topnav {
    margin-left: 2px;
    gap: 2px;
  }
  .topnav a {
    padding: 6px 8px;
    font-size: 13px;
  }
  .topnav .nav-full {
    display: none;
  }
  .topnav .nav-short {
    display: inline;
  }
  .topbar-right {
    gap: 6px;
  }
  .user-chip {
    padding: 4px 8px 4px 4px;
    gap: 6px;
  }
  .avatar {
    width: 24px;
    height: 24px;
  }
  .user-chip .u-name {
    max-width: 5em;
    font-size: 13px;
  }
  .topbar-right .btn {
    padding: 6px 10px;
    font-size: 13px;
  }

  .page {
    padding: 12px 10px 36px;
  }
  .page-head {
    margin-bottom: 12px;
  }
  .page-head h1 {
    font-size: 19px;
  }
  /* 这句说明在卡片标题里已经表达过，窄屏不再占两行 */
  .page-head p {
    display: none;
  }

  .card {
    margin-bottom: 12px;
  }
  .card-head {
    padding: 11px 12px;
    gap: 8px;
  }
  .card-head h2 {
    font-size: 14px;
    white-space: nowrap;
  }
  /* 副标题是解释性的，窄屏收掉后标题就能单行显示 */
  .card-head .sub {
    display: none;
  }
  .card-body {
    padding: 12px;
  }

  .upload-zone {
    padding: 14px 12px;
  }
  .upload-zone .uz-title {
    margin-bottom: 2px;
  }
  .upload-zone .uz-sub {
    margin-bottom: 10px;
  }
  /* 手机上没有拖拽操作 */
  .upload-zone .uz-drag {
    display: none;
  }
  .photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 8px;
    margin-top: 12px;
  }

  .submit-bar {
    margin-bottom: 12px;
    gap: 8px;
  }
  .submit-bar .btn-block {
    max-width: none;
    flex: 1 1 140px;
  }

  /* 只读信息改成两列，省一半高度；值太长时仍会自然换行 */
  .info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
  }

  .alert {
    font-size: 12px;
    padding: 9px 11px;
  }
}

@media print {
  .topbar,
  .toolbar,
  .pager,
  .bulkbar {
    display: none !important;
  }
  .table-wrap {
    max-height: none;
    overflow: visible;
  }
}
