:root {
  color-scheme: light;
  --bg: #f6f5f1;
  --ink: #1f2423;
  --muted: #66706d;
  --line: #d8d6cd;
  --panel: #ffffff;
  --panel-2: #f0eee6;
  --green: #2f6f5e;
  --green-dark: #214f45;
  --amber: #b7791f;
  --blue: #315f8f;
  --red: #a3423f;
  --level-1: #2f6f5e;
  --level-1-soft: #f4faf5;
  --level-2: #315f8f;
  --level-2-soft: #f1f6fc;
  --level-3: #9a6730;
  --level-3-soft: #fff7ea;
  --shadow: 0 18px 40px rgba(31, 36, 35, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
}

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

button {
  cursor: pointer;
}

.appShell {
  width: min(1460px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0 36px;
}

.floatingBack {
  position: fixed;
  z-index: 80;
  top: 10px;
  left: 10px;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--green-dark);
  font-size: 1.55rem;
  line-height: 1;
  box-shadow: 0 8px 22px rgba(31, 36, 35, 0.14);
}

.floatingBack:not(.available) {
  opacity: 0.62;
}

.floatingTop {
  position: fixed;
  z-index: 80;
  right: 14px;
  bottom: 14px;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--green-dark);
  font-size: 1.35rem;
  line-height: 1;
  box-shadow: 0 10px 24px rgba(31, 36, 35, 0.15);
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: end;
  padding-bottom: 16px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.82rem;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 0.94;
}

h2 {
  font-size: 1.45rem;
}

h3 {
  font-size: 1rem;
}

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

.stat {
  min-width: 78px;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 10px 12px;
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(31, 36, 35, 0.04);
}

.stat strong {
  display: block;
  font-size: 1.25rem;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.tabs,
.sectionBar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0;
}

.tab,
.sectionButton,
.panelTools button,
.smallButton {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  min-height: 42px;
  padding: 0 16px;
}

.tab {
  min-width: 86px;
  font-weight: 700;
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 6px 14px;
}

.sectionButton.active,
.smallButton.primary {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.tab.active {
  background: var(--panel);
  border-color: rgba(47, 111, 94, 0.24);
  color: var(--green);
  box-shadow: inset 0 -3px 0 var(--green);
}

.tabCount {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 22px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 800;
}

.tabLabel {
  display: block;
}

.sectionBar {
  margin-top: 6px;
}

.workArea {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin-top: 14px;
  align-items: start;
}

.panel,
.detailPanel {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  min-height: 68vh;
  padding: 18px;
  position: relative;
}

.panel[data-level="1"] {
  border-top: 4px solid var(--level-1);
  background: rgba(255, 255, 255, 0.9);
}

.panel[data-level="2"] {
  border-top: 4px solid var(--level-2);
  background: linear-gradient(180deg, var(--level-2-soft) 0, rgba(255, 255, 255, 0.9) 190px);
}

.panel[data-level="3"] {
  border-top: 4px solid var(--level-3);
  background: linear-gradient(180deg, var(--level-3-soft) 0, rgba(255, 255, 255, 0.9) 190px);
}

.panel[data-level="4"] {
  border-top: 4px solid #7a4b78;
  background: linear-gradient(180deg, #fbf2fb 0, rgba(255, 255, 255, 0.9) 190px);
}

.panel[data-level="1"] #panelTitle {
  color: var(--ink);
  font-size: 1.48rem;
}

.panel[data-level="2"] #panelTitle {
  color: var(--level-2);
  font-size: 1.3rem;
}

.panel[data-level="3"] #panelTitle {
  color: var(--level-3);
  font-size: 1.16rem;
}

.panel[data-level="4"] #panelTitle {
  color: #7a4b78;
  font-size: 1.08rem;
}

.panel[data-level="2"] .categoryCard {
  border-left: 4px solid rgba(49, 95, 143, 0.46);
  background: #fbfdff;
}

