/* ===== 基础重置 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    color: #1f2937;
    background: #f3f4f6;
    line-height: 1.5;
}
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; font-size: 14px; }

/* ===== 通用按钮 ===== */
.btn {
    display: inline-block;
    padding: 8px 18px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.4;
    transition: all .15s;
    white-space: nowrap;
}
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-default { background: #fff; color: #374151; border-color: #d1d5db; }
.btn-default:hover { background: #f9fafb; }
.btn-text { background: transparent; color: #6b7280; padding: 6px 10px; }
.btn-text:hover { color: #dc2626; }
.btn-block { display: block; width: 100%; }
.btn-sm { padding: 4px 12px; font-size: 13px; }

/* ===== 登录页 ===== */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #3b82f6 100%);
    padding: 20px;
}
.login-card {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 12px;
    padding: 40px 36px;
    box-shadow: 0 20px 50px rgba(0,0,0,.2);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo h1 { font-size: 26px; color: #1e3a8a; font-weight: 700; }
.login-logo p { color: #6b7280; margin-top: 6px; font-size: 14px; }
.login-form .form-group { margin-bottom: 18px; }
.login-form label { display: block; margin-bottom: 6px; color: #374151; font-weight: 500; }
.login-form input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    outline: none;
    transition: border-color .15s;
}
.login-form input:focus { border-color: #2563eb; }
.captcha-row { display: flex; gap: 10px; align-items: center; }
.captcha-row input { flex: 1; }
.captcha-img {
    width: 120px;
    height: 40px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    background: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
.captcha-img svg { width: 100%; height: 100%; }
.captcha-img:empty::before { content: "点击获取"; color: #9ca3af; font-size: 12px; }
.error-text { color: #dc2626; font-size: 13px; min-height: 18px; margin-top: 8px; text-align: center; }

/* ===== 后台主框架 ===== */
.admin-wrap { min-height: 100vh; }
.topbar {
    height: 56px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-left h2 { font-size: 17px; color: #1e3a8a; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.admin-name { color: #6b7280; font-size: 13px; }

/* Tab 导航 */
.tabnav {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 24px;
    display: flex;
    gap: 4px;
}
.tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 14px 20px;
    font-size: 14px;
    color: #6b7280;
    transition: all .15s;
}
.tab-btn:hover { color: #2563eb; }
.tab-btn.active { color: #2563eb; border-bottom-color: #2563eb; font-weight: 500; }

/* 面板 */
.tab-panel { display: none; padding: 24px; max-width: 1200px; margin: 0 auto; }
.tab-panel.active { display: block; }
.panel-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.panel-toolbar h3 { font-size: 16px; color: #1f2937; }

/* 卡片 */
.add-form-card, .table-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px 24px;
    margin-bottom: 16px;
    border: 1px solid #e5e7eb;
}
.add-form-card h4 { font-size: 15px; color: #374151; margin-bottom: 16px; }

/* 表单 */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 6px; color: #374151; font-weight: 500; font-size: 13px; }
.form-group input, .form-group select {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    outline: none;
    transition: border-color .15s;
    background: #fff;
}
.form-group input:focus, .form-group select:focus { border-color: #2563eb; }
.inline-form {
    display: flex;
    gap: 14px;
    align-items: flex-end;
    flex-wrap: wrap;
}
.inline-form .form-group { margin-bottom: 0; }
.inline-form .form-group input, .inline-form .form-group select { min-width: 140px; }

/* 表格 */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid #f3f4f6;
    font-size: 14px;
}
.data-table th {
    background: #f9fafb;
    color: #6b7280;
    font-weight: 600;
    font-size: 13px;
}
.data-table tbody tr:hover { background: #f9fafb; }
.empty-row { text-align: center; color: #9ca3af; padding: 32px; }

/* 状态标签 */
.tag { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.tag-green { background: #d1fae5; color: #065f46; }
.tag-red { background: #fee2e2; color: #991b1b; }
.tag-gray { background: #e5e7eb; color: #4b5563; }
.tag-blue { background: #dbeafe; color: #1e40af; }

/* 操作按钮间距 */
.row-actions { display: flex; gap: 8px; }

/* ===== 弹窗 ===== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}
.modal-card {
    background: #fff;
    border-radius: 8px;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 10px 30px rgba(0,0,0,.2);
}
.modal-sm { max-width: 360px; }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}
.modal-header h4 { font-size: 16px; color: #1f2937; }
.modal-close {
    background: transparent;
    border: none;
    font-size: 24px;
    color: #9ca3af;
    line-height: 1;
    padding: 0 4px;
}
.modal-close:hover { color: #1f2937; }
.modal-body { padding: 20px; }
.modal-info { margin-bottom: 16px; color: #6b7280; }
.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ===== 提示 toast ===== */
.toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: #1f2937;
    color: #fff;
    padding: 10px 22px;
    border-radius: 6px;
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transition: all .25s;
    z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: #dc2626; }
.toast.success { background: #059669; }

/* ===== 响应式 ===== */
@media (max-width: 640px) {
    .inline-form { flex-direction: column; align-items: stretch; }
    .inline-form .form-group input, .inline-form .form-group select { min-width: 0; width: 100%; }
    .tab-panel { padding: 16px; }
    .data-table { font-size: 13px; }
    .data-table th, .data-table td { padding: 8px 10px; }
}
