:root {
  --bg: #0c0c0e;
  --panel: #16161a;
  --text: #f1f1f3;
  --muted: #a8a8b0;
  --border: #2a2a33;
  --primary: #6ea8fe;
  --danger: #ff6b6b;
  --ok: #55d6a6;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: radial-gradient(1200px 600px at 20% -10%, #1f1f26, transparent), var(--bg);
  color: var(--text);
}

a { color: var(--primary); }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(22, 22, 26, 0.75);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-right { display: flex; gap: 10px; align-items: center; }

.pill {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 4px 8px;
  border-radius: 999px;
}

.card {
  width: min(560px, calc(100% - 24px));
  margin: 28px auto;
  background: rgba(22, 22, 26, 0.85);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}
.card.wide { width: min(920px, calc(100% - 24px)); }

h1 { margin: 0 0 8px; font-size: 22px; }
h2 { margin: 0; font-size: 18px; }

label { display: block; margin: 12px 0; }
.field { display: block; margin: 12px 0; }
.field-title { display: block; font-weight: 600; }
.subfield { margin: 10px 0 0; }
input, select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #111114;
  color: var(--text);
  outline: none;
}
textarea.textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #111114;
  color: var(--text);
  outline: none;
  resize: vertical;
}
.textarea {
  display: block;
  width: 100%;
}
input:focus, select:focus, .editor:focus { border-color: rgba(110,168,254,0.6); box-shadow: 0 0 0 3px rgba(110,168,254,0.12); }
textarea.textarea:focus { border-color: rgba(110,168,254,0.6); box-shadow: 0 0 0 3px rgba(110,168,254,0.12); }

button {
  border: 1px solid rgba(110,168,254,0.5);
  background: rgba(110,168,254,0.15);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
}
button.secondary { border-color: var(--border); background: rgba(42,42,51,0.4); }
button.danger { border-color: rgba(255,107,107,0.55); background: rgba(255,107,107,0.12); }
button:disabled { opacity: 0.65; cursor: not-allowed; }

.inline { display: inline; margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 720px) { .grid2 { grid-template-columns: 1fr; } }

.hint { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }

.alert {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(42,42,51,0.35);
  color: var(--text);
  margin-bottom: 12px;
}
.alert-error { border-color: rgba(255,107,107,0.5); background: rgba(255,107,107,0.12); }
.alert-ok { border-color: rgba(85,214,166,0.5); background: rgba(85,214,166,0.10); }
.hidden { display: none; }

.editor-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(17, 17, 20, 0.8);
}
.editor-toolbar button { padding: 8px 10px; border-radius: 8px; }
.editor {
  min-height: 220px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: #111114;
  outline: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
}
.modal {
  position: fixed;
  left: 50%;
  top: 80px;
  transform: translateX(-50%);
  width: min(520px, calc(100% - 24px));
  background: rgba(22, 22, 26, 0.97);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.5);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal-body { margin-top: 6px; }
.toggle { display: flex; align-items: center; gap: 10px; }
.toggle input { width: auto; }

.segmented {
  display: inline-flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 8px;
}
.seg {
  border: 0;
  border-right: 1px solid var(--border);
  background: rgba(42,42,51,0.25);
  padding: 8px 10px;
  border-radius: 0;
}
.seg:last-child { border-right: 0; }
.seg.selected {
  background: rgba(110,168,254,0.20);
}
