/* =====================================================================
   工作看板 · 样式
   浅色为默认主题，html[data-theme="dark"] 切换深色
   ===================================================================== */

:root {
  --bg: #f4f6fb;
  --bg-grad: radial-gradient(1200px 600px at 15% -10%, #e5edff 0%, transparent 60%),
             radial-gradient(900px 500px at 100% 0%, #e9fbf4 0%, transparent 55%);
  --panel: #ffffff;
  --panel-2: #f7f9fc;
  --line: #e6eaf2;
  --line-strong: #d5dbe8;
  --text: #0f172a;
  --muted: #6b7a90;
  --brand: #2563eb;
  --brand-ink: #ffffff;
  --brand-soft: #eef3ff;
  --todo: #f59e0b;
  --doing: #3b82f6;
  --done: #10b981;
  --danger: #ef4444;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 10px 26px -18px rgba(16, 24, 40, .35);
  --shadow-lift: 0 2px 6px rgba(16, 24, 40, .07), 0 16px 34px -20px rgba(16, 24, 40, .45);
  --tap: 44px;
}

html[data-theme="dark"] {
  --bg: #0b1220;
  --bg-grad: radial-gradient(1200px 600px at 10% -10%, #16233d 0%, transparent 60%),
             radial-gradient(900px 500px at 100% 0%, #102a26 0%, transparent 55%);
  --panel: #121c2e;
  --panel-2: #17233a;
  --line: #223049;
  --line-strong: #2d3d59;
  --text: #e8eefb;
  --muted: #93a3bd;
  --brand: #4f83ff;
  --brand-soft: #1a2a4d;
  --todo: #fbbf24;
  --doing: #60a5fa;
  --done: #34d399;
  --danger: #f87171;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 28px -20px rgba(0, 0, 0, .9);
  --shadow-lift: 0 2px 8px rgba(0, 0, 0, .45), 0 18px 36px -22px rgba(0, 0, 0, .95);
}

* { box-sizing: border-box; }

/* hidden 必须始终生效：否则 .modal-root{display:grid}、.btn{display:inline-flex}
   这类规则会盖掉浏览器默认的 [hidden]{display:none}，导致弹窗和按钮常驻显示 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* 锁死手机上的双指缩放与双击缩放（只允许上下左右滑动） */
html { touch-action: pan-x pan-y; }
body { touch-action: manipulation; }

/* 可点击元素：再去掉双击缩放带来的延迟 */
button, a, input, select, textarea, label, .card, .daycell, .tick { touch-action: manipulation; }

body { background-image: var(--bg-grad); background-attachment: fixed; min-height: 100vh; }

.app {
  max-width: 1440px;
  margin: 0 auto;
  padding: 16px 20px calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.spacer { flex: 1 1 auto; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform .12s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--panel-2); }
.btn:active { transform: scale(.97); }
.btn-icon { min-width: 38px; padding: 0; font-size: 17px; }
.btn-soft { background: var(--panel-2); border-color: var(--line); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand); filter: brightness(1.07); }
.btn-danger-ghost { color: var(--danger); border-color: transparent; background: transparent; }
.btn-danger-ghost:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.btn.is-loading .ico { display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.linkbtn {
  border: 0; background: none; color: var(--brand);
  font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; padding: 4px 2px; border-radius: 6px;
}
.linkbtn:hover { text-decoration: underline; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 16px;
}

.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.logo {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  background: linear-gradient(145deg, var(--brand), #7c3aed);
  color: #fff; font-weight: 800; font-size: 19px;
  display: grid; place-items: center;
  box-shadow: 0 6px 16px -8px rgba(37, 99, 235, .9);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 17px; letter-spacing: .3px; }
.brand-text span { font-size: 12px; color: var(--muted); }

.clock {
  margin-left: auto;
  text-align: right;
  padding: 6px 14px;
  border-radius: 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  min-width: 190px;
}
.clock-time {
  font-size: 26px; font-weight: 800; letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  line-height: 1.1;
  background: linear-gradient(90deg, var(--brand), #8b5cf6);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.clock-date { font-size: 12px; color: var(--muted); margin-top: 2px; }
.clock-daybar { height: 3px; border-radius: 3px; background: var(--line); margin-top: 6px; overflow: hidden; }
.clock-daybar i { display: block; height: 100%; width: 0; border-radius: 3px; background: linear-gradient(90deg, var(--brand), var(--done)); transition: width .4s ease; }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.viewswitch {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px;
}
.viewswitch button {
  border: 0; background: transparent; color: var(--muted);
  font: inherit; font-size: 14px; font-weight: 700;
  padding: 7px 16px; border-radius: 8px; cursor: pointer; min-width: 46px;
  transition: background .16s ease, color .16s ease;
}
.viewswitch button:hover { color: var(--text); }
.viewswitch button.is-active { background: var(--panel); color: var(--brand); box-shadow: var(--shadow); }

/* ---------------- 状态条 ---------------- */
.statusline {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--muted); padding: 0 4px;
}
.conn { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.conn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.conn.is-online { color: var(--done); } .conn.is-online .dot { background: var(--done); box-shadow: 0 0 0 3px color-mix(in srgb, var(--done) 22%, transparent); animation: pulse 2s ease-in-out infinite; }
.conn.is-offline { color: var(--danger); } .conn.is-offline .dot { background: var(--danger); }
@keyframes pulse { 50% { opacity: .45; } }
.sep { opacity: .5; }
.operator { display: inline-flex; align-items: center; gap: 6px; }
.operator input {
  width: 108px; min-height: 30px; padding: 4px 9px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--panel); color: var(--text); font: inherit; font-size: 12.5px;
}

/* ---------------- 工具条 ---------------- */
.toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 10px 14px;
}
.range-nav { display: flex; align-items: center; gap: 8px; min-width: 0; }
.range-label { display: flex; flex-direction: column; line-height: 1.25; margin-left: 6px; min-width: 0; }
.range-label strong { font-size: 15px; white-space: nowrap; }
.range-label small { font-size: 11.5px; color: var(--muted); }

.tools { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.search { display: flex; align-items: center; gap: 6px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; min-height: 38px; }
.search span { color: var(--muted); font-size: 15px; }
.search input { border: 0; background: transparent; color: var(--text); font: inherit; font-size: 13.5px; min-height: 36px; width: 190px; outline: none; }
.select {
  min-height: 38px; padding: 0 10px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--text);
  font: inherit; font-size: 13.5px; max-width: 150px;
}
#overdueBtn.is-active { background: color-mix(in srgb, var(--danger) 14%, transparent); border-color: color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger); }
#overdueBtn b { font-weight: 700; }

/* ---------------- 周期概览 ---------------- */
.calendar-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.daystrip { display: flex; gap: 8px; min-width: 100%; }
/* 日视图只有一个日期格子，别让它被拉满整行 */
.daystrip:not(.month) .daycell { max-width: 280px; }
.daystrip.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; min-width: 640px; }
.daycell {
  flex: 1 1 0; min-width: 92px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 9px 10px; cursor: pointer; text-align: left; font: inherit; color: var(--text);
  transition: border-color .16s ease, transform .12s ease, background .16s ease;
}
.daystrip.month .daycell { min-width: 0; padding: 7px 6px; min-height: 62px; }
.daycell:hover { border-color: var(--brand); transform: translateY(-1px); }
.daycell .dow { font-size: 11.5px; color: var(--muted); }
.daycell .dnum { font-size: 15px; font-weight: 700; margin-top: 2px; }
.daycell .cnt { font-size: 11px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.daycell .bars { display: flex; gap: 3px; margin-top: 5px; }
.daycell .bars i { flex: 1 1 auto; height: 4px; border-radius: 3px; background: var(--line); }
.daycell .bars i.on-todo { background: var(--todo); } .daycell .bars i.on-doing { background: var(--doing); } .daycell .bars i.on-done { background: var(--done); }
.daycell.is-weekend { background: color-mix(in srgb, var(--danger) 5%, var(--panel)); }
.daycell.is-today { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.daycell.is-today .dnum { color: var(--brand); }
.daycell.is-focus { background: var(--brand-soft); border-color: var(--brand); }
.daycell.is-blank { background: transparent; border: 1px dashed var(--line); cursor: default; min-height: 62px; }
.daycell.is-blank:hover { transform: none; border-color: var(--line); }
.daycell .dow-head { font-size: 11px; color: var(--muted); text-align: center; }
.daycell.is-head { background: transparent; border: 0; cursor: default; min-height: 0; padding: 2px 0; }
.daycell.is-head:hover { transform: none; border: 0; }

/* ---------------- 统计 ---------------- */
.stats { display: flex; gap: 10px; flex-wrap: wrap; }
.stat {
  flex: 1 1 150px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 14px; box-shadow: var(--shadow);
}
.stat .k { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat .k i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.stat .v { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.3; }
.stat.t-todo .k i { background: var(--todo); } .stat.t-todo .v { color: var(--todo); }
.stat.t-doing .k i { background: var(--doing); } .stat.t-doing .v { color: var(--doing); }
.stat.t-done .k i { background: var(--done); } .stat.t-done .v { color: var(--done); }
.stat.t-rate .bar { height: 6px; border-radius: 6px; background: var(--line); margin-top: 9px; overflow: hidden; }
.stat.t-rate .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--done)); transition: width .5s ease; }

/* ---------------- 看板 ---------------- */
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.col {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden;
}
.col-head {
  display: flex; align-items: center; gap: 9px; padding: 12px 14px;
  border-bottom: 1px solid var(--line); background: var(--panel-2);
}
.col-head .mark { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.col-head h3 { margin: 0; font-size: 15px; font-weight: 800; }
.col-head .hint { font-size: 11.5px; color: var(--muted); }
.col-head .count {
  margin-left: auto; min-width: 26px; height: 24px; padding: 0 8px;
  border-radius: 999px; display: grid; place-items: center;
  font-size: 12.5px; font-weight: 800; background: var(--panel); border: 1px solid var(--line);
}
.col-body { padding: 10px; display: flex; flex-direction: column; gap: 9px; min-height: 120px; max-height: calc(100vh - 330px); overflow-y: auto; }
.col.c-todo .mark { background: var(--todo); } .col.c-todo .col-head h3 { color: var(--todo); }
.col.c-doing .mark { background: var(--doing); } .col.c-doing .col-head h3 { color: var(--doing); }
.col.c-done .mark { background: var(--done); } .col.c-done .col-head h3 { color: var(--done); }
.col.c-doing { box-shadow: var(--shadow-lift); border-color: color-mix(in srgb, var(--doing) 35%, var(--line)); }

.date-divider {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 700; color: var(--muted);
  margin: 2px 2px -2px;
}
.date-divider::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--line); }
.date-divider.is-today { color: var(--brand); }

.card {
  position: relative; display: flex; gap: 10px;
  background: var(--panel); border: 1px solid var(--line);
  border-left: 4px solid var(--muted);
  border-radius: 12px; padding: 10px 11px;
  transition: box-shadow .16s ease, transform .12s ease, border-color .16s ease;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.card[data-status="todo"] { border-left-color: var(--todo); }
.card[data-status="doing"] { border-left-color: var(--doing); background: color-mix(in srgb, var(--doing) 5%, var(--panel)); }
.card[data-status="done"] { border-left-color: var(--done); opacity: .72; }
.card.is-overdue { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.card.is-done .card-title { text-decoration: line-through; color: var(--muted); }

.card .tick {
  flex: none; width: 26px; height: 26px; margin-top: 1px;
  border-radius: 50%; border: 2px solid var(--line-strong);
  background: transparent; color: transparent; cursor: pointer;
  display: grid; place-items: center; font-size: 14px; font-weight: 800;
  transition: all .16s ease;
}
.card .tick:hover { border-color: var(--done); color: var(--done); }
.card.is-done .tick { background: var(--done); border-color: var(--done); color: #fff; }
.card.is-doing .tick { border-color: var(--doing); }

.card-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.card-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-date { font-size: 11px; font-weight: 700; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; }
.card-title { margin: 0; font-size: 14.5px; font-weight: 700; line-height: 1.4; word-break: break-word; }
.badge { font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; }
.badge.high { color: #b45309; background: #fef3c7; border-color: #fde68a; }
.badge.late { color: #fff; background: var(--danger); }
.badge.live { color: #fff; background: var(--doing); }
.badge.ok { color: #065f46; background: #d1fae5; }
html[data-theme="dark"] .badge.high { color: #fcd34d; background: #422006; border-color: #78350f; }
html[data-theme="dark"] .badge.ok { color: #6ee7b7; background: #052e2b; }

.card-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.card-meta .time { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.card-note { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; word-break: break-word; }
.card-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.owner { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; }
.acts { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.act {
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--text);
  font: inherit; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 8px; cursor: pointer;
  transition: background .14s ease, border-color .14s ease, color .14s ease;
}
.act:hover { background: var(--panel-2); border-color: var(--brand); color: var(--brand); }
.act.ok { color: var(--done); border-color: color-mix(in srgb, var(--done) 45%, transparent); }
.act.ok:hover { background: color-mix(in srgb, var(--done) 12%, transparent); border-color: var(--done); color: var(--done); }
.act.mini { padding: 4px 7px; font-size: 12px; color: var(--muted); }
.act.mini:hover { color: var(--brand); }
.act.danger:hover { color: var(--danger); border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }

.empty {
  text-align: center; color: var(--muted); font-size: 12.5px;
  padding: 22px 12px; border: 1px dashed var(--line-strong); border-radius: 12px;
}
.empty b { display: block; font-size: 13.5px; color: var(--text); margin-bottom: 4px; }

.board-empty {
  grid-column: 1 / -1; text-align: center; padding: 40px 20px;
  background: var(--panel); border: 1px dashed var(--line-strong); border-radius: var(--radius);
}

/* ---------------- 页脚 / 悬浮按钮 ---------------- */
.foot { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); padding: 2px 4px 0; }
.foot code { background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
kbd { background: var(--panel-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; font-size: 11px; font-family: inherit; }

.fab {
  position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom));
  width: 54px; height: 54px; border-radius: 50%; border: 0;
  background: var(--brand); color: #fff; font-size: 26px; font-weight: 300;
  box-shadow: 0 10px 26px -8px rgba(37, 99, 235, .85); cursor: pointer; display: none;
  align-items: center; justify-content: center;
}
.fab:active { transform: scale(.94); }

/* ---------------- 弹窗 ---------------- */
.modal-root { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal-mask { position: absolute; inset: 0; background: rgba(9, 15, 28, .5); backdrop-filter: blur(3px); }
.modal {
  position: relative; width: min(620px, 100%); max-height: 92vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 30px 60px -25px rgba(9, 15, 28, .7);
  animation: pop .18s ease-out;
}
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-head .btn { margin-left: auto; }
.modal-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-top: 1px solid var(--line); background: var(--panel-2); }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 0; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field > span b { color: var(--danger); }
.field input, .field select, .field textarea {
  width: 100%; min-height: var(--tap); padding: 9px 11px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--panel); color: var(--text); font: inherit; font-size: 14px; outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { min-height: 76px; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.field-row { display: flex; gap: 12px; }
.field-wide { width: 100%; }

/* ---------------- Toast ---------------- */
.toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: var(--text); color: var(--bg); font-size: 13px; font-weight: 600;
  padding: 9px 16px; border-radius: 999px; box-shadow: var(--shadow-lift);
  animation: rise .2s ease-out; max-width: 88vw; text-align: center;
}
.toast.err { background: var(--danger); color: #fff; }
.toast.ok { background: var(--done); color: #fff; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

/* ---------------- 提醒开关 ---------------- */
.bell {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 32px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--muted);
  font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer;
  transition: all .16s ease;
}
.bell:hover { border-color: var(--brand); color: var(--brand); }
.bell .bell-ic { font-size: 14px; }
.bell.is-on { color: var(--done); border-color: color-mix(in srgb, var(--done) 45%, transparent); background: color-mix(in srgb, var(--done) 10%, var(--panel)); }
.bell.is-off { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: color-mix(in srgb, var(--danger) 8%, var(--panel)); }
.badge.bell-badge { color: var(--muted); background: var(--panel-2); border-color: var(--line); }

/* ---------------- 到点提醒横幅 ---------------- */
.alarm {
  position: fixed; top: 0; left: 0; right: 0; z-index: 70;
  display: flex; flex-direction: column; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--danger) 16%, transparent), transparent);
  pointer-events: none;
}
.alarm-item {
  pointer-events: auto;
  display: flex; align-items: center; gap: 12px;
  background: var(--panel); border: 1px solid color-mix(in srgb, var(--danger) 40%, var(--line));
  border-radius: 16px; padding: 12px 14px;
  box-shadow: 0 18px 40px -18px rgba(9, 15, 28, .6);
  animation: drop .22s ease-out;
}
.alarm-ic { font-size: 26px; animation: ring .8s ease-in-out infinite; }
.alarm-txt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.alarm-txt strong { font-size: 15px; }
.alarm-txt span { font-size: 12.5px; color: var(--muted); }
.alarm-acts { display: flex; gap: 8px; flex: none; }
@keyframes drop { from { transform: translateY(-14px); opacity: 0; } }
@keyframes ring { 0%, 100% { transform: rotate(-12deg); } 50% { transform: rotate(12deg); } }

/* ---------------- 登录 / 注册 / 找回密码 ---------------- */
.auth {
  position: fixed; inset: 0; z-index: 90; overflow-y: auto; padding: 28px 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
}
.auth-card {
  width: min(420px, 100%); margin: 0 auto;
  display: flex; flex-direction: column; gap: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 22px;
  padding: 26px 22px 20px; box-shadow: 0 30px 60px -25px rgba(9, 15, 28, .65);
}
.auth-logo {
  width: 52px; height: 52px; margin: 0 auto; border-radius: 16px;
  background: linear-gradient(145deg, var(--brand), #7c3aed); color: #fff;
  display: grid; place-items: center; font-size: 24px; font-weight: 800;
}
.auth-card h2 { margin: 0; font-size: 20px; text-align: center; }
.auth-card .auth-sub { margin: -8px 0 0; text-align: center; font-size: 13px; color: var(--muted); }

.auth-tabs { display: flex; gap: 4px; padding: 3px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.auth-tabs button {
  flex: 1 1 0; border: 0; background: transparent; color: var(--muted);
  font: inherit; font-size: 13.5px; font-weight: 700; padding: 9px 4px; border-radius: 9px; cursor: pointer;
  transition: background .16s ease, color .16s ease;
}
.auth-tabs button:hover { color: var(--text); }
.auth-tabs button.is-active { background: var(--panel); color: var(--brand); box-shadow: var(--shadow); }

.auth-panel { display: flex; flex-direction: column; gap: 12px; }
.auth-panel[hidden] { display: none; }
.auth-panel .field > span { font-size: 12.5px; }
.auth-submit { width: 100%; min-height: 46px; font-size: 15px; margin-top: 2px; }
.auth-links { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.auth-links button {
  border: 0; background: none; color: var(--brand); font: inherit; font-size: 12.5px;
  font-weight: 600; cursor: pointer; padding: 4px 0;
}
.auth-links button:hover { text-decoration: underline; }
.code-row { display: flex; gap: 8px; align-items: stretch; }
.code-row input { flex: 1 1 auto; min-width: 0; }
.code-row .btn { flex: 0 0 auto; min-width: 108px; font-size: 13px; }
.auth-msg { min-height: 18px; font-size: 12.5px; line-height: 1.5; color: var(--danger); }
.auth-msg.is-ok { color: var(--done); }
.auth-msg.is-warn { color: #b45309; }
html[data-theme="dark"] .auth-msg.is-warn { color: #fbbf24; }
.auth-note { font-size: 11.5px; line-height: 1.6; color: var(--muted); }

/* ---------------- 当前账号 ---------------- */
.user-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 3px 6px 3px 4px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line);
}
.user-chip[hidden] { display: none; }
.user-avatar {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  background: linear-gradient(145deg, var(--brand), #7c3aed); color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.user-name { font-size: 12.5px; font-weight: 600; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- 未开通推送的大横幅 ---------------- */
.push-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412;
  box-shadow: var(--shadow);
}
.push-banner[hidden] { display: none; }
.push-banner .pb-text { flex: 1 1 200px; min-width: 0; font-size: 13.5px; line-height: 1.45; }
.push-banner .pb-text small { display: block; margin-top: 3px; font-size: 11.5px; opacity: .85; font-weight: 400; }
.push-banner .pb-btn { flex: 0 0 auto; white-space: nowrap; }
html[data-theme="dark"] .push-banner { background: #3b2410; border-color: #7c4a17; color: #fdba74; }

/* ---------------- 页脚备案号 ---------------- */
.foot-icp { flex: 1 1 100%; margin-top: 4px; font-size: 11.5px; color: var(--muted); text-align: center; }
.foot-icp a { color: var(--muted); text-decoration: none; }
.foot-icp a:hover { color: var(--brand); text-decoration: underline; }
.foot-icp[hidden] { display: none; }
.foot-icp svg { vertical-align: -2px; }
.link-btn {
  border: 0; background: none; color: var(--brand); font: inherit; font-weight: 700;
  cursor: pointer; padding: 2px 6px; border-radius: 6px; text-decoration: underline;
}
.link-btn:hover { background: var(--brand-soft); }
.link-btn:disabled { opacity: .6; cursor: default; }
.foot-line { display: block; }
.push-note { display: block; margin-top: 3px; font-size: 11px; color: #b45309; }
html[data-theme="dark"] .push-note { color: #fbbf24; }

/* ---------------- 内联 SVG 图标 ---------------- */
.ico-svg { flex: none; vertical-align: -2px; }
.badge.bell-badge { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); background: var(--panel-2); border-color: var(--line); }
.badge.late { display: inline-flex; align-items: center; gap: 3px; }
.card-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.act.mini svg { display: block; }

/* 逾期分组标题 */
.date-divider.is-late { color: var(--danger); font-weight: 800; }
.date-divider.is-late svg { vertical-align: -2px; margin-right: 2px; }
#overdueBtn.has-late { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }

/* ---------------- 下一个会议 ---------------- */
.nextup-wrap { overflow: visible; }
.nextup {
  width: 100%; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px;
  text-align: left; cursor: pointer; font: inherit; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--brand);
  border-radius: var(--radius-sm); padding: 11px 14px; box-shadow: var(--shadow);
  transition: border-color .16s ease, transform .12s ease;
}
.nextup:hover { border-color: var(--brand); transform: translateY(-1px); }
.nextup.is-none { cursor: default; color: var(--muted); justify-content: center; border-left-color: var(--line-strong); font-size: 13px; }
.nextup.is-none:hover { transform: none; border-color: var(--line); }
.nextup-tag {
  font-size: 10.5px; font-weight: 800; padding: 2px 8px; border-radius: 999px;
  color: var(--brand); background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent);
}
.nextup-tag.is-doing { color: #fff; background: var(--doing); border-color: var(--doing); }
.nextup-title { font-size: 15px; font-weight: 800; }
.nextup-meta { font-size: 12px; color: var(--muted); }
.nextup-count { margin-left: auto; font-size: 13px; font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; }

/* ---------------- 自定义确认框 ---------------- */
.confirm-root { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: 20px; }
.confirm-mask { position: absolute; inset: 0; background: rgba(9, 15, 28, .5); backdrop-filter: blur(3px); }
.confirm-box {
  position: relative; width: min(360px, 100%);
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 20px 18px 16px; box-shadow: 0 30px 60px -25px rgba(9, 15, 28, .7);
  animation: pop .16s ease-out;
}
.confirm-box h4 { margin: 0 0 6px; font-size: 16px; }
.confirm-box p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; word-break: break-word; }
.confirm-acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.confirm-acts .btn { min-width: 80px; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.06); }

/* Toast 上的操作按钮（撤销） */
.toast.has-act { display: inline-flex; align-items: center; gap: 12px; }
.toast-act {
  border: 0; background: rgba(255, 255, 255, .22); color: inherit;
  font: inherit; font-size: 12.5px; font-weight: 800; padding: 4px 10px; border-radius: 999px; cursor: pointer;
}
.toast-act:hover { background: rgba(255, 255, 255, .35); }

/* ---------------- 滚动条 ---------------- */
.col-body::-webkit-scrollbar, .calendar-wrap::-webkit-scrollbar, .modal::-webkit-scrollbar { width: 8px; height: 8px; }
.col-body::-webkit-scrollbar-thumb, .calendar-wrap::-webkit-scrollbar-thumb, .modal::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }

/* =====================================================================
   响应式
   ===================================================================== */
@media (max-width: 1080px) {
  .board { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .col-body { max-height: none; }
  .search input { width: 150px; }
}

@media (max-width: 900px) {
  .clock { order: 3; width: 100%; min-width: 0; text-align: left; }
  .clock-time { font-size: 30px; }
  .topbar-actions { margin-left: auto; }
  .tools { width: 100%; margin-left: 0; }
  .search { flex: 1 1 100%; }
  .search input { width: 100%; }
}

@media (max-width: 760px) {
  :root { --radius: 14px; }

  /* ============ 手机端：这一整块（时钟+状态+工具条）冻结，上下滑动始终可见 ============ */
  .app { padding: 0 12px calc(84px + env(safe-area-inset-bottom)); gap: 10px; }

  .freeze {
    position: sticky; top: 0; z-index: 45;
    display: flex; flex-direction: column; gap: 8px;
    margin: 0 -12px;
    padding: calc(6px + env(safe-area-inset-top)) 12px 8px;
    background: var(--bg);
    box-shadow: 0 14px 20px -22px rgba(16, 24, 40, 1);
  }
  /* 冻结块里的三行不再是独立卡片，视觉上合成一整块 */
  .freeze > .topbar { background: transparent; border: 0; box-shadow: none; backdrop-filter: none; }
  .topbar {
    flex-wrap: nowrap; align-items: center; gap: 8px;
    margin: 0; padding: 0; border-radius: 0;
  }
  .brand { display: none; }
  .clock { order: 0; flex: 1 1 auto; width: auto; min-width: 0; margin-left: 0; padding: 2px 10px; text-align: left; }
  .clock-time { font-size: 22px; }
  .clock-date { font-size: 11px; margin-top: 0; }
  .clock-daybar { margin-top: 4px; }
  .topbar-actions { width: auto; flex: 0 0 auto; margin-left: 0; gap: 6px; min-width: 0; }
  .topbar-actions .viewswitch { flex: 0 0 auto; min-width: 0; padding: 2px; }
  .topbar-actions .viewswitch button { flex: 0 0 auto; min-width: 0; padding: 6px 9px; font-size: 13px; }
  #themeBtn { display: none; }
  .btn-label { display: none; }
  #refreshBtn { min-width: 42px; min-height: 38px; }

  /* 状态条压成一行，省出冻结区高度 */
  .statusline { font-size: 11.5px; gap: 6px; padding: 0 2px; flex-wrap: nowrap; overflow: hidden; }
  .statusline .conn { flex: 0 0 auto; white-space: nowrap; }
  .statusline .sep { display: none; }
  .statusline .operator { display: none; }
  #syncText { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .user-chip { flex: none; }
  .bell { flex: none; padding: 0 9px; min-height: 28px; font-size: 11.5px; }

  /* 工具条也压紧 */
  .toolbar { padding: 8px 10px; gap: 8px; }
  .range-nav { gap: 6px; }
  .range-label small { display: none; }
  .tools { gap: 6px; }
  .search { min-height: 34px; }
  .search input { min-height: 32px; font-size: 13px; }
  .select { min-height: 34px; font-size: 13px; max-width: 132px; }

  /* 三列改为纵向堆叠，手机上滚一屏看完三个状态 */
  .board { grid-template-columns: 1fr; gap: 10px; }
  .col-body { max-height: none; padding: 8px; gap: 8px; }
  /* 列标题不再吸顶：冻结区已经占了屏幕上方，再叠一层会挤掉内容 */
  .col-head { position: static; }
  /* 手机上让 7 天条 / 月历一屏放得下，不用横向拖动 */
  .calendar-wrap { margin: 0; padding: 0; overflow-x: visible; }
  .daystrip { min-width: 0; gap: 5px; }
  .daystrip:not(.month) .daycell { max-width: none; min-width: 0; padding: 7px 5px; }
  .daycell { min-width: 0; padding: 7px 5px; }
  .daycell .dow { font-size: 10.5px; }
  .daycell .dnum { font-size: 14px; }
  .daycell .cnt { font-size: 10px; }
  .daystrip.month { min-width: 0; gap: 4px; }
  .daystrip.month .daycell { min-height: 54px; padding: 5px 4px; }
  .daycell.is-blank { min-height: 54px; }
  /* 顶栏：允许缩放，任何窄屏都不会溢出 */
  .topbar-actions { min-width: 0; }
  .topbar-actions .viewswitch { min-width: 0; }
  .topbar-actions .viewswitch button { min-width: 0; padding: 7px 10px; }

  /* 统计压成一条紧凑横条，省出整整两行高度 */
  .stats {
    flex-wrap: nowrap; gap: 0; padding: 8px 2px;
    background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  }
  .stat { flex: 1 1 0; min-width: 0; background: none; border: 0; box-shadow: none; padding: 0 2px; text-align: center; }
  .stat .k { font-size: 10px; justify-content: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .stat .v { font-size: 15px; text-align: center; }
  .stat.t-rate .bar { margin-top: 3px; height: 3px; }

  .toolbar { padding: 9px 10px; }
  .range-label strong { font-size: 14px; }
  .nextup { padding: 10px 12px; gap: 4px 8px; }
  .nextup-title { font-size: 14px; }
  .nextup-count { margin-left: 0; }
  .fab { display: flex; }
  #addBtn { display: none; }
  .field-row { flex-direction: column; gap: 12px; }
  .field-row-3 { flex-direction: row; }
  .card { padding: 10px; }
  .acts { width: 100%; margin-left: 0; }
  .act { flex: 1 1 auto; min-height: 38px; }
  .foot-hint { display: none; }
}

@media (max-width: 420px) {
  .clock-time { font-size: 24px; }
  .stat .k { font-size: 9.5px; }
  .stat .v { font-size: 14px; }
  .field-row-3 { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
