/* ===== 기본 ===== */
:root {
  --bg: #ffffff;
  --bg-sidebar: #f7f7f5;
  --bg-hover: #f1f1ef;
  --bg-sunken: #fbfbfa;
  --text: #37352f;
  --text-muted: #787774;
  --text-faint: #9b9a97;
  --border: #e9e9e7;
  --border-strong: #ddddda;
  --accent: #2383e2;
  --danger: #eb5757;
  --today: #eb5757;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(15, 15, 15, .06), 0 4px 12px rgba(15, 15, 15, .08);
  --shadow-lg: 0 4px 16px rgba(15, 15, 15, .12), 0 0 0 1px rgba(15, 15, 15, .05);

  --c-blue-bg: #e7f3f8;      --c-blue-fg: #183347;
  --c-orange-bg: #faebdd;    --c-orange-fg: #49290e;
  --c-green-bg: #edf3ec;     --c-green-fg: #1c3829;
  --c-purple-bg: #f4f0f7;    --c-purple-fg: #412454;
  --c-pink-bg: #fbf2f5;      --c-pink-fg: #4c2337;
  --c-red-bg: #fdebec;       --c-red-fg: #5d1715;
  --c-yellow-bg: #fbf3db;    --c-yellow-fg: #402c1b;
  --c-teal-bg: #e0f2f1;      --c-teal-fg: #12403c;
  --c-gray-bg: #f1f1ef;      --c-gray-fg: #32302c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic",
    "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
input, textarea, select { outline: none; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #dcdcda; border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #c4c4c1; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ===== 레이아웃 ===== */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ===== 사이드바 ===== */
.sidebar {
  width: 240px; flex-shrink: 0; background: var(--bg-sidebar);
  border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow-y: auto;
}
.sidebar.collapsed { display: none; }
.sb-head { padding: 12px 14px; display: flex; align-items: center; gap: 8px; }
.sb-logo {
  width: 22px; height: 22px; border-radius: 5px; background: #0b6e99; color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.sb-title { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-section { padding: 8px 8px 4px; }
.sb-label {
  font-size: 11px; font-weight: 600; color: var(--text-faint);
  padding: 4px 8px; letter-spacing: .02em;
}
.sb-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px;
  border-radius: var(--radius); color: var(--text-muted); font-size: 14px; text-align: left;
}
.sb-item:hover { background: var(--bg-hover); }
.sb-item.active { background: var(--bg-hover); color: var(--text); font-weight: 500; }
.sb-item .ico { width: 18px; text-align: center; flex-shrink: 0; opacity: .8; }
.sb-item .cnt { margin-left: auto; font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.sb-foot { margin-top: auto; padding: 10px; border-top: 1px solid var(--border); }
.me-picker { width: 100%; padding: 7px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: #fff; }
.me-hint { font-size: 11px; color: var(--text-faint); padding: 6px 2px 4px; }
.sb-status { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-faint); padding: 6px 2px 0; }
.dot-live { width: 6px; height: 6px; border-radius: 50%; background: #43a047; }
.dot-live.off { background: #bdbdbd; }

/* ===== 메인 ===== */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 45px; display: flex; align-items: center; gap: 8px; padding: 0 14px;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.icon-btn {
  width: 28px; height: 28px; border-radius: var(--radius); display: grid; place-items: center;
  color: var(--text-muted); flex-shrink: 0;
}
.icon-btn:hover { background: var(--bg-hover); }
.crumb { font-weight: 500; display: flex; align-items: center; gap: 6px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.page-head { padding: 26px 46px 0; }
.page-title { font-size: 32px; font-weight: 700; letter-spacing: -.02em; display: flex; align-items: center; gap: 10px; }
.page-desc { color: var(--text-faint); margin-top: 6px; font-size: 14px; }

/* 탭 */
.tabs { display: flex; align-items: center; gap: 2px; padding: 14px 46px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tab {
  padding: 6px 9px; border-radius: var(--radius); color: var(--text-muted);
  display: flex; align-items: center; gap: 6px; font-size: 14px; position: relative; top: 1px;
  border-bottom: 2px solid transparent; border-radius: var(--radius) var(--radius) 0 0;
}
.tab:hover { background: var(--bg-hover); }
.tab.active { color: var(--text); font-weight: 600; border-bottom-color: var(--text); }
.tabs-right { margin-left: auto; display: flex; align-items: center; gap: 6px; padding-bottom: 6px; }

/* 툴바 */
.toolbar {
  display: flex; align-items: center; gap: 8px; padding: 10px 46px;
  border-bottom: 1px solid var(--border); flex-wrap: wrap; background: var(--bg);
}
.search {
  display: flex; align-items: center; gap: 6px; padding: 5px 9px; border: 1px solid var(--border-strong);
  border-radius: var(--radius); background: #fff; min-width: 220px;
}
.search input { border: none; background: none; flex: 1; font-size: 13px; }
.chipset { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.chip {
  padding: 4px 9px; border-radius: 14px; font-size: 12px; border: 1px solid var(--border-strong);
  color: var(--text-muted); background: #fff; white-space: nowrap;
}
.chip:hover { background: var(--bg-hover); }
.chip.on { background: var(--text); color: #fff; border-color: var(--text); }
.chip .x { opacity: .6; margin-left: 3px; }
.toolbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.btn {
  padding: 6px 11px; border-radius: var(--radius); font-size: 13px; font-weight: 500;
  border: 1px solid var(--border-strong); background: #fff; color: var(--text); white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: #1a6fc4; }
.btn-danger { color: var(--danger); border-color: #f3c9c9; }
.btn-danger:hover { background: #fdebec; }
.btn-ghost { border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-hover); }
.seg { display: flex; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.seg button { padding: 5px 10px; font-size: 12px; color: var(--text-muted); border-right: 1px solid var(--border); }
.seg button:last-child { border-right: none; }
.seg button.on { background: var(--text); color: #fff; }

.view { flex: 1; overflow: auto; }

/* ===== 공통 배지 ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 4px;
  font-size: 12px; line-height: 18px; white-space: nowrap; max-width: 100%;
}
.badge.blue { background: var(--c-blue-bg); color: var(--c-blue-fg); }
.badge.orange { background: var(--c-orange-bg); color: var(--c-orange-fg); }
.badge.green { background: var(--c-green-bg); color: var(--c-green-fg); }
.badge.purple { background: var(--c-purple-bg); color: var(--c-purple-fg); }
.badge.pink { background: var(--c-pink-bg); color: var(--c-pink-fg); }
.badge.red { background: var(--c-red-bg); color: var(--c-red-fg); }
.badge.yellow { background: var(--c-yellow-bg); color: var(--c-yellow-fg); }
.badge.teal { background: var(--c-teal-bg); color: var(--c-teal-fg); }
.badge.gray { background: var(--c-gray-bg); color: var(--c-gray-fg); }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.status .d { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.status.s-todo .d { background: #b9b9b7; }
.status.s-doing .d { background: #eb5757; }
.status.s-done .d { background: #2383e2; }

.avatar {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 600; color: #fff; flex-shrink: 0; background: #9b9a97;
}
.avatar.sm { width: 21px; height: 21px; font-size: 10px; }
.av-blue { background: #337ea9; } .av-orange { background: #d9730d; } .av-green { background: #448361; }
.av-purple { background: #9065b0; } .av-pink { background: #c14c8a; } .av-red { background: #d44c47; }
.av-teal { background: #0f7b6c; } .av-yellow { background: #cb912f; } .av-gray { background: #9b9a97; }
.avatars { display: inline-flex; align-items: center; }
.avatars .avatar + .avatar { margin-left: -7px; box-shadow: 0 0 0 2px #fff; }

.empty { padding: 60px 20px; text-align: center; color: var(--text-faint); }
.empty h3 { font-size: 15px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }

/* ===== 타임라인 ===== */
.tl { display: flex; height: 100%; min-height: 0; }
.tl-left { width: 260px; flex-shrink: 0; border-right: 1px solid var(--border); background: var(--bg); position: sticky; left: 0; z-index: 4; }
.tl-scroll { flex: 1; overflow-x: auto; overflow-y: hidden; position: relative; }
.tl-wrap { display: flex; overflow: auto; height: 100%; }
.tl-head-h { height: 56px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-end; padding: 0 12px 8px; font-size: 12px; color: var(--text-faint); font-weight: 600; position: sticky; top: 0; background: var(--bg); z-index: 3; }
.tl-grid { position: relative; }
.tl-months { display: flex; height: 28px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg); z-index: 3; }
.tl-month { border-right: 1px solid var(--border); font-size: 12px; font-weight: 600; color: var(--text-muted); padding: 5px 8px; white-space: nowrap; overflow: hidden; }
.tl-days { display: flex; height: 28px; border-bottom: 1px solid var(--border); position: sticky; top: 28px; background: var(--bg); z-index: 3; }
.tl-day {
  border-right: 1px solid var(--border); font-size: 11px; color: var(--text-faint);
  display: flex; flex-direction: column; align-items: center; justify-content: center; flex-shrink: 0;
}
.tl-day.weekend { background: var(--bg-sunken); }
.tl-day.today { color: #fff; }
.tl-day.today .num { background: var(--today); color: #fff; border-radius: 50%; width: 18px; height: 18px; display: grid; place-items: center; }
.tl-day .num { font-weight: 600; color: var(--text-muted); }
.tl-body { position: relative; }
.tl-colbg { position: absolute; inset: 0; display: flex; pointer-events: none; }
.tl-colbg .c { border-right: 1px solid var(--border); flex-shrink: 0; }
.tl-colbg .c.weekend { background: var(--bg-sunken); }
.tl-colbg .c.today { background: rgba(235, 87, 87, .05); box-shadow: inset 1px 0 0 rgba(235,87,87,.35); }

.tl-group-head {
  height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 12px;
  border-bottom: 1px solid var(--border); background: var(--bg-sunken); font-weight: 600; font-size: 13px;
}
.tl-group-head.spacer { background: var(--bg-sunken); }
.tl-sub-head { height: 30px; display: flex; align-items: center; gap: 6px; padding: 0 12px 0 26px; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--text-muted); }
.tl-row-label {
  height: 34px; display: flex; align-items: center; gap: 7px; padding: 0 12px 0 26px;
  border-bottom: 1px solid var(--border); font-size: 13px; cursor: pointer; overflow: hidden;
}
.tl-row-label:hover { background: var(--bg-hover); }
.tl-row-label .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-row { height: 34px; border-bottom: 1px solid var(--border); position: relative; }
.tl-row:hover { background: rgba(0,0,0,.014); }

.bar {
  position: absolute; top: 5px; height: 24px; border-radius: 4px; display: flex; align-items: center;
  gap: 6px; padding: 0 8px; font-size: 12px; cursor: pointer; overflow: hidden; white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.05); transition: filter .12s;
}
.bar:hover { filter: brightness(.96); box-shadow: inset 0 0 0 1px rgba(0,0,0,.14); }
.bar .bt { overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.bar .bmeta { opacity: .75; font-size: 11px; }
.bar.done { opacity: .62; }
.bar.overdue { box-shadow: inset 0 0 0 1.5px var(--danger); }
.bar-progress { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(0,0,0,.07); border-radius: 4px 0 0 4px; pointer-events: none; }
.tl-todayline { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--today); opacity: .5; pointer-events: none; z-index: 2; }

/* ===== 캘린더 ===== */
.cal { padding: 0 0 40px; }
.cal-head { display: flex; align-items: center; gap: 10px; padding: 12px 46px; }
.cal-title { font-size: 17px; font-weight: 700; }
.cal-grid { border-top: 1px solid var(--border); }
.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--border); }
.cal-dow div { padding: 7px 10px; font-size: 12px; color: var(--text-faint); font-weight: 600; text-align: right; }
.cal-dow div.sun { color: #d44c47; }
.cal-dow div.sat { color: #337ea9; }
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--border); position: relative; overflow: hidden; }
.cal-cell { min-height: var(--cell-h, 112px); border-right: 1px solid var(--border); padding: 6px; position: relative; overflow: hidden; }
.cal-cell:last-child { border-right: none; }
.cal-cell.out { background: var(--bg-sunken); }
.cal-cell.weekend { background: rgba(0,0,0,.008); }
.cal-daynum { font-size: 12px; color: var(--text-muted); font-weight: 600; text-align: right; height: 20px; }
.cal-cell.out .cal-daynum { color: #c9c9c6; }
.cal-cell.today .cal-daynum span { background: var(--today); color: #fff; border-radius: 50%; width: 20px; height: 20px; display: inline-grid; place-items: center; }
.cal-cell:hover .cal-add { opacity: 1; }
.cal-add { position: absolute; left: 6px; top: 4px; opacity: 0; font-size: 15px; color: var(--text-faint); line-height: 1; }
.cal-lanes { position: absolute; left: 0; right: 0; top: 26px; bottom: 0; pointer-events: none; }
.cal-ev {
  position: absolute; height: 21px; border-radius: 4px; padding: 0 6px; font-size: 11.5px;
  display: flex; align-items: center; gap: 4px; cursor: pointer; pointer-events: auto;
  overflow: hidden; white-space: nowrap; box-shadow: inset 0 0 0 1px rgba(0,0,0,.05);
}
.cal-ev:hover { filter: brightness(.95); }
.cal-ev.done { opacity: .6; text-decoration: line-through; }
.cal-ev .ct { overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.cal-more {
  position: absolute; font-size: 11px; line-height: 16px; height: 16px; color: var(--text-muted);
  padding: 0 4px; pointer-events: auto; cursor: pointer; white-space: nowrap;
  border-radius: 3px; font-weight: 500;
}
.cal-more:hover { color: var(--text); background: var(--bg-hover); }

/* ===== 테이블 ===== */
.tbl { padding: 4px 46px 60px; }
.tgroup { margin-top: 18px; }
.tgroup-head { display: flex; align-items: center; gap: 8px; padding: 6px 4px; font-size: 13px; font-weight: 600; }
.tgroup-head .cnt { color: var(--text-faint); font-weight: 400; font-size: 12px; }
.tgroup-head .caret { color: var(--text-faint); width: 14px; transition: transform .15s; }
.tgroup.collapsed .caret { transform: rotate(-90deg); }
.tgroup.collapsed .tgroup-body { display: none; }
table.grid { width: 100%; border-collapse: collapse; }
table.grid th {
  text-align: left; font-size: 12px; font-weight: 500; color: var(--text-faint);
  padding: 7px 8px; border-bottom: 1px solid var(--border); border-top: 1px solid var(--border); white-space: nowrap;
}
table.grid td { padding: 7px 8px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
table.grid tbody tr { cursor: pointer; }
table.grid tbody tr:hover { background: var(--bg-hover); }
td.c-title { font-weight: 500; min-width: 220px; }
td.c-desc { color: var(--text-muted); font-size: 12px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.date-cell { font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.date-cell.late { color: var(--danger); font-weight: 600; }
.row-add { padding: 8px; color: var(--text-faint); font-size: 13px; width: 100%; text-align: left; border-radius: var(--radius); }
.row-add:hover { background: var(--bg-hover); color: var(--text-muted); }

/* ===== 보드 ===== */
.board { display: flex; gap: 14px; padding: 18px 46px 60px; align-items: flex-start; overflow-x: auto; min-height: 100%; }
.col { width: 300px; flex-shrink: 0; background: var(--bg-sunken); border-radius: 8px; padding: 10px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 10px; }
.col-head .cnt { color: var(--text-faint); font-size: 12px; }
.col-head .add { margin-left: auto; color: var(--text-faint); font-size: 16px; line-height: 1; }
.card {
  background: #fff; border-radius: 6px; padding: 10px; margin-bottom: 8px; cursor: pointer;
  box-shadow: 0 1px 2px rgba(15,15,15,.08), 0 0 0 1px rgba(15,15,15,.05);
}
.card:hover { box-shadow: 0 2px 6px rgba(15,15,15,.12), 0 0 0 1px rgba(15,15,15,.08); }
.card-title { font-weight: 500; font-size: 13.5px; margin-bottom: 7px; line-height: 1.35; }
.card-meta { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.card-foot { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.card-foot .avatars { margin-left: auto; }
.progress { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; margin-top: 8px; }
.progress i { display: block; height: 100%; background: var(--accent); }

/* ===== 모달 ===== */
.overlay {
  position: fixed; inset: 0; background: rgba(15,15,15,.35); display: grid; place-items: center;
  z-index: 50; padding: 24px; animation: fade .12s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: #fff; border-radius: 8px; box-shadow: var(--shadow-lg); width: 100%; max-width: 720px;
  max-height: 88vh; display: flex; flex-direction: column; animation: pop .14s ease;
}
@keyframes pop { from { transform: translateY(6px) scale(.99); opacity: 0; } }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.modal-head .sp { margin-left: auto; display: flex; gap: 6px; }
.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-foot { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; }
.modal-foot .sp { margin-left: auto; display: flex; gap: 8px; }
.title-input {
  width: 100%; border: none; font-size: 24px; font-weight: 700; padding: 4px 0 14px;
  letter-spacing: -.01em;
}
.title-input::placeholder { color: #d3d3d0; }
.prop { display: grid; grid-template-columns: 116px 1fr; align-items: start; gap: 8px; padding: 5px 0; }
.prop > label { color: var(--text-muted); font-size: 13px; display: flex; align-items: center; gap: 6px; padding-top: 6px; }
.ctl { padding: 6px 9px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: #fff; font-size: 13.5px; width: 100%; }
.ctl:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(35,131,226,.14); }
textarea.ctl { resize: vertical; min-height: 72px; line-height: 1.5; }
.row2 { display: flex; gap: 8px; align-items: center; }
.pickset { display: flex; flex-wrap: wrap; gap: 5px; padding-top: 3px; }
.pick {
  padding: 4px 9px; border-radius: 14px; border: 1px solid var(--border-strong); font-size: 12px;
  color: var(--text-muted); background: #fff; display: inline-flex; align-items: center; gap: 5px;
}
.pick:hover { background: var(--bg-hover); }
.pick.on { border-color: var(--text); color: var(--text); font-weight: 500; background: var(--bg-hover); }
.subtasks { padding-top: 4px; }
.sub-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.sub-row input[type="text"] { flex: 1; border: none; border-bottom: 1px solid transparent; padding: 3px 0; font-size: 13.5px; }
.sub-row input[type="text"]:focus { border-bottom-color: var(--border-strong); }
.sub-row input[type="text"].done { color: var(--text-faint); text-decoration: line-through; }
.sub-row .del { color: var(--text-faint); opacity: 0; padding: 0 4px; }
.sub-row:hover .del { opacity: 1; }
.errors { background: #fdebec; color: #7d2b28; border-radius: var(--radius); padding: 9px 12px; font-size: 13px; margin-bottom: 14px; }
.errors li { margin-left: 16px; }
.meta-line { font-size: 11.5px; color: var(--text-faint); }

/* 토스트 */
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--text); color: #fff; padding: 9px 15px; border-radius: 6px; font-size: 13px;
  box-shadow: var(--shadow); animation: up .16s ease;
}
.toast.err { background: var(--danger); }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

/* 활동 로그 */
.activity { padding: 10px 46px 60px; max-width: 720px; }
.act-row { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; align-items: flex-start; }
.act-row .when { margin-left: auto; color: var(--text-faint); font-size: 11.5px; white-space: nowrap; }
.act-row .what { color: var(--text-muted); }
.act-row .what b { color: var(--text); font-weight: 500; }


}

/* ===== 체크박스형 필터 ===== */
.cb {
  width: 15px; height: 15px; border-radius: 3px; border: 1.5px solid var(--border-strong);
  display: inline-grid; place-items: center; font-size: 10px; color: #fff; flex-shrink: 0;
  background: #fff; line-height: 1;
}
.cb.on { background: var(--accent); border-color: var(--accent); }
.sb-item.check { color: var(--text); }
.sb-item.check .cb:not(.on) + * { opacity: .45; }
.chip.cbchip { display: inline-flex; align-items: center; gap: 5px; padding-left: 6px; }
.chip.cbchip.on { background: #fff; color: var(--text); border-color: var(--border-strong); font-weight: 500; }
.chip.cbchip:not(.on) { color: var(--text-faint); }
.tag-lead {
  font-size: 10px; background: var(--c-yellow-bg); color: var(--c-yellow-fg);
  border-radius: 3px; padding: 1px 4px; margin-left: 4px; font-weight: 600;
}
.cal-note { padding: 8px 46px 0; font-size: 12px; color: var(--text-faint); }
.tone-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 7px; vertical-align: middle; }
.cf-flag { margin-left: auto; font-size: 11px; }

/* ===== 홈 ===== */
.home { padding: 20px 46px 60px; display: flex; flex-direction: column; gap: 16px; }
.panel { border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; background: var(--bg); }
.panel-alert { border-color: #f0d9a8; background: #fffcf5; }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-head h2 { font-size: 15px; font-weight: 700; }
.panel-sub { font-size: 12px; color: var(--text-faint); }
.panel-empty { color: var(--text-faint); font-size: 13px; padding: 10px 2px; }

.stat-row { display: flex; gap: 10px; flex-wrap: wrap; }
.stat { border: 1px solid var(--border); border-radius: 8px; padding: 10px 16px; min-width: 104px; flex: 1; }
.stat-l { font-size: 12px; color: var(--text-faint); }
.stat-n { font-size: 24px; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; }
.progress.big { height: 6px; margin-top: 14px; }

.cf-list { display: flex; flex-direction: column; }
.cf-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 6px; border-top: 1px solid var(--border);
  cursor: pointer; border-radius: 4px;
}
.cf-row:first-child { border-top: none; }
.cf-row:hover { background: var(--bg-hover); }
.cf-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.cf-main { min-width: 0; flex: 1; }
.cf-title { font-size: 13.5px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.cf-meta { font-size: 11.5px; color: var(--text-faint); margin-top: 3px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.cf-act { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.cf-recent { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-faint); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cf-recent-item { cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.cf-recent-item:hover { color: var(--text); }
.due { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.due.late { color: var(--danger); font-weight: 600; }

table.home-grid td { padding: 9px 8px; }
table.home-grid td.num, table.home-grid th.num { text-align: center; font-variant-numeric: tabular-nums; }
table.home-grid td.num.zero { color: var(--text-faint); }
table.home-grid td.num.strong { font-weight: 700; }
table.home-grid td.p-name { display: flex; align-items: center; gap: 7px; font-weight: 500; }
table.home-grid .rate { font-size: 11px; color: var(--text-faint); margin-top: 3px; text-align: right; }
table.home-grid tbody tr:hover { background: transparent; }

/* 모달 안 컨펌 박스 */
.cf-box { border: 1px solid var(--border); border-radius: 8px; padding: 11px 13px; margin: 4px 0 14px; background: var(--bg-sunken); }
.cf-box.wait { border-color: #ecd9a5; background: #fffbf0; }
.cf-box.ok { border-color: #cbe5cf; background: #f3faf4; }
.cf-box.no { border-color: #f2cdcd; background: #fdf4f4; }
.cf-box-t { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.cf-box-m { font-size: 12px; color: var(--text-muted); }
.cf-box-a { display: flex; gap: 6px; margin-top: 9px; align-items: center; flex-wrap: wrap; }

@media (max-width: 900px) {
  .home { padding-left: 18px; padding-right: 18px; }
  .cal-note { padding-left: 18px; }
}


/* ===== 추가 색상 (담당자 10명까지) ===== */
.av-indigo { background: #5b5bd6; } .av-lime { background: #6b8e23; }
.av-brown { background: #8b5a2b; }  .av-slate { background: #5b6b7c; }

.sb-note {
  font-size: 11.5px; color: var(--text-faint); line-height: 1.5;
  padding: 8px 10px; margin: 6px 4px 0; background: var(--bg-hover); border-radius: 6px;
}
.sb-note b { color: var(--text-muted); }
.sb-phone { width: 100%; margin-top: 8px; justify-content: center; }
.sb-close { display: none; margin-left: auto; }
.scrim { position: fixed; inset: 0; background: rgba(15,15,15,.35); z-index: 19; }
.bottomnav { display: none; }

/* 휴대폰 안내 모달 */
.modal-sm { max-width: 440px; }
.guide-p { font-size: 13px; line-height: 1.6; color: var(--text-muted); margin-bottom: 8px; }
.guide-p.muted { color: var(--text-faint); font-size: 12px; }
.guide-p b { color: var(--text); }
.urlbox {
  display: flex; align-items: center; gap: 8px; background: var(--bg-sunken);
  border: 1px solid var(--border); border-radius: 6px; padding: 9px 11px; margin-bottom: 8px;
}
.urlbox code { font-size: 14px; font-weight: 600; flex: 1; word-break: break-all; }
.guide-box { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin: 14px 0 10px; }
.guide-t { font-weight: 600; font-size: 13px; margin-bottom: 8px; }

/* ============================================================
   태블릿
   ============================================================ */
@media (max-width: 1100px) {
  .page-head, .tabs, .toolbar, .tbl, .board, .cal-note, .activity, .home { padding-left: 22px; padding-right: 22px; }
}

/* ============================================================
   휴대폰 — 사이드바는 서랍, 아래에 탭 바
   ============================================================ */
@media (max-width: 900px) {
  .page-head, .tabs, .toolbar, .tbl, .board, .cal-note, .activity, .home {
    padding-left: 14px; padding-right: 14px;
  }

  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 268px; z-index: 20;
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg);
    display: flex;
  }
  .sidebar.open { transform: none; }
  .sidebar.collapsed { display: flex; }
  .sb-close { display: grid; }
  .sb-item { padding: 9px 8px; }

  .topbar { height: 52px; padding: 0 12px; position: sticky; top: 0; background: var(--bg); z-index: 8; }
  .hide-sm { display: none; }
  .page-head { padding-top: 16px; }
  .page-title { font-size: 24px; }
  .page-desc { display: none; }

  .tabs { display: none; }                    /* 아래 탭 바로 대체 */
  .toolbar { padding-top: 8px; padding-bottom: 8px; gap: 6px; position: sticky; top: 52px; z-index: 7; }
  .search { min-width: 0; flex: 1 1 100%; }
  .toolbar-right { margin-left: 0; flex: 1 1 100%; }
  .chipset { flex: 1 1 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .chip, .btn { padding: 7px 11px; }
  .seg button { padding: 7px 12px; }

  .view { padding-bottom: 62px; }             /* 탭 바 높이만큼 */

  .bottomnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
    background: rgba(255,255,255,.96); backdrop-filter: blur(8px);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bn-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 7px 2px 8px; color: var(--text-faint); font-size: 10.5px;
  }
  .bn-item.active { color: var(--accent); }
  .bn-ico { font-size: 17px; line-height: 1.1; }
  .bn-item.active .bn-ico { transform: scale(1.06); }

  /* 표는 가로 스크롤 */
  .tgroup-body, .home-grid { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.grid { min-width: 620px; }
  table.home-grid { min-width: 660px; }
  td.c-desc { display: none; }
  table.grid th:last-child { display: none; }

  /* 캘린더는 가로 스크롤로 월 구조 유지 */
  .cal { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .cal-grid { min-width: 700px; }
  .cal-ev { font-size: 11px; }

  /* 보드는 한 칸씩 스와이프 */
  .board { gap: 10px; scroll-snap-type: x mandatory; }
  .col { width: 84vw; scroll-snap-align: start; }

  /* 홈 */
  .home { gap: 12px; }
  .panel { padding: 14px; border-radius: 8px; }
  .stat { min-width: 88px; padding: 9px 12px; }
  .stat-n { font-size: 20px; }
  .cf-row { flex-wrap: wrap; }
  .cf-act { width: 100%; margin-left: 18px; padding-top: 4px; }

  /* 모달은 아래에서 올라오는 시트 */
  .overlay { padding: 0; align-items: flex-end; }
  .modal { max-width: none; max-height: 92vh; border-radius: 14px 14px 0 0; animation: sheet .18s ease; }
  .modal-sm { max-width: none; }
  .modal-body { padding: 16px 16px 24px; }
  .modal-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .title-input { font-size: 20px; }
  .prop { grid-template-columns: 1fr; gap: 4px; padding: 8px 0; }
  .prop > label { padding-top: 0; font-size: 12px; color: var(--text-faint); }
  .pick { padding: 7px 11px; }
  .ctl { padding: 9px 10px; font-size: 16px; }   /* 16px 미만이면 iOS가 화면을 확대합니다 */
  .modal-foot .btn { padding: 9px 16px; }
  @keyframes sheet { from { transform: translateY(24px); } }

  /* 타임라인 */
  .tl-left { width: 168px; }
  .tl-row-label { padding-left: 12px; font-size: 12px; }
  .tl-group-head { padding: 0 10px; }
  .tl-sub-head { padding-left: 12px; }

  .toasts { bottom: 74px; }
}

/* 아주 좁은 화면 */
@media (max-width: 400px) {
  .bn-l { font-size: 9.5px; }
  .stat { flex: 1 1 44%; }
}

/* 홈 화면에 추가해 앱처럼 실행할 때 */
@media (display-mode: standalone) {
  .topbar { padding-top: env(safe-area-inset-top); height: calc(52px + env(safe-area-inset-top)); }
}


/* ===== 신원 선택 / 승인 대기 화면 ===== */
#gate {
  position: fixed; inset: 0; z-index: 60; background: var(--bg-sidebar);
  display: grid; place-items: center; padding: 24px; overflow-y: auto;
}
/* hidden 속성이 display 선언에 밀리지 않도록 */
#gate[hidden], .app[hidden], [hidden] { display: none !important; }
.gate-card {
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow); padding: 34px 30px; width: 100%; max-width: 400px; text-align: center;
}
.gate-logo { font-size: 40px; line-height: 1; margin-bottom: 12px; }
.gate-card h1 { font-size: 20px; font-weight: 700; margin-bottom: 8px; letter-spacing: -.01em; }
.gate-sub { font-size: 13.5px; color: var(--text-muted); line-height: 1.65; margin-bottom: 18px; }
.gate-msg {
  background: var(--c-yellow-bg); color: var(--c-yellow-fg); border-radius: 6px;
  padding: 9px 12px; font-size: 12.5px; margin-bottom: 16px; line-height: 1.5;
}
.gate-people { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.gate-person {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; width: 100%;
  border: 1px solid var(--border-strong); border-radius: 9px; background: #fff;
  font-size: 14.5px; font-weight: 500; text-align: left;
}
.gate-person:hover { background: var(--bg-hover); border-color: var(--text-faint); }
.gate-new { width: 100%; padding: 11px; margin-bottom: 12px; }
.gate-note { font-size: 12px; color: var(--text-faint); line-height: 1.6; }
.gate-note b { color: var(--text-muted); }
.gate-card .btn { margin: 0 3px 6px; }

@media (max-width: 900px) {
  .gate-card { padding: 28px 20px; }
}


/* ===== 캘린더 상단 월 표시 ===== */
.cal-top {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 22px 46px 16px; position: relative;
}
.cal-month { display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 190px; }
.cal-month h2 {
  font-size: 27px; font-weight: 600; letter-spacing: -.02em; color: var(--text-muted);
  line-height: 1.15; white-space: nowrap;
}
.cal-month h2 b { font-weight: 800; color: var(--text); }
.cal-nav {
  width: 38px; height: 38px; border-radius: 50%; font-size: 22px; color: var(--text-muted);
  display: grid; place-items: center; border: 1px solid var(--border); background: #fff; line-height: 1;
}
.cal-nav:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border-strong); }

/* ===== 타임라인 끌어서 이동 ===== */
#tl-wrap { cursor: grab; }
#tl-wrap.grabbing { cursor: grabbing; user-select: none; }
#tl-wrap.grabbing .bar { pointer-events: none; }

@media (max-width: 900px) {
  .cal-top { padding: 14px 14px 10px; gap: 8px; }
  .cal-month h2 { font-size: 22px; }
  .cal-nav { width: 34px; height: 34px; font-size: 20px; }
}


/* ===== 비밀번호 입력 ===== */
.pw-input {
  font-size: 16px; padding: 12px 14px; text-align: center; letter-spacing: .08em;
  margin-bottom: 10px;
}
#pw-form { margin-bottom: 12px; }
#pw-form .gate-new { margin: 0; }


/* ===== 팀원 관리 ===== */
.role-pick { padding: 5px 8px; font-size: 12px; background: #fff; }
.role-pick:disabled { opacity: .5; cursor: not-allowed; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:disabled:hover { background: #fff; }
.tag-me {
  font-size: 10px; background: var(--c-blue-bg); color: var(--c-blue-fg);
  border-radius: 3px; padding: 1px 5px; margin-left: 5px; font-weight: 600;
}


/* ===== 로그인 화면 — 이름 + 비밀번호 ===== */
.gate-person { position: relative; transition: border-color .12s, background .12s; }
.gate-person.on {
  border-color: var(--accent); background: #f4f9fe;
  box-shadow: inset 0 0 0 1px var(--accent);
}
.gate-check { margin-left: auto; color: var(--accent); font-weight: 700; opacity: 0; }
.gate-person.on .gate-check { opacity: 1; }
#login-form .pw-input { margin-top: 4px; }
#login-form .gate-new { margin-bottom: 0; }
#gate-register { margin-top: 10px; font-size: 13px; }


/* ===== 프로필 사진 ===== */
img.avatar.photo { object-fit: cover; display: inline-block; padding: 0; }
.avatars img.avatar + img.avatar,
.avatars img.avatar + .avatar,
.avatars .avatar + img.avatar { margin-left: -5px; box-shadow: 0 0 0 2px #fff; }
.gate-person img.avatar, .pcard-top img.avatar { flex-shrink: 0; }

/* ===== 담당자별 현황 — 휴대폰용 카드 ===== */
.pcards { display: none; flex-direction: column; gap: 10px; }
.pcard { border: 1px solid var(--border); border-radius: 8px; padding: 11px 12px; }
.pcard-top { display: flex; align-items: center; gap: 8px; }
.pcard-name { font-weight: 600; font-size: 14px; }
.pcard-total { margin-left: auto; font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.pcard-cats { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin: 9px 0 7px; font-size: 12px; }
.pcard-cats b { font-weight: 700; margin-right: 5px; font-variant-numeric: tabular-nums; }
.pcard-none { color: var(--text-faint); font-size: 12px; }
.pcard-nums { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.pcard-nums i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 4px; }
.pcard-nums b { color: var(--text); font-variant-numeric: tabular-nums; }
.pcard-nums .late b { color: var(--danger); }

/* ===== 캘린더 — 날짜별 점 (휴대폰) ===== */
.cal-dots { display: none; }

@media (max-width: 900px) {
  /* 담당자별 현황: 표 대신 카드 */
  .pcards { display: flex; }
  table.home-grid { display: none; }

  /* 캘린더를 한 화면에 — 막대 대신 점, 날짜를 누르면 목록 */
  .cal { overflow-x: visible; }
  .cal-grid { min-width: 0; }
  .cal-lanes { display: none; }
  .cal-week { --cell-h: auto !important; }
  .cal-cell { min-height: 60px !important; padding: 3px 2px; }
  .cal-daynum { font-size: 12px; height: 17px; text-align: center; }
  .cal-cell.today .cal-daynum span { width: 18px; height: 18px; }
  .cal-dow div { text-align: center; padding: 6px 2px; font-size: 11px; }
  .cal-add { display: none; }

  .cal-dots {
    display: flex; flex-wrap: wrap; align-content: flex-start; justify-content: center;
    gap: 3px; width: 100%; padding: 2px 1px 0; min-height: 26px; background: none; border: none;
  }
  .cal-dots i { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
  .cal-dots em { font-size: 9px; font-style: normal; color: var(--text-faint); line-height: 7px; }
  .cal-cell:active { background: var(--bg-hover); }
  .cal-note { padding-left: 14px; padding-right: 14px; }
}

@media (max-width: 380px) {
  .cal-cell { min-height: 54px !important; }
  .cal-dots i { width: 6px; height: 6px; }
}


/* ===== 프로필 사진 크게 보기 ===== */
img.avatar.photo { cursor: zoom-in; }
img.avatar.photo:hover { box-shadow: 0 0 0 2px var(--accent); }

.photo-overlay { align-items: center !important; padding: 24px !important; }
.photo-view {
  background: #fff; border-radius: 14px; padding: 22px; text-align: center;
  box-shadow: var(--shadow-lg); animation: pop .14s ease; max-width: 92vw;
}
.photo-big {
  width: 260px; height: 260px; max-width: 74vw; max-height: 74vw;
  border-radius: 16px; object-fit: cover; display: block; margin: 0 auto 14px;
  background: var(--bg-hover);
}
.photo-big.photo-none {
  display: grid; place-items: center; color: #fff; font-size: 92px; font-weight: 700;
}
.photo-name { font-size: 17px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.photo-acts { display: flex; gap: 7px; justify-content: center; flex-wrap: wrap; }

/* 큰 아바타가 쓰이는 곳 */
.gate-person .avatar { width: 32px; height: 32px; font-size: 14px; }
.pcard-top .avatar { width: 34px; height: 34px; font-size: 15px; }
.home-grid td.p-name .avatar { width: 30px; height: 30px; font-size: 13px; }
.cf-row > .avatar { width: 30px; height: 30px; font-size: 13px; }
.modal .pick .avatar { width: 22px; height: 22px; font-size: 11px; }

/* 줄 높이가 늘어난 만큼 맞춰 줍니다 */
.tl-group-head { height: 40px; }
.sb-item .avatar.sm { width: 21px; height: 21px; }

@media (max-width: 900px) {
  .photo-view { padding: 18px; }
  .photo-big { width: 220px; height: 220px; }
}
