/* ============================================================
   车辆预约系统 - 苹果风移动端样式
   ============================================================ */

:root {
  --bg: #f2f2f7;
  --card: #ffffff;
  --text: #000000;
  --text-2: #3c3c43;
  --text-3: #8e8e93;
  --text-4: #c7c7cc;
  --sep: rgba(60, 60, 67, 0.12);
  --blue: #007aff;
  --green: #34c759;
  --orange: #ff9500;
  --red: #ff3b30;
  --purple: #5856d6;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 20px rgba(0, 0, 0, 0.05);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 54px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

button,
input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* ------------------------- 布局 ------------------------- */

.app {
  max-width: 540px;
  margin: 0 auto;
  padding: 0 16px calc(var(--tabbar-h) + var(--safe-bottom) + 28px);
  min-height: 100vh;
}

.nav {
  padding: 24px 4px 16px;
}

.nav h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.4px;
  line-height: 1.2;
}

.nav-sub {
  margin: 4px 0 0;
  color: var(--text-3);
  font-size: 14px;
}

.section {
  margin-bottom: 22px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 4px 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.2px;
}

.section-title a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 500;
}

/* ------------------------- 卡片 ------------------------- */

.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
}

.card-tight {
  padding: 0;
  overflow: hidden;
}

.group {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 12px;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  position: relative;
}

.row + .row::before {
  content: "";
  position: absolute;
  left: 16px;
  right: 0;
  top: 0;
  height: 1px;
  background: var(--sep);
  transform: scaleY(0.5);
}

.row-tap:active {
  background: rgba(120, 120, 128, 0.08);
}

.row-main {
  flex: 1;
  min-width: 0;
}

.row-title {
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-sub {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-value {
  color: var(--text-3);
  font-size: 15px;
  flex: none;
}

.chev {
  flex: none;
  width: 8px;
  height: 13px;
  border-right: 2px solid var(--text-4);
  border-top: 2px solid var(--text-4);
  transform: rotate(45deg);
  border-radius: 1px;
}

/* ------------------------- 车辆大卡片 ------------------------- */

.hero {
  background: var(--card);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 14px;
}

.hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.plate {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 1px;
  line-height: 1.15;
}

.hero-sub {
  color: var(--text-3);
  font-size: 13px;
  margin-top: 5px;
}

.hero-body {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--sep);
}

.hero-empty {
  color: var(--text-3);
  font-size: 14px;
  padding: 6px 0;
}

/* ------------------------- 状态胶囊 ------------------------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 999px;
  white-space: nowrap;
  flex: none;
}

.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.pill-free {
  background: rgba(52, 199, 89, 0.13);
  color: #1a8a3c;
}
.pill-busy {
  background: rgba(255, 149, 0, 0.15);
  color: #b26a00;
}
.pill-wait {
  background: rgba(0, 122, 255, 0.12);
  color: #0060cc;
}
.pill-done {
  background: rgba(60, 60, 67, 0.08);
  color: #6c6c70;
}
.pill-cancel {
  background: rgba(60, 60, 67, 0.08);
  color: #8e8e93;
}
.pill-mine {
  background: rgba(88, 86, 214, 0.12);
  color: var(--purple);
}

/* ------------------------- 头像 ------------------------- */

.avatar {
  border-radius: 50%;
  object-fit: cover;
  background: #e5e5ea;
  flex: none;
  display: block;
}

.avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(160deg, #8fb8f0, #5b8def);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  flex: none;
}

.avatar-stack {
  display: flex;
  align-items: center;
}

.avatar-stack .avatar,
.avatar-stack .avatar-fallback {
  margin-left: -9px;
  border: 2px solid #fff;
}

.avatar-stack > :first-child {
  margin-left: 0;
}

/* ------------------------- 按钮 ------------------------- */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  height: 50px;
  border-radius: 14px;
  border: 0;
  font-size: 17px;
  font-weight: 600;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn:active {
  opacity: 0.82;
}
.btn:disabled {
  opacity: 0.4;
}

.btn-sm {
  height: 40px;
  font-size: 15px;
  border-radius: 12px;
}

.btn-secondary {
  background: rgba(120, 120, 128, 0.12);
  color: var(--blue);
}

.btn-danger {
  background: rgba(255, 59, 48, 0.1);
  color: var(--red);
}

.btn-ghost {
  background: rgba(120, 120, 128, 0.12);
  color: var(--text-2);
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.btn svg {
  width: 20px;
  height: 20px;
  flex: none;
}

.icon-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-box svg {
  width: 100%;
  height: 100%;
}

/* ------------------------- 表单 ------------------------- */

.field {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  position: relative;
  min-height: 50px;
}

.field + .field::before {
  content: "";
  position: absolute;
  left: 16px;
  right: 0;
  top: 0;
  height: 1px;
  background: var(--sep);
  transform: scaleY(0.5);
}

.field-label {
  flex: none;
  width: 68px;
  color: var(--text-2);
  font-size: 15px;
}

.field-label .req {
  color: var(--red);
  margin-left: 2px;
}

.field-body {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.field input[type="text"],
.field input[type="date"],
.field input[type="time"],
.field textarea {
  flex: 1;
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  padding: 0;
  font-size: 15px;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--text-4);
}

.field textarea {
  resize: none;
  min-height: 66px;
  line-height: 1.5;
  padding-top: 2px;
}

.field-col {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.field-col .field-label {
  width: auto;
}

.picker-link {
  color: var(--text-4);
  font-size: 15px;
  text-align: right;
  flex: 1;
}

.picker-link.filled {
  color: var(--text);
}

/* 日期时间输入 */
.dt-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.dt-row input {
  flex: 1;
  min-width: 0;
  background: rgba(120, 120, 128, 0.08);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  border: 0;
  outline: none;
}

.dt-row input:focus {
  background: rgba(0, 122, 255, 0.1);
}

.quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 1px 16px 14px;
}

.chip {
  border: 0;
  background: rgba(120, 120, 128, 0.1);
  color: var(--text-2);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 13px;
  cursor: pointer;
}

.chip:active {
  background: rgba(0, 122, 255, 0.15);
  color: var(--blue);
}

/* ------------------------- 选中人员 ------------------------- */

.people {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px 14px;
}

.person-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(120, 120, 128, 0.1);
  border-radius: 999px;
  padding: 5px 12px 5px 5px;
  font-size: 14px;
  max-width: 100%;
}

.person-chip .avatar-fallback {
  width: 24px;
  height: 24px;
  font-size: 12px;
}

.person-chip .avatar {
  width: 24px;
  height: 24px;
}

.person-chip .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 110px;
}

