:root {
  --bg: #f1f4f7;
  --surface: #ffffff;
  --surface-alt: #f8fafb;
  --line: #d6dde4;
  --text: #17212b;
  --muted: #62707c;
  --blue: #18428f;
  --danger: #c94a4a;
  --shadow: 0 18px 40px rgba(20, 35, 52, 0.06);
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background: var(--bg);
}

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

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 34px 32px 30px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card img {
  width: 88px;
  margin: 0 auto 4px;
}

.login-card h1 {
  margin: 0;
  font-family: "Sora", sans-serif;
  text-align: center;
}

.login-note,
.login-help,
.login-error {
  color: var(--muted);
}

.login-heading {
  margin: -4px 0 2px;
  color: var(--muted);
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
}

.login-note,
.login-help {
  margin: 0;
  text-align: center;
}

.login-error {
  min-height: 24px;
  margin: 0;
  color: var(--danger);
  text-align: center;
}

a {
  color: inherit;
  text-decoration: none;
}

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

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

.admin-shell.is-sidebar-collapsed {
  grid-template-columns: 1fr;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  overflow: auto;
}

.admin-shell.is-sidebar-collapsed .admin-sidebar {
  display: none;
}

.admin-brand {
  display: flex;
  gap: 14px;
  align-items: center;
}

.admin-brand img {
  width: 72px;
}

.admin-brand strong,
.admin-header h1,
.panel-head h2,
.editor-card h3,
.item-card h4,
.subpanel h3 {
  font-family: "Sora", sans-serif;
}

.admin-brand span,
#status-text,
label span,
.input-help {
  color: var(--muted);
}

.admin-nav,
.admin-actions {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.admin-userbox {
  display: grid;
  gap: 8px;
  margin-top: 24px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-alt);
}

.admin-nav-button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-alt);
}

.admin-nav-button {
  color: var(--text);
  cursor: pointer;
}

.admin-nav-button.is-active {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
}

.button {
  cursor: pointer;
}

.button-primary {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
}

.button-danger {
  color: var(--danger);
  border-color: rgba(201, 74, 74, 0.22);
  background: rgba(201, 74, 74, 0.06);
}

.admin-main {
  padding: 28px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--blue);
  font-size: 0.84rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.admin-header-main {
  min-width: 0;
}

.admin-header h1 {
  margin: 0 0 10px;
  max-width: none;
  font-size: clamp(2rem, 3.2vw, 2.8rem);
  line-height: 0.98;
}

.admin-header-toggle {
  flex: 0 0 auto;
  min-width: 150px;
}

.panel-stack {
  display: grid;
  gap: 18px;
  margin-top: 24px;
}

.page-management-shell {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.page-structure-pane,
.page-editor-pane {
  min-width: 0;
  display: grid;
  gap: 16px;
}

.page-structure-pane {
  width: 272px;
  max-width: 272px;
}

.page-editor-pane {
  width: 100%;
  min-width: 0;
}

#menu-manager {
  width: 100%;
  max-width: 272px;
}

.panel-head.panel-head-sub {
  margin: 0;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  min-width: 0;
  width: 100%;
}

.panel-head.panel-head-sub h3 {
  margin: 0;
  font-size: 1.05rem;
  min-width: 0;
}

.page-structure-pane > .panel-head.panel-head-sub {
  grid-template-columns: 1fr;
  justify-items: start;
}

.page-management-shell > .page-structure-pane > .panel-head.panel-head-sub,
.page-management-shell > .page-editor-pane > .panel-head.panel-head-sub {
  min-height: 92px;
  box-sizing: border-box;
  align-content: start;
}

.page-management-shell > .page-editor-pane > .panel-head.panel-head-sub > div {
  display: grid;
  align-content: start;
  min-height: 100%;
}

.page-structure-pane > .panel-head.panel-head-sub .button {
  width: auto;
  min-width: 0;
  padding-inline: 14px;
}

