:root {
  --bg: #f5f6f8;
  --card: #fff;
  --line: #dde1e6;
  --text: #1f2328;
  --muted: #667085;
  --primary: #2f5bea;
  --danger: #d92d20;
  --ok: #079455;
  --radius: 8px;
  --control-h: 38px;
  /* 선택칸·프로젝트 고르기 공통 아래 화살표(회색 꺾쇠) */
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23667085' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Pretendard", "Malgun Gothic", system-ui, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  word-break: keep-all;
}

/* 머리말 */
.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 20px; background: var(--card); border-bottom: 1px solid var(--line);
}
.topbar[hidden] { display: none; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.menu { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.menu a { padding: 6px 10px; border-radius: 6px; color: var(--muted); text-decoration: none; }
.menu a.active, .menu a:hover { background: var(--bg); color: var(--text); }
.who { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.who-link { display: inline-flex; align-items: center; gap: 6px; height: auto; padding: 2px 6px; border: 0; border-radius: 6px; background: none; color: var(--text); font: inherit; text-decoration: none; cursor: pointer; }
.who-link[aria-expanded=true] { background: var(--bg); }
.who-link:hover { background: var(--bg); }

/* 아이콘(Lucide 스프라이트) */
.icon { display: inline-block; flex: none; vertical-align: middle; }
.icon-btn {
  position: relative; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 8px; background: none;
  display: inline-flex; align-items: center; justify-content: center; color: var(--muted);
}
.icon-btn:hover, .icon-btn[aria-expanded=true] { background: var(--bg); color: var(--text); }

/* 사용자 정보 카드(누른 자리에 뜬다) */
.user-card {
  position: absolute; z-index: 90; width: 300px; max-width: calc(100vw - 16px); background: #fff;
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 28px rgba(0, 0, 0, .16); padding: 14px;
}
.user-card-head { display: flex; align-items: center; gap: 12px; }
.user-card-name { flex: 1; min-width: 0; display: grid; gap: 2px; }
.user-card-name strong { font-size: 15px; overflow-wrap: anywhere; }
.user-card-name .muted { font-size: 13px; }
.user-card-head .icon-btn { width: 28px; height: 28px; align-self: flex-start; }
.user-card-info { margin: 12px 0 0; display: grid; gap: 6px; border-top: 1px solid var(--line); padding-top: 10px; }
.user-card-row { display: grid; grid-template-columns: 68px minmax(0, 1fr); gap: 8px; align-items: baseline; font-size: 13px; }
.user-card-row dt { color: var(--muted); }
.user-card-row dd { margin: 0; overflow-wrap: anywhere; }
.user-card-row a { color: var(--primary); text-decoration: none; }
.user-card-row a:hover { text-decoration: underline; }
.user-card-projects { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.user-card-loading { margin: 4px 0; }
/* 목록의 사용자(누르면 카드) */
button.user-link {
  height: auto; padding: 2px 4px; margin: -2px -4px; border: 0; background: none; text-align: left;
  white-space: normal; border-radius: 6px; font: inherit; color: inherit;
}
button.user-link:hover { background: var(--bg); }
button.user-link:hover strong { color: var(--primary); text-decoration: underline; }

/* 알림(머리말 종) */
.notif { position: relative; }
.notif-count {
  position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}
.notif-count[hidden] { display: none; }
.notif-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; width: 360px; max-height: 70vh; overflow: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
}
.notif-panel[hidden] { display: none; }
.notif-head {
  position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; background: #fff; border-bottom: 1px solid var(--line);
}
.notif-head button.link { display: inline-flex; align-items: center; gap: 4px; }
.notif-list { list-style: none; margin: 0; padding: 4px; display: grid; gap: 2px; }
.notif-item { display: flex; gap: 10px; padding: 10px; border-radius: 6px; color: var(--text); text-decoration: none; }
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: #f3f6fe; }
.notif-item.unread:hover { background: #e9eefc; }
.notif-text { min-width: 0; display: grid; gap: 2px; font-size: 13px; }
.notif-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-excerpt { color: var(--muted); overflow-wrap: anywhere; }
.notif-text time { font-size: 12px; }
.notif-empty { margin: 0; padding: 24px; text-align: center; color: var(--muted); }

/* 프로필 사진 */
.avatar { border-radius: 50%; object-fit: cover; flex: none; display: inline-block; vertical-align: middle; }
.avatar-initial { display: inline-flex; align-items: center; justify-content: center; background: #e4e9f7; color: var(--primary); font-weight: 700; }
.author { display: inline-flex; align-items: center; gap: 6px; }
.profile-card { max-width: 640px; margin-left: auto; margin-right: auto; }
.profile { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.profile-actions .actions { margin-top: 0; }
label.button {
  display: inline-flex; align-items: center; height: var(--control-h); padding: 0 14px; border-radius: 6px;
  border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 400;
}
label.button:focus-within { outline: 2px solid var(--primary); }

/* 목록 섬네일 */
.title-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; }
button.thumb {
  position: relative; flex: none; width: 56px; height: 42px; padding: 0; border-radius: 6px; overflow: hidden;
  border: 1px solid var(--line); background: var(--bg); cursor: zoom-in;
}
button.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
button.thumb.large { width: 160px; height: 120px; }
.thumb-count {
  position: absolute; right: 2px; bottom: 2px; padding: 0 4px; border-radius: 4px;
  background: rgba(0, 0, 0, .65); color: #fff; font-size: 11px; line-height: 16px;
}

/* 원본 이미지 모달 */
body.no-scroll { overflow: hidden; }
.viewer { position: fixed; inset: 0; z-index: 100; background: rgba(15, 18, 24, .88); display: flex; flex-direction: column; }
.viewer-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; color: #fff; }
.viewer-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-count { color: #c9ced6; }
.viewer-open { color: #c9ced6; }
.viewer-close { background: none; border: 0; color: #fff; font-size: 28px; height: 40px; width: 40px; padding: 0; }
.viewer-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 8px 16px; }
.viewer-img { max-width: calc(100% - 112px); max-height: 100%; object-fit: contain; background: #fff; }
.viewer-nav { flex: none; width: 48px; height: 64px; font-size: 32px; background: rgba(255, 255, 255, .12); border: 0; color: #fff; }
.viewer-nav[hidden] { display: none; }

/* 본문 */
.page { margin: 24px auto; padding: 0 24px; }   /* 화면 폭 끝까지(로그인·내 정보 카드는 각자 폭) */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card + .card { margin-top: 16px; }
.narrow { max-width: 420px; margin: 48px auto; }
h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.muted { color: var(--muted); }

/* 폼 */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; }
.req { color: var(--danger); margin-left: 2px; }
input, select, textarea {
  font: inherit; color: inherit;
  height: var(--control-h); padding: 0 10px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
  width: 100%;
}
textarea { height: auto; min-height: 90px; padding: 8px 10px; }
/* 선택칸: 브라우저 화살표 대신 같은 꺾쇠를 왼쪽 여백(10px)과 같은 간격으로 오른쪽에 둔다 */
select {
  appearance: none; -webkit-appearance: none;
  padding-right: 32px;
  background: #fff var(--chevron) no-repeat right 10px center / 12px 12px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.inline { display: flex; gap: 8px; }
.inline input { flex: 1; min-width: 0; }

button {
  font: inherit; height: var(--control-h); padding: 0 14px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--text); white-space: nowrap;
}
button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.danger { color: var(--danger); }
button.small { height: 30px; padding: 0 10px; font-size: 13px; }
button.link { border: 0; background: none; padding: 0; height: auto; color: var(--muted); text-decoration: underline; }
button:disabled { opacity: .5; cursor: default; }
.wide { width: 100%; }

.error { color: var(--danger); min-height: 1.2em; margin: 4px 0 0; }

/* 탭 */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { flex: none; }
.tabs { scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--muted); }
.tabs button.active { border-bottom-color: var(--primary); color: var(--text); font-weight: 600; }

/* 표 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
td.nowrap { white-space: nowrap; }
td.break { overflow-wrap: anywhere; }
.empty { padding: 24px; text-align: center; color: var(--muted); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: var(--bg); }
.badge.on { background: #e7f6ee; color: var(--ok); }

/* 링크를 버튼처럼 */
a.button {
  display: inline-flex; align-items: center; height: var(--control-h); padding: 0 14px; border-radius: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--text); text-decoration: none; white-space: nowrap;
}
a.button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
a.button { gap: 4px; }
.with-icon { display: inline-flex; align-items: center; gap: 4px; }
.push-right { margin-left: auto; }
a.button.small { height: 30px; padding: 0 10px; font-size: 13px; }
button.icon { width: 30px; padding: 0; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.help { color: var(--muted); font-size: 13px; }
.label { font-weight: 600; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head h1, .page-head h2 { margin: 0; }
.page-head .actions { margin-top: 0; }
.row-actions { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
/* 표 칸은 표 칸으로 둔다 — inline-flex 가 되면 밑줄·높이가 다른 칸과 어긋난다 */
td.row-actions { display: table-cell; text-align: right; }
td.row-actions > * + * { margin-left: 6px; }
/* 표 아래 추가 폼: 표와 붙지 않게 띄우고 옅은 상자로 구분 */
.table-wrap + form.inline { margin-top: 16px; padding: 12px; background: var(--bg); border-radius: var(--radius); flex-wrap: wrap; }
.table-wrap + form.inline input { min-width: 160px; }
/* 기본 그룹 이름 + 배지 */
.group-name { display: inline-flex; align-items: center; gap: 8px; min-height: var(--control-h); }
/* 표 안 개수 링크(멤버 n명 등): 파란 밑줄 대신 옅은 알약 */
a.count-link {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px;
  background: var(--bg); color: var(--text); text-decoration: none; font-size: 13px; font-variant-numeric: tabular-nums;
}
a.count-link span { color: var(--muted); }
a.count-link:hover { background: #eef2fe; color: var(--primary); }
a.count-link:hover span { color: var(--primary); }
.narrow-form { max-width: 560px; }

/* 상태 표시 */
.badge.status { background: #eef2fe; color: var(--primary); white-space: nowrap; }
.badge.status.closed { background: var(--bg); color: var(--muted); }

/* 게시판 목록 */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.filters select { width: auto; min-width: 140px; }
.filters input { flex: 1; min-width: 160px; width: auto; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: #fafbfc; }
.title-cell a { color: var(--text); text-decoration: none; font-weight: 600; overflow-wrap: anywhere; }
.title-cell a:hover { text-decoration: underline; }
.col-no { width: 64px; color: var(--muted); }
.board-table th { text-align: center; }
/* 칸 정렬: 목록 설정에서 열마다 정한다 */
.board-table td.al-left { text-align: left; }
.board-table td.al-center { text-align: center; }
.board-table td.al-right { text-align: right; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 16px; }

/* 글 보기 */
.post-fields { margin: 16px 0; display: grid; gap: 0; }
.post-field { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.post-field dt { color: var(--muted); font-weight: 600; }
.post-field dd { margin: 0; overflow-wrap: anywhere; }
.pre { white-space: pre-wrap; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.thumbs img { max-width: 240px; max-height: 180px; border: 1px solid var(--line); border-radius: 6px; }
.file-list { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 4px; }
.file-list li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; overflow-wrap: anywhere; }
.file-field input[type=file] { height: auto; padding: 6px; }

/* 라디오·체크박스 묶음 */
fieldset.field { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
fieldset.field legend { font-weight: 600; padding: 0; margin-bottom: 6px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px 16px; }
/* .field label 의 굵은 글씨를 선택지에는 쓰지 않는다 */
.choice-item, .check, .field .choice-item, .field .check { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; cursor: pointer; }
.choice-item input, .check input { width: 16px; height: 16px; margin: 0; }

/* 사용자 검색 */
.user-search { position: relative; }
.search-results { list-style: none; margin: 4px 0 0; padding: 0; border: 1px solid var(--line); border-radius: 6px; max-height: 240px; overflow-y: auto; }
.search-results:empty { display: none; }
.search-results li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.search-results li:last-child { border-bottom: 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; background: #eef2fe; }
.chip button { text-decoration: none; font-size: 16px; }

/* 끌어서 순서 바꾸는 목록 */
/* minmax(0, 1fr): 항목이 내용 최소폭만큼 늘어나 목록(편집 칸) 밖으로 나가지 않게 */
.sort-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.sort-item { display: flex; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; flex-wrap: wrap; }
.sort-item input:not([type=checkbox]) { flex: 1; min-width: 140px; width: auto; }
.sort-item.dragging { opacity: .5; }
/* 끌기 손잡이: 글자(⋮⋮)는 두 개로 보여서 점 2×3 하나로 그린다 */
.handle {
  flex: none; width: 10px; height: 16px; margin: 0 2px; cursor: grab; user-select: none; opacity: .55;
  background: radial-gradient(circle, var(--muted) 1.4px, transparent 1.6px) 0 0 / 5px 5.33px;
}
.move { display: inline-flex; gap: 4px; }

/* 진행상태 › 중분류 */
.sort-item.status-item { display: block; }
.status-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.status-row input:not([type=checkbox]) { flex: 1; min-width: 140px; width: auto; }
/* 이름 칸 옆의 체크·버튼 묶음: 칸이 좁으면 묶음째 다음 줄로(오른쪽 끝에 버튼) */
.status-opts { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; flex: 0 1 auto; margin-left: auto; }
.status-opts .row-actions { flex-wrap: nowrap; }
.status-row > input[data-name], .sub-item > input[data-sub-name] { flex: 3 1 160px; }
.sub-box { margin: 8px 0 0 28px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.sort-item .sub-add input { min-width: 0; }
.sub-list { margin: 0; gap: 4px; }
.sub-item { padding: 4px 8px; background: #fafbfc; }
.sub-item.is-hidden input[data-sub-name] { color: var(--muted); text-decoration: line-through; }
.sub-mark { color: var(--muted); }
.sub-add input { height: 32px; }
.field[hidden] { display: none; }

/* 항목 편집기: 왼쪽 목록, 오른쪽 편집 */
.editor-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.field-item { flex-wrap: nowrap; }
.field-item.selected { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.field-item.is-hidden .field-pick strong { color: var(--muted); text-decoration: line-through; }
.field-pick {
  flex: 1; min-width: 0; height: auto; border: 0; background: none; padding: 2px 0; text-align: left;
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start;
}
.field-pick strong { overflow-wrap: anywhere; }
.badges { display: flex; gap: 4px; flex-wrap: wrap; }
.editor-panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.empty-panel { color: var(--muted); display: grid; gap: 12px; justify-items: start; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.checks { display: flex; gap: 8px 20px; flex-wrap: wrap; margin-bottom: 14px; }
.option-list { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 6px; }
.option-list li { display: flex; gap: 6px; align-items: center; }
.option-list input { flex: 1; width: auto; min-width: 0; }
.preview-box { border: 1px dashed var(--line); border-radius: var(--radius); padding: 12px; margin: 8px 0 12px; background: #fafbfc; }
.preview-box > .label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.preview-box.full { margin-top: 16px; background: #fff; }

/* 상세 설정: 기본 항목 / 입력 항목 */
.list-title { display: flex; align-items: baseline; gap: 8px; margin: 0 0 6px; font-size: 13px; font-weight: 600; }
.list-title .muted { font-weight: 400; font-size: 12px; }
.editor-list .list-title:not(:first-child) { margin-top: 16px; }
.builtin-list { gap: 4px; }
.builtin-item { flex-wrap: nowrap; padding: 6px 8px; background: #fafbfc; }
.builtin-item.selected { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); background: #fff; }
.builtin-item .field-pick { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.builtin-item .field-pick strong { overflow-wrap: anywhere; }
.builtin-item:hover { border-color: #c4ccd8; }
.pick-arrow { color: var(--muted); font-size: 18px; padding: 0 4px; }
.status-editor { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.status-editor h3 { font-size: 15px; margin: 0 0 8px; }

/* 목록 설정: 왼쪽 열 목록(보이기·정렬·순서), 오른쪽 행 수·미리보기 */
.list-settings { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.col-item { flex-wrap: nowrap; }
/* 열 이름은 140px 아래로 줄이지 않는다 — 칸이 좁으면 정렬·순서 버튼이 다음 줄로 간다 */
.col-item .col-check { flex: 1 1 140px; min-width: 0; overflow-wrap: anywhere; }
.col-item .badges { flex: none; }
.align-seg { display: inline-flex; flex: none; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.align-seg button { height: 28px; width: 32px; padding: 0; border: 0; border-radius: 0; font-size: 12px; color: var(--muted); }
.align-seg button + button { border-left: 1px solid var(--line); }
.align-seg button.active { background: #eef2fe; color: var(--primary); font-weight: 600; }
table.preview-head td { font-size: 12px; white-space: nowrap; color: var(--muted); }

/* ---------- 게시판 탭 ---------- */
.board-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 0 0 12px; }
.board-tabs a {
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted);
  text-decoration: none; font-size: 13px; white-space: nowrap;
}
.board-tabs a:hover { color: var(--text); }
.board-tabs a.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.board-tabs a.off { border-style: dashed; }
.board-pick { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.board-pick .board-tabs { margin: 0; }

/* ---------- 화면 머리·프로젝트 여러 개 고르기 ---------- */
.head-title { min-width: 0; }
.eyebrow { margin: 0 0 2px; font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.multi-pick { position: relative; }
/* 선택칸(select)과 같은 모양: 높이·여백·모서리·꺾쇠 */
.multi-pick > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; height: var(--control-h);
  padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; white-space: nowrap;
  max-width: 240px;
}
.multi-pick > summary::-webkit-details-marker { display: none; }
.multi-pick > summary::after {
  content: ''; flex: none; width: 12px; height: 12px; margin-left: auto; background: var(--chevron) no-repeat center / 12px 12px;
}
.multi-pick > summary [data-pick-label] { overflow: hidden; text-overflow: ellipsis; }
.multi-pick[open] > summary { border-color: var(--primary); }
.multi-pick-panel {
  position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; min-width: 220px; max-width: min(320px, 90vw);
  max-height: 320px; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .12); padding: 8px; display: flex; flex-direction: column; gap: 2px;
}
.multi-pick-panel .check { display: flex; justify-content: flex-start; padding: 6px 8px; border-radius: 6px; }
.multi-pick-panel input[type=checkbox] { flex: none; min-width: 0; width: auto; margin: 0; }
.multi-pick-panel .check:hover { background: var(--bg, #f4f5f7); }
.multi-pick-panel .pick-all { border-bottom: 1px solid var(--line); border-radius: 0; margin-bottom: 4px; }
/* 진행상태 고르기: 중분류는 상태 아래에 들여 쓴다 */
.multi-pick-panel .check.pick-sub { padding-left: 30px; color: var(--muted); }
.multi-pick-actions { display: flex; justify-content: flex-end; padding-top: 6px; border-top: 1px solid var(--line); margin-top: 4px; }

/* ---------- 게시판 권한 ---------- */
.perm-row { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin: 0 0 12px; }
.perm-row legend { font-weight: 600; padding: 0 4px; }
.perm-row .help { margin: 0 0 8px; }
.perm-scopes, .perm-groups { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.perm-groups[hidden] { display: none; }
.perm-groups { margin-top: 8px; padding: 8px 10px; background: var(--bg, #f4f5f7); border-radius: 6px; }

/* ---------- 목록 정렬·열 ---------- */
.sort-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 4px 0 8px; font-size: 13px; }
.sort-chip { padding: 2px 8px; gap: 2px; }
.sort-chip button.link { color: var(--primary); text-decoration: none; font-size: 13px; }
.sort-chip.muted { background: var(--bg); }
/* 낮은 선택칸도 여백·꺾쇠는 다른 선택칸과 같다(왼쪽 10px, 꺾쇠 오른쪽 10px) */
select.sort-add { width: auto; height: 30px; font-size: 13px; padding: 0 32px 0 10px; }
button.sort-head {
  border: 0; background: none; padding: 0; height: auto; font: inherit; font-weight: 600; color: var(--muted);
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
}
button.sort-head:hover, button.sort-head.on { color: var(--text); }
.sort-icon { font-size: 11px; color: var(--muted); }
button.sort-head.on .sort-icon { color: var(--primary); }
.sort-icon sub { font-size: 9px; }
th.col-thumb, td.col-thumb { width: 64px; }
.comment-count { font-size: 12px; margin-left: 4px; }
.col-check { flex: 1; font-weight: 600; }
.sort-item.is-hidden .col-check { color: var(--muted); font-weight: 400; }
table.preview-head th { white-space: nowrap; font-size: 12px; }

/* ---------- 답글·활동 ---------- */
.thread h2 { display: flex; gap: 6px; align-items: baseline; }
.timeline { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; }
.timeline .activity { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); padding: 4px 0; }
.timeline .activity strong { color: var(--text); font-weight: 600; }
/* 답글은 상자 없이 평평하게: 답글 사이 얇은 선, 답글의 답글은 들여쓰고 왼쪽 세로선만 */
.timeline .comment { display: flex; gap: 10px; padding: 14px 0; border-top: 1px solid var(--line); }
.timeline .comment.flash { background: #f5f8ff; box-shadow: 0 0 0 6px #f5f8ff; border-radius: 4px; }
.replies { list-style: none; margin: 8px 0 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); display: grid; gap: 0; }
.timeline .replies .comment { padding: 8px 0; border-top: 0; }
.reply-slot:not(:empty) { margin-top: 10px; }
.reply-form textarea { min-height: 60px; }
/* 답글·수정·삭제: 본문 아래 작은 회색 글자 */
.comment-actions { display: flex; gap: 14px; margin-top: 6px; }
.comment-actions button.link { color: var(--muted); font-size: 13px; font-weight: 600; text-decoration: none; }
.comment-actions button.link:hover { color: var(--text); }
.comment-actions button.link[data-delete-comment]:hover { color: var(--danger); }
/* 멘션한 이름: 누르면 사용자 정보 카드 */
button.mention {
  display: inline; height: auto; padding: 0 2px; border: 0; border-radius: 4px; background: #eef2fe;
  color: var(--primary); font: inherit; font-weight: 600; white-space: normal; cursor: pointer;
}
button.mention:hover { background: #dfe7fd; text-decoration: underline; }
.thread h2 .icon { color: var(--muted); align-self: center; }

/* '@' 멘션 고르기 */
.mention-wrap { position: relative; }
/* 입력칸 아래 글자 기준선 여백이 생기지 않게 */
.mention-wrap > textarea { display: block; }
/* 위치(left·top)는 '@'를 친 글자 바로 아래로 thread.js 가 정한다 */
.mention-pop {
  position: absolute; left: 0; top: 100%; margin: 0; z-index: 30; min-width: 220px; max-width: min(320px, 100%);
  max-height: 240px; overflow: auto; list-style: none; padding: 4px; background: #fff;
  border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .12);
}
.mention-pop[hidden] { display: none; }
.mention-pop li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.mention-pop li.active, .mention-pop li:hover { background: #eef2fe; }
.mention-pop .muted { font-size: 12px; margin-left: auto; }
.comment-main { flex: 1; min-width: 0; }
.comment-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-bottom: 2px; }
.comment-head time { font-size: 12px; }
.comment-body { overflow-wrap: anywhere; }
.comment-form textarea, .comment-edit textarea { min-height: 72px; }
button.link.small { font-size: 13px; }

/* ---------- 진행보드 ---------- */
.kanban-card { max-width: none; }
/* 열은 줄바꿈 그리드로 전부 보인다 — 가로 스크롤·열 안 세로 스크롤을 쓰지 않는다 */
.kanban { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; align-items: start; }
.kcol { min-width: 0; background: var(--bg); border-radius: var(--radius); display: flex; flex-direction: column; }
.kcol.closed .kcol-head { color: var(--muted); }
.kcol.drop-target { outline: 2px dashed var(--primary); outline-offset: -2px; }
.kcol-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; font-weight: 600; }
.kcount { background: #fff; border-radius: 999px; padding: 0 8px; font-size: 12px; color: var(--muted); }
.kcol-body { padding: 0 8px 8px; display: grid; gap: 8px; }
.kempty { color: var(--muted); font-size: 13px; text-align: center; margin: 8px 0; }
/* position: relative — 카드 안 sr-only(절대 위치) 라벨이 카드 밖으로 나가 문서 전체를 넓히지 않게 */
.kcard { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 10px; display: grid; gap: 6px; }
.kcard.movable { cursor: grab; }
.kcard.dragging { opacity: .5; }
.kcard-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 12px; }
.kcard-title { color: var(--text); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.kcard-title:hover { text-decoration: underline; }
button.thumb.kthumb { width: 100%; height: 96px; }
.kcard-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 13px; }
.kmove { width: auto; height: 28px; font-size: 12px; padding: 0 28px 0 8px; max-width: 120px; background-position: right 8px center; }

/* ---------- 요약 ---------- */
.summary h2 { font-size: 15px; }
.period-nav { display: flex; align-items: center; gap: 8px; margin: 4px 0 16px; flex-wrap: wrap; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 2px; }
.kpi-label { color: var(--muted); font-size: 13px; }
.kpi-value { font-size: 28px; font-weight: 700; line-height: 1.2; }
.kpi-sub { color: var(--muted); font-size: 12px; }
.chart-box { position: relative; margin-bottom: 20px; }
.chart-wrap { width: 100%; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.sw.created, .trend .bar.created { background: #2a78d6; fill: #2a78d6; }
.sw.closed, .trend .bar.closed { background: #eb6834; fill: #eb6834; }
.trend .grid { stroke: var(--line); stroke-width: 1; }
.trend .axis { fill: var(--muted); font-size: 11px; }
.trend .hit { fill: transparent; }
.trend .bucket.on .hit { fill: rgba(31, 35, 40, .05); }
.chart-tip {
  position: absolute; pointer-events: none; background: #fff; border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 10px; font-size: 12px; line-height: 1.6; box-shadow: 0 2px 8px rgba(0, 0, 0, .08); white-space: nowrap;
}
.chart-tip[hidden] { display: none; }
.table-view { margin-top: 8px; }
.table-view summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.summary-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 24px; }
.hbars { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.hbars li { display: grid; grid-template-columns: 120px minmax(0, 1fr) 36px; gap: 8px; align-items: center; }
.hbar-label { overflow-wrap: anywhere; font-size: 13px; }
.hbar-track { height: 14px; }
.hbar { display: block; height: 100%; min-width: 2px; background: #2a78d6; border-radius: 0 4px 4px 0; }
.hbar-value { text-align: right; font-variant-numeric: tabular-nums; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* 시스템 관리 공통 */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin-bottom: 12px; }
.seg button { border: 0; border-radius: 0; height: 32px; background: #fff; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.active { background: #eef2fe; color: var(--primary); font-weight: 600; }
.editor-card { border: 1px solid var(--primary); border-radius: var(--radius); padding: 16px; margin: 12px 0; background: #fbfcff; }
.editor-card .page-head h2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.notice { border: 1px solid #f5c26b; background: #fff8e6; border-radius: 6px; padding: 10px 12px; margin: 8px 0; }
code.temp { font-size: 16px; font-weight: 700; letter-spacing: 1px; background: #fff; padding: 2px 6px; border-radius: 4px; user-select: all; }
.code { font-family: Consolas, monospace; font-size: 12px; margin-top: 2px; }
tr.group-row th { background: var(--bg); text-align: left; font-size: 13px; }
tr.is-off input[data-name], tr.is-off .row-head { color: var(--muted); }
.pg-list { display: grid; gap: 0; }
/* 사용자그룹 상세: 권한그룹 체크 */
.pg-checks { display: grid; gap: 6px; margin: 4px 0 10px; }
.pg-check { align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; }
.pg-check input { margin-top: 2px; }
.pg-check:has(input:checked) { border-color: var(--primary); background: #f5f8ff; }
.feature-section + .feature-section { margin-top: 8px; }
.feature-section .label { margin: 0 0 4px; }
.feature-checks { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.permission-feature-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.permission-feature-tools input[type=search] { flex: 1; min-width: 180px; }
.permission-feature-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin: 4px 0 8px; }
.permission-feature-toolbar .row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.permission-feature-group { border: 1px solid var(--line); border-radius: 6px; min-width: 0; }
.permission-feature-group > summary { display: flex; align-items: center; gap: 10px; padding: 12px; cursor: pointer; list-style: none; }
.permission-feature-group > summary::-webkit-details-marker { display: none; }
.permission-feature-group > summary::before { content: ''; width: 12px; height: 12px; flex: none; background: var(--chevron) center / 12px no-repeat; transform: rotate(-90deg); }
.permission-feature-group[open] > summary::before { transform: rotate(0); }
.permission-feature-group > summary strong { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.permission-feature-group > summary .badge { flex: none; }
.permission-feature-group > summary:hover { background: var(--bg); }
.permission-feature-group > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; border-radius: 6px; }
.permission-feature-group .feature-checks { padding: 0 12px 12px; margin: 0; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
.permission-feature-group .pg-check span { min-width: 0; overflow-wrap: anywhere; }
.permission-feature-group .pg-check input { flex: none; }
.permission-feature-picker [hidden] { display: none; }
/* 기능·권한 목록은 요약을 먼저 보여 주고 편집 폼은 필요할 때 펼친다. */
#features-body [hidden], #perm-body [hidden] { display: none; }
.feature-detail h1, .feature-detail .code, .user-table td { overflow-wrap: anywhere; }
.authz-disclosure { min-width: 0; border: 1px solid var(--line); border-radius: 6px; }
.authz-disclosure + .authz-disclosure { margin-top: 6px; }
.authz-disclosure > summary { display: flex; align-items: center; gap: 10px; padding: 10px 12px; list-style: none; cursor: pointer; }
.authz-disclosure > summary::-webkit-details-marker { display: none; }
.authz-disclosure > summary::before { content: ''; width: 12px; height: 12px; flex: none; background: var(--chevron) center / 12px no-repeat; transform: rotate(-90deg); }
.authz-disclosure[open] > summary::before { transform: rotate(0); }
.authz-disclosure > summary:hover { background: var(--bg); }
.authz-disclosure > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; border-radius: 6px; }
.authz-summary-title { flex: 1; min-width: 0; display: grid; gap: 2px; overflow-wrap: anywhere; }
.authz-summary-description { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.authz-disclosure > summary > .badge, .authz-disclosure > summary > .muted { flex: none; }
.authz-disclosure-body { border-top: 1px solid var(--line); padding: 12px; }
.authz-disclosure-body .code { margin-top: 0; overflow-wrap: anywhere; }
.authz-add { margin-top: 16px; }
.authz-add .inline { flex-wrap: wrap; }
.authz-add .inline input { flex-basis: 180px; }
.feature-preview { margin: 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.feature-preview .label { color: var(--text); margin-right: 6px; }
h1.group-name { display: flex; align-items: center; gap: 8px; }
.feature-list { text-align: left; color: var(--muted); font-size: 13px; min-width: 200px; }

/* 매핑 표: 행·열 교차 체크 */
table.matrix { width: auto; min-width: 100%; }
table.matrix th, table.matrix td { text-align: center; white-space: nowrap; }
table.matrix .row-head { text-align: left; }
table.matrix td.feature-list, table.matrix td.muted { white-space: normal; text-align: left; }
table.matrix input[type=checkbox] { width: 18px; height: 18px; }
table.matrix tbody tr:hover { background: #fafbfc; }

/* 시스템 관리: 머리말 아래 화면 폭 중메뉴 띠(밑줄 강조) + 본문 */
.admin-layout { display: block; }
.subnav {
  /* .page 의 위 여백·좌우 여백만큼 밖으로 꺼내 머리말에 붙인다 */
  margin: -24px -24px 20px; padding: 0 24px; background: var(--card); border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none; position: relative; /* 지금 메뉴 위치 계산(offsetLeft) 기준 */
}
.subnav::-webkit-scrollbar { display: none; }
.subnav-inner { display: flex; gap: 4px; min-width: max-content; }
.subnav a {
  display: inline-flex; align-items: center; gap: 7px; height: 48px; padding: 0 12px; margin-bottom: -1px;
  border-bottom: 2px solid transparent; color: var(--muted); font-size: 15px; text-decoration: none; white-space: nowrap;
}
.subnav a .icon { color: currentColor; opacity: .8; }
.subnav a:hover { color: var(--text); border-bottom-color: var(--line); }
.subnav a.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.subnav a.active .icon { opacity: 1; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #1f2328; color: #fff; padding: 10px 16px; border-radius: 6px;
}
.toast[hidden] { display: none; }

@media (max-width: 640px) {
  .page { margin: 12px auto; padding: 0 16px; }
  .narrow { margin: 16px auto; }
  .card { padding: 16px; }
  /* 머리말: 1줄 로고·사용자, 2줄 메뉴(가로) */
  .topbar {
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "brand who" "menu menu";
    padding: 10px 12px; gap: 8px;
  }
  .brand { grid-area: brand; }
  .who { grid-area: who; }
  .menu { grid-area: menu; flex-wrap: nowrap; overflow-x: auto; }
  .menu a { white-space: nowrap; }
  /* 알림 목록은 화면 너비에 맞춰 머리말 아래에 */
  .notif-panel { position: fixed; left: 8px; right: 8px; top: 52px; width: auto; max-height: calc(100vh - 64px); }

  /* 표 → 목록(Tabler 목록 참고): 제목 한 줄 + '작은 이름표 값'을 한 줄로 흘리고, 설명은 흐린 한 줄, 버튼은 오른쪽 아래.
     상자·카드 없이 행 사이 선 하나로만 나눈다. 누르면 이동하는 행(tr.clickable)에는 › */
  table.stack thead { display: none; }
  table.stack, table.stack tbody { display: block; width: 100%; }
  table.stack tr {
    position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px;
    width: 100%; padding: 12px 0; border-bottom: 1px solid var(--line);
  }
  table.stack td, table.stack td.al-center, table.stack td.al-right {
    display: inline-flex; align-items: center; gap: 5px; min-width: 0; max-width: 100%; padding: 0; border: 0;
    text-align: left; justify-content: flex-start; font-size: 13px; color: var(--muted);
  }
  table.stack td > * { min-width: 0; }
  table.stack td[data-label]::before { content: attr(data-label); flex: none; color: #98a2b3; font-size: 12px; }
  table.stack td[data-label]:empty { display: none; }
  /* 제목: 게시판은 제목 칸, 나머지 표는 첫 칸 */
  table.stack td.title-cell, table.stack tr:not(:has(td.title-cell)) > td:first-child {
    order: -1; flex-basis: 100%; font-size: 15px; font-weight: 600; color: var(--text);
  }
  table.stack td.title-cell::before, table.stack tr:not(:has(td.title-cell)) > td:first-child::before { content: none; }
  table.stack td.title-cell a { color: var(--text); }
  /* 제목 칸 안의 보조 글(사용자 메일 등)은 굵게 하지 않는다 */
  table.stack tr:not(:has(td.title-cell)) > td:first-child .muted { font-weight: 400; font-size: 13px; }
  /* 설명은 이름표 없이 흐린 한 줄 */
  table.stack td[data-label="설명"] { flex-basis: 100%; }
  table.stack td[data-label="설명"]::before { content: none; }
  /* 이미지는 요약 뒤에 작게 */
  table.stack td.col-thumb { order: 90; flex-basis: 100%; }
  table.stack td.col-thumb::before { content: none; }
  table.stack td.row-actions { order: 99; flex-basis: 100%; display: flex; justify-content: flex-end; gap: 6px; margin-top: 2px; }
  table.stack td.row-actions > * + * { margin-left: 0; }
  table.stack td.row-actions::before { content: none; }
  table.stack tr.clickable { padding-right: 22px; }
  table.stack tr.clickable::after {
    content: '›'; position: absolute; right: 2px; top: 50%; transform: translateY(-50%); font-size: 20px; color: #98a2b3;
  }
  table.stack td.empty { flex-basis: 100%; display: block; text-align: center; padding: 16px 0; }
}

/* 좁은 화면: 하위 메뉴를 위쪽 가로 탭으로, 항목 편집기는 위아래로 */
@media (max-width: 768px) {
  .editor-layout { grid-template-columns: minmax(0, 1fr); }
  .list-settings { grid-template-columns: minmax(0, 1fr); }
  .col-item { flex-wrap: wrap; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-grid { grid-template-columns: minmax(0, 1fr); }
  .hbars li { grid-template-columns: 90px minmax(0, 1fr) 32px; }
  .menu { scrollbar-width: none; }
  .menu::-webkit-scrollbar { display: none; }
  .viewer-img { max-width: 100%; }
  .viewer-stage { position: relative; padding: 0 0 16px; }
  .viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); }
  .viewer-prev { left: 4px; }
  .viewer-next { right: 4px; }
  .who-link .who-name { max-width: 7em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sub-box { margin-left: 12px; }
  /* 탭이 많으면 두 줄로(가려지지 않게) */
  .tabs { gap: 0; flex-wrap: wrap; overflow-x: visible; }
  .tabs button { padding: 0 9px; }
  .editor-panel { padding: 12px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .post-field { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .subnav { margin: -12px -16px 14px; padding: 0 8px; }
  .subnav a { height: 44px; padding: 0 10px; font-size: 14px; gap: 6px; }
}

/* 나의 홈(위젯) — 12칸 격자, 한 줄 56px(home.js 의 HOME_ROW_PX·HOME_GAP 과 맞춘다) */
.home-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.home-head h1 { margin: 0; }
.home-head .actions { margin-top: 0; }
.home-head button .icon { margin-right: 4px; }
.home-add { width: auto; }
.home-help { margin: 0 0 12px; }
.home-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-rows: 56px; gap: 12px; }
.home-grid > .card + .card { margin-top: 0; }
.home-empty { grid-column: 1 / -1; grid-row: span 2; color: var(--muted); }
.widget { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 0; overflow: hidden; }
.widget-head { display: flex; align-items: center; gap: 4px; min-height: 48px; padding: 6px 8px 6px 14px; border-bottom: 1px solid var(--line); }
.widget-head h2 { flex: 1; min-width: 0; margin: 0; font-size: 15px; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; }
.widget-head h2 span, .widget-head h2 small { overflow: hidden; text-overflow: ellipsis; }
.widget-head h2 small { font-weight: 400; font-size: 12px; }
.widget-tools { display: flex; align-items: center; gap: 2px; flex: none; }
.widget-tools [data-tools] { display: inline-flex; align-items: center; gap: 4px; margin-right: 4px; }
.widget-tools button.link { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; font-size: 13px; }
.widget-body { flex: 1; min-height: 0; overflow: auto; padding: 4px; }
.widget-body .notif-list { padding: 0; }
.widget-empty { margin: 0; padding: 24px 12px; text-align: center; color: var(--muted); }
.widget-table th, .widget-table td { padding: 8px 6px; }
.widget-table tr.clickable { cursor: pointer; }
.widget-table tr.clickable:hover { background: var(--bg); }
.widget-move { display: none; }
/* 편집 중에는 위젯 보조 버튼(모두 읽음·게시판)과 건수를 숨겨 머리에 손잡이·설정·삭제 자리를 둔다 */
.home-grid.editing [data-tools], .home-grid.editing [data-sub] { display: none; }
.home-grid.editing .widget { outline: 2px dashed #c9d6fb; outline-offset: -2px; }
.home-grid.editing .widget-head { cursor: grab; background: #f8f9fb; touch-action: none; user-select: none; }
.home-grid.editing .widget-grip { cursor: grab; margin-left: -8px; }
.widget.dragging { z-index: 2; box-shadow: 0 10px 28px rgba(16, 24, 40, .18); opacity: .96; }
.widget.dragging .widget-head { cursor: grabbing; }
.widget-resize {
  position: absolute; right: 0; bottom: 0; width: 20px; height: 20px; cursor: nwse-resize; touch-action: none;
  background: linear-gradient(135deg, transparent 0 55%, var(--muted) 55% 62%, transparent 62% 72%, var(--muted) 72% 79%, transparent 79%);
}

/* 위젯 설정 대화상자 */
.dialog-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(16, 24, 40, .45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.dialog { background: var(--card); border-radius: var(--radius); width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 20px; display: grid; gap: 4px; }
.dialog > .check { margin-bottom: 10px; }
.dialog-actions { justify-content: flex-end; margin-top: 4px; }
.col-pick { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; margin: 4px 0 0; min-width: 0; }
.col-pick legend { font-weight: 600; padding: 0 4px; }
.col-pick legend .help { font-weight: 400; }
.col-pick-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.col-pick-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 4px; border-radius: 6px; }
.col-pick-item:hover { background: var(--bg); }
.col-pick-item .check { flex: 1; min-width: 0; padding: 6px 0; }
.col-pick-move { display: inline-flex; flex: none; }
.col-pick-move .icon-btn { width: 30px; height: 30px; }

@media (max-width: 640px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); grid-auto-rows: auto; }
  .home-grid > .widget { grid-column: 1 !important; grid-row: auto !important; height: calc(var(--h) * 52px); }
  .widget-resize { display: none; }
  .widget-body table.stack tr { padding-left: 8px; padding-right: 8px; }
  .widget-body table.stack tr.clickable { padding-right: 30px; }
  .widget-body table.stack tr.clickable::after { right: 10px; }
  .widget-move { display: inline-flex; }
  .home-grid.editing .widget-head { cursor: default; touch-action: auto; }
  .home-grid.editing .widget-grip { display: none; }
}

/* 게시판 트리(게시판·진행보드·요약 왼쪽). 게시판이 하나면 그리지 않는다 */
.board-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.board-main { min-width: 0; }
.board-tree {
  position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 8px;
}
.tree-toggle { display: none; }
.tree-title { margin: 0 8px 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.tree-list, .tree-list ul { list-style: none; margin: 0; padding: 0; }
.tree-list ul { padding-left: 14px; }
.tree-board, .tree-folder > summary {
  display: flex; align-items: center; gap: 6px; padding: 7px 8px; border-radius: 6px;
  color: var(--text); text-decoration: none; cursor: pointer;
}
.tree-board span, .tree-folder > summary span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-board:hover, .tree-folder > summary:hover { background: var(--bg); }
.tree-board .icon, .tree-caret { color: var(--muted); }
.tree-board.active { background: #eef2fe; color: var(--primary); font-weight: 600; }
.tree-board.active .icon { color: var(--primary); }
.tree-board.off { color: var(--muted); }
.tree-folder > summary { list-style: none; font-weight: 600; }
.tree-folder > summary::-webkit-details-marker { display: none; }
.tree-caret { transition: transform .15s; }
.tree-folder[open] > summary .tree-caret { transform: rotate(90deg); }
@media (max-width: 900px) {
  .board-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .board-tree { position: static; max-height: none; padding: 0; }
  .tree-toggle { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; justify-content: flex-start; }
  .tree-toggle span { flex: 1; min-width: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; }
  .tree-nav { display: none; padding: 4px 8px 8px; border-top: 1px solid var(--line); }
  .board-tree.open .tree-nav { display: block; }
  .tree-title { display: none; }
}

/* 게시판 관리: 트리 편집 */
.tree-edit { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tree-edit .tree-edit { margin: 6px 0 0 12px; padding-left: 24px; border-left: 2px solid var(--line); }
.tree-root { margin-bottom: 12px; }
.tree-row.folder-row { background: #f8f9fb; }
.tree-row.folder-row input[data-name] { font-weight: 600; }
.tnode.dragging > .tree-row { opacity: .5; }
.tree-row.drop-before { box-shadow: 0 -3px 0 var(--primary); }
.tree-row.drop-after { box-shadow: 0 3px 0 var(--primary); }
.tree-row.drop-inside { outline: 2px solid var(--primary); background: #eef2fe; }
.tree-empty { padding: 8px 10px; border: 1px dashed var(--line); border-radius: 6px; font-size: 13px; }
.tree-add { display: grid; gap: 8px; }

/* 사용자 상태(온라인·자리비움·다른 용무 중·오프라인) — presence.js */
.presence { position: relative; }
.presence-dot { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 2px #fff; }
.p-online { background: #12b76a; }
.p-away { background: #f79009; }
.p-busy { background: #f04438; }
.p-offline { background: #fff; box-shadow: inset 0 0 0 2px #98a2b3, 0 0 0 2px #fff; }
.who-link .presence-dot.on-avatar { width: 10px; height: 10px; right: -1px; bottom: -1px; }
.presence-me { display: flex; align-items: center; gap: 10px; padding: 8px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.presence-me .presence-text { display: grid; min-width: 0; }
.presence-me small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.presence-item { color: var(--text); text-decoration: none; }
/* 메뉴 구분선: 머리(이름·메일) 아래 선과 같은 곧은 선 */
.presence-sep { height: 1px; margin: 4px 0; background: var(--line); }
.presence-item .icon { color: var(--muted); }
.presence-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; width: 240px; padding: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(16, 24, 40, .12);
}
.presence-panel[hidden] { display: none; }
.presence-item { display: flex; align-items: center; gap: 10px; width: 100%; height: auto; padding: 8px; border: 0; background: none; text-align: left; border-radius: 6px; white-space: normal; }
.presence-item:hover, .presence-item:focus { background: var(--bg); }
.presence-item .presence-text { flex: 1; display: grid; }
.presence-item small { font-size: 12px; }
.presence-item.on { font-weight: 600; }
.presence-label { display: inline-flex; align-items: center; gap: 6px; }
.avatar-wrap { position: relative; display: inline-flex; flex: none; }
.presence-dot.on-avatar { position: absolute; right: 0; bottom: 0; width: 12px; height: 12px; }
.me-presence { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.me-presence select { width: auto; }
/* 권한 수정: '사용자 카드 상세 보기' 아래 카드 항목 */
.card-fields {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px;
  margin: 0 0 4px 28px; padding: 8px 12px; border: 1px dashed var(--line); border-radius: 6px; min-width: 0;
}
.card-fields legend { font-size: 13px; font-weight: 600; padding: 0 4px; }
.card-fields .help { flex-basis: 100%; margin: 0; }
.card-fields:disabled { opacity: .5; }
/* 기능 검색·'선택한 기능만'으로 '사용자 카드 상세 보기'가 가려지면 항목 칸도 함께 숨긴다 */
.pg-check[hidden] + .card-fields { display: none; }
@media (max-width: 640px) {
  .presence-panel { position: fixed; left: auto; right: 8px; top: 52px; }
  .card-fields { margin-left: 0; }
}

/* 기능 관리: 기능그룹별 묶음 */
.feature-group + .feature-group { margin-top: 16px; }
.feature-group-title { display: flex; align-items: baseline; gap: 8px; margin: 0 0 6px; font-size: 15px; }
.feature-group-title .muted { font-size: 13px; font-weight: 400; }
.feature-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); }
.feature-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.feature-row + .feature-row { border-top: 1px solid var(--line); }
.feature-row[hidden] { display: none; }
.feature-row-name { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.feature-row-name strong, .feature-row-name .muted { overflow-wrap: anywhere; }
.feature-row-name .muted { font-size: 13px; }
.feature-row .badge, .feature-row .button { flex: none; }
@media (max-width: 640px) {
  .feature-row { flex-wrap: wrap; gap: 6px 10px; }
  .feature-row-name { flex-basis: 100%; }
}

/* ---------- 모바일 앱 목록(Tabler list-group 참고) — app.js mobileListHtml ---------- */
.mobile-only { display: none !important; }
@media (max-width: 640px) {
  .mobile-only { display: block !important; }
  .desktop-only { display: none !important; }
}
.mlist { list-style: none; margin: 8px -16px 0; padding: 0; border-top: 1px solid var(--line); }
.widget-body .mlist { margin: 0 -4px; border-top: 0; }
.mlist > li[hidden] { display: none; }
.mlist > li { border-bottom: 1px solid var(--line); }
.mlist-item {
  display: flex; align-items: center; gap: 12px; width: 100%; height: auto; padding: 12px 16px;
  border: 0; border-radius: 0; background: none; color: var(--text); font: inherit; text-align: left; text-decoration: none; cursor: pointer;
}
.mlist-item:active, .mlist-item:hover { background: var(--bg); }
.mlist-media { flex: none; display: inline-flex; }
.mlist-icon {
  width: 36px; height: 36px; border-radius: 10px; background: #eef2fe; color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
}
.mlist-thumb { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; display: block; }
.mlist-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.mlist-title { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 15px; font-weight: 600; }
.mlist-title > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mlist-count { flex: none; color: var(--muted); font-size: 12px; font-weight: 400; }
.mlist-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; }
.mlist-end { flex: none; display: inline-flex; align-items: center; gap: 6px; }
.mlist-chev { color: #98a2b3; font-size: 20px; line-height: 1; }
.mlist-actions { display: flex; justify-content: flex-end; gap: 6px; padding: 0 16px 10px; margin-top: -4px; }
.mlist-empty { margin: 8px 0; padding: 24px 0; text-align: center; color: var(--muted); }
.badge.warn { background: #fff4e5; color: #b54708; }

/* ---------- PC 표(Tabler 표 참고): 작은 회색 열 제목, 줄 강조, 표 안 단추는 글자 링크 ---------- */
@media (min-width: 641px) {
  table.stack thead th { font-size: 12px; font-weight: 600; color: var(--muted); background: #f9fafb; letter-spacing: .02em; }
  table.stack tbody tr:hover { background: #f9fafb; }
  table.stack td.row-actions .button.small:not(.primary),
  table.stack td.row-actions button.small:not(.primary) {
    border-color: transparent; background: none; color: var(--primary); padding: 0 6px; height: 28px;
  }
  table.stack td.row-actions button.small.danger { color: var(--danger); }
  table.stack td.row-actions .button.small:hover, table.stack td.row-actions button.small:not(.primary):hover { background: #eef2fe; }
}
