/* ── 팔레트 (화이트 계열) ─────────────────────────────────────────── */
:root {
  --bg:          #f4f6f8;   /* 페이지 배경 */
  --col:         #eceff3;   /* 칸반 칸 배경 */
  --surface:     #ffffff;   /* 카드 */
  --surface-alt: #f8fafc;
  --line:        #dfe4ea;
  --line-soft:   #eaeef3;

  --text:        #16202b;   /* 본문 */
  --text-dim:    #5a6875;   /* 보조 */
  --text-mute:   #8593a1;   /* 흐림 */

  --accent:      #2563eb;
  --urgent:      #dc2626;
  --warn:        #d97706;
  --ok:          #15803d;

  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 32, 48, .06), 0 1px 3px rgba(16, 32, 48, .04);
  --shadow-md: 0 2px 6px rgba(16, 32, 48, .08), 0 6px 16px rgba(16, 32, 48, .07);
  --shadow-lg: 0 10px 30px rgba(16, 32, 48, .16);

  /* 모션 — motion.dev 예제의 스프링 감각을 네이티브 이징으로 옮긴 값 */
  --ease-out:  cubic-bezier(.22, 1, .36, 1);
  --ease-back: cubic-bezier(.34, 1.4, .64, 1);
  /* 감쇠 스프링(stiffness 400 / damping 22)을 샘플링한 값 — 12% 정도 튕깁니다 */
  --ease-spring: linear(0,0.1028,0.3311,0.5888,0.8149,0.9803,1.0794,1.1216,1.123,1.1007,1.0689,1.0375,1.0124,0.9955,0.9867,0.984,0.9855,0.9891,0.9933,0.9969,0.9996,1.0012,1.0019,1.002,1);
}

* { box-sizing: border-box; }

/* display:flex/grid 를 준 요소는 hidden 속성만으로 숨겨지지 않으므로 명시적으로 눌러줍니다. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Hahmlet', 'Apple SD Gothic Neo', -apple-system, BlinkMacSystemFont, system-ui, serif;
  font-size: 14px;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'tnum';   /* 숫자 폭 고정 — 카운터가 덜컹거리지 않게 */
}

body { display: flex; flex-direction: column; overflow: hidden; }

button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 11px;
  outline: none;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
textarea { resize: vertical; min-height: 92px; line-height: 1.6; }
select {
  appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%), linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position: right 13px center, right 8px center;
  background-size: 5px 5px; background-repeat: no-repeat; padding-right: 28px;
}

