:root {
  --paper: #f6f3ec;
  --card: #fffdf8;
  --card-2: #fbf8f1;
  --ink: #1f1d1a;
  --ink-2: #4a463f;
  --muted: #736e63;
  --line: #e4ded1;
  --line-strong: #d3cbb9;
  --accent: #b4472e;
  --accent-soft: #f7e8e3;
  --green: #3f7a4f;
  --green-soft: #e8f1e8;
  --amber: #b07d20;
  --amber-soft: #f8efdc;
  --blue: #2f6f8f;
  --blue-soft: #e4eef3;
  --gray-soft: #efece4;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(31, 29, 26, .05), 0 10px 30px -18px rgba(31, 29, 26, .35);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #141311;
    --card: #1c1a17;
    --card-2: #221f1b;
    --ink: #f1ece1;
    --ink-2: #c8c1b2;
    --muted: #8e8778;
    --line: #302b24;
    --line-strong: #413a31;
    --accent: #e0785f;
    --accent-soft: #3a231d;
    --green: #7fb189;
    --green-soft: #1f2c22;
    --amber: #d3a44a;
    --amber-soft: #33290f;
    --blue: #7fb0c9;
    --blue-soft: #1b2a31;
    --gray-soft: #262320;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 30px -18px rgba(0, 0, 0, .8);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Noto Sans SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
h1, h2, h3, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

[hidden] { display: none !important; }

/* ------------------------------------------------------------ 登录 */

.login {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 10%, rgba(180, 71, 46, .07), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(47, 111, 143, .07), transparent 45%),
    var(--paper);
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 34px 28px 28px;
  box-shadow: var(--shadow);
  text-align: center;
}

.login-logo {
  width: 54px; height: 54px;
  margin: 0 auto 14px;
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 26px;
  box-shadow: 0 8px 20px -8px rgba(180, 71, 46, .7);
}

.login-card h1 { font-size: 22px; letter-spacing: .08em; font-weight: 650; }
.login-card .sub { color: var(--muted); font-size: 12.5px; letter-spacing: .22em; margin-top: 6px; }

.login-card form { margin-top: 26px; text-align: left; }

.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .1em;
  margin-bottom: 6px;
}

input[type="password"], input[type="text"], input[type="time"], input[type="date"], select, textarea {
  width: 100%;
  padding: 11px 12px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  min-height: 44px;
  font-size: 16px; /* 小于 16px 时 iOS 聚焦会自动放大页面 */
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea { resize: vertical; min-height: 74px; line-height: 1.5; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--ink);
  font-size: 14px;
  transition: transform .06s, background .15s, border-color .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
  font-weight: 550;
}
.btn.primary:active { background: var(--ink-2); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.block { width: 100%; }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn.danger { color: var(--accent); border-color: var(--line); }
.btn:disabled { opacity: .5; }

.err { color: var(--accent); font-size: 13px; min-height: 20px; margin-top: 10px; text-align: center; }

/* ------------------------------------------------------------ 外壳 */

.app { min-height: 100dvh; padding-bottom: calc(72px + var(--safe-bottom)); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px 10px;
  max-width: 1080px;
  margin: 0 auto;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
}

.brand {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: .16em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.brand small { letter-spacing: .04em; color: var(--muted); font-weight: 400; font-size: 11px; }

.top-actions { display: flex; gap: 4px; align-items: center; }

.icon-btn {
  padding: 7px 11px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--gray-soft); color: var(--ink); }
.icon-btn.active { color: var(--ink); background: var(--gray-soft); font-weight: 550; }

/* 日期栏 */
.dateline {
  max-width: 1080px;
  margin: 0 auto;
  padding: 2px 18px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}
.nav-btn:hover { background: var(--gray-soft); color: var(--ink); }

.dateline-main { flex: 1; min-width: 0; }
.d-date { font-size: 22px; font-weight: 650; letter-spacing: .01em; line-height: 1.25; }
.d-date .wd { color: var(--muted); font-size: 14px; font-weight: 400; margin-left: 7px; letter-spacing: .08em; }
.d-sub { color: var(--muted); font-size: 12px; margin-top: 1px; }

.today-btn {
  padding: 5px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink-2);
  background: var(--card);
}

/* 一周条 */
.weekstrip {
  max-width: 1080px;
  margin: 12px auto 0;
  padding: 0 18px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}
