:root {
  --bg: #f5f3ed;
  --surface: #ffffff;
  --surface-2: #faf9f5;
  --ink: #1c2925;
  --muted: #71807a;
  --line: #e5e7e1;
  --primary: #2f6f60;
  --primary-strong: #24574c;
  --primary-soft: #e5f1ed;
  --accent: #d8a95d;
  --accent-soft: #fff3dc;
  --danger: #b95454;
  --danger-soft: #fce9e8;
  --slate-soft: #edf0ef;
  --shadow: 0 18px 45px rgba(35, 60, 51, 0.08);
  --shadow-small: 0 8px 24px rgba(35, 60, 51, 0.08);
  --radius-xl: 26px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  color-scheme: light;
  font-family: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  padding-top: env(safe-area-inset-top);
  color: var(--ink);
  background:
    radial-gradient(circle at 72% -10%, rgba(192, 220, 210, 0.33), transparent 25rem),
    var(--bg);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

.install-app-button {
  position: fixed;
  z-index: 45;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  gap: 8px;
  padding: 0 17px;
  border: 0;
  border-radius: 14px;
  color: #ffffff;
  background: #183d35;
  box-shadow: 0 13px 32px rgba(24, 61, 53, 0.25);
  font-size: 12px;
  font-weight: 800;
}

.install-app-button > span {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 7px;
  color: #183d35;
  background: #dceee7;
  font-size: 14px;
}

.install-help {
  text-align: left;
}

.install-help > h2,
.install-help > p {
  text-align: center;
}

.install-icon {
  color: var(--primary);
  background: var(--primary-soft);
}

.install-steps {
  display: grid;
  gap: 9px;
  margin-top: 20px;
}

.install-steps span {
  display: block;
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 10px;
  line-height: 1.55;
}

.install-steps b {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 11px;
}

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

button {
  color: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(47, 111, 96, 0.24);
  outline-offset: 2px;
}

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

.hidden {
  display: none !important;
}

.auth-app {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(420px, 1.05fr) minmax(460px, 0.95fr);
  background: #ffffff;
}

.auth-showcase {
  position: relative;
  display: flex;
  min-height: 100vh;
  overflow: hidden;
  flex-direction: column;
  padding: clamp(34px, 5vw, 68px);
  color: #f5fffb;
  background:
    radial-gradient(circle at 78% 22%, rgba(211, 235, 226, 0.18), transparent 17rem),
    radial-gradient(circle at 13% 94%, rgba(216, 169, 93, 0.16), transparent 18rem),
    linear-gradient(145deg, #173d34, #286b5b);
}

.auth-showcase::before,
.auth-showcase::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
}

.auth-showcase::before {
  width: 380px;
  height: 380px;
  right: -180px;
  top: 16%;
}

.auth-showcase::after {
  width: 230px;
  height: 230px;
  right: 12%;
  bottom: -145px;
}

.auth-brand {
  position: relative;
  z-index: 1;
}

.auth-copy {
  position: relative;
  z-index: 1;
  margin: auto 0;
}

.auth-copy .eyebrow {
  color: #bde2d5;
}

.auth-copy h1 {
  margin: 18px 0 20px;
  font-size: clamp(42px, 5vw, 68px);
  line-height: 1.1;
  letter-spacing: -0.07em;
}

.auth-copy p {
  margin: 0;
  color: rgba(245, 255, 251, 0.68);
  font-size: 14px;
  line-height: 1.85;
}

.auth-feature-row {
  position: relative;
  z-index: 1;
  display: flex;
  gap: clamp(18px, 4vw, 42px);
  padding-top: 25px;
  border-top: 1px solid rgba(255, 255, 255, 0.13);
  color: rgba(245, 255, 251, 0.72);
  font-size: 11px;
}

.auth-feature-row span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-feature-row b {
  color: #e8c98f;
  font-size: 9px;
  letter-spacing: 0.08em;
}

.auth-panel {
  display: grid;
  min-height: 100vh;
  place-items: center;
  align-content: center;
  gap: 16px;
  padding: 44px clamp(28px, 7vw, 100px);
  background:
    radial-gradient(circle at 55% 0, rgba(219, 235, 229, 0.4), transparent 24rem),
    #f8f7f2;
}

.auth-card {
  width: min(440px, 100%);
  padding: 34px;
  border: 1px solid rgba(224, 228, 222, 0.9);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 24px 60px rgba(35, 60, 51, 0.11);
}

.auth-card-heading h2 {
  margin: 8px 0 7px;
  font-size: 25px;
  letter-spacing: -0.055em;
}

.auth-card-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
  margin: 25px 0 22px;
  padding: 5px;
  border-radius: 13px;
  background: #f0f2ef;
}

.auth-tabs button {
  min-height: 40px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}

.auth-tabs button.active {
  color: var(--primary-strong);
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(35, 60, 51, 0.08);
}

.auth-form {
  display: grid;
  gap: 15px;
}

.auth-submit {
  min-height: 50px;
  margin-top: 2px;
}

.auth-error {
  min-height: 16px;
  margin: -4px 0 -2px;
  color: var(--danger);
  font-size: 10px;
  line-height: 1.5;
}

.demo-login {
  display: grid;
  gap: 8px;
  margin-top: 4px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
  text-align: center;
}

.demo-login > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
}

.demo-login > div {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.demo-login button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--primary-strong);
  background: var(--surface-2);
  font-size: 10px;
  font-weight: 800;
}

