/* ─── Variables ───────────────────────────────────────────────── */
:root {
  --navy:       #0b1d3e;
  --navy-light: #132248;
  --navy-card:  #0f2050;
  --orange:     #3d6fff;
  --orange-light: #5c86ff;
  --orange-glow: rgba(61, 111, 255, 0.12);
  --white:      #ffffff;
  --offwhite:   #f5f7fc;
  --gray-100:   #eef1f8;
  --gray-200:   #dde3f0;
  --gray-400:   #8f9ab5;
  --gray-600:   #4f5e7b;
  --gray-800:   #1e2d4e;
  --text:       #0b1d3e;
  --text-muted: #4f5e7b;
  --radius:     10px;
  --radius-lg:  16px;
  --shadow-sm:  0 1px 4px rgba(11,29,62,.07);
  --shadow:     0 4px 20px rgba(11,29,62,.11);
  --shadow-lg:  0 8px 40px rgba(11,29,62,.18);
  --transition: 0.2s ease;
}

/* ─── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--offwhite);
  color: var(--text);
  line-height: 1.6;
  letter-spacing: -0.011em;
  font-feature-settings: 'kern' 1;
  min-height: 100vh;
}
a { color: var(--orange); text-decoration: none; }
a:hover { color: var(--orange-light); }
img { max-width: 100%; }
button { cursor: pointer; font-family: inherit; }

/* ─── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-400); border-radius: 3px; }

/* ─── Navbar ──────────────────────────────────────────────────── */
.navbar {
  background: var(--navy);
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(0,0,0,.25);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.nav-logo {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--white);
}
.nav-logo span { color: var(--orange); }

.nav-tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gray-400);
  border-left: 1px solid rgba(255,255,255,.15);
  padding-left: 12px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gray-400);
  font-size: 14px;
}

.nav-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--orange);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: white;
  flex-shrink: 0;
}

.nav-btn {
  padding: 7px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  border: none;
  transition: var(--transition);
}
.nav-btn.ghost {
  background: rgba(255,255,255,.08);
  color: var(--gray-400);
}
.nav-btn.ghost:hover { background: rgba(255,255,255,.14); color: white; }
.nav-btn.admin-btn {
  background: var(--orange);
  color: white;
  border: none;
}
.nav-btn.admin-btn:hover { background: var(--orange-light); box-shadow: 0 4px 12px rgba(61,111,255,.35); }

/* ─── Login Page ──────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 80%, rgba(61,111,255,.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 20%, rgba(61,111,255,.08) 0%, transparent 60%);
}

.login-card {
  background: var(--navy-light);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius-lg);
  padding: 48px 44px;
  width: 100%;
  max-width: 420px;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo-name {
  font-size: 28px;
  font-weight: 800;
  color: white;
  letter-spacing: -0.5px;
}
.login-logo-name span { color: var(--orange); }
.login-logo-sub {
  font-size: 13px;
  color: var(--gray-400);
  margin-top: 4px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.login-divider {
  text-align: center;
  margin: 20px 0;
  position: relative;
}
.login-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0; right: 0;
  height: 1px;
  background: rgba(255,255,255,.1);
}
.login-divider span {
  background: var(--navy-light);
  padding: 0 12px;
  font-size: 12px;
  color: var(--gray-400);
  position: relative;
}

.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-400);
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}
.form-input {
  width: 100%;
  padding: 11px 14px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius);
  color: white;
  font-size: 14px;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}
.form-input::placeholder { color: rgba(255,255,255,.25); }
.form-input:focus {
  border-color: var(--orange);
  background: rgba(255,255,255,.09);
  box-shadow: 0 0 0 3px var(--orange-glow);
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--orange);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 700;
  transition: var(--transition);
  letter-spacing: 0.3px;
}
.btn-primary:hover { background: var(--orange-light); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(232,114,74,.4); }
.btn-primary:active { transform: none; }

.btn-google {
  width: 100%;
  padding: 11px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius);
  color: white;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: var(--transition);
  text-decoration: none;
}
.btn-google:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.2); color: white; }

.login-error {
  background: rgba(239,68,68,.15);
  border: 1px solid rgba(239,68,68,.3);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: #fca5a5;
  font-size: 13px;
  margin-bottom: 18px;
  display: none;
}
.login-error.show { display: block; }

/* ─── Search Hero ─────────────────────────────────────────────── */
.search-hero {
  background: var(--navy);
  padding: 56px 24px 48px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.search-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 100% at 50% 120%, rgba(61,111,255,.12) 0%, transparent 70%);
}

