* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand: #b4520e;
  --brand-dark: #8f400a;
  --brand-soft: #fbeade;
  --go: #0e7490;
  --go-soft: #d8f2f8;
  --bg: #f6f2ee;
  --card: #ffffff;
  --ink: #2c2320;
  --muted: #736459;
  --line: #e8e0d8;
  --red: #b3261e;
  --red-soft: #fbe3e1;
  --radius: 12px;
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang HK", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  font-size: 15px;
}

button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-dark); word-break: break-all; }

/* ---------- topbar ---------- */
.topbar {
  background: var(--brand);
  color: #fff;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .brand {
  font-weight: 700; font-size: 15px; letter-spacing: .02em;
  display: flex; align-items: center; gap: 9px; min-width: 0;
}
.brand-mark {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: block;
  flex-shrink: 0;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .8);
}
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 13px; opacity: .92; }
.topbar button {
  background: rgba(255,255,255,.14);
  border: none;
  color: #fff;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 13px;
  white-space: nowrap;
}
.topbar button:hover { background: rgba(255,255,255,.24); }

/* ---------- layout ---------- */
.container { max-width: 860px; margin: 0 auto; padding: 16px 14px 90px; }

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  margin-bottom: 14px;
  -webkit-overflow-scrolling: touch;
}
.tabs button {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 14px;
  white-space: nowrap;
  color: var(--muted);
}
.tabs button.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
}
.tabs .badge {
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  padding: 0 6px;
  margin-left: 4px;
  font-weight: 700;
}
.tabs button.active .badge { background: rgba(255, 255, 255, .92); color: var(--brand-dark); }

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.month-nav { display: flex; align-items: center; gap: 4px; }
.month-nav .month-label { font-weight: 700; font-size: 16px; min-width: 110px; text-align: center; }
.month-nav button {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 8px;
  width: 32px; height: 32px;
  font-size: 15px;
}
.toolbar .spacer { flex: 1; }

/* ---------- buttons ---------- */
.btn {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 9px;
  padding: 7px 14px;
  font-size: 14px;
  color: var(--ink);
}
.btn:hover { border-color: #d6c9bc; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--brand-dark); }
.btn-sm { padding: 4px 10px; font-size: 13px; border-radius: 7px; }

/* ---------- stats ---------- */
.stats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  color: var(--muted);
}
.stat b { color: var(--ink); margin-left: 2px; }
.stat.warn { border-color: #eda9a4; background: var(--red-soft); color: var(--red); }
.stat.warn b { color: var(--red); }

/* ---------- sections / groups ---------- */
.group { margin-bottom: 22px; }
.group-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.group-title.danger { color: var(--red); }
.group-title .count { font-weight: 500; }

.member-section { margin-bottom: 24px; }
.member-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.member-head .m-name { font-weight: 700; font-size: 15px; }
.member-head .m-sum { font-size: 12.5px; color: var(--muted); }
.member-head .bar { flex: 1; max-width: 140px; }

.bar {
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }

/* ---------- task card ---------- */
.task {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
}
.task.overdue { border-color: #eda9a4; }
.task.done { opacity: .72; }
.task summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 13px;
  cursor: pointer;
}
.task summary::-webkit-details-marker { display: none; }
.task summary .chev {
  color: var(--muted);
  transition: transform .15s;
  font-size: 12px;
  flex-shrink: 0;
}
.task[open] summary .chev { transform: rotate(180deg); }
.t-main { flex: 1; min-width: 0; }
.t-title { font-weight: 600; font-size: 14.5px; overflow-wrap: anywhere; }
.task.done .t-title { text-decoration: line-through; text-decoration-thickness: 1px; }
.t-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 5px;
  font-size: 12px;
  color: var(--muted);
}
.t-meta .due { white-space: nowrap; }
.t-meta .due.late { color: var(--red); font-weight: 700; }
.mini-bar { display: inline-flex; align-items: center; gap: 5px; }
.mini-bar .bar { width: 52px; }

