/* ===========================================================================
   NPC RENT — 設計基礎
   淺色紙感底、深靛藍主色、全圓角。任何方塊都不得出現直角。
   =========================================================================== */

:root {
  /* 色票 */
  --paper: #fafaf7;
  --paper-2: #f3f3ed;
  --surface: #ffffff;
  --ink: #17203a;
  --ink-2: #39415c;
  --muted: #6a7086;
  --faint: #9aa0b0;
  --line: #e7e6df;
  --line-2: #d9d8cf;
  --sage: #6e8b74;
  --sage-soft: #e4ede6;
  --clay: #c08b5c;
  --clay-soft: #f5e9dc;
  --alert: #b4524a;
  --alert-soft: #f8e6e4;

  /* 圓角 —— 全站唯一來源 */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 26px;
  --r-xl: 36px;
  --r-pill: 999px;

  /* 陰影：極淡，不搶戲 */
  --sh-1: 0 1px 2px rgba(23, 32, 58, .04), 0 4px 16px rgba(23, 32, 58, .04);
  --sh-2: 0 2px 6px rgba(23, 32, 58, .06), 0 12px 32px rgba(23, 32, 58, .07);
  --sh-3: 0 8px 24px rgba(23, 32, 58, .10), 0 32px 64px rgba(23, 32, 58, .10);

  --nav-h: 68px;
  --wrap: 1160px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Noto Sans TC', 'Inter', -apple-system, BlinkMacSystemFont,
               'Segoe UI', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  font-size: 16px;
  line-height: 1.7;
  letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
}

body.lang-en { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }

/* 紙感細紋 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .5;
  background-image: radial-gradient(rgba(23, 32, 58, .028) 1px, transparent 1px);
  background-size: 22px 22px;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.3; letter-spacing: -.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

.wrap { width: min(var(--wrap), calc(100% - 48px)); margin-inline: auto; position: relative; z-index: 1; }

/* ─── 導覽列 ─────────────────────────────────────────────────────────── */

.nav {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  background: rgba(250, 250, 247, .82);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.nav__inner { display: flex; align-items: center; gap: 20px; width: min(var(--wrap), calc(100% - 48px)); margin-inline: auto; }

.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; letter-spacing: -.02em; font-size: 18px; white-space: nowrap; flex: none; }
.brand svg { width: 30px; height: 30px; flex: none; }
.brand__sub { font-size: 11px; font-weight: 600; color: var(--sage); letter-spacing: .14em; text-transform: uppercase; padding: 3px 9px; background: var(--sage-soft); border-radius: var(--r-pill); }

