:root {
  --ink: #10262f;
  --muted: #71838a;
  --line: #dfe9e8;
  --paper: #f3f7f5;
  --card: #ffffff;
  --navy: #0b1f2a;
  --teal: #0c8f85;
  --teal-dark: #08776f;
  --teal-soft: #e2f5f1;
  --orange: #f28b4b;
  --orange-soft: #fff0e6;
  --red: #d45c5c;
  --red-soft: #fcebec;
  --blue: #477bce;
  --blue-soft: #eaf1fd;
  --shadow: 0 18px 45px rgba(18, 48, 57, .08);
}

* { box-sizing: border-box; }
html { background: var(--navy); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  color: var(--ink);
  background:
    radial-gradient(circle at 78% 0, rgba(12, 143, 133, .18), transparent 34%),
    linear-gradient(to bottom, #0b1f2a 0, #0e2a34 300px, var(--paper) 301px, var(--paper) 100%);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
button, input, select { outline: none; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  box-shadow: 0 0 0 3px rgba(12, 143, 133, .24);
}
.hidden { display: none !important; }

.driver-shell {
  width: min(100%, 1040px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px calc(26px + env(safe-area-inset-bottom));
}
.driver-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  margin-bottom: 22px;
  color: white;
}
.driver-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: white;
  text-decoration: none;
}
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 14px;
  color: var(--navy);
  background: var(--orange);
  font-weight: 950;
  letter-spacing: -.05em;
  box-shadow: 0 8px 22px rgba(242, 139, 75, .24);
}
.driver-brand strong, .driver-brand small { display: block; }
.driver-brand strong { font-size: 16px; letter-spacing: .01em; }
.driver-brand small { margin-top: 3px; color: #8faab2; font-size: 10px; letter-spacing: .2em; }
.header-actions { display: flex; align-items: center; gap: 9px; }
.sync-pill {
  min-height: 30px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 999px;
  color: #cae0df;
  background: rgba(255,255,255,.06);
  font-size: 10px;
  white-space: nowrap;
}
.sync-pill i { width: 7px; height: 7px; border-radius: 50%; background: #5ad3ab; box-shadow: 0 0 0 4px rgba(90,211,171,.1); }
.sync-pill.saving i { background: #ffc06a; }
.sync-pill.offline i { background: #ef7777; }
.avatar-button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 12px;
  color: white;
  background: rgba(255,255,255,.12);
  font-weight: 800;
}
.install-mini {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px;
  color: #d9e8e8;
  background: rgba(255,255,255,.07);
  font-size: 10px;
  font-weight: 700;
}

.driver-main { display: grid; gap: 15px; }
.entry-column, .history-column { min-width: 0; display: grid; gap: 15px; align-content: start; }
.welcome-card {
  min-height: 164px;
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
  overflow: hidden;
  border-radius: 24px;
  color: white;
  background:
    radial-gradient(circle at 90% 0, rgba(242,139,75,.24), transparent 35%),
    linear-gradient(130deg, #123543, #0b1f2a 68%);
  box-shadow: 0 18px 40px rgba(5, 25, 33, .22);
  position: relative;
}
.welcome-card::after {
  content: "";
  position: absolute;
  right: -42px;
  bottom: -78px;
  width: 180px;
  height: 180px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 50%;
  box-shadow: 0 0 0 30px rgba(255,255,255,.025), 0 0 0 62px rgba(255,255,255,.016);
}
.eyebrow { margin: 0; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .17em; }
.welcome-card .eyebrow { color: #82a5ab; }
.welcome-card h1 { margin: 8px 0 6px; font-size: clamp(25px, 6vw, 34px); letter-spacing: -.04em; }
.welcome-card p:not(.eyebrow) { margin: 0; max-width: 460px; color: #a8c0c4; font-size: 12px; line-height: 1.65; }
.driver-identity {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}
.driver-identity > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--orange);
  background: rgba(242,139,75,.13);
  font-weight: 800;
}
.driver-identity strong, .driver-identity small { display: block; }
.driver-identity strong { font-size: 14px; }
.driver-identity small { margin-top: 3px; color: #8faab2; font-size: 10px; }

.entry-card, .history-card {
  padding: 21px 18px;
  border: 1px solid rgba(221,233,232,.88);
  border-radius: 22px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.section-title {
  margin: 23px 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.section-title:first-child { margin-top: 0; }
.section-title > div { display: flex; align-items: center; gap: 9px; }
.section-title h2 { margin: 0; font-size: 16px; letter-spacing: -.02em; }
.step { color: var(--teal); font-size: 10px; font-weight: 900; }
.required-note { color: #9aabad; font-size: 10px; }
.vehicle-picker { position: relative; display: block; }
.vehicle-picker select {
  width: 100%;
  height: 56px;
  padding: 0 44px 0 15px;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 15px;
  color: var(--ink);
  background: #f9fbfa;
  font-size: 16px;
  font-weight: 700;
}
.select-arrow {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-58%);
  color: var(--teal);
  font-size: 22px;
  pointer-events: none;
}
.vehicle-meta { margin: 9px 2px 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.category-title { margin-top: 25px; }
.category-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.category-button {
  min-height: 84px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: #fbfcfb;
  text-align: left;
  transition: .18s ease;
}
.category-button:active { transform: scale(.98); }
.category-button span:last-child { min-width: 0; }
.category-button strong, .category-button small { display: block; }
.category-button strong { font-size: 14px; }
.category-button small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.category-icon {
  width: 37px;
  height: 37px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 900;
}
.category-button.expense .category-icon { color: var(--red); background: var(--red-soft); }
.category-button.income .category-icon { color: var(--teal); background: var(--teal-soft); }
.category-button.active { border-color: rgba(12,143,133,.44); background: #f4fcfa; box-shadow: inset 0 0 0 1px rgba(12,143,133,.12); }
.category-button.expense.active { border-color: rgba(212,92,92,.4); background: #fff7f7; box-shadow: inset 0 0 0 1px rgba(212,92,92,.08); }
.income-details {
  display: grid;
  gap: 14px;
  margin-top: 15px;
  padding: 14px;
  border: 1px solid #d8e9e5;
  border-radius: 15px;
  background: #f5fbf9;
}
.choice-section { display: grid; gap: 8px; }
.choice-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.choice-label span { font-size: 11px; font-weight: 800; }
.choice-label small { color: var(--muted); font-size: 9px; }
.choice-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.choice-buttons.payment-choices { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.choice-buttons button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  background: white;
  font-size: 12px;
  font-weight: 700;
}
.choice-buttons button.active { color: var(--teal); border-color: rgba(12,143,133,.45); background: var(--teal-soft); box-shadow: inset 0 0 0 1px rgba(12,143,133,.1); }
.amount-title { margin-top: 25px; }
.type-hint {
  min-width: 42px;
  padding: 5px 9px;
  border-radius: 999px;
  text-align: center;
  font-size: 10px;
  font-weight: 800;
}
.type-hint.expense { color: var(--red); background: var(--red-soft); }
.type-hint.income { color: var(--teal); background: var(--teal-soft); }
.amount-field {
  height: 76px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid #cbdcd9;
  border-radius: 17px;
  background: #f9fbfa;
}
.amount-field > span { color: var(--muted); font-size: 24px; font-weight: 700; }
.amount-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
}
.amount-field input::placeholder { color: #b9c6c5; }
.amount-suffix { color: var(--muted); font-size: 17px; font-weight: 800; white-space: nowrap; }
.amount-field input::-webkit-outer-spin-button,
.amount-field input::-webkit-inner-spin-button { margin: 0; -webkit-appearance: none; }
.evidence-title { margin-top: 25px; }
.required-badge {
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--red);
  background: var(--red-soft);
  font-size: 9px;
  font-weight: 800;
}
.evidence-panel {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #f9fbfa;
}
.evidence-copy strong { display: block; font-size: 12px; }
.evidence-copy p { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.photo-upload-button {
  min-height: 74px;
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  border: 1px dashed #a9ccc5;
  border-radius: 13px;
  color: var(--teal);
  background: #f2fbf8;
  cursor: pointer;
}
.photo-upload-button > span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--teal-soft);
  font-size: 20px;
  font-weight: 500;
}
.photo-upload-button strong { font-size: 11px; }
.photo-upload-button small { width: 100%; margin-top: -5px; color: #8a9d9e; text-align: center; font-size: 9px; }
.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.photo-item { position: relative; overflow: hidden; aspect-ratio: 1; border-radius: 11px; background: #e8efed; }
.photo-item img { width: 100%; height: 100%; display: block; object-fit: cover; }
.photo-item button {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 25px;
  height: 25px;
  border: 0;
  border-radius: 8px;
  color: white;
  background: rgba(6,25,31,.72);
  font-size: 15px;
}
.photo-item span {
  position: absolute;
  left: 5px;
  bottom: 5px;
  padding: 3px 6px;
  border-radius: 6px;
  color: white;
  background: rgba(6,25,31,.72);
  font-size: 8px;
}
.upload-status { min-height: 15px; margin: 9px 0 0; color: var(--muted); font-size: 9px; text-align: center; }
.optional-fields { margin-top: 17px; border-top: 1px dashed var(--line); }
.optional-fields summary {
  padding: 16px 2px 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  list-style: none;
}
.optional-fields summary::-webkit-details-marker { display: none; }
.optional-fields summary span { color: #a9b6b6; font-weight: 500; }
.optional-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding-top: 7px; }
.optional-grid label { display: grid; gap: 7px; color: var(--muted); font-size: 10px; }
.optional-grid label.full { grid-column: 1 / -1; }
.optional-grid input {
  width: 100%;
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #fafcfb;
  font-size: 16px;
}
.submit-button {
  width: 100%;
  min-height: 56px;
  margin-top: 19px;
  padding: 0 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-radius: 16px;
  color: white;
  background: var(--teal);
  font-size: 15px;
  font-weight: 850;
  box-shadow: 0 12px 26px rgba(12,143,133,.2);
}
.submit-button:active { background: var(--teal-dark); transform: scale(.99); }
.submit-button:disabled { cursor: not-allowed; filter: grayscale(.45); opacity: .62; }
.submit-arrow {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(255,255,255,.13);
  font-size: 18px;
}
.submit-help { margin: 10px 0 0; color: #8c9d9f; text-align: center; font-size: 10px; line-height: 1.5; }

.history-column { padding-top: 0; }
.history-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.history-head h2 { margin: 5px 0 0; font-size: 20px; letter-spacing: -.03em; }
.history-head > span { color: var(--teal); font-size: 11px; font-weight: 800; }
.today-summary { margin-top: 17px; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.today-summary > div { padding: 13px; border-radius: 13px; background: #f7faf9; }
.today-summary span, .today-summary strong { display: block; }
.today-summary span { color: var(--muted); font-size: 9px; }
.today-summary strong { margin-top: 5px; font-size: 16px; font-variant-numeric: tabular-nums; }
.expense-text { color: var(--red); }
.income-text { color: var(--teal); }
.history-list { display: grid; gap: 8px; margin-top: 15px; }
.history-item {
  padding: 12px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid #edf2f1;
  border-radius: 13px;
  background: #fbfcfc;
}
.history-item > i {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}
.history-item.expense > i { color: var(--red); background: var(--red-soft); }
.history-item.income > i { color: var(--teal); background: var(--teal-soft); }
.history-item strong, .history-item small { display: block; }
.history-item strong { font-size: 12px; }
.history-item small { margin-top: 4px; color: var(--muted); font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-item > b { font-size: 13px; font-variant-numeric: tabular-nums; }
.history-item.expense > b { color: var(--red); }
.history-item.income > b { color: var(--teal); }
.history-empty { min-height: 132px; display: grid; place-items: center; align-content: center; color: var(--muted); text-align: center; }
.history-empty > span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; color: var(--teal); background: var(--teal-soft); font-weight: 800; }
.history-empty p { margin: 9px 0 0; color: var(--ink); font-size: 12px; font-weight: 700; }
.history-empty small { margin-top: 4px; font-size: 9px; }
.manager-link {
  min-height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d8e5e3;
  border-radius: 13px;
  color: var(--ink);
  background: rgba(255,255,255,.72);
  text-decoration: none;
  font-size: 11px;
  font-weight: 700;
}
.security-note { margin: 0; color: #8a9b9d; text-align: center; font-size: 9px; line-height: 1.6; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 70;
  max-width: calc(100% - 32px);
  padding: 12px 17px;
  border-radius: 13px;
  color: white;
  background: var(--navy);
  box-shadow: 0 14px 34px rgba(5,25,33,.24);
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.success { background: var(--teal); }

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
  overflow-y: auto;
  background:
    radial-gradient(circle at 80% 10%, rgba(12,143,133,.22), transparent 32%),
    linear-gradient(145deg, #0b1f2a, #102f3a);
}
.auth-card {
  width: min(100%, 390px);
  padding: 28px 23px 24px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 24px;
  color: white;
  background: rgba(17, 48, 59, .93);
  box-shadow: 0 28px 70px rgba(0,0,0,.28);
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.auth-brand strong, .auth-brand small { display: block; }
.auth-brand strong { font-size: 17px; }
.auth-brand small { margin-top: 3px; color: #90acb2; font-size: 10px; letter-spacing: .15em; }
.auth-card .eyebrow { color: #85a8ae; }
.auth-card h2 { margin: 8px 0 8px; font-size: 27px; letter-spacing: -.04em; }
.auth-copy { margin: 0 0 22px; color: #a9bec2; font-size: 11px; line-height: 1.6; }
.auth-card form { display: grid; gap: 14px; }
.auth-card label { display: grid; gap: 7px; color: #cfe0e1; font-size: 10px; font-weight: 700; }
.auth-card input {
  width: 100%;
  height: 50px;
  padding: 0 13px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 13px;
  color: white;
  background: rgba(255,255,255,.07);
  font-size: 16px;
}
.auth-card input::placeholder { color: #6f8b91; }
.phone-input { display: flex; overflow: hidden; border: 1px solid rgba(255,255,255,.12); border-radius: 13px; background: rgba(255,255,255,.07); }
.phone-input i { min-width: 48px; display: grid; place-items: center; color: #9eb6bb; border-right: 1px solid rgba(255,255,255,.08); font-size: 12px; font-style: normal; }
.phone-input input { height: 49px; border: 0; background: transparent; border-radius: 0; }
.auth-card form button {
  min-height: 52px;
  margin-top: 4px;
  border: 0;
  border-radius: 14px;
  color: #08242a;
  background: #5cc7ad;
  font-size: 14px;
  font-weight: 850;
}
.auth-card form button:disabled { cursor: wait; opacity: .65; }
.auth-help { min-height: 18px; margin: 14px 0 0; color: #8fa9af; text-align: center; font-size: 10px; line-height: 1.5; }
.install-auth-button {
  width: 100%;
  min-height: 43px;
  margin-top: 10px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  color: #bcd4d4;
  background: rgba(255,255,255,.05);
  font-size: 11px;
  font-weight: 700;
}
.install-sheet {
  position: fixed;
  inset: 0;
  z-index: 120;
  padding: 20px 16px max(20px, env(safe-area-inset-bottom));
  display: grid;
  place-items: end center;
  background: rgba(4, 17, 23, .68);
  backdrop-filter: blur(6px);
}
.install-sheet-card {
  position: relative;
  width: min(100%, 430px);
  padding: 25px 21px 20px;
  border-radius: 23px;
  background: white;
  box-shadow: 0 24px 60px rgba(0,0,0,.28);
}
.install-sheet-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: #f1f5f4;
  font-size: 20px;
}
.install-mark {
  width: 48px;
  height: 48px;
  margin-bottom: 17px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  color: var(--navy);
  background: var(--orange);
  font-size: 14px;
  font-weight: 950;
}
.install-sheet-card h2 { margin: 7px 0 9px; font-size: 23px; letter-spacing: -.04em; }
.install-guide-text { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.65; }
.install-steps { margin: 16px 0; padding: 0; display: grid; gap: 10px; list-style: none; counter-reset: install-step; }
.install-steps li {
  counter-increment: install-step;
  padding: 12px 12px 12px 42px;
  position: relative;
  border-radius: 12px;
  color: #425a60;
  background: #f5f9f8;
  font-size: 11px;
  line-height: 1.55;
}
.install-steps li::before {
  content: counter(install-step);
  position: absolute;
  left: 12px;
  top: 11px;
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--teal);
  background: var(--teal-soft);
  font-size: 9px;
  font-weight: 900;
}
.install-open-browser, .install-sheet-done {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 13px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
}
.install-open-browser { margin-bottom: 9px; color: white; background: var(--teal); }
.install-sheet-done { color: var(--ink); background: #edf3f2; }

@media (min-width: 760px) {
  .driver-shell { padding-inline: 28px; }
  .driver-main { grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
  .history-column { position: sticky; top: 20px; }
  .welcome-card { padding: 29px; }
  .entry-card, .history-card { padding: 24px; }
}

@media (max-width: 390px) {
  .driver-shell { padding-inline: 12px; }
  .entry-card, .history-card { padding-inline: 15px; border-radius: 19px; }
  .category-button { min-height: 78px; padding: 10px; gap: 8px; }
  .category-icon { width: 33px; height: 33px; }
  .category-button strong { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
