:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --muted: #5b6475;
  --text: #0f172a;
  --accent: #0ea5a4;
  --accent-strong: #14b8a6;
  --border: #e2e8f0;
  --card: #ffffff;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Space Grotesk', 'JetBrains Mono', 'Noto Sans KR', system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at 20% 20%, rgba(20, 184, 166, 0.18), transparent 30%),
    radial-gradient(circle at 80% 10%, rgba(14, 165, 164, 0.14), transparent 28%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  border-right: 1px solid var(--border);
  padding: 20px;
  position: sticky;
  top: 0;
  height: 100vh;
}

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

.logo-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-strong), #22d3ee);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #ffffff;
  box-shadow: var(--shadow);
}

.logo-text .brand {
  font-weight: 700;
  letter-spacing: 0.4px;
}

.logo-text .sub {
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  padding: 12px 14px;
  border-radius: 10px;
  color: var(--text);
  background: transparent;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-item:hover {
  background: rgba(125, 211, 252, 0.08);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.16), rgba(34, 211, 238, 0.12));
  color: #0f172a;
  border: 1px solid rgba(20, 184, 166, 0.35);
}

.main {
  padding: 28px 32px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.page-header h1 {
  margin: 4px 0 0;
  font-size: 28px;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  color: var(--muted);
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid var(--border);
}

.user-meta {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  line-height: 1.2;
}

.user-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 6px rgba(52, 211, 153, 0.15);
}

.content {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.cols-3 {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.grid.cols-2 {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.course-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.04);
  color: var(--text);
  font-size: 12px;
}

.tag.draft {
  border-color: rgba(245, 158, 11, 0.4);
  color: #d97706;
}

.tag.published {
  border-color: rgba(16, 185, 129, 0.4);
  color: #059669;
}

.tag.difficulty {
  border-color: rgba(125, 211, 252, 0.5);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--accent-strong), #5eead4);
  color: #ffffff;
  font-weight: 700;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 30px rgba(20, 184, 166, 0.25);
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
  color: var(--text);
  box-shadow: none;
}

.btn.danger {
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #ffffff;
}

.btn.small {
  padding: 6px 10px;
  font-size: 13px;
}

.btn.disabled,
.btn:disabled {
  opacity: 0.5;
  pointer-events: none;
  box-shadow: none;
  transform: none;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  color: var(--muted);
  font-size: 14px;
}

input[type='text'],
input[type='number'],
input[type='file'],
select,
textarea {
  width: 100%;
  padding: 12px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  font-family: inherit;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input[readonly] {
  background: #f8fafc;
  color: var(--muted);
}

.section-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-block {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: rgba(15, 23, 42, 0.02);
}

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

.section-title input {
  flex: 1;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(125, 211, 252, 0.1);
  color: var(--text);
  font-size: 12px;
  border: 1px solid rgba(125, 211, 252, 0.3);
}

.lesson-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lesson-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.03);
  border: 1px solid var(--border);
  gap: 10px;
}

.lesson-item input {
  width: 100%;
}

.drag-handle {
  font-size: 14px;
  color: var(--muted);
  cursor: grab;
}

.draggable.dragging {
  opacity: 0.6;
  border-style: dashed;
}

.section-block.draggable,
.lesson-item.draggable {
  cursor: grab;
}

.lesson-item .meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.practice-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.practice-files {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.file-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  border: 1px dashed var(--border);
  background: rgba(15, 23, 42, 0.02);
}

.file-row textarea {
  min-height: 80px;
}

.timeline-table {
  width: 100%;
  border-collapse: collapse;
}

.timeline-table th,
.timeline-table td {
  border: 1px solid var(--border);
  padding: 8px;
  font-size: 14px;
}

.timeline-table th {
  color: var(--muted);
  background: rgba(15, 23, 42, 0.02);
}

.video-preview {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.muted-tip {
  font-size: 13px;
  color: var(--muted);
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.12), rgba(34, 211, 238, 0.08));
  border-radius: 14px;
  border: 1px solid rgba(20, 184, 166, 0.2);
}

.hero h2 {
  margin: 0 0 6px;
}

.hero p {
  margin: 0;
  color: var(--muted);
}

.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
}

.login-panel {
  width: min(420px, 94vw);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.alert {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.04);
  margin-bottom: 12px;
}

.alert-error {
  border-color: rgba(239, 68, 68, 0.35);
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.08);
}

.alert-success {
  border-color: rgba(16, 185, 129, 0.35);
  color: #047857;
  background: rgba(16, 185, 129, 0.08);
}

.welcome-banner {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(20, 184, 166, 0.08);
  border: 1px solid rgba(20, 184, 166, 0.2);
  margin-bottom: 16px;
}

.thumbnail-preview {
  margin-top: 10px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  max-width: 320px;
}

.thumbnail-preview img {
  width: 100%;
  display: block;
}

.json-preview {
  margin: 0;
  padding: 12px;
  border-radius: 10px;
  background: #0f172a;
  color: #e2e8f0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  max-height: 200px;
  overflow: auto;
}

.ql-toolbar.ql-snow,
.ql-container.ql-snow {
  border-color: var(--border);
}

.ql-container.ql-snow {
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}

.ql-toolbar.ql-snow {
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}

.table-wrap {
  margin-top: 14px;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.course-thumb {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #eef2f7;
  height: 150px;
}

.course-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.form-inline {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}

.list-table {
  display: grid;
  gap: 8px;
}

.list-row {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 0.8fr 0.6fr;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.02);
  font-size: 13px;
}

.list-row.header {
  background: rgba(15, 23, 42, 0.06);
  font-weight: 600;
}

.list-row.empty {
  grid-template-columns: 1fr;
  text-align: center;
  color: var(--muted);
}

.faq-row {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.faq-row input,
.faq-row textarea {
  width: 100%;
}

.faq-actions {
  display: flex;
  justify-content: flex-end;
}

.editorjs {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #ffffff;
  min-height: 320px;
}

.editor-tall {
  min-height: 520px;
}

.codex-editor__redactor {
  padding-bottom: 60px;
}

.notice {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(14, 165, 164, 0.4);
  background: rgba(14, 165, 164, 0.08);
  color: #0f766e;
  margin-bottom: 12px;
}

@media (max-width: 720px) {
  .list-row {
    grid-template-columns: 1fr;
  }

  .form-inline {
    flex-direction: column;
    align-items: stretch;
  }

  .course-thumb {
    height: 180px;
  }
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table th {
  color: var(--muted);
  font-weight: 600;
}

.inline-form {
  margin: 0;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.25);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.modal.open {
  display: flex;
}

.modal-content {
  width: min(720px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: relative;
    height: auto;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}
