/* ============================================================
   editor.css — окно конструктора
   ============================================================ */

.app-editor {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--surface-paper, #fffdf8);
  user-select: text;
  -webkit-user-select: text;
}

.ed-panel,
.ed-card,
.ed-field,
.ed-textarea,
.ed-input,
.ed-code,
.ed-preview-box {
  user-select: text;
  -webkit-user-select: text;
}

/* ---------- Верхняя полоса ---------- */

.ed-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border-dark);
  flex: none;
}

.ed-brand {
  font-weight: 700;
  font-size: 13px;
  color: var(--sand-dark);
  letter-spacing: 0.02em;
}

.ed-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
  flex-wrap: wrap;
}

.ed-btn {
  padding: 6px 11px;
  border-radius: 8px;
  border: 1px solid var(--border-dark);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.ed-btn:hover {
  background: var(--dock-hover-bg);
  border-color: var(--accent);
}

.ed-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.ed-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.ed-btn-main {
  background: var(--accent);
  border-color: var(--accent-dark);
  color: var(--on-accent);
  font-weight: 600;
}

.ed-btn-main:hover {
  background: var(--accent-dark);
}

/* Главная кнопка сохранения: заметнее остальных */
.ed-btn-save {
  background: var(--accent-dark);
  border: 2px solid var(--accent-dark);
  color: var(--on-accent);
  font-weight: 700;
  padding: 6px 14px;
  box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.35);
}

.ed-btn-save:hover {
  background: var(--text);
  border-color: var(--text);
  color: var(--surface-paper);
}

.ed-btn-save:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

/* Меню сохранения: одна кнопка, два понятных способа */
.ed-save-menu {
  position: relative;
  display: inline-flex;
}

.ed-save-menu > summary {
  display: inline-flex;
  align-items: center;
  list-style: none;
  cursor: pointer;
}

.ed-save-menu > summary::-webkit-details-marker {
  display: none;
}

.ed-save-menu > summary::after {
  content: "▾";
  margin-left: 4px;
  font-size: 10px;
}

.ed-save-list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 800;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 220px;
  padding: 4px;
  background: var(--surface-paper);
  border: 1px solid var(--border-dark);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(var(--accent-rgb), 0.25);
}

.ed-save-item {
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.ed-save-item:hover {
  background: var(--dock-hover-bg);
}

.ed-save-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.ed-save-item:disabled {
  color: var(--text-dim);
  cursor: not-allowed;
}

.ed-btn-danger {
  color: #a33a2a;
  border-color: #d9b3ab;
}

.ed-btn-danger:hover {
  background: #f7e4e0;
  border-color: #c4715f;
}

.ed-status {
  flex: none;
  padding: 0 12px;
  font-size: 11px;
  line-height: 0;
  color: var(--text-dim);
  overflow: hidden;
  transition: padding 0.2s ease, line-height 0.2s ease;
}

.ed-status.show {
  padding: 7px 12px;
  line-height: 1.4;
}

.ed-status.ok {
  color: #3f6b3a;
  background: #eaf1e6;
  border-bottom: 1px solid #cfe0c9;
}

.ed-status.err {
  color: #963626;
  background: #f8e7e3;
  border-bottom: 1px solid #e8c7bf;
}

/* ---------- Тело: меню и панель ---------- */

.ed-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.ed-nav {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-inset);
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  flex: none;
  scrollbar-width: none;
}

.ed-nav::-webkit-scrollbar {
  display: none;
}

.ed-tab {
  text-align: center;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-soft);
  color: var(--text-dim);
  font-size: 11.5px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.ed-tab:hover {
  background: var(--dock-hover-bg);
  border-color: var(--accent);
  color: var(--text);
}

.ed-tab.active {
  background: var(--accent);
  border-color: var(--accent-dark);
  color: var(--on-accent);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(var(--accent-rgb), 0.25);
}

.ed-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.ed-panel {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 14px 16px 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ed-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.ed-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
  align-items: start;
}

.ed-span-all {
  grid-column: 1 / -1;
}

