:root {
  --brand: #0B5FA5;
  --brand-d: #083F6E;
  --brand-l: #E8F2FA;
  --bg: #F4F6F9;
  --card: #FFFFFF;
  --line: #E3E8EF;
  --text: #1B2430;
  --text-2: #5A6675;
  --text-3: #8A94A3;
  --ok: #1F7A45;
  --ok-bg: #E8F5EC;
  --warn: #B25E00;
  --warn-bg: #FFF3E0;
  --danger: #C0281D;
  --danger-bg: #FDECEA;
  --gray-bg: #EEF1F5;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 32, 48, 0.06);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body { overscroll-behavior-y: contain; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; }
a { color: var(--brand); text-decoration: none; }

.boot {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; background: var(--brand-d); color: #fff;
  transition: opacity .35s;
}
.boot-mark { font-size: 22px; letter-spacing: 4px; font-weight: 600; }
.boot-sub { font-size: 13px; opacity: .72; letter-spacing: 1px; }
.boot.hide { opacity: 0; pointer-events: none; }

.shell { padding-bottom: calc(62px + var(--safe-b)); min-height: 100vh; max-width: 820px; margin: 0 auto; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--brand);
  color: #fff;
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
}
.topbar .t-title { font-size: 17px; font-weight: 600; flex: 1; }
.topbar .t-sub { font-size: 12px; opacity: .82; font-weight: 400; display: block; margin-top: 1px; }
.topbar .t-btn {
  background: rgba(255,255,255,.16); border: 0; color: #fff; border-radius: 8px;
  padding: 7px 11px; font-size: 13px; min-height: 34px;
}
.topbar .back {
  width: 34px; height: 34px; border-radius: 8px; border: 0; background: rgba(255,255,255,.16);
  color: #fff; font-size: 18px; line-height: 1; display: grid; place-items: center; padding: 0;
}

.page { padding: 12px 12px 24px; max-width: 760px; margin: 0 auto; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow);
}
.card.tap { cursor: pointer; }
.card.tap:active { background: #FAFBFC; }

.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text-2); font-size: 13px; }
.dim { color: var(--text-3); font-size: 12px; }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.mb0 { margin-bottom: 0; }

.p-title { font-size: 16px; font-weight: 600; line-height: 1.4; }
.p-sub { font-size: 12.5px; color: var(--text-2); margin-top: 3px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; padding: 2px 8px; border-radius: 20px; line-height: 1.6;
  background: var(--gray-bg); color: var(--text-2); white-space: nowrap;
}
.badge.overdue { background: var(--danger-bg); color: var(--danger); font-weight: 600; }
.badge.t1 { background: #FDE8DC; color: #A8431B; font-weight: 600; }
.badge.t3 { background: var(--warn-bg); color: var(--warn); }
.badge.t7 { background: #FFF8E1; color: #8A6100; }
.badge.done { background: var(--ok-bg); color: var(--ok); }
.badge.blocked { background: var(--gray-bg); color: var(--text-2); }
.badge.brand { background: var(--brand-l); color: var(--brand-d); }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 8px; text-align: center; }
.stat b { display: block; font-size: 20px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11.5px; color: var(--text-2); }
.stat.danger b { color: var(--danger); }
.stat.warn b { color: var(--warn); }
.stat.ok b { color: var(--ok); }

.progress { height: 6px; border-radius: 6px; background: var(--gray-bg); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand); border-radius: 6px; transition: width .3s; }
.progress.done > i { background: var(--ok); }

