:root {
  --bg: #f7f4ef;
  --panel: #ffffff;
  --line: #e6e0d7;
  --ink: #321310;
  --muted: #8a847c;
  --brand: #4a1714;
  --brand-deep: #2f0e0d;
  --lime: #f0b20e;
  --lime-deep: #d99b00;
  --shadow: 0 18px 38px rgba(71, 58, 45, 0.08);
  --soft-shadow: 0 8px 18px rgba(71, 58, 45, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(240, 178, 14, 0.12), transparent 22%),
    linear-gradient(180deg, #fbfaf7 0%, var(--bg) 100%);
  color: var(--ink);
  font: 14px/1.4 "PingFang SC", "Helvetica Neue", sans-serif;
}

.page {
  width: 768px;
  height: 100vh;
  margin: 0 auto;
  padding: 14px 18px 16px;
  position: relative;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 12px;
  background: rgba(255,255,255,.95);
  padding: 5px;
  box-shadow: var(--soft-shadow);
}

.topbar h1 {
  margin: 0;
  font-size: 18px;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.view {
  height: calc(100vh - 110px);
  overflow: auto;
  padding-bottom: 18px;
}

.auth-box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.auth-box.hidden,
.status-badge.hidden,
.view.hidden {
  display: none;
}

.mini-field {
  display: grid;
  gap: 4px;
}

.mini-field label,
.field-line label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 12px;
  border: 1px solid #d6d0c7;
  border-radius: 8px;
  background: #fffdfa;
  color: var(--ink);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.02);
}

select[multiple] {
  height: auto;
  min-height: 86px;
  padding: 8px 12px;
}

input:focus,
select:focus {
  outline: none;
  border-color: rgba(77, 129, 178, 0.7);
  box-shadow: 0 0 0 3px rgba(77, 129, 178, 0.12);
}