/* ---------- Master-Detail Split (заметки, документы, браузер) ---------- */

.ed-split {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.ed-master {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 8px;
  position: sticky;
  top: 0;
}

.ed-master-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 55vh;
  overflow-y: auto;
}

.ed-master-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.ed-master-item:hover {
  background: var(--surface-mute);
}

.ed-master-item.active {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}

.ed-master-sub {
  font-size: 10.5px;
  opacity: 0.72;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.ed-detail {
  min-width: 0;
}

@media (max-width: 720px) {
  .ed-grid-2,
  .ed-split {
    grid-template-columns: 1fr;
  }

  .ed-master {
    position: static;
  }

  .ed-master-list {
    max-height: 180px;
  }
}

/* ---------- Карточки и поля ---------- */

.ed-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ed-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ed-card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--sand-dark);
  margin-right: auto;
}

.ed-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ed-label {
  font-size: 11px;
  color: var(--text-dim);
}

.ed-input,
.ed-textarea,
.ed-select {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  border: 1px solid var(--border-dark);
  border-radius: 7px;
  background: var(--surface-paper);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  line-height: 1.45;
}

.ed-input:focus,
.ed-textarea:focus,
.ed-select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.ed-textarea {
  resize: vertical;
  min-height: 72px;
}

.ed-code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  min-height: 150px;
  white-space: pre;
  tab-size: 2;
}

.ed-fmt-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

.ed-fmt-btn {
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--border-dark);
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.ed-fmt-btn:hover {
  background: var(--dock-hover-bg);
  border-color: var(--accent);
}

.ed-fmt-btn.active {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent-dark);
}

.ed-preview-box {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-inset);
  min-height: 80px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  overflow-wrap: break-word;
  box-sizing: border-box;
}

.ed-preview-box blockquote {
  margin: 8px 0 12px;
  padding: 8px 14px 8px 12px;
  background: var(--surface-soft);
  border-right: 3px solid var(--accent);
  border-radius: 6px 0 0 6px;
  color: var(--text);
  font-style: italic;
}

.ed-hint {
  font-size: 10.5px;
  color: var(--text-dim);
  line-height: 1.4;
}

.ed-preset-warning {
  margin-top: 6px;
  padding: 6px 8px;
  border-left: 2px solid var(--sand-accent);
  background: var(--surface-soft);
  color: var(--text);
  border-radius: 4px;
}

.ed-preview-img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
}

.ed-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.ed-row > .ed-field {
  flex: 1;
}

/* ---------- Переключатель режима ---------- */

.ed-seg {
  display: inline-flex;
  border: 1px solid var(--border-dark);
  border-radius: 8px;
  overflow: hidden;
}

.ed-seg button {
  padding: 5px 10px;
  border: 0;
  background: var(--surface-soft);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
}

.ed-seg button + button {
  border-left: 1px solid var(--border-dark);
}

.ed-seg button.active {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}

/* ---------- Список ссылок ---------- */

.ed-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ed-link-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.ed-link-row .ed-input {
  flex: 1;
  min-width: 0;
}

.ed-mini {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid var(--border-dark);
  background: var(--surface-soft);
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.ed-mini:hover {
  background: var(--dock-hover-bg);
  color: var(--text);
}

/* ---------- Список приложений ---------- */

.ed-apps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
  align-items: start;
}

.ed-app-card {
  gap: 8px;
}

.ed-app-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-paper);
}

.ed-app-icon {
  width: 26px;
  height: 26px;
  flex: none;
  color: var(--sand-dark);
  display: grid;
  place-items: center;
}

.ed-app-icon svg {
  width: 20px;
  height: 20px;
}

.ed-app-info {
  flex: 1;
  min-width: 0;
}

.ed-app-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.ed-app-type {
  font-size: 10.5px;
  color: var(--text-dim);
}

.ed-app-row.is-fixed .ed-app-type::after {
  content: " • нельзя удалить";
}

/* ---------- Пустое состояние ---------- */

