/* INKUMO DESIGN WORKS — 米白極簡 */
:root {
  --bg: #F6F3EE;
  --surface: #FFFFFF;
  --surface-2: #FBF9F5;
  --ink: #1E1C1A;
  --ink-2: #4A4641;
  --muted: #8A847B;
  --line: #E6E0D6;
  --line-2: #D6CEC1;
  --red: #A8432F;   --red-bg: #F7E8E3;
  --amber: #946318; --amber-bg: #FAF0DC;
  --green: #3E7454; --green-bg: #E5EFE7;
  --blue: #3F5E7A;  --blue-bg: #E6EDF2;
  --plum: #6E4E6A;  --plum-bg: #F0E7EF;
  --lgreen: #2F8A4F; --lgreen-bg: #E2F1E6;
  --serif: 'Noto Serif TC', 'Songti TC', serif;
  --sans: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  --latin: 'Barlow Condensed', 'Noto Sans TC', sans-serif;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(30, 28, 26, .04), 0 4px 16px rgba(30, 28, 26, .04);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 15px; line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; line-height: 1.35; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- 頂部列 ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; height: 56px;
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand img { width: 30px; height: 30px; }
.brand-text { font-family: var(--latin); font-weight: 500; letter-spacing: .22em; font-size: 15px; white-space: nowrap; }
.brand-text small { display: block; font-family: var(--sans); letter-spacing: .3em; font-size: 10px; color: var(--muted); line-height: 1.1; }
.topbar .spacer { flex: 1; }
.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid transparent; background: none;
  text-decoration: none; color: var(--ink-2);
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--line); }
.badge-dot {
  position: absolute; top: 3px; right: 1px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; line-height: 17px; text-align: center; font-weight: 700;
}
.me-btn {
  display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 13px;
}
.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--ink); color: #fff; font-size: 12px; font-weight: 500; flex: none;
}
.avatar.client { background: #CFC6B8; color: var(--ink); }
.avatar.sm { width: 22px; height: 22px; font-size: 11px; }
.me-name { max-width: 7em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu {
  position: absolute; right: 12px; top: 52px; width: 280px; z-index: 50;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.12);
  padding: 8px; max-height: calc(100vh - 70px); overflow: auto;
}
.menu h4 { margin: 8px 8px 4px; font-size: 12px; color: var(--muted); font-weight: 500; }
.menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; background: none;
  border-radius: 8px; text-align: left; font-size: 14px;
}
.menu button:hover { background: var(--surface-2); }
.menu button.on { background: var(--bg); font-weight: 700; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.demo-chip {
  font-size: 11px; color: var(--amber); background: var(--amber-bg); border-radius: 4px; padding: 1px 6px; white-space: nowrap;
}

/* ---------- 版面 ---------- */
.wrap { max-width: 1140px; margin: 0 auto; padding: 20px 16px 110px; }
.wrap.narrow { max-width: 760px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--ink-2); }
.proj-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.proj-head h1 { font-size: 24px; }
.proj-meta { font-size: 13px; color: var(--muted); }
.proj-head .grow { flex: 1; min-width: 200px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; line-height: 1.5;
  padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink-2); background: var(--surface); white-space: nowrap;
}
.tag.red { color: var(--red); background: var(--red-bg); border-color: transparent; }
.tag.amber { color: var(--amber); background: var(--amber-bg); border-color: transparent; }
.tag.green { color: var(--green); background: var(--green-bg); border-color: transparent; }
.tag.ink { color: #fff; background: var(--ink); border-color: var(--ink); }
.tag.ghost { background: transparent; }

.tabs { display: none; gap: 4px; margin: 18px 0 0; border-bottom: 1px solid var(--line); }
.tabs a {
  padding: 8px 14px; text-decoration: none; color: var(--ink-2); font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px;
  display: flex; align-items: center; gap: 6px;
}
.tabs a.on { color: var(--ink); font-weight: 700; border-color: var(--ink); }
.tabs .count { font-size: 11px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 0 6px; }
.tabs .tab-new { margin-left: auto; }

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex;
  background: rgba(255,255,255,.96); backdrop-filter: blur(8px); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 7px;
  font-size: 11px; color: var(--muted); text-decoration: none; position: relative;
}
.bottomnav a.on { color: var(--ink); font-weight: 700; }
.bottomnav a .badge-dot { top: 2px; right: calc(50% - 22px); }
.bottomnav a.plus svg { background: var(--ink); color: #fff; border-radius: 50%; padding: 3px; width: 24px; height: 24px; }

@media (min-width: 900px) {
  .tabs { display: flex; }
  .bottomnav { display: none; }
  .wrap { padding-bottom: 60px; }
  .proj-head h1 { font-size: 28px; }
}

/* ---------- 卡片 ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 14px; }
.card-h { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-h h2, .card-h h3 { font-size: 16px; }
.card-h .spacer { flex: 1; }
.section { margin-top: 18px; }
.grid3 { display: grid; gap: 14px; margin-top: 14px; }
.grid3 .card + .card { margin-top: 0; }
@media (min-width: 900px) {
  .grid3 { grid-template-columns: 1fr 1fr 1fr; align-items: start; }
}
.link-btn { border: 0; background: none; padding: 0; color: var(--ink-2); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid var(--ink); background: var(--ink); color: #fff; font-size: 14px; font-weight: 500;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #000; }
.btn.line { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn.line:hover { border-color: var(--ink); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 6px; }
.btn[disabled] { background: #CFC8BD; border-color: #CFC8BD; color: #fff; cursor: not-allowed; }
.btn.block { width: 100%; }

/* 警示條 */
.alert {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius);
  background: var(--red-bg); color: var(--red); font-size: 14px; margin-top: 14px;
}
.alert.amber { background: var(--amber-bg); color: var(--amber); }
.alert a { color: inherit; font-weight: 700; }
.alert svg { margin-top: 3px; }

