/* 할 일 보드 — 체크리스트의 '보드' 보기 (public/js/board/*, 2026-10-24). 색은 tokens.css 의 것만 빌려 써요 (밝은 · 어두운 화면 둘 다). */
:root {
  --tb-blue: var(--c-blue); --tb-green: var(--c-green); --tb-amber: var(--c-amber); --tb-rose: var(--c-rose);
  --tb-violet: var(--c-violet); --tb-teal: var(--c-teal, #2A9DA8); --tb-orange: var(--sys-orange); --tb-gray: var(--ink-3);
  --tb-red: var(--sys-red);
  --tb-col-bg: var(--track);
  --tb-card-bg: var(--glass-3);
}

/* 보드 | 목록 */
.ck-mode { margin-left: 4px; background: var(--track); border-radius: 10px; }
.ck-mode button { border-radius: 8px; }
.ck-mode [aria-selected="true"] { background: var(--glass-3); box-shadow: var(--e-2); }

.ck.tb { max-width: 1280px; gap: 16px; }
.tb-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.tb-title { font-size: 38px; letter-spacing: -.02em; }
.tb-sum { margin: 6px 0 0; color: var(--ink-2); font-size: 14px; }
.tb-sum b { color: var(--ink); font-variant-numeric: tabular-nums; }
.tb-new { gap: 6px; padding: 9px 14px; border-radius: 12px; flex: none; }

/* 숫자 칩 */
.tb-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tb-kpi { display: flex; align-items: baseline; gap: 8px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); text-align: left; cursor: pointer; transition: background var(--d-fast) var(--ease), border-color var(--d-fast) var(--ease); }
.tb-kpi b { font: 650 24px/1 var(--font-display); color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tb-kpi span { font-size: 13px; }
.tb-kpi:hover { background: var(--hover); }
.tb-kpi.warn b { color: var(--tb-red); }
.tb-kpi.on { border-color: var(--ink); background: var(--accent-soft); }

/* 필터 */
.tb-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tb-range { background: var(--track); border-radius: 10px; }
.tb-range [aria-selected="true"] { background: var(--glass-3); box-shadow: var(--e-2); border-radius: 8px; }
.tb-fbtn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--ink-2); font: 500 13px var(--font); cursor: pointer; max-width: 200px; }
.tb-fbtn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-fbtn:hover { background: var(--hover); }
.tb-fbtn.on { color: var(--ink); border-color: var(--ink); }
.tb-search { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); color: var(--ink-3); flex: 1 1 220px; max-width: 360px; }
.tb-search input { border: 0; background: transparent; outline: 0; color: var(--ink); font: 13.5px var(--font); width: 100%; min-width: 0; }
.tb-search:focus-within { border-color: var(--line-2); box-shadow: 0 0 0 3px var(--accent-soft); }

/* 칸 */
.tb-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 12px; align-items: start; overflow-x: auto; padding: 2px 2px 14px; scrollbar-width: thin; }
.tb-col { display: flex; flex-direction: column; gap: 8px; min-height: 220px; padding: 10px; border-radius: 18px; background: var(--tb-col-bg); }
.tb-col-h { display: flex; align-items: center; gap: 8px; padding: 2px 4px 2px 6px; min-height: 30px; }
.tb-col-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--ink-3); }
.tb-col-dot.tb-k-doing { background: var(--tb-blue); } .tb-col-dot.tb-k-done { background: var(--tb-green); } .tb-col-dot.tb-k-own { background: var(--tb-violet); }
.tb-col-name { margin: 0; font: 600 14px var(--font); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: text; }
.tb-count { font: 600 12px var(--font); color: var(--ink-3); font-variant-numeric: tabular-nums; background: var(--hover); padding: 1px 7px; border-radius: 999px; }
.tb-col-act { margin-left: auto; display: inline-flex; gap: 2px; }
.tb-more { font-size: 16px; line-height: 1; letter-spacing: 1px; }
.tb-col-in { height: 28px; font-weight: 600; flex: 1; min-width: 0; }
.tb-add .input { width: 100%; }
.tb-body { display: flex; flex-direction: column; gap: 8px; min-height: 64px; }
.tb-empty { margin: 0; padding: 18px 8px; text-align: center; color: var(--ink-3); font-size: 12.5px; border: 1.5px dashed var(--line); border-radius: 12px; }
.tb-body:has(.tb-card) .tb-empty { display: none; }
.tb-addcol { align-self: start; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 52px; padding: 0 16px; border-radius: 18px; border: 1.5px dashed var(--line-2); background: transparent; color: var(--ink-3); font: 500 13px var(--font); cursor: pointer; }
.tb-addcol:hover { color: var(--ink); background: var(--hover); }

