:root {
    --bg: #F7F9FC;
    --bg-glow: #EEF3FF;
    --primary: #2457E6;
    --primary-hover: #1B44B8;
    --primary-soft: #EEF3FF;
    --accent: #12B8A6;
    --accent-soft: #E6F7F5;
    --surface: #FFFFFF;
    --text: #0F172A;
    --text-muted: #64748B;
    --border: #E2E8F0;
    --success: #16A34A;
    --success-soft: #E9F7EE;
    --warning: #D97706;
    --warning-soft: #FDF3E4;
    --danger: #DC2626;
    --danger-soft: #FDECEE;
    --radius-card: 12px;
    --radius-control: 8px;
    --shadow-card: 0 1px 3px rgba(15, 23, 42, .06);
    --shadow-lift: 0 6px 18px rgba(15, 23, 42, .08);
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --font-body: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-title: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.65;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 { font-family: var(--font-title); margin: 0; line-height: 1.3; }

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

/* ---------------- 按钮 ---------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 18px;
    border-radius: var(--radius-control);
    border: 1px solid transparent;
    font-size: 14px;
    font-family: var(--font-body);
    line-height: 1.2;
    cursor: pointer;
    transition: background .22s var(--ease), border-color .22s var(--ease), transform .22s var(--ease), box-shadow .22s var(--ease);
    white-space: nowrap;
    user-select: none;
}
.btn:active { transform: translateY(1px) scale(0.995); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; box-shadow: var(--shadow-lift); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #0E9F91; color: #fff; box-shadow: var(--shadow-lift); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); box-shadow: var(--shadow-lift); }
.btn-danger { background: var(--surface); border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-soft:hover { background: #E0EAFC; color: var(--primary-hover); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { min-height: 48px; padding: 0 26px; font-size: 15px; }
.btn-block { display: flex; width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.input, .select, .textarea {
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-control);
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    font-family: var(--font-body);
    transition: border-color .22s var(--ease), box-shadow .22s var(--ease);
}
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(36, 87, 230, .12);
}
.input-error { border-color: var(--danger) !important; }
.field-error { color: var(--danger); font-size: 13px; margin-top: 5px; }
.field-hint { color: var(--text-muted); font-size: 13px; margin-top: 5px; }
.textarea { min-height: 80px; resize: vertical; }

/* ---------------- 卡片 ---------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
}

/* ---------------- 徽章 / 标签 ---------------- */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    background: #EEF1F5;
    color: var(--text-muted);
}
.tag-success { background: var(--success-soft); color: var(--success); }
.tag-warning { background: var(--warning-soft); color: var(--warning); }
.tag-danger { background: var(--danger-soft); color: var(--danger); }
.tag-info { background: var(--primary-soft); color: var(--primary); }
.tag-accent { background: var(--accent-soft); color: var(--accent); }

/* ---------------- 提示条 ---------------- */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius-control);
    font-size: 14px;
    margin-bottom: 14px;
    border: 1px solid transparent;
}
.alert-success { background: var(--success-soft); border-color: #BBE5CC; color: #147A3C; }
.alert-error { background: var(--danger-soft); border-color: #F5C8CE; color: #B11D22; }
.alert-warning { background: var(--warning-soft); border-color: #F3DDA9; color: #9A5A06; }
.alert-info { background: var(--primary-soft); border-color: #CFDFFB; color: #1B44B8; }

/* ---------------- 表格 ---------------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { background: #F9FAFC; color: var(--text-muted); font-weight: 500; font-size: 13px; white-space: nowrap; }
.table tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; border-radius: var(--radius-card); }

/* ---------------- 弹层 ---------------- */
.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s var(--ease), visibility .2s var(--ease);
}
.modal-mask.open { opacity: 1; visibility: visible; }
.modal {
    background: var(--surface);
    border-radius: var(--radius-card);
    width: 100%;
    max-width: 460px;
    padding: 24px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, .22);
    transform: translateY(-4px);
    transition: transform .2s var(--ease);
}
.modal-mask.open .modal { transform: translateY(0); }
.modal-title { font-size: 17px; font-weight: 600; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ---------------- 顶部导航 ---------------- */
.topbar {
    height: 64px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.topbar-inner {
    height: 64px;
    display: flex;
    align-items: center;
    gap: 20px;
}
.brand { font-family: var(--font-title); font-size: 20px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.brand-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--primary); display: inline-block; }

/* ---------------- 空状态 ---------------- */
.empty { text-align: center; padding: 56px 20px; color: var(--text-muted); }
.empty-icon { margin: 0 auto 14px; color: #B6C2D1; }

/* ---------------- Toast ---------------- */
#toastWrap {
    position: fixed;
    top: 76px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 320px;
}
.toast {
    padding: 10px 16px;
    border-radius: var(--radius-control);
    font-size: 14px;
    box-shadow: var(--shadow-lift);
    background: var(--surface);
    border-left: 4px solid var(--primary);
    animation: toastIn .2s var(--ease);
}
.toast-success { border-left-color: var(--success); color: #147A3C; }
.toast-error { border-left-color: var(--danger); color: #B11D22; }
.toast-info { border-left-color: var(--primary); color: var(--primary-hover); }
@keyframes toastIn {
    from { opacity: 0; transform: translateX(12px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ---------------- 工具类 ---------------- */
.row { display: flex; gap: 12px; align-items: center; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 12px; }
.muted { color: var(--text-muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.hide { display: none !important; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.gap-16 { gap: 16px; }
.text-center { text-align: center; }
.spacer { flex: 1; }

/* ---------------- 入场动画 ---------------- */
.reveal { animation: reveal .22s var(--ease) both; }
@keyframes reveal {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        transition-duration: .001ms !important;
    }
}

@media (max-width: 767px) {
    .container { padding: 0 16px; }
    #toastWrap { right: 12px; left: 12px; max-width: none; }
}
