/* 车辆预约系统 — 视觉母题：车牌蓝 / 调度表 */
:root {
  --ink: #1c2733;
  --ink-soft: #5b6b7c;
  --plate: #2563eb;
  --plate-dark: #1d4ed8;
  --plate-grad: linear-gradient(135deg, #3b82f6, #1d4ed8);
  --paper: #f0f2f5;
  --card: #ffffff;
  --line: #e2e7ee;
  --free: #f6f9f6;
  --free-line: #d8e4d8;
  --busy: #fbeeee;
  --busy-line: #eccaca;
  --busy-ink: #b04a4a;
  --mine: #e9f0fb;
  --mine-line: #c3d4ef;
  --ok: #2f9e63;
  --danger: #c94f4f;
  --amber: #b97f22;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 20px rgba(0,0,0,.08);
  --shadow-hover: 0 2px 6px rgba(0,0,0,.08), 0 8px 28px rgba(0,0,0,.1);
  --border-light: #e2e8f0;
  font-size: 15px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }

/* ---------- 顶栏 ---------- */
.topbar {
  background: var(--plate-grad);
  position: sticky; top: 0; z-index: 20;
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
}
.topbar-inner {
  max-width: 1120px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 22px; height: 58px;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: .5px; color: #fff; }
.logo svg { display: block; }
.nav-icon { width: 16px; height: 16px; vertical-align: -3px; margin-right: 5px; }

.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
  padding: 7px 14px; border-radius: 8px; color: rgba(255,255,255,.75);
  text-decoration: none; font-weight: 500; border: none; background: none; font-size: 14.5px;
}
.nav a:hover { background: rgba(255,255,255,.15); color: #fff; }
.nav a.on { background: rgba(255,255,255,.2); color: #fff; font-weight: 600; }

.me-area { display: flex; align-items: center; gap: 12px; color: rgba(255,255,255,.85); }
.me-name { font-size: 13.5px; color: rgba(255,255,255,.75); }
.me-name b { color: #fff; font-weight: 600; margin-left: 6px; }
.role-tag {
  font-size: 11px; padding: 1px 7px; border-radius: 999px;
  background: #eef2f6; color: var(--ink-soft); border: 1px solid var(--line);
}

/* ---------- 通用 ---------- */
.container { max-width: 1120px; margin: 0 auto; padding: 26px 20px 60px; }

.btn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 7px 16px; border-radius: 8px; font-weight: 500;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--paper); }
.btn:focus-visible, a:focus-visible { outline: 2px solid var(--plate); outline-offset: 2px; }
.btn.primary { background: var(--plate-grad); border-color: var(--plate-dark); color: #fff; }
.btn.primary:hover { background: var(--plate-dark); }
.btn.danger { color: var(--danger); border-color: #e5c8c8; }
.btn.danger:hover { background: var(--busy); }
.btn.ghost-sm { padding: 4px 10px; font-size: 13px; border-radius: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-title { font-size: 21px; font-weight: 700; letter-spacing: .3px; }
.page-sub { font-size: 13.5px; color: var(--ink-soft); margin-top: 3px; }

/* 车牌徽章 — 系统签名元素 */
.plate-chip {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--plate-grad); color: #fff;
  font-weight: 700; letter-spacing: 1.5px; font-size: 13.5px;
  padding: 3px 10px; border-radius: 6px;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .75), 0 1px 2px rgba(28, 39, 51, .25);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

.badge { display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 999px; font-weight: 500; }
.badge.ok { background: #e8f5ee; color: var(--ok); }
.badge.off { background: #f0f1f3; color: var(--ink-soft); }
.badge.cancel { background: #f0f1f3; color: var(--ink-soft); text-decoration: line-through; }
.badge.warn { background: #faf3e4; color: var(--amber); }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); font-size: 14.5px;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--plate); outline-offset: -1px; border-color: var(--plate);
}
.field .hint { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.form-error { color: var(--danger); font-size: 13.5px; margin: 10px 0 2px; min-height: 18px; }
.field input:invalid:not(:placeholder-shown) { border-color: var(--danger); }
.field input:valid:not(:placeholder-shown) { border-color: var(--ok); }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1000px 500px at 80% -20%, rgba(59,130,246,.12) 0%, transparent 60%),
    radial-gradient(800px 400px at -10% 120%, rgba(59,130,246,.06) 0%, transparent 55%),
    linear-gradient(180deg, #f8fafc 0%, #f0f2f5 100%);
}
.login-card { width: 400px; padding: 40px 36px 34px; border: 1px solid var(--border-light); }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 30px; }
.login-brand h1 { font-size: 24px; font-weight: 700; letter-spacing: 2px; color: var(--plate); }
.login-brand .sub { font-size: 13px; color: var(--ink-soft); letter-spacing: 2px; }
.login-demo {
  margin-top: 18px; padding: 10px 12px; border-radius: 8px; background: var(--paper);
  font-size: 12.5px; color: var(--ink-soft); line-height: 1.7;
}
.login-demo code { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; font-size: 12px; }

/* ---------- 日历 ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.cal-title { font-size: 19px; font-weight: 700; letter-spacing: 1px; min-width: 150px; text-align: center; }
.cal-nav { display: flex; gap: 8px; align-items: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-dow {
  text-align: center; font-size: 12.5px; font-weight: 600; color: var(--ink-soft);
  padding: 6px 0 8px; letter-spacing: 2px;
}
.cal-dow.weekend { color: #c08a8a; }
.cal-cell {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  min-height: 92px; padding: 8px 9px; text-align: left;
  display: flex; flex-direction: column; gap: 5px; transition: border-color .12s, box-shadow .12s;
  position: relative;
}
.cal-cell:hover { border-color: var(--plate); box-shadow: 0 4px 20px rgba(37,99,235,.18); transform: scale(1.06); background: rgba(255,255,255,.85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); z-index: 2; position: relative; }
.cal-cell.other { opacity: .38; pointer-events: none; }
.cal-cell.holiday { background: linear-gradient(135deg, #e8f0fe, #d4e4fc); border-color: #a8c8f0; }
.cal-cell.holiday:hover { background: linear-gradient(135deg, #d4e4fc, #bdd6f8); border-color: #7aacf0; box-shadow: 0 4px 20px rgba(37,99,235,.22); transform: scale(1.06); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.cal-cell.today { border-color: var(--plate); border-width: 2px; padding: 7px 8px; }
.cal-cell.past { opacity: .55; }
.cal-daynum { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cal-lunar { font-size: 10.5px; color: var(--ink-soft); line-height: 1.2; margin-top: 1px; }
.cal-cell.holiday .cal-lunar { color: var(--plate-dark); font-weight: 600; }
.cal-cell.today .cal-daynum { color: var(--plate-dark); }
.cal-cell.today .cal-daynum::after {
  content: "今天"; font-size: 10px; font-weight: 600; color: #fff; background: var(--plate);
  border-radius: 4px; padding: 1px 5px; margin-left: 6px; vertical-align: 2px; letter-spacing: 1px;
}
.cal-marks { display: flex; flex-direction: column; gap: 3px; margin-top: auto; }
.cal-mark { font-size: 11.5px; line-height: 1.35; border-radius: 4px; padding: 1px 6px; width: fit-content; max-width: 100%; }
.cal-mark.holiday-mark { background: linear-gradient(135deg, #e8f0fe, #d4e4fc); color: var(--plate-dark); font-weight: 700; font-size: 10.5px; letter-spacing: .5px; }
.cal-mark.total { background: var(--paper); color: var(--ink-soft); }
.cal-mark.mine { background: var(--mine); color: var(--plate-dark); font-weight: 600; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(28, 39, 51, .45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 5vh 16px 16px; z-index: 50; overflow-y: auto;
}
.modal {
  background: var(--card); border-radius: 12px; width: 640px; max-width: 100%;
  box-shadow: 0 18px 60px rgba(15, 23, 32, .3); animation: pop .18s ease-out;
  margin-bottom: 6vh;
}
.modal.narrow { width: 430px; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .modal { animation: none; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 12px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 16.5px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--ink-soft); padding: 2px 8px; border-radius: 6px; line-height: 1; }
.modal-close:hover { background: var(--paper); color: var(--ink); }
.modal-body { padding: 18px 20px 20px; }

/* 预约弹窗左右分栏 */
.booking-layout { display: flex; gap: 20px; padding: 18px 20px 20px; }
.booking-left { flex: 1; min-width: 0; }
.booking-right { width: 260px; flex-shrink: 0; }
.booking-right .day-list { margin-top: 0; border-top: none; padding-top: 0; border-left: 1px solid var(--border-light); padding-left: 16px; height: 100%; }
.booking-right .day-list ul { max-height: calc(100vh - 280px); overflow-y: auto; }
.booking-right .day-list li { flex-wrap: wrap; gap: 4px 8px; padding: 6px 0; border-bottom: 1px solid #f0f0f0; }
.booking-right .day-list li:last-child { border-bottom: none; }

/* ---------- 时段选择（调度表）---------- */
.slot-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.slot-toolbar select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); font-size: 14px; flex: 1; min-width: 220px; }
.slot-summary { font-size: 13.5px; color: var(--ink-soft); }
.slot-summary b { color: var(--plate-dark); font-variant-numeric: tabular-nums; }

.slot-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; margin-bottom: 10px; }
.slot {
  border: 1px solid var(--free-line); background: var(--free); color: var(--ink-soft);
  border-radius: 6px; font-size: 11.5px; padding: 6px 0; text-align: center;
  font-variant-numeric: tabular-nums; font-weight: 600; position: relative;
  transition: transform .06s;
}
.slot:active { transform: scale(.96); }
.slot.free:hover { border-color: var(--plate); color: var(--plate-dark); background: #fff; transform: translateY(-1px); box-shadow: 0 2px 8px rgba(37,99,235,.15); }
.slot.busy { background: var(--busy); border-color: var(--busy-line); color: var(--busy-ink); cursor: not-allowed; }
.slot.past-slot { background: #edf0f3; border-color: #dfe3e8; color: #a9b3bd; cursor: not-allowed; }
.slot.busy.mine-slot { background: var(--mine); border-color: var(--mine-line); color: var(--plate-dark); cursor: pointer; }
.slot.busy.mine-slot:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(37,99,235,.12); }
.slot.sel { background: var(--plate-grad); border-color: var(--plate-dark); color: #fff; transform: translateY(-1px); box-shadow: 0 2px 10px rgba(37,99,235,.25); }
.slot.legend-chip { cursor: default; }

.slot-legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-soft); margin-bottom: 14px; flex-wrap: wrap; }
.slot-legend span { display: inline-flex; align-items: center; gap: 6px; }
.slot-legend i { width: 13px; height: 13px; border-radius: 3px; display: inline-block; border: 1px solid var(--line); }
.slot-legend .l-free { background: var(--free); border-color: var(--free-line); }
.slot-legend .l-busy { background: var(--busy); border-color: var(--busy-line); }
.slot-legend .l-mine { background: var(--mine); border-color: var(--mine-line); }
.slot-legend .l-sel { background: var(--plate); border-color: var(--plate-dark); }

.day-list { margin-top: 16px; border-top: 1px dashed var(--line); padding-top: 12px; }
.day-list li .plate-chip { flex-shrink: 0; }
.day-list h4 { font-size: 13px; color: var(--ink-soft); font-weight: 600; margin-bottom: 8px; letter-spacing: 1px; }
.day-list ul { list-style: none; max-height: 150px; overflow-y: auto; }
.day-list li { display: flex; align-items: center; gap: 10px; padding: 5px 2px; font-size: 13px; }
.day-list .t { font-variant-numeric: tabular-nums; color: var(--ink-soft); min-width: 108px; }
.day-list .who { color: var(--ink); font-weight: 500; }
.day-list .pu { color: var(--ink-soft); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left; font-size: 12.5px; letter-spacing: 1px; color: var(--ink-soft);
  padding: 10px 12px; border-bottom: 1px solid var(--line); font-weight: 600; white-space: nowrap;
}
table.data td { padding: 11px 12px; border-bottom: 1px solid #eef1f5; vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: #fafbfd; }
.t-num { font-variant-numeric: tabular-nums; }
.t-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.t-empty { text-align: center; color: var(--ink-soft); padding: 34px 0 !important; font-size: 13.5px; }

/* ---------- 标签页 ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tabs button {
  background: none; border: none; padding: 9px 16px; font-size: 14.5px; font-weight: 500;
  color: var(--ink-soft); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--plate-dark); font-weight: 700; border-bottom-color: var(--plate); }

/* ---------- Toast ---------- */
#toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--ink); color: #fff; font-size: 13.5px; padding: 9px 18px; border-radius: 8px;
  box-shadow: 0 6px 24px rgba(15, 23, 32, .3); animation: pop .18s ease-out; max-width: 88vw;
}
.toast.ok { background: #24603f; }
.toast.err { background: #8f3a3a; }

/* ---------- 空状态 ---------- */
.empty-tip { text-align: center; color: var(--ink-soft); font-size: 13.5px; padding: 40px 0; }
.empty-tip b { display: block; font-size: 15px; color: var(--ink); margin-bottom: 6px; }

/* ========== 响应式：平板 (≤768px) ========== */
@media (max-width: 768px) {
  .container { padding: 14px 10px 40px; }
  .topbar-inner { padding: 0 10px; gap: 8px; height: auto; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
  .logo span.title { font-size: 15px; }
  .nav { order: 3; width: 100%; justify-content: center; }
  .nav a { padding: 5px 10px; font-size: 13px; }
  .me-area { gap: 8px; }
  .me-name { font-size: 12px; }
  .role-tag { font-size: 11px; padding: 2px 6px; }
  .cal-head { flex-direction: column; align-items: center; gap: 8px; }
  .cal-title { font-size: 17px; }
  .cal-grid { gap: 3px; }
  .cal-cell { min-height: 56px; padding: 4px 5px; border-radius: 6px; gap: 2px; }
  .cal-daynum { font-size: 15px; }
  .cal-lunar { font-size: 9px; }
  .cal-mark { font-size: 9px; padding: 0 3px; }
  .cal-cell.today .cal-daynum::after { font-size: 8px; padding: 0 3px; margin-left: 3px; }
  .modal { width: 95%; max-width: 500px; }
  .booking-layout { flex-direction: column; gap: 12px; padding: 12px; }
  .booking-left { flex: none; width: 100%; }
  .booking-right { width: 100%; flex-shrink: 1; }
  .booking-right .day-list { border-left: none; border-top: 1px solid var(--border-light); padding-left: 0; padding-top: 10px; margin-top: 8px; }
  .booking-right .day-list ul { max-height: 180px; }
  .slot-grid { grid-template-columns: repeat(6, 1fr); gap: 3px; }
  .slot { padding: 5px 2px; font-size: 11px; }
  .slot-toolbar { flex-direction: column; gap: 6px; }
  .slot-toolbar select { width: 100%; }
  .field input, .field select { font-size: 14px; padding: 8px 10px; }
  table.data { font-size: 12px; }
  table.data th, table.data td { padding: 6px 8px; }
}

/* ========== 响应式：手机 (≤480px) ========== */
@media (max-width: 480px) {
  .container { padding: 10px 6px 36px; }
  .topbar-inner { padding: 0 6px; gap: 4px; padding-top: 4px; padding-bottom: 4px; }
  .logo { gap: 6px; }
  .logo svg { width: 24px; height: 24px; }
  .logo span.title { font-size: 13px; }
  .nav { gap: 2px; }
  .nav a { padding: 4px 8px; font-size: 12px; border-radius: 6px; }
  .nav-icon { width: 13px; height: 13px; margin-right: 3px; }
  .me-area { gap: 4px; }
  .me-name { font-size: 11px; max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .role-tag { font-size: 10px; padding: 1px 4px; }
  .btn.ghost-sm { font-size: 11px; padding: 4px 8px; }
  .cal-head { gap: 6px; }
  .cal-head .btn { font-size: 12px; padding: 5px 10px; }
  .cal-title { font-size: 15px; }
  .cal-grid { gap: 2px; }
  .cal-dow { font-size: 10px; padding: 4px 0; }
  .cal-cell { min-height: 48px; padding: 3px 4px; border-radius: 5px; gap: 1px; }
  .cal-cell:hover { transform: scale(1.03); }
  .cal-daynum { font-size: 14px; }
  .cal-lunar { font-size: 8px; }
  .cal-mark { font-size: 8px; padding: 0 2px; border-radius: 3px; }
  .cal-cell.today { border-width: 1.5px; padding: 2px 3px; }
  .cal-cell.today .cal-daynum::after { font-size: 7px; padding: 0 2px; margin-left: 2px; }
  .modal { width: 98%; border-radius: 10px; }
  .modal-head { padding: 12px 14px; }
  .modal-head h3 { font-size: 14px; }
  .modal-body { padding: 10px; }
  .booking-layout { padding: 8px; gap: 8px; }
  .booking-right .day-list ul { max-height: 140px; }
  .booking-right .day-list li { font-size: 11px; padding: 4px 0; }
  .slot-grid { grid-template-columns: repeat(4, 1fr); gap: 2px; }
  .slot { padding: 4px 1px; font-size: 10px; border-radius: 4px; }
  .slot-legend { gap: 6px; font-size: 10px; flex-wrap: wrap; }
  .slot-legend i { width: 10px; height: 10px; }
  .field { margin-bottom: 8px; }
  .field label { font-size: 12px; }
  .field input, .field select { font-size: 13px; padding: 7px 8px; }
  .login-card { width: 92%; padding: 24px 18px 20px; }
  .login-brand h1 { font-size: 20px; }
  .login-brand .sub { font-size: 11px; }
  table.data { font-size: 11px; }
  table.data th, table.data td { padding: 5px 6px; }
  .page-title { font-size: 17px; }
  .btn { font-size: 13px; padding: 7px 14px; }
  .btn.primary { font-size: 13px; }
  .plate-chip { font-size: 10px; padding: 1px 5px; }
}