.nav__links { display: flex; gap: 2px; margin-left: auto; align-items: center; min-width: 0; }
.nav__link {
  padding: 9px 13px;
  white-space: nowrap;
  border-radius: var(--r-pill);
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink-2);
  transition: background .18s var(--ease), color .18s var(--ease);
}
.nav__link:hover { background: var(--paper-2); color: var(--ink); }
.nav__link.is-active { background: var(--ink); color: #fff; }

.nav__tools { display: flex; align-items: center; gap: 8px; flex: none; margin-left: 8px; }

.nav .nav-toggle { display: none; }

/* 語言切換 */
.langswitch {
  display: inline-flex;
  padding: 3px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
}
.langswitch button {
  border: 0;
  background: transparent;
  padding: 5px 13px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all .18s var(--ease);
}
.langswitch button.is-on { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }

/* ─── 按鈕 ───────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .16s var(--ease), box-shadow .18s var(--ease),
              background .18s var(--ease), border-color .18s var(--ease);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn--primary { background: var(--ink); color: #fff; box-shadow: var(--sh-1); }
.btn--primary:hover:not(:disabled) { box-shadow: var(--sh-2); background: #1f2a4a; }

.btn--sage { background: var(--sage); color: #fff; }
.btn--sage:hover:not(:disabled) { background: #5f7b65; }

.btn--ghost { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
.btn--ghost:hover:not(:disabled) { border-color: var(--ink); background: var(--paper-2); }

.btn--quiet { background: transparent; color: var(--muted); padding-inline: 14px; }
.btn--quiet:hover:not(:disabled) { background: var(--paper-2); color: var(--ink); }

.btn--danger { background: var(--alert-soft); color: var(--alert); border-color: #eccfcc; }
.btn--danger:hover:not(:disabled) { background: #f2d9d6; }

.btn--sm { padding: 7px 15px; font-size: 13.5px; }
.btn--lg { padding: 14px 30px; font-size: 16px; }
.btn--block { width: 100%; }
.btn svg { width: 17px; height: 17px; flex: none; }

/* ─── 表面 ───────────────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 26px;
  box-shadow: var(--sh-1);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 32px;
  box-shadow: var(--sh-1);
}

.soft {
  background: var(--paper-2);
  border-radius: var(--r-md);
  padding: 18px 20px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  font-size: 12.5px;
  font-weight: 600;
  background: var(--paper-2);
  color: var(--muted);
  border: 1px solid var(--line);
}
.tag--sage { background: var(--sage-soft); color: #4d6b54; border-color: #cfe0d3; }
.tag--clay { background: var(--clay-soft); color: #96653a; border-color: #ecd9c4; }
.tag--ink { background: var(--ink); color: #fff; border-color: var(--ink); }
.tag--alert { background: var(--alert-soft); color: var(--alert); border-color: #eccfcc; }

/* ─── 首頁英雄區 ─────────────────────────────────────────────────────── */

.hero { padding: 64px 0 52px; }
.hero__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.02fr); gap: 40px; align-items: center; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 6px 16px 6px 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  box-shadow: var(--sh-1);
  margin-bottom: 24px;
}
.eyebrow b { background: var(--ink); color: #fff; padding: 3px 11px; border-radius: var(--r-pill); font-size: 11.5px; letter-spacing: .08em; }

.hero h1 { font-size: clamp(38px, 5vw, 58px); line-height: 1.12; letter-spacing: -.035em; }
.hero h1 .accent { color: var(--sage); }
.hero__lead { margin-top: 22px; font-size: 17.5px; color: var(--ink-2); max-width: 30em; line-height: 1.75; }
.hero__cta { display: flex; gap: 12px; margin-top: 34px; flex-wrap: wrap; }
.hero__art { border-radius: var(--r-xl); overflow: hidden; }
.hero__art img { width: 100%; height: auto; }

.hero__stats { display: flex; gap: 34px; margin-top: 42px; flex-wrap: wrap; }
.stat__n { font-size: 27px; font-weight: 700; letter-spacing: -.02em; }
.stat__l { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ─── 區塊標題 ───────────────────────────────────────────────────────── */

.section { padding: 60px 0; }
.section__head { max-width: 40em; margin-bottom: 38px; }
.section__kicker { font-size: 12.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--sage); margin-bottom: 12px; }
.section__head h2 { font-size: clamp(26px, 3.4vw, 36px); letter-spacing: -.025em; }
.section__head p { margin-top: 14px; color: var(--ink-2); font-size: 16.5px; }

/* ─── 運作流程 ───────────────────────────────────────────────────────── */

.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.step {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
  position: relative;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.step:hover { transform: translateY(-3px); box-shadow: var(--sh-2); }
.step img { width: 86px; height: 86px; border-radius: var(--r-md); margin-bottom: 14px; }
.step__n { position: absolute; top: 20px; right: 22px; font-size: 13px; font-weight: 700; color: var(--faint); letter-spacing: .1em; }
.step h3 { font-size: 17px; margin-bottom: 8px; }
.step p { font-size: 14.5px; color: var(--muted); line-height: 1.65; }

/* 雙欄說明（派任務 / 接任務） */
.duo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.duo__col { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 30px; }
.duo__col--alt { background: linear-gradient(170deg, var(--sage-soft), var(--paper-2)); border-color: #d6e3d9; }
.duo__col h3 { font-size: 20px; margin-bottom: 8px; }
.duo__col > p { color: var(--ink-2); font-size: 15px; }
.checklist { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 12px; }
.checklist li { display: flex; gap: 11px; font-size: 14.5px; color: var(--ink-2); line-height: 1.6; }
.checklist svg { width: 19px; height: 19px; flex: none; margin-top: 3px; color: var(--sage); }

/* ─── 任務卡片 ───────────────────────────────────────────────────────── */

.taskgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }

.taskcard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.taskcard:hover { transform: translateY(-3px); box-shadow: var(--sh-2); border-color: var(--line-2); }
.taskcard__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.taskcard__code { font-size: 11.5px; font-weight: 700; letter-spacing: .1em; color: var(--faint); font-variant-numeric: tabular-nums; }
.taskcard h3 { font-size: 17.5px; line-height: 1.4; }
.taskcard__sum { font-size: 14.5px; color: var(--muted); line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.taskcard__meta { display: flex; flex-wrap: wrap; gap: 7px; }
.taskcard__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 15px; border-top: 1px dashed var(--line); }
.reward { font-size: 21px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.reward span { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-left: 4px; }

.metaline { display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--muted); }
.metaline svg { width: 16px; height: 16px; flex: none; color: var(--faint); }

/* ─── 篩選列 ─────────────────────────────────────────────────────────── */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 14px 18px;
  box-shadow: var(--sh-1);
}
.chiprow { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  padding: 7px 15px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all .16s var(--ease);
}
.chip:hover { border-color: var(--line-2); color: var(--ink); }
.chip.is-on { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ─── 表單 ───────────────────────────────────────────────────────────── */

.field { display: grid; gap: 7px; margin-bottom: 18px; }
.field > label { font-size: 14px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: 7px; }
.field .req { color: var(--clay); font-size: 12px; }
.field .hint { font-size: 12.8px; color: var(--faint); line-height: 1.55; }

.input, .select, textarea.input {
  width: 100%;
  padding: 12px 16px;
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  font-size: 15px;
  transition: border-color .16s var(--ease), background .16s var(--ease), box-shadow .16s var(--ease);
  outline: none;
}
.input:focus, .select:focus, textarea.input:focus {
  border-color: var(--ink);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(23, 32, 58, .07);
}
textarea.input { resize: vertical; min-height: 120px; line-height: 1.7; border-radius: var(--r-md); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236a7086' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9.5l6 5.5 6-5.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 15px center; background-size: 17px; padding-right: 42px; }

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

.radioset { display: flex; gap: 10px; flex-wrap: wrap; }
.radiopill { position: relative; }
.radiopill input { position: absolute; opacity: 0; pointer-events: none; }
.radiopill span {
  display: block;
  padding: 10px 20px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-2);
  background: var(--paper);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .16s var(--ease);
}
.radiopill input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ─── 提示訊息 ───────────────────────────────────────────────────────── */

.note {
  border-radius: var(--r-md);
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.65;
  display: flex;
  gap: 11px;
  align-items: flex-start;
}
.note svg { width: 19px; height: 19px; flex: none; margin-top: 2px; }
.note--info { background: var(--paper-2); color: var(--ink-2); }
.note--sage { background: var(--sage-soft); color: #43614a; }
.note--clay { background: var(--clay-soft); color: #8a5c31; }
.note--alert { background: var(--alert-soft); color: var(--alert); }

/* ─── 彈窗 ───────────────────────────────────────────────────────────── */

.modal-veil {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(23, 32, 58, .38);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s var(--ease);
  overflow-y: auto;
}
.modal-veil.is-open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  width: min(520px, 100%);
  padding: 34px;
  box-shadow: var(--sh-3);
  transform: translateY(14px) scale(.985);
  transition: transform .24s var(--ease);
  margin: auto;
}
.modal-veil.is-open .modal { transform: none; }
.modal--wide { width: min(820px, 100%); }
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.modal__head h3 { font-size: 22px; letter-spacing: -.02em; }
.modal__head p { font-size: 14px; color: var(--muted); margin-top: 6px; }
.iconbtn {
  width: 36px; height: 36px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--paper);
  display: grid; place-items: center;
  cursor: pointer; flex: none;
  transition: all .16s var(--ease);
}
.iconbtn:hover { background: var(--paper-2); border-color: var(--line-2); }
.iconbtn svg { width: 17px; height: 17px; }

.tabs { display: flex; gap: 4px; padding: 4px; background: var(--paper-2); border-radius: var(--r-pill); margin-bottom: 24px; }
.tabs button {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 9px 14px;
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all .18s var(--ease);
}
.tabs button.is-on { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }

/* ─── 吐司 ───────────────────────────────────────────────────────────── */

.toaster { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: grid; gap: 10px; }
.toast {
  background: var(--ink);
  color: #fff;
  padding: 13px 20px;
  border-radius: var(--r-md);
  font-size: 14.5px;
  box-shadow: var(--sh-3);
  max-width: 380px;
  animation: toast-in .26s var(--ease);
}
.toast--bad { background: var(--alert); }
.toast--good { background: var(--sage); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }

/* ─── 表格 ───────────────────────────────────────────────────────────── */

.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left;
  padding: 13px 16px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
  background: var(--paper-2);
  white-space: nowrap;
}
th:first-child { border-top-left-radius: var(--r-lg); }
th:last-child { border-top-right-radius: var(--r-lg); }
td { padding: 13px 16px; border-top: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: var(--paper); }

/* ─── 文件頁 ─────────────────────────────────────────────────────────── */

.doclayout { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 42px; align-items: start; }
.docnav { position: sticky; top: calc(var(--nav-h) + 22px); display: grid; gap: 3px; }
.docnav a {
  padding: 8px 14px;
  border-radius: var(--r-md);
  font-size: 14px;
  color: var(--muted);
  transition: all .16s var(--ease);
}
.docnav a:hover { background: var(--paper-2); color: var(--ink); }
.docnav a.is-on { background: var(--ink); color: #fff; }
.docnav .docnav__group { font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); padding: 16px 14px 6px; }

.prose h2 { font-size: 28px; margin: 48px 0 14px; letter-spacing: -.02em; scroll-margin-top: calc(var(--nav-h) + 20px); }
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 18.5px; margin: 30px 0 10px; scroll-margin-top: calc(var(--nav-h) + 20px); }
.prose p { margin: 12px 0; color: var(--ink-2); }
.prose ul, .prose ol { margin: 12px 0; padding-left: 22px; color: var(--ink-2); }
.prose li { margin: 6px 0; }
.prose code {
  background: var(--paper-2);
  border: 1px solid var(--line);
  padding: 2px 7px;
  border-radius: var(--r-xs);
  font-size: 13.5px;
  font-family: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, monospace;
  color: #8a5c31;
}
.prose table { margin: 16px 0; display: block; overflow-x: auto; white-space: nowrap; }
.prose table th, .prose table td { white-space: normal; }
.prose > * { min-width: 0; }

