:root {
  --bg: #efe2d0;
  --paper: rgba(255, 250, 243, 0.82);
  --paper-strong: #fffaf4;
  --sidebar: rgba(70, 42, 18, 0.92);
  --sidebar-soft: rgba(255, 255, 255, 0.1);
  --text: #24170d;
  --text-soft: #6f5944;
  --line: rgba(77, 47, 20, 0.12);
  --line-strong: rgba(77, 47, 20, 0.2);
  --accent: #c86426;
  --accent-strong: #8f3f0f;
  --accent-soft: rgba(200, 100, 38, 0.12);
  --success: #2f8a57;
  --success-soft: rgba(47, 138, 87, 0.12);
  --danger: #c34141;
  --danger-soft: rgba(195, 65, 65, 0.12);
  --shadow: 0 24px 70px rgba(75, 43, 14, 0.16);
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(243, 182, 102, 0.55), transparent 32%),
    radial-gradient(circle at bottom right, rgba(201, 130, 82, 0.4), transparent 28%),
    linear-gradient(135deg, #f9f1e6, #ebddc8 58%, #e8d7c4);
}

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

button {
  cursor: pointer;
  border: 0;
}

.app-shell {
  position: relative;
  min-height: 100vh;
  padding: 24px;
  overflow: hidden;
}

.backdrop-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(8px);
  opacity: 0.7;
  pointer-events: none;
}

.orb-one {
  top: -80px;
  right: -40px;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(255, 214, 173, 0.95), rgba(255, 214, 173, 0));
}

.orb-two {
  bottom: -120px;
  left: -60px;
  width: 340px;
  height: 340px;
  background: radial-gradient(circle, rgba(225, 166, 115, 0.65), rgba(225, 166, 115, 0));
}

.dashboard-shell {
  position: relative;
  z-index: 1;
  max-width: 1360px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 22px;
}

.dashboard-shell.is-locked {
  filter: blur(3px);
  user-select: none;
}

.sidebar,
.topbar,
.panel-card,
.feedback-strip,
.modal-card,
.loading-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.sidebar {
  min-height: calc(100vh - 48px);
  padding: 26px;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, var(--sidebar), rgba(61, 35, 14, 0.94));
  color: #fff4ea;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 26px;
}

.brand-block h1,
.topbar h2,
.section-head h3,
.empty-card h3,
.modal-card h3 {
  margin: 0;
}

.brand-block p,
.topbar p,
.section-head p,
.empty-card p,
.modal-card p,
.feedback-strip,
.helper-text {
  margin: 0;
  line-height: 1.6;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.08);
}

.brand-block .eyebrow,
.modal-card .eyebrow,
.topbar .eyebrow {
  margin-bottom: 14px;
}

.brand-block h1 {
  font-size: clamp(30px, 4vw, 42px);
  line-height: 0.98;
}

.brand-block p {
  margin-top: 14px;
  color: rgba(255, 244, 234, 0.74);
}

.nav-list {
  display: grid;
  gap: 10px;
}

.nav-item {
  width: 100%;
  padding: 16px 18px;
  border-radius: 18px;
  background: transparent;
  border: 1px solid transparent;
  color: #fff4ea;
  text-align: left;
  font-weight: 700;
  user-select: none;
  transition: background 140ms ease, transform 140ms ease, border-color 140ms ease;
}

.nav-item:hover,
.nav-item.active {
  background: var(--sidebar-soft);
  border-color: rgba(255, 255, 255, 0.14);
  transform: translateY(-1px);
}

.sidebar-note {
  align-self: end;
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-note strong {
  display: block;
  font-size: 36px;
}

.sidebar-note span {
  color: rgba(255, 244, 234, 0.72);
}

.main-pane {
  display: grid;
  gap: 18px;
  align-content: start;
}

.topbar {
  padding: 24px 28px;
  border-radius: var(--radius-xl);
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 18px;
}

.topbar h2 {
  margin-bottom: 8px;
  font-size: clamp(28px, 4vw, 40px);
}

.topbar p {
  color: var(--text-soft);
  max-width: 64ch;
}

.topbar-actions,
.button-row,
.card-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(36, 23, 13, 0.06);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
}

.feedback-strip {
  padding: 14px 18px;
  border-radius: 18px;
  color: var(--success);
  background: var(--success-soft);
}

.feedback-strip.error,
.status-banner.error,
.error-text {
  color: var(--danger);
}

.feedback-strip.error {
  background: var(--danger-soft);
}

.page-grid {
  display: grid;
  gap: 18px;
}

.split-view {
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
}

.content-layout {
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
}

.panel-card,
.empty-card {
  padding: 24px;
  border-radius: var(--radius-xl);
}

.large-panel {
  min-height: 420px;
}

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

.section-head p {
  color: var(--text-soft);
  margin-top: 8px;
}

.section-head.compact {
  align-items: center;
}

.chapter-list,
.content-list,
.stack {
  display: grid;
  gap: 14px;
}

.chapter-item,
.content-item,
.empty-card {
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid rgba(77, 47, 20, 0.08);
}

.chapter-item,
.content-item {
  padding: 18px;
  border-radius: 20px;
  user-select: none;
}

