:root {
  font-family:system-ui,-apple-system,"Segoe UI",sans-serif;
  color:#17324d;
  background:#f1f5f8;
  font-size:16px;
  color-scheme:light;
}

* {
  box-sizing:border-box;
}

[hidden] {
  display:none!important;
}

body {
  margin:0;
}

header,main {
  max-width:1120px;
  margin:auto;
  padding:24px;
}

header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  border-bottom:1px solid #d9e2eb;
}

a {
  color:#16657a;
}

.brand {
  font-size:1.25rem;
  font-weight:750;
  text-decoration:none;
}

h1 {
  font-size:clamp(1.7rem,5vw,2.3rem);
  margin:0;
}

h2 {
  font-size:1.3rem;
  margin:0;
  overflow-wrap:anywhere;
}

.heading {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  flex-wrap:wrap;
  margin-bottom:20px;
}

button,.button {
  font:inherit;
  min-height:44px;
  border:1px solid transparent;
  border-radius:9px;
  padding:10px 16px;
  background:#16677a;
  color:white;
  cursor:pointer;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
}

button:disabled {
  opacity:.6;
  cursor:wait;
}

.secondary {
  color:#17324d;
  background:white;
  border-color:#b8cbdc;
}

button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible {
  outline:3px solid #db9d34;
  outline-offset:3px;
}

label {
  display:flex;
  flex-direction:column;
  gap:7px;
  margin-bottom:16px;
}

input,select,textarea {
  font:inherit;
  width:100%;
  min-width:0;
  border:1px solid #b8cbdc;
  border-radius:9px;
  background:white;
  color:inherit;
  padding:11px;
  min-height:44px;
}

textarea {
  resize:vertical;
}

.filters {
  display:flex;
  align-items:end;
  gap:16px;
  flex-wrap:wrap;
  padding:20px;
  border:1px solid #d9e2eb;
  background:white;
  border-radius:14px;
  margin:20px 0;
}

.filters label {
  flex:1;
  min-width:180px;
  margin:0;
}

.lessons {
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(min(100%,300px),1fr));
  gap:18px;
}

.lesson {
  background:white;
  border:1px solid #d9e2eb;
  border-radius:14px;
  padding:22px;
  display:flex;
  flex-direction:column;
  gap:16px;
  min-width:0;
}

.lesson p {
  margin:0;
}

.lesson .open {
  margin-top:auto;
  align-self:start;
}

.lesson h2 {
  line-height:1.4;
}

.muted,small {
  color:#526777;
  line-height:1.5;
}

.lesson-meta {
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  font-size:.85rem;
}

.badge {
  padding:4px 8px;
  background:#edf3f7;
  border-radius:6px;
}

.draft {
  background:#fff1d6;
  color:#79541d;
}

.lesson-actions {
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  border-top:1px solid #e3eaf0;
  padding-top:14px;
}

.lesson-actions button {
  font-size:.9rem;
}

.empty {
  background:white;
  padding:32px;
  border:1px solid #d9e2eb;
  border-radius:14px;
  grid-column:1/-1;
}

.error {
  color:#a42b24;
}

.instructions {
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  line-height:1.7;
  margin:20px 0;
}

.form-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:16px;
}

.actions {
  display:flex;
  justify-content:flex-end;
  gap:12px;
  flex-wrap:wrap;
}

fieldset {
  border:1px solid #c7d5e1;
  border-radius:9px;
  padding:14px;
  margin:0 0 20px;
}

.checks {
  display:flex;
  gap:18px;
  flex-wrap:wrap;
}

.check {
  display:flex;
  flex-direction:row;
  align-items:center;
  gap:8px;
  margin:0;
}

.check input {
  width:20px;
  min-height:20px;
  height:20px;
}

dialog {
  width:min(800px,calc(100% - 24px));
  max-height:calc(100dvh - 32px);
  padding:26px;
  border:1px solid #c7d5e1;
  border-radius:16px;
  color:#17324d;
  overflow:auto;
}

dialog::backdrop {
  background:#142d46aa;
}

iframe {
  width:100%;
  aspect-ratio:16/9;
  border:0;
  border-radius:9px;
  background:#172f45;
}

video {
  width:100%;
  max-height:65dvh;
  background:#172f45;
  border-radius:9px;
}

.training-picture {
  display:block;
  max-width:100%;
  max-height:65dvh;
  margin:auto;
  object-fit:contain;
  border-radius:9px;
}

.preview {
  line-height:1.6;
  overflow-wrap:anywhere;
}

.viewer-loading {
  padding:24px;
}

#source {
  margin-top:12px;
}

#notice:empty {
  display:none;
}

@media(max-width:540px) {
  header,main {
    padding:18px;
  }

  header {
    font-size:.9rem;
  }

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

  dialog {
    padding:20px;
  }

  .filters {
    padding:16px;
  }

  .filters label {
    min-width:100%;
  }

  .heading button {
    flex-shrink:0;
  }

}
