:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #152033;
  --muted: #61718a;
  --line: #d8deea;
  --accent: #0f6fff;
  --danger: #c43a3a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 20% 10%, #e8f0ff, var(--bg));
}

.layout {
  width: min(1200px, 96vw);
  margin: 20px auto;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(15, 40, 88, 0.08);
  padding: 18px;
}

.hidden {
  display: none;
}

.panel-login {
  width: min(460px, 92vw);
  margin: 8vh auto;
}

label {
  display: block;
  font-size: 14px;
  margin-bottom: 10px;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 4px;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

button.danger {
  background: var(--danger);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

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

.error {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.split {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 14px;
  margin-top: 14px;
}

.sidebar {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  display: grid;
  gap: 14px;
  max-height: 76vh;
  overflow: auto;
}

.stack-block h3,
.preview h3 {
  margin: 0 0 6px;
}

.inline-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: end;
}

.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: grid;
  gap: 5px;
}

.list li {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px;
  display: flex;
  justify-content: space-between;
  gap: 6px;
  align-items: center;
}

.list.templates li.active {
  border-color: var(--accent);
  background: #eef4ff;
}

.list-item-actions {
  display: flex;
  gap: 4px;
}

.list-item-actions button {
  padding: 4px 7px;
  font-size: 12px;
}

.editor {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  overflow: auto;
  max-height: 76vh;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.aliases {
  margin-bottom: 10px;
}

.chips {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chips li {
  background: #e9eef8;
  color: #243450;
  border-radius: 999px;
  padding: 4px 10px;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 13px;
}

.chips button {
  background: transparent;
  color: #243450;
  padding: 0;
  font-size: 14px;
}

#quill-editor {
  background: #fff;
  margin-top: 6px;
}

.ql-editor {
  min-height: 150px;
}

.image-panel {
  margin-top: 10px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 10px;
}

.image-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.preview {
  margin-top: 14px;
}

.preview-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 70px;
  padding: 8px;
  background: #fff;
}

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

@media (max-width: 980px) {
  .split {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .editor {
    max-height: none;
  }

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

  .image-actions {
    flex-direction: column;
  }
}