.demo-login small {
  color: #9aa39f;
  font-size: 8px;
}

.role-choice {
  margin: 0;
  padding: 0;
  border: 0;
}

.role-choice legend {
  margin-bottom: 8px;
  color: #4b5c55;
  font-size: 11px;
  font-weight: 800;
}

.role-choice > div {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
}

.role-choice button {
  display: grid;
  min-height: 76px;
  grid-template-columns: 30px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-content: center;
  align-items: center;
  gap: 2px 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: #ffffff;
  text-align: left;
}

.role-choice button > span {
  display: grid;
  grid-row: 1 / 3;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 9px;
  color: var(--primary);
  background: var(--primary-soft);
}

.role-choice button strong {
  font-size: 12px;
}

.role-choice button small {
  color: var(--muted);
  font-size: 8px;
}

.role-choice button.active {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.auth-footnote {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin: 0;
  color: #8b9692;
  font-size: 9px;
}

.auth-footnote button {
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  color: var(--primary);
  background: transparent;
  font-size: 10px;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  display: flex;
  width: 248px;
  flex-direction: column;
  padding: 28px 20px 22px;
  color: #f9fffc;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.06), transparent 35%),
    #183d35;
}

.brand {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  color: inherit;
  text-align: left;
  background: transparent;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 14px 14px 14px 5px;
  color: #173b33;
  background: #d8e9e3;
  font-family: Georgia, serif;
  font-size: 23px;
  font-weight: 700;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 17px;
  letter-spacing: -0.03em;
}

.brand small {
  margin-top: 3px;
  color: rgba(244, 255, 251, 0.58);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.brand.compact {
  color: var(--ink);
}

.brand.compact small {
  color: var(--muted);
}

.side-nav {
  display: grid;
  gap: 6px;
  margin-top: 42px;
}

.nav-item {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 13px;
  padding: 0 14px;
  border: 0;
  border-radius: 13px;
  color: rgba(246, 255, 252, 0.67);
  background: transparent;
  font-size: 14px;
  font-weight: 650;
  text-align: left;
  transition: 0.18s ease;
}

.nav-item > span {
  display: grid;
  width: 22px;
  place-items: center;
  font-size: 19px;
}

.side-nav .nav-item:hover,
.side-nav .nav-item.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.11);
}

.sidebar-card {
  margin-top: auto;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.07);
}

.sidebar-card strong {
  display: block;
  margin-top: 8px;
  font-size: 14px;
}

.sidebar-card p {
  margin: 7px 0 15px;
  color: rgba(247, 255, 252, 0.62);
  font-size: 12px;
  line-height: 1.55;
}

.studio-profile {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 20px;
  padding: 4px;
}

.avatar {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: #173b33;
  background: #e6c78e;
  font-size: 13px;
  font-weight: 800;
}

.studio-profile strong,
.studio-profile small {
  display: block;
}

.studio-profile strong {
  font-size: 13px;
}

.studio-profile small {
  margin-top: 3px;
  color: rgba(247, 255, 252, 0.54);
  font-size: 10px;
}

.main-area {
  grid-column: 2;
  min-width: 0;
}

.topbar {
  display: flex;
  min-height: 122px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px clamp(24px, 4vw, 64px) 18px;
}

.today-label {
  margin-bottom: 7px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(22px, 2.25vw, 30px);
  letter-spacing: -0.05em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-content {
  padding: 10px clamp(24px, 4vw, 64px) 60px;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: fade-up 0.3s ease both;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 750;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.button-primary {
  color: #ffffff;
  background: var(--primary);
  box-shadow: 0 7px 18px rgba(47, 111, 96, 0.18);
}

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

.button-soft {
  color: #eafff8;
  border-color: rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.1);
}

.button-ghost {
  border-color: var(--line);
  color: #47564f;
  background: #ffffff;
}

.button-danger {
  color: #ffffff;
  background: var(--danger);
}

.button-small {
  min-height: 36px;
  padding-inline: 13px;
  border-radius: 10px;
  font-size: 12px;
}

.button-block {
  width: 100%;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: #ffffff;
  font-size: 21px;
}

.mobile-only,
.bottom-nav {
  display: none;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.75fr);
  gap: 22px;
}

.content-column {
  display: grid;
  align-content: start;
  gap: 22px;
}

.hero-card {
  position: relative;
  display: flex;
  min-height: 178px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  overflow: hidden;
  padding: 30px clamp(24px, 4vw, 38px);
  border-radius: var(--radius-xl);
  color: #f4fff9;
  background:
    radial-gradient(circle at 88% 25%, rgba(213, 235, 225, 0.19), transparent 10rem),
    linear-gradient(130deg, #214f44, #2f7564);
  box-shadow: var(--shadow);
}

.hero-card::after {
  content: "";
  position: absolute;
  width: 160px;
  height: 160px;
  right: -55px;
  bottom: -75px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
}

.hero-copy {
  position: relative;
  z-index: 1;
}

.hero-copy .eyebrow {
  color: #bfe2d7;
}

.hero-copy h2 {
  max-width: 430px;
  margin: 10px 0 10px;
  font-size: clamp(22px, 2.4vw, 31px);
  letter-spacing: -0.055em;
}

.hero-copy p {
  margin: 0;
  color: rgba(244, 255, 249, 0.7);
  font-size: 13px;
  line-height: 1.6;
}

.hero-stat {
  position: relative;
  z-index: 1;
  min-width: 124px;
  padding-left: 25px;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
}

.hero-stat strong,
.hero-stat small {
  display: block;
}

.hero-stat strong {
  font-size: 43px;
  letter-spacing: -0.05em;
}

.hero-stat small {
  margin-top: 3px;
  color: rgba(244, 255, 249, 0.65);
  font-size: 12px;
}

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

.metric-card {
  min-height: 125px;
  padding: 21px;
  border: 1px solid rgba(226, 229, 223, 0.8);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-small);
}

