:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-soft: #f2f7f5;
  --ink: #202323;
  --muted: #69716f;
  --line: #dfe5e1;
  --brand: #176f63;
  --brand-dark: #0f4c45;
  --accent: #c77f2f;
  --danger: #a63d40;
  --shadow: 0 18px 60px rgba(28, 41, 38, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: Arial, Helvetica, sans-serif;
}

a {
  color: inherit;
}

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

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 480px);
  min-height: 100vh;
}

.brand-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 48px;
  padding: clamp(32px, 6vw, 80px);
  background:
    linear-gradient(rgb(255 255 255 / 8%), rgb(245 255 253 / 82%)),
    url("/img/logo.png") center/cover;
  color: #352d2d;
}

.brand-panel h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(48px, 8vw, 96px);
  line-height: 0.95;
  letter-spacing: 0;
}

.lead {
  max-width: 620px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 20px;
  line-height: 1.5;
}

.login-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.login-hints span,
.count-pill {
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  padding: 8px 12px;
  color: inherit;
  background: rgba(255, 255, 255, 0.12);
}

.login-panel {
  display: grid;
  place-items: center;
  padding: 32px;
}

.form-card,
.panel-form,
.module-card,
.lesson-card,
.student-lesson {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.form-card {
  width: min(100%, 420px);
  padding: 28px;
  box-shadow: var(--shadow);
}

.form-card h2,
.panel-form h2,
.section-title h2,
.student-heading h2 {
  margin: 0;
}

label {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  color: var(--ink);
  background: white;
}

textarea {
  resize: vertical;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn,
.icon-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 700;
}

.primary-btn {
  width: 100%;
  margin-top: 22px;
  color: white;
  background: #da3e48;
}

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

.secondary-btn {
  color: white;
  background: var(--accent);
}

.ghost-btn {
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--surface);
}

.danger-btn,
.icon-danger {
  color: white;
  background: var(--danger);
}

.form-message,
.muted {
  min-height: 22px;
  color: var(--muted);
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  padding: 18px clamp(18px, 4vw, 44px);
  background: rgba(246, 244, 239, 0.94);
  backdrop-filter: blur(12px);
}

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

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.file-action {
  position: relative;
  overflow: hidden;
}

.file-action input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.app-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 24px;
  padding: 24px clamp(18px, 4vw, 44px) 48px;
}

.sidebar {
  align-self: start;
}

.panel-form {
  padding: 22px;
}

.content-area,
.lesson-view {
  min-width: 0;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-title.compact {
  margin-bottom: 12px;
}

.count-pill {
  border-color: var(--line);
  color: var(--brand-dark);
  background: var(--surface-soft);
}

.module-list,
.lesson-list,
.student-lessons {
  display: grid;
  gap: 16px;
}

.module-card {
  padding: 22px;
}

.module-header,
.lesson-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.module-header h3,
.lesson-header h4,
.student-lesson h3 {
  margin: 0 0 6px;
}

.module-header p,
.lesson-header p,
.student-heading p,
.student-lesson p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.lesson-card {
  padding: 16px;
  background: var(--surface-soft);
}

.inline-form,
.material-form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) auto;
  gap: 10px;
  margin-bottom: 14px;
}

.material-form {
  grid-template-columns: minmax(160px, 1fr) 130px minmax(160px, 1fr) auto;
}

.materials {
  display: grid;
  gap: 10px;
}

.material-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 90px auto auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: white;
}

.material-row strong,
.student-material strong {
  color: var(--brand-dark);
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 28px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.56);
}

.student-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 24px;
  padding: 24px clamp(18px, 4vw, 44px) 48px;
}

.module-nav {
  align-self: start;
}

.module-nav-btn {
  display: grid;
  gap: 5px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 10px;
  padding: 14px;
  text-align: left;
  color: var(--ink);
  background: white;
  cursor: pointer;
}

.module-nav-btn span {
  color: var(--muted);
}

.module-nav-btn.active {
  border-color: var(--brand);
  background: var(--surface-soft);
}

.student-heading {
  margin-bottom: 18px;
}

.student-lesson {
  display: grid;
  gap: 18px;
  padding: 22px;
}

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

.student-material {
  display: grid;
  gap: 6px;
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  text-decoration: none;
  background: var(--surface-soft);
}

@media (max-width: 920px) {
  .login-shell,
  .app-layout,
  .student-shell {
    grid-template-columns: 1fr;
  }

  .brand-panel {
    min-height: 44vh;
  }

  .inline-form,
  .material-form,
  .material-row {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 560px) {
  .login-panel,
  .app-layout,
  .student-shell {
    padding-left: 14px;
    padding-right: 14px;
  }

  .brand-panel {
    padding: 28px 20px;
  }

  .top-actions,
  .ghost-btn,
  .danger-btn {
    width: 100%;
  }
}
