:root {
  --bg: #ffffff;
  --side: #f7f7f8;
  --hover: #f1f1f3;
  --active: #ebebef;
  --line: #e8e8ec;
  --line-soft: #f0f0f3;
  --text: #1c1d21;
  --text-2: #3c3f47;
  --muted: #8a8f98;
  --accent: #5e6ad2;
  --accent-soft: #eef0fc;
  --danger: #e5484d;
  --warn: #f76b15;
  --review: #8e4ec6;
  --ok: #30a46c;
  --radius: 6px;
  font-family: "Segoe UI", "Microsoft JhengHei UI", "Microsoft JhengHei", "Noto Sans TC", system-ui, sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
b { font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; padding: 12px; }
.danger-text { color: var(--danger); }
.loading, .empty { padding: 40px; text-align: center; color: var(--muted); }
.inline { display: inline-flex; align-items: center; gap: 6px; }

/* ── 登入／改密碼 ── */
.auth-page { min-height: 100vh; display: grid; place-items: center; background: var(--side); }
.auth-card {
  width: min(360px, 92vw); background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 28px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, .06); display: grid; gap: 14px;
}
.auth-card h1 { margin: 0; font-size: 18px; font-weight: 600; }
.auth-card p { margin: 0; color: var(--muted); }
.auth-card label { display: grid; gap: 6px; font-weight: 500; color: var(--text-2); }
.auth-card input {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); font-weight: 400; outline: none;
}
.auth-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.alert { background: #fff1f1; color: var(--danger); border: 1px solid #ffd4d4; padding: 8px 10px; border-radius: var(--radius); }
.btn {
  display: inline-block; padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; cursor: pointer; color: var(--text); text-align: center; font-weight: 500;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #4f5bc4; }

/* ── 版面 ── */
.shell { display: grid; grid-template-columns: auto minmax(0, 1fr); height: 100vh; }
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.content { flex: 1; overflow-y: auto; padding: 0 0 40px; }

/* ── 側欄 ── */
.sidebar {
  width: 232px; background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column;
  height: 100vh; overflow-y: auto; padding: 10px 8px; gap: 2px;
}
.sidebar.collapsed { width: 52px; }
.sidebar.collapsed .nav-label, .sidebar.collapsed .nav-count, .sidebar.collapsed .side-section { display: none; }
.sidebar.collapsed .side-top { flex-direction: column; gap: 6px; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 10px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; white-space: nowrap; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 6px; background: var(--accent); color: #fff; display: grid; place-items: center;
  font-size: 12px; flex: none;
}
.icon-btn {
  border: 0; background: none; width: 26px; height: 26px; border-radius: var(--radius); display: grid; place-items: center;
  cursor: pointer; color: var(--muted); flex: none;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.side-section { font-size: 11px; color: var(--muted); padding: 14px 8px 4px; font-weight: 500; }
.side-nav { display: grid; gap: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 5px 8px; border-radius: var(--radius);
  cursor: pointer; text-align: left; color: var(--text-2); min-height: 28px; white-space: nowrap;
}
.nav-item:hover { background: var(--hover); }
.nav-item.active { background: var(--active); color: var(--text); font-weight: 500; }
.nav-item .ico { color: var(--muted); flex: none; }
.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-count { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.dept-badge {
  width: 16px; height: 16px; border-radius: 4px; background: #e4e4e9; color: #62656d; font-size: 10px;
  display: grid; place-items: center; flex: none;
}
.dot { display: inline-block; border-radius: 50%; flex: none; }
.nav-item .dot { margin: 0 4px; }
.side-bottom { margin-top: auto; padding-top: 10px; }
.account { position: relative; }
.account-btn {
  display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 6px; border-radius: var(--radius);
  cursor: pointer; text-align: left;
}
.account-btn:hover { background: var(--hover); }
.account-btn .nav-label { display: grid; line-height: 1.25; }
.account-btn small { color: var(--muted); font-size: 11px; }

.popover {
  position: absolute; z-index: 40; background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .1); padding: 6px;
}
.account-pop { bottom: calc(100% + 6px); left: 0; width: 240px; }
.pop-head { display: flex; gap: 10px; align-items: center; padding: 8px; }
.pop-row { display: flex; justify-content: space-between; padding: 4px 8px; }
.pop-sep { height: 1px; background: var(--line); margin: 6px 0; }
.pop-link {
  display: block; width: 100%; text-align: left; border: 0; background: none; padding: 6px 8px; border-radius: var(--radius);
  cursor: pointer; color: var(--text); text-decoration: none;
}
.pop-link:hover { background: var(--hover); text-decoration: none; }

/* ── 工具列 ── */
.toolbar {
  display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 20px; border-bottom: 1px solid var(--line);
  flex: none; background: #fff;
}
.toolbar h1 { margin: 0; font-size: 14px; font-weight: 600; white-space: nowrap; }
.tool-spacer { flex: 1; }
.seg { display: inline-flex; background: var(--hover); border-radius: var(--radius); padding: 2px; }
.seg button {
  display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; padding: 3px 10px; border-radius: 4px;
  cursor: pointer; color: var(--muted); font-size: 12px;
}
.seg button.on { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.search-box {
  display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 8px;
  height: 28px; color: var(--muted); width: 220px;
}
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-box input { border: 0; outline: none; flex: 1; min-width: 0; background: none; color: var(--text); }
.tool-btn {
  display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border: 1px solid var(--line);
  background: #fff; border-radius: var(--radius); cursor: pointer; color: var(--text-2);
}
.tool-btn:hover { background: var(--hover); }
.tool-btn.on { border-color: #c8ccf3; background: var(--accent-soft); color: var(--accent); }
.log-btn { margin-left: 8px; }

/* 紀錄：最近被修改的任務 */
.log-view { padding: 12px 20px 40px; }
.log-view.is-loading .log-list { opacity: .6; }
.log-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.log-search { width: 360px; max-width: 100%; height: 32px; }
.log-list { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.log-row { display: grid; grid-template-columns: 76px 16px 64px minmax(0, 1fr) auto; gap: 10px; align-items: start;
  padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.log-row:last-child { border-bottom: 0; }
.log-row:hover { background: var(--hover); }
.log-row.active { background: var(--accent-soft); }
.log-row > .ico, .log-row > svg, .log-row > .row-code, .log-time { margin-top: 2px; }
.log-time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.log-title { font-weight: 500; }
.log-latest { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); margin-top: 3px; flex-wrap: wrap; }
.log-latest .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; display: inline-block; vertical-align: bottom; }
.log-fields { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 5px; }
.log-count { font-size: 12px; color: var(--text-2); white-space: nowrap; margin-top: 2px; }
@media (max-width: 700px) {
  .log-view { padding: 10px; }
  .log-row { grid-template-columns: 16px minmax(0, 1fr) auto; }
  .log-row .log-time, .log-row > .row-code { display: none; }
}
.filter-menu { position: relative; }
.filter-pop { right: 0; top: calc(100% + 6px); width: 240px; display: grid; gap: 8px; padding: 12px; }
.filter-pop label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.filter-pop select { padding: 5px 6px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--text); }

/* ── 目標列、統計 ── */
.goal-strip { display: flex; gap: 20px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.vision { display: flex; gap: 8px; align-items: baseline; font-weight: 500; min-width: 220px; }
.vision .muted { font-size: 11px; font-weight: 400; }
.goal-cards { display: flex; gap: 10px; flex: 1; flex-wrap: wrap; }
.goal-card {
  flex: 1; min-width: 170px; max-width: 260px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px;
  display: grid; gap: 4px; cursor: help;
}
.goal-top { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--text-2); }
.goal-code { font-weight: 600; color: var(--muted); font-size: 11px; }
.goal-ok { margin-left: auto; font-size: 10px; color: var(--ok); background: #e9f7ef; padding: 0 6px; border-radius: 99px; }
.goal-val { display: flex; gap: 4px; align-items: baseline; font-variant-numeric: tabular-nums; }
.goal-val b { font-size: 15px; }
.goal-val .muted { font-size: 11px; }
.bar { height: 4px; background: var(--line-soft); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar i.ok { background: var(--ok); }

.stats-line {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 20px; color: var(--muted);
  border-bottom: 1px solid var(--line-soft); font-size: 12px;
}
.stats-line > i { font-style: normal; color: #c7c9d1; }
.stat b { color: var(--text); font-variant-numeric: tabular-nums; }
.stat.warn b { color: var(--warn); }
.stat.danger b { color: var(--danger); }
.stat.review b { color: var(--review); }

.person-strip {
  display: flex; align-items: center; gap: 10px; padding: 10px 20px; border-bottom: 1px solid var(--line-soft); background: #fbfbfc;
}
.ps-name { display: grid; line-height: 1.3; }
.ps-name .muted { font-size: 12px; }
.ps-stats { display: flex; gap: 14px; margin-left: auto; color: var(--muted); font-size: 12px; }
.ps-stats b { color: var(--text); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 20px; border-bottom: 1px solid var(--line-soft); }
.chip {
  display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line); background: #fff; border-radius: var(--radius);
  padding: 1px 8px; cursor: pointer; font-size: 12px; color: var(--text-2);
}
.chip span { color: var(--muted); }
.chip:hover { background: var(--hover); }
.chip-clear { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 12px; }
.chip-clear:hover { color: var(--text); }

/* ── 清單 ── */
.is-loading { opacity: .5; transition: opacity .15s; }
.group-head {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; height: 36px; padding: 0 16px 0 0;
  background: #f7f7f8; border-bottom: 1px solid var(--line-soft);
}
.group-head:hover { background: var(--hover); }
.group-toggle {
  flex: 1; display: flex; align-items: center; gap: 8px; height: 100%; padding: 0 20px; border: 0; background: none;
  cursor: pointer; text-align: left; font-weight: 500; color: var(--text-2);
}
.group-add {
  width: 24px; height: 24px; border: 0; background: none; border-radius: var(--radius); color: var(--muted); cursor: pointer;
  font-size: 15px; line-height: 1; opacity: 0; flex: none;
}
.group-head:hover .group-add, .column-head:hover .group-add, .group-add:focus-visible { opacity: 1; }
.group-add:hover { background: #e4e4e9; color: var(--text); }
.column-head .group-add { margin-left: auto; }
.dept-stat {
  --c: #8a8f98; font-size: 11px; font-weight: 400; padding: 1px 6px; border-radius: 9px;
  color: color-mix(in srgb, var(--c) 80%, #000); background: color-mix(in srgb, var(--c) 13%, #fff);
}
.dept-stat.danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, #fff); }
.dept-empty { padding: 8px 20px 8px 44px; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line-soft); }
.person-split { margin-left: 4px; }
.person-idle { padding: 12px 20px; line-height: 1.7; }
.dept-unassigned .group-head { background: color-mix(in srgb, var(--warn) 9%, #fff); }
.dept-unassigned .group-toggle { color: var(--warn); }
.chev { color: var(--muted); transition: transform .12s; }
.chev.open { transform: rotate(90deg); }
.row {
  display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 20px 0 24px; border-bottom: 1px solid var(--line-soft);
  cursor: pointer; outline: none;
}
.row:hover { background: #fafafb; }
.row:focus-visible, .row.active { background: var(--accent-soft); }
.row-code { color: var(--muted); font-size: 12px; width: 44px; flex: none; font-variant-numeric: tabular-nums; }
.row-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.row-tail { display: flex; align-items: center; gap: 10px; flex: none; }
.row-date { width: 40px; text-align: right; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.row-date.overdue { color: var(--danger); }
.row-date.recurring { color: #a8acb5; font-size: 11px; }
.row-edited { width: 74px; text-align: right; color: #a8acb5; font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 700px) { .row-edited { display: none; } }
.ico-status, .ico-prio { flex: none; display: block; }
.label {
  display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 99px; padding: 0 8px 0 6px;
  font-size: 11px; color: var(--text-2); height: 20px; white-space: nowrap;
}
.mini { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pill { font-size: 11px; padding: 0 6px; border-radius: 4px; background: var(--hover); color: var(--text-2); white-space: nowrap; }
.pill.warn { background: #fff1e7; color: var(--warn); }
.pill.assist-pill { background: #eef2ff; color: #4f46e5; }
.avatar {
  display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 600; flex: none; line-height: 1;
}
.avatar.unassigned { border: 1.5px dashed #c3c6cf; background: none; }

/* ── 看板 ── */
.board { display: flex; gap: 12px; padding: 14px 20px; overflow-x: auto; align-items: flex-start; }
.column { width: 280px; flex: none; background: #f7f7f8; border-radius: 8px; display: flex; flex-direction: column; max-height: calc(100vh - 200px); }
.column-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-weight: 500; }
.column-body { display: grid; gap: 6px; padding: 0 8px 8px; overflow-y: auto; }
.column-empty { color: var(--muted); font-size: 12px; text-align: center; padding: 16px 0; }
.bcard {
  background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 10px; display: grid; gap: 6px; cursor: pointer; outline: none;
}
.bcard:hover { border-color: #d5d7de; box-shadow: 0 1px 3px rgba(0, 0, 0, .05); }
.bcard.active, .bcard:focus-visible { border-color: var(--accent); }
.bcard-top { display: flex; justify-content: space-between; align-items: center; }
.bcard-title { line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bcard-foot { display: flex; align-items: center; gap: 6px; }
.bcard-foot .row-date { margin-left: auto; }

/* ── 目標與策略頁 ── */
.goals-page { max-width: 1040px; padding: 24px 32px; display: grid; gap: 28px; }
.gp-label { font-size: 11px; color: var(--muted); font-weight: 600; margin-bottom: 8px; letter-spacing: .04em; }
.gp-vision { font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.gp-goals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.gp-goal { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: grid; gap: 4px; }
.gp-strategies { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.gp-strategy {
  text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 12px 14px; display: grid; gap: 6px;
  align-content: start;
}
.gp-s-head { display: flex; align-items: center; gap: 8px; }
.gp-s-head .muted { margin-left: auto; white-space: nowrap; }
.gp-s-foot { display: flex; gap: 14px; align-items: center; font-size: 12px; color: var(--text-2); }
.gp-s-foot .link-btn { margin-left: auto; }
.gp-hint { background: var(--accent-soft); color: #3f4ab0; border-radius: 6px; padding: 8px 12px; font-size: 12px; }
.gp-field { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 6px; align-items: start; }
.gp-field-label { font-size: 12px; color: var(--muted); padding-top: 2px; }
.link-btn { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 2px 4px; border-radius: 4px; font-size: 12px; }
.link-btn:hover { background: var(--accent-soft); }
.b { font-weight: 600; }
.goal-card[role="button"] { cursor: pointer; }
.goal-card[role="button"]:hover { border-color: #d5d7de; }

/* ── 詳細面板 ── */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .12); z-index: 30; }
.drawer {
  position: fixed; top: 8px; right: 8px; bottom: 8px; width: min(900px, calc(100vw - 16px)); background: #fff; z-index: 31;
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 16px 48px rgba(0, 0, 0, .14);
  display: flex; flex-direction: column; animation: slide .16s ease-out; overflow: hidden;
}
@keyframes slide { from { transform: translateX(24px); opacity: .5; } to { transform: none; opacity: 1; } }
.drawer-bar { display: flex; justify-content: space-between; align-items: center; height: 44px; padding: 0 12px 0 20px; border-bottom: 1px solid var(--line); flex: none; }
.drawer-bar .muted { display: inline-flex; align-items: center; gap: 6px; }
.drawer-scroll { flex: 1; overflow-y: auto; }
.drawer-grid { display: grid; grid-template-columns: minmax(0, 1fr) 260px; min-height: 100%; }
.d-main { padding: 20px 28px 40px; display: grid; gap: 20px; align-content: start; }
.d-crumb { display: flex; gap: 6px; color: var(--muted); font-size: 12px; }
.d-title { margin: -10px 0 0; font-size: 20px; font-weight: 600; line-height: 1.35; }
.d-desc { white-space: pre-wrap; color: var(--text-2); }
.d-section { display: grid; gap: 6px; }
.d-section-title { font-size: 12px; font-weight: 600; color: var(--muted); }
.callout { background: #f7f7f8; border-radius: 6px; padding: 10px 12px; }
.sublist { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.subrow { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 12px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.subrow:last-child { border-bottom: 0; }
.subrow:hover { background: #fafafb; }

.props { border-left: 1px solid var(--line); background: #fbfbfc; padding: 16px 16px 40px; display: grid; gap: 10px; align-content: start; }
.prop { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 8px; align-items: start; }
.prop-label { color: var(--muted); font-size: 12px; padding-top: 1px; }
.prop-value { display: grid; gap: 4px; min-width: 0; }
.prop-progress { display: flex; align-items: center; gap: 8px; }
.prop-progress .bar { flex: 1; }
.props-sep { height: 1px; background: var(--line); margin: 4px 0; }
.person { display: flex; align-items: center; gap: 6px; min-width: 0; }
.person span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.timeline { display: grid; gap: 4px; }
.tl-axis { position: relative; height: 16px; margin-left: 110px; }
.tl-axis span { position: absolute; font-size: 11px; color: var(--muted); }
.tl-row { display: grid; grid-template-columns: 110px 1fr; align-items: center; }
.tl-label { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 8px; color: var(--text-2); }
.tl-track { position: relative; height: 18px; border-left: 1px solid var(--line-soft); }
.tl-bar { --c: #888; position: absolute; top: 4px; height: 10px; background: #e6e7ec; border-radius: 3px; overflow: hidden; }
.tl-bar i { display: block; height: 100%; background: var(--c); }
.tl-bar.overdue { box-shadow: 0 0 0 1.5px var(--danger); }
.tl-today { position: absolute; top: -2px; bottom: -2px; width: 1.5px; background: var(--danger); z-index: 1; }

.activity { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.act { display: flex; gap: 10px; align-items: flex-start; font-size: 12px; color: var(--text-2); }
.act-dot { width: 20px; height: 20px; flex: none; display: grid; place-items: center; }
.act-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #c7c9d1; }
.comment-body { background: #f7f7f8; border-radius: 6px; padding: 8px 10px; margin-top: 4px; color: var(--text); font-size: 13px; }
.comment-box { border: 1px dashed var(--line); border-radius: 6px; padding: 10px 12px; font-size: 12px; }
.comment-body { white-space: pre-wrap; word-break: break-word; line-height: 1.6; }
.comment-main { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.comment-actions { margin-left: auto; display: inline-flex; gap: 2px; opacity: 0; }
.act.comment:hover .comment-actions, .comment-actions:focus-within { opacity: 1; }
.link-btn.danger { color: var(--danger); }
.link-btn.danger:hover { background: #fff0f0; }
.meeting-tag { font-size: 11px; font-weight: 600; color: #8a5a00; background: #fff4d6; border-radius: 4px; padding: 1px 6px; }
.act.meeting .comment-body { background: #fffaeb; border-left: 3px solid #f0b429; }
.act-title { display: flex; align-items: center; gap: 12px; }
.act-filter { display: inline-flex; gap: 2px; margin-left: auto; }
.act-filter button, .cf-kind button {
  border: 1px solid transparent; background: none; border-radius: 4px; padding: 2px 8px; font-size: 12px; color: var(--muted); cursor: pointer;
}
.act-filter button.on, .cf-kind button.on { background: var(--accent-soft); color: var(--accent); border-color: #d9dcf6; font-weight: 500; }
.comment-form { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; margin: 8px 0 14px; background: #fff; }
.comment-form:focus-within { border-color: #c5c9ef; }
.cf-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.cf-kind { display: inline-flex; gap: 2px; }
.cf-date { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.cf-date input { border: 1px solid var(--line); border-radius: 4px; padding: 2px 6px; font: inherit; color: var(--text); }
.comment-form textarea {
  width: 100%; border: 0; outline: none; resize: none; font: inherit; font-size: 13px; line-height: 1.6; min-height: 60px; background: none;
}
.cf-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.cf-foot .muted { margin-right: auto; }
.act .comment-form { margin: 6px 0 0; }

/* ── 編輯元件 ── */
.editable { border-radius: 4px; margin: -2px -4px; padding: 2px 4px; cursor: text; white-space: pre-wrap; min-height: 1.5em; }
.editable:hover { background: var(--hover); }
.editable:focus-visible { outline: 2px solid var(--accent-soft); }
.editable.placeholder { color: #a8acb5; }
.edit-input {
  margin: -3px -5px; padding: 2px 4px; border: 1px solid var(--accent); border-radius: 4px; outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft); background: #fff; font: inherit; color: var(--text); resize: none;
  width: calc(100% + 10px); display: block;
}
textarea.edit-input { line-height: 1.5; overflow: hidden; }
.edit-wrap { display: grid; gap: 2px; }
.edit-hint { font-size: 11px; color: var(--muted); text-align: right; }
.d-title.edit-input { font-size: 20px; font-weight: 600; line-height: 1.35; }
.callout.editable { margin: 0; padding: 10px 12px; }
.callout.editable:hover { background: #efeff2; }
.callout.edit-input { margin: 0; width: 100%; padding: 9px 11px; background: #fff; }
.gp-vision.edit-input { font-size: 20px; font-weight: 600; }
.vision .editable, .vision .edit-input { font-weight: 500; }

.menu-anchor { position: relative; display: inline-block; max-width: 100%; }
.prop-btn, .prop-static {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: 26px; padding: 2px 6px; margin: -3px -6px;
  border: 1px solid transparent; border-radius: var(--radius); background: none; text-align: left; color: var(--text);
}
.prop-btn { cursor: pointer; }
.prop-btn:hover, .prop-btn.open { background: var(--hover); border-color: var(--line); }
.prop-btn > span, .prop-static > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu { top: calc(100% + 4px); left: -6px; min-width: 220px; max-width: 300px; padding: 4px; }
.menu.right { left: auto; right: 0; }
.menu-search {
  width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 6px 8px 8px; outline: none; margin-bottom: 4px; background: none;
}
.menu-list { max-height: 300px; overflow-y: auto; display: grid; }
.menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 6px 8px; border-radius: 4px;
  cursor: pointer; text-align: left; color: var(--text); min-height: 30px;
}
.menu-item:hover { background: var(--hover); }
.menu-item.on { font-weight: 500; }
.menu-item.danger { color: var(--danger); }
.menu-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-hint { margin-left: auto; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.menu-check { color: var(--accent); margin-left: 4px; }
.menu-hint + .menu-check { margin-left: 4px; }
.menu-label + .menu-check { margin-left: auto; }
.menu-empty { padding: 8px; color: var(--muted); font-size: 12px; }
.menu-create { color: var(--accent); border-bottom: 1px solid var(--line); border-radius: 4px 4px 0 0; margin-bottom: 4px; }
.menu-plus { width: 18px; text-align: center; font-weight: 600; flex: none; }

.x-btn {
  border: 0; background: none; color: var(--muted); cursor: pointer; width: 20px; height: 20px; border-radius: 4px; flex: none;
  font-size: 11px; opacity: .6; margin-left: auto;
}
.x-btn:hover { background: #e4e4e9; color: var(--danger); opacity: 1; }
.person .x-btn { margin-left: 0; }
.add-btn { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px 0; font-size: 12px; text-align: left; }
.add-btn:hover { color: var(--accent); }
.add-row {
  display: flex; align-items: center; width: 100%; height: 34px; padding: 0 12px; border: 0; background: none; color: var(--muted);
  cursor: pointer; text-align: left; font-size: 12px;
}
.add-row:hover { background: #fafafb; color: var(--accent); }
.add-row.editing { cursor: default; background: #fff; }
.add-row.editing input { flex: 1; border: 0; outline: none; background: none; font-size: 13px; color: var(--text); }
.relation-add { display: flex; align-items: center; border-top: 1px solid var(--line-soft); }
.relation-add select { margin-left: 10px; border: 1px solid var(--line); border-radius: 4px; padding: 2px 4px; background: #fff; font-size: 12px; }
.relation-add .add-row { flex: 1; }
.sublist > .add-row { border-top: 1px solid var(--line-soft); }
.sublist > .add-row:first-child { border-top: 0; }
.readonly-tag { margin-left: auto; font-size: 11px; background: var(--hover); color: var(--muted); padding: 0 8px; border-radius: 99px; }
.inline-field { display: grid; gap: 2px; }
.date-input {
  border: 1px solid transparent; border-radius: var(--radius); padding: 1px 4px; margin: -2px -5px; background: none; color: inherit;
  font: inherit; cursor: pointer; min-height: 26px;
}
.date-input:hover { background: var(--hover); border-color: var(--line); }
.date-input:focus { outline: none; border-color: var(--accent); background: #fff; }
.num-field { display: inline-flex; align-items: center; font-variant-numeric: tabular-nums; }
.num-field input {
  width: 46px; border: 1px solid transparent; border-radius: 4px; padding: 1px 2px; background: none; text-align: right; font: inherit;
}
.num-field input:hover { border-color: var(--line); }
.num-field input:focus { outline: none; border-color: var(--accent); background: #fff; }
.drawer-actions { display: inline-flex; align-items: center; gap: 2px; }
.drawer-left { display: inline-flex; align-items: center; gap: 12px; min-width: 0; }
@media (max-width: 700px) { .drawer-left > .muted:first-child { display: none; } }

.btn.sm { padding: 0 12px; height: 28px; font-size: 12px; display: inline-flex; align-items: center; }
.btn:disabled { opacity: .5; cursor: default; }

/* ── 新增任務視窗 ── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .18); z-index: 50; display: grid; justify-items: center; align-items: start; padding-top: 12vh; }
.modal {
  width: min(680px, 94vw); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, .18);
  display: grid; gap: 4px; padding: 10px 16px 14px;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-title { border: 0; outline: none; font-size: 18px; font-weight: 600; padding: 6px 0; color: var(--text); }
.modal-desc { border: 0; outline: none; resize: vertical; font: inherit; color: var(--text-2); padding: 2px 0 8px; min-height: 60px; }
.modal-title::placeholder, .modal-desc::placeholder { color: #b0b4bc; }
.modal-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.modal-chips .prop-btn { margin: 0; border-color: var(--line); height: 28px; font-size: 12px; }
.modal-chips .menu { left: 0; }
.chip-date { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 6px; height: 28px; font-size: 12px; }
.chip-date .date-input { margin: 0; min-height: 0; padding: 0; border: 0; }
.modal-foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line-soft); padding-top: 10px; }

/* ── 提示訊息 ── */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 12px;
  background: #1c1d21; color: #fff; padding: 8px 10px 8px 16px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
  animation: toast-in .15s ease-out; max-width: 90vw;
}
.toast.error { background: #c62a2f; }
.toast button { border: 0; background: rgba(255, 255, 255, .14); color: #fff; padding: 3px 10px; border-radius: 4px; cursor: pointer; font-weight: 500; }
.toast button:hover { background: rgba(255, 255, 255, .24); }
.toast .toast-x { background: none; padding: 3px 6px; opacity: .7; }
@keyframes toast-in { from { transform: translate(-50%, 8px); opacity: 0; } to { transform: translateX(-50%); opacity: 1; } }

/* ── 清單：進度、狀態原因 ── */
.row-reason { margin-left: 10px; color: var(--muted); font-size: 12px; }
.row-reason::before { content: '— '; }
.row-progress { display: inline-flex; align-items: center; gap: 6px; width: 78px; }
.row-progress .bar { flex: 1; }
.row-pct { width: 30px; text-align: right; font-size: 11px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.row-progress.zero .row-pct { color: #b4bac6; }
.status-reason { margin-top: 4px; color: var(--text-2); }
.status-reason .editable.placeholder { color: #b0b4bc; }
.status-reason textarea { width: 100%; }
.faint { color: #b4bac6; }

/* ── 標籤、找任務 ── */
.tag-input { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-height: 24px; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 2px; height: 20px; padding: 0 6px; border-radius: 4px; background: #eef0fc;
  color: #4a54b8; font-size: 12px; white-space: nowrap; border: 0;
}
.tag-link { border: 0; background: none; padding: 0; color: inherit; font: inherit; cursor: pointer; }
.tag-link:hover { text-decoration: underline; }
button.tag-chip.tag-link { padding: 0 6px; }
.tag-x { border: 0; background: none; padding: 0 0 0 2px; color: #8f96c9; cursor: pointer; font-size: 10px; line-height: 1; }
.tag-x:hover { color: var(--danger); }
.tag-field { flex: 1; min-width: 80px; border: 0; outline: none; background: none; font: inherit; font-size: 12px; padding: 2px 0; color: var(--text); }
.tag-field::placeholder { color: #b0b4bc; }
.tag-pop { left: 0; top: calc(100% + 4px); }
.menu-item.hi { background: var(--hover); }
.row-tags { display: inline-flex; align-items: center; gap: 4px; }
.row-tags .tag-chip { font-size: 11px; height: 18px; }

.sublist.visible { overflow: visible; }
.picker { flex: 1; position: relative; }
.picker-input { width: 100%; height: 34px; padding: 0 12px; border: 0; outline: none; background: none; font: inherit; font-size: 13px; color: var(--text); }
.picker-input::placeholder { color: #a8acb5; font-size: 12px; }
.picker-pop { left: 0; right: 0; top: calc(100% + 2px); max-width: none; width: auto; min-width: 360px; }
.picker-pop .menu-list { max-height: 320px; overflow-y: auto; }
.picker-pop .menu-item { gap: 8px; }
.picker-pop .menu-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── 組織頁 ── */
.content.org { overflow: auto; }
.org-page { padding: 12px 20px 40px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-content: start; }
.org-page.with-panel { padding-right: 480px; }
.org-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.org-legend { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); padding-bottom: 4px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-item.check { cursor: pointer; color: var(--muted); }
.org-chart { overflow: auto; padding: 8px 0 24px; }

.org-tree, .org-tree ul { display: flex; justify-content: center; margin: 0; padding: 0; }
.org-tree { width: max-content; min-width: 100%; }
.org-tree ul { position: relative; padding-top: 18px; }
.org-tree li { list-style: none; position: relative; display: flex; flex-direction: column; align-items: center; padding: 18px 8px 0; }
.org-tree > li { padding-top: 0; }
.org-tree li::before, .org-tree li::after {
  content: ''; position: absolute; top: 0; right: 50%; width: 50%; height: 18px; border-top: 1px solid #cfd3da;
}
.org-tree li::after { right: auto; left: 50%; border-left: 1px solid #cfd3da; }
.org-tree > li::before, .org-tree > li::after { display: none; }
.org-tree li:only-child::before { display: none; }
.org-tree li:only-child::after { border-top: 0; }
.org-tree li:first-child::before, .org-tree li:last-child::after { border: 0 none; }
.org-tree li:last-child::before { border-right: 1px solid #cfd3da; border-radius: 0 6px 0 0; }
.org-tree li:first-child::after { border-radius: 6px 0 0 0; }
.org-tree li:only-child::after { border-radius: 0; }
.org-tree ul::before { content: ''; position: absolute; top: 0; left: 50%; height: 18px; border-left: 1px solid #cfd3da; }
.org-group {
  position: relative; z-index: 1; display: grid; gap: 6px; padding: 8px;
  border: 1px dashed #cfd3da; border-radius: 10px; background: #fafbfc;
}
.org-node-wrap { position: relative; display: flex; flex-direction: column; align-items: center; }
.org-fold {
  position: absolute; z-index: 2; bottom: -9px; left: 50%; transform: translateX(-50%); min-width: 18px; height: 18px;
  padding: 0 5px; border: 1px solid #cfd3da; border-radius: 9px; background: #fff; color: var(--muted);
  font-size: 11px; line-height: 16px; cursor: pointer;
}
.org-fold:hover { border-color: var(--accent); color: var(--accent); }
.org-fold.closed { color: var(--accent); font-weight: 600; }
.org-group-label { position: absolute; top: 5px; left: 12px; font-size: 11px; color: var(--muted); }
.org-chart-wrap { min-width: 0; }
.org-chart { cursor: grab; }
.org-chart.panning { cursor: grabbing; user-select: none; }
.org-chart .org-node { cursor: pointer; }
.legend-title { font-weight: 600; color: var(--text); }
.org-legend.flows { padding-top: 0; }
.org-zoom { display: inline-flex; align-items: center; gap: 1px; border: 1px solid var(--line); border-radius: 6px; padding: 1px; background: #fff; }
.org-zoom button { border: 0; background: none; height: 22px; min-width: 24px; padding: 0 6px; border-radius: 4px; cursor: pointer; color: var(--text-2); font: inherit; font-size: 12px; }
.org-zoom button:hover:not(:disabled) { background: var(--hover); }
.org-zoom button:disabled { opacity: .35; cursor: default; }
.org-zoom .z-val { min-width: 44px; font-variant-numeric: tabular-nums; }
.org-zoom .z-fit { border-left: 1px solid var(--line); border-radius: 0 4px 4px 0; }

/* ── 八大流 ── */
.flow-chips { display: inline-flex; flex-wrap: wrap; gap: 3px; }
.flow-chip {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 4px; font-size: 12px; font-weight: 500;
  color: var(--fc); background: color-mix(in srgb, var(--fc) 12%, #fff); white-space: nowrap; border: 0;
}
.flow-chip.xs { height: 16px; padding: 0 4px; font-size: 10.5px; border-radius: 3px; }
.flow-chip.toggle { cursor: pointer; color: var(--muted); background: #fff; border: 1px dashed #d4d7de; height: 22px; }
.flow-chip.toggle.on { color: #fff; background: var(--fc); border: 1px solid var(--fc); }
.flow-chip.toggle:not(.on):hover { color: var(--fc); border-color: var(--fc); }
.flows-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.fm-wrap { display: grid; gap: 6px; overflow-x: auto; }
.flow-matrix { border-collapse: separate; border-spacing: 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; width: max-content; }
.flow-matrix th, .flow-matrix td { padding: 6px 10px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; vertical-align: middle; }
.flow-matrix thead th { font-size: 12px; font-weight: 500; color: var(--muted); background: #fbfbfc; text-align: left; }
.flow-matrix tbody tr:hover td { background: #fafafb; }
.flow-matrix tfoot td { border-bottom: 0; background: #fbfbfc; }
.flow-matrix th.fm-flow { text-align: center; color: var(--fc); font-weight: 700; font-size: 13px; border-top: 3px solid var(--fc); min-width: 76px; }
.flow-matrix td.fm-people { white-space: normal; min-width: 180px; max-width: 280px; line-height: 1.9; }
.fm-dept-in { display: inline-flex; align-items: center; gap: 6px; }
.fm-dept-in .fm-del { visibility: hidden; margin-left: 2px; }
.flow-matrix tr:hover .fm-del { visibility: visible; }
.fm-person { display: inline-flex; align-items: center; gap: 1px; margin-right: 8px; color: var(--text-2); white-space: nowrap; }
.fm-person .x-btn { width: 16px; height: 16px; margin-left: 0; font-size: 10px; opacity: 0; }
.fm-person:hover .x-btn { opacity: .7; }
.fm-add { display: inline-block; }
.popover.fm-add-pop { position: fixed; top: auto; width: 300px; max-width: 300px; display: grid; gap: 6px; z-index: 60; }
.fm-add-pop .menu-list { max-height: 220px; }
.fm-new-person { display: flex; gap: 6px; }
.fm-new-person input { flex: 1; min-width: 0; }
.fm-add-pop .fm-search { border: 1px solid var(--line); border-radius: 6px; height: 28px; padding: 0 8px; margin: 0 4px 2px; width: calc(100% - 8px); }
.fm-add-step { display: grid; gap: 4px; font-size: 12px; color: var(--muted); padding: 0 4px; }
.fm-add-step select, .fm-add-step input { height: 28px; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; font: inherit; font-size: 13px; color: var(--text); background: #fff; }
.flow-matrix tr.fm-add-row td { padding: 2px 6px; }
.flow-matrix tr.fm-add-row:hover td { background: none; }
.fm-cell { text-align: center; }
.fm-dot {
  width: 24px; height: 24px; border-radius: 50%; border: 1px dashed #d4d7de; background: #fff; cursor: pointer;
  color: #fff; font-size: 0; display: inline-block; vertical-align: middle;
}
.fm-dot:hover:not(:disabled) { border-color: var(--fc); background: color-mix(in srgb, var(--fc) 15%, #fff); }
.fm-dot.on { background: var(--fc); border: 1px solid var(--fc); }
.fm-dot:disabled { cursor: default; }
.fm-dot:disabled:not(.on) { border-color: transparent; }
.fm-n { text-align: center !important; font-variant-numeric: tabular-nums; }
.fm-n.multi { font-weight: 700; color: var(--accent); }
.fm-empty { color: var(--danger); font-weight: 600; }
.fm-hint { padding-left: 2px; }
.flow-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; max-width: 1500px; }
.flow-card {
  background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--fc); border-radius: 8px; padding: 12px 14px;
  display: grid; gap: 8px; align-content: start;
}
.flow-card.empty { background: #fffafa; border-style: dashed; border-top-style: solid; }
.fc-head { display: flex; align-items: center; gap: 8px; }
.fc-name { font-size: 16px; font-weight: 700; color: var(--fc); }
.fc-dept { border-top: 1px solid var(--line-soft); padding-top: 8px; display: grid; gap: 2px; }
.fc-dept-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.fc-also { display: inline-flex; align-items: center; gap: 4px; font-weight: 400; font-size: 11px; color: var(--muted); margin-left: auto; }
.fc-pos {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 3px 6px; border: 0; background: none; border-radius: 4px;
  cursor: pointer; text-align: left; font: inherit; font-size: 12.5px; color: var(--text);
}
.fc-pos:hover { background: var(--hover); }
.fc-pos-name { flex: 0 0 auto; min-width: 84px; }
.fc-pos-people { display: flex; flex-wrap: wrap; gap: 2px 10px; justify-content: flex-end; margin-left: auto; font-size: 12px; }
.org-node .flow-chips { margin-top: 1px; }
.org-table td.flow-td { white-space: normal; min-width: 110px; }

.org-node {
  position: relative; z-index: 1; width: 168px; background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--dc);
  border-radius: 8px; padding: 7px 10px 6px; cursor: pointer; display: grid; gap: 4px; text-align: left;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04); outline: none;
}
.org-node:hover { border-color: #d4d7de; border-top-color: var(--dc); box-shadow: 0 3px 10px rgba(0, 0, 0, .07); }
.org-node.active { border-color: var(--accent); border-top-color: var(--dc); box-shadow: 0 0 0 3px var(--accent-soft); }
.org-node:focus-visible { box-shadow: 0 0 0 3px var(--accent-soft); }
.org-node.inactive { opacity: .55; border-style: dashed; }
.on-head { display: flex; align-items: baseline; gap: 6px; }
.on-name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.on-code { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.on-people { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; min-height: 18px; }
.on-person { display: inline-flex; align-items: center; gap: 4px; }
.on-people > .muted { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.on-person small { color: var(--muted); }
.on-foot { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }

.org-panel {
  position: fixed; top: 8px; right: 8px; bottom: 8px; width: 460px; max-width: calc(100vw - 16px); background: #fff; z-index: 20;
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 16px 48px rgba(0, 0, 0, .12);
  display: flex; flex-direction: column; overflow: hidden; animation: slide .16s ease-out;
}
.op-body { padding: 16px 22px 40px; display: grid; gap: 18px; align-content: start; }
.op-body .d-title { margin: 0; }
.op-person-head { display: flex; align-items: center; gap: 10px; }
.props.flat { border: 0; background: #fbfbfc; border-radius: 8px; padding: 12px 14px; }
.duty-text { line-height: 1.7; }
.weight-field { margin-left: auto; font-size: 12px; color: var(--muted); }
.weight-field input { width: 44px; }
.op-actions { display: flex; gap: 8px; padding-top: 4px; border-top: 1px solid var(--line-soft); padding-top: 14px; }
.btn.danger-outline { color: var(--danger); border-color: #f3c5c7; }
.btn.danger-outline:hover { background: #fff5f5; }
.subrow.static { cursor: default; }
.subrow.static:hover { background: none; }
.link-plain { border: 0; background: none; padding: 0; cursor: pointer; color: var(--text); font: inherit; }
.link-plain:hover { color: var(--accent); text-decoration: underline; }
.tool-spacer { flex: 1; }

.org-table-wrap { display: grid; gap: 0; max-width: 1100px; }
.org-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.org-table th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--line); background: #fbfbfc; }
.org-table td { padding: 8px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.org-table tr:last-child td { border-bottom: 0; }
.org-table tbody tr { cursor: pointer; }
.org-table tbody tr:hover { background: #fafafb; }
.org-table tbody tr.active { background: var(--accent-soft); }
.org-table tbody tr.inactive { color: var(--muted); }
.pos-chip {
  display: inline-block; margin: 1px 4px 1px 0; padding: 0 8px; border-radius: 99px; background: var(--hover); font-size: 12px;
  color: var(--text-2); white-space: nowrap; border: 0;
}
.pos-chip.link { cursor: pointer; }
.pos-chip.link:hover { background: var(--accent-soft); color: var(--accent); }
.pos-chip.inactive { text-decoration: line-through; opacity: .6; }
.add-under { margin-top: 8px; }

.dept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; max-width: 1200px; }
.dept-card {
  background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--dc, var(--line)); border-radius: 8px; padding: 12px 14px;
  display: grid; gap: 10px; align-content: start;
}
.dept-card.add { border-top-width: 1px; border-style: dashed; padding: 0; overflow: hidden; }
.dept-card.add .add-row { height: 44px; }
.dept-head { display: flex; align-items: center; gap: 8px; }
.dept-positions { display: flex; flex-wrap: wrap; gap: 4px; }

/* 規則必做 */
.ok-text { color: var(--ok); }
.rules-page { padding: 12px 20px 40px; display: grid; gap: 12px; align-content: start; }
.week-nav { display: inline-flex; align-items: center; gap: 4px; }
.week-nav b { min-width: 96px; text-align: center; font-variant-numeric: tabular-nums; }
.week-nav .icon-btn:disabled { opacity: .3; cursor: default; }
.score-head, .status-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.score-body { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; max-width: 1200px; }
.score-side { display: grid; gap: 2px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 4px; max-height: calc(100vh - 220px); overflow: auto; }
.side-search { margin: 4px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius); outline: none; }
.side-search:focus { border-color: var(--accent); }
.side-item { display: flex; align-items: center; gap: 8px; border: 0; background: none; text-align: left; padding: 7px 8px; border-radius: var(--radius); cursor: pointer; color: var(--text); }
.side-item:hover { background: var(--hover); }
.side-item.active { background: var(--accent-soft); }
.side-text { display: grid; min-width: 0; flex: 1; }
.side-text > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-title { font-weight: 500; }
.side-count { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.side-count.done { color: var(--ok); }
.side-fail { font-size: 11px; color: var(--danger); font-weight: 600; }
.pad { padding: 8px; }
.score-main { display: grid; gap: 8px; min-width: 0; }
.score-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 15px; }
.score-title .muted { font-size: 12px; }
.score-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.score-table th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 6px 10px; border-bottom: 1px solid var(--line); background: #fbfbfc; }
.score-table td { padding: 6px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.score-table tr:last-child td { border-bottom: 0; }
.score-table tr.rated.fail { background: #fff8f8; }
.score-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.score-name .muted { flex-basis: 100%; padding-left: 28px; margin-top: -2px; }
.mark-th, .mark-td { width: 76px; text-align: center !important; }
.by-th, .by-td { width: 80px; }
.note-td { min-width: 160px; }
.mark {
  width: 36px; height: 30px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; cursor: pointer;
  font-size: 16px; line-height: 1; color: #c3c7cf;
}
.mark.pass:hover:not(:disabled) { border-color: var(--ok); color: var(--ok); }
.mark.fail:hover:not(:disabled) { border-color: var(--danger); color: var(--danger); }
.mark.pass.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.mark.fail.on { background: var(--danger); border-color: var(--danger); color: #fff; }
.mark:disabled { cursor: default; opacity: .55; }
.mark-all { border: 1px solid var(--line); background: #fff; border-radius: 4px; padding: 2px 8px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.mark-all.pass { color: var(--ok); }
.mark-all.fail { color: var(--danger); }
.mark-all:hover:not(:disabled) { background: var(--hover); }
.mark-all:disabled { opacity: .4; cursor: default; }
.waiting { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; }
.org-table-wrap.wide { max-width: none; overflow-x: auto; }
.status-table td, .status-table th { white-space: nowrap; }
.status-table tbody tr { cursor: default; }
.status-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.wk-th { text-align: center !important; font-size: 11px !important; padding: 8px 2px !important; }
.wk-td { text-align: center; padding: 6px 2px !important; }
.wk {
  display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 4px;
  font-size: 10px; font-weight: 600; color: #fff; font-style: normal; vertical-align: middle;
}
.wk.ok { background: var(--ok); }
.wk.bad { background: var(--danger); }
.wk.part { background: #b7e4cb; }
.wk.none { background: #eceef2; }
.legend-row { display: flex; gap: 16px; flex-wrap: wrap; }
.legend-row span { display: inline-flex; align-items: center; gap: 4px; }
.rule-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 12px; max-width: 1200px; }
.rule-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: grid; gap: 10px; align-content: start; }
.rule-card.inactive { opacity: .6; }
.rule-card.add { border-style: dashed; padding: 0; overflow: hidden; }
.rule-card.add .add-row { height: 44px; }
.rule-head { display: flex; align-items: center; gap: 8px; }
.rule-field { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 6px; align-items: start; }
.rule-targets { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.target-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; background: var(--hover); font-size: 12px; }
.target-chip.position { background: var(--accent-soft); }

/* ── 預算 ── */
.stat.budget b { color: #0f7b52; }
.row-budget { font-size: 11px; color: #0f7b52; background: #e9f7ef; padding: 0 6px; border-radius: 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.money-field { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.money-field input {
  width: 130px; border: 1px solid var(--accent); border-radius: 4px; padding: 2px 6px; outline: none; font: inherit; font-size: 13px;
  color: var(--text); box-shadow: 0 0 0 3px var(--accent-soft); font-variant-numeric: tabular-nums;
}
.gp-label { display: flex; align-items: baseline; gap: 12px; }
.gp-budget-total { margin-left: auto; font-weight: 400; letter-spacing: 0; font-size: 12px; color: var(--text-2); }
.gp-budget-total b { color: #0f7b52; }

/* ── 人員：負責策略 ── */
.org-table th, .org-table td { white-space: nowrap; }
.org-table td.st-td, .org-table td.pos-td { white-space: normal; }
.st-td { min-width: 220px; }
.st-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.st-chip {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 4px 0 8px; border: 1px solid var(--line); border-radius: 99px;
  background: #fff; font-size: 12px; color: var(--text-2); cursor: pointer; white-space: nowrap;
}
.st-chip b { min-width: 18px; height: 16px; padding: 0 5px; border-radius: 99px; background: var(--hover); color: var(--text); font-size: 11px; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.st-chip:hover { border-color: #c8ccf3; background: var(--accent-soft); color: var(--accent); }
.org-table-wrap { max-width: 1400px; overflow-x: auto; }

/* ── 職位工作內容 ── */
.icon-btn.pencil { width: 22px; height: 22px; }
.icon-btn.pencil:hover, .icon-btn.pencil.on { color: var(--accent); background: var(--accent-soft); }
.wi-title { display: flex; align-items: center; gap: 8px; }
.pos-block { border-bottom: 1px solid var(--line-soft); }
.pos-block .subrow { border-bottom: 0; }
.pos-work:empty { display: none; }
.pos-work { padding: 0 12px 10px; }
.wi-list { display: grid; gap: 2px; background: #fbfbfc; border-radius: 6px; padding: 6px 10px; }
.wi-row { display: flex; align-items: baseline; gap: 8px; font-size: 12px; line-height: 1.6; }
.wi-freq { flex: none; font-size: 11px; padding: 0 6px; border-radius: 4px; background: #eef0fc; color: #4a54b8; }
.wi-freq.weekly { background: #e9f7ef; color: #1f7a4d; }
.wi-freq.monthly { background: #fff4e5; color: #b26a00; }
.wi-freq.adhoc { background: var(--hover); color: var(--text-2); }
.wi-text { flex: 1; min-width: 0; color: var(--text); white-space: pre-wrap; }
.wi-pct { flex: none; color: var(--text-2); font-variant-numeric: tabular-nums; }
.wi-sum { display: flex; justify-content: flex-end; font-size: 12px; color: var(--muted); border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 4px; }
.wi-sum b, .wi-foot b { color: var(--text); }
.warn-text { color: var(--warn) !important; }
.wi-empty { border: 1px dashed var(--line); background: none; border-radius: 6px; width: 100%; padding: 6px 10px; color: var(--muted); font-size: 12px; text-align: left; cursor: pointer; }
.wi-empty:hover { color: var(--accent); border-color: #c8ccf3; }
.wi-edit { display: grid; gap: 6px; border: 1px solid #c8ccf3; background: #fff; border-radius: 8px; padding: 10px; box-shadow: 0 0 0 3px var(--accent-soft); }
.wi-erow { display: flex; align-items: center; gap: 6px; }
.wi-erow select { border: 1px solid var(--line); border-radius: 4px; padding: 3px 2px; background: #fff; font-size: 12px; flex: none; }
.wi-input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 4px; padding: 3px 6px; font: inherit; outline: none; }
.wi-input:focus, .wi-pct-in input:focus, .wi-erow select:focus { border-color: var(--accent); outline: none; }
.wi-pct-in { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; color: var(--muted); flex: none; }
.wi-pct-in input { width: 52px; border: 1px solid var(--line); border-radius: 4px; padding: 3px 4px; text-align: right; font: inherit; }
.wi-erow .x-btn { margin-left: 0; }
.wi-edit .add-row { height: 28px; padding: 0 4px; }
.wi-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line-soft); padding-top: 8px; }
.wi-total { font-size: 12px; color: var(--muted); text-align: right; padding: 6px 2px 0; }
.wi-total b { color: var(--text); }

/* ── 時間軸 ── */
.gt-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 20px; border-bottom: 1px solid var(--line-soft); }
.gt-controls .week-nav b { min-width: 150px; font-size: 13px; }
.gt-controls .chip-date { gap: 4px; }
.gt-select { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.gt-select select { padding: 3px 6px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--text); font-size: 12px; }
.gt-scroll { position: relative; overflow: auto; max-height: calc(100vh - 150px); min-height: 320px; border-bottom: 1px solid var(--line); }
.gt-head { position: sticky; top: 0; z-index: 6; display: flex; background: #fbfbfc; border-bottom: 1px solid var(--line); }
.gt-corner {
  position: sticky; left: 0; z-index: 7; width: 340px; flex: none; background: #fbfbfc; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; padding: 8px 14px; font-size: 12px; color: var(--text-2);
}
.gt-scale { position: relative; flex: none; }
.gt-top, .gt-units, .gt-sum { position: relative; }
.gt-top { height: 24px; border-bottom: 1px solid var(--line-soft); }
.gt-units { height: 24px; border-bottom: 1px solid var(--line-soft); }
.gt-units.day { height: 32px; }
.gt-sum { height: 38px; }
.gt-cell {
  position: absolute; top: 0; bottom: 0; display: flex; align-items: center; padding: 0 6px; border: 0; border-left: 1px solid var(--line-soft);
  background: none; font: inherit; font-size: 11px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-align: left;
}
.gt-top .gt-cell { font-weight: 600; color: var(--text); border-left-color: #dcdde3; }
button.gt-cell { cursor: zoom-in; }
button.gt-cell:hover { background: var(--accent-soft); color: var(--accent); }
.gt-cell.center { justify-content: center; padding: 0; flex-direction: column; line-height: 1.15; }
.gt-cell small { font-size: 10px; color: var(--muted); }
.gt-cell.weekend { background: #f1f1f4; }
.gt-cell.today { color: var(--danger); font-weight: 600; background: #fff1f1; }
.gt-cell.today small { color: var(--danger); }
.gt-sum .gt-cell { flex-direction: column; align-items: flex-start; justify-content: center; line-height: 1.25; }
.gt-sum .gt-cell.narrow { align-items: center; padding: 0; gap: 2px; }
.gt-sum b { font-size: 12px; color: var(--text); font-variant-numeric: tabular-nums; }
.gt-sum .late { color: var(--danger); }
.gt-dot-late { width: 5px; height: 5px; border-radius: 50%; background: var(--danger); }
.gt-body { position: relative; min-height: 120px; }
.gt-grid { position: absolute; top: 0; bottom: 0; z-index: 0; pointer-events: none; }
.gt-grid i { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line-soft); }
.gt-grid i.weekend { background: #f8f8fa; }
.gt-grid i.month { border-left-color: #dcdde3; }
.gt-today { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--danger); opacity: .55; }
.gt-row { position: relative; display: flex; height: 34px; border-bottom: 1px solid var(--line-soft); cursor: pointer; outline: none; }
.gt-row:hover { background: rgba(94, 106, 210, .035); }
.gt-row.active, .gt-row:focus-visible { background: rgba(94, 106, 210, .08); }
.gt-left {
  position: sticky; left: 0; z-index: 3; width: 340px; flex: none; min-width: 0; display: flex; align-items: center; gap: 8px;
  padding: 0 12px 0 10px; background: #fff; border-right: 1px solid var(--line);
}
.gt-row:hover .gt-left { background: #fafafd; }
.gt-row.active .gt-left { background: var(--accent-soft); }
.gt-left.sub { padding-left: 34px; }
.gt-left.sub .gt-title { color: var(--text-2); font-size: 12px; }
.gt-left .row-code { width: auto; min-width: 36px; }
.gt-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gt-toggle { width: 18px; height: 18px; flex: none; display: grid; place-items: center; border: 0; background: none; padding: 0; border-radius: 4px; cursor: pointer; }
.gt-toggle:hover { background: var(--hover); }
.gt-toggle-sp { width: 18px; flex: none; }
.gt-lane { position: relative; flex: none; z-index: 1; }
.gt-bar {
  --c: #8a94a6; position: absolute; top: 7px; height: 20px; border-radius: 5px; overflow: hidden; display: flex; align-items: center;
  background: color-mix(in srgb, var(--c) 14%, #fff); border: 1px solid color-mix(in srgb, var(--c) 50%, #fff);
}
.gt-bar > i { position: absolute; left: 0; top: 0; bottom: 0; background: color-mix(in srgb, var(--c) 40%, #fff); }
.gt-bar-text { position: relative; padding: 0 7px; font-size: 11px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gt-bar.sub { top: 10px; height: 14px; border-radius: 4px; }
.gt-bar.derived { top: 14px; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--c) 30%, #fff); border: 0; }
.gt-bar.clip-l { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 2px dashed color-mix(in srgb, var(--c) 60%, #fff); }
.gt-bar.clip-r { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: 2px dashed color-mix(in srgb, var(--c) 60%, #fff); }
.gt-bar.overdue { border-color: var(--danger); }
.gt-late { position: absolute; top: 16px; height: 0; border-top: 2px dashed var(--danger); opacity: .8; }
.gt-point { --c: #8a94a6; position: absolute; top: 11px; width: 12px; height: 12px; margin-left: -6px; transform: rotate(45deg); background: var(--c); border-radius: 2px; }
.gt-bar-label { position: absolute; top: 7px; line-height: 20px; font-size: 11px; color: var(--text-2); white-space: nowrap; pointer-events: none; }
.gt-row.gt-group { height: 32px; background: #f7f7f8; cursor: default; }
.gt-row.gt-group:hover { background: #f3f3f5; }
.gt-group .gt-left { background: #f7f7f8; }
.gt-row.gt-group:hover .gt-left { background: #f3f3f5; }
.gt-left .group-toggle { padding: 0 2px; gap: 8px; }
.gt-group-bar { position: absolute; top: 14px; height: 4px; border-radius: 2px; background: #d6d8e0; }
.gt-empty { position: sticky; left: 0; width: min(100%, 900px); padding: 40px; text-align: center; color: var(--muted); }
.gt-foot { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 8px 20px; font-size: 12px; }
.gt-legend { display: inline-flex; gap: 14px; margin-left: auto; color: var(--muted); }
.gt-legend > span { display: inline-flex; align-items: center; gap: 5px; }
.gt-legend i { display: inline-block; }
.lg-bar { width: 26px; height: 10px; border-radius: 3px; background: linear-gradient(90deg, #b9c9f5 55%, #e3e9fb 55%); border: 1px solid #a9b8ee; }
.lg-late { width: 22px; border-top: 2px dashed var(--danger); }
.lg-today { width: 2px; height: 12px; background: var(--danger); opacity: .6; }
.gt-undated { margin: 0 20px 20px; }

@media (max-width: 900px) {
  .drawer-grid { grid-template-columns: 1fr; }
  .props { border-left: 0; border-top: 1px solid var(--line); }
  .ps-stats { display: none; }
  .row .label { display: none; }
  .score-body { grid-template-columns: 1fr; }
}

/* ── 手機 App ── */
.side-backdrop { display: none; }
.install-card { width: min(460px, 94vw); }
.install-head { display: flex; gap: 14px; align-items: center; }
.install-head img { border-radius: 12px; flex: none; }
.install-url { display: flex; gap: 14px; align-items: center; background: var(--side); border-radius: 8px; padding: 12px; }
.install-qr { flex: none; background: #fff; border-radius: 6px; line-height: 0; }
.install-link { font-size: 15px; word-break: break-all; color: var(--accent); }
.install-card h2 { font-size: 14px; margin: 4px 0 6px; }
.install-card ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; color: var(--text-2); }
.install-ico { display: inline-block; padding: 0 4px; border: 1px solid var(--line); border-radius: 4px; font-size: 11px; }

@media (max-width: 700px) {
  :root { font-size: 14px; }
  .shell, .main, .sidebar { height: 100dvh; }
  .shell { grid-template-columns: 52px minmax(0, 1fr); padding-top: env(safe-area-inset-top); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 45; padding-top: calc(10px + env(safe-area-inset-top)); }
  .sidebar.collapsed { z-index: 20; }
  .sidebar:not(.collapsed) { width: min(280px, 86vw); box-shadow: 8px 0 32px rgba(0, 0, 0, .16); }
  .side-backdrop { display: block; position: fixed; inset: 0; z-index: 44; background: rgba(0, 0, 0, .25); }
  .main { grid-column: 2; }
  .toolbar { height: auto; min-height: 48px; padding: 6px 10px; gap: 8px; overflow-x: auto; scrollbar-width: none; }
  .toolbar::-webkit-scrollbar { display: none; }
  .toolbar > * { flex: none; }
  .seg button { padding: 4px 8px; }
  .search-box input { width: 120px; }
  .goal-strip { padding: 10px 12px; gap: 10px; }
  .goal-card { min-width: 140px; }
  .board { padding: 10px 12px; }
  .column { width: 82vw; }
  .row { flex-wrap: wrap; height: auto; min-height: 44px; padding: 8px 12px; row-gap: 4px; }
  .row-title { flex: 1 1 0; white-space: normal; line-height: 1.4; }
  .row-tail { flex-basis: 100%; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
  .row-tail .row-tags { display: none; }
  .drawer { inset: 0; width: 100vw; border-radius: 0; border: 0; padding-top: env(safe-area-inset-top); }
  .d-main { padding: 16px 14px 32px; }
  .modal-backdrop { padding-top: 4vh; }
  .popover.filter-pop { position: fixed; left: 10px; right: 10px; top: 60px; width: auto; }
  .popover.bell-pop { position: fixed; left: 10px; right: 10px; top: 60px; width: auto; }
  input, select, textarea { font-size: 16px; }
}

/* ── 預算簽核、通知鈴鐺 ── */
.bell { position: relative; }
.bell-btn { position: relative; width: 30px; height: 30px; }
.bell-btn .ico { width: 17px; height: 17px; }
.bell-btn.on { background: var(--hover); color: var(--text); }
.bell-count {
  position: absolute; top: 0; right: -2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 600; line-height: 16px; text-align: center;
  box-shadow: 0 0 0 2px #fff;
}
.bell-pop { right: 0; top: calc(100% + 6px); width: 360px; padding: 0; overflow: hidden; }
.bell-head { display: flex; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.bell-todo {
  display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); cursor: pointer;
  padding: 9px 12px; background: #fff7ed; color: #9a3412; font: inherit;
}
.bell-todo:hover { background: #ffedd5; }
.bell-list { max-height: 60vh; overflow-y: auto; }
.bell-item {
  display: flex; gap: 10px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line-soft);
  background: #fff; padding: 10px 12px; cursor: pointer; font: inherit; color: var(--text-2);
}
.bell-item:hover { background: var(--hover); }
.bell-item.unread { background: #f7f8ff; color: var(--text); }
.bell-item.unread .bell-title { font-weight: 600; }
.bell-text { display: grid; gap: 2px; min-width: 0; }
.bell-title { line-height: 1.4; }
.bell-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: var(--muted); }
.bell-item:not(.unread) .bell-dot { opacity: .35; }
.bell-dot.budget_pending { background: var(--warn); }
.bell-dot.budget_approved { background: var(--ok); }
.bell-dot.budget_rejected { background: var(--danger); }
.bell-empty { padding: 24px 12px; text-align: center; }

.budget-st { font-size: 11px; padding: 1px 7px; border-radius: 4px; white-space: nowrap; margin-left: 4px; font-weight: 500; }
.budget-st.pending { background: #fff1e7; color: #c2410c; }
.budget-st.approved { background: #e9f7ef; color: #0f7b52; }
.budget-st.rejected { background: #fff0f0; color: var(--danger); }
.budget-st.cancelled { background: var(--hover); color: var(--muted); }
.row-budget.pending { background: #fff1e7; color: #c2410c; }
.row-budget.rejected { background: #fff0f0; color: var(--danger); }

.step-st { font-size: 11px; padding: 0 6px; border-radius: 4px; background: var(--hover); color: var(--text-2); white-space: nowrap; }
.step-st.pending { background: #fff1e7; color: #c2410c; }
.step-st.approved { background: #e9f7ef; color: #0f7b52; }
.step-st.rejected { background: #fff0f0; color: var(--danger); }
.step-st.cancelled, .step-st.waiting { color: var(--muted); }

.ap-mine {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 8px;
  border: 1px solid #fed7aa; background: #fff7ed; border-radius: 8px;
}
.ap-mine > span:first-child { flex: 1; }
.ap-title { display: flex; align-items: center; gap: 6px; }
.ap-line-title { font-size: 12px; font-weight: 600; color: var(--text-2); margin-top: 4px; }
.ap-stuck { padding: 6px 10px; border-radius: 6px; background: #fff7ed; color: #9a3412; font-size: 13px; line-height: 1.7; }
.ap-stuck-who { white-space: nowrap; }
.ap-resubmit { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin-bottom: 8px; border-radius: 8px; background: #fff0f0; }
.ap-resubmit > span { flex: 1; }
.cosign-pick { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 10px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fbfbfc; }
.cosign-pick select { height: 28px; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; background: #fff; font: inherit; font-size: 13px; max-width: 220px; }
.ap-table td.ap-wait-td { white-space: normal; min-width: 200px; }
.ap-batch { display: grid; gap: 6px; margin-bottom: 8px; }
.ap-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ap-step { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 4px 0; }
.ap-step.cancelled, .ap-step.waiting { opacity: .7; }
.ap-no {
  width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center;
  font-size: 10px; color: var(--muted); flex: none;
}
.ap-step.approved .ap-no { background: var(--ok); border-color: var(--ok); color: #fff; }
.ap-step.rejected .ap-no { background: var(--danger); border-color: var(--danger); color: #fff; }
.ap-step.pending .ap-no { border-color: var(--warn); color: var(--warn); }
.ap-reason { flex-basis: 100%; margin-left: 26px; font-size: 12px; color: var(--text-2); background: #fafafb; border-radius: 6px; padding: 4px 8px; }

.decide { display: inline-flex; gap: 6px; }
.decide-reject { display: grid; gap: 6px; min-width: 260px; flex: 1; }
.decide-reject textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font: inherit; resize: vertical; outline: none;
}
.decide-reject textarea:focus { border-color: var(--accent); }
.decide-row { display: flex; justify-content: flex-end; gap: 6px; }

.approvals-page { display: grid; gap: 14px; padding: 16px 20px; align-content: start; }
.ap-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ap-table td { vertical-align: middle; }
.ap-table td.ap-task { white-space: normal; min-width: 240px; }
.ap-table td.ap-reason-td { white-space: normal; max-width: 280px; }
.ap-table .num { text-align: right; font-variant-numeric: tabular-nums; }