.metric-card .metric-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric-icon {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border-radius: 9px;
  color: var(--primary);
  background: var(--primary-soft);
}

.metric-card strong {
  display: block;
  margin-top: 15px;
  font-size: clamp(21px, 2vw, 27px);
  letter-spacing: -0.04em;
}

.metric-card small {
  display: block;
  margin-top: 5px;
  color: #8a9791;
  font-size: 10px;
}

.panel {
  padding: 25px;
  border: 1px solid rgba(226, 229, 223, 0.88);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-small);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.panel-header h2,
.panel-header h3 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.04em;
}

.panel-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.text-button {
  min-height: 40px;
  border: 0;
  color: var(--primary);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}

.lesson-list,
.member-list,
.transaction-list,
.activity-list {
  display: grid;
  gap: 10px;
}

.lesson-card {
  display: grid;
  grid-template-columns: 77px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 78px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
}

.lesson-time {
  padding-right: 15px;
  border-right: 1px solid var(--line);
}

.lesson-time strong,
.lesson-time small {
  display: block;
}

.lesson-time strong {
  font-size: 15px;
}

.lesson-time small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.lesson-info {
  min-width: 0;
}

.lesson-info strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lesson-info p {
  margin: 6px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lesson-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status {
  display: inline-flex;
  min-height: 27px;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.status::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.status-scheduled,
.status-active {
  color: #276454;
  background: var(--primary-soft);
}

.status-completed {
  color: #626d69;
  background: var(--slate-soft);
}

.status-cancelled,
.status-ended {
  color: #a04e4e;
  background: var(--danger-soft);
}

.status-attention {
  color: #976921;
  background: var(--accent-soft);
}

.finance-summary {
  display: grid;
  gap: 15px;
}

.finance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: var(--muted);
  font-size: 12px;
}

.finance-row strong {
  color: var(--ink);
  font-size: 14px;
}

.finance-row.total {
  margin-top: 2px;
  padding-top: 17px;
  border-top: 1px dashed #d9ddd8;
}

.finance-row.total strong {
  color: var(--primary);
  font-size: 22px;
}

.progress {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9ece9;
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.activity-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-height: 45px;
}

.activity-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 13px;
  font-weight: 900;
}

.activity-item strong,
.activity-item small {
  display: block;
}

.activity-item strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-item small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.activity-amount {
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.activity-amount.income {
  color: var(--primary);
}

.activity-amount.expense {
  color: var(--danger);
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.page-heading h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.05em;
}

.page-heading p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box {
  position: relative;
  width: min(320px, 100%);
}

.search-box::before {
  content: "⌕";
  position: absolute;
  top: 50%;
  left: 14px;
  color: var(--muted);
  font-size: 19px;
  transform: translateY(-50%);
}

.search-box input,
.filter-select,
.month-input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #ffffff;
}

.search-box input {
  padding: 0 14px 0 42px;
}

.filter-select,
.month-input {
  width: auto;
  min-width: 120px;
  padding: 0 12px;
}

.member-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-small);
}

.member-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) minmax(130px, 1fr) 110px minmax(180px, 1.2fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 75px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}

.member-row:last-child {
  border-bottom: 0;
}

.member-row.header {
  min-height: 45px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 10px;
  font-weight: 800;
}

.member-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.member-avatar {
  display: grid;
  width: 39px;
  height: 39px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 13px;
  color: #285d50;
  background: var(--primary-soft);
  font-size: 13px;
  font-weight: 900;
}

.member-identity strong,
.member-identity small {
  display: block;
}

.member-identity strong {
  font-size: 13px;
}

.member-identity small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.pass-cell strong,
.pass-cell small {
  display: block;
}

.pass-cell strong {
  font-size: 13px;
}

.pass-cell small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.member-row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.lesson-board {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 20px;
}

.date-panel {
  align-self: start;
}

.calendar-month {
  margin: 0 0 18px;
  font-size: 19px;
  letter-spacing: -0.04em;
}

.date-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.date-chip {
  display: grid;
  min-width: 0;
  min-height: 58px;
  place-items: center;
  align-content: center;
  gap: 4px;
  padding: 4px;
  border: 0;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
}

.date-chip small {
  font-size: 9px;
}

.date-chip strong {
  font-size: 13px;
}

.date-chip.active {
  color: #ffffff;
  background: var(--primary);
}

.date-chip.has-lesson:not(.active)::after {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.date-panel-note {
  margin: 20px 0 0;
  padding: 14px;
  border-radius: 13px;
  color: #5c6b65;
  background: var(--surface-2);
  font-size: 10px;
  line-height: 1.6;
}

.lesson-group-title {
  margin: 22px 0 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.03em;
}

.lesson-group-title:first-child {
  margin-top: 0;
}

.calendar-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 20px;
}

.calendar-panel {
  min-width: 0;
}

.calendar-toolbar {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px auto;
  align-items: center;
  gap: 7px;
  margin-bottom: 18px;
}

