/* ============ 8X 暮色试驾 · 活动管理系统 ============ */
/* 极氪品牌色规范：月白/纸黄主体、星辰紫深色打底、曙光橙仅作高亮 */

:root {
  --brand: #FF5841;          /* 曙光橙（高亮） */
  --brand-red: #EA512A;      /* 日出红 */
  --brand-energy: #F76400;   /* 能量橙 */
  --brand-purple: #31041B;   /* 星辰紫 */
  --bg: #FFFBF3;             /* 月白 */
  --bg-soft: #FFF4E2;        /* 纸黄 */
  --card: #FFFFFF;
  --line: #DDDDDD;           /* 纯净灰 */
  --line-warm: #D9C5B7;      /* 浅栗棕 */
  --muted: #9DA2A5;          /* 浅炭灰 */
  --text: #232323;           /* 木炭灰 */
  --brown: #69514B;          /* 栗棕 */
  --brown-mid: #B9A6A0;      /* 中栗棕 */
  --green: #2E9E6B;
  --blue: #3B82C4;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(49, 4, 27, 0.07);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

.hidden { display: none !important; }

/* ============ 登录页 ============ */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 15% 10%, rgba(255, 88, 65, 0.10), transparent 45%),
    radial-gradient(ellipse at 85% 90%, rgba(49, 4, 27, 0.12), transparent 50%),
    var(--bg);
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line-warm);
  padding: 40px 36px 30px;
  text-align: center;
}
.login-logo {
  width: 64px; height: 64px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-purple), #5A1024);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px;
  box-shadow: 0 6px 18px rgba(49, 4, 27, 0.35);
}
.login-card h1 { font-size: 22px; letter-spacing: 2px; }
.login-sub { color: var(--muted); font-size: 13px; margin: 4px 0 26px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.login-card input {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  background: var(--bg);
  outline: none;
  transition: border-color .2s;
}
.login-card input:focus { border-color: var(--brand); }
.login-card button {
  padding: 12px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-energy));
  cursor: pointer;
  transition: opacity .2s, transform .1s;
}
.login-card button:hover { opacity: .9; }
.login-card button:active { transform: scale(.98); }