.panel-lead {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.page-content-workspace {
  display: grid;
  gap: 16px;
}

.admin-panel,
.editor-card,
.item-card,
.subpanel,
.menu-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.admin-panel {
  padding: 22px;
}

.admin-panel.is-hidden {
  display: none;
}

.menu-item,
.editor-card,
.subpanel,
.item-card {
  padding: 18px;
}

.page-structure-pane .menu-item,
.page-structure-pane .menu-item-static {
  width: 100%;
  max-width: 272px;
  padding: 14px;
}

.menu-draggable {
  cursor: default;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.menu-draggable.is-dragging {
  opacity: 0.6;
  cursor: grabbing;
}

.menu-draggable.is-drop-target {
  border-color: rgba(24, 66, 143, 0.28);
  box-shadow: 0 0 0 2px rgba(24, 66, 143, 0.08);
}

.menu-item.is-selected {
  border-color: rgba(24, 66, 143, 0.24);
  box-shadow: 0 24px 50px rgba(24, 66, 143, 0.12);
}

.menu-item-static {
  cursor: pointer;
}

.menu-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  position: relative;
  min-height: 48px;
  padding-right: 92px;
}

.menu-item-head-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: nowrap;
}

.menu-item-head-left h4 {
  margin: 0;
  cursor: pointer;
  min-width: 0;
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-item-type {
  display: none;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(24, 66, 143, 0.08);
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.menu-drag-handle {
  font-size: 1.1rem;
  letter-spacing: 1px;
  color: var(--muted);
  user-select: none;
  cursor: grab;
  padding: 6px 8px;
  border-radius: 999px;
  touch-action: none;
}

.menu-drag-handle:hover {
  background: rgba(24, 66, 143, 0.08);
}

.menu-drag-handle:active {
  cursor: grabbing;
}

body.is-menu-dragging {
  user-select: none;
}

.menu-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(calc(-50% + 8px));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
}

.menu-item:hover .menu-actions,
.menu-item:focus-within .menu-actions,
.menu-item.is-selected .menu-actions,
.menu-item.is-expanded .menu-actions,
.menu-item-static:hover .menu-actions,
.menu-item-static:focus-within .menu-actions {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(-50%);
}

.menu-expand-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 0.9rem;
}

.menu-item-body {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition:
    grid-template-rows 260ms ease,
    opacity 220ms ease,
    margin-top 220ms ease;
  margin-top: 0;
}

.menu-item.is-expanded .menu-item-body {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: 16px;
}

.menu-item-body > * {
  min-height: 0;
  overflow: hidden;
}

.menu-manager-intro {
  display: grid;
  gap: 6px;
  padding: 16px 18px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(24, 66, 143, 0.05), rgba(24, 66, 143, 0.02));
  border: 1px solid rgba(24, 66, 143, 0.08);
  color: var(--muted);
}

.menu-manager-intro strong {
  color: var(--text);
  font-size: 15px;
}

.menu-manager-intro span {
  font-size: 13px;
  line-height: 1.55;
}

.menu-manager-intro-main {
  margin-bottom: 2px;
}

.menu-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.8fr);
  gap: 14px;
}

.menu-node-editor {
  display: grid;
  gap: 14px;
}

.menu-node-note {
  padding: 14px 16px;
  border: 1px dashed rgba(24, 66, 143, 0.22);
  border-radius: 16px;
  background: rgba(24, 66, 143, 0.03);
  color: var(--muted);
}

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

.menu-field.full {
  grid-column: 1 / -1;
}

.menu-toggle-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(24, 66, 143, 0.03);
}

.menu-toggle-copy {
  display: grid;
  gap: 4px;
}

.menu-toggle-copy strong,
.menu-toggle-copy small {
  line-height: 1.3;
}

.menu-toggle-copy small {
  color: var(--muted);
}

.menu-switch {
  position: relative;
  display: inline-flex;
  width: 54px;
  height: 32px;
  flex: 0 0 auto;
}

.menu-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.menu-switch-slider {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: #cfd7df;
  transition: background 0.2s ease;
}

.menu-switch-slider::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 10px rgba(15, 32, 52, 0.12);
  transition: transform 0.2s ease;
}

.menu-switch input:checked + .menu-switch-slider {
  background: var(--blue);
}

.menu-switch input:checked + .menu-switch-slider::after {
  transform: translateX(22px);
}

.menu-child-list {
  display: grid;
  gap: 14px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed rgba(24, 66, 143, 0.14);
}

.menu-depth-1 {
  margin-left: 24px;
  background: linear-gradient(180deg, rgba(24, 66, 143, 0.02), rgba(24, 66, 143, 0.04));
}

