/* ============================================
   JewelryQA - 去AI化设计系统
   参考 Stack Overflow / Notion / Linear
   ============================================ */

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

:root {
    --bg: #ffffff;
    --bg-alt: #f7f7f8;
    --bg-hover: #f3f4f6;
    --text: #1a1a1a;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    --border-light: #f0f0f0;
    --accent: #1e3a5f;
    --accent-hover: #162d4a;
    --accent-light: #eff4f9;
    --success: #166534;
    --success-bg: #f0fdf4;
    --danger: #991b1b;
    --danger-bg: #fef2f2;
    --warning: #92400e;
    --warning-bg: #fffbeb;
    --radius: 4px;
    --radius-sm: 3px;
}

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ========== Header ========== */
.site-header {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    display: flex;
    align-items: center;
    height: 56px;
    gap: 24px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    flex-shrink: 0;
}
.logo:hover { text-decoration: none; }
.logo-icon { display: flex; align-items: center; color: var(--accent); }
.logo-text { letter-spacing: -0.01em; }
.main-nav {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.main-nav a {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: var(--radius);
    transition: background 0.15s, color 0.15s;
}
.main-nav a:hover {
    background: var(--bg-hover);
    color: var(--text);
    text-decoration: none;
}
.header-search {
    flex: 1;
    max-width: 480px;
}
.search-form {
    display: flex;
    position: relative;
    align-items: center;
}
.search-form .search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    display: flex;
    pointer-events: none;
}
.search-form input {
    width: 100%;
    padding: 8px 12px 8px 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    outline: none;
    background: var(--bg-alt);
    transition: border-color 0.15s, background 0.15s;
    font-family: inherit;
}
.search-form input:focus {
    border-color: var(--accent);
    background: var(--bg);
}
.search-form button {
    display: none;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.menu-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    align-items: center;
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    text-decoration: none;
    font-family: inherit;
    line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-secondary, .btn-outline {
    background: var(--bg);
    border-color: var(--border);
    color: var(--text);
}
.btn-secondary:hover, .btn-outline:hover { background: var(--bg-hover); border-color: var(--text-muted); }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #7f1d1d; }
.btn-ghost {
    background: none;
    color: var(--text-secondary);
    border: none;
    padding: 4px 8px;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

/* ========== Main Layout ========== */
.site-main { padding: 24px 0 48px; min-height: calc(100vh - 200px); }
.layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 32px;
    align-items: start;
}
.content-col { min-width: 0; }
.sidebar-col { min-width: 0; }

/* ========== Page Header ========== */
.page-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}
.page-header p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ========== Hero (首页搜索区) ========== */
.hero {
    padding: 32px 0 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}
.hero h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 6px;
}
.hero p {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}
.hero-search {
    max-width: 560px;
    position: relative;
}
.hero-search .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    display: flex;
    pointer-events: none;
}
.hero-search input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    outline: none;
    background: var(--bg);
    transition: border-color 0.15s;
    font-family: inherit;
}
.hero-search input:focus { border-color: var(--accent); }
.hero-search button { display: none; }

/* ========== Tabs ========== */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
}
.tabs a {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 10px 16px;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ========== Question List (列表式) ========== */
.question-list { border-top: 1px solid var(--border-light); }
.question-row {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.1s;
}
.question-row:hover { background: var(--bg-alt); }
.question-stats {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 60px;
    flex-shrink: 0;
    padding-top: 2px;
}
.question-stat {
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
}
.question-stat .num {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}
.question-stat.answered .num { color: var(--success); }
.question-body { flex: 1; min-width: 0; }
.question-body h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.4;
}
.question-body h3 a { color: var(--text); }
.question-body h3 a:hover { color: var(--accent); text-decoration: underline; }
.question-excerpt {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.question-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 12px;
    color: var(--text-muted);
    flex-wrap: wrap;
}
.question-meta .meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.question-meta .meta-item svg { flex-shrink: 0; }

/* ========== Topic Tags ========== */
.topic-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.topic-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: var(--bg-alt);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    border: 1px solid var(--border);
}
.topic-tag:hover {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
    text-decoration: none;
}

/* ========== Question Detail ========== */
.breadcrumb {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: var(--text-muted); }

.question-detail {
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}
.question-detail h1 {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 12px;
}
.question-detail .question-body {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
    margin-bottom: 16px;
}
.question-detail .question-body p { margin-bottom: 12px; }
.question-detail .question-body ul,
.question-detail .question-body ol { margin: 10px 0 10px 24px; }
.question-detail .question-body li { margin-bottom: 4px; }

