:root {
  --bg: #f4f6f3;
  --surface: #ffffff;
  --surface-soft: #f9faf7;
  --ink: #17202a;
  --muted: #667085;
  --line: #d9e0dd;
  --brand: #246b5f;
  --brand-dark: #17483f;
  --accent: #c76a2c;
  --blue: #2d6cdf;
  --success-bg: #dff6e8;
  --success: #116033;
  --warning-bg: #fff0c2;
  --warning: #8a5200;
  --muted-bg: #e8ecef;
  --danger-bg: #fee4e2;
  --danger: #9f1f17;
  --shadow: 0 18px 45px rgba(23, 32, 42, 0.09);
  --shadow-soft: 0 10px 24px rgba(23, 32, 42, 0.06);
  --radius: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Nirmala UI", "Iskoola Pota", "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
}

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

.app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  padding: 28px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(217, 224, 221, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.public-hero {
  position: relative;
  overflow: hidden;
  min-height: 0;
  align-items: flex-start;
  padding: 22px 24px;
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.topbar > * {
  position: relative;
  z-index: 1;
}

.topbar h1 {
  max-width: 760px;
  margin-top: 4px;
  font-size: clamp(25px, 4vw, 38px);
  line-height: 1.08;
  letter-spacing: 0;
}

.topbar p {
  max-width: 760px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
}

.public-hero p {
  color: var(--muted);
}

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

.public-hero .eyebrow {
  color: var(--brand);
}

.hero-points {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.hero-points span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

main {
  display: grid;
  gap: 22px;
}

.panel,
.process-strip,
.metric-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.panel {
  padding: 26px;
}

.chooser-panel {
  padding-bottom: 28px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

h2 {
  color: var(--ink);
  font-size: clamp(22px, 3vw, 28px);
  line-height: 1.15;
}

.section-note {
  max-width: 620px;
  margin-top: 7px;
  color: var(--muted);
}

.pill,
.status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.pill {
  background: var(--success-bg);
  color: var(--success);
}

#lessons-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.choice-button {
  display: flex;
  min-height: 74px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  padding: 16px;
  background: #ffffff;
  border: 1px solid #cbd6d2;
  border-radius: var(--radius);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.choice-button:hover,
.choice-button:focus-visible {
  border-color: rgba(36, 107, 95, 0.55);
  box-shadow: 0 12px 26px rgba(23, 32, 42, 0.08);
  transform: translateY(-1px);
  outline: none;
}

.choice-button span {
  color: var(--ink);
  font-size: 18px;
  font-weight: 850;
}

.choice-button small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.lesson-search {
  margin-bottom: 16px;
}

.slide-in {
  animation: sectionSlideIn 0.24s ease both;
}

@keyframes sectionSlideIn {
  from {
    opacity: 0;
    transform: translateX(14px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.lesson-card {
  position: relative;
  width: 100%;
  min-height: 188px;
  padding: 18px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.lesson-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 18px;
  right: 18px;
  height: 4px;
  background: var(--accent);
  border-radius: 0 0 4px 4px;
  opacity: 0.75;
}

.lesson-card:hover,
.lesson-card.selected {
  border-color: rgba(36, 107, 95, 0.55);
  background: #ffffff;
  box-shadow: 0 18px 36px rgba(36, 107, 95, 0.14);
  transform: translateY(-2px);
}

.lesson-card.selected {
  outline: 3px solid rgba(36, 107, 95, 0.14);
}

.lesson-subject {
  display: inline-flex;
  margin: 8px 0 12px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 900;
}

.lesson-title {
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 850;
  line-height: 1.2;
}

.lesson-description {
  min-height: 48px;
  margin-bottom: 16px;
  color: #566475;
}

.lesson-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: #6b7280;
  font-size: 14px;
  font-weight: 800;
}

.lesson-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  background: #ffffff;
  border: 1px solid #e0e7e4;
  border-radius: 999px;
}

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

#recording-request-form .form-group {
  margin-bottom: 0;
}

#recording-request-form .form-group:first-child,
#recording-request-form .form-group:has(.checkbox-label),
#recording-request-form .btn-submit {
  grid-column: 1 / -1;
}

.form-group,
.form-row {
  margin-bottom: 16px;
}

label {
  display: block;
  margin-bottom: 7px;
  color: #263342;
  font-size: 14px;
  font-weight: 800;
}

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="url"],
input[type="password"],
textarea,
select,
input[type="search"] {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  background: #ffffff;
  border: 1px solid #cbd6d2;
  border-radius: 7px;
  color: #111827;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(36, 107, 95, 0.12);
  outline: none;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(480px, 100%);
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-copy {
  margin-bottom: 20px;
}

.auth-copy h1 {
  margin-top: 6px;
  color: var(--ink);
  font-size: clamp(28px, 6vw, 40px);
  line-height: 1.08;
}

.auth-copy p {
  margin-top: 10px;
  color: var(--muted);
}

.stacked-form {
  display: grid;
  gap: 16px;
}

.stacked-form .form-row {
  margin-bottom: 0;
}

.auth-links {
  margin-top: 18px;
  text-align: center;
}

.auth-links a {
  color: var(--brand);
  font-weight: 850;
}

.login-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 18px;
  padding: 6px;
  background: #eef2f1;
  border-radius: var(--radius);
}

.login-tabs a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 10px;
  border-radius: 7px;
  color: #475569;
  font-weight: 850;
  text-align: center;
  text-decoration: none;
}

.login-tabs a.active {
  background: #ffffff;
  color: var(--brand-dark);
  box-shadow: 0 8px 18px rgba(23, 32, 42, 0.08);
}

.form-help {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

input[readonly] {
  background: #eef4f1;
  color: var(--brand-dark);
  font-weight: 800;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  background: #f8faf9;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  margin-top: 2px;
  accent-color: var(--brand);
}

.btn-submit,
.btn-secondary,
.btn-light {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 12px 18px;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 850;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn-submit {
  width: 100%;
  background: var(--brand);
  color: #ffffff;
  box-shadow: 0 10px 18px rgba(36, 107, 95, 0.18);
}

.btn-submit:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
}

.btn-submit:disabled {
  background: #94a3b8;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  flex: 0 0 auto;
  background: #ffffff;
  color: var(--brand-dark);
}

.topbar:not(.public-hero) .btn-secondary {
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.btn-light {
  background: #eef2f1;
  color: #334155;
}

.btn-secondary:hover,
.btn-light:hover {
  box-shadow: 0 8px 18px rgba(23, 32, 42, 0.08);
  transform: translateY(-1px);
}

.top-actions,
.button-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.button-row .btn-submit,
.button-row .btn-light,
.access-form .btn-submit,
.access-form .btn-light {
  width: auto;
}

.process-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
}

.process-strip div {
  padding: 20px;
  border-right: 1px solid var(--line);
}

.process-strip div:last-child {
  border-right: 0;
}

.process-strip strong,
.process-strip span {
  display: block;
}

.process-strip strong {
  margin-bottom: 7px;
  color: var(--ink);
}

.process-strip span {
  color: var(--muted);
  font-size: 14px;
}

.success-message,
.error-message {
  padding: 14px 16px;
  border-radius: 7px;
  margin-top: 16px;
  font-weight: 800;
}

.success-message {
  background: var(--success-bg);
  border: 1px solid #9fe1b8;
  color: var(--success);
}

.error-message {
  background: var(--danger-bg);
  border: 1px solid #f6a6a0;
  color: var(--danger);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.82fr) minmax(420px, 1.18fr);
  gap: 22px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.metric-card {
  min-height: 124px;
  padding: 20px;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 14px;
  font-weight: 850;
}

.metric-card strong {
  display: block;
  margin-top: 13px;
  color: var(--ink);
  font-size: 40px;
  line-height: 1;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(250px, 390px) 190px;
  gap: 10px;
}

.request-cards {
  display: grid;
  gap: 14px;
}

.request-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.request-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.request-main h3 {
  margin-top: 4px;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.25;
}

.student-grid {
  display: grid;
  grid-template-columns: 1fr 0.85fr 1.1fr 0.85fr;
  gap: 14px;
  margin-bottom: 16px;
}

.student-grid > div {
  min-width: 0;
  padding: 12px;
  background: #ffffff;
  border: 1px solid #e4ebe7;
  border-radius: 7px;
}

.student-grid span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.student-grid strong,
.student-grid small {
  display: block;
}

.student-grid strong {
  color: #1f2937;
  overflow-wrap: anywhere;
}

.student-recordings {
  display: grid;
  gap: 14px;
}

.recording-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 18px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.recording-card h3 {
  margin-top: 4px;
  color: var(--ink);
  font-size: 20px;
}

.recording-card p {
  margin-top: 6px;
  color: #566475;
}

.recording-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 800;
}

.recording-card .btn-submit {
  width: auto;
  white-space: nowrap;
}

.student-grid small {
  color: var(--muted);
}

.payment-form {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

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

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

.lesson-list-table {
  display: grid;
  gap: 12px;
}

.compact-lesson {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.compact-lesson h3 {
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.25;
}

.compact-lesson p {
  color: #566475;
  font-size: 14px;
}

.compact-lesson span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.compact-lesson a {
  align-self: flex-start;
  color: var(--blue);
  font-size: 14px;
  font-weight: 850;
  white-space: nowrap;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
}

th,
td {
  padding: 14px;
  border-bottom: 1px solid #e6ece9;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f7faf8;
  color: #475569;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

td small {
  color: var(--muted);
}

.status.success {
  background: var(--success-bg);
  color: var(--success);
}

.status.warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.status.muted {
  background: var(--muted-bg);
  color: #475569;
}

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

@media (max-width: 980px) {
  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

@media (max-width: 820px) {
  .app-shell {
    padding: 14px;
  }

  .topbar,
  .section-heading,
  .request-main,
  .recording-card,
  .compact-lesson {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    padding: 18px;
  }

  .public-hero {
    min-height: 0;
  }

  .top-actions,
  .button-row {
    width: 100%;
  }

  .top-actions .btn-secondary,
  .button-row .btn-submit,
  .button-row .btn-light,
  .recording-card .btn-submit {
    flex: 1 1 160px;
    width: 100%;
  }

  .admin-grid,
  .metric-grid,
  .process-strip,
  .two-columns,
  .filter-bar,
  .student-grid,
  #recording-request-form {
    grid-template-columns: 1fr;
  }

  .choice-grid,
  #lessons-list {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 18px;
  }

  .process-strip div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .process-strip div:last-child {
    border-bottom: 0;
  }

  .lesson-card {
    min-height: 0;
  }

  .lesson-description {
    min-height: 0;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 10px;
  }

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

  .hero-points,
  .top-actions,
  .button-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .btn-submit,
  .btn-secondary,
  .btn-light {
    width: 100%;
  }

  .metric-card {
    min-height: 96px;
  }

  .metric-card strong {
    font-size: 34px;
  }

  .table-wrap {
    border: 0;
    overflow: visible;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  thead {
    display: none;
  }

  tr {
    margin-bottom: 12px;
    padding: 14px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }

  td {
    padding: 8px 0;
    border-bottom: 1px solid #edf1ef;
  }

  td:last-child {
    border-bottom: 0;
  }
}
