/* ===== MAJESTIC LEGAL WIKI — MAIN STYLES (LIGHT THEME) ===== */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=DM+Sans:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* === CSS VARIABLES === */
:root {
    --bg-base: #f8f9fb;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f3f4f6;
    --bg-elevated: #e5e7eb;
    --bg-input: #f9fafb;

    --border: rgba(0,0,0,0.08);
    --border-strong: rgba(0,0,0,0.16);
    --border-accent: rgba(99,102,241,0.5);

    --text-primary: #111827;
    --text-secondary: #374151;
    --text-muted: #6b7280;
    --text-accent: #4f46e5;

    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-dim: rgba(99,102,241,0.1);
    --accent-glow: rgba(99,102,241,0.2);

    --gold: #d97706;
    --gold-dim: rgba(217,119,6,0.1);
    --red: #dc2626;
    --red-dim: rgba(220,38,38,0.1);
    --green: #059669;
    --green-dim: rgba(5,150,105,0.1);
    --blue: #2563eb;
    --blue-dim: rgba(37,99,235,0.1);
    --purple: #7c3aed;

    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'DM Sans', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
    --shadow-lg: 0 4px 24px rgba(0,0,0,0.08);
    --shadow-accent: 0 0 0 3px rgba(99,102,241,0.15);

    --transition: 0.2s ease;
    --transition-slow: 0.4s cubic-bezier(0.4,0,0.2,1);
}

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-body);
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    font-size: 15px;
    line-height: 1.6;
}
a { color: var(--text-accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* === BACKGROUND EFFECTS === */
.bg-grid {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background-image:
        linear-gradient(rgba(0,0,0,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,0.02) 1px, transparent 1px);
    background-size: 48px 48px;
}
.bg-noise { display: none; }

/* === TOPBAR === */
.topbar {
    position: sticky; top: 0; z-index: 100;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    height: 64px;
}
.topbar-inner {
    max-width: 1400px; margin: 0 auto; padding: 0 24px;
    height: 100%; display: flex; align-items: center; gap: 16px;
}
.logo {
    display: flex; align-items: center; gap: 12px;
    text-decoration: none; flex-shrink: 0;
}
.logo-icon {
    width: 36px; height: 36px;
    background: var(--accent-dim); border: 1px solid var(--border-accent);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: var(--accent); font-size: 16px;
}
.logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.logo-main { font-family: var(--font-display); font-size: 15px; color: var(--text-primary); }
.logo-sub { font-size: 10px; color: var(--text-muted); letter-spacing: 1px; text-transform: uppercase; }
.topbar-search { flex: 1; max-width: 480px; }
.search-wrap {
    position: relative; display: flex; align-items: center;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.search-wrap:focus-within { border-color: var(--border-accent); box-shadow: var(--shadow-accent); }
.search-wrap i { position: absolute; left: 14px; color: var(--text-muted); font-size: 13px; }
.search-wrap input {
    flex: 1; padding: 10px 14px 10px 38px; background: transparent;
    border: none; outline: none; color: var(--text-primary); font-size: 14px;
}
.search-wrap input::placeholder { color: var(--text-muted); }
.search-wrap kbd {
    margin-right: 10px; padding: 2px 6px; background: var(--bg-elevated);
    border: 1px solid var(--border); border-radius: 4px;
    font-family: var(--font-mono); font-size: 11px; color: var(--text-muted);
}
.topbar-nav { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.nav-link {
    padding: 8px 14px; border-radius: var(--radius-sm);
    color: var(--text-secondary); font-size: 14px; font-weight: 500;
    transition: all var(--transition); display: flex; align-items: center; gap: 6px;
}
.nav-link:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.nav-link.ai-link { color: var(--accent); }
.nav-link.ai-link:hover { background: var(--accent-dim); }
.btn-outline-sm {
    padding: 7px 16px; border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong); color: var(--text-secondary);
    font-size: 14px; font-weight: 500; transition: all var(--transition);
    background: transparent;
}
.btn-outline-sm:hover { border-color: var(--border-accent); color: var(--text-primary); }
.btn-primary-sm {
    padding: 7px 16px; border-radius: var(--radius-sm);
    background: var(--accent); color: white;
    font-size: 14px; font-weight: 500; transition: all var(--transition);
    border: none;
}
.btn-primary-sm:hover { background: var(--accent-hover); box-shadow: var(--shadow); color: white; }

/* User Menu */
.user-menu-wrap { position: relative; }
.user-btn {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 12px 6px 6px; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: 40px;
    color: var(--text-primary); transition: all var(--transition);
}
.user-btn:hover { border-color: var(--border-accent); }
.user-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--accent-dim); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 13px; overflow: hidden; flex-shrink: 0;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-info { display: flex; flex-direction: column; line-height: 1.2; }
.user-name { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.user-role { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.role-owner { color: var(--gold); }
.role-admin { color: var(--accent); }
.role-user { color: var(--text-muted); }
.user-btn .fa-chevron-down { font-size: 11px; color: var(--text-muted); transition: transform var(--transition); }
.user-btn.open .fa-chevron-down { transform: rotate(180deg); }
.user-dropdown {
    position: absolute; top: calc(100% + 8px); right: 0; min-width: 200px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    overflow: hidden; opacity: 0; visibility: hidden;
    transform: translateY(-8px); transition: all var(--transition);
    z-index: 200;
}
.user-dropdown.open { opacity: 1; visibility: visible; transform: translateY(0); }
.user-dropdown a {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 16px; color: var(--text-secondary); font-size: 14px;
    transition: all var(--transition);
}
.user-dropdown a:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.user-dropdown a.danger:hover { background: var(--red-dim); color: var(--red); }
.user-dropdown a i { width: 16px; opacity: 0.7; }
.dropdown-sep { height: 1px; background: var(--border); margin: 4px 0; }

/* Mobile */
.mobile-menu-btn {
    display: none; flex-direction: column; gap: 5px;
    background: none; border: none; padding: 6px;
}
.mobile-menu-btn span {
    display: block; width: 22px; height: 2px;
    background: var(--text-secondary); border-radius: 2px; transition: all var(--transition);
}
.mobile-nav {
    display: none; position: fixed; top: 64px; left: 0; right: 0; z-index: 99;
    background: var(--bg-surface); border-bottom: 1px solid var(--border);
    flex-direction: column;
}
.mobile-nav.open { display: flex; }
.mobile-nav a {
    padding: 14px 24px; color: var(--text-secondary); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px; font-size: 15px;
}
.mobile-nav a:hover { background: var(--bg-card-hover); color: var(--text-primary); }

/* === MAIN WRAP === */
.main-wrap { position: relative; z-index: 1; }

/* === HERO === */
.hero {
    padding: 80px 24px 64px;
    text-align: center;
    background: linear-gradient(180deg, rgba(99,102,241,0.04) 0%, transparent 100%);
}
.hero-badge {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 14px; background: var(--accent-dim);
    border: 1px solid var(--border-accent); border-radius: 40px;
    color: var(--accent); font-size: 12px; font-weight: 500;
    letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 24px;
}
.hero h1 {
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 5vw, 4rem);
    font-weight: 700; line-height: 1.15;
    margin-bottom: 20px;
    color: var(--text-primary);
}
.hero p {
    font-size: 17px; color: var(--text-secondary); max-width: 520px;
    margin: 0 auto 36px;
}
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn-primary {
    padding: 12px 28px; background: var(--accent); color: white;
    border: none; border-radius: var(--radius); font-size: 15px; font-weight: 500;
    transition: all var(--transition); display: inline-flex; align-items: center; gap: 8px;
}
.btn-primary:hover { background: var(--accent-hover); color: white; box-shadow: var(--shadow); transform: translateY(-1px); }
.btn-secondary {
    padding: 12px 28px; background: var(--bg-card); color: var(--text-secondary);
    border: 1px solid var(--border); border-radius: var(--radius); font-size: 15px; font-weight: 500;
    transition: all var(--transition); display: inline-flex; align-items: center; gap: 8px;
}
.btn-secondary:hover { background: var(--bg-card-hover); color: var(--text-primary); border-color: var(--border-strong); }

/* Stats bar */
.stats-bar {
    display: flex; gap: 0; justify-content: center;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); overflow: hidden; max-width: 600px; margin: 40px auto 0;
}
.stat-item {
    flex: 1; padding: 20px 24px; text-align: center;
    border-right: 1px solid var(--border);
}
.stat-item:last-child { border-right: none; }
.stat-num {
    font-family: var(--font-display); font-size: 1.8rem; font-weight: 600;
    color: var(--text-primary);
}
.stat-lbl { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* === SECTIONS === */
.section { padding: 60px 24px; max-width: 1400px; margin: 0 auto; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 32px; }
.section-title {
    font-family: var(--font-display); font-size: 1.6rem;
    display: flex; align-items: center; gap: 12px;
    color: var(--text-primary);
}
.section-title::before {
    content: ''; display: block; width: 4px; height: 28px;
    background: var(--accent); border-radius: 2px;
}
.section-link { font-size: 13px; color: var(--text-accent); display: flex; align-items: center; gap: 6px; }
.section-link:hover { color: var(--accent-hover); }

/* === CATEGORY CARDS === */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.cat-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 24px;
    transition: all var(--transition-slow); cursor: pointer;
    text-decoration: none; color: inherit; display: block;
    position: relative; overflow: hidden;
}
.cat-card:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow); }
.cat-icon {
    width: 44px; height: 44px; border-radius: var(--radius-sm);
    background: var(--accent-dim);
    color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; margin-bottom: 16px;
}
.cat-name { font-weight: 600; font-size: 15px; color: var(--text-primary); margin-bottom: 6px; }
.cat-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.cat-count { margin-top: 16px; font-size: 12px; color: var(--text-muted); }
.cat-count span { color: var(--accent); font-weight: 600; }