.question-detail-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: var(--text-muted);
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.question-detail-meta .meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ========== Answers ========== */
.answers-section h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.answer-item {
    display: flex;
    gap: 16px;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-light);
}
.answer-item.best {
    background: var(--success-bg);
    margin: 0 -12px;
    padding: 20px 12px;
    border-radius: var(--radius);
    border-bottom: none;
    margin-bottom: 16px;
}
.answer-vote {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 48px;
    flex-shrink: 0;
}
.vote-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.vote-btn:hover { border-color: var(--accent); color: var(--accent); }
.vote-btn.liked { background: var(--accent); color: #fff; border-color: var(--accent); }
.vote-count {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}
.answer-body { flex: 1; min-width: 0; }
.best-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--success);
    color: #fff;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.answer-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.answer-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-light);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    flex-shrink: 0;
}
.answer-author { font-weight: 600; font-size: 14px; }
.answer-time { font-size: 12px; color: var(--text-muted); }
.answer-content {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
}
.answer-content p { margin-bottom: 10px; }
.answer-content ul, .answer-content ol { margin: 10px 0 10px 24px; }
.answer-content li { margin-bottom: 5px; }
.answer-content h2, .answer-content h3 {
    font-size: 17px;
    font-weight: 600;
    margin: 18px 0 8px;
    color: var(--text);
}
.answer-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0;
    font-size: 14px;
}
.answer-content th, .answer-content td {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
}
.answer-content th { background: var(--bg-alt); font-weight: 600; }
.answer-content blockquote {
    border-left: 3px solid var(--border);
    padding-left: 14px;
    color: var(--text-secondary);
    margin: 12px 0;
}

/* ========== Answer Form ========== */
.answer-form {
    margin-top: 24px;
    padding: 20px;
    background: var(--bg-alt);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.answer-form h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 14px;
}

/* ========== Forms ========== */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 5px;
    font-size: 14px;
    color: var(--text);
}
.form-group .hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
    font-family: inherit;
    background: var(--bg);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { border-color: var(--accent); }
.form-group textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
.form-group.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.form-group.checkbox-group label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 400;
    font-size: 13px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    margin-bottom: 0;
}
.form-group.checkbox-group label:hover { background: var(--bg-hover); }
.form-group.checkbox-group input[type="checkbox"] { margin: 0; }

/* ========== Sidebar ========== */
.sidebar-widget {
    margin-bottom: 24px;
}
.sidebar-widget h3 {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.sidebar-list { list-style: none; }
.sidebar-list li {
    padding: 6px 0;
    border-bottom: 1px solid var(--border-light);
}
.sidebar-list li:last-child { border-bottom: none; }
.sidebar-list a {
    font-size: 14px;
    color: var(--text);
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.4;
}
.sidebar-list a:hover { color: var(--accent); text-decoration: none; }
.sidebar-list .sidebar-item-title {
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.sidebar-list .meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}
.sidebar-cta {
    background: var(--accent-light);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}
.sidebar-cta p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }

/* ========== Topic Grid ========== */
.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.topic-card {
    background: var(--bg);
    padding: 20px;
    transition: background 0.15s;
}
.topic-card:hover { background: var(--bg-alt); }
.topic-card .topic-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    background: var(--accent-light);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}
.topic-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.topic-card h3 a { color: var(--text); }
.topic-card h3 a:hover { color: var(--accent); }
.topic-card .count { font-size: 13px; color: var(--text-muted); }
.topic-card .desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ========== Topic Detail ========== */
.topic-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}
.topic-header .topic-icon-lg {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    background: var(--accent-light);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.topic-header h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.topic-header p { font-size: 14px; color: var(--text-secondary); margin-bottom: 8px; }
.topic-stats {
    display: flex;
    gap: 20px;
    font-size: 13px;
    color: var(--text-muted);
}
.topic-stats span { display: flex; align-items: center; gap: 4px; }

/* ========== Pagination ========== */
.pagination {
    margin-top: 24px;
    display: flex;
    justify-content: center;
}
.pagination ul {
    list-style: none;
    display: flex;
    gap: 2px;
}
.pagination li a {
    display: block;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text);
    transition: all 0.15s;
}
.pagination li a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.pagination li.active a { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ========== Footer ========== */
.site-footer {
    background: var(--bg-alt);
    border-top: 1px solid var(--border);
    padding: 32px 0 20px;
    margin-top: 48px;
}
.footer-inner {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 32px;
    padding-bottom: 24px;
}
.footer-col h4 {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin-bottom: 12px;
}
.footer-col p { font-size: 14px; color: var(--text-secondary); line-height: 1.6; }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 6px; }
.footer-col a { font-size: 14px; color: var(--text-secondary); }
.footer-col a:hover { color: var(--accent); }
.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 16px;
    font-size: 13px;
    color: var(--text-muted);
}

