/* ============================================================
   Sanctum â€” an esoteric library, not a SaaS dashboard.
   Desktop: persistent left sidebar (Notion/Slack-style)
   Mobile:  compact top bar + fixed bottom tab bar with FAB
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700&family=Cormorant+Garamond:ital,wght@0,500;0,600;1,500&display=swap');

:root {
  /* Deep royal amethyst â€” primary accent (dimmed from neon toward "royal") */
  --primary: #7c4dd9;
  --primary-dark: #5b3aa8;
  --primary-bright: #9b6ef3;
  --primary-soft: rgba(124, 77, 217, 0.16);

  /* Muted celestial gold/brass â€” secondary accent for highlights & badges */
  --gold: #d4af37;
  --gold-soft: rgba(212, 175, 55, 0.16);
  --gold-dim: #8a7126;

  /* Obsidian / cosmic charcoal neutrals, with an indigo undertone instead of flat gray */
  --bg: #0a0812;
  --bg-glow-1: rgba(88, 51, 158, 0.16);
  --bg-glow-2: rgba(15, 89, 74, 0.10);
  --surface: #15111f;
  --surface-2: #1d1829;
  --surface-3: #271f38;
  --text: #f1ecf7;
  --text-muted: #a89bc0;
  --text-faint: #7a6d95;
  --border: rgba(212, 175, 55, 0.14);
  --border-soft: rgba(255, 255, 255, 0.06);

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 8px 28px rgba(0,0,0,0.4);
  --shadow-lg: 0 16px 44px rgba(0,0,0,0.5);
  --glow-primary: 0 0 0 1px rgba(124,77,217,0.4), 0 0 24px rgba(124,77,217,0.35);
  --glow-gold: 0 0 0 1px rgba(212,175,55,0.35), 0 0 18px rgba(212,175,55,0.25);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Cinzel', Georgia, 'Times New Roman', serif;
  --font-serif: 'Cormorant Garamond', Georgia, serif;

  --sidebar-w: 252px;
  --topbar-h: 60px;
  --bottomnav-h: 66px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  position: relative;
  min-height: 100vh;
}

/* Atmospheric depth: layered radial glows + faint constellation dots,
   fixed to the viewport so it reads as ambient light, not a texture. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 900px 600px at 12% -8%, var(--bg-glow-1), transparent 60%),
    radial-gradient(ellipse 700px 500px at 100% 10%, var(--bg-glow-2), transparent 60%),
    radial-gradient(ellipse 800px 700px at 90% 95%, rgba(124,77,217,0.08), transparent 65%);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.4;
  background-image:
    radial-gradient(1px 1px at 8% 22%, rgba(241,236,247,0.5) 100%, transparent),
    radial-gradient(1px 1px at 22% 68%, rgba(212,175,55,0.4) 100%, transparent),
    radial-gradient(1.5px 1.5px at 38% 12%, rgba(241,236,247,0.35) 100%, transparent),
    radial-gradient(1px 1px at 55% 80%, rgba(241,236,247,0.4) 100%, transparent),
    radial-gradient(1px 1px at 68% 35%, rgba(212,175,55,0.35) 100%, transparent),
    radial-gradient(1.5px 1.5px at 82% 60%, rgba(241,236,247,0.4) 100%, transparent),
    radial-gradient(1px 1px at 92% 20%, rgba(241,236,247,0.3) 100%, transparent),
    radial-gradient(1px 1px at 15% 88%, rgba(241,236,247,0.3) 100%, transparent);
  background-repeat: no-repeat;
}
.app-shell, .admin-shell { position: relative; z-index: 1; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { font-family: inherit; }
::selection { background: var(--primary-soft); }

h1, h2, h3, .font-display { font-family: var(--font-display); letter-spacing: 0.01em; font-weight: 600; }

/* ---------- Icon system ---------- */
.icon-svg { flex-shrink: 0; vertical-align: middle; }
.icon-emoji {
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1; font-style: normal;
}


/* ============================================================
   App shell layout
   ============================================================ */
