:root {
    color-scheme: light;
    --canvas: #f5f7fa;
    --white: #fff;
    --ink: #203247;
    --muted: #536477;
    --border: #e1e8ef;
    --blue: #2c4560;
    --blue-dark: #23394f;
    --blue-light: #eaf0f6;
    font-family: system-ui, "Microsoft YaHei", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-size: 14px; line-height: 1.55; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1 { font-size: clamp(24px, 3vw, 32px); line-height: 1.25; }
h2 { font-size: 17px; }
h3 { font-size: 16px; }
a { color: var(--blue); text-decoration: none; }
button, input { font: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible {
    outline: 2px solid #4e78a1;
    outline-offset: 3px;
}

.guest-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: radial-gradient(ellipse at top, #eaf0f6 0, transparent 68%), var(--canvas);
}
.card { min-width: 0; border: 1px solid var(--border); border-radius: 15px; background: var(--white); }
.login-card, .error-card {
    width: min(100%, 418px);
    padding: clamp(22px, 5vw, 34px);
    box-shadow: 0 16px 42px rgba(35, 57, 79, .08);
}
.login-card h1, .error-card h1 { margin: 24px 0 18px; font-size: 26px; }
.error-card h1 { margin-top: 0; }
.stack { display: grid; gap: 14px; }
.stack > .button { width: 100%; margin-top: 4px; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 650; }
input:not([type="hidden"]) {
    width: 100%;
    min-height: 42px;
    padding: 8px 11px;
    border: 1px solid #ced9e4;
    border-radius: 8px;
    background: var(--white);
    color: var(--ink);
    font-weight: 400;
}
input::placeholder { color: #657689; }
.alert {
    margin-bottom: 15px;
    padding: 10px 12px;
    border: 1px solid #efd1ca;
    border-radius: 8px;
    background: #fff2ee;
    color: #8b3125;
}
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 39px;
    padding: 6px 13px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-weight: 650;
    cursor: pointer;
    white-space: nowrap;
}
.button-primary { background: var(--blue); color: var(--white); }
.button-primary:hover { background: var(--blue-dark); }
.button-quiet { border-color: var(--border); background: var(--white); color: var(--blue); }
.button-quiet:hover { background: var(--blue-light); }

.admin { display: grid; grid-template-columns: 234px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    min-height: 100vh;
    padding: 23px 16px;
    background: var(--blue-dark);
    color: #f4f7fb;
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; font-size: 16px; font-weight: 750; }
.brand-icon {
    display: grid;
    flex: 0 0 37px;
    height: 37px;
    place-items: center;
    border-radius: 10px;
    background: var(--blue);
    color: var(--white);
    font-size: 17px;
}
.sidebar .brand { padding: 0 5px; }
.sidebar .brand-icon { background: #3d5975; }
.brand small { display: block; color: #bfd0e0; font-size: 12px; font-weight: 500; }
.sidebar nav { display: grid; gap: 4px; margin-top: 32px; }
.nav-label { margin-bottom: 4px; padding: 0 11px; color: #c2d1df; font-size: 12px; font-weight: 650; }
.sidebar nav a { padding: 9px 11px; border-radius: 8px; color: #e4edf5; }
.sidebar nav a:hover { background: #314a63; }
.sidebar nav a[aria-current="page"] { background: #415e7b; color: var(--white); font-weight: 750; }
.sidebar a:focus-visible { outline-color: #abc9e4; }
.topbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    min-height: 65px;
    padding: 10px clamp(16px, 4vw, 44px);
    border-bottom: 1px solid var(--border);
    background: var(--white);
}
.account-menu { display: flex; align-items: center; gap: 12px; min-width: 0; }
.account-menu form { margin: 0; }
.account-name { color: var(--muted); font-weight: 650; overflow-wrap: anywhere; }
.main { max-width: 1400px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 44px) 44px; }
.main > h1 { margin-bottom: 19px; }
.card-heading { padding: 17px 20px; border-bottom: 1px solid var(--border); }
.empty { display: grid; min-height: 174px; place-items: center; padding: 28px 18px; color: var(--muted); text-align: center; }
.shop-row { padding: 19px 20px; overflow-wrap: anywhere; }
.shop-row + .shop-row, .pagination { border-top: 1px solid var(--border); }
.shop-heading { display: grid; gap: 3px; }
.muted { color: var(--muted); }
.shop-about { margin-top: 12px; white-space: pre-wrap; }
.contact-list { display: grid; gap: 5px; margin-top: 10px; }
.contact-list > div { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.contact-list dt { min-width: 4em; color: var(--muted); }
.review-form { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 15px; }
.review-form label { flex: 1 1 210px; max-width: 430px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pagination { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 20px; }

@media (max-width: 720px) {
    .admin { display: block; }
    .sidebar { position: static; min-height: 0; padding: 14px 16px 12px; }
    .sidebar .brand { padding: 0; }
    .sidebar nav { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 13px; }
    .nav-label { display: none; }
    .sidebar nav a { padding: 7px 10px; }
    .topbar { min-height: 54px; padding-block: 7px; }
    .main { padding-top: 22px; }
    .card-heading, .shop-row, .pagination { padding-inline: 15px; }
}

.topbar { justify-content: space-between; }
.topbar-context { color: var(--muted); font-weight: 650; }
.account-name > span { margin-left: 6px; color: #62758a; font-size: 12px; }
.account-name:hover, .record-link:hover, .back-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.success { margin-bottom: 16px; padding: 9px 13px; border: 1px solid #c6e3d5; border-radius: 8px; background: #edf8f2; color: #275240; }
.page-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 19px; }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-heading a, .record-link, .back-link { font-weight: 700; }
.record-link, .card-heading a { white-space: nowrap; }
.back-link { display: inline-block; margin-bottom: 10px; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 11px; margin-bottom: 18px; }
.metric { display: grid; gap: 4px; padding: 13px 15px; }
.metric span { color: var(--muted); font-size: 13px; font-weight: 650; }
.metric strong { font-size: 27px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.metric:hover { border-color: #8199b0; background: #f8fafc; }
.queue-grid, .detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.detail-grid { grid-template-columns: minmax(0, 3fr) minmax(238px, 2fr); }
.queue-empty, .queue-row, .history-row { padding: 13px 17px; }
.queue-empty, .queue-row time, .history-row span { color: var(--muted); }
.queue-row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 5px 12px; border-bottom: 1px solid var(--border); }
.queue-row:last-child { border-bottom: 0; }
.queue-row:hover, tbody tr:hover { background: #f6f9fc; }
.queue-row strong, .definition dd, .preserve { overflow-wrap: anywhere; }
time { white-space: nowrap; }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.filters label { min-width: 145px; }
.filters label:has(input) { flex: 1 1 210px; }
select, textarea {
    width: 100%; min-height: 42px; padding: 8px 11px; border: 1px solid #ced9e4;
    border-radius: 8px; background: var(--white); color: var(--ink); font: inherit; font-weight: 400;
}
select:focus-visible, textarea:focus-visible { outline: 2px solid #4e78a1; outline-offset: 3px; }
textarea { resize: vertical; }
.table-frame { overflow-x: auto; }
table { width: 100%; min-width: 590px; border-collapse: collapse; text-align: left; }
th, td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { background: #f7f9fc; color: var(--muted); font-size: 13px; white-space: nowrap; }
td strong { overflow-wrap: anywhere; }
td small { display: block; color: var(--muted); }
td.empty { display: table-cell; height: 120px; }
.badge { display: inline-block; margin: 2px 3px 2px 0; padding: 3px 8px; border-radius: 999px; background: #eef2f6; color: #43576c; font-size: 12px; white-space: nowrap; }
.badge-review { background: #e6eff9; color: #274b6f; }
.pagination { align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); border-top: 0; }
.definition { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 16px 18px; }
.definition dt { font-size: 12px; color: var(--muted); }
.definition dd { margin-top: 3px; font-weight: 600; }
.detail-body { margin: 0 18px; padding: 14px 0; border-top: 1px solid var(--border); }
.detail-body h3 { margin-bottom: 7px; }
.preserve { white-space: pre-wrap; }
.gallery { display: flex; flex-wrap: wrap; gap: 8px; }
.gallery img { display: block; width: 112px; height: 85px; object-fit: cover; border: 1px solid var(--border); border-radius: 8px; }
.history { margin-top: 15px; }
.history-row + .history-row { border-top: 1px solid var(--border); }
.history-row span { margin-left: 8px; }
.history-row p { margin-top: 4px; }
.inset { padding: 16px 18px; }
.form-panel { max-width: 720px; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 7px; font-weight: 700; }
.radio-option { display: flex; align-items: center; gap: 9px; padding: 8px 0; }
.radio-option input[type="radio"] { width: auto; min-height: 0; margin: 0; accent-color: var(--blue); }
@media (max-width: 720px) {
    .queue-grid, .detail-grid { grid-template-columns: 1fr; }
    .filters { padding-inline: 13px; }
}