button {
  height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.primary {
  background: linear-gradient(180deg, #5a8dba, #4d81b2);
  color: #fff;
  box-shadow: 0 10px 20px rgba(77, 129, 178, 0.24);
}

.primary:hover {
  background: linear-gradient(180deg, #527ea5, #447299);
  transform: translateY(-1px);
}

.lime {
  background: linear-gradient(180deg, #a7ea3d, #97de2f);
  color: #fff;
  box-shadow: 0 10px 20px rgba(151, 222, 47, 0.28);
}

.lime:hover {
  background: linear-gradient(180deg, #9ce034, #8bd027);
  transform: translateY(-1px);
}

.secondary {
  background: linear-gradient(180deg, #f6efe6, #ece4d8);
  color: #6e655d;
  border: 1px solid #ded5ca;
  box-shadow: var(--soft-shadow);
}

.entry-card .secondary {
  background: linear-gradient(180deg, #f0b20e, #d99b00);
  color: #45280f;
  border: 1px solid #d99b00;
  box-shadow: 0 12px 24px rgba(240, 178, 14, 0.24);
}

.entry-card .secondary:hover {
  background: linear-gradient(180deg, #e2a300, #cb9200);
}

.entry-card .primary {
  background: linear-gradient(180deg, #f0b20e, #d99b00);
  color: #45280f;
  border: 1px solid #d99b00;
  box-shadow: 0 12px 24px rgba(240, 178, 14, 0.24);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 12px;
  background: linear-gradient(180deg, #f8f3ec, #f0e9df);
  border: 1px solid #ddd6cb;
  border-radius: 999px;
  color: #6d645b;
  font-size: 12px;
  box-shadow: var(--soft-shadow);
}

.status-badge.hide-logout button {
  display: none;
}

.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  height: 100%;
  align-content: start;
  margin-top: 10px;
}

.login-view {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 420px;
  padding: 26px 24px 22px;
  border: 1px solid #e4ddd2;
  border-radius: 18px;
  background: linear-gradient(180deg, #fffdf9, #f7f2ea);
  box-shadow: var(--soft-shadow);
}

.login-card h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.login-card p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
}

.login-card .mini-field {
  margin-bottom: 12px;
}

.login-card button {
  width: 100%;
}

.entry-card {
  padding: 22px 20px;
  border: 1px solid #e4ddd2;
  border-radius: 18px;
  background: linear-gradient(180deg, #fffdf9, #f7f2ea);
  box-shadow: var(--soft-shadow);
}

.entry-card h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.entry-card p {
  min-height: 34px;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.entry-card button {
  width: 100%;
  height: 42px;
  font-size: 16px;
}

.subnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.subnav-title {
  font-size: 16px;
  font-weight: 700;
}

.subnav-actions {
  display: flex;
  gap: 8px;
}

.section {
  margin-bottom: 10px;
}

.block-label {
  margin: 8px 0 8px;
  font-size: 16px;
  font-weight: 700;
}

.field-line {
  display: grid;
  grid-template-columns: 120px 1fr;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.field-line label {
  font-size: 17px;
  color: var(--ink);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  box-shadow: var(--soft-shadow);
  margin: 0 auto;
}

.income-table-wrap {
  display: flex;
  justify-content: center;
}

.route-section .block-label,
.route-section .income-table-wrap {
  display: none;
}

.route-readonly-row {
  margin-top: 10px;
}

.income-table-wrap table {
  max-width: 708px;
}

.income-table-wrap th,
.income-table-wrap td {
  text-align: center;
}

th,
td {
  border: 1px solid #ece6dd;
  padding: 7px 10px;
  font-size: 12px;
}

th {
  color: #6f685f;
  font-weight: 600;
  background: #faf8f4;
}

.highway-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
  margin-top: 10px;
}

.field-inline {
  display: grid;
  grid-template-columns: 150px 1fr;
  align-items: center;
  gap: 10px;
}

.field-inline label {
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
}

.title-box {
  width: 505px;
  margin: 0 auto 10px;
  height: 32px;
  border: 1px solid #ddd7ce;
  background: linear-gradient(180deg, #fffdfa, #f9f5ee);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 500;
  border-radius: 8px;
  box-shadow: var(--soft-shadow);
}

.section-panel {
  padding: 8px 10px 2px;
  border: 1px solid #e3dbcf;
  border-radius: 14px;
  box-shadow: var(--soft-shadow);
}

.fuel-panel {
  background: linear-gradient(180deg, #f7fbff, #eef5fb);
}

.mileage-panel {
  padding-bottom: 10px;
}

.expense-panel {
  background: linear-gradient(180deg, #fff8f1, #fdf0e3);
}

.weight-panel {
  background: linear-gradient(180deg, #f8fbf5, #eef6ea);
}

.triple-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 8px;
}

.triple-row .field-inline {
  grid-template-columns: 56px 1fr;
  gap: 8px;
}

.mileage-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}

.mileage-row .field-inline {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 10px;
  border: 1px solid #dfe8f0;
  border-radius: 12px;
  background: rgba(255, 255, 255, .62);
}

.mileage-row .field-inline label {
  font-size: 15px;
}

.mileage-photo-row {
  min-width: 0;
}

.mileage-photo-row label {
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}

.mileage-photo-row input {
  min-width: 0;
}

.expense-row .field-inline {
  grid-template-columns: max-content 1fr;
}

.remark-row {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 8px;
  max-width: 340px;
  margin: 0 auto 8px;
  align-items: center;
}

.remark-row label {
  color: var(--ink);
  font-weight: 700;
}

.submit-wrap {
  display: flex;
  justify-content: center;
  margin-top: 4px;
}

.submit-wrap button {
  width: 202px;
  height: 42px;
  font-size: 18px;
}

.maintenance-shell {
  max-width: 620px;
  margin: 0 auto;
  padding-top: 4px;
  height: calc(100% - 34px);
  overflow: auto;
}

.maintenance-form {
  display: grid;
  gap: 14px;
}

.maintenance-row {
  display: grid;
  grid-template-columns: 112px 1fr;
  align-items: center;
  gap: 16px;
}

.driver-hidden-field {
  display: none;
}

.repair-remark-row {
  margin-top: 54px;
}

.maintenance-row label {
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
}

.maintenance-submit {
  display: flex;
  justify-content: center;
  margin-top: 0;
}

.maintenance-gap {
  height: 22px;
}

.maintenance-submit button {
  width: 226px;
  height: 44px;
  font-size: 18px;
}

.message {
  min-height: 20px;
  margin-top: 8px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.message.error { color: #c1483e; }
.message.success { color: #2b7a55; }

.result-card {
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px solid #d6e5d5;
  border-radius: 8px;
  background: #f4fbf5;
  color: #2b7a55;
  font-size: 12px;
  box-shadow: var(--soft-shadow);
}

.maintenance-history {
  margin-top: 12px;
  padding-bottom: 10px;
}

.maintenance-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.maintenance-history-head h3 {
  margin: 0;
  font-size: 15px;
}

.maintenance-history-head span {
  color: var(--muted);
  font-size: 12px;
}

.maintenance-history-list {
  display: grid;
  gap: 8px;
}

.maintenance-record {
  padding: 9px 10px;
  border: 1px solid #e6e0d7;
  border-radius: 10px;
  background: #fffdf9;
  box-shadow: var(--soft-shadow);
}

.maintenance-record-main {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
}

.maintenance-record-main span {
  white-space: nowrap;
}

.maintenance-record-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.maintenance-record.empty {
  color: var(--muted);
  text-align: center;
}

.maintenance-history-pager {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}

.maintenance-history-pager button {
  height: 30px;
  padding: 0 12px;
  font-size: 12px;
}

@media (max-width: 760px) {
  body {
    height: auto;
    overflow: auto;
  }

  .page {
    width: 100%;
    height: auto;
    padding: 16px 14px 24px;
    overflow: visible;
  }

  .view {
    height: auto;
    overflow: visible;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .auth-box {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }

  .home-grid,
  .highway-row,
  .triple-row,
  .mileage-row,
  .field-line,
  .field-inline,
  .mileage-photo-row,
  .remark-row,
  .maintenance-row {
    grid-template-columns: 1fr;
  }

  .title-box,
  .submit-wrap button,
  .maintenance-submit button {
    width: 100%;
  }
}