.ed-empty {
  padding: 18px 14px;
  border: 1px dashed var(--border-dark);
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 12px;
  text-align: center;
}

.ed-add {
  align-self: flex-start;
  padding: 6px 11px;
  border-radius: 8px;
  border: 1px dashed var(--border-dark);
  background: transparent;
  color: var(--accent-dark);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}

.ed-add:hover {
  border-style: solid;
  border-color: var(--accent);
  background: var(--surface-soft);
}

/* ---------- Окно загрузки файла ---------- */

.ed-load {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(36, 30, 24, 0.52);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.ed-load.is-on {
  opacity: 1;
}

.ed-load.is-out {
  opacity: 0;
}

.ed-load-card {
  width: min(320px, 100%);
  padding: 24px 24px 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-paper, #fffdf8);
  box-shadow: 0 22px 60px rgba(30, 24, 18, 0.35);
  text-align: center;
  transform: translateY(10px) scale(0.97);
  transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.ed-load.is-on .ed-load-card {
  transform: translateY(0) scale(1);
}

.ed-load-ring {
  position: relative;
  width: 54px;
  height: 54px;
  margin: 0 auto 14px;
  border: 3px solid var(--accent);
  border-top-color: transparent;
  border-right-color: transparent;
  border-radius: 50%;
  animation: edLoadSpin 0.9s linear infinite;
}

.ed-load-ring::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.18;
  animation: edLoadPulse 1.6s ease-in-out infinite;
}

.ed-load-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text);
}

.ed-load-file {
  margin-top: 3px;
  overflow: hidden;
  font-size: 11px;
  color: var(--text-dim);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ed-load-bar {
  height: 8px;
  margin: 16px 0 8px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--surface-mute);
}

.ed-load-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--sand-dark), var(--accent));
  background-size: 200% 100%;
  transition: width 0.18s ease;
  animation: edLoadShine 1.4s linear infinite;
}

.ed-load-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.ed-load-pct {
  font-weight: 700;
  color: var(--text);
}

@keyframes edLoadSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes edLoadPulse {
  50% {
    transform: scale(0.72);
    opacity: 0.35;
  }
}

@keyframes edLoadShine {
  to {
    background-position: -200% 0;
  }
}

.no-motion .ed-load-ring,
.no-motion .ed-load-ring::after,
.no-motion .ed-load-fill {
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  .ed-load-ring,
  .ed-load-ring::after,
  .ed-load-fill {
    animation: none;
  }

  .ed-load,
  .ed-load-card,
  .ed-load-fill {
    transition: none;
  }
}

/* ---------- Дерево файлов ---------- */

.ed-tree {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ed-tree-children {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  padding-left: 12px;
  border-left: 2px dashed var(--border-dark);
}

.ed-tree-children.ed-tree-root {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 10px;
  align-items: start;
  margin-left: 0;
  padding-left: 0;
  border-left: 0;
}

.ed-tree-node {
  background: var(--surface-paper);
}

.ed-tree-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.ed-tree-actions .ed-btn {
  padding: 4px 9px;
  font-size: 11px;
}

/* ---------- Гайд ---------- */

.ed-guide {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
  align-items: start;
}

.ed-guide-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-dim);
}

.ed-guide-p {
  margin: 0;
}

.ed-guide-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ed-guide-body code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--surface-mute);
  color: var(--sand-dark);
}

.ed-guide-code {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-inset);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre;
}

/* ---------- Узкий экран ---------- */