/* === ARTICLE CARDS === */
.article-list { display: flex; flex-direction: column; gap: 12px; }
.article-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px 24px;
    transition: all var(--transition); display: flex; align-items: flex-start; gap: 16px;
    text-decoration: none; color: inherit;
}
.article-card:hover { background: var(--bg-card-hover); border-color: var(--border-strong); }
.article-num {
    font-family: var(--font-mono); font-size: 11px; color: var(--accent);
    background: var(--accent-dim); border: 1px solid var(--border-accent);
    padding: 3px 8px; border-radius: 4px; white-space: nowrap; flex-shrink: 0; margin-top: 2px;
}
.article-body { flex: 1; min-width: 0; }
.article-title { font-weight: 600; font-size: 15px; color: var(--text-primary); margin-bottom: 4px; }
.article-excerpt { font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.article-meta { display: flex; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.article-tag {
    font-size: 11px; padding: 2px 8px; border-radius: 4px;
    background: var(--bg-elevated); color: var(--text-muted);
    display: flex; align-items: center; gap: 4px;
}
.tag-video { background: rgba(236,72,153,0.1); color: #be185d; }
.tag-person { background: rgba(5,150,105,0.1); color: #047857; }

/* === ARTICLE VIEW === */
.article-view { max-width: 860px; margin: 0 auto; padding: 40px 24px 80px; }
.article-view-header { margin-bottom: 40px; }
.breadcrumb {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--text-muted); margin-bottom: 20px; flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--text-accent); }
.breadcrumb-sep { color: var(--text-muted); opacity: 0.4; }
.article-view-num {
    font-family: var(--font-mono); font-size: 12px; color: var(--accent);
    background: var(--accent-dim); border: 1px solid var(--border-accent);
    padding: 4px 12px; border-radius: 6px; display: inline-block; margin-bottom: 14px;
}
.article-view-title {
    font-family: var(--font-display); font-size: clamp(1.5rem, 3vw, 2.2rem);
    font-weight: 700; line-height: 1.25; margin-bottom: 16px;
    color: var(--text-primary);
}
.article-view-meta {
    display: flex; gap: 20px; flex-wrap: wrap; padding-bottom: 24px;
    border-bottom: 1px solid var(--border); margin-bottom: 32px;
}
.meta-item { font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.meta-item i { color: var(--accent); opacity: 0.7; }
.article-content { font-size: 16px; line-height: 1.8; color: var(--text-secondary); }
.article-content h2, .article-content h3 { font-family: var(--font-display); color: var(--text-primary); margin: 28px 0 12px; }
.article-content p { margin-bottom: 16px; }
.article-content blockquote {
    border-left: 3px solid var(--accent); padding: 12px 20px;
    background: var(--accent-dim); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin: 20px 0; color: var(--text-secondary);
}
.article-content code { font-family: var(--font-mono); font-size: 13px; background: var(--bg-elevated); padding: 2px 6px; border-radius: 4px; color: var(--accent); }
.video-embed { margin: 24px 0; border-radius: var(--radius); overflow: hidden; background: var(--bg-elevated); }
.person-badge {
    display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px;
    background: var(--green-dim); border: 1px solid rgba(5,150,105,0.3);
    border-radius: 40px; color: var(--green); font-size: 13px; margin-bottom: 20px;
}

/* === FORMS === */
.auth-wrap {
    min-height: calc(100vh - 128px); display: flex; align-items: center; justify-content: center;
    padding: 40px 24px;
}
.auth-card {
    width: 100%; max-width: 420px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-xl); padding: 40px;
}
.auth-card h2 { font-family: var(--font-display); font-size: 1.8rem; margin-bottom: 8px; color: var(--text-primary); }
.auth-card .auth-sub { color: var(--text-muted); margin-bottom: 32px; font-size: 14px; }
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block; font-size: 13px; font-weight: 500;
    color: var(--text-secondary); margin-bottom: 8px;
}
.form-input {
    width: 100%; padding: 11px 14px;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-primary);
    font-size: 14px; transition: all var(--transition); outline: none;
}
.form-input:focus { border-color: var(--border-accent); box-shadow: var(--shadow-accent); }
.form-input::placeholder { color: var(--text-muted); }
textarea.form-input { resize: vertical; min-height: 100px; }
.form-select {
    width: 100%; padding: 11px 14px;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-primary);
    font-size: 14px; outline: none; cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center;
}
.form-select:focus { border-color: var(--border-accent); box-shadow: var(--shadow-accent); }
.btn-form {
    width: 100%; padding: 13px; background: var(--accent); color: white;
    border: none; border-radius: var(--radius-sm); font-size: 15px; font-weight: 600;
    transition: all var(--transition);
}
.btn-form:hover { background: var(--accent-hover); }
.form-alt { margin-top: 20px; text-align: center; font-size: 13px; color: var(--text-muted); }
.form-alt a { color: var(--text-accent); }
.alert {
    padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px;
    margin-bottom: 20px; display: flex; align-items: center; gap: 8px;
}
.alert-error { background: var(--red-dim); border: 1px solid rgba(220,38,38,0.3); color: #b91c1c; }
.alert-success { background: var(--green-dim); border: 1px solid rgba(5,150,105,0.3); color: #047857; }
.alert-info { background: var(--blue-dim); border: 1px solid rgba(37,99,235,0.3); color: #1d4ed8; }

/* === AI CHAT === */
.ai-chat-wrap { max-width: 920px; margin: 0 auto; padding: 32px 24px 80px; }
.ai-header { margin-bottom: 32px; }
.ai-header h1 { font-family: var(--font-display); font-size: 2rem; margin-bottom: 8px; color: var(--text-primary); }
.ai-header p { color: var(--text-muted); font-size: 14px; }
.ai-chat-container {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-xl); overflow: hidden; display: flex; flex-direction: column;
    height: 600px;
}
.ai-messages { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.ai-messages::-webkit-scrollbar { width: 4px; }
.ai-messages::-webkit-scrollbar-track { background: transparent; }
.ai-messages::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }
.msg { display: flex; gap: 12px; max-width: 85%; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar {
    width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.msg.user .msg-avatar { background: var(--accent-dim); color: var(--accent); }
.msg.ai .msg-avatar { background: var(--gold-dim); color: var(--gold); }
.msg-bubble {
    padding: 12px 16px; border-radius: var(--radius);
    font-size: 14px; line-height: 1.6;
}
.msg.user .msg-bubble { background: var(--accent); color: white; border-radius: var(--radius) var(--radius) 4px var(--radius); }
.msg.ai .msg-bubble { background: var(--bg-card-hover); border: 1px solid var(--border); border-radius: var(--radius) var(--radius) var(--radius) 4px; color: var(--text-primary); }
.msg.ai .msg-bubble h4 { font-size: 13px; color: var(--gold); margin-bottom: 6px; font-weight: 600; }
.msg.ai .msg-bubble .ai-source { font-size: 12px; color: var(--text-muted); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.ai-input-area {
    padding: 16px 20px; border-top: 1px solid var(--border);
    display: flex; gap: 12px; align-items: flex-end;
}
.ai-input-area textarea {
    flex: 1; padding: 11px 14px; background: var(--bg-input);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text-primary); font-size: 14px; resize: none; outline: none;
    transition: border-color var(--transition); max-height: 120px;
}
.ai-input-area textarea:focus { border-color: var(--border-accent); }
.ai-send-btn {
    width: 44px; height: 44px; background: var(--accent); color: white;
    border: none; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center; font-size: 15px;
    transition: all var(--transition); flex-shrink: 0;
}
.ai-send-btn:hover { background: var(--accent-hover); }
.ai-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ai-typing { display: flex; gap: 4px; align-items: center; padding: 8px 0; }
.ai-typing span {
    width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted);
    animation: typing 1.2s infinite;
}
.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%,80%,100% { transform: scale(1); opacity: 0.5; } 40% { transform: scale(1.3); opacity: 1; } }

/* === ADMIN PANEL === */
.admin-wrap { display: flex; min-height: calc(100vh - 64px); }
.admin-sidebar {
    width: 260px; flex-shrink: 0; background: var(--bg-surface);
    border-right: 1px solid var(--border); padding: 24px 16px;
    position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto;
}
.admin-sidebar h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); padding: 0 8px; margin-bottom: 8px; }
.admin-nav-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px;
    border-radius: var(--radius-sm); color: var(--text-secondary); font-size: 14px;
    transition: all var(--transition); cursor: pointer; margin-bottom: 2px;
    background: none; border: none; width: 100%; text-align: left;
}
.admin-nav-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.admin-nav-item.active { background: var(--accent-dim); color: var(--accent); }
.admin-nav-item i { width: 18px; text-align: center; font-size: 13px; }
.admin-content { flex: 1; padding: 32px; overflow-y: auto; }
.admin-section { display: none; }
.admin-section.active { display: block; }
.admin-section-title { font-family: var(--font-display); font-size: 1.4rem; margin-bottom: 24px; display: flex; align-items: center; gap: 10px; color: var(--text-primary); }
.data-table-wrap { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 12px 16px; text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); background: var(--bg-card-hover); border-bottom: 1px solid var(--border); }
.data-table td { padding: 14px 16px; font-size: 14px; border-bottom: 1px solid var(--border); color: var(--text-primary); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-card-hover); }
.badge { padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 500; }
.badge-owner { background: var(--gold-dim); color: var(--gold); }
.badge-admin { background: var(--accent-dim); color: var(--accent); }
.badge-user { background: var(--bg-elevated); color: var(--text-muted); }
.badge-approved { background: var(--green-dim); color: var(--green); }
.badge-pending { background: var(--gold-dim); color: var(--gold); }
.badge-rejected { background: var(--red-dim); color: var(--red); }
.action-btn {
    padding: 5px 12px; font-size: 12px; border-radius: 6px; cursor: pointer;
    border: 1px solid var(--border); background: var(--bg-elevated);
    color: var(--text-secondary); transition: all var(--transition); margin-right: 4px;
}
.action-btn:hover { border-color: var(--border-accent); color: var(--text-primary); }
.action-btn.danger:hover { background: var(--red-dim); border-color: rgba(220,38,38,0.4); color: var(--red); }
.action-btn.success:hover { background: var(--green-dim); border-color: rgba(5,150,105,0.4); color: var(--green); }

