:root {
    /* 计划 349：旧变量名保留为别名，值统一走 design-tokens.css（单一真源）。
       模板里的 var(--accent) / var(--text-muted) 因此与 /app 同色。 */
    --bg: var(--color-bg);
    --card-bg: var(--color-surface);
    --text: var(--color-text);
    --text-secondary: var(--color-text-secondary);
    --text-muted: var(--color-text-muted);
    --accent: var(--color-primary);
    --accent-soft: var(--color-primary-soft);
    --border: var(--color-border);
    --warning: #f59e0b;
    --font-mono: var(--font-mono);
    /* --radius / --radius-sm / --radius-lg 不再在此定义：统一由 design-tokens.css 提供 */
}

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

/* 计划 158：键盘焦点必须看得见（全站统一） */:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* 计划 158：长文本/长链接不撑破容器 */.wrap-anywhere {
    overflow-wrap: anywhere;
    word-break: break-word;
}

html { font-size: 16px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

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

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.product-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.2s;
    overflow: hidden;
}
.product-card:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(0,0,0,0.08); }
.product-card-header { position: relative; }

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 16px;
    transition: all 0.2s;
}
.stat-card:hover { border-color: var(--accent); }

.category-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 16px;
    text-align: center;
    transition: all 0.2s;
}
.category-card:hover { border-color: var(--accent); transform: translateY(-2px); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    background: var(--card-bg);
    color: var(--text);
}
.btn:hover { opacity: 0.9; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #4f46e5; }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 28px; font-size: 0.95rem; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 6px; color: var(--text-secondary); }
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: var(--card-bg);
    color: var(--text);
    transition: border-color 0.2s;
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 0.85rem; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
table th, table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.admin-sidebar {
    width: 220px;
    flex-shrink: 0;
}
.admin-sidebar a {
    display: block;
    padding: 10px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    margin-bottom: 4px;
    transition: all 0.15s;
}
.admin-sidebar a:hover, .admin-sidebar a.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
}
.status-paid { background: #dcfce7; color: #166534; }
.status-pending { background: #fef3c7; color: #92400e; }
.status-cancelled { background: #fef2f2; color: #991b1b; }

@media (max-width: 768px) {
    body { font-size: 14px; }
    .admin-layout { flex-direction: column; }
    .admin-sidebar { width: 100%; display: flex; flex-wrap: wrap; gap: 4px; }
    .admin-sidebar a { flex-shrink: 0; }
}

/* 计划 168：跳转链接默认移出视口，聚焦时出现 */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 2000;
    background: var(--accent);
    color: #fff;
    padding: 8px 14px;
    border-radius: 0 0 8px 0;
}
.skip-link:focus {
    left: 0;
}