@media (max-width: 620px) {
  .ed-body {
    flex-direction: column;
  }

  .ed-nav {
    width: auto;
    flex-direction: row;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .ed-tab {
    white-space: nowrap;
  }

  .ed-panel {
    padding: 12px 12px 22px;
  }

  .ed-guide-code {
    font-size: 10.5px;
  }
}

/* ------------------------------------------------------------
   Стиль Liquid Glass для конструктора
   ------------------------------------------------------------ */

body[data-style="glass"] .app-editor {
  background: transparent;
}

body[data-style="glass"] .ed-top {
  background: rgba(var(--accent-rgb), 0.14);
  border-bottom-color: rgba(var(--accent-rgb), 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

body[data-style="glass"] .ed-nav {
  background: rgba(var(--accent-rgb), 0.08);
  border-right-color: rgba(var(--accent-rgb), 0.2);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

body[data-style="glass"] .ed-tab {
  color: var(--text-dim);
}

body[data-style="glass"] .ed-tab:hover {
  background: rgba(var(--accent-rgb), 0.18);
  color: var(--text);
}

body[data-style="glass"] .ed-tab.active {
  background: var(--sand-accent);
  color: var(--on-accent);
  box-shadow: 0 2px 10px rgba(var(--accent-rgb), 0.45);
}

body[data-style="glass"] .ed-card {
  background: rgba(var(--accent-rgb), 0.12);
  border-color: rgba(var(--accent-rgb), 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

body[data-style="glass"] .ed-btn {
  background: rgba(var(--accent-rgb), 0.2);
  border-color: rgba(var(--accent-rgb), 0.35);
  color: var(--text);
}

body[data-style="glass"] .ed-btn:hover,
body[data-style="glass"] .ed-btn:focus-visible {
  background: rgba(var(--accent-rgb), 0.35);
  border-color: var(--sand-accent);
}

body[data-style="glass"] .ed-btn-main {
  background: var(--sand-accent);
  border-color: var(--sand-accent);
  color: var(--on-accent);
  box-shadow: 0 2px 12px rgba(var(--accent-rgb), 0.45);
}

body[data-style="glass"] .ed-btn-save {
  background: rgba(var(--accent-rgb), 0.28);
  border-color: var(--sand-accent);
  color: var(--text);
}

body[data-style="glass"] .ed-field input,
body[data-style="glass"] .ed-select,
body[data-style="glass"] .ed-textarea,
body[data-style="glass"] .ed-code {
  background-color: rgba(var(--accent-rgb), 0.14);
  border-color: rgba(var(--accent-rgb), 0.3);
  color: var(--text);
}

body.theme-dark[data-style="glass"] .ed-card {
  background: rgba(var(--accent-rgb), 0.08);
  border-color: rgba(var(--accent-rgb), 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* ------------------------------------------------------------
   Стиль Windows 98 для конструктора
   ------------------------------------------------------------ */

body[data-style="win98"] .ed-tab,
body[data-style="win98"] .ed-card,
body[data-style="win98"] .ed-btn,
body[data-style="win98"] .ed-btn-main,
body[data-style="win98"] .ed-btn-save,
body[data-style="win98"] .ed-field input,
body[data-style="win98"] .ed-select,
body[data-style="win98"] .ed-textarea,
body[data-style="win98"] .ed-code,
body[data-style="win98"] .ed-dialog-window {
  border-radius: 0;
}

body[data-style="win98"] .ed-btn,
body[data-style="win98"] .ed-btn-main,
body[data-style="win98"] .ed-btn-save {
  border: 1px solid var(--border-dark);
  background: var(--surface-mute);
  color: var(--text);
  box-shadow: inset 1px 1px 0 var(--surface-paper), inset -1px -1px 0 rgba(0, 0, 0, 0.35);
  transition: none;
}

body[data-style="win98"] .ed-btn:hover,
body[data-style="win98"] .ed-btn-main:hover,
body[data-style="win98"] .ed-btn-save:hover {
  background: var(--surface-soft);
}

body[data-style="win98"] .ed-btn:active,
body[data-style="win98"] .ed-btn-main:active,
body[data-style="win98"] .ed-btn-save:active {
  box-shadow: inset 1px 1px 0 rgba(0, 0, 0, 0.45);
  transform: translate(1px, 1px);
}

body[data-style="win98"] .ed-field input,
body[data-style="win98"] .ed-select,
body[data-style="win98"] .ed-textarea,
body[data-style="win98"] .ed-code {
  border: 1px solid var(--border-dark);
  background-color: var(--surface-paper);
  box-shadow: inset 1px 1px 0 rgba(0, 0, 0, 0.35);
}

body[data-style="win98"] .ed-tab.active {
  background: var(--surface-paper);
  border: 1px solid var(--border-dark);
  color: var(--text);
  font-weight: 700;
}

/* ------------------------------------------------------------
   Стиль Aero для конструктора (Frutiger Aero)
   ------------------------------------------------------------ */

body[data-style="aero"] .ed-card {
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.65) 0%, rgba(255, 255, 255, 0.2) 100%),
    var(--surface-paper);
  border: 1px solid rgba(var(--accent-rgb), 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 4px 16px rgba(0, 0, 0, 0.05);
}

body[data-style="aero"] .ed-tab {
  border-radius: 8px;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

body[data-style="aero"] .ed-tab:hover {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.75) 0%, rgba(var(--accent-rgb), 0.12) 100%),
    var(--surface-mute);
}

body[data-style="aero"] .ed-tab.active {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.65) 0%, rgba(255, 255, 255, 0.2) 48%, rgba(0, 0, 0, 0.08) 50%, rgba(255, 255, 255, 0.2) 100%),
    var(--sand-dark);
  color: var(--on-accent);
  box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.35), inset 0 1px 0.5px rgba(255, 255, 255, 0.9);
}

body[data-style="aero"] .ed-btn,
body[data-style="aero"] .ed-btn-save {
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0.25) 48%, rgba(var(--accent-rgb), 0.08) 50%, rgba(255, 255, 255, 0.25) 100%),
    var(--surface-mute);
  color: var(--text);
  box-shadow:
    inset 0 1px 0.5px rgba(255, 255, 255, 0.95),
    0 2px 4px rgba(0, 0, 0, 0.08);
}

body[data-style="aero"] .ed-btn:hover,
body[data-style="aero"] .ed-btn-save:hover {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0.35) 48%, rgba(var(--accent-rgb), 0.14) 50%, rgba(255, 255, 255, 0.35) 100%),
    var(--hover-strong);
  box-shadow:
    0 0 10px rgba(var(--accent-rgb), 0.45),
    0 3px 6px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 #ffffff;
}

