:root {
  --brand: #0B6B58;
  --brand-dark: #074C40;
  --mint: #E9F6F1;
  --ink: #16302A;
  --muted: #6C817B;
  --line: #DCE8E3;
  --bg: #F4F7F6;
  --danger: #B4473B;
  --warn: #A66B12;
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
}
button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: rgba(244, 247, 246, .94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.logo {
  width: 38px; height: 38px; flex: none;
  border-radius: 11px;
  background: linear-gradient(145deg, #0C7A63, #074C40);
  color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 19px;
  box-shadow: 0 4px 12px rgba(11, 107, 88, .22);
}
.brand-text { min-width: 0; }
.brand-text h1 { margin: 0; font-size: 16px; letter-spacing: .3px; white-space: nowrap; }
.brand-text p { margin: 1px 0 0; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.icon-btn {
  border: 1px solid var(--line); background: #fff; color: var(--brand-dark);
  min-width: 48px; height: 36px; padding: 0 12px; border-radius: 10px;
  font-size: 12.5px; font-weight: 600;
}
.icon-btn:active { background: var(--mint); }

main { padding: 12px 14px 0; max-width: 760px; margin: 0 auto; }

.notice {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 14px; margin: 0 0 12px;
  border-radius: var(--radius);
  background: #FFF8E8; border: 1px solid #F0DCAE; color: #74520C;
  font-size: 12.5px;
}
.notice b { font-size: 13px; }
.notice span { line-height: 1.55; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 11px 13px; min-width: 0;
}
.stat span { display: block; font-size: 11.5px; color: var(--muted); }
.stat strong { display: block; margin-top: 2px; font-size: 21px; letter-spacing: .2px; }
.stat.wide { grid-column: span 2; background: linear-gradient(145deg, #0B6B58, #084C3F); border: 0; color: #fff; }
.stat.wide span { color: rgba(255,255,255,.72); }
.stat.wide strong { color: #fff; font-size: 25px; }

.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.search {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px;
  background: #fff; border: 1px solid var(--line); border-radius: 11px; padding: 0 10px;
}
.search span { color: var(--muted); font-size: 17px; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: 10px 0; color: var(--ink); }
.install {
  border: 0; background: var(--brand); color: #fff; border-radius: 11px;
  padding: 0 12px; height: 40px; font-size: 12px; font-weight: 700; white-space: nowrap;
}
.install:active { background: var(--brand-dark); }

.chips { display: flex; gap: 7px; overflow-x: auto; padding: 0 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: #fff; color: #425A54;
  border-radius: 999px; padding: 6px 13px; font-size: 12.5px; white-space: nowrap;
}
.chip.active { background: var(--brand-dark); color: #fff; border-color: var(--brand-dark); }

.list { display: flex; flex-direction: column; gap: 10px; }
.card {
  width: 100%; text-align: left; border: 1px solid var(--line); background: #fff;
  border-radius: var(--radius); padding: 13px 14px 12px; color: var(--ink);
  box-shadow: 0 1px 2px rgba(10, 40, 32, .03);
}
.card:active { border-color: #B9D8CE; background: #FBFEFC; }
.card-top { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.no { font-weight: 800; font-size: 14px; letter-spacing: .2px; }
.pill {
  font-size: 10.5px; border-radius: 999px; padding: 2px 8px; border: 1px solid transparent;
  background: #EEF3F1; color: #4C625B;
}
.pill.active { background: #E9F6EF; color: #1C6E4E; border-color: #C7E6D6; }
.pill.done { background: #EEF1F5; color: #53647A; }
.pill.unsettled { background: #FFF4E5; color: #9A6110; }
.pill.settled { background: #E9F6F1; color: #0B6B58; }
.card-site { margin-top: 7px; font-weight: 600; font-size: 13.5px; }
.card-customer { color: var(--muted); font-size: 12px; margin-top: 1px; }
.veh-line { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 7px; }
.veh {
  font-size: 11px; background: var(--mint); color: #12604E; border-radius: 6px;
  padding: 1px 7px; font-weight: 700;
}
.card-bottom { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--line); }
.money-label { font-size: 10.5px; color: var(--muted); }
.money-value { font-weight: 800; font-size: 15px; }
.balance { color: var(--danger); }
.balance.zero { color: var(--brand); }
.due { text-align: right; font-size: 11px; color: var(--muted); line-height: 1.5; }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty.hidden { display: none; }
.empty-logo {
  width: 54px; height: 54px; border-radius: 16px; margin: 0 auto 12px;
  background: var(--mint); color: var(--brand); display: grid; place-items: center;
  font-size: 26px; font-weight: 800;
}
.empty b { display: block; color: var(--ink); margin-bottom: 3px; }
.empty span { font-size: 12.5px; }
.foot-note { text-align: center; color: #93A49F; font-size: 11px; padding: 18px 0 8px; }

.sheet-wrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg { position: absolute; inset: 0; background: rgba(8, 24, 20, .42); backdrop-filter: blur(2px); }
.sheet {
  position: relative; width: 100%; max-width: 760px; max-height: 88vh;
  background: #fff; border-radius: 20px 20px 0 0; overflow: hidden;
  display: flex; flex-direction: column;
  animation: rise .18s ease-out;
}
@keyframes rise { from { transform: translateY(18px); opacity: .7; } to { transform: translateY(0); opacity: 1; } }
.sheet-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 16px 16px 12px; border-bottom: 1px solid var(--line);
}
.sheet-head h2 { margin: 0; font-size: 17px; }
.sheet-head p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.sheet-body { overflow-y: auto; padding: 14px 16px calc(22px + env(safe-area-inset-bottom)); }
.block { margin-bottom: 16px; }
.block h3 { margin: 0 0 7px; font-size: 13px; color: var(--brand-dark); }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.kv .k { color: var(--muted); font-size: 11.5px; }
.kv .v { font-size: 12.5px; text-align: right; word-break: break-word; }
.row-line { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 12.5px; }
.row-line:last-child { border-bottom: 0; }
.row-line .r { text-align: right; }
.total-big { font-size: 20px; font-weight: 800; color: var(--brand-dark); }
.badge-danger { color: var(--danger); font-weight: 800; }
.badge-brand { color: var(--brand); font-weight: 800; }
.veh-card { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 9px; }
.veh-card .vh { display: flex; justify-content: space-between; gap: 8px; font-weight: 800; margin-bottom: 6px; }
.remarks { background: #F7FAF9; border-radius: 10px; padding: 9px 11px; color: #425A54; font-size: 12.5px; white-space: pre-wrap; }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 80;
  background: rgba(16, 40, 34, .94); color: #fff; border-radius: 999px;
  padding: 9px 16px; font-size: 12.5px; white-space: nowrap;
}

@media (min-width: 560px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .stat.wide { grid-column: auto; }
  .list { display: grid; grid-template-columns: 1fr 1fr; }
  .card { height: 100%; }
  .sheet { border-radius: 18px; margin-bottom: 24px; }
}

.top-actions { display: flex; align-items: center; gap: 6px; }
.top-action {
  border: 0; background: var(--brand); color: #fff; border-radius: 10px;
  height: 36px; padding: 0 12px; font-size: 12.5px; font-weight: 800;
}
.top-action:active { background: var(--brand-dark); }
.login {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: linear-gradient(160deg, #E9F6F1, #F4F7F6 55%, #EAF2EF);
}
.login-card {
  width: 100%; max-width: 340px; background: #fff; border: 1px solid var(--line);
  border-radius: 22px; padding: 26px 22px 22px; box-shadow: 0 18px 50px rgba(10, 70, 56, .14);
}
.login-logo {
  width: 50px; height: 50px; border-radius: 14px; margin-bottom: 12px;
  background: linear-gradient(145deg, #0C7A63, #074C40); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 24px;
}
.login-card h2 { margin: 0; font-size: 21px; }
.login-card > p { margin: 3px 0 18px; color: var(--muted); font-size: 12.5px; }
.login-card label, .create-form label {
  display: block; font-size: 12px; color: var(--muted); margin-bottom: 11px;
}
.login-card input, .create-form input, .create-form select, .create-form textarea {
  width: 100%; margin-top: 5px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); padding: 10px 11px; font-size: 14px; outline: 0;
}
.login-card input:focus, .create-form input:focus, .create-form select:focus, .create-form textarea:focus {
  border-color: #8CC9B9; box-shadow: 0 0 0 3px rgba(11, 107, 88, .08);
}
.login-submit {
  width: 100%; height: 44px; border: 0; border-radius: 11px; background: var(--brand);
  color: #fff; font-weight: 800; font-size: 15px; margin-top: 2px;
}
.login-submit:active { background: var(--brand-dark); }
.login-error { min-height: 18px; margin-top: 9px; color: var(--danger); font-size: 12px; }
.create-form .block { margin-bottom: 14px; }
.create-form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.create-form textarea { resize: vertical; min-height: 68px; }
.create-actions { display: flex; gap: 8px; margin-top: 16px; }
.btn-primary, .btn-ghost {
  flex: 1; height: 44px; border-radius: 11px; font-weight: 800; font-size: 14px;
}
.btn-primary { border: 0; background: var(--brand); color: #fff; }
.btn-primary:active { background: var(--brand-dark); }
.btn-ghost { border: 1px solid var(--line); background: #fff; color: #516861; }
.mobile-agent-fab {
  position: fixed; right: 16px; bottom: calc(82px + env(safe-area-inset-bottom));
  z-index: 55; width: 48px; height: 48px; border: 0; border-radius: 50%;
  background: linear-gradient(145deg, #0B6B58, #073F35); color: #fff;
  font-size: 23px; box-shadow: 0 8px 22px rgba(7,63,53,.3);
}
.mobile-agent-fab:active { transform: scale(.96); }
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 7px 10px calc(7px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.96); border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.nav-item {
  border: 0; background: transparent; color: #748A83; font-size: 11px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0;
}
.nav-item span { font-size: 17px; line-height: 1; }
.nav-item.active { color: var(--brand); font-weight: 800; }
.agent-input {
  width: 100%; box-sizing: border-box; resize: vertical; min-height: 110px;
  border: 1px solid var(--line); border-radius: 11px; padding: 11px; font: inherit;
  font-size: 14px; outline: 0;
}
.agent-input:focus { border-color: #8CC9B9; box-shadow: 0 0 0 3px rgba(11,107,88,.08); }
.agent-example { margin-top: 7px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.agent-results { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; min-height: 4px; }
.agent-chip { font-size: 11px; border-radius: 6px; padding: 2px 7px; background: #EAF6F1; color: #0B5D4B; border: 1px solid #D3EBE1; }
.mine-card { background: #F5FBF9; border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.mine-card b { display: block; margin-bottom: 3px; }
.mine-card span { color: var(--muted); font-size: 12px; }
.mine-btn { width: 100%; height: 44px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--brand-dark); font-weight: 700; margin-bottom: 9px; }
.mine-btn.danger { color: var(--danger); }.agent-empty { color: var(--muted); font-size: 12px; }/* 顶部别再堆按钮，开单/我的走底部导航 */
#newOrderBtn, #logoutBtn { display: none !important; }
.toolbar .install { display: none !important; }
.top-actions { gap: 0; }
.top-actions .icon-btn { min-width: 42px; padding: 0 8px; }
.foot-note { padding: 12px 0 4px; font-size: 10px; }