:root {
  --editor-cyan: #62d8ff;
  --editor-green: #5ee6a8;
  --editor-red: #ff6b78;
  --editor-panel: #0d1220;
  --editor-panel-2: #111827;
  --editor-line: rgba(140, 177, 220, 0.2);
}

.editor-page {
  min-height: 100vh;
  overflow: hidden;
  background:
    linear-gradient(rgba(6, 8, 16, 0.86), rgba(6, 8, 16, 0.96)),
    linear-gradient(90deg, rgba(98, 216, 255, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(98, 216, 255, 0.05) 1px, transparent 1px),
    #060810;
  background-size: auto, 48px 48px, 48px 48px, auto;
  color: #eef6ff;
}

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

button {
  color: inherit;
}

.editor-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
}

.editor-header {
  min-height: 74px;
  padding: 1.2rem 2.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  background: rgba(8, 12, 22, 0.96);
  border-bottom: 1px solid var(--editor-line);
}

.editor-brand {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.editor-brand__mark {
  width: 34px;
  height: 34px;
  border: 1px solid var(--gold);
  transform: rotate(45deg);
  position: relative;
}

.editor-brand__mark::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid var(--editor-cyan);
}

.editor-brand strong,
.editor-brand small {
  display: block;
  font-family: var(--font-display);
  text-transform: uppercase;
}

.editor-brand strong {
  font-size: 1.25rem;
  color: #fff;
}

.editor-brand small {
  margin-top: 0.15rem;
  color: var(--gold);
  font-size: 0.9rem;
  letter-spacing: 0.16em;
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.8rem;
}

.editor-button,
.editor-icon-button {
  border: 1px solid var(--editor-line);
  border-radius: 4px;
  background: #141d2c;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, color 0.18s;
}

.editor-button {
  min-height: 38px;
  padding: 0.65rem 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.editor-button:hover,
.editor-icon-button:hover {
  border-color: var(--editor-cyan);
  background: #18283b;
}

.editor-button--primary {
  color: #041018;
  border-color: var(--editor-cyan);
  background: var(--editor-cyan);
  font-weight: 700;
}

.editor-button--primary:hover {
  color: #041018;
  background: #9be8ff;
}

.editor-button--danger {
  border-color: rgba(255, 107, 120, 0.55);
  color: #ffd8dc;
  background: rgba(255, 107, 120, 0.12);
}

.editor-button--wide {
  width: 100%;
}

.editor-statusbar {
  min-height: 34px;
  padding: 0.4rem 2.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  background: #080d17;
  border-bottom: 1px solid var(--editor-line);
  color: #8292a9;
  font-family: var(--font-mono);
  font-size: 1rem;
}

.editor-statusbar .is-dirty {
  color: var(--gold);
}

.editor-statusbar .is-saved {
  color: var(--editor-green);
}

.editor-tabs {
  display: flex;
  gap: 0;
  overflow-x: auto;
  background: #0b111d;
  border-bottom: 1px solid var(--editor-line);
}

.editor-tab {
  min-width: 118px;
  height: 48px;
  padding: 0 1.5rem;
  border: 0;
  border-right: 1px solid var(--editor-line);
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #7e8da4;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.95rem;
  text-transform: uppercase;
}

.editor-tab:hover {
  color: #dcecff;
  background: rgba(98, 216, 255, 0.05);
}

.editor-tab.is-active {
  color: var(--editor-cyan);
  border-bottom-color: var(--editor-cyan);
  background: rgba(98, 216, 255, 0.08);
}

.editor-workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(240px, 310px) minmax(0, 1fr);
}

.record-browser {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: rgba(10, 16, 28, 0.97);
  border-right: 1px solid var(--editor-line);
}

.record-browser__tools {
  padding: 1.4rem;
  border-bottom: 1px solid var(--editor-line);
}

