/* ============================================================
   悬浮日程 · 网页系统 样式
   沿用原作视觉语言：橙主色、圆角卡片、浅色底
   ============================================================ */
:root {
  --orange: #e8722c;
  --orange-deep: #d45f1e;
  --orange-soft: #fdf0e7;
  --red: #e5484d;
  --red-soft: #fdebec;
  --blue: #3b82f6;
  --blue-soft: #eaf2fe;
  --purple: #8b5cf6;
  --purple-soft: #f1ebfd;
  --teal: #14b8a6;
  --teal-soft: #e4f7f4;
  --green: #22a06b;
  --green-soft: #e6f4ee;
  --gray: #64748b;
  --gray-soft: #eef1f5;
  --bg: #f5f6fa;
  --card: #ffffff;
  --line: #e8eaf0;
  --txt: #1f2329;
  --txt2: #4e5969;
  --txt3: #86909c;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(31, 35, 41, .05);
}
* { box-sizing: border-box; }
/* 修復：自訂 display 會覆蓋 HTML hidden 屬性，必須強制隱藏 */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14.5px;
  line-height: 1.55;
  padding-bottom: 70px; /* 给底部 tabbar 留位 */
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; }
.flex1 { flex: 1; }

/* ---------- 每日快照列表 ---------- */
.snap-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 0; border-bottom: 1px dashed #e5e9f0; font-size: 13.5px;
}
.snap-item:last-child { border-bottom: none; }
.snap-date { font-weight: 500; }
.snap-at { color: var(--txt3); font-weight: 400; font-size: 12px; margin-left: 6px; }

/* ===== 顶栏 ===== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1080px; margin: 0 auto; padding: 10px 18px;
  display: flex; align-items: center; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15.5px; white-space: nowrap; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px; background: var(--orange);
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.brand-sub { font-size: 12px; font-weight: 500; color: var(--txt3); }
.top-tabs { display: flex; gap: 4px; margin-left: 8px; flex: 1; }
.top-tab {
  border: 0; background: transparent; padding: 7px 14px; border-radius: 9px;
  font-size: 14px; color: var(--txt2); font-weight: 500;
}
.top-tab:hover { background: var(--gray-soft); }
.top-tab.on { background: var(--orange-soft); color: var(--orange-deep); font-weight: 600; }
.top-actions { display: flex; gap: 6px; }
.icon-btn {
  border: 1px solid var(--line); background: #fff; color: var(--txt2);
  width: 32px; height: 32px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { border-color: var(--orange); color: var(--orange-deep); }

/* ===== 主区 ===== */
.main { max-width: 1080px; margin: 0 auto; padding: 18px 18px 30px; }
.view { display: none; }
.view.on { display: block; }

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

