/* ===== 디자인 토큰 ===== */
:root {
  --color-bg: #f5f6f8;
  --color-surface: #ffffff;
  --color-border: #e3e6eb;
  --color-text: #1d2330;
  --color-muted: #6b7280;
  --color-primary: #1f6feb;
  --color-primary-weak: #e8f0fe;
  --color-danger: #d93025;
  --color-danger-weak: #fdecea;
  --color-success: #1e8e3e;
  --color-warning-weak: #fff4e5;
  --color-warning: #b26a00;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);

  --sidebar-width: 232px;
  --topbar-height: 60px;
  --tabbar-height: 62px;

  --font: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--color-primary); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
button, input, select, textarea { font: inherit; color: inherit; }

.icon { width: 20px; height: 20px; flex: none; }
[data-icon] { display: inline-flex; }

/* ===== 레이아웃 ===== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 12px;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 14px;
  color: var(--color-text);
  font-weight: 700;
  font-size: 17px;
}
/* 대표 사진 (img/logo.jpg: 원본 icon.jpg의 로고 부분을 128px로 줄인 것) */
.brand-logo {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
}
/* 사이드바 상단 가로형 로고 (img/logo-wide.jpg, 글자 없이 로고만) */
.brand-wide { display: block; width: 100%; max-width: 196px; height: auto; border-radius: 8px; }
/* 테마 On/Off 에 따라 다른 로고를 보여준다 (On: logo2·logo4 블랙 톤, Off: logo5·logo6 밝은 톤) */
.theme-on-only { display: none !important; }
html[data-theme="premium"] .theme-on-only { display: block !important; }
html[data-theme="premium"] .theme-off-only { display: none !important; }
.auth-logo img.auth-logo-light { width: 180px; height: auto; border-radius: 0; }
/* 테마 Off: 사진과 아이디 입력창 사이를 한 줄(약 24px) 더 띄운다 */
html:not([data-theme="premium"]) .auth-logo { margin-bottom: 48px; }
.brand-compact { display: none; padding: 0; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-muted);
  font-weight: 500;
}
.nav-link:hover { background: var(--color-bg); color: var(--color-text); }
.nav-link[aria-current="page"] { background: var(--color-primary-weak); color: var(--color-primary); }

.main-col { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 360px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-muted);
}
.search:focus-within { border-color: var(--color-primary); background: var(--color-surface); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--color-text); }

.banner {
  padding: 10px 24px;
  background: var(--color-warning-weak);
  color: var(--color-warning);
  border-bottom: 1px solid #f5d9a8;
  font-size: 14px;
}

.page {
  width: 100%;
  max-width: 1200px;
  padding: 24px;
  outline: none;
}

.tabbar { display: none; }

/* 카피라이트: 앱은 본문 아래(.page가 남는 높이를 채움), 로그인은 화면 맨 아래 */
.page { flex: 1; }
.app-footer { padding: 12px 24px 20px; color: var(--color-muted); font-size: 12px; text-align: center; }

/* ===== 모바일: 사이드바 → 하단 탭바 ===== */
@media (max-width: 768px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .brand-compact { display: flex; }
  .topbar { padding: 0 16px; }
  .search { max-width: none; }
  .banner { padding: 10px 16px; }
  .page { padding: 16px; }
  /* 하단 탭바에 가리지 않도록 탭바 높이만큼은 카피라이트 아래에 둔다 */
  .app-footer { padding: 8px 16px calc(var(--tabbar-height) + 16px + env(safe-area-inset-bottom)); }

  .tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 20;
    display: grid;
    grid-auto-flow: column;   /* 메뉴 수는 역할마다 다르다 (대표 7개 · 트레이너 4개) */
    grid-auto-columns: minmax(0, 1fr);
    height: calc(var(--tabbar-height) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
  }
  .tab-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    color: var(--color-muted);
    font-size: 11px;
    font-weight: 500;
  }
  .tab-link span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tab-link[aria-current="page"] { color: var(--color-primary); }
}