.app-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---------- Desktop sidebar ---------- */
.app-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: rgba(21, 17, 31, 0.72);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-right: 1px solid var(--border);
  box-shadow: 1px 0 0 rgba(255,255,255,0.03);
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
}
.app-logo {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
  padding: 4px 10px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.app-logo .icon-svg { color: var(--gold); filter: drop-shadow(0 0 6px rgba(212,175,55,0.5)); }
.app-logo span { color: var(--text); }
.app-logo-mobile {
  font-family: var(--font-display);
  display: flex; align-items: center; gap: 8px; font-weight: 600;
  font-size: 1.08rem; letter-spacing: 0.01em; white-space: nowrap; color: var(--text);
}
.app-logo-mobile .icon-svg { color: var(--gold); filter: drop-shadow(0 0 5px rgba(212,175,55,0.45)); }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.94rem;
  font-weight: 500;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.sidebar-link .icon { font-size: 1.05rem; width: 20px; text-align: center; }
.sidebar-link:hover { background: var(--surface-2); color: var(--text); }
.sidebar-link.active { background: var(--primary-soft); color: var(--text); font-weight: 600; }
.sidebar-link.active .icon-svg { color: var(--primary-bright); }
.sidebar-link.active::before {
  content: "";
  position: absolute;
  left: -12px; top: 50%; transform: translateY(-50%);
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px 1px rgba(212,175,55,0.8);
}

.sidebar-nav + .sidebar-section-label,
.sidebar-nav:first-of-type {
  position: relative;
}
.sidebar-section-label {
  position: relative;
  font-family: var(--font-display);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold-dim);
  padding: 22px 12px 8px;
  font-weight: 600;
}
.sidebar-section-label::before {
  content: "";
  position: absolute;
  top: 10px; left: 12px; right: 12px;
  height: 1px;
  background: linear-gradient(90deg, rgba(212,175,55,0.5), transparent 75%);
}
.sidebar-categories { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.sidebar-categories .sidebar-link .icon-svg { color: var(--text-faint); transition: color 0.15s var(--ease); }
.sidebar-categories .sidebar-link:hover .icon-svg { color: var(--gold); }
.sidebar-spacer { flex: 1; min-height: 12px; }

.sidebar-write-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: 0.02em;
  padding: 11px;
  border-radius: var(--radius-sm);
  margin: 14px 4px 10px;
  box-shadow: var(--glow-primary);
  transition: box-shadow 0.2s var(--ease), transform 0.1s var(--ease), filter 0.2s var(--ease);
}
.sidebar-write-btn:hover { filter: brightness(1.12); box-shadow: 0 0 0 1px rgba(124,77,217,0.55), 0 0 32px rgba(124,77,217,0.5); }
.sidebar-write-btn:active { transform: scale(0.98); }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  margin-top: 4px;
}
.user-avatar-circle {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}
.user-avatar-circle.small { width: 26px; height: 26px; font-size: 0.8rem; }
.user-avatar-circle.large { width: 64px; height: 64px; font-size: 1.6rem; }
.user-info { min-width: 0; }
.user-name { font-size: 0.9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-sub { font-size: 0.78rem; color: var(--text-faint); }
.muted-link { font-size: 0.85rem; color: var(--text-faint) !important; }

/* ---------- Main column ---------- */
.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Mobile-only top bar (hidden on desktop) */
.app-topbar {
  display: none;
}
.sidebar-toggle-btn, .sidebar-backdrop { display: none; }
.sidebar-close-btn {
  display: none;
  position: absolute; top: calc(16px + var(--safe-top)); right: 14px;
  align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px;
  color: var(--text-muted); cursor: pointer;
}
.sidebar-close-btn:hover { color: var(--text); background: var(--surface-3); }

.app-content {
  flex: 1;
  padding: 28px 32px 60px;
  width: 100%;
}
.container { max-width: 980px; margin: 0 auto; }

/* ============================================================
   Mobile layout: sidebar becomes hidden, bottom tab bar appears
   ============================================================ */
@media (max-width: 900px) {
  .app-sidebar { display: none; }

  .app-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: calc(var(--topbar-h) + var(--safe-top));
    padding: calc(10px + var(--safe-top)) 16px 10px;
    background: rgba(15, 11, 24, 0.78);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 30;
  }
  .sidebar-toggle-btn {
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
    color: var(--text); cursor: pointer;
    transition: background 0.12s var(--ease), border-color 0.12s var(--ease);
  }
  .sidebar-toggle-btn:hover { background: var(--surface-3); }
  .sidebar-toggle-btn:active { transform: scale(0.94); }

  .app-logo-mobile { flex-shrink: 0; }

  /* Smaller, right-aligned search â€” doesn't fight the logo for space */
  .topbar-search { flex: 0 1 128px; margin-left: auto; position: relative; display: flex; align-items: center; transition: flex-basis 0.15s var(--ease); }
  .topbar-search:focus-within { flex-basis: 168px; }
  .topbar-search-icon {
    position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
    color: var(--text-faint); display: flex; pointer-events: none;
  }
  .topbar-search input {
    width: 100%;
    height: 34px;
    padding: 0 12px 0 32px;
    border-radius: 17px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-size: 0.84rem;
    line-height: 34px;
  }
  .topbar-search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

  .app-content { padding: 16px 16px calc(var(--bottomnav-h) + var(--safe-bottom) + 24px); }

  .site-footer { display: none; } /* keep mobile focused, footer redundant with bottom nav */

  /* ---------- Sidebar becomes a slide-in overlay drawer on mobile ---------- */
  .sidebar-close-btn { display: flex; }
  .sidebar-backdrop {
    display: block;
    position: fixed; inset: 0;
    background: rgba(8, 6, 14, 0.6);
    backdrop-filter: blur(2px);
    z-index: 55;
    opacity: 0; pointer-events: none;
    transition: opacity 0.22s var(--ease);
  }
  .sidebar-backdrop.is-open { opacity: 1; pointer-events: auto; }

  .app-sidebar {
    display: flex;
    position: fixed; top: 0; left: 0;
    width: min(300px, 84vw);
    height: 100vh; height: 100dvh;
    transform: translateX(-100%);
    transition: transform 0.28s var(--ease);
    z-index: 60;
    box-shadow: 8px 0 32px rgba(0,0,0,0.45);
    padding-top: calc(20px + var(--safe-top));
  }
  .app-sidebar.is-open { transform: translateX(0); }
}
body.no-scroll { overflow: hidden; }

