/* ═══════════════════════════════════════════════════════════════════
   app.css — 레이아웃 · 컴포넌트
   ═══════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: Figtree, 'Noto Sans KR', Inter, system-ui, -apple-system, 'Malgun Gothic', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: var(--primary); }
.muted { color: var(--text-3); }
.spacer { flex: 1; }
.nowrap { white-space: nowrap; }
.trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 6px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ═══════════════════════════ 로그인 ═══════════════════════════ */
.login-wrap {
  position: fixed; inset: 0; z-index: 900;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: var(--bg);
}
.login-wrap::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(1000px 500px at 20% -10%, var(--primary-soft), transparent 60%),
              radial-gradient(800px 400px at 100% 110%, var(--purple-soft), transparent 60%);
  pointer-events: none;
}
.login-box {
  position: relative; width: 100%; max-width: 400px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 36px 32px; box-shadow: var(--shadow-lg);
}
.brand { display: flex; align-items: center; gap: 11px; justify-content: center; margin-bottom: 8px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 19px;
}
.brand-name { font-weight: 800; font-size: 21px; letter-spacing: -.5px; }
.brand-name em { color: var(--primary); font-style: normal; }
.login-sub { text-align: center; color: var(--text-2); font-size: 13px; margin-bottom: 26px; }
.form-error {
  display: none; margin-bottom: 14px; padding: 10px 13px; font-size: 13px; font-weight: 500;
  background: var(--negative-soft); color: var(--negative);
  border: 1px solid var(--negative); border-radius: var(--r);
}
.form-error.show { display: block; }

/* ═══════════════════════════ 셸 ═══════════════════════════ */
#shell { display: flex; height: 100%; }

#sidebar {
  width: var(--sidebar-w); flex-shrink: 0; z-index: 30;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
  transition: width .18s ease;
}
#sidebar.collapsed { width: 60px; }
#sidebar.collapsed .sb-text, #sidebar.collapsed .sb-label, #sidebar.collapsed .sb-user-meta { display: none; }
#sidebar.collapsed .nav-item, #sidebar.collapsed .sb-brand { justify-content: center; padding-left: 0; padding-right: 0; }

.sb-brand { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.sb-brand .brand-mark { width: 30px; height: 30px; font-size: 14px; border-radius: 8px; }
.sb-brand .brand-name { font-size: 16px; }
.sb-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 10px 8px; }
.sb-label {
  font-size: 10.5px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 1px; padding: 14px 10px 6px; white-space: nowrap;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 8px 10px; margin-bottom: 2px; border-radius: var(--r);
  color: var(--text-2); font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-ico { width: 20px; text-align: center; flex-shrink: 0; font-size: 15px; }
.nav-count {
  margin-left: auto; background: var(--negative); color: #fff;
  border-radius: 10px; padding: 0 6px; font-size: 11px; font-weight: 700; line-height: 18px;
}
.proj-item { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: var(--r); color: var(--text-2); font-size: 13.5px; font-weight: 500; width: 100%; text-align: left; margin-bottom: 1px; }
.proj-item:hover { background: var(--surface-2); color: var(--text); }
.proj-item.active { background: var(--surface-3); color: var(--text); font-weight: 600; }
.proj-dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }

.sb-user { border-top: 1px solid var(--border); padding: 8px; flex-shrink: 0; }
.sb-user-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r); width: 100%; text-align: left; }
.sb-user-row:hover { background: var(--surface-2); }
.sb-user-meta .n { font-size: 13.5px; font-weight: 600; }
.sb-user-meta .r { font-size: 11.5px; color: var(--text-3); }

#main { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

#topbar {
  height: 56px; flex-shrink: 0; display: flex; align-items: center; gap: 10px; padding: 0 18px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
#page-title { font-size: 17px; font-weight: 700; letter-spacing: -.3px; min-width: 0; }
#page-title small { font-weight: 500; font-size: 13px; color: var(--text-2); margin-left: 8px; }
#topbar-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2); font-size: 15px; transition: background .12s, color .12s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.rel { position: relative; }
.badge-dot {
  position: absolute; top: 1px; right: 1px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--negative); color: #fff; border: 2px solid var(--surface);
  font-size: 10px; font-weight: 700; line-height: 13px; display: none;
}
.badge-dot.show { display: block; }

