/* 任務平台 — 品牌設計系統（超纖日記：深棕 × 金黃 × 奶油，自動跟隨系統深淺色） */

:root {
  color-scheme: light dark;
  --qh-bg: light-dark(#f6efe2, #17120e);
  --qh-surface: light-dark(#fffdf7, #231b13);
  --qh-surface-2: light-dark(#f0e6d2, #30261a);
  --qh-ink: light-dark(#2a1f14, #f0e7d6);
  --qh-muted: light-dark(#7d6b52, #b6a388);
  --qh-line: light-dark(#e8dcc3, #3d3121);
  --qh-primary: light-dark(#40261b, #e3b23f);
  --qh-primary-strong: light-dark(#2e1d12, #c9922e);
  --qh-primary-soft: light-dark(#f3e7d0, #35261a);
  --qh-accent: light-dark(#c9922e, #e3b23f);
  --qh-accent-soft: light-dark(#fbf0d9, #3c2d12);
  --qh-danger: #c2410c;
  --qh-green: #3e7a5a;
  --qh-blue: #2563eb;
  --qh-purple: #7c3aed;
  --qh-gray: #8a7557;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(42, 31, 20, .10);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--qh-bg);
  color: var(--qh-ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}
button { font: inherit; cursor: pointer; }
input, select, textarea {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--qh-line);
  border-radius: 10px;
  background: var(--qh-surface);
  color: var(--qh-ink);
  width: 100%;
}
label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--qh-muted); margin-bottom: 10px; }
.hidden { display: none !important; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.error-text { color: var(--qh-danger); font-size: 14px; }
.view-hint { color: var(--qh-muted); font-size: 12px; margin: 0 0 12px; }

/* buttons */
.btn {
  background: transparent;
  border: 1px solid var(--qh-line);
  border-radius: 10px;
  padding: 10px 16px;
  color: var(--qh-ink);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-primary { background: var(--qh-primary); border-color: transparent; color: light-dark(#fff, #2e1d12); }
.btn-ghost { color: var(--qh-muted); }
.btn-sm { padding: 8px 12px; font-size: 13px; }
.btn-danger { background: var(--qh-danger); border-color: transparent; color: #fff; }
.icon-btn { background: transparent; border: 0; font-size: 16px; color: var(--qh-muted); padding: 6px; }
.fab {
  position: fixed; right: 18px; bottom: 84px; z-index: 40;
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--qh-primary); color: light-dark(#fff, #2e1d12);
  border: 0; font-size: 26px; box-shadow: 0 6px 18px rgba(42,31,20,.28);
}

/* auth */
.auth-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { background: var(--qh-surface); border: 1px solid var(--qh-line); border-radius: 18px; box-shadow: var(--shadow); padding: 30px 26px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; }
.auth-card h1 { margin: 0; font-size: 20px; }
.auth-sub { color: var(--qh-muted); font-size: 14px; margin: 0 0 6px; }
.brand-lg { display: flex; align-items: center; gap: 10px; }
.brand-lg h1 { font-size: 20px; }

.brand-mark {
  width: 26px; height: 26px; border-radius: 8px; flex: 0 0 26px;
  background: linear-gradient(135deg, var(--qh-primary), var(--qh-accent));
}

/* shell */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex: 0 0 232px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 16px;
  padding: 18px 12px;
  background: var(--qh-surface);
  border-right: 1px solid var(--qh-line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; padding: 0 8px; }
.campaign { background: var(--qh-primary-soft); color: var(--qh-primary-strong); border-radius: 12px; padding: 12px; font-size: 12px; }
.campaign b { display: block; margin-bottom: 3px; }
.side-nav { display: flex; flex-direction: column; gap: 3px; }
.side-nav button {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px; border: 0;
  background: transparent; color: var(--qh-muted); font-size: 14px; text-align: left;
}
.side-nav button.active { background: var(--qh-primary-soft); color: var(--qh-primary-strong); font-weight: 700; }
.side-nav button:hover { background: var(--qh-surface-2); }
.side-user { margin-top: auto; display: flex; align-items: center; gap: 9px; padding: 12px 8px; border-top: 1px solid var(--qh-line); }
.side-user-id { flex: 1; min-width: 0; }
.side-user-id b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-id span { font-size: 11px; color: var(--qh-muted); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: 0 0 32px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--qh-primary); color: light-dark(#fff, #2e1d12);
  font-size: 12px; font-weight: 700;
}

.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 20px 22px 14px;
  max-width: 1120px; margin: 0 auto;
}
.topbar h1 { margin: 0; font-size: 19px; }
.topbar h1 small { display: block; font-size: 12px; color: var(--qh-muted); font-weight: 400; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.campaign-chip { background: var(--qh-accent-soft); color: var(--qh-accent); border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 600; }

.view { padding: 4px 22px 40px; max-width: 1120px; margin: 0 auto; }

/* stats / seg / chips / filters */
.stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.stat { background: var(--qh-surface); border: 1px solid var(--qh-line); border-radius: 12px; padding: 9px 14px; font-size: 12px; color: var(--qh-muted); }
.stat b { display: block; font-size: 17px; color: var(--qh-ink); }
.seg { display: inline-flex; gap: 2px; background: var(--qh-surface-2); border-radius: 10px; padding: 3px; margin-bottom: 10px; }
.seg button { padding: 7px 15px; border: 0; border-radius: 8px; background: transparent; font-size: 13px; color: var(--qh-muted); }
.seg button.active { background: var(--qh-surface); color: var(--qh-ink); font-weight: 700; box-shadow: 0 1px 3px rgba(42,31,20,.14); }
.chips-row { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.chips-row button { border: 1px solid var(--qh-line); border-radius: 999px; padding: 5px 12px; background: transparent; font-size: 12px; color: var(--qh-muted); }
.chips-row button.active { background: var(--qh-accent-soft); border-color: var(--qh-accent); color: var(--qh-accent); font-weight: 700; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 14px; }

/* task cards */
.task-list { display: flex; flex-direction: column; gap: 10px; }
.task-card { background: var(--qh-surface); border: 1px solid var(--qh-line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; cursor: pointer; }
.task-card:hover { border-color: var(--qh-accent); }
.tc-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.tc-head h3 { margin: 0; font-size: 15px; line-height: 1.4; }
.tc-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--qh-muted); }
.tc-foot { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.progress { flex: 1; height: 6px; background: var(--qh-surface-2); border-radius: 999px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--qh-accent); border-radius: 999px; }
.pct { font-size: 11px; color: var(--qh-muted); min-width: 32px; text-align: right; }

/* chips */
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.chip-p0 { background: #fee2e2; color: #c2410c; }
.chip-p1 { background: #ffedd5; color: #d97706; }
.chip-p2 { background: #e0f2fe; color: var(--qh-blue); }
.chip-p3 { background: var(--qh-surface-2); color: var(--qh-gray); }
.chip-STABLE { background: var(--qh-surface-2); color: var(--qh-gray); }
.chip-REQUESTED { background: #fef3c7; color: #b45309; }
.chip-CLAIMED { background: #ede9fe; color: var(--qh-purple); }
.chip-IN_PROGRESS { background: #dbeafe; color: var(--qh-blue); }
.chip-SUSPENDED { background: #e7e5e4; color: #78716c; }
.chip-DONE { background: #dcfce7; color: var(--qh-green); }
.chip-PENDING { background: #fef3c7; color: #b45309; }
.chip-ACTIVE { background: #dcfce7; color: var(--qh-green); }
.chip-cat { background: var(--qh-primary-soft); color: var(--qh-primary-strong); }

/* board */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 14px; }
.board-col { flex: 0 0 226px; background: var(--qh-surface-2); border-radius: var(--radius); padding: 10px; border: 1px solid transparent; }
.board-col.drag-over { border-color: var(--qh-accent); outline: 2px dashed var(--qh-accent); }
.col-head { display: flex; align-items: center; gap: 7px; margin: 2px 6px 10px; font-size: 12px; color: var(--qh-muted); font-weight: 700; }
.col-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; }
.board-mini { background: var(--qh-surface); border: 1px solid var(--qh-line); border-radius: 11px; padding: 10px; margin-bottom: 9px; cursor: grab; }
.board-mini.dragging { opacity: .45; }
.board-mini h4 { margin: 0 0 7px; font-size: 12.5px; line-height: 1.35; }
.bmm { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--qh-muted); }
.mini-bar { flex: 1; min-width: 30px; height: 4px; background: var(--qh-surface-2); border-radius: 999px; overflow: hidden; }
.mini-bar i { display: block; height: 100%; background: var(--qh-accent); }
.mini-move { margin-left: auto; background: transparent; border: 0; color: var(--qh-muted); padding: 2px 4px; }

/* cards / lists */
.card { background: var(--qh-surface); border: 1px solid var(--qh-line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 10px; }
.card-list { display: flex; flex-direction: column; gap: 10px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-head h2 { margin: 0; font-size: 17px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.empty { text-align: center; color: var(--qh-muted); padding: 44px 0; }

/* resource */
.resource-card .rc-usage { margin-top: 12px; border-top: 1px solid var(--qh-line); padding-top: 10px; font-size: 13px; }
.resource-card .rc-usage b { color: var(--qh-ink); }
.resource-card ul { margin: 6px 0 0; padding-left: 18px; color: var(--qh-muted); font-size: 13px; }
.resource-card li { margin-bottom: 4px; }

/* modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(35, 27, 19, .48);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: var(--qh-surface); border: 1px solid var(--qh-line);
  border-radius: 18px 18px 0 0;
  width: 100%; max-width: 660px; max-height: 88vh; overflow-y: auto;
  padding: 18px 18px 26px;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-close { background: transparent; border: 0; font-size: 18px; color: var(--qh-muted); }
.detail-section { margin-top: 14px; border-top: 1px solid var(--qh-line); padding-top: 12px; }
.detail-section h4 { margin: 0 0 8px; font-size: 12px; color: var(--qh-muted); text-transform: uppercase; letter-spacing: .04em; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.step-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; }
.step-item input[type=checkbox] { width: auto; }
.step-item.done span { text-decoration: line-through; color: var(--qh-muted); }
.step-item .del { margin-left: auto; background: transparent; border: 0; color: var(--qh-danger); }
.follow-list { color: var(--qh-muted); font-size: 13px; }
.move-list { display: flex; flex-direction: column; gap: 8px; }
.move-list button { border: 1px solid var(--qh-line); border-radius: 10px; padding: 12px; background: var(--qh-surface); color: var(--qh-ink); font-size: 14px; text-align: left; }
.move-list button:hover { border-color: var(--qh-accent); background: var(--qh-accent-soft); }

/* mobile bottom nav */
.mnav {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  justify-content: space-around;
  padding: 6px 4px 14px;
  background: var(--qh-surface);
  border-top: 1px solid var(--qh-line);
}
.mnav button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; color: var(--qh-muted); background: transparent; border: 0; padding: 4px 10px; }
.mnav button span { font-size: 18px; }
.mnav button.active { color: var(--qh-accent); font-weight: 700; }

/* responsive */
@media (max-width: 899px) {
  .sidebar { display: none; }
  .topbar { padding: 14px 16px 10px; }
  .topbar h1 { font-size: 17px; }
  .view { padding: 4px 14px 96px; }
  .mnav { display: flex; }
  .fab { display: flex; align-items: center; justify-content: center; }
  .form-grid { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .board-col { flex-basis: 210px; }
}
@media (min-width: 900px) {
  .fab { display: none; }
  .modal-overlay { align-items: center; }
  .modal { border-radius: 18px; }
}