.wd-cell {
  border-radius: 10px;
  padding: 7px 2px 6px;
  text-align: center;
  border: 1px solid transparent;
  transition: background .15s;
  position: relative;
}
.wd-cell:hover { background: var(--gray-soft); }
.wd-cell .wd-name { font-size: 10.5px; color: var(--muted); letter-spacing: .08em; }
.wd-cell .wd-num { font-size: 15px; font-weight: 550; margin-top: 1px; font-variant-numeric: tabular-nums; }
.wd-cell .wd-dot {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--line-strong);
  margin: 3px auto 0;
}
.wd-cell.has-plan .wd-dot { background: var(--accent); opacity: .75; }
.wd-cell.today { border-color: var(--line-strong); background: var(--card); }
.wd-cell.selected { background: var(--ink); color: var(--paper); }
.wd-cell.selected .wd-name, .wd-cell.selected .wd-dot { color: var(--paper); opacity: .6; }
.wd-cell.selected .wd-dot { background: var(--paper); }

/* 主体 */
main { max-width: 1080px; margin: 0 auto; padding: 16px 18px 40px; }

.view-title { display: none; }

.today-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }

/* ------------------------------------------------------------ 卡片与概览 */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.ov-item {
  background: var(--card);
  padding: 12px 10px 11px;
  text-align: center;
}
.ov-num {
  font-size: 21px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  letter-spacing: -.01em;
}
.ov-num small { font-size: 11px; font-weight: 400; color: var(--muted); margin-left: 1px; }
.ov-label { font-size: 11px; color: var(--muted); letter-spacing: .06em; margin-top: 2px; }

.progress-wrap { margin-top: 12px; }
.progress-head {
  display: flex; justify-content: space-between;
  font-size: 11.5px; color: var(--muted); margin-bottom: 5px;
}
.progress-bar {
  height: 6px; border-radius: 99px;
  background: var(--gray-soft);
  overflow: hidden;
}
.progress-bar > i {
  display: block; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), #d4805f);
  transition: width .35s ease;
}

/* 现在提示 */
.nowbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--card-2);
  border: 1px dashed var(--line-strong);
  font-size: 13px;
  color: var(--ink-2);
}
.nowbar .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  flex: none;
}
.nowbar b { font-weight: 650; }
.nowbar .spacer { flex: 1; }

/* ------------------------------------------------------------ 时间块 */

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 4px 2px 10px;
}
.section-head h2 { font-size: 13px; letter-spacing: .14em; color: var(--muted); font-weight: 550; }
.section-head .hint { font-size: 11.5px; color: var(--muted); }

.blocks { display: flex; flex-direction: column; gap: 8px; }

.block {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px 11px 0;
  position: relative;
  overflow: hidden;
  transition: border-color .15s, transform .06s, box-shadow .15s;
}
.block::before {
  content: "";
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--c, var(--muted));
}
.block:hover { border-color: var(--line-strong); }
.block:active { transform: scale(.995); }
.block.done { background: linear-gradient(180deg, var(--card), var(--card)); }
.block.skipped .b-title { text-decoration: line-through; color: var(--muted); }

.block-time {
  text-align: right;
  font-variant-numeric: tabular-nums;
  padding-top: 1px;
  line-height: 1.35;
}
.block-time .t1 { display: block; font-size: 13.5px; font-weight: 600; }
.block-time .t2 { display: block; font-size: 11.5px; color: var(--muted); }

.block-body { min-width: 0; }
.block-head { display: flex; align-items: flex-start; gap: 8px; }
.b-title {
  font-size: 15px; font-weight: 520; flex: 1; min-width: 0;
  overflow-wrap: anywhere; line-height: 1.4;
}

