:root {
  --bg: #f4f6f4;
  --card: #ffffff;
  --primary: #1d9e75;
  --primary-dark: #0f6e56;
  --primary-soft: #e1f5ee;
  --text: #23231e;
  --muted: #8a8a80;
  --border: #e5e7e1;
  --danger: #e24b4a;
  --danger-soft: #fcebeb;
  --amber: #b9770f;
  --amber-soft: #faeeda;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(20, 40, 30, .06);
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5;
}
input, select, textarea, button { font-family: inherit; font-size: 15px; color: inherit; }
button { cursor: pointer; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 218px; background: var(--card); border-right: 1px solid var(--border);
  padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: none; flex-direction: column; gap: 4px;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; }
.sidebar .logo {
  width: 38px; height: 38px; border-radius: 11px; background: var(--primary);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 19px; flex-shrink: 0;
}
.sidebar .brand b { font-size: 16px; font-weight: 600; display: block; line-height: 1.3; }
.sidebar .brand small { color: var(--muted); font-size: 12px; }
.sidebar a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  color: var(--text); text-decoration: none; font-size: 14.5px;
}
.sidebar a svg { width: 19px; height: 19px; stroke: var(--muted); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.sidebar a.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.sidebar a.active svg { stroke: var(--primary); }
.sidebar .foot { margin-top: auto; padding: 10px 12px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--border); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 12px 18px;
  background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 17px; font-weight: 600; flex: 1; }
.topbar .who { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.topbar .who b { color: var(--text); font-weight: 600; }
.content { padding: 16px; max-width: 980px; width: 100%; margin: 0 auto; flex: 1; }

/* 底部导航（移动端） */
.bottombar {
  display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: var(--card); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom);
}
.bottombar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0 6px; color: var(--muted); text-decoration: none; font-size: 11px;
}
.bottombar a svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bottombar a.active { color: var(--primary); font-weight: 600; }

/* ---------- 组件 ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card h3 { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.stat {
  flex: 1 1 130px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px; min-width: 130px;
}
.stat .num { font-size: 24px; font-weight: 700; margin-top: 4px; letter-spacing: -0.5px; }
.stat .lbl { font-size: 12.5px; color: var(--muted); }
.stat.green .num { color: var(--primary-dark); }
.stat.dark .num { color: var(--text); }
.stat.red .num { color: var(--danger); }
.chip {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px;
  background: var(--primary-soft); color: var(--primary-dark);
}
.chip.mt { background: #faeeda; color: #854f0b; }
.chip.dy { background: #23231e; color: #fff; }
.chip.off { background: #eef0f3; color: #4a5568; }
.chip.vip { background: #fbeaf0; color: #993556; }
.chip.bad { background: var(--danger-soft); color: var(--danger); }
.chip.ok { background: #e6f4ea; color: #1a7a3e; }
/* 订单详情键值行 */
.kv-row { display:flex; justify-content:space-between; align-items:center; padding:8px 0; border-bottom:1px solid var(--border); }
.kv-row .k { color:var(--muted); font-size:12.5px; white-space:nowrap; }
.kv-row .v { font-size:13.5px; text-align:right; word-break:break-all; }
.detail-grid { display:grid; grid-template-columns:1fr 1fr; gap:0 16px; }
@media (max-width:559px) { .detail-grid { grid-template-columns:1fr; } }
.list-item.clickable .grow { cursor:pointer; }
.list-item.clickable .grow:active { opacity:.6; }