.calendar-toolbar h3 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.04em;
  text-align: center;
}

.calendar-nav-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--primary-strong);
  background: #ffffff;
  font-size: 24px;
  line-height: 1;
}

.calendar-nav-button:hover,
.calendar-nav-button:focus-visible {
  background: var(--primary-soft);
}

.calendar-today-button {
  margin-left: 5px;
}

.month-calendar {
  display: grid;
  overflow: hidden;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--line);
}

.calendar-weekday {
  display: grid;
  min-height: 42px;
  place-items: center;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 800;
}

.calendar-weekday:first-child {
  color: #b45a5a;
}

.calendar-weekday:nth-child(7) {
  color: var(--primary);
}

.calendar-day {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 136px;
  align-items: stretch;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border: 0;
  color: var(--ink);
  background: #ffffff;
  text-align: left;
}

.calendar-day:hover {
  z-index: 1;
  background: #f2f8f5;
}

.calendar-day.other-month {
  color: #aab1ae;
  background: #fafaf8;
}

.calendar-day.selected {
  z-index: 2;
  background: #f1f8f5;
  box-shadow: inset 0 0 0 2px var(--primary);
}

.calendar-date-number {
  display: grid;
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 800;
}

.calendar-day.today .calendar-date-number {
  color: #ffffff;
  background: var(--accent);
}

.calendar-day.selected .calendar-date-number {
  color: #ffffff;
  background: var(--primary);
}

