/* ==========================================================================
   信息提炼助手 · 移动端界面
   视觉：鲸尾管家（深海页头 + 海雾底 + 白卡片 + 金线点睛）
   布局：固定页头 + 可滚动内容 + 底部 4 tab；全面适配 iOS 安全区与键盘。
   ========================================================================== */

:root {
  --navy: #1e3358;
  --navy-deep: #16294a;
  --blue: #2f5c9e;
  --sky: #7fb3e0;
  --mist: #bfd9f2;
  --gold: #c9a55c;
  --gold-soft: #ead9b0;
  --bg: #f2f8fe;
  --bg2: #eaf4fc;
  --card: #ffffff;
  --line: #dfeaf6;
  --line-strong: #c9dbee;
  --chip: #f1f8fe;
  --ink: #16233f;
  --ink2: #5a6b85;
  --muted: #5f7189;
  --success: #2f855a;
  --success-bg: #f0fff4;
  --info: #2b6cb0;
  --info-bg: #ebf4ff;
  --warn: #b7791f;
  --warn-bg: #fffbe6;
  --danger: #c53030;
  --danger-bg: #fff5f5;
  --radius-card: 18px;
  --radius-sm: 14px;
  --shadow-card: 0 2px 10px rgba(35, 74, 128, 0.06);
  --shadow-lift: 0 10px 26px rgba(22, 41, 74, 0.16);
  --tabbar-h: 58px;
  --app-vh: 100vh;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overflow: hidden;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

svg {
  display: block;
  flex: 0 0 auto;
}

button {
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

input,
textarea {
  font: inherit;
  color: inherit;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   启动页
   -------------------------------------------------------------------------- */
.boot {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(24px + var(--safe-top)) 20px calc(24px + var(--safe-bottom));
  background: linear-gradient(165deg, #101f3a 0%, #16294a 42%, #1e3358 68%, #2b4f8c 100%);
  color: #fff;
  overflow: hidden;
  transition: opacity 0.26s var(--ease);
}

.boot.is-done {
  opacity: 0;
  pointer-events: none;
}

.bubbles {
  position: absolute;
  inset: -12% -14% 26%;
  pointer-events: none;
  background-image: radial-gradient(circle at 16% 34%, rgba(127, 179, 224, 0.26) 0 5px, transparent 6px),
    radial-gradient(circle at 68% 20%, rgba(191, 217, 242, 0.18) 0 9px, transparent 10px),
    radial-gradient(circle at 86% 58%, rgba(127, 179, 224, 0.16) 0 6px, transparent 7px),
    radial-gradient(circle at 34% 76%, rgba(191, 217, 242, 0.14) 0 4px, transparent 5px),
    radial-gradient(circle at 54% 46%, rgba(201, 165, 92, 0.14) 0 3px, transparent 4px),
    radial-gradient(circle at 8% 66%, rgba(127, 179, 224, 0.2) 0 7px, transparent 8px);
  animation: bubble-float 22s ease-in-out infinite alternate;
}

@keyframes bubble-float {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(0, -14px, 0) scale(1.02);
  }
}

.boot-inner {
  position: relative;
  width: min(90vw, 360px);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.boot-badge {
  width: 84px;
  height: 84px;
  margin-bottom: 18px;
  filter: drop-shadow(0 12px 26px rgba(0, 0, 0, 0.34));
  animation: badge-in 0.5s var(--ease) both;
}

@keyframes badge-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
}

.boot-title {
  margin: 0;
  font-size: 27px;
  font-weight: 800;
  letter-spacing: 3px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.24);
}

.boot-sub {
  margin-top: 9px;
  font-size: 12.5px;
  letter-spacing: 0.6px;
  color: rgba(214, 231, 248, 0.78);
}

.boot-progress {
  width: 100%;
  margin-top: 34px;
}

.bar {
  position: relative;
  height: 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, #7fb3e0 0%, #ead9b0 100%);
  transition: width 0.32s var(--ease);
}

.boot-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-top: 10px;
  font-size: 11.5px;
  color: rgba(214, 231, 248, 0.76);
}

.boot-meta b {
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.boot-tip {
  margin: 22px 0 0;
  font-size: 11.5px;
  line-height: 1.65;
  color: rgba(214, 231, 248, 0.6);
}

.boot-error {
  margin-top: 26px;
  width: 100%;
  text-align: left;
  background: rgba(12, 24, 44, 0.42);
  border: 1px solid rgba(255, 160, 160, 0.28);
  border-radius: 14px;
  padding: 12px 14px;
}

.boot-error h3 {
  margin: 0 0 6px;
  font-size: 13px;
  color: #ffd9d9;
  display: flex;
  align-items: center;
  gap: 6px;
}

.boot-error p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: #f7e5e5;
  word-break: break-word;
}

.boot-detail {
  margin-top: 10px;
  max-height: 24vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10.5px;
  line-height: 1.5;
  color: #ffc9c9;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 8px;
  padding: 8px 9px;
}

.boot-actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  justify-content: center;
}

