/**
 * 페이지 레이아웃.
 *
 * 기존 클라(9880줄)의 정책:
 * - .app: 100vh, padding 12px, gap 12px, 2열 그리드 (main + side 380px)
 * - .main-panel: flex column, topbar 고정 / calendar flex:1 (남은 공간 가득)
 * - .calendar-grid: 6행 균등 분할 (grid-template-rows: repeat(6, minmax(0, 1fr)))
 * - 공휴일은 셀 배경 X — 숫자 색만 빨강 + 작은 chip
 * - 오늘은 검정 원형 chip (숫자만 강조)
 */

/* ===== 앱 그리드 ===== */
.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 12px;
  width: 100%;
  height: 100vh;
  padding: 12px;
  overflow: hidden;
}

.app__main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  min-width: 0;
}

.app__side {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

/* ===== topbar ===== */
.topbar {
  flex: 0 0 auto;
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.topbar__left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.topbar__right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.topbar__divider {
  width: 1px;
  height: 22px;
  background: #d1d5db;
  align-self: center;
}
.month-title {
  font-size: var(--font-size-3xl);
  font-weight: 700;
  min-width: 150px;
  text-align: center;
  background: #f3f4f6;
  border: 1px solid var(--color-neutral-soft);
  padding: 4px 12px;
  border-radius: var(--radius-md);
  font-family: inherit;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.month-title::after {
  content: "▾";
  font-size: 14px;
  color: var(--color-text-sub);
}
.month-title:hover { background: var(--color-neutral-soft); }

/* ===== 캘린더 ===== */
.calendar-wrap {
  flex: 1 1 auto;
  min-height: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}

.cal-header {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background: var(--color-week-header-bg);
  border-bottom: 1px solid var(--color-line);
}
.cal-header__cell {
  text-align: center;
  padding: 9px 6px;
  font-weight: 700;
  font-size: var(--font-size-lg);
  color: var(--color-text);
}
.cal-header__cell--sun { color: var(--color-sun); }
.cal-header__cell--sat { color: var(--color-sat); }

.cal-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: repeat(6, minmax(0, 1fr));
}

.cal-cell {
  min-height: 0;
  min-width: 0;
  border-right: 1px solid var(--color-line);
  border-bottom: 1px solid var(--color-line);
  padding: 7px;
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: background var(--transition-fast);
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell:hover { background: #f8fbff; }

.cal-cell--other-month {
  background: #fafafa;
  color: var(--color-text-sub);
}
.cal-cell--selected {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
  z-index: 1;
}

.cal-cell__date-line {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 22px;
}

.cal-cell__day {
  grid-column: 1;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.1;
  color: #111827;
  min-width: 24px;
}
.cal-cell__day--sun, .cal-cell__day--holiday { color: var(--color-sun); }
.cal-cell__day--sat { color: var(--color-sat); }
.cal-cell--other-month .cal-cell__day { color: var(--color-text-sub); opacity: 0.8; }
.cal-cell--other-month .cal-cell__day--sun,
.cal-cell--other-month .cal-cell__day--holiday { color: var(--color-sun); opacity: 0.6; }
.cal-cell--other-month .cal-cell__day--sat { color: var(--color-sat); opacity: 0.6; }

/* 오늘 강조 — 숫자만 검정 원형 chip */
.cal-cell__day--today {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-pill);
  background: #111827;
  color: #fff !important;
  opacity: 1 !important;
  padding: 0;
}
.cal-cell__day--today.cal-cell__day--sun,
.cal-cell__day--today.cal-cell__day--holiday {
  background: var(--color-sun);
}
.cal-cell__day--today.cal-cell__day--sat {
  background: var(--color-sat);
}

.cal-cell__holiday {
  grid-column: 2;
  background: var(--color-holiday-bg);
  color: #b91c1c;
  border-radius: var(--radius-pill);
  padding: 2px 7px;
  font-size: var(--font-size-xs);
  font-weight: 700;
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* (다음 단계 자리) status-line / chip 영역 */
.cal-cell__status-line {
  grid-column: 3;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  overflow: hidden;
}

/* ===== 셀 안 일정 미리보기 ===== */
.cal-cell__preview {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow: hidden;
}

.schedule-chip {
  flex: 1 1 0;
  min-height: 0;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  padding: 6px 7px 6px 10px;
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: var(--font-size-sm);
  min-width: 0;
  overflow: hidden;
  position: relative;
}
/* state별 좌측 컬러 바 (chip 전체 배경은 흰색 유지) */
.schedule-chip::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-top-left-radius: var(--radius-md);
  border-bottom-left-radius: var(--radius-md);
  background: var(--color-line);
}
.schedule-chip.chip-state-open::before    { background: #10b981; }  /* 연두 */
.schedule-chip.chip-state-draft::before   { background: #3b82f6; }  /* 파랑 */
.schedule-chip.chip-state-closed::before  { background: #9ca3af; }  /* 회색 */
.schedule-chip.chip-state-canceled::before,
.schedule-chip.chip-state-dayoff::before  { background: #d1d5db; }  /* 연회색 */

/* canceled 일정은 본문도 흐리게 */
.schedule-chip.chip-state-canceled { opacity: 0.7; background: #fafafa; }
.schedule-chip.chip-state-dayoff   { background: #fafafa; }
.schedule-chip.chip-canceled .schedule-chip__title { text-decoration: line-through; }

.schedule-chip__title {
  flex: 0 0 auto;
  font-weight: 700;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.schedule-chip__owner {
  flex: 0 0 auto;
  color: var(--color-text-sub);
  font-size: var(--font-size-xs);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.schedule-chip__sub {
  flex: 0 0 auto;
  color: var(--color-text-sub);
  font-size: var(--font-size-xs);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.schedule-chip__content {
  flex: 1 1 auto;
  min-height: 0;
  color: var(--color-neutral-strong);
  font-size: var(--font-size-xs);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  white-space: normal;
  line-height: 1.35;
}

.cal-cell__more {
  flex: 0 0 auto;
  font-size: var(--font-size-xs);
  color: var(--color-text-sub);
  text-align: right;
}
.cal-cell__empty {
  flex: 0 0 auto;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  text-align: center;
  padding: 6px 0;
}

/* ===== 셀 작업실 뱃지 ===== */
.workroom-badge {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-pill);
  padding: 2px 7px;
  font-size: var(--font-size-xs);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.workroom-badge.workroom-blocked {
  /* 빨강 계열은 공휴일 날짜와 시각적으로 충돌해서 주황으로 변경.
     공휴일 셀(red) ↔ 작업실 불가 칩(orange) 명확히 구분. */
  background: #ffedd5;
  color: #9a3412;
}

/* ===== 결재 대기 뱃지 ===== */
.approval-pending-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-sm);
  font-weight: 700;
  background: var(--color-warn-soft);
  color: var(--color-warn-strong);
  flex: 0 0 auto;
}

/* ===== SQL 콘솔 ===== */
.sql-console {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-4);
}
.sql-console__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.sql-console__top h1 {
  margin: 0;
  font-size: var(--font-size-2xl);
}
.sql-console__layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: var(--space-3);
}
.sql-console__schema {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  padding: var(--space-2);
  max-height: 80vh;
  overflow-y: auto;
  font-size: var(--font-size-sm);
}
.sql-console__table {
  margin-bottom: 4px;
}
.sql-console__table summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
}
.sql-console__table summary:hover { background: var(--color-bg); }
.sql-console__table-name {
  background: transparent;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  text-align: left;
  color: var(--color-primary);
  font-weight: 700;
}
.sql-console__cols {
  list-style: none;
  margin: 0;
  padding: 4px 0 4px 16px;
  font-size: var(--font-size-xs);
}
.sql-console__cols li { padding: 2px 0; }
.sql-console__main {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.sql-console__presets {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
}
.sql-console__editor {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.sql-console__sql {
  font-family: var(--font-mono);
  font-size: var(--font-size-md);
  resize: vertical;
}
.sql-console__bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.sql-console__confirm {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--font-size-sm);
  cursor: pointer;
}
.sql-console__result {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  padding: var(--space-2);
  min-height: 80px;
}
.sql-console__result-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  padding: 0 var(--space-1);
}
.sql-console__table-wrap {
  overflow-x: auto;
  max-height: 60vh;
  overflow-y: auto;
}
.sql-console__table-wrap .data-table {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
}
.sql-console__write-result {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  flex-wrap: wrap;
  padding: var(--space-2);
}

@media (max-width: 900px) {
  .sql-console__layout { grid-template-columns: 1fr; }
  .sql-console__schema { max-height: 200px; }
}

/* ===== 회원 선택기 (공통) ===== */
.member-picker {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  padding: var(--space-2);
  background: var(--color-surface);
}
.member-picker__head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.member-picker__search {
  flex: 1;
  min-width: 160px;
}
.member-picker__opt {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--font-size-sm);
  cursor: pointer;
  white-space: nowrap;
}
.member-picker__count {
  font-size: var(--font-size-sm);
  color: var(--color-text-sub);
  font-weight: 600;
  margin-left: auto;
}
.member-picker__empty {
  padding: var(--space-3);
  color: var(--color-text-sub);
  text-align: center;
  font-size: var(--font-size-md);
}
.member-picker__list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--color-line);
}
.member-picker__row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 8px;
  cursor: pointer;
  font-size: var(--font-size-md);
  border-radius: var(--radius-sm);
}
.member-picker__row:hover { background: var(--color-bg); }
.member-picker__row.is-inactive {
  opacity: 0.55;
}
.member-picker__row.is-inactive .member-picker__name {
  text-decoration: line-through;
  text-decoration-color: var(--color-text-muted);
}
.member-picker__row input { flex-shrink: 0; }
.member-picker__name { flex: 1; }
.member-picker__sub {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}
.member-picker__badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xs);
  font-weight: 700;
}
.member-picker__badge--inactive {
  background: var(--color-neutral-soft);
  color: var(--color-neutral-strong);
}

/* ===== 내 요청함 ===== */
.my-req-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.my-req-row {
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  overflow: hidden;
}
.my-req-row__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 10px 12px;
  cursor: pointer;
  flex-wrap: wrap;
}
.my-req-row__head:hover { background: #fafbff; }
.my-req-row__main {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}
.my-req-row__op {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--color-primary-soft);
  color: var(--color-primary-strong);
  font-size: var(--font-size-xs);
  font-weight: 700;
}
.my-req-row__right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.my-req-row__body {
  display: none;
  padding: 0 12px 10px;
  border-top: 1px solid var(--color-line);
  flex-direction: column;
  gap: 4px;
  background: #fafafa;
}
.my-req-row.is-expanded .my-req-row__body { display: flex; padding-top: 10px; }
.my-req__field {
  display: flex;
  gap: 6px;
  font-size: var(--font-size-md);
}
.my-req__label {
  color: var(--color-text-sub);
  font-weight: 700;
  width: 50px;
  flex-shrink: 0;
}
.my-req__decision {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed var(--color-line);
}