.codeblock { position: relative; margin: 18px 0; }
.codeblock pre {
  margin: 0;
  background: #161d33;
  color: #e6e8f0;
  padding: 20px 22px;
  border-radius: var(--r-lg);
  overflow-x: auto;
  font-family: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, monospace;
  font-size: 13.2px;
  line-height: 1.75;
}
.codeblock pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.codeblock__bar {
  display: flex; align-items: center; justify-content: space-between;
  background: #10162a; color: #8f97b2;
  padding: 9px 18px;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  font-size: 12px; font-weight: 600; letter-spacing: .06em;
}
.codeblock__bar + pre { border-radius: 0 0 var(--r-lg) var(--r-lg); }
.copybtn {
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.06);
  color: #cfd5e6;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  font-size: 11.5px; font-weight: 600;
  cursor: pointer;
  transition: background .16s var(--ease);
}
.copybtn:hover { background: rgba(255,255,255,.14); }

/* 未解鎖遮罩 */
.locked { position: relative; }
.locked__veil {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(250,250,247,.55) 0%, var(--paper) 55%);
  backdrop-filter: blur(3px);
  border-radius: var(--r-xl);
  display: flex; align-items: center; justify-content: center;
  padding: 30px;
}

/* ─── 頁尾 ───────────────────────────────────────────────────────────── */