/* ── 버튼 ───────────────────────────────────────────────────────── */
.btn {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 13px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: background .15s, border-color .15s, transform .12s var(--ease-out), box-shadow .15s;
}
.btn:hover { background: var(--surface-alt); border-color: #cdd5de; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500; }
.btn.primary:hover { background: #1d4fd8; border-color: #1d4fd8; }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.ghost:hover { background: rgba(22, 32, 43, .05); }
.btn.danger { color: var(--urgent); border-color: #f3c4c4; }
.btn.danger:hover { background: #fef2f2; }
.btn.icon { padding: 7px 10px; }
.btn.full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.badge {
  background: var(--urgent); color: #fff; border-radius: 999px;
  padding: 0 6px; font-size: 11px; font-weight: 700; min-width: 18px; text-align: center;
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* ── 로그인 ─────────────────────────────────────────────────────── */
.login-page {
  align-items: center; justify-content: center;
  background: radial-gradient(900px 520px at 50% -5%, #e4ecfa, var(--bg));
}
.login-card {
  width: min(384px, calc(100vw - 40px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px; padding: 30px;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 15px;
  animation: cardIn .45s var(--ease-back) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.login-card h1 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -.01em; }
.login-card .sub { margin: -9px 0 4px; color: var(--text-dim); font-size: 13px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--text-dim); }
.login-card button {
  background: var(--accent); border: none; border-radius: 9px; padding: 11px;
  color: #fff; font-weight: 600; cursor: pointer; transition: background .15s, transform .12s;
}
.login-card button:hover { background: #1d4fd8; }
.login-card button:active { transform: scale(.98); }
.err { color: var(--urgent); font-size: 13px; min-height: 18px; }

/* ── 상단바 ─────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 13px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.topbar-left { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.topbar h1 {
  margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.015em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.me { color: var(--text-mute); font-size: 12px; white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-mute); pointer-events: none; }
.search input { width: 210px; padding-left: 30px; }

/* ── 부서 탭 ────────────────────────────────────────────────────── */
.deptbar {
  display: flex; gap: 2px; padding: 0 22px; overflow-x: auto;
  background: var(--surface); border-bottom: 1px solid var(--line);
  flex-shrink: 0; scrollbar-width: none;
}
.deptbar::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  background: none; border: none; padding: 11px 13px 12px;
  cursor: pointer; color: var(--text-dim); white-space: nowrap;
  display: flex; align-items: center; gap: 7px;
  transition: color .15s;
}
.tab::after {
  content: ''; position: absolute; left: 8px; right: 8px; bottom: 0; height: 2px;
  background: var(--tab-color, var(--accent)); border-radius: 2px 2px 0 0;
  transform: scaleX(0); transform-origin: center;
  transition: transform .28s var(--ease-out);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); font-weight: 700; }
.tab.active::after { transform: scaleX(1); }
.tab .swatch { width: 8px; height: 8px; border-radius: 50%; background: var(--tab-color, var(--accent)); }
.tab .cnt { color: var(--text-mute); font-size: 12px; font-weight: 400; }
.tab .overdue { color: var(--urgent); font-size: 11px; font-weight: 700; }

/* ── 요약 통계 ──────────────────────────────────────────────────── */
.stats { display: flex; gap: 9px; padding: 14px 22px 0; flex-shrink: 0; overflow-x: auto; scrollbar-width: none; }
.stats::-webkit-scrollbar { display: none; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 9px 15px; display: flex; align-items: baseline; gap: 8px; white-space: nowrap;
  box-shadow: var(--shadow-sm);
  animation: statIn .4s var(--ease-out) both;
}
@keyframes statIn { from { opacity: 0; transform: translateY(-6px); } }
.stat b { font-size: 19px; font-weight: 700; }
.stat span { color: var(--text-dim); font-size: 12px; }
.stat.alert { border-color: #f6cdcd; background: #fef4f4; }
.stat.alert b { color: var(--urgent); }
.stat.warn { border-color: #f2ddb4; background: #fffaf0; }
.stat.warn b { color: var(--warn); }
.stat.clickable { cursor: pointer; transition: transform .14s var(--ease-out), box-shadow .14s; }
.stat.clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* ── 보드 ───────────────────────────────────────────────────────── */
main { flex: 1; min-height: 0; overflow: auto; padding: 16px 22px 28px; }
.board { display: grid; grid-template-columns: repeat(4, minmax(268px, 1fr)); gap: 14px; align-items: start; min-height: 100%; }

.col {
  background: var(--col); border: 1px solid transparent; border-radius: 14px;
  padding: 11px; display: flex; flex-direction: column; gap: 8px; min-height: 150px;
  transition: background .2s, border-color .2s;
}
.col.dragover { background: #e7edf7; border-color: #bcd0f0; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 5px; }
.col-head .pill {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 12px; font-size: 12px; font-weight: 700;
}
.col-head .pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--st-color); }
.col-head .n { color: var(--text-mute); font-size: 12px; }
.col-head .add {
  margin-left: auto; background: none; border: none; color: var(--text-mute);
  cursor: pointer; font-size: 18px; line-height: 1; padding: 2px 7px; border-radius: 6px;
  transition: background .15s, color .15s, transform .12s;
}
.col-head .add:hover { color: var(--accent); background: rgba(37, 99, 235, .1); transform: scale(1.12); }

/* ── 카드 ───────────────────────────────────────────────────────── */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--pri-color);
  border-radius: var(--radius);
  padding: 11px 13px;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 7px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .18s var(--ease-out), transform .14s var(--ease-out), border-color .15s;
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); border-color: #cfd8e2; }
.card:active { transform: translateY(0) scale(.995); }

/* 드래그 중인 카드 — motion.dev 예제의 "드래그 그림자" */
.card.dragging {
  opacity: .55;
  transform: scale(1.02) rotate(-.6deg);
  box-shadow: var(--shadow-lg);
  cursor: grabbing;
}

/* 긴급 — 우선순위와 별개로 눈에 먼저 들어와야 합니다 */
.card.urgent { border-left-color: var(--urgent); background: linear-gradient(90deg, #fff6f6, var(--surface) 42%); }
.card.urgent::before {
  content: ''; position: absolute; left: -3px; top: -1px; bottom: -1px; width: 3px;
  background: var(--urgent); border-radius: 3px 0 0 3px;
  animation: urgentPulse 2.4s ease-in-out infinite;
}
@keyframes urgentPulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.card .title { font-weight: 500; line-height: 1.5; word-break: break-word; letter-spacing: -.005em; }

/* 완료 — motion.dev 예제의 취소선 스윕 */
.card .title.done { color: var(--text-mute); position: relative; display: inline-block; }
.card .title.done::after {
  content: ''; position: absolute; left: 0; top: 52%; height: 1.5px; width: 100%;
  background: var(--text-mute); transform-origin: left center;
  animation: strike .42s var(--ease-out) both;
}
@keyframes strike { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.card .snippet {
  color: var(--text-mute); font-size: 12px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

/* 카드 하단: 등록일 + 경과. 하단 여백을 채우고(왼쪽 날짜·오른쪽 오래됨 배지) 오래된 건을 눈에 띄게. */
.card .cardfoot {
  display: flex; align-items: center; gap: 6px;
  margin-top: 1px; padding-top: 8px;
  border-top: 1px solid var(--line-soft);
  font-size: 11px; color: var(--text-mute); line-height: 1;
}
.card .cardfoot .cal { display: inline-flex; opacity: .75; }
.card .cardfoot .reg { font-weight: 600; color: var(--text-dim); letter-spacing: -.01em; }
.card .cardfoot .age::before { content: '·'; margin: 0 5px; color: #c4cdd8; }
.card .cardfoot .staleflag {
  margin-left: auto; font-weight: 700; font-size: 10px;
  color: #92600b; background: #fdf0d8; border-radius: 999px; padding: 2px 7px;
}
.card .cardfoot.stale .reg,
.card .cardfoot.stale .age,
.card .cardfoot.stale .cal { color: var(--warn); }

/* 카드 우측 상단 빠른 메뉴 */
.card .qbtn {
  position: absolute; top: 6px; right: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  width: 24px; height: 22px; line-height: 1; padding: 0;
  color: var(--text-mute); cursor: pointer;
  opacity: 0; transform: scale(.9);
  transition: opacity .15s, transform .15s var(--ease-out), color .15s;
}
.card:hover .qbtn, .card .qbtn:focus-visible { opacity: 1; transform: scale(1); }
.card .qbtn:hover { color: var(--text); background: var(--surface-alt); }

/* ── 칩 ─────────────────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: #eef1f5; color: var(--text-dim); white-space: nowrap;
  border: 0;   /* 버튼으로 쓰는 칩(마감일 빠른 지정 등)에 브라우저 기본 테두리가 생기는 걸 막습니다 */
}
button.chip { cursor: pointer; transition: background .15s, transform .12s var(--ease-out); }
button.chip:hover { background: #dfe5ec; }
button.chip:active { transform: scale(.94); }
.chip.pri { background: color-mix(in srgb, var(--pri-color) 16%, #fff); color: var(--pri-color); font-weight: 700; }
.chip.dept { background: color-mix(in srgb, var(--dept-color) 13%, #fff); color: var(--dept-color); font-weight: 700; }
.chip.urgent { background: var(--urgent); color: #fff; font-weight: 700; letter-spacing: .02em; }
.chip.due.soon { background: #fdf0d8; color: #92600b; font-weight: 700; }
.chip.due.over { background: #fde0e0; color: #a51b1b; font-weight: 700; }
.chip.tag { background: #e8eefb; color: #2b53a8; }
.avatar {
  width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center;
  font-size: 10px; font-weight: 700; color: #fff; flex-shrink: 0;
}

.empty-col {
  color: var(--text-mute); font-size: 12px; text-align: center; padding: 16px 0;
  border: 1px dashed #cfd6de; border-radius: var(--radius);
}

/* 긴급 고정 그룹과 나머지를 가르는 선 */
.pin-sep {
  display: flex; align-items: center; gap: 8px;
  font-size: 10px; color: var(--text-mute); letter-spacing: .04em;
  margin: 2px 2px 0; user-select: none;
}
.pin-sep::before, .pin-sep::after {
  content: ''; flex: 1; height: 1px;
  background: repeating-linear-gradient(90deg, #c9d2dc 0 4px, transparent 4px 8px);
}

/* 드롭 위치 표시선 — 어디에 끼워 넣을지 보여줍니다 */
.drop-line {
  height: 3px; border-radius: 999px; background: var(--accent); margin: 1px 0;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
  animation: dropIn .18s var(--ease-out) both;
}
@keyframes dropIn { from { opacity: 0; transform: scaleX(.75); } }

/* ── 팝오버 ─────────────────────────────────────────────────────── */
.popover {
  position: fixed; z-index: 60;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px; box-shadow: var(--shadow-lg); width: 244px;
  display: flex; flex-direction: column; gap: 10px;
  animation: popIn .16s var(--ease-out) both;
}
@keyframes popIn { from { opacity: 0; transform: translateY(-6px) scale(.97); } }
.pop-row { display: flex; flex-direction: column; gap: 5px; }
.pop-row label { font-size: 11px; color: var(--text-dim); }
.menu-item {
  background: none; border: none; text-align: left; padding: 8px 10px;
  border-radius: 7px; cursor: pointer; width: 100%;
  display: flex; align-items: center; gap: 8px;
  transition: background .12s;
}
.menu-item:hover { background: var(--surface-alt); }
.menu-item.danger { color: var(--urgent); }
.menu-item.on { color: var(--accent); font-weight: 700; }
.menu-sep { height: 1px; background: var(--line-soft); margin: 2px 0; }
.menu-label { font-size: 11px; color: var(--text-mute); padding: 0 10px; }

/* 카드 빠른 메뉴 — 항목이 많아 세로로 길어지므로 촘촘하게 */
.popover.compact { gap: 1px; padding: 7px; }
.popover.compact .menu-item { padding: 6px 9px; font-size: 13px; }
.popover.compact .menu-sep { margin: 4px 0; }
.popover.compact .menu-label { padding: 3px 9px 1px; }

/* ── 모달 ───────────────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; background: rgba(16, 26, 38, .34);
  backdrop-filter: blur(3px); z-index: 100;
  display: grid; place-items: center; padding: 26px;
  animation: fadeIn .18s ease both;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  background: var(--bg); border: 1px solid var(--line); border-radius: 16px;
  width: min(720px, 100%); max-height: 88vh; overflow: auto; box-shadow: var(--shadow-lg);
  animation: modalIn .3s var(--ease-back) both;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.97); } }
.modal.wide { width: min(980px, 100%); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg); z-index: 1;
}
.modal-head h2 { margin: 0; font-size: 17px; font-weight: 700; }
.modal-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 20px; border-top: 1px solid var(--line);
  position: sticky; bottom: 0; background: var(--bg);
}
/* 닫기 버튼 — motion.dev 의 dots-morph-button 참고.
   쉴 때는 점 네 개, 올리면 두 선이 자라나 서로 만나며 ✕ 가 됩니다.
   양 끝에서 가운데로 자라야 해서 각 대각선을 반쪽짜리 두 조각으로 나눠 그립니다. */
/* 모달 하단 줄 — 버튼은 오른쪽, 상태 배지는 왼쪽 끝에 놓이게 전체 폭을 차지합니다. */
.foot-row { display: flex; align-items: center; gap: 8px; flex: 1; justify-content: flex-end; }

.close {
  background: none; border: 0; color: var(--text-mute);
  cursor: pointer; padding: 4px; border-radius: 8px;
  display: grid; place-items: center;
  transition: color .18s, background .18s, transform .4s var(--ease-spring);
}
.close:hover, .close:focus-visible { color: var(--text); background: rgba(22, 32, 43, .06); }
.close:active { transform: scale(.88); }

.close svg { width: 22px; height: 22px; display: block; }
.close path {
  fill: none; stroke: currentColor; stroke-width: 2.8; stroke-linecap: round;
  transition: d .55s var(--ease-spring);
}
/* 네 모서리의 점 (길이가 거의 0인 선 + 둥근 끝 = 점) */
.close .m1 { d: path("M 8 8 L 8.01 8.01 M 16 16 L 15.99 15.99"); }
.close .m2 { d: path("M 16 8 L 15.99 8.01 M 8 16 L 8.01 15.99"); }
/* 가운데(12,12)까지 자라 두 대각선이 교차 */
.close:hover .m1, .close:focus-visible .m1 { d: path("M 8 8 L 11.9 11.9 M 16 16 L 12.1 12.1"); }
.close:hover .m2, .close:focus-visible .m2 { d: path("M 16 8 L 12.1 11.9 M 8 16 L 11.9 12.1"); }

/* CSS 의 d 속성을 지원하지 않는 브라우저는 위 규칙을 무시하고
   마크업에 적힌 d 를 그대로 그립니다. 그래서 마크업에는 ✕ 모양을 넣어두었습니다 —
   모핑은 안 되더라도 닫기 버튼으로 보이는 건 유지됩니다. */

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; color: var(--text-dim); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.hint { font-size: 12px; color: var(--text-dim); line-height: 1.6; }

/* 긴급 토글 */
.urgent-toggle {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 13px;
  background: var(--surface); cursor: pointer; width: 100%; text-align: left;
  transition: border-color .18s, background .18s;
}
.urgent-toggle .sw {
  width: 38px; height: 22px; border-radius: 999px; background: #cfd6de;
  position: relative; flex-shrink: 0; transition: background .22s var(--ease-out);
}
.urgent-toggle .sw::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm);
  transition: transform .26s var(--ease-back);
}
.urgent-toggle.on { border-color: #f3b4b4; background: #fef5f5; }
.urgent-toggle.on .sw { background: var(--urgent); }
.urgent-toggle.on .sw::after { transform: translateX(16px); }
.urgent-toggle .txt { font-weight: 500; }
.urgent-toggle .desc { font-size: 11px; color: var(--text-mute); }

/* ── 상태 전환 버튼 (motion.dev multi-state-badge 참고) ────────────
   배지를 따로 띄우지 않고 제출 버튼 자신이 상태를 나타냅니다.
   누른 그 자리에서 추가 → 등록중 → 등록 완료 로 바뀌고,
   나가는 글자와 들어오는 글자가 동시에 교차하며 너비가 스프링으로 늘어납니다. */
.msb {
  position: relative; overflow: hidden; justify-content: center;
  transition: background .45s var(--ease-out), border-color .45s var(--ease-out);
}
.msb-layer { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
/* 나가는 층은 자리를 차지하지 않게 겹쳐 둡니다 — 그래야 너비가 새 내용 기준으로 잡힙니다. */
.msb-layer.exiting {
  position: absolute; inset: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}

.btn.msb.is-processing { background: #7ba4f2; border-color: #7ba4f2; cursor: progress; }
.btn.msb.is-success    { background: #15803d; border-color: #15803d; }
.btn.msb.is-error      { background: var(--urgent); border-color: var(--urgent); }
/* 잠긴 동안에도 색이 흐려지지 않아야 상태가 또렷하게 보입니다. */
.btn.msb:disabled { opacity: 1; }
.btn.msb.is-processing:hover, .btn.msb.is-success:hover { background: inherit; }

.sb-spin {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: sbSpin .7s linear infinite;
}
@keyframes sbSpin { to { transform: rotate(360deg); } }

.sb-ic { width: 16px; height: 16px; flex-shrink: 0; }
.sb-ic path {
  fill: none; stroke: currentColor; stroke-width: 2.6;
  stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 30; stroke-dashoffset: 30;
  animation: sbDraw .45s var(--ease-out) .08s forwards;
}
@keyframes sbDraw { to { stroke-dashoffset: 0; } }

.section-title { font-size: 12px; color: var(--text-dim); font-weight: 700; margin-top: 4px; }
.comment { border-top: 1px solid var(--line-soft); padding: 11px 0; }
.comment:first-of-type { border-top: none; }
.comment .who { font-size: 12px; color: var(--text-dim); margin-bottom: 3px; display: flex; gap: 8px; }
.comment .body { white-space: pre-wrap; line-height: 1.6; }
.act-line { font-size: 12px; color: var(--text-mute); padding: 3px 0; }

/* ── 중복 검사 ──────────────────────────────────────────────────── */
.dup-group {
  border: 1px solid var(--line); border-radius: 12px; padding: 13px;
  display: flex; flex-direction: column; gap: 10px; background: var(--surface);
  box-shadow: var(--shadow-sm);
  animation: statIn .32s var(--ease-out) both;
}
.dup-group.cross { border-color: #f1bcbc; background: #fffafa; }
.dup-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dup-head .score { font-size: 12px; color: var(--text-dim); margin-left: auto; }
.dup-item {
  display: flex; gap: 10px; align-items: flex-start; padding: 9px 11px;
  background: var(--surface-alt); border: 1px solid transparent; border-radius: 9px;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.dup-item:hover { background: #f1f5f9; }
.dup-item.target { border-color: var(--accent); background: #f2f6fe; }
.dup-item input[type=radio] { width: auto; margin-top: 3px; accent-color: var(--accent); }
.dup-item .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.dup-item .t { font-weight: 700; line-height: 1.45; }
.dup-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ── 가져오기 미리보기 ──────────────────────────────────────────── */
.imp-row {
  display: grid; grid-template-columns: 1fr 128px 106px 92px 76px 34px; gap: 8px;
  align-items: center; padding: 8px 0; border-top: 1px solid var(--line-soft);
}
.imp-row:first-of-type { border-top: none; }
.imp-head {
  display: grid; grid-template-columns: 1fr 128px 106px 92px 76px 34px; gap: 8px;
  font-size: 11px; color: var(--text-dim); padding-bottom: 6px;
}
.imp-row .t { min-width: 0; }
.imp-row .t input { font-weight: 500; }
.imp-row .t .d { font-size: 11px; color: var(--text-mute); margin-top: 3px; white-space: pre-wrap; line-height: 1.45; }
.imp-urgent {
  border: 1px solid var(--line); border-radius: 7px; padding: 7px 6px;
  background: var(--surface); cursor: pointer; font-size: 11px; text-align: center;
  color: var(--text-mute); transition: all .15s;
}
.imp-urgent.on { background: var(--urgent); border-color: var(--urgent); color: #fff; font-weight: 700; }
.rm { background: none; border: none; color: var(--text-mute); cursor: pointer; font-size: 17px; transition: color .15s; }
.rm:hover { color: var(--urgent); }

/* ── 전체 보기 (부서별 요약) ────────────────────────────────────── */
.overview { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.ov-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; box-shadow: var(--shadow-sm);
  animation: statIn .38s var(--ease-out) both;
  transition: box-shadow .18s, transform .18s var(--ease-out);
}
.ov-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.ov-head { display: flex; align-items: center; gap: 8px; padding: 13px 15px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.ov-head:hover { background: var(--surface-alt); }
.ov-head .swatch { width: 9px; height: 9px; border-radius: 50%; background: var(--dept-color); }
.ov-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.ov-head .n { margin-left: auto; color: var(--text-mute); font-size: 12px; }
.ov-bar { display: flex; height: 5px; background: var(--line-soft); }
.ov-bar i { display: block; transition: width .5s var(--ease-out); }
.ov-list { padding: 9px; display: flex; flex-direction: column; gap: 6px; background: var(--col); }
.ov-list .card { padding: 9px 11px; }
.ov-more { text-align: center; color: var(--text-mute); font-size: 12px; padding: 5px; cursor: pointer; border-radius: 6px; }
.ov-more:hover { color: var(--accent); background: rgba(37, 99, 235, .07); }

/* ── 토스트 ─────────────────────────────────────────────────────── */
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #16202b; color: #fff; border-radius: 10px; padding: 11px 18px;
  box-shadow: var(--shadow-lg); max-width: 90vw; font-size: 13px;
  animation: rise .3s var(--ease-back) both;
}
.toast.err { background: var(--urgent); }
.toast.ok { background: #14532d; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.94); } }

/* ── 스크롤바 ───────────────────────────────────────────────────── */
main::-webkit-scrollbar, .modal::-webkit-scrollbar { width: 11px; height: 11px; }
main::-webkit-scrollbar-thumb, .modal::-webkit-scrollbar-thumb {
  background: #c6cfd8; border-radius: 99px; border: 3px solid transparent; background-clip: content-box;
}
main::-webkit-scrollbar-thumb:hover, .modal::-webkit-scrollbar-thumb:hover { background: #aab6c2; background-clip: content-box; }

/* ── 반응형 ─────────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  .board { grid-template-columns: repeat(2, minmax(250px, 1fr)); }
  .search input { width: 150px; }
}
@media (max-width: 780px) {
  .topbar { flex-wrap: wrap; }
  .topbar-right { width: 100%; overflow-x: auto; }
  .board { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .imp-row, .imp-head { grid-template-columns: 1fr; }
}

/* 모션을 줄이도록 설정한 사용자는 애니메이션 없이 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