.btn-on-dark {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
}

/* --------------------------------------------------------------------------
   主框架
   -------------------------------------------------------------------------- */
.app {
  position: fixed;
  inset: 0;
  height: var(--app-vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.22s var(--ease);
}

.app.is-ready {
  opacity: 1;
}

/* 页头 */
.appbar {
  position: relative;
  z-index: 10;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 0 0 22px 22px;
  padding: calc(var(--safe-top) + 14px) 18px 20px;
  background: linear-gradient(152deg, #16294a 0%, #1e3358 46%, #2b4f8c 100%);
  color: #fff;
  box-shadow: 0 10px 24px rgba(22, 41, 74, 0.18);
}

.appbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 11px;
  background: radial-gradient(circle at 9px 0, transparent 8.4px, var(--bg) 8.8px) repeat-x;
  background-size: 18px 11px;
  pointer-events: none;
}

.brand-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-badge {
  flex: 0 0 auto;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.26));
}

.brand-text {
  flex: 1;
  min-width: 0;
}

.brand-title {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  margin-top: 2px;
  font-size: 11px;
  letter-spacing: 0.3px;
  color: rgba(214, 231, 248, 0.74);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-new {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 700;
  color: #3a2a0d;
  background: linear-gradient(135deg, #efdfb6 0%, #d6b573 55%, #c9a55c 100%);
  box-shadow: 0 6px 16px rgba(201, 165, 92, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.65);
  cursor: pointer;
  transition: transform 0.1s var(--ease), opacity 0.15s;
}

.btn-new:active {
  transform: scale(0.97);
}

.stat-strip {
  position: relative;
  display: flex;
  gap: 8px;
  margin-top: 15px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.stat-strip::-webkit-scrollbar {
  display: none;
}

.stat {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 7px 11px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.11);
  font-size: 11.5px;
  color: rgba(226, 238, 250, 0.86);
  white-space: nowrap;
}

.stat b {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.stat.is-warn {
  border-color: rgba(234, 217, 176, 0.5);
  background: rgba(201, 165, 92, 0.18);
}

.stat.is-warn b {
  color: #f4e3bd;
}

/* 内容区 */
.app-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 14px 14px 22px;
  scroll-behavior: smooth;
}

.screen {
  display: none;
  animation: screen-in 0.2s var(--ease);
}

.screen.is-active {
  display: block;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

.screen-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding: 0 4px 10px;
}

.screen-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.4px;
  color: var(--navy);
}

.screen-sub {
  margin: 3px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}

.toolbar {
  position: sticky;
  top: -14px;
  z-index: 4;
  margin: -2px -14px 10px;
  padding: 8px 14px 9px;
  background: linear-gradient(180deg, var(--bg) 72%, rgba(242, 248, 254, 0.86));
  backdrop-filter: blur(6px);
}

/* --------------------------------------------------------------------------
   通用控件
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 10px 16px;
  border: 0;
  border-radius: 12px;
  background: var(--chip);
  color: var(--navy);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s var(--ease), opacity 0.15s;
}

.btn:active {
  transform: scale(0.98);
}

.btn[disabled] {
  opacity: 0.5;
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(135deg, #3765a8 0%, #2f5c9e 45%, #1e3358 100%);
  color: #fff;
  box-shadow: 0 7px 18px rgba(30, 51, 88, 0.22);
}

.btn-ghost {
  background: #fff;
  border: 1px solid var(--line-strong);
  color: var(--navy);
}

.btn-danger {
  background: linear-gradient(135deg, #dc5a5a, #c53030);
  color: #fff;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  min-height: 34px;
  padding: 7px 11px;
  font-size: 12.5px;
  border-radius: 10px;
}

.spinner {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.seg {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--chip);
}

.seg > button {
  flex: 1;
  min-height: 32px;
  padding: 6px 8px;
  border: 0;
  border-radius: 9px;
  background: none;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink2);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s, color 0.14s, box-shadow 0.14s;
}

.seg > button.is-on {
  background: #fff;
  color: var(--navy);
  box-shadow: 0 1px 4px rgba(30, 51, 88, 0.14);
}

.seg.is-dark {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.24);
}

.seg.is-dark > button {
  color: rgba(226, 238, 250, 0.8);
}

.seg.is-dark > button.is-on {
  background: rgba(255, 255, 255, 0.94);
  color: var(--navy);
}

.switch {
  position: relative;
  flex: 0 0 auto;
  width: 46px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #e4eef8;
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(22, 41, 74, 0.24);
  transition: transform 0.16s var(--ease);
}

.switch[aria-checked="true"] {
  background: linear-gradient(135deg, #3765a8, #1e3358);
  border-color: #1e3358;
}

.switch[aria-checked="true"]::after {
  transform: translateX(18px);
}

.input,
input[type="text"],
input[type="password"],
input[type="number"],
textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  font-size: 13.5px;
  color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  transition: border-color 0.14s, box-shadow 0.14s;
}

.input:focus,
input:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 92, 158, 0.12);
}

textarea {
  min-height: 120px;
  line-height: 1.6;
  resize: none;
}

.input-inline {
  width: 86px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   卡片 / chip / 证据
   -------------------------------------------------------------------------- */
.card {
  position: relative;
  margin-bottom: 10px;
  padding: 13px 14px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--card);
  box-shadow: var(--shadow-card);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--chip);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink2);
  white-space: nowrap;
}

