/* 中文明确交给苹方，西文还是系统字体。iOS 模拟器里只写 -apple-system 时中文全是方框，没有苹方的系统会自动跳到下一个字体。 */
@font-face { font-family: "系统中文"; font-weight: 400; src: local("PingFangSC-Regular"), local("PingFang SC"); unicode-range: U+2E80-9FFF, U+F900-FAFF, U+FE30-FE4F, U+FF00-FFEF; }
@font-face { font-family: "系统中文"; font-weight: 500; src: local("PingFangSC-Medium"); unicode-range: U+2E80-9FFF, U+F900-FAFF, U+FE30-FE4F, U+FF00-FFEF; }
@font-face { font-family: "系统中文"; font-weight: 600 700; src: local("PingFangSC-Semibold"); unicode-range: U+2E80-9FFF, U+F900-FAFF, U+FE30-FE4F, U+FF00-FFEF; }

/* 按 Apple Human Interface Guidelines 的思路：系统字体、分组列表、细分隔线。颜色变量都在 styles-theme.css。 */
:root {
  color-scheme: light dark;
  --spring: cubic-bezier(.32, .72, 0, 1);
  --sans: "系统中文", -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='14' viewBox='0 0 10 14' fill='none' stroke='%238E8E93' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 5l3-3 3 3M2 9l3 3 3-3'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--label);
  font: 15px/1.42 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.boot { padding: 80px 20px; text-align: center; color: var(--label-3); }
.muted { color: var(--label-3); }
.mono { font-family: var(--mono); font-size: 13px; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 6px 14px; border-radius: 10px;
  background: var(--fill); color: var(--label);
  font-size: 14px; font-weight: 600; white-space: nowrap;
  transition: background-color .15s, opacity .15s, transform .15s var(--spring);
}
.btn:hover { background: var(--fill-strong); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; transform: none; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-press); }
.btn.tinted { background: var(--accent-soft); color: var(--accent-text); }
.btn.plain { background: none; color: var(--accent-text); padding-inline: 6px; }
.btn.plain:hover { background: var(--fill-soft); }
.btn.plain.danger { color: var(--red); }
.btn.large { width: 100%; min-height: 50px; border-radius: 12px; font-size: 17px; }

/* 输入 */
.input, .textarea, .select {
  width: 100%; min-height: 36px; padding: 7px 11px; border: 0; border-radius: 10px;
  background: var(--fill); color: var(--label); font-size: 15px;
}
.input::placeholder, .textarea::placeholder { color: var(--label-3); }
.textarea { display: block; min-height: 88px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 26px;
  background-image: var(--chevron); background-repeat: no-repeat; background-position: right 9px center;
}
.select.form {
  width: auto; max-width: 100%; min-height: 32px; padding: 4px 22px 4px 4px; background-color: transparent;
  background-position: right 3px center; color: var(--label-2); text-align: right; text-align-last: right;
}
.select.pill {
  width: auto; min-height: 32px; padding: 4px 25px 4px 12px; border-radius: 999px; font-size: 14px; font-weight: 500;
  background-color: var(--fill); background-position: right 9px center;
}
.select.pill.active { background-color: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.select.status { width: auto; min-height: 30px; padding: 3px 23px 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background-position: right 7px center; }
.tint-gray { background-color: var(--fill) !important; color: var(--label-2) !important; }
.tint-blue { background-color: var(--blue-soft) !important; color: var(--blue) !important; }
.tint-green { background-color: var(--green-soft) !important; color: var(--green) !important; }
.tint-red { background-color: var(--red-soft) !important; color: var(--red) !important; }

/* 分组列表 */
.group { position: relative; background: var(--surface); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-card); }
.row { position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 6px 16px; }
.row + .row::before, .list-row + .list-row::before {
  content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 1px; background: var(--sep); transform: scaleY(.6);
}
.row-label { flex: none; font-size: 15px; }
.row-value { margin-left: auto; min-width: 0; display: flex; justify-content: flex-end; align-items: center; gap: 6px; color: var(--label-2); }
.row.field-row .input { flex: 1; min-width: 0; padding: 4px 0; min-height: 32px; background: none; border-radius: 0; text-align: right; }
.row.field-row .input:focus { outline: none; }
.row.action { justify-content: center; font-size: 15px; width: 100%; color: var(--accent-text); }
.row.action.danger { color: var(--red); }
.row.action:hover { background: var(--fill-soft); }
.row.stack { display: block; padding: 12px 16px; }
.section-title { display: flex; align-items: baseline; gap: 8px; padding: 0 16px 7px; font-size: 13px; color: var(--label-2); }
.section-title strong { font-size: 13px; font-weight: 600; }
.section-title .n { color: var(--label-3); font-variant-numeric: tabular-nums; }
.section-foot { padding: 7px 16px 0; font-size: 13px; color: var(--label-3); }
.section { display: flex; flex-direction: column; }
.form-stack { display: flex; flex-direction: column; gap: 22px; }
.form-error { padding: 0 16px; color: var(--red); font-size: 14px; }