.conn { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-3); font-weight: 500; }
.conn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--positive); }
.conn-dot.off { background: var(--warning); }

#content { flex: 1; overflow: auto; padding: 20px 22px 60px; }

/* ═══════════════════════════ 버튼 ═══════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--r-sm); border: 1px solid transparent;
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s, opacity .12s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-ghost { background: transparent; color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-ok { background: var(--positive); color: #fff; }
.btn-ok:hover { filter: brightness(1.06); }
.btn-danger { background: var(--negative); color: #fff; }
.btn-danger:hover { filter: brightness(1.06); }
.btn-soft { background: var(--surface-2); color: var(--text-2); border-color: var(--border); }
.btn-soft:hover { background: var(--surface-3); color: var(--text); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-xs { padding: 3px 9px; font-size: 12px; border-radius: var(--r-sm); }
.btn-block { width: 100%; padding: 11px; font-size: 14.5px; }

/* ═══════════════════════════ 폼 ═══════════════════════════ */
.field { margin-bottom: 15px; }
.label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.label .hint { font-weight: 400; color: var(--text-3); margin-left: 6px; }
.input, select.input, textarea.input {
  width: 100%; padding: 9px 12px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  font-size: 14px; outline: none; transition: border-color .12s, box-shadow .12s;
}
.input:focus { border-color: var(--primary); box-shadow: var(--ring); }
textarea.input { resize: vertical; min-height: 78px; line-height: 1.55; }
select.input { cursor: pointer; }
/* 한 줄 입력칸은 종류마다 기본 높이가 다르다 (text 41 · select 39 · date 43).
   같은 줄에 나란히 놓으면 그 차이가 어긋남으로 보인다. 하나로 맞춘다. */
input.input:not([type="checkbox"]):not([type="radio"]),
select.input { height: 40px; }
/* 라벨에 붙는 힌트 길이가 칸마다 달라 두 줄로 접히면, 입력칸이 서로 다른 높이에서
   시작해 어긋나 보인다. 아래를 기준으로 맞춰 입력칸 줄이 항상 나란히 놓이게 한다. */
.row-2, .row-3, .row-4 { align-items: end; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.row-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
/* 칸 안의 .field 여백은 없애고, 그 여백을 줄 자체가 갖는다 —
   그래야 한쪽 칸만 길어져도 다음 줄과의 간격이 일정하다. */
.row-2 > .field, .row-3 > .field, .row-4 > .field { margin-bottom: 0; }
.row-2, .row-3, .row-4 { margin-bottom: 15px; }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 3px solid transparent; transition: transform .12s, border-color .12s; }
.swatch.sel { border-color: var(--text); transform: scale(1.15); }

.chip-input {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 8px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
  max-height: 150px; overflow-y: auto;
}
.pick-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  font-size: 12.5px; font-weight: 500; color: var(--text-2); transition: all .12s;
}
.pick-chip:hover { border-color: var(--border-2); }
.pick-chip.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 600; }

/* ═══════════════════════════ 컴포넌트 ═══════════════════════════ */
.status-cell {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 84px; padding: 5px 12px; border-radius: var(--r-sm);
  background: var(--cell); color: #fff; font-size: 12.5px; font-weight: 600;
  white-space: nowrap; line-height: 1.35;
}
.status-cell.sm { min-width: 62px; padding: 3px 8px; font-size: 11.5px; }
.status-cell.editable { cursor: pointer; transition: filter .12s; }
.status-cell.editable:hover { filter: brightness(1.08); }

.grp-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--chip) 16%, transparent);
  color: var(--chip); font-size: 11px; font-weight: 700; letter-spacing: .3px;
}
.grp-chip.lg { padding: 4px 11px; font-size: 12.5px; }
.grp-chip-ko { font-weight: 500; opacity: .85; }

.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  border-radius: 50%; background: var(--av); color: #fff; font-weight: 700; line-height: 1;
  border: 2px solid var(--surface);
}
.avatar.ghost { background: var(--neutral); }
.avatar.more { background: var(--surface-3); color: var(--text-2); font-size: 11px; }
.av-stack { display: inline-flex; }
.av-stack .avatar + .avatar { margin-left: -8px; }
/* 보드 헤더의 프로젝트 책임자.
   이름이 길면(베트남어 이름은 네 마디가 흔하다) 줄바꿈되어 헤더 밖으로 넘쳤다.
   한 줄로 붙이고 넘치는 만큼만 잘라 낸다 — 전체 이름은 title 속성으로 남는다. */