body[data-style="aero"] .ed-btn-main {
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.65) 0%, rgba(255, 255, 255, 0.2) 48%, rgba(0, 0, 0, 0.08) 50%, rgba(255, 255, 255, 0.2) 100%),
    var(--sand-dark);
  color: var(--on-accent);
  box-shadow:
    0 4px 14px rgba(var(--accent-rgb), 0.4),
    inset 0 1.5px 0.5px rgba(255, 255, 255, 0.95);
}

body[data-style="aero"] .ed-btn-main:hover {
  box-shadow:
    0 0 16px var(--sand-accent),
    0 5px 16px rgba(0, 0, 0, 0.2),
    inset 0 1.5px 0.5px #ffffff;
}

body[data-style="aero"] .ed-field input,
body[data-style="aero"] .ed-select,
body[data-style="aero"] .ed-textarea,
body[data-style="aero"] .ed-code {
  border-radius: 8px;
  background: linear-gradient(180deg, var(--surface-paper) 0%, var(--surface-inset) 100%);
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  box-shadow: inset 0 1.5px 2px rgba(0, 0, 0, 0.08), 0 1px 0 rgba(255, 255, 255, 0.85);
}

body.theme-dark[data-style="aero"] .ed-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(var(--accent-rgb), 0.06) 100%),
    var(--surface-paper);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 4px 16px rgba(0, 0, 0, 0.35);
}

/* ---------- Своё окно подтверждения ---------- */

.ed-dialog {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.42);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.ed-dialog.is-on {
  opacity: 1;
}

.ed-dialog-card {
  width: min(380px, 100%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-paper);
  box-shadow: 0 18px 40px rgba(var(--accent-rgb), 0.28);
}

.ed-dialog-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--sand-dark);
}

.ed-dialog-text {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-dim);
}

.ed-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

body.no-motion .ed-dialog {
  transition: none;
}

/* ---------- Предупреждение о liquid glass ---------- */