/* ---------- Guest "register for free" banner ---------- */
.guest-banner {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 10px 44px 10px 16px; position: relative;
  background: linear-gradient(90deg, var(--primary-dark), var(--primary));
  color: #fff; font-size: 0.88rem; font-weight: 500; text-align: center;
}
.guest-banner-link { color: #fff; text-decoration: none; }
.guest-banner-link strong { text-decoration: underline; }
.guest-banner-link:hover { opacity: 0.9; }
.guest-banner-close {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(255,255,255,0.15); border: none; color: #fff; cursor: pointer;
  flex-shrink: 0;
}
.guest-banner-close:hover { background: rgba(255,255,255,0.28); }
@media (max-width: 560px) {
  .guest-banner { font-size: 0.8rem; padding: 9px 40px 9px 12px; }
}

/* ---------- "Write" popup (sidebar Write button + mobile FAB) ---------- */
.write-modal-backdrop {
  display: flex; align-items: center; justify-content: center; padding: 20px;
  position: fixed; inset: 0; z-index: 70;
  background: rgba(8,6,14,0.6); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity 0.2s var(--ease);
}
.write-modal-backdrop.is-open { opacity: 1; pointer-events: auto; }
.write-modal {
  position: relative; width: 100%; max-width: 380px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 26px 22px 22px; box-shadow: var(--shadow-md);
  transform: translateY(10px); transition: transform 0.22s var(--ease);
}
.write-modal-backdrop.is-open .write-modal { transform: translateY(0); }
.write-modal h2 { margin: 0 0 16px; font-size: 1.15rem; }
.write-modal-close {
  position: absolute; top: 14px; right: 14px;
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text-muted); cursor: pointer;
}
.write-modal-close:hover { color: var(--text); background: var(--surface-3); }
.write-modal-option {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  transition: background 0.12s var(--ease), border-color 0.12s var(--ease);
}
.write-modal-option:hover { background: var(--surface-3); border-color: rgba(212,175,55,0.3); }
.write-modal-option-icon {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary-bright);
  display: flex; align-items: center; justify-content: center;
}
.write-modal-option-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.write-modal-option-text strong { font-size: 0.95rem; }
.write-modal-option-sub { font-size: 0.8rem; color: var(--text-faint); }
.write-modal-option.disabled { pointer-events: none; cursor: default; opacity: 0.5; }
.write-modal-locked-msg {
  display: none;
  margin: 12px 2px 0; font-size: 0.85rem; color: var(--text-muted); line-height: 1.5;
}
.write-modal-locked-msg.is-visible { display: block; }
.write-modal-locked-msg a { color: var(--primary-bright); font-weight: 600; }

/* ---------- Fixed bottom tab bar (mobile only) ---------- */
.bottom-nav {
  display: none;
}
@media (max-width: 900px) {
  .bottom-nav {
    display: flex;
    align-items: center;
    justify-content: space-around;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: calc(var(--bottomnav-h) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: rgba(17, 13, 27, 0.78);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border-top: 1px solid var(--border);
    z-index: 40;
  }
  .bottom-nav-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: var(--text-faint);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    flex: 1;
    padding: 6px 0;
    transition: color 0.15s var(--ease);
  }
  .bottom-nav-item .icon { font-size: 1.25rem; line-height: 1; }
  .bottom-nav-item.active { color: var(--gold); }
  .bottom-nav-item.active .icon-svg { stroke-width: 2; color: var(--primary-bright); }
  .bottom-nav-item.active::after {
    content: "";
    position: absolute;
    top: -1px; left: 50%; transform: translateX(-50%);
    width: 4px; height: 4px; border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 6px 1px rgba(212,175,55,0.8);
  }
  .bottom-nav-fab {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 54px; height: 54px;
    margin-top: -26px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, var(--primary-bright), var(--primary-dark) 75%);
    color: #fff;
    font-size: 1.4rem;
    box-shadow:
      0 0 0 3px rgba(10,8,18,0.9),
      0 0 0 4px rgba(212,175,55,0.55),
      0 4px 18px rgba(124,77,217,0.55),
      0 0 26px rgba(124,77,217,0.4);
    transition: transform 0.15s var(--ease), box-shadow 0.2s var(--ease);
  }
  .bottom-nav-fab:active {
    transform: scale(0.92);
    box-shadow:
      0 0 0 3px rgba(10,8,18,0.9),
      0 0 0 4px rgba(212,175,55,0.75),
      0 4px 22px rgba(124,77,217,0.7);
  }
}

/* ============================================================
   Shared components
   ============================================================ */

.category-tag { display: inline-block; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; padding: 3px 11px; border-radius: 12px; font-size: 0.76rem; font-weight: 600; letter-spacing: 0.02em; }
.category-tag.small { font-size: 0.7rem; }
.meta { color: var(--text-muted); font-size: 0.88rem; margin-top: 8px; }
.meta.small { font-size: 0.8rem; }

/* ---------- Featured ---------- */
.featured-article { margin: 4px 0 24px; animation: fade-up 0.4s var(--ease); }
.featured-link { display: block; position: relative; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-md); }
.featured-cover { width: 100%; height: 240px; object-fit: cover; display: block; filter: brightness(0.5); transition: transform 0.4s var(--ease); }
.featured-link:hover .featured-cover { transform: scale(1.03); }
.featured-info { position: absolute; bottom: 0; left: 0; right: 0; padding: 20px; background: linear-gradient(transparent, rgba(0,0,0,0.9)); }
.featured-info h1 { font-size: 1.4rem; margin: 8px 0; }
@media (min-width: 700px) {
  .featured-cover { height: 400px; }
  .featured-info { padding: 34px; }
  .featured-info h1 { font-size: 2.1rem; }
}

/* ---------- Grids & cards ---------- */
.grid { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 16px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(3, 1fr); } }