/* ============ 布局 ============ */
.app-view { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  min-width: 232px;
  background: linear-gradient(180deg, var(--brand-purple), #4A0E22 70%, #5A1024);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .12);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.brand-name { font-size: 15px; font-weight: 700; letter-spacing: 1px; }
.brand-sub { font-size: 11px; opacity: .55; }

.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  margin-bottom: 4px;
  border-radius: 10px;
  color: rgba(255,255,255,.78);
  cursor: pointer;
  font-size: 13.5px;
  transition: background .15s, color .15s;
  border: none; background: transparent; width: 100%; text-align: left;
  font-family: inherit;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active {
  background: linear-gradient(135deg, var(--brand), var(--brand-energy));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(255, 88, 65, .35);
}
.nav-icon { font-size: 16px; width: 22px; text-align: center; }

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}
.user-info { flex: 1; min-width: 0; }
.user-info .u-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info .u-role { font-size: 11px; opacity: .55; }
.icon-btn {
  background: rgba(255,255,255,.12);
  border: none; color: #fff;
  width: 30px; height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
}
.icon-btn:hover { background: rgba(255,255,255,.25); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 26px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar h2 { font-size: 18px; letter-spacing: 1px; }
.event-tag {
  background: var(--bg-soft);
  border: 1px solid var(--line-warm);
  color: var(--brown);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
}
.main-content { padding: 22px 26px 40px; }

/* ============ 卡片 / 统计 ============ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--line-warm);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.stat-card .s-label { font-size: 12.5px; color: var(--muted); }
.stat-card .s-value { font-size: 26px; font-weight: 700; margin-top: 4px; color: var(--text); }
.stat-card .s-value.hl { color: var(--brand); }       /* 关键数字品牌橙高亮 */
.stat-card .s-value.purple { color: var(--brand-purple); }
.stat-card .s-sub { font-size: 11.5px; color: var(--brown-mid); margin-top: 2px; }

.card {
  background: var(--card);
  border: 1px solid var(--line-warm);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap; gap: 10px;
}
.card-title { font-size: 15px; font-weight: 700; }
.card-body { padding: 16px 18px; }

/* ============ 表格 ============ */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  background: var(--bg-soft);
  color: var(--brown);
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-warm);
  white-space: nowrap;
  font-size: 12.5px;
}
.tbl td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.tbl tr:hover td { background: #FFFDF8; }
.tbl .num { font-variant-numeric: tabular-nums; }
.empty-tip { text-align: center; color: var(--muted); padding: 36px 0; }

/* ============ 徽章 ============ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge.idle { background: #E9F7F0; color: var(--green); }
.badge.busy { background: #FDECE8; color: var(--brand-red); }
.badge.waiting { background: var(--bg-soft); color: var(--brown); border: 1px solid var(--line-warm); }
.badge.driving { background: #FDECE8; color: var(--brand-red); }
.badge.finished { background: #EDEFF0; color: var(--muted); }
.badge.checkin-yes { background: #E9F7F0; color: var(--green); }
.badge.checkin-no { background: #EDEFF0; color: var(--muted); }
.badge.web-ok { background: #E9F7F0; color: var(--green); }
.badge.web-fail { background: #FDECE8; color: var(--brand-red); }
.badge.web-none { background: #EDEFF0; color: var(--muted); }
.badge.sys { background: var(--brand-purple); color: #fff; }
.badge.custom { background: #EFEAF2; color: #6B4E7E; }
.badge.warn { background: #FFF7E6; color: #B8860B; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.idle { background: var(--green); }
.dot.busy { background: var(--brand-red); }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 14px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
  white-space: nowrap;
}
.btn:hover { border-color: var(--brown-mid); background: var(--bg); }
.btn:active { transform: scale(.97); }
.btn.primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-energy));
  border: none; color: #fff; font-weight: 600;
  box-shadow: 0 3px 10px rgba(255, 88, 65, .28);
}
.btn.primary:hover { opacity: .9; }
.btn.dark {
  background: linear-gradient(135deg, var(--brand-purple), #5A1024);
  border: none; color: #fff; font-weight: 600;
}
.btn.danger { color: var(--brand-red); border-color: #F5C6BB; }
.btn.danger:hover { background: #FDECE8; }
.btn.success { color: var(--green); border-color: #BFE3D2; }
.btn.success:hover { background: #E9F7F0; }
.btn.sm { padding: 4px 10px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ============ 表单 ============ */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; }
.form-item label { display: block; font-size: 12.5px; color: var(--brown); margin-bottom: 5px; font-weight: 500; }
.form-item label .req { color: var(--brand-red); margin-left: 2px; }
.form-item input, .form-item select, .form-item textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 13.5px;
  background: var(--bg);
  outline: none;
  font-family: inherit;
  transition: border-color .2s;
}
.form-item input:focus, .form-item select:focus, .form-item textarea:focus { border-color: var(--brand); background: #fff; }
.form-item textarea { resize: vertical; min-height: 60px; }
.form-item.full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* 筛选栏 */
.filter-bar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  padding: 14px 18px;
  background: var(--card);
  border: 1px solid var(--line-warm);
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.filter-bar input, .filter-bar select {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 13px;
  background: var(--bg);
  outline: none;
}
.filter-bar input:focus, .filter-bar select:focus { border-color: var(--brand); }

/* ============ 签到页 ============ */
.checkin-search-wrap {
  background: var(--card);
  border: 1px solid var(--line-warm);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 28px;
  text-align: center;
  margin-bottom: 20px;
}
.checkin-search-wrap h3 { font-size: 18px; margin-bottom: 6px; }
.checkin-search-wrap .sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.big-search {
  display: flex; gap: 10px; justify-content: center;
  max-width: 560px; margin: 0 auto;
}
.big-search input {
  flex: 1;
  padding: 14px 20px;
  font-size: 17px;
  border: 2px solid var(--line-warm);
  border-radius: 12px;
  background: var(--bg);
  outline: none;
  letter-spacing: 1px;
  transition: border-color .2s;
}
.big-search input:focus { border-color: var(--brand); }
.big-search button {
  padding: 0 28px;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-energy));
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(255, 88, 65, .3);
}
.checkin-result-list { display: flex; flex-direction: column; gap: 10px; }
.checkin-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--card);
  border: 1px solid var(--line-warm);
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.checkin-item .ci-main { flex: 1; min-width: 200px; }
.checkin-item .ci-name { font-size: 15.5px; font-weight: 700; }
.checkin-item .ci-meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* 试驾安排弹窗卡片 */
.arrange-list { display: flex; flex-direction: column; gap: 10px; max-height: 46vh; overflow-y: auto; }
.arrange-item {
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all .15s;
  background: var(--bg);
}
.arrange-item:hover { border-color: var(--brand); }
.arrange-item.selected {
  border-color: var(--brand);
  background: #FFF0EC;
  box-shadow: 0 0 0 2px rgba(255, 88, 65, .15);
}
.arrange-item .ar-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.arrange-item .ar-model { font-weight: 700; font-size: 14.5px; }
.car-no-tag {
  font-style: normal;
  display: inline-block;
  background: linear-gradient(135deg, var(--brand-purple), #5A1024);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 7px;
  margin-right: 8px;
  vertical-align: 1px;
}
.arrange-item .ar-queue { font-size: 12px; color: var(--brand-red); font-weight: 600; }
.arrange-item .ar-queue.ok { color: var(--green); }
.arrange-item .ar-info { font-size: 12.5px; color: var(--brown); display: flex; gap: 14px; flex-wrap: wrap; }
.arrange-item .ar-sps { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.sp-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  margin-right: 6px;
  border: 1px solid var(--line);
  background: #fff;
}
.sp-chip.busy { color: var(--brand-red); border-color: #F5C6BB; background: #FDECE8; }

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(49, 4, 27, .45);
  backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  z-index: 100;
  padding: 6vh 16px 20px;
  overflow-y: auto;
}
.modal {
  background: var(--card);
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  box-shadow: 0 20px 50px rgba(49,4,27,.3);
  animation: modalIn .18s ease;
}
.modal.lg { max-width: 760px; }
@keyframes modalIn { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-header h3 { font-size: 16px; }
.modal-close {
  border: none; background: none; font-size: 20px; color: var(--muted);
  cursor: pointer; width: 30px; height: 30px; border-radius: 8px;
}
.modal-close:hover { background: var(--bg-soft); color: var(--text); }
.modal-body { padding: 20px; max-height: 65vh; overflow-y: auto; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  border-radius: 0 0 16px 16px;
}

/* ============ Toast ============ */
#toast-root {
  position: fixed; top: 20px; right: 20px;
  z-index: 300;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--text);
  color: #fff;
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  animation: toastIn .2s ease;
  max-width: 360px;
}
.toast.success { background: var(--green); }
.toast.error { background: var(--brand-red); }
@keyframes toastIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ============ 权限矩阵 ============ */
.perm-table td, .perm-table th { text-align: center; }
.perm-table th:first-child, .perm-table td:first-child { text-align: left; }
.perm-check {
  width: 18px; height: 18px;
  accent-color: var(--brand);
  cursor: pointer;
}