.request-state-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xs);
  font-weight: 700;
}
.request-state-badge.state-pending  { background: var(--color-warn-soft); color: var(--color-warn-strong); }
.request-state-badge.state-approved { background: var(--color-success-soft); color: var(--color-success-strong); }
.request-state-badge.state-rejected { background: var(--color-danger-soft); color: var(--color-danger-strong); }
.request-state-badge.state-canceled { background: var(--color-neutral-soft); color: var(--color-neutral-strong); }

.my-req-row.state-canceled,
.my-req-row.state-rejected { opacity: 0.75; }

/* ===== 내 계정 모달 ===== */
.my-account__section {
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  background: var(--color-surface);
  margin-bottom: var(--space-3);
}
.my-account__section h3 {
  margin: 0 0 var(--space-2);
  font-size: var(--font-size-md);
  color: var(--color-text-sub);
}
.my-account__row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: var(--space-2);
  align-items: center;
  margin-bottom: 6px;
}
.my-account__row:last-child { margin-bottom: 0; }
.my-account__label {
  color: var(--color-text-sub);
  font-size: var(--font-size-sm);
  font-weight: 600;
}
.my-account__value-with-action {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  justify-content: space-between;
}

/* ===== code-edit modal ===== */
.code-edit__status {
  margin-top: var(--space-2);
  min-height: 1.4em;
  font-size: var(--font-size-sm);
}
.code-edit__ok {
  color: var(--color-success-strong);
  font-weight: 600;
}

