/* ===== 全局变量覆盖 ===== */
:root {
    --pico-font-size: 15px;
    --pico-border-radius: 8px;
    --brand-color: #4361ee;
    --brand-light: #eef1ff;
    --danger-color: #e63946;
    --success-color: #2a9d8f;
    --warning-color: #e9c46a;
    --muted-text: #6c757d;
    --card-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* ===== 布局 ===== */
body { background: #f5f6fa; }
.app-header {
    background: var(--brand-color);
    color: #fff;
    padding: 0.6rem 0;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 12px rgba(67,97,238,0.15);
}
.app-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.app-header .logo {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.app-header .logo svg { width: 22px; height: 22px; }
.app-header nav ul {
    list-style: none;
    display: flex;
    gap: 0.3rem;
    margin: 0;
    padding: 0;
}
.app-header nav a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.88rem;
    transition: all 0.2s;
}
.app-header nav a:hover,
.app-header nav a.active {
    background: rgba(255,255,255,0.18);
    color: #fff;
}
.app-header nav a.nav-logout {
    color: rgba(255,255,255,0.6);
    margin-left: 0.5rem;
}
.app-header nav a.nav-logout:hover {
    color: #fff;
    background: rgba(255,255,255,0.12);
}

/* ===== 内容区 ===== */
.page-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.2rem;
    font-size: 1.3rem;
    font-weight: 600;
}
.page-title svg { width: 24px; height: 24px; color: var(--brand-color); }

/* ===== 卡片 ===== */
.card {
    background: #fff;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    margin-bottom: 1.2rem;
}
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 1.2rem 1.5rem;
    box-shadow: var(--card-shadow);
    text-align: center;
    transition: transform 0.15s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-card .stat-num { font-size: 2rem; font-weight: 700; color: var(--brand-color); }
.stat-card .stat-label { font-size: 0.85rem; color: var(--muted-text); margin-top: 0.3rem; }
.stat-card .stat-action { margin-top: 0.8rem; }
.stat-card .stat-action a {
    font-size: 0.82rem;
    color: var(--brand-color);
    text-decoration: none;
    padding: 0.3rem 0.8rem;
    border: 1px solid var(--brand-color);
    border-radius: 6px;
    transition: all 0.2s;
}
.stat-card .stat-action a:hover { background: var(--brand-color); color: #fff; }

/* ===== 表格 ===== */
table {
    background: #fff;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
}
table thead th {
    background: var(--brand-light);
    color: #333;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: none;
    padding: 0.8rem 1rem;
    border-bottom: 2px solid #e0e4f0;
}
table tbody td {
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
    vertical-align: middle;
}
table tbody tr { transition: background 0.15s; }
table tbody tr:hover { background: #f8f9ff; }
td.actions {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    flex-wrap: wrap;
}
td.actions form { margin: 0; }
td.actions a[role="button"],
td.actions button {
    font-size: 0.78rem;
    padding: 0.25rem 0.6rem;
    margin: 0;
}
td code {
    background: var(--brand-light);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.82rem;
}
.file-size { color: var(--muted-text); font-size: 0.85rem; }

/* ===== 面包屑 ===== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.88rem;
    color: var(--muted-text);
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.breadcrumb a {
    color: var(--brand-color);
    text-decoration: none;
}
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { color: #bbb; }

/* ===== Flash 消息 ===== */
.flash-msg {
    padding: 0.8rem 1.2rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.flash-msg.success {
    background: #e8f5e9;
    color: #2e7d32;
    border-left: 4px solid var(--success-color);
}
.flash-msg.error {
    background: #ffeef0;
    color: #c62828;
    border-left: 4px solid var(--danger-color);
}
.flash-msg.warning {
    background: #fff8e1;
    color: #f57f17;
    border-left: 4px solid var(--warning-color);
}

/* ===== 折叠面板 ===== */
details {
    background: #fff;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    margin-bottom: 1.2rem;
    overflow: hidden;
}
details summary {
    padding: 0.8rem 1.2rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 10px;
}
details[open] summary {
    border-bottom: 1px solid #eee;
    border-radius: 10px 10px 0 0;
    margin-bottom: 0;
}
details form {
    padding: 1.2rem;
}

/* ===== 登录页 ===== */
.login-card {
    max-width: 400px;
    margin: 8vh auto;
    background: #fff;
    border-radius: 12px;
    padding: 2.5rem 2rem;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    text-align: center;
}
.login-card h3 {
    color: var(--brand-color);
    margin-bottom: 1.5rem;
}

/* ===== API Key ===== */
.key-success {
    background: #e8f5e9;
    border: 2px solid var(--success-color);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.2rem;
}
.key-success h4 { color: #2e7d32; margin-bottom: 0.5rem; }
.key-copy-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.key-copy-row input {
    font-family: monospace;
    flex: 1;
    background: #fff;
}
.key-list { display: flex; flex-direction: column; gap: 0.8rem; }
.key-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    padding: 1rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.key-card .key-info { flex: 0 0 auto; min-width: 120px; }
.key-card .key-name { font-weight: 600; font-size: 0.95rem; }
.key-card .key-date { font-size: 0.8rem; color: var(--muted-text); margin-top: 0.15rem; }
.key-card .key-value-wrap {
    flex: 1;
    min-width: 200px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.key-card .key-masked {
    font-family: monospace;
    font-size: 0.88rem;
    background: #f5f6fa;
    border: 1px solid #e0e4f0;
    border-radius: 6px;
    padding: 0.4rem 0.7rem;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    letter-spacing: 0.5px;
    transition: all 0.2s;
}
.key-card .key-masked.revealed {
    background: #fff;
    border-color: var(--brand-color);
    user-select: all;
    cursor: text;
}
.key-card .key-actions {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}
.key-btn {
    font-size: 0.78rem;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.key-btn:hover { border-color: var(--brand-color); color: var(--brand-color); }
.key-btn.danger { color: var(--danger-color); border-color: var(--danger-color); }
.key-btn.danger:hover { background: var(--danger-color); color: #fff; }

/* ===== API 信息卡片 ===== */
.api-info-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    margin-bottom: 1.2rem;
    overflow: hidden;
    border-left: 4px solid var(--brand-color);
}
.api-info-head {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.7rem 1rem;
    background: var(--brand-light);
    font-weight: 600;
    font-size: 0.9rem;
}
.api-info-body { padding: 0.8rem 1rem; }
.api-endpoint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.api-endpoint code {
    background: #f5f6fa;
    padding: 0.35rem 0.6rem;
    border-radius: 5px;
    font-size: 0.82rem;
    flex: 1;
    min-width: 0;
    word-break: break-all;
}
.api-method {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    background: #e8f5e9;
    color: #2e7d32;
    flex-shrink: 0;
}
.api-method.head { background: #fff3e0; color: #e65100; }
.api-hint {
    font-size: 0.82rem;
    color: var(--muted-text);
    margin-top: 0.5rem;
}
.api-hint a { color: var(--brand-color); }

/* ===== API 测试页 ===== */
.api-test-panel {
    background: #fff;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
}
.api-test-tabs {
    display: flex;
    border-bottom: 2px solid #eee;
}
.api-tab {
    flex: 1;
    padding: 0.8rem;
    border: none;
    background: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--muted-text);
    transition: all 0.2s;
}
.api-tab.active {
    color: var(--brand-color);
    border-bottom: 2px solid var(--brand-color);
    margin-bottom: -2px;
}
.api-test-form { padding: 1.2rem; }
.api-url-preview {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f5f6fa;
    border: 1px solid #e0e4f0;
    border-radius: 6px;
    padding: 0.5rem 0.8rem;
    margin-bottom: 1rem;
    overflow-x: auto;
}
.api-url-preview code {
    font-size: 0.82rem;
    word-break: break-all;
}
.api-result {
    margin: 0 1.2rem 1.2rem;
    border: 1px solid #e0e4f0;
    border-radius: 8px;
    overflow: hidden;
}
.api-result-head {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0.8rem;
    background: #f5f6fa;
    font-size: 0.82rem;
    border-bottom: 1px solid #e0e4f0;
}
.status-ok { color: #2e7d32; font-weight: 700; }
.status-err { color: var(--danger-color); font-weight: 700; }
.api-result pre {
    margin: 0;
    padding: 0.8rem;
    font-size: 0.82rem;
    background: #fafbff;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ===== 公开下载页 ===== */
.public-hero {
    max-width: 640px;
    margin: 5vh auto;
    text-align: center;
}
.public-hero img {
    width: 96px;
    height: 96px;
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
}
.public-hero h2 { margin-bottom: 0.3rem; }
.public-hero .desc { color: var(--muted-text); margin-bottom: 1.5rem; }
.platform-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    text-align: left;
}
.platform-card {
    background: #fff;
    border-radius: 10px;
    padding: 1.2rem;
    box-shadow: var(--card-shadow);
    transition: transform 0.15s;
}
.platform-card:hover { transform: translateY(-2px); }
.platform-card h5 { margin-bottom: 0.3rem; }
.platform-card .meta { font-size: 0.85rem; color: var(--muted-text); margin-bottom: 0.8rem; }
.app-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}
.app-card-link .app-card-action {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--brand-color);
    font-weight: 600;
}

/* ===== 平台徽章 ===== */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-android { background: #e8f5e9; color: #2e7d32; }
.badge-ios { background: #e3f2fd; color: #1565c0; }
.badge-windows { background: #e8eaf6; color: #283593; }
.badge-macos { background: #f3e5f5; color: #6a1b9a; }
.badge-linux { background: #fff3e0; color: #e65100; }

/* ===== 更新履历 ===== */
.changelog-section {
    text-align: left;
    margin-top: 2rem;
}
.changelog-section h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--brand-light);
}
.changelog-item {
    background: #fff;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    margin-bottom: 0.8rem;
    overflow: hidden;
}
.changelog-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1rem;
    background: #fafbff;
    border-bottom: 1px solid #f0f0f0;
    flex-wrap: wrap;
}
.changelog-ver {
    font-weight: 600;
    font-size: 0.9rem;
}
.changelog-date,
.changelog-size {
    font-size: 0.82rem;
    color: var(--muted-text);
}
.changelog-body {
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-line;
}
.changelog-body.empty {
    color: #bbb;
    font-style: italic;
}

/* ===== 固件总览 ===== */
.fw-series-block {
    background: #fff;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    margin-bottom: 1.5rem;
    overflow: hidden;
}
.fw-series-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.2rem;
    background: var(--brand-light);
    border-bottom: 2px solid #dde3f7;
}
.fw-series-head h3 {
    margin: 0;
    font-size: 1.05rem;
}
.fw-manage-link {
    font-size: 0.82rem;
    color: var(--brand-color);
    text-decoration: none;
}
.fw-manage-link:hover { text-decoration: underline; }
.fw-product-block {
    padding: 0.8rem 1.2rem;
    border-bottom: 1px solid #f0f0f0;
}
.fw-product-block:last-child { border-bottom: none; }
.fw-product-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
    flex-wrap: wrap;
}
.fw-empty {
    color: var(--muted-text);
    font-size: 0.88rem;
    padding: 0.5rem 0;
}
.fw-empty a { color: var(--brand-color); }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .app-header .container { flex-direction: column; gap: 0.5rem; }
    .app-header nav ul { flex-wrap: wrap; justify-content: center; }
    .stat-grid { grid-template-columns: 1fr; }
    td.actions { flex-direction: column; align-items: flex-start; }
    .fw-series-head { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
}