/* === DASHBOARD === */
.dashboard-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 24px; max-width: 1200px; margin: 0 auto; padding: 40px 24px 80px; }
.profile-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-xl);
    padding: 32px; text-align: center; height: fit-content;
    position: sticky; top: 88px;
}
.profile-avatar-lg {
    width: 80px; height: 80px; border-radius: 50%; margin: 0 auto 16px;
    background: var(--accent-dim); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; font-weight: 700; overflow: hidden;
}
.profile-avatar-lg img { width: 100%; height: 100%; object-fit: cover; }
.profile-username { font-family: var(--font-display); font-size: 1.4rem; margin-bottom: 4px; color: var(--text-primary); }
.profile-position { font-size: 13px; color: var(--text-muted); }
.profile-role-badge { margin: 12px auto; }
.profile-stats { display: flex; gap: 0; margin-top: 20px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.pstat { flex: 1; padding: 12px 8px; text-align: center; border-right: 1px solid var(--border); }
.pstat:last-child { border-right: none; }
.pstat-num { font-weight: 700; font-size: 1.2rem; color: var(--text-primary); }
.pstat-lbl { font-size: 11px; color: var(--text-muted); }
.dashboard-main h2 { font-family: var(--font-display); font-size: 1.3rem; margin-bottom: 16px; color: var(--text-primary); }

/* === SEARCH PAGE === */
.search-page { max-width: 900px; margin: 0 auto; padding: 40px 24px 80px; }
.search-page h1 { font-family: var(--font-display); font-size: 1.8rem; margin-bottom: 8px; color: var(--text-primary); }
.search-results-info { color: var(--text-muted); font-size: 14px; margin-bottom: 28px; }
.search-big {
    display: flex; gap: 0; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 32px;
}
.search-big input {
    flex: 1; padding: 16px 20px; background: transparent; border: none; outline: none;
    color: var(--text-primary); font-size: 16px;
}
.search-big button {
    padding: 0 24px; background: var(--accent); color: white; border: none;
    font-size: 14px; font-weight: 500; cursor: pointer; transition: background var(--transition);
}
.search-big button:hover { background: var(--accent-hover); }

/* === EMPTY STATE === */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 3rem; opacity: 0.3; margin-bottom: 16px; }
.empty-state h3 { font-family: var(--font-display); font-size: 1.2rem; color: var(--text-secondary); margin-bottom: 8px; }