/* users-modal의 code 편집 버튼 */
.user-row__code-btn {
  font-weight: 700;
  text-align: left;
  min-width: 80px;
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.perm-chip {
  display: inline-block;
  padding: 2px 8px;
  background: var(--color-primary-soft);
  color: var(--color-primary-strong);
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xs);
  font-weight: 600;
}
.role-chip {
  display: inline-block;
  padding: 2px 10px;
  background: var(--color-info-soft);
  color: var(--color-info-strong);
  border-radius: var(--radius-pill);
  font-size: var(--font-size-sm);
  font-weight: 700;
}

/* ===== 연간 달력 모달 ===== */
.year-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.year-modal__title {
  flex: 1;
  text-align: center;
  font-size: var(--font-size-xl);
  font-weight: 700;
}
.year-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
}
.mini-cal {
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  padding: 8px;
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mini-cal.is-current {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
}
.mini-cal__title {
  background: transparent;
  border: none;
  font-size: var(--font-size-md);
  font-weight: 700;
  cursor: pointer;
  padding: 4px 0;
  border-radius: var(--radius-sm);
  text-align: center;
}
.mini-cal__title:hover {
  background: rgba(0, 0, 0, 0.05);
}
.mini-cal__weekdays,
.mini-cal__days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.mini-cal__wd {
  font-size: 10px;
  text-align: center;
  color: var(--color-text-sub);
  font-weight: 600;
  padding: 2px 0;
}
.mini-cal__wd.is-sun { color: #dc2626; }
.mini-cal__wd.is-sat { color: #2563eb; }

.mini-cal__day {
  position: relative;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0;
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11px;
  color: var(--color-text);
  min-height: 22px;
}
.mini-cal__day:hover { background: rgba(0, 0, 0, 0.06); }
.mini-cal__day.is-empty { visibility: hidden; cursor: default; }
.mini-cal__day.is-sun .mini-cal__num { color: #dc2626; }
.mini-cal__day.is-sat .mini-cal__num { color: #2563eb; }
.mini-cal__day.is-holiday .mini-cal__num { color: #dc2626; font-weight: 700; }
.mini-cal__day.is-today {
  background: #000;
  border-radius: 50%;
}
.mini-cal__day.is-today .mini-cal__num,
.mini-cal__day.is-today.is-holiday .mini-cal__num,
.mini-cal__day.is-today.is-sun .mini-cal__num,
.mini-cal__day.is-today.is-sat .mini-cal__num {
  color: #fff;
  font-weight: 700;
}
.mini-cal__day.has-schedule .mini-cal__num {
  font-weight: 700;
}
.mini-cal__dot {
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--color-primary);
}
.mini-cal__day.is-today .mini-cal__dot { background: #fff; }

@media (max-width: 900px) {
  .year-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .year-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== 역할/권한 관리 ===== */
.roles-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--space-3);
  height: 65vh;
  min-height: 0;
}
.roles-left {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  border-right: 1px solid var(--color-line);
  padding-right: var(--space-3);
  overflow: hidden;       /* head 고정, 스크롤은 __list가 담당 */
  min-height: 0;
}
.roles-left__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: 0 0 auto;
}
.roles-left__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;       /* 좌측 목록 독립 스크롤 */
  min-height: 0;
  flex: 1 1 auto;
}
.role-list__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-size: var(--font-size-md);
}
.role-list__item:hover {
  background: #f8fbff;
}
.role-list__item.is-active {
  background: var(--color-primary-soft);
  border-color: var(--color-primary);
}
.role-list__item.is-disabled {
  opacity: 0.6;
}
.role-list__name {
  flex: 1;
}
.role-list__sys {
  font-size: var(--font-size-xs);
  background: var(--color-info-soft);
  color: var(--color-info-strong);
  padding: 1px 6px;
  border-radius: var(--radius-pill);
}
.role-list__count {
  font-size: var(--font-size-xs);
  background: #f3f4f6;
  color: var(--color-text-sub);
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  min-width: 24px;
  text-align: center;
}

.roles-right {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding-right: var(--space-1);
  overflow-y: auto;       /* 우측 편집 영역 독립 스크롤 */
  min-height: 0;
}
.roles-right__section {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}
.roles-right__section h3 {
  margin: 0 0 var(--space-2);
  font-size: var(--font-size-lg);
}
.roles-right__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  flex-wrap: wrap;
}
.roles-right__head h3 { margin: 0; }

.perm-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-3);
}
.perm-group {
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  margin: 0;
}
.perm-group legend {
  padding: 0 var(--space-2);
  font-weight: 700;
  color: var(--color-text-sub);
}
.perm-check {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 4px 0;
  cursor: pointer;
  font-size: var(--font-size-md);
}
.perm-key {
  margin-left: auto;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  font-family: var(--font-mono, monospace);
}

