:root {
  --bg: #090b0f;
  --panel: #171a20;
  --panel-2: #20242b;
  --ink: #eef2f5;
  --muted: #9aa2af;
  --line: #2a2f38;
  --teal: #119c9b;
  --teal-2: #24c8c2;
  --red: #ef4444;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", Arial, sans-serif;
  background:
    radial-gradient(circle at 50% 0%, rgba(36, 200, 194, 0.16), transparent 34%),
    var(--bg);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

.editor-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 24px auto;
}

.editor-header,
.editor-toolbar,
.side-panel,
.card-panel,
.edit-panel,
.message-panel {
  border-radius: 8px;
  background: rgba(23, 26, 32, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.editor-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 20px;
}

.editor-header p,
.panel-title p {
  margin: 0 0 4px;
  color: var(--muted);
}

.editor-header h1,
.panel-title h2 {
  margin: 0;
}

.header-actions,
.editor-toolbar,
.edit-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

button,
.editor-toolbar label {
  border: 0;
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--ink);
  padding: 10px 13px;
  font-weight: 800;
}

.header-actions button:first-child,
.panel-title button {
  background: var(--teal);
  color: #fff;
}

.editor-toolbar {
  margin-top: 14px;
  padding: 14px;
}

.editor-toolbar input {
  display: none;
}

.editor-grid {
  display: grid;
  grid-template-columns: 220px minmax(360px, 1fr) 360px;
  gap: 14px;
  margin-top: 14px;
  align-items: start;
}

.side-panel,
.card-panel,
.edit-panel {
  padding: 14px;
  min-height: 620px;
}

.side-panel {
  display: grid;
  gap: 10px;
}

.side-panel strong {
  color: var(--muted);
  margin-top: 8px;
}

.side-panel button.active,
.category-list button.active {
  background: rgba(17, 156, 155, 0.2);
  color: #dffefa;
}

.category-list {
  display: grid;
  gap: 8px;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.item-list {
  display: grid;
  gap: 10px;
}

.item-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #1b1e24;
  padding: 14px;
  text-align: left;
}

.item-card.active {
  border-color: var(--teal-2);
  box-shadow: 0 0 0 1px rgba(36, 200, 194, 0.4);
}

.item-card span {
  display: inline-block;
  border-radius: 999px;
  background: rgba(17, 156, 155, 0.18);
  color: #dffefa;
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 8px;
}

.item-card strong,
.item-card small {
  display: block;
}

.item-card small {
  color: var(--muted);
  line-height: 1.45;
  margin-top: 6px;
}

.edit-form {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-weight: 800;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1116;
  color: var(--ink);
  padding: 10px;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.edit-actions {
  margin-top: 14px;
}

.danger {
  background: rgba(239, 68, 68, 0.18);
  color: #fecaca;
}

.message-panel {
  margin-top: 14px;
  padding: 14px;
}

.message-panel p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
  white-space: pre-wrap;
}

.message-panel.error p {
  color: #fecaca;
}

.message-panel.success p {
  color: #bffffb;
}

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

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