/* Homepage "Latest" grid only: 2 columns even on narrow phones (instead
   of the single stacked column .grid uses elsewhere below 560px), with
   the card content sized down to fit two side by side comfortably. */
@media (max-width: 559px) {
  .latest-articles-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .latest-articles-grid .article-card img { height: 92px; }
  .latest-articles-grid .article-card .category-tag { margin: 8px 0 0 10px; }
  .latest-articles-grid .article-card h3 { margin: 8px 10px 3px; font-size: 0.85rem; line-height: 1.28; }
  .latest-articles-grid .article-card p { display: none; }
  .latest-articles-grid .article-card .meta { margin: 0 10px 12px; font-size: 0.72rem; }
}

.article-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: block;
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), border-color 0.18s var(--ease);
  animation: fade-up 0.35s var(--ease) both;
}
.article-card:hover { transform: translateY(-3px); box-shadow: 0 0 0 1px rgba(212,175,55,0.2), var(--shadow-md); border-color: rgba(212,175,55,0.35); }
.article-card img { width: 100%; height: 150px; object-fit: cover; display: block; background: var(--surface-2); }
.article-card h3, .article-card h4 { margin: 12px 14px 4px; font-size: 1.02rem; }
.article-card p { margin: 0 14px 10px; color: var(--text-muted); font-size: 0.88rem; }
.article-card .meta { margin: 0 14px 14px; }
.article-card.small img { height: 100px; }

.two-col { display: grid; grid-template-columns: 1fr; gap: 24px; margin: 30px 0; }
@media (min-width: 700px) { .two-col { grid-template-columns: 1fr 1fr; } }
/* ---------- Trending: ranked cards, not a bare numbered list ---------- */
.trending-list { margin-top: 32px; }
.trending-list h2 { display: flex; align-items: center; gap: 8px; }
.trending-list h2 svg { color: var(--gold); }
.trending-list ol { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-direction: column; gap: 10px; }

.trending-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.16s var(--ease), border-color 0.16s var(--ease), background 0.16s var(--ease);
  animation: fade-up 0.35s var(--ease) both;
}
.trending-item:hover {
  transform: translateX(4px);
  border-color: rgba(212,175,55,0.4);
  background: var(--surface-2);
}

.trending-rank {
  flex: 0 0 auto;
  min-width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--bg);
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
}
.trending-list ol li:nth-child(-n+3) .trending-rank {
  background: linear-gradient(135deg, var(--primary-bright), var(--primary-dark));
  color: #fff;
}

.trending-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.trending-title {
  font-size: 0.98rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trending-meta { display: flex; align-items: center; gap: 10px; font-size: 0.8rem; color: var(--text-muted); }
.trending-cat {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-bright);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.trending-views { display: inline-flex; align-items: center; gap: 4px; }
.trending-views svg { color: var(--gold-dim); }

.trending-arrow { flex: 0 0 auto; color: var(--text-faint); transform: rotate(-90deg); transition: transform 0.16s var(--ease), color 0.16s var(--ease); }
.trending-item:hover .trending-arrow { color: var(--gold); transform: rotate(-90deg) translateX(2px); }

@media (max-width: 480px) {
  .trending-meta { flex-wrap: wrap; gap: 6px; }
}

/* ---------- Altar card: the bounded, ceremonial empty-state container ---------- */
.altar-card {
  text-align: center;
  padding: 56px 24px;
  margin: 24px 0;
  color: var(--text-muted);
  background: linear-gradient(180deg, rgba(124,77,217,0.06), rgba(255,255,255,0.015));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.altar-card::before {
  content: "";
  position: absolute;
  top: -40%; left: 50%; transform: translateX(-50%);
  width: 340px; height: 340px;
  background: radial-gradient(circle, rgba(124,77,217,0.18), transparent 70%);
  pointer-events: none;
}
.altar-card h1 { color: var(--text); margin: 0 0 10px; position: relative; }
.altar-card p { position: relative; font-size: 1.05rem; }
.empty-state-icon {
  width: 72px; height: 72px; margin: 0 auto 20px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--gold-soft);
  color: var(--gold);
  box-shadow: var(--glow-gold);
  position: relative;
}

/* ---------- Search page ---------- */
.search-page-header { margin: 4px 0 8px; }
.search-page-header h1 { display: flex; align-items: center; gap: 12px; margin: 0 0 20px; }
.search-page-header h1 .icon-svg { color: var(--gold); }
.search-form-large {
  display: flex; align-items: center; gap: 10px;
  max-width: 640px;
}
.search-form-large { position: relative; }
.search-form-icon {
  position: absolute; left: 18px; top: 50%; transform: translateY(-50%);
  color: var(--text-faint); display: flex; pointer-events: none;
}
.search-form-large input {
  flex: 1;
  height: 50px;
  padding: 0 18px 0 46px;
  border-radius: 25px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.98rem;
  font-family: inherit;
  transition: border-color 0.12s var(--ease), box-shadow 0.12s var(--ease);
}
.search-form-large input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.search-form-large input::placeholder { color: var(--text-faint); }
.search-form-large button {
  height: 50px; padding: 0 26px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; border: none; border-radius: 25px;
  font-weight: 600; cursor: pointer;
  box-shadow: var(--glow-primary);
  transition: filter 0.12s var(--ease), transform 0.1s var(--ease);
}
.search-form-large button:hover { filter: brightness(1.1); }
.search-form-large button:active { transform: scale(0.97); }
.search-result-count { margin: 18px 0 4px; }
@media (max-width: 480px) {
  .search-form-large { flex-wrap: wrap; }
  .search-form-large input { width: 100%; }
  .search-form-large button { width: 100%; }
}

/* ---------- Category cards: esoteric archive grid ---------- */
.categories-section { margin: 40px 0 8px; }
.category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 18px;
}
@media (min-width: 560px) { .category-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .category-grid { grid-template-columns: repeat(5, 1fr); } }
.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 22px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), border-color 0.18s var(--ease);
}
.category-card:hover {
  transform: translateY(-3px);
  border-color: rgba(212,175,55,0.4);
  box-shadow: 0 0 0 1px rgba(212,175,55,0.25), 0 10px 28px rgba(124,77,217,0.18);
}
.category-card-icon {
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-bright);
  transition: color 0.18s var(--ease), background 0.18s var(--ease);
}
.category-card:hover .category-card-icon { color: var(--gold); background: var(--gold-soft); }
.category-card-title { font-size: 0.88rem; font-weight: 600; color: var(--text); }

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