.panel[data-level="3"] .selectedCard {
  background: #744c2b;
}

.panel[data-level="3"] .groupCard {
  border-left: 4px solid rgba(154, 103, 48, 0.5);
}

.panel[data-level="4"] .selectedCard {
  background: #5f3a61;
}

.detailPanel {
  position: sticky;
  top: 16px;
  padding: 16px;
}

.detailPanel[hidden] {
  display: none;
}

.panelHead {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}

.panelTools {
  display: flex;
  gap: 8px;
  align-items: center;
}

.searchRow {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 36px;
  margin: 4px 0 8px;
}

.searchRow[hidden] {
  display: none;
}

.searchRow span {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.searchRow input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
  font-size: 0.86rem;
}

.levelBadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 10px;
  background: var(--level-1);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.panel[data-level="2"] .levelBadge {
  background: var(--level-2);
}

.panel[data-level="3"] .levelBadge {
  background: var(--level-3);
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 30px;
  align-items: center;
  color: var(--muted);
  font-size: 0.86rem;
}

.crumb {
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 0;
  min-height: 28px;
}

.selectedCard {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 18px;
  border-radius: 8px;
  background: var(--green-dark);
  color: #fff;
}

.selectedCard[hidden] {
  display: none;
}

.selectedCard p,
.selectedCard span {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
}

.selectedCard h3 {
  color: #fff;
  font-size: 1.7rem;
  line-height: 1.08;
}

.categoryGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.categoryGrid.zoneColumns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.categoryColumn {
  display: grid;
  gap: 10px;
  align-content: start;
}

.categoryCard {
  display: grid;
  min-height: 104px;
  gap: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  padding: 14px;
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease;
}

.categoryCard:hover {
  transform: translateY(-2px);
  border-color: var(--green);
}

.categoryMeta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.78rem;
  align-self: end;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.pill.today {
  background: #e4efe9;
  color: var(--green-dark);
}

.pill.tomorrow {
  background: #eef2fa;
  color: var(--blue);
}

.pill.done {
  background: #f3eadc;
  color: var(--amber);
}

.groupGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.groupGrid.storyGrid {
  grid-template-columns: 1fr;
}

.storyToolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 10px;
}

.storyToolbar span {
  color: var(--muted);
  font-size: 0.82rem;
}

.storyCard {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}

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

.storyTitleLine input,
.storyMiniFields input,
.storyCard textarea,
.richField {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.storyActions select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.storyTitleLine input {
  min-height: 42px;
  padding: 0 12px;
  font-size: 1rem;
  font-weight: 800;
}

.richColorControl {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  padding: 0 8px;
  font-size: 0.8rem;
  font-weight: 800;
}

.richColorControl input {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  padding: 0;
}

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

.storyMiniFields input {
  min-height: 38px;
  padding: 0 10px;
}

.storyCard textarea,
.richField {
  min-height: 118px;
  padding: 12px;
  line-height: 1.55;
}

.richField {
  overflow: auto;
  white-space: pre-wrap;
}

.richField:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
}

.miniRichField {
  min-height: 38px;
  padding: 9px 10px;
}

.storyCollection {
  border-left-color: #3f6fa3;
}

.storyCollection.collapsed {
  background: #fbfcfb;
}

.collectionBar {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(63, 111, 163, 0.2);
  border-radius: 8px;
  background: #f4f8fa;
  padding: 6px 8px;
}

.collectionBar span {
  color: #315f89;
  font-size: 0.86rem;
  font-weight: 800;
}

.collectionBar button {
  min-height: 30px;
  border: 1px solid rgba(63, 111, 163, 0.28);
  border-radius: 8px;
  background: #fff;
  color: #315f89;
  padding: 0 10px;
  font-weight: 800;
}

.collectionOverallFields {
  display: grid;
  gap: 6px;
}

.collectionPropsField {
  min-height: 42px;
  background: #fff;
  border-color: rgba(63, 111, 163, 0.28);
}

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