.section-h { font-size: 13px; color: var(--text-2); font-weight: 600; margin: 16px 4px 8px; display: flex; justify-content: space-between; align-items: center; }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 4px; margin-bottom: 8px; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: 1px solid var(--line); background: #fff; color: var(--text-2);
  border-radius: 20px; padding: 6px 12px; font-size: 13px; white-space: nowrap; min-height: 32px;
}
.tabs button.on { background: var(--brand); border-color: var(--brand); color: #fff; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(255,255,255,.97); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding-bottom: var(--safe-b);
  backdrop-filter: blur(8px);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; padding: 7px 0 6px; color: var(--text-3); font-size: 11px; min-height: 52px;
}
.tabbar a.on { color: var(--brand); }
.tabbar svg { width: 21px; height: 21px; }
.tabbar .dot {
  position: absolute; transform: translate(13px, -11px); min-width: 15px; height: 15px;
  background: var(--danger); color: #fff; border-radius: 9px; font-size: 10px;
  display: grid; place-items: center; padding: 0 4px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--text);
  border-radius: 10px; padding: 10px 14px; font-size: 15px; min-height: 44px; font-family: inherit;
}
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 500; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: #F3C9C4; background: var(--danger-bg); }
.btn.block { width: 100%; }
.btn.sm { min-height: 34px; padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn:active { opacity: .82; }
.btn[disabled] { opacity: .45; }

.field { margin-bottom: 12px; }
.field > label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 5px; }
.field > label.req::after { content: " *"; color: var(--danger); }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=tel], select, textarea {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 10px 12px; font-size: 15px; font-family: inherit; color: var(--text); min-height: 44px;
  appearance: none;
}
textarea { min-height: 76px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11,95,165,.1); }
select { background-image: linear-gradient(45deg, transparent 49%, #7A8797 50%), linear-gradient(-45deg, transparent 49%, #7A8797 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 11px;
  font-size: 13px; color: var(--text-2);
}
.chip.on { background: var(--brand-l); border-color: #A9CDE8; color: var(--brand-d); font-weight: 500; }
.chip.on::before { content: "✓ "; }

.task-row { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.task-row:last-child { border-bottom: 0; }
.task-bar { width: 3px; border-radius: 3px; background: var(--gray-bg); align-self: stretch; min-height: 40px; }
.task-bar.overdue { background: var(--danger); }
.task-bar.t1 { background: #D2662E; }
.task-bar.t3 { background: #E0A020; }
.task-bar.t7 { background: #E8C766; }
.task-bar.done { background: var(--ok); }
.task-bar.blocked { background: #B4BCC7; }

.tl { position: relative; padding-left: 20px; }
.tl::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 14px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: -18px; top: 5px; width: 9px; height: 9px;
  border-radius: 50%; background: #fff; border: 2px solid var(--brand);
}
.tl-item.fu::before { border-color: var(--ok); }
.tl-item.other::before { border-color: #A7B0BC; }

.sheet-mask {
  position: fixed; inset: 0; background: rgba(12, 22, 34, .42); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center; animation: fade .18s;
}
.sheet {
  background: #fff; width: 100%; max-width: 760px; border-radius: 16px 16px 0 0;
  padding: 14px 14px calc(14px + var(--safe-b)); max-height: 92vh; overflow-y: auto;
  animation: up .22s cubic-bezier(.2,.8,.3,1);
}
.sheet h3 { font-size: 16px; margin-bottom: 12px; }
@keyframes fade { from { opacity: 0 } }
@keyframes up { from { transform: translateY(28px); opacity: .6 } }

.toast-root { position: fixed; left: 0; right: 0; bottom: calc(76px + var(--safe-b)); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  background: rgba(24, 34, 46, .93); color: #fff; padding: 9px 16px; border-radius: 20px;
  font-size: 13.5px; max-width: 82%; text-align: center; animation: fade .2s;
}

.login-wrap { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 28px 22px 40px; max-width: 420px; margin: 0 auto; }
.login-logo { width: 54px; height: 54px; border-radius: 14px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 15px; font-weight: 600; letter-spacing: 1px; margin-bottom: 18px; }
.login-h { font-size: 22px; font-weight: 600; letter-spacing: .5px; }
.login-s { color: var(--text-2); font-size: 13.5px; margin: 6px 0 26px; }

.empty { text-align: center; color: var(--text-3); font-size: 13.5px; padding: 36px 16px; }
.hr { height: 1px; background: var(--line); margin: 12px 0; }

.kv { display: flex; gap: 10px; font-size: 14px; padding: 6px 0; }
.kv > span:first-child { color: var(--text-2); min-width: 78px; flex-shrink: 0; font-size: 13.5px; }
.kv > span:last-child { flex: 1; word-break: break-word; }

.notice { background: var(--brand-l); color: var(--brand-d); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 10px; }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.danger { background: var(--danger-bg); color: var(--danger); }

@media (min-width: 720px) {
  .page { padding: 16px 20px 32px; }
  .stat b { font-size: 22px; }
}