/* ---------- Single article ---------- */
.single-article .cover { width: 100%; max-height: 380px; object-fit: cover; border-radius: var(--radius-lg); }
.article-meta-top { margin: 20px 0; }
.article-meta-top h1 { font-size: 1.5rem; margin: 10px 0; line-height: 1.25; }
@media (min-width: 700px) { .article-meta-top h1 { font-size: 2.1rem; } }
.author-line { color: var(--text-muted); font-size: 0.92rem; }
.share-buttons { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.share-buttons button {
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  padding: 7px 14px; border-radius: 20px; cursor: pointer; font-size: 0.84rem;
  transition: background 0.15s var(--ease);
}
.share-buttons button:hover { background: var(--surface-3); }
/* Fixed (not sticky) so it always tracks the actual viewport regardless
   of ancestor stacking/containing-block quirks â€” sticky was inconsistent
   here. Starts after the sidebar's width on desktop; mobile (below)
   pulls it back to the left edge, under the topbar. */
.reading-progress { position: fixed; top: 0; left: var(--sidebar-w); right: 0; height: 3px; background: transparent; z-index: 45; }
.reading-progress-bar { height: 100%; width: 0; background: var(--primary); transition: width 0.1s linear; }
@media (max-width: 900px) {
  /* Belt-and-suspenders: this now also comes after the base rule in
     source order (equal-specificity ties go to whichever is later), but
     !important is added on top so this can never silently lose that tie
     again no matter how this file gets reordered/edited later â€” this
     exact bug (base rule's left: var(--sidebar-w), 252px, winning on
     mobile and pushing the bar in from the edge) already happened once
     from a plain ordering slip. */
  .reading-progress { top: calc(var(--topbar-h) + var(--safe-top)) !important; left: 0 !important; right: 0 !important; }
}
.article-body { font-size: 1.05rem; margin: 24px 0; word-wrap: break-word; }
.article-body img { max-width: 100%; border-radius: var(--radius-sm); height: auto; }
/* The site-wide `a { text-decoration: none; color: inherit; }` reset (for
   nav/UI links) meant a link inserted via the editor rendered completely
   indistinguishable from plain text â€” same color, no underline â€” even
   though it was inserted correctly. This is the actual reason "insert
   link" looked broken: there was nothing to see, not a functional bug. */
.article-body a, .editor-area a {
  color: var(--primary-bright);
  text-decoration: underline;
  text-decoration-color: rgba(157, 123, 230, 0.45);
  text-underline-offset: 2px;
}
.article-body a:hover, .editor-area a:hover { text-decoration-color: currentColor; }
.article-body pre { background: #0a0a12; padding: 16px; border-radius: var(--radius-sm); overflow-x: auto; }
.article-body blockquote {
  border-left: 3px solid var(--gold);
  margin-left: 0; padding-left: 18px; color: var(--text-muted);
  font-family: var(--font-serif); font-style: italic; font-size: 1.2em; font-weight: 500;
}
.tags { margin: 20px 0; }
.tag { background: var(--surface-2); padding: 4px 12px; border-radius: 14px; margin-right: 8px; font-size: 0.85rem; display: inline-block; margin-bottom: 6px; }

.reactions { display: flex; gap: 8px; align-items: center; margin: 24px 0; flex-wrap: wrap; }
.reaction-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 42px; height: 42px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 21px;
  cursor: pointer; color: var(--text-muted); font-size: 0.88rem; font-weight: 600;
  transition: transform 0.12s var(--ease), border-color 0.12s var(--ease), background 0.12s var(--ease), color 0.12s var(--ease);
}
/* Icon-only (logged-out) reaction buttons stay circular, no count shown. */
.reaction-btn:not(:has(.reaction-count)) { width: 42px; padding: 0; }
.reaction-count { line-height: 1; }
.bookmark-btn {
  display: flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 22px;
  padding: 9px 16px; cursor: pointer; font-size: 0.92rem; font-weight: 600; color: var(--text-muted);
  transition: transform 0.12s var(--ease), border-color 0.12s var(--ease), background 0.12s var(--ease), color 0.12s var(--ease);
}
.reaction-btn:hover, .bookmark-btn:hover { color: var(--text); border-color: var(--surface-3); }
.reaction-btn, .bookmark-btn { text-decoration: none; } /* both render as <a> for logged-out visitors */
.reaction-btn:active, .bookmark-btn:active { transform: scale(0.92); }
.reaction-btn.active, .bookmark-btn.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.reaction-btn.reaction-dislike.active { border-color: #c9556f; background: rgba(201, 85, 111, 0.14); color: #dd7d92; }

.related-articles { margin: 40px 0; }

.comments-section { margin: 40px 0; }
#comment-form textarea {
  width: 100%; min-height: 84px; padding: 12px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border); color: var(--text); resize: vertical;
}
#comment-form textarea:focus, .article-form input:focus, .article-form textarea:focus,
.admin-form input:focus, .admin-form textarea:focus, .auth-form input:focus, .topbar-search input:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
#comment-form button { margin-top: 8px; background: var(--primary); color: #fff; border: none; padding: 9px 20px; border-radius: 20px; cursor: pointer; font-weight: 600; }
.comment { padding: 12px 0; border-bottom: 1px solid var(--border); }
.comment.reply { margin-left: 20px; }
.comment strong { color: var(--text); }

