.login-body {
  min-height: 100vh;
  background:
    radial-gradient(820px 380px at 92% -10%, rgba(226, 177, 90, 0.28), transparent 60%),
    var(--bg);
}

.login-wrap {
  width: min(440px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3rem 0 4rem;
  display: grid;
  gap: 1.25rem;
}

.login-card h1 {
  font-size: 2.2rem;
}

.login-card .lede {
  font-size: 1rem;
}

.text-link {
  font-weight: 700;
  color: var(--brand);
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px 1fr;
}

.side {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem 1rem 1.5rem;
  background: #102622;
  color: #e7efe9;
}

.side .logo-name {
  color: #f7f3ea;
}

.side .logo-tag {
  color: #c5d4ce;
}

.side-role {
  margin: 0;
  color: #f3e6c4;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#side-nav {
  display: grid;
  gap: 0.25rem;
}

#side-nav button {
  width: 100%;
  padding: 0.75rem 0.8rem;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #e7efe9;
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

#side-nav button.is-on,
#side-nav button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.side-logout {
  margin-top: auto;
  color: #f7f3ea;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.workspace {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.work-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 4.5rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 243, 236, 0.94);
}

.work-bar h1 {
  font-size: 1.45rem;
}

#who {
  margin-left: auto;
  color: var(--muted);
  font-weight: 700;
}

.work-bar .menu-toggle {
  display: none;
}

.view {
  padding: 1.25rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.9rem;
}

.toolbar input[type="search"] {
  min-height: 44px;
  min-width: min(280px, 100%);
  padding: 0 0.9rem;
  border: 1px solid #d9d3c6;
  border-radius: 12px;
  background: #fff;
  font: inherit;
}

.toolbar .btn {
  margin-left: auto;
}

.data-grid {
  width: 100%;
  height: 560px;
  --ag-font-family: var(--sans);
  --ag-header-background-color: #134e48;
  --ag-header-foreground-color: #fff;
  --ag-active-color: #134e48;
  --ag-border-radius: 16px;
  --ag-wrapper-border-radius: 16px;
}

.row-actions {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  height: 100%;
}

#login-status:not(:empty) {
  color: #9b2c2c;
  font-weight: 700;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-small {
  min-height: 34px;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: #e7f2f0;
  color: var(--brand);
  font-size: 0.85rem;
}

.pdf-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.pdf-btn svg {
  flex: 0 0 auto;
}

.panel {
  display: grid;
  gap: 0.7rem;
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
}

.card-list {
  display: grid;
  gap: 0.8rem;
}

.hint,
.group-mini p {
  color: var(--muted);
}

#photo-form .avatar {
  width: 168px;
  height: 168px;
}

#photo-form .avatar-empty {
  background: #e7e1d6;
}

.profile-list {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
}

.profile-list div {
  display: grid;
  gap: 0.15rem;
}

.profile-list dt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.profile-list dd {
  margin: 0;
  font-weight: 700;
}

.tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}

.tab {
  min-height: 40px;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.tab.is-on {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.8rem;
}

.check {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  font-weight: 700;
}

.field textarea {
  width: 100%;
  min-height: 90px;
  padding: 0.7rem 0.9rem;
  border: 1px solid #d9d3c6;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  resize: vertical;
}

#modal,
#question-modal,
#video-modal {
  width: min(640px, calc(100% - 1.5rem));
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: transparent;
}

#question-modal {
  width: min(760px, calc(100% - 1.5rem));
}

#modal::backdrop,
#question-modal::backdrop,
#video-modal::backdrop {
  background: rgba(16, 32, 30, 0.45);
}

.modal-card {
  position: relative;
  display: grid;
  gap: 0.75rem;
  max-height: calc(100vh - 2rem);
  overflow: auto;
  padding: 1.2rem;
  border-radius: 24px;
  background: var(--paper);
}

.modal-card h2 {
  font-size: 1.5rem;
  padding-right: 2.2rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

.form-error {
  color: #9b2c2c;
  font-weight: 700;
}

.stack-form {
  display: grid;
  gap: 0.75rem;
}

.member-list {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.member-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
}

.option-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.45rem;
}