/* 外壳 */
.shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); height: 100vh; height: 100dvh; }
.nav {
  display: flex; flex-direction: column; gap: 2px; padding: 16px 10px 10px;
  background: var(--material); border-right: 1px solid var(--sep);
  -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
}
.brand { display: flex; align-items: center; gap: 9px; padding: 2px 9px 16px; font-size: 16px; font-weight: 700; }
.brand img { width: 26px; height: 26px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 6px 10px; border-radius: 9px;
  color: var(--label); font-size: 15px; text-decoration: none; transition: background-color .15s;
}
.nav-link svg { width: 19px; height: 19px; flex: none; color: var(--accent-text); }
.nav-link:hover { background: var(--fill-soft); }
.nav-link[aria-current="page"] { background: var(--fill-strong); font-weight: 600; }
.nav-foot { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--sep); }
.nav-user { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 40px; padding: 6px 9px; border-radius: 9px; text-align: left; font-size: 14px; font-weight: 500; }
.nav-user:hover { background: var(--fill-soft); }
.main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.content { flex: 1; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; }
.pagehead {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 16px 28px 12px; background: var(--bg);
}
@supports (background: color-mix(in srgb, red, blue)) {
  .pagehead {
    background: color-mix(in srgb, var(--bg) 80%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  }
}
.pagehead h1 { font-size: 28px; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
.pagehead .sub { font-size: 14px; color: var(--label-3); font-variant-numeric: tabular-nums; align-self: flex-end; padding-bottom: 3px; }
.head-tools, .head-global { display: flex; align-items: center; gap: 8px; }
.head-tools { order: 3; margin-left: auto; }
.head-global { order: 4; }
.head-global:last-child { margin-left: auto; }
.page { max-width: 1320px; padding: 4px 28px 40px; display: flex; flex-direction: column; gap: 22px; }
.tabbar { display: none; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--fill); color: var(--label); transition: background-color .15s;
}
.icon-btn:hover { background: var(--fill-strong); }
.icon-btn svg { width: 19px; height: 19px; }
.badge {
  position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--danger-fill); color: #fff; font-size: 11px; font-weight: 600; line-height: 18px; text-align: center;
  font-variant-numeric: tabular-nums; box-shadow: 0 0 0 2px var(--bg);
}
.mobile-only { display: none !important; }

/* 分段控件 */
.segmented { display: inline-flex; padding: 2px; border-radius: 9px; background: var(--fill); }
.segmented button {
  min-height: 28px; padding: 3px 14px; border-radius: 7px; color: var(--label); font-size: 13px; font-weight: 500;
  transition: background-color .2s, box-shadow .2s;
}
.segmented button[aria-pressed="true"] { background: var(--surface); box-shadow: var(--shadow-thumb); font-weight: 600; }
.segmented.wide { display: flex; }
.segmented.wide button { flex: 1; }

