:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --panel: #ffffff;
  --panel-2: #f9fbfa;
  --text: #1c2522;
  --muted: #66736e;
  --line: #dce4e0;
  --brand: #17695f;
  --brand-dark: #104d46;
  --accent: #bf7d2a;
  --danger: #b43d3d;
  --warning: #8d5a12;
  --soft: #e7f2ee;
  --shadow: 0 18px 46px rgba(28, 37, 34, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", "Noto Sans KR", Inter, system-ui, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.app-shell {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #102522;
  color: #eef7f2;
  padding: 26px 20px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.brand {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 10px;
}

.brand-logo {
  width: min(190px, 100%);
  height: auto;
  display: block;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.94);
  padding: 8px 10px;
}

.brand-copy {
  min-width: 0;
}

.brand strong,
.brand span,
.panel-label {
  display: block;
}

.brand span,
.panel-label {
  margin-top: 3px;
  color: rgba(238, 247, 242, 0.68);
  font-size: 13px;
}

.side-nav {
  display: grid;
  gap: 7px;
}

.nav-item {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(238, 247, 242, 0.74);
  text-align: left;
  padding: 0 14px;
  font-weight: 800;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.side-summary {
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 16px;
}

.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.summary-row span {
  color: rgba(238, 247, 242, 0.7);
  font-size: 13px;
}

.summary-row strong {
  font-size: 24px;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.topbar,
.section-header,
.toolbar,
.segmented,
.card-actions,
.row-actions,
.settings-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar,
.section-header {
  justify-content: space-between;
}

.topbar {
  margin-bottom: 22px;
}

.login-badge {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  padding: 12px;
}

.login-badge strong,
.login-badge span {
  display: block;
}

.login-badge span {
  margin-top: 4px;
  color: rgba(238, 247, 242, 0.68);
  font-size: 13px;
  line-height: 1.5;
}

.login-button {
  width: 100%;
  min-height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-weight: 900;
}

.hidden {
  display: none !important;
}

.toolbar {
  flex-wrap: wrap;
}

.toolbar.small {
  justify-content: flex-end;
}

.toolbar.small input {
  width: 240px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 34px;
}

h2 {
  margin-bottom: 0;
  font-size: 21px;
}

h3 {
  margin-bottom: 6px;
  font-size: 17px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.panel,
.metric-card,
.member-card,
.class-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 20px;
}

.booking-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
  align-items: start;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 18px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card {
  padding: 18px;
}

.metric-card span,
.metric-card p {
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  display: block;
  margin: 8px 0;
  font-size: 30px;
}

.metric-card p {
  margin-bottom: 0;
}

.primary-button,
.ghost-button,
.danger-button,
.icon-button,
.file-button,
.segmented button {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 800;
}

.primary-button {
  background: var(--brand);
  color: #fff;
}

.primary-button:hover {
  background: var(--brand-dark);
}

.ghost-button,
.icon-button,
.segmented button {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.danger-button {
  background: #fff3f1;
  border-color: #efc5bd;
  color: var(--danger);
}

.file-button {
  display: inline-flex;
  align-items: center;
  background: #fff;
  border-color: var(--line);
}

.file-button input {
  display: none;
}

.icon-button {
  min-width: 38px;
  padding: 0;
}

.segmented {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
}

.segmented button {
  border: 0;
  min-height: 34px;
}

.weekdays,
.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.weekdays {
  margin: 18px 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}

.calendar {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.day-cell {
  min-height: 124px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 10px;
  text-align: left;
}

.day-cell:nth-child(7n) {
  border-right: 0;
}

.day-cell.muted {
  background: #f6f8f7;
  color: #a0aaa5;
}

.day-cell.selected {
  outline: 3px solid rgba(23, 105, 95, 0.25);
  outline-offset: -3px;
}

.day-number,
.class-card header,
.member-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.day-number {
  align-items: center;
  font-weight: 900;
}

.pill,
.capacity-chip,
.category,
.status {
  display: inline-flex;
  align-items: center;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.pill,
.capacity-chip {
  background: var(--soft);
  color: var(--brand);
  padding: 4px 8px;
}

.category {
  margin-bottom: 8px;
  background: #fff0da;
  color: #8d5a12;
  padding: 4px 8px;
}

.mini-class,
.mini-count {
  display: block;
  margin-top: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.mini-class {
  border-radius: 6px;
  background: #eaf3ef;
  color: #244a44;
  padding: 6px 7px;
}

.mini-count {
  color: var(--muted);
}

.day-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.day-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.day-badge.open {
  background: #1f9d57;
}

.day-badge.closed {
  background: #d64545;
}

.ledger-plus {
  color: #1f9d57;
}

.ledger-minus {
  color: #d64545;
}

.member-form,
.class-list,
.stack-list,
.activity-list,
.member-grid,
.settings-grid,
.form-grid,
.filter-row {
  display: grid;
  gap: 12px;
}

.filter-row {
  grid-template-columns: 1fr 1fr;
  margin: 18px 0 12px;
}

.member-form {
  margin: 18px 0 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 11px 12px;
}

textarea {
  resize: vertical;
}

.notice-line {
  margin-bottom: 14px;
  border-left: 3px solid var(--brand);
  background: #eef6f3;
  border-radius: 6px;
  color: #2f4f49;
  font-size: 13px;
  line-height: 1.5;
  padding: 10px 12px;
}

.class-card,
.member-card {
  padding: 15px;
  display: grid;
  gap: 12px;
  box-shadow: none;
}

.muted,
.help-text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.warning-text {
  margin-bottom: 0;
  color: var(--warning);
  font-size: 13px;
}

.recurring-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin: 12px 0;
}

.recurring-form label {
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}

.recurring-form input,
.recurring-form select {
  min-height: 36px;
}

.recurring-form input[type="text"] {
  min-width: 140px;
}

.recurring-form button {
  min-height: 38px;
}

.pill.warn {
  background: var(--warning);
  color: #fff;
}

.capacity-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: #e7ece9;
}

.capacity-bar span {
  display: block;
  height: 100%;
  background: var(--brand);
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 24px;
  text-align: center;
}

.ops-item,
.activity-item,
.mini-booking {
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.ops-item:first-child,
.activity-item:first-child {
  padding-top: 0;
}

.ops-item strong,
.ops-item span,
.activity-item span,
.activity-item time,
.mini-booking strong,
.mini-booking span {
  display: block;
}

.mini-booking {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mini-booking span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.my-bookings {
  margin-top: 18px;
}

.credit-strip {
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--brand);
  font-size: 13px;
  font-weight: 900;
  padding: 10px 12px;
}

/* ---- 내 예약 아코디언 (달력 위, 기본 접힘) ---- */
.mybook-acc {
  margin-bottom: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.mybook-acc > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  user-select: none;
}
.mybook-acc > summary::-webkit-details-marker { display: none; }
.mybook-acc-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.mybook-acc-icon { font-size: 17px; }
.mybook-acc-title { font-weight: 900; color: var(--text); }
.mybook-acc-hint { color: var(--brand); font-size: 13px; font-weight: 800; }
.mybook-acc-caret { color: var(--muted); font-size: 16px; transition: transform 0.25s ease; }
.mybook-acc[open] > summary { border-bottom: 1px solid var(--line); background: var(--panel-2); }
.mybook-acc[open] .mybook-acc-caret { transform: rotate(180deg); }
.mybook-acc > .stack-list { padding: 12px 18px 16px; }

/* ---- 선택 날짜 수업 패널: 달력과 명확히 구분 ---- */
.booking-panel-head {
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--soft);
  border-left: 4px solid var(--brand);
  border-radius: 8px;
}
.booking-panel-head .eyebrow { margin-bottom: 2px; }
.booking-panel-head h2 { color: var(--brand-dark); }

/* ---- 달력 범례 ---- */
.calendar-legend {
  display: flex;
  gap: 18px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.calendar-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.lg-dot.open { background: #1f9d57; }
.lg-dot.closed { background: #d64545; }

.ops-members {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.ops-members span {
  border-radius: 99px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  padding: 5px 8px;
}

.activity-item {
  display: grid;
  gap: 4px;
}

.activity-item time {
  color: var(--muted);
  font-size: 12px;
}

.table-wrap {
  overflow: auto;
  margin-top: 16px;
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 13px;
}

.status {
  padding: 5px 9px;
}

.status.reserved,
.status.attended {
  background: #e6f4ef;
  color: var(--brand);
}

.status.waitlist {
  background: #fff1dc;
  color: #8d5a12;
}

.status.cancelled,
.status.noShow {
  background: #f6e6e6;
  color: var(--danger);
}

.member-grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  margin-top: 16px;
}

.member-card dl {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0;
}

.member-card dl div {
  border-radius: 8px;
  background: var(--panel-2);
  padding: 10px;
}

.member-card dt {
  color: var(--muted);
  font-size: 12px;
}

.member-card dd {
  margin: 4px 0 0;
  font-weight: 900;
}

.settings-grid,
.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wide {
  grid-column: 1 / -1;
}

.settings-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

dialog {
  width: min(720px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
}

dialog::backdrop {
  background: rgba(16, 37, 34, 0.42);
}

.dialog-body {
  padding: 22px;
}

.dialog-actions {
  margin: 20px 0 0;
  padding: 0;
  justify-content: flex-end;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10;
  max-width: min(420px, calc(100vw - 36px));
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  border-radius: 8px;
  background: #102522;
  color: #fff;
  padding: 13px 15px;
  box-shadow: var(--shadow);
  transition: 0.2s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* 사이드바 상단(로고 + 계정) */
.sidebar-top { display: flex; flex-direction: column; gap: 16px; }

/* 기간 복사/붙여넣기 폼 */
.copy-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 10px; }
.copy-form label { display: grid; gap: 5px; color: var(--muted); font-size: 13px; font-weight: 900; }
.copy-form input { min-height: 40px; }
.copy-form button { min-height: 40px; }
.copy-form .help-text { align-self: center; }

/* 자동 폐강 체크박스 라인 */
.check-label { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 900; color: var(--text); }
.check-label input { width: auto; min-height: 0; }
.check-label .help-text { flex-basis: 100%; margin: 0; font-weight: 400; }

/* 대리예약 회원 목록 */
.proxy-list { max-height: 52vh; overflow-y: auto; margin: 12px 0 4px; }

/* 폐강된 수업 행 */
.row-closed { opacity: 0.55; }

/* 내가 예약한 수업 카드 강조 */
.class-card.is-booked { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; }
.booked-tag { color: var(--brand); }

@media (max-width: 1160px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    gap: 16px;
  }

  /* 로고 왼쪽 · 내 계정 정보 오른쪽 */
  .sidebar-top {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  .brand { flex-direction: row; align-items: center; }
  .brand-logo { width: min(150px, 42vw); }
  .login-badge { flex: 1; max-width: 62%; padding: 10px 12px; }

  /* 메뉴: 가로 스크롤 탭 바 */
  .side-nav {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .nav-item { text-align: center; white-space: nowrap; padding: 0 16px; }

  .side-summary { margin-top: 0; }

  .booking-layout,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .workspace,
  .sidebar {
    padding: 16px;
  }

  .brand-copy { display: none; }
  .brand-logo { width: min(132px, 40vw); }
  .login-badge { max-width: 66%; }

  .topbar,
  .section-header {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar.small input,
  .toolbar.small select,
  .toolbar.small button,
  .toolbar button,
  .segmented {
    width: 100%;
  }
  .toolbar.small input { width: 100%; }

  .metric-grid,
  .settings-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .mini-booking {
    align-items: stretch;
    flex-direction: column;
  }

  .panel {
    padding: 14px;
  }

  .day-cell {
    min-height: 84px;
    padding: 6px;
  }

  .day-badge { width: 24px; height: 24px; font-size: 12px; }

  .copy-form { flex-direction: column; align-items: stretch; }
  .copy-form button { width: 100%; }

  .card-actions,
  .row-actions { flex-wrap: wrap; }
  .card-actions button,
  .row-actions button { flex: 1; min-width: 84px; }

  .dialog-body { padding: 16px; }
}