.foot { border-top: 1px solid var(--line); margin-top: 72px; padding: 46px 0 40px; }
.foot__grid { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 36px; }
.foot h4 { font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin-bottom: 14px; }
.foot a { display: block; font-size: 14.5px; color: var(--ink-2); padding: 4px 0; }
.foot a:hover { color: var(--sage); }
.foot__note { margin-top: 36px; padding-top: 22px; border-top: 1px solid var(--line); font-size: 13px; color: var(--faint); display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; }

/* ─── 雜項 ───────────────────────────────────────────────────────────── */

.empty { text-align: center; padding: 64px 24px; color: var(--muted); }
.empty h3 { font-size: 18px; margin-bottom: 8px; color: var(--ink); }

.skeleton { background: linear-gradient(90deg, var(--paper-2) 25%, #eceae2 50%, var(--paper-2) 75%); background-size: 200% 100%; animation: sk 1.3s infinite; border-radius: var(--r-lg); height: 216px; }
@keyframes sk { to { background-position: -200% 0; } }

.spin { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--sage); display: inline-block; }
.dot--clay { background: var(--clay); }
.dot--alert { background: var(--alert); }
.dot--faint { background: var(--faint); }

.badge {
  min-width: 19px; height: 19px; padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--alert); color: #fff;
  font-size: 11px; font-weight: 700;
  display: inline-grid; place-items: center;
}