.editor-search span,
.editor-field > span,
.editor-fieldset legend {
  display: block;
  margin-bottom: 0.45rem;
  color: #93a4ba;
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.editor-search input,
.editor-field input,
.editor-field textarea,
.editor-field select {
  width: 100%;
  border: 1px solid var(--editor-line);
  border-radius: 4px;
  outline: none;
  background: #080d17;
  color: #eff7ff;
  font-size: 1.45rem;
}

.editor-search input,
.editor-field input,
.editor-field select {
  min-height: 42px;
  padding: 0.7rem 0.9rem;
}

.editor-search input {
  margin-bottom: 1rem;
}

.editor-field textarea {
  min-height: 110px;
  padding: 0.9rem;
  resize: vertical;
  line-height: 1.5;
}

.editor-field input:focus,
.editor-field textarea:focus,
.editor-field select:focus,
.editor-search input:focus {
  border-color: var(--editor-cyan);
  box-shadow: 0 0 0 2px rgba(98, 216, 255, 0.09);
}

.editor-field input[type="color"] {
  padding: 0.35rem;
  cursor: pointer;
}

.record-list {
  min-height: 0;
  overflow-y: auto;
  padding: 0.7rem;
}

.record-list__empty {
  padding: 2rem 1rem;
  color: #718197;
  text-align: center;
}

.record-list__item {
  width: 100%;
  min-height: 58px;
  padding: 0.8rem 1rem;
  border: 1px solid transparent;
  border-radius: 4px;
  display: block;
  background: transparent;
  color: #c4d0df;
  text-align: left;
  cursor: pointer;
}

.record-list__item:hover {
  background: rgba(255, 255, 255, 0.035);
}

.record-list__item.is-active {
  color: #fff;
  border-color: rgba(98, 216, 255, 0.32);
  background: rgba(98, 216, 255, 0.09);
}

.record-list__item strong,
.record-list__item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-list__item strong {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.record-list__item small {
  margin-top: 0.25rem;
  color: #718197;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.record-editor {
  min-width: 0;
  overflow-y: auto;
  padding: 2.2rem 2.6rem 6rem;
}

.record-editor__empty {
  min-height: 50vh;
  display: grid;
  place-items: center;
  color: #718197;
}

.record-editor__header {
  margin: 0 auto 2rem;
  max-width: 1040px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
}

.editor-kicker {
  color: var(--editor-cyan);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  text-transform: uppercase;
}

.record-editor__header h1,
.editor-dialog h2 {
  font-family: var(--font-display);
  letter-spacing: 0;
}

.record-editor__header h1 {
  margin-top: 0.25rem;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.2;
}

.record-editor__actions {
  display: flex;
  flex-shrink: 0;
  gap: 0.8rem;
}

.editor-form {
  max-width: 1040px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.4rem;
}

.editor-field {
  min-width: 0;
}

.editor-field--wide {
  grid-column: 1 / -1;
}

.editor-field__hint {
  display: block;
  margin-top: 0.4rem;
  color: #687990;
  font-size: 1.15rem;
}

.editor-field__error {
  color: var(--editor-red);
}

.editor-field textarea.is-invalid {
  border-color: var(--editor-red);
}

.editor-fieldset {
  margin: 0;
  padding: 1.2rem;
  border: 1px solid var(--editor-line);
  border-radius: 4px;
  grid-column: 1 / -1;
}

.editor-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.5rem;
  max-height: 280px;
  overflow: auto;
}

.editor-check {
  min-height: 38px;
  padding: 0.55rem 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  border: 1px solid rgba(140, 177, 220, 0.12);
  border-radius: 3px;
  background: #0a101c;
  color: #b9c7d8;
  cursor: pointer;
}

.editor-check:has(input:checked) {
  border-color: rgba(98, 216, 255, 0.42);
  color: #fff;
  background: rgba(98, 216, 255, 0.08);
}

.editor-check input {
  accent-color: var(--editor-cyan);
}

.editor-unit-preview {
  grid-column: 1 / -1;
  min-height: 116px;
  padding: 1rem;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 1.4rem;
  border-left: 3px solid var(--editor-cyan);
  background: rgba(98, 216, 255, 0.05);
}

.editor-unit-preview img {
  width: 92px;
  height: 92px;
  object-fit: cover;
  background: #060810;
}

.editor-unit-preview strong,
.editor-unit-preview span {
  display: block;
}

.editor-unit-preview strong {
  font-family: var(--font-display);
  font-size: 1.3rem;
}

.editor-unit-preview span {
  margin-top: 0.4rem;
  color: #8292a9;
  font-size: 1.3rem;
}

.editor-unit-preview.is-missing img {
  opacity: 0.15;
}

.editor-dialog {
  width: min(680px, calc(100vw - 2rem));
  max-height: min(720px, calc(100vh - 2rem));
  padding: 0;
  border: 1px solid rgba(98, 216, 255, 0.35);
  border-radius: 6px;
  background: #0c1320;
  color: #eef6ff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.65);
}

.editor-dialog::backdrop {
  background: rgba(2, 5, 10, 0.82);
  backdrop-filter: blur(4px);
}

.editor-dialog__header {
  padding: 1.6rem 1.8rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--editor-line);
}

.editor-icon-button {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  font-family: var(--font-mono);
  text-transform: uppercase;
}

#validationResults,
#confirmMessage {
  padding: 1.8rem;
}

.validation-summary {
  margin-bottom: 1.2rem;
  color: var(--editor-green);
}

.validation-list {
  margin: 0;
  padding-left: 2rem;
  color: #d8e4f1;
}

.validation-list li + li {
  margin-top: 0.7rem;
}

.editor-dialog--confirm {
  width: min(480px, calc(100vw - 2rem));
}

.editor-dialog__actions {
  padding: 0 1.8rem 1.8rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.8rem;
}

@media (max-width: 820px) {
  .editor-page {
    overflow: auto;
  }

  .editor-shell {
    min-height: 100vh;
    display: block;
  }

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

  .editor-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .editor-workspace {
    display: block;
  }

  .record-browser {
    height: 360px;
    border-right: 0;
    border-bottom: 1px solid var(--editor-line);
  }

  .record-editor {
    overflow: visible;
    padding: 2rem 1.4rem 5rem;
  }
}

@media (max-width: 560px) {
  .editor-header,
  .editor-statusbar {
    padding-left: 1.2rem;
    padding-right: 1.2rem;
  }

  .editor-button {
    flex: 1 1 calc(50% - 0.4rem);
  }

  .editor-statusbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.2rem;
  }

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

  .record-editor__actions {
    width: 100%;
  }

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

  .editor-field--wide,
  .editor-fieldset,
  .editor-unit-preview {
    grid-column: auto;
  }
}
