:root {
  color-scheme: light;
  --pageBg: #f3f6fb;
  --card: rgba(255, 255, 255, 0.96);
  --surface: #f8fafc;
  --surfaceStrong: #eef2f7;
  --text: #152033;
  --muted: #647085;
  --subtle: #8b96a9;
  --border: #dce3ed;
  --borderStrong: #c9d3e1;
  --accent: #3157d5;
  --accentStrong: #2545b8;
  --accentSoft: #e9edff;
  --success: #20a374;
  --dangerBg: #fff3f3;
  --dangerBorder: #ffcaca;
  --dangerText: #a52a2a;
  --shadow: 0 18px 50px rgba(42, 55, 82, 0.08);
  --shadowStrong: 0 18px 42px rgba(37, 69, 184, 0.24);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--pageBg);
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 8% 0%, rgba(112, 137, 255, 0.13), transparent 28rem),
    radial-gradient(circle at 94% 12%, rgba(62, 189, 164, 0.1), transparent 24rem),
    var(--pageBg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

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

.pageShell {
  width: min(100%, 1540px);
  margin: 0 auto;
  padding: 22px 32px 24px;
}

.pageHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 20px;
}

.brandLockup {
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: 14px;
  color: inherit;
  text-decoration: none;
}

.brandLockup:focus-visible {
  outline: 3px solid rgba(49, 87, 213, 0.22);
  outline-offset: 4px;
}