.option-extra,
.yt-row,
.day-time {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.option-extra {
  grid-column: 1 / -1;
}

.day-times {
  display: grid;
  gap: 0.45rem;
}

.day-time span {
  flex: 1;
}

.yt-row input {
  flex: 1;
  min-width: 12rem;
}

.option-row input[type="text"] {
  min-height: 44px;
  padding: 0 0.8rem;
  border: 1px solid #d9d3c6;
  border-radius: 12px;
  font: inherit;
}

.question-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
}

.lesson-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.4rem;
}

.lesson-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
}

.lesson-index {
  display: grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: #e7f2f0;
  color: var(--brand);
  font-size: 0.82rem;
  font-weight: 800;
}

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

.lesson-main strong,
.lesson-main .hint {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lesson-main .hint {
  margin: 0;
}

.lesson-row .row-actions {
  flex-wrap: nowrap;
}

.pick-list {
  display: grid;
  align-content: start;
  gap: 0.35rem;
  min-height: 16rem;
  max-height: min(62vh, 560px);
  overflow: auto;
}

.pick-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-weight: 700;
}

.pick-item[hidden] {
  display: none;
}

.pick-item:has(input:checked) {
  border-color: var(--brand);
  background: #e7f2f0;
}

#modal.is-desk {
  width: min(920px, calc(100% - 1.5rem));
}

.desk-block {
  display: grid;
  gap: 0.7rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.desk-block h3 {
  margin: 0;
}

.desk-block .card-list {
  grid-template-columns: 1fr;
}

#modal.is-pick {
  width: min(760px, calc(100% - 1.5rem));
}

.lesson {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding-top: 0.55rem;
  border-top: 1px solid var(--line);
}

.video-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 12px;
  background: #111;
}

#video-modal.is-pdf {
  width: min(960px, calc(100% - 1.5rem));
}

.pdf-frame {
  width: 100%;
  height: min(72vh, 760px);
  border: 0;
  border-radius: 12px;
  background: #fff;
}

.question-image {
  max-width: 280px;
  border-radius: 12px;
}

.option-view {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding-left: 1.2rem;
}

.option-view .is-correct {
  font-weight: 800;
  color: var(--brand);
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 70;
  max-width: min(360px, calc(100% - 2rem));
  margin: 0;
  padding: 0.8rem 1rem;
  border-radius: 14px;
  background: #102622;
  color: #fff;
  font-weight: 700;
}

.group-board {
  display: grid;
  gap: 1rem;
}

.group-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 100%;
  padding: 1.15rem;
  border: 1px solid var(--brand);
  border-radius: 18px;
  background: linear-gradient(180deg, #f3faf8 0%, #fffdf8 100%);
  box-shadow: var(--shadow);
}

.group-card p {
  color: var(--muted);
}

.group-card .group-note {
  margin: 0;
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  background: var(--gold-soft);
  color: var(--ink);
  font-weight: 700;
}

.group-card .group-fee {
  margin: 0;
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  background: #e7f2f0;
  color: var(--brand-deep);
}

.group-card .group-fee strong {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--brand);
  font-size: 1.15rem;
}

.group-card .btn {
  align-self: flex-start;
  margin-top: auto;
}

.apply-dialog {
  width: min(480px, calc(100% - 1.5rem));
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: transparent;
}

.apply-dialog::backdrop {
  background: rgba(16, 32, 30, 0.45);
}

.apply-success-card {
  border-color: #b7dfc4;
  background: #f4fbf6;
}

.apply-success {
  color: #146c3a;
  font-weight: 700;
}

.nav a.nav-login {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
}

.nav a.nav-login::after {
  display: none;
}

.empty-note {
  color: var(--muted);
}

@media (min-width: 720px) {
  .group-board,
  .card-list {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 981px) {
  .group-board {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 720px) {
  .lesson-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .lesson-row .row-actions {
    grid-column: 1 / -1;
    flex-wrap: wrap;
  }
}

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

  .side {
    position: fixed;
    z-index: 50;
    inset: 0 auto 0 0;
    width: min(280px, 86vw);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }

  body.side-open .side {
    transform: none;
  }

  .work-bar .menu-toggle {
    display: inline-flex;
  }

  .toolbar .btn {
    margin-left: 0;
  }

  .option-row,
  .lesson {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }
}