.category-header {
  border-left: 3px solid var(--gold);
  padding: 4px 0 4px 18px;
  margin: 4px 0 24px;
  position: relative;
}
.cat-header-title { display: flex; align-items: center; gap: 14px; }
.cat-header-title .icon-svg {
  color: var(--gold);
  filter: drop-shadow(0 0 8px rgba(212,175,55,0.4));
}
.cat-list-link { display: flex; align-items: center; gap: 10px; }
.icon-preview-cell { color: var(--primary); }
.featured-badge { display: inline-flex; color: #fbbf24; vertical-align: middle; }

/* ---------- Native editor ---------- */
.editor-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.editor-toolbar { display: flex; flex-wrap: wrap; gap: 4px; background: var(--surface-2); padding: 8px; border-bottom: 1px solid var(--border); }
.editor-toolbar button {
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  padding: 6px 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: 0.85rem;
  transition: background 0.12s var(--ease);
}
.editor-toolbar button:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.editor-toolbar .divider { width: 1px; background: var(--border); margin: 0 4px; }
.editor-area { min-height: 260px; padding: 18px; color: var(--text); }
.editor-area:focus { outline: none; }
.editor-area p { margin: 0 0 1em; }
.editor-area hidefornotregistered {
  background: rgba(212,175,55,0.12); outline: 1px dashed var(--gold);
  border-radius: 3px; padding: 1px 3px;
}

/* ---------- Locked sections (guest-facing placeholder) ---------- */
.locked-section {
  margin: 20px 0; padding: 26px 20px; text-align: center;
  background: var(--surface-2); border: 1px dashed var(--border); border-radius: var(--radius);
}
.locked-section-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; margin-bottom: 10px; border-radius: 50%;
  background: var(--gold-soft); color: var(--gold);
}
.locked-section p { margin: 0 0 14px; color: var(--text-muted); }
.locked-section-btn {
  display: inline-block; padding: 9px 20px; border-radius: 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; font-weight: 600; font-size: 0.9rem; text-decoration: none;
}
.locked-section-btn:hover { filter: brightness(1.1); }

/* ---------- "Who reacted" list (likes.php) ---------- */
.back-link { display: inline-block; margin-bottom: 16px; color: var(--text-muted); font-size: 0.9rem; }
.back-link:hover { color: var(--text); }
.reactions-summary { display: flex; gap: 16px; margin: 8px 0 24px; }
.reactions-summary-count {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 18px; background: var(--surface-2); border: 1px solid var(--border);
  font-size: 0.9rem; font-weight: 600;
}
.reactions-user-list { list-style: none; margin: 0 0 24px; padding: 0; }
.reactions-user-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 4px; border-bottom: 1px solid var(--border);
}
.reactions-user-list li:last-child { border-bottom: none; }
.reactions-user-time { margin-left: auto; }
.see-who-liked-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 0.85rem; margin-top: -8px; }
.see-who-liked-link:hover { color: var(--text); }

/* Link-insert dialog */
.editor-link-modal-backdrop {
  display: flex; align-items: center; justify-content: center; padding: 20px;
  position: fixed; inset: 0; z-index: 70;
  background: rgba(8,6,14,0.6); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity 0.18s var(--ease);
}
.editor-link-modal-backdrop.is-open { opacity: 1; pointer-events: auto; }
.editor-link-modal {
  width: 100%; max-width: 380px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 22px; box-shadow: var(--shadow-md);
  display: flex; flex-direction: column; gap: 10px;
}
.editor-link-modal h3 { margin: 0 0 4px; font-size: 1.05rem; }
.editor-link-modal label { font-size: 0.82rem; color: var(--text-muted); margin-bottom: -4px; }
.editor-link-modal input[type="text"] {
  width: 100%; padding: 9px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 0.9rem;
}
.editor-link-modal input[type="text"]:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.editor-link-modal .checkbox-label { display: flex; align-items: center; gap: 8px; font-weight: 400; font-size: 0.88rem; }
.editor-link-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.editor-link-modal-actions button {
  padding: 8px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); cursor: pointer; font-size: 0.88rem; font-weight: 600;
}
.editor-link-modal-actions button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.editor-link-modal-actions button:hover { filter: brightness(1.1); }