.chapter-cover {
  display: block;
  width: 100%;
  height: 180px;
  object-fit: cover;
  margin-bottom: 14px;
  border-radius: 16px;
  background: rgba(36, 23, 13, 0.08);
}

.thumbnail-form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 100px;
  gap: 16px;
  align-items: start;
}

.content-cover-card,
.media-preview-card {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(36, 23, 13, 0.08);
}

.content-cover-block {
  margin-bottom: 14px;
}

.content-cover-label {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-soft);
}

.content-cover {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-preview-poster {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-preview-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.content-cover-overlay,
.media-preview-overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 12px 8px 8px;
  color: #fff;
  text-align: center;
  line-height: 1.35;
  font-size: 11px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.92));
}

.chapter-item.active {
  background: rgba(200, 100, 38, 0.12);
  border-color: rgba(200, 100, 38, 0.3);
}

.item-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 10px;
}

.item-head h4 {
  margin: 0 0 6px;
  font-size: 18px;
}

.item-head small,
.content-meta {
  color: var(--text-soft);
}

.chapter-label-list {
  display: grid;
  gap: 4px;
  margin-top: 6px;
  color: var(--text-soft);
  font-size: 13px;
}

.content-detail-list {
  display: grid;
  gap: 8px;
  color: var(--text-soft);
  line-height: 1.6;
}

.content-detail-list strong {
  color: var(--text);
}

.content-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.content-image-card {
  margin: 0;
  display: grid;
  gap: 8px;
}

.content-image-card img {
  display: block;
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 12px;
  background: rgba(36, 23, 13, 0.08);
}

.content-image-card figcaption {
  font-size: 12px;
  color: var(--text-soft);
  word-break: break-word;
}

.media-preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.media-preview-block {
  display: grid;
  gap: 8px;
}

.media-preview-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 12px;
  background: rgba(36, 23, 13, 0.08);
}

.media-preview-card.empty {
  display: grid;
  place-items: center;
  padding: 16px;
  color: var(--text-soft);
  text-align: center;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  font-size: 14px;
  font-weight: 800;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 14px 15px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--paper-strong);
  color: var(--text);
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: rgba(200, 100, 38, 0.45);
  box-shadow: 0 0 0 4px rgba(200, 100, 38, 0.1);
}

.field textarea {
  min-height: 130px;
  resize: vertical;
}

.field.has-error input,
.field.has-error textarea,
.field.has-error select {
  border-color: rgba(195, 65, 65, 0.45);
  box-shadow: 0 0 0 4px rgba(195, 65, 65, 0.08);
}

.field input:disabled,
.field textarea:disabled,
.field select:disabled,
.btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.inline-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.helper-text {
  font-size: 12px;
  color: var(--text-soft);
}

.dynamic-list,
.checkbox-list {
  display: grid;
  gap: 10px;
}

.media-upload-row {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.38);
  border: 1px dashed rgba(77, 47, 20, 0.16);
}

.media-upload-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.dynamic-row,
.checkbox-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(77, 47, 20, 0.08);
}

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

.checkbox-row {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  cursor: pointer;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.checkbox-row span {
  display: grid;
  gap: 4px;
}

.checkbox-row small {
  color: var(--text-soft);
  line-height: 1.5;
}

.toggle-field {
  display: flex;
  align-items: start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(77, 47, 20, 0.08);
}

.toggle-field input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.toggle-field span {
  display: grid;
  gap: 4px;
}

.toggle-field strong {
  font-size: 14px;
}

.toggle-field small {
  color: var(--text-soft);
  line-height: 1.5;
}

.error-text {
  font-size: 12px;
  font-weight: 700;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 14px;
  font-weight: 800;
  transition: transform 140ms ease, background 140ms ease, opacity 140ms ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn-primary {
  color: #fff8f3;
  background: linear-gradient(135deg, var(--accent), #dc844c);
}

.btn-secondary {
  color: var(--text);
  background: rgba(36, 23, 13, 0.08);
}

.btn-ghost {
  color: var(--text-soft);
  background: transparent;
  border: 1px solid var(--line-strong);
}

.empty-card {
  text-align: center;
  padding: 38px 24px;
}

.list-pagination {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.loading-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.loading-panel {
  padding: 28px 34px;
  border-radius: var(--radius-xl);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(34, 20, 10, 0.3);
  backdrop-filter: blur(8px);
}

.modal-card {
  width: min(480px, 100%);
  padding: 28px;
  border-radius: var(--radius-xl);
}

.modal-card p {
  color: var(--text-soft);
  margin: 12px 0 18px;
}

.status-banner {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--danger-soft);
}

@media (max-width: 1120px) {
  .dashboard-shell,
  .split-view,
  .content-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 16px;
  }

  .sidebar,
  .topbar,
  .panel-card,
  .modal-card {
    padding: 20px;
    border-radius: 22px;
  }

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

  .inline-fields {
    grid-template-columns: 1fr;
  }

  .dynamic-row {
    grid-template-columns: 1fr;
  }

  .media-upload-controls {
    grid-template-columns: 1fr;
  }

  .thumbnail-form-row {
    grid-template-columns: 1fr;
  }
}