.chip-important {
  background: #fff8e8;
  border-color: #ecd5a5;
  color: #8a5a12;
}

.chip-normal {
  background: var(--chip);
  color: var(--ink2);
}

.chip-calm {
  background: #f7fafc;
  border-color: #e6edf5;
  color: var(--muted);
}

.chip-warn {
  background: var(--warn-bg);
  border-color: #f0dfa8;
  color: #8a6512;
}

.chip-due {
  background: var(--info-bg);
  border-color: #cfe2f8;
  color: var(--info);
}

.chip-due.is-overdue {
  background: var(--danger-bg);
  border-color: #f6c9c9;
  color: var(--danger);
}

.chip-due.is-soon {
  background: var(--warn-bg);
  border-color: #f0dfa8;
  color: #8a5a12;
}

.tag {
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 8px;
  background: #f7fafc;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
}

/* 证据 */
.ev-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  padding: 4px 2px;
  border: 0;
  background: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--blue);
  cursor: pointer;
}

.ev-toggle svg {
  transition: transform 0.18s var(--ease);
}

.item.is-open .ev-toggle svg {
  transform: rotate(180deg);
}

.ev {
  display: none;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #f9fcff, #f3f8fd);
}

.item.is-open .ev {
  display: block;
  animation: ev-in 0.18s var(--ease);
}

@keyframes ev-in {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
}

.ev-quote {
  margin: 0;
  padding-left: 9px;
  border-left: 3px solid var(--gold);
  font-size: 12.5px;
  line-height: 1.6;
  color: #3d4d66;
  word-break: break-word;
}

