/* ============================================================
   API Hub · 浅色主题样式表
   ============================================================ */

:root {
    --bg: #f6f8fc;
    --surface: #ffffff;
    --surface-2: #f9fafc;
    --text: #1c2434;
    --text-soft: #3f4a5f;
    --muted: #6f7b90;
    --border: #e5e9f0;
    --border-strong: #d7dde8;
    --primary: #5b5bd6;
    --primary-dark: #4848bd;
    --primary-soft: #eef0ff;
    --violet: #8b5cf6;
    --cyan: #0ea5c6;
    --amber: #f59e0b;
    --green: #10b981;
    --red: #ef4444;
    --shadow: 0 10px 34px rgba(28, 36, 52, 0.06);
    --shadow-sm: 0 3px 12px rgba(28, 36, 52, 0.05);
    --radius: 16px;
    --radius-sm: 10px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; }
p { margin: 0; }
code, pre, .mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.container { width: min(1200px, calc(100% - 48px)); margin: 0 auto; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.site-main { flex: 1; }

/* ---------------- 按钮 ---------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 1px solid transparent; border-radius: 10px; padding: 10px 18px;
    font-weight: 600; font-size: 14px; line-height: 1.2; white-space: nowrap;
    transition: transform .15s ease, background .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 5px 16px rgba(91, 91, 214, .22); }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 7px 20px rgba(91, 91, 214, .3); }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text-soft); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-light { background: #fff; color: var(--primary-dark); }
.btn-light:hover { background: #f4f4ff; }
.text-link { color: var(--muted); font-size: 13px; }
.text-link:hover { color: var(--primary); }
.link-danger { background: none; border: 0; color: var(--red); padding: 0; font-size: 13px; }
.link-danger:hover { text-decoration: underline; }

/* ---------------- 页头 ---------------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 26px; height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-mark {
    display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: #fff; font-weight: 800; font-size: 18px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, .3);
}
.brand-mark.small { width: 30px; height: 30px; font-size: 15px; border-radius: 8px; }
.brand-mark.large { width: 48px; height: 48px; font-size: 24px; border-radius: 14px; }
.brand-text { font-size: 18px; font-weight: 800; letter-spacing: -.3px; }
.main-nav { display: flex; align-items: center; gap: 22px; flex-shrink: 0; }
.main-nav a { font-size: 14px; color: var(--muted); font-weight: 500; position: relative; padding: 22px 0; }
.main-nav a:hover, .main-nav a.active { color: var(--primary); }
.main-nav a.active::after {
    content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
    background: var(--primary); border-radius: 2px 2px 0 0;
}
.header-search {
    margin-left: auto; display: flex; align-items: center; gap: 8px;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 10px; padding: 0 10px; height: 38px; width: 230px;
}
.header-search:focus-within { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px var(--primary-soft); }
.header-search svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.header-search input { border: 0; outline: 0; background: transparent; width: 100%; font-size: 13px; }
.header-search kbd {
    font-size: 11px; color: var(--muted); border: 1px solid var(--border-strong);
    border-radius: 4px; padding: 0 5px; line-height: 17px;
}
.header-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.user-menu { display: flex; align-items: center; gap: 8px; }
.avatar {
    display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
    background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 13px;
}
.user-name { font-size: 13px; font-weight: 600; }

.flash-wrap { padding-top: 16px; }
.flash, .alert {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 11px 16px; border-radius: 10px; font-size: 13px;
}
.flash-success, .alert-success { background: #ecfdf5; color: #047857; border: 1px solid #c6f0dd; }
.flash-error, .alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert { margin-bottom: 16px; }
.flash-close { background: none; border: 0; color: inherit; font-size: 20px; line-height: 1; opacity: .6; }

/* ---------------- Hero ---------------- */
.hero {
    position: relative; overflow: hidden;
    background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 48%, #ecfeff 100%);
    border-bottom: 1px solid #e8eafd;
}
.hero-grid {
    position: absolute; inset: 0; opacity: .5;
    background-image: linear-gradient(rgba(99,102,241,.055) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(99,102,241,.055) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: linear-gradient(to bottom, #000 0%, transparent 92%);
}
.hero::after {
    content: ''; position: absolute; width: 420px; height: 420px; border-radius: 50%;
    right: -120px; top: -180px; background: radial-gradient(circle, rgba(168,85,247,.16), transparent 68%);
}
.hero-inner { position: relative; text-align: center; padding: 74px 0 40px; }
.hero-badge {
    display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px;
    background: rgba(255,255,255,.8); border: 1px solid #dfe2fb; border-radius: 999px;
    font-size: 12px; color: var(--primary-dark); font-weight: 600;
}
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(16,185,129,.15); }
.hero h1 { font-size: clamp(34px, 5vw, 54px); letter-spacing: -1.6px; margin: 22px 0 16px; font-weight: 800; }
.gradient-text {
    background: linear-gradient(100deg, #4f46e5, #9333ea 55%, #0891b2);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { color: var(--muted); font-size: 16px; max-width: 640px; margin: 0 auto 30px; }
.hero-search {
    position: relative; display: flex; align-items: center; gap: 10px;
    max-width: 660px; margin: 0 auto; padding: 7px 7px 7px 18px;
    background: #fff; border: 1px solid #dfe3f2; border-radius: 14px;
    box-shadow: 0 12px 36px rgba(79,70,229,.11);
}
.hero-search:focus-within { border-color: var(--primary); box-shadow: 0 12px 40px rgba(79,70,229,.18); }
.hero-search svg { width: 20px; height: 20px; color: var(--muted); flex-shrink: 0; }
.hero-search input { flex: 1; border: 0; outline: 0; font-size: 15px; min-width: 0; }
.hero-quick { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 18px; color: var(--muted); font-size: 13px; }
.hero-quick a { color: var(--primary); }
.hero-quick a:hover { text-decoration: underline; }
.suggest-panel {
    position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 40;
    background: #fff; border: 1px solid var(--border); border-radius: 12px;
    box-shadow: var(--shadow); overflow: hidden; text-align: left;
}
.suggest-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--surface-2); }
.suggest-item:last-child { border-bottom: 0; }
.suggest-item:hover { background: var(--primary-soft); }
.suggest-item strong { font-size: 13px; }
.suggest-item small { color: var(--muted); margin-left: auto; font-size: 12px; }
.suggest-empty { padding: 14px; color: var(--muted); font-size: 13px; text-align: center; }
.hero-stats {
    display: flex; justify-content: center; gap: 0; margin-top: 46px;
    background: rgba(255,255,255,.55); border: 1px solid rgba(255,255,255,.9);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
    width: fit-content; margin-left: auto; margin-right: auto; overflow: hidden;
}
.hero-stats > div { display: flex; flex-direction: column; padding: 16px 32px; min-width: 120px; }
.hero-stats > div + div { border-left: 1px solid var(--border); }
.hero-stats strong { font-size: 24px; font-weight: 800; color: var(--primary-dark); letter-spacing: -.5px; }
.hero-stats span { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------------- 区块与卡片 ---------------- */
.section { padding: 52px 0 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; gap: 16px; }
.section-head h2 { font-size: 24px; letter-spacing: -.5px; }
.section-head p { color: var(--muted); font-size: 13px; margin-top: 5px; }
.head-emoji { font-size: 20px; }
.section-more { color: var(--primary); font-size: 13px; font-weight: 600; white-space: nowrap; }
.section-more:hover { text-decoration: underline; }

.category-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.category-card {
    display: flex; flex-direction: column; gap: 4px; padding: 20px 18px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.category-card:hover { transform: translateY(-3px); border-color: #c7cbef; box-shadow: var(--shadow); }
.category-icon { font-size: 26px; line-height: 1.2; }
.category-card strong { font-size: 15px; margin-top: 6px; }
.category-desc { font-size: 11px; color: var(--muted); line-height: 1.5; min-height: 32px; }
.category-count { font-size: 11px; color: var(--primary); font-weight: 600; margin-top: 6px; }

.api-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.api-card {
    display: flex; flex-direction: column; min-height: 226px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px; box-shadow: var(--shadow-sm);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.api-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: #c9cdf0; }
.card-top { display: flex; align-items: center; gap: 10px; }
.card-icon {
    display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px;
    background: var(--surface-2); border: 1px solid var(--border); font-size: 19px;
}
.method-badge {
    display: inline-block; padding: 2px 8px; border-radius: 6px;
    font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; font-weight: 700; letter-spacing: .4px;
}
.method-badge.get { background: #e6f8f1; color: #0f8a63; }
.method-badge.post { background: #e9f0ff; color: #3b63cf; }
.method-badge.put { background: #fff4e5; color: #b67408; }
.method-badge.del { background: #fdecec; color: #cf3c3c; }
.method-badge.patch { background: #f3ebff; color: #7c3aed; }
.fav-btn {
    margin-left: auto; background: none; border: 0; font-size: 20px; line-height: 1;
    color: #cfd5e0; padding: 2px 4px; transition: color .15s ease, transform .15s ease;
}
.fav-btn:hover { color: #f5a623; transform: scale(1.15); }
.fav-btn.is-active { color: #f59e0b; }
.card-category { font-size: 11px; color: var(--muted); margin-top: 14px; }
.card-title { font-size: 16px; margin-top: 3px; }
.card-title a:hover { color: var(--primary); }
.card-summary {
    font-size: 12.5px; color: var(--muted); line-height: 1.6; margin-top: 8px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag { font-size: 11px; color: var(--primary); background: var(--primary-soft); padding: 2px 8px; border-radius: 6px; }
.card-footer {
    display: flex; align-items: center; gap: 10px; margin-top: auto;
    padding-top: 14px; border-top: 1px solid var(--surface-2); font-size: 11.5px;
}
.card-metric { color: var(--muted); }
.auth-pill { color: var(--amber); background: #fff7e6; padding: 2px 7px; border-radius: 5px; }
.auth-pill.free { color: #0f8a63; background: #e9f8f1; }
.card-link { margin-left: auto; color: var(--primary); font-weight: 600; }

.cta-band {
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
    margin: 56px 0 64px; padding: 30px 36px; border-radius: var(--radius);
    background: linear-gradient(110deg, #4f46e5, #7c3aed); color: #fff;
    box-shadow: 0 16px 40px rgba(79,70,229,.2);
}
.cta-band h2 { font-size: 22px; }
.cta-band p { opacity: .82; font-size: 13px; margin-top: 6px; }

/* ---------------- 页脚 ---------------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); margin-top: auto; }
.footer-inner { display: flex; justify-content: space-between; gap: 30px; padding: 42px 0 32px; }
.footer-brand { display: flex; gap: 12px; align-items: flex-start; max-width: 360px; }
.footer-brand strong { font-size: 16px; }
.footer-brand p { color: var(--muted); font-size: 12px; margin-top: 4px; }
.footer-links { display: flex; gap: 60px; }
.footer-links div { display: flex; flex-direction: column; gap: 8px; }
.footer-links h4 { font-size: 13px; margin-bottom: 4px; }
.footer-links a { color: var(--muted); font-size: 12.5px; }
.footer-links a:hover { color: var(--primary); }
.footer-bottom {
    display: flex; justify-content: space-between; gap: 12px; padding: 16px 0 24px;
    border-top: 1px solid var(--border); color: var(--muted); font-size: 11.5px;
}

/* ---------------- 列表页 ---------------- */
.page-head { padding: 34px 0 22px; }
.breadcrumb { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.breadcrumb a:hover { color: var(--primary); }
.page-head h1 { font-size: 30px; letter-spacing: -.8px; }
.page-head p { color: var(--muted); margin-top: 6px; font-size: 14px; }
.category-strip { display: flex; flex-wrap: wrap; gap: 9px; padding-bottom: 20px; }
.chip {
    padding: 6px 14px; border-radius: 999px; background: var(--surface);
    border: 1px solid var(--border); font-size: 12.5px; color: var(--text-soft);
    transition: all .15s ease;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.filter-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px; box-shadow: var(--shadow-sm);
}
.filter-search {
    display: flex; align-items: center; gap: 8px; flex: 1 1 240px; min-width: 200px;
    border: 1px solid var(--border); border-radius: 9px; padding: 0 12px; height: 38px; background: var(--surface-2);
}
.filter-search:focus-within { border-color: var(--primary); background: #fff; }
.filter-search svg { width: 16px; height: 16px; color: var(--muted); }
.filter-search input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 13px; min-width: 0; }
.filter-bar select {
    height: 38px; border: 1px solid var(--border); border-radius: 9px; padding: 0 30px 0 11px;
    background: var(--surface-2); font-size: 13px; outline: 0;
}
.filter-bar select:focus { border-color: var(--primary); }
.check-filter { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-soft); white-space: nowrap; }
.result-meta { color: var(--muted); font-size: 13px; margin: 22px 0 14px; }
.result-meta strong { color: var(--text); }
.pagination { display: flex; justify-content: center; gap: 7px; margin: 34px 0 60px; }
.page-btn {
    display: grid; place-items: center; min-width: 36px; height: 36px; padding: 0 10px;
    border: 1px solid var(--border); background: var(--surface); border-radius: 8px; font-size: 13px;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btn.disabled { opacity: .4; pointer-events: none; }
.page-dots { display: grid; place-items: center; width: 24px; color: var(--muted); }

.empty-state {
    text-align: center; padding: 70px 20px 80px; background: var(--surface);
    border: 1px dashed var(--border-strong); border-radius: var(--radius); margin-bottom: 50px;
}
.empty-icon { font-size: 46px; }
.empty-state h3 { font-size: 18px; margin-top: 12px; }
.empty-state p { color: var(--muted); font-size: 13px; margin: 8px 0 20px; }

/* ---------------- 详情页 ---------------- */
.detail-page { padding: 28px 0 60px; }
.detail-hero {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 20px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 26px 28px; box-shadow: var(--shadow-sm); margin-bottom: 22px;
}
.detail-badges { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pill { font-size: 11px; color: var(--text-soft); background: var(--surface-2); border: 1px solid var(--border); padding: 2px 9px; border-radius: 999px; }
.pill-green { background: #eaf9f2; border-color: #c9eedd; color: #0b7a57; }
.pill-blue { background: #eef6ff; border-color: #d5e9fb; color: #2563a8; }
.detail-hero h1 { font-size: 28px; margin-top: 14px; letter-spacing: -.6px; }
.detail-summary { color: var(--text-soft); font-size: 14px; margin-top: 8px; }
.detail-metrics { display: flex; flex-wrap: wrap; gap: 18px; color: var(--muted); font-size: 12px; margin-top: 14px; }
.detail-metrics a { color: var(--primary); font-weight: 600; }
.fav-hero-btn { flex-shrink: 0; }
.fav-hero-btn.is-active { background: #fff7e6; border-color: #f7d9a0; color: #b47008; }

.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.detail-content, .detail-side { display: flex; flex-direction: column; gap: 18px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow-sm); }
.panel h2 { font-size: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; }
.panel > h2 + .prose { margin-top: 12px; }
.prose { color: var(--text-soft); font-size: 13.5px; line-height: 1.85; }
.detail-tags { margin-top: 16px; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.7; }
.panel > .hint:first-of-type { margin-top: 10px; }
.endpoint-box {
    display: flex; align-items: center; gap: 12px; padding: 13px 15px;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.endpoint-box code { font-size: 12px; color: var(--text-soft); word-break: break-all; line-height: 1.6; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.data-table th { text-align: left; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: 11px 12px; border-bottom: 1px solid var(--surface-2); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table code { font-size: 11.5px; color: #374151; background: var(--surface-2); padding: 2px 6px; border-radius: 4px; }
.type-tag { font-size: 11px; color: var(--violet); background: #f4edff; padding: 2px 7px; border-radius: 5px; }
.optional { color: var(--muted); font-size: 11.5px; }
.code-block {
    margin: 0; padding: 16px; background: #f8f9fd; border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: 12px; line-height: 1.75;
    color: #334155; overflow-x: auto; white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow-y: auto;
}

.try-panel { position: sticky; top: 88px; }
.live-dot { font-size: 11px; color: var(--green); background: #eaf9f2; padding: 3px 9px; border-radius: 999px; }
.try-fields { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--text-soft); }
.field > span small { color: var(--muted); font-weight: 400; }
.field input, .field select, .field textarea {
    width: 100%; border: 1px solid var(--border-strong); border-radius: 9px;
    padding: 9px 11px; background: #fff; outline: 0; font-size: 13px; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
    border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.field textarea { resize: vertical; line-height: 1.6; }
.field b { color: var(--red); }
.spinner { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.result-head { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--text-soft); margin: 18px 0 8px; }
.result-status { color: var(--muted); font-family: monospace; }
.result-status.ok { color: var(--green); }
.result-status.fail { color: var(--red); }
.result-box {
    margin: 0; padding: 13px; min-height: 120px; max-height: 300px; overflow: auto;
    background: #f8f9fd; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 11.5px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; color: #334155;
}
.result-image { margin-top: 10px; text-align: center; }
.result-image img { max-width: 100%; max-height: 260px; border-radius: 10px; border: 1px solid var(--border); }
.related-item { display: flex; align-items: center; gap: 11px; padding: 9px 0; border-bottom: 1px solid var(--surface-2); }
.related-item:last-child { border-bottom: 0; }
.related-item > span:first-child { font-size: 19px; }
.related-item div { min-width: 0; flex: 1; }
.related-item strong { display: block; font-size: 12.5px; }
.related-item small { display: block; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.related-item:hover strong { color: var(--primary); }
.related-item .arrow { color: var(--muted); }

/* ---------------- 登录注册 ---------------- */
.auth-page { display: grid; place-items: center; padding: 60px 0 80px; }
.auth-card {
    width: min(430px, 100%); background: var(--surface); border: 1px solid var(--border);
    border-radius: 20px; box-shadow: var(--shadow); padding: 34px;
}
.auth-head { text-align: center; margin-bottom: 24px; }
.auth-head .brand-mark { margin: 0 auto 14px; }
.auth-head h1 { font-size: 23px; }
.auth-head p { color: var(--muted); font-size: 13px; margin-top: 6px; }
.auth-form { display: flex; flex-direction: column; gap: 15px; }
.auth-form .btn { margin-top: 6px; }
.auth-switch { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 20px; }
.auth-switch a { color: var(--primary); font-weight: 600; }
.demo-tip {
    display: flex; justify-content: space-between; align-items: center; margin-top: 20px;
    padding: 10px 13px; background: var(--primary-soft); border-radius: 9px; font-size: 12px; color: var(--primary-dark);
}

/* ---------------- 收藏页 ---------------- */
.favorite-list { display: flex; flex-direction: column; gap: 12px; padding-bottom: 50px; }
.favorite-row {
    display: flex; align-items: center; gap: 16px; padding: 18px 20px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.favorite-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2); font-size: 22px; flex-shrink: 0; }
.favorite-info { flex: 1; min-width: 0; }
.favorite-title { display: flex; align-items: center; gap: 10px; }
.favorite-title a { font-size: 15px; font-weight: 700; }
.favorite-title a:hover { color: var(--primary); }
.favorite-info p { color: var(--muted); font-size: 12.5px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.favorite-info small { color: var(--muted); font-size: 11px; }
.favorite-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* ---------------- 后台 ---------------- */
.admin-body { background: #f4f6fb; }
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar {
    width: 226px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--border);
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.admin-brand { padding: 20px 20px 24px; }
.admin-brand .brand-text { display: flex; flex-direction: column; line-height: 1.2; font-size: 16px; }
.admin-brand small { font-size: 10px; color: var(--muted); font-weight: 500; margin-top: 3px; }
.admin-nav { display: flex; flex-direction: column; gap: 3px; padding: 0 12px; flex: 1; }
.nav-label { font-size: 10px; color: #9aa4b5; text-transform: uppercase; letter-spacing: 1px; padding: 16px 10px 6px; }
.admin-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px; font-size: 13px; color: var(--text-soft); }
.admin-nav a span { font-size: 16px; }
.admin-nav a:hover { background: var(--surface-2); }
.admin-nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.sidebar-foot { padding: 16px 20px; font-size: 11px; color: #a5adba; border-top: 1px solid var(--border); }
.admin-main { flex: 1; min-width: 0; }
.admin-topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
    height: 72px; padding: 0 30px; background: #fff; border-bottom: 1px solid var(--border);
}
.admin-topbar-title h1 { font-size: 18px; }
.admin-topbar-title span { font-size: 11.5px; color: var(--muted); }
.admin-user { display: flex; align-items: center; gap: 10px; }
.admin-user strong { display: block; font-size: 13px; }
.admin-user small { color: var(--muted); font-size: 11px; }
.admin-content { padding: 26px 30px 60px; display: flex; flex-direction: column; gap: 18px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card {
    display: flex; align-items: center; gap: 14px; background: #fff;
    border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm);
}
.stat-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; font-size: 22px; flex-shrink: 0; }
.stat-icon.indigo { background: #eef0ff; }
.stat-icon.violet { background: #f5ecff; }
.stat-icon.cyan { background: #e6f8fb; }
.stat-icon.amber { background: #fff4e2; }
.stat-card small { color: var(--muted); font-size: 12px; display: block; }
.stat-card strong { display: block; font-size: 25px; letter-spacing: -.5px; line-height: 1.3; }
.stat-card em { color: var(--muted); font-size: 11px; font-style: normal; }
.admin-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.admin-panel { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow-sm); }
.admin-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.admin-panel-head h2 { font-size: 15px; }
.admin-panel-head span, .admin-panel-head a { font-size: 11.5px; color: var(--muted); }
.admin-panel-head a { color: var(--primary); font-weight: 600; }
.chart-bars { display: flex; align-items: flex-end; gap: 12px; height: 190px; padding-top: 20px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; gap: 6px; }
.chart-value { font-size: 10px; color: var(--muted); }
.chart-bar {
    width: 100%; max-width: 34px; min-height: 4px; border-radius: 6px 6px 2px 2px;
    background: linear-gradient(180deg, #7c7cf0, #5b5bd6);
}
.chart-label { font-size: 10px; color: var(--muted); white-space: nowrap; }
.rank-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.rank-list li { display: flex; align-items: center; gap: 11px; }
.rank-num { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: var(--surface-2); font-size: 11px; color: var(--muted); font-weight: 700; }
.rank-1 { background: #fff2d6; color: #b47808; }
.rank-2 { background: #eef0f4; color: #6b7280; }
.rank-3 { background: #fbeee6; color: #b46b3a; }
.rank-list div { flex: 1; min-width: 0; }
.rank-list strong { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-list small { color: var(--muted); font-size: 10.5px; }
.rank-hits { color: var(--muted); font-size: 11px; white-space: nowrap; }
.admin-table th, .admin-table td { padding: 10px 12px; }
.admin-table .table-sub { display: block; color: var(--muted); font-size: 11px; max-width: 300px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: var(--muted); }
.status-dot.active { background: var(--green); }
.status-dot.inactive { background: var(--amber); }
.status-dot.down { background: var(--red); }
.table-actions { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.table-actions a { color: var(--primary); font-size: 12px; }
.table-actions a:hover { text-decoration: underline; }
.table-empty { text-align: center; color: var(--muted); padding: 34px !important; }
.icon-cell { font-size: 19px; width: 50px; }
.desc-cell { color: var(--muted); max-width: 260px; }
.count-pill { background: var(--primary-soft); color: var(--primary); padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.admin-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.admin-search { display: flex; gap: 8px; }
.admin-search input { border: 1px solid var(--border-strong); border-radius: 9px; padding: 8px 12px; min-width: 260px; font-size: 13px; outline: 0; background: #fff; }
.admin-search input:focus { border-color: var(--primary); }
.toolbar-hint { color: var(--muted); font-size: 12px; }
.back-link { color: var(--primary); font-size: 12.5px; font-weight: 600; }
.admin-form { display: flex; flex-direction: column; gap: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.field-full { grid-column: 1 / -1; }
.checkbox-row { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.checkbox-row label { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-soft); }
.checkbox-row input { width: 15px; height: 15px; accent-color: var(--primary); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------------- Toast ---------------- */
.toast {
    position: fixed; bottom: 26px; left: 50%; transform: translate(-50%, 20px);
    background: #1f2937; color: #fff; padding: 10px 18px; border-radius: 10px;
    font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.2); opacity: 0; pointer-events: none;
    transition: opacity .2s ease, transform .2s ease; z-index: 100;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #b91c1c; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1080px) {
    .category-grid { grid-template-columns: repeat(3, 1fr); }
    .api-grid { grid-template-columns: repeat(2, 1fr); }
    .detail-layout { grid-template-columns: 1fr; }
    .try-panel { position: static; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .header-search { display: none; }
}
@media (max-width: 760px) {
    .container { width: min(100% - 28px, 1200px); }
    .header-inner { gap: 12px; }
    .main-nav { gap: 12px; }
    .main-nav a { font-size: 12.5px; }
    .user-name, .header-actions .btn-ghost { display: none; }
    .hero-inner { padding: 54px 0 30px; }
    .hero-stats { width: 100%; }
    .hero-stats > div { padding: 12px 10px; min-width: 0; flex: 1; }
    .hero-stats strong { font-size: 19px; }
    .category-grid, .api-grid { grid-template-columns: repeat(2, 1fr); }
    .section { padding-top: 40px; }
    .cta-band { flex-direction: column; align-items: flex-start; padding: 24px; }
    .footer-inner, .footer-bottom { flex-direction: column; }
    .footer-links { gap: 30px; }
    .detail-hero { flex-direction: column; }
    .admin-sidebar { width: 64px; }
    .admin-brand .brand-text, .nav-label, .admin-nav a, .sidebar-foot { font-size: 0; }
    .admin-nav a { justify-content: center; }
    .admin-nav a span { font-size: 18px; }
    .admin-topbar, .admin-content { padding-left: 16px; padding-right: 16px; }
    .admin-grid-2, .form-grid { grid-template-columns: 1fr; }
    .field-full { grid-column: auto; }
    .favorite-row { flex-wrap: wrap; }
}
@media (max-width: 480px) {
    .api-grid, .category-grid { grid-template-columns: 1fr; }
    .main-nav a:nth-child(3) { display: none; }
    .hero-search { flex-wrap: wrap; }
    .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 14px; }
}
