:root {
  color-scheme: light;
  --brand: #117c72;
  --brand-dark: #0d6159;
  --ink: #17272b;
  --muted: #687b7e;
  --line: #dfeae8;
  --soft: #edf7f5;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { min-width: 320px; margin: 0; background: #f3f7f7; color: var(--ink); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
button, input, select { font: inherit; }
button, select, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.topbar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: calc(18px + env(safe-area-inset-top)) 18px 16px; background: linear-gradient(135deg, #0d6159, #13887c); color: #fff; box-shadow: 0 8px 24px rgba(12, 75, 69, .18); }
.topbar h1 { margin: 4px 0 0; font-size: 25px; letter-spacing: -.04em; }
.topbar p { margin: 2px 0 0; color: #cbeae6; font-size: 13px; }
.topbar p strong { color: #fff; font-size: 18px; }
.back-link { color: #d8f2ef; font-size: 12px; text-decoration: none; }
.quiet-button { min-height: 36px; padding: 0 12px; border: 1px solid rgba(255,255,255,.3); border-radius: 10px; background: rgba(255,255,255,.1); color: #fff; }

main { width: min(100%, 760px); margin: 0 auto; padding: 16px 14px calc(100px + env(safe-area-inset-bottom)); }
.controls { position: sticky; top: 123px; z-index: 4; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.94); box-shadow: 0 8px 22px rgba(35, 69, 73, .07); backdrop-filter: blur(10px); }
.controls label { min-width: 0; flex: 1; display: flex; align-items: center; gap: 8px; padding-left: 4px; color: var(--muted); font-size: 13px; }
.controls select { min-width: 0; flex: 1; min-height: 40px; padding: 0 8px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); }
.refresh-button { min-height: 40px; padding: 0 14px; border: 0; border-radius: 9px; background: var(--brand); color: #fff; font-weight: 700; }
.refresh-button:disabled { opacity: .55; }
.update-time { min-height: 21px; margin: 10px 3px; color: var(--muted); font-size: 12px; }
.caregiver-list { display: grid; gap: 12px; }

.caregiver-card { padding: 16px; overflow: hidden; border: 1px solid var(--line); border-radius: 17px; background: #fff; box-shadow: 0 8px 24px rgba(32, 70, 73, .055); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.person { min-width: 0; }
.caregiver-name { color: var(--ink); font-size: 20px; font-weight: 800; text-decoration: none; }
.caregiver-name[href]::after { content: "  拨号"; color: var(--brand); font-size: 11px; font-weight: 700; }
.project-name { display: inline-flex; margin-top: 5px; padding: 2px 8px; border-radius: 999px; background: var(--soft); color: var(--brand-dark); font-size: 11px; }
.status { flex: 0 0 auto; padding: 5px 9px; border-radius: 999px; background: #e8f5ff; color: #1f65a6; font-size: 12px; font-weight: 700; }
.status.ready { background: #fff0e4; color: #a24d15; }
.recipient-name { display: flex; align-items: baseline; gap: 8px; margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.recipient-name strong { color: var(--ink); font-size: 16px; }
.remaining { margin: 12px 0 7px; }
.remaining strong { display: block; font-size: 21px; letter-spacing: -.02em; }
.remaining span { display: block; margin-top: 1px; color: var(--muted); font-size: 12px; }
progress { width: 100%; height: 7px; display: block; overflow: hidden; border: 0; border-radius: 999px; background: #e6efee; }
progress::-webkit-progress-bar { background: #e6efee; }
progress::-webkit-progress-value { background: linear-gradient(90deg, #39b7a9, var(--brand)); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--brand); border-radius: 999px; }
.location { margin: 14px 0; padding-top: 12px; border-top: 1px solid #edf2f1; color: #53676a; font-size: 13px; overflow-wrap: anywhere; }
.location small { display: block; margin-top: 3px; color: #8a999b; }
.navigate-button { width: 100%; min-height: 46px; border: 0; border-radius: 12px; background: var(--soft); color: var(--brand-dark); font-weight: 800; }
.navigate-button:disabled { color: #93a09f; background: #f1f4f4; }
.empty-state { padding: 54px 24px; border: 1px dashed #cfdedc; border-radius: 18px; background: #fff; color: var(--muted); text-align: center; }
.empty-state strong { display: block; margin-bottom: 5px; color: var(--ink); font-size: 18px; }

.fast-scroll { position: fixed; right: 14px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 6; display: grid; gap: 8px; }
.fast-scroll button { width: 42px; height: 42px; border: 1px solid rgba(17,124,114,.2); border-radius: 50%; background: rgba(255,255,255,.94); color: var(--brand-dark); font-size: 20px; font-weight: 800; box-shadow: 0 7px 20px rgba(30, 70, 73, .14); }

.login-layer { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 22px; background: #eaf2f1; }
.login-card { width: min(100%, 370px); padding: 30px; border-radius: 22px; background: #fff; box-shadow: 0 24px 80px rgba(25, 67, 69, .16); }
.login-mark { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 16px; background: var(--brand); color: #fff; font-size: 24px; font-weight: 800; }
.login-card p { margin: 18px 0 0; color: var(--muted); font-size: 12px; }
.login-card h1 { margin: 2px 0 20px; font-size: 24px; }
.login-card label { display: grid; gap: 6px; margin-top: 13px; color: var(--muted); font-size: 13px; }
.login-card input { min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; outline: none; }
.login-card input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(17,124,114,.12); }
.login-card button { width: 100%; min-height: 46px; margin-top: 20px; border: 0; border-radius: 11px; background: var(--brand); color: #fff; font-weight: 800; }
.login-card output { min-height: 21px; display: block; margin-top: 10px; color: #b3261e; font-size: 13px; }

@media (min-width: 700px) {
  .topbar { padding-left: max(28px, calc((100vw - 760px) / 2)); padding-right: max(28px, calc((100vw - 760px) / 2)); }
  .caregiver-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .controls { top: 123px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .refresh-button { grid-column: 1 / -1; }
}