/* 标签 */
.capsule { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.c-gray { background: var(--fill); color: var(--label-2); }
.c-blue { background: var(--blue-soft); color: var(--blue); }
.c-teal { background: var(--teal-soft); color: var(--teal); }
.c-orange { background: var(--orange-soft); color: var(--orange); }
.c-red { background: var(--red-soft); color: var(--red); }
.c-green { background: var(--green-soft); color: var(--green); }
.prio { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--label-3); }
.prio.p0 { color: var(--red); font-weight: 700; }
.prio.p1 { color: var(--orange); font-weight: 700; }
.type { font-size: 13px; color: var(--label-2); white-space: nowrap; }
.lines { display: flex; flex-wrap: wrap; gap: 4px; }
.ln { padding: 1px 7px; border-radius: 6px; background: var(--fill); color: var(--label-2); font-size: 12px; white-space: nowrap; }
.ln.doing { background: var(--blue-soft); color: var(--blue); }
.ln.done { background: var(--green-soft); color: var(--green); }
.ln.block { background: var(--red-soft); color: var(--red); font-weight: 600; }
.who { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; font-size: 14px; }
.av {
  width: 24px; height: 24px; flex: none; display: inline-grid; place-items: center; border-radius: 50%;
  color: #fff; font-size: 12px; font-weight: 600;
}

/* 筛选 */
.filterbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search { position: relative; flex: 0 1 240px; min-width: 170px; }
.search .input { padding-left: 32px; min-height: 32px; font-size: 14px; border-radius: 10px; }
.search svg { position: absolute; left: 10px; top: 50%; width: 15px; height: 15px; transform: translateY(-50%); color: var(--label-3); pointer-events: none; }
.pill-btn {
  position: relative; display: inline-flex; align-items: center; gap: 6px; max-width: 280px; min-height: 32px; padding: 4px 25px 4px 12px;
  border-radius: 999px; background: var(--fill); color: var(--label); font-size: 14px; font-weight: 500; white-space: nowrap;
  background-image: var(--chevron); background-repeat: no-repeat; background-position: right 9px center;
}
.pill-btn span { overflow: hidden; text-overflow: ellipsis; }
.pill-btn.active { background-color: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.toggle-pill { min-height: 32px; padding: 4px 12px; border-radius: 999px; background: var(--fill); font-size: 14px; font-weight: 500; white-space: nowrap; }
.toggle-pill[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.reset-btn { min-height: 32px; padding: 4px 8px; color: var(--accent-text); font-size: 14px; white-space: nowrap; }
.picker { position: relative; }
.panel {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: 310px; max-height: 390px; overflow: auto; padding: 10px;
  border-radius: 14px; background: var(--material); box-shadow: var(--shadow-float); outline: 1px solid var(--sep);
  -webkit-backdrop-filter: saturate(180%) blur(30px); backdrop-filter: saturate(180%) blur(30px);
  animation: pop-in .22s var(--spring);
}
.pgroup { padding: 10px 8px 3px; font-size: 12px; font-weight: 600; color: var(--label-3); }
.pitem { display: flex; align-items: center; gap: 9px; min-height: 36px; padding: 5px 8px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.pitem:hover { background: var(--fill-soft); }
.pitem input { width: 17px; height: 17px; flex: none; accent-color: var(--accent); }
.pitem .cnt { margin-left: auto; font-size: 13px; color: var(--label-3); font-variant-numeric: tabular-nums; }
.pactions { display: flex; justify-content: space-between; padding: 8px 2px 0; margin-top: 6px; border-top: 1px solid var(--sep); }

/* 表格 */
.table-wrap { overflow: auto; max-height: calc(100dvh - 190px); }
table { width: 100%; min-width: 880px; border-collapse: separate; border-spacing: 0; font-size: 14px; }
thead th {
  position: sticky; top: 0; z-index: 2; padding: 9px 14px; text-align: left; white-space: nowrap;
  background: var(--surface); box-shadow: inset 0 -1px 0 var(--sep); color: var(--label-3); font-size: 13px; font-weight: 500;
}
tbody td { padding: 11px 14px; box-shadow: inset 0 -1px 0 var(--sep); vertical-align: middle; }
tbody tr:last-child td { box-shadow: none; }
tbody tr.clickable { cursor: pointer; transition: background-color .12s; }
tbody tr.clickable:hover td { background: var(--fill-soft); }
td.name { min-width: 280px; font-weight: 500; }
td.ver { color: var(--label-2); font-size: 13px; white-space: nowrap; }
.link-btn { color: inherit; font-weight: inherit; text-align: left; overflow-wrap: anywhere; }
.empty { padding: 48px 16px; text-align: center; color: var(--label-3); font-size: 14px; }

/* 列表行 */
.list-row {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 16px; text-align: left;
  background: none; transition: background-color .12s;
}
button.list-row:hover { background: var(--fill-soft); }
.list-main { min-width: 0; flex: 1; }
.list-title { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.list-title.link { display: block; width: 100%; text-align: left; }
.list-title.link:hover { color: var(--accent-text); }
.list-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 3px; font-size: 13px; color: var(--label-2); }
.list-side { flex: none; display: flex; align-items: center; gap: 8px; }
.reason { color: var(--red); font-size: 13px; }

/* 看板 */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(262px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.col { display: flex; flex-direction: column; max-height: calc(100dvh - 190px); min-width: 0; border-radius: 14px; background: var(--fill-soft); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
.col-head .n { margin-left: auto; font-size: 13px; color: var(--label-3); font-variant-numeric: tabular-nums; }
.col-body { display: flex; flex-direction: column; gap: 8px; padding: 0 8px 8px; overflow-y: auto; }
.tcard {
  display: flex; flex-direction: column; gap: 8px; width: 100%; padding: 12px; text-align: left;
  background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-card);
  transition: transform .2s var(--spring), box-shadow .2s;
}
.tcard:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0, 0, 0, .09); }
.tcard:active { transform: scale(.985); }
.tcard-title { font-size: 15px; font-weight: 500; line-height: 1.4; overflow-wrap: anywhere; }
.tcard-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 13px; color: var(--label-2); }
.tcard-meta .who { margin-left: auto; font-size: 13px; }
.cards { display: flex; flex-direction: column; gap: 8px; }

/* 概览卡片（类似“提醒事项”） */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 5px 10px; padding: 12px 14px; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-card); }
.stat-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: #fff; }
.stat-icon svg { width: 17px; height: 17px; }
.stat-num { justify-self: end; font-size: 26px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-label { grid-column: 1 / -1; font-size: 14px; font-weight: 500; color: var(--label-2); }
.i-blue { background: var(--blue-soft); color: var(--blue); } .i-orange { background: var(--orange-soft); color: var(--orange); } .i-gray { background: var(--fill); color: var(--label-2); } .i-red { background: var(--red-soft); color: var(--red); }

/* 版本 */
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.vcard { display: flex; flex-direction: column; gap: 11px; padding: 15px 16px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-card); }
.vcard-head { display: flex; align-items: center; gap: 8px; }
.vcard-name { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.vcard-head .capsule { margin-left: auto; }
.bar { height: 5px; overflow: hidden; border-radius: 999px; background: var(--fill); }
.bar i { display: block; height: 100%; border-radius: 999px; background: var(--viz-done); transition: width .35s var(--spring); }
.vnums { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--label-2); }
.vnums b { color: var(--label); font-weight: 600; font-variant-numeric: tabular-nums; }
.vnums .alert, .vnums .alert b { color: var(--red); }
.vcard-foot { display: flex; align-items: center; justify-content: space-between; margin: auto -6px -4px; }