/* ========== Alerts ========== */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
    border: 1px solid transparent;
}
.alert-success { background: var(--success-bg); color: var(--success); border-color: #bbf7d0; }
.alert-error { background: var(--danger-bg); color: var(--danger); border-color: #fecaca; }
.alert-info { background: var(--accent-light); color: var(--accent); border-color: #bfdbfe; }

/* ========== 404 ========== */
.error-page {
    text-align: center;
    padding: 60px 20px;
}
.error-page .error-code {
    font-size: 72px;
    font-weight: 700;
    color: var(--text-muted);
    line-height: 1;
    margin-bottom: 16px;
}
.error-page h1 { font-size: 24px; margin-bottom: 8px; }
.error-page p { color: var(--text-secondary); margin-bottom: 24px; }

/* ========== Admin ========== */
.admin-body { background: var(--bg-alt); }
.admin-header {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
}
.admin-header .logo { color: var(--text); font-size: 16px; }
.admin-header .admin-actions { display: flex; align-items: center; gap: 12px; }
.admin-header .admin-actions a { font-size: 13px; color: var(--text-secondary); display: flex; align-items: center; gap: 4px; }
.admin-header .admin-actions a:hover { color: var(--accent); }
.admin-layout { display: flex; padding-top: 52px; min-height: 100vh; }
.admin-sidebar {
    width: 200px;
    background: var(--bg);
    border-right: 1px solid var(--border);
    padding: 12px 0;
    position: fixed;
    top: 52px; bottom: 0; left: 0;
    overflow-y: auto;
}
.admin-sidebar a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    color: var(--text-secondary);
    font-size: 14px;
    border-left: 3px solid transparent;
    transition: all 0.15s;
}
.admin-sidebar a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.admin-sidebar a.active {
    background: var(--accent-light);
    color: var(--accent);
    border-left-color: var(--accent);
    font-weight: 500;
}
.admin-content {
    margin-left: 200px;
    padding: 24px;
    flex: 1;
    min-width: 0;
}
.admin-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}
.admin-card h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.stat-card .num { font-size: 28px; font-weight: 700; color: var(--text); }
.stat-card .label { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.admin-table th, .admin-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}
.admin-table th {
    background: var(--bg-alt);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.admin-table tr:hover { background: var(--bg-alt); }
.admin-table .actions { display: flex; gap: 4px; flex-wrap: wrap; }
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
}
.status-active { background: var(--success-bg); color: var(--success); }
.status-pending { background: var(--warning-bg); color: var(--warning); }
.status-inactive { background: var(--danger-bg); color: var(--danger); }

/* Login page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-alt);
}
.login-box {
    background: var(--bg);
    padding: 32px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    width: 360px;
}
.login-box h2 {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 24px;
}
.login-box .login-logo {
    text-align: center;
    margin-bottom: 16px;
    color: var(--accent);
}

/* ========== Responsive ========== */
@media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar-col { order: -1; }
    .footer-inner { grid-template-columns: 1fr 1fr; }
    .header-search { display: none; }
}
@media (max-width: 640px) {
    .main-nav {
        display: none;
        position: absolute;
        top: 56px; left: 0; right: 0;
        background: var(--bg);
        flex-direction: column;
        padding: 8px 16px;
        border-bottom: 1px solid var(--border);
        gap: 0;
    }
    .main-nav.open { display: flex; }
    .main-nav a { padding: 10px 0; border-bottom: 1px solid var(--border-light); }
    .menu-toggle { display: flex; }
    .hero h1 { font-size: 20px; }
    .hero { padding: 24px 0 20px; }
    .footer-inner { grid-template-columns: 1fr; }
    .question-stats { flex-direction: row; min-width: auto; gap: 12px; }
    .question-row { flex-direction: column; gap: 8px; }
    .admin-sidebar { width: 56px; }
    .admin-sidebar a { padding: 10px; justify-content: center; font-size: 0; }
    .admin-sidebar a svg { width: 20px; height: 20px; }
    .admin-content { margin-left: 56px; padding: 16px; }
    .container { padding: 0 16px; }
}

/* ============================================
   Community signals (added layer)
   ============================================ */

/* Announcement bar */
.announcement-bar {
    background: #1e3a5f;
    color: #ffffff;
    font-size: 12.5px;
    line-height: 32px;
}
.announcement-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
}
.announcement-icon { display: inline-flex; align-items: center; opacity: 0.9; }

/* Avatar base */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff;
    font-weight: 600;
    text-transform: uppercase;
    flex-shrink: 0;
    user-select: none;
}
.avatar-group {
    display: inline-flex;
    align-items: center;
}
.avatar-group .avatar {
    border: 2px solid #fff;
    margin-left: -8px;
}
.avatar-group .avatar:first-child { margin-left: 0; }