.ev-msg {
  margin: 7px 0 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
  word-break: break-word;
}

.ev-src {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   结果摘要卡
   -------------------------------------------------------------------------- */
.result-card {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-card);
  background: linear-gradient(158deg, #ffffff 0%, #f8fbff 62%, #f4f9ff 100%);
  box-shadow: var(--shadow-card);
}

.result-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.result-title {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-mode {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef5fd;
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 600;
  color: var(--blue);
}

.result-meta {
  margin-top: 6px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--muted);
  word-break: break-word;
}

.result-meta b {
  color: var(--ink2);
  font-weight: 700;
}

.result-warn {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  padding: 8px 9px;
  border-radius: 10px;
  background: var(--warn-bg);
  border: 1px solid #f0dfa8;
  font-size: 11.5px;
  line-height: 1.5;
  color: #7a5a10;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

/* --------------------------------------------------------------------------
   待办
   -------------------------------------------------------------------------- */
.item {
  position: relative;
}

.todo {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.todo-check {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: -6px 0 -6px -9px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}

.todo-check .box {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: #fff;
  color: transparent;
  transition: background 0.16s, border-color 0.16s, color 0.16s, transform 0.12s;
}

.todo-check:active .box {
  transform: scale(0.92);
}

.is-done .todo-check .box {
  border-color: var(--navy);
  background: linear-gradient(135deg, #3765a8, #1e3358);
  color: #fff;
}

.todo-main {
  flex: 1;
  min-width: 0;
}

.todo-text {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--ink);
  word-break: break-word;
}

.is-done .todo-text {
  color: var(--muted);
  font-weight: 500;
  text-decoration: line-through;
  text-decoration-color: rgba(95, 113, 137, 0.5);
}

.is-done .card {
  background: #fbfdff;
}

.todo-flash {
  animation: flash 1.4s var(--ease);
}

@keyframes flash {
  0%,
  100% {
    box-shadow: var(--shadow-card);
  }
  25% {
    box-shadow: 0 0 0 3px rgba(201, 165, 92, 0.55);
  }
}

/* --------------------------------------------------------------------------
   要点
   -------------------------------------------------------------------------- */
.kp {
  position: relative;
  margin-bottom: 9px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.kp::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: var(--line-strong);
}

.kp.k-notice::before {
  background: linear-gradient(180deg, #9cc4e8, #2f5c9e);
}

.kp.k-question::before {
  background: linear-gradient(180deg, #ead9b0, #c9a55c);
}

.kp.k-decision::before {
  background: linear-gradient(180deg, #8ed3ae, #2f855a);
}

.kp-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  word-break: break-word;
}

.kp-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.kp-foot .ev-toggle {
  margin-top: 6px;
}

/* --------------------------------------------------------------------------
   日程
   -------------------------------------------------------------------------- */
.week-card {
  margin-bottom: 12px;
  padding: 11px 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #fff;
  box-shadow: var(--shadow-card);
}

.week-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
}

.week-nav b {
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
}

.week-nav button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink2);
  cursor: pointer;
}

.week-nav button[disabled] {
  opacity: 0.4;
  pointer-events: none;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
}

.week-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 0;
  padding: 5px 0 4px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  cursor: pointer;
}

.week-col .wd {
  font-size: 10px;
  color: var(--muted);
}

.week-col .dd {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.week-col.is-today .dd {
  background: linear-gradient(135deg, #3765a8, #1e3358);
  color: #fff;
}

.week-col.is-sel {
  border-color: var(--line-strong);
  background: #f5faff;
}

.week-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 6px;
}

.week-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--sky);
}

.week-dot.is-important {
  background: var(--gold);
}

.day-sel {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 2px 2px 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink2);
}

.day-sel span {
  font-weight: 500;
  color: var(--muted);
  font-size: 11.5px;
}

.group {
  margin-bottom: 13px;
}

.group-head {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 2px 4px 7px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink2);
}

.group-head .count {
  font-weight: 600;
  color: var(--muted);
  font-size: 11px;
}

.row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 7px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: var(--shadow-card);
}