/* ---------- Forms ---------- */
.article-form, .admin-form, .auth-form { display: flex; flex-direction: column; gap: 12px; max-width: 720px; }
.article-form input, .article-form select, .article-form textarea,
.admin-form input, .admin-form select, .admin-form textarea,
.auth-form input {
  padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-family: inherit; width: 100%;
  transition: border-color 0.12s var(--ease), box-shadow 0.12s var(--ease);
}
.article-form textarea, .admin-form textarea { min-height: 90px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; }
.checkbox-label input { width: auto; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
/* Blocks further clicks visually/interactively once a submit is in
   flight â€” deliberately not `button.disabled`, see main.js for why. */
form.is-submitting .form-actions { pointer-events: none; opacity: 0.65; }
.form-actions button, .article-form button, .auth-form button, .admin-form button {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  padding: 11px 20px; border-radius: var(--radius-sm); cursor: pointer; font-weight: 600;
  transition: background 0.12s var(--ease), transform 0.1s var(--ease);
}
.form-actions button:active, .article-form button:active, .auth-form button:active { transform: scale(0.98); }
.form-actions button.primary, .article-form button.primary, .auth-form button, .admin-form button.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; border-color: var(--primary);
  box-shadow: var(--glow-primary);
}
.form-actions button.primary:hover, .article-form button.primary:hover, .auth-form button:hover, .admin-form button.primary:hover {
  filter: brightness(1.1);
}
.btn-like-link { align-self: center; color: var(--primary); font-weight: 600; }
.error { color: #f87171; background: rgba(248,113,113,0.1); padding: 10px 14px; border-radius: var(--radius-sm); }
.success { color: #4ade80; background: rgba(74,222,128,0.1); padding: 10px 14px; border-radius: var(--radius-sm); }
.muted { color: var(--text-muted); }
.muted.small { font-size: 0.85rem; }
.current-cover { max-width: 240px; border-radius: var(--radius-sm); display: block; }

.auth-form-wrap {
  max-width: 420px; margin: 40px auto; animation: fade-up 0.3s var(--ease);
  padding: 36px 32px;
  background: linear-gradient(180deg, rgba(124,77,217,0.06), rgba(255,255,255,0.015));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), var(--shadow-sm);
}
.auth-form-wrap h1 { text-align: center; }
.auth-form-wrap > p.muted { text-align: center; }
.auth-form-footer { margin-top: 20px; text-align: center; line-height: 1.6; }
.auth-form-footer a { color: var(--primary-bright); font-weight: 600; }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 8px; margin: 30px 0; flex-wrap: wrap; }
.pagination a { padding: 7px 13px; border: 1px solid var(--border); border-radius: var(--radius-sm); transition: background 0.12s var(--ease); }
.pagination a:hover { background: var(--surface-2); }
.pagination a.active { background: var(--primary); border-color: var(--primary); }

/* ---------- Footer (desktop) ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 50px; padding: 24px 0; }
.footer-inner { max-width: 980px; margin: 0 auto; }
.footer-meta { color: var(--text-faint); font-size: 0.85rem; font-family: var(--font-serif); font-style: italic; letter-spacing: 0.01em; }

/* ---------- Data tables ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-sm); }
.data-table { width: 100%; border-collapse: collapse; margin-top: 16px; min-width: 500px; }
.data-table th, .data-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.data-table th { color: var(--text-faint); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.data-table td:nth-child(1) { white-space: normal; }
.status-badge { padding: 3px 11px; border-radius: 10px; font-size: 0.72rem; text-transform: uppercase; white-space: nowrap; font-weight: 700; letter-spacing: 0.02em; }
.status-published { background: #14532d; color: #86efac; }
.status-draft { background: #3f3f46; color: #d4d4d8; }
.status-pending { background: #713f12; color: #fde68a; }
.status-hidden, .status-archived { background: #450a0a; color: #fca5a5; }
.status-visible { background: #14532d; color: #86efac; }
.status-deleted { background: #450a0a; color: #fca5a5; }

.chip-list { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: var(--surface); border: 1px solid var(--border); padding: 6px 12px; border-radius: 14px; }

.preview-banner { display: flex; align-items: center; gap: 8px; background: #713f12; color: #fde68a; padding: 12px 20px; border-radius: var(--radius-sm); margin: 20px 0; font-weight: 600; }
.profile-page { max-width: 900px; }
.profile-hero {
  display: flex; align-items: center; gap: 16px;
  margin: 4px 0 28px;
}
.profile-hero h1 { margin: 0 0 4px; }
.profile-hero .muted { margin: 0; }
.profile-hero .muted.small { margin-top: 2px; }
.profile-hero-info { min-width: 0; }
.role-badge {
  display: inline-block; margin-left: 6px; padding: 2px 9px; border-radius: 9px;
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.03em; font-weight: 700;
  background: var(--surface-2); color: var(--text-muted); vertical-align: middle;
}
.role-badge.role-admin { background: var(--gold-soft); color: var(--gold); }
.role-badge.role-author { background: var(--primary-soft); color: var(--primary-bright); }

@media (max-width: 640px) {
  .profile-hero { gap: 12px; margin-bottom: 22px; }
  .user-avatar-circle.large { width: 54px; height: 54px; font-size: 1.3rem; }
  .profile-hero h1 { font-size: 1.4rem; }

  /* "My Articles" as stacked cards instead of a table that forces
     horizontal scrolling on a phone-width screen. */
  .profile-articles-table { min-width: 0; }
  .profile-articles-table thead { display: none; }
  .profile-articles-table, .profile-articles-table tbody,
  .profile-articles-table tr, .profile-articles-table td { display: block; width: 100%; }
  .profile-articles-table tr {
    margin-bottom: 12px; padding: 12px 14px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  }
  .profile-articles-table td {
    border-bottom: none; padding: 5px 0; white-space: normal;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
  }
  .profile-articles-table td::before {
    content: attr(data-label); color: var(--text-faint); font-size: 0.72rem;
    text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; flex-shrink: 0;
  }
  .profile-articles-table td[data-label="Title"] {
    display: block; padding-bottom: 8px; margin-bottom: 4px;
    border-bottom: 1px solid var(--border); font-weight: 600;
  }
  .profile-articles-table td[data-label="Title"]::before { content: none; }
  .profile-articles-table td[data-label=""] { justify-content: flex-end; padding-top: 4px; }
  .profile-articles-table .edit-link {
    color: var(--primary-bright); font-weight: 600; font-size: 0.88rem;
  }
}

