﻿:root {
  --bg-color: #f1f5f9;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --success: #059669;
  --success-hover: #047857;
  --success-soft: #ecfdf5;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-soft: #fef2f2;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --shadow-card: 0 1px 3px 0 rgba(15, 23, 42, 0.05), 0 1px 2px -1px rgba(15, 23, 42, 0.03);
  --shadow-hover: 0 10px 15px -3px rgba(15, 23, 42, 0.07), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-modal: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.5;
  padding: 20px 24px;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1520px;
  margin: 0 auto;
}

/* 顶部导航栏（降噪精简版） */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  background: var(--card-bg);
  padding: 16px 22px;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  margin-bottom: 14px;
}

.top-brand-area {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.top-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.top-bar h1 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}

.ver-badge {
  font-size: 11.5px;
  background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
  color: #1e40af;
  padding: 2px 9px;
  border-radius: 999px;
  font-weight: 700;
  border: 1px solid #bfdbfe;
}

.subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

/* 可折叠规则气泡按钮与悬浮卡片 */
.rule-popover-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.rule-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid #bfdbfe;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.rule-trigger-btn:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}

.rule-popover-card {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 460px;
  max-width: 90vw;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 15px 30px -5px rgba(15, 23, 42, 0.15);
  z-index: 80;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.65;
}

.rule-popover-card.open {
  display: block;
  animation: fadeSlideDown 0.16s ease-out;
}

.rule-popover-card h4 {
  font-size: 13px;
  color: #1e3a8a;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.rule-popover-card ul {
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.backup-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.btn-admin-soft {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #1e293b;
  font-weight: 600;
}

.btn-admin-soft:hover {
  background: var(--primary-soft);
  border-color: #93c5fd;
  color: var(--primary);
}

/* 临期预警横幅 */
.expiry-alert-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: linear-gradient(90deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #f59e0b;
  color: #78350f;
  padding: 11px 18px;
  border-radius: 12px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.expiry-alert-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 500;
}

.expiry-alert-icon {
  font-size: 16px;
}

.expiry-alert-actions {
  display: flex;
  gap: 8px;
}

/* 对账时间段栏 */
.period-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  background: var(--card-bg);
  padding: 14px 20px;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  margin-bottom: 14px;
}

.period-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.period-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.range-sep {
  font-weight: 600;
  color: var(--text-muted);
  padding: 0 2px;
}

.quick-presets {
  display: flex;
  gap: 6px;
  margin-left: 4px;
}

