:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #273549;
  --border: rgba(255, 255, 255, 0.14);
  --text: #f8fafc;
  --muted: #94a3b8;
  --primary: #10b981;
  --accent: #f59e0b;
  --danger: #ef4444;
  --radius: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Nunito', 'Segoe UI', system-ui, sans-serif;
  line-height: 1.45;
}

.hidden {
  display: none !important;
}

.ed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  flex-wrap: wrap;
}

.ed-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ed-logo {
  font-size: 2.3rem;
}

.ed-brand h1 {
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 1.45rem;
}

.ed-sub {
  font-size: 0.9rem;
  color: var(--muted);
}

.ed-header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 2px solid transparent;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, opacity 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--primary);
  color: #052e16;
}

.btn-accent {
  background: var(--accent);
  color: #1c1917;
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

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

.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  padding: 14px 20px;
  border-radius: 12px;
  background: #065f46;
  border: 2px solid #34d399;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.toast.error {
  background: #7f1d1d;
  border-color: #f87171;
}

.ed-tabs {
  display: flex;
  gap: 10px;
  padding: 14px 24px 0;
  max-width: 1320px;
  margin: 0 auto;
}

.tab-btn {
  padding: 12px 22px;
  border-radius: 12px 12px 0 0;
  border: 2px solid var(--border);
  border-bottom: none;
  background: var(--surface);
  color: var(--muted);
  font-family: 'Nunito', sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--surface-2);
  color: #ffffff;
  border-color: var(--accent);
}

.ed-layout {
  max-width: 1320px;
  margin: 0 auto 32px;
  padding: 20px 24px;
  display: grid;
  grid-template-columns: minmax(300px, 430px) 1fr;
  gap: 24px;
  align-items: start;
}

.ed-list-col,
.ed-form-col {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.col-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.toolbar-note {
  flex: 1;
  font-size: 0.88rem;
  color: var(--muted);
}

.items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 4px;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: border-color 0.12s ease;
}

.list-item:hover {
  border-color: var(--accent);
}

.list-item.selected {
  border-color: var(--primary);
  background: #1e3a3a;
}

.item-emoji {
  font-size: 1.9rem;
  line-height: 1;
}

.item-meta {
  flex: 1;
  min-width: 0;
}

.item-title {
  font-weight: 800;
  font-size: 1rem;
}

.item-sub {
  font-size: 0.84rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-badge {
  font-size: 0.76rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  font-weight: 700;
}

.reorder-btns {
  display: flex;
  gap: 4px;
}

.mini-btn {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
}

.ed-form-col h2 {
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 1.4rem;
  margin-bottom: 16px;
  color: var(--accent);
}

.ed-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.field>span {
  font-weight: 700;
  font-size: 0.94rem;
}

.field small {
  color: var(--muted);
  font-size: 0.84rem;
}

.input-field {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.96rem;
}

.input-field:focus {
  outline: none;
  border-color: var(--primary);
}

.audio-upload-box {
  padding: 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 2px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.audio-row,
.upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.audio-row .input-field {
  flex: 1;
}

.color-presets {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 3px solid transparent;
  cursor: pointer;
}

.color-swatch.active {
  border-color: #ffffff;
  box-shadow: 0 0 0 3px var(--primary);
}

.emoji-input-row {
  display: flex;
  gap: 8px;
}

.emoji-input {
  font-size: 1.35rem;
  text-align: center;
  max-width: 110px;
}

.emoji-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  margin-top: 4px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 10px;
  max-height: 170px;
  overflow-y: auto;
}

.emoji-choice {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 1.35rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emoji-choice:hover {
  border-color: var(--accent);
  transform: scale(1.1);
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  flex-wrap: wrap;
}

@media (max-width: 860px) {
  .ed-layout {
    grid-template-columns: 1fr;
  }

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