.calendar-events {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.calendar-event {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
  padding: 5px 7px 5px 9px;
  border-radius: 5px;
  color: #276454;
  background: var(--primary-soft);
  box-shadow: inset 3px 0 0 var(--primary);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
}

.calendar-event time {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.calendar-event em {
  min-width: 0;
  overflow: hidden;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-event em > span {
  display: inline;
}

.calendar-event em > span + span::before {
  content: " · ";
}

.calendar-event.event-completed {
  color: #626d69;
  background: var(--slate-soft);
  box-shadow: inset 3px 0 0 #8a9591;
}

.calendar-event.event-attention {
  color: #8a631f;
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.calendar-event.event-cancelled {
  color: #a04e4e;
  background: var(--danger-soft);
  box-shadow: inset 3px 0 0 var(--danger);
  text-decoration: line-through;
}

.calendar-more {
  padding-left: 3px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 10px;
}

.calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
}

.legend-dot.completed {
  background: #8a9591;
}

.legend-dot.cancelled {
  background: var(--danger);
}

.calendar-day-panel {
  position: static;
}

.calendar-day-header {
  align-items: flex-start;
}

.calendar-day-header .button {
  flex: 0 0 auto;
}

.calendar-day-panel .lesson-card {
  grid-template-columns: 68px minmax(0, 1fr) auto;
}

.calendar-day-panel .lesson-actions {
  grid-column: auto;
  justify-content: flex-end;
  padding-top: 0;
  border-top: 0;
}

.calendar-rule-note {
  margin: 16px 0 0;
  padding: 13px 14px;
  border-radius: 12px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 9px;
  line-height: 1.55;
}

.ledger-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.ledger-metric {
  min-height: 118px;
  padding: 22px;
  border-radius: 18px;
  color: #ffffff;
  background: var(--primary);
}

.ledger-metric:nth-child(2) {
  color: var(--ink);
  background: #efe7d8;
}

.ledger-metric:nth-child(3) {
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
}

.ledger-metric span,
.ledger-metric strong,
.ledger-metric small {
  display: block;
}

.ledger-metric span {
  font-size: 11px;
  font-weight: 750;
  opacity: 0.75;
}

.ledger-metric strong {
  margin-top: 12px;
  font-size: clamp(21px, 2vw, 28px);
  letter-spacing: -0.04em;
}

.ledger-metric small {
  margin-top: 5px;
  font-size: 9px;
  opacity: 0.66;
}

.transaction-row {
  display: grid;
  grid-template-columns: 45px minmax(0, 1fr) 115px;
  align-items: center;
  gap: 13px;
  min-height: 63px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.transaction-row:last-child {
  border-bottom: 0;
}

.transaction-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 900;
}

.transaction-icon.income {
  color: var(--primary);
  background: var(--primary-soft);
}

.transaction-icon.expense {
  color: var(--danger);
  background: var(--danger-soft);
}

.transaction-main strong,
.transaction-main small {
  display: block;
}

.transaction-main strong {
  font-size: 12px;
}

.transaction-main small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
}

.transaction-value {
  text-align: right;
  font-size: 13px;
  font-weight: 850;
}

.transaction-value.income {
  color: var(--primary);
}

.transaction-value.expense {
  color: var(--danger);
}

.empty-state {
  display: grid;
  min-height: 190px;
  place-items: center;
  align-content: center;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.empty-state span {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  margin-bottom: 13px;
  border-radius: 16px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 22px;
}

.empty-state strong {
  color: var(--ink);
  font-size: 14px;
}

.empty-state p {
  max-width: 330px;
  margin: 7px 0 0;
  font-size: 11px;
  line-height: 1.6;
}

.eyebrow {
  color: var(--primary);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.modal {
  width: min(520px, calc(100% - 30px));
  max-width: calc(100vw - 30px);
  max-height: min(88vh, 820px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 0;
  border: 0;
  border-radius: 24px;
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 30px 90px rgba(17, 40, 33, 0.28);
}

.modal::backdrop {
  background: rgba(18, 38, 32, 0.55);
  backdrop-filter: blur(3px);
}

.modal > form,
.confirm-content {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 28px;
}

.modal-wide {
  width: min(660px, calc(100% - 30px));
}

.modal-small {
  width: min(410px, calc(100% - 30px));
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 23px;
}

.modal-header h2 {
  margin: 6px 0 0;
  font-size: 23px;
  letter-spacing: -0.05em;
}

.modal-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 14px;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field > span,
.field legend {
  color: #4b5c55;
  font-size: 11px;
  font-weight: 800;
}

.field small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
}

.field-full {
  grid-column: 1 / -1;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  padding: 0 13px;
  border: 1px solid #dfe3de;
  border-radius: 12px;
  color: var(--ink);
  background: #fbfcfa;
  font-size: 13px;
}

.field input,
.field select {
  height: 47px;
}

.field textarea {
  min-height: 118px;
  padding-block: 12px;
  line-height: 1.65;
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #a9b1ad;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  background: #ffffff;
}

.field-help {
  display: block;
  line-height: 1.5;
}

.input-suffix {
  position: relative;
}

.input-suffix input {
  padding-right: 42px;
}

.input-suffix em {
  position: absolute;
  top: 50%;
  right: 13px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  transform: translateY(-50%);
}

.total-input input {
  color: var(--primary-strong);
  background: var(--primary-soft);
  font-size: 16px;
  font-weight: 850;
}

.form-note {
  margin: 15px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 26px;
}

.package-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-bottom: 19px;
}

.package-option {
  display: grid;
  min-height: 70px;
  place-content: center;
  gap: 5px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: #ffffff;
  text-align: center;
}

.package-option strong {
  font-size: 12px;
}

.package-option small {
  color: var(--muted);
  font-size: 9px;
}

.package-option.active {
  border-color: var(--primary);
  color: var(--primary-strong);
  background: var(--primary-soft);
}

.member-picker {
  gap: 9px;
}

.member-picker-tools {
  display: flex;
  align-items: center;
  gap: 9px;
}

.member-search-box {
  position: relative;
  display: block;
  min-width: 0;
  flex: 1;
}

.member-search-box > span {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 13px;
  color: var(--muted);
  font-size: 15px;
  transform: translateY(-50%);
  pointer-events: none;
}

.member-search-box input {
  width: 100%;
  height: 43px;
  padding: 0 13px 0 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #ffffff;
  font-size: 11px;
}

.member-search-box input::placeholder {
  color: #9ca6a2;
}

.member-picker-status {
  display: inline-flex;
  min-height: 31px;
  flex: 0 0 auto;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--slate-soft);
  font-size: 9px;
  white-space: nowrap;
}

.member-picker-status.has-selection {
  color: var(--primary-strong);
  background: var(--primary-soft);
}

.member-check-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 210px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 2px 5px 2px 2px;
  scrollbar-gutter: stable;
}

.member-check {
  display: flex;
  min-height: 50px;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
}

.member-check:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.member-check:has(input:disabled) {
  opacity: 0.48;
}

.member-check input {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
}

.member-check span {
  min-width: 0;
}

.member-check strong,
.member-check small {
  display: block;
}

.member-check strong {
  font-size: 11px;
}

.member-check small {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-picker-empty {
  display: grid;
  min-height: 92px;
  grid-column: 1 / -1;
  place-content: center;
  gap: 5px;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 13px;
  color: var(--muted);
  background: var(--surface-2);
  text-align: center;
}

.member-picker-empty strong {
  color: var(--ink);
  font-size: 11px;
}

.member-picker-empty span {
  font-size: 9px;
}

.member-detail-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}

.member-detail-summary article {
  padding: 15px;
  border-radius: 14px;
  background: var(--surface-2);
}

.member-detail-summary .member-detail-total {
  color: var(--primary-strong);
  background: var(--primary-soft);
}

.member-detail-summary span,
.member-detail-summary strong {
  display: block;
}

.member-detail-summary span {
  color: var(--muted);
  font-size: 9px;
}

.member-detail-summary strong {
  margin-top: 6px;
  font-size: 18px;
  letter-spacing: -0.04em;
}

.member-detail-fields {
  margin-bottom: 24px;
}

.member-pass-section {
  padding-top: 21px;
  border-top: 1px solid var(--line);
}

.member-detail-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 12px;
}

.member-detail-section-title h3 {
  margin: 0;
  font-size: 15px;
}

.member-detail-section-title span {
  color: var(--muted);
  font-size: 9px;
}

.member-detail-pass-list {
  display: grid;
  max-height: 245px;
  overflow-x: hidden;
  overflow-y: auto;
  gap: 8px;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.member-detail-pass {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
}

.member-detail-pass > div:first-child {
  min-width: 0;
}

.member-detail-pass strong,
.member-detail-pass span,
.member-detail-pass small {
  display: block;
}

.member-detail-pass > div:first-child > strong {
  font-size: 12px;
}

.member-detail-pass > div:first-child > span,
.member-detail-pass > div:first-child > small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.member-detail-pass-state {
  display: grid;
  flex: 0 0 auto;
  justify-items: end;
  gap: 7px;
}

.member-detail-pass-state > strong {
  font-size: 11px;
}

.member-detail-actions {
  align-items: center;
}

.member-detail-actions #memberManualDeductButton {
  margin-right: auto;
}

.auto-rule {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 17px;
  padding: 13px 15px;
  border-radius: 13px;
  color: #456159;
  background: var(--primary-soft);
}

