/* 送货单 · Liquid Glass UI
   毛玻璃只用于应用界面；正式送货单由 render.js 单独绘制为白底黑字。 */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --bg-a: #f4f7fc;
  --bg-b: #e6eef8;
  --orb1: rgba(150, 196, 255, .55);
  --orb2: rgba(196, 214, 255, .55);
  --orb3: rgba(170, 232, 236, .42);
  --orb4: rgba(225, 222, 255, .45);
  --text: #0c1424;
  --text-2: rgba(22, 34, 58, .62);
  --text-3: rgba(22, 34, 58, .40);
  --glass: rgba(255, 255, 255, .56);
  --glass-hi: rgba(255, 255, 255, .74);
  --glass-in: rgba(255, 255, 255, .55);
  --glass-edge: rgba(255, 255, 255, .85);
  --glass-edge-2: rgba(255, 255, 255, .18);
  --hair: rgba(20, 40, 80, .08);
  --hair-2: rgba(20, 40, 80, .13);
  --shadow: 0 1px 1px rgba(20, 40, 80, .03), 0 10px 30px -6px rgba(20, 40, 80, .10), 0 30px 70px -20px rgba(20, 40, 80, .12);
  --shadow-sm: 0 1px 2px rgba(20, 40, 80, .05), 0 6px 18px -6px rgba(20, 40, 80, .10);
  --accent: #0a7cff;
  --accent-2: #3d9bff;
  --accent-soft: rgba(10, 124, 255, .10);
  --accent-ink: #0066d6;
  --danger: #ff3b30;
  --danger-soft: rgba(255, 59, 48, .10);
  --ok: #26a65b;
  --r-xl: 28px;
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --blur: blur(30px) saturate(185%);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.32, 1.25, .42, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg-a: #070b14;
  --bg-b: #0d1424;
  --orb1: rgba(40, 96, 200, .40);
  --orb2: rgba(70, 70, 170, .32);
  --orb3: rgba(20, 120, 140, .26);
  --orb4: rgba(110, 70, 170, .24);
  --text: #eef3fb;
  --text-2: rgba(226, 234, 248, .64);
  --text-3: rgba(226, 234, 248, .38);
  --glass: rgba(30, 38, 56, .50);
  --glass-hi: rgba(40, 50, 72, .70);
  --glass-in: rgba(255, 255, 255, .06);
  --glass-edge: rgba(255, 255, 255, .22);
  --glass-edge-2: rgba(255, 255, 255, .03);
  --hair: rgba(255, 255, 255, .08);
  --hair-2: rgba(255, 255, 255, .14);
  --shadow: 0 1px 1px rgba(0, 0, 0, .2), 0 12px 32px -8px rgba(0, 0, 0, .5), 0 30px 70px -20px rgba(0, 0, 0, .5);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px -6px rgba(0, 0, 0, .4);
  --accent: #3b97ff;
  --accent-2: #5aaaff;
  --accent-soft: rgba(59, 151, 255, .16);
  --accent-ink: #6cb2ff;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-b);
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
  line-height: 1.45;
  overscroll-behavior-y: none;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- 背景光斑 ---------- */
.ambient { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: linear-gradient(160deg, var(--bg-a), var(--bg-b)); }
.orb { position: absolute; border-radius: 50%; filter: blur(70px); animation: drift 26s var(--ease) infinite alternate; }
.o1 { width: 52vmax; height: 52vmax; left: -14vmax; top: -18vmax; background: var(--orb1); }
.o2 { width: 44vmax; height: 44vmax; right: -16vmax; top: 8vmax; background: var(--orb2); animation-delay: -8s; }
.o3 { width: 40vmax; height: 40vmax; left: 18vmax; bottom: -22vmax; background: var(--orb3); animation-delay: -14s; }
.o4 { width: 26vmax; height: 26vmax; right: 12vmax; bottom: 6vmax; background: var(--orb4); animation-delay: -4s; }
@keyframes drift { to { transform: translate3d(4vmax, 3vmax, 0) scale(1.08); } }

/* ---------- 液态玻璃 ---------- */
.glass {
  position: relative;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border-radius: var(--r-lg);
  box-shadow: inset 0 1px 0 var(--glass-edge), inset 0 -1px 0 var(--glass-edge-2), var(--shadow);
}
.glass::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, var(--glass-edge), var(--glass-edge-2) 38%, var(--glass-edge-2) 62%, var(--glass-edge));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.glass::after { /* 顶部柔光折射 */
  content: "";
  position: absolute; left: 8%; right: 8%; top: 0; height: 40%;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,.28), rgba(255,255,255,0));
  pointer-events: none;
  opacity: .7;
}
[data-theme="dark"] .glass::after { opacity: .12; }