.user-checks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 4px 12px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: var(--space-2);
}
.user-check {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 4px 0;
  cursor: pointer;
  font-size: var(--font-size-md);
}
.user-key {
  margin-left: auto;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  font-family: var(--font-mono, monospace);
}

@media (max-width: 900px) {
  .roles-layout {
    grid-template-columns: 1fr;
    height: auto;          /* 세로 배치에선 독립 스크롤 대신 모달 전체 스크롤 */
  }
  .roles-left {
    border-right: none;
    padding-right: 0;
    border-bottom: 1px solid var(--color-line);
    padding-bottom: var(--space-3);
    overflow: visible;
  }
  .roles-left__list,
  .roles-right {
    overflow-y: visible;
  }
}

/* ===== 회원 관리 ===== */
.users-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}
.users-search {
  flex: 1;
  min-width: 180px;
  max-width: 360px;
}
.signup-code {
  display: inline-block;
  padding: 2px 8px;
  background: var(--color-warn-soft);
  color: var(--color-warn-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono, monospace);
  font-size: var(--font-size-md);
  font-weight: 700;
  letter-spacing: 0.05em;
}
.user-state-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xs);
  font-weight: 700;
}
.user-state-badge.state-active     { background: var(--color-success-soft); color: var(--color-success-strong); }
.user-state-badge.state-temporary  { background: var(--color-warn-soft); color: var(--color-warn-strong); }
.user-state-badge.state-removed    { background: var(--color-neutral-soft); color: var(--color-neutral-strong); }
.user-row.state-temporary td { background: #fffbeb; }

/* ===== 데이터 테이블 ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-md);
}
.data-table thead {
  background: #fafafa;
}
/* 모달 body가 스크롤될 때 thead 고정.
   .users-table-wrap는 sticky의 스크롤 컨테이너를 명확히 하기 위한 wrapper. */
.users-table-wrap .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fafafa;
  /* sticky 요소는 border가 함께 안 따라가서 그림자로 구분선 보완 */
  box-shadow: inset 0 -1px 0 var(--color-line);
}
.data-table th,
.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--color-line);
  text-align: left;
  vertical-align: middle;
}
.data-table th {
  font-weight: 700;
  font-size: var(--font-size-sm);
  color: var(--color-text-sub);
}
.data-table td.text-center,
.data-table th.text-center { text-align: center; }
.data-table tbody tr:hover {
  background: #f8fbff;
}

/* ===== 참가권 ===== */
.tickets-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}
.ticket-state-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xs);
  font-weight: 700;
}
.ticket-state-badge.state-active   { background: var(--color-success-soft); color: var(--color-success-strong); }
.ticket-state-badge.state-expired  { background: var(--color-neutral-soft); color: var(--color-neutral-strong); }
.ticket-state-badge.state-revoked  { background: var(--color-danger-soft); color: var(--color-danger-strong); }
.ticket-row.state-expired,
.ticket-row.state-revoked { opacity: 0.65; }

/* 액션 컬럼(회수/만료) — 버튼 유무와 무관하게 너비 고정해서 다른 셀이 흔들리지 않게 */
.tickets-table th:last-child,
.tickets-table td:last-child {
  width: 130px;
  min-width: 130px;
  white-space: nowrap;
}
/* 회수/만료 버튼 간격 */
.ticket-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-start;
}
/* 통신 중 툴바 로딩 인디케이터 */
.tickets-loading {
  display: inline-flex;
  align-items: center;
  font-size: var(--font-size-sm);
  color: var(--color-text-sub);
}

/* confirm/prompt 공통 모달 */
.modal-confirm__msg,
.modal-prompt__msg {
  white-space: pre-wrap;
  line-height: 1.5;
  margin-bottom: var(--space-3);
}
.modal-prompt__input {
  width: 100%;
}
.modal-prompt__error {
  margin-top: var(--space-2);
}

/* ===== 결재함 모달 ===== */
.approval-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.approval-row {
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.approval-row__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.approval-row__op {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--color-primary-soft);
  color: var(--color-primary-strong);
  font-size: var(--font-size-xs);
  font-weight: 700;
}
.approval-row__body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: var(--font-size-md);
}
.approval-row__field {
  display: flex;
  gap: 6px;
}
.approval-row__label {
  color: var(--color-text-sub);
  width: 40px;
  flex-shrink: 0;
  font-weight: 700;
}
.approval-row__actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
}

