/* Admin CRM — layout + components. Builds on styles/tokens.css */

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font-sans); background: var(--bg-surface); color: var(--fg-primary); }
a { color: inherit; text-decoration: none; cursor: pointer; }
button { font-family: inherit; }

.num { font-family: var(--font-sans); font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.accent { color: var(--accent); }
.muted { color: var(--fg-secondary); }
.neg { color: var(--danger); }

/* ============================================================
   Shell
   ============================================================ */
.shell { display: flex; min-height: 100vh; background: var(--bg-main); }
/* C-4b-fix2: 모바일 폭에서 topbar·테이블이 밀려도 메인 영역 자체는 viewport 를 넘지 않게 클립.
   테이블 래퍼(overflow-x: auto) 는 그 안쪽에서 자체 스크롤 허용. */
.shell-main { flex: 1; min-width: 0; overflow-x: hidden; display: flex; flex-direction: column; }

/* ============================================================
   Sidebar
   ============================================================ */
/* Phase D-1a: semantic 토큰으로 치환 (sidebar background 는 brand 고정) */
.sb {
  width: var(--shell-sidebar-w);
  background: var(--color-bg-brand);
  color: var(--sidebar-text);
  padding: 16px 10px 12px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  /* hotfix17 TASK 2: rail-mode 부드러운 transition */
  transition: width 200ms ease;
}

/* hotfix17.7 TASK 3: 토글 버튼 컴팩트 — .sb-item 과 동일한 padding/gap/font-size 로 통일.
   세로 공간 차지 메뉴 한 항목 동일. 위 divider 만 유지 (지점 카드와 분리), 아래 divider 제거. */
.sb-toggle-divider {
  height: 1px;
  background: var(--sidebar-divider);
  margin: 6px 0;
}
.sb-toggle-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 14px;          /* .sb-item 과 동일 (icon x 일관) */
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  color: var(--sidebar-text);
  font-size: 13px;            /* .sb-item 과 동일 */
  font-family: inherit;
  font-weight: 500;
  text-align: left;
  transition: background var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out);
}
.sb-toggle-btn:hover {
  background: var(--sidebar-hover);
  color: #fff;
}
/* hotfix17.10: 모든 focus state 시각 단서 제거 — 브라우저가 mouse click 후에도 focus-visible 처리하는
   엣지 케이스(Chrome) 까지 차단. 키보드 Tab 네비게이션은 hover 색과 동일한 brand 배경으로 대체 표시. */