/* ---------- 布局 ---------- */
.view {
  min-height: 100vh;
  padding: calc(20px + var(--safe-t)) 18px calc(118px + var(--safe-b));
  max-width: 760px;
  margin: 0 auto;
  outline: none;
}
.view.no-tab { padding-bottom: calc(150px + var(--safe-b)); }
.enter { animation: enter .42s var(--ease) both; }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } }

.sidebar {
  position: fixed; left: 16px; top: 16px; bottom: 16px; width: 236px;
  padding: 22px 14px; display: flex; flex-direction: column; gap: 22px;
  border-radius: var(--r-xl); z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.brand img { border-radius: 10px; box-shadow: var(--shadow-sm); }
.brand b { display: block; font-size: 17px; letter-spacing: .02em; }
.brand small { display: block; color: var(--text-2); font-size: 12px; max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-nav a {
  display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 14px;
  border-radius: 14px; color: var(--text-2); font-size: 15px; transition: background .2s, color .2s;
}
.side-nav a.on { background: var(--glass-hi); color: var(--accent-ink); box-shadow: var(--shadow-sm), inset 0 1px 0 var(--glass-edge); }
.side-nav a.new { margin-bottom: 10px; color: #fff; background: linear-gradient(180deg, var(--accent-2), var(--accent)); box-shadow: 0 8px 20px -8px var(--accent), inset 0 1px 0 rgba(255,255,255,.35); }
.side-nav a.new:hover { color: #fff; filter: brightness(1.05); }
.side-nav svg, .tabbar svg { width: 22px; height: 22px; flex: none; }
.side-nav .kbd { margin-left: auto; font-size: 11px; opacity: .7; border: 1px solid rgba(255,255,255,.5); border-radius: 6px; padding: 0 5px; }

.tabbar {
  position: fixed; left: 12px; right: 12px; bottom: calc(10px + var(--safe-b));
  height: 66px; border-radius: 33px; z-index: 20;
  display: flex; align-items: stretch; justify-content: space-around; padding: 6px;
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 10.5px; color: var(--text-2); border-radius: 27px; transition: color .2s, background .25s;
}
.tabbar a.on { color: var(--accent-ink); background: var(--glass-hi); box-shadow: inset 0 1px 0 var(--glass-edge), var(--shadow-sm); }

@media (min-width: 960px) {
  body.has-nav .view { margin-left: 268px; margin-right: 0; padding: 36px 48px 60px; max-width: 980px; }
  body.has-nav .view.no-tab { padding-bottom: 140px; }
  .tabbar { display: none !important; }
}
@media (max-width: 959px) { .sidebar { display: none !important; } }

/* ---------- 通用组件 ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 6px 4px 22px; }
.page-head h1 { margin: 0; font-size: 32px; font-weight: 700; letter-spacing: .01em; }
.page-head p { margin: 4px 0 0; color: var(--text-2); font-size: 14px; }
.page-head .back { display: inline-flex; align-items: center; gap: 2px; color: var(--accent-ink); font-size: 16px; margin-bottom: 6px; background: none; border: 0; padding: 0; }
.page-head .back svg { width: 20px; height: 20px; }

.card { padding: 18px; margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 10px; }
.card-head h2 { margin: 0; font-size: 15px; font-weight: 600; color: var(--text-2); letter-spacing: .02em; }
.card-head a, .link { color: var(--accent-ink); font-size: 14px; background: none; border: 0; padding: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 22px; border-radius: 999px; border: 0;
  font-size: 16px; font-weight: 600; white-space: nowrap;
  transition: transform .18s var(--ease), filter .2s, opacity .2s;
  user-select: none;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn svg { width: 19px; height: 19px; }
.btn.primary { color: #fff; background: linear-gradient(180deg, var(--accent-2), var(--accent)); box-shadow: 0 10px 22px -10px var(--accent), inset 0 1px 0 rgba(255,255,255,.35); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.glassy { background: var(--glass-hi); box-shadow: inset 0 1px 0 var(--glass-edge), var(--shadow-sm); color: var(--text); }
.btn.ghost { background: var(--glass-in); color: var(--accent-ink); box-shadow: inset 0 0 0 1px var(--hair); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.sm { height: 36px; padding: 0 14px; font-size: 14px; }
.btn.block { width: 100%; }

.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; display: inline-grid; place-items: center; background: transparent; color: var(--text-2); transition: background .2s; }
.icon-btn svg { width: 19px; height: 19px; }

.input {
  width: 100%; height: 50px; padding: 0 16px;
  border-radius: var(--r-md); border: 1px solid var(--hair);
  background: var(--glass-in);
  font-size: 17px; outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.input::placeholder { color: var(--text-3); }
.input:focus { border-color: color-mix(in srgb, var(--accent) 55%, transparent); box-shadow: 0 0 0 4px var(--accent-soft); background: var(--glass-hi); }
.input.invalid { border-color: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.search { position: relative; }
.search svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 42px; }

.list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 12px;
  border-radius: 14px; transition: background .18s; width: 100%; text-align: left; border: 0; background: none;
}
.row { position: relative; }
.row + .row::before { content: ""; position: absolute; left: 12px; right: 12px; top: 0; height: 1px; background: var(--hair); }
@media (hover: hover) { .row:hover { background: var(--glass-in); } .side-nav a:hover { background: var(--glass-in); color: var(--text); } .icon-btn:hover { background: var(--glass-in); } }
.row.hl, .row:active { background: var(--glass-in); }
.row.hl { box-shadow: inset 0 0 0 1.5px var(--accent-soft); }
.row .main { flex: 1; min-width: 0; }
.row .t { font-size: 16px; font-weight: 500; overflow-wrap: anywhere; }
.row.note .t { line-height: 1.35; }
.row.note .meta { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-top: 3px; }
.row.note .meta .s { margin: 0; }
.row .s { font-size: 13px; color: var(--text-2); margin-top: 1px; }
.row .amt { font-size: 17px; font-weight: 600; white-space: nowrap; }
.row .chev { width: 16px; height: 16px; color: var(--text-3); flex: none; }
.row.inactive .t { color: var(--text-3); }
.date-chip { width: 50px; flex: none; text-align: center; line-height: 1.1; }
.date-chip b { display: block; font-size: 19px; font-weight: 600; }
.date-chip small { font-size: 11px; color: var(--text-2); }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 99px; background: var(--hair); color: var(--text-2); margin-left: 6px; vertical-align: 2px; }
.badge.void { background: var(--danger-soft); color: var(--danger); }
.empty { text-align: center; color: var(--text-2); padding: 34px 12px; font-size: 14px; }
.empty svg { width: 40px; height: 40px; opacity: .35; display: block; margin: 0 auto 10px; }

/* ---------- 首页 ---------- */
.hero {
  display: flex; align-items: center; gap: 18px; width: 100%; min-height: 112px; padding: 22px 24px;
  margin-bottom: 18px; border: 0; border-radius: var(--r-xl); text-align: left;
  color: #fff;
  background: linear-gradient(140deg, rgba(76, 162, 255, .95), rgba(10, 112, 240, .95));
  box-shadow: 0 22px 44px -18px rgba(10, 112, 240, .6), inset 0 1px 0 rgba(255,255,255,.45), inset 0 -1px 0 rgba(0,0,0,.08);
  position: relative; overflow: hidden;
  transition: transform .25s var(--spring);
}
.hero::after { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 90% at 85% -10%, rgba(255,255,255,.42), transparent 55%); pointer-events: none; }
.hero:active { transform: scale(.985); }
.hero .plus { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.22); box-shadow: inset 0 1px 0 rgba(255,255,255,.5); flex: none; }
.hero .plus svg { width: 30px; height: 30px; }
.hero b { display: block; font-size: 23px; font-weight: 700; letter-spacing: .02em; }
.hero small { font-size: 14px; opacity: .85; }

/* ---------- 新建送货单 ---------- */
.step { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); font-weight: 600; margin: 0 4px 10px; letter-spacing: .03em; }
.step i { font-style: normal; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; background: var(--accent-soft); color: var(--accent-ink); }
.picker {
  width: 100%; min-height: 60px; display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-radius: var(--r-md); border: 1px solid var(--hair); background: var(--glass-in); text-align: left;
  transition: border-color .2s, box-shadow .2s;
}
.picker:hover { border-color: var(--hair-2); }
.picker.invalid { border-color: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.picker .v { flex: 1; font-size: 17px; font-weight: 500; overflow-wrap: anywhere; }
.picker .ph { color: var(--text-3); font-weight: 400; }
.picker svg { width: 18px; height: 18px; color: var(--text-3); flex: none; }
.date-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.date-row label { font-size: 15px; color: var(--text-2); flex: none; }
.date-row .input { height: 44px; max-width: 220px; font-size: 16px; }

.items { display: flex; flex-direction: column; gap: 10px; }
.item {
  border-radius: var(--r-md); padding: 14px 14px 12px; background: var(--glass-in);
  box-shadow: inset 0 0 0 1px var(--hair); animation: enter .35s var(--ease) both;
}
.item-top { display: flex; align-items: flex-start; gap: 8px; }
.item-name { flex: 1; font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.item-name small { display: block; font-size: 13px; color: var(--text-2); font-weight: 400; margin-top: 2px; }
.item-top .icon-btn { margin: -6px -6px 0 0; }
.item-fields { display: grid; grid-template-columns: 1.25fr 1fr 1.1fr; gap: 10px; margin-top: 10px; align-items: end; }
.f label, .f > span { display: block; font-size: 12px; color: var(--text-2); margin: 0 0 4px 4px; }
.f .wrap { position: relative; display: flex; align-items: center; }
.f .input { height: 48px; font-size: 19px; font-weight: 600; padding: 0 40px 0 14px; text-align: right; font-variant-numeric: tabular-nums; }
.f .unit { position: absolute; right: 13px; font-size: 14px; color: var(--text-2); pointer-events: none; }
.f.price .input { padding: 0 14px 0 30px; font-size: 17px; font-weight: 500; }
.f.price .unit { left: 13px; right: auto; }
.f.sub .val { height: 48px; display: flex; align-items: center; justify-content: flex-end; padding-right: 4px; font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.price-hint { font-size: 12px; color: var(--accent-ink); margin: 6px 4px 0; }
.price-hint button { border: 0; background: none; color: inherit; text-decoration: underline; padding: 0; font-size: inherit; }
.add-item {
  width: 100%; height: 56px; border-radius: var(--r-md); border: 1.5px dashed color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--accent-soft); color: var(--accent-ink); font-size: 16px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; transition: transform .18s var(--ease);
}
.add-item:active { transform: scale(.985); }
.add-item svg { width: 20px; height: 20px; }

.action-bar {
  position: fixed; z-index: 25; left: 12px; right: 12px; bottom: calc(12px + var(--safe-b));
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 20px; border-radius: 32px;
}
.action-bar .total { flex: 1; min-width: 0; }
.action-bar .total span { display: block; font-size: 12px; color: var(--text-2); }
.action-bar .total b { display: block; font-size: 24px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.action-bar .btn { height: 50px; }
@media (max-width: 420px) { .action-bar .btn { padding: 0 16px; font-size: 15px; } .action-bar .total b { font-size: 21px; } }
@media (min-width: 960px) {
  body.has-nav .action-bar { left: 316px; right: auto; width: min(884px, calc(100vw - 364px)); bottom: 24px; }
}

/* ---------- 单据查看 ---------- */
.paper {
  background: #fff; border-radius: 10px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 18px 40px -16px rgba(20,40,80,.35);
  margin: 0 auto 18px; max-width: 760px;
}
.paper img { display: block; width: 100%; height: auto; -webkit-touch-callout: default; }
.paper.void { position: relative; }
.paper.void::after { content: "已作废"; position: absolute; top: 14px; right: 14px; padding: 4px 12px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 13px; font-weight: 700; }
.paper .ph { aspect-ratio: 210 / 135; display: grid; place-items: center; color: #999; font-size: 14px; }
.actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.actions .wide { grid-column: 1 / -1; }
@media (min-width: 640px) { .actions { grid-template-columns: repeat(4, 1fr); } .actions .wide { grid-column: span 2; } }
.meta-line { color: var(--text-2); font-size: 13px; text-align: center; margin: 12px 0 0; }
.hint { color: var(--text-2); font-size: 13px; margin: 10px 4px 0; }

/* ---------- 管理页 ---------- */
.add-bar { display: flex; gap: 10px; }
.add-bar .input { flex: 1; }
.add-grid { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 10px; }
@media (max-width: 640px) { .add-grid { grid-template-columns: 1fr 1fr; } .add-grid .full { grid-column: 1 / -1; } }
.section-label { font-size: 13px; color: var(--text-3); margin: 16px 12px 4px; font-weight: 600; }

.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--glass-in); box-shadow: inset 0 0 0 1px var(--hair); }
.seg button { border: 0; background: none; height: 34px; padding: 0 16px; border-radius: 9px; font-size: 14px; color: var(--text-2); }
.seg button.on { background: var(--glass-hi); color: var(--text); box-shadow: var(--shadow-sm), inset 0 1px 0 var(--glass-edge); font-weight: 600; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; }
.set-row + .set-row { border-top: 1px solid var(--hair); }
.set-row .l { font-size: 16px; }
.set-row .l small { display: block; color: var(--text-2); font-size: 13px; }

/* ---------- 弹层 ---------- */
.backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(10, 18, 34, .22); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: fade .25s var(--ease) both; }
[data-theme="dark"] .backdrop { background: rgba(0,0,0,.45); }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; z-index: 51; left: 0; right: 0; bottom: 0;
  max-height: calc(100dvh - 48px - var(--safe-t)); display: flex; flex-direction: column;
  border-radius: 30px 30px 0 0; padding: 8px 16px calc(16px + var(--safe-b));
  background: var(--glass-hi);
  animation: up .42s var(--spring) both;
}
.sheet::after { display: none; }
.sheet .grab { width: 38px; height: 5px; border-radius: 3px; background: var(--hair-2); margin: 2px auto 10px; flex: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 2px 12px; flex: none; }
.sheet-head h3 { margin: 0; font-size: 18px; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; min-height: 0; flex: 1; margin: 0 -6px; padding: 0 6px; }
.sheet-foot { flex: none; padding-top: 12px; display: flex; gap: 10px; }
.sheet-foot .btn { flex: 1; }
@keyframes up { from { transform: translateY(100%); } }
@media (min-width: 720px) {
  .sheet { left: 50%; top: 50%; bottom: auto; width: min(560px, calc(100vw - 40px)); max-height: min(720px, calc(100vh - 80px));
    transform: translate(-50%, -50%); border-radius: 28px; padding: 18px 20px 18px; animation: pop .32s var(--spring) both; }
  .sheet.wide { width: min(860px, calc(100vw - 40px)); max-height: calc(100vh - 60px); }
  .sheet .grab { display: none; }
  @keyframes pop { from { opacity: 0; transform: translate(-50%, -46%) scale(.97); } }
}
.closing .backdrop { animation: fade .2s reverse both; }
.closing .sheet { animation: none; opacity: 0; transition: opacity .18s; }
.sheet .input + .input, .stack > * + * { margin-top: 10px; }
.sheet .f-label { display: block; font-size: 13px; color: var(--text-2); margin: 12px 4px 6px; }
.confirm-msg { color: var(--text-2); margin: 0 4px 6px; font-size: 15px; }

/* ---------- 提示 ---------- */
.toasts { position: fixed; z-index: 90; left: 0; right: 0; top: calc(14px + var(--safe-t)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto; max-width: min(92vw, 420px); padding: 12px 18px; border-radius: 18px; font-size: 15px;
  background: var(--glass-hi); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: inset 0 1px 0 var(--glass-edge), var(--shadow); animation: drop .4s var(--spring) both;
}
.toast.err { color: var(--danger); }
.toast.out { opacity: 0; transform: translateY(-6px); transition: .25s; }
@keyframes drop { from { opacity: 0; transform: translateY(-14px) scale(.96); } }

.offline { position: fixed; z-index: 80; top: calc(10px + var(--safe-t)); left: 50%; transform: translateX(-50%); padding: 8px 16px; border-radius: 99px; font-size: 13px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.offline .dot { width: 8px; height: 8px; border-radius: 50%; background: #ff9f0a; box-shadow: 0 0 0 3px rgba(255,159,10,.2); }
body.offline-mode .view { padding-top: calc(60px + var(--safe-t)); }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login { width: min(380px, 100%); padding: 34px 26px 26px; text-align: center; border-radius: 32px; }
.login img { width: 76px; height: 76px; border-radius: 18px; box-shadow: var(--shadow); }
.login h1 { font-size: 26px; margin: 16px 0 4px; }
.login p { color: var(--text-2); margin: 0 0 22px; font-size: 14px; }
.login .btn { margin-top: 12px; height: 50px; }
.login .err { color: var(--danger); font-size: 14px; min-height: 20px; margin-top: 10px; }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--hair-2); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(1turn); } }
.kbd-hint { font-size: 12px; color: var(--text-3); text-align: center; margin-top: 14px; }
@media (max-width: 959px) { .kbd-hint { display: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- 按年份分组 ---------- */
.date-md { width: 64px; flex: none; font-size: 15px; font-weight: 600; color: var(--text); }
.year + .year { margin-top: 6px; }
.year-head {
  width: 100%; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 12px;
  border: 0; background: none; border-radius: 12px; text-align: left; color: var(--text);
}
.year-head b { font-size: 20px; font-weight: 700; letter-spacing: .01em; }
.year-head span { font-size: 13px; color: var(--text-2); }
.year-head svg { width: 18px; height: 18px; margin-left: auto; color: var(--text-3); transition: transform .25s var(--ease); transform: rotate(-90deg); }
.year.open .year-head svg { transform: none; }
@media (hover: hover) { .year-head:hover { background: var(--glass-in); } }
.year-body { display: none; }
.year.open .year-body { display: block; animation: enter .3s var(--ease) both; }
.year-body .row:first-child::before { display: none; }