/* 카드 */
.tb-card { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 12px 12px 11px; border-radius: 14px; background: var(--tb-card-bg); border: 1px solid var(--line); box-shadow: var(--e-2); cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: box-shadow var(--d-fast) var(--ease), border-color var(--d-fast) var(--ease); }
.tb-card:hover { border-color: var(--line-2); box-shadow: var(--e-3); }
.tb-card:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.tb-card-top { display: flex; flex-wrap: wrap; gap: 6px; }
.tb-proj, .tb-flag { display: inline-flex; align-items: center; gap: 4px; height: 21px; padding: 0 8px; border-radius: 6px; font: 600 11.5px var(--font); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.tb-proj { --tc: var(--tb-gray); background: color-mix(in srgb, var(--tc) 16%, transparent); color: color-mix(in srgb, var(--tc) 72%, var(--ink)); }
.tb-flag { background: var(--hover); color: var(--ink-2); }
.tb-flag.p-max { background: color-mix(in srgb, var(--tb-red) 15%, transparent); color: color-mix(in srgb, var(--tb-red) 85%, var(--ink)); }
.tb-flag.p-xhigh { background: color-mix(in srgb, var(--tb-orange) 17%, transparent); color: color-mix(in srgb, var(--tb-orange) 80%, var(--ink)); }
.tb-card-main { display: flex; align-items: flex-start; gap: 9px; }
.tb-check { flex: none; display: grid; place-items: center; width: 19px; height: 19px; margin-top: 1px; padding: 0; border-radius: 50%; border: 1.5px solid var(--line-2); background: transparent; color: transparent; cursor: pointer; transition: background var(--d-fast) var(--ease), border-color var(--d-fast) var(--ease); }
.tb-check:hover { border-color: var(--ink-2); color: var(--ink-3); }
.tb-card.done .tb-check { background: var(--tb-green); border-color: var(--tb-green); color: #fff; }
.tb-text { margin: 0; font: 500 14.5px/1.4 var(--font); color: var(--ink); overflow-wrap: anywhere; }
.tb-card.done .tb-text { color: var(--ink-3); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--ink-3) 70%, transparent); }
.tb-prog { display: flex; align-items: center; gap: 8px; }
.tb-bar { flex: 1; height: 4px; border-radius: 4px; background: var(--track); overflow: hidden; }
.tb-bar i { display: block; height: 100%; width: var(--f, 0%); background: var(--tb-green); border-radius: inherit; transition: width var(--d-base) var(--ease); }
.tb-bar.tb-bar-lg { height: 6px; display: block; flex: none; margin: 2px 0 6px; }
.tb-subn { font: 600 11.5px var(--font); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tb-meta { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 12px; }
.tb-due, .tb-day { display: inline-flex; align-items: center; gap: 4px; }
.tb-due.late { color: var(--tb-red); font-weight: 600; }
.tb-noteic { display: inline-flex; margin-left: auto; }

/* 끄는 중 */
.tb-card.is-ph { background: transparent; border: 1.5px dashed var(--line-2); box-shadow: none; }
.tb-card.is-ph > * { visibility: hidden; }
.tb-ghost { position: fixed !important; z-index: 1000; margin: 0; pointer-events: none; cursor: grabbing; box-shadow: var(--e-4), 0 0 0 1px var(--line-2); transform-origin: 30% 50%; will-change: transform; }
.tb-ghost.drop { transition: transform .16s var(--ease); }
body.tb-dragging, body.tb-dragging * { cursor: grabbing !important; }
body.tb-dragging .tb-board { scroll-snap-type: none; } /* 폰: 끄는 동안 칸 자석을 꺼야 저절로 옆 칸으로 넘어가요 */
body.tb-dragging .tb-col:has(.is-ph) { background: color-mix(in srgb, var(--tb-col-bg) 100%, var(--accent-soft)); box-shadow: inset 0 0 0 1.5px var(--line-2); }

/* 폰: 칸 하나씩 옆으로 넘기기 + 아래 칸 고르기(엄지 자리) */
.tb-tabs { display: none; }
@media (max-width: 760px) {
  .ck.tb { padding-bottom: 12px; gap: 12px; }
  .tb-title { font-size: 30px; }
  .tb-new span { display: none; }
  .tb-new { padding: 9px; }
  .tb-kpis { gap: 6px; }
  .tb-kpi { flex-direction: column; gap: 3px; padding: 9px 10px; border-radius: 12px; }
  .tb-kpi b { font-size: 19px; }
  .tb-kpi span { font-size: 11.5px; white-space: nowrap; }
  .tb-range { flex: 1 1 100%; display: flex; }
  .tb-range button { flex: 1; }
  .tb-search { flex-basis: 100%; max-width: none; order: 5; }
  .tb-fbtn { flex: 1 1 0; min-width: 0; max-width: none; justify-content: space-between; }
  .tb-board { grid-auto-columns: calc(100% - 26px); scroll-snap-type: x mandatory; gap: 10px; padding: 2px 2px 8px; scrollbar-width: none; overscroll-behavior-x: contain; }
  .tb-board::-webkit-scrollbar { display: none; }
  .tb-col { scroll-snap-align: start; min-height: 46vh; }
  .tb-addcol { scroll-snap-align: start; min-height: 46vh; width: 100%; }
  .tb-col-act .icon-btn { width: 34px; height: 34px; }
  .tb-check { width: 24px; height: 24px; }
  .tb-tabs { position: sticky; bottom: 6px; z-index: 5; display: flex; gap: 4px; padding: 4px; margin: 0 auto; width: max-content; max-width: 100%; overflow-x: auto; border-radius: 999px; background: var(--glass); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border: 1px solid var(--glass-edge); box-shadow: var(--e-3); scrollbar-width: none; }
  .tb-tabs button { flex: none; min-height: 40px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--ink-2); font: 500 13.5px var(--font); white-space: nowrap; }
  .tb-tabs button b { font-weight: 600; color: var(--ink-3); margin-left: 2px; }
  .tb-tabs button[aria-current="true"] { background: var(--ink); color: var(--on-ink); }
  .tb-tabs button[aria-current="true"] b { color: inherit; opacity: .7; }
}

