:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #f0f4f8;
  --text: #17202a;
  --muted: #667085;
  --line: #d9e2ec;
  --accent: #006b5f;
  --accent-strong: #004d44;
  --accent-soft: #d9f2ee;
  --warning: #b54708;
  --danger: #b42318;
  --success: #067647;
  --shadow: 0 16px 40px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

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

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

.app-shell {
  display: grid;
  grid-template-columns: minmax(260px, 300px) minmax(420px, 1fr) minmax(320px, 380px);
  min-height: 100vh;
}

.sidebar,
.editor-panel {
  background: var(--panel);
  padding: 24px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.editor-panel {
  border-right: 0;
  border-left: 1px solid var(--line);
}

.workspace {
  padding: 28px;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.panel-header h2,
.panel-header p {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
}

.brand p,
.eyebrow {
  color: var(--muted);
  font-size: 13px;
}

.eyebrow {
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.topbar h2 {
  margin-top: 6px;
  font-size: 28px;
}

.stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stat {
  min-width: 92px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 4px 16px rgba(16, 24, 40, 0.04);
}

.stat strong {
  display: block;
  font-size: 20px;
}

.stat span {
  color: var(--muted);
  font-size: 12px;
}

.field-label,
.filter-group label {
  display: block;
  margin: 16px 0 7px;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.primary-action,
.ghost-button,
.icon-button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

.primary-action {
  width: 100%;
  padding: 12px 14px;
  background: var(--accent);
  color: #fff;
}

.primary-action:hover {
  background: var(--accent-strong);
}

.primary-action:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.ghost-button {
  padding: 9px 10px;
  background: var(--panel-soft);
  color: var(--text);
}

.teachbase-sync {
  margin-top: 12px;
}

.sync-status {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.icon-button {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

.course-meta {
  margin: 14px 0 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.course-meta a {
  color: var(--accent);
  font-weight: 700;
}

.current-user {
  margin-top: 10px;
}

.module-tree {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.module-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.module-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  border: 0;
  padding: 12px;
  background: var(--panel-soft);
  color: var(--text);
  text-align: left;
  font-weight: 700;
  cursor: pointer;
}

.module-title:hover {
  background: #e7eef6;
}

.module-toggle {
  display: grid;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 8px;
  background: #fff;
  color: var(--accent);
  font-weight: 700;
}

.section-list {
  display: block;
}

.section-list[hidden] {
  display: none;
}

.section-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  background: #fff;
  padding: 10px 12px;
  text-align: left;
  color: var(--text);
  cursor: pointer;
}

.section-name {
  min-width: 0;
}

.section-marker {
  display: grid;
  flex: 0 0 20px;
  min-width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.section-button.active,
.section-button:hover {
  background: var(--accent-soft);
}

.filters {
  display: grid;
  grid-template-columns: 180px 180px minmax(220px, 1fr);
  gap: 12px;
  margin-bottom: 20px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.filter-group label {
  margin-top: 0;
}

.feedback-list {
  display: grid;
  gap: 14px;
}

.section-content {
  margin-bottom: 20px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 4px 16px rgba(16, 24, 40, 0.04);
}

.content-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.content-header h3,
.content-item h4 {
  margin: 0;
}

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

.content-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.content-item img,
.content-item video,
.content-item iframe {
  display: block;
  max-width: 100%;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.content-item img,
.content-item video {
  max-height: 520px;
  object-fit: contain;
}

.content-item iframe {
  width: 100%;
  min-height: 520px;
  background: #fff;
}

.content-item a {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent);
  font-weight: 700;
}

.content-text,
.content-html {
  margin-top: 10px;
  line-height: 1.6;
}

.feedback-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 18px;
}

.feedback-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.feedback-location {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.feedback-text {
  white-space: pre-wrap;
  line-height: 1.55;
}

.feedback-quote {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--accent-soft);
  color: #18423c;
  line-height: 1.5;
}

.badges,
.card-actions,
.image-preview,
.attachment-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--panel-soft);
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

.badge.done {
  background: #dcfae6;
  color: var(--success);
}

.badge.in_progress {
  background: #d1e9ff;
  color: #175cd3;
}

.card-actions {
  justify-content: flex-end;
  margin-top: 14px;
}

.attachment-grid {
  margin-top: 12px;
}

.attachment-grid img,
.image-preview img {
  width: 110px;
  height: 78px;
  border-radius: 8px;
  border: 1px solid var(--line);
  object-fit: cover;
  background: var(--panel-soft);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.inline-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.empty-state {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  text-align: center;
}

.new-course-dialog {
  position: fixed;
  inset: 24px 24px 24px auto;
  width: min(420px, calc(100vw - 48px));
  overflow-y: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(16, 24, 40, 0.25);
}

.user-dialog {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(16, 24, 40, 0.45);
}

.user-card {
  width: min(420px, 100%);
  padding: 24px;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(16, 24, 40, 0.25);
}

.user-card h2 {
  margin: 6px 0 14px;
}

.hidden {
  display: none !important;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 280px 1fr;
  }

  .editor-panel {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 760px) {
  .app-shell,
  .filters {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .workspace,
  .editor-panel {
    padding: 18px;
  }

  .topbar,
  .feedback-head {
    flex-direction: column;
  }

  .stats {
    justify-content: flex-start;
  }
}