.person-chip .remove {
  border: 0;
  background: transparent;
  color: var(--text-3);
  font-size: 17px;
  line-height: 1;
  padding: 0 0 0 2px;
  cursor: pointer;
}

.empty-inline {
  color: var(--text-4);
  font-size: 14px;
  padding: 4px 0;
}

/* ------------------------- 冲突提示 ------------------------- */

.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.5;
  margin-bottom: 12px;
}

.alert-danger {
  background: rgba(255, 59, 48, 0.09);
  color: #b3261e;
}

.alert-success {
  background: rgba(52, 199, 89, 0.1);
  color: #1a7a36;
}

.alert-info {
  background: rgba(0, 122, 255, 0.09);
  color: #0055b3;
}

.alert-mark {
  flex: none;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.35;
}

/* ------------------------- 日历 ------------------------- */

.week-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.week-strip::-webkit-scrollbar {
  display: none;
}

.day-cell {
  flex: none;
  width: 52px;
  border: 0;
  background: var(--card);
  border-radius: 14px;
  padding: 9px 0 8px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  color: var(--text);
}

.day-cell .wd {
  font-size: 11px;
  color: var(--text-3);
}

.day-cell .dd {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.1;
}

.day-cell .cnt {
  font-size: 10px;
  color: var(--text-3);
  height: 12px;
}

.day-cell.active {
  background: var(--blue);
  color: #fff;
}

.day-cell.active .wd,
.day-cell.active .cnt {
  color: rgba(255, 255, 255, 0.85);
}

.day-cell.today .dd::after {
  content: "";
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--blue);
  margin: 2px auto 0;
}

.day-cell.active.today .dd::after {
  background: #fff;
}

/* 时间轴 */

.tl-wrap {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 14px 14px 14px 0;
  overflow: hidden;
}

.tl {
  position: relative;
  padding-left: 56px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-height: 420px;
}

.tl-line {
  position: absolute;
  left: 56px;
  right: 10px;
  border-top: 1px solid rgba(60, 60, 67, 0.09);
  height: 0;
}

.tl-line span {
  position: absolute;
  left: -50px;
  top: -8px;
  width: 40px;
  text-align: right;
  font-size: 11px;
  color: var(--text-3);
}