/* ===== 通用控件 ===== */
.btn {
  border: 1px solid transparent; border-radius: 10px; padding: 8px 16px;
  font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px;
  transition: filter .15s;
}
.btn:hover { filter: brightness(.96); }
.btn-primary { background: var(--orange); color: #fff; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--txt2); }
.btn-ghost:hover { border-color: var(--orange); color: var(--orange-deep); }
.btn-danger-ghost { background: #fff; border-color: var(--line); color: var(--red); }
.btn-danger-ghost:hover { border-color: var(--red); background: var(--red-soft); }
.btn-success { background: var(--green); color: #fff; }

/* ---------- 任務詳情：標題 + 圓形完成剔選（Todoist/TickTick 慣例） ---------- */
.task-title-row { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.ck-lg {
  width: 26px !important; height: 26px !important; border-radius: 50% !important;
  flex: none; margin: 0 !important;
}
.ck-lg:checked::after {
  content: ""; position: absolute; left: 8px; top: 5px;
  width: 6px; height: 12px; border: solid #fff; border-width: 0 2.6px 2.6px 0;
  transform: rotate(43deg);
}
.ed-title-input { font-size: 16px; font-weight: 600; }
.task-title-row.is-done .ed-title-input { color: var(--txt3); text-decoration: line-through; }

/* ---------- 任務顏色標籤（Trello 式） ---------- */
.color-strip {
  position: absolute; top: 0; left: 0; right: 0; height: 5px;
  border-radius: 11px 11px 0 0; pointer-events: none;
}
.swatch-btn {
  width: 30px; height: 28px; border-radius: 8px; padding: 0;
  justify-content: center; font-size: 11px; color: var(--txt3);
  transition: transform .12s;
}
.swatch-btn:hover { transform: scale(1.08); border-color: var(--orange); }
.swatch-btn.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--orange); color: #fff; }
.link-btn { border: 0; background: none; color: var(--orange-deep); font-size: 13px; padding: 2px 6px; }
.link-btn:hover { text-decoration: underline; }

.seg { display: inline-flex; background: var(--gray-soft); border-radius: 10px; padding: 3px; }
.seg-btn {
  border: 0; background: transparent; padding: 5px 12px; border-radius: 8px;
  font-size: 13px; color: var(--txt2);
}
.seg-btn.on { background: #fff; color: var(--txt); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.seg-btn.on.red { color: var(--red); }

.sel, .search {
  border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px;
  background: #fff; color: var(--txt); outline: none;
}
.sel:focus, .search:focus { border-color: var(--orange); }
.search { min-width: 180px; flex: 1; max-width: 260px; }

/* ===== 工具行 ===== */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 16px 0 14px;
}

/* ===== 新增入口 ===== */
.add-hero {
  padding: 16px 18px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.add-hero-btn {
  font-size: 15.5px; font-weight: 600; padding: 11px 26px; border-radius: 12px;
  box-shadow: 0 3px 10px rgba(232, 114, 44, .3);
}
.add-hero-hint { font-size: 12.5px; color: var(--txt3); }
.add-pick { display: flex; gap: 5px; flex-wrap: wrap; }

.pick-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 8px;
  padding: 5px 11px; font-size: 12.5px; color: var(--txt2); white-space: nowrap;
}
.pick-btn:hover { border-color: var(--orange); }
/* 選中態：實色底白字，一按即見 */
.pick-btn.on {
  border-color: transparent !important;
  color: #fff !important;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(31, 35, 41, .18);
}
.pick-btn.on.q1 { background: var(--red); }
.pick-btn.on.q2 { background: var(--blue); }
.pick-btn.on.q3 { background: var(--orange); }
.pick-btn.on.q4 { background: #64748b; }
.pick-btn.on.c-proj { background: var(--blue); }
.pick-btn.on.c-ops { background: var(--orange); }
.pick-btn.on.c-daily { background: var(--purple); }
.pick-btn.on.c-doc { background: var(--teal); }
.pick-btn.on.c-generic { background: var(--gray); }

/* ===== 看板 ===== */
.board {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  align-items: start;
}
.quad-col { background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); padding: 10px; min-height: 120px; }
.quad-head { display: flex; align-items: baseline; gap: 7px; padding: 4px 6px 10px; border-bottom: 2px solid var(--quad-color, var(--line)); margin-bottom: 10px; }
.quad-head b { font-size: 14px; }
.quad-head .hint { font-size: 11.5px; color: var(--txt3); }
.quad-head .cnt { margin-left: auto; font-size: 12px; color: var(--txt3); background: var(--gray-soft); border-radius: 20px; padding: 1px 8px; }
.quad-add {
  border: 0; background: transparent; color: var(--txt3);
  width: 22px; height: 22px; border-radius: 7px;
  font-size: 14px; line-height: 1; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.quad-add:hover { background: var(--orange); color: #fff; }
.quad-col.q1 .quad-head { --quad-color: var(--red); }
.quad-col.q2 .quad-head { --quad-color: var(--blue); }
.quad-col.q3 .quad-head { --quad-color: var(--orange); }
.quad-col.q4 .quad-head { --quad-color: #cbd5e1; }
.quad-empty { color: var(--txt3); font-size: 12.5px; text-align: center; padding: 18px 0; }

/* 任务卡 */
.task {
  border: 1px solid var(--line); border-radius: 11px; background: #fff;
  padding: 9px 11px; margin-bottom: 8px; position: relative;
  transition: box-shadow .15s, border-color .15s;
}
.task:hover { box-shadow: 0 3px 12px rgba(31,35,41,.08); border-color: #d9dde5; }
.task.is-overdue { background: #fffafa; border-color: #f3c2c4; }
.task-top { display: flex; gap: 8px; align-items: flex-start; }
.ck {
  appearance: none; width: 22px; height: 22px; border: 2px solid #b9c1cd;
  border-radius: 6px; margin: 1px 0 0; flex: none; cursor: pointer; position: relative;
  background: #fff; padding: 0; transition: background .15s, border-color .15s;
}
.ck:hover { border-color: var(--orange); background: #fff7f0; }
.ck:checked { background: var(--green); border-color: var(--green); }
.ck:checked::after {
  content: ""; position: absolute; left: 6.5px; top: 3px;
  width: 5px; height: 11px; border: solid #fff; border-width: 0 2.4px 2.4px 0;
  transform: rotate(43deg);
}
.task.done .task-txt { color: var(--txt3); text-decoration: line-through; }
.task-txt { font-size: 13.8px; font-weight: 500; word-break: break-word; cursor: pointer; flex: 1; }
.task:hover .task-txt { color: var(--orange-deep); }
.task-meta { display: flex; gap: 5px; flex-wrap: wrap; margin: 7px 0 0 25px; }
.chip {
  font-size: 11px; padding: 1.5px 8px; border-radius: 20px; white-space: nowrap;
  cursor: pointer; border: 1px solid transparent;
}
.chip-cat-c-proj { background: var(--blue-soft); color: var(--blue); }
.chip-cat-c-ops { background: var(--orange-soft); color: var(--orange-deep); }
.chip-cat-c-daily { background: var(--purple-soft); color: var(--purple); }
.chip-cat-c-doc { background: var(--teal-soft); color: var(--teal); }
.chip-cat-c-generic { background: var(--gray-soft); color: var(--gray); }
.chip-due { background: var(--gray-soft); color: var(--txt2); cursor: default; }
.chip-due.today { background: var(--orange-soft); color: var(--orange-deep); font-weight: 600; }
.chip-due.soon { background: #fff7e6; color: #b26a00; }
.chip-due.overdue { background: var(--red); color: #fff; font-weight: 600; }
.chip-note { background: var(--gray-soft); color: var(--txt3); cursor: default; }
.task-note-dot {
  position: absolute; right: 10px; bottom: 8px;
  width: 0; height: 0; border-style: solid; border-width: 0 0 9px 9px;
  border-color: transparent transparent var(--orange) transparent; opacity: .75;
}

/* ===== 列表 ===== */
.list-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 12px; color: var(--txt3); font-weight: 600;
  padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td { padding: 10px 12px; border-bottom: 1px solid #f1f3f7; font-size: 13.5px; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.row-overdue td { background: #fffafa; }
.tbl .t-text { font-weight: 500; cursor: pointer; }
.tbl .t-text:hover { color: var(--orange-deep); }
.tbl .t-due.overdue { color: var(--red); font-weight: 600; }
.tbl .t-due.today { color: var(--orange-deep); font-weight: 600; }
.row-del {
  border: 0; background: none; color: #c6ccd6; font-size: 15px; padding: 2px 6px; border-radius: 6px;
}
.row-del:hover { color: var(--red); background: var(--red-soft); }

/* ===== 小节标题 ===== */
.sec-title {
  display: flex; align-items: center; gap: 7px; margin: 24px 0 12px;
  font-weight: 700; font-size: 15px; color: var(--txt);
}
.sec-sub { font-size: 12px; font-weight: 400; color: var(--txt3); }
.sec-title .link-btn { margin-left: auto; }

/* ===== 日曆（例行週期 + 任務截止日） ===== */
.cal-wrap { padding: 12px 14px 14px; }
.cal-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-today { padding: 6px 14px; font-size: 13px; }
.cal-summary { font-size: 12.5px; color: var(--txt2); }
.cal-toolbar .link-btn { margin-left: auto; }
.cal-head { margin-bottom: 6px; }
.cal-week-row {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
}
.cal-week-row span {
  text-align: center; font-size: 12px; color: var(--txt3); font-weight: 600;
  padding: 2px 0;
}
.cal-grid { display: grid; gap: 4px; }
.cal-month { grid-template-columns: repeat(7, 1fr); }
.cal-week { grid-template-columns: repeat(7, 1fr); }
.cal-cell {
  background: #fff; border: 1px solid var(--line); border-radius: 9px;
  min-height: 74px; padding: 4px 5px; cursor: pointer;
  transition: border-color .15s, background .15s;
  overflow: hidden;
}
.cal-cell:hover { border-color: var(--orange); background: #fffdf9; }
.cal-cell.other { background: #fafbfd; }
.cal-cell.other .cal-daynum { color: #c3c9d4; }
.cal-cell.today { border-color: var(--orange); border-width: 1.6px; background: var(--orange-soft); }
.cal-cell.today .cal-daynum {
  background: var(--orange); color: #fff; border-radius: 8px;
  width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.cal-daynum { font-size: 11.5px; color: var(--txt2); font-weight: 600; margin-bottom: 3px; }
.cal-items { display: flex; flex-direction: column; gap: 3px; }
.cal-item {
  border: 0; text-align: left; font-family: inherit; font-size: 11px;
  padding: 2.5px 6px; border-radius: 5px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: block; width: 100%;
}
.cal-cyc { background: var(--orange-soft); color: var(--orange-deep); }
.cal-cyc.done { background: var(--green-soft); color: var(--green); }
.cal-cyc.late { background: var(--red-soft); color: var(--red); }
.cal-task { background: var(--teal-soft); color: var(--teal); }
.cal-task.done { background: var(--gray-soft); color: var(--txt3); text-decoration: line-through; }
.cal-task.late { background: var(--red); color: #fff; }
.cal-item-sub { opacity: .65; margin-left: 4px; }
.cal-more { font-size: 10.5px; color: var(--txt3); padding-left: 3px; }
.cal-empty { color: #d4d9e2; font-size: 12px; }
.cal-weekcell { min-height: 130px; }
.cal-dayview { padding: 6px 2px; }
.cal-dayview-head {
  font-size: 15px; font-weight: 700; margin-bottom: 12px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.cal-sec { font-size: 13px; color: var(--txt2); margin: 12px 0 6px; }
.cal-dayview .cal-item { font-size: 13px; padding: 8px 12px; border-radius: 8px; margin-bottom: 5px; }
.cal-dayview .cal-item-sub { float: right; }
/* 例行小視窗 */
.cal-pop-name { font-size: 15.5px; font-weight: 700; margin-bottom: 10px; }
.cal-pop-meta { display: flex; gap: 6px; flex-wrap: wrap; }
/* 雲端同步 */
.cloud-auto {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--txt2); margin-top: 10px; cursor: pointer;
}
.cloud-auto input { accent-color: var(--orange); width: 15px; height: 15px; }

/* ===== 资料库 ===== */
.lib-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.lib-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px; cursor: pointer; display: flex; flex-direction: column; gap: 8px;
  transition: box-shadow .15s, border-color .15s, transform .15s;
}
.lib-card:hover { box-shadow: 0 4px 16px rgba(31,35,41,.09); border-color: #d9dde5; transform: translateY(-1px); }
.lib-title { font-weight: 700; font-size: 14.5px; word-break: break-word; }
.lib-snippet {
  color: var(--txt2); font-size: 13px; white-space: pre-wrap;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
  word-break: break-word;
}
.lib-meta { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; margin-top: auto; }
.lib-time { font-size: 11.5px; color: var(--txt3); margin-left: auto; }
.lib-link { font-size: 12px; color: var(--blue); text-decoration: none; }
.lib-link:hover { text-decoration: underline; }
.lib-empty { grid-column: 1/-1; text-align: center; color: var(--txt3); padding: 60px 0; }
.lib-empty b { display: block; font-size: 15px; color: var(--txt2); margin-bottom: 6px; }

/* ===== 统计 ===== */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat-card b { font-size: 26px; font-weight: 700; display: block; }
.stat-card span { font-size: 12.5px; color: var(--txt3); }
.stat-card.sc-overdue b { color: var(--red); }
.stat-card.sc-done b { color: var(--green); }
.stat-card.sc-rate b { color: var(--orange-deep); }

.stats-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.panel { padding: 16px 18px; margin-bottom: 14px; }
.panel-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.panel-head h3 { font-size: 15px; }
.panel-head .sub { font-size: 12px; color: var(--txt3); }

.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bar-row .bar-label { width: 56px; font-size: 12.5px; color: var(--txt2); flex: none; }
.bar-track { flex: 1; height: 10px; background: var(--gray-soft); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; min-width: 2px; }
.bar-row .bar-num { width: 30px; text-align: right; font-size: 12.5px; color: var(--txt2); flex: none; }

.trend { display: flex; align-items: flex-end; gap: 10px; height: 110px; padding: 0 4px; }
.trend .t-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.trend .t-bars { display: flex; gap: 3px; align-items: flex-end; height: 80px; }
.trend .t-bar { width: 11px; border-radius: 3px 3px 0 0; min-height: 2px; }
.trend .t-label { font-size: 11px; color: var(--txt3); }
.legend { display: flex; gap: 16px; margin-top: 10px; font-size: 12px; color: var(--txt2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }

.late-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 2px;
  border-bottom: 1px solid #f1f3f7; font-size: 13.5px;
}
.late-item:last-child { border-bottom: 0; }
.late-item .lt-days {
  background: var(--red); color: #fff; border-radius: 20px;
  font-size: 11px; padding: 1.5px 9px; font-weight: 600; flex: none;
}
.late-item .lt-name { font-weight: 500; flex: 1; }
.none-tip { color: var(--txt3); font-size: 13px; padding: 8px 0; }

.data-ops { display: flex; gap: 10px; flex-wrap: wrap; }
.data-note { color: var(--txt3); font-size: 12.5px; margin: 12px 0 0; line-height: 1.7; }

/* ===== 底部 Tab（手机） ===== */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: rgba(255,255,255,.95); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  display: none;
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar-inner { display: flex; }
.tabbar .tab {
  flex: 1; border: 0; background: none; padding: 9px 0 10px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 11px; color: var(--txt3);
}
.tabbar .tab.on { color: var(--orange-deep); font-weight: 600; }

/* ===== 模态 ===== */
.modal-mask {
  position: fixed; inset: 0; z-index: 100; background: rgba(15, 18, 25, .45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 460px;
  max-height: 88vh; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-lg { max-width: 620px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 20px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 15.5px; }
.modal-body { padding: 16px 20px; overflow-y: auto; }
.modal-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 20px; border-top: 1px solid var(--line);
}
.f-label { display: block; font-size: 12.5px; color: var(--txt2); font-weight: 600; margin: 13px 0 6px; }
.modal-body .f-label:first-child { margin-top: 0; }
.f-input {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; outline: none; background: #fff; color: var(--txt);
}
.f-input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-soft); }
.f-area { resize: vertical; line-height: 1.65; }
.f-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ===== Toast ===== */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(16px);
  background: rgba(31, 35, 41, .92); color: #fff; font-size: 13.5px;
  padding: 9px 18px; border-radius: 10px; z-index: 200;
  opacity: 0; pointer-events: none; transition: all .22s;
  max-width: 80vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== 版本浮標（確認最新版已載入） ===== */
#version-badge {
  position: fixed; right: 10px; bottom: 84px; z-index: 55;
  background: var(--green); color: #fff; font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px; opacity: .85;
  pointer-events: none;
}
@media (min-width: 641px) { #version-badge { bottom: 10px; } }

/* ===== 響應式 ===== */
@media (max-width: 900px) {
  .board { grid-template-columns: repeat(2, 1fr); }
  .lib-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-cols { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { padding-bottom: 76px; }
  .topbar .top-tabs { display: none; }
  .tabbar { display: flex; }
  .main { padding: 10px 10px 16px; }
  .board { grid-template-columns: 1fr; }
  .cal-cell { min-height: 52px; }
  .cal-item { font-size: 10px; padding: 1.5px 3px; }
  .lib-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .add-hero-btn { width: 100%; justify-content: center; }
  .search { max-width: none; }
  .f-cols { grid-template-columns: 1fr; }
  .brand-sub { display: none; }

  /* ---- 手機緊湊模式：一眼睇晒，少啲碌 ---- */
  .card { border-radius: 12px; }
  .add-hero { padding: 9px 12px; gap: 8px; }
  .add-hero-btn { font-size: 14px; padding: 8px 16px; }
  .add-hero-hint { display: none; }
  .toolbar { gap: 5px; }
  .seg-btn { padding: 5px 9px; font-size: 11.5px; }
  .sel, .search { font-size: 12.5px; padding: 6px 9px; }
  .task { padding: 7px 9px; margin-bottom: 6px; }
  .task-txt { font-size: 13px; }
  .chip { font-size: 10px; padding: 1px 6px; }

  /* ---- 任務卡單行式：剔選｜標題｜分類｜詳情｜截止 全部一行 ---- */
  .task { display: flex; align-items: center; gap: 6px; }
  .task-top { display: contents; }
  .task-txt { flex: 1; min-width: 0; }
  .task-meta {
    display: flex; flex-direction: row; flex-wrap: nowrap;
    margin: 0; gap: 3px; flex: none; overflow: hidden;
  }
  .quad-head { padding: 2px 4px 6px; margin-bottom: 6px; }
  .quad-head b { font-size: 13px; }
  .quad-head .hint { display: none; }
  .sec-title { margin: 14px 0 8px; font-size: 13.5px; }
  .sec-sub { display: none; }

  /* 日曆：緊湊月曆條（似手機 widget） */
  .cal-wrap { padding: 8px 8px 10px; }
  .cal-toolbar { gap: 5px; margin-bottom: 5px; }
  .cal-nav { gap: 3px; }
  .cal-today { padding: 4px 10px; font-size: 12px; }
  .cal-summary { font-size: 10.5px; }
  .cal-week-row { gap: 2px; }
  .cal-week-row span { font-size: 10px; padding: 1px 0; }
  .cal-grid { gap: 2px; }
  .cal-cell { min-height: 40px; padding: 2px 3px; border-radius: 6px; }
  .cal-daynum { font-size: 10px; margin-bottom: 1px; }
  .cal-cell.today .cal-daynum { width: 15px; height: 15px; font-size: 9.5px; border-radius: 6px; }
  .cal-item { font-size: 9.5px; padding: 1px 3px; border-radius: 4px; gap: 0; }
  .cal-items { gap: 1.5px; }

  /* ---- 手機週視圖：日期 strip + 全寬議程（似 widget） ---- */
  .cal-strip { grid-template-columns: repeat(7, 1fr); }
  .cal-stripcell { min-height: 46px; padding: 4px 2px; text-align: center; }
  .cal-stripcell .cal-daynum { font-size: 15px; font-weight: 600; color: var(--txt); margin: 1px 0 0; }
  .cal-stripcell.today .cal-daynum { color: var(--orange-deep); }
  .cal-stripcell.sel { border-color: var(--orange); background: var(--orange-soft); }
  .cal-dots { display: flex; gap: 2.5px; justify-content: center; margin-top: 3px; }
  .cal-dots i { width: 4.5px; height: 4.5px; border-radius: 50%; background: var(--orange); display: block; }
  .cal-agenda { margin-top: 10px; }
  .cal-agenda .cal-item { font-size: 13px; padding: 8px 11px; white-space: normal; line-height: 1.5; }
  .cal-agenda .cal-dayview-head { font-size: 14px; font-weight: 700; color: var(--txt); margin-bottom: 6px; }
}
