:root {
    color-scheme: light;
    --paper: #f7f3eb;
    --white: #fffdf9;
    --ink: #262017;
    --muted: #62584c;
    --border: #e6ddd0;
    --amber: #884515;
    --amber-dark: #68310e;
    --amber-light: #f5e5d2;
    --shadow: 0 12px 36px rgba(73, 51, 27, .06);
    font-family: system-ui, "Microsoft YaHei", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-size: 14px; line-height: 1.55; }
a { color: var(--amber-dark); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid #b26020;
    outline-offset: 3px;
}
button, input, select, textarea { font: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(28px, 4vw, 42px); line-height: 1.18; letter-spacing: -.035em; }
h2 { font-size: 18px; letter-spacing: -.01em; }
h3 { font-size: 14px; }

.admin { display: grid; grid-template-columns: 218px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: #292219; color: #f4eadd; padding: 26px 16px; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; color: inherit; font-size: 16px; font-weight: 750; }
.sidebar .brand { padding-left: 6px; }
.brand small { display: block; margin-top: 2px; color: #d9c9b5; font-size: 11px; font-weight: 500; letter-spacing: .12em; }
.brand-icon { display: grid; flex: 0 0 39px; width: 39px; height: 39px; place-items: center; border-radius: 11px; background: #8a4819; color: #fff9ef; font-family: "Songti SC", SimSun, serif; font-size: 23px; font-weight: bold; }
.sidebar nav { display: grid; gap: 4px; }
.sidebar nav a { display: block; padding: 9px 11px; border-radius: 7px; color: #f3e8dc; }
.sidebar nav a:hover { background: #3b3126; text-decoration: none; }
.sidebar nav a[aria-current] { background: #6a452b; color: #fff8ec; font-weight: 700; }
.nav-label { margin: 15px 0 2px; padding-left: 11px; color: #c3b39f; font-size: 11px; font-weight: 650; letter-spacing: .12em; }

.topbar { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px clamp(16px, 4vw, 48px); border-bottom: 1px solid var(--border); background: var(--white); color: var(--muted); }
.topbar > span { font-weight: 700; }
.account-menu { display: flex; align-items: center; gap: 14px; }
.account-menu small { margin-left: 5px; color: var(--muted); }
.main { max-width: 1500px; padding: 32px clamp(16px, 4vw, 48px) 56px; margin: 0 auto; }
.page-title { margin: 0 0 23px; }
.page-title p { margin: 4px 0 0; color: var(--muted); }
.with-action { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.card { border: 1px solid var(--border); border-radius: 14px; background: var(--white); box-shadow: var(--shadow); min-width: 0; }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.card-heading h2 { margin: 0; }
.card-heading a { font-size: 13px; font-weight: 680; white-space: nowrap; }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 38px; padding: 7px 13px; border: 1px solid transparent; border-radius: 8px; font-weight: 680; cursor: pointer; text-decoration: none; white-space: nowrap; }
.button:hover { text-decoration: none; }
.button-primary { background: var(--amber); border-color: var(--amber); color: #fff; }
.button-primary:hover { background: var(--amber-dark); }
.button-quiet { border-color: var(--border); background: #fffaf2; color: var(--amber-dark); }
.button-quiet:hover { background: var(--amber-light); }
.alert { margin-bottom: 16px; padding: 10px 13px; border: 1px solid; border-radius: 8px; }
.alert.success { background: #edf5e9; border-color: #cfdfc7; color: #345b2f; }
.alert.error { background: #fcece7; border-color: #edd1c9; color: #822b23; }

.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.metric { display: flex; flex-direction: column; min-width: 0; padding: 16px; color: var(--ink); align-items: flex-start; }
.metric:hover { border-color: #d4ae87; color: var(--amber-dark); text-decoration: none; }
.metric > span { color: var(--muted); font-size: 13px; font-weight: 650; }
.metric strong { margin: 4px 0 8px; font-size: 36px; line-height: 1; font-variant-numeric: tabular-nums; }
.metric small { color: var(--amber-dark); }
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.queue-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--border); color: var(--ink); }
.queue-row:last-child { border-bottom: 0; }
a.queue-row:hover { background: #fdf5e9; }
.queue-row small { display: block; color: var(--muted); overflow-wrap: anywhere; }
time { color: var(--muted); font-size: 13px; white-space: nowrap; }
.empty { margin: 0; padding: 18px; color: var(--muted); }

.filters { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; padding: 15px; border-bottom: 1px solid var(--border); }
label { display: grid; gap: 6px; color: var(--ink); font-weight: 640; }
input:not([type="radio"]), select, textarea { display: block; width: 100%; min-height: 39px; padding: 8px 10px; border: 1px solid #dcd0c0; border-radius: 8px; background: #fff; color: var(--ink); font-weight: 400; }
textarea { resize: vertical; }
.filters label:first-child { flex: 1 1 220px; }
.filter-actions, .form-buttons { display: flex; gap: 8px; }
.table-frame { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 15px; border-bottom: 1px solid var(--border); vertical-align: middle; text-align: left; }
th { background: #faf6ef; color: #554a3d; font-size: 12px; font-weight: 720; white-space: nowrap; }
td { overflow-wrap: anywhere; }
td.table-main { min-width: 140px; }
td strong, td small { display: block; }
td small { color: var(--muted); margin-top: 2px; }
.table-link { font-weight: 680; white-space: nowrap; }
.badge { display: inline-block; margin: 2px 5px 2px 0; border-radius: 999px; padding: 3px 8px; font-size: 12px; font-weight: 680; white-space: nowrap; }
.badge-good { background: #e7f1e4; color: #365a30; }
.badge-amber { background: #f7e9cf; color: #794714; }
.badge-red { background: #f7e5df; color: #86342a; }
.badge-muted { background: #eeeae2; color: #62584c; }
.pagination { display: flex; justify-content: space-between; align-items: center; min-height: 62px; padding: 10px 15px; color: var(--muted); }

.back-link { display: inline-block; margin-bottom: 12px; font-weight: 700; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr); align-items: start; gap: 16px; }
.definition { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 16px 18px; }
.definition dt { color: var(--muted); font-size: 12px; }
.definition dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.content-section { margin: 0 18px; padding: 14px 0; border-top: 1px solid var(--border); }
.content-section h3 { margin-bottom: 6px; }
.content-section p { margin-bottom: 0; }
.preserve { white-space: pre-wrap; overflow-wrap: anywhere; }
.gallery { display: flex; flex-wrap: wrap; gap: 9px; }
.gallery img { width: 92px; height: 82px; object-fit: cover; border-radius: 7px; border: 1px solid var(--border); background: var(--paper); }
.related-links { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--border); }
.history { margin-top: 16px; }
.stack { display: grid; gap: 14px; }
.form-inset { padding: 16px 18px 20px; }
.form-card { max-width: 710px; padding: 21px; }
.form-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.hint { margin: 0; color: var(--muted); font-size: 13px; }
fieldset { min-width: 0; padding: 0; margin: 0; border: 0; }
legend { margin-bottom: 8px; font-weight: 750; }
.option { display: flex; align-items: flex-start; gap: 10px; margin-top: 8px; padding: 13px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.option input { margin-top: 4px; accent-color: var(--amber); }
.option small { display: block; margin-top: 3px; color: var(--muted); font-weight: 400; }
.guest-shell { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(ellipse at 20% 8%, #f6dfc2, transparent 52%), var(--paper); }
.login-card, .error-card { width: 100%; max-width: 430px; padding: 28px; }
.login-card h1, .error-card h1 { margin-bottom: 17px; font-size: 29px; }
.guest-brand small { color: var(--muted); }
.login-card .button-primary { width: 100%; margin-top: 3px; }

@media (max-width: 1050px) {
    .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
    .admin { display: block; }
    .sidebar { padding: 13px 14px; }
    .sidebar .brand { margin: 0 0 9px; padding: 0; }
    .sidebar nav { display: flex; flex-wrap: wrap; gap: 3px; }
    .sidebar nav a { padding: 5px 8px; font-size: 12px; }
    .nav-label { display: none; }
    .topbar { min-height: 52px; }
    .main { padding-top: 20px; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-grid, .detail-grid { grid-template-columns: 1fr; }
    th, td { padding: 9px 10px; }
    .queue-row small { font-size: 12px; }
}