.search-hero-title {
  font-size: 32px;
  font-weight: 800;
  color: white;
  margin-bottom: 8px;
  position: relative;
  letter-spacing: -0.5px;
}
.search-hero-title span { color: var(--orange); }

.search-hero-sub {
  color: var(--gray-400);
  font-size: 15px;
  margin-bottom: 28px;
  position: relative;
}

.search-box-wrap {
  max-width: 640px;
  margin: 0 auto;
  position: relative;
}
.search-box {
  width: 100%;
  padding: 16px 56px 16px 20px;
  background: white;
  border: 2px solid transparent;
  border-radius: 50px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  box-shadow: 0 4px 24px rgba(0,0,0,.25);
  transition: var(--transition);
}
.search-box:focus { border-color: var(--orange); box-shadow: 0 4px 24px rgba(0,0,0,.25), 0 0 0 4px var(--orange-glow); }
.search-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--orange);
  pointer-events: none;
  font-size: 20px;
}

/* ─── Category Chips ──────────────────────────────────────────── */
.categories-bar {
  background: var(--navy);
  border-top: 1px solid rgba(255,255,255,.06);
  padding: 12px 24px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  justify-content: center;
  flex-wrap: wrap;
}
.categories-bar::-webkit-scrollbar { display: none; }

.cat-chip {
  padding: 5px 14px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-400);
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  user-select: none;
}
.cat-chip:hover { color: white; background: rgba(255,255,255,.1); }
.cat-chip.active { background: var(--orange); border-color: var(--orange); color: white; }

/* ─── Results Area ────────────────────────────────────────────── */
.results-area {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 24px;
}

.results-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.results-meta strong { color: var(--text); }

.result-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  display: block;
  text-decoration: none;
  color: inherit;
}
.result-card:hover {
  border-color: var(--orange);
  box-shadow: 0 4px 20px rgba(232,114,74,.12);
  transform: translateY(-2px);
}

.result-category {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 6px;
}

.result-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.3;
}

.result-summary {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.result-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tag {
  padding: 2px 10px;
  background: var(--gray-100);
  border-radius: 50px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-600);
}

.result-date {
  font-size: 12px;
  color: var(--gray-400);
  margin-left: auto;
  white-space: nowrap;
}

/* ─── Empty State ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
}
.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: .5; }
.empty-title { font-size: 18px; font-weight: 700; color: var(--gray-600); margin-bottom: 8px; }

/* ─── Article Page ────────────────────────────────────────────── */
.article-layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 32px;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 36px;
  align-items: start;
}

@media (max-width: 800px) {
  .article-layout { grid-template-columns: 1fr; }
  .article-sidebar { order: -1; }
}

.article-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--orange);
  margin-bottom: 20px;
}
.article-back:hover { color: var(--orange-light); }

.article-main-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 48px 56px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}

@media (max-width: 600px) {
  .article-main-card { padding: 24px 20px; }
}

.article-category-badge {
  display: inline-block;
  padding: 4px 12px;
  background: var(--orange-glow);
  border: 1px solid rgba(232,114,74,.25);
  border-radius: 50px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 16px;
}

.article-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.25;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.article-meta-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.article-meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--text-muted);
}

.article-tags-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