.auto-rule > span {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 9px;
  color: #ffffff;
  background: var(--primary);
}

.auto-rule p,
.auto-rule strong {
  display: block;
  margin: 0;
}

.auto-rule p {
  font-size: 9px;
  line-height: 1.55;
}

.auto-rule strong {
  margin-bottom: 2px;
  font-size: 10px;
}

.confirm-content {
  text-align: center;
}

.confirm-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  margin: 0 auto 17px;
  border-radius: 15px;
  color: var(--danger);
  background: var(--danger-soft);
  font-size: 20px;
  font-weight: 900;
}

.confirm-content h2 {
  margin-bottom: 9px;
  font-size: 19px;
}

.confirm-content p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.confirm-content .modal-actions {
  justify-content: center;
}

.toast {
  position: fixed;
  z-index: 100;
  top: 24px;
  left: 50%;
  max-width: min(420px, calc(100% - 32px));
  padding: 13px 18px;
  border-radius: 13px;
  color: #ffffff;
  background: #183d35;
  box-shadow: 0 12px 35px rgba(18, 48, 40, 0.25);
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -12px);
  transition: 0.24s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.member-app {
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 0, rgba(196, 224, 214, 0.42), transparent 28rem),
    var(--bg);
}

.member-header {
  display: flex;
  max-width: 1050px;
  min-height: 88px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 auto;
  padding: 18px 28px;
}

.member-content {
  max-width: 1050px;
  margin: 0 auto;
  padding: 32px 28px 70px;
}

.member-lookup {
  display: grid;
  min-height: calc(100vh - 190px);
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.75fr);
  align-items: center;
  gap: clamp(40px, 8vw, 100px);
}

.lookup-copy .eyebrow {
  font-size: 10px;
}

.lookup-copy h1 {
  max-width: 560px;
  margin: 14px 0 17px;
  font-size: clamp(35px, 5vw, 60px);
  line-height: 1.12;
  letter-spacing: -0.065em;
}

.lookup-copy p {
  max-width: 480px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.lookup-card {
  padding: 32px;
  border: 1px solid rgba(225, 229, 223, 0.85);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.lookup-card h2 {
  margin-bottom: 8px;
  font-size: 20px;
  letter-spacing: -0.04em;
}

.lookup-card > p {
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.lookup-card .field input {
  height: 54px;
  font-size: 16px;
}

.lookup-card .button {
  width: 100%;
  min-height: 52px;
  margin-top: 13px;
}

.privacy-note {
  margin: 17px 0 0;
  padding-top: 15px;
  border-top: 1px solid var(--line);
  color: #8b9692;
  font-size: 9px;
  line-height: 1.6;
}

.demo-number {
  display: inline-flex;
  min-height: 35px;
  align-items: center;
  gap: 6px;
  margin-top: 15px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  color: var(--primary-strong);
  background: var(--primary-soft);
  font-size: 9px;
  font-weight: 800;
}

.member-result {
  max-width: 760px;
  margin: 18px auto 0;
}

.member-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 25px;
}

.member-result-header h1 {
  margin: 7px 0 0;
  font-size: 30px;
  letter-spacing: -0.055em;
}

.member-pass-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 30px;
  padding: 32px;
  border-radius: 26px;
  color: #f6fffb;
  background:
    radial-gradient(circle at 88% 18%, rgba(255, 255, 255, 0.13), transparent 9rem),
    linear-gradient(135deg, #1f5145, #347a68);
  box-shadow: var(--shadow);
}

.member-pass-hero h2 {
  margin: 8px 0 9px;
  font-size: 22px;
}

.member-pass-hero p {
  margin: 0;
  color: rgba(246, 255, 251, 0.68);
  font-size: 11px;
}

.remaining-count {
  text-align: right;
}

.remaining-count strong,
.remaining-count small {
  display: block;
}

.remaining-count strong {
  font-size: 49px;
  line-height: 1;
  letter-spacing: -0.06em;
}

.remaining-count small {
  margin-top: 6px;
  color: rgba(246, 255, 251, 0.68);
  font-size: 10px;
}

.member-result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 17px;
  margin-top: 17px;
}

.member-result-card {
  padding: 23px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.9);
}

.member-result-card h3 {
  margin-bottom: 17px;
  font-size: 14px;
}

.next-lesson {
  padding: 16px;
  border-radius: 14px;
  background: var(--surface-2);
}

.next-lesson strong,
.next-lesson span,
.next-lesson small {
  display: block;
}

.next-lesson span {
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
}

.next-lesson strong {
  margin-top: 7px;
  font-size: 15px;
}

.next-lesson small {
  margin-top: 6px;
  color: var(--muted);
  font-size: 9px;
}

.mini-history {
  display: grid;
  gap: 11px;
}

.mini-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 13px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line);
  font-size: 10px;
}

.mini-history-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.mini-history-item strong {
  font-size: 10px;
}

.mini-history-item span {
  color: var(--muted);
}

.member-calendar-section {
  margin-top: 22px;
}

.member-calendar-title {
  margin-bottom: 14px;
}

.member-calendar-title h2 {
  margin: 7px 0 5px;
  font-size: 21px;
  letter-spacing: -0.045em;
}

.member-calendar-title p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.member-calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.72fr);
  align-items: start;
  gap: 17px;
}

.member-calendar-panel,
.member-day-panel {
  padding: 22px;
}

.member-day-lessons {
  display: grid;
  gap: 10px;
}