/* ===== 페이지 공통 ===== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.page-header h1 { font-size: 22px; }

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.placeholder { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.placeholder ul { margin: 0; padding-left: 20px; color: var(--color-muted); }

.muted { color: var(--color-muted); margin: 0; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--color-primary-weak);
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 600;
}

/* ===== 버튼 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--color-bg); }
.btn-primary { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.btn-primary:hover { background: #1a5fd0; }
.btn-danger { background: var(--color-danger); border-color: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #bf2a20; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-icon { min-height: 36px; width: 36px; padding: 0; }

/* ===== 모달 ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(16, 24, 40, .45);
}
.modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 32px);
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.modal-lg { max-width: 760px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}
.modal-header h2 { font-size: 17px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-body p { margin: 0; white-space: pre-line; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px 16px;
}

@media (max-width: 768px) {
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { max-width: none; max-height: 90vh; border-radius: var(--radius) var(--radius) 0 0; }
  .modal-footer { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .modal-footer .btn { flex: 1; }
}

/* ===== 토스트 ===== */
.toast-region {
  position: fixed;
  z-index: 200;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--color-text);
  color: #fff;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  pointer-events: auto;
  animation: toast-in .18s ease-out;
}
.toast-success { background: var(--color-success); }
.toast-error { background: var(--color-danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }

/* ===== 테이블 ===== */
.table-wrap {
  overflow-x: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  white-space: nowrap;
}
.table th { background: var(--color-bg); color: var(--color-muted); font-weight: 600; font-size: 13px; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th[aria-sort="ascending"]::after { content: " ▲"; font-size: 10px; }
.table th[aria-sort="descending"]::after { content: " ▼"; font-size: 10px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover, .table tr.clickable:focus-visible { background: var(--color-primary-weak); outline: none; }
.table .align-right { text-align: right; }
.table .align-center { text-align: center; }
.table-empty { padding: 32px 16px; text-align: center; color: var(--color-muted); }

/* ===== 공통 보조 ===== */
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-small { min-height: 32px; padding: 0 12px; font-size: 13px; }
.card + .card, .card + .table-wrap { margin-top: 16px; }
.card-title { font-size: 17px; margin-bottom: 12px; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.section-header h2 { font-size: 17px; margin: 0; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 40px 20px; text-align: center; }
.empty-state p { margin: 0; }

.banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.banner[hidden] { display: none; }
.banner .btn { border-color: #f5d9a8; }

/* 배지 색상 */
.badge-neutral { background: #eef0f3; color: #4b5563; }
.badge-info { background: var(--color-primary-weak); color: var(--color-primary); }
.badge-success { background: #e6f4ea; color: var(--color-success); }
.badge-warning { background: var(--color-warning-weak); color: var(--color-warning); }
.badge-danger { background: var(--color-danger-weak); color: var(--color-danger); }
.badge-muted { background: #f1f3f4; color: #80868b; }

.caution-icon { display: inline-flex; color: var(--color-danger); vertical-align: middle; }
.caution-icon .icon { width: 18px; height: 18px; }
.member-name { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }

/* ===== 폼 ===== */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-section { display: flex; flex-direction: column; gap: 14px; }
.form-section h2 { font-size: 17px; }
.form-section > p { margin: -8px 0 0; }
.form-section.card + .form-section.card { margin-top: 0; }
.form-section-caution { border-left: 4px solid var(--color-danger); }
.form-subtitle { font-size: 15px; margin-top: 8px; color: var(--color-muted); }
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-full { grid-column: 1 / -1; }
.field-label { font-size: 14px; font-weight: 600; }
.required { color: var(--color-danger); }
.field-hint { margin: 0; font-size: 13px; color: var(--color-muted); }
.field-error { margin: 0; font-size: 13px; color: var(--color-danger); }
.has-error .input { border-color: var(--color-danger); }
.has-error .choice span { border-color: var(--color-danger); }

.input {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}
.input:focus { outline: 2px solid var(--color-primary-weak); border-color: var(--color-primary); }
textarea.input { resize: vertical; min-height: 64px; }
.input-color { padding: 4px; height: 42px; cursor: pointer; }

.choice-group { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  font-size: 14px;
  cursor: pointer;
}
.choice input:checked + span { border-color: var(--color-primary); background: var(--color-primary-weak); color: var(--color-primary); font-weight: 600; }
.choice input:focus-visible + span { outline: 2px solid var(--color-primary); outline-offset: 2px; }

.toggle-list { display: flex; flex-direction: column; gap: 10px; }
.toggle { position: relative; display: inline-flex; align-items: center; gap: 10px; min-height: 32px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-track {
  position: relative;
  flex: none;
  width: 40px;
  height: 24px;
  border-radius: 999px;
  background: #c4c9d0;
  transition: background .15s;
}
.toggle-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform .15s;
}
.toggle input:checked + .toggle-track { background: var(--color-primary); }
.toggle input:checked + .toggle-track::after { transform: translateX(16px); }
.toggle input:focus-visible + .toggle-track { outline: 2px solid var(--color-primary); outline-offset: 2px; }

.form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ===== 회원 목록 ===== */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.toolbar .input { width: auto; min-width: 150px; }
.toolbar input[type="search"] { flex: 1 1 220px; }

/* ===== 회원 상세 ===== */
.member-header { align-items: flex-start; }
.member-title { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.member-title h1 { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.member-title p { margin: 0; }
.back-link {
  /* 뒤로 가기 (회원 목록·수업 일정): 작은 테두리 버튼 */
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 32px;
  padding: 0 12px 0 8px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-muted);
  font-size: 13px;
  font-weight: 600;
}
.back-link:hover { color: var(--color-text); background: var(--color-bg); }
.back-link .icon { width: 16px; height: 16px; }
.header-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.callout { margin-bottom: 16px; padding: 14px 16px; border-radius: var(--radius); }
.callout-danger { background: var(--color-danger-weak); border: 1px solid #f6c6c2; color: #8c1d18; }
.callout strong { display: inline-flex; align-items: center; gap: 6px; }
.callout-list { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 8px 0 0; font-size: 14px; }
.callout-list dt { font-weight: 600; }
.callout-list dd { margin: 0; white-space: pre-line; }

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  overflow-x: auto;
  border-bottom: 1px solid var(--color-border);
  scrollbar-width: none;
}
.tab {
  flex: none;
  padding: 10px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--color-muted);
  font-weight: 600;
  cursor: pointer;
}
.tab[aria-selected="true"] { color: var(--color-primary); border-bottom-color: var(--color-primary); }

.info-list { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; margin: 0; }
.info-list dt { color: var(--color-muted); font-size: 14px; }
.info-list dd { margin: 0; white-space: pre-line; word-break: break-word; }
.chip-list { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 2px 10px; border: 1px solid var(--color-border); border-radius: 999px; background: var(--color-bg); font-size: 13px; }

/* 수강권 카드 */
.pass-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.pass-list .card + .card { margin-top: 0; }
.pass-card { display: flex; flex-direction: column; gap: 12px; }
.pass-expired, .pass-exhausted, .pass-refunded { background: #fafbfc; }
.pass-card-header { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.pass-card-header h3 { margin-right: auto; font-size: 16px; }
.pass-remaining { display: flex; flex-direction: column; gap: 2px; }
.pass-remaining strong { font-size: 22px; }
.pass-remaining span { font-size: 14px; }
.pass-meta { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0; font-size: 14px; }
.pass-meta dt { color: var(--color-muted); }
.pass-meta dd { margin: 0; }
.pass-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.pass-actions .btn { min-height: 34px; padding: 0 10px; font-size: 13px; }
.pass-actions .icon { width: 16px; height: 16px; }

.progress { height: 8px; overflow: hidden; border-radius: 999px; background: var(--color-bg); }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--color-primary); }
.progress-danger span { background: var(--color-danger); }

.adjust-preview { display: flex; align-items: center; min-height: 42px; margin: 0; font-weight: 600; }

/* 변경 이력 */
.history { display: flex; flex-direction: column; gap: 12px; }
.history > p { margin: 0; }
.timeline {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  padding: 0 0 0 16px;
  border-left: 2px solid var(--color-border);
  list-style: none;
}
.timeline-item { position: relative; }
.timeline-item::before {
  content: "";
  position: absolute;
  top: 6px;
  left: -22px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-primary);
}
.timeline-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 14px; }
.timeline-type, .timeline-delta { font-weight: 700; }
.timeline-time { margin-left: auto; font-size: 13px; }
.timeline-detail, .timeline-reason { margin: 4px 0 0; font-size: 14px; }
.timeline-actor { margin: 4px 0 0; font-size: 13px; }   /* 처리자 (PRD 6.8) */
.timeline-reason { padding: 6px 10px; border-radius: var(--radius-sm); background: var(--color-bg); }

/* ===== 설정 ===== */
/* 설정 하위 메뉴(탭)별 화면: 카드를 위에서 아래로 */
.settings-tabs a.tab { text-decoration: none; }
.settings-stack { display: flex; flex-direction: column; gap: 16px; }
.settings-stack .card + .card { margin-top: 0; }
.settings-narrow { max-width: 760px; }
@media (max-width: 768px) {
  /* 휴대폰: 설정 하위 메뉴 4개를 2줄로 모두 보이게 */
  .settings-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; }
  .settings-tabs .tab { text-align: center; }
}
#settings-policy .form-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.input-suffix { display: flex; align-items: center; gap: 8px; }
.input-suffix .input { width: 96px; flex: none; }
.input-suffix span { font-size: 14px; color: var(--color-muted); white-space: nowrap; }
.settings-section { display: flex; flex-direction: column; gap: 12px; }
.settings-section .card-title { margin: 0; }
.settings-section > p { margin: 0; }
.settings-section .section-header { margin-bottom: 0; }
.color-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: middle; }
.usage { display: flex; flex-direction: column; gap: 6px; }
.usage-label { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px; font-size: 14px; }
.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
  padding: 14px;
  border: 1px solid #f6c6c2;
  border-radius: var(--radius-sm);
  background: #fffafa;
}
.danger-zone p { margin: 2px 0 0; font-size: 13px; }



@media (max-width: 768px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .toolbar .input { flex: 1 1 140px; min-width: 0; }
  .toolbar input[type="search"] { flex-basis: 100%; }
  .info-list { grid-template-columns: 100px 1fr; }
  .pass-list { grid-template-columns: minmax(0, 1fr); }
  .form-actions .btn { flex: 1; }
}

/* ===== 공통 보조 (M3) ===== */
.callout-warning { background: var(--color-warning-weak); border: 1px solid #f5d9a8; color: #7a4a00; }
.callout-warning[hidden] { display: none; }
.callout-items { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }
.callout-hint { margin: 8px 0 0; font-size: 13px; font-weight: 600; }
.modal .callout { margin: 12px 0 0; }
.link-btn { padding: 0 2px; border: 0; background: none; color: var(--color-primary); font-size: 13px; font-weight: 600; cursor: pointer; }
.toast { display: flex; align-items: center; gap: 12px; }
.toast > span { flex: 1; }
.toast-action {
  flex: none;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: var(--radius-sm);
  background: transparent;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.toast-action:hover { background: rgba(255, 255, 255, .15); }

.segmented { display: inline-flex; border: 1px solid var(--color-border); border-radius: var(--radius-sm); overflow: hidden; background: var(--color-surface); }
.segment { min-height: 38px; padding: 0 14px; border: 0; background: none; font-weight: 600; color: var(--color-muted); cursor: pointer; }
.segment + .segment { border-left: 1px solid var(--color-border); }
.segment[aria-pressed="true"] { background: var(--color-primary-weak); color: var(--color-primary); }

/* ===== 수업 캘린더 ===== */
.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.cal-nav, .cal-options { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cal-options .input { width: auto; min-width: 140px; }
.cal-range { margin-left: 6px; font-size: 17px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 6px; font-size: 13px; color: var(--color-muted); }
.cal-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend .caution-icon .icon { width: 15px; height: 15px; }
.cal-summary { margin-bottom: 10px; font-size: 14px; }

.cal-scroll {
  overflow-x: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.cal { --gutter: 52px; min-width: 100%; }
.cal-view-week { min-width: 720px; }
.cal-head, .cal-body { display: grid; grid-template-columns: var(--gutter) repeat(var(--days), minmax(0, 1fr)); }
.cal-head {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}
.cal-day-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 6px 0;
  border: 0;
  border-left: 1px solid var(--color-border);
  background: none;
  color: var(--color-muted);
  font-size: 12px;
  cursor: pointer;
}
.cal-view-day .cal-day-head { cursor: default; }
.cal-date { font-size: 18px; font-weight: 700; color: var(--color-text); line-height: 1.3; }
.cal-day-head.is-sunday .cal-weekday, .cal-day-head.is-sunday .cal-date { color: var(--color-danger); }
.cal-day-head.is-today .cal-date {
  min-width: 30px;
  border-radius: 999px;
  background: var(--color-primary);
  color: #fff;
}

.cal-times { display: flex; flex-direction: column; }
.cal-time {
  height: var(--slot);
  padding-right: 6px;
  text-align: right;
  font-size: 11px;
  color: var(--color-muted);
  transform: translateY(-7px);
}
.cal-day { position: relative; display: flex; flex-direction: column; border-left: 1px solid var(--color-border); }
.cal-time:first-child { transform: none; padding-top: 2px; }
.cal-day.is-today { background: #f8fbff; }
.cal-slot {
  height: var(--slot);
  border: 0;
  border-top: 1px dashed #eef0f3;
  background: none;
  cursor: pointer;
}
.cal-slot.is-hour { border-top: 1px solid var(--color-border); }
.cal-slot:hover, .cal-slot:focus-visible { background: var(--color-primary-weak); outline: none; }

.cal-event {
  --c: var(--color-primary);
  position: absolute;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  overflow: hidden;
  padding: 3px 6px;
  border: 0;
  border-left: 4px solid var(--c);
  border-radius: 5px;
  background: color-mix(in srgb, var(--c) 14%, #fff);
  color: var(--color-text);
  text-align: left;
  font-size: 12px;
  line-height: 1.35;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .12);
}
.cal-event:hover, .cal-event:focus-visible { z-index: 2; outline: 2px solid var(--c); }
.cal-event-name { display: inline-flex; align-items: center; gap: 3px; max-width: 100%; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event-name .caution-icon .icon { width: 13px; height: 13px; }
.cal-event-meta { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #4b5563; }
.cal-event.status-done { background: var(--c); color: #fff; }
.cal-event.status-done .cal-event-meta { color: rgba(255, 255, 255, .9); }
.cal-event.status-done .caution-icon { color: #fff; }
.cal-event.status-no_show { background: repeating-linear-gradient(135deg, var(--color-danger-weak) 0 6px, #fff 6px 12px); border-left-color: var(--color-danger); }
.cal-event.status-late_cancel, .cal-event.status-cancel, .cal-event.status-trainer_cancel { opacity: .6; background: #f1f3f4; }
.cal-event.status-late_cancel .cal-event-name, .cal-event.status-cancel .cal-event-name, .cal-event.status-trainer_cancel .cal-event-name { text-decoration: line-through; }
.cal-now { position: absolute; left: 0; right: 0; z-index: 2; height: 2px; background: var(--color-danger); pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--color-danger); }

/* 수업 상세 */
.session-detail { display: flex; flex-direction: column; gap: 12px; }
.session-detail .callout { margin: 0; }
.session-detail .form-subtitle { margin-top: 4px; }
.session-detail-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 18px; }
.session-detail .info-list { grid-template-columns: 90px 1fr; font-size: 14px; }
.status-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.status-btn { flex-direction: column; gap: 0; min-height: 54px; padding: 6px 8px; line-height: 1.3; }
.status-btn small { font-size: 11px; font-weight: 500; opacity: .8; }
.status-btn .icon { display: none; }
.status-btn-recommended { border-color: var(--color-warning); box-shadow: inset 0 0 0 1px var(--color-warning); }
.undo-btn { align-self: flex-start; }
.session-detail .field-error { font-size: 14px; }

/* 수업 이력 · 홀딩 */
.history-summary { margin: -4px 0 12px; font-size: 14px; }
.hold-list { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.hold-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.hold-list .badge { padding: 0 8px; font-size: 12px; }

/* 데이터 점검 */
.integrity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}
.integrity-row p { margin: 2px 0 0; font-size: 13px; }
.integrity-ok { color: var(--color-success); }
.integrity-checks { margin: 0; padding-left: 18px; font-size: 14px; color: var(--color-muted); }
.integrity-issues { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }

@media (max-width: 768px) {
  .cal-toolbar { flex-direction: column; align-items: stretch; }
  .cal-options .input { flex: 1 1 140px; min-width: 0; }
  .cal-range { font-size: 16px; }
  .cal { --gutter: 44px; }
  .status-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ===== 운동일지 작성 (M4) ===== */
.wl-member { color: inherit; }
.wl-caution { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 14px; }
.wl-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.wl-toolbar .btn { min-height: 48px; flex: 1 1 200px; }
.wl-entries { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.wl-entries .card + .card { margin-top: 0; }
.wl-entry { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; }
.wl-entry-head { display: flex; align-items: center; gap: 8px; }
.wl-entry-head h3 { font-size: 16px; margin-right: auto; }
.wl-prev {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--color-primary-weak);
  font-size: 14px;
}
.wl-prev.muted { background: var(--color-bg); }
.wl-prev .link-btn { flex: none; font-size: 14px; min-height: 32px; }
.wl-sets { display: flex; flex-direction: column; gap: 6px; }
.wl-set { display: grid; grid-template-columns: 36px minmax(0, 1fr) minmax(0, 1fr) 44px; gap: 8px; align-items: center; }
.wl-set-head { font-size: 12px; color: var(--color-muted); text-align: center; }
.wl-set-no { text-align: center; font-weight: 700; color: var(--color-muted); }
.wl-input { min-height: 48px; font-size: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.wl-input::placeholder { color: #b3b9c2; }
.wl-remove-set { width: 44px; min-height: 44px; color: var(--color-muted); }
.wl-add-set { min-height: 44px; border-style: dashed; }
.wl-empty { padding: 28px 16px; }
.wl-memo { margin-bottom: 16px; }
.wl-memo .choice span { min-height: 44px; }
.wl-savebar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 -24px -24px;
  padding: 12px 24px;
  background: rgba(245, 246, 248, .95);
  border-top: 1px solid var(--color-border);
  backdrop-filter: blur(4px);
}
.wl-save { min-height: 52px; font-size: 17px; }
.wl-error { white-space: pre-line; }

/* 운동 선택 창 */
.picker { display: flex; flex-direction: column; gap: 10px; }
.picker .choice-group { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.picker .choice span { white-space: nowrap; }
.picker-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; max-height: 50vh; overflow-y: auto; }
.picker-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 52px;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  text-align: left;
  cursor: pointer;
}
.picker-item:hover, .picker-item:focus-visible { border-color: var(--color-primary); background: var(--color-primary-weak); outline: none; }
.picker-name { font-weight: 600; }
.picker-meta { font-size: 12px; color: var(--color-muted); }
.picker-empty { padding: 16px 0; }

/* 회원 상세 > 운동일지 · 체성분 */
.chart-area { position: relative; }
.chart-box { position: relative; height: 260px; }
.chart-error { padding: 24px 0; text-align: center; }
.chart-note { margin-top: 8px; font-size: 14px; }
.section-header .input { width: auto; min-width: 200px; }
.workout-list { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.workout-list .card + .card { margin-top: 0; }
.workout-card { display: flex; flex-direction: column; gap: 10px; }
.workout-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.workout-card-head h3 { font-size: 16px; }
.workout-card-head .btn { margin-left: auto; }
.workout-entries { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: var(--radius-sm); background: var(--color-bg); }
.stat-label { font-size: 13px; color: var(--color-muted); }
.stat-value { font-size: 22px; }
.stat-sub { font-size: 13px; }
.body-history-title { font-size: 17px; margin: 20px 0 12px; }
.girth summary { cursor: pointer; font-weight: 600; margin-bottom: 12px; }
.body-delete { margin-right: auto; }

/* 설정 > 운동 라이브러리 */
.row-actions { display: inline-flex; gap: 6px; }

@media (max-width: 768px) {
  .wl-savebar {
    bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom));
    margin: 0 -16px;
    padding: 10px 16px;
  }
  .wl-entry { padding: 12px; }
  .wl-set { grid-template-columns: 28px minmax(0, 1fr) minmax(0, 1fr) 44px; gap: 6px; }
  .picker-list { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .section-header .input { flex: 1 1 100%; min-width: 0; }
  .chart-box { height: 220px; }
}

/* ===== 상단 검색 (M5) ===== */
.search-wrap { position: relative; width: 100%; max-width: 360px; }
.search-wrap .search { max-width: none; }
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  max-height: 60vh;
  overflow-y: auto;
  padding: 6px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.search-results[hidden] { display: none; }
.search-result {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
}
.search-result .muted { margin-left: auto; font-size: 13px; }
.search-result.is-active, .search-result:hover { background: var(--color-primary-weak); }
.search-empty { padding: 10px; font-size: 14px; }
.page-content { min-width: 0; }

/* ===== 대시보드 (M5) ===== */
.callout-info { background: var(--color-primary-weak); border: 1px solid #c6dafc; color: #174ea6; }
.callout-info p { margin: 4px 0 0; }
.dash-month { margin-bottom: 16px; }
.dash-month .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.dash-side { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.dash-grid .card + .card, .dash-side .card + .card { margin-top: 0; }
.dash-widget .card-title { margin: 0; }
.dash-widget-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 8px; margin-bottom: 10px; }
.dash-hint { font-size: 12px; }
.dash-count {
  display: inline-flex;
  min-width: 22px;
  justify-content: center;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--color-bg);
  font-size: 13px;
  vertical-align: middle;
}
.dash-empty { padding: 8px 0; font-size: 14px; }
.dash-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.dash-item + .dash-item { border-top: 1px solid var(--color-border); }
.dash-item-link { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 4px; color: var(--color-text); }
.dash-item-link:hover { background: var(--color-bg); }
.dash-item-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.dash-item-sub { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-item-value { flex: none; font-size: 14px; }
.dash-more { margin-top: 6px; }
.dash-today .section-header { margin-bottom: 10px; }
.dash-today .section-header .muted { margin-right: auto; font-size: 13px; }

.today-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.today-item {
  --c: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--c);
  border-radius: var(--radius-sm);
}
.today-item.status-done { background: #f8fbf9; }
.today-item.status-no_show, .today-item.status-late_cancel { opacity: .65; }
.today-time { flex: none; width: 48px; font-weight: 700; font-variant-numeric: tabular-nums; }
.today-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.today-meta { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.today-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.today-done { min-height: 40px; padding: 0 14px; }
.btn-outline-primary { border-color: var(--color-primary); color: var(--color-primary); }
/* 위험한 동작(탈퇴 처리 등)의 테두리 버튼 */
.btn-outline-danger { border-color: #f1b8b2; color: var(--color-danger); background: var(--color-surface); }
.btn-outline-danger:hover { border-color: var(--color-danger); background: var(--color-danger-weak); }

@media (max-width: 1024px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .dash-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .search-wrap { max-width: none; }
  .dash-month .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-month .stat-value { font-size: 18px; word-break: keep-all; }
  .dash-side { grid-template-columns: minmax(0, 1fr); }
  .today-item { gap: 8px; padding: 8px; }
  .today-time { width: 42px; }
  .today-actions .badge { display: none; }
}

/* 좁은 화면에서 표 열 줄이기 (createTable의 desktopOnly) */
@media (max-width: 768px) {
  .col-desktop, .only-desktop { display: none; }
  .table th, .table td { padding: 10px 8px; }
}

/* ===== M6 ===== */
.pre-line { white-space: pre-line; }

/* 환불 */
.refund-hint {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  font-size: 14px;
}
.refund-hint .muted { font-size: 13px; }

/* PAR-Q */
.parq-result { display: flex; flex-direction: column; gap: 8px; }
.parq-result p { margin: 0; }
.parq-yes { margin: 0; padding-left: 18px; color: var(--color-danger); font-size: 14px; }
.parq-history summary { cursor: pointer; font-size: 14px; color: var(--color-muted); }
.parq-history ul { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }
.parq-list { display: flex; flex-direction: column; gap: 10px; }
.parq-q { margin: 0; padding: 10px 12px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); }
.parq-q legend { padding: 0 4px; font-size: 14px; font-weight: 600; }
.parq-q .choice-group { margin-top: 6px; }

/* 반복 예약 */
.repeat-box { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px dashed var(--color-border); border-radius: var(--radius-sm); }
.repeat-box[hidden] { display: none; }
.repeat-preview p { margin: 0 0 6px; font-size: 14px; }
.repeat-dates { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; list-style: none; max-height: 120px; overflow-y: auto; }
.repeat-dates li { padding: 2px 8px; border-radius: 999px; background: var(--color-primary-weak); color: var(--color-primary); font-size: 12px; }
.repeat-dates li.is-conflict { background: var(--color-danger-weak); color: var(--color-danger); }

/* 상담 */
.consult-funnel { margin-bottom: 16px; }
.consult-funnel .stat-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.convert-btn { margin-right: auto; }

/* PR */
.wl-set.is-pr .wl-input { border-color: #f2b705; background: #fffbea; }
.wl-set.is-pr .wl-set-no { font-size: 18px; }
.wl-best { color: #8a6100; font-weight: 600; }
.pr-card { margin-top: 16px; }
.pr-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin: 0 0 8px; padding: 0; list-style: none; }
.pr-list li { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: var(--radius-sm); background: #fffbea; font-size: 14px; }
.pr-name { font-weight: 600; }

/* 매출/통계 */
.report-toolbar { margin: 0; }
.report-custom { display: inline-flex; align-items: center; gap: 6px; }
.report-custom[hidden] { display: none; }
.report-custom .input { width: auto; min-width: 140px; }
.report-body { display: flex; flex-direction: column; gap: 16px; }
.report-body .card + .card { margin-top: 0; }
.report-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.report-grid .card + .card { margin-top: 0; }
.report-body .chart-area { margin-bottom: 12px; }
.bar-list { display: flex; flex-direction: column; gap: 12px; margin: 0 0 8px; padding: 0; list-style: none; }
.bar-list-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; font-size: 14px; }
.bar-list-head strong { margin-left: auto; }

@media (max-width: 1024px) {
  .report-grid { grid-template-columns: minmax(0, 1fr); }
  .report-stats, .consult-funnel .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .report-stats, .consult-funnel .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-stats .stat-value, .consult-funnel .stat-value { font-size: 18px; word-break: keep-all; }
  .report-custom { flex-wrap: wrap; }
}

/* ===== 페이지 나누기 (createTable pageKey) ===== */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-top: 10px;
}
.pager-info { font-size: 14px; color: var(--color-muted); font-variant-numeric: tabular-nums; }
.pager-pages { display: flex; align-items: center; gap: 4px; }
.pager-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.pager-btn:hover:not(:disabled) { background: var(--color-bg); }
.pager-btn:disabled { opacity: .4; cursor: default; }
.pager-btn .icon { width: 18px; height: 18px; }
.pager-num.is-current { border-color: var(--color-primary); background: var(--color-primary); color: #fff; }
.pager-size-select { width: auto; min-height: 36px; padding: 4px 8px; font-size: 14px; }

@media (max-width: 768px) {
  .pager { justify-content: center; }
  .pager-info { width: 100%; text-align: center; }
  .pager-btn { min-width: 40px; height: 40px; }
}

/* 행 번호 (createTable rowNumbers) */
.table .col-no { width: 1%; text-align: center; color: var(--color-muted); font-variant-numeric: tabular-nums; }
.table th.col-no { color: var(--color-muted); }
@media (max-width: 768px) {
  .table .col-no { padding-left: 6px; padding-right: 2px; font-size: 13px; }
}

/* ===== 로그인 (M7-2) ===== */
.app[hidden], .tabbar[hidden], .auth-root[hidden] { display: none !important; }
.auth-root {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: max(48px, 10vh) 16px 32px;
}
.auth-card { width: 100%; max-width: 400px; padding: 28px 24px; }
/* 맨 아래로 밀고, 오른쪽 아래 테마 토글(떠 있는 버튼)과 겹치지 않게 그 높이만큼 띄운다 */
.auth-footer { margin-top: auto; padding: 32px 16px 56px; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; font-size: 18px; font-weight: 700; }
.auth-brand .brand-logo { width: 44px; height: 44px; }
.auth-title { font-size: 20px; margin-bottom: 16px; }
.auth-logo { display: flex; justify-content: center; margin: 4px 0 24px; }
.auth-logo img { width: 120px; height: 120px; border-radius: 0; object-fit: cover; }
/* 화면에는 안 보이고 화면 읽기 프로그램만 읽는 글자 (입력칸 이름 등) */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.auth-lead { margin-bottom: 16px; font-size: 14px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-remember { display: flex; flex-direction: column; gap: 6px; }
.auth-message {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--color-danger-weak);
  color: #8c1d18;
  font-size: 14px;
}
.auth-message[hidden] { display: none; }
.btn-block { width: 100%; min-height: 46px; }
.auth-card .btn-ghost.btn-block { margin-top: 8px; min-height: 40px; color: var(--color-muted); }

.topbar .search-wrap { flex: 1 1 auto; min-width: 0; }   /* 좁은 화면에서 검색창이 줄어 이름·로그아웃 자리를 남긴다 */
.user-area { display: flex; align-items: center; gap: 4px; margin-left: auto; flex: none; }
.user-name { max-width: 160px; padding: 0 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; line-height: 40px; }
.logout .icon { width: 18px; height: 18px; }

@media (max-width: 768px) {
  .user-name { max-width: 72px; padding: 0 6px; font-size: 14px; }
  .logout { width: 36px; padding: 0; }
  .logout-label { display: none; }
}

/* ===== 계정 관리 (M7-5) ===== */
.input-with-button { display: flex; gap: 8px; align-items: center; }
.input-with-button .input { flex: 1; min-width: 0; font-family: ui-monospace, Consolas, monospace; }
.temp-password { display: flex; flex-direction: column; gap: 12px; }
.temp-password p { margin: 0; }
.temp-password-value {
  padding: 12px 16px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 20px;
  letter-spacing: 1px;
  text-align: center;
  user-select: all;
}

/* ===== 수강권 작업 내역 (#/pass-logs) ===== */
.pass-log-range { display: flex; align-items: center; gap: 6px; }
.pass-log-range[hidden] { display: none; }
.pass-log-range .input { min-width: 0; }
.pass-log-hint { margin: -4px 0 12px; }
.table .pl-detail { white-space: normal; min-width: 240px; max-width: 420px; }
.pl-sub { display: block; margin-top: 2px; color: var(--color-muted); font-size: 13px; white-space: normal; }
.table .pl-time { font-variant-numeric: tabular-nums; }
.only-mobile { display: none; }
@media (max-width: 768px) {
  .pass-log-range { flex: 1 1 100%; }
  .pass-log-range .input { flex: 1 1 0; }
  /* 375px에서 가로 스크롤 없이 일시·처리자·작업·회원·증감: 좁은 칸은 줄을 바꾼다 */
  .table .pl-time { white-space: normal; min-width: 52px; font-size: 13px; }
  .table .pl-time, .table .pl-actor, .table .pl-kind, .table .pl-member, .table .pl-delta { padding-left: 5px; padding-right: 5px; }
  .table .pl-actor, .table .pl-member { white-space: normal; overflow-wrap: anywhere; }
  .table .pl-kind { white-space: normal; }
  .table .pl-kind .badge { white-space: normal; text-align: center; }
  .only-mobile { display: block; }
  .pl-sub { max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
.pass-card.is-focused { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.dash-review { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; text-decoration: none; }
.dash-review span { font-size: 14px; }
.dash-review .icon { width: 18px; height: 18px; margin-left: auto; }

/* ===== 디자인 테마 토글 (On = 새 디자인, Off = 기존). js/components/themeToggle.js ===== */
.theme-toggle-slot { display: flex; flex: none; }
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 8px 0 12px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.theme-toggle:hover { color: var(--color-text); }
.theme-toggle:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.theme-toggle-track {
  position: relative;
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: #c4c9d2;
  transition: background-color .15s;
}
.theme-toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  transition: transform .15s;
}
.theme-toggle[aria-checked="true"] .theme-toggle-track { background: var(--color-primary); }
.theme-toggle[aria-checked="true"] .theme-toggle-track::after { transform: translateX(14px); }
.theme-toggle-state { min-width: 26px; margin-left: -2px; color: var(--color-text); font-variant-numeric: tabular-nums; }
/* 로그인 화면: 오른쪽 아래 */
.theme-toggle-floating { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 30; box-shadow: var(--shadow); }
@media (max-width: 768px) {
  /* 좁은 화면 상단: 검색창 자리를 위해 스위치만 (상태는 스위치 색·위치로). 로그인 화면은 ON/OFF 글자도 */
  .theme-toggle { gap: 6px; height: 34px; padding: 0 6px; }
  .theme-toggle-slot .theme-toggle-label, .theme-toggle-slot .theme-toggle-state { display: none; }
}

/* ===== 사용성·접근성 보강 (UX 점검) ===== */
/* 키보드로 이동할 때 현재 위치가 항상 보이게 */
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex]:focus-visible:not(.page):not(.modal) {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.input:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 0; }
.page:focus, .modal:focus { outline: none; }

/* 본문 바로가기 (키보드 사용자용, 포커스가 올 때만 보임) */
.skip-link {
  position: fixed; left: 12px; top: -48px; z-index: 300;
  padding: 10px 16px; border-radius: var(--radius-sm);
  background: var(--color-primary); color: #fff; font-weight: 600;
}
.skip-link:focus { top: 12px; }

/* 오류는 색뿐 아니라 아이콘 글자로도 구분 */
.field-error:not([hidden])::before { content: "⚠ "; }
.field-error { font-weight: 500; }
.has-error .field-label { color: var(--color-danger); }
.input[aria-invalid="true"] { border-color: var(--color-danger); }

/* 터치 화면(휴대폰·태블릿): 누르는 영역 44px 이상, 입력 글자 16px(자동 확대 방지) */
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn-small { min-height: 40px; }
  .btn-icon { min-height: 44px; width: 44px; }
  .input { min-height: 46px; font-size: 16px; }
  .choice span { min-height: 44px; }
  .toggle { min-height: 44px; }
  .pass-actions .btn { min-height: 40px; }
}

/* 모션을 줄이도록 설정한 사용자 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* 서버 깨우는 중 안내 (오류가 아니므로 붉은색이 아닌 안내 색) */
.auth-message.auth-wake, html[data-theme="premium"] .auth-message.auth-wake {
  border: 1px solid var(--color-border); background: rgba(127, 127, 127, .12); color: inherit;
}
.auth-message.auth-wake[hidden] { display: none; }