/* ─── Article Content ─────────────────────────────────────────── */
.article-content { line-height: 1.9; color: var(--text); font-size: 16px; }
.article-content h1, .article-content h2, .article-content h3,
.article-content h4, .article-content h5 {
  font-weight: 700;
  color: var(--navy);
  margin: 36px 0 14px;
  line-height: 1.3;
}
.article-content h1:first-child, .article-content h2:first-child { margin-top: 0; }
.article-content h1 { font-size: 26px; }
.article-content h2 { font-size: 21px; border-bottom: 2px solid var(--gray-200); padding-bottom: 10px; }
.article-content h3 { font-size: 18px; }
.article-content p { margin-bottom: 18px; }
.article-content ul, .article-content ol { margin: 0 0 18px 28px; }
.article-content li { margin-bottom: 8px; line-height: 1.8; }
.article-content strong { font-weight: 700; color: var(--navy); }
.article-content em { font-style: italic; }
.article-content blockquote {
  border-left: 4px solid var(--orange);
  padding: 12px 20px;
  margin: 20px 0;
  background: var(--orange-glow);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text);
  font-style: italic;
}
.article-content code {
  background: var(--gray-100);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 13px;
  color: var(--navy);
}
.article-content pre {
  background: var(--navy);
  color: #e2e8f0;
  padding: 20px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 20px 0;
  font-size: 13px;
  line-height: 1.7;
}
.article-content pre code { background: none; color: inherit; padding: 0; font-size: inherit; }
.article-content hr { border: none; border-top: 1px solid var(--gray-200); margin: 28px 0; }
.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14px;
}
.article-content th, .article-content td {
  padding: 10px 14px;
  text-align: left;
  border: 1px solid var(--gray-200);
}
.article-content th {
  background: var(--navy);
  color: white;
  font-weight: 600;
}
.article-content tr:nth-child(even) td { background: var(--gray-100); }
.article-content a { color: var(--orange); text-decoration: underline; }

/* ─── Sidebar ─────────────────────────────────────────────────── */
.sidebar-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  margin-bottom: 16px;
}
.sidebar-heading {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gray-400);
  margin-bottom: 14px;
}

.related-item {
  display: block;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
  text-decoration: none;
  transition: var(--transition);
}
.related-item:last-child { border-bottom: none; }
.related-item:hover .related-title { color: var(--orange); }
.related-cat { font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--orange); margin-bottom: 2px; }
.related-title { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.3; }

/* ─── Admin Page ──────────────────────────────────────────────── */
.admin-layout {
  display: grid;
  grid-template-columns: 244px 1fr;
  min-height: calc(100vh - 64px);
}

.admin-sidebar {
  background: var(--navy);
  padding: 16px 0;
  border-right: 1px solid rgba(255,255,255,.06);
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
}

.admin-nav-section {
  padding: 0 16px;
  margin-bottom: 3px;
}
.admin-nav-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
  padding: 0 12px;
  margin-bottom: 2px;
}
.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px;
  border-radius: var(--radius);
  font-size: 12.5px;
  font-weight: 500;
  color: rgba(255,255,255,.6);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  line-height: 1.3;
}
.admin-nav-item:hover { background: rgba(255,255,255,.07); color: white; }
.admin-nav-item.active { background: rgba(232,114,74,.15); color: var(--orange); }
.admin-nav-icon { font-size: 16px; width: 20px; text-align: center; }

.admin-content { background: var(--offwhite); padding: 32px; overflow-y: auto; }

.admin-section { display: none; }
.admin-section.active { display: block; }

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.admin-page-title { font-size: 22px; font-weight: 800; color: var(--text); }
.admin-page-sub { font-size: 14px; color: var(--text-muted); margin-top: 2px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}
@media (max-width: 900px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 22px;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}
.stat-num {
  font-size: 32px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}
.stat-icon { font-size: 28px; margin-bottom: 8px; }