.chip {
  flex: none;
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: .04em;
  color: var(--c, var(--muted));
  background: color-mix(in srgb, var(--c, #8a8578) 11%, transparent);
  border: 1px solid color-mix(in srgb, var(--c, #8a8578) 22%, transparent);
  white-space: nowrap;
}

.block-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}
.block-meta .actual { font-variant-numeric: tabular-nums; }
.dev { font-variant-numeric: tabular-nums; }
.dev.late { color: var(--accent); }
.dev.early { color: var(--blue); }
.dev.ok { color: var(--green); }

.status {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; padding: 1px 7px; border-radius: 999px;
  font-weight: 500;
}
.status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status.done { color: var(--green); background: var(--green-soft); }
.status.partial { color: var(--amber); background: var(--amber-soft); }
.status.pending { color: var(--muted); background: var(--gray-soft); }
.status.doing { color: var(--blue); background: var(--blue-soft); }
.status.skipped { color: var(--muted); background: transparent; border: 1px dashed var(--line-strong); }

.block-actions { display: flex; gap: 6px; margin-top: 8px; }
.mini-btn {
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 7px;
  border: 1px solid var(--line-strong);
  color: var(--ink-2);
  background: var(--card-2);
  min-height: 26px;
}
.mini-btn:hover { border-color: var(--ink); color: var(--ink); }
.mini-btn.solid { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.block-note {
  margin-top: 5px;
  font-size: 12px;
  color: var(--muted);
  border-left: 2px solid var(--line);
  padding-left: 8px;
  overflow-wrap: anywhere;
}

.empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  font-size: 13.5px;
  line-height: 1.9;
}
.empty b { display: block; color: var(--ink-2); font-size: 15px; margin-bottom: 4px; font-weight: 550; }

.add-row { margin-top: 12px; display: flex; gap: 8px; }

/* ------------------------------------------------------------ 右栏 */

.side { display: flex; flex-direction: column; gap: 14px; }

.ring-card { display: flex; align-items: center; gap: 16px; }
.ring { position: relative; width: 92px; height: 92px; flex: none; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring-label {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  text-align: center;
}
.ring-label .v { font-size: 20px; font-weight: 650; line-height: 1; font-variant-numeric: tabular-nums; }
.ring-label .l { font-size: 10px; color: var(--muted); margin-top: 3px; letter-spacing: .08em; }

.ring-info { min-width: 0; }
.ring-info h3 { font-size: 13px; letter-spacing: .1em; color: var(--muted); font-weight: 550; }
.ring-info p { font-size: 13px; margin-top: 4px; color: var(--ink-2); line-height: 1.5; }

.kv-list { margin-top: 12px; display: flex; flex-direction: column; gap: 9px; }
.kv { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 13px; }
.kv span { color: var(--muted); }
.kv b { font-weight: 600; font-variant-numeric: tabular-nums; }

.cat-bars { display: flex; flex-direction: column; gap: 9px; margin-top: 12px; }
.cat-row { display: grid; grid-template-columns: 60px minmax(0, 1fr) 42px; align-items: center; gap: 8px; font-size: 12px; }
.cat-name { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-track { height: 6px; background: var(--gray-soft); border-radius: 99px; overflow: hidden; }
.cat-track > i { display: block; height: 100%; border-radius: 99px; background: var(--c); }
.cat-val { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11.5px; }

.tip { font-size: 12.5px; color: var(--muted); line-height: 1.75; }
.tip b { color: var(--ink-2); font-weight: 550; }

/* ------------------------------------------------------------ 统计页 */

.stats-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.stats-head h1 { font-size: 19px; font-weight: 650; letter-spacing: .04em; }

.seg {
  display: inline-flex;
  background: var(--gray-soft);
  border-radius: 9px;
  padding: 3px;
  gap: 2px;
}
.seg button {
  padding: 5px 11px;
  border-radius: 7px;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .07); font-weight: 550; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
}
.stat .s-label { font-size: 11.5px; color: var(--muted); letter-spacing: .06em; }
.stat .s-value { font-size: 24px; font-weight: 650; margin-top: 3px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .s-value small { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 3px; }
.stat .s-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.chart-card { margin-bottom: 16px; }
.chart-card h2, .block-card h2 {
  font-size: 13px; letter-spacing: .1em; color: var(--muted);
  font-weight: 550; margin-bottom: 14px;
  display: flex; justify-content: space-between; align-items: baseline;
}
.legend { display: flex; gap: 12px; font-size: 11px; letter-spacing: 0; color: var(--muted); font-weight: 400; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; vertical-align: 0; }

.bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 148px;
  padding-top: 8px;
}
.bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; gap: 4px; min-width: 0; }
.bar-pair { flex: 1; display: flex; align-items: flex-end; gap: 2px; width: 100%; justify-content: center; }
.bar {
  width: 46%;
  max-width: 16px;
  border-radius: 3px 3px 0 0;
  background: var(--line-strong);
  min-height: 2px;
  position: relative;
  transition: height .3s;
}
.bar.plan { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.bar.actual { background: var(--accent); }
.bar-group.today .bar.actual { background: var(--ink); }
.bar-x { font-size: 10px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bar-x.today { color: var(--ink); font-weight: 600; }

.donut-wrap { display: flex; align-items: center; gap: 18px; }
.donut { flex: none; }
.donut-center { font-size: 11px; fill: var(--muted); }
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.dl-row { display: flex; align-items: center; gap: 7px; font-size: 12.5px; }
.dl-dot { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.dl-name { flex: 1; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-val { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11.5px; }

.insight-list { display: flex; flex-direction: column; gap: 10px; }
.insight { display: flex; gap: 9px; font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.insight .ico {
  flex: none; width: 20px; height: 20px; border-radius: 6px;
  display: grid; place-items: center; font-size: 11px;
  background: var(--accent-soft); color: var(--accent);
  margin-top: 1px;
}
.insight b { font-weight: 600; color: var(--ink); }

/* ------------------------------------------------------------ 设置页 */

.set-card { margin-bottom: 14px; }
.set-card h2 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.set-card .desc { font-size: 12px; color: var(--muted); margin-bottom: 14px; line-height: 1.7; }

.cat-edit { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.cat-edit-row { display: flex; gap: 8px; align-items: center; }
.cat-edit-row input[type="color"] {
  width: 38px; height: 38px; padding: 2px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card-2); flex: none;
}
.cat-edit-row input[type="text"] { flex: 1; min-height: 38px; padding: 8px 10px; }
.cat-del {
  width: 34px; height: 34px; flex: none; border-radius: 8px;
  color: var(--muted); display: grid; place-items: center; font-size: 16px;
}
.cat-del:hover { background: var(--accent-soft); color: var(--accent); }

.set-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ------------------------------------------------------------ 弹层 */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(24, 22, 19, .42);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0; } }
@keyframes slideup { from { transform: translateY(18px); opacity: .6; } }

.sheet {
  width: 100%;
  max-width: 520px;
  max-height: 92dvh;
  overflow-y: auto;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  padding: 20px 20px calc(20px + var(--safe-bottom));
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .2);
  animation: slideup .2s ease;
}
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.sheet-head h2 { font-size: 16px; font-weight: 600; }
.sheet-close { width: 32px; height: 32px; border-radius: 50%; color: var(--muted); font-size: 18px; }
.sheet-close:hover { background: var(--gray-soft); }

.cat-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-pick {
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 34px;
}
.cat-pick i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.cat-pick.on { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.cat-pick.on i { background: var(--paper); }

.status-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.status-pick button {
  padding: 8px 2px;
  border-radius: 9px;
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  min-height: 38px;
}
.status-pick button.on { border-color: var(--ink); background: var(--ink); color: var(--paper); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-row-3 { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }

.quick-times { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.quick-times button {
  font-size: 11.5px; padding: 4px 9px; border-radius: 7px;
  border: 1px solid var(--line); color: var(--muted); min-height: 28px;
}
.quick-times button:hover { border-color: var(--ink); color: var(--ink); }

.modal-actions { display: flex; gap: 8px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }

/* ------------------------------------------------------------ 底部导航 / Toast */

.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 40;
  display: flex;
  justify-content: space-around;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(6px + var(--safe-bottom));
}
.tabbar button {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 10.5px; color: var(--muted); padding: 5px 0;
  border-radius: 9px;
}
.tabbar button .ti { font-size: 17px; line-height: 1.2; }
.tabbar button.on { color: var(--accent); font-weight: 550; }

.fab {
  position: fixed;
  right: 18px;
  bottom: calc(74px + var(--safe-bottom));
  z-index: 35;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-size: 26px;
  line-height: 1;
  display: grid; place-items: center;
  box-shadow: 0 10px 24px -8px rgba(0, 0, 0, .5);
}
.fab:active { transform: scale(.95); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(88px + var(--safe-bottom));
  transform: translate(-50%, 10px);
  background: var(--ink);
  color: var(--paper);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 200;
  white-space: nowrap;
  max-width: 86vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.show { opacity: .95; transform: translate(-50%, 0); }

/* ------------------------------------------------------------ 桌面 */

@media (min-width: 860px) {
  body { font-size: 15px; }
  .app { padding-bottom: 40px; }
  .topbar { padding: 20px 24px 10px; }
  .dateline, .weekstrip, main { padding-left: 24px; padding-right: 24px; }
  .tabbar { display: none; }
  .fab { display: none; }
  .today-grid { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; gap: 22px; }
  .side { position: sticky; top: 76px; }
  .view-title { display: block; }
  .modal { align-items: center; }
  .sheet { border-radius: 20px; max-height: 88vh; padding-bottom: 20px; margin: 20px; }
  .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .d-date { font-size: 24px; }
  .add-row .btn { flex: none; }
}

@media (max-width: 380px) {
  .overview { grid-template-columns: repeat(2, 1fr); }
  .ov-item { padding: 10px 6px; }
  .block { grid-template-columns: 50px minmax(0, 1fr); }
  .bar-x { font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* 统计口径说明 */
.formula {
  margin: -6px 2px 14px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}