/* chips */
.chip {
  display: inline-block;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.chip.todo   { background: #efe9e3; color: #6b5d53; }
.chip.doing  { background: #dce8fb; color: #1d4ed8; }
.chip.review { background: #fbeec8; color: #8a6206; }
.chip.approved { background: var(--go-soft); color: var(--go); }
.chip.done   { background: #d9f2e0; color: #15803d; }
.chip.routine { background: #efe9e3; color: #6b5d53; }
.chip.late   { background: var(--red-soft); color: var(--red); }
.chip.adhoc  { background: #ece7fa; color: #6d28d9; }
.chip.self   { background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); }
.chip.p-high   { background: var(--red-soft); color: var(--red); }
.chip.p-medium { background: #fbeec8; color: #8a6206; }
.chip.p-low    { background: #efe9e3; color: var(--muted); }

/* card body */
.t-body { border-top: 1px solid var(--line); padding: 12px 13px; }
.t-desc { font-size: 14px; color: #4a3d35; white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 10px; }
.t-block { margin-bottom: 10px; }
.t-block .b-label { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 3px; }
.t-block .b-text { font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; }

.alert {
  background: #fdf1e3;
  border: 1px solid #e8b98a;
  color: #8a4b12;
  border-radius: 9px;
  padding: 8px 11px;
  font-size: 13.5px;
  margin-bottom: 10px;
  white-space: pre-wrap;
}
.alert.ok {
  background: #eefafd;
  border-color: #7fd4e3;
  color: var(--go);
}

/* 例行任務摺疊區（admin 總覽） */
.routine-block {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 4px 12px;
  margin-bottom: 8px;
  background: transparent;
}
.routine-block > summary {
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--muted);
  padding: 7px 0;
  list-style: none;
}
.routine-block > summary::-webkit-details-marker { display: none; }
.routine-block .r-over { color: var(--red); }
.routine-block .routine-list { padding: 4px 0 8px; }

.subtasks { margin-bottom: 8px; }
.subtask {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 0;
}
.subtask input[type=checkbox] {
  width: 19px; height: 19px;
  accent-color: var(--brand);
  flex-shrink: 0;
}
.subtask .s-title { flex: 1; font-size: 14px; overflow-wrap: anywhere; }
.subtask.done .s-title { color: var(--muted); text-decoration: line-through; }
.subtask .s-del {
  border: none; background: none;
  color: #d6c9bc; font-size: 15px; padding: 2px 6px;
}
.subtask .s-del:hover { color: var(--red); }

.add-sub { display: flex; gap: 6px; margin-bottom: 10px; }
.add-sub input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13.5px;
}

.t-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.empty {
  color: var(--muted);
  font-size: 13.5px;
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}

/* ---------- review queue ---------- */
.review-card { border-color: #e8c46a; }

/* ---------- 成員管理 ---------- */
.user-row {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.user-row .u-info { flex: 1; min-width: 160px; }
.user-row .u-name { font-weight: 700; }
.user-row .u-email { font-size: 12.5px; color: var(--muted); }

/* ---------- auth screens ---------- */
.auth-wrap {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.auth-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 10px 30px rgba(180, 82, 14, .10);
}
.auth-card .logo { margin-bottom: 12px; }
.auth-card .logo img { width: 66px; height: 66px; border-radius: 50%; display: block; }
.auth-card h1 { font-size: 19px; margin-bottom: 2px; }
.auth-card .sub { color: var(--muted); font-size: 13.5px; margin-bottom: 18px; }
.auth-card form { display: grid; gap: 12px; }
.auth-card .btn-primary { padding: 10px; font-size: 15px; }

/* ---------- forms ---------- */
label { display: block; font-size: 13px; font-weight: 600; color: #4a3d35; }
/* label 有 display 就會蓋過瀏覽器自己嘅 [hidden]{display:none}，要撳返佢 */
[hidden] { display: none !important; }
label input, label select, label textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 11px;
  font-size: 14.5px;
  font-weight: 400;
  background: #fff;
}
label input:focus-visible, label select:focus-visible, label textarea:focus-visible,
.add-sub input:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
  border-color: var(--brand);
}
textarea { resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint { font-size: 12px; color: var(--muted); }

/* ---------- dialog ---------- */
dialog {
  border: none;
  border-radius: 14px;
  padding: 20px;
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100svh - 40px);
  overflow-y: auto;
  margin: auto;
}
dialog::backdrop { background: rgba(15, 23, 42, .45); }
dialog h2 { font-size: 17px; margin-bottom: 12px; }
dialog form { display: grid; gap: 12px; }
.dlg-sub { font-size: 13.5px; color: var(--muted); margin: -6px 0 4px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.confirm-msg { font-size: 15px; margin-bottom: 14px; white-space: pre-wrap; }

/* ---------- toast ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: #33281f;
  color: #fff;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 50;
  max-width: calc(100vw - 40px);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--red); }

/* ---------- fab（手機加任務） ---------- */
.fab {
  position: fixed;
  right: 18px;
  bottom: 22px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 14.5px;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(180, 82, 14, .32);
  z-index: 15;
}
.fab:hover { background: var(--brand-dark); }

@media (max-width: 520px) {
  .container { padding: 12px 10px 100px; }
  .form-row { grid-template-columns: 1fr; }
  .topbar .who { display: none; }
  .topbar { padding: 9px 12px; gap: 8px; }
  .topbar .brand { font-size: 14.5px; gap: 8px; }
  .brand-mark { width: 27px; height: 27px; }
  .brand-full { display: none; }
  .month-nav .month-label { min-width: 96px; font-size: 15px; }
}

/* ---------- 自動化：批量開任務／API key／Notion ---------- */
.card-plain {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  font-size: 14px;
}
.card-plain p { color: var(--muted); }
.card-plain b { color: var(--ink); }

.notion-form { display: grid; gap: 10px; margin-bottom: 10px; }

.token-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 12px;
  overflow-wrap: anywhere;
  user-select: all;
}

.bulk-table { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.bulk-table table { border-collapse: collapse; width: 100%; font-size: 13px; }
.bulk-table th, .bulk-table td {
  text-align: left;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.bulk-table th { font-size: 11.5px; color: var(--muted); font-weight: 700; white-space: nowrap; }
.bulk-table tr:last-child td { border-bottom: none; }

.bulk-errors {
  background: var(--red-soft);
  border: 1px solid #eda9a4;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--red);
  margin-bottom: 10px;
}
.bulk-errors > div { margin-top: 5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; opacity: .75; }

#dlg-bulk textarea, #bulk-preview { font-size: 13.5px; }
#dlg-bulk textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
#dlg-bulk { width: min(620px, calc(100vw - 32px)); }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .92em;
  background: var(--bg);
  border-radius: 4px;
  padding: 0 4px;
}

.btn:disabled,
.btn-primary:disabled {
  opacity: .45;
  cursor: not-allowed;
  background: var(--line);
  border-color: var(--line);
  color: var(--muted);
}

/* 未分派 */
.chip.unassigned { background: #fbeade; color: var(--brand-dark); box-shadow: inset 0 0 0 1px #e8c0a0; }
.group-title.warnish { color: var(--brand-dark); }
.stat.warnish { border-color: #e8c0a0; background: var(--brand-soft); color: var(--brand-dark); }
.stat.warnish b { color: var(--brand-dark); }

/* ---------- 項目（pipeline） ---------- */
.chip.proj    { background: #e6eefb; color: #1e40af; }
.chip.blocked { background: #efe9e3; color: #6b5d53; box-shadow: inset 0 0 0 1px #d9cec4; }
.chip.ready   { background: #d9f2e0; color: #15803d; }

.alert.wait {
  background: #efe9e3;
  color: #5f5248;
  border-left: 3px solid #c2b3a6;
}
.hint.handoff { margin-top: 4px; }

.proj {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
}
.proj.late { border-color: #eda9a4; }
.proj-head .p-title { font-weight: 700; font-size: 16px; }
.proj-head .p-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.proj-head .warn-txt { color: var(--red); }
.p-progress { display: flex; align-items: center; gap: 8px; margin: 8px 0 4px; }
.p-progress .bar { flex: 1; max-width: 220px; }
.p-progress .p-pct { font-size: 12px; color: var(--muted); }
.p-now { font-size: 13px; color: var(--ink); }
.p-now b { color: var(--brand-dark); }

.pipeline {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 0 4px;
  -webkit-overflow-scrolling: touch;
}
.stage {
  flex: 0 0 auto;
  min-width: 132px;
  max-width: 180px;
  text-align: left;
  background: #faf7f4;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  display: grid;
  gap: 2px;
  position: relative;
}
.stage + .stage { margin-left: 10px; }
.stage + .stage::before {
  content: '›';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  color: #bfb2a6;
  font-size: 16px;
}
.stage .s-no { font-size: 11px; color: var(--muted); }
.stage .s-name { font-weight: 600; font-size: 14px; line-height: 1.3; }
.stage .s-who { font-size: 12px; color: var(--muted); }
.stage .s-state { font-size: 11px; color: var(--muted); }
.stage.done { background: #eef8f1; border-color: #bfe3c9; }
.stage.done .s-name { text-decoration: line-through; opacity: .75; }
.stage.doing, .stage.review, .stage.approved { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand-soft); }
.stage.ready { background: #fff; border-color: #7fbf95; }
.stage.blocked { opacity: .72; }
.stage.overdue { border-color: #eda9a4; background: var(--red-soft); }
.stage:hover { border-color: var(--brand); }

.p-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.proj-tasks { margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 8px; }
.proj-tasks > summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.proj-task-list { margin-top: 8px; }
.tpl-group > summary { cursor: pointer; }
.bulk-table tr.row-late td { background: var(--red-soft); }
label.inline { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
label.inline input { width: auto; }

/* ---------- 新 chips：焦點／唔做喇／未到開工日 ---------- */
.chip.focus     { background: #fde9c8; color: #92400e; box-shadow: inset 0 0 0 1px #e8b98a; font-weight: 700; }
.chip.cancelled { background: #efe9e3; color: var(--muted); text-decoration: line-through; }
.chip.later     { background: #efe9e3; color: #6b5d53; }
.chip.warnish   { background: var(--brand-soft); color: var(--brand-dark); box-shadow: inset 0 0 0 1px #e8c0a0; }

.task.killed { opacity: .6; }
.task.killed .t-title { text-decoration: line-through; }
.task.focused { border-color: #e8b98a; box-shadow: inset 3px 0 0 #d97706; }
.alert.killed { background: #efe9e3; border-color: #d9cec4; color: #6b5d53; }
.killed-group > summary { cursor: pointer; }

/* ---------- 月度總覽篩選 ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 14px; }
.fbtn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 13px;
  cursor: pointer;
}
.fbtn.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.f-note { font-size: 12.5px; color: var(--brand-dark); }

.member-head .m-sum.over { color: var(--brand-dark); font-weight: 700; }
.member-head .m-hidden { font-size: 12px; color: var(--muted); }

/* ---------- Dashboard ---------- */
.group-title .spacer, .g-head .spacer, .g-nums .spacer { flex: 1; }

.goals { display: grid; gap: 10px; }
.goal {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.goal.hit { border-color: #bfe3c9; background: #f6fdf8; }
.goal.hit .bar > i { background: #15803d; }
/* .bar 本身係 inline span，得喺 flex 容器入面先有高度——呢度佢係獨立一行，要自己 block */
.goal > .bar { display: block; width: 100%; }
.g-head { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.g-label { font-weight: 700; font-size: 15px; }
.g-nums { display: flex; align-items: baseline; gap: 6px; margin-bottom: 7px; }
.g-now {
  width: 84px;
  font-size: 20px;
  font-weight: 700;
  color: var(--brand-dark);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px 8px;
  background: var(--bg);
}
.g-now:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.g-of { font-size: 14px; color: var(--muted); }
.g-pct { font-size: 13px; font-weight: 700; color: var(--muted); }
.g-note { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

.quick-links { display: flex; flex-wrap: wrap; gap: 8px; }
.qlink {
  display: inline-block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13.5px;
  color: var(--brand-dark);
  text-decoration: none;
  word-break: normal;
}
.qlink:hover { border-color: var(--brand); }

.dash-member {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 8px;
}
.dash-member .m-name { font-weight: 700; font-size: 14.5px; min-width: 72px; }
.dash-member .bar { flex: 1; min-width: 90px; max-width: 200px; }
.dash-member .m-sum { font-size: 13px; color: var(--muted); }
.dash-member .m-flags { display: flex; gap: 5px; flex-wrap: wrap; }

/* ---------- 收入（Dashboard 頂部） ---------- */
.fin-src { font-size: 12px; font-weight: 500; color: var(--muted); text-decoration: none; }
.fin-src:hover { color: var(--brand-dark); text-decoration: underline; }
.fin-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.fin-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "co spark" "amt spark" "sub sub";
  column-gap: 12px;
  align-items: end;
}
.fin-co { grid-area: co; font-size: 12px; font-weight: 700; color: var(--brand-dark); letter-spacing: .03em; }
.fin-amt {
  grid-area: amt;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.fin-sub { grid-area: sub; font-size: 12px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.fin-sub .up { color: #15803d; font-weight: 600; }
.fin-sub .down { color: var(--red); font-weight: 600; }
.fin-spark { grid-area: spark; display: flex; align-items: flex-end; gap: 3px; height: 40px; }
.fin-spark span { width: 7px; background: #e3d6cb; border-radius: 2px 2px 0 0; }
.fin-spark span.cur { background: var(--brand); }

/* ---------- 我的任務：看板 ---------- */
.container.wide { max-width: 1240px; }
.mine-bar { display: flex; align-items: center; gap: 8px; margin: 2px 0 12px; }
.mine-bar-title { font-size: 14px; font-weight: 700; }
.mine-bar .spacer { flex: 1; }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.seg button { border: 0; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; padding: 4px 14px; border-radius: 999px; }
.seg button.on { background: var(--brand); color: #fff; }
.seg button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

.kboard { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; align-items: stretch; }
.kcol {
  background: #eee7e0;
  border-radius: var(--radius);
  padding: 8px;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: background .12s, box-shadow .12s;
}
.kcol.kover { background: var(--brand-soft); box-shadow: inset 0 0 0 2px var(--brand); }
.kcol-head { display: flex; align-items: center; gap: 6px; padding: 2px 2px 0; }
.kcol-head .n { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.kcol-late { margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--red); }
.kcol-hint { font-size: 11.5px; color: var(--muted); line-height: 1.4; padding: 0 2px; margin-top: -4px; }

.kcard {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
.kcard:hover { border-color: #d3c3b5; }
.kcard:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.kcard.late { box-shadow: inset 3px 0 0 var(--red); }
.kcard.focused { box-shadow: inset 3px 0 0 #e0902f; }
.kcard.late.focused { box-shadow: inset 3px 0 0 var(--red), inset 6px 0 0 #e0902f; }
.kcard.muted { opacity: .6; }
.kcard.kdragging { opacity: .3; }
.k-title { font-size: 14px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.k-proj { display: block; font-size: 11.5px; color: #1e40af; line-height: 1.35; }
.k-meta { display: flex; gap: 10px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.k-dates { white-space: nowrap; }
.k-arrow { margin: 0 3px; opacity: .7; }
.kcard.late .k-due { color: var(--red); font-weight: 600; }
.k-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.k-chips .chip { font-size: 11px; padding: 0 7px; }
.kempty {
  border: 1.5px dashed #d6c9bd;
  border-radius: 10px;
  padding: 16px 8px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
.kmore { border: 0; background: none; font: inherit; font-size: 12px; color: var(--muted); text-decoration: underline; padding: 2px; }
.kghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 12px 28px rgba(44, 35, 32, .24);
  opacity: .95;
}
body.is-kdragging, body.is-kdragging * { cursor: grabbing !important; }
.kboard-tip { margin-top: 10px; }

@media (max-width: 900px) {
  .kboard {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    margin: 0 -14px;
    padding: 0 14px 6px;
    scroll-padding: 0 14px;
  }
  .kcol { flex: 0 0 min(80vw, 300px); scroll-snap-align: start; }
}
@media (max-width: 520px) {
  /* 呢個闊度 .container 左右得 10px padding，要跟返 */
  .kboard { margin: 0 -10px; padding: 0 10px 6px; scroll-padding: 0 10px; }
}

.dlg-detail { width: min(640px, calc(100vw - 24px)); }
.dlg-detail #detail-body .task { margin: 0; }
@media (prefers-reduced-motion: reduce) { .kcol { transition: none; } }