.panel-head,
.item-head,
.toggle-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.panel-head.panel-head-sub {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.item-head {
  align-items: flex-start;
}

.item-head-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.panel-head h2,
.editor-card h3,
.item-card h4,
.subpanel h3 {
  margin: 0;
}

.admin-grid,
.repeater {
  display: grid;
  gap: 14px;
}

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

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

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

.field-grid .full {
  grid-column: 1 / -1;
}

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

.login-card label {
  gap: 10px;
}

.login-card .button-primary {
  width: 100%;
  margin-top: 8px;
  padding-top: 15px;
  padding-bottom: 15px;
}

input,
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

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

.editor-card.editor-card-compact textarea {
  min-height: 150px;
  max-height: 180px;
  overflow-y: auto;
}

.compact-editor-layout textarea {
  min-height: 150px;
  max-height: 180px;
  overflow-y: auto;
}

.image-field {
  display: grid;
  grid-template-columns: 200px minmax(280px, 1fr);
  gap: 18px;
  align-items: start;
}

.compact-editor-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.compact-editor-layout > .editor-card,
.compact-editor-layout > .item-card,
.compact-editor-layout > .subpanel,
.compact-editor-layout > .menu-item {
  padding: 14px;
  align-self: start;
}

.compact-editor-layout .field-grid {
  grid-template-columns: 1fr;
}

.compact-editor-layout .field-grid.field-grid-compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.compact-editor-layout .field-grid.field-grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compact-editor-layout .image-field {
  grid-template-columns: 1fr;
}

.compact-editor-layout .editor-card-image-split .image-field {
  grid-template-columns: 200px minmax(0, 1fr);
  align-items: start;
}

.compact-editor-layout .image-preview {
  max-width: min(200px, 100%);
}

.compact-editor-layout .repeater {
  gap: 12px;
}

.compact-editor-layout .item-card {
  padding: 14px;
}

.item-cover-preview {
  margin-bottom: 14px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #eef2f7;
}

.item-cover-preview img {
  display: block;
  width: 100%;
  max-width: 200px;
  height: 140px;
  object-fit: cover;
}

.project-editor-head-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
}

.project-editor-head-left h4 {
  margin: 0;
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
  max-width: 220px;
}

.project-editor-mini-preview {
  flex: 0 0 58px;
  width: 58px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #eef2f7;
}

.project-editor-mini-preview img,
.project-editor-mini-preview span {
  display: block;
  width: 100%;
  height: 100%;
}

.project-editor-mini-preview img {
  object-fit: cover;
}

.project-editor-mini-preview span {
  display: grid;
  place-items: center;
  padding: 4px;
  font-size: 0.66rem;
  color: var(--muted);
  text-align: center;
}

.project-editor-card .item-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.project-editor-card .item-head-actions {
  flex: 0 0 auto;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.project-editor-card .item-head-actions .button {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  white-space: nowrap;
}

.project-media-list {
  margin-top: 12px;
}

.project-media-item {
  display: grid;
  align-content: start;
  gap: 12px;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.project-media-item.is-dragging {
  opacity: 0.58;
  transform: scale(0.99);
}

.project-media-item.is-drop-target {
  border-color: rgba(24, 66, 143, 0.26);
  box-shadow: 0 0 0 2px rgba(24, 66, 143, 0.08);
}

.project-media-head-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.project-media-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-alt);
  color: var(--muted);
  cursor: grab;
  user-select: none;
}

.project-media-drag-handle:active {
  cursor: grabbing;
}

.project-media-item .card-toggle-body {
  grid-template-columns: 1fr;
  align-items: start;
}

.project-media-item .field-grid {
  margin-top: 10px;
  grid-template-columns: 1fr;
}

.project-media-preview {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #eef2f7;
  min-height: 76px;
  max-width: none;
}

.project-media-preview img,
.project-media-preview video {
  display: block;
  width: 100%;
  height: 76px;
  object-fit: cover;
}

.project-media-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 76px;
  padding: 10px;
  text-align: center;
  color: var(--muted);
}

.card-toggle-bar {
  margin-bottom: 12px;
}

.card-toggle-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-alt);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.card-toggle-button strong {
  font-size: 1.2rem;
  line-height: 1;
  color: var(--blue);
}

.card-toggle-head {
  cursor: pointer;
}

.card-toggle-head .card-toggle-indicator {
  margin-left: auto;
  color: var(--blue);
  font-size: 1.2rem;
  line-height: 1;
}

.card-toggle-body {
  display: grid;
  gap: 14px;
  max-height: 520px;
  overflow-y: auto;
  overflow-anchor: none;
  padding-right: 4px;
}

.project-repeater-panel .card-toggle-body {
  max-height: 680px;
}

.compact-card.is-collapsed .card-toggle-body {
  display: none;
}

.compact-card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.repeater.repeater-cols-1 {
  grid-template-columns: 1fr;
}

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

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

