* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    background: #f4f6f9;
    color: #243044;
    font-size: 14px;
}
a { color: inherit; text-decoration: none; }
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: #1f2937; color: #d1d5db; flex-shrink: 0; }
.brand { padding: 22px 20px; font-size: 18px; font-weight: 700; color: #fff; border-bottom: 1px solid #374151; }
.brand small { display: block; margin-top: 6px; font-size: 12px; color: #9ca3af; font-weight: 400; }
.menu { padding: 12px 10px; }
.menu a { display: block; padding: 11px 14px; border-radius: 8px; margin-bottom: 4px; font-size: 14px; }
.menu a:hover, .menu a.active { background: #374151; color: #fff; }
.menu-group { margin-bottom: 4px; }
.menu-group > summary {
    display: flex; align-items: center; justify-content: space-between;
    padding: 11px 14px; border-radius: 8px; font-size: 14px; cursor: pointer; list-style: none;
}
.menu-group > summary::-webkit-details-marker { display: none; }
.menu-group > summary::after {
    content: ''; width: 0; height: 0;
    border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor;
    transition: transform .15s;
}
.menu-group:not([open]) > summary::after { transform: rotate(-90deg); }
.menu-group > summary:hover, .menu-group > summary.active { background: #374151; color: #fff; }
.menu-children { padding: 2px 0 4px; }
.menu-children a { display: block; padding: 9px 14px 9px 30px; font-size: 13px; color: #9ca3af; }
.menu-children a:hover, .menu-children a.active { background: #374151; color: #fff; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    height: 60px; background: #fff; border-bottom: 1px solid #e5e7eb;
    display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
}
.topbar .title { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 15px; font-weight: 600; }
.breadcrumb-home { color: #334155; }
.breadcrumb-home:hover { color: #2563eb; }
.breadcrumb-sep { color: #cbd5e1; font-weight: 400; }
.breadcrumb-path { min-width: 0; color: #475569; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .user { font-size: 13px; color: #6b7280; display: flex; align-items: center; gap: 14px; }
.topbar .user button { border: 0; background: transparent; color: #6b7280; cursor: pointer; font-size: 13px; }
.topbar .user a { color: #2563eb; }
.content { padding: 24px; }
.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.flash.success { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.flash.error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.card { background: #fff; border-radius: 12px; box-shadow: 0 1px 2px rgba(16,24,40,.06); padding: 20px; margin-bottom: 16px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; margin: 0; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.muted { color: #6b7280; font-size: 13px; }
.btn {
    display: inline-block; padding: 9px 14px; border-radius: 8px; border: 1px solid #d1d5db;
    background: #fff; color: #374151; cursor: pointer; font-size: 14px; line-height: 1.2;
}
.btn.primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn.danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn.small { padding: 5px 9px; font-size: 13px; }
.btn:hover { opacity: .9; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.form-group { margin-bottom: 16px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { display: block; margin-bottom: 6px; color: #374151; font-weight: 600; font-size: 13px; }
.form-group .hint { margin-top: 5px; color: #6b7280; font-size: 12px; }
input[type=text], input[type=password], input[type=number], input[type=email], select, textarea {
    width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 8px;
    background: #fff; color: #243044; font-size: 14px; font-family: inherit;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
input[readonly] { background: #f8fafc; color: #6b7280; }
.checkbox-list { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 10px 12px; border: 1px solid #e5e7eb; border-radius: 8px; background: #fafafa; max-height: 260px; overflow-y: auto; }
.checkbox-list label { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; color: #374151; }
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filter-bar .item { min-width: 140px; }
.filter-bar .item label { display: block; margin-bottom: 5px; color: #6b7280; font-size: 12px; }
.filter-bar .item input, .filter-bar .item select { height: 38px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid #eef2f7; font-size: 14px; vertical-align: middle; }
th { background: #f8fafc; color: #475569; font-weight: 600; white-space: nowrap; }
tr:hover td { background: #f8fafc; }
td.actions { white-space: nowrap; }
td.actions form { display: inline; margin: 0; }
td.actions button, td.actions a.link { border: 0; background: transparent; color: #2563eb; cursor: pointer; font-size: 14px; padding: 0; margin-right: 10px; }
td.actions button.danger { color: #dc2626; }
.tag { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 12px; }
.tag.on { background: #ecfdf5; color: #047857; }
.tag.off { background: #fef2f2; color: #b91c1c; }
.tag.warn { background: #fffbeb; color: #b45309; }
.tag.info { background: #eff6ff; color: #1d4ed8; }
.pagination { margin-top: 18px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pagination ul { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0; flex-wrap: wrap; }
.pagination li a, .pagination li span { display: inline-block; padding: 7px 11px; border: 1px solid #e5e7eb; border-radius: 7px; background: #fff; font-size: 13px; }
.pagination li.active span { background: #2563eb; color: #fff; border-color: #2563eb; }
.pagination-total { color: #6b7280; font-size: 13px; }
.empty { text-align: center; color: #9ca3af; padding: 30px 0; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: #fff; border-radius: 12px; padding: 18px; box-shadow: 0 1px 2px rgba(16,24,40,.06); }
.stat .label { color: #6b7280; font-size: 13px; margin-bottom: 8px; }
.stat .value { font-size: 26px; font-weight: 700; color: #111827; }
.stat .sub { color: #9ca3af; font-size: 12px; margin-top: 6px; }
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.rich-content { line-height: 1.9; word-break: break-word; white-space: pre-wrap; }
.rich-content img, .rich-content video { max-width: 100%; height: auto; }
.rich-content a { color: #2563eb; text-decoration: underline; word-break: break-all; }
.identity { display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #e0e7ff; color: #3730a3; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #eff6ff, #f8fafc); padding: 20px; }
.login-card { width: 380px; max-width: 100%; background: #fff; border-radius: 16px; box-shadow: 0 20px 50px rgba(15,23,42,.12); padding: 30px; }
.login-card h1 { margin: 0 0 6px; font-size: 22px; text-align: center; }
.login-card .sub { text-align: center; color: #6b7280; margin-bottom: 22px; }
.login-card .captcha-row { display: flex; gap: 10px; align-items: center; }
.login-card .captcha-row img { height: 38px; border: 1px solid #e5e7eb; border-radius: 8px; cursor: pointer; }
.login-card .btn { width: 100%; }
.print-page { background: #fff; color: #111; padding: 24px; font-family: "Microsoft YaHei", sans-serif; }
.print-page .print-toolbar { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 16px; }
.print-page h1 { text-align: center; font-size: 20px; margin: 6px 0 18px; }
.print-page table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.print-page th, .print-page td { border: 1px solid #999; padding: 7px 8px; font-size: 14px; vertical-align: top; }
.print-page .noborder, .print-page .noborder td { border: 0; }
.print-page .section-title { font-weight: 700; margin: 16px 0 8px; }
.print-page .content-block { line-height: 1.9; word-break: break-word; white-space: pre-wrap; }
.print-page .meta { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 8px; }
@media (max-width: 900px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .layout { display: block; }
    .sidebar { width: 100%; }
    .menu { max-height: 45vh; overflow-y: auto; }
    .content { padding: 14px; }
    .form-grid { grid-template-columns: 1fr; }
    .topbar { padding: 0 14px; }
    .topbar .user span.identity-text { display: none; }
}
@media print {
    body { background: #fff; }
    .print-toolbar { display: none !important; }
    .print-page { padding: 0; }
    .print-page table { page-break-inside: auto; }
    .print-page tr { page-break-inside: avoid; }
}