.ed-glass-notice {
  display: none;
  z-index: 901;
}

.ed-glass-notice.is-on {
  display: grid;
}

.ed-glass-notice .ed-dialog-card {
  width: min(420px, 100%);
  border-color: var(--border-dark);
  background: var(--surface-paper);
  box-shadow: 0 18px 40px rgba(var(--accent-rgb), 0.34), 0 0 0 1px rgba(var(--accent-rgb), 0.18);
}

.ed-glass-notice .ed-card-head {
  margin: 0;
  justify-content: space-between;
}

body.no-motion .ed-glass-notice .ed-btn-main {
  animation: none;
}

.ed-glass-notice .ed-dialog-actions {
  flex-wrap: wrap;
}

.ed-glass-notice .ed-dialog-actions .ed-btn-main {
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.22);
  animation: ed-glass-pulse 1.6s ease-in-out infinite;
}

@keyframes ed-glass-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.18); }
  50% { box-shadow: 0 0 0 5px rgba(var(--accent-rgb), 0.28); }
}

@media (max-width: 480px) {
  .ed-glass-notice .ed-dialog-actions .ed-btn {
    flex: 1 1 100%;
  }
}


/* ------------------------------------------------------------
   Material 3 / Material Design для конструктора
   ------------------------------------------------------------ */
body[data-style="material"] .app-editor {
  background: transparent;
}

body[data-style="material"] .ed-top {
  background: color-mix(in srgb, var(--surface-soft) 78%, var(--accent) 22%);
  border-bottom-color: transparent;
}

body[data-style="material"] .ed-nav {
  background: color-mix(in srgb, var(--surface-inset) 82%, var(--accent) 18%);
  border-right-color: transparent;
}

body[data-style="material"] .ed-tab,
body[data-style="material"] .ed-btn,
body[data-style="material"] .ed-btn-main,
body[data-style="material"] .ed-btn-save {
  border-radius: 999px;
}

body[data-style="material"] .ed-tab:hover,
body[data-style="material"] .ed-tab.active {
  background: color-mix(in srgb, var(--sand-accent) 18%, var(--surface-mute) 82%);
  color: var(--text);
}

body[data-style="material"] .ed-card {
  border: 0;
  border-radius: 24px;
  background: color-mix(in srgb, var(--surface-soft) 84%, var(--accent) 16%);
  box-shadow: 0 6px 18px rgba(var(--accent-rgb), 0.1);
}

body[data-style="material"] .ed-btn,
body[data-style="material"] .ed-btn-main,
body[data-style="material"] .ed-btn-save {
  border: 0;
  background: color-mix(in srgb, var(--surface-mute) 78%, var(--accent) 22%);
  color: var(--text);
  min-height: 40px;
  padding-inline: 16px;
}

body[data-style="material"] .ed-btn:hover,
body[data-style="material"] .ed-btn:focus-visible,
body[data-style="material"] .ed-btn-save:hover,
body[data-style="material"] .ed-btn-save:focus-visible {
  background: color-mix(in srgb, var(--sand-accent) 24%, var(--surface-mute) 76%);
  outline: 2px solid color-mix(in srgb, var(--sand-accent) 70%, transparent);
  outline-offset: 2px;
}

body[data-style="material"] .ed-btn-main {
  background: var(--sand-accent);
  color: var(--on-accent);
}

body[data-style="material"] .ed-field input,
body[data-style="material"] .ed-select,
body[data-style="material"] .ed-textarea,
body[data-style="material"] .ed-code {
  border: 0;
  border-bottom: 2px solid var(--border-dark);
  border-radius: 8px 8px 4px 4px;
  background: color-mix(in srgb, var(--surface-inset) 88%, var(--accent) 12%);
  color: var(--text);
}

body[data-style="material"] .ed-field input:focus,
body[data-style="material"] .ed-select:focus,
body[data-style="material"] .ed-textarea:focus {
  border-bottom-color: var(--sand-accent);
  outline: none;
  box-shadow: 0 2px 0 var(--sand-accent);
}
