.editor-shell {
  --ed-accent: var(--accent, #2f5f92);
  --ed-ink: #171e28;
  --ed-muted: #526070;
  --ed-line: #e3e9ef;
  --ed-soft: #f4f7f9;
  color: var(--ed-ink);
  width: min(100%, 38rem);
  max-width: calc(100% - 24px);
  max-height: calc(100dvh - 24px);
  border: 1px solid var(--ed-line);
  border-radius: 22px;
  padding: 0;
  box-shadow: 0 24px 100px #1524313d;
  overflow: hidden;
  background: #fff;
  font: inherit;
}

.editor-shell::backdrop {
  background: #10212d70;
  backdrop-filter: blur(3px);
}

.editor-shell--card {
  width: min(100%, 46.5rem);
  height: 100dvh;
  max-width: 100%;
  max-height: 100dvh;
  margin: 0 0 0 auto;
  border-radius: 20px 0 0 20px;
  border-right: 0;
}

.editor-shell[open] {
  animation: editor-appear 160ms ease-out;
}

@keyframes editor-appear {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.editor-form {
  display: flex;
  flex-direction: column;
  margin: 0;
  max-height: inherit;
}

.editor-shell--card .editor-form { height: 100%; }

.editor-head {
  flex: 0 0 auto;
  display: flex;
  align-items: start;
  gap: 14px;
  padding: 26px 30px 22px;
  border-bottom: 1px solid var(--ed-line);
}

.editor-head-mark {
  flex: 0 0 43px;
  align-self: start;
  height: 43px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: var(--ed-accent);
  background: color-mix(in srgb, var(--ed-accent) 11%, white);
}

.editor-head-copy { flex: 1 1 auto; min-width: 0; }
.editor-head h2 { font-size: 1.34rem; line-height: 1.2; margin: 0; letter-spacing: -.025em; overflow-wrap: anywhere; }
.editor-head p { font-size: .83rem; color: var(--ed-muted); margin: 6px 0 0; line-height: 1.45; }

.editor-icon-button {
  display: inline-grid;
  place-items: center;
  padding: 0;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  background: transparent;
  border: 0;
  border-radius: 9px;
  color: var(--ed-muted);
  cursor: pointer;
}

.editor-icon-button:hover { color: var(--ed-ink); background: var(--ed-soft); }

.editor-tabs { display: flex; flex: 0 0 auto; align-items: stretch; padding: 0 30px; gap: 21px; border-bottom: 1px solid var(--ed-line); overflow-x: auto; }
.editor-tab { font: inherit; font-size: .84rem; font-weight: 650; display: flex; gap: 7px; align-items: center; justify-content: center; padding: 13px 2px; white-space: nowrap; background: transparent; border: 0; border-bottom: 2px solid transparent; color: var(--ed-muted); cursor: pointer; }
.editor-tab:hover, .editor-tab[aria-selected="true"] { color: var(--ed-accent); }
.editor-tab[aria-selected="true"] { border-bottom-color: var(--ed-accent); }

.editor-body { min-height: 0; padding: 22px 30px 26px; overflow-y: auto; overscroll-behavior: contain; }
.editor-shell--card .editor-body { flex: 1 1 auto; }
.editor-body [hidden] { display: none !important; }
.editor-stack { display: grid; gap: 24px; }
.editor-section { display: grid; gap: 13px; min-width: 0; }
.editor-section + .editor-section { border-top: 1px solid var(--ed-line); padding-top: 20px; }
.editor-section-head { display: flex; align-items: center; gap: 8px; color: var(--ed-accent); }
.editor-section-head h3 { font-size: .95rem; margin: 0; color: var(--ed-ink); font-weight: 700; }
.editor-note { color: var(--ed-muted); font-size: .8rem; line-height: 1.5; margin: 0; }
.editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; align-items: start; }
.editor-grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.editor-span { grid-column: 1 / -1; }
.editor-field { display: grid; gap: 6px; min-width: 0; align-content: start; color: var(--ed-ink); font-size: .79rem; font-weight: 650; }
.editor-field > span small { font-size: inherit; color: var(--ed-accent); }

.editor-control {
  color-scheme: light;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  color: var(--ed-ink);
  background: #fff;
  border: 1px solid #d7e0e8;
  border-radius: 9px;
  padding: 9px 11px;
  font: inherit;
  font-size: .86rem;
  font-weight: 450;
  outline: none;
}

.editor-control::placeholder { color: #667483; }
.editor-control:focus { border-color: var(--ed-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ed-accent) 14%, transparent); }
.editor-control[aria-invalid="true"] { border-color: #cb3f59; }
.editor-control:is(textarea) { resize: vertical; line-height: 1.5; min-height: 74px; }
.editor-control[multiple] { min-height: 90px; }
.editor-control:is(select) { padding-right: 19px; }

.editor-option {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: .84rem;
  line-height: 1.35;
  cursor: pointer;
}

.editor-option input { flex: 0 0 auto; width: 17px; height: 17px; margin: 0; accent-color: var(--ed-accent); }
.editor-block { display: grid; gap: 12px; padding: 13px; background: var(--ed-soft); border: 1px solid var(--ed-line); border-radius: 11px; }
.editor-block:has([name="blocked"]:checked) { background: #fff4f6; border-color: #f7d3dc; }
.editor-block:has([name="blocked"]:checked) > .editor-option { color: #a62745; }

.editor-tests { display: grid; gap: 7px; }
.editor-test { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 7px; }
.editor-test .editor-option { padding: 7px 3px; }
.editor-test .editor-control { min-height: 36px; }
.editor-test:has(input[type="checkbox"]:checked) .editor-control { color: var(--ed-muted); }
.editor-inline { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.editor-dependencies { margin: 0; padding: 10px 12px; min-width: 0; border: 1px solid var(--ed-line); border-radius: 10px; }
.editor-dependencies legend { padding: 0 4px; font-size: .79rem; font-weight: 650; }
.editor-dependencies [type="search"] { margin-top: 7px; }
.editor-dependency-items { display: grid; gap: 9px; margin-top: 10px; max-height: 140px; overflow-y: auto; }
.editor-dependency-items label span { overflow-wrap: anywhere; }
.editor-tag { display: inline-flex; padding: 3px 7px; border-radius: 5px; color: var(--tag); background: color-mix(in srgb, var(--tag) 10%, white); font-size: .75rem; font-weight: 650; overflow-wrap: anywhere; }
[data-editor-tags]:not(:empty) { margin-top: 7px; }
.editor-colors { display: flex; flex-wrap: wrap; gap: 9px; }
.editor-color { position: relative; width: 27px; height: 27px; border-radius: 50%; background: var(--swatch); border: 2px solid white; outline: 1px solid var(--ed-line); cursor: pointer; }
.editor-color:has(:checked) { outline: 2px solid var(--ed-accent); }
.editor-color:has(:focus-visible) { outline: 3px solid var(--ed-accent); }
.editor-color input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }

.editor-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.editor-entry { display: flex; gap: 9px; padding: 10px 12px; background: var(--ed-soft); border-radius: 10px; font-size: .84rem; line-height: 1.45; overflow-wrap: anywhere; }
.editor-entry > svg { color: var(--ed-accent); flex: 0 0 auto; margin-top: 2px; }
.editor-entry strong { font-size: .81rem; }
.editor-entry time { color: var(--ed-muted); font-size: .75rem; margin-left: 6px; }
.editor-entry p { margin: 4px 0 0; white-space: pre-wrap; }

.editor-foot { display: flex; flex: 0 0 auto; align-items: center; justify-content: end; gap: 9px; padding: 15px 30px 17px; border-top: 1px solid var(--ed-line); background: #fff; }
.editor-foot-actions { margin-right: auto; display: flex; gap: 5px; }
.editor-button { display: inline-flex; min-height: 37px; align-items: center; justify-content: center; gap: 6px; padding: 0 14px; border-radius: 9px; background: #fff; color: var(--ed-ink); border: 1px solid #d7e0e8; font: inherit; font-size: .82rem; font-weight: 650; white-space: nowrap; cursor: pointer; }
.editor-button:hover { background: var(--ed-soft); }
.editor-button--primary { background: var(--ed-accent); color: #fff; border-color: var(--ed-accent); }
.editor-button--primary:hover { background: color-mix(in srgb, var(--ed-accent) 90%, #12101b); }
.editor-button--subtle { padding: 0 8px; min-height: 30px; border-color: transparent; color: var(--ed-accent); }
.editor-button--danger { padding: 0 8px; border-color: transparent; color: #ad2b49; }
.editor-button--danger:hover { background: #fff1f4; }
.editor-button:disabled { opacity: .55; cursor: wait; }
.editor-button:focus-visible, .editor-icon-button:focus-visible, .editor-tab:focus-visible { outline: 2px solid var(--ed-accent); outline-offset: 2px; }

.editor-error { flex: 0 0 auto; margin: 0 30px 12px; padding: 8px 10px; border-radius: 8px; background: #fff1f4; color: #a62745; font-size: .82rem; line-height: 1.42; }
.editor-error[hidden] { display: none; }
.editor-confirm { border-top: 1px solid var(--ed-line); padding: 16px 30px; background: #fff6f7; display: grid; gap: 10px; }
.editor-confirm[hidden] { display: none; }
.editor-confirm p { font-size: .86rem; line-height: 1.45; margin: 0; color: #7f2440; }

@media (max-width: 620px) {
  .editor-shell { border-radius: 14px; }
  .editor-shell--card { border-radius: 0; }
  .editor-head, .editor-body, .editor-tabs, .editor-foot, .editor-confirm { padding-left: 16px; padding-right: 16px; }
  .editor-head { padding-top: 18px; padding-bottom: 17px; }
  .editor-tabs { gap: 14px; }
  .editor-grid { gap: 10px; }
  .editor-grid--three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .editor-error { margin-left: 16px; margin-right: 16px; }
  .editor-foot { flex-wrap: wrap; padding-top: 10px; padding-bottom: 11px; }
  .editor-foot-actions { flex: 1 1 auto; }
}

@media (max-width: 390px) {
  .editor-grid, .editor-grid--three { grid-template-columns: minmax(0, 1fr); }
  .editor-tab { gap: 4px; font-size: .78rem; }
}

@media (prefers-reduced-motion: reduce) {
  .editor-shell[open] { animation: none; }
}