.tl-block {
  position: absolute;
  left: 56px;
  right: 10px;
  border-radius: 10px;
  padding: 7px 10px;
  overflow: hidden;
  color: #fff;
  font-size: 12px;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.tl-block.mine {
  background: var(--blue);
}
.tl-block.other {
  background: #98a2b3;
}
.tl-block.running {
  background: var(--orange);
}

.tl-block .t1 {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tl-block .t2 {
  opacity: 0.92;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
}

.tl-now {
  position: absolute;
  left: 56px;
  right: 10px;
  height: 0;
  border-top: 1.5px solid var(--red);
}

.tl-now::before {
  content: "";
  position: absolute;
  left: -4px;
  top: -3.5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
}

.tl-empty {
  padding: 30px 0;
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
}

/* ------------------------- 空状态 / 加载 ------------------------- */

.empty {
  text-align: center;
  color: var(--text-3);
  padding: 56px 20px;
  font-size: 14px;
  line-height: 1.7;
}

.empty .icon {
  font-size: 34px;
  margin-bottom: 10px;
  opacity: 0.4;
}

.page-loading {
  text-align: center;
  color: var(--text-3);
  padding: 60px 0;
  font-size: 14px;
}

.loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.12);
  z-index: 200;
}

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ------------------------- 底部 Tab ------------------------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  padding-top: 4px;
  display: flex;
  align-items: flex-start;
  max-width: 540px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.88);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--sep);
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 44px;
  border: 0;
  background: none;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
}

.tab.active {
  color: var(--blue);
}

.tab svg {
  width: 23px;
  height: 23px;
  display: block;
}

.tab-fab {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.tab-fab button {
  width: 50px;
  height: 50px;
  margin-top: -19px;
  border-radius: 50%;
  border: 0;
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0, 122, 255, 0.42);
  cursor: pointer;
}

.tab-fab button:active {
  transform: scale(0.94);
}

.tab-fab svg {
  width: 26px;
  height: 26px;
}

/* ------------------------- 弹层 ------------------------- */

.sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade 0.18s ease;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.sheet {
  width: 100%;
  max-width: 540px;
  max-height: 84vh;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  padding-bottom: var(--safe-bottom);
  display: flex;
  flex-direction: column;
  animation: slideUp 0.24s cubic-bezier(0.32, 0.72, 0, 1);
  overflow: hidden;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 10px;
  flex: none;
}

.sheet-title {
  font-size: 17px;
  font-weight: 600;
}

.sheet-action {
  border: 0;
  background: none;
  color: var(--blue);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
}

.sheet-search {
  padding: 0 16px 10px;
  flex: none;
}

.sheet-search input {
  width: 100%;
  border: 0;
  background: rgba(120, 120, 128, 0.12);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 15px;
  outline: none;
}

.sheet-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 12px 16px;
}

.sheet-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--card);
  margin-bottom: 7px;
  cursor: pointer;
}

.sheet-item.selected {
  background: rgba(0, 122, 255, 0.1);
}

.sheet-item .tick {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--text-4);
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
}

.sheet-item.selected .tick {
  background: var(--blue);
  border-color: var(--blue);
}

/* ------------------------- Toast ------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 26px);
  transform: translateX(-50%);
  background: rgba(30, 30, 32, 0.92);
  color: #fff;
  font-size: 14px;
  padding: 11px 18px;
  border-radius: 12px;
  max-width: 82vw;
  text-align: center;
  z-index: 400;
  animation: fade 0.16s ease;
  line-height: 1.45;
}

/* ------------------------- 详情 ------------------------- */

.detail-rows .row {
  padding: 12px 16px;
}

.detail-rows .k {
  flex: none;
  width: 72px;
  color: var(--text-3);
  font-size: 14px;
}

.detail-rows .v {
  flex: 1;
  text-align: right;
  font-size: 15px;
  word-break: break-all;
}

.timeline-log {
  padding: 6px 16px 14px;
}

.log-item {
  display: flex;
  gap: 10px;
  font-size: 13px;
  color: var(--text-3);
  padding: 5px 0;
}

.log-item .dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-4);
  margin-top: 7px;
}

.log-item .txt b {
  color: var(--text-2);
  font-weight: 500;
}

/* ------------------------- 统计小卡 ------------------------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.stat {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 14px 10px;
  text-align: center;
}

.stat .n {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.15;
}

.stat .l {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 3px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
}

.bar-row .nm {
  flex: none;
  width: 84px;
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-row .bar {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: rgba(120, 120, 128, 0.12);
  overflow: hidden;
}

.bar-row .bar i {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--blue);
}

.bar-row .num {
  flex: none;
  width: 30px;
  text-align: right;
  font-size: 13px;
  color: var(--text-3);
}

/* ------------------------- 工具类 ------------------------- */

.muted {
  color: var(--text-3);
}
.small {
  font-size: 13px;
}
.tiny {
  font-size: 12px;
}
.mt8 {
  margin-top: 8px;
}
.mt12 {
  margin-top: 12px;
}
.mt16 {
  margin-top: 16px;
}
.mb0 {
  margin-bottom: 0;
}
.nowrap {
  white-space: nowrap;
}