label.f { display: block; margin-bottom: 12px; }
label.f small { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
input[type=text], input[type=number], input[type=password], input[type=date], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: #fff; outline: none; transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 10px; border: none; background: var(--primary); color: #fff;
  font-size: 15px; font-weight: 600; transition: opacity .15s;
}
.btn:active { opacity: .8; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--primary-dark); border: 1.5px solid var(--primary); }
.btn.danger { background: var(--danger); }
.btn.soft { background: var(--primary-soft); color: var(--primary-dark); }
.btn.sm { padding: 5px 12px; font-size: 13px; border-radius: 8px; font-weight: 500; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.list-item {
  display: flex; align-items: center; gap: 12px; padding: 13px 4px;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .t { font-weight: 600; font-size: 15px; }
.list-item .s { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.list-item .amt { font-weight: 700; font-size: 16px; text-align: right; }
.list-item .amt small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl tr:last-child td { border-bottom: none; }
.tbl .r { text-align: right; }
.tbl-wrap { overflow-x: auto; }
.day-summary:hover { background: var(--bg-soft, #f5f7fa); }
.day-toggle { display: inline-block; width: 16px; font-size: 11px; color: var(--muted); transition: transform .15s; }
.day-detail > td { background: var(--bg-soft, #fafbfc); }
.day-detail table.tbl td { border-bottom: 1px solid var(--border); font-size: 12.5px; }

.empty { text-align: center; color: var(--muted); padding: 36px 0; font-size: 14px; }
.calc-hint {
  margin-top: 10px; padding: 10px 12px; border-radius: 10px;
  background: var(--primary-soft); color: var(--primary-dark);
  font-size: 13px; line-height: 1.6; word-break: break-all;
}
.alert { padding: 10px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 12px; }
.alert.err { background: var(--danger-soft); color: var(--danger); }
.alert.ok { background: var(--primary-soft); color: var(--primary-dark); }

/* 登录页 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 32px 26px; }
.login-card .logo {
  width: 56px; height: 56px; border-radius: 16px; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 27px; margin: 0 auto 14px;
}
.login-card h2 { text-align: center; font-size: 18px; margin-bottom: 4px; }
.login-card .sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 24px; }

/* toast */
#toast {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%) translateY(-80px);
  background: rgba(30, 30, 26, .92); color: #fff; padding: 10px 20px; border-radius: 999px;
  font-size: 14px; z-index: 99; transition: transform .25s; max-width: 86vw; text-align: center;
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(20, 25, 22, .45); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: var(--card); width: 100%; max-width: 560px; border-radius: 18px 18px 0 0;
  padding: 22px 20px 30px; max-height: 85vh; overflow-y: auto;
}
@media (min-width: 560px) {
  .modal-mask { align-items: center; }
  .modal { border-radius: 18px; }
}

/* 服务选择 */
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.svc-cat { margin-bottom: 16px; }
.svc-cat:last-child { margin-bottom: 0; }
.svc-cat-title { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 700; color: var(--primary-dark); margin-bottom: 8px; }
.svc-cat-title::before { content: ''; width: 4px; height: 13px; border-radius: 2px; background: var(--primary); }
.svc-cat-title span { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.svc-item {
  border: 1.5px solid var(--border); border-radius: 12px; padding: 12px; text-align: center;
  background: #fff; transition: all .12s;
}
.svc-item.on { border-color: var(--primary); background: var(--primary-soft); }
.svc-item b { display: block; font-size: 14.5px; }
.svc-item .p { color: var(--primary-dark); font-weight: 700; margin-top: 3px; font-size: 15px; }
.svc-item .d { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.quick-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 14px 6px 10px; border-radius: 14px;
  background: #fff; border: 1px solid var(--border);
  transition: all .12s; cursor: pointer;
}
.quick-card:hover { border-color: var(--primary); background: var(--primary-soft); transform: translateY(-1px); }
.quick-card:active { transform: scale(0.97); }
.quick-ico { width: 56px; height: 56px; object-fit: contain; margin-bottom: 6px; }
.quick-card b { font-size: 13.5px; font-weight: 600; color: var(--text); }
@media (max-width: 480px) { .quick-ico { width: 48px; height: 48px; } .quick-card b { font-size: 12.5px; } }

.range { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 14px; flex-wrap: wrap; }
.range .f { flex: 1; min-width: 120px; margin-bottom: 0; }

@media (min-width: 900px) {
  .sidebar { display: flex; }
  .bottombar { display: none; }
  .content { padding: 24px; }
}
@media (max-width: 899px) {
  .content { padding-bottom: 76px; }
}