/* ─── Admin Table ─────────────────────────────────────────────── */
.admin-table-card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.admin-table-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-search-input {
  padding: 8px 14px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
  width: 220px;
  color: var(--text);
}
.admin-search-input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-glow); }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 8px 20px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--gray-100);
  border-bottom: 1px solid var(--gray-200);
}
.data-table td {
  padding: 7px 20px;
  font-size: 14px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--text);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--offwhite); }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 700;
}
.badge-super { background: rgba(124,58,237,.12); color: #7c3aed; font-weight: 700; }
.badge-admin { background: rgba(232,114,74,.15); color: var(--orange); }
.badge-user { background: var(--gray-100); color: var(--gray-600); }
.badge-published { background: rgba(34,197,94,.12); color: #15803d; }
.badge-draft { background: var(--gray-100); color: var(--gray-600); }

.action-btn {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid;
  transition: var(--transition);
  cursor: pointer;
  font-family: inherit;
}
.action-btn.edit { border-color: var(--gray-200); color: var(--text); background: white; }
.action-btn.edit:hover { border-color: var(--orange); color: var(--orange); }
.action-btn.delete { border-color: rgba(239,68,68,.3); color: #dc2626; background: white; }
.action-btn.delete:hover { background: rgba(239,68,68,.06); }
.action-btn.view { border-color: rgba(59,130,246,.3); color: #2563eb; background: white; }
.action-btn.view:hover { background: rgba(59,130,246,.06); }

/* ─── Add / Edit Buttons ──────────────────────────────────────── */
.btn-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  background: var(--orange);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
  transition: var(--transition);
  cursor: pointer;
  font-family: inherit;
}
.btn-add:hover { background: var(--orange-light); box-shadow: 0 4px 12px rgba(232,114,74,.35); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  background: white;
  color: var(--text);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
  cursor: pointer;
  font-family: inherit;
}
.btn-secondary:hover { border-color: var(--gray-400); }

.source-action-btn {
  width: auto;
  font-size: 12px;
  padding: 5px 14px;
  min-width: 140px;
  justify-content: center;
}
.source-action-btn.active {
  background: var(--orange-glow);
  border-color: var(--orange);
  color: var(--orange);
}

/* ─── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,20,40,.65);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(16px);
  transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: none; }

.modal-header {
  padding: 22px 26px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: white;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-title { font-size: 17px; font-weight: 700; color: var(--text); }
.modal-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--gray-200);
  background: white;
  font-size: 18px;
  color: var(--gray-600);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.modal-close:hover { background: var(--gray-100); color: var(--text); }

.modal-body { padding: 24px 26px; }
.modal-footer {
  padding: 16px 26px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.form-group-modal { margin-bottom: 16px; }
.form-label-modal {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 6px;
}
.form-label-modal .optional {
  font-weight: 400;
  color: var(--gray-400);
  margin-left: 4px;
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: var(--transition);
  background: white;
}
.form-control:focus { border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-glow); }
.form-control.textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.6;
}
.form-control.content-area {
  min-height: 280px;
  font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.7;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.checkbox-row input[type="checkbox"] { accent-color: var(--orange); width: 15px; height: 15px; }
.checkbox-row label { font-size: 14px; color: var(--text); cursor: pointer; font-weight: 500; }

/* ─── Toast ───────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--navy);
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--orange);
  animation: slideIn 0.3s ease;
  max-width: 320px;
}
.toast.success { border-color: #22c55e; }
.toast.error { border-color: #ef4444; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: none; opacity: 1; } }

/* ─── Loading ─────────────────────────────────────────────────── */
.loading-spinner {
  text-align: center;
  padding: 48px;
  color: var(--text-muted);
  font-size: 14px;
}
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── 403 ─────────────────────────────────────────────────────── */
.error-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  flex-direction: column;
  gap: 12px;
}
.error-code { font-size: 80px; font-weight: 900; color: var(--orange); line-height: 1; }
.error-title { font-size: 24px; font-weight: 700; color: var(--navy); }
.error-sub { color: var(--text-muted); }

/* ─── Glossary Tooltips ───────────────────────────────────────── */
.glossary-term {
  border-bottom: 2px dotted var(--orange);
  cursor: help;
  position: relative;
  display: inline;
}
.glossary-term .glossary-tip {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  transform: none;
  background: var(--navy);
  color: white;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.6;
  width: 300px;
  white-space: normal;
  text-align: left;
  pointer-events: none;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.1);
  transition: opacity 0.18s ease, transform 0.18s ease;
  word-break: normal;
  overflow-wrap: break-word;
}
.glossary-term .glossary-tip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 16px;
  transform: none;
  border: 6px solid transparent;
  border-top-color: var(--navy);
}
.glossary-term:hover {
  z-index: 300;
}
.glossary-term:hover .glossary-tip {
  visibility: visible;
  opacity: 1;
}

