* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.6 -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; color: #1f2937; background: #f3f5f9; }
a { color: #2563eb; text-decoration: none; }
pre { white-space: pre-wrap; word-break: break-all; background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 6px; padding: 10px; margin: 6px 0 12px; font-family: inherit; }
.muted { color: #6b7280; }
.break { word-break: break-all; }
.nowrap { white-space: nowrap; }
.text-green { color: #16a34a; font-weight: 600; }
.text-red { color: #dc2626; font-weight: 600; }

/* 布局 */
.sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 200px; background: #111827; color: #fff; }
.sidebar .brand { height: 56px; line-height: 56px; padding: 0 20px; font-size: 18px; font-weight: 600; border-bottom: 1px solid #1f2937; }
.sidebar nav a { display: block; padding: 12px 20px; color: #cbd5e1; border-left: 3px solid transparent; }
.sidebar nav a:hover { background: #1f2937; color: #fff; }
.sidebar nav a.active { background: #1f2937; color: #fff; border-left-color: #3b82f6; }
.main { margin-left: 200px; min-height: 100vh; }
.topbar { height: 56px; background: #fff; border-bottom: 1px solid #e5e7eb; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; }
.topbar h2 { margin: 0; font-size: 16px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.inline-form { display: inline; margin: 0; }
.content { padding: 20px; }
.card { background: #fff; border-radius: 8px; padding: 20px; margin-bottom: 20px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.card h3 { margin: 0 0 16px; font-size: 15px; }
.card.narrow { max-width: 480px; }

/* 表单 */
.form label { display: block; margin-bottom: 14px; color: #374151; }
.form input[type=text], .form input[type=number], .form input[type=password], .form textarea,
.search input, .login-box input[type=text], .login-box input[type=password] {
    display: block; width: 100%; margin-top: 6px; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font: inherit; background: #fff;
}
.form input[readonly] { background: #f3f4f6; color: #6b7280; }
.form textarea { resize: vertical; }
.form-row { display: flex; gap: 16px; }
.form-row label { flex: 1; }
.search { display: flex; gap: 10px; margin-bottom: 16px; max-width: 480px; }
.search input { margin-top: 0; }

/* 按钮 */
.btn { display: inline-block; padding: 7px 16px; border: 1px solid #d1d5db; border-radius: 6px; background: #fff; color: #374151; cursor: pointer; font: inherit; white-space: nowrap; }
.btn:hover { filter: brightness(.96); }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.btn-sm { padding: 3px 10px; font-size: 13px; }
.btn-block { display: block; width: 100%; }
.btn-primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn-success { background: #16a34a; border-color: #16a34a; color: #fff; }
.btn-warning { background: #eab308; border-color: #eab308; color: #fff; }
.btn-danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn-group { display: flex; gap: 10px; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 8px; border-bottom: 1px solid #eef0f3; text-align: left; vertical-align: middle; }
th { background: #f9fafb; color: #6b7280; font-weight: 500; white-space: nowrap; }
td.empty { text-align: center; color: #9ca3af; padding: 30px; }
.user-cell { line-height: 1.5; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 4px; color: #fff; font-size: 12px; white-space: nowrap; }
.tag.blue { background: #3b82f6; }
.tag.yellow { background: #eab308; }
.tag.green { background: #16a34a; }
.tag.red { background: #dc2626; }
.tag.gray { background: #9ca3af; }

.pager { display: flex; align-items: center; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.pager a { padding: 4px 10px; border: 1px solid #e5e7eb; border-radius: 4px; color: #374151; }
.pager a.active { background: #2563eb; border-color: #2563eb; color: #fff; }

/* 开关 */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: #dc2626; border-radius: 22px; cursor: pointer; transition: .2s; }
.slider::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: #16a34a; }
.switch input:checked + .slider::before { transform: translateX(18px); }
.switch-label { margin-left: 6px; font-size: 12px; color: #6b7280; }

/* 弹窗 */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 40px 10px; }
.modal.show { display: flex; }
.modal-box { background: #fff; border-radius: 8px; width: 560px; max-width: 100%; padding: 0 20px 20px; }
.modal-head { position: relative; padding: 16px 30px 16px 0; font-size: 16px; font-weight: 600; border-bottom: 1px solid #eef0f3; margin-bottom: 16px; }
.modal-close { position: absolute; right: 0; top: 10px; border: 0; background: none; font-size: 24px; cursor: pointer; color: #9ca3af; }
.modal-body p { margin: 6px 0; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.thumbs img { width: 96px; height: 96px; object-fit: cover; border-radius: 6px; border: 1px solid #e5e7eb; }
.hidden { display: none !important; }

.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); padding: 10px 20px; border-radius: 6px; color: #fff; background: #111827; z-index: 200; display: none; max-width: 90%; }
.toast.show { display: block; }
.toast.ok { background: #16a34a; }
.toast.err { background: #dc2626; }

/* 登录 */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #1e3a8a, #111827); }
.login-box { width: 360px; max-width: 92%; background: #fff; border-radius: 10px; padding: 30px; }
.login-box h1 { margin: 0 0 20px; text-align: center; font-size: 20px; }
.login-box label { display: block; margin-bottom: 14px; }
.captcha-row { display: flex; gap: 10px; align-items: center; }
.captcha-row input { margin-top: 6px; }
.captcha-row img { width: 120px; height: 40px; margin-top: 6px; cursor: pointer; border-radius: 4px; flex-shrink: 0; }
.alert { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; padding: 8px 12px; border-radius: 6px; margin-bottom: 14px; }

@media (max-width: 768px) {
    .sidebar { position: static; width: auto; }
    .sidebar nav { display: flex; overflow-x: auto; }
    .sidebar nav a { border-left: 0; border-bottom: 3px solid transparent; white-space: nowrap; }
    .sidebar nav a.active { border-bottom-color: #3b82f6; }
    .main { margin-left: 0; }
    .topbar { height: auto; flex-wrap: wrap; gap: 8px; padding: 10px 20px; }
    .form-row { flex-direction: column; gap: 0; }
}
