:root {
  --bg: #07070d;
  --bg-2: #0c0c18;
  --bg-3: #111125;
  --ink: #f3f4fb;
  --ink-dim: #a8a9bf;
  --ink-faint: #5a5b78;
  --line: rgba(255,255,255,0.07);
  --line-2: rgba(255,255,255,0.12);
  --c1: #22D3EE;
  --c2: #A855F7;
  --c3: #EC4899;
  --c4: #34D399;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; scrollbar-width: none; }
*::-webkit-scrollbar { display: none; }
[hidden] { display: none !important; }

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Space Grotesk', system-ui, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Login ─────────────────────────────────────────────── */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(900px 600px at 50% 50%, rgba(168,85,247,0.12), transparent 70%), var(--bg);
}

.login-box {
  width: 360px;
  padding: 40px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: 16px;
  text-align: center;
}

.login-box .logo {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
}
.login-box .logo span { color: var(--c2); }

.login-box .sub {
  color: var(--ink-faint);
  font-size: 13px;
  margin-bottom: 28px;
  font-family: 'JetBrains Mono', monospace;
}

/* ── Inputs ────────────────────────────────────────────── */
input, textarea, select {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
}

input:focus, textarea:focus, select:focus { border-color: var(--c2); }
textarea { resize: vertical; min-height: 80px; }
input::placeholder, textarea::placeholder { color: var(--ink-faint); }

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
}

.btn-primary { background: var(--c2); color: #fff; }
.btn-primary:hover { background: #9333ea; }

.btn-save { background: var(--c4); color: #000; font-weight: 700; }
.btn-save:hover { opacity: .85; }

.btn-ghost { background: transparent; color: var(--ink-dim); border: 1px solid var(--line-2); }
.btn-ghost:hover { color: var(--ink); }

.btn-danger { background: rgba(236,72,153,0.12); color: var(--c3); border: 1px solid rgba(236,72,153,0.25); }
.btn-danger:hover { background: rgba(236,72,153,0.22); }

.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── Error text ────────────────────────────────────────── */
.error { color: var(--c3); font-size: 12px; margin-top: 8px; text-align: left; }

/* ── App shell ─────────────────────────────────────────── */
#admin-panel { display: block; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: rgba(7,7,13,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar .brand { font-weight: 700; font-size: 15px; }
.topbar .brand > span:first-child { color: var(--c2); }
.brand-sub { color: var(--ink-faint) !important; font-weight: 400 !important; }
.topbar .right { display: flex; align-items: center; gap: 12px; }

.save-status {
  font-size: 12px;
  color: var(--ink-faint);
  font-family: 'JetBrains Mono', monospace;
}

.main { max-width: 880px; margin: 0 auto; padding: 32px 24px 80px; }

/* ── Tabs ──────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink-dim);
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  font-family: inherit;
  transition: all .2s;
}

.tab.active { color: var(--c2); border-bottom-color: var(--c2); }
.tab:hover:not(.active) { color: var(--ink); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.tab-badge {
  background: var(--c2);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  min-width: 16px;
  text-align: center;
}

/* ── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  padding: 22px;
  margin-bottom: 18px;
}

.card-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 18px;
  font-family: 'JetBrains Mono', monospace;
}

/* ── Fields ────────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }

.label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-dim);
  margin-bottom: 6px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.full { grid-column: 1 / -1; }

/* ── Image preview ─────────────────────────────────────── */
.img-preview-wrap { margin-top: 8px; }
.img-preview {
  max-height: 80px;
  max-width: 100%;
  border-radius: 6px;
  border: 1px solid var(--line-2);
  display: block;
}

/* ── Bug reports ───────────────────────────────────────── */
.bugs-empty {
  text-align: center;
  color: var(--ink-faint);
  padding: 4rem 0;
  font-size: 14px;
}
.bugs-empty svg { display: block; margin: 0 auto .75rem; }

.bugs-list { display: flex; flex-direction: column; gap: 12px; }

.bug-card {
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  padding: 18px 22px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .5rem 1rem;
  align-items: start;
}

.bug-card-meta { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 6px; }
.bug-name { font-weight: 600; font-size: 14px; color: var(--ink); }
.bug-date { font-size: 11px; color: var(--ink-faint); font-family: 'JetBrains Mono', monospace; }
.bug-desc { font-size: 13px; color: var(--ink-dim); line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.bug-actions { grid-row: 1 / 3; align-self: center; }

/* ── Markdown editor / preview ─────────────────────────── */
.md-hint {
  font-size: 11px;
  color: var(--ink-faint);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  margin-left: 6px;
}

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

.md-split textarea { height: 100%; min-height: 120px; }

.md-preview {
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 10px 14px;
  min-height: 120px;
  overflow-y: auto;
  font-size: 13px;
  color: var(--ink-dim);
  line-height: 1.65;
  word-break: break-word;
}

.md-preview-placeholder { color: var(--ink-faint); font-style: italic; }

/* markdown content – shared for .md-preview and .cl-md-body in admin */
.md-preview p, .cl-md-body p { margin: 0 0 6px; }
.md-preview p:last-child, .cl-md-body p:last-child { margin-bottom: 0; }
.md-preview ul, .cl-md-body ul { margin: 4px 0 6px; padding-left: 20px; }
.md-preview li, .cl-md-body li { margin: 2px 0; }
.md-preview h1, .md-preview h2, .md-preview h3,
.cl-md-body h1, .cl-md-body h2, .cl-md-body h3 {
  font-size: 13px; font-weight: 700; color: var(--ink);
  margin: 10px 0 4px;
}
.md-preview h1:first-child, .md-preview h2:first-child, .md-preview h3:first-child,
.cl-md-body h1:first-child, .cl-md-body h2:first-child, .cl-md-body h3:first-child { margin-top: 0; }
.md-preview code, .cl-md-body code {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  background: rgba(255,255,255,.08); padding: 1px 5px; border-radius: 4px;
}
.md-preview pre, .cl-md-body pre {
  background: rgba(0,0,0,.35); border: 1px solid var(--line-2);
  border-radius: 6px; padding: 10px 14px; overflow-x: auto; margin: 6px 0;
}
.md-preview pre code, .cl-md-body pre code { background: none; padding: 0; font-size: 12px; }
.md-preview strong, .cl-md-body strong { font-weight: 700; color: var(--ink); }
.md-preview em, .cl-md-body em { font-style: italic; }
.md-preview del, .cl-md-body del { text-decoration: line-through; opacity: .65; }
.md-preview a, .cl-md-body a { color: var(--c1); }
.md-preview a:hover, .cl-md-body a:hover { text-decoration: underline; }

/* ── Changelog entry edit form ─────────────────────────── */
.cl-edit-form { width: 100%; }
.cl-edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.cl-edit-grid .field { margin-bottom: 0; }
.cl-edit-body-wrap { margin-bottom: 10px; }
.cl-edit-actions { display: flex; gap: 8px; }

/* ── Toast notification ────────────────────────────────── */
.notif {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  transform: translateY(80px);
  opacity: 0;
  transition: all .3s;
  pointer-events: none;
}

.notif.show { transform: translateY(0); opacity: 1; }
.notif.success, .notif.ok { background: var(--c4); color: #000; }
.notif.error, .notif.err { background: var(--c3); color: #fff; }