/* 详情弹层 */
.overlay { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .22); animation: fade-in .25s ease; }
.sheet {
  position: fixed; z-index: 41; top: 10px; right: 10px; bottom: 10px; width: min(560px, calc(100vw - 20px));
  display: flex; flex-direction: column; overflow: hidden; border-radius: 18px; background: var(--bg); box-shadow: var(--shadow-float);
  animation: slide-left .36s var(--spring);
}
.sheet:focus { outline: none; }
.grabber { display: none; }
.sheet-nav {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; min-height: 52px; padding: 8px 14px;
  background: var(--material); box-shadow: inset 0 -1px 0 var(--sep);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.sheet-nav .left { display: flex; align-items: center; gap: 8px; justify-self: start; min-width: 0; }
.sheet-nav .center { font-size: 16px; font-weight: 600; text-align: center; }
.sheet-nav .right { justify-self: end; }
.nav-btn { min-height: 36px; padding: 4px 6px; border-radius: 8px; color: var(--accent-text); font-size: 16px; }
.nav-btn.strong { font-weight: 600; }
.nav-btn.danger { color: var(--red); }
.nav-btn:disabled { color: var(--label-3); }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 22px; -webkit-overflow-scrolling: touch; }
.sheet-body > * { flex-shrink: 0; }
.title-input {
  display: block; width: 100%; padding: 2px 16px; border: 0; background: transparent; resize: none;
  font-size: 21px; font-weight: 700; line-height: 1.3; field-sizing: content;
}
.title-input:focus { outline: none; }
.banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 11px 14px 11px 16px; border-radius: 12px; font-size: 15px; font-weight: 500; background: var(--orange-soft); color: var(--orange); }
.banner .btn { margin-left: auto; }
.banner.done { background: var(--green-soft); color: var(--green); }
.toggles { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 2px 10px; }
.toggle {
  min-height: 34px; padding: 5px 14px; border-radius: 999px; background: var(--surface); color: var(--label); font-size: 14px;
  box-shadow: var(--shadow-card); transition: background-color .18s, color .18s, transform .18s var(--spring);
}
.toggle:hover { background: var(--fill-strong); }
.toggle:active { transform: scale(.95); }
.toggle[aria-pressed="true"] { background: var(--accent); color: #fff; font-weight: 600; }
.toggle:disabled { opacity: .7; }
.sub-row { flex-wrap: wrap; }
.sub-name { flex: none; width: 62px; font-weight: 600; font-size: 15px; }
.sub-owner { flex: 1; min-width: 0; display: flex; justify-content: flex-end; }
.sub-reason { flex-basis: 100%; padding-left: 74px; }
.sub-reason .input { min-height: 32px; font-size: 14px; }
.borderless { background: none; padding: 0; border-radius: 0; }
.borderless:focus { outline: none; }
.textarea.borderless { min-height: 66px; resize: none; field-sizing: content; }
.comment-actions { display: flex; justify-content: flex-end; margin-top: 8px; }
.timeline { display: flex; flex-direction: column; gap: 14px; padding: 14px 16px 0; }
.tl-item { display: flex; gap: 10px; font-size: 14px; }
.tl-body { min-width: 0; flex: 1; }
.tl-meta { font-size: 13px; color: var(--label-3); }
.tl-comment { display: inline-block; margin-top: 4px; padding: 8px 12px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-card); white-space: pre-wrap; overflow-wrap: anywhere; }
.tl-text { color: var(--label-2); overflow-wrap: anywhere; }