/* 角色卡片 */
.role-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.role-card {
  border: 1px solid var(--line-warm);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
  position: relative;
}
.role-card .rc-name { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.role-card .rc-desc { color: var(--muted); font-size: 12.5px; margin: 6px 0 10px; min-height: 20px; }
.role-card .rc-perms { font-size: 12px; color: var(--brown); }
.role-card .rc-perms span { background: var(--bg-soft); padding: 2px 7px; border-radius: 6px; margin: 0 4px 4px 0; display: inline-block; border: 1px solid var(--line-warm); }
.role-card .rc-actions { margin-top: 12px; display: flex; gap: 8px; }

/* 时间线 / 排程 */
.seq-tag {
  font-weight: 700;
  color: var(--brand-purple);
  background: #F3EAF1;
  padding: 2px 9px;
  border-radius: 7px;
  font-size: 12px;
  letter-spacing: .5px;
}

/* 标签页 */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab-btn {
  padding: 9px 18px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  font-family: inherit;
}
.tab-btn.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 700; }

/* 字段映射编辑器：行内控件统一样式 */
.map-row select.map-key,
.map-row input.map-val {
  flex: 1;
  height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s, background .2s;
}
.map-row select.map-key:focus,
.map-row input.map-val:focus {
  border-color: var(--brand);
  background: #fff;
}
.map-row input.map-val::placeholder { color: var(--muted); }

/* 进度条 */
.progress {
  height: 8px;
  border-radius: 99px;
  background: var(--bg-soft);
  border: 1px solid var(--line-warm);
  overflow: hidden;
  min-width: 90px;
}
.progress > div {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--brand), var(--brand-energy));
  transition: width .4s ease;
}
.progress > div.done { background: var(--green); }

/* 上传区 */
.drop-zone {
  border: 2px dashed var(--line-warm);
  border-radius: 12px;
  padding: 26px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: all .2s;
  background: var(--bg);
}
.drop-zone:hover, .drop-zone.dragover { border-color: var(--brand); color: var(--brand); background: #FFF0EC; }

/* 响应式 */
@media (max-width: 900px) {
  .sidebar { width: 68px; min-width: 68px; }
  .sidebar-brand .brand-name, .sidebar-brand .brand-sub,
  .sidebar-user .user-info, .sidebar-brand div { display: none; }
  .nav-item { justify-content: center; padding: 12px 8px; }
  .nav-item .nav-label { display: none; }
  .main-content { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .big-search { flex-direction: column; }
  .big-search button { padding: 12px; }
}
