:root {
    font-family: Inter, "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
    color: #192332;
    background: #f4f6f8;
    font-synthesis: none;
    --ink: #192332;
    --muted: #566475;
    --line: #e4e9ef;
    --accent: #c64c0a;
    --accent-hover: #a83c06;
    --soft: #fff2e8;
    --white: #fff;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-size: 14px; line-height: 1.5; min-width: 260px; }
h1, h2, p, form, dl, dd { margin: 0; }
h1 { font-size: 22px; line-height: 1.3; }
h2 { font-size: 17px; line-height: 1.35; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.admin-shell { width: min(1320px, calc(100% - 64px)); margin: 32px auto; display: grid; gap: 20px; }
.panel { min-width: 0; background: var(--white); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 3px 12px #19233206; }
.top-panel { padding: 22px 24px 0; }
.top-row, .section-head, .pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand, .claim-header { display: flex; align-items: center; gap: 13px; }
.brand p, .claim-header p { color: var(--muted); margin-top: 3px; }
.brand-mark, .claim-mark {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    border-radius: 50%;
    background: #f57829;
    color: #331500;
    font-size: 20px;
    font-weight: 750;
}
.tabs { display: flex; gap: 5px; flex-wrap: wrap; margin: 20px 0 0; padding-bottom: 14px; }
.tabs a { display: inline-flex; align-items: center; text-decoration: none; padding: 9px 15px; min-height: 40px; color: var(--muted); border-radius: 6px; font-weight: 650; }
.tabs a:hover { color: var(--accent); background: var(--soft); }
.tabs a[aria-current] { color: #782c06; background: #ffe3d1; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 8px 14px;
    border: 1px solid transparent;
    border-radius: 6px;
    text-decoration: none;
    white-space: nowrap;
    font-weight: 650;
}
.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.primary:hover:enabled { background: var(--accent-hover); border-color: var(--accent-hover); }
.outline { color: var(--ink); background: #fff; border-color: #d8dfe7; }
.outline:hover { background: #f5f7fa; }
.small { min-height: 33px; padding: 5px 10px; font-size: 13px; }
.danger { color: #9b2733; }
.wide { width: 100%; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.dashboard-date-filter label { display: inline-flex; align-items: center; max-width: 100%; white-space: nowrap; }
.dashboard-date-filter input[type="date"] { width: auto; max-width: 100%; }
.metric { padding: 20px; display: grid; gap: 3px; color: var(--muted); }
.metric-icon { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 8px; font-size: 20px; color: #fff; margin-bottom: 8px; }
.violet { background: #6058b5; }
.teal { background: #0c7966; }
.rose { background: #a93663; }
.amber { background: #bd5314; }
.metric strong { font-size: 32px; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.table-panel { padding: 20px 24px; }
.table-panel > .section-head, .claim-panel > .section-head { margin-bottom: 16px; flex-wrap: wrap; }
.table-search { margin-bottom: 14px; }
.table-search input[type="search"] { flex: 1 1 240px; max-width: 360px; }
.table-search select { width: auto; max-width: 100%; }
.bulk-delete-actions { margin-bottom: 12px; }
.row-select { width: 1%; text-align: center; }
.row-select input[type="checkbox"] { width: 16px; height: 16px; min-height: 0; margin: 0; vertical-align: middle; }
.table-sort { display: inline-flex; align-items: center; gap: 5px; color: inherit; text-decoration: none; }
.table-sort:hover, th[aria-sort] .table-sort { color: var(--accent); }
.table-sort span { font-size: .9em; }
.table-scroll { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; font-variant-numeric: tabular-nums; }
th, td { padding: 12px 13px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: #415065; background: #f6f8fb; font-size: 13px; }
tr:last-child td { border-bottom: 0; }
td .actions { flex-wrap: nowrap; }
td.empty { padding: 33px 15px; text-align: center; color: var(--muted); }
.strong { font-weight: 650; }
.muted, .pager { color: var(--muted); }
.pager { margin-top: 14px; font-size: 13px; flex-wrap: wrap; }
.pager-links { gap: 5px; }
.pager-number { min-width: 30px; font-variant-numeric: tabular-nums; }
.pager-number.current { background: var(--soft); color: var(--accent); border-color: #f1c5a9; }
.pager-gap { padding-inline: 2px; }
.pager-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.pager-controls label { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.pager-controls input[type="number"] { width: 74px; min-height: 33px; padding: 4px 6px; }
.badge { display: inline-block; padding: 3px 8px; border-radius: 5px; font-size: 12px; white-space: nowrap; font-weight: 700; }
.gray { background: #edf1f5; color: #48556a; }
.blue { background: #e9f1ff; color: #174e9c; }
.green { background: #e0f5ed; color: #13654e; }
.orange { background: #fff0e4; color: #883707; }
.red { background: #fff0f1; color: #982735; }
.card-link { font-family: ui-monospace, Consolas, monospace; }
.occupancy-account { min-width: 0; overflow-wrap: anywhere; }
.occupancy-description { margin: 14px 0; }
.occupancy-cards td .card-link { display: inline-block; max-width: 25em; white-space: normal; overflow-wrap: break-word; }
.shortcut-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.shortcut-list a { display: flex; justify-content: space-between; gap: 5px; align-items: center; min-height: 46px; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; color: var(--ink); text-decoration: none; font-weight: 650; }
.shortcut-list a:hover { color: var(--accent); border-color: #efbf9f; background: var(--soft); }
.shortcut-list span { color: var(--accent); }

.notice { padding: 11px 14px; border: 1px solid transparent; border-radius: 6px; }
.success { background: #effaf4; color: #12563f; border-color: #c5e8d7; }
.error { background: #fff4f3; color: #8b2731; border-color: #f1cccf; }
label, .stack { display: grid; gap: 15px; }
.dispatch-limits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; min-width: 0; margin: 0; padding: 0; border: 0; }
.dispatch-limits legend { margin-bottom: 8px; padding: 0; }
.dispatch-limits label { gap: 6px; }
label { gap: 6px; color: var(--ink); font-weight: 650; }
input, select, textarea { min-width: 0; width: 100%; border: 1px solid #ccd6e1; border-radius: 6px; min-height: 42px; padding: 8px 10px; background: #fff; color: var(--ink); font-weight: 400; }
textarea { resize: vertical; }
dialog { width: min(510px, calc(100% - 28px)); max-height: calc(100% - 28px); padding: 22px; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 18px 65px #19233230; }
dialog::backdrop { background: #1e283b69; }
.dialog-actions { justify-content: flex-end; }
.login-shell { width: min(430px, calc(100% - 32px)); margin: min(12vh, 100px) auto 30px; }
.login-panel { padding: 25px; display: grid; gap: 20px; }
.return-link { justify-self: start; }
.toast { position: fixed; z-index: 5; bottom: 24px; left: 50%; transform: translateX(-50%); background: #192332; color: #fff; padding: 9px 15px; border-radius: 6px; max-width: calc(100% - 30px); }
.clipboard-input { position: fixed; left: -9999px; top: 0; }

.mail-record-fields { display: grid; gap: 6px; margin-bottom: 16px; }
.mail-record-fields > div { display: grid; grid-template-columns: 5.5em minmax(0, 1fr); gap: 6px; }
.mail-record-fields dt { color: var(--muted); }
.mail-record-fields dd, .mail-record-body { overflow-wrap: anywhere; }
.mail-record-body { white-space: pre-wrap; padding: 14px; border: 1px solid var(--line); border-radius: 6px; }
.archive-sync { min-width: 0; max-width: 100%; }
.archive-sync select { width: auto; max-width: 100%; }
.archive-sync button { gap: 6px; }

.claim-page { --accent: #215fc4; --accent-hover: #194da4; --line: #dfe5eb; background: #f7f8fa; }
.claim-shell { width: min(900px, calc(100% - 56px)); margin: 52px auto 38px; }
.claim-header { padding: 0 0 20px; border-bottom: 1px solid var(--line); }
.claim-header h1 { flex: 1; font-size: 22px; }
.claim-mark { width: 40px; height: 40px; flex-basis: 40px; border-radius: 8px; background: #163b70; color: #fff; }
.claim-icon { display: block; width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.claim-mark .claim-icon { width: 21px; height: 21px; }
.claim-page .tool-button { display: grid; place-items: center; padding: 0; width: 38px; min-height: 38px; flex: 0 0 38px; }
.claim-page .small { gap: 6px; }
.claim-page .small .claim-icon { width: 15px; height: 15px; }
.claim-layout { display: grid; grid-template-columns: minmax(240px, .7fr) minmax(0, 1.3fr); gap: 34px; padding-top: 23px; }
.claim-page .claim-shell > .claim-layout:first-child { padding-top: 0; }
.claim-layout:not(:has(.claim-flow)) { grid-template-columns: minmax(0, 420px); }
.claim-flow, .claim-panel { min-width: 0; }
.claim-flow { display: grid; gap: 27px; }
.claim-summary { align-self: start; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.claim-panel > .section-head { margin-bottom: 12px; }
.claim-panel h2 { font-size: 16px; }
.claim-panel > .account-heading { justify-content: flex-start; gap: 8px 14px; }
.account-heading h2 { flex-shrink: 0; }
.login-reminder { display: flex; align-items: center; gap: 7px; max-width: 100%; min-width: 0; padding: 6px 10px; border: 1px solid #ffd397;  border-radius: 8px; background: linear-gradient(100deg, #fff8ed, #ffebc8); color: #9a5000; font-size: 13px; font-weight: 700; line-height: 1.5; }
.login-reminder-icon { display: grid; place-items: center; flex: 0 0 18px; width: 18px; height: 18px; border-radius: 50%; background: linear-gradient(#ffb84d, #ff8b0a); box-shadow: 0 1px 4px #ff9b3340; color: #fff; font-size: 13px; line-height: 1; }
.login-reminder > span:last-child { min-width: 0; overflow-wrap: anywhere; white-space: pre-line; }
.claim-info { display: grid; gap: 1px; font-variant-numeric: tabular-nums; }
.claim-info div { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 3px 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.claim-info dt, .credential-row small { display: block; color: var(--muted); font-size: 12px; }
.claim-info dd { font-weight: 650; overflow-wrap: anywhere; }
.claim-panel > .button { margin-top: 12px; }
.claim-message { color: var(--muted); margin-top: 9px; }
.claim-message:empty { display: none; }
.open-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; }
.credential-row, .code-result { display: flex; align-items: center; gap: 8px; }
.credential-row { border-top: 1px solid var(--line); padding: 9px 0; }
.credential-row > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.credential-row strong { display: block; font-family: ui-monospace, Consolas, monospace; margin-top: 2px; }
#verification-panel { border-top: 1px solid var(--line); padding-top: 16px; }
.verification-status { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; }
.verification-status:has(#verification-hint:empty) { display: none; }
#verification-countdown { min-width: 4.1em; text-align: right; color: var(--accent); font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.code-result { flex-wrap: wrap; justify-content: space-between; background: #eaf3fe; border: 1px solid #d5e5fb; padding: 10px 12px; border-radius: 6px; }
.code-result output { max-width: 100%; font: 700 23px/1.15 ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }
.history-list { margin: 12px 0 0; padding: 0; list-style: none; font-variant-numeric: tabular-nums; }
.history-list:empty { display: none; }
.history-list li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 10px; border-top: 1px solid var(--line); padding: 10px 0; }
.history-list small { width: 100%; color: var(--muted); }
.history-code { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; width: 100%; }
.history-code code { min-width: 0; font: 700 16px/1.4 ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }

@media (max-width: 720px) {
    .admin-shell { width: calc(100% - 28px); margin: 14px auto; gap: 14px; }
    .top-panel, .table-panel { padding: 14px; }
    .top-panel { padding-bottom: 0; }
    .top-row { flex-wrap: wrap; }
    .tabs { margin-top: 14px; gap: 3px; }
    .tabs a { padding: 6px 9px; min-height: 38px; font-size: 13px; }
    .metrics, .shortcut-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .metric { padding: 14px; }
    .metric strong { font-size: 27px; }
    .claim-shell { margin: 10px auto; width: calc(100% - 28px); }
    .claim-header { padding-bottom: 13px; }
    .claim-header h1 { font-size: 20px; }
    .claim-layout, .claim-layout:not(:has(.claim-flow)) { grid-template-columns: minmax(0, 1fr); gap: 19px; padding-top: 14px; }
    .claim-flow { gap: 17px; }
}