.brandMark {
  display: grid;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 14px;
  background: linear-gradient(145deg, #4265dc, #2344b2);
  box-shadow: 0 12px 28px rgba(49, 87, 213, 0.26);
  color: #fff;
}

.brandMark svg {
  width: 26px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.pageHeader h1 {
  margin: 0;
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1.12;
}

.headerDescription {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.headerMeta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
}

.statusBadge,
.versionBadge {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  backdrop-filter: blur(10px);
}

.statusBadge svg {
  width: 16px;
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.workspaceGrid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.card {
  border: 1px solid rgba(210, 219, 232, 0.88);
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.settingsCard {
  position: sticky;
  top: 18px;
  padding: 22px;
}

.sectionHeading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.sectionNumber {
  display: inline-grid;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 10px;
  background: var(--accentSoft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.sectionHeading h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.sectionHeading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.fieldGroup {
  min-width: 0;
  margin-top: 19px;
}

.fieldGroup > label,
.fieldLabelWithHelp > label {
  display: block;
  margin-bottom: 7px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.fieldGroup small,
.switchLabel small {
  display: block;
  margin-top: 6px;
  color: var(--subtle);
  font-size: 11px;
  line-height: 1.4;
}

.fieldRow {
  display: grid;
  grid-template-columns: 0.78fr 1.22fr;
  gap: 10px;
}

input[type="text"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  outline: 0;
  background: #fff;
  color: var(--text);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input[type="text"],
select {
  min-height: 42px;
  border-radius: 11px;
  padding: 9px 11px;
  font-size: 13px;
}

select {
  cursor: pointer;
}

input[type="text"]:hover,
select:hover,
textarea:hover {
  border-color: var(--borderStrong);
}

input[type="text"]:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(49, 87, 213, 0.12);
}

.inputWithSuffix {
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fff;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.inputWithSuffix:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(49, 87, 213, 0.12);
}

.inputWithSuffix input {
  min-width: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.inputWithSuffix input:focus {
  box-shadow: none;
}

.inputWithSuffix > span {
  padding: 0 11px 0 4px;
  color: var(--subtle);
  font-size: 12px;
}

.optionGroup {
  display: grid;
  gap: 2px;
  margin-top: 20px;
  padding: 7px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.switchLabel {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}

.switchLabel > span:first-child {
  min-width: 0;
}

.switchLabel strong {
  display: block;
  font-size: 12px;
}

.switchLabel small {
  margin-top: 2px;
}

.switchLabel input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.switchTrack {
  position: relative;
  flex: 0 0 auto;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: #cad3df;
  transition: background 160ms ease, box-shadow 160ms ease;
}

.switchTrack::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(42, 55, 82, 0.24);
  content: "";
  transition: transform 160ms ease;
}

.switchLabel input:checked + .switchTrack {
  background: var(--accent);
}

.switchLabel input:checked + .switchTrack::after {
  transform: translateX(16px);
}

.switchLabel input:focus-visible + .switchTrack {
  box-shadow: 0 0 0 3px rgba(49, 87, 213, 0.18);
}

.primaryButton {
  display: flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #3d62dc, var(--accentStrong));
  box-shadow: var(--shadowStrong);
  color: #fff;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.secondaryButton {
  display: flex;
  width: 100%;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 15px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.secondaryButton:hover {
  border-color: var(--borderStrong);
  background: var(--surfaceStrong);
  transform: translateY(-1px);
}

.secondaryButton:focus-visible {
  outline: 3px solid rgba(49, 87, 213, 0.2);
  outline-offset: 2px;
}

.secondaryButton strong,
.secondaryButton small {
  display: block;
}

.secondaryButton strong {
  font-size: 12px;
}

.secondaryButton small {
  margin-top: 2px;
  color: var(--subtle);
  font-size: 11px;
}

.secondaryButton svg {
  width: 17px;
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.primaryButton svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  transition: transform 160ms ease;
}

.primaryButton:hover:not(:disabled) {
  box-shadow: 0 20px 46px rgba(37, 69, 184, 0.3);
  transform: translateY(-1px);
}

.primaryButton:hover:not(:disabled) svg {
  transform: translateX(3px);
}

.primaryButton:focus-visible {
  outline: 3px solid rgba(49, 87, 213, 0.25);
  outline-offset: 3px;
}

.primaryButton:disabled {
  cursor: wait;
  opacity: 0.72;
}

.primaryButton.isLoading svg {
  animation: loadingArrow 900ms ease-in-out infinite alternate;
}

.submitHint {
  margin: 11px 0 0;
  color: var(--subtle);
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
}

.editorStack {
  display: grid;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  gap: 16px;
}

.editorCard {
  display: flex;
  height: 100%;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  padding: 22px;
}

.editorTopbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 19px;
}

.editorHeader {
  display: flex;
  min-width: 0;
  min-height: 32px;
  flex: 1;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.editorMetric {
  flex: 0 0 auto;
  align-self: flex-start;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surfaceStrong);
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.sourceModeSelector {
  display: grid;
  width: min(410px, 48%);
  flex: 0 1 410px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surfaceStrong);
}

.sourceModeOption {
  position: relative;
  min-width: 0;
}

.sourceModeSelector label {
  display: block;
  cursor: pointer;
}

.sourceModeSelector input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.sourceModeLabel {
  display: flex;
  min-height: 42px;
  align-items: center;
  padding: 8px 36px 8px 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.sourceModeSelector strong {
  color: var(--text);
  font-size: 12px;
}

.sourceModeSelector input:checked + .sourceModeLabel {
  border-color: var(--border);
  background: #fff;
  box-shadow: 0 4px 14px rgba(42, 55, 82, 0.08);
  color: var(--accent);
}

.sourceModeSelector input:focus-visible + .sourceModeLabel {
  box-shadow: 0 0 0 3px rgba(49, 87, 213, 0.18);
}

.sourceModeHelp {
  position: absolute;
  z-index: 2;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
}

.sourceModeHelpText {
  top: calc(100% + 7px);
}

.editorCard > #singleDocumentPanel,
.editorCard > .collectionPanel {
  flex: 1;
  min-height: 0;
}

.editorCard > #singleDocumentPanel .editorSurface,
.editorCard > #singleDocumentPanel textarea {
  height: 100%;
  min-height: 0;
}

.editorCard > #singleDocumentPanel textarea {
  resize: none;
}

.collectionPanel {
  min-height: clamp(520px, 66vh, 790px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
}

.collectionPanel:not([hidden]),
.collectionBrowser:not([hidden]) {
  display: flex;
  min-height: 0;
  flex-direction: column;
}

.collectionBrowser:not([hidden]),
.importEmptyState {
  flex: 1;
}

.importConfiguration {
  display: grid;
  grid-template-columns: minmax(150px, 0.28fr) minmax(0, 0.72fr);
  gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.importConfiguration .fieldGroup {
  margin-top: 0;
}

.importConfiguration select {
  min-height: 38px;
}

.fieldLabelWithHelp {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}

.fieldLabelWithHelp > label {
  margin: 0;
}

.helpTooltip {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--borderStrong);
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  cursor: help;
}

.helpTooltip:hover,
.helpTooltip:focus-visible {
  border-color: var(--accent);
  outline: 0;
  color: var(--accent);
}

.helpTooltipText {
  position: absolute;
  z-index: 4;
  top: calc(100% + 6px);
  right: 0;
  width: min(310px, calc(100vw - 48px));
  padding: 9px 11px;
  border-radius: 9px;
  background: var(--text);
  box-shadow: 0 10px 28px rgba(21, 32, 51, 0.2);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-3px);
  transition: opacity 140ms ease, transform 140ms ease;
  visibility: hidden;
}

.helpTooltip:hover + .helpTooltipText,
.helpTooltip:focus-visible + .helpTooltipText {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
}

.collectionFileGroup input[type="file"] {
  width: 100%;
  min-height: 38px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}

.collectionFileGroup input[type="file"]::file-selector-button {
  min-height: 28px;
  margin-right: 10px;
  padding: 5px 10px;
  border: 0;
  border-radius: 7px;
  background: var(--accentSoft);
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

.importEmptyState {
  display: grid;
  min-height: 0;
  place-content: center;
  justify-items: center;
  padding: 32px;
  color: var(--muted);
  text-align: center;
}

.importEmptyState svg {
  width: 48px;
  margin-bottom: 14px;
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.importEmptyState strong {
  color: var(--text);
  font-size: 14px;
}

.importEmptyState span {
  margin-top: 5px;
  font-size: 12px;
}

.collectionToolbar {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}

.collectionToolbar strong,
.collectionToolbar span {
  display: block;
}

.collectionToolbar strong {
  font-size: 13px;
}

.collectionToolbar span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.selectionActions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.selectionActions button {
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.selectionActions button:hover {
  background: var(--accentSoft);
}

.documentTree {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 10px 12px 18px;
}

.documentTree ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.documentTree ul ul {
  margin-left: 20px;
  padding-left: 13px;
  border-left: 1px solid var(--border);
}

.documentTreeRow {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
}

.treeToggle,
.treeToggleSpacer {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
}

.treeToggle {
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.treeToggle:hover {
  background: var(--surfaceStrong);
  color: var(--accent);
}

.treeToggle:focus-visible {
  outline: 3px solid rgba(49, 87, 213, 0.18);
  outline-offset: 1px;
}

.treeToggle span {
  font-size: 21px;
  line-height: 1;
  transition: transform 140ms ease;
}

.treeToggle[aria-expanded="true"] span {
  transform: rotate(90deg);
}

.documentTree label {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 2px 9px;
  align-items: center;
  padding: 8px 9px;
  border-radius: 9px;
  cursor: pointer;
}

.documentTree label:hover {
  background: var(--surface);
}

.documentTree input {
  grid-row: 1 / span 2;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.documentTree label > span {
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.documentTree label > small {
  overflow: hidden;
  color: var(--subtle);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editorSurface {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
}

.editorToolbar {
  display: flex;
  height: 39px;
  align-items: center;
  gap: 6px;
  padding: 0 13px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.editorToolbar > span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c7d0dc;
}

.editorToolbar > span:first-child {
  background: #ff8f87;
}

.editorToolbar > span:nth-child(2) {
  background: #ffc86b;
}

.editorToolbar > span:nth-child(3) {
  background: #70d2a7;
}

.editorToolbar p {
  margin: 0 0 0 6px;
  color: var(--subtle);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 10px;
}

.editorSurface textarea {
  display: block;
  min-height: clamp(520px, 66vh, 790px);
  resize: vertical;
  border: 0;
  border-radius: 0;
  padding: 20px 22px;
  box-shadow: none;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.7;
  tab-size: 2;
}

.editorSurface textarea:focus {
  box-shadow: inset 0 0 0 2px rgba(49, 87, 213, 0.18);
}

.cssDialog {
  width: min(760px, calc(100vw - 32px));
  max-height: min(780px, calc(100vh - 32px));
  overflow: hidden;
  padding: 0;
  border: 1px solid rgba(210, 219, 232, 0.95);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 28px 90px rgba(20, 32, 55, 0.28);
  color: var(--text);
}

.cssDialog::backdrop {
  background: rgba(18, 28, 48, 0.55);
  backdrop-filter: blur(5px);
}

.cssDialog[open] {
  animation: dialogEnter 180ms ease-out;
}

.dialogHeader,
.dialogFooter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
}

.dialogHeader {
  border-bottom: 1px solid var(--border);
}

.dialogBody {
  padding: 20px;
  background: var(--surface);
}

.cssEditorSurface textarea {
  min-height: min(50vh, 430px);
}

.iconButton {
  display: grid;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

.iconButton:hover {
  background: var(--surfaceStrong);
  color: var(--text);
}

.iconButton:focus-visible,
.dialogConfirmButton:focus-visible {
  outline: 3px solid rgba(49, 87, 213, 0.2);
  outline-offset: 2px;
}

.iconButton svg {
  width: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.dialogFooter {
  border-top: 1px solid var(--border);
}

.dialogFooter p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.dialogConfirmButton {
  min-height: 38px;
  padding: 8px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.dialogConfirmButton:hover {
  background: var(--accentStrong);
}

.errorBox {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
  padding: 14px 16px;
  border: 1px solid var(--dangerBorder);
  border-radius: 14px;
  background: var(--dangerBg);
  color: var(--dangerText);
}

.errorIcon {
  display: grid;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: var(--dangerText);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.errorBox strong,
.errorBox span {
  display: block;
}

.errorBox strong {
  margin-bottom: 2px;
  font-size: 13px;
}

.errorBox div > span {
  font-size: 12px;
  line-height: 1.45;
}

.visuallyHidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@keyframes loadingArrow {
  from { transform: translateX(-2px); }
  to { transform: translateX(3px); }
}

@keyframes dialogEnter {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 980px) {
  .pageShell {
    padding: 22px 20px;
  }

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

  .settingsCard {
    position: static;
  }

  .settingsCard .fieldGroup {
    margin-top: 16px;
  }

  .editorSurface textarea {
    min-height: 52vh;
  }

  .editorStack {
    height: auto !important;
    overflow: visible;
  }

  .editorCard {
    height: auto;
    overflow: visible;
  }

  .editorCard > #singleDocumentPanel .editorSurface,
  .editorCard > #singleDocumentPanel textarea {
    height: auto;
  }

  .editorCard > #singleDocumentPanel textarea {
    min-height: 52vh;
    resize: vertical;
  }

  .editorCard > .collectionPanel {
    min-height: 52vh;
  }
}

@media (max-width: 660px) {
  .pageShell {
    padding: 17px 12px;
  }

  .pageHeader {
    align-items: flex-start;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 18px;
  }

  .brandLockup {
    align-items: flex-start;
    gap: 12px;
  }

  .brandMark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }

  .brandMark svg {
    width: 22px;
  }

  .headerDescription {
    max-width: 34rem;
  }

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

  .workspaceGrid {
    gap: 14px;
  }

  .card {
    border-radius: 16px;
  }

  .settingsCard,
  .editorCard {
    padding: 17px;
  }

  .fieldRow {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .editorHeader {
    align-items: flex-start;
  }

  .editorMetric {
    margin-top: 2px;
  }

  .editorSurface textarea {
    min-height: 48vh;
    padding: 16px;
    font-size: 12px;
  }

  .sourceModeSelector,
  .importConfiguration {
    grid-template-columns: 1fr;
  }

  .editorTopbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 12px;
    margin-bottom: 15px;
  }

  .editorHeader {
    grid-column: 1;
    grid-row: 1;
  }

  .editorMetric {
    grid-column: 2;
    grid-row: 1;
  }

  .sourceModeSelector {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .editorHeader,
  .sourceModeSelector {
    width: 100%;
    flex-basis: auto;
  }

  .editorCard > .collectionPanel {
    min-height: 48vh;
  }

  .collectionToolbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .documentTree ul ul {
    margin-left: 10px;
    padding-left: 8px;
  }

  .cssDialog {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    border-radius: 16px;
  }

  .dialogHeader,
  .dialogFooter {
    padding: 15px;
  }

  .dialogBody {
    padding: 15px;
  }

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

  .dialogConfirmButton {
    width: 100%;
  }

}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
