@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg-dark: #0f1724;
  --accent: #5B6CF9;
  --accent-light: #eef0fe;
  --surface: #f8fafc;
  --border: #e8edf2;
  --muted: #4a5568;
  --text: #0f1724;
  --radius: 6px;
  --font: 'Inter', -apple-system, sans-serif;
}

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

html { font-size: 14px; }

body {
  font-family: var(--font);
  background: var(--surface);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* ── Navbar ── */
.navbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -.3px;
}

.navbar-brand span { color: var(--accent); }

.navbar-center { flex: 1; display: flex; justify-content: center; }

.navbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

/* ── Select ── */
select {
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 30px 6px 10px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%234a5568' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
  min-width: 160px;
}

select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, box-shadow .15s;
  white-space: nowrap;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #4a5be8; }

.btn-outline { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--surface); }

.btn-danger { background: #fff; color: #dc2626; border: 1px solid #fecaca; }
.btn-danger:hover { background: #fef2f2; }

.btn-sm { padding: 5px 12px; font-size: 12px; }

.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Page Layout ── */
.page { max-width: 900px; margin: 0 auto; padding: 32px 24px; }
.page-wide { max-width: 1100px; margin: 0 auto; padding: 32px 24px; }

/* ── Cards ── */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 24px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 24px;
}

.stat-label { font-size: 12px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); }

/* ── Table ── */
.table-wrap {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

table { width: 100%; border-collapse: collapse; }
th { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); text-align: left; }
td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #fafbfc; }

.status-dot {
  width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 6px;
}
.status-dot.published { background: #22c55e; }
.status-dot.draft { background: #d1d5db; }

/* ── Tags ── */
.tag {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}
.tag-new      { background: #eef0fe; color: #5B6CF9; }
.tag-improved { background: #fffbeb; color: #92400e; }
.tag-fixed    { background: #f0fdf4; color: #166534; }
.tag-security { background: #fef2f2; color: #991b1b; }

/* ── Forms ── */
.form-group { margin-bottom: 20px; }
label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; }

input[type="text"],
input[type="email"],
input[type="color"],
textarea {
  width: 100%;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

input:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

textarea { resize: vertical; min-height: 180px; line-height: 1.6; }
textarea.mono { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12px; }

/* ── Toggle ── */
.toggle-group { display: flex; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; width: fit-content; }
.toggle-opt {
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  background: #fff;
  color: var(--muted);
  border: none;
  transition: background .12s, color .12s;
  font-family: var(--font);
}
.toggle-opt.active { background: var(--accent); color: #fff; }
.toggle-opt:not(:last-child) { border-right: 1px solid var(--border); }

/* ── Two-column editor ── */
.editor-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 24px;
}

.editor-pane, .preview-pane {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.pane-header {
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.pane-body { padding: 16px; }

.preview-content {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  min-height: 200px;
}
.preview-content h1,.preview-content h2,.preview-content h3 { margin: 1em 0 .5em; font-weight: 700; }
.preview-content p { margin-bottom: .75em; }
.preview-content code { background: var(--surface); padding: 1px 5px; border-radius: 3px; font-size: 12px; font-family: 'SF Mono','Fira Code',monospace; }
.preview-content pre { background: var(--surface); padding: 12px; border-radius: var(--radius); overflow-x: auto; margin-bottom: .75em; }
.preview-content ul,.preview-content ol { padding-left: 1.4em; margin-bottom: .75em; }
.preview-content li { margin-bottom: .25em; }

/* ── Code block ── */
.code-block {
  background: #0f1724;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 16px 20px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  overflow-x: auto;
  position: relative;
}

.copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font);
  transition: background .15s;
}
.copy-btn:hover { background: rgba(255,255,255,.2); }

/* ── Plan badge ── */
.plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.plan-free { background: #f1f5f9; color: #64748b; }
.plan-pro  { background: var(--accent-light); color: var(--accent); }
.plan-team { background: #fef9c3; color: #854d0e; }

/* ── Section headers ── */
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
}

.section-desc {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}

/* ── Page title row ── */
.page-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title { font-size: 20px; font-weight: 700; color: var(--text); }

/* ── Toast ── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  animation: slide-in .2s ease;
  max-width: 320px;
}

.toast-success { background: #16a34a; }
.toast-error   { background: #dc2626; }
.toast-info    { background: var(--accent); }

@keyframes slide-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
}
.empty-icon { font-size: 40px; margin-bottom: 12px; opacity: .3; }
.empty-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-desc { font-size: 13px; color: var(--muted); margin-bottom: 20px; }

/* ── Login ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
}

.login-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 4px 24px rgba(0,0,0,.06);
}

.login-logo {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.login-logo span { color: var(--accent); }

.login-tagline {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 28px;
}

/* ── Color swatch ── */
.color-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-swatch {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  flex-shrink: 0;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .stats-row { grid-template-columns: 1fr; }
  .editor-layout { grid-template-columns: 1fr; }
  .page, .page-wide { padding: 20px 16px; }
  .navbar { padding: 0 16px; }
}
