:root {
  color-scheme: light;
  --paper: #f5f5f0;
  --white: #fff;
  --ink: #18372e;
  --muted: #566a61;
  --line: #dce3da;
  --green: #205943;
  --soft: #e7eee5;
  --red: #a12727;
  --gold: #d8eb97;
  font:
    16px/1.55 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
button:disabled {
  opacity: 0.6;
  cursor: wait;
}
a {
  color: var(--green);
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #749a36;
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: clamp(28px, 3.2vw, 43px);
  line-height: 1.18;
  letter-spacing: -0.035em;
  font-weight: 650;
  margin-bottom: 14px;
}
h2 {
  font-size: 25px;
  line-height: 1.25;
  letter-spacing: -0.025em;
}
h3 {
  font-size: 19px;
  line-height: 1.35;
  margin-bottom: 9px;
}
p {
  margin-bottom: 16px;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 13px;
}
.eyebrow {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 15px;
}
.brand {
  font-size: 17px;
  letter-spacing: -0.025em;
  font-weight: 750;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mark {
  width: 29px;
  height: 29px;
  display: inline-grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 17px;
}
.button {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 9px;
  min-height: 44px;
  padding: 10px 17px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition:
    background 0.18s,
    transform 0.18s;
}
.button:hover {
  background: var(--soft);
}
.button.primary {
  background: var(--green);
  border-color: var(--green);
  color: var(--white);
}
.button.primary:hover {
  background: #164530;
}
.button.danger {
  color: var(--red);
}
.button.ghost {
  background: transparent;
  border-color: transparent;
}
.button.full {
  width: 100%;
}
.login {
  min-height: 100svh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.login-story {
  background: var(--green);
  color: #f4f6e8;
  padding: 48px 9%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.login-story h1 {
  font-size: clamp(40px, 5vw, 74px);
  max-width: 550px;
  margin: 70px 0 25px;
}
.login-story p {
  max-width: 360px;
  color: #d2e0d4;
}
.story-bottom {
  font-size: 13px;
  border-top: 1px solid #668472;
  padding-top: 20px;
  margin-top: 70px;
}
.orbit {
  align-self: flex-end;
  width: 170px;
  height: 170px;
  border: 1px solid #8caa7d;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 25px 0;
}
.orbit span {
  font-size: 76px;
  font-weight: 300;
  color: var(--gold);
}
.login-form-wrap {
  display: grid;
  place-items: center;
  padding: 48px 28px;
}
.login-form {
  width: 100%;
  max-width: 370px;
}
.login-form h2 {
  font-size: 30px;
}
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 17px;
}
label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 14px;
  font-weight: 550;
}
input,
select,
textarea {
  border: 1px solid #b8c6b9;
  background: var(--white);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
  min-width: 0;
  width: 100%;
  font-size: 16px;
}
textarea {
  resize: vertical;
  min-height: 105px;
}
input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--green);
}
input[type="file"] {
  font-size: 14px;
}
input[type="checkbox"] + span {
  font-weight: 400;
}
.check-label {
  flex-direction: row;
  align-items: center;
  min-height: 44px;
}
.error {
  color: var(--red);
  font-size: 14px;
  margin-top: 14px;
}
.topbar {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 36px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.top-right {
  display: flex;
  align-items: center;
  gap: 18px;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--soft);
  display: grid;
  place-items: center;
  font-weight: 650;
}
.shell {
  display: grid;
  grid-template-columns: 218px 1fr;
  min-height: calc(100svh - 80px);
}
.sidebar {
  background: var(--white);
  border-right: 1px solid var(--line);
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar .button {
  justify-content: flex-start;
}
.sidebar .active {
  background: var(--soft);
  border-color: transparent;
}
.sidebar-bottom {
  margin-top: auto;
  padding: 45px 13px 0;
  color: var(--muted);
  font-size: 12px;
}
.workspace {
  padding: 42px clamp(20px, 4vw, 60px);
  min-width: 0;
  max-width: 1600px;
  width: 100%;
  margin: auto;
}
.intro {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  align-items: flex-start;
  margin-bottom: 32px;
}
.intro p {
  max-width: 520px;
}
.badge {
  display: inline-flex;
  align-items: center;
  background: var(--soft);
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}
.badge.locked {
  background: #eee9df;
  color: #685636;
}
.badge.draft {
  background: #eee9df;
  color: #685636;
}
.course-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.course-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--white);
  display: flex;
  flex-direction: column;
}
.course-art {
  height: 150px;
  background: #e2e9dd;
  position: relative;
  padding: 20px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  color: var(--green);
  overflow: hidden;
}
.course-art .art-symbol {
  font-size: 100px;
  line-height: 1;
  font-weight: 250;
  position: absolute;
  right: 20px;
  top: 8px;
  opacity: 0.55;
}
.course-art .art-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  z-index: 1;
}
.course-card[data-kind="purchase"] .course-art {
  background: #e8e7da;
}
.course-card[data-kind="workshop"] .course-art {
  background: #e0e8e8;
}
.course-content {
  padding: 22px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
}
.course-content h3 {
  margin: 5px 0;
}
.course-content p {
  font-size: 14px;
  color: var(--muted);
  flex: 1;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.course-content .button {
  width: 100%;
  margin-top: 12px;
}
.course-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}
.empty {
  border: 1px dashed #b8c6b9;
  border-radius: 14px;
  padding: 45px 28px;
  text-align: center;
  background: #ffffff80;
}
.empty h2 {
  margin-bottom: 10px;
}
.panel {
  background: var(--white);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 13px;
  min-width: 0;
  margin-bottom: 24px;
}
.panel h2 {
  font-size: 21px;
}
.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
.admin-grid .panel {
  margin-bottom: 0;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.spread {
  justify-content: space-between;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}
.item {
  border-bottom: 1px solid var(--line);
  padding: 17px 0;
  overflow-wrap: anywhere;
}
.item:last-child {
  border-bottom: 0;
}
.item p {
  margin: 4px 0 8px;
}
.list-heading {
  margin-top: 36px;
}
.course-heading {
  margin-top: 24px;
}
.course-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.lesson-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lesson-list .button {
  justify-content: flex-start;
  text-align: left;
  width: 100%;
  font-weight: 400;
}
.lesson-list .selected {
  background: var(--soft);
  border-color: #b8c6b9;
}
.lesson-content {
  white-space: normal;
  overflow-wrap: anywhere;
}
.lesson-content h2 {
  white-space: normal;
}
.lesson-content p { line-height: 1.75; margin: 0 0 18px; }
.lesson-content h3 { margin: 28px 0 12px; font-size: 20px; }
.lesson-content ul { padding-left: 24px; line-height: 1.75; }
.lesson-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0; }
.lesson-section { min-height: 160px; }
.lesson-picker { display: none; }
.lesson-editor { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); }
.lesson-editor summary, .course-editor-list summary { cursor: pointer; padding: 14px 0; font-weight: 600; }
.material-forms { display: grid; gap: 26px; margin-top: 20px; }
.material-card { margin-bottom: 18px; }
.material-card .attachment { margin-bottom: 10px; }
.pdf-viewer { padding: 14px; background: var(--paper); border-radius: 8px; }
.pdf-viewer canvas { display: block; width: 100%; height: auto; margin-top: 16px; background: white; }
.recording { padding: 20px; background: var(--paper); border-radius: 10px; }
.pdf-preview { width: 100%; height: 640px; border: 1px solid var(--line); border-radius: 8px; }
.video-embed { width: 100%; aspect-ratio: 16/9; border: 0; border-radius: 10px; background: #17241d; }
.recording { margin-bottom: 28px; }
.lesson-next { border-top: 1px solid var(--line); padding-top: 22px; margin-top: 26px; }
.course-layout .lesson-list { max-height: 80vh; overflow-y: auto; }
@media (max-width: 1100px) {
  .course-layout { grid-template-columns: 210px minmax(0,1fr); gap: 16px; }
}
@media (max-width: 760px) {
  .lesson-picker { display: grid; gap: 8px; margin: 0 0 18px; }
  .course-layout .lesson-list { display: none; }
  .pdf-preview { height: 480px; }
  .lesson-tabs .button { flex: 1 1 auto; font-size: 14px; }
}
.player {
  width: 100%;
  max-height: 520px;
  border-radius: 10px;
  background: #17241d;
  display: block;
  margin: 16px 0;
}
.audio {
  width: 100%;
  margin: 16px 0;
}
.attachment {
  padding: 18px;
  background: var(--paper);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 20px 0;
}
.notice {
  background: var(--soft);
  border-left: 3px solid var(--green);
  padding: 14px 18px;
  font-size: 14px;
  margin-bottom: 25px;
}
.table-wrap {
  overflow-x: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}
th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  font-weight: 600;
}
td {
  overflow-wrap: anywhere;
}
.loading {
  padding: 60px;
  text-align: center;
  color: var(--muted);
}
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--green);
  color: var(--white);
  border-radius: 9px;
  box-shadow: 0 4px 24px #10271c30;
  padding: 14px 23px;
  max-width: calc(100% - 32px);
  z-index: 10;
}
footer {
  font-size: 12px;
  color: var(--muted);
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
@media (min-width: 1500px) {
  .workspace {
    margin: 0 auto;
  }
}
@media (max-width: 1100px) {
  .course-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .shell {
    grid-template-columns: 185px 1fr;
  }
  .admin-grid {
    grid-template-columns: 1fr;
  }
  .workspace {
    padding: 30px 25px;
  }
}
@media (max-width: 760px) {
  .login {
    grid-template-columns: 1fr;
  }
  .login-story {
    padding: 28px;
  }
  .login-story h1 {
    font-size: 36px;
    margin: 35px 0 18px;
  }
  .login-story .orbit,
  .story-bottom {
    display: none;
  }
  .login-form-wrap {
    padding: 35px 24px;
  }
  .topbar {
    height: auto;
    min-height: 76px;
    padding: 18px 20px;
    flex-wrap: wrap;
  }
  .top-right {
    gap: 10px;
  }
  .top-right .user-name {
    display: none;
  }
  .shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .sidebar {
    padding: 12px 18px;
    flex-direction: row;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
    gap: 4px;
  }
  .sidebar-bottom {
    display: none;
  }
  .sidebar .button {
    font-size: 13px;
    padding: 9px 11px;
  }
  .workspace {
    padding: 28px 20px;
  }
  .intro {
    display: block;
    margin-bottom: 22px;
  }
  .course-grid {
    grid-template-columns: 1fr;
  }
  .course-art {
    height: 125px;
  }
  .course-layout {
    grid-template-columns: 1fr;
  }
  .lesson-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .field-row {
    grid-template-columns: 1fr;
  }
  .panel {
    padding: 20px;
  }
  .admin-grid {
    gap: 18px;
  }
  .course-content {
    padding: 20px;
  }
  .user-name {
    display: none;
  }
  .table-wrap {
    max-width: 100%;
  }
  h1 {
    font-size: 31px;
  }
}
@media (max-width: 380px) {
  .lesson-list {
    grid-template-columns: 1fr;
  }
  .top-right .avatar {
    display: none;
  }
  .topbar {
    gap: 10px;
  }
  .button {
    padding: 10px 13px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

.course-checklist { margin: 0; min-width: 0; border: 1px solid var(--line, #dce3df); border-radius: 12px; padding: 14px; display: grid; gap: 8px; }
.course-checklist legend { font-weight: 700; padding: 0 6px; }
.course-checklist .check-label { gap: 10px; }
.course-checklist input { flex-shrink: 0; }

/* ---------- Moja przestrzeń ---------- */
.space-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 22px;
  align-items: start;
}
.space-layout .lesson-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: none;
}
.space-layout .lesson-list .eyebrow {
  margin-bottom: 6px;
}
.space-layout .lesson-list .button {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}
.space-picker {
  display: grid;
  gap: 8px;
  margin: 0 0 18px;
}
.space-picker select {
  max-width: 420px;
}
.notebook-page .page-title {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 10px 0 12px;
}
.notebook-page .page-body {
  min-height: 55vh;
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 14px;
  font-family: inherit;
}
.version-preview {
  white-space: pre-wrap;
  font-size: 13px;
  background: var(--paper);
  padding: 10px 12px;
  border-radius: 8px;
  max-height: 200px;
  overflow: auto;
}
.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--red);
  margin-left: 6px;
  vertical-align: middle;
}
.comments {
  margin-top: 26px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.comment {
  background: var(--soft);
  border-left: 3px solid var(--green);
  padding: 10px 14px;
  margin-bottom: 10px;
  border-radius: 0 8px 8px 0;
}
.comment.unseen {
  border-left-color: var(--red);
}
.comments form {
  margin-top: 12px;
}
.board-toolbar {
  margin-bottom: 10px;
}
.board-toolbar select {
  width: auto;
  min-height: 44px;
  padding: 8px 10px;
}
.legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.legend-item::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: -1px;
  background: var(--sticky, #fff3a3);
}
.board-scroll {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 13px;
  background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 40px 40px,
    var(--white);
  max-height: 72vh;
  margin-bottom: 24px;
}
.board {
  position: relative;
}
.board-edges {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.board-edges line {
  stroke: #7c9385;
  stroke-width: 2;
}
.sticky {
  position: absolute;
  width: 170px;
  min-height: 96px;
  background: var(--sticky, #fff3a3);
  border-radius: 6px;
  box-shadow: 0 3px 12px #10271c2a;
  display: flex;
  flex-direction: column;
  border: 2px solid transparent;
}
.sticky.selected {
  border-color: var(--green);
}
.sticky.connecting {
  border-style: dashed;
}
.sticky.root {
  width: 190px;
  font-weight: 650;
}
.sticky-head {
  cursor: grab;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 10px;
  color: #3b4a40;
  user-select: none;
  touch-action: none;
  background: #00000010;
  border-radius: 4px 4px 0 0;
}
.sticky-head:active {
  cursor: grabbing;
}
.sticky textarea,
.sticky-text {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  font-size: 14px;
  line-height: 1.35;
  resize: none;
  min-height: 66px;
  border-radius: 0 0 6px 6px;
  overflow-wrap: anywhere;
}
.sticky textarea:focus-visible {
  outline-offset: -3px;
}
.state-pomysl { --sticky: #fff3a3; }
.state-sprawdzone { --sticky: #cfeec4; }
.state-odrzucone { --sticky: #f5c8c4; }
.state-decyzja { --sticky: #cfe0f7; }
.task.done > .row > .check-label span {
  text-decoration: line-through;
  color: var(--muted);
}
.task details {
  margin-top: 6px;
}
.task .check-label {
  gap: 10px;
}
@media (max-width: 900px) {
  .space-layout {
    grid-template-columns: 1fr;
  }
  .space-layout .lesson-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .space-layout .lesson-list .eyebrow,
  .space-layout .lesson-list form {
    grid-column: 1 / -1;
  }
}

/* Zaproszenia i linki do nowego hasła */
.badge.warn {
  background: #fbefd9;
  color: #7a5a1a;
}
#invite-box {
  margin-top: 18px;
  margin-bottom: 0;
}
#invite-box input.full {
  width: 100%;
  box-sizing: border-box;
  margin: 8px 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}
.item .row {
  margin-top: 8px;
}