.substoryList.collapsed {
  display: none !important;
}

.substoryCard {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9faf5;
  padding: 10px;
}

.substoryHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.substoryHead strong {
  color: #315f89;
  font-size: 0.92rem;
}

.miniDanger {
  min-height: 30px;
  padding: 0 8px;
  font-size: 0.78rem;
}

.addSubstoryButton {
  width: 100%;
  justify-content: center;
}

.reordering {
  cursor: grabbing;
  user-select: none;
}

.reorderGhost {
  opacity: 0.58;
  outline: 2px solid rgba(47, 111, 94, 0.45);
  transform: scale(0.985);
}

.reorderOverBefore,
.reorderOverAfter {
  position: relative;
}

.reorderOverBefore::before,
.reorderOverAfter::after {
  content: '';
  position: absolute;
  left: 6px;
  right: 6px;
  height: 4px;
  border-radius: 999px;
  background: var(--green);
  z-index: 3;
}

.reorderOverBefore::before {
  top: -4px;
}

.reorderOverAfter::after {
  bottom: -4px;
}

.storyReferenceDrop {
  border: 1px dashed rgba(47, 111, 94, 0.34);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 8px;
  outline: none;
}

.storyReferenceDrop.dragOver {
  border-color: var(--green);
  background: #eef6ef;
}

.storyReferenceHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}

.storyReferenceHead strong {
  font-size: 0.9rem;
}

.storyReferenceHead button {
  min-height: 30px;
  border: 1px solid rgba(47, 111, 94, 0.22);
  border-radius: 8px;
  background: #fff;
  color: var(--green-dark);
  padding: 0 10px;
  font-weight: 800;
}

.storyReferenceGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 7px;
}

.storyReferenceItem {
  position: relative;
}

.storyReferenceThumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 0;
  border-radius: 6px;
  background: #f0eee6;
  padding: 0;
  overflow: hidden;
}

.storyReferenceThumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.storyReferenceRemove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(163, 66, 63, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--red);
  font-size: 1rem;
  line-height: 1;
}

.storyReferenceHint {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.storyActions {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
}

.storyActions select {
  min-height: 38px;
  padding: 0 10px;
}

.dangerButton {
  min-height: 38px;
  border: 1px solid rgba(163, 66, 63, 0.28);
  border-radius: 8px;
  background: #fff7f6;
  color: var(--red);
  padding: 0 12px;
  font-weight: 700;
}

.groupCard {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  padding: 8px;
  text-align: left;
  -webkit-touch-callout: none;
  user-select: none;
}

.groupCard.active {
  outline: 3px solid rgba(47, 111, 94, 0.24);
  border-color: var(--green);
}

.thumbButton {
  width: 100%;
  height: 116px;
  border: 0;
  padding: 0;
  border-radius: 6px;
  background: #f0eee6;
  overflow: hidden;
}

.thumbButton img,
.thumbButton video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.videoThumb {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  background: #0f1312;
}

.videoThumb img,
.videoThumb video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.playIcon {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.24);
}

.playIcon::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 10px;
  border-left: 12px solid var(--green-dark);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
}

.groupBody {
  min-width: 0;
  padding: 0;
}

.groupTitleRow {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  justify-content: space-between;
}

.groupBody p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.groupActions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 8px;
}

.groupActions select,
.field select,
.field input,
.field textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

.field textarea {
  min-height: 86px;
  padding: 10px;
  resize: vertical;
}

.doneToggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  padding: 0 10px;
  white-space: nowrap;
}

.miniAssets {
  display: flex;
  gap: 5px;
  margin-top: 7px;
  overflow-x: auto;
}

.miniAssets button {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0;
  background: #f0eee6;
  overflow: hidden;
}

.miniAssets img,
.miniAssets video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.moreAssets {
  color: var(--green-dark);
  font-weight: 800;
}

.groupAssetGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.miniAssets .playIcon {
  width: 22px;
  height: 22px;
}