.member-calendar-lesson {
  display: grid;
  grid-template-columns: 75px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #ffffff;
}

.member-lesson-time {
  padding-right: 12px;
  border-right: 1px solid var(--line);
}

.member-lesson-time strong,
.member-lesson-time small,
.member-lesson-info strong,
.member-lesson-info p {
  display: block;
}

.member-lesson-time strong {
  font-size: 12px;
  line-height: 1.4;
}

.member-lesson-time small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.member-lesson-info {
  min-width: 0;
}

.member-lesson-info strong {
  font-size: 12px;
}

.member-lesson-info p {
  margin: 5px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-calendar-lesson .status {
  grid-column: 1 / -1;
  justify-self: end;
}

@media (max-width: 1080px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-grid > .content-column:last-child {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .member-row {
    grid-template-columns: minmax(170px, 1.4fr) 105px 100px minmax(140px, 1fr) auto;
  }

  .calendar-workspace,
  .member-calendar-layout {
    grid-template-columns: 1fr;
  }

  .calendar-day-panel {
    position: static;
  }
}

@media (max-width: 820px) {
  body {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .field input,
  .field select,
  .field textarea,
  .search-box input,
  .filter-select,
  .month-input {
    font-size: 16px;
  }

  .auth-app {
    display: block;
    min-height: 100vh;
    background: var(--bg);
  }

  .auth-showcase {
    min-height: 290px;
    padding: 28px 24px 38px;
  }

  .auth-copy {
    margin: 42px 0 0;
  }

  .auth-copy h1 {
    margin: 12px 0 12px;
    font-size: 38px;
  }

  .auth-copy p {
    font-size: 11px;
  }

  .auth-feature-row {
    display: none;
  }

  .auth-panel {
    min-height: 0;
    margin-top: -20px;
    padding: 0 16px 45px;
    background: transparent;
  }

  .auth-card {
    padding: 27px 22px;
    border-radius: 23px;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .main-area {
    width: 100%;
  }

  .topbar {
    min-height: 94px;
    padding: 18px 18px 12px;
  }

  .topbar h1 {
    font-size: 21px;
  }

  .today-label {
    font-size: 9px;
  }

  .topbar-actions .button-primary {
    padding-inline: 12px;
  }

  .mobile-only {
    display: grid;
  }

  .page-content {
    padding: 10px 16px 104px;
  }

  .bottom-nav {
    position: fixed;
    z-index: 20;
    inset: auto 10px calc(8px + env(safe-area-inset-bottom)) 10px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 7px;
    border: 1px solid rgba(225, 230, 224, 0.85);
    border-radius: 19px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 14px 38px rgba(31, 59, 50, 0.16);
    backdrop-filter: blur(12px);
  }

  .app-shell:not(.hidden) ~ .install-app-button,
  .install-app-button {
    bottom: calc(86px + env(safe-area-inset-bottom));
  }

  .bottom-nav .nav-item {
    display: grid;
    min-height: 52px;
    place-items: center;
    align-content: center;
    gap: 3px;
    padding: 2px;
    color: #7a8782;
    font-size: 9px;
    text-align: center;
  }

  .bottom-nav .nav-item > span {
    width: auto;
    font-size: 18px;
  }

  .bottom-nav .nav-item.active {
    color: var(--primary);
    background: var(--primary-soft);
  }

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

  .metric-grid .metric-card:last-child,
  .ledger-metrics .ledger-metric:last-child {
    grid-column: 1 / -1;
  }

  .dashboard-grid > .content-column:last-child {
    grid-template-columns: 1fr;
  }

  .hero-card {
    min-height: 165px;
    padding: 25px;
  }

  .hero-copy h2 {
    font-size: 23px;
  }

  .hero-stat strong {
    font-size: 36px;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-heading .toolbar {
    width: 100%;
  }

  .toolbar .search-box {
    flex: 1;
  }

  .member-table {
    display: grid;
    gap: 10px;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .member-row.header {
    display: none;
  }

  .member-row {
    grid-template-columns: 1fr auto;
    gap: 12px;
    min-height: 0;
    padding: 17px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #ffffff;
    box-shadow: var(--shadow-small);
  }

  .member-row > .pass-cell,
  .member-row > .next-cell {
    padding-top: 12px;
    border-top: 1px solid var(--line);
  }

  .member-row > .pass-cell {
    grid-column: 1;
  }

  .member-row > .next-cell {
    grid-column: 2;
  }

  .member-row-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .member-row-actions .button {
    flex: 1;
  }

  .lesson-board {
    grid-template-columns: 1fr;
  }

  .calendar-workspace,
  .member-calendar-layout {
    gap: 14px;
  }

  .date-panel {
    padding-bottom: 17px;
  }

  .date-panel-note {
    display: none;
  }

  .member-lookup {
    min-height: 0;
    grid-template-columns: 1fr;
    gap: 34px;
    padding: 34px 0;
  }

  .lookup-copy {
    text-align: center;
  }

  .lookup-copy p {
    margin-inline: auto;
  }

  .lookup-card {
    width: min(430px, 100%);
    margin: 0 auto;
  }
}

@media (display-mode: standalone) {
  .install-app-button {
    display: none !important;
  }

  body {
    overscroll-behavior-y: none;
  }
}

@media (max-width: 560px) {
  .auth-showcase {
    min-height: 270px;
  }

  .auth-copy h1 {
    font-size: 33px;
  }

  .auth-copy p br {
    display: none;
  }

  .topbar {
    gap: 10px;
  }

  .topbar h1 {
    font-size: 18px;
    line-height: 1.35;
  }

  .topbar-actions {
    gap: 7px;
  }

  .topbar-actions .button-primary {
    min-width: 44px;
    width: 44px;
    padding: 0;
    font-size: 0;
  }

  .topbar-actions .button-primary span {
    font-size: 20px;
  }

  .hero-card {
    align-items: flex-start;
    flex-direction: column;
    gap: 21px;
  }

  .hero-stat {
    display: flex;
    width: 100%;
    align-items: baseline;
    gap: 8px;
    padding: 17px 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-left: 0;
  }

  .metric-grid,
  .ledger-metrics {
    grid-template-columns: 1fr;
  }

  .metric-grid .metric-card:last-child,
  .ledger-metrics .ledger-metric:last-child {
    grid-column: auto;
  }

  .metric-card,
  .ledger-metric {
    min-height: 105px;
  }

  .panel {
    padding: 19px;
    border-radius: 20px;
  }

  .lesson-card {
    grid-template-columns: 63px minmax(0, 1fr);
    gap: 12px;
  }

  .lesson-card .lesson-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
    padding-top: 9px;
    border-top: 1px solid var(--line);
  }

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

  .toolbar .filter-select,
  .toolbar .month-input {
    width: 100%;
  }

  .modal {
    width: calc(100% - 18px);
    max-width: calc(100% - 18px);
    max-height: calc(100dvh - 18px);
    margin-inline: auto;
    border-radius: 21px;
  }

  .modal > form,
  .confirm-content {
    padding: 22px 19px;
  }

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

  .field-full {
    grid-column: auto;
  }

  .member-detail-summary {
    gap: 6px;
  }

  .member-detail-summary article {
    padding: 12px 9px;
  }

  .member-detail-summary strong {
    font-size: 15px;
  }

  .member-detail-section-title,
  .member-detail-pass {
    align-items: flex-start;
    flex-direction: column;
  }

  .member-detail-pass-state {
    width: 100%;
    align-items: center;
    grid-template-columns: auto 1fr;
    justify-items: start;
  }

  .member-detail-pass-state > strong {
    justify-self: end;
  }

  .member-detail-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .member-detail-actions #memberManualDeductButton {
    grid-column: 1 / -1;
    margin-right: 0;
  }

  .package-options {
    grid-template-columns: 1fr;
  }

  .package-option {
    min-height: 58px;
  }

  .member-check-list {
    grid-template-columns: 1fr;
  }

  .member-header {
    min-height: 78px;
    padding: 15px 17px;
  }

  .member-header .brand-mark {
    width: 37px;
    height: 37px;
  }

  .member-content {
    padding: 22px 17px 55px;
  }

  .member-result {
    max-width: none;
  }

  .lookup-copy h1 {
    font-size: 37px;
  }

  .lookup-card {
    padding: 24px 20px;
    border-radius: 22px;
  }

  .member-result-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .member-pass-hero {
    align-items: flex-start;
    grid-template-columns: 1fr;
    padding: 25px;
  }

  .remaining-count {
    text-align: left;
  }

  .member-result-grid {
    grid-template-columns: 1fr;
  }

  .calendar-panel,
  .member-calendar-panel {
    padding: 16px 4px;
    border-radius: 18px;
  }

  .calendar-toolbar {
    grid-template-columns: 34px minmax(0, 1fr) 34px auto;
    gap: 4px;
    margin: 0 4px 13px;
  }

  .calendar-toolbar h3 {
    font-size: 16px;
  }

  .calendar-nav-button {
    width: 34px;
    height: 34px;
  }

  .calendar-today-button {
    min-height: 34px;
    margin-left: 2px;
    padding-inline: 9px;
  }

  .month-calendar {
    border-radius: 13px;
  }

  .calendar-weekday {
    min-height: 30px;
    font-size: 11px;
  }

  .calendar-day {
    min-height: 124px;
    gap: 4px;
    padding: 5px 2px;
  }

  .calendar-date-number {
    width: 23px;
    height: 23px;
    font-size: 13px;
  }

  .calendar-events {
    gap: 2px;
  }

  .calendar-event {
    align-items: flex-start;
    flex-direction: column;
    justify-content: flex-start;
    gap: 1px;
    min-height: 34px;
    padding: 4px 1px 4px 3px;
    box-shadow: inset 2px 0 0 var(--primary);
    font-size: 11px;
    line-height: 1.15;
  }

  .calendar-event time {
    font-size: 9px;
  }

  .calendar-event em {
    display: block;
    width: 100%;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  .calendar-event em > span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .calendar-event em > span + span::before {
    content: "";
  }

  .calendar-event.event-completed {
    box-shadow: inset 2px 0 0 #8a9591;
  }

  .calendar-event.event-attention {
    box-shadow: inset 2px 0 0 var(--accent);
  }

  .calendar-event.event-cancelled {
    box-shadow: inset 2px 0 0 var(--danger);
  }

  .calendar-more {
    padding: 0;
    font-size: 9px;
    text-align: center;
  }

  .calendar-legend {
    margin: 11px 4px 0;
  }

  .calendar-day-panel,
  .member-day-panel {
    padding: 19px;
    border-radius: 20px;
  }

  .calendar-day-header {
    align-items: stretch;
    flex-direction: column;
  }

  .calendar-day-header .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
