:root {
  --bg: #070b0f;
  --bg-elev: #0e151c;
  --surface: #0e151c;
  --surface-2: #141d27;
  --ink: #e8eef4;
  --ink-soft: #8b9aab;
  --line: rgba(148, 173, 199, 0.14);
  --accent: #2dd4a8;
  --accent-2: #25b894;
  --accent-soft: rgba(45, 212, 168, 0.14);
  --warn: #e6b450;
  --danger: #f07178;
  --rail: #070b0f;
  --rail-ink: #e8eef4;
  --rail-muted: #8b9aab;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --font: "Outfit", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --glow: rgba(45, 212, 168, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(45, 212, 168, 0.12), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 0%, rgba(56, 120, 180, 0.1), transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 100%, rgba(14, 40, 55, 0.55), transparent 60%),
    linear-gradient(180deg, #070b0f 0%, #0a1016 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.rail {
  background: linear-gradient(180deg, #0e151c 0%, var(--rail) 100%);
  color: var(--rail-ink);
  padding: 1.5rem 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
}

.brand {
  padding: 0.35rem 0.65rem;
}

.brand-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rail-muted);
  margin-bottom: 0.35rem;
}

.brand-name {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.brand-sub {
  margin-top: 0.35rem;
  font-size: 0.82rem;
  color: var(--rail-muted);
  line-height: 1.35;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav a {
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  color: var(--rail-ink);
  opacity: 0.82;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.nav a:hover,
.nav a.active {
  background: var(--accent-soft);
  opacity: 1;
}

.nav a.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.rail-foot {
  margin-top: auto;
  padding: 0.75rem;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0.5rem;
}

.rail-foot a {
  font-size: 0.85rem;
  color: var(--rail-muted);
}

.rail-foot a:hover {
  color: var(--accent);
}

.main {
  padding: 1.5rem 1.75rem 2.5rem;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.topbar h1 {
  margin: 0;
  font-size: 1.7rem;
  letter-spacing: -0.03em;
}

.topbar p {
  margin: 0.35rem 0 0;
  color: var(--ink-soft);
  max-width: 42rem;
}

.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid transparent;
  background: var(--accent);
  color: #06241c;
  border-radius: 10px;
  padding: 0.65rem 1rem;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.12s ease, background 0.12s ease;
}

.btn:hover {
  background: var(--accent-2);
}

.btn:active {
  transform: translateY(1px);
}

.btn.secondary {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line);
}

.btn.ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: transparent;
}

.btn.danger {
  background: var(--danger);
  color: #1a0a0b;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.panel-head h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.panel-body {
  padding: 1.1rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}

.stat .label {
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.stat .value {
  margin-top: 0.35rem;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--accent);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  background: var(--surface-2);
}

.table tr:hover td {
  background: rgba(45, 212, 168, 0.06);
}

.table tr {
  cursor: pointer;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 650;
  background: var(--accent-soft);
  color: var(--accent);
}

.badge.muted {
  background: rgba(148, 173, 199, 0.12);
  color: var(--ink-soft);
}

.badge.warn {
  background: rgba(230, 180, 80, 0.16);
  color: var(--warn);
}

.badge.danger {
  background: rgba(240, 113, 120, 0.16);
  color: var(--danger);
}

.form {
  display: grid;
  gap: 0.85rem;
}

.form.row {
  grid-template-columns: 1fr 1fr;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  background: var(--surface-2);
  color: var(--ink);
}

textarea {
  min-height: 120px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--glow);
  border-color: var(--accent);
}

.muted {
  color: var(--ink-soft);
}

.mono {
  font-family: var(--mono);
  font-size: 0.85rem;
}

.empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--ink-soft);
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 0.8rem 1rem;
  border-radius: 10px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: 0.2s ease;
  z-index: 50;
  max-width: 22rem;
}

.toast.show {
  opacity: 1;
  transform: none;
}

.list-notes {
  display: grid;
  gap: 0.65rem;
}

.note {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  background: var(--surface-2);
}

.note .meta {
  font-size: 0.75rem;
  color: var(--ink-soft);
  margin-bottom: 0.35rem;
}

.map-hint {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.map-hint .item {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.75rem;
  align-items: start;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.map-hint .item strong {
  font-size: 0.82rem;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 1rem;
  align-items: start;
  min-height: calc(100vh - 7rem);
}

.editor-form {
  max-height: calc(100vh - 7.5rem);
  overflow: auto;
  padding-right: 0.25rem;
}

.editor-preview {
  position: sticky;
  top: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 70vh;
  display: flex;
  flex-direction: column;
}

.editor-preview .bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.editor-preview iframe {
  width: 100%;
  flex: 1;
  min-height: 70vh;
  border: 0;
  background: #fff;
}

.field-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem;
  margin-bottom: 0.75rem;
  background: var(--surface-2);
}

.field-block h3 {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
}

.img-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 0.65rem;
  align-items: center;
}

.img-row img,
.img-row .ph {
  width: 72px;
  height: 54px;
  object-fit: cover;
  border-radius: 8px;
  background: #0a1218;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  color: var(--ink-soft);
}

.slug-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.8rem;
}

@media (max-width: 960px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .rail {
    position: relative;
    height: auto;
  }

  .grid-2,
  .form.row,
  .stats,
  .editor-layout {
    grid-template-columns: 1fr;
  }

  .editor-preview {
    position: relative;
    top: 0;
  }

  .map-hint .item {
    grid-template-columns: 1fr;
  }
}
