/* =====================================================================
 * app.css v2 — 手機版（預設）＋ 電腦版（≥1024px）
 *   手機：單欄、底部固定輸入列、LINE 內建瀏覽器
 *   電腦：左側選單 ＋ 任務清單／詳細左右分欄
 * ===================================================================== */
:root {
  --green: #06C755; --green-d: #05a648; --green-l: #e6f9ee; --bg: #f3f4f6; --card: #fff; --text: #1f2328; --sub: #6b7280; --faint: #9ca3af;
  --line: #e5e7eb; --red: #e03131; --pink: #d6336c; --orange: #e8590c; --blue: #1c7ed6; --done: #2b8a3e;
  --radius: 12px; --side-w: 232px; --top-h: 52px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[x-cloak] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }

@media (max-width: 1023px) { .desktop-only { display: none !important; } }
@media (min-width: 1024px) { .mobile-only { display: none !important; } }

/* ---------- 外框 ---------- */
.sidebar { display: none; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px;
  height: var(--top-h); padding: 0 12px; background: #fff; border-bottom: 1px solid var(--line); }
.topbar-title { flex: 1; margin: 0; font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-btn { width: 36px; height: 36px; display: grid; place-items: center; font-size: 30px; line-height: 1; color: var(--text); margin-left: -6px; }
.topbar-logo { font-weight: 800; color: var(--green); font-size: 16px; }
.topbar-me img, .topbar-me .avatar-fallback { width: 32px; height: 32px; border-radius: 50%; display: block; object-fit: cover; }
.page { max-width: 640px; margin: 0 auto; padding: 12px 12px 110px; }

/* ---------- 共用元件 ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.section-title { font-size: 13px; color: var(--sub); margin: 16px 4px 8px; font-weight: 600; }
.muted { color: var(--sub); font-size: 13px; }
.empty { text-align: center; color: var(--faint); padding: 40px 0; }
.avatar, .avatar-fallback { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex: none; }
.avatar-fallback { display: inline-grid; place-items: center; background: #cbd5e1; color: #fff; font-size: 12px; font-weight: 700; }
.avatars { display: flex; }
.avatars > * { margin-left: -6px; }
.avatars > * > * { border: 2px solid #fff; }
.avatars > *:first-child { margin-left: 0; }
.btn { border: 0; border-radius: 10px; padding: 9px 16px; background: var(--green); color: #fff; font-weight: 600; white-space: nowrap; }
.btn:hover { background: var(--green-d); }
.btn-ghost { background: #eef0f3; color: var(--text); }
.btn-ghost:hover { background: #e2e5e9; }
.btn-danger { background: #fff; color: var(--red); border: 1px solid #f3c1c1; }
.btn-danger:hover { background: #fdecec; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-block { width: 100%; }
.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: #eef0f3; color: var(--sub); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.spinner { width: 22px; height: 22px; border: 3px solid #d1d5db; border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.link-btn { border: 0; background: none; color: var(--blue); padding: 4px; font-size: 14px; }
.link-btn:hover { text-decoration: underline; }

.due-overdue { color: var(--red); font-weight: 700; }
.due-today { color: var(--pink); font-weight: 700; }
.due-soon { color: var(--orange); font-weight: 600; }
.due-normal { color: var(--text); }
.due-none, .due-done { color: var(--faint); }

/* ---------- 首頁 ---------- */
.home-hello { font-size: 22px; margin: 4px 0 16px; }
.shortcuts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 6px; }
.shortcuts-4 { grid-template-columns: repeat(2, 1fr); }
.shortcut { background: #fff; border-radius: var(--radius); padding: 12px 6px; text-align: center; font-size: 14px; font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.shortcut .ico { display: block; font-size: 22px; margin-bottom: 2px; }
.group-card { display: block; transition: box-shadow .15s, transform .15s; }
.group-head { display: flex; align-items: center; gap: 10px; }
.group-icon { width: 42px; height: 42px; border-radius: 12px; background: var(--green-l); color: var(--green); display: grid; place-items: center; font-weight: 800; font-size: 18px; flex: none; }
.group-name { font-weight: 700; font-size: 16px; }
.stats { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.stat { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #f3f4f6; color: var(--sub); }
.stat b { font-size: 13px; }
.stat-overdue { background: #fdecec; color: var(--red); }
.stat-today { background: #fdebf1; color: var(--pink); }

/* ---------- 任務清單 ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 8px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; border: 0; padding: 6px 14px; border-radius: 999px; background: #fff; color: var(--sub); font-size: 14px; }
.tab:hover { color: var(--text); }
.tab.on { background: var(--text); color: #fff; }
.toolbar { display: flex; gap: 8px; margin-bottom: 8px; }
.search { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: #fff; }
.search:focus, .composer input:focus, .composer textarea:focus, .composer select:focus { outline: 2px solid var(--green-l); border-color: var(--green); }
.seg { flex: none; display: flex; background: #e5e7eb; border-radius: 10px; padding: 2px; }
.seg button { white-space: nowrap; border: 0; background: none; padding: 6px 9px; border-radius: 8px; font-size: 13px; color: var(--sub); }
.seg button.on { background: #fff; color: var(--text); font-weight: 600; }
.list-count { margin: 0 4px 8px; }

/* 任務列：手機是兩行卡片 */
.task-item { display: grid; grid-template-columns: auto 1fr auto auto; column-gap: 8px; row-gap: 8px; align-items: center;
  grid-template-areas: "title title title title" "due group icons people"; }
.task-state { color: var(--green); font-weight: 700; margin-right: 6px; text-decoration: none; display: inline-block; }
.task-title { grid-area: title; font-weight: 600; word-break: break-word; }
.task-due { grid-area: due; font-size: 13px; white-space: nowrap; }
.task-group { grid-area: group; min-width: 0; }
.task-icons { grid-area: icons; font-size: 13px; color: var(--sub); display: flex; gap: 8px; white-space: nowrap; }
.task-people { grid-area: people; }
.in-group .task-group { visibility: hidden; }
.task-done .task-title { color: var(--faint); text-decoration: line-through; }
.task-no { color: var(--faint); font-weight: 400; font-size: 13px; margin-right: 4px; }
.check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #cbd5e1; background: #fff; flex: none; display: grid; place-items: center; color: #fff; font-size: 15px; padding: 0; }
.check:hover { border-color: var(--green); }
.check.on { background: var(--green); border-color: var(--green); }
.check-sm { width: 20px; height: 20px; font-size: 12px; }

/* 輸入列：手機固定在底部 */
.composer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: #fff; border-top: 1px solid var(--line);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); }
.composer-inner { max-width: 640px; margin: 0 auto; display: flex; gap: 8px; align-items: center; }
.composer input[type=text], .composer textarea { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; background: #f9fafb; resize: none; }
.composer input[type=date] { width: 128px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 6px; background: #f9fafb; font-size: 13px; }
.composer select { max-width: 110px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 6px; background: #f9fafb; font-size: 13px; }
/* 手機：新增任務的標題獨佔一行，群組／日期／按鈕在第二行 */
.task-composer .composer-inner { flex-wrap: wrap; }
.task-composer input[type=text] { flex: 1 1 100%; order: -1; }
.task-composer select { flex: 1; max-width: none; }
.list-body { padding-bottom: 50px; }   /* 讓出兩行高的新增列 */

/* ---------- 任務詳細 ---------- */
.detail-page, .detail-pane { container-type: inline-size; }
.detail-grid.is-loading { opacity: .6; transition: opacity .2s; }
/* 單欄（手機、窄面板）：拆開兩欄，依序排列 */
.detail-grid { display: flex; flex-direction: column; }
.detail-main, .detail-side { display: contents; }
.d-title { order: 1; } .d-props { order: 2; } .d-actions { order: 3; } .d-summary { order: 4; } .d-subtasks { order: 5; }
.d-files { order: 6; } .d-comments { order: 7; }
.d-actions { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.d-actions:empty { display: none; }
/* 雙欄（詳細區寬度夠時） */
@container (min-width: 720px) {
  .detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
  .detail-main, .detail-side { display: block; }
  .detail-side { position: sticky; top: 12px; }
  .d-props .kv-k { width: 64px; }
}

.detail-title { font-size: 20px; font-weight: 700; margin: 2px 0 0; word-break: break-word; border-radius: 6px; }
.editable { cursor: text; border-radius: 6px; }
.editable:hover { background: #f5f7f9; box-shadow: 0 0 0 4px #f5f7f9; }
.detail-title-input { width: 100%; font-size: 20px; font-weight: 700; border: 1px solid var(--green); border-radius: 8px; padding: 4px 8px; }
.status-bar { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; gap: 10px; }
.side-status { padding: 4px 0 12px; border-bottom: 1px solid #f1f2f4; }
.badge-status { font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.badge-pending { background: #e7f1fd; color: var(--blue); }
.badge-done { background: #e6f4ea; color: var(--done); }
.kv { display: flex; align-items: center; min-height: 44px; border-bottom: 1px solid #f1f2f4; gap: 12px; }
.kv:last-child { border-bottom: 0; }
.kv-top { align-items: flex-start; padding-top: 8px; }
.kv-top .kv-k { padding-top: 4px; }
.kv-k { width: 64px; color: var(--sub); font-size: 14px; flex: none; }
.kv-v { flex: 1; min-width: 0; }
.kv input[type=date] { border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; background: #fff; max-width: 100%; }
.due-hint { font-size: 12px; margin-top: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: #f3f4f6; border-radius: 999px; padding: 3px 4px 3px 3px; font-size: 14px; }
.chip button { border: 0; background: none; color: var(--faint); font-size: 16px; line-height: 1; padding: 0 4px; }
.chip button:hover { color: var(--red); }
.summary-text { white-space: pre-wrap; word-break: break-word; }
.summary-input { width: 100%; min-height: 110px; border: 1px solid var(--green); border-radius: 8px; padding: 8px; }
.subtask { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; }
.subtask-title { flex: 1; }
.subtask.done .subtask-title { color: var(--faint); text-decoration: line-through; }
.comment { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f1f2f4; }
.comment .avatar, .comment .avatar-fallback { width: 32px; height: 32px; }
.comment-body { flex: 1; min-width: 0; }
.comment-head { font-size: 13px; color: var(--sub); }
.comment-head b { color: var(--text); margin-right: 6px; }
.comment-text { white-space: pre-wrap; word-break: break-word; margin-top: 2px; }

/* 選人面板：手機由下滑出 */
.sheet-mask { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: #fff; border-radius: 16px 16px 0 0;
  max-height: 70vh; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); }
.sheet-head { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 700; }
.sheet-head span { flex: 1; }
.sheet-list { overflow-y: auto; padding: 4px 8px 12px; }
.person { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 10px 8px; border-radius: 10px; text-align: left; font-size: 15px; }
.person:hover:not(:disabled) { background: #f3f4f6; }
.person .avatar, .person .avatar-fallback { width: 36px; height: 36px; }
.person .person-name { flex: 1; }
.person:disabled { opacity: .45; cursor: default; }

.toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50;
  background: rgba(31,35,40,.92); color: #fff; padding: 9px 16px; border-radius: 10px; font-size: 14px; max-width: 86vw; text-align: center; }
.toast-err { background: rgba(224,49,49,.95); }

.login-box { text-align: center; padding: 60px 20px; }
.login-box h1 { font-size: 24px; margin: 0 0 8px; }
.btn-line { display: inline-block; background: var(--green); color: #fff; padding: 14px 32px; border-radius: 12px; font-size: 17px; font-weight: 700; margin-top: 20px; }

.pane-empty { text-align: center; color: var(--sub); padding: 120px 20px; }
.pane-empty-ico { font-size: 44px; margin-bottom: 8px; }

/* =====================================================================
 * 電腦版
 * ===================================================================== */
@media (min-width: 1024px) {
  html, body { font-size: 14px; }
  .app { display: flex; min-height: 100vh; }

  /* 左側選單 */
  .sidebar { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; width: var(--side-w); flex: none;
    background: #fff; border-right: 1px solid var(--line); padding: 14px 10px; }
  .sidebar-logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 17px; padding: 4px 8px 14px; }
  .logo-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--green); color: #fff; display: grid; place-items: center; font-size: 15px; }
  .nav-group { display: flex; flex-direction: column; gap: 2px; }
  .nav-scroll { flex: 1; overflow-y: auto; min-height: 0; }
  .nav-title { font-size: 12px; color: var(--faint); font-weight: 700; padding: 16px 10px 6px; }
  .nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #374151; }
  .nav-item:hover { background: #f3f4f6; }
  .nav-item.on { background: var(--green-l); color: #04813a; font-weight: 700; }
  .nav-ico { width: 20px; text-align: center; }
  .nav-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .nav-dot { width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; margin: 0 6px; flex: none; }
  .nav-dot.red { background: var(--red); }
  .nav-count { font-size: 12px; color: var(--sub); background: #f3f4f6; border-radius: 999px; padding: 0 7px; }
  .nav-empty { color: var(--faint); font-size: 13px; padding: 6px 10px; }
  .sidebar-me { display: flex; align-items: center; gap: 8px; padding: 12px 8px 2px; border-top: 1px solid var(--line); margin-top: 8px; }
  .sidebar-logout { font-size: 12px; color: var(--sub); }
  .sidebar-logout:hover { color: var(--red); }

  .main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .topbar { padding: 0 24px; }
  .topbar-me, .topbar-logo { display: none; }
  .page { padding: 20px 24px 40px; width: 100%; }
  .page-narrow { max-width: 1120px; margin: 0; }
  .page-wide { max-width: none; padding: 0; flex: 1; min-height: 0; }

  /* 首頁：群組卡片三欄 */
  .shortcuts { display: none; }
  .group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
  .group-grid .card { margin: 0; }
  .home-cols { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
  .home-mine .card { padding: 4px 0; }
  .mine-row { display: flex; gap: 10px; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--line); }
  .mine-row:last-child { border-bottom: 0; }
  .mine-row:hover { background: #f9fafb; }
  .mine-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mine-due { font-size: 12px; white-space: nowrap; }
  .mine-more { display: block; text-align: center; padding: 8px; font-size: 13px; color: var(--green-d, #05a847); }
  .group-card:hover { box-shadow: 0 6px 18px rgba(0,0,0,.08); transform: translateY(-1px); }

  /* 任務清單／詳細 左右分欄，各自捲動 */
  .split { display: grid; grid-template-columns: minmax(460px, 46%) minmax(0, 1fr); height: calc(100vh - var(--top-h)); }
  .list-pane { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--bg); }
  .list-head { padding: 16px 20px 0; }
  .list-title { font-size: 20px; margin: 0 0 12px; }
  .list-body { flex: 1; overflow-y: auto; padding: 0 20px 24px; }
  .detail-pane { overflow-y: auto; padding: 20px 24px 40px; background: #f8f9fb; }

  /* 新增任務：放在清單上方 */
  .task-composer { position: static; padding: 0; border: 0; background: none; margin-bottom: 12px; }
  .task-composer .composer-inner { max-width: none; flex-wrap: nowrap; }
  .task-composer input[type=text] { flex: 1; order: 0; }
  .task-composer select { flex: none; width: auto; max-width: 240px; }   /* 群組名稱要顯示完整（2026-10-01） */
  .task-composer input[type=text] { background: #fff; padding: 10px 12px; }
  .task-composer input[type=date], .task-composer select { background: #fff; }

  /* 任務列：一行一筆的表格式 */
  /* 標題欄最寬；群組縮成標題下方的小標籤，窄面板也看得到完整標題 */
  .row-head, .task-item { grid-template-columns: minmax(0, 1fr) 92px 76px 48px; column-gap: 12px; }
  .task-item { grid-template-areas: "title due people icons" "group due people icons"; row-gap: 3px; }
  .row-head { display: grid; font-size: 12px; color: var(--faint); padding: 0 12px 6px; }
  .row-head span:nth-child(2) { display: none; }
  .task-item .task-group { line-height: 1; }
  .task-item .task-group .pill { font-size: 11px; padding: 1px 7px; }
  .task-people { overflow: hidden; }
  .task-item { padding: 10px 12px; margin-bottom: 6px; border: 1px solid transparent; }
  .task-item:hover { border-color: #d1d5db; }
  .task-item.selected { border-color: var(--green); box-shadow: 0 0 0 2px var(--green-l); }
  .task-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .task-icons { justify-content: flex-end; }
  .in-group .task-item .task-group { display: none; }
  .topbar-btn { display: none; }

  /* 詳細 */
  .detail-page { max-width: 1120px; }
  .comment-composer { position: static; padding: 10px 0 0; border: 0; background: none; }
  .comment-composer .composer-inner { max-width: none; align-items: flex-end; }
  .comment-composer textarea { min-height: 42px; background: #fff; }

  /* 選人：置中對話框 */
  .sheet { left: 50%; right: auto; bottom: auto; top: 12vh; transform: translateX(-50%); width: 420px; border-radius: 16px; max-height: 70vh; box-shadow: 0 20px 50px rgba(0,0,0,.2); }
  .toast { bottom: 32px; }
}

/* ---------- 私人備忘錄 ---------- */
.group-icon-personal { background: #fef3c7; font-size: 20px; }
.pill-personal { background: #fef3c7; color: #92400e; }
.nav-lock { width: 20px; flex: none; font-size: 11px; text-align: center; }
.memo-hint { font-size: 12px; color: #92400e; background: #fffbeb; border-radius: 8px; padding: 6px 10px; margin: 8px 0; }

/* ---------- 帳號管理 /admin ---------- */
.nav-count-red { background: var(--red, #e53935); color: #fff; font-weight: 700; }
.admin-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; margin-bottom: 12px; }
.admin-title { font-size: 20px; margin: 0 0 4px; }
.admin-newgroup { display: flex; gap: 8px; }
.admin-newgroup input { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; min-width: 0; width: 180px; background: #fff; }
.admin-filter { display: inline-flex; margin-bottom: 12px; }
.user-row { padding: 14px 16px; }
.user-off { border-left: 4px solid #f59e0b; }
.user-main { display: flex; align-items: center; gap: 12px; }
.avatar-lg { width: 44px !important; height: 44px !important; font-size: 18px; flex: none; }
.user-info { flex: 1; min-width: 0; }
.user-name { font-weight: 700; font-size: 16px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.user-meta { font-size: 12px; margin-top: 2px; }
.user-actions { display: flex; gap: 8px; align-items: center; flex: none; }
.badge-wait { background: #fef3c7; color: #92400e; }
.pill-admin { background: #e0e7ff; color: #3730a3; }
.user-groups { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.user-groups-label { font-size: 12px; margin-right: 4px; }
.gchip { display: inline-flex; gap: 4px; align-items: center; border: 1px solid var(--line); background: #fff; color: var(--sub);
  border-radius: 999px; padding: 4px 12px; font-size: 13px; }
.gchip:hover { border-color: var(--green); }
.gchip.on { background: var(--green-l); border-color: var(--green); color: #047a3a; font-weight: 600; }
.user-admin { margin-left: auto; font-size: 13px; color: var(--sub); display: inline-flex; gap: 4px; align-items: center; }
@media (max-width: 600px) {
  .user-main { flex-wrap: wrap; }
  .user-actions { width: 100%; justify-content: flex-end; }
  .admin-newgroup { width: 100%; } .admin-newgroup input { flex: 1; }
}

/* ---------- 新增任務表單 ---------- */
.task-form { display: flex; flex-direction: column; max-height: 88vh; }
.form-body { overflow-y: auto; padding: 12px 16px 4px; display: flex; flex-direction: column; gap: 12px; }
.f-row { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.f-label { font-size: 13px; color: var(--sub); font-weight: 600; }
.f-label small { font-weight: 400; margin-left: 4px; }
.req { color: var(--red); }
.form-body input[type=text], .form-body input[type=date], .form-body select, .form-body textarea {
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; background: #fff; font: inherit; width: 100%; box-sizing: border-box; }
.form-body textarea { resize: vertical; }
.form-body input:focus, .form-body select:focus, .form-body textarea:focus { outline: 2px solid var(--green-l); border-color: var(--green); }
.f-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.f-people { display: flex; flex-wrap: wrap; gap: 6px; }
.form-foot { display: flex; gap: 8px; align-items: center; padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.form-foot .muted { flex: 1; font-size: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 1024px) { .task-form { width: 520px; max-height: 80vh; top: 8vh; } }

/* ---------- 多人交辦／關卡 ---------- */
.check-off { opacity: .35; cursor: not-allowed; }
.av-done { opacity: .35; }
.av-active img, .av-active .avatar-fallback { box-shadow: 0 0 0 2px var(--green); }
.prog { font-size: 12px; color: var(--sub); }
.flow { display: flex; flex-direction: column; gap: 8px; align-items: stretch !important; }
.flow-stage { border-left: 3px solid var(--line); padding-left: 10px; }
.flow-stage.is-active { border-left-color: var(--green); }
.flow-stage.is-done { border-left-color: #b7dfc2; }
.flow-head { display: flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 700; color: var(--sub); margin-bottom: 4px; }
.flow-tag { font-weight: 400; background: #f3f4f6; border-radius: 999px; padding: 0 7px; }
.is-active .flow-tag { background: var(--green-l); color: #047a3a; }
.is-done .flow-tag { background: #e6f4ea; color: var(--done); }
.flow-person { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 6px; padding: 3px 0; font-size: 14px; }
.flow-name { font-weight: 500; white-space: nowrap; }          /* 名字不要被擠成直排（2026-10-01） */
.flow-state { font-size: 12px; color: #047a3a; white-space: nowrap; }
.flow-person .link-btn { white-space: nowrap; font-size: 13px; padding: 0 2px; }
.flow-state.done { color: var(--faint); }
.flow-x { border: 0; background: none; color: var(--faint); font-size: 16px; padding: 0 4px; margin-left: auto; }
.flow-x:hover { color: var(--red); }
.flow-add { font-size: 12px; }
.flow-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.f-flow { align-self: flex-start; margin: 2px 0; }
.f-hint { font-size: 12px; }
.f-radio { display: flex; gap: 6px; align-items: center; font-size: 14px; padding: 3px 0; }

/* 帳號管理：層級／上級 */
.user-tier { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 10px; font-size: 13px; color: var(--sub); }
.user-tier select { margin-left: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; background: #fff; font-size: 13px; }
.gchip:disabled { opacity: .45; cursor: not-allowed; }
.user-groups .user-tier { flex-basis: 100%; }

/* ---------- v9（2026-09-30）：附件 ---------- */
.files { display: flex; flex-direction: column; }
.file { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f1f2f4; }
.file:last-child { border-bottom: 0; }
.file-thumb { width: 48px; height: 48px; border-radius: 8px; overflow: hidden; flex: none; background: #f3f4f6; display: grid; place-items: center; }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-icon { font-weight: 800; font-size: 13px; color: #fff; }
.fi-pdf { background: #e03131; } .fi-doc { background: #1c7ed6; } .fi-xls { background: #2b8a3e; }
.file-uploading .file-icon { background: #f3f4f6; font-size: 20px; }
.file-info { flex: 1; min-width: 0; }
.file-name { display: block; font-size: 14px; color: var(--text, #1f2328); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 12px; }
.file-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.file-actions label.btn { cursor: pointer; }
.file-hint { font-size: 12px; }
.upload-bar { height: 4px; background: #e5e7eb; border-radius: 2px; margin-top: 6px; overflow: hidden; }
.upload-bar span { display: block; height: 100%; background: var(--green); transition: width .2s; }

/* ---------- v10（2026-10-01）：我的待辦任務依群組分段、新增列的群組選單顯示完整 ---------- */
.list-sec + .list-sec { margin-top: 14px; }
.list-sec-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--sub); margin: 4px 4px 8px; }
.list-sec-count { font-weight: 400; font-size: 12px; background: #e5e7eb; border-radius: 999px; padding: 0 8px; }
.list-body.no-composer { padding-bottom: 16px; }   /* 跨群組清單沒有新增列（2026-10-01） */
.lock-hint { font-size: 12px; color: #047a3a; background: #e6f4ea; border-radius: 8px; padding: 6px 10px; margin: 8px 0; }

/* ---------- v13（2026-10-02）：附件預覽格＋檢視器 ---------- */
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.tile { position: relative; cursor: pointer; border-radius: 10px; overflow: hidden; background: #f3f4f6; border: 1px solid var(--line); }
.tile:hover { border-color: var(--green); }
.tile-img, .tile-doc { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.tile-doc { display: grid; place-items: center; color: #fff; font-size: 15px; background: #9ca3af; }
.tile-doc.fi-pdf { background: #e03131; } .tile-doc.fi-doc { background: #1c7ed6; } .tile-doc.fi-xls { background: #2b8a3e; }
.tile-name { font-size: 11px; padding: 4px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: #fff; color: var(--text); }
.tile-x { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.55); color: #fff; font-size: 15px; line-height: 1; display: grid; place-items: center; padding: 0; }
.tile-uploading { cursor: default; }
.tile-uploading .tile-doc { background: #e5e7eb; font-size: 24px; }
.tile-uploading .upload-bar { margin: 0 6px 6px; }
html.viewer-open, html.viewer-open body { overflow: hidden; }
.viewer { position: fixed; inset: 0; z-index: 100; background: rgba(17,17,17,.94); display: flex; flex-direction: column; }
.viewer-bar { display: flex; align-items: center; gap: 6px; padding: 10px 12px calc(10px); padding-top: calc(10px + env(safe-area-inset-top)); color: #fff; }
.viewer-title { flex: 1; min-width: 0; }
.viewer-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-meta { font-size: 12px; color: #bbb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-btn { flex: none; width: 40px; height: 40px; border-radius: 10px; border: 0; background: rgba(255,255,255,.12); color: #fff;
  font-size: 18px; display: grid; place-items: center; text-decoration: none; }
.viewer-btn:hover { background: rgba(255,255,255,.22); }
.viewer-body { flex: 1; overflow: auto; display: flex; flex-direction: column; align-items: center; -webkit-overflow-scrolling: touch; padding: 0 0 calc(16px + env(safe-area-inset-bottom)); }
.viewer-img { max-width: 100%; max-height: 100%; margin: auto; object-fit: contain; cursor: zoom-in; }
.viewer-img.zoom { max-width: none; max-height: none; cursor: zoom-out; margin: 0; }
.viewer-pages { width: 100%; max-width: 1000px; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 0 8px; }
.viewer-page { background: #fff; max-width: 100%; box-shadow: 0 2px 10px rgba(0,0,0,.4); }
.viewer-more, .viewer-msg { color: #ddd; text-align: center; padding: 20px; }
.viewer-msg { margin: auto; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.viewer .spinner { border-color: #555; border-top-color: #fff; }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; border: 0; border-radius: 10px;
  background: rgba(255,255,255,.12); color: #fff; font-size: 34px; line-height: 1; }
.viewer-nav.prev { left: 8px; } .viewer-nav.next { right: 8px; }
@media (max-width: 1023px) { .viewer-nav { top: auto; bottom: calc(16px + env(safe-area-inset-bottom)); transform: none; height: 48px; } }

/* ---- v14：留言編輯、@提及 ---- */
.comment-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.comment-edited { font-size: 12px; color: var(--faint, #9CA3AF); cursor: help; }
.comment-edit-btn { margin-left: auto; font-size: 12px; color: var(--sub); background: none; border: 0; padding: 0 2px; cursor: pointer; }
.comment-edit-btn:hover { color: var(--primary, #1C7ED6); text-decoration: underline; }
.comment-text .mention { color: #1C7ED6; font-weight: 600; background: #E7F1FF; border-radius: 4px; padding: 0 2px; }
.comment-editing { margin-top: 6px; }
.comment-editing textarea { width: 100%; box-sizing: border-box; min-height: 72px; font: inherit; padding: 8px 10px;
  border: 1px solid var(--line, #E5E7EB); border-radius: 8px; resize: vertical; }
.comment-editing-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.btn.sm { padding: 5px 12px; font-size: 13px; }
.btn.ghost { background: #fff; color: var(--text); border: 1px solid var(--line, #E5E7EB); }
.mention-wrap { position: relative; }
.mention-pop { position: absolute; left: 0; bottom: calc(100% + 6px); z-index: 60; min-width: 180px; max-width: 260px;
  background: #fff; border: 1px solid var(--line, #E5E7EB); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 4px; }
.mention-pop.down { bottom: auto; top: calc(100% + 4px); }
.mention-pop button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border: 0; background: none;
  border-radius: 6px; font: inherit; text-align: left; cursor: pointer; }
.mention-pop button.on, .mention-pop button:hover { background: #F1F5FF; }
.avatar-fallback.sm { width: 22px; height: 22px; font-size: 11px; }

.app-ver { font-size: 11px; color: var(--faint, #9CA3AF); margin-left: 6px; }

/* ---- v17：公告群組、交辦規則、完成對話框 ---- */
.form-foot.foot-apart { justify-content: space-between; }
.form-foot.foot-apart .btn { min-width: 112px; }
.ann-state { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 10px; }
.ann-state.unread { background: #FFE8CC; color: #D9480F; }
.ann-state.read { background: #EBFBEE; color: #2B8A3E; }
.ann-hint { background: #FFF4E6; color: #D9480F; }
.gchip-me { border-style: dashed; }
.newgroup-kind { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--sub); white-space: nowrap; }
.user-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; width: 100%; }
.user-vacation { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; width: 100%; }
.user-vacation { font-size: 13px; color: var(--sub); gap: 6px 12px; }
.user-vacation select, .user-vacation input { margin-left: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; background: #fff; font-size: 13px; }
.user-vacation input { width: 9em; }
.user-vacation .muted { font-size: 12px; }

/* 人員分類清單（帳號管理） */
.tag-admin { padding: 12px 16px; margin-bottom: 12px; }
.tag-admin-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 8px; }
.tag-admin-head .muted { font-size: 12px; }
.tag-admin-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tag-item { display: inline-flex; align-items: center; gap: 4px; cursor: default; }
.tag-x { border: 0; background: none; color: inherit; font-size: 15px; line-height: 1; padding: 0 2px; cursor: pointer; opacity: .6; }
.tag-x:hover { opacity: 1; color: #E03131; }
.tag-admin-add { display: flex; gap: 8px; max-width: 420px; }
.tag-admin-add input { flex: 1; min-width: 0; }
.admin-newgroup .newgroup-kind input { width: auto; flex: none; margin: 0; }
.tag-admin-add input { border: 1px solid var(--line, #E5E7EB); border-radius: 8px; padding: 8px 10px; font: inherit; background: #fff; }

.gchip-auto { cursor: default; opacity: .75; border-style: dashed; }

/* 公告每日提醒（2026-10-08） */
.remind-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.remind-row input[type=checkbox] { width: auto; }
.remind-row input[type=date] { width: auto; }
.pin-badge { font-size: 12px; color: #b9770e; }
.remind-who { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.remind-edit-tools { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.remind-edit .f-people { max-height: 220px; overflow-y: auto; }
.btn-sm { padding: 4px 12px; font-size: 13px; min-height: 0; }
/* 部門任務總覽（2026-10-14） */
.team-ov { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.team-ov-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-weight: 700; margin-bottom: 6px; }
.team-ov-head .muted { font-weight: 400; font-size: 12px; }
.team-ov-head .link-btn { margin-left: auto; }
.team-br + .team-br { border-top: 1px solid var(--line); }
.team-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 4px; font-size: 13px; border-radius: 8px; }
.team-row.picked { background: #eef6ff; }
.team-br-row { font-weight: 600; }
.team-fold { width: 18px; border: 0; background: none; cursor: pointer; color: var(--sub); padding: 0; font-size: 13px; }
.team-name { min-width: 110px; color: inherit; text-decoration: none; }
.team-name:hover { text-decoration: underline; }
.team-n { color: var(--sub); white-space: nowrap; }
.team-n b { color: var(--text, #222); }
.team-n.bad, .team-n.bad b { color: #d6336c; }
.team-n.good b { color: #2b8a3e; }
.team-old { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }
.team-pick { font-size: 12px; margin-top: 6px; }
.gchip:disabled.not-assignable { text-decoration: line-through; }
.sys-admin .sys-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; font-size: 14px; }
.sys-admin select { border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; background: #fff; font-size: 13px; }
.sys-admin input[type=checkbox] { width: auto; }
.user-dept { font-size: 13px; color: var(--sub); }
.user-warn { font-size: 12px; color: #c0392b; }
.user-cross { font-size: 13px; }
.user-cross input { width: auto; margin-right: 4px; }
/* 留言回覆（2026-10-15） */
.comment-quote { display: block; margin: 4px 0 2px; padding: 4px 8px; border-left: 3px solid var(--line); background: #f6f7f9; border-radius: 4px;
  font-size: 12px; color: var(--sub); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comment.flash { background: #fff8db; transition: background .3s; border-radius: 8px; }
.reply-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; margin-bottom: 6px; background: #eef6ff; border-radius: 8px; font-size: 12px; color: var(--sub); }
.reply-bar span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comment-hint { font-size: 11px; margin-bottom: 4px; }
/* 留言已讀（2026-10-16） */
.comment-read { margin-top: 4px; font-size: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.comment-read .link { font-size: 12px; color: var(--sub); }
.comment-read .link.done { color: #2b8a3e; }
.comment-me { color: #d6336c; font-size: 12px; }
.comment-read-list { flex-basis: 100%; display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; background: #f6f7f9; border-radius: 6px; }
.comment-read-list .r-yes { color: #2b8a3e; }
.comment-read-list .r-no { color: var(--sub); }

/* 自訂圖示（2026-10-21）：SVG 線條圖示 */
svg.ic { display: block; flex: none; }
.nav-ico { display: flex; align-items: center; justify-content: center; flex: none; }
.nav-dot-end { margin: 0 2px 0 6px; }
.shortcut .ico { display: flex; justify-content: center; height: 28px; align-items: center; }
.group-icon-svg { background: #f1f5f9; }
.btn-ico { display: inline-flex; align-items: center; gap: 6px; }
.icon-admin .icon-sec { font-size: 13px; color: var(--sub); margin: 10px 0 4px; }
.icon-rows { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; }
.icon-row { display: flex; align-items: center; gap: 8px; padding: 4px; border-radius: 8px; min-width: 0; }
.icon-row-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.icon-row .tag-mini { font-size: 11px; color: #0d9488; flex: none; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid #e2e8f0; background: #fff; display: grid; place-items: center; cursor: pointer; flex: none; padding: 0; }
.icon-btn:hover, .icon-btn.on { border-color: var(--green); box-shadow: 0 0 0 2px var(--green-l); }
.icon-btn .nav-dot { margin: 0; }
.icon-picker { margin-top: 10px; border: 1px solid #e2e8f0; border-radius: 12px; padding: 12px; background: #f8fafc; }
.icon-picker-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.icon-preview { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: #fff; border: 1px solid #e2e8f0; flex: none; }
.icon-picker-head input[type=search] { flex: 1; min-width: 140px; padding: 7px 10px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 14px; }
.icon-colors { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.icon-color { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #cbd5e1; cursor: pointer; padding: 0; }
.icon-color.on { box-shadow: 0 0 0 2px #0f172a; }
.icon-cat { font-size: 12px; color: #64748b; margin: 8px 0 4px; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 4px; max-height: 260px; overflow-y: auto; }
.icon-grid button { height: 40px; border: 1px solid transparent; border-radius: 8px; background: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.icon-grid button:hover { border-color: #cbd5e1; }
.icon-grid button.on { border-color: var(--green); background: var(--green-l); }
.icon-picker-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; flex-wrap: wrap; }
.team-n.pub b { color: #1C7ED6; }