/* ─── Auto-Related Articles ───────────────────────────────────── */
.related-articles-section {
  margin-top: 40px;
  padding-top: 28px;
  border-top: 2px solid var(--gray-200);
}
.related-articles-heading {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gray-400);
  margin-bottom: 16px;
}
.related-articles-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (max-width: 600px) { .related-articles-grid { grid-template-columns: 1fr; } }
.related-article-card {
  display: block;
  background: var(--offwhite);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-decoration: none;
  transition: var(--transition);
}
.related-article-card:hover {
  border-color: var(--orange);
  background: white;
  box-shadow: 0 4px 12px rgba(61,111,255,.08);
  transform: translateY(-1px);
}
.related-article-cat {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 4px;
}
.related-article-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}
.related-article-summary {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ─── Responsive ──────────────────────────────────────────────── */
.mobile-sidebar-toggle { display: none; }
.mobile-sidebar-overlay { display: none; }
@media (max-width: 900px) {
  .admin-layout { grid-template-columns: 1fr; }
  /* Sidebar becomes a slide-in drawer instead of just disappearing — with
     no toggle, mobile users (including super admins) had no way to reach
     the nav at all below this breakpoint. */
  .admin-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 260px; z-index: 300;
    transform: translateX(-100%); transition: transform .25s ease;
    overflow-y: auto;
  }
  .admin-sidebar.open { transform: translateX(0); }
  .mobile-sidebar-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; font-size: 18px; background: rgba(255,255,255,.08);
    border: none; border-radius: var(--radius); color: white; cursor: pointer;
  }
  .mobile-sidebar-overlay.open {
    display: block; position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 290;
  }
}
@media (max-width: 600px) {
  .navbar { padding: 0 16px; }
  .nav-tag { display: none; }
  .search-hero { padding: 36px 16px 32px; }
  .search-hero-title { font-size: 24px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ─── Design Enhancements ─────────────────────────────────────── */

/* Navbar polish */
.navbar { border-bottom: 1px solid rgba(255,255,255,.05); }
.nav-tag { font-size: 10px; }

/* Article page — accent strip above main card */
.article-back { font-size: 12px; letter-spacing: .3px; }
.article-main-card {
  border-top: 3px solid var(--orange);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Article content — richer typography */
.article-content h2 {
  border-bottom: 1px solid var(--gray-200);
  padding-bottom: 10px;
  margin-top: 40px;
}
.article-content th {
  background: var(--navy);
  letter-spacing: .3px;
  font-size: 12px;
  text-transform: uppercase;
}
.article-content td { vertical-align: top; }

/* Sidebar heading — orange accent line */
.sidebar-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--navy);
  font-size: 11px;
  letter-spacing: 1.2px;
}
.sidebar-heading::before {
  content: '';
  display: block;
  width: 3px;
  height: 14px;
  background: var(--orange);
  border-radius: 2px;
  flex-shrink: 0;
}

/* Admin sidebar — richer active state */
.admin-nav-item.active {
  background: linear-gradient(90deg, rgba(61,111,255,.18) 0%, rgba(61,111,255,.06) 100%);
  color: var(--orange-light);
  font-weight: 600;
  border-left: 2px solid var(--orange);
  margin-left: -2px;
  padding-left: 14px;
}
.admin-nav-item { border-left: 2px solid transparent; margin-left: -2px; }

/* Admin content — bigger page titles */
.admin-page-title { font-size: 22px; letter-spacing: -0.4px; }
.admin-page-sub { font-size: 13px; }

/* Stat cards — richer */
.stat-card {
  border-top: 2px solid var(--gray-200);
  transition: border-top-color .2s, box-shadow .2s;
}
.stat-card:hover { border-top-color: var(--orange); box-shadow: 0 4px 20px rgba(61,111,255,.08); }
.stat-num { font-size: 34px; }

/* Buttons — better focus ring */
.btn-add:focus-visible, .btn-secondary:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

/* Form controls */
.form-control:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(61,111,255,.12);
  outline: none;
}

/* Badges */
.badge { font-size: 11px; letter-spacing: .3px; }
.badge-super { font-size: 11px; }

/* Data tables — cleaner rows */
.data-table th {
  background: var(--navy);
  color: rgba(255,255,255,.8);
  font-size: 11px;
  letter-spacing: .8px;
  text-transform: uppercase;
  font-weight: 600;
}
.data-table tr:hover td { background: rgba(61,111,255,.03); }

/* Loading spinner — smoother */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid var(--gray-200);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* Toast — cleaner */
.toast {
  background: var(--navy);
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
  margin-bottom: 8px;
  border-left: 3px solid var(--orange);
  animation: slideIn .2s ease;
}
.toast.success { border-left-color: #22c55e; }
.toast.error { border-left-color: #ef4444; }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Error page */
.error-page {
  text-align: center;
  padding: 100px 24px;
}
.error-code {
  font-size: 72px;
  font-weight: 800;
  color: var(--gray-200);
  line-height: 1;
  margin-bottom: 12px;
}
.error-title { font-size: 22px; font-weight: 700; color: var(--navy); margin-bottom: 8px; }
.error-sub { color: var(--text-muted); font-size: 14px; }