.repeater.repeater-cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.image-preview {
  width: 200px;
  max-width: 200px;
  height: 200px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-alt);
}

.back-to-top-button {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(24, 66, 143, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 36px rgba(14, 22, 43, 0.14);
  color: var(--blue);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(12px) scale(0.96);
  transition: opacity 180ms ease, transform 180ms ease, box-shadow 180ms ease, width 180ms ease;
  backdrop-filter: blur(10px);
}

.back-to-top-button.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.back-to-top-icon {
  font-size: 1rem;
  line-height: 1;
}

.back-to-top-text {
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  opacity: 0;
  transition: max-width 180ms ease, opacity 180ms ease;
}

.back-to-top-button:hover,
.back-to-top-button:focus-visible {
  box-shadow: 0 22px 42px rgba(24, 66, 143, 0.18);
}

.back-to-top-button:hover .back-to-top-text,
.back-to-top-button:focus-visible .back-to-top-text {
  max-width: 80px;
  opacity: 1;
}

.image-picker {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.image-selected-meta {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-alt);
  color: var(--muted);
}

.image-picker-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.image-file-input {
  display: none;
}

.inline-media-library {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-alt);
  max-height: 240px;
  overflow-y: auto;
}

.inline-media-card {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.inline-media-card.is-selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(24, 66, 143, 0.08);
}

.inline-media-card img {
  width: 100%;
  height: 96px;
  object-fit: cover;
  border-radius: 10px;
}

.inline-media-card strong {
  font-size: 0.84rem;
}

.media-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 32, 62, 0.42);
  backdrop-filter: blur(8px);
}

.media-picker-dialog {
  width: min(980px, 100%);
  max-height: min(84vh, 920px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(15, 32, 62, 0.18);
  display: grid;
  grid-template-rows: auto 1fr;
}

.media-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.media-picker-head h3 {
  margin: 0;
}

.media-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
  padding: 20px;
  overflow-y: auto;
}

.media-picker-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}

.media-picker-card.is-selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(24, 66, 143, 0.08);
}

.media-picker-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  background: var(--surface-alt);
}

.media-picker-card strong,
.media-picker-card span {
  padding: 0 2px;
}

.media-picker-card span {
  color: var(--muted);
  font-size: 0.88rem;
}

.media-card img {
  width: 200px;
  max-width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 12px;
}

.media-meta {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

#finance-editor.compact-editor-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#services-editor.compact-editor-layout,
#operations-editor.compact-editor-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#finance-editor .finance-cards-card .repeater {
  grid-template-columns: 1fr;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.menu-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.toggle-row {
  margin-bottom: 0;
}

.toggle-row input {
  width: auto;
}

.toast {
  position: fixed;
  right: 24px;
  top: 24px;
  z-index: 120;
  max-width: min(420px, calc(100vw - 32px));
  padding: 14px 18px;
  border-radius: 14px;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 16px 34px rgba(20, 35, 52, 0.16);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1040px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-shell.is-sidebar-collapsed .admin-sidebar {
    display: block;
  }

  .admin-sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .page-management-shell {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  .admin-main {
    padding: 18px;
  }

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

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

  .field-grid.field-grid-compact {
    grid-template-columns: 1fr;
  }

  .compact-editor-layout .field-grid.field-grid-compact,
  .compact-editor-layout .field-grid.field-grid-two,
  .repeater.repeater-cols-2,
  .repeater.repeater-cols-3,
  .repeater.repeater-cols-4,
  #finance-editor.compact-editor-layout,
  #services-editor.compact-editor-layout,
  #operations-editor.compact-editor-layout {
    grid-template-columns: 1fr;
  }

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

  .compact-editor-layout {
    grid-template-columns: 1fr;
  }

  .image-field {
    grid-template-columns: 1fr;
  }

  .project-media-item .card-toggle-body {
    grid-template-columns: 1fr;
  }

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

  .image-preview {
    width: min(200px, 100%);
    max-width: min(200px, 100%);
    height: auto;
    aspect-ratio: 1 / 1;
  }

  .panel-head,
  .item-head,
  .toggle-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .menu-item-head,
  .menu-toggle-field {
    flex-direction: column;
    align-items: stretch;
  }

  .menu-item-head {
    padding-right: 0;
  }

  .menu-actions {
    position: static;
    transform: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .menu-depth-1 {
    margin-left: 0;
  }

  .media-picker-dialog {
    width: 100%;
  }

  .back-to-top-button {
    right: 18px;
    bottom: 18px;
  }
}