/* === MODAL === */
.modal-overlay {
    position: fixed; inset: 0; z-index: 500;
    background: rgba(0,0,0,0.4); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center; padding: 20px;
    opacity: 0; visibility: hidden; transition: all var(--transition);
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-xl); width: 100%; max-width: 560px;
    max-height: 90vh; overflow-y: auto; padding: 32px;
    transform: scale(0.95); transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.modal-header h3 { font-family: var(--font-display); font-size: 1.3rem; color: var(--text-primary); }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; transition: color var(--transition); }
.modal-close:hover { color: var(--text-primary); }

/* === PAGINATION === */
.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 32px; }
.page-btn {
    width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: 14px; color: var(--text-secondary);
    transition: all var(--transition); cursor: pointer; text-decoration: none;
}
.page-btn:hover { border-color: var(--border-accent); color: var(--text-primary); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: white; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* === FOOTER === */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-surface); margin-top: 60px; }
.footer-inner { max-width: 1400px; margin: 0 auto; padding: 48px 24px 32px; display: flex; gap: 48px; flex-wrap: wrap; }
.footer-brand { flex: 1; min-width: 200px; }
.footer-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-family: var(--font-display); font-size: 1.1rem; color: var(--text-primary); }
.footer-logo i { color: var(--accent); }
.footer-brand p { font-size: 13px; color: var(--text-muted); line-height: 1.6; max-width: 280px; }
.footer-links { display: flex; gap: 48px; flex-wrap: wrap; }
.footer-col h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 14px; }
.footer-col a { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 8px; transition: color var(--transition); }
.footer-col a:hover { color: var(--text-accent); }
.footer-bottom { max-width: 1400px; margin: 0 auto; padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-muted); }