.row-time {
  flex: 0 0 44px;
  padding-top: 1px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--blue);
  font-variant-numeric: tabular-nums;
}

.row.is-overdue .row-time {
  color: var(--danger);
}

.row-main {
  flex: 1;
  min-width: 0;
}

.row-title {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink);
  word-break: break-word;
}

.row-sub {
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted);
  word-break: break-word;
}

/* --------------------------------------------------------------------------
   空状态
   -------------------------------------------------------------------------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 34px 22px 26px;
  text-align: center;
}

.empty-badge {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin-bottom: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: linear-gradient(160deg, #ffffff, #eff7ff);
  color: var(--blue);
  box-shadow: 0 6px 18px rgba(47, 92, 158, 0.09);
}

.empty-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
}

.empty-desc {
  margin: 7px 0 0;
  max-width: 21em;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--muted);
}

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 16px;
  justify-content: center;
}

/* --------------------------------------------------------------------------
   设置
   -------------------------------------------------------------------------- */
.set-card {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #fff;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.set-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 13px 14px 5px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: var(--navy);
}

.set-head svg {
  color: var(--gold);
}

.set-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 11px 14px;
  border-top: 1px solid #eef5fc;
}

.set-row:first-of-type {
  border-top: 0;
}

.set-row.stack {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.set-label {
  flex: 1;
  min-width: 0;
}

.set-label b {
  display: block;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
}

.set-label span {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}

.set-value {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink2);
}

.set-row .seg {
  flex: 0 0 auto;
}

.set-row .seg.wide {
  flex: 1;
}

.set-note {
  padding: 9px 14px 12px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
  background: #fbfdff;
  border-top: 1px solid #eef5fc;
}

.set-note b {
  color: var(--ink2);
}

.set-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
}

/* --------------------------------------------------------------------------
   输入面板 / 确认面板
   -------------------------------------------------------------------------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  background: rgba(12, 23, 42, 0.44);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease);
}

.sheet-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.sheet {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: calc(var(--app-vh) - 22px);
  border-radius: 22px 22px 0 0;
  background: var(--bg);
  box-shadow: 0 -12px 34px rgba(12, 23, 42, 0.28);
  transform: translateY(22px);
  transition: transform 0.24s var(--ease);
  overflow: hidden;
}

.sheet-backdrop.is-open .sheet {
  transform: none;
}

.sheet-compose {
  height: calc(var(--app-vh) - 18px);
}

/* 输入面板：让文本框吃掉多余空白，底部按钮始终贴在安全区上方 */
.sheet-compose .sheet-body {
  display: flex;
  flex-direction: column;
}

.sheet-compose #compose-text {
  flex: 1 1 auto;
  max-height: none;
}

.sheet-grab {
  width: 38px;
  height: 4px;
  margin: 8px auto 0;
  border-radius: 99px;
  background: var(--line-strong);
}

.sheet-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 6px;
}

.sheet-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--navy);
}

.sheet-close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--ink2);
  cursor: pointer;
}

.sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 4px 16px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sheet-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px calc(12px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(242, 248, 254, 0.5), var(--bg) 45%);
}

.sheet-foot .btn-primary {
  flex: 1;
}

.compose-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 12px 2px 7px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink2);
}

.compose-label span {
  font-weight: 500;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

#compose-text {
  min-height: 168px;
  max-height: 34vh;
  font-size: 14px;
  line-height: 1.62;
}

.quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.quick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
}

.quick.is-on {
  border-color: var(--blue);
  background: var(--info-bg);
  color: var(--blue);
}

/* 「来源 · 纯文本」是说明标签，不是按钮 */
.quick.quick-tag {
  border-style: dashed;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  cursor: default;
}

.compose-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}

.compose-opt .grow {
  flex: 1;
  min-width: 0;
}

.compose-opt b {
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.compose-opt span {
  display: block;
  margin-top: 1px;
  font-size: 11px;
  color: var(--muted);
}

.compose-hint {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--info-bg);
  border: 1px solid #d5e6f9;
  font-size: 11.5px;
  line-height: 1.55;
  color: #2c5c8f;
}