.miniAssets .playIcon::before {
  left: 9px;
  top: 6px;
  border-left-width: 8px;
  border-top-width: 5px;
  border-bottom-width: 5px;
}

.detailEmpty {
  min-height: 240px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.detailPanel h3 {
  font-size: 1.18rem;
  margin-bottom: 12px;
}

.detailMedia {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

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

.assetTile button {
  width: 100%;
  border: 0;
  padding: 0;
  background: #101312;
  overflow: hidden;
}

.assetTile img,
.assetTile video {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: contain;
}

.assetCaption {
  min-height: 42px;
  padding: 7px 8px;
  color: var(--muted);
  font-size: 0.73rem;
  overflow-wrap: anywhere;
}

.field {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.field label {
  color: var(--muted);
  font-size: 0.82rem;
}

.assetGrid {
  display: none;
}

.emptyState {
  display: grid;
  place-items: center;
  min-height: 300px;
  color: var(--muted);
  text-align: center;
}

dialog {
  width: min(920px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  background: #0f1312;
  padding: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.32);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
}

.moveDialog {
  width: min(520px, calc(100vw - 16px));
  max-height: calc(100vh - 24px);
  background: var(--panel);
  color: var(--ink);
  padding: 0;
  overflow: hidden;
}

.moveDialog::backdrop {
  background: rgba(0, 0, 0, 0.36);
}

.moveSheet {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.moveHead {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
}

.moveHead p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.8rem;
}

.moveHead h3 {
  font-size: 1.24rem;
}

.moveClose {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 1.2rem;
  line-height: 1;
}

.movePreview {
  height: 90px;
  border-radius: 8px;
  background: #0f1312;
  overflow: hidden;
}

.movePreview img,
.movePreview video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.moveField {
  display: grid;
  gap: 6px;
}

.moveField[hidden],
.movePreview[hidden] {
  display: none;
}

.moveField span {
  color: var(--muted);
  font-size: 0.82rem;
}

.moveField select,
.moveField input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

.moveActions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.moveActions button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--ink);
  font-weight: 700;
}

.moveActions .primary {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.closeDialog {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.4rem;
}

#mediaPreview img,
#mediaPreview video {
  max-width: 100%;
  max-height: 82vh;
  display: block;
  margin: 0 auto;
}

.galleryShell {
  position: relative;
  min-height: 40vh;
}

.galleryMedia {
  display: grid;
  place-items: center;
}

.galleryNav {
  position: absolute;
  z-index: 2;
  top: 50%;
  width: 42px;
  height: 54px;
  border: 0;
  border-radius: 999px;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.82);
  color: #0f1312;
  font-size: 2rem;
  line-height: 1;
}

.galleryPrev {
  left: 0;
}

.galleryNext {
  right: 0;
}

.galleryCount {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  min-width: 56px;
  min-height: 28px;
  border-radius: 999px;
  background: rgba(15, 19, 18, 0.72);
  color: #fff;
  display: grid;
  place-items: center;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 800;
}