/* ============================================================
   Admin CP â€” same design tokens, own sidebar shell
   ============================================================ */
.admin-body { background: var(--bg); }
.admin-shell { display: flex; min-height: 100vh; min-height: 100dvh; flex-wrap: wrap; }

.admin-nav-toggle {
  display: none; align-items: center; gap: 8px; width: 100%; background: var(--surface); border: none;
  border-bottom: 1px solid var(--border); color: var(--text); padding: 14px 16px;
  text-align: left; font-size: 1rem; cursor: pointer; font-weight: 600;
}

.admin-sidebar {
  width: 232px; flex-shrink: 0;
  background: rgba(21, 17, 31, 0.72);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-right: 1px solid var(--border); padding: 20px 12px; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
}
.admin-logo {
  font-family: var(--font-display); display: flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 1.1rem; padding: 4px 10px 22px; color: var(--text);
}
.admin-logo .icon-svg { color: var(--gold); filter: drop-shadow(0 0 6px rgba(212,175,55,0.5)); }
.admin-sidebar nav { display: flex; flex-direction: column; flex: 1; gap: 2px; }
.admin-sidebar nav a {
  position: relative;
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: 500; transition: background 0.12s var(--ease), color 0.12s var(--ease);
}
.admin-sidebar nav a:hover { background: var(--surface-2); color: var(--text); }
.admin-sidebar nav a.active { color: var(--text); background: var(--primary-soft); font-weight: 700; }
.admin-sidebar nav a.active .icon-svg { color: var(--primary-bright); }
.admin-sidebar nav a.active::before {
  content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 5px; height: 5px; border-radius: 50%; background: var(--gold);
  box-shadow: 0 0 8px 1px rgba(212,175,55,0.8);
}
.back-to-site {
  position: relative;
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  color: var(--text-faint); font-size: 0.88rem; transition: color 0.12s var(--ease);
}
.back-to-site:hover { color: var(--text); }
.back-to-site:first-of-type {
  margin-top: 8px;
}
.back-to-site:first-of-type::before {
  content: "";
  position: absolute; top: -8px; left: 12px; right: 12px; height: 1px;
  background: linear-gradient(90deg, rgba(212,175,55,0.4), transparent 75%);
}

.admin-main { flex: 1; min-width: 0; padding: 0 28px 40px; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; padding: 22px 0; border-bottom: 1px solid var(--border); margin-bottom: 22px; flex-wrap: wrap; gap: 8px; }
.admin-topbar h1 { margin: 0; font-size: 1.4rem; }
.admin-user { color: var(--text-muted); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.admin-content { max-width: 1100px; }

.stat-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 24px; }
@media (min-width: 700px) { .stat-cards { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 960px) { .stat-cards { grid-template-columns: repeat(6, 1fr); } }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 4px;
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.stat-num { font-family: var(--font-display); font-size: 1.7rem; font-weight: 600; color: var(--gold); }

.filter-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-bar a { padding: 7px 14px; border: 1px solid var(--border); border-radius: 16px; font-size: 0.88rem; transition: background 0.12s var(--ease); }
.filter-bar a:hover { background: var(--surface-2); }
.filter-bar a.active { background: var(--primary); border-color: var(--primary); }

.row-actions form { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.row-form { display: contents; }
.row-actions button, .inline-form button, .data-table button {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: 6px 11px; border-radius: var(--radius-sm); cursor: pointer; font-size: 0.85rem;
  transition: background 0.12s var(--ease);
}
.row-actions button:hover, .data-table button:hover { background: var(--surface-3); }
.row-actions button.danger, .data-table button.danger { background: rgba(127,29,29,0.35); border-color: #7f1d1d; color: #fca5a5; }
.inline { display: inline; }
.inline-form { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.inline-form input, .inline-form select { padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); width: auto; }
.w-icon { width: 60px !important; }
.w-order { width: 70px !important; }
.w-emoji { width: 90px !important; text-align: center; }

.admin-preview { background: var(--surface); padding: 20px; border-radius: var(--radius); border: 1px solid var(--border); }

@media (max-width: 900px) {
  .admin-nav-toggle { display: flex; }
  .admin-sidebar { display: none; width: 100%; border-right: none; position: static; height: auto; }
  .admin-sidebar.open { display: flex; }
  .admin-main { width: 100%; padding: 0 16px 40px; }
}

/* ---------- Small admin helpers (users.php) ---------- */
.hint { font-size: 0.85rem; color: var(--text-muted); line-height: 1.5; margin: 0 0 14px; }
button.small, .inline-form + form button.small { padding: 5px 10px; font-size: 0.8rem; border-radius: 8px; }