.confirm-body {
  padding: 12px 18px 4px;
}

.confirm-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: var(--navy);
}

.confirm-text {
  margin: 7px 0 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink2);
}

.confirm-actions {
  display: flex;
  gap: 10px;
  padding: 16px 18px calc(16px + var(--safe-bottom));
}

.confirm-actions .btn {
  flex: 1;
}

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */
.toast-host {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 11px 13px;
  border-radius: 14px;
  background: rgba(22, 41, 74, 0.97);
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 12px 28px rgba(12, 23, 42, 0.3);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
  pointer-events: auto;
}

.toast.in {
  opacity: 1;
  transform: none;
}

.toast span {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.toast-ok {
  background: rgba(31, 92, 61, 0.97);
}

.toast-danger {
  background: rgba(150, 42, 42, 0.97);
}

/* --------------------------------------------------------------------------
   底部 tab
   -------------------------------------------------------------------------- */
.tabbar {
  flex: 0 0 auto;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2px;
  padding: 5px 6px calc(5px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.tabbar button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 48px;
  padding: 6px 2px 4px;
  border: 0;
  border-radius: 12px;
  background: none;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.14s;
}

.tabbar button.is-on {
  color: var(--navy);
}

.tabbar button.is-on::after {
  content: "";
  position: absolute;
  top: 1px;
  width: 18px;
  height: 3px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--gold), var(--gold-soft));
}

.tab-ico {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
}

.tab-badge {
  position: absolute;
  top: 3px;
  right: 50%;
  margin-right: -22px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.item.is-done {
  background: #fbfdff;
}

.row.is-done .row-title {
  color: var(--muted);
  font-weight: 500;
  text-decoration: line-through;
  text-decoration-color: rgba(95, 113, 137, 0.45);
}

/* --------------------------------------------------------------------------
   小屏 / 动效偏好
   -------------------------------------------------------------------------- */
@media (max-width: 350px) {
  .appbar {
    padding-left: 14px;
    padding-right: 14px;
  }

  .brand-title {
    font-size: 17px;
  }

  .btn-new span {
    display: none;
  }

  .row-time {
    flex-basis: 38px;
  }
}

/* 每日自动读取（设置页卡片） */
/* input[type=number] 的 width:100% 会压过 .input-inline（属性选择器权重更高），
   设置行的数字框要按固定宽度显示，否则右侧「小时」这类后缀会被挤成竖排。 */
.set-value .input-inline {
  width: 86px;
}

.set-value > span {
  white-space: nowrap;
}

.ar-src {
  padding: 12px 14px 13px;
  border-top: 1px solid #eef5fc;
}

.ar-src.is-off {
  opacity: 0.62;
}

.ar-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ar-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.ar-name {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ar-name b {
  font-size: 13px;
  color: var(--ink);
}

.ar-name span {
  font-size: 11px;
  color: var(--muted);
}

.ar-times {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
}

.ar-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 4px 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--chip);
}

.ar-chip b {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.ar-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.ar-x:active {
  background: var(--line);
}

.ar-add {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border: 1px dashed var(--line-strong);
  border-radius: 999px;
  color: var(--blue);
  font-size: 11.5px;
  font-weight: 700;
}

.ar-add input {
  width: 64px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 11.5px;
}

.ar-none {
  font-size: 11.5px;
  color: var(--muted);
}

.ar-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.ar-field {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--ink2);
}

.ar-field .input-inline {
  width: 62px;
}

.ar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.ar-row .set-label {
  flex: 1;
}

.ar-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ar-pending {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 7px 9px;
  border-radius: 10px;
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 11.5px;
  font-weight: 600;
}

.ar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.ar-last {
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}

.compose-banner {
  margin: 0 0 10px;
  padding: 9px 11px;
  border-radius: 12px;
  background: var(--info-bg);
  color: var(--info);
  font-size: 12px;
  line-height: 1.5;
}

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