/* 자세히: 컴퓨터는 오른쪽 서랍 · 폰은 아래 시트 */
.tb-sheet { position: fixed; inset: 0; z-index: 70; }
.tb-sheet-back { position: absolute; inset: 0; background: rgba(0, 0, 0, .32); opacity: 0; transition: opacity .18s ease-out; }
.tb-panel { position: absolute; top: 10px; right: 10px; bottom: 10px; width: min(440px, calc(100% - 20px)); overflow-y: auto; display: flex; flex-direction: column; gap: 16px; padding: 16px 20px 18px; border-radius: 20px; background: var(--paper-solid); border: 1px solid var(--line); box-shadow: var(--e-4); transform: translateX(24px); opacity: 0; transition: transform .2s var(--ease), opacity .18s ease-out; }
.tb-sheet.in .tb-sheet-back { opacity: 1; } .tb-sheet.in .tb-panel { transform: none; opacity: 1; }
.tb-sheet.out .tb-sheet-back { opacity: 0; } .tb-sheet.out .tb-panel { transform: translateX(24px); opacity: 0; }
.tb-s-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tb-s-col .select { min-width: 120px; }
.tb-s-title { width: 100%; resize: none; border: 0; background: transparent; color: var(--ink); font: 650 21px/1.35 var(--font-display); letter-spacing: -.02em; padding: 4px 2px; border-radius: 8px; outline: 0; field-sizing: content; min-height: 2.6em; }
.tb-s-title:focus { background: var(--hover); }
.tb-props { display: grid; grid-template-columns: 76px 1fr; gap: 10px 12px; align-items: center; }
.tb-pk { font-size: 12.5px; color: var(--ink-3); }
.tb-pv { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.tb-pv > .input { flex: 1 1 140px; min-width: 0; }
.tb-hint { font-size: 12px; }
.tb-dots { display: inline-flex; gap: 5px; }
.tb-dot { width: 18px; height: 18px; border-radius: 50%; border: 0; padding: 0; background: var(--tc); cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.tb-dot.on { box-shadow: 0 0 0 2px var(--paper-solid), 0 0 0 3.5px var(--tc); }
.tb-prios { gap: 5px; }
.tb-pchip { height: 28px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--ink-2); font: 500 12.5px var(--font); cursor: pointer; }
.tb-pchip:hover { background: var(--hover); }
.tb-pchip.on { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.tb-pchip.p-max.on { background: var(--tb-red); border-color: var(--tb-red); color: #fff; }
.tb-pchip.p-xhigh.on { background: var(--tb-orange); border-color: var(--tb-orange); color: #fff; }
.tb-quick { display: inline-flex; flex-wrap: wrap; gap: 2px; }
.tb-subs h3, .tb-notes h3 { margin: 0 0 8px; font: 600 13px var(--font); color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.tb-subs ul { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 2px; }
.tb-subs li { display: flex; align-items: center; gap: 8px; padding: 4px 4px; border-radius: 8px; }
.tb-subs li:hover { background: var(--hover); }
.tb-subs li .check { width: 17px; height: 17px; flex: none; }
.tb-sub-t { flex: 1; font-size: 14px; color: var(--ink); overflow-wrap: anywhere; }
.tb-subs li.done .tb-sub-t { color: var(--ink-3); text-decoration: line-through; }
.tb-subs li .icon-btn { opacity: .5; } .tb-subs li:hover .icon-btn { opacity: 1; }
.tb-subadd .input { width: 100%; }
.tb-notes .textarea { width: 100%; resize: vertical; min-height: 90px; }
.tb-s-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 6px; border-top: 1px solid var(--line); }
.tb-s-foot .danger { color: var(--err); gap: 5px; }
@media (max-width: 760px) {
  .tb-panel { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 88vh; border-radius: 20px 20px 0 0; padding: 14px 16px max(18px, env(safe-area-inset-bottom)); transform: translateY(30px); }
  .tb-sheet.out .tb-panel { transform: translateY(30px); }
  .tb-props { grid-template-columns: 64px 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .tb-panel, .tb-sheet-back, .tb-ghost.drop { transition: none; }
}