.main-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
input[type="month"],
input[type="text"],
input[type="number"],
input[type="date"],
input[type="password"],
select {
  padding: 7px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text-main);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.mini-select {
  padding: 2px 6px !important;
  font-size: 11.5px !important;
  border-radius: 6px !important;
  border-color: #fcd34d !important;
  background: #fffbeb !important;
  color: #92400e !important;
  font-weight: 600;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.readonly-input {
  background: #f1f5f9 !important;
  color: #475569 !important;
  cursor: not-allowed;
}

.money-readonly {
  background: #ecfdf5 !important;
  color: #065f46 !important;
  border-color: #a7f3d0 !important;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* 现代按钮体系 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.25);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
}

.btn-success {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  color: #fff;
  box-shadow: 0 1px 2px rgba(5, 150, 105, 0.25);
}
.btn-success:hover:not(:disabled) {
  background: linear-gradient(180deg, #059669 0%, #047857 100%);
}

.btn-warn-solid {
  background: var(--amber);
  color: #fff;
}
.btn-warn-solid:hover:not(:disabled) {
  background: #b45309;
}

.btn-danger-solid {
  background: var(--danger);
  color: #fff;
}
.btn-danger-solid:hover:not(:disabled) {
  background: var(--danger-hover);
}

.btn-outline {
  background: #fff;
  border-color: #cbd5e1;
  color: var(--text-secondary);
}
.btn-outline:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #94a3b8;
  color: var(--text-main);
}

.btn-sm {
  padding: 4px 9px;
  font-size: 12px;
  border-radius: 6px;
}

.btn-warn-text {
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
}
.btn-warn-text:hover:not(:disabled) {
  background: #fef3c7;
}

.btn-danger-text {
  color: var(--danger);
  background: #fef2f2;
  border: 1px solid #fecaca;
}
.btn-danger-text:hover:not(:disabled) {
  background: #fee2e2;
}

.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

/* KPI 仪表盘统计卡片 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--card-bg);
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: #cbd5e1;
}

.stat-card.card-blue::before { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.stat-card.card-green::before { background: linear-gradient(90deg, #10b981, #34d399); }
.stat-card.card-amber::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.stat-card.card-alert::before { background: linear-gradient(90deg, #ef4444, #f59e0b); }

.stat-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.stat-icon-badge {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.icon-blue { background: #eff6ff; color: #2563eb; }
.icon-green { background: #ecfdf5; color: #059669; }
.icon-amber { background: #fffbeb; color: #d97706; }

.expiry-stat-card {
  cursor: pointer;
  border-color: #fde68a;
  background: linear-gradient(180deg, #ffffff 0%, #fffdf7 100%);
}

.expiry-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.expiry-stat-card.has-alert {
  border-color: #f59e0b;
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
}

.expiry-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.stat-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.stat-value {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* 车位出租率进度条（进度条与占用率文字同一行并排，使底部时段与旁边卡片水平对齐） */
.occupancy-bar-wrap {
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.occupancy-track {
  flex: 1;
  min-width: 60px;
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.occupancy-bar-wrap .stat-sub {
  white-space: nowrap;
  flex-shrink: 0;
}

.occupancy-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3b82f6 0%, #10b981 100%);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.occupancy-fill.high-load {
  background: linear-gradient(90deg, #f59e0b 0%, #ef4444 100%);
}

.text-blue { color: var(--primary) !important; }
.text-green { color: var(--success) !important; }
.text-red { color: var(--danger) !important; }
.text-amber { color: var(--amber) !important; }

/* 筛选栏 */
.filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.filter-left {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
}

.search-input-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 260px;
}

.search-input-wrap input[type="text"] {
  width: 100%;
  padding-right: 30px;
}

.search-clear-btn {
  display: none;
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: #cbd5e1;
  color: #ffffff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background-color 0.15s ease;
}

.search-clear-btn:hover {
  background: #64748b;
}

.search-clear-btn.visible {
  display: inline-flex;
}

.hint-text {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* 表格与悬浮固定表头 */
.table-wrapper {
  background: var(--card-bg);
  border-radius: 14px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  overflow-x: auto;
  max-height: 68vh;
  overflow-y: auto;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

th, td {
  padding: 12px 13px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

th:nth-child(1),
td:nth-child(1),
th:nth-child(2),
td:nth-child(2),
th:nth-child(3),
td:nth-child(3),
th:nth-child(7),
td:nth-child(7) {
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #f8fafc;
  font-weight: 700;
  font-size: 12.5px;
  color: #334155;
  white-space: nowrap;
  border-bottom: 1px solid #cbd5e1;
}

tbody tr {
  transition: background-color 0.12s ease;
}

tbody tr:hover {
  background: #f8fafc;
}

tbody tr.row-urgent { background: #fef2f2; }
tbody tr.row-urgent:hover { background: #fee2e2; }

tbody tr.row-expiring { background: #fffbeb; }
tbody tr.row-expiring:hover { background: #fef3c7; }

tbody tr.row-overdue { background: #fff1f2; }
tbody tr.row-overdue:hover { background: #ffe4e6; }

.cell-sub {
  display: block;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.days-urgent { color: #b91c1c; font-weight: 700; }
.days-expiring { color: #b45309; font-weight: 700; }
.days-overdue { color: #be123c; font-weight: 700; }
.days-future { color: #2563eb; font-weight: 600; }

/* 中国标准燃油蓝牌 & 新能源绿白渐变车牌徽章 */
.plate-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 5px;
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, #1d4ed8 0%, #1e3a8a 100%);
  color: #ffffff;
  border: 1px solid #1e40af;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35), 0 1px 2px rgba(15, 23, 42, 0.12);
}

.plate-badge.plate-ev {
  background: linear-gradient(180deg, #f0fdf4 0%, #4ade80 65%, #22c55e 100%);
  color: #052e16;
  border: 1px solid #16a34a;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6), 0 1px 2px rgba(15, 23, 42, 0.1);
}

.plate-history {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}
.status-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.status-paid {
  background: #d1fae5;
  color: #065f46;
}

.status-refunded {
  background: #e2e8f0;
  color: #334155;
}

.status-overdue {
  background: #fee2e2;
  color: #b91c1c;
}

.expiry-pill {
  display: inline-block;
  margin-top: 3px;
  padding: 1px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
}

.expiry-pill-urgent {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.expiry-pill-soon {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.expiry-pill-overdue {
  background: #ffe4e6;
  color: #9f1239;
  border: 1px solid #fda4af;
}

.action-group {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

/* 弹窗与丝滑入场动画 */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(3px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.active {
  display: flex;
  animation: backdropFadeIn 0.16s ease-out;
}

.modal {
  background: #fff;
  width: 100%;
  max-width: 660px;
  border-radius: 16px;
  padding: 22px 26px;
  box-shadow: var(--shadow-modal);
  border: 1px solid var(--border-color);
  max-height: 90vh;
  overflow-y: auto;
  animation: modalScaleIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal.modal-xl {
  max-width: 860px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 14px;
}

.modal-header h3 {
  font-size: 16.5px;
  font-weight: 700;
  color: var(--text-main);
}

.close-btn {
  background: #f1f5f9;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.close-btn:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.modal-tip {
  background: #f0f9ff;
  border-left: 4px solid var(--primary);
  padding: 10px 13px;
  font-size: 13px;
  color: #1e3a8a;
  margin-bottom: 14px;
  border-radius: 6px;
}

.calc-preview-box.full-settle-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border: 1px solid #6ee7b7;
  border-radius: 10px;
  padding: 13px 16px;
  margin-bottom: 14px;
}

.calc-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  color: #065f46;
}

.calc-row strong {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.calc-sub-note {
  font-size: 12px;
  color: #047857;
}

.settled-tag {
  display: inline-block;
  background: #059669;
  color: #fff;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.refund-detail-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #78350f;
  padding: 11px 13px;
  border-radius: 10px;
  font-size: 12.5px;
  margin-bottom: 14px;
  line-height: 1.6;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 5px;
}

.form-group.full-width {
  grid-column: 1 / -1;
  margin-bottom: 12px;
}

.form-group label {
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

/* 登录页样式 */
.login-backdrop {
  position: fixed;
  inset: 0;
  background-color: #003399;
  background-image:
    radial-gradient(ellipse 85% 55% at 15% 12%, rgba(255, 255, 255, 0.18) 0%, rgba(135, 195, 255, 0.06) 45%, rgba(255, 255, 255, 0) 75%),
    radial-gradient(circle at 88% 90%, rgba(0, 15, 55, 0.35) 0%, rgba(0, 51, 153, 0) 65%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 999;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border-radius: 18px;
  padding: 32px 30px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.15);
  animation: modalScaleIn 0.22s ease-out;
}

.login-header {
  text-align: center;
  margin-bottom: 22px;
}

.login-brand {
  font-size: 21px;
  font-weight: 800;
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
}

.login-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 12.5px;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.login-submit-btn {
  width: 100%;
  padding: 11px 16px;
  font-size: 14.5px;
  margin-top: 6px;
}

.user-session-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  padding: 5px 11px;
  border-radius: 9px;
  font-size: 12.5px;
  color: #1e293b;
  font-weight: 500;
}

.role-tag {
  background: #dbeafe;
  color: #1e40af;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}

.btn-logout {
  color: #b91c1c;
  border-color: #fecaca;
}
.btn-logout:hover:not(:disabled) {
  background: #fef2f2;
  border-color: #fca5a5;
}

/* 账号管理 & 审计日志卡片 */
.account-role-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 13px 15px;
  margin-bottom: 12px;
}

.account-role-title {
  font-size: 13px;
  font-weight: 700;
  color: #1e3a8a;
  margin-bottom: 8px;
}

.custom-role-builder {
  background: #f0f9ff;
  border-color: #bae6fd;
}

.account-role-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.custom-role-badge {
  font-size: 11px;
  font-weight: 700;
  color: #0369a1;
  background: #e0f2fe;
  padding: 2px 9px;
  border-radius: 999px;
}

.perm-section-box {
  background: #ffffff;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 6px;
}

.perm-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: #1e3a8a;
  margin-bottom: 8px;
}

.perm-quick-btns {
  display: flex;
  gap: 6px;
}

.perm-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.parking-spot-types-grid .perm-item:last-child {
  grid-column: span 2;
}

.perm-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: #334155;
  cursor: pointer;
  user-select: none;
}

.custom-roles-list-box {
  margin-top: 10px;
}

.custom-roles-list-title {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 6px;
}

.custom-roles-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.custom-role-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 12px;
}

.custom-role-chip-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.custom-role-chip-perms {
  font-size: 11px;
  color: #64748b;
}

.audit-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}

.audit-toolbar input[type="text"] {
  flex: 1;
  min-width: 220px;
}

.audit-log-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 58vh;
  overflow-y: auto;
}

.audit-card {
  border: 1px solid #e2e8f0;
  border-left: 4px solid #2563eb;
  border-radius: 9px;
  padding: 12px 14px;
  background: #f8fafc;
}

.audit-card.high-risk {
  border-left-color: #d97706;
  background: #fffbeb;
}

.audit-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12.5px;
}

.audit-meta-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.audit-tag {
  background: #e0e7ff;
  color: #1e3a8a;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.audit-tag.risk {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.audit-diff-list {
  list-style: none;
  margin: 6px 0;
  padding: 8px 10px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 7px;
  font-size: 12.5px;
}

.audit-diff-list li {
  margin-bottom: 4px;
}
.audit-diff-list li:last-child {
  margin-bottom: 0;
}

.audit-old {
  color: #b91c1c;
  text-decoration: line-through;
}

.audit-new {
  color: #047857;
  font-weight: 600;
}

.audit-reason {
  font-size: 12px;
  color: #475569;
  margin-top: 4px;
}

.parking-switcher-wrap {
  display: inline-flex;
  align-items: center;
  background-color: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 999px;
  padding: 1px 6px 1px 9px;
  gap: 2px;
}

.parking-switcher-prefix {
  font-size: 11.5px;
  font-weight: 700;
  color: #047857;
  user-select: none;
}

.parking-switcher-select {
  padding: 2px 4px !important;
  font-size: 12px !important;
  font-weight: 700;
  border: none !important;
  border-radius: 999px !important;
  background-color: transparent !important;
  color: #065f46 !important;
  box-shadow: none !important;
  cursor: pointer;
}

.parking-switcher-select:focus {
  outline: none;
  box-shadow: none !important;
}

.brand-logo {
  height: 1.05em;
  width: auto;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

@keyframes modalScaleIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes backdropFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeSlideDown {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== 平板与手机横竖屏触控专属优化 ========== */

/* 1. 所有触控屏设备（平板/手机）：增大按钮热区与间距，防止手指误触 */
@media (hover: none) and (pointer: coarse) {
  .btn {
    min-height: 40px;
    padding: 8px 14px;
    font-size: 13.5px;
  }

  .btn-sm {
    min-height: 34px;
    padding: 6px 11px;
    font-size: 12.5px;
  }

  .action-group {
    gap: 7px;
  }

  input[type="month"],
  input[type="text"],
  input[type="number"],
  input[type="date"],
  input[type="password"],
  select {
    min-height: 40px;
    font-size: 16px; /* 防止手机/平板点击输入框时屏幕自动放大 */
  }

  .mini-select {
    min-height: 28px !important;
    font-size: 12.5px !important;
  }

  .parking-switcher-select {
    min-height: 30px !important;
    font-size: 13px !important;
  }

  .close-btn {
    width: 36px;
    height: 36px;
    font-size: 22px;
  }

  .perm-item {
    padding: 4px 0;
    font-size: 13.5px;
  }

  .perm-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
  }
}

/* 2. 平板横竖屏及中等屏幕（<= 1024px） */
@media (max-width: 1024px) {
  body {
    padding: 14px 16px;
  }

  .top-bar,
  .period-bar {
    padding: 14px 16px;
  }

  /* 4张KPI统计卡片在平板上呈现规整的 2x2 矩阵 */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .table-wrapper {
    max-height: 64vh;
    -webkit-overflow-scrolling: touch;
  }

  /* 横向滑动表格时，固定最左侧“车位号”列，方便对照查看 */
  th:first-child,
  td:first-child {
    position: sticky;
    left: 0;
    z-index: 6;
    background: #ffffff;
    box-shadow: 2px 0 6px -2px rgba(15, 23, 42, 0.08);
  }

  th:first-child {
    z-index: 12;
    background: #f8fafc;
  }

  tbody tr.row-urgent td:first-child { background: #fef2f2; }
  tbody tr.row-expiring td:first-child { background: #fffbeb; }
  tbody tr.row-overdue td:first-child { background: #fff1f2; }
}

/* 3. 手机竖屏及超窄屏（<= 680px） */
@media (max-width: 680px) {
  body {
    padding: 10px 10px;
  }

  .top-bar {
    padding: 12px 14px;
    gap: 10px;
  }

  .top-bar h1 {
    font-size: 17px;
  }

  .backup-actions {
    width: 100%;
    gap: 6px;
  }

  .user-session-badge {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .period-bar {
    padding: 12px 14px;
    gap: 10px;
  }

  .period-controls,
  .period-group,
  .quick-presets,
  .main-actions {
    width: 100%;
  }

  .period-group {
    flex-wrap: wrap;
  }

  .period-group input[type="month"] {
    flex: 1;
    min-width: 125px;
  }

  .quick-presets .btn,
  .main-actions .btn {
    flex: 1;
  }

  /* 手机竖屏 KPI 卡片单列或双列紧凑显示 */
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .stat-value {
    font-size: 21px;
  }

  .filter-left {
    width: 100%;
  }

  .filter-left .search-input-wrap,
  .filter-left input[type="text"],
  .filter-left select {
    min-width: 100%;
    width: 100%;
  }

  .form-grid,
  .perm-checkbox-grid {
    grid-template-columns: 1fr;
  }

  .modal-backdrop {
    padding: 10px;
  }

  .modal {
    padding: 16px 16px;
    border-radius: 14px;
    max-height: 92vh;
  }

  .modal-footer {
    flex-wrap: wrap;
  }

  .modal-footer .btn {
    flex: 1;
    min-width: 110px;
  }

  .login-card {
    padding: 24px 20px;
  }
}