/* ── Reset & Base ──────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0b0d14;
  --card-bg: #151822;
  --border: rgba(255,255,255,0.06);
  --text: #e2e8f0;
  --muted: #64748b;
  --accent: #068ec4;
  --success: #22c55e;
  --danger: #ef4444;
  --sidebar-w: 260px;
  --radius: 8px;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Buttons ──────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.btn:hover { opacity: 0.9; }
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-success {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
}
.btn-muted {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 6px 14px;
  font-size: 13px;
}
.btn-muted:hover { color: var(--text); border-color: rgba(255,255,255,0.15); }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 6px 14px; font-size: 13px; }

/* ── Editor mode toggle ──────────────────────────── */
.editor-mode-toggle {
  display: flex; gap: 0; margin-bottom: 16px;
  border: 1px solid var(--border); border-radius: 6px;
  overflow: hidden; width: fit-content;
}
.btn-mode {
  padding: 8px 20px; border: none; border-radius: 0;
  background: transparent; color: var(--muted);
  font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: all .2s;
}
.btn-mode:hover { color: var(--text); background: rgba(255,255,255,.04); }
.btn-mode.active {
  background: var(--accent); color: #fff;
}

/* ── Login ────────────────────────────────────────── */
.login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
}

.login-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

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

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.form-group input:focus {
  border-color: var(--accent);
}

.login-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius);
  color: var(--danger);
  font-size: 13px;
  padding: 10px 14px;
  margin-bottom: 16px;
}

/* ── Sidebar ──────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-section-label {
  padding: 16px 20px 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px 8px 28px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.nav-item:hover {
  background: rgba(255,255,255,0.04);
}
.nav-item.active {
  background: rgba(6,142,196,0.12);
  color: var(--accent);
}
.nav-item .nav-icon {
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}
.nav-item-muted {
  color: var(--muted);
  font-style: italic;
  font-size: 13px;
  padding: 6px 20px 6px 28px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar {
  font-size: 20px;
}

.user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

/* ── Mobile hamburger ─────────────────────────────── */
.sidebar-hamburger {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 200;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 20px;
  padding: 6px 12px;
  cursor: pointer;
}

/* ── Main Content ─────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  padding: 0;
}

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

.content-header h2 {
  font-size: 20px;
  font-weight: 600;
}

.content-body {
  padding: 24px 32px;
}

.muted { color: var(--muted); }

/* ── Editor ───────────────────────────────────────── */
.editor-group {
  margin-bottom: 20px;
}

.editor-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}

.editor-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.editor-input:focus { border-color: var(--accent); }

.editor-textarea {
  width: 100%;
  min-height: 500px;
  padding: 16px;
  background: #0a0c12;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: #c9d1d9;
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.7;
  resize: vertical;
  outline: none;
  tab-size: 2;
  transition: border-color 0.15s;
}
.editor-textarea:focus { border-color: var(--accent); }

.editor-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

/* ── Publish ──────────────────────────────────────── */
.publish-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  max-width: 600px;
}

.publish-card h3 {
  font-size: 18px;
  margin-bottom: 16px;
}

.publish-summary {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 24px;
  line-height: 1.8;
}

.publish-result {
  margin-top: 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 13px;
  font-family: monospace;
  white-space: pre-wrap;
  color: var(--success);
}

/* ── Toast ────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  z-index: 9999;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: toast-in 0.3s ease;
}
.toast.toast-success { border-color: rgba(34,197,94,0.4); }
.toast.toast-error { border-color: rgba(239,68,68,0.4); color: var(--danger); }

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

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-close { display: block; }
  .sidebar-hamburger { display: block; }
  .main-content { margin-left: 0; }
  .content-header { padding: 20px 16px 12px; }
  .content-body { padding: 16px; }
  .content-header h2 { font-size: 17px; }
  .stats-cards { grid-template-columns: repeat(2, 1fr); }
}

/* ── Stats ──────────────────────────────────────────── */
.stats-range { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.stats-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stats-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; padding: 18px; text-align: center; }
.stats-card-value { font-size: 28px; font-weight: 700; color: var(--accent); }
.stats-card-label { font-size: 13px; color: var(--muted); margin-top: 4px; }
.stats-chart-wrap { background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.bo-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bo-table th, .bo-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.bo-table th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