/* ===== 참가자 모달 ===== */
/* ===== 참가자 관리 모달 (pm-*) ===== */
/* 구조: 좌(회원 단일 선택) + 우(참가 방식 라디오). 모드 토글 없음. */

.pm-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 10px;
  background: #fafafa;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
  font-size: var(--font-size-sm);
  flex-wrap: wrap;
}
.pm-meta__time { color: var(--color-text-sub); }
.pm-meta__sub  { color: var(--color-text-sub); font-size: var(--font-size-xs); }

/* 좌/우 2단 */
.pm-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  flex: 1 1 auto;
  min-height: 0;  /* flex 자식의 overflow 작동을 위해 필요 */
}
.pm-left,
.pm-right {
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 240px;
}
.pm-right {
  padding: var(--space-2);
  overflow-y: auto;
}

/* 좌측 검색 + 토글 체크박스 영역 */
.pm-search {
  padding: 6px;
  border-bottom: 1px solid var(--color-line);
  background: #fafafa;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pm-search__input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  background: #fff;
  box-sizing: border-box;
}
.pm-search__input:focus {
  outline: none;
  border-color: var(--color-primary);
}
.pm-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--font-size-xs);
  color: var(--color-text-sub);
  cursor: pointer;
  user-select: none;
  padding: 0 4px;
}
.pm-toggle input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

/* 좌측 리스트 */
.pm-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* 행 (button) */
.modal .pm-list .pm-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  border: 1px solid transparent;
  background: transparent;
  box-sizing: border-box;
  cursor: pointer;
  text-align: left;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  color: inherit;
  margin: 0;
  transition: background 0.1s, border-color 0.1s;
}
.modal .pm-list .pm-row:hover {
  background: #f5f5f5;
}
.pm-row__name {
  flex: 1;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pm-row.is-selected {
  border-color: var(--color-primary);
  background: var(--color-primary-soft) !important;
}

/* 상태별 배경 (선택 시는 위에서 override) */
.pm-row.is-existing { background: #f0f7ff; }
.pm-row.is-new      { background: #f0fdf4; }
.pm-row.is-changed  { background: #f5f3ff; }
.pm-row.is-removed {
  background: #fef2f2;
  text-decoration: line-through;
  color: var(--color-text-sub);
}
/* 비활성 회원 (탈퇴/추방/삭제) — 토글로 켰을 때 옅게 */
.pm-row.is-inactive {
  opacity: 0.55;
}
.pm-row.is-inactive:hover { opacity: 0.75; }

/* chip */
.pm-chip {
  font-size: var(--font-size-xs);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
}
.pm-chip--existing { background: var(--color-primary-soft); color: var(--color-primary-strong); }
.pm-chip--new      { background: #dcfce7; color: #166534; }
.pm-chip--changed  { background: #ede9fe; color: #5b21b6; }
.pm-chip--removed  { background: #fee2e2; color: #991b1b; }
.pm-chip--inactive { background: #e5e7eb; color: #4b5563; }

/* 빈 상태 */
.pm-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--color-text-sub);
  font-size: var(--font-size-sm);
  line-height: 1.5;
}

/* === 우측 상세 === */
.pm-detail {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.pm-detail__name {
  font-size: var(--font-size-md);
  font-weight: 600;
}

/* 권종 라디오 (세로 1열) */
.pm-radios {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pm-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: var(--font-size-sm);
  background: #fff;
  transition: background 0.1s, border-color 0.1s;
}
.pm-radio:hover:not(.is-disabled) {
  background: #f5f5f5;
}
.pm-radio.is-disabled {
  cursor: not-allowed;
  color: var(--color-text-sub);
  background: #fafafa;
}
.pm-radio.is-checked {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
}
.pm-radio__label {
  font-weight: 500;
  min-width: 60px;
}
/* 라디오 우측 칩: 보유량·만기 / 보유 없음 / 차감 없음 */
.pm-radio__chip {
  margin-left: auto;
  font-size: var(--font-size-xs);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  background: var(--color-primary-soft);
  color: var(--color-primary-strong);
}
.pm-radio__chip--empty {
  background: #f1f5f9;
  color: var(--color-text-sub);
  font-weight: 500;
}
.pm-radio__chip--neutral {
  background: #f1f5f9;
  color: var(--color-text-sub);
  font-weight: 500;
}
/* 같은 날 다른 detail에서 이미 사용 중인 ticket의 type — 안내 강조 */
.pm-radio__chip--reuse {
  background: #fef3c7;
  color: #92400e;
}
/* 같은 날 이미 다른 권종을 사용 중이라 새로 차감할 수 없는 옵션 */
.pm-radio__chip--blocked {
  background: #fee2e2;
  color: #991b1b;
  font-weight: 500;
}
/* 이미 이 권종으로 참가 중 — 사용된 ticket 이름 + "사용됨" 표시 */
.pm-radio__chip--using {
  background: #dbeafe;
  color: #1e40af;
}

/* 통신 중 모달 본문 비활성. footer는 자체 disabled로 처리. */
.pm-busy {
  pointer-events: none;
  opacity: 0.55;
  transition: opacity 0.15s ease;
}

/* 일간 자유이용권 정책 경고 박스 */
.pm-warning {
  padding: 8px 10px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: var(--radius-md);
  color: #92400e;
  font-size: var(--font-size-sm);
  line-height: 1.4;
}

/* 푸터 */
.pm-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  width: 100%;
}
.pm-footer__left { font-size: var(--font-size-sm); }
.pm-footer__count { font-weight: 600; color: var(--color-primary-strong); }
.pm-footer__right { display: flex; gap: var(--space-2); }

/* 좁은 화면 — 좌/우 위아래 적층 */
@media (max-width: 600px) {
  .pm-body { grid-template-columns: 1fr; }
  .pm-left, .pm-right { min-height: 180px; max-height: 35vh; }
}
/* ===== 폼 유틸리티 ===== */
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}
.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-3);
}
.form-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}

.workroom-notice {
  background: var(--color-warn-soft);
  color: var(--color-warn-strong);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: var(--font-size-md);
  margin-bottom: var(--space-3);
}

/* ===== 디테일 편집 row ===== */
.detail-edit-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.detail-edit-row {
  display: grid;
  /* 시간 80 / 장소 110 / 내용 1fr (확장) / 삭제 auto.
     상세일정 상태 드롭다운은 옛 시스템 정책에 맞춰 UI에서 제거 (항상 'open' 전송). */
  grid-template-columns: 80px 110px 1fr auto;
  gap: var(--space-2);
  align-items: center;
}
.detail-edit-row .input,
.detail-edit-row .select {
  padding: 7px 10px;
  font-size: var(--font-size-md);
}

/* ===== owner picker ===== */
.owner-picker {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.owner-picker__row {
  display: flex;
  gap: var(--space-3);
}
.owner-picker__radio {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--font-size-md);
  cursor: pointer;
}
.owner-picker__radio.is-disabled {
  color: var(--color-text-muted);
  cursor: not-allowed;
}

@media (max-width: 720px) {
  .form-row-2 { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr; }
  .detail-edit-row {
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: auto;
  }
}

/* ===== 사이드 패널 헤더 ===== */
.side-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-line);
}
.side-header__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.side-header__title {
  margin: 0;
  font-size: var(--font-size-xl);
  font-weight: 700;
}
.side-holiday-chip {
  align-self: flex-start;
  background: var(--color-holiday-bg);
  color: var(--color-danger-strong);
  font-size: var(--font-size-md);
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  min-height: 1.4em;  /* 빈 placeholder도 같은 높이 유지 */
}
.side-holiday-chip--placeholder {
  background: transparent;
  color: transparent;
  visibility: hidden;
}

