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

html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
    font-family: var(--font-sans);
    color: var(--fg);
    background: var(--bg);
    line-height: 1.6;
    min-height: 100vh;
}

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

img { max-width: 100%; }

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

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 18px; border: 1px solid transparent; border-radius: var(--radius-md);
    font-size: 14px; font-weight: 500; font-family: inherit; cursor: pointer;
    transition: all var(--transition-fast); text-align: center; justify-content: center;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); box-shadow: var(--shadow-glow); }
.btn-outline { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-outline:hover { background: var(--accent-soft); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .9; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { opacity: .9; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: .9; }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Forms ── */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--fg); margin-bottom: 6px; }
.form-group small { display: block; font-size: 12px; color: var(--fg-muted); margin-top: 4px; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
textarea, .search-input {
    width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-md);
    font-size: 14px; font-family: inherit; color: var(--fg); background: var(--bg-card);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
}
input:focus, textarea:focus, .search-input:focus {
    border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}

.required { color: var(--danger); }

.toggle-label { display: flex !important; align-items: center; gap: 8px; font-weight: 400 !important; cursor: pointer; }
.toggle-label input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

/* ── Alerts ── */
.alert { padding: 12px 16px; border-radius: var(--radius-md); margin-bottom: 16px; font-size: 14px; font-weight: 500; }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-success { background: var(--success-soft); color: var(--success); }

/* ── Site Header ── */
.site-header {
    background: rgba(255,255,255,.85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.header-brand { display: flex; align-items: center; gap: 12px; }
.brand-link { display: flex; align-items: center; gap: 8px; color: var(--fg); text-decoration: none; }
.brand-logo { font-size: 24px; color: var(--accent); }
.brand-name-zh { font-family: var(--font-serif); font-size: 20px; font-weight: 700; }
.brand-name-en { font-size: 14px; font-weight: 300; color: var(--fg-muted); margin-left: 4px; }
.brand-version { font-size: 12px; color: var(--fg-muted); background: var(--accent-soft); padding: 2px 8px; border-radius: var(--radius-full); }
.header-nav { display: flex; align-items: center; gap: 16px; }
.nav-link { font-size: 14px; font-weight: 500; color: var(--fg); transition: color var(--transition-fast); }
.nav-link:hover { color: var(--accent); }
.nav-link-accent { color: var(--accent); }
.nav-user { font-size: 14px; color: var(--fg-muted); }
.nav-form { display: inline; }
.nav-btn { background: none; border: none; font-size: 14px; color: var(--fg-muted); cursor: pointer; font-family: inherit; padding: 4px 8px; border-radius: var(--radius-sm); }
.nav-btn:hover { color: var(--accent); background: var(--accent-soft); }

/* ── Site Footer ── */
.site-footer { background: var(--bg-card); border-top: 1px solid var(--border); margin-top: 60px; padding: 48px 0 24px; }
.footer-top { display: flex; justify-content: space-between; gap: 48px; }
.footer-brand .brand-logo { font-size: 20px; }
.footer-brand .brand-name-zh { font-size: 18px; }
.brand-slogan { font-size: 13px; color: var(--fg-muted); margin-top: 6px; }
.footer-links { display: flex; gap: 48px; }
.footer-col { display: flex; flex-direction: column; gap: 8px; }
.footer-col h4 { font-size: 13px; font-weight: 600; color: var(--fg); }
.footer-col a, .footer-col span { font-size: 13px; color: var(--fg-muted); }
.footer-col a:hover { color: var(--accent); }
.footer-divider { height: 1px; background: var(--border); margin: 24px 0 16px; }
.footer-copyright { font-size: 12px; color: var(--fg-muted); text-align: center; }

/* ── Auth Pages ── */
.auth-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #f0f1ff 0%, #faf8ff 50%, #f5f0ff 100%);
    padding: 24px;
}
.auth-card {
    background: var(--bg-card); border-radius: var(--radius-lg); padding: 40px;
    width: 100%; max-width: 420px; box-shadow: var(--shadow-lg);
}
.auth-brand { text-align: center; margin-bottom: 32px; }
.brand-logo-lg { font-size: 40px; color: var(--accent); display: block; margin-bottom: 12px; }
.auth-brand h1 { font-family: var(--font-serif); font-size: 22px; font-weight: 700; }
.auth-subtitle { font-size: 14px; color: var(--fg-muted); margin-top: 6px; }
.auth-form { display: flex; flex-direction: column; gap: 0; }
.auth-form .form-group input { margin-top: 0; }
.login-prompt {
    text-align: center; padding: 12px; background: var(--accent-soft);
    border-radius: var(--radius-md); margin-bottom: 20px; font-size: 14px; color: var(--accent);
}
.auth-footer { text-align: center; margin-top: 24px; }
.auth-footer p { font-size: 14px; color: var(--fg-muted); }
.auth-footer a { color: var(--accent); }
.auth-skip { display: block; margin-top: 12px; font-size: 13px; color: var(--fg-muted); }

/* ── Page Content ── */
.page-content { padding: 32px 0; }
.page-title-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.page-title-bar h1 { font-family: var(--font-serif); font-size: 24px; }

/* ── Doc Grid ── */
.doc-grid { display: grid; gap: 16px; }
.doc-card {
    background: var(--bg-card); border-radius: var(--radius-md); padding: 20px;
    border: 1px solid var(--border); transition: box-shadow var(--transition-fast);
    display: flex; justify-content: space-between; align-items: flex-start;
}
.doc-card:hover { box-shadow: var(--shadow-md); }
.doc-card-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.doc-card-title a { color: var(--fg); }
.doc-card-title a:hover { color: var(--accent); }
.doc-card-excerpt { font-size: 13px; color: var(--fg-muted); margin-bottom: 8px; line-height: 1.5; }
.doc-card-meta { font-size: 12px; color: var(--fg-muted); }
.doc-card-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; margin-left: 16px; }

.empty-state { text-align: center; padding: 60px 0; }
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state p { color: var(--fg-muted); margin-bottom: 20px; }

/* ── Search ── */
.search-form { display: flex; gap: 8px; }
.search-input { max-width: 320px; }

/* ── Badges ── */
.badge { display: inline-block; padding: 2px 10px; border-radius: var(--radius-full); font-size: 12px; font-weight: 600; }
.badge-default { background: var(--accent-soft); color: var(--accent); }
.badge-accent { background: var(--accent); color: #fff; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

.text-muted { color: var(--fg-muted); font-size: 13px; }

/* ── Toast ── */
.toast-container { position: fixed; bottom: 48px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
    padding: 12px 20px; border-radius: var(--radius-md); font-size: 14px; font-weight: 500;
    box-shadow: var(--shadow-lg); animation: slideIn .3s ease; min-width: 200px;
}
.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }
.toast-info { background: var(--accent); color: #fff; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