/* 对话框 */
dialog.modal {
  padding: 0; border: 0; overflow: hidden; background: var(--bg); color: var(--label); box-shadow: var(--shadow-float);
  width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); border-radius: 16px;
}
dialog.modal[open] { display: flex; animation: pop-in .3s var(--spring); }
dialog.modal::backdrop { background: rgba(0, 0, 0, .3); animation: fade-in .25s ease; }
.modal-form { display: flex; flex-direction: column; width: 100%; min-height: 0; }
dialog.alert { width: min(340px, calc(100vw - 48px)); border-radius: 16px; background: var(--surface-raised); }
.alert-inner { display: flex; flex-direction: column; width: 100%; }
.alert-text { padding: 24px 20px 20px; text-align: center; }
.alert-title { font-size: 17px; font-weight: 600; line-height: 1.4; }
.alert-body { margin-top: 8px; font-size: 14px; line-height: 1.5; color: var(--label-2); overflow-wrap: anywhere; }
.alert-lines { white-space: pre-line; }
.alert-input { margin-top: 12px; }
.alert-input .textarea { min-height: 72px; font-size: 14px; text-align: left; }
/* 输入框下面的一行下拉：左边小标题，右边下拉占满。高度跟 --control-h 走（34，手机 44） */
.alert-pick { display: flex; align-items: center; gap: 8px; margin-top: 8px; text-align: left; }
.alert-pick-label { flex: none; font-size: 14px; color: var(--label-2); }
.alert-pick .select { flex: 1; min-width: 0; font-size: 14px; text-overflow: ellipsis; }
/* 按钮学 macOS 的提示框：两个等宽的圆角按钮，右边是要做的事，左边灰色退出 */
.alert-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 16px 16px; }
.alert-actions button { min-height: 40px; padding: 0 12px; border-radius: 10px; background: var(--fill); color: var(--label); font-size: 15px; font-weight: 500; }
.alert-actions button:hover { background: var(--fill-strong); }
.alert-actions button:active { transform: scale(.98); }
.alert-actions button + button { background: var(--accent); color: #fff; font-weight: 600; }
.alert-actions button + button:hover { background: var(--accent-press); }
.alert-actions button.danger { background: var(--danger-fill); color: #fff; }
.alert-actions button.danger:hover { background: var(--danger-fill); filter: brightness(.92); }
@media (max-width: 760px) { .alert-actions button { min-height: 44px; } }
/* 取消和确定在标题栏上，和表单一样：左边取消，中间标题，右边确定 */
.alert-nav { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 8px 12px; box-shadow: inset 0 -1px 0 var(--sep); }
.alert-nav .alert-title { font-size: 15px; text-align: center; overflow-wrap: anywhere; }
.alert-nav + .alert-text { padding-top: 16px; }
.alert-nav + .alert-text > .alert-body:first-child { margin-top: 0; }
.alert-nav + .alert-text > .alert-input:first-child { margin-top: 0; }
@media (max-width: 760px) { .alert-nav .nav-btn { min-height: 44px; } }
/* 用鼠标或手指打开的弹窗，自动聚焦的按钮不画焦点框；用键盘操作时才显示 */
:root[data-input="pointer"] dialog button:focus-visible { outline: none; }
.password-box { margin-top: 12px; padding: 12px; border-radius: 10px; background: var(--fill); font-family: var(--mono); font-size: 16px; font-weight: 600; user-select: all; -webkit-user-select: all; overflow-wrap: anywhere; }

/* 通知 */
.bell-wrap { position: relative; }
.popover {
  position: absolute; z-index: 35; top: calc(100% + 8px); right: 0; width: 380px; max-height: 70vh; display: flex; flex-direction: column;
  overflow: hidden; border-radius: 16px; background: var(--surface-raised); box-shadow: var(--shadow-float); outline: 1px solid var(--sep);
  transform-origin: top right; animation: pop-in .24s var(--spring);
}
.popover-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; font-size: 16px; font-weight: 600; box-shadow: inset 0 -1px 0 var(--sep); }
.popover-list { overflow-y: auto; }
.notice { position: relative; display: block; width: 100%; padding: 10px 16px 10px 28px; text-align: left; }
.notice + .notice::before { content: ""; position: absolute; top: 0; left: 28px; right: 0; height: 1px; background: var(--sep); transform: scaleY(.6); }
.notice:hover { background: var(--fill-soft); }
.notice.unread::after { content: ""; position: absolute; left: 11px; top: 16px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.notice-body { font-size: 14px; overflow-wrap: anywhere; }
.notice.unread .notice-body { font-weight: 500; }
.notice-time { margin-top: 2px; font-size: 13px; color: var(--label-3); }

/* 屏幕上方居中，一眼看得到，不挡左边的标题和右边的按钮。深色实底白字，浅色深色、什么背景上都看得清。 */
.toasts {
  position: fixed; z-index: 60; inset: max(calc(env(safe-area-inset-top) + 10px), 14px) 0 auto 0; margin: 0 auto; padding: 0; border: 0; background: none; color: inherit; overflow: visible;
  display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(480px, calc(100vw - 24px)); height: auto; pointer-events: none;
}
.toast {
  max-width: 100%; padding: 10px 18px; border-radius: 14px; background: #2C2C2E; color: #fff; font-size: 14px; font-weight: 500; line-height: 1.4; text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .28); outline: 1px solid rgba(255, 255, 255, .16); overflow-wrap: anywhere;
  animation: drop-in .4s var(--spring);
}
.toast.error { background: var(--danger-fill); }

/* 登录 */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 22px; text-align: center; }
.auth-card img { width: 72px; height: 72px; margin: 0 auto; filter: drop-shadow(0 6px 14px rgba(0, 113, 227, .28)); }
.auth-card h1 { font-size: 28px; font-weight: 700; letter-spacing: -.01em; }
.auth-card p { margin-top: 6px; color: var(--label-2); font-size: 15px; }
.auth-card .row-label, .account-form .row-label { width: 74px; text-align: left; }
.auth-card .row .input, .account-form .row .input { flex: 1; min-width: 0; padding: 4px 0; background: none; border-radius: 0; min-height: 32px; }
.auth-card .row .input:focus, .account-form .row .input:focus { outline: none; }
.auth-card .form-error { padding: 0; }

@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.96); } }
@keyframes slide-left { from { transform: translateX(calc(100% + 20px)); } }
@keyframes slide-up { from { transform: translateY(100%); } }
@keyframes drop-in { from { opacity: 0; transform: translateY(-24px) scale(.96); } }
@keyframes rise-in { from { opacity: 0; transform: translateY(20px) scale(.97); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, ::backdrop { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* 手机：44pt 触控区、标签栏、从底部弹起的页面 */
@media (max-width: 760px) {
  body { font-size: 16px; }
  input, select, textarea, .input, .select, .textarea { font-size: 16px; }
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .nav { display: none; }
  .mobile-only { display: inline-grid !important; }
  .desk-only { display: none !important; }
  /* 手机：大标题随内容滚走；通知和账号在标题同一行，页面操作单独一行 */
  .pagehead { position: static; padding: max(10px, env(safe-area-inset-top)) 16px 10px; -webkit-backdrop-filter: none; backdrop-filter: none; background: none; }
  .pagehead h1 { font-size: 32px; }
  .head-global { order: 3; margin-left: auto; }
  .head-tools { order: 4; flex-basis: 100%; margin-left: 0; }
  .head-tools .segmented { flex: 1; }
  .head-tools .segmented button { flex: 1; min-height: 32px; }
  .page { padding: 2px 16px 28px; gap: 20px; }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding-bottom: env(safe-area-inset-bottom);
    background: var(--material); border-top: 1px solid var(--sep);
    -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 50px; padding: 5px 2px 3px; color: var(--label-3); font-size: 11px; font-weight: 500; text-decoration: none; }
  .tabbar a[aria-current="page"] { color: var(--accent); }
  .tabbar svg { width: 25px; height: 25px; }
  .icon-btn { width: 40px; height: 40px; }
  .btn { min-height: 40px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filterbar { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 8px; scrollbar-width: none; }
  .filterbar::-webkit-scrollbar { display: none; }
  .filterbar > * { flex: none; }
  .search { width: 170px; }
  .select.pill, .pill-btn, .toggle-pill, .reset-btn, .search .input { min-height: 38px; font-size: 14px; }
  .picker { position: static; }
  .panel { position: fixed; top: auto; left: 8px; right: 8px; bottom: calc(66px + env(safe-area-inset-bottom)); width: auto; max-height: 60vh; animation-name: drop-in; }
  .pitem { min-height: 44px; }
  .list-row.wrap-mobile { flex-wrap: wrap; }
  .list-row.wrap-mobile .list-side { width: 100%; justify-content: flex-end; }
  .board { grid-auto-columns: minmax(80vw, 1fr); scroll-snap-type: x proximity; margin: 0 -16px; padding: 0 16px 12px; scroll-padding-left: 16px; }
  .col { scroll-snap-align: start; max-height: none; }
  .vcard-foot .btn { min-height: 40px; }
  .sheet {
    top: max(env(safe-area-inset-top), 14px); left: 0; right: 0; bottom: 0; width: 100%;
    border-radius: 14px 14px 0 0; animation-name: slide-up;
  }
  .grabber { display: block; position: absolute; top: 5px; left: 50%; width: 36px; height: 5px; margin-left: -18px; border-radius: 999px; background: var(--fill-strong); z-index: 2; }
  .sheet-nav { padding-top: 14px; min-height: 58px; }
  .sheet-body { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .nav-btn { min-height: 44px; font-size: 17px; }
  .toggle { min-height: 40px; padding: 6px 16px; font-size: 15px; }
  .sub-name { width: 52px; }
  .sub-reason { padding-left: 0; }
  .select.status { min-height: 36px; }
  .select.form { min-height: 40px; }
  dialog.modal:not(.alert) {
    width: 100%; max-width: 100%; margin: auto 0 0; max-height: calc(100dvh - 14px - env(safe-area-inset-top));
    border-radius: 14px 14px 0 0;
  }
  dialog.modal:not(.alert)[open] { animation-name: slide-up; animation-duration: .36s; }
  .alert-actions button { min-height: 50px; }
  .popover { position: fixed; top: max(calc(env(safe-area-inset-top) + 58px), 62px); left: 8px; right: 8px; width: auto; max-height: calc(100dvh - 150px); }
  .notice { padding-block: 13px; }
}
