:root {
  color-scheme: dark;
  --bg: #07100e;
  --panel: #101a17;
  --panel-2: #14231e;
  --line: #2ab16f;
  --line-soft: rgba(42, 177, 111, 0.36);
  --text: #f2fbf7;
  --muted: #a8bbb3;
  --faint: #607168;
  --danger: #ff8b8b;
  --warn: #f2c96d;
  --radius: 8px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.32);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(42, 177, 111, 0.12), transparent 34rem),
    linear-gradient(135deg, #07100e 0%, #111817 48%, #07100e 100%);
  color: var(--text);
}

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

button {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: #172520;
  color: var(--text);
  min-height: 2.65rem;
  padding: 0.65rem 0.9rem;
  cursor: pointer;
}

button:hover {
  border-color: var(--line);
  background: #1b3028;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

button:disabled:hover {
  border-color: var(--line-soft);
  background: #172520;
}

button.primary {
  background: var(--line);
  color: #04100b;
  border-color: var(--line);
  font-weight: 750;
}

button.ghost {
  background: transparent;
}

button.danger {
  border-color: rgba(255, 139, 139, 0.72);
  color: #ffd5d5;
  background: rgba(94, 20, 20, 0.34);
}

button.danger:hover {
  border-color: var(--danger);
  background: rgba(132, 28, 28, 0.48);
}

button.icon {
  width: 2.75rem;
  padding: 0;
  font-size: 1.3rem;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: var(--radius);
  background: #0c1512;
  color: var(--text);
  min-height: 2.65rem;
  padding: 0.7rem 0.8rem;
}

textarea {
  min-height: 7rem;
  resize: vertical;
}

label {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.9rem;
}

a {
  color: #7ef0ad;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  height: 5.4rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.1rem;
  border-bottom: 1px solid rgba(42, 177, 111, 0.26);
  background: rgba(7, 16, 14, 0.82);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.brand img {
  width: 3.8rem;
  height: 3.8rem;
  object-fit: contain;
}

.brand-small {
  color: var(--line);
  font-size: 0.88rem;
  font-weight: 750;
  line-height: 1;
}

.brand-title {
  font-size: clamp(1.35rem, 4vw, 2rem);
  line-height: 1.05;
  font-weight: 850;
  letter-spacing: 0;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.sidebar {
  position: fixed;
  inset: 5.4rem auto 0 0;
  width: min(21rem, 86vw);
  background: #0c1512;
  border-right: 1px solid var(--line-soft);
  padding: 1rem;
  transform: translateX(-105%);
  transition: transform 0.2s ease;
  z-index: 9;
  overflow: auto;
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-title {
  color: var(--muted);
  margin: 1rem 0 0.5rem;
  font-size: 0.82rem;
  text-transform: uppercase;
}

.side-link {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  margin-bottom: 0.55rem;
}

.main {
  width: min(70rem, calc(100vw - 1.5rem));
  margin: 0 auto;
  padding: 1.5rem 0 4rem;
}

.narrow {
  width: min(34rem, calc(100vw - 1.5rem));
}

.hero-login {
  min-height: calc(100vh - 9rem);
  display: grid;
  align-items: center;
}

.surface {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(16, 26, 23, 0.9);
  box-shadow: var(--shadow);
}

.login-panel {
  padding: clamp(1rem, 5vw, 2rem);
}

.stack {
  display: grid;
  gap: 1rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

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

.page-title {
  margin: 0 0 1rem;
  font-size: clamp(1.7rem, 4vw, 2.75rem);
  letter-spacing: 0;
}

.subtle {
  color: var(--muted);
}

.error {
  color: var(--danger);
}

.success {
  color: #89efb3;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
}

.card,
.module-card,
.course-row,
.print-card {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  background: rgba(20, 35, 30, 0.82);
}

.card {
  padding: 1rem;
}

.back-button {
  width: fit-content;
  min-height: 2.2rem;
  padding: 0.45rem 0.7rem;
}

.template-card {
  text-align: left;
}

.foreign-template {
  border-color: rgba(255, 96, 96, 0.9);
}

.foreign-template:hover {
  border-color: #ff8b8b;
}

.card.compact {
  margin-bottom: 1rem;
  display: grid;
  gap: 0.35rem;
}

.module-card {
  min-height: 7.8rem;
  padding: 1rem;
  display: grid;
  gap: 0.65rem;
  align-content: space-between;
  text-align: left;
}

.module-card.available {
  border-color: var(--line-soft);
}

.module-card.locked {
  opacity: 0.48;
  cursor: not-allowed;
}

.module-card strong,
.card strong {
  display: block;
  font-size: 1.15rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 1.75rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: rgba(42, 177, 111, 0.13);
  border: 1px solid var(--line-soft);
  color: #95efba;
  font-size: 0.82rem;
}

.content-viewer {
  display: grid;
  gap: 1rem;
}

.media-box {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  overflow: hidden;
  background: #060b0a;
}

.media-box img,
.media-box video,
.media-box audio,
.media-box iframe {
  display: block;
  width: 100%;
}

.media-box img {
  height: auto;
}

.media-box video {
  max-height: 70vh;
}

.media-box iframe {
  min-height: 70vh;
  border: 0;
}

.file-link {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  color: var(--text);
  text-decoration: none;
}

.file-kind {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.8rem;
}

.course-row {
  padding: 1rem;
  display: grid;
  gap: 0.75rem;
}

.content-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.content-controls {
  justify-content: flex-end;
}

.user-form {
  text-align: left;
}

.inline-check {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 0.5rem;
  width: fit-content;
}

.inline-check input {
  width: 1.2rem;
  min-height: 1.2rem;
}

.date-list {
  display: grid;
  gap: 0.75rem;
}

.date-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 11rem;
  gap: 0.75rem;
  align-items: end;
}

.admin-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1rem;
}

.admin-actions button {
  min-height: 7rem;
  text-align: left;
  padding: 1rem;
}

.qr-box {
  width: 12rem;
  aspect-ratio: 1;
  border: 8px solid #fff;
  background: #fff;
}

.qr-box img {
  width: 100%;
  height: 100%;
  display: block;
}

.print-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1.25rem;
  padding: 1rem;
  background: #fff;
  color: #101010;
}

.print-card h2,
.print-card p {
  margin: 0;
}

.hidden {
  display: none !important;
}

.legal-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.65rem;
  padding: 1rem;
  color: var(--muted);
  border-top: 1px solid rgba(42, 177, 111, 0.18);
}

.legal-footer a {
  color: var(--muted);
  text-decoration: none;
}

.legal-footer a:hover {
  color: #7ef0ad;
}

.legal-page {
  width: min(58rem, calc(100vw - 1.5rem));
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
}

.legal-document {
  display: grid;
  gap: 1.25rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(16, 26, 23, 0.9);
  box-shadow: var(--shadow);
  padding: clamp(1rem, 4vw, 2rem);
}

.legal-back {
  width: fit-content;
  color: #7ef0ad;
  text-decoration: none;
}

.legal-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  border-bottom: 1px solid rgba(42, 177, 111, 0.24);
  padding-bottom: 1rem;
}

.legal-header img {
  width: 4.3rem;
  height: 4.3rem;
  object-fit: contain;
}

.legal-content {
  display: grid;
  gap: 1.25rem;
  line-height: 1.65;
}

.legal-content h2,
.legal-content p {
  margin: 0;
}

.legal-content h2 {
  font-size: 1.05rem;
}

.legal-content ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

@media (max-width: 680px) {
  .topbar {
    height: 4.8rem;
    padding: 0 0.75rem;
  }

  .brand img {
    width: 3.1rem;
    height: 3.1rem;
  }

  .sidebar {
    inset-block-start: 4.8rem;
  }

  .split,
  .date-item,
  .content-row,
  .print-card {
    grid-template-columns: 1fr;
  }

  .topbar-actions .ghost.optional {
    display: none;
  }

  .legal-header {
    align-items: flex-start;
  }

  .legal-header img {
    width: 3.2rem;
    height: 3.2rem;
  }
}

@media print {
  body {
    background: #fff;
    color: #000;
  }

  .topbar,
  .sidebar,
  .no-print,
  .main > *:not(.print-only) {
    display: none !important;
  }

  .main,
  .print-only {
    display: block !important;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .print-card {
    box-shadow: none;
    border: 2px solid #000;
  }
}
