@import url('vendor/pretendard/pretendardvariable-dynamic-subset.css');

:root {
  --bg: #F7F6F3; --surface: #FFFFFF; --sunk: #EFEDE8; --line: #E2DFD8;
  --text: #1F2328; --muted: #6B6F76; --faint: #9A9DA3;
  --accent: #2F4A7A; --red: #C62828; --red-bg: #FCEBEA;
  --work: #2F5D8A; --family: #B0652A; --personal: #6E4E9E; --health: #2E7D4F; --finance: #8A6D1F; --inbox: #6B6F76; --warn: #B26A00; --on-red: #FFFFFF; --on-accent: #FFFFFF;
  --bar: #2F4A7A; --bar-bg: #E6E3DC;
  --radius: 10px; --gutter: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131416; --surface: #1C1E21; --sunk: #232529; --line: #2E3135;
    --text: #E7E8EA; --muted: #9DA1A8; --faint: #6E7279;
    --accent: #8FB0E3; --red: #FF6B6B; --red-bg: #3A1E1E;
    --work: #7FA7D6; --family: #E0A06A; --personal: #B39AE0; --health: #7CC79A; --finance: #D7B95E;
    --bar: #8FB0E3; --bar-bg: #2E3135; --inbox: #9DA1A8; --warn: #E0A040; --on-red: #2A0E0E; --on-accent: #10233F; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131416; --surface: #1C1E21; --sunk: #232529; --line: #2E3135;
  --text: #E7E8EA; --muted: #9DA1A8; --faint: #6E7279;
  --accent: #8FB0E3; --red: #FF6B6B; --red-bg: #3A1E1E;
  --work: #7FA7D6; --family: #E0A06A; --personal: #B39AE0; --health: #7CC79A; --finance: #D7B95E;
  --bar: #8FB0E3; --bar-bg: #2E3135; --inbox: #9DA1A8; --warn: #E0A040; --on-red: #2A0E0E; --on-accent: #10233F; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: 'Pretendard Variable', Pretendard, -apple-system, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; word-break: keep-all; overflow-wrap: anywhere;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--muted); }

/* ── 위 막대 ── */
header.top {
  position: sticky; top: 0; z-index: 10; background: var(--bg);
  border-bottom: 1px solid var(--line); padding: 10px var(--gutter) 8px;
}
.crumbs { display: flex; gap: 4px; align-items: center; overflow-x: auto; white-space: nowrap; scrollbar-width: none; font-size: 13px; }
.crumbs::-webkit-scrollbar { display: none; }
.crumbs a { color: var(--muted); text-decoration: none; padding: 2px 2px; border-radius: 4px; }
.crumbs a.drop-hover { background: var(--sunk); color: var(--text); }
.crumbs .sep { color: var(--faint); }
.titlerow { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.titlerow h1 { font-size: 19px; font-weight: 700; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iconbtn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; height: 32px; min-width: 32px; padding: 0 10px; font-size: 13px; }
.iconbtn:hover { border-color: var(--faint); }

main { padding: 10px var(--gutter) 88px; max-width: 1400px; margin: 0 auto; }

/* ── 아래 막대 ── */
nav.bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex;
  background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
nav.bottom a { flex: 1; text-align: center; padding: 8px 0 9px; font-size: 12px; color: var(--muted); text-decoration: none; position: relative; }
nav.bottom a.on { color: var(--text); font-weight: 600; }
nav.bottom .ic { display: block; font-size: 17px; line-height: 1.2; }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; font-size: 11px; line-height: 18px; background: var(--sunk); color: var(--muted); }
.badge.red { background: var(--red); color: var(--on-red); }

/* ── 대시보드 ── */
.strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 12px; display: flex; align-items: baseline; gap: 6px; text-decoration: none; color: inherit; }
.stat b { font-size: 20px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.stat.alert b { color: var(--red); }
section.block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 12px; margin-bottom: 12px; }
section.block h2 { font-size: 13px; font-weight: 600; color: var(--muted); margin: 8px 0 2px; }
.row { display: grid; grid-template-columns: 10px minmax(0, 1fr) 72px 76px; align-items: center; gap: 8px; padding: 5px 0; font-size: 14px; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.row:first-of-type { border-top: 0; }
.row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .pct { text-align: right; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.reddot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); display: inline-block; vertical-align: middle; margin-left: 4px; }
.bar { height: 5px; background: var(--bar-bg); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--bar); border-radius: 3px; }
.item { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; font-size: 14px; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.item:first-of-type { border-top: 0; }
.item .t { flex: 1; min-width: 0; }
.item .t small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .d { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.item .d.over { color: var(--red); font-weight: 600; }
.empty { color: var(--muted); font-size: 13px; padding: 8px 0; }
.group { font-size: 12px; color: var(--muted); margin: 6px 0 0; }

/* ── 보드 ── */
.board { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; margin: 0 calc(-1 * var(--gutter)); padding-left: var(--gutter); padding-right: var(--gutter); scroll-padding: 0 var(--gutter); }
.col { flex: 0 0 min(84vw, 300px); scroll-snap-align: start; background: var(--sunk); border-radius: var(--radius); padding: 8px; display: flex; flex-direction: column; max-height: calc(100vh - 190px); }
.col h2 { font-size: 13px; font-weight: 600; margin: 2px 4px 8px; display: flex; gap: 6px; align-items: center; }
.col h2 .n { color: var(--muted); font-weight: 500; }
.list { flex: 1; overflow-y: auto; min-height: 40px; display: flex; flex-direction: column; gap: 6px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; display: block; text-decoration: none; color: inherit; position: relative; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-user-drag: none; }
.card .ttl { font-weight: 500; padding-right: 22px; }
.card .kind { font-size: 11px; color: var(--muted); line-height: 1.2; margin-bottom: 1px; }
.card .meta { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.card .meta .over { color: var(--red); font-weight: 600; }
.card .more { position: absolute; top: 4px; right: 4px; border: 0; background: none; color: var(--muted); width: 28px; height: 28px; border-radius: 6px; font-size: 16px; }
.card .more:hover { background: var(--sunk); color: var(--text); }
.card .bar { margin-top: 6px; }
.card.pending { border-color: var(--red); }
.card.done .ttl { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.card.paused { background: var(--sunk); border-style: dashed; }
.tag { font-size: 11px; padding: 0 6px; border-radius: 4px; background: var(--sunk); color: var(--muted); line-height: 18px; }
.tag.red { background: var(--red-bg); color: var(--red); }
.sortable-ghost { opacity: .35; }
.sortable-chosen { box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.addcard { margin-top: 6px; border: 0; background: none; color: var(--muted); text-align: left; padding: 6px 4px; border-radius: 6px; font-size: 13px; }
.addcard:hover { background: var(--surface); color: var(--text); }
.addform textarea { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px; resize: none; }
.boardhead { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.boardhead .bar { width: 120px; }
.notice { background: var(--sunk); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; font-size: 13px; }
.notice.red { background: var(--red-bg); border-color: var(--red); }
.desc { white-space: pre-wrap; font-size: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; max-height: 6.5em; overflow: hidden; position: relative; }
.desc.open { max-height: none; }

@media (min-width: 900px) {
  .board { overflow-x: auto; scroll-snap-type: none; }
  .col { flex: 0 0 290px; max-height: calc(100vh - 170px); }
  nav.bottom { left: 50%; transform: translateX(-50%); max-width: 520px; border: 1px solid var(--line); border-bottom: 0; border-radius: 12px 12px 0 0; }
  .dash { display: grid; grid-template-columns: 1.3fr 1fr; gap: 12px; align-items: start; }
  .dash .strip { grid-column: 1 / -1; }
}

/* ── 시트(아래에서 올라오는 창) ── */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; border-radius: 14px 14px 0 0; padding: 14px var(--gutter) calc(20px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { .scrim { align-items: center; } .sheet { border-radius: 14px; max-height: 86vh; } }
.sheet h2 { font-size: 17px; margin: 0 0 10px; display: flex; gap: 8px; align-items: center; }
.sheet h2 span { flex: 1; }
.field { display: block; margin-bottom: 10px; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 10px; }
.field textarea { min-height: 120px; resize: vertical; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btns { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 7px 12px; font-size: 14px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
:root[data-theme="dark"] .btn.primary { color: #111; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { color: #111; } }
.btn.danger { color: var(--red); }
.timeline { border-top: 1px solid var(--line); margin-top: 6px; }
.ev { font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.ev .who { color: var(--muted); font-size: 12px; }
.ev.pause { color: var(--text); }
.choice { display: block; width: 100%; text-align: left; margin-bottom: 6px; }
.pick { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 10px 2px; }
.pick:hover { background: var(--sunk); }
.colrow { display: grid; grid-template-columns: 1fr auto auto 56px auto auto; gap: 6px; align-items: center; margin-bottom: 6px; }
.colrow input[type=text] { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 6px 8px; min-width: 0; }
.colrow label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.toast { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: 8px; font-size: 14px; z-index: 60; max-width: 90vw; }
.links a { color: var(--accent); }
.search input { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }

.two > input, .two > textarea { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.two > textarea { resize: vertical; }
.no { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 500; margin-right: 1px; }

/* ── 3.5단계 ── */
.quick { margin-bottom: 10px; }
.quick input { width: 100%; font: inherit; font-size: 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.quick input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.help { border: 1px solid var(--line); background: none; color: var(--muted); border-radius: 50%; width: 20px; height: 20px; font-size: 11px; margin-left: 6px; padding: 0; vertical-align: middle; }
.pz { font-size: 11px; color: var(--muted); margin-left: 5px; font-variant-numeric: tabular-nums; }
.card.old { opacity: .55; }
.card.old:hover { opacity: 1; }
.col.wip-over > h2 { color: var(--warn); }
.col.wip-over > h2 .n { color: var(--warn); font-weight: 700; }
.acts { display: flex; gap: 6px; }
a.iconbtn, a.btn { display: inline-flex; align-items: center; text-decoration: none; color: inherit; }
.tree .trow { display: flex; justify-content: space-between; gap: 8px; padding: 8px 4px; border-top: 1px solid var(--line); text-decoration: none; color: inherit; font-size: 14px; }
.tree .trow:first-child { border-top: 0; }
.tree .trow small { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tree .trow.done .t { color: var(--muted); text-decoration: line-through; }
.tree .trow.pending .t { color: var(--red); }
.checklist { display: flex; flex-direction: column; gap: 4px; }
.clrow { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 14px; }
.clrow .iconbtn { height: 24px; min-width: 24px; padding: 0 6px; }
.tplsel { font: inherit; font-size: 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); padding: 6px; }
.togs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin: 10px 0; }
@media (max-width: 520px) { .togs { grid-template-columns: 1fr; } }
.tog { font-size: 14px; display: flex; align-items: center; gap: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0; font-size: 14px; }
.qacts { display: flex; gap: 4px; }
.qacts .iconbtn { height: 28px; min-width: 28px; padding: 0 8px; }
.colrow input.wip { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 6px; width: 56px; color: var(--text); }
