:root {
  --ink: #1d1d1b;
  --muted: #747470;
  --line: #e3e2de;
  --line-strong: #cfcec9;
  --paper: #fffefa;
  --canvas: #f4f3ef;
  --panel: #f8f7f3;
  --deep: #171716;
  --accent: #242423;
  --accent-soft: #e9e8e3;
  --ui-accent: #8a0b6e;
  --danger: #4a4a47;
  --shadow: 0 18px 50px rgba(0, 0, 0, .09);
  --radius: 14px;
  --ui-font: Inter, "Aptos", "Segoe UI Variable", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  --display-font: "Aptos Display", Inter, "Segoe UI Variable Display", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  font-family: var(--ui-font);
  color: var(--ink);
  background: var(--canvas);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { min-width: 320px; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid rgba(30, 30, 29, .2);
  outline-offset: 2px;
}
.app { min-height: 100vh; display: grid; grid-template-rows: 58px 1fr; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 0 18px;
  background: #fff;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .09);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center;
  border: 1px solid rgba(214,174,98,.52);
  color: #e4c384; font: 700 18px/1 Georgia, serif;
  background: rgba(255,255,255,.04);
}
.brand-title { font: 600 16px/1.1 Georgia, "Times New Roman", serif; letter-spacing: .01em; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.save-state { color: #b7c7c2; font-size: 12px; margin-right: 4px; white-space: nowrap; }
.button {
  min-height: 38px; border: 1px solid var(--line-strong); border-radius: 9px;
  background: #fff; color: var(--ink); padding: 8px 13px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-weight: 650; font-size: 14px;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.button:hover { transform: translateY(-1px); border-color: #aab9b3; }
.button.primary { background: var(--accent); border-color: var(--accent); color: #15231f; }
.button.dark { background: #163a36; color: #fff; border-color: #31524e; }
.button.ghost { background: transparent; color: inherit; border-color: currentColor; opacity: .92; }
.button.danger { color: var(--danger); }
.button.small { min-height: 32px; padding: 6px 9px; font-size: 13px; }
.button.icon { width: 34px; padding: 0; }
.workspace { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 0; }
.sidebar {
  background: #f7f9f8; border-right: 1px solid var(--line);
  padding: 16px 12px; min-height: calc(100vh - 58px);
  position: sticky; top: 58px; height: calc(100vh - 58px); overflow: auto;
}
.sidebar-label {
  color: var(--muted); font-size: 12px; font-weight: 800;
  letter-spacing: .13em; text-transform: uppercase;
  margin: 4px 8px 10px;
}
.outline { display: grid; gap: 7px; }
.outline-item {
  width: 100%; border: 1px solid transparent; border-radius: 10px;
  background: transparent; text-align: left; padding: 10px 11px;
  color: #43504c; display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 6px;
}
.outline-item:hover { background: #edf2f0; }
.outline-item.active { background: #e7efec; border-color: #cddbd6; color: var(--deep); box-shadow: inset 3px 0 0 var(--accent); }
.outline-number { font: 700 13px/1.4 Georgia, serif; color: var(--accent); }
.outline-name { font-size: 14px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.outline-meta { grid-column: 2; color: var(--muted); font-size: 12px; margin-top: 2px; }
.sidebar-foot { display: grid; gap: 8px; margin-top: 15px; }
.main { min-width: 0; padding: 22px clamp(16px, 3vw, 38px) 64px; }
.editor-wrap { max-width: 920px; margin: 0 auto; }
.editor-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 18px; margin-bottom: 14px;
}
.eyebrow { color: var(--accent); font-size: 12px; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
.editor-head h1 { margin: 0; font: 600 clamp(25px, 3vw, 34px)/1.08 Georgia, serif; color: var(--deep); }
.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: none;
}
.meta-card { padding: 22px; margin-bottom: 18px; }
.card-title {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 17px;
}
.card-title h2 { margin: 0; font: 600 21px/1.2 Georgia, serif; color: var(--deep); }
.helper { color: var(--muted); font-size: 13px; line-height: 1.45; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.form-grid .wide { grid-column: 1 / -1; }
label.field { display: grid; gap: 7px; color: #42504c; font-size: 13px; font-weight: 750; }
input, textarea, select {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 9px;
  background: #fff; color: var(--ink); padding: 10px 11px; font-size: 15px;
}
textarea { min-height: 104px; resize: vertical; line-height: 1.55; }
input::placeholder, textarea::placeholder { color: #97a19d; }
.section-card { padding: 24px; }
.section-top {
  display: grid; grid-template-columns: 1fr auto; gap: 15px;
  align-items: start; padding-bottom: 20px; border-bottom: 1px solid var(--line);
}
.section-title-fields { display: grid; gap: 10px; }
.section-title-input { font: 600 25px/1.2 Georgia, serif; color: var(--deep); padding: 9px 10px; }
.section-actions { display: flex; gap: 6px; }
.block-toolbar {
  position: sticky; top: 77px; z-index: 8;
  margin: 14px 0; padding: 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: rgba(248,250,249,.95); border: 1px solid var(--line); border-radius: 11px;
  backdrop-filter: blur(8px);
}
.block-tools { display: flex; flex-wrap: wrap; gap: 7px; }
.blocks { display: grid; gap: 14px; }
.block {
  border: 1px solid var(--line); border-radius: 12px; background: #fcfdfd;
  overflow: hidden;
}
.block-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; background: #f4f7f6; border-bottom: 1px solid var(--line);
}
.block-type {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; color: #53615d;
}
.type-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.block-actions { display: flex; align-items: center; gap: 5px; }
.reveal-select { width: auto; min-width: 132px; min-height: 32px; padding: 5px 28px 5px 8px; font-size: 12px; font-weight: 700; }
.block-body { padding: 16px; display: grid; gap: 13px; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.finding-grid { display: grid; grid-template-columns: 155px 1fr; gap: 13px; }
.media-drop {
  border: 1.5px dashed #aebbb6; border-radius: 11px; background: #f7faf8;
  padding: 22px; text-align: center; color: #53615d;
}
.media-drop.drag { background: #eef6f2; border-color: var(--accent); }
.media-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.media-edit {
  border: 1px solid var(--line); border-radius: 11px; overflow: hidden; background: #fff;
}
.media-preview { aspect-ratio: 16 / 10; background: #dfe6e3; overflow: hidden; position: relative; }
.media-preview img, .media-preview video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-badge {
  position: absolute; left: 9px; top: 9px; padding: 5px 8px;
  background: rgba(16,45,42,.88); color: #fff; border-radius: 6px; font-size: 11px; font-weight: 800;
}
.media-edit-body { padding: 11px; display: grid; gap: 9px; }
.media-edit-top { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; }
.empty-blocks {
  border: 1.5px dashed var(--line-strong); border-radius: 12px;
  padding: 34px; text-align: center; color: var(--muted);
}
.palette { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.swatch {
  width: 27px; height: 27px; border-radius: 50%; border: 3px solid #fff;
  box-shadow: 0 0 0 1px #b8c3bf;
}
.swatch.active { box-shadow: 0 0 0 2px var(--ink); }
.toast {
  position: fixed; right: 22px; bottom: 22px; z-index: 100;
  background: #112e2a; color: #fff; border: 1px solid #36534e;
  padding: 12px 15px; border-radius: 10px; box-shadow: var(--shadow);
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: .2s ease; max-width: 360px; font-size: 14px;
  display: flex; align-items: center; gap: 14px;
}
.toast.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.toast-action { border: 0; border-radius: 7px; background: #d7b36d; color: #17221f; padding: 7px 10px; font-weight: 800; white-space: nowrap; }
.modal {
  position: fixed; inset: 0; z-index: 80; display: none;
  grid-template-rows: 64px 1fr; background: #dfe5e2;
}
.modal.open { display: grid; }
.preview-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: #102d2a; color: #fff; padding: 0 18px; box-shadow: 0 3px 14px rgba(0,0,0,.15);
}
.preview-title { display: flex; align-items: center; gap: 13px; min-width: 0; }
.preview-title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-actions { display: flex; align-items: center; gap: 8px; }
.segmented {
  display: inline-flex; background: #0a211f; border: 1px solid #34534e; padding: 3px; border-radius: 9px;
}
.segmented button {
  border: 0; background: transparent; color: #b9cac5; padding: 7px 11px; border-radius: 6px; font-size: 13px; font-weight: 700;
}
.segmented button.active { color: #192521; background: #d9b56f; }
.preview-scroll { overflow: auto; padding: 34px 18px 70px; }
.report-stack { display: grid; gap: 24px; justify-content: center; }
.thumbnail-picker {
  position: fixed; inset: 0; z-index: 120; display: none; place-items: center;
  padding: 20px; background: rgba(17,22,21,.72); backdrop-filter: blur(9px);
}
.thumbnail-picker.open { display: grid; }
.thumbnail-card {
  width: min(760px, 100%); max-height: calc(100vh - 40px); overflow: auto;
  background: #fff; border: 1px solid #d8dedb; border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0,0,0,.25);
}
.thumbnail-head, .thumbnail-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 15px 17px;
}
.thumbnail-head { border-bottom: 1px solid var(--line); }
.thumbnail-head h2 { margin: 0; font: 650 19px/1.2 var(--display-font); }
.thumbnail-stage {
  position: relative; aspect-ratio: 16 / 9; margin: 17px;
  overflow: hidden; background: #141414;
}
.thumbnail-stage video { width: 100%; height: 100%; display: block; object-fit: contain; }
.thumbnail-stage .video-play-mark { width: 58px; height: 58px; font-size: 20px; }
.thumbnail-stage.playing .video-play-mark { opacity: 0; }
.thumbnail-controls { display: grid; grid-template-columns: 1fr auto; gap: 13px; align-items: center; padding: 0 17px 14px; }
.thumbnail-controls input[type="range"] { accent-color: #303030; padding: 0; }
.frame-time { min-width: 78px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.thumbnail-foot { border-top: 1px solid var(--line); }
.thumbnail-foot .helper { max-width: 440px; }
