/* 后台样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
    background: #f0f2f5;
    color: #333;
    -webkit-font-smoothing: antialiased;
    font-size: 14px;
}
a { color: #1a3d8f; text-decoration: none; }
a:hover { color: #c8161d; }
img { max-width: 100%; }
input, select, textarea, button { font-family: inherit; font-size: 14px; }

.layout { display: flex; min-height: 100vh; }

/* 侧边栏 */
.sidebar {
    width: 230px;
    background: #0f2655;
    color: #cbd5e0;
    display: flex; flex-direction: column;
    position: fixed; top: 0; bottom: 0; left: 0;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 22px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark {
    width: 38px; height: 38px; border-radius: 50%;
    background: linear-gradient(135deg, #c8161d 0%, #c8161d 45%, #fff 45%, #fff 55%, #2a5fb4 55%);
    color: #fff; font-weight: bold; font-family: Georgia, serif; font-size: 22px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,.3);
}
.brand-text strong { display: block; color: #fff; font-size: 16px; letter-spacing: 1px; }
.brand-text span { font-size: 11px; opacity: .7; letter-spacing: 2px; }

.menu { flex: 1; padding: 14px 0; overflow-y: auto; }
.menu a {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 22px; color: #cbd5e0; font-size: 14px;
    border-left: 3px solid transparent;
    transition: all .2s;
    position: relative;
}
.menu a:hover { background: rgba(255,255,255,.05); color: #fff; }
.menu a.active {
    background: rgba(200,22,29,.15);
    color: #fff;
    border-left-color: #c8161d;
}
.menu .icon { font-size: 16px; width: 20px; text-align: center; }
.menu .badge {
    margin-left: auto;
    background: #c8161d; color: #fff;
    border-radius: 10px; padding: 1px 7px; font-size: 11px; font-weight: bold;
}

.sidebar-foot { padding: 16px 22px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-foot a { display: block; padding: 6px 0; font-size: 13px; color: #94a3b8; }
.sidebar-foot a:hover { color: #fff; }

/* 主内容 */
.main { flex: 1; margin-left: 230px; min-width: 0; }
.topbar {
    background: #fff;
    padding: 0 30px;
    height: 60px;
    display: flex; justify-content: space-between; align-items: center;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
    position: sticky; top: 0; z-index: 10;
}
.page-title { font-size: 18px; font-weight: 500; color: #0f2655; }
.user-info { display: flex; align-items: center; gap: 14px; color: #666; font-size: 13px; }
.user-info .sep { color: #ddd; }
.user-info a { color: #1a3d8f; }

.content { padding: 24px 30px; }

/* Flash 提示 */
.flash {
    padding: 12px 18px; border-radius: 4px; margin-bottom: 18px;
    font-size: 14px; border: 1px solid;
}
.flash-success { background: #f0f9eb; color: #67c23a; border-color: #c2e7b0; }
.flash-error { background: #fef0f0; color: #f56c6c; border-color: #fbc4c4; }
.flash-info { background: #ecf5ff; color: #409eff; border-color: #b3d8ff; }

/* 卡片 */
.card {
    background: #fff;
    border-radius: 6px;
    padding: 22px;
    margin-bottom: 18px;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.card-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid #f0f2f5;
}
.card-title { font-size: 16px; font-weight: 500; color: #0f2655; }

/* 统计卡片 */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 18px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: 6px; padding: 22px; box-shadow: 0 1px 4px rgba(0,0,0,.04); display: flex; align-items: center; gap: 18px; }
.stat-card .stat-icon { width: 56px; height: 56px; border-radius: 8px; display:flex; align-items:center; justify-content:center; font-size: 24px; color: #fff; }
.stat-card .stat-num { font-size: 26px; font-weight: bold; color: #0f2655; line-height: 1; }
.stat-card .stat-label { color: #999; font-size: 13px; margin-top: 6px; }
.stat-card.blue .stat-icon { background: linear-gradient(135deg, #1a3d8f, #2a5fb4); }
.stat-card.red .stat-icon { background: linear-gradient(135deg, #c8161d, #e63946); }
.stat-card.green .stat-icon { background: linear-gradient(135deg, #67c23a, #95d475); }
.stat-card.orange .stat-icon { background: linear-gradient(135deg, #e6a23c, #f0c785); }

/* 按钮 */
.btn {
    display: inline-block;
    padding: 8px 18px;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 14px;
    transition: all .2s;
    background: #fff;
    color: #333;
    text-decoration: none;
    line-height: 1.4;
}
.btn:hover { opacity: .85; }
.btn-primary { background: #1a3d8f; color: #fff; border-color: #1a3d8f; }
.btn-primary:hover { background: #15326b; color: #fff; }
.btn-danger { background: #c8161d; color: #fff; border-color: #c8161d; }
.btn-danger:hover { background: #a8121a; color: #fff; }
.btn-default { background: #fff; border-color: #dcdfe6; color: #606266; }
.btn-default:hover { color: #1a3d8f; border-color: #1a3d8f; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* 表格 */
.table { width: 100%; background: #fff; border-collapse: collapse; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid #f0f2f5; }
.table th { background: #fafbfc; color: #606266; font-weight: 500; font-size: 13px; }
.table tbody tr:hover { background: #fafbfc; }
.table .actions a { margin-right: 8px; }
.table .thumb { width: 60px; height: 40px; object-fit: cover; border-radius: 3px; background: #f0f2f5; }
.table .status-on { color: #67c23a; }
.table .status-off { color: #909399; }
.empty { text-align: center; padding: 40px 0; color: #999; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: 120px 1fr; gap: 18px 20px; align-items: start; }
.form-grid label { padding-top: 10px; color: #606266; text-align: right; }
.form-grid label .req { color: #c8161d; }
.form-grid .field { min-width: 0; }
.form-grid input[type=text], .form-grid input[type=email], .form-grid input[type=tel],
.form-grid input[type=password], .form-grid input[type=date], .form-grid input[type=number],
.form-grid textarea, .form-grid select {
    width: 100%; padding: 8px 12px; border: 1px solid #dcdfe6; border-radius: 4px;
    background: #fff; transition: border-color .2s;
}
.form-grid input:focus, .form-grid textarea:focus, .form-grid select:focus {
    outline: none; border-color: #1a3d8f;
}
.form-grid textarea { resize: vertical; min-height: 90px; }
.form-grid .tip { color: #999; font-size: 12px; margin-top: 6px; }
.form-actions { padding-top: 20px; margin-top: 24px; border-top: 1px solid #f0f2f5; padding-left: 140px; }
.form-actions .btn { margin-right: 12px; }

/* 上传 */
.upload-box {
    display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.upload-preview {
    width: 140px; height: 100px; border: 1px dashed #dcdfe6;
    border-radius: 4px; background: #fafbfc center/cover no-repeat;
    display: flex; align-items: center; justify-content: center;
    color: #c0c4cc; font-size: 12px;
}
.upload-box input[type=file] { padding: 6px 0; }

/* 切换按钮 */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { display: none; }
.switch-bg { width: 40px; height: 22px; background: #ccc; border-radius: 22px; position: relative; transition: background .2s; }
.switch-bg::after { content:""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + .switch-bg { background: #67c23a; }
.switch input:checked + .switch-bg::after { transform: translateX(18px); }

/* 登录页 */
.login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0f2655, #1a3d8f, #2a5fb4);
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: ""; position: absolute; inset: 0;
    background: radial-gradient(circle at 30% 40%, rgba(200,22,29,.15), transparent 60%);
}
.login-box {
    background: #fff;
    width: 400px;
    padding: 40px 36px;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    position: relative;
    z-index: 1;
}
.login-box .login-brand { text-align: center; margin-bottom: 26px; }
.login-box .login-brand .brand-mark { margin: 0 auto 14px; width: 56px; height: 56px; font-size: 30px; }
.login-box .login-brand h1 { font-size: 20px; color: #0f2655; letter-spacing: 2px; margin-bottom: 4px; }
.login-box .login-brand p { font-size: 12px; color: #999; letter-spacing: 3px; }
.login-box .form-item { margin-bottom: 18px; }
.login-box .form-item label { display: block; margin-bottom: 6px; color: #606266; font-size: 13px; }
.login-box .form-item input {
    width: 100%; padding: 10px 14px; border: 1px solid #dcdfe6; border-radius: 4px;
    background: #fafbfc; transition: all .2s;
}
.login-box .form-item input:focus { outline: none; border-color: #1a3d8f; background: #fff; }
.login-box .btn-login {
    width: 100%; padding: 12px; background: linear-gradient(135deg, #c8161d, #e63946);
    color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 15px;
    transition: all .2s;
}
.login-box .btn-login:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(200,22,29,.3); }
.login-error { background: #fef0f0; color: #f56c6c; padding: 10px 14px; border-radius: 4px; margin-bottom: 16px; font-size: 13px; text-align: center; }
.login-tip { text-align: center; margin-top: 20px; font-size: 12px; color: #999; }

/* 分页 */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 24px; }
.pagination a, .pagination span {
    padding: 6px 12px; border: 1px solid #dcdfe6; border-radius: 4px;
    color: #606266; text-decoration: none;
}
.pagination a:hover { color: #1a3d8f; border-color: #1a3d8f; }
.pagination .current { background: #1a3d8f; color: #fff; border-color: #1a3d8f; }

/* 工具栏 */
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar .search { flex: 1; max-width: 280px; }
.toolbar input, .toolbar select {
    padding: 7px 12px; border: 1px solid #dcdfe6; border-radius: 4px; background: #fff;
}

/* 响应式 */
@media (max-width: 768px) {
    .sidebar { width: 100%; height: auto; position: relative; }
    .main { margin-left: 0; }
    .stats-grid { grid-template-columns: repeat(2,1fr); }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid label { text-align: left; padding-top: 0; }
    .form-actions { padding-left: 0; }
}

/* ============ 后台自定义 LOGO（纵向精致版） ============ */
/* 含 LOGO 时，brand 改为纵向居中布局 */
.brand.brand-has-logo {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 22px 18px 18px;
}
/* LOGO 白底卡片 — 居中、占满宽度 */
.brand-logo-wrap {
    background: #fff;
    border-radius: 8px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0,0,0,.22);
}
.brand-img {
    max-width: 100%;
    max-height: 46px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}
/* LOGO 下方副标题条 */
.brand-sub {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 14px;
}
.brand-sub-cn {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 3px;
}
.brand-sub-en {
    color: rgba(203,213,224,.65);
    font-size: 10px;
    letter-spacing: 2px;
    padding-left: 10px;
    border-left: 1px solid rgba(255,255,255,.2);
}

/* 登录页 LOGO 图 */
.login-logo-img {
    max-width: 240px;
    max-height: 84px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto 16px;
}

/* 登录页 LOGO 下副标题 */
.login-sub {
    text-align: center;
    color: #999;
    font-size: 12px;
    letter-spacing: 2px;
    margin-top: 4px;
}