/* Contributor list */
.contributor-list { list-style: none; }
.contributor-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border-light);
}
.contributor-item:last-child { border-bottom: none; }
.contributor-meta { flex: 1; min-width: 0; }
.contributor-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.contributor-sub { font-size: 12px; color: var(--text-muted); }
.contributor-level {
    font-size: 10px;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Level badges */
.level-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
}
.level-badge-expert { background: var(--success-bg); color: var(--success); }
.level-badge-top { background: #eef2ff; color: #3730a3; }
.level-badge-active { background: var(--bg-alt); color: var(--text-secondary); border: 1px solid var(--border); }
.level-badge-new { background: var(--bg-alt); color: var(--text-muted); }
.level-badge-verified { background: var(--accent-light); color: var(--accent); border: 1px solid var(--accent); }

/* Status tags */
.status-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.status-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: var(--radius-sm);
    font-size: 11.5px;
    font-weight: 600;
}
.status-answered { background: var(--success-bg); color: var(--success); }
.status-open { background: var(--bg-alt); color: var(--text-secondary); border: 1px solid var(--border); }
.status-hot { background: var(--warning-bg); color: var(--warning); }

/* Edited mark */
.edited-mark {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1px 6px;
    vertical-align: middle;
    margin-left: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Question asker row on detail */
.question-author-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    padding: 10px 12px;
    background: var(--bg-alt);
    border-radius: var(--radius);
}
.question-author-meta { min-width: 0; }
.question-author-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.question-author-time {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 3px;
    margin-top: 1px;
}

/* Answer author card */
.answer-author-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}
.answer-author-info { min-width: 0; flex: 1; }
.answer-author-line {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.answer-author-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}
.answer-bio { color: var(--text-secondary); margin-right: 8px; }
.answer-stats-inline { color: var(--text-muted); }
.answer-foot { margin-top: 8px; }
.answer-time {
    font-size: 12px;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

/* Comments */
.comment-list {
    list-style: none;
    margin-top: 14px;
    border-top: 1px solid var(--border-light);
    padding-top: 4px;
}
.comment-item {
    display: flex;
    gap: 8px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border-light);
}
.comment-item:last-child { border-bottom: none; }
.comment-body { min-width: 0; flex: 1; }
.comment-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 2px;
}
.comment-author { font-size: 12.5px; font-weight: 600; color: var(--text); }
.comment-time { font-size: 11.5px; color: var(--text-muted); }
.comment-text { font-size: 13.5px; color: var(--text-secondary); line-height: 1.5; }

/* Question stats widget */
.question-stats-widget .stats-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.question-stats-widget .stats-list li {
    display: flex;
    align-items: center;
    gap: 10px;
}
.question-stats-widget .stats-num {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    min-width: 56px;
}
.question-stats-widget .stats-label {
    font-size: 12.5px;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* You might also like */
.also-like { margin-top: 40px; }
.also-like h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.also-like-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}
.also-like-card {
    display: block;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    transition: background 0.15s, border-color 0.15s;
}
.also-like-card:hover {
    background: var(--bg-alt);
    border-color: var(--text-muted);
    text-decoration: none;
}
.also-like-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.also-like-card:hover .also-like-title { color: var(--accent); }
.also-like-meta { font-size: 12px; color: var(--text-muted); }

/* Mobile tweaks for community signals */
@media (max-width: 640px) {
    .announcement-inner { white-space: normal; line-height: 1.5; padding: 6px 0; }
    .contributor-level { display: none; }
    .also-like-grid { grid-template-columns: 1fr; }
}

/* ===== Live activity & online signal ===== */
.announcement-inner { position: relative; }
.announcement-msg { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewing-count {
    position: absolute;
    right: 0;
    top: 0;
    line-height: 32px;
    font-size: 11.5px;
    opacity: 0.92;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.activity-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.activity-item { display: flex; gap: 8px; align-items: flex-start; }
.activity-item .avatar { margin-top: 1px; }
.activity-body { flex: 1; min-width: 0; }
.activity-text { font-size: 12.5px; line-height: 1.45; color: var(--text-secondary); }
.activity-actor { color: var(--text); font-weight: 600; }
.activity-title { color: var(--accent); }
.activity-time { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

.new-badge {
    display: inline-flex;
    align-items: center;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    color: var(--success);
    background: var(--success-bg);
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-sm);
    padding: 1px 6px;
    margin-left: 6px;
    vertical-align: middle;
}
.new-badge-red { color: var(--danger); background: var(--danger-bg); border-color: #fecaca; }
.new-badge-inline { margin-left: 8px; font-size: 11px; text-transform: none; letter-spacing: 0; vertical-align: middle; }

.recent-answer-hint { color: var(--warning); font-weight: 600; }

@media (max-width: 640px) {
    .viewing-count { position: static; line-height: inherit; margin-left: auto; }
}