/* ===== 작업실 토글 카드 ===== */
.workroom-toggle-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #fafafa;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  margin: 8px 0;
}
.workroom-toggle-card__label {
  font-size: var(--font-size-md);
  font-weight: 700;
  color: var(--color-text);
}
.workroom-toggle-card__state {
  flex: 1;
  font-size: var(--font-size-md);
  color: var(--color-text-sub);
}
.workroom-toggle-card__state.state-unavailable {
  color: var(--color-danger-text);
  font-weight: 700;
}

/* iOS-style toggle switch */
.toggle-switch {
  display: inline-block;
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-switch__slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #d1d5db;
  border-radius: var(--radius-pill);
  transition: background var(--transition-fast);
}
.toggle-switch__slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition-fast);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-switch__slider {
  background: var(--color-danger);
}
.toggle-switch input:checked + .toggle-switch__slider::before {
  transform: translateX(20px);
}
.toggle-switch.is-disabled .toggle-switch__slider { cursor: not-allowed; opacity: 0.5; }
.toggle-switch input:disabled + .toggle-switch__slider { cursor: not-allowed; opacity: 0.5; }

/* ===== 사이드 본문 ===== */
.side-body {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.side-empty {
  padding: 24px 0;
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--font-size-md);
  line-height: 1.6;
}

