:root {
  color-scheme: light;
  font-family: Pretendard, "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #17221d;
  background: #f4f6f3;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: #f4f6f3; letter-spacing: 0; }
button, input { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
[hidden] { display: none !important; }

.mobile-login {
  min-height: 100dvh;
  display: grid;
  align-content: center;
  padding: 28px 22px;
  background: #17221d;
}

.login-inner { width: min(100%, 420px); margin: 0 auto; }
.brand-lockup { display: flex; align-items: center; gap: 12px; color: #fff; margin-bottom: 38px; }
.brand-lockup img { width: 48px; height: 48px; border-radius: 8px; }
.brand-lockup strong { display: block; font-size: 22px; }
.brand-lockup span { display: block; margin-top: 2px; color: #b8c5be; font-size: 13px; }
.login-title { color: #fff; font-size: 30px; line-height: 1.25; margin: 0 0 10px; }
.login-copy { color: #b8c5be; margin: 0 0 28px; font-size: 14px; line-height: 1.6; }
.login-form { display: grid; gap: 15px; }
.field { display: grid; gap: 7px; color: #dfe6e2; font-size: 13px; font-weight: 700; }
.field input {
  width: 100%; height: 52px; border: 1px solid #53615a; border-radius: 7px;
  background: #24312b; color: #fff; padding: 0 15px; outline: none;
}
.field input:focus { border-color: #d8a642; box-shadow: 0 0 0 3px rgba(216, 166, 66, .18); }
.primary-action {
  min-height: 50px; border: 0; border-radius: 7px; padding: 0 18px;
  color: #fff; background: #2f7258; font-weight: 800;
}
.login-form .primary-action { margin-top: 5px; background: #d8a642; color: #17221d; }
.form-error { min-height: 20px; margin: 0; color: #efaa9d; font-size: 13px; }

.mobile-shell { min-height: 100dvh; padding-bottom: 76px; }
.app-header {
  position: sticky; top: 0; z-index: 10; height: 64px; padding: 0 18px;
  display: flex; align-items: center; justify-content: space-between;
  color: #fff; background: #174f3c; border-bottom: 1px solid rgba(255,255,255,.12);
}
.staff-theme .app-header { background: #17221d; }
.header-brand { display: flex; align-items: center; gap: 9px; }
.header-brand img { width: 34px; height: 34px; border-radius: 7px; }
.header-brand strong { font-size: 17px; }
.header-actions { display: flex; gap: 8px; }
.header-button {
  min-height: 36px; border: 1px solid rgba(255,255,255,.32); border-radius: 6px;
  padding: 0 11px; color: #fff; background: transparent; font-size: 12px; font-weight: 700;
}
.app-main { width: min(100%, 720px); margin: 0 auto; padding: 22px 16px 30px; }
.page-section { display: none; }
.page-section.active { display: block; }
.eyebrow { margin: 0 0 7px; color: #2f7258; font-size: 12px; font-weight: 900; }
.page-title { margin: 0; font-size: 25px; line-height: 1.3; }
.page-subtitle { margin: 7px 0 0; color: #69756f; font-size: 14px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin: 27px 0 12px; }
.section-heading h2 { margin: 0; font-size: 17px; }
.section-heading span { color: #75817b; font-size: 12px; }

.summary-band {
  margin-top: 20px; padding: 18px; background: #174f3c; color: #fff;
  border-radius: 8px; display: grid; gap: 16px;
}
.staff-theme .summary-band { background: #293730; }
.summary-band small { color: #c9d7d0; }
.summary-band strong { display: block; margin-top: 4px; font-size: 25px; }
.summary-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: #dfe8e3; }

.class-list, .member-list { display: grid; gap: 10px; }
.class-card, .pass-panel, .member-row, .empty-state {
  border: 1px solid #d8ded9; border-radius: 8px; background: #fff;
}
.class-card { padding: 15px; }
.class-top { display: flex; justify-content: space-between; gap: 12px; }
.class-date { color: #2f7258; font-size: 12px; font-weight: 800; }
.class-card h3 { margin: 5px 0 4px; font-size: 17px; }
.class-card p { margin: 0; color: #69756f; font-size: 13px; }
.status-chip {
  align-self: flex-start; min-width: 54px; padding: 5px 7px; border-radius: 5px;
  background: #e8f1ec; color: #245b47; text-align: center; font-size: 11px; font-weight: 900;
}
.status-chip.full, .status-chip.absent { background: #f6e8e4; color: #a84f3e; }
.status-chip.wait { background: #fbf1d8; color: #8a6417; }
.class-footer { margin-top: 14px; padding-top: 12px; border-top: 1px solid #edf0ed; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.capacity { color: #526058; font-size: 12px; font-weight: 700; }
.small-action { min-height: 36px; border: 0; border-radius: 6px; padding: 0 13px; color: #fff; background: #2f7258; font-size: 12px; font-weight: 800; }
.small-action.secondary { background: #eef2ef; color: #33413a; }
.small-action.danger { background: #b55745; }

.mobile-shell.calendar-mode .app-main { width: min(100%, 1180px); }
.member-week-toolbar { display: flex; align-items: center; gap: 8px; margin-top: 22px; }
.member-week-toolbar button {
  min-width: 40px; height: 40px; border: 1px solid #d6ddd8; border-radius: 6px;
  background: #fff; color: #26342d; font-size: 16px; font-weight: 900;
}
.member-week-toolbar strong { min-width: 170px; font-size: 15px; }
.member-week-toolbar #memberTodayWeek { padding: 0 13px; font-size: 12px; }
.member-week-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 0 8px; color: #718078; font-size: 11px; }
.member-week-summary > span:last-child { display: flex; align-items: center; gap: 6px; }
.member-week-summary i { width: 9px; height: 9px; margin-left: 5px; border-radius: 2px; }
.member-week-summary i.open { background: #dceee4; }
.member-week-summary i.mine { background: #4f7e6a; }
.member-week-summary i.full { background: #b45c4b; }
.member-week-scroll { max-height: calc(100dvh - 285px); overflow: auto; border: 1px solid #d8ded9; background: #fff; }
.member-week-grid { display: grid; grid-template-columns: 58px repeat(7, minmax(105px, 1fr)); min-width: 850px; }
.member-week-corner, .member-week-day { position: sticky; top: 0; z-index: 3; min-height: 48px; border-bottom: 1px solid #d8ded9; background: #f3f6f4; }
.member-week-corner { left: 0; z-index: 5; display: grid; place-items: center; color: #718078; font-size: 10px; }
.member-week-day { display: flex; align-items: center; justify-content: center; gap: 5px; border-left: 1px solid #d8ded9; font-size: 12px; }
.member-week-day span { color: #718078; font-size: 10px; }
.member-week-day.today { background: #eaf4ee; color: #245b47; }
.member-week-time { position: sticky; left: 0; z-index: 2; min-height: 82px; padding-top: 12px; border-bottom: 1px solid #e3e8e4; background: #fff; color: #718078; text-align: center; font-size: 10px; }
.member-week-cell { min-height: 82px; padding: 4px; border-left: 1px solid #e3e8e4; border-bottom: 1px solid #e3e8e4; background: #fbfcfb; }
.member-week-cell.today { background: #f5faf7; }
.member-week-class { display: grid; width: 100%; min-height: 70px; padding: 8px; border: 0; border-radius: 5px; background: #dceee4; color: #204c3b; text-align: left; cursor: pointer; }
.member-week-class span { font-size: 10px; font-weight: 900; }
.member-week-class strong { margin-top: 2px; font-size: 12px; line-height: 1.25; overflow-wrap: anywhere; }
.member-week-class small { align-self: end; margin-top: 5px; color: inherit; font-size: 9px; opacity: .82; }
.member-week-class.mine { background: #4f7e6a; color: #fff; }
.member-week-class.full { background: #f2ddd8; color: #934635; }
.member-week-class.past { opacity: .58; }
.member-week-class + .member-week-class { margin-top: 4px; }

.mobile-modal[hidden] { display: none; }
.mobile-modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; }
.mobile-modal-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(20, 29, 25, .55); }
.mobile-modal-panel { position: relative; width: min(100%, 480px); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 20px; border-radius: 8px; background: #fff; box-shadow: 0 22px 60px rgba(18, 31, 25, .26); }
.mobile-modal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.mobile-modal-heading span { color: #2f7258; font-size: 10px; font-weight: 900; }
.mobile-modal-heading h2 { margin: 4px 0 0; font-size: 21px; overflow-wrap: anywhere; }
.mobile-modal-heading > button { flex: 0 0 auto; width: 36px; height: 36px; border: 1px solid #d6ddd8; border-radius: 6px; background: #fff; color: #35423b; font-size: 21px; }
.mobile-class-detail-status { display: flex; justify-content: flex-end; margin: 18px 0 8px; }
.mobile-class-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 16px; }
.mobile-class-detail-grid div { min-width: 0; padding: 13px; background: #f5f7f5; }
.mobile-class-detail-grid dt { color: #718078; font-size: 10px; }
.mobile-class-detail-grid dd { margin: 5px 0 0; font-size: 14px; font-weight: 800; overflow-wrap: anywhere; }
.mobile-class-warning { margin: 0 0 12px; padding: 11px; background: #fbf1e8; color: #8e5126; font-size: 12px; }
.mobile-modal-panel .primary-action.danger { background: #b55745; }

.pass-list { display: grid; gap: 12px; margin-top: 20px; }
.pass-panel { padding: 18px; }
.pass-panel.inactive { background: #fafafa; }
.pass-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.pass-heading span { display: block; margin-bottom: 4px; color: #2f7258; font-size: 11px; font-weight: 900; }
.pass-heading h2 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.pass-status { flex: 0 0 auto; padding: 5px 7px; border-radius: 5px; font-size: 11px; font-style: normal; font-weight: 900; }
.pass-status.active { background: #e8f1ec; color: #245b47; }
.pass-status.inactive { background: #f1e9e6; color: #9a5143; }
.pass-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.pass-stat { padding: 13px; background: #f5f7f5; border-radius: 6px; }
.pass-stat span { display: block; color: #718078; font-size: 11px; }
.pass-stat strong { display: block; margin-top: 5px; font-size: 17px; overflow-wrap: anywhere; }
.pass-stat.wide { grid-column: 1 / -1; }
.pass-empty { margin-top: 20px; }
.empty-state { padding: 28px 18px; color: #69756f; text-align: center; font-size: 14px; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 12; height: 68px;
  display: grid; grid-template-columns: repeat(3, 1fr); background: #fff; border-top: 1px solid #d8ded9;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav button { border: 0; background: transparent; color: #7b8781; font-size: 12px; font-weight: 800; }
.bottom-nav button.active { color: #174f3c; box-shadow: inset 0 3px 0 #174f3c; }
.staff-theme .bottom-nav button.active { color: #17221d; box-shadow: inset 0 3px 0 #d8a642; }

.member-row { padding: 14px; display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
.member-row strong { display: block; font-size: 15px; }
.member-row span { display: block; margin-top: 3px; color: #718078; font-size: 12px; }
.attendance-control { display: flex; gap: 6px; }
.attendance-control button { min-width: 48px; min-height: 34px; border: 1px solid #d6ddd8; border-radius: 6px; background: #fff; color: #3c4942; font-size: 11px; font-weight: 800; }
.attendance-control button.selected.completed { border-color: #2f7258; background: #2f7258; color: #fff; }
.attendance-control button.selected.absent { border-color: #b55745; background: #b55745; color: #fff; }
.detail-back { border: 0; background: transparent; padding: 0; color: #2f7258; font-weight: 800; }

.toast {
  position: fixed; left: 50%; bottom: 86px; z-index: 30; transform: translateX(-50%);
  width: min(calc(100% - 32px), 440px); padding: 13px 15px; border-radius: 7px;
  background: #17221d; color: #fff; text-align: center; font-size: 13px;
  box-shadow: 0 10px 28px rgba(23,34,29,.24);
}

@media (min-width: 700px) {
  .bottom-nav { left: 50%; right: auto; width: 720px; transform: translateX(-50%); border-left: 1px solid #d8ded9; border-right: 1px solid #d8ded9; }
  .app-main { padding-left: 24px; padding-right: 24px; }
}

@media (max-width: 430px) {
  .pass-grid { grid-template-columns: 1fr; }
  .pass-stat.wide { grid-column: auto; }
  .summary-meta { flex-direction: column; gap: 4px; }
  .member-week-toolbar { flex-wrap: wrap; }
  .member-week-toolbar strong { flex: 1 1 160px; }
  .member-week-summary { align-items: flex-start; flex-direction: column; }
  .member-week-scroll { max-height: calc(100dvh - 340px); }
  .mobile-modal { align-items: end; padding: 0; }
  .mobile-modal-panel { width: 100%; max-height: 88dvh; border-radius: 8px 8px 0 0; }
  .mobile-class-detail-grid { grid-template-columns: 1fr; }
}

/* Dark app theme shared by the member and staff PWAs. */
:root {
  color-scheme: dark;
  color: #f1f4fa;
  background: #0f1117;
}

body,
.mobile-login,
.mobile-shell {
  background: #0f1117;
  color: #f1f4fa;
}

.mobile-login {
  border-top: 4px solid #314f7d;
}

.brand-lockup {
  color: #f5f7ff;
}

.brand-lockup img,
.header-brand img {
  background: #314f7d;
  box-shadow: 0 8px 24px rgba(19, 39, 68, .4);
}

.brand-lockup span,
.login-copy,
.page-subtitle,
.section-heading span,
.class-card p,
.capacity,
.member-row span,
.pass-stat span,
.mobile-class-detail-grid dt,
.member-week-summary {
  color: #aeb6c4;
}

.login-title,
.page-title,
.section-heading h2,
.class-card h3,
.pass-heading h2,
.mobile-modal-heading h2,
.member-row strong {
  color: #f1f4fa;
}

.field {
  color: #cbd2de;
}

.field input,
.member-week-toolbar button {
  border-color: #3a414d;
  background: #20242b;
  color: #f1f4fa;
}

.field input::placeholder {
  color: #858e9d;
  opacity: 1;
}

.field input:focus {
  border-color: #3b5e91;
  box-shadow: 0 0 0 3px rgba(59, 94, 145, .2);
}

.primary-action,
.login-form .primary-action,
.small-action {
  border: 1px solid #314f7d;
  background: #243b63;
  color: #f7f9ff;
}

.primary-action:hover,
.login-form .primary-action:hover,
.small-action:hover {
  border-color: #3b5e91;
  background: #314f7d;
}

.small-action.secondary {
  border-color: #3a414d;
  background: #252a33;
  color: #e7ebf3;
}

.small-action.danger,
.mobile-modal-panel .primary-action.danger {
  border-color: #d66f62;
  background: #c86155;
  color: #ffffff;
}

.app-header,
.staff-theme .app-header {
  color: #f6f7fb;
  background: rgba(20, 23, 30, .97);
  border-bottom-color: #2d333e;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}

.header-button {
  border-color: #47505f;
  background: #20242b;
  color: #f1f4fa;
}

.eyebrow,
.class-date,
.pass-heading span,
.mobile-modal-heading span,
.detail-back {
  color: #5273a8;
}

.summary-band,
.staff-theme .summary-band {
  border: 1px solid #3b5e91;
  background: #293f69;
  color: #ffffff;
  box-shadow: 0 14px 32px rgba(30, 43, 92, .25);
}

.summary-band small,
.summary-meta {
  color: #e8ecff;
}

.class-card,
.pass-panel,
.member-row,
.empty-state {
  border-color: #303642;
  background: #191d24;
  color: #f1f4fa;
}

.pass-panel.inactive {
  background: #171a20;
}

.status-chip,
.pass-status.active {
  background: #273554;
  color: #bfc9ff;
}

.status-chip.full,
.status-chip.absent,
.pass-status.inactive {
  background: #482b30;
  color: #f1aaa0;
}

.status-chip.wait {
  background: #40371f;
  color: #e8ca78;
}

.class-footer {
  border-top-color: #303642;
}

.member-week-scroll {
  border-color: #303642;
  background: #15181e;
  scrollbar-color: #596270 #171a20;
}

.member-week-corner,
.member-week-day {
  border-color: #303642;
  background: #20242b;
  color: #f1f4fa;
}

.member-week-corner,
.member-week-day span,
.member-week-time {
  color: #aeb6c4;
}

.member-week-day.today {
  background: #283252;
  color: #dce3ff;
}

.member-week-time {
  border-color: #303642;
  background: #191d24;
}

.member-week-cell,
.member-week-cell.today {
  border-color: #303642;
  background: #15191f;
}

.member-week-cell.today {
  background: #191f2e;
}

.member-week-class {
  background: #2b3859;
  color: #dce4ff;
}

.member-week-class.mine {
  background: #3a588b;
  color: #ffffff;
}

.member-week-class.full {
  background: #512f35;
  color: #f3b2a8;
}

.mobile-modal-backdrop {
  background: rgba(4, 6, 10, .78);
  backdrop-filter: blur(5px);
}

.mobile-modal-panel {
  border: 1px solid #343b47;
  background: #191d24;
  color: #f1f4fa;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
}

.mobile-modal-heading > button {
  border-color: #3a414d;
  background: #242932;
  color: #f1f4fa;
}

.mobile-class-detail-grid div,
.pass-stat {
  background: #222730;
  color: #f1f4fa;
}

.mobile-class-warning {
  background: #3a291f;
  color: #efbd93;
}

.empty-state {
  color: #aeb6c4;
}

.bottom-nav {
  border-color: #303642;
  background: rgba(24, 28, 35, .98);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, .24);
}

.bottom-nav button {
  color: #8f98a7;
}

.bottom-nav button.active,
.staff-theme .bottom-nav button.active {
  color: #afc5eb;
  box-shadow: inset 0 3px 0 #3b5e91;
}

.attendance-control button {
  border-color: #3a414d;
  background: #252a33;
  color: #e7ebf3;
}

.attendance-control button.selected.completed {
  border-color: #6bc59a;
  background: #326d53;
  color: #ffffff;
}

.attendance-control button.selected.absent {
  border-color: #d66f62;
  background: #9b493f;
  color: #ffffff;
}

.toast {
  border: 1px solid #4a5260;
  background: #252a33;
  color: #ffffff;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .42);
}

@media (min-width: 700px) {
  .bottom-nav {
    border-left-color: #303642;
    border-right-color: #303642;
  }
}