.lead-chip { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 200px;
  margin-right: 4px; padding-right: 10px; border-right: 1px solid var(--border);
  font-size: 12.5px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.lead-chip > .sb-text { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 860px) { .lead-chip { display: none; } }

/* 보드 헤더의 프로젝트 참여자 — 누가 이 안에서 일하는지 한눈에 */
.board-members { display: inline-flex; align-items: center; margin-right: 4px; padding-right: 10px;
  border-right: 1px solid var(--border); }
@media (max-width: 700px) { .board-members { display: none; } }

.tl-pill {
  display: inline-flex; align-items: center; padding: 4px 11px; border-radius: 999px;
  background: color-mix(in srgb, var(--pill) 18%, transparent);
  color: var(--pill); font-size: 12px; font-weight: 600; white-space: nowrap;
}

.prog { display: inline-flex; align-items: center; gap: 8px; width: 100%; }
.prog-bar { flex: 1; height: 7px; min-width: 42px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.prog-fill { display: block; height: 100%; border-radius: 4px; transition: width .35s ease; }
.prog-num { font-size: 11.5px; font-weight: 700; color: var(--text-2); min-width: 32px; text-align: right; }

.tag { display: inline-block; padding: 2px 8px; border-radius: var(--r-sm); background: var(--surface-3); color: var(--text-2); font-size: 11px; font-weight: 600; }

.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty-icon { font-size: 34px; margin-bottom: 10px; }
.empty-title { font-size: 15px; font-weight: 600; color: var(--text-2); }
.empty-desc { font-size: 13px; margin-top: 5px; }
.empty-act { margin-top: 16px; }

/* ═══════════════════════════ 카드 / 섹션 ═══════════════════════════ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.card-title { font-size: 14px; font-weight: 700; letter-spacing: -.2px; }
.card-body { padding: 16px; }

.section-title {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  font-size: 14px; font-weight: 700; margin: 22px 0 10px; letter-spacing: -.2px;
}
.section-title:first-child { margin-top: 0; }
.section-link { font-size: 12.5px; font-weight: 600; color: var(--primary); }

/* 알림/경고 배너 */
.alert {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 11px 15px; border-radius: var(--r); margin-bottom: 9px;
  font-size: 13.5px; font-weight: 500; border: 1px solid transparent;
  transition: filter .12s;
}
.alert:hover { filter: brightness(.98); }
.alert .a-txt { flex: 1; }
.alert .a-go { font-size: 12.5px; font-weight: 600; opacity: .8; }
.alert-red { background: var(--negative-soft); border-color: var(--negative); color: var(--negative); }
.alert-amber { background: var(--warning-soft); border-color: var(--warning); color: #B26A00; }
.alert-blue { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.alert-purple { background: var(--purple-soft); border-color: var(--purple); color: var(--purple); }
:root[data-theme="dark"] .alert-amber { color: var(--warning); }

/* 통계 타일 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 15px 16px; border-top: 3px solid var(--accent, var(--primary));
}
.stat-val { font-size: 28px; font-weight: 800; line-height: 1.1; letter-spacing: -.6px; color: var(--accent, var(--text)); }
.stat-label { font-size: 12px; color: var(--text-2); font-weight: 600; margin-top: 4px; }
.stat-sub { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }

/* ═══════════════════════════ 보드 ═══════════════════════════ */
.board-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.view-tabs { display: inline-flex; gap: 2px; background: var(--surface-2); border-radius: var(--r); padding: 3px; }
.view-tab {
  padding: 6px 15px; border-radius: var(--r-sm); font-size: 13.5px; font-weight: 600;
  color: var(--text-2); transition: background .12s, color .12s;
}
.view-tab:hover { color: var(--text); }
.view-tab.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }

.filter-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  font-size: 12.5px; font-weight: 600; color: var(--text-2); transition: all .12s;
}
.filter-chip:hover { border-color: var(--border-2); color: var(--text); }
.filter-chip.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.filter-search {
  display: flex; align-items: center; gap: 7px; padding: 6px 12px; min-width: 190px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
}
.filter-search input { border: none; outline: none; background: none; width: 100%; font-size: 13px; }

/* 그룹 (monday 시그니처: 컬러 스트라이프 + 접기 + 요약) */
.group { margin-bottom: 18px; }
.group-head { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; }
.group-toggle { color: var(--gcolor); font-size: 12px; width: 18px; transition: transform .15s; }
.group.collapsed .group-toggle { transform: rotate(-90deg); }
.group-name { color: var(--gcolor); font-size: 14.5px; font-weight: 700; letter-spacing: -.2px; }
.group-count { color: var(--text-3); font-size: 12.5px; font-weight: 500; }
.group-body { border-radius: var(--r); overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
.group.collapsed .group-body { display: none; }

/* 테이블 뷰 */
.btable { width: 100%; border-collapse: collapse; }
.btable th {
  padding: 9px 12px; text-align: left; white-space: nowrap;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
  font-size: 11.5px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .6px;
}
.btable td { padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
.btable tbody tr:last-child td { border-bottom: none; }
.btable tbody tr { transition: background .1s; }
.btable tbody tr:hover { background: var(--surface-2); }
.btable tbody tr td:first-child { border-left: 4px solid var(--rowcolor, transparent); }
.btable .t-name { font-weight: 600; cursor: pointer; }
.btable .t-name:hover { color: var(--primary); }
.btable .t-sub { font-size: 11.5px; color: var(--text-3); font-weight: 500; margin-top: 2px; }
.btable .col-tight { width: 1%; white-space: nowrap; }
.group-summary td { background: var(--surface-2); font-size: 12px; color: var(--text-2); font-weight: 600; border-top: 1px solid var(--border); }

/* ═══════════════════════════ 간트 ═══════════════════════════ */
.gantt-wrap { border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.gantt-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.gantt-scroll { overflow: auto; max-height: calc(100vh - 260px); }
.gantt-flex { display: flex; min-width: max-content; }

.gl { position: sticky; left: 0; z-index: 6; width: 300px; min-width: 300px; flex-shrink: 0; background: var(--surface); border-right: 2px solid var(--border); }
.gl-head, .gr-head { position: sticky; top: 0; z-index: 4; background: var(--surface-2); }
.gl-head { height: 54px; display: flex; align-items: flex-end; padding: 0 12px 8px; border-bottom: 1px solid var(--border); font-size: 11.5px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .6px; }
.gl-row { height: 44px; display: flex; align-items: center; gap: 9px; padding: 0 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.gl-row:hover { background: var(--surface-2); }
.gl-row .bar-color { width: 4px; height: 22px; border-radius: 2px; flex-shrink: 0; }
.gl-row .gl-name { flex: 1; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gl-group { height: 34px; display: flex; align-items: center; gap: 8px; padding: 0 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 12.5px; font-weight: 700; color: var(--gcolor); }

.gr { position: relative; }
.gr-head { border-bottom: 1px solid var(--border); }
.g-months { display: flex; height: 26px; }
.g-month { display: flex; align-items: center; padding: 0 8px; border-right: 1px solid var(--border); font-size: 11.5px; font-weight: 700; color: var(--text-2); overflow: hidden; white-space: nowrap; }
.g-days { display: flex; height: 28px; }
.g-day { display: flex; align-items: center; justify-content: center; flex-shrink: 0; border-right: 1px solid var(--border); font-size: 10.5px; color: var(--text-3); font-weight: 500; }
.g-day.weekend { background: var(--surface-3); }
.g-day.today { background: var(--primary); color: #fff; font-weight: 700; }
.g-body { position: relative; }
.g-row { height: 44px; border-bottom: 1px solid var(--border); position: relative; }
.g-row:hover { background: var(--surface-2); }
.g-row.group-sep { height: 34px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.g-weekend { position: absolute; top: 0; bottom: 0; background: var(--surface-2); opacity: .55; pointer-events: none; z-index: 0; }
.g-today-line { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--negative); z-index: 5; pointer-events: none; }

.g-plan {
  position: absolute; top: 7px; height: 7px; border-radius: 3px;
  background: var(--border-2); opacity: .85; z-index: 1; pointer-events: none;
}
/* 기한이 승인되어 밀린 태스크의 기준선 — 최초 계획이 어디였는지 눈에 띄게 */
.g-plan.moved { background: repeating-linear-gradient(90deg, var(--border-2) 0 5px, transparent 5px 9px); }

/* 상세 모달 하단의 구글 캘린더 링크 — 버튼처럼 보이지만 실제로는 링크다 */
.gcal-btn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.g-bar {
  position: absolute; top: 18px; height: 20px; border-radius: var(--r-sm); z-index: 2;
  display: flex; align-items: center; padding: 0 8px; overflow: hidden;
  background: var(--bar); color: #fff; font-size: 11.5px; font-weight: 600; white-space: nowrap;
  cursor: pointer; transition: filter .12s, box-shadow .12s;
}
.g-bar:hover { filter: brightness(1.08); box-shadow: var(--shadow); }
.g-bar .g-fill { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(0,0,0,.22); pointer-events: none; }
.g-bar .g-label { position: relative; }
.g-bar.dragging { opacity: .75; }
/* 일정 막대 — 진행률 채움이 없고 태스크와 구분되도록 빗금을 넣는다 */
.g-bar.g-event {
  background: repeating-linear-gradient(45deg,
    var(--bar) 0 6px, color-mix(in srgb, var(--bar) 78%, #000) 6px 12px);
  cursor: pointer;
}
.g-handle { position: absolute; top: 0; bottom: 0; width: 7px; cursor: ew-resize; z-index: 3; }
.g-handle.l { left: 0; } .g-handle.r { right: 0; }
.g-bar.movable { cursor: grab; }
.g-dcr { position: absolute; top: 18px; height: 20px; border-radius: var(--r-sm); border: 2px dashed var(--sky); z-index: 1; pointer-events: none; }
.g-ms {
  position: absolute; top: 4px; width: 12px; height: 12px; z-index: 4; cursor: pointer;
  background: var(--ms); transform: rotate(45deg); border-radius: 2px; border: 2px solid var(--surface);
}
.g-links { position: absolute; inset: 0; pointer-events: none; z-index: 3; overflow: visible; }
.g-legend { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-2); font-weight: 500; }
.g-legend .sw { width: 15px; height: 9px; border-radius: 3px; display: inline-block; vertical-align: middle; margin-right: 5px; }

/* ═══════════════════════════ 캘린더 ═══════════════════════════ */
.cal { border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.cal-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-dow { padding: 8px; text-align: center; font-size: 11.5px; font-weight: 700; color: var(--text-2); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.cal-dow.sun { color: var(--negative); } .cal-dow.sat { color: var(--primary); }
.cal-cell { min-height: 108px; padding: 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell.other { background: var(--surface-2); }
.cal-cell.today .cal-num { background: var(--primary); color: #fff; }
.cal-num { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 4px; }
.cal-item { display: block; width: 100%; text-align: left; padding: 3px 7px; margin-bottom: 3px; border-radius: var(--r-sm); background: var(--ev); color: #fff; font-size: 11.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-item:hover { filter: brightness(1.08); }
.cal-more { font-size: 11px; color: var(--text-3); font-weight: 600; padding-left: 4px; }

/* ═══════════════════════════ 리스트 항목 ═══════════════════════════ */
.tile {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 11px 14px; margin-bottom: 6px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--accent, var(--border));
  transition: border-color .12s, box-shadow .12s;
}
.tile:hover { box-shadow: var(--shadow-sm); border-color: var(--border-2); }
.tile-main { flex: 1; min-width: 0; }
.tile-title { font-size: 14px; font-weight: 600; letter-spacing: -.2px; }
.tile-title.done { text-decoration: line-through; color: var(--text-3); }
.tile-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-3); font-weight: 500; margin-top: 3px; }
.check {
  width: 20px; height: 20px; flex-shrink: 0; border-radius: 50%;
  border: 2px solid var(--border-2); display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: transparent; transition: all .12s;
}
.check:hover { border-color: var(--positive); }
.check.on { background: var(--positive); border-color: var(--positive); color: #fff; }

/* ═══════════════════════════ 모달 ═══════════════════════════ */
.overlay {
  position: fixed; inset: 0; z-index: 200; padding: 20px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(28,31,59,.55); backdrop-filter: blur(3px);
  animation: fade .13s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  animation: rise .16s ease;
}
@keyframes rise { from { transform: translateY(14px); opacity: 0 } to { transform: none; opacity: 1 } }
.modal-sm { max-width: 420px; }
.modal-lg { max-width: 760px; }
.m-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--border); }
.m-head-txt { flex: 1; min-width: 0; }
.m-title { font-size: 17px; font-weight: 700; letter-spacing: -.3px; }
.m-sub { font-size: 12.5px; color: var(--text-2); margin-top: 3px; }
.m-body { padding: 18px 20px; }
.m-foot { display: flex; align-items: center; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
.confirm-body { font-size: 14px; color: var(--text-2); line-height: 1.6; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }

.popover {
  position: fixed; z-index: 300; min-width: 190px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow-lg); animation: fade .1s ease;
  max-height: 420px; overflow-y: auto;
}
.pop-item {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: var(--r-sm); font-size: 13.5px; font-weight: 500; color: var(--text);
}
.pop-item:hover { background: var(--surface-2); }
.pop-item.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.pop-label { padding: 6px 10px 4px; font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .6px; }
.pop-sep { height: 1px; background: var(--border); margin: 5px 0; }

/* ═══════════════════════════ 토스트 ═══════════════════════════ */
#toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 500; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  padding: 10px 18px; border-radius: var(--r); font-size: 13.5px; font-weight: 600;
  background: var(--text); color: var(--surface); box-shadow: var(--shadow-lg);
  animation: rise .18s ease; transition: opacity .3s, transform .3s;
}
.toast.out { opacity: 0; transform: translateY(8px); }
.toast-ok { background: var(--positive); color: #fff; }
.toast-err { background: var(--negative); color: #fff; }
.toast-warn { background: var(--warning); color: #1a1a1a; }

/* ═══════════════════════════ 알림 피드 ═══════════════════════════ */
.notif { display: flex; gap: 10px; width: 100%; text-align: left; padding: 10px; border-radius: var(--r-sm); }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: var(--primary-soft); }
.notif-txt { font-size: 13px; line-height: 1.45; }
.notif-time { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ═══════════════════════════ 상세 모달 ═══════════════════════════ */
.det-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.det-box { background: var(--surface-2); border-radius: var(--r); padding: 11px; text-align: center; }
.det-box.warn { background: var(--negative-soft); }
.det-k { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.det-v { font-size: 14px; font-weight: 700; }
.det-extra { font-size: 11px; color: var(--sky); font-weight: 600; margin-top: 2px; }

.notice { border-radius: var(--r); padding: 11px 14px; margin-bottom: 14px; font-size: 13px; font-weight: 500; border: 1px solid transparent; }
.notice-title { font-weight: 700; margin-bottom: 3px; }
.notice-sky { background: var(--sky-soft); border-color: var(--sky); color: var(--sky); }
.notice-purple { background: var(--purple-soft); border-color: var(--purple); color: var(--purple); }
.notice-ok { background: var(--positive-soft); border-color: var(--positive); color: var(--positive); }

.status-picker { display: flex; gap: 7px; flex-wrap: wrap; }
.status-pick {
  padding: 7px 16px; border-radius: var(--r-sm); font-size: 13px; font-weight: 600;
  background: var(--surface-2); color: var(--pick); border: 2px solid var(--pick); transition: all .12s;
}
.status-pick.on { background: var(--pick); color: #fff; }

.log { display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; margin-bottom: 5px; background: var(--surface-2); border-radius: var(--r-sm); }
.log-date { font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.log-val { font-size: 13.5px; font-weight: 700; color: var(--primary); }
.log-note { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }

.comment { padding: 10px 13px; margin-bottom: 7px; border-radius: var(--r); background: var(--surface-2); border-left: 3px solid var(--border-2); }
.comment.sys { background: var(--primary-soft); border-left-color: var(--primary); }
.comment.approval { background: var(--positive-soft); border-left-color: var(--positive); }
.comment-head { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; }
.comment-auth { font-size: 12.5px; font-weight: 700; }
.comment-time { font-size: 11px; color: var(--text-3); }
.comment-txt { font-size: 13.5px; color: var(--text-2); line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.comment-txt .mention { color: var(--primary); font-weight: 600; background: var(--primary-soft); padding: 0 4px; border-radius: 3px; }

.collab-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.collab-chip { position: relative; display: inline-flex; }
.collab-x {
  position: absolute; top: -4px; right: -4px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--negative); color: #fff; font-size: 10px; line-height: 1;
  display: none; align-items: center; justify-content: center; border: 2px solid var(--surface);
}
.collab-chip:hover .collab-x { display: flex; }
.collab-add {
  width: 28px; height: 28px; border-radius: 50%; border: 2px dashed var(--border-2);
  display: flex; align-items: center; justify-content: center; color: var(--text-2); font-size: 15px;
}
.collab-add:hover { border-color: var(--primary); color: var(--primary); }

/* ═══════════════════════════ KPI ═══════════════════════════ */
.kpi-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.kpi-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 15px; text-align: center; }
.kpi-card.now { border-color: var(--primary); background: var(--primary-soft); }
.kpi-q { font-size: 11.5px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .7px; }
.kpi-score { font-size: 30px; font-weight: 800; line-height: 1.15; letter-spacing: -.6px; margin-top: 6px; }
.kpi-note { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.kpi-track { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin-top: 9px; }
.kpi-track > span { display: block; height: 100%; border-radius: 3px; transition: width .4s; }
.kpi-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: color-mix(in srgb, var(--kb) 16%, transparent); color: var(--kb); }
.kpi-cat-row td { background: var(--surface-2); font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .6px; padding: 6px 12px; }

/* ═══════════════════════════ 팀 ═══════════════════════════ */
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.member-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; transition: box-shadow .12s; }
.member-card:hover { box-shadow: var(--shadow-sm); }
.member-top { display: flex; align-items: center; gap: 11px; margin-bottom: 12px; }
.member-name { font-size: 14.5px; font-weight: 700; }
.member-role { font-size: 12px; color: var(--text-3); font-weight: 500; }
.member-stats { display: flex; gap: 12px; font-size: 12px; color: var(--text-2); font-weight: 500; margin-bottom: 10px; }

/* ═══════════════════════════ 주간 보고 ═══════════════════════════ */
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.report-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 15px; }
.report-title { font-size: 12px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 11px; }
.report-line { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; font-weight: 600; }
.report-line:last-child { border-bottom: none; }
.report-sub { font-size: 11.5px; color: var(--text-3); font-weight: 500; margin-top: 2px; }

/* ═══════════════════════════ 전역 검색 ═══════════════════════════ */
.search-overlay { position: fixed; inset: 0; z-index: 400; background: rgba(28,31,59,.5); backdrop-filter: blur(3px); display: flex; justify-content: center; padding-top: 12vh; }
.search-box { width: 100%; max-width: 620px; height: fit-content; max-height: 70vh; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); overflow: hidden; display: flex; flex-direction: column; }
.search-input { display: flex; align-items: center; gap: 11px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.search-input input { flex: 1; border: none; outline: none; background: none; font-size: 16px; }
.search-results { overflow-y: auto; padding: 8px; }
.search-item { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; padding: 10px 12px; border-radius: var(--r-sm); }
.search-item:hover, .search-item.cursor { background: var(--surface-2); }
.search-kind { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; }
.search-hint { padding: 10px 18px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-3); display: flex; gap: 14px; }
kbd { background: var(--surface-3); border: 1px solid var(--border); border-radius: 3px; padding: 1px 5px; font-size: 11px; font-family: inherit; }

/* ═══════════════════════════ 반응형 ═══════════════════════════ */
.mobile-only { display: none; }
@media (max-width: 900px) {
  .kpi-summary { grid-template-columns: 1fr 1fr; }
  .report-grid { grid-template-columns: 1fr; }
  .det-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .mobile-only { display: block; }
  #sidebar {
    position: fixed; left: calc(-1 * var(--sidebar-w)); top: 0; bottom: 0;
    transition: left .2s ease; box-shadow: var(--shadow-lg);
  }
  #sidebar.open { left: 0; }
  #content { padding: 14px 12px 60px; }
  #topbar { padding: 0 12px; gap: 6px; }
  #page-title { font-size: 15px; }
  #page-title small { display: none; }
  .conn { display: none; }
  .row-2, .row-3, .row-4 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .kpi-summary { grid-template-columns: 1fr 1fr; }
  .gl { width: 160px; min-width: 160px; }
  .btable .hide-sm { display: none; }
  .modal { max-height: 96vh; }
  .board-head { gap: 8px; }
}
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 25; display: none; }
.scrim.show { display: block; }