.hr { height: 1px; background: var(--line); border: 0; margin: 26px 0; }
.stack { display: grid; gap: 14px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row--end { justify-content: flex-end; }
.row--between { justify-content: space-between; }
.mut { color: var(--muted); }
.sm { font-size: 13.5px; }
.xs { font-size: 12.5px; }
.b { font-weight: 600; }
.center { text-align: center; }
.hide { display: none !important; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-variant-numeric: tabular-nums; }

.keyreveal {
  background: #161d33; color: #d7dcec;
  padding: 15px 18px; border-radius: var(--r-md);
  font-family: ui-monospace, Menlo, monospace; font-size: 13px;
  word-break: break-all; line-height: 1.6;
}

/* ─── 響應式 ─────────────────────────────────────────────────────────── */

@media (max-width: 1040px) {
  .taskpage { grid-template-columns: minmax(0, 1fr) !important; }
  .taskpage aside { position: static !important; }
}

@media (max-width: 1080px) {
  .nav__links {
    position: fixed;
    inset: var(--nav-h) 0 auto;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    border-radius: 0 0 var(--r-xl) var(--r-xl);
    flex-direction: column;
    align-items: stretch;
    padding: 14px;
    gap: 2px;
    box-shadow: var(--sh-2);
    display: none;
  }
  .nav__links.is-open { display: flex; }
  .nav__tools { margin-left: 0; margin-top: 10px; flex-wrap: wrap; }
  .nav .nav-toggle { display: grid; margin-left: auto; }
}

@media (max-width: 960px) {
  .hero__grid { grid-template-columns: minmax(0, 1fr); gap: 34px; }
  .hero__art { order: -1; max-width: 460px; }
  .steps { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .duo { grid-template-columns: minmax(0, 1fr); }
  .doclayout { grid-template-columns: minmax(0, 1fr); }
  .docnav { position: static; display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; }
  .docnav a { white-space: nowrap; }
  .docnav .docnav__group { display: none; }
  .foot__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

@media (max-width: 720px) {
  .wrap, .nav__inner { width: calc(100% - 32px); }
  .hero { padding: 48px 0 36px; }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .panel { padding: 24px; border-radius: var(--r-lg); }
  .modal { padding: 26px; border-radius: var(--r-lg); }
  .foot__grid { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .hero__stats { gap: 22px; }
}

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

/* ===========================================================================
   對話視窗
   =========================================================================== */

.chat {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--sh-1);
  min-height: 0;
}

.chat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.chat__live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--sage);
  padding: 4px 11px;
  background: var(--sage-soft);
  border-radius: var(--r-pill);
  white-space: nowrap;
}
.chat__live .dot { animation: pulse 2.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.chat__log {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 220px;
  max-height: 460px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}
.chat--compact .chat__log { max-height: 320px; min-height: 180px; }

.chat__empty { margin: auto; color: var(--faint); font-size: 14px; text-align: center; }

.chat__row { display: flex; }
.chat__row.is-mine { justify-content: flex-end; }

.chat__bubble {
  max-width: min(78%, 460px);
  background: var(--paper-2);
  border-radius: var(--r-lg);
  border-bottom-left-radius: var(--r-xs);
  padding: 11px 15px;
}
.chat__row.is-mine .chat__bubble {
  background: var(--ink);
  color: #fff;
  border-bottom-left-radius: var(--r-lg);
  border-bottom-right-radius: var(--r-xs);
}
.chat__bubble p { font-size: 14.8px; line-height: 1.65; word-break: break-word; }
.chat__bubble time { display: block; margin-top: 5px; font-size: 11.5px; opacity: .6; }
.chat__who {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.chat__who .tag { padding: 1px 8px; font-size: 10.5px; }
.chat__file {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--sage);
  text-decoration: underline;
}
.chat__row.is-mine .chat__file { color: #b8d0be; }

.chat__sys {
  align-self: center;
  max-width: 88%;
  text-align: center;
  background: var(--sage-soft);
  color: #43614a;
  border-radius: var(--r-md);
  padding: 9px 15px;
  font-size: 13px;
  line-height: 1.6;
}
.chat__sys time { display: block; margin-top: 3px; font-size: 11px; opacity: .65; }

.chat__form {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: var(--paper);
}
.chat__input {
  flex: 1;
  border: 1px solid var(--line-2);
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 11px 15px;
  font-size: 15px;
  line-height: 1.5;
  resize: none;
  max-height: 140px;
  outline: none;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.chat__input:focus { border-color: var(--ink); box-shadow: 0 0 0 4px rgba(23, 32, 58, .07); }
.chat__send {
  width: 44px; height: 44px;
  padding: 0;
  border-radius: var(--r-pill);
  flex: none;
}
.chat__locked {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--muted);
  font-size: 13.5px;
}

/* 訊息列表（messages.html） */
.threadlist { display: grid; gap: 10px; }
.thread {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 15px 18px;
  transition: border-color .16s var(--ease), transform .16s var(--ease);
}
.thread:hover { border-color: var(--line-2); transform: translateX(2px); }
.thread.is-on { border-color: var(--ink); background: var(--paper); }
.thread__body { flex: 1; min-width: 0; }
.thread__title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thread__last {
  font-size: 13.5px;
  color: var(--muted);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thread__side { text-align: right; flex: none; display: grid; gap: 6px; justify-items: end; }

/* ===========================================================================
   流程階段指示
   =========================================================================== */

.stageline {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}
.stageline__dot {
  width: 100%;
  height: 4px;
  border-radius: var(--r-pill);
  background: var(--line);
  transition: background .2s var(--ease);
}
.stageline__dot.is-done { background: var(--sage); }
.stageline__dot.is-now { background: var(--ink); }
.stageline__dot.is-bad { background: var(--alert); }

.stagetag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 4px 9px;
  border-radius: var(--r-pill);
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--muted);
  white-space: nowrap;
}
.stagetag b { font-size: 11px; opacity: .65; font-variant-numeric: tabular-nums; }
.stagetag--now { background: var(--ink); border-color: var(--ink); color: #fff; }
.stagetag--done { background: var(--sage-soft); border-color: #cfe0d3; color: #4d6b54; }
.stagetag--wait { background: var(--clay-soft); border-color: #ecd9c4; color: #96653a; }
.stagetag--bad { background: var(--alert-soft); border-color: #eccfcc; color: var(--alert); }

/* 首頁完整流程圖 */
.flowmap { display: grid; gap: 14px; }
.flowstep {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  position: relative;
}
.flowstep__n {
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  background: var(--paper-2);
  color: var(--ink);
  display: grid; place-items: center;
  font-weight: 700; font-size: 15px;
  border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.flowstep--poster .flowstep__n { background: var(--ink); color: #fff; border-color: var(--ink); }
.flowstep--worker .flowstep__n { background: var(--sage-soft); color: #43614a; border-color: #cfe0d3; }
.flowstep--both .flowstep__n { background: var(--clay-soft); color: #8a5c31; border-color: #ecd9c4; }
.flowstep h4 { font-size: 16.5px; margin-bottom: 5px; }
.flowstep p { font-size: 14.5px; color: var(--muted); line-height: 1.7; }
.flowstep__who {
  display: inline-block;
  margin-bottom: 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ===========================================================================
   PWA 安裝橫幅
   =========================================================================== */

.installbar {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translate(-50%, 130%);
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(520px, calc(100% - 32px));
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  padding: 13px 15px;
  box-shadow: var(--sh-3);
  transition: transform .3s var(--ease);
}
.installbar.is-in { transform: translate(-50%, 0); }
.installbar__mark {
  width: 42px; height: 42px;
  border-radius: var(--r-md);
  background: var(--sage-soft);
  color: var(--sage);
  display: grid; place-items: center;
  flex: none;
}
.installbar__text { flex: 1; min-width: 0; line-height: 1.45; }
.installbar__text b { display: block; font-size: 14.5px; }
.installbar__text span { font-size: 12.5px; color: var(--muted); }

.pushrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 18px;
  background: var(--paper-2);
  border-radius: var(--r-md);
  flex-wrap: wrap;
}

/* 未讀小紅點 */
.dotbadge {
  position: relative;
}
.dotbadge::after {
  content: '';
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--alert);
  border: 2px solid var(--paper);
}

.taskcard__next {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  line-height: 1.55;
  color: var(--muted);
}
.taskcard__next svg { flex: none; margin-top: 3px; color: var(--faint); }

/* ─── 訊息頁 ─────────────────────────────────────────────────────────── */

.msglayout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.msglist { min-width: 0; overflow: hidden; }
.msgpane {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  overflow: hidden;
  min-height: 420px;
  display: flex;
  flex-direction: column;
}
.msgpane__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.msgpane__back { display: none; transform: rotate(180deg); }
.msgpane .chat { border: 0; border-radius: 0; box-shadow: none; flex: 1; }
.msgpane .chat__head { display: none; }
.msgpane .chat__log { max-height: none; min-height: 340px; }

@media (max-width: 860px) {
  .msglayout { grid-template-columns: minmax(0, 1fr); }
  .msglayout .msgpane { display: none; }
  .msglayout.is-open .msglist { display: none; }
  .msglayout.is-open .msgpane { display: flex; }
  .msgpane__back { display: grid; }
  .msgpane .chat__log { min-height: calc(100dvh - 300px); }
}

/* ===========================================================================
   手機優化：這個平台的使用者多半在路上用手機操作
   =========================================================================== */

/* 分頁列在窄螢幕改為橫向捲動，不再撐爆版面 */
.tabs {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 0 0 auto; white-space: nowrap; scroll-snap-align: start; }

/* 篩選 chip 列同理 */
.chiprow {
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.chiprow::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; white-space: nowrap; }

/* 關閉中的彈窗要完全退出版面，否則在窄螢幕會撐出橫向捲動 */
.modal-veil { visibility: hidden; }
.modal-veil.is-open { visibility: visible; }

@media (max-width: 720px) {
  /* 觸控目標至少 40px 高 */
  .btn { min-height: 44px; padding-block: 12px; }
  .btn--sm { min-height: 38px; padding: 9px 16px; font-size: 14px; }
  .btn--lg { min-height: 50px; }
  .iconbtn { width: 40px; height: 40px; }
  .chip { min-height: 38px; padding: 9px 16px; }
  .tabs button { min-height: 40px; }
  .langswitch button { min-height: 34px; padding: 7px 14px; }
  .nav__link { min-height: 44px; display: flex; align-items: center; }
  .brand { min-height: 44px; }
  .copybtn { min-height: 38px; padding: 9px 15px; }

  /* 表單元素放大，避免 iOS 聚焦時自動縮放（字級需 ≥16px） */
  .input, .select, textarea.input, .chat__input { font-size: 16px; padding: 13px 16px; }
  .select { background-position: right 14px center; }

  /* 彈窗貼齊底部，像原生的 sheet */
  .modal-veil { padding: 0; align-items: flex-end; }
  .modal {
    width: 100%;
    max-height: 92dvh;
    overflow-y: auto;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  }
  .modal--wide { width: 100%; }

  /* 對話：輸入列貼底，訊息區吃滿可用高度 */
  .chat__log { max-height: none; min-height: 46dvh; padding: 14px; }
  .chat__bubble { max-width: 86%; }
  .chat__form { padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
  .chat__send { width: 46px; height: 46px; }

  /* 吐司避開底部安全區與安裝橫幅 */
  .toaster { left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }

  .installbar {
    width: calc(100% - 24px);
    bottom: calc(14px + env(safe-area-inset-bottom));
    padding: 12px;
    gap: 11px;
  }
  .installbar__mark { width: 38px; height: 38px; }

  /* 任務詳情的側欄改為貼在內容之後，不再 sticky */
  .taskpage aside { position: static !important; }

  /* 流程圖在手機上編號與內容改為上下排列 */
  .flowstep { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 18px; }

  /* 表格橫向捲動 */
  .tablewrap { -webkit-overflow-scrolling: touch; }

  /* 頁尾與區塊間距收斂 */
  .section { padding: 42px 0; }
  .foot { margin-top: 48px; padding: 34px 0 30px; }
}

/* 安全區：安裝成 PWA 後的瀏海與底部手勢區 */
@supports (padding: env(safe-area-inset-left)) {
  .wrap, .nav__inner {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}

/* 已安裝為獨立視窗時，導覽列不再需要 sticky 的半透明效果 */
@media (display-mode: standalone) {
  .nav { background: var(--paper); }
  body { padding-top: env(safe-area-inset-top); }
}


/* panel 內的子元素不得撐破容器（程式碼、長網址、表格） */
.panel > *, .card > *, .duo__col > *, .flowstep > * { min-width: 0; }
.codeblock { max-width: 100%; overflow: hidden; border-radius: var(--r-lg); }
.codeblock pre { max-width: 100%; }

/* 篩選列的分隔線 */
.filtersep {
  width: 1px;
  align-self: stretch;
  min-height: 24px;
  background: var(--line);
  flex: none;
}
@media (max-width: 720px) { .filtersep { display: none; } }

/* ===========================================================================
   信譽與評價
   =========================================================================== */

/* 星等：底層灰、上層以寬度裁切成實際分數 */
.stars { position: relative; display: inline-block; line-height: 0; white-space: nowrap; }
.stars__bg, .stars__fg { display: block; }
.stars__bg svg { fill: var(--line-2); }
.stars__fg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  width: var(--fill, 0%);
}
.stars__fg svg { fill: var(--clay); }
.stars svg { display: inline-block; }

.repbadge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
}
.repbadge b { font-variant-numeric: tabular-nums; }
.repbadge__n { color: var(--faint); font-weight: 500; }
.repbadge--new {
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: var(--paper-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: 500;
  font-size: 11.5px;
}
.repbadge--new svg { color: var(--sage); }

.reppanel { margin-top: 12px; }
.reppanel__top {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line);
}
.reppanel__top b { font-size: 19px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* 評分輸入 */
.starpick { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.starpick__b {
  border: 0;
  background: none;
  padding: 3px;
  cursor: pointer;
  line-height: 0;
  border-radius: var(--r-sm);
  transition: transform .12s var(--ease);
}
.starpick__b svg { fill: var(--line-2); transition: fill .12s var(--ease); }
.starpick__b.is-on svg { fill: var(--clay); }
.starpick__b:hover { transform: scale(1.12); }
.starpick__label {
  margin-left: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
}

/* 收到的評價列表 */
.ratelist { display: grid; gap: 10px; }
.rateitem {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 16px;
}
.rateitem__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rateitem p { font-size: 14px; color: var(--ink-2); margin-top: 7px; line-height: 1.6; }

/* 待評價提示 */
.ratecta {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--clay-soft);
  border: 1px solid #ecd9c4;
  border-radius: var(--r-md);
  flex-wrap: wrap;
}
.ratecta__body { flex: 1; min-width: 180px; }

.taskcard__poster {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 11px;
  border-top: 1px dashed var(--line);
}

/* 需要立即處理的面板 */
.panel--alert {
  border-color: #eccfcc;
  box-shadow: 0 0 0 1px #eccfcc, var(--sh-1);
}
.panel--alert::before {
  content: '';
  display: block;
  height: 3px;
  border-radius: var(--r-pill);
  background: var(--alert);
  margin: -8px 0 16px;
  width: 44px;
}

/* 進階篩選列 */
.advfilter {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px 18px;
  margin-bottom: 18px;
  box-shadow: var(--sh-1);
}
.advfilter__row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.advfilter__row label { flex: none; }
@media (max-width: 720px) {
  .advfilter__row .input { flex: 1; min-width: 0; width: auto !important; }
}

/* ===========================================================================
   趨勢小多重圖
   格線與軸線刻意做得很淡，資料才是主角。
   =========================================================================== */

.sparkgrid {
  display: grid;
  /* 五個指標要能在寬螢幕排成一列，4+1 換行看起來像漏掉一張 */
  grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
  gap: 14px;
}

.spark {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px 16px 14px;
  display: flex;
  flex-direction: column;
}
/* 繪圖區靠卡片底部對齊，卡片高度不一時基線仍成一直線 */
.spark__plot { margin-top: auto; }

.spark__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  /* 固定高度：有說明文字的卡片不會把繪圖區往下推，同一列的基線才對得齊 */
  min-height: 46px;
}
.spark__title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  line-height: 1.35;
}
.spark__note {
  font-size: 11.5px;
  color: var(--faint);
  margin-top: 3px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.spark__total {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1;
  flex: none;
}

.spark__plot {
  position: relative;
  height: 68px;
  display: block;
}

/* 基線：最淡的一條，不用虛線（虛線只是雜訊） */
.spark__base {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--line);
}

/* 長條：貼齊基線、頂端 4px 圓角，細而不厚重 */
.spark__bar {
  position: absolute;
  bottom: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 4px 4px 0 0;
  cursor: default;
  transition: opacity .12s var(--ease);
}
.spark__bar:hover, .spark__bar:focus-visible { opacity: .72; outline: none; }
.spark__bar:focus-visible { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }

.spark__tip {
  position: absolute;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: var(--r-pill);
  white-space: nowrap;
  pointer-events: none;
  z-index: 2;
}

.spark__axis {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  font-size: 11px;
  color: var(--faint);
}

.chartbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* ===========================================================================
   照片上傳
   =========================================================================== */

.picker__row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.picker__btn { cursor: pointer; }
.picker__hint { flex: 1; min-width: 140px; line-height: 1.4; }

.picker__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.picker__grid:empty { margin-top: 0; }

.picker__item {
  position: relative;
  width: 76px;
  height: 76px;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--paper-2);
  border: 1px solid var(--line);
  flex: none;
}
.picker__item img { width: 100%; height: 100%; object-fit: cover; }
.picker__item.is-busy { display: grid; place-items: center; }
.picker__item.is-busy .spin { border-color: var(--line-2); border-top-color: var(--ink); }

.picker__x {
  position: absolute;
  top: 4px; right: 4px;
  width: 22px; height: 22px;
  border: 0;
  border-radius: 50%;
  background: rgba(23, 32, 58, .78);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}
.picker__x:hover { background: var(--ink); }

/* 已提交的證明縮圖 */
.thumbs { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.thumbs__i {
  width: 68px; height: 68px;
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  flex: none;
  transition: transform .14s var(--ease);
}
.thumbs__i:hover { transform: scale(1.04); }
.thumbs__i img { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 720px) {
  .picker__item { width: 68px; height: 68px; }
  .thumbs__i { width: 60px; height: 60px; }
}

/* 對話輸入列的加照片按鈕 */
.chat__clip {
  width: 40px; height: 40px;
  flex: none;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-2);
  background: var(--surface);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--muted);
  transition: all .16s var(--ease);
}
.chat__clip:hover { border-color: var(--ink); color: var(--ink); }
.chat__clip.is-busy { opacity: .5; pointer-events: none; }
.chat__bubble .thumbs { margin-top: 8px; }
.chat__bubble .thumbs__i { width: 116px; height: 88px; border-color: rgba(255,255,255,.2); }
@media (max-width: 720px) { .chat__clip { width: 44px; height: 44px; } }

/* ===========================================================================
   待辦時間線
   =========================================================================== */

.todogroup { margin-bottom: 22px; }
.todogroup:last-child { margin-bottom: 0; }

.todogroup__h {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 10px;
}
.todogroup__h span {
  font-size: 11px;
  letter-spacing: 0;
  padding: 1px 8px;
  border-radius: var(--r-pill);
  background: var(--paper-2);
  color: var(--muted);
}
.todogroup__h.is-late { color: var(--alert); }
.todogroup__h.is-late span { background: var(--alert-soft); color: var(--alert); }

.todolist { display: grid; gap: 10px; }

.todo {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  transition: transform .16s var(--ease), box-shadow .16s var(--ease),
              border-color .16s var(--ease);
}
.todo:hover { transform: translateY(-2px); box-shadow: var(--sh-2); border-color: var(--line-2); }
.todo--urgent { border-left: 3px solid var(--clay); }

.todo__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}
.todo__action { font-size: 13px; font-weight: 700; color: var(--ink); }
.todo--urgent .todo__action { color: #8a5c31; }

.todo__title { font-size: 15.5px; font-weight: 600; line-height: 1.45; }
.todo__why { font-size: 13.5px; color: var(--muted); margin-top: 5px; line-height: 1.6; }

.todo__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 11px;
  padding-top: 11px;
  border-top: 1px dashed var(--line);
}
.todo__meta .metaline { font-size: 12.8px; }
.todo__who { display: flex; align-items: center; gap: 5px; margin-top: 8px; }
.todo__who svg { color: var(--faint); }

@media (max-width: 720px) {
  .todo { padding: 15px 16px; }
  .todo__meta { gap: 7px 13px; }
}

/* 個人頁 */
.profile__mark {
  width: 58px; height: 58px;
  border-radius: var(--r-lg);
  background: var(--sage-soft);
  color: var(--sage);
  display: grid;
  place-items: center;
  flex: none;
}
@media (max-width: 720px) { .profile__mark { width: 48px; height: 48px; } }

/* ── 任務範本挑選 ─────────────────────────────────────────── */
.tplpick { margin-bottom: 24px; }
.tplpick__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(214px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.tplpick__b {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  text-align: left;
  width: 100%;
  padding: 13px 14px;
  font: inherit;
  color: inherit;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color .16s var(--ease), background .16s var(--ease);
}
.tplpick__b:hover { border-color: var(--sage); background: var(--paper-2); }
.tplpick__b.is-on { border-color: var(--sage); box-shadow: inset 0 0 0 1px var(--sage); }
.tplpick__b > span:last-child { min-width: 0; }
.tplpick__i { flex: none; margin-top: 1px; color: var(--sage); }
.tplpick__n { display: block; font-weight: 600; font-size: 14px; }
.tplpick__h { display: block; margin-top: 3px; font-size: 12.5px; line-height: 1.45; color: var(--muted); }

/* 未填完的佔位符：送出前先在表單上指出來，不要等伺服器退件 */
.input.is-warn { border-color: var(--clay); background: var(--clay-soft); }

@media (max-width: 720px) {
  .tplpick__grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
}

/* ── 首頁介紹影片 ──────────────────────────────────────────── */
.filmbox { position: relative; border-radius: var(--r-xl); overflow: hidden;
  background: var(--ink); box-shadow: var(--sh-2); }
.filmbox__v { display: block; width: 100%; height: auto; }

/* 蓋在影片上的播放鈕。播放後整塊隱藏，讓原生控制項接手。 */
.filmbox__play {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 0; font: inherit; color: #fff; cursor: pointer;
  background: linear-gradient(180deg, rgba(23,32,58,.12), rgba(23,32,58,.52));
  border: 0; transition: background .2s var(--ease);
}
.filmbox__play:hover { background: linear-gradient(180deg, rgba(23,32,58,.2), rgba(23,32,58,.6)); }
.filmbox__play:focus-visible { outline: 3px solid var(--sage); outline-offset: -3px; }
.filmbox__disc {
  display: grid; place-items: center; width: 62px; height: 62px;
  border-radius: var(--r-pill); background: rgba(255,255,255,.94); color: var(--ink);
  box-shadow: 0 6px 22px rgba(23,32,58,.32);
  transition: transform .2s var(--ease);
}
.filmbox__play:hover .filmbox__disc { transform: scale(1.06); }
.filmbox__cap { text-align: center; text-shadow: 0 1px 10px rgba(23,32,58,.5); }
.filmbox__t { display: block; font-size: 15px; font-weight: 600; }
.filmbox.is-playing .filmbox__play { display: none; }

@media (max-width: 720px) {
  .filmbox__disc { width: 54px; height: 54px; }
  .filmbox__t { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .filmbox__disc, .filmbox__play { transition: none; }
}