/* === TOPIC PAGE === */
.topic-header {
    padding: 48px 24px; max-width: 1400px; margin: 0 auto;
    display: flex; align-items: flex-start; gap: 24px;
}
.topic-icon-lg {
    width: 64px; height: 64px; border-radius: var(--radius);
    background: var(--accent-dim); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; flex-shrink: 0;
}
.topic-info h1 { font-family: var(--font-display); font-size: 2rem; margin-bottom: 8px; color: var(--text-primary); }
.topic-info p { color: var(--text-muted); font-size: 15px; }
.topic-body { max-width: 1400px; margin: 0 auto; padding: 0 24px 80px; display: grid; grid-template-columns: 260px 1fr; gap: 32px; }
.topic-toc { position: sticky; top: 88px; height: fit-content; }
.toc-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.toc-card h3 { padding: 16px 20px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); color: var(--text-muted); }
.toc-link {
    display: flex; align-items: center; gap: 10px; padding: 11px 20px;
    font-size: 13px; color: var(--text-secondary); border-bottom: 1px solid var(--border);
    transition: all var(--transition);
}
.toc-link:last-child { border-bottom: none; }
.toc-link:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.toc-link .toc-num { font-family: var(--font-mono); font-size: 11px; color: var(--accent); }

/* === LOADING === */
.loading-spinner {
    width: 32px; height: 32px; border: 3px solid var(--border);
    border-top-color: var(--accent); border-radius: 50%;
    animation: spin 0.8s linear infinite; margin: 20px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .topbar-search, .topbar-nav { display: none; }
    .mobile-menu-btn { display: flex; }
    .hero h1 { font-size: 2rem; }
    .stats-bar { flex-direction: column; }
    .stat-item { border-right: none; border-bottom: 1px solid var(--border); }
    .topic-body { grid-template-columns: 1fr; }
    .topic-toc { position: static; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .admin-wrap { flex-direction: column; }
    .admin-sidebar { width: 100%; height: auto; position: static; }
    .footer-inner { flex-direction: column; gap: 24px; }
}