@media (max-width: 1100px) {
  .workArea {
    grid-template-columns: 1fr;
  }

  .detailPanel {
    position: static;
  }

  .categoryGrid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .categoryGrid.zoneColumns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .groupGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .groupAssetGrid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  body {
    padding-bottom: 0;
  }

  .appShell {
    width: 100%;
    padding: 0 0 16px;
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 18px 16px 12px 58px;
    background: #f8faf4;
    border-bottom: 1px solid var(--line);
  }

  h1 {
    font-size: 2.1rem;
    line-height: 1;
  }

  h2 {
    font-size: 1.18rem;
  }

  .stats {
    display: none;
  }

  .tabs {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    padding: 0;
    background: #fff;
    border-bottom: 1px solid var(--line);
    box-shadow: none;
  }

  .tab {
    min-width: 0;
    min-height: 64px;
    border: 0;
    border-radius: 0;
    padding: 0 4px;
  }

  .tab.active {
    box-shadow: inset 0 -4px 0 var(--green);
  }

  .sectionBar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
    margin-top: 0;
  }

  .sectionButton {
    min-height: 42px;
    padding: 0 8px;
  }

  .workArea {
    margin-top: 0;
    padding: 0 10px;
    gap: 10px;
  }

  .panel {
    min-height: auto;
    padding: 9px;
  }

  .detailPanel {
    display: none;
  }

  .panelHead {
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: start;
    margin-bottom: 6px;
  }

  .panelTools {
    justify-content: end;
  }

  .levelBadge {
    min-width: 42px;
    min-height: 28px;
    padding: 0 8px;
    font-size: 0.74rem;
  }

  .searchRow {
    min-height: 34px;
    margin: 2px 0 7px;
  }

  .searchRow input {
    min-height: 34px;
    font-size: 0.82rem;
  }

  .panel[data-level="1"] #panelTitle {
    font-size: 1.24rem;
  }

  .panel[data-level="2"] #panelTitle {
    font-size: 1.06rem;
  }

  .panel[data-level="3"] #panelTitle {
    font-size: 0.96rem;
  }

  .panel[data-level="4"] #panelTitle {
    font-size: 0.92rem;
  }

  .categoryGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 8px;
  }

  .categoryColumn {
    gap: 8px;
  }

  .groupGrid {
    grid-template-columns: 1fr;
    gap: 9px;
    margin-top: 8px;
  }

  .storyToolbar {
    padding: 8px;
  }

  .storyTitleLine {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 7px;
  }

  .storyMiniFields {
    grid-template-columns: 1fr;
  }

  .storyCard {
    padding: 10px;
  }

  .storyCard textarea {
    min-height: 112px;
  }

  .storyReferenceDrop {
    padding: 7px;
  }

  .storyReferenceGrid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .storyActions {
    grid-template-columns: 1fr 72px 64px;
    gap: 6px;
  }

  .categoryCard {
    min-height: 68px;
    gap: 6px;
    padding: 9px;
  }

  .categoryCard h3 {
    font-size: 0.9rem;
    line-height: 1.18;
  }

  .categoryMeta {
    gap: 4px;
    font-size: 0.72rem;
  }

  .selectedCard {
    margin-top: 6px;
    gap: 4px;
    padding: 10px 12px;
  }

  .selectedCard h3 {
    font-size: 1.18rem;
  }

  .groupCard {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 8px;
    padding: 7px;
  }

  .thumbButton {
    height: 92px;
  }

  .groupBody {
    padding: 0;
  }

  .groupTitleRow h3 {
    font-size: 0.92rem;
    line-height: 1.25;
  }

  .groupActions {
    grid-template-columns: 1fr 72px;
    gap: 5px;
  }

  .groupActions select,
  .doneToggle {
    min-height: 34px;
    font-size: 0.86rem;
  }

  .doneToggle {
    justify-content: center;
    padding: 0 6px;
  }

  .detailMedia {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .groupAssetGrid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 8px;
  }

  .assetCaption {
    min-height: 28px;
    padding: 5px 6px;
    font-size: 0.68rem;
    text-align: center;
  }

  .assetCaption {
    font-size: 0.68rem;
  }

  dialog {
    width: calc(100vw - 16px);
    padding: 10px;
  }

  #mediaPreview img,
  #mediaPreview video {
    max-height: 84vh;
  }

  .galleryNav {
    width: 36px;
    height: 48px;
    font-size: 1.7rem;
  }

  .moveDialog {
    width: 100vw;
    max-width: none;
    margin: auto 0 0;
    border-radius: 12px 12px 0 0;
  }

  .moveSheet {
    padding: 14px 14px max(14px, env(safe-area-inset-bottom));
  }

  .floatingTop {
    right: 10px;
    bottom: 12px;
  }
}

@media (max-width: 380px) {
  .groupActions,
  .detailMedia {
    grid-template-columns: 1fr;
  }

  .groupAssetGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