.sb-toggle-btn:focus,
.sb-toggle-btn:focus-visible,
.sb-toggle-btn:active { outline: none !important; }
.sb-toggle-btn:focus-visible { background: var(--sidebar-hover); color: #fff; }
.sb-toggle-btn i { width: 16px; height: 16px; flex-shrink: 0; stroke-width: 1.75; }  /* .sb-ic 와 동일 */

/* hotfix17 TASK 2: rail-mode (collapsed) — 64px 아이콘 전용 */
.sb.is-rail { width: 64px; }
.sb.is-rail .sb-brand-text,
.sb.is-rail .sb-brand-name,
.sb.is-rail .sb-brand-sub,
.sb.is-rail .sb-item > span,
.sb.is-rail .sb-chev,
.sb.is-rail .sb-sub,
.sb.is-rail .sb-branch-label,
.sb.is-rail .sb-logout span {
  display: none !important;
}

/* hotfix17.8 TASK 2: 섹션 라벨 — expand=긴 라벨, rail=short 라벨 (3~4자, 중앙 정렬, 희미) */
.sb-section-label-short { display: none; }
.sb.is-rail .sb-section-label-long { display: none; }
.sb.is-rail .sb-section-label-short { display: block; }
.sb.is-rail .sb-section-label {
  text-align: center;
  font-size: 9.5px;
  padding: 8px 0 4px;
  color: var(--color-text-disabled);
  letter-spacing: 0.06em;
}

/* hotfix17.8 TASK 1: rail 모드 footer 아이콘 강제 노출 안전망 — Lucide rerender 누락 등 회귀 방지 */
.sb.is-rail .sb-toggle-btn i,
.sb.is-rail .sb-toggle-btn svg,
.sb.is-rail .sb-branch-ic,
.sb.is-rail .sb-logout i,
.sb.is-rail .sb-logout svg {
  display: inline-flex !important;
  visibility: visible !important;
}
/* hotfix17.9 + hotfix17.10 TASK 3: rail 모드 지점 chip — 가로 "광주" + 가운데 정렬.
   기존 .sb-branch-ic 28×28 정사각 → 가로 pill (auto width, height 24px, "광주" 한 줄 horizontal). */
.sb.is-rail .sb-branch {
  justify-content: center;
  padding: 4px 0;
  background: transparent;
}
.sb.is-rail .sb-branch-static:hover { background: transparent; }
.sb.is-rail .sb-branch-ic {
  width: auto;
  min-width: 36px;
  height: 24px;
  border-radius: 12px;
  padding: 0 10px;
  font-size: 11px;
  white-space: nowrap;
}
/* hotfix17.10: 로그아웃 + 토글 — rail 모드 가운데 정렬 (justify-content: center) + padding 축소 */
.sb.is-rail .sb-logout {
  justify-content: center;
  padding: 8px 0;
}
.sb.is-rail .sb-brand {
  flex-direction: column;
  gap: 6px;
  align-items: center;
  padding: 6px 0 10px;
}
.sb.is-rail .sb-mark { width: 36px; height: 36px; }
/* hotfix17.6: rail 모드에서 토글 버튼은 아이콘만 + 중앙 정렬, "접기/펼치기" span 숨김 */
/* hotfix17.7 TASK 2: rail 모드에서도 동일한 padding-left 유지 → 아이콘 x 좌표 일관 (점프 제거).
   .sb { padding: 16px 10px 12px } 기준, 모든 메뉴 항목 padding-left 14px →
   icon 좌측 끝 = 10 + 14 = 24px from .sb left edge. expand/rail 무관 동일. */
/* hotfix17.10: rail 모드 토글 버튼 — 가운데 정렬 (시각 anchor 로 사이드바 폭 중앙). */
.sb.is-rail .sb-toggle-btn {
  justify-content: center;
  padding: 8px 0;
}
.sb.is-rail .sb-toggle-btn span { display: none; }
.sb.is-rail .sb-item {
  /* 메뉴 항목은 좌측 정렬 유지 → icon x 일관성 (.sb-item 패턴) */
  padding: 8px 14px;
}
.sb.is-rail .sb-item .sb-ic { margin: 0; }
/* 베이스 .sb-item / .sb-toggle-btn 도 동일 padding 으로 수렴 (아래 베이스 룰에서 갱신) */

/* hotfix17.13: rail 모드 tooltip — 기존 `.sb.is-rail .sb-item:hover::after` (left: 100%) 가
   .sb-scroll 의 overflow-y: auto 에 의해 자동 적용된 overflow-x clip 으로 인해 사이드바 우측
   밖으로 못 나가서 메뉴 라벨 길이만큼 좁게 잘려 보이는 버그 발생.
   ReactDOM.createPortal 로 body 직계 자식으로 띄우는 .sb-tooltip 으로 치환 (Sidebar_v1_0426.jsx).
   sb-toggle-btn 도 같은 패턴으로 통합 (sb-foot 영역이라 ::after 잘림은 없었지만 일관성 유지). */
.sb-tooltip {
  position: fixed;
  transform: translateY(-50%);
  background: rgba(15, 23, 42, 0.95);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11.5px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 1000;
}

.sb-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 10px;
  color: #fff;
  border-bottom: 1px solid var(--sidebar-divider);
  margin-bottom: 10px;
}
/* hotfix20: 좌상단 brand 클릭 → 역할별 홈 이동. 호버 시 미세 강조. */
.sb-brand-link { cursor: pointer; transition: background 120ms; border-radius: 6px; }
.sb-brand-link:hover { background: rgba(255,255,255,0.04); }
.sb-brand-link:focus-visible { outline: 2px solid var(--accent, #2BB2A2); outline-offset: 2px; }
/* Part 1.5 §4.5: 엠블럼 48×48 */
.sb-mark { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sb-mark img { width: 100%; height: 100%; object-fit: contain; }
.sb-brand-name { font-weight: 700; font-size: 18px; line-height: 1.1; letter-spacing: -0.015em; }
.sb-brand-sub { font-size: 12px; font-weight: 400; color: var(--color-text-disabled); margin-top: 3px; letter-spacing: 0; }

.sb-scroll { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.sb-scroll::-webkit-scrollbar { width: 4px; }
.sb-scroll::-webkit-scrollbar-thumb { background: var(--sidebar-hover); border-radius: 2px; }

.sb-menu-label { padding: 6px 10px 10px; font-size: 10.5px; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; }

.sb-section { margin-top: 4px; }
.sb-section + .sb-section { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--sidebar-divider); }
.sb-section-label { padding: 4px 10px 6px; font-size: 10px; color: var(--color-text-disabled); text-transform: uppercase; letter-spacing: 0.12em; font-weight: 600; }

.sb-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  /* hotfix17.7 TASK 2: padding-left 14 (rail/expand 동일) — icon x 일관성 */
  padding: 8px 14px;
  border-radius: 6px; background: transparent; border: 0;
  color: var(--sidebar-text); font-size: 13px; font-weight: 500;
  cursor: pointer; margin-bottom: 1px; text-align: left;
  transition: background var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out);
  position: relative;
}
.sb-item:hover { background: var(--sidebar-hover); color: #fff; }
/* hotfix17.10: focus/active outline 제거 — 클릭 후 잔존 outline 차단 */
.sb-item:focus,
.sb-item:focus-visible,
.sb-item:active { outline: none !important; }
.sb-item:focus-visible { background: var(--sidebar-hover); color: #fff; }
.sb-item.is-active { background: var(--sidebar-hover); color: #fff; }
.sb-item.is-active::before {
  content: ''; position: absolute; left: -10px; top: 6px; bottom: 6px;
  width: 3px; background: var(--color-brand-primary); border-radius: 0 2px 2px 0;
}
/* Part 1.5 §2: 부모에 서브 active 있을 때 배경 강조. 좌측 3px 인디케이터는 없음 (서브에만 유지) */
.sb-item.has-active-child { background: var(--sidebar-hover); color: #fff; }
.sb-ic { width: 16px; height: 16px; flex-shrink: 0; stroke-width: 1.75; }
.sb-chev { margin-left: auto; width: 14px; height: 14px; opacity: 0.5; transition: transform var(--dur-base); }
.sb-chev.is-open { transform: rotate(90deg); opacity: 0.8; }

.sb-sub { padding: 2px 0 4px 34px; display: flex; flex-direction: column; }
.sb-subitem {
  display: flex; align-items: center; width: 100%;
  text-align: left; padding: 6px 10px; background: transparent; border: 0;
  color: var(--color-text-disabled); font-size: 12.5px; cursor: pointer; border-radius: 6px;
  font-family: inherit; margin-bottom: 1px;
}
.sb-subitem:hover { color: #fff; background: var(--sidebar-hover); }
.sb-subitem.is-active { color: #fff; font-weight: 500; }
.sb-subitem.is-active::before {
  content: ''; display: inline-block; width: 4px; height: 4px; border-radius: 50%;
  background: var(--color-brand-primary); margin-right: 8px; margin-left: -12px;
}

/* Part 1.5 §7: phase2 (예정) 서브는 회색 + 예정 뱃지. 클릭 시 toast 안내 */
.sb-subitem.is-phase2 { color: var(--color-text-disabled); cursor: not-allowed; }
.sb-subitem.is-phase2:hover { background: transparent; color: var(--color-text-disabled); }
.sb-phase-badge {
  margin-left: auto; font-size: 9.5px; font-weight: 600;
  padding: 2px 6px; border-radius: 3px;
  background: var(--sidebar-divider); color: var(--color-text-muted);
  letter-spacing: 0.02em;
}

.sb-foot {
  margin-top: 12px; padding: 10px 8px 4px;
  border-top: 1px solid var(--sidebar-divider);
  display: flex; flex-direction: column; gap: 8px;
}
.sb-branch {
  display: flex; align-items: center; gap: 10px;
  /* hotfix17.7 TASK 2: padding-left 14 (icon x 일관) */
  padding: 8px 14px; border-radius: 6px;
  background: var(--sidebar-hover);
  color: #fff; font-size: 12.5px;
  cursor: pointer; border: 0; text-align: left;
  width: 100%;
}
.sb-branch-ic { width: 28px; height: 28px; border-radius: 6px; background: var(--color-brand-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.sb-branch-label { flex: 1; }
.sb-branch-name { color: #fff; font-weight: 600; }
.sb-branch-sub { color: var(--color-text-disabled); font-size: 10.5px; margin-top: 1px; }
.sb-branch i { color: var(--color-text-disabled); width: 14px; height: 14px; }
.sb-branch-static { cursor: default; }
.sb-branch-static:hover { background: var(--sidebar-hover); }
.sb-logout {
  display: flex; align-items: center; gap: 10px;
  background: transparent; border: 0;
  /* hotfix17.7 TASK 2: padding-left 14 (icon x 일관), gap 10 (.sb-item 과 동일) */
  padding: 8px 14px; color: var(--color-text-disabled);
  font-size: 12px; cursor: pointer; border-radius: 6px;
  width: 100%;
}
.sb-logout:hover { color: #fff; background: var(--sidebar-hover); }
/* hotfix17.10: focus outline 제거 (toggle-btn 과 동일 패턴) */
.sb-logout:focus,
.sb-logout:focus-visible,
.sb-logout:active { outline: none !important; }
.sb-logout:focus-visible { background: var(--sidebar-hover); color: #fff; }
.sb-logout i { width: 16px; height: 16px; flex-shrink: 0; stroke-width: 1.75; }

/* ============================================================
   Topbar
   ============================================================ */
.tb {
  height: var(--shell-header-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px; gap: 20px; flex-shrink: 0;
  position: sticky; top: 0; z-index: 10;
}
.tb-hamburger { display: none; background: transparent; border: 0; padding: 6px; cursor: pointer; color: var(--fg-primary); }
.tb-tabs { display: flex; gap: 0; height: 100%; align-items: stretch; }
.tb-tab {
  background: transparent; border: 0; padding: 0 16px;
  font-size: 13.5px; color: var(--fg-secondary); cursor: pointer;
  border-bottom: 2px solid transparent; font-weight: 500;
  display: inline-flex; align-items: center; height: 100%; min-height: 36px;
  gap: 6px;
}
.tb-tab:hover { color: var(--fg-primary); }
.tb-tab.is-active { color: var(--color-text-primary); border-bottom-color: var(--color-brand-primary); font-weight: 600; }
.tb-tab i { width: 14px; height: 14px; color: var(--fg-muted); }
.tb-tab.is-active i { color: var(--color-brand-primary); }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.tb-search {
  display: flex; align-items: center; gap: 8px;
  width: 300px; height: 40px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--slate-300); border-radius: 8px;
  background: var(--bg-surface);
  transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), background var(--dur-base) var(--ease-out);
}
.tb-search:focus-within { border-color: var(--color-border-focus); background: var(--color-bg-elevated); box-shadow: var(--shadow-focus); }
.tb-search .lucide,
.tb-search > svg {
  width: 16px; height: 16px; flex-shrink: 0;
  color: var(--color-text-disabled); stroke-width: 2;
}
.tb-search input {
  flex: 1; min-width: 0;
  height: 100%; padding: 0; margin: 0;
  border: 0; background: transparent;
  font-size: 13px; font-family: inherit;
  color: var(--fg-primary); outline: none;
}
.tb-search input::placeholder { color: var(--color-text-disabled); }
.tb-search kbd {
  flex-shrink: 0;
  font-family: var(--font-mono); font-size: 11px;
  background: var(--color-border-subtle); color: var(--color-text-muted);
  padding: 2px 6px; border-radius: 4px; line-height: 1;
  border: 0;
}

.tb-iconbtn {
  width: 36px; height: 36px; border-radius: 6px;
  background: transparent; border: 1px solid transparent;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--fg-secondary); position: relative;
}
.tb-iconbtn:hover { background: var(--color-border-subtle); color: var(--fg-primary); }
.tb-iconbtn i { width: 16px; height: 16px; }
.tb-iconbtn .dot { position: absolute; top: 8px; right: 8px; width: 6px; height: 6px; background: var(--danger); border-radius: 50%; border: 1.5px solid #fff; }

/* hotfix15 + Part C.2.5 TASK 5-B/5-C: 알림 벨 + 빨간 배지 + 드롭다운 */
.tb-bell-wrap { position: relative; display: inline-flex; }
.tb-bell.is-open { background: var(--color-border-subtle); color: var(--fg-primary); }
/* hotfix28.6: 위치 위쪽으로 (벨 가림 완화) + 정원 (찌그러짐 수정) */
.bell-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #DC2626;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 0 4px;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  border-radius: 9999px;
  text-align: center;
  border: 1.5px solid #fff;
  font-variant-numeric: tabular-nums;
  box-sizing: border-box;
}
.noti-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 360px;
  max-height: 480px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--color-border-subtle, #E5E7EB);
  border-radius: 10px;
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.16);
  z-index: 1200;
}
.noti-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border-subtle, #E5E7EB);
  font-weight: 700;
  font-size: 13px;
  color: var(--fg-primary, #111827);
  background: var(--color-bg-subtle, #F9FAFB);
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}
.noti-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--fg-muted, #9CA3AF);
  font-size: 13px;
}
.noti-item {
  padding: 12px 16px;
  border-bottom: 1px solid #F3F4F6;
  cursor: pointer;
  transition: background 0.12s ease;
}
.noti-item:hover { background: var(--color-bg-subtle, #F9FAFB); }
.noti-item.is-unread { background: #EFF6FF; }
.noti-item.is-unread:hover { background: #DBEAFE; }
.noti-item.severity-warning .noti-title { color: #92400E; }
.noti-item.severity-error .noti-title   { color: #991B1B; }
.noti-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
  color: var(--fg-primary, #111827);
}
.noti-message {
  font-size: 12px;
  color: var(--fg-secondary, #374151);
  line-height: 1.5;
  margin-bottom: 8px;
  word-break: keep-all;
}
.noti-students {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}
.noti-student-link {
  text-align: left;
  background: #FEF3C7;
  border: 1px solid #FCD34D;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 12px;
  color: #78350F;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: inherit;
  font-weight: 600;
  transition: background 0.12s ease;
}
.noti-student-link:hover { background: #FDE68A; }
.noti-student-meta { font-size: 11px; color: #92400E; font-weight: 500; }
.noti-time {
  font-size: 11px;
  color: var(--fg-muted, #9CA3AF);
  font-variant-numeric: tabular-nums;
}
.noti-footer {
  padding: 10px 16px;
  text-align: center;
  border-top: 1px solid var(--color-border-subtle, #E5E7EB);
  background: var(--color-bg-subtle, #F9FAFB);
  font-size: 11px;
  color: var(--fg-muted, #9CA3AF);
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
}

/* hotfix16 TASK 6-C: 알림 드롭다운 강의(session_unassigned) 카드 chip */
.noti-sessions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  margin-bottom: 8px;
}
.noti-session-chip {
  display: flex;
  flex-direction: column;
  background: #FEF3C7;
  border: 1px solid #FCD34D;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 12px;
}
.noti-session-course { font-weight: 600; color: #78350F; }
.noti-session-meta { font-size: 11px; color: #92400E; margin-top: 2px; font-variant-numeric: tabular-nums; }
.btn-noti-action {
  margin-top: 6px;
  padding: 8px 10px;
  background: var(--accent, #0D9488);
  color: #fff;
  border: 0;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  transition: background 0.12s ease;
  width: 100%;
}
.btn-noti-action:hover { background: #0F766E; }

.tb-user {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px;
  background: transparent; border: 0; padding: 0 8px 0 4px;
  cursor: pointer; font-size: 13px; color: var(--fg-primary);
  border-radius: 6px;
}
.tb-user:hover { background: var(--color-border-subtle); }
.tb-user .av { width: 28px; height: 28px; border-radius: 50%; background: var(--color-brand-primary); color: var(--color-on-brand); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; letter-spacing: 0; }
.tb-user-name { font-weight: 500; }
.tb-user i { width: 14px; height: 14px; color: var(--fg-muted); }

/* ============================================================
   Dashboard
   ============================================================ */
.dash { padding: 28px 32px 80px; }

.dash-hero { margin-bottom: 24px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.dash-hero h1 {
  margin: 0; font-size: 26px; font-weight: 700;
  line-height: 1.35; letter-spacing: -0.02em;
  color: var(--fg-primary);
}
.dash-hero h1 > .pin,
.dash-hero .pin {
  color: #0F172A !important;
  font-weight: 700 !important;
  background-image: linear-gradient(transparent 62%, rgba(14, 149, 148, 0.22) 62%, rgba(14, 149, 148, 0.22) 92%, transparent 92%);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  padding: 0 3px;
}
.dash-hero h1 .count { color: var(--accent); font-weight: 800; font-size: 30px; margin: 0 2px; }
.dash-hero-meta { display: flex; align-items: center; gap: 14px; color: var(--fg-secondary); font-size: 12.5px; }
.dash-hero-meta .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--slate-300); }
.dash-hero-meta .live { display: inline-flex; align-items: center; gap: 6px; color: var(--success); font-weight: 500; }
.dash-hero-meta .live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15); }

/* KPI */
.dash-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.stat {
  background: #fff; border: 1px solid var(--border);
  border-radius: 8px; padding: 18px 20px;
  display: flex; flex-direction: column; gap: 10px;
  position: relative; overflow: hidden;
  transition: border-color var(--dur-base) var(--ease-out);
}
.stat:hover { border-color: var(--slate-300); }
.stat-head { display: flex; align-items: center; justify-content: space-between; }
.stat-label { font-size: 12.5px; color: var(--fg-secondary); font-weight: 500; }
.stat-icon { width: 28px; height: 28px; border-radius: 6px; background: var(--color-border-subtle); color: var(--fg-secondary); display: flex; align-items: center; justify-content: center; }
.stat-icon.is-teal { background: var(--color-brand-primary-subtle); color: var(--color-brand-primary); }
.stat-icon.is-warn { background: var(--warning-50); color: var(--warning-700); }
.stat-icon.is-ok   { background: var(--success-50); color: var(--success-700); }
.stat-icon.is-info { background: var(--color-brand-primary-subtle); color: var(--color-brand-primary); }
.stat-icon i { width: 16px; height: 16px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--fg-primary); letter-spacing: -0.025em; line-height: 1.1; }
.stat-value .unit { font-size: 14px; font-weight: 500; color: var(--fg-secondary); margin-left: 2px; }
.stat-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.stat-delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-variant-numeric: tabular-nums; padding: 2px 6px; border-radius: 4px; }
.stat-delta.up { background: var(--success-50); color: var(--success-700); }
.stat-delta.down { background: var(--danger-50); color: var(--danger-700); }
.stat-delta.flat { background: var(--color-border-subtle); color: var(--slate-600); }
.stat-hint { color: var(--fg-muted); font-size: 11.5px; }
.stat-cta { font-size: 11.5px; color: var(--accent); font-weight: 600; margin-left: auto; cursor: pointer; }
.stat-cta:hover { text-decoration: underline; }
.stat-spark { position: absolute; right: 8px; bottom: 6px; opacity: 0.7; pointer-events: none; }

/* Grid */
.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr);
  gap: 16px;
  margin-bottom: 16px;
}
.dash-grid-2 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

/* Card generic — Phase D-1a semantic 토큰 사용 */
.card {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-default);
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
}
.card-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; gap: 12px;
  border-bottom: 1px solid var(--color-border-default);
}
.card-hd .h3 { margin: 0; font-size: 15px; font-weight: 600; color: var(--fg-primary); }
.card-hd-more { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--fg-secondary); background: transparent; border: 0; cursor: pointer; padding: 4px 6px; border-radius: 4px; }
.card-hd-more:hover { background: var(--color-border-subtle); color: var(--fg-primary); }
.card-hd-more i { width: 14px; height: 14px; }
.card-body { padding: 16px 18px; }
.card-body-flush { padding: 0; }

/* Sub-tabs inside card header */
.card-subtabs { display: flex; gap: 2px; padding: 10px 12px 0; border-bottom: 1px solid var(--border); }
.card-subtab {
  background: transparent; border: 0; padding: 8px 12px 10px;
  font-size: 13px; color: var(--fg-secondary); cursor: pointer;
  border-bottom: 2px solid transparent; font-weight: 500;
  margin-bottom: -1px;
}
.card-subtab:hover { color: var(--fg-primary); }
.card-subtab.is-active { color: var(--color-text-primary); border-bottom-color: var(--color-brand-primary); font-weight: 600; }
.card-subtab .count { color: var(--fg-muted); font-weight: 500; margin-left: 4px; font-size: 12px; }
.card-subtab.is-active .count { color: var(--color-brand-primary); }

/* Board list */
.board-list { display: flex; flex-direction: column; }
.board-item {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 14px; align-items: center;
  padding: 12px 18px;
  border-top: 1px solid var(--divider);
  font-size: 13px;
  cursor: pointer;
  transition: background var(--dur-base);
}
.board-item:first-child { border-top: 0; }
.board-item:hover { background: var(--color-bg-sunken); }
.board-date { color: var(--fg-secondary); font-size: 12px; }
.board-title { color: var(--fg-primary); display: flex; align-items: center; gap: 8px; min-width: 0; }
.board-title-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-title .pin { color: var(--danger); font-weight: 700; font-size: 11px; }
.board-new {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--danger); color: #fff;
  font-size: 9px; font-weight: 700;
  flex-shrink: 0;
}

/* Schedule list (수능 시간표) */
.sched-list { display: flex; flex-direction: column; }
.sched-row {
  display: grid; grid-template-columns: 84px 1fr auto;
  gap: 14px; align-items: center;
  padding: 11px 18px; border-top: 1px solid var(--divider);
  font-size: 13px;
}
.sched-row:first-child { border-top: 0; }
.sched-row:hover { background: var(--color-bg-sunken); }
.sched-time { font-family: var(--font-sans); font-variant-numeric: tabular-nums; font-weight: 600; color: var(--fg-primary); font-size: 13px; }
.sched-time .sub { color: var(--fg-muted); font-weight: 500; font-size: 11.5px; margin-left: 2px; }
.sched-title { color: var(--fg-primary); }
.sched-title .where { color: var(--fg-secondary); font-size: 12px; margin-left: 6px; }

/* Attendance / signup list (출결·회원 신청) */
.req-list { display: flex; flex-direction: column; }
.req-row {
  display: grid; grid-template-columns: 36px 1fr auto;
  gap: 12px; align-items: center;
  padding: 11px 18px; border-top: 1px solid var(--divider);
  font-size: 13px;
}
.req-row:first-child { border-top: 0; }
.req-row:hover { background: var(--color-bg-sunken); }
.req-av { width: 32px; height: 32px; border-radius: 50%; background: var(--color-border-default); color: var(--color-text-secondary); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; }
.req-av.teal { background: var(--color-brand-primary-subtle); color: var(--color-text-link); }
.req-av.warn { background: var(--warning-50); color: var(--warning-700); }
.req-av.pink { background: #FCE7F3; color: #BE185D; }
.req-av.violet { background: #EDE9FE; color: #6D28D9; }
.req-body { min-width: 0; }
.req-name { color: var(--fg-primary); font-weight: 500; font-size: 13px; }
.req-name .sub { color: var(--fg-muted); font-weight: 400; margin-left: 6px; font-size: 12px; }
.req-meta { color: var(--fg-secondary); font-size: 11.5px; margin-top: 1px; }
.req-actions { display: flex; gap: 4px; }
.req-btn {
  height: 26px; padding: 0 10px;
  border-radius: 4px; border: 1px solid var(--border);
  background: #fff; font-size: 11.5px; font-weight: 500;
  cursor: pointer; color: var(--fg-primary); font-family: inherit;
}
.req-btn:hover { background: var(--color-border-subtle); }
.req-btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.req-btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.req-btn.ghost { background: transparent; border-color: transparent; color: var(--fg-secondary); }
.req-btn.ghost:hover { color: var(--danger); background: var(--danger-50); }

/* Badge (inherit base) */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 500; line-height: 1; white-space: nowrap; }
/* Phase D-1a semantic 토큰 */
.badge-neutral { background: var(--color-bg-subtle);             color: var(--color-text-secondary); }
.badge-info    { background: var(--color-action-info-subtle);    color: var(--color-text-link); }
.badge-success { background: var(--color-action-success-subtle); color: var(--color-text-link); }
.badge-warning { background: var(--color-action-warning-subtle); color: var(--warning-700); }
.badge-danger  { background: var(--color-action-danger-subtle);  color: var(--danger-700); }
.badge-brand   { background: var(--color-bg-brand);              color: var(--color-on-brand); }

/* Calendar */
.cal-hd { display: flex; align-items: center; gap: 10px; }
.cal-title { font-size: 15px; font-weight: 700; color: var(--fg-primary); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.cal-nav { display: flex; gap: 2px; align-items: center; }
.icon-btn {
  width: 28px; height: 28px; border-radius: 6px;
  border: 1px solid var(--border); background: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--fg-secondary);
}
.icon-btn:hover { background: var(--color-border-subtle); color: var(--fg-primary); }
.icon-btn i { width: 14px; height: 14px; }
.cal-today-btn {
  height: 28px; padding: 0 10px; border-radius: 6px;
  border: 1px solid var(--border); background: #fff;
  font-size: 12px; font-weight: 500; color: var(--fg-primary);
  cursor: pointer; font-family: inherit;
}
.cal-today-btn:hover { background: var(--color-border-subtle); }
.cal-legend { display: flex; align-items: center; gap: 14px; margin-left: auto; font-size: 11.5px; color: var(--fg-secondary); }
.cal-legend .dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.cal-legend .dot.teal { background: var(--color-brand-primary); }
.cal-legend .dot.amber { background: var(--warning-600); }
.cal-legend .dot.violet { background: #8B5CF6; }

.cal { display: flex; flex-direction: column; }
.cal-wd { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--bg-surface); border-bottom: 1px solid var(--border); }
.cal-wd-item { padding: 8px 10px; font-size: 11px; color: var(--fg-secondary); text-align: left; letter-spacing: 0.05em; font-weight: 600; text-transform: uppercase; }
.cal-wd-item.sun { color: var(--danger); }
.cal-wd-item.sat { color: var(--color-brand-primary-hover); }

.cal-row { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-row:last-child .cal-cell { border-bottom: 0; }
.cal-cell {
  border-top: 1px solid var(--divider);
  border-left: 1px solid var(--divider);
  min-height: 92px; padding: 6px 6px 8px;
  display: flex; flex-direction: column; gap: 3px;
  cursor: pointer;
  transition: background var(--dur-base);
}
.cal-cell:first-child { border-left: 0; }
.cal-row:first-child .cal-cell { border-top: 0; }
.cal-cell:hover { background: var(--color-bg-sunken); }
.cal-cell.dim { background: var(--bg-surface); }
.cal-cell.dim .cal-num { color: var(--fg-muted); }

.cal-num {
  font-size: 12px; color: var(--fg-primary); font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 5px; border-radius: 999px;
  font-variant-numeric: tabular-nums;
  align-self: flex-start;
}
.cal-num.is-today { background: var(--accent); color: #fff; }
.cal-cell.sun .cal-num:not(.is-today) { color: var(--danger); }
.cal-cell.sat .cal-num:not(.is-today) { color: var(--color-brand-primary-hover); }

.cal-ev {
  font-size: 11px; padding: 2px 6px; border-radius: 3px;
  line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-weight: 500;
  border-left: 2px solid;
}
.cal-ev.tone-teal   { background: var(--color-brand-primary-subtle);    color: var(--color-text-link);    border-color: var(--color-brand-primary); }
.cal-ev.tone-amber  { background: var(--warning-50); color: var(--warning-700); border-color: var(--warning-600); }
.cal-ev.tone-violet { background: #F5F3FF;           color: #6D28D9;            border-color: #8B5CF6; }
.cal-ev.tone-danger { background: var(--danger-50);  color: var(--danger-700);  border-color: var(--danger-600); }

/* Empty state row (calendar note) */
.cal-note {
  padding: 10px 18px; background: var(--bg-surface);
  color: var(--fg-secondary); font-size: 12px;
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--border);
}
.cal-note i { width: 14px; height: 14px; color: var(--fg-muted); }

/* ============================================================
   Tweaks panel
   ============================================================ */
.tweaks {
  position: fixed; right: 20px; bottom: 20px; z-index: 50;
  width: 280px; background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  font-family: var(--font-sans);
}
.tweaks-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.tweaks-hd .t { font-size: 13px; font-weight: 600; color: var(--fg-primary); display: flex; align-items: center; gap: 6px; }
.tweaks-hd .t i { width: 14px; height: 14px; color: var(--accent); }
.tweaks-hd button { background: transparent; border: 0; width: 24px; height: 24px; border-radius: 4px; cursor: pointer; color: var(--fg-secondary); display: inline-flex; align-items: center; justify-content: center; }
.tweaks-hd button:hover { background: var(--color-border-subtle); color: var(--fg-primary); }
.tweaks-hd button i { width: 14px; height: 14px; }
.tweaks-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 12px; }
.tweaks-row { display: flex; flex-direction: column; gap: 6px; }
.tweaks-row label { font-size: 11.5px; color: var(--fg-secondary); font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; }
.tweaks-row input[type=text], .tweaks-row input[type=number] {
  height: 30px; padding: 0 8px; border: 1px solid var(--border); border-radius: 4px;
  font-size: 12.5px; font-family: inherit; color: var(--fg-primary);
}
.tweaks-row input:focus { outline: none; border-color: var(--accent); box-shadow: var(--shadow-focus); }
.tweaks-row .seg { display: flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.tweaks-row .seg button { flex: 1; height: 30px; background: #fff; border: 0; cursor: pointer; font-size: 12px; font-family: inherit; color: var(--fg-secondary); padding: 0; }
.tweaks-row .seg button:hover { background: var(--color-border-subtle); }
.tweaks-row .seg button.on { background: var(--accent); color: #fff; }
.tweaks-row .seg button + button { border-left: 1px solid var(--border); }
.tweaks-row .seg button.on + button { border-left-color: var(--accent); }

/* C-5a-fix1: Tweaks 토글 FAB */
.tweaks-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 49;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--color-border-default);
  background: var(--color-bg-elevated);
  color: var(--color-text-secondary);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-md);
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.tweaks-fab:hover { background: var(--color-bg-subtle); color: var(--color-text-primary); transform: translateY(-1px); }
.tweaks-fab.is-open { background: var(--color-brand-primary); color: var(--color-on-brand); border-color: var(--color-brand-primary); }
.tweaks-fab i { width: 18px; height: 18px; }
/* Tweaks 패널이 열려있으면 FAB 는 패널 위에 겹쳐 이동 */
.tweaks-fab.is-open { bottom: calc(20px + 220px); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1280px) {
  .dash-kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sb { position: fixed; left: 0; top: 0; bottom: 0; z-index: 100; transform: translateX(-100%); transition: transform var(--dur-slow); }
  .sb.is-open { transform: translateX(0); box-shadow: var(--shadow-md); }
  .tb-hamburger { display: inline-flex; }
  .tb-search { width: 160px; }
  .dash { padding: 20px 16px 64px; }
  .dash-hero h1 { font-size: 20px; }
  .dash-hero h1 .count { font-size: 24px; }
  .dash-kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 14px; }
}