/* 待你處理 */
.pending-list { display: flex; flex-direction: column; gap: 8px; }
.pending-item {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 8px; border: 1px solid var(--line);
  text-decoration: none; background: var(--surface-2);
}
.pending-item:hover { border-color: var(--ink); }
.pending-item .t { flex: 1; min-width: 0; }
.pending-item .t b { display: block; font-weight: 500; }

/* 類型圖示 */
.ticon {
  position: relative; width: 34px; height: 34px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; flex: none;
  background: #EEEAE3; color: var(--ink-2);
}
.ticon.quote { background: var(--amber-bg); color: var(--amber); }
.ticon.comm { background: var(--blue-bg); color: var(--blue); }
.ticon.line { background: var(--lgreen-bg); color: var(--lgreen); }
.ticon.voice { background: var(--plum-bg); color: var(--plum); }
.ticon.sm { width: 26px; height: 26px; border-radius: 6px; }
.ticon.sm svg { width: 15px; height: 15px; }
.seq {
  position: absolute; right: -5px; bottom: -5px; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 4px;
  background: var(--ink); color: #fff; font-size: 10px; line-height: 18px; text-align: center; font-weight: 700; border: 2px solid var(--surface);
  box-sizing: content-box;
}

/* 進度條 */
.stages { position: relative; display: flex; overflow-x: auto; gap: 0; padding: 6px 2px 4px; scrollbar-width: thin; }
.stage { flex: 1 0 92px; position: relative; text-align: center; padding-top: 26px; }
.stage::before { content: ''; position: absolute; top: 10px; left: 0; right: 0; height: 2px; background: var(--line); }
.stage:first-child::before { left: 50%; }
.stage:last-child::before { right: 50%; }
.stage.done::before { background: var(--ink); }
.stage.current::before { background: linear-gradient(90deg, var(--ink) 50%, var(--line) 50%); }
.stage:first-child.current::before { background: var(--line); }
.stage .dot {
  position: absolute; top: 4px; left: calc(50% - 7px); width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--line-2);
}
.stage.done .dot { background: var(--ink); border-color: var(--ink); }
.stage.current .dot { border-color: var(--ink); box-shadow: 0 0 0 4px rgba(30,28,26,.12); background: var(--surface); }
.stage.current .dot::after { content: ''; position: absolute; inset: 2px; border-radius: 50%; background: var(--ink); }
.stage .nm { font-size: 13px; line-height: 1.4; color: var(--ink-2); }
.stage.current .nm { font-weight: 700; color: var(--ink); }
.stage.todo .nm { color: var(--muted); }
.stage .dt { font-size: 11px; color: var(--muted); }
.stage-edit { display: flex; flex-direction: column; gap: 6px; }
.stage-edit .row { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.stage-edit .row input[type=text] { flex: 1; min-width: 0; }
.stage-edit .row input { border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; background: var(--surface); }
.stage-edit .row input[type=date] { width: 140px; }

/* 規則卡 */
.rules dl { margin: 0; display: grid; gap: 10px; }
.rules dt { font-size: 12px; color: var(--muted); }
.rules dd { margin: 0; font-size: 14px; }
.rules textarea { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; min-height: 60px; background: var(--surface-2); }
@media (min-width: 900px) { .rules dl { grid-template-columns: 1fr 1fr; gap: 12px 24px; } }
details.fold > summary { list-style: none; cursor: pointer; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary .chev { transition: transform .2s; }
details.fold[open] > summary .chev { transform: rotate(180deg); }

/* 動態 */
.feed { display: flex; flex-direction: column; }
.feed-row { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); text-decoration: none; }
.feed-row:first-child { border-top: 0; padding-top: 0; }
.feed-row .body { flex: 1; min-width: 0; font-size: 14px; }
.feed-row .quote { color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.feed-row .when { font-size: 12px; color: var(--muted); }
.kind { font-size: 11px; padding: 0 6px; border-radius: 4px; background: var(--bg); color: var(--ink-2); margin-right: 4px; border: 1px solid var(--line); }
.kind.publish { color: var(--blue); background: var(--blue-bg); border-color: transparent; }
.kind.confirm { color: var(--green); background: var(--green-bg); border-color: transparent; }
.kind.converge { color: #fff; background: var(--ink); border-color: var(--ink); }

/* 待辦 */
.todo-group h4 { margin: 12px 0 4px; font-size: 12px; color: var(--muted); font-weight: 500; }
.todo-group:first-child h4 { margin-top: 0; }
.todo { display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; align-items: flex-start; }
.todo:first-of-type { border-top: 0; }
.todo input { margin-top: 5px; width: 16px; height: 16px; accent-color: var(--ink); flex: none; }
.todo .body { flex: 1; min-width: 0; }
.todo.done .txt { text-decoration: line-through; color: var(--muted); }
.todo .meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.todo .meta a { color: var(--muted); }
.due.over { color: var(--red); font-weight: 700; }
.due.today { color: var(--amber); font-weight: 700; }

/* 閱讀狀態 */
.rs-item { padding: 10px 0; border-top: 1px solid var(--line); }
.rs-item:first-child { border-top: 0; padding-top: 0; }
.rs-top { display: flex; align-items: center; gap: 8px; text-decoration: none; font-size: 14px; }
.rs-top .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-people { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.person-st {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 2px 8px; border-radius: 999px;
  background: var(--bg); color: var(--ink-2); white-space: nowrap;
}
.person-st.unread { background: var(--red-bg); color: var(--red); font-weight: 700; }
.person-st.need { background: var(--amber-bg); color: var(--amber); font-weight: 700; }
.person-st.ok { background: var(--green-bg); color: var(--green); }
.person-st .ref { font-size: 10px; opacity: .8; font-weight: 400; }

/* 時間軸 */
.intro { font-size: 14px; color: var(--ink-2); margin: 16px 0 10px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin: 12px 0; scrollbar-width: none; }
.chip {
  flex: none; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface);
  font-size: 13px; text-decoration: none; color: var(--ink-2);
}
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.tl { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.tl li a {
  display: flex; gap: 12px; align-items: center; padding: 14px 4px; border-bottom: 1px solid var(--line); text-decoration: none;
}
.tl li a:hover { background: var(--surface); }
.tl .t { flex: 1; min-width: 0; }
.tl .t b { font-weight: 500; }
.tl .t .sub { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 2px; }
.tl .date { font-size: 13px; color: var(--muted); white-space: nowrap; }

/* ---------- 內頁 ---------- */
.readbar { position: sticky; top: calc(56px + env(safe-area-inset-top, 0px)); z-index: 25; height: 3px; background: var(--line); }
.readbar i { display: block; height: 100%; width: 0; background: var(--ink); transition: width .15s; }
.article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 18px; margin-top: 14px; }
@media (min-width: 700px) { .article { padding: 32px 36px; } }
.article h1 { font-size: 24px; margin: 6px 0 4px; }
.art-meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.art-sec { margin-top: 22px; }
.art-sec h3 { font-size: 16px; margin-bottom: 8px; color: var(--ink); }
.art-sec ul, .art-sec ol { margin: 0; padding-left: 1.3em; }
.art-sec li { margin: 4px 0; }
.box { border-left: 3px solid var(--ink); background: #F2EFEA; padding: 12px 16px; border-radius: 0 8px 8px 0; margin-top: 20px; }
.box h3 { font-size: 14px; font-family: var(--sans); font-weight: 700; margin-bottom: 4px; display: flex; gap: 6px; align-items: center; }
.box.amber { border-color: var(--amber); background: var(--amber-bg); }
.box.amber h3 { color: var(--amber); }
.box.red { border-color: var(--red); background: var(--red-bg); }
.box.red h3 { color: var(--red); }
.box.green { border-color: var(--green); background: var(--green-bg); }
.box.green h3 { color: var(--green); }
.box ul { margin: 0; padding-left: 1.2em; }
.box .todo { border-color: rgba(0,0,0,.06); }
.kv { width: 100%; border-collapse: collapse; font-size: 14px; }
.kv th, .kv td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.kv th { width: 90px; color: var(--muted); font-weight: 500; }

.chat { display: flex; flex-direction: column; gap: 8px; background: #EDF1EE; border-radius: 10px; padding: 14px; }
.bubble { max-width: 88%; }
.bubble .who { font-size: 12px; color: var(--muted); }
.bubble .txt { background: #fff; border-radius: 12px; padding: 7px 12px; display: inline-block; font-size: 14px; }
.bubble.studio { align-self: flex-end; text-align: right; }
.bubble.studio .txt { background: #C9E8C6; text-align: left; }

.audio { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.audio .play { width: 36px; height: 36px; border-radius: 50%; background: var(--plum); color: #fff; display: flex; align-items: center; justify-content: center; border: 0; }
.audio .wave { flex: 1; height: 28px; display: flex; align-items: center; gap: 2px; }
.audio .wave i { flex: 1; background: #CDBFCB; border-radius: 1px; }
blockquote { margin: 8px 0; padding: 4px 0 4px 14px; border-left: 2px solid var(--line-2); color: var(--ink-2); font-family: var(--serif); }
blockquote cite { display: block; font-size: 12px; color: var(--muted); font-style: normal; font-family: var(--sans); }

/* 報價 */
.qtable { width: 100%; border-collapse: collapse; font-size: 14px; }
.qtable th { font-size: 12px; color: var(--muted); font-weight: 500; text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line-2); }
.qtable td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.qtable .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.qtable .grp td { background: var(--bg); font-weight: 700; font-size: 13px; }
.qtable .spec { font-size: 12px; color: var(--muted); }
.qtable .tot td { font-weight: 700; border-bottom: 0; }
.qtable .tot.big td { font-size: 16px; border-top: 2px solid var(--ink); }
.qmarks { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.qmark { font-size: 12px; border: 1px solid var(--line-2); background: var(--surface); padding: 1px 8px; border-radius: 999px; }
.qmark.on.ok { background: var(--green-bg); color: var(--green); border-color: var(--green); }
.qmark.on.q { background: var(--amber-bg); color: var(--amber); border-color: var(--amber); }
@media (max-width: 600px) {
  .qtable .hide-m { display: none; }
}

/* 讀到底 */
.sentinel { margin-top: 28px; text-align: center; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 10px; }
.sentinel::before, .sentinel::after { content: ''; flex: 1; border-top: 1px dashed var(--line-2); }
.sentinel.done { color: var(--green); }
.confirm-box { margin-top: 18px; padding: 16px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2); }
.confirm-box .sig { height: 56px; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; }
.sig-row { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.sig-row:first-of-type { border-top: 0; }
.sig-row .who { flex: 1; min-width: 120px; }

/* 留言 */
.comments { margin-top: 18px; }
.cmt { padding: 12px 0; border-top: 1px solid var(--line); }
.cmt-h { display: flex; align-items: center; gap: 8px; font-size: 13px; flex-wrap: wrap; }
.cmt-h b { font-weight: 700; }
.cmt-txt { font-size: 14px; margin-top: 4px; white-space: pre-wrap; }
.cmt.converge { background: #F2EFEA; border: 1px solid var(--ink); border-radius: 8px; padding: 12px; margin: 8px 0; }
.cmt-actions { margin-top: 4px; }
.form textarea, .form input[type=text], .form input[type=date], .form input[type=email], .form select {
  width: 100%; border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px; background: var(--surface); font-size: 15px;
}
.form textarea { min-height: 88px; resize: vertical; }
.form label.lb { display: block; font-size: 13px; color: var(--ink-2); margin: 14px 0 6px; font-weight: 500; }
.form .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.form .check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; margin: 10px 0; }
.form .check input { margin-top: 5px; accent-color: var(--ink); }
.form .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }
.internal { margin-top: 18px; border: 1.5px dashed #C9B48E; border-radius: var(--radius); padding: 16px; background: #FFFCF4; }
.internal .card-h h2 { color: #7A5A1E; }
.internal .cmt { border-color: #EFE3C8; }

/* 類型切換 */
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); display: flex; gap: 6px; align-items: center; font-size: 14px; }
.seg button.on { border-color: var(--ink); background: var(--ink); color: #fff; }

/* 案件總覽 */
.plist { display: grid; gap: 14px; margin-top: 16px; }
@media (min-width: 900px) { .plist { grid-template-columns: 1fr 1fr 1fr; } }
.pcard { display: block; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.pcard:hover { border-color: var(--ink); box-shadow: var(--shadow); }
.pcard h2 { font-size: 19px; }
.pcard .stats { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.mini-stages { display: flex; gap: 3px; margin-top: 12px; }
.mini-stages i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.mini-stages i.done { background: var(--ink); }
.mini-stages i.current { background: var(--ink-2); opacity: .5; }

/* 通知 */
.notif { display: flex; gap: 12px; padding: 14px 4px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.notif.new { background: linear-gradient(90deg, rgba(168,67,47,.06), transparent); }
.notif .ch {
  width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none;
  background: var(--bg); color: var(--ink-2); font-size: 11px; font-weight: 700;
}
.notif .ch.line { background: #06C755; color: #fff; }
.notif .ch.email { background: var(--blue-bg); color: var(--blue); }
.notif .ch.red { background: var(--red-bg); color: var(--red); }
.notif .ch.green { background: var(--green-bg); color: var(--green); }
.notif .body { flex: 1; min-width: 0; font-size: 14px; }
.notif .when { font-size: 12px; color: var(--muted); }
.rule-steps { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.rule-steps li { display: flex; gap: 10px; align-items: center; font-size: 14px; }
.rule-steps .n { font-family: var(--latin); font-size: 18px; width: 48px; flex: none; }
@media (min-width: 900px) { .rule-steps { grid-template-columns: repeat(4, 1fr); } .rule-steps li { flex-direction: column; align-items: flex-start; gap: 2px; } }

/* 彈窗 */
.modal-bg { position: fixed; inset: 0; z-index: 80; background: rgba(30,28,26,.45); display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--surface); width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; border-radius: 16px 16px 0 0; padding: 20px 18px 24px; }
@media (min-width: 600px) { .modal-bg { align-items: center; } .modal { border-radius: 16px; } }
.modal h2 { font-size: 18px; margin-bottom: 6px; }
.sigpad { width: 100%; height: 180px; border: 1px dashed var(--line-2); border-radius: 10px; background: #fff; touch-action: none; display: block; }
.phone { background: #8CABD9; border-radius: 18px; padding: 16px 12px; }
.phone .oa { display: flex; gap: 8px; align-items: flex-start; }
.phone .oa img { width: 34px; height: 34px; border-radius: 50%; background: #fff; padding: 3px; }
.phone .msg { background: #fff; border-radius: 14px; padding: 12px 14px; font-size: 14px; max-width: 100%; }
.phone .msg .btnlike { display: block; margin-top: 10px; text-align: center; padding: 8px; border-radius: 8px; background: var(--ink); color: #fff; font-size: 13px; }
.mail { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; font-size: 14px; }
.mail .mh { background: var(--surface-2); padding: 10px 14px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); }
.mail .mb { padding: 18px 16px; }

.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 90;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: calc(100% - 32px);
  box-shadow: 0 8px 30px rgba(0,0,0,.2); animation: tin .2s ease-out;
}
@keyframes tin { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- 登入 ---------- */
.login { min-height: 100%; display: flex; flex-direction: column; background: var(--surface); }
.login .hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px 30px; text-align: center; }
.login .hero img { width: 120px; height: 120px; }
.login .wordmark { font-family: var(--latin); font-weight: 500; letter-spacing: .28em; font-size: clamp(26px, 7vw, 46px); margin-top: 26px; line-height: 1.1; padding-left: .28em; }
.login .works { font-family: var(--latin); letter-spacing: .6em; color: #B5AEA3; font-size: clamp(14px, 3.4vw, 20px); margin-top: 6px; padding-left: .6em; }
.login .zh { letter-spacing: .9em; font-size: 14px; margin-top: 16px; padding-left: .9em; color: var(--ink-2); }
.login .form-area { width: 100%; max-width: 560px; margin: 0 auto; padding: 0 24px 40px; }
.login .form-area h2 { font-family: var(--sans); font-weight: 500; letter-spacing: .2em; font-size: 18px; }
.login .inrow { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--muted); margin-top: 18px; }
.login .inrow input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 18px; letter-spacing: .08em; padding: 12px 0; }
.login .inrow button { border: 0; background: none; font-size: 16px; color: var(--muted); display: flex; align-items: center; gap: 8px; letter-spacing: .1em; }
.login .inrow button:hover { color: var(--ink); }
.login .hint { font-size: 13px; color: var(--muted); letter-spacing: .08em; margin-top: 10px; }
.login .err { color: var(--red); font-size: 13px; margin-top: 6px; }
.demo-pick { margin-top: 28px; padding: 14px; border-radius: 12px; background: var(--bg); }
.demo-pick .grp { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.demo-pick button { border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 4px 12px 4px 4px; font-size: 13px; display: flex; gap: 6px; align-items: center; }
.demo-pick button:hover { border-color: var(--ink); }

.footer { text-align: center; padding: 30px 16px 100px; font-size: 12px; color: var(--muted); }
.footer img { width: 34px; opacity: .6; }
@media (min-width: 900px) { .footer { padding-bottom: 40px; } }
.empty { padding: 18px; text-align: center; color: var(--muted); font-size: 14px; }
.show-m { display: none; }
@media (max-width: 600px) { .show-m { display: inline; } }

/* ---------- v2：案件編號、後台、檔案、付款、保固 ---------- */
.code { font-family: var(--latin); letter-spacing: .12em; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.head-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.page-head { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; }
.page-head .grow { flex: 1; min-width: 200px; }
.group-h { font-size: 15px; font-family: var(--sans); font-weight: 700; margin: 26px 0 0; display: flex; align-items: center; gap: 6px; }
.group-fold > summary { list-style: none; cursor: pointer; }
.group-fold > summary::-webkit-details-marker { display: none; }
.group-fold[open] .chev { transform: rotate(180deg); }
.pcard-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 2px; }
.row2 { display: grid; gap: 0 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .row2 { grid-template-columns: 1fr 1fr; } }
.desk-only { display: none; }
@media (min-width: 900px) { .desk-only { display: inline-flex; } }
.err-text { color: var(--red); font-weight: 700; }

.mrow { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.mrow:first-of-type { border-top: 0; }
.mrow .grow { flex: 1; min-width: 180px; }
.mrow.off { opacity: .6; }
.mrow-act { display: flex; gap: 6px; }
.mrow select { border: 1px solid var(--line-2); border-radius: 6px; padding: 5px 8px; background: var(--surface); }
.chips-s { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip-s { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--ink-2); }
.chip-s.ink { background: var(--ink); color: #fff; border-color: var(--ink); }
.life { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; counter-reset: s; }
.life li { display: flex; gap: 10px; align-items: baseline; font-size: 13px; padding: 8px 10px; background: var(--surface-2); border-radius: 8px; }
.life li b { flex: none; width: 4em; }
.life li span { color: var(--ink-2); }
.mp-list { border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; max-height: 240px; overflow: auto; }
.mp-row { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); }
.mp-row:first-child { border-top: 0; }
.mp-row .grow { flex: 1; }
.mp-row select { width: auto !important; padding: 4px 8px !important; font-size: 13px !important; }

.filebox { display: flex; align-items: center; gap: 10px; padding: 14px; border: 1.5px dashed var(--line-2); border-radius: 10px; background: var(--surface-2); color: var(--ink-2); font-size: 14px; cursor: pointer; position: relative; }
.filebox:hover { border-color: var(--ink); }
.filebox input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.filebox:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; }
.file-list { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.fl { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.fl .muted { margin-left: auto; }

.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .gallery { grid-template-columns: repeat(3, 1fr); } }
.gallery figure { margin: 0; min-width: 0; }
.gallery figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gallery .kind { font-size: 10px; }
.thumb { display: block; width: 100%; padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bg); aspect-ratio: 16 / 10; max-width: 100%; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.missing { aspect-ratio: 16 / 10; display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--muted); background: var(--bg); padding: 8px; text-align: center; }
.fcard { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); margin-top: 8px; }
.fcard .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.fcard b { font-weight: 500; }
.btn.disabled { opacity: .5; pointer-events: none; }
.audio-box { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); margin-top: 8px; }
.audio-box audio { width: 100%; margin-top: 6px; }
.pano { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 10px; background: var(--ink); color: #fff; text-decoration: none; }
.pano span { flex: 1; display: flex; flex-direction: column; }
.pano .muted { color: #CFC8BD; }
.quote-top { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; }
.quote-top .big { font-size: 22px; font-variant-numeric: tabular-nums; }
.pre { white-space: pre-wrap; }
.tbl-wrap { overflow-x: auto; }
.kv .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fold-sec > summary { cursor: pointer; list-style: none; }
.fold-sec > summary::-webkit-details-marker { display: none; }
.fold-sec .chat { margin-top: 10px; }
.addfile { margin-top: 20px; font-size: 14px; }
.addfile summary { cursor: pointer; display: inline-flex; gap: 6px; align-items: center; color: var(--ink-2); }
.addfile select, .addfile input { margin-top: 8px; display: block; max-width: 100%; }
.zoom-img { width: 100%; border-radius: 8px; display: block; }
.modal.wide { max-width: 960px; }

.pay-sum { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 15px; }
.pay-sum b { font-size: 22px; font-variant-numeric: tabular-nums; }
.pay-bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin: 10px 0 6px; }
.pay-bar i { display: block; height: 100%; background: var(--green); }
.pay-stages { display: grid; gap: 0; }
.pay-st { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.pay-st .grow { flex: 1; }
.pay-st b { font-weight: 500; }
@media (min-width: 900px) { .pay-stages { grid-template-columns: repeat(3, 1fr); gap: 12px; } .pay-st { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; flex-direction: column; align-items: flex-start; } .pay-st.paid { background: var(--green-bg); border-color: transparent; } }
.pay-row { flex-wrap: wrap; }
.pay-row .pct { display: inline-flex; align-items: center; gap: 4px; }
.pay-row .pct input { width: 56px; }

.warranty { border-color: var(--green); }
.warranty .card-h svg { color: var(--green); }
.rep-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.repair-state { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.repair-state select { border: 1px solid var(--line-2); border-radius: 6px; padding: 4px 8px; background: var(--surface); }
.ticon.drawing { background: var(--blue-bg); color: var(--blue); }
.ticon.repair { background: var(--red-bg); color: var(--red); }
.kind.red { color: var(--red); background: var(--red-bg); border-color: transparent; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------- v3：延誤金、保固期進度 ---------- */
.fine-chip { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font-size: 12px; color: var(--green); white-space: nowrap; }
.fine-chip svg { width: 14px; height: 14px; }
.fine-chip b { font-variant-numeric: tabular-nums; }
.fine-chip.on { background: var(--red); border-color: var(--red); color: #fff; font-weight: 700; box-shadow: 0 0 0 3px var(--red-bg); }
@media (max-width: 480px) { .brand-text { display: none; } .fine-chip span { display: none; } .topbar { gap: 8px; } }
.red-text { color: var(--red); font-variant-numeric: tabular-nums; }
.fine-total { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 12px 14px; background: var(--red-bg); border-radius: 10px; color: var(--red); margin: 8px 0 10px; }
.fine-total b { font-size: 24px; font-variant-numeric: tabular-nums; }
.fine-rule { font-size: 13px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.fine-row { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); text-decoration: none; }
.fine-row .grow { flex: 1; min-width: 0; }
.fine-row b { font-weight: 500; }
.fine-amt { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fine-person { margin-top: 12px; }
.fine-ph { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.fine-ph .spacer { flex: 1; }
.fine-mini { color: #fff; background: var(--red); border-radius: 4px; padding: 0 6px; font-weight: 700; }
.stage.wseg { flex: 2 0 170px; padding-top: 26px; }
.stage.wseg::before { display: none; }
.stage.wseg .wbar { position: absolute; top: 7px; left: 0; right: 0; height: 8px; border-radius: 4px; background: var(--green-bg); overflow: hidden; }
.stage.wseg .wbar i { display: block; height: 100%; background: var(--green); }
.stage.wseg .nm { color: var(--green); font-weight: 700; }
.stage.wend .dot { border-color: var(--green); }
.rule-steps .n { width: 52px; }
@media (min-width: 900px) { .rule-steps { grid-template-columns: repeat(5, 1fr); } }

/* ---------- v4：參與人員複選 ---------- */
.pick-list { display: flex; flex-wrap: wrap; gap: 6px; }
.pick { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 6px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); font-size: 14px; cursor: pointer; }
.pick input { accent-color: var(--ink); margin: 0; }
.pick:has(input:checked) { border-color: var(--ink); background: var(--bg); font-weight: 500; }

/* ---------- v5：待辦權限、通知 ---------- */
:root { color-scheme: light; }
.todo input:disabled { opacity: .35; cursor: not-allowed; }
.todo:has(input:disabled) { cursor: default; }
.notif .ch.amber { background: var(--amber-bg); color: var(--amber); }

/* ---------- v6：多人待辦、付款金額制、成本表、內部回報、業主提問 ---------- */
.wrap.wide { max-width: 1280px; }
.tel { color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.toast.warn { background: var(--red); }

/* 多人待辦 */
.owners { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.owner { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px 1px 2px; border-radius: 999px; background: var(--bg); font-size: 12px; }
.owner.ok { background: var(--green-bg); color: var(--green); }
.owner svg { width: 12px; height: 12px; }
.cost-mini-tag { color: var(--blue); background: var(--blue-bg); border-radius: 4px; padding: 0 6px; font-weight: 500; }
.internal-todos { border-color: #C9B48E; background: #FFFCF4; }
.internal-todos .card-h svg { color: #7A5A1E; }
.add-in { margin-top: 12px; }
.add-in summary { cursor: pointer; display: inline-flex; gap: 6px; align-items: center; font-size: 14px; color: var(--ink-2); }

/* 進度拖曳 */
.srow { touch-action: none; }
.srow .drag { cursor: grab; color: var(--muted); display: inline-flex; padding: 4px 2px; touch-action: none; }
.srow.dragging { background: var(--amber-bg); box-shadow: var(--shadow); }
.icon-btn.sm { width: 30px; height: 30px; border: 1px solid var(--line); }
.icon-btn.sm[disabled] { opacity: .3; cursor: not-allowed; }
.stage-edit .srow { flex-wrap: wrap; }

/* 付款 */
.pay-head { display: flex; justify-content: space-between; gap: 8px; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 14px; flex-wrap: wrap; }
.pay-head.extra { border-top: 1px dashed var(--line-2); }
.pay-extras { display: grid; gap: 0; }
.pay-act { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pay-total { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding: 12px 14px; background: var(--surface-2); border-radius: 8px; font-size: 14px; font-variant-numeric: tabular-nums; }
.pay-total b { font-size: 17px; }
.pay-grid { display: grid; gap: 8px; margin-bottom: 8px; }
.pg-h { display: none; }
.pg-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); align-items: center; }
.pg-row input { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: var(--surface); min-width: 0; width: 100%; }
.pg-pct { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 13px; }
@media (min-width: 900px) {
  .pg-h { display: grid; grid-template-columns: 2fr 1.3fr .7fr 1.3fr 1.3fr .5fr; gap: 8px; font-size: 12px; color: var(--muted); padding: 0 10px; }
  .pg-row { grid-template-columns: 2fr 1.3fr .7fr 1.3fr 1.3fr .5fr; }
}
fieldset.apply { border: 1px solid var(--line); border-radius: 10px; padding: 4px 14px 8px; margin: 16px 0 0; }
fieldset.apply legend { padding: 0 6px; margin: 0; }

/* 首頁成本卡 */
.cost-card { border-color: var(--blue); }
.cost-card .card-h svg { color: var(--blue); }
.cost-mini { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.cost-mini > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cost-mini b { font-size: 17px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.usebar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin: 10px 0 4px; }
.usebar i { display: block; height: 100%; background: var(--green); transition: width .2s; }
.usebar.warn i { background: var(--amber); }
.usebar.over i { background: var(--red); }

/* 成本表（沿用工程預估成本控制表） */
:root { --input-bg: #FFFBEF; --input-line: #E8DCC0; }
.cost-status { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.cost-status .spacer { flex: 1; }
.cc-grid { display: grid; gap: 14px; margin-top: 14px; }
.cc-grid > * { min-width: 0; }
@media (min-width: 1000px) {
  .cc-grid { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
  .cc-side { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 70px); }
}
.cc-info { display: grid; gap: 10px 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 700px) { .cc-info { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .cc-info { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.cc-info label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.cc-info input { width: 100%; border: 1px solid var(--input-line); border-radius: 8px; padding: 8px 10px; background: var(--input-bg); font-size: 14px; }
.cc-ro { padding: 8px 0; font-size: 14px; overflow-wrap: anywhere; }
.qtable.items { min-width: 860px; width: 100%; border-collapse: collapse; font-size: 14px; }
.qtable.items th { font-size: 12px; color: var(--muted); font-weight: 500; text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.qtable.items th.num { text-align: right; }
.qtable.items td { padding: 4px 6px; vertical-align: middle; border-bottom: 1px solid var(--line); }
.qtable .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.qtable .cc-code { color: var(--muted); font-family: var(--latin); font-size: 15px; letter-spacing: .04em; width: 34px; }
.cell { width: 100%; border: 1px solid transparent; border-radius: 6px; padding: 6px 8px; background: var(--input-bg); font-size: 14px; }
.cell:hover { border-color: var(--input-line); }
.cell:focus { outline: none; border-color: var(--ink); background: var(--surface); }
.cell.n { text-align: right; font-variant-numeric: tabular-nums; }
.cell.name { background: transparent; padding-left: 4px; }
.cell.name:hover, .cell.name:focus { background: var(--input-bg); }
.cell:disabled { background: transparent; color: var(--ink); }
.qtable .diff.neg, .v.neg { color: var(--red); font-weight: 700; }
.qtable .tot td { background: var(--surface-2); padding: 10px 6px; font-weight: 700; }
.row-off td { color: var(--muted); }
.x { border: 0; background: none; color: var(--muted); padding: 2px 6px; cursor: pointer; }
.x:hover { color: var(--red); }
.sum-card { padding: 0; overflow: hidden; }
.cc-side .sum-card + .sum-card { margin-top: 14px; }
.sum-h { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--ink); color: #fff; }
.sum-h h3 { font-family: var(--sans); font-size: 14px; font-weight: 700; }
.sum-h .n { font-family: var(--latin); font-size: 17px; letter-spacing: .06em; opacity: .7; }
.sum-b { padding: 4px 14px 12px; }
.cc-line { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.cc-line:last-child { border-bottom: 0; }
.cc-line .k { flex: 1; min-width: 0; color: var(--ink-2); }
.cc-line .k small { color: var(--muted); font-size: 12px; margin-left: 4px; }
.cc-line .v { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.cc-line.key .k { color: var(--ink); font-weight: 700; }
.cc-line.key .v { font-size: 16px; font-weight: 700; }
.cc-line .rate { font-size: 12px; color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; }
.cc-line input { width: 128px; text-align: right; font-variant-numeric: tabular-nums; border: 1px solid var(--input-line); border-radius: 6px; padding: 5px 8px; background: var(--input-bg); font-size: 14px; }
.cc-line input.pct { width: 64px; }
.person { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.person input.nm { flex: 1; min-width: 0; border: 1px solid var(--input-line); border-radius: 6px; padding: 5px 8px; background: var(--input-bg); }
.person input.pct { width: 58px; text-align: right; border: 1px solid var(--input-line); border-radius: 6px; padding: 5px 6px; background: var(--input-bg); }
.person .v { width: 92px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.err-row { font-size: 12px; color: var(--red); margin-top: 6px; }
.note { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.6; }

/* 內部回報、業主提問 */
.ticon.internal { background: #F4EBD8; color: #7A5A1E; }
.ticon.question { background: var(--amber-bg); color: var(--amber); }
.kind.internal { color: #7A5A1E; background: #F4EBD8; border-color: transparent; }
.tl li.is-internal a { background: #FFFCF4; }
.article.is-internal { border: 1.5px dashed #C9B48E; background: #FFFCF4; }
.ask-card { border-color: var(--amber); }
.ask-card .card-h svg { color: var(--amber); }
.pg-f { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pg-l { font-size: 11px; color: var(--muted); }
@media (min-width: 900px) { .pg-l { display: none; } }
.fine-total.team { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }

/* ---------- 第二批：LINE 綁定與登入 ---------- */
.btn-line { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 8px; background: #06C755; color: #fff; font-weight: 700; padding: 11px 18px; font-size: 15px; cursor: pointer; }
.btn-line:hover { background: #05b34c; }
.btn-line:disabled { opacity: .6; cursor: wait; }
.btn-line.sm { padding: 6px 12px; font-size: 13px; }
.btn-line svg { stroke: #fff; }
.login .btn-line { width: 100%; margin-top: 4px; }
.line-or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 22px 0 12px; }
.line-or::before, .line-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.line-card { border-color: #b8e8c8; background: #f3fbf6; }

/* ---------- 進度編輯：電腦一行、手機三行 ---------- */
.stage-edit .srow {
  display: grid; flex-wrap: nowrap; gap: 8px; align-items: center;
  grid-template-columns: 20px 22px minmax(0, 1fr) 150px auto auto auto;
  grid-template-areas: "drag radio name date up down del";
}
.stage-edit .srow .drag { grid-area: drag; }
.stage-edit .srow input[type=radio] { grid-area: radio; margin: 0; width: 20px; height: 20px; accent-color: var(--ink); }
.stage-edit .srow input[type=text] { grid-area: name; width: 100%; min-width: 0; }
.stage-edit .srow input[type=date] { grid-area: date; width: 100%; min-width: 0; max-width: 100%; min-height: 38px; display: block; }
.stage-edit .srow .sdate-lb { display: none; }
.stage-edit .srow [data-a="stage-up"] { grid-area: up; }
.stage-edit .srow [data-a="stage-down"] { grid-area: down; }
.stage-edit .srow [data-a="stage-del"] { grid-area: del; justify-self: end; }
@media (max-width: 640px) {
  .stage-edit .srow {
    grid-template-columns: 20px 22px minmax(0, 1fr) 34px 34px auto;
    grid-template-areas:
      "drag radio name name name name"
      "lb   lb    date date date date"
      ".    .     .    up   down del";
    row-gap: 8px; padding: 10px;
  }
  .stage-edit .srow .sdate-lb { display: block; grid-area: lb; font-size: 12px; color: var(--muted); white-space: nowrap; }
  .stage-edit .srow input[type=text] { padding: 8px 10px; }
  /* iPhone 空白日期欄會撐大，改成一般輸入框外觀，寬度就會乖乖照排版 */
  .stage-edit .srow input[type=date] { -webkit-appearance: none; appearance: none; padding: 8px 10px; background: var(--surface); text-align: left; }
}
/* iPhone 點輸入框時不要自動放大畫面（字小於 16px 才會放大） */
@media (max-width: 640px) {
  input[type=text], input[type=email], input[type=date], input[type=number], input[type=tel], input[type=url], textarea, select { font-size: 16px !important; }
}

/* ---------- 全平台日期欄：手機上一律照格子寬度（iPhone 空白日期欄會撐大） ---------- */
@media (max-width: 640px) {
  input[type=date] {
    -webkit-appearance: none; appearance: none;
    display: block; width: 100%; max-width: 100%; min-width: 0; min-height: 40px;
    background-color: var(--surface); text-align: left;
  }
  input[type=date]::-webkit-date-and-time-value { text-align: left; }
}
/* 格狀排版的欄位不准被內容撐寬 */
.pg-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.pg-row > *, .row2 > *, .cc-info > * { min-width: 0; }
@media (min-width: 560px) { .row2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (min-width: 900px) { .pg-row { grid-template-columns: 2fr 1.3fr .7fr 1.3fr 1.3fr .5fr; } }