/* ===== 사이드 패널 일정 카드 ===== */
.schedule-card {
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
/* state별 카드 배경은 사용 안 함. state는 우측 chip으로만 강조. */

.schedule-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.schedule-card__title {
  font-weight: 700;
  font-size: var(--font-size-lg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.schedule-card__state {
  font-size: var(--font-size-xs);
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  flex-shrink: 0;
}
.schedule-card__state.state-open    { background: var(--color-success-soft); color: var(--color-success-strong); }
.schedule-card__state.state-draft   { background: var(--color-primary-soft); color: var(--color-primary-strong); }
.schedule-card__state.state-closed  { background: var(--color-neutral-soft); color: var(--color-neutral-strong); }
.schedule-card__state.state-canceled{ background: var(--color-danger-soft); color: var(--color-danger-strong); }
.schedule-card__state.state-holiday { background: #f3f4f6; color: #6b7280; }

.schedule-card__owner {
  font-size: var(--font-size-md);
  color: var(--color-text-sub);
}

.schedule-card__details {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 4px;
}

/* ===== 디테일 row (시간 박스 + 본문) ===== */
.detail-row {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid rgba(0,0,0,0.06);
}
.detail-row:first-child { border-top: none; padding-top: 6px; }
.detail-row__time {
  flex-shrink: 0;
  width: 56px;
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  padding: 6px 4px;
  text-align: center;
  font-size: var(--font-size-md);
  font-weight: 700;
  color: var(--color-text);
  height: fit-content;
}
.detail-row__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.detail-row__content {
  font-size: var(--font-size-lg);
  color: var(--color-text);
  font-weight: 500;
}
.detail-row__place {
  font-size: var(--font-size-md);
  color: var(--color-text-sub);
}
.detail-row--canceled .detail-row__content {
  text-decoration: line-through;
  color: var(--color-text-muted);
}

.participant-btn {
  align-self: flex-start;
  margin-top: 2px;
  border: 1px solid var(--color-line);
  background: var(--color-surface);
  color: var(--color-text-sub);
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  font-size: var(--font-size-xs);
  cursor: pointer;
}
.participant-btn:hover { background: #f8fafc; }

/* ===== 로그인 / 가입 모달 안 ===== */
.login-signup-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  font-size: var(--font-size-md);
  color: var(--color-text-sub);
  margin-top: 4px;
}

.signup-code-preview {
  min-height: 16px;
  font-size: var(--font-size-sm);
  color: var(--color-success);
  margin-top: 4px;
}
.signup-code-preview--error {
  color: var(--color-danger);
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-size-md);
  color: var(--color-text);
}

/* ===== 개발 허브 ===== */
body.dev-hub-body { overflow: auto; }
.dev-hub {
  max-width: 920px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-4);
}
.dev-hub__title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: 0 0 var(--space-2);
}
.dev-hub__subtitle {
  color: var(--color-text-sub);
  margin: 0 0 var(--space-6);
}
.dev-hub__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-2);
}
.dev-hub__link {
  display: block;
  padding: 10px 14px;
  background: var(--color-primary-soft);
  border-radius: var(--radius-md);
  color: var(--color-primary);
  font-size: var(--font-size-lg);
  text-decoration: none;
  transition: background var(--transition-fast);
}
.dev-hub__link:hover { background: #bfdbfe; text-decoration: none; }
.dev-hub__link--done { background: var(--color-success-soft); color: var(--color-success); }
.dev-hub__link--todo {
  background: var(--color-bg);
  color: var(--color-text-muted);
  pointer-events: none;
  cursor: not-allowed;
}

.row-line {
  display: flex;
  gap: var(--space-3);
  font-size: var(--font-size-md);
  padding: 4px 0;
}
.row-line__label {
  color: var(--color-text-sub);
  width: 140px;
  flex-shrink: 0;
}

/* ===== 반응형 ===== */
@media (max-width: 1100px), (orientation: portrait) {
  html, body { overflow: auto; }
  .app {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }
  .app__side {
    max-height: none;
  }
}

/* ===== 컨텐츠 마스터 ===== */
/* roles-layout와 유사한 좌우 분할. 좌측: 검색·목록 / 우측: 편집 */
.content-master-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: var(--space-3);
  height: 70vh;
  min-height: 0;
}
.content-master-left {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  border-right: 1px solid var(--color-line);
  padding-right: var(--space-3);
  overflow: hidden;
  min-height: 0;
}
.content-master-left__head {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 0 0 auto;
}
.content-master-left__archived {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--font-size-sm);
  color: var(--color-text-sub);
  user-select: none;
}
.content-master-left__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  min-height: 0;
  flex: 1 1 auto;
}
.content-master-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  transition: background 0.15s;
}
.content-master-item:hover {
  background: #f8fbff;
}
.content-master-item.is-selected {
  background: var(--color-primary-soft);
  border-color: var(--color-primary);
}
.content-master-item.is-archived {
  opacity: 0.55;
}
.content-master-item__name {
  font-weight: 500;
}
.content-master-item__meta {
  font-size: var(--font-size-sm);
  color: var(--color-text-sub);
  margin-top: 2px;
}
.content-master-loading {
  display: inline-flex;
  align-items: center;
  font-size: var(--font-size-sm);
  color: var(--color-text-sub);
}

.content-master-right {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-right: var(--space-1);
  overflow-y: auto;
  min-height: 0;
}
.content-master-right__head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-line);
}
.content-master-right__thumb {
  width: 96px;
  height: 96px;
  object-fit: contain;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  flex: 0 0 auto;
}
.content-master-right__head-info {
  flex: 1;
  min-width: 0;
}
.content-master-right__head-info h3 {
  margin: 0 0 var(--space-1) 0;
}
.content-master-right__stats {
  padding: var(--space-2);
  background: var(--color-bg);
  border-radius: var(--radius-sm);
}
.content-master-right__actions {
  align-items: center;
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-line);
}
.content-master-right__archived {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--font-size-sm);
  user-select: none;
}

@media (max-width: 900px) {
  .content-master-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .content-master-left {
    border-right: none;
    padding-right: 0;
    border-bottom: 1px solid var(--color-line);
    padding-bottom: var(--space-3);
    overflow: visible;
  }
  .content-master-left__list,
  .content-master-right {
    overflow-y: visible;
  }
}

/* ===== 컨텐츠 추가 모달 ===== */
.content-add__intro {
  margin-bottom: var(--space-3);
}
.content-add__modes {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.content-add__modes .btn {
  width: 100%;
}
.content-add__back {
  margin-bottom: var(--space-2);
}
.content-add__bgg-selected {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  flex-wrap: wrap;
  padding: var(--space-2) var(--space-3);
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-3);
}
.content-add__results {
  margin-top: var(--space-2);
  max-height: 320px;
  overflow-y: auto;
}
.content-add__result-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.content-add__result-item {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}
.content-add__result-item:hover {
  background: #f8fbff;
}
.content-add__result-name {
  font-weight: 500;
}
.content-add__optional {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-line);
}
.content-add__optional summary {
  cursor: pointer;
  font-weight: 500;
  margin-bottom: var(--space-2);
}

/* ===== 보유 관리 모달 ===== */
.holdings-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-line);
  margin-bottom: var(--space-2);
  flex-wrap: wrap;
}
.holdings-target {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.holdings-state-filter {
  width: auto;
  min-width: 110px;
}
.holdings-search {
  width: 200px;
}
.holdings-loading {
  font-size: var(--font-size-sm);
  color: var(--color-text-sub);
}

.holdings-body {
  max-height: 50vh;
  overflow-y: auto;
  margin-bottom: var(--space-3);
}
.holdings-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.holdings-row {
  display: grid;
  grid-template-columns: 48px 1fr auto 200px 32px;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}
.holdings-row.state-0 {
  opacity: 0.6;
  background: var(--color-bg);
}
.holdings-row.state-2 {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
}
.holdings-row__thumb {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--color-bg);
}
.holdings-row__thumb--blank {
  background: var(--color-bg);
  border: 1px dashed var(--color-line);
}
.holdings-row__main {
  min-width: 0;
}
.holdings-row__name {
  font-weight: 500;
}
.holdings-row__states {
  display: inline-flex;
  gap: 2px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-surface);
}
.holdings-row__state {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: var(--font-size-sm);
  cursor: pointer;
  user-select: none;
  border-right: 1px solid var(--color-line);
}
.holdings-row__state:last-child { border-right: none; }
.holdings-row__state input[type="radio"] {
  display: none;
}
.holdings-row__state.is-active.state-0 {
  background: var(--color-text-muted);
  color: white;
}
.holdings-row__state.is-active.state-1 {
  background: var(--color-success);
  color: white;
}
.holdings-row__state.is-active.state-2 {
  background: var(--color-primary);
  color: white;
}
.holdings-row__state:hover:not(.is-active) {
  background: #f8fbff;
}
.holdings-row__memo {
  font-size: var(--font-size-sm);
}
.holdings-row__delete {
  font-size: 14px;
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* 추가 영역 */
.holdings-add {
  border-top: 1px solid var(--color-line);
  padding-top: var(--space-3);
}
.holdings-add__head {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.holdings-add__query {
  flex: 1;
}
.holdings-add__candidates {
  margin-top: var(--space-2);
  max-height: 240px;
  overflow-y: auto;
}
.holdings-add__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.holdings-add__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.holdings-add__item:hover:not(:disabled) {
  background: #f8fbff;
}
.holdings-add__item.is-already {
  opacity: 0.55;
  cursor: not-allowed;
}
.holdings-add__thumb {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--color-bg);
}
.holdings-add__item-name {
  font-weight: 500;
  flex: 1;
  min-width: 0;
}

@media (max-width: 720px) {
  .holdings-row {
    grid-template-columns: 48px 1fr auto;
    grid-template-areas:
      "thumb main delete"
      "states states states"
      "memo memo memo";
  }
  .holdings-row__thumb { grid-area: thumb; }
  .holdings-row__main { grid-area: main; }
  .holdings-row__states { grid-area: states; }
  .holdings-row__memo { grid-area: memo; width: 100%; }
  .holdings-row__delete { grid-area: delete; }
}

/* ===== 일정-컨텐츠 매핑 ===== */

/* 일정 편집 모달의 컨텐츠 섹션 */
.schedule-content-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.schedule-content-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  min-height: 28px;
}
.schedule-content-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px 2px 6px;
  background: var(--color-primary-soft);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
}
.schedule-content-chip__thumb {
  width: 20px;
  height: 20px;
  object-fit: contain;
  border-radius: 2px;
}
.schedule-content-chip__remove {
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0 2px;
  font-size: 12px;
  line-height: 1;
}
.schedule-content-chip__remove:hover {
  color: var(--color-danger);
}

.schedule-content-add {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.schedule-content-query {
  width: 100%;
}
.schedule-content-candidates {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  max-height: 200px;
  overflow-y: auto;
  background: var(--color-surface);
}
.schedule-content-candidate {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  width: 100%;
  padding: 6px 10px;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  font-size: var(--font-size-sm);
}
.schedule-content-candidate:hover:not(:disabled) {
  background: #f8fbff;
}
.schedule-content-candidate.is-already {
  opacity: 0.55;
  cursor: not-allowed;
}
.schedule-content-candidate__name {
  font-weight: 500;
}

/* side-panel 일정 카드의 컨텐츠 매핑 표시 */
.schedule-card__contents {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: var(--space-1);
}
.schedule-card__contents:empty {
  display: none;
}
.schedule-card__content-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  background: var(--color-primary-soft);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  color: var(--color-text);
}
.schedule-card__content-thumb {
  width: 16px;
  height: 16px;
  object-fit: contain;
  border-radius: 2px;
}

/* ===== 컨텐츠 통계 ===== */
.content-stats-tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--color-line);
  margin-bottom: var(--space-2);
  padding-bottom: var(--space-2);
}
.content-stats-toolbar {
  margin-bottom: var(--space-2);
}
.content-stats-body {
  max-height: 60vh;
  overflow-y: auto;
}
.content-stats-summary {
  padding: var(--space-2) var(--space-3);
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-2);
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
}
.content-stats-table th.w-rank { width: 48px; }
.content-stats-table th.w-category { width: 120px; }
.content-stats-table th.w-count { width: 80px; text-align: right; }
.content-stats-table th.w-date { width: 110px; }
.content-stats-table td:has(.content-stats-thumb) { width: 40px; }
.content-stats-thumb {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--color-bg);
}
.content-stats-user-chip {
  display: inline-block;
  padding: 1px 6px;
  background: var(--color-primary-soft);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  margin-right: 2px;
}
