:root{font-family:system-ui,"Microsoft Yahei",sans-serif;color:#192d42;background:#f3f6fa}*{box-sizing:border-box}body{margin:0}header{background:#102b43;color:#fff;padding:22px 5%;display:flex;justify-content:space-between;align-items:center}header strong{font-size:23px}header span{font-size:15px;font-weight:400;margin-left:14px;color:#bdd1df}main{max-width:1250px;margin:36px auto;padding:0 22px}h1{font-size:30px;letter-spacing:-1px;margin:0 0 10px}p{color:#697d90;line-height:1.7}button,input,select,textarea{font:inherit;border-radius:7px;border:1px solid #ccd7e1;padding:10px 13px}button{cursor:pointer;background:#087f86;color:white;border-color:transparent}button:hover{filter:brightness(.92)}button:disabled{opacity:.5;cursor:default}input,select,textarea{background:white;min-width:0}label{display:block}label input{margin:8px 0}input[type=checkbox]{accent-color:#087f86}#login{max-width:470px;background:#fff;border:1px solid #e1e8ee;border-radius:14px;padding:36px;margin:80px auto}#login input{width:100%}#login button{width:100%;margin-top:15px}.heading,.batch,.pager{display:flex;align-items:center;gap:12px;justify-content:space-between}.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:18px;margin:24px 0}.stat{background:white;border:1px solid #e1e8ee;border-radius:10px;padding:20px}.stat strong{display:block;font-size:30px;margin-top:8px}nav{display:flex;gap:8px;margin-bottom:22px}nav button{background:#e0eaee;color:#26455d}.filters{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:16px}.filters input{width:180px}.batch{justify-content:flex-start;background:#e7eff4;padding:12px;border-radius:8px;margin-bottom:14px}.batch button{font-size:13px}.devices{display:grid;gap:10px}.device{display:grid;grid-template-columns:24px 2fr 1fr 1fr 1fr auto;gap:14px;align-items:center;background:white;padding:18px;border:1px solid #dfe7ed;border-radius:9px}.device small{display:block;color:#7c8c9b;margin-top:5px;word-break:break-all}.badge{font-size:12px;padding:5px 9px;border-radius:20px;display:inline-block;background:#edf2f5}.badge.online{background:#d9f1e8;color:#12644b}.badge.disabled{background:#fce3df;color:#9b392c}.device button{font-size:13px}.pager{justify-content:center;margin:24px}.release,.audit{background:white;border:1px solid #dfe7ed;border-radius:8px;padding:18px;margin:12px 0;overflow-wrap:anywhere}textarea{display:block;width:100%;margin:12px 0;min-height:85px}dialog{border:1px solid #d3dfe8;border-radius:12px;width:min(650px,95vw);max-height:90vh}dialog::backdrop{background:#102b4380}.close{float:right;background:#e4ebf0;color:#284455}#detailContent{padding:30px 12px 12px;overflow-wrap:anywhere}#detailContent input{width:100%}pre{white-space:pre-wrap;font:13px/1.6 monospace}#status{position:sticky;bottom:10px;background:#fff4d9;color:#775816;padding:12px;border-radius:8px;min-height:0}#status:empty{display:none}[hidden]{display:none!important}@media(max-width:700px){main{margin:22px auto;padding:0 14px}.heading{align-items:flex-start;flex-direction:column}.stats{grid-template-columns:repeat(2,1fr);gap:10px}.stat{padding:14px}.device{grid-template-columns:24px 1fr 1fr;gap:12px}.device>div:nth-child(2){grid-column:span 2}.batch{flex-wrap:wrap}.filters input{width:100%}h1{font-size:26px}#login{margin:40px auto;padding:26px}}

/* Device editor: keep access controls separate from profile saving. */
#detailContent>h2{margin:0 0 22px}
.detail-permissions{padding:18px;background:#f3f7f9;border:1px solid #dfe7ed;border-radius:10px;margin-bottom:26px}
.detail-section-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}
.detail-section-heading h3,.detail-editor h3{margin:0;font-size:16px}
.detail-hint{font-size:13px;margin:8px 0 16px}
.detail-permission-actions{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.permission-button{min-height:44px;font-weight:600;border:1px solid}
.permission-allowed{color:#087f68;background:#fff;border-color:#9acfc2}
.permission-disabled{color:#ae493b;background:#fff;border-color:#e4b4ac}
.permission-allowed[aria-pressed=true]{background:#d9f1e8;border-color:#087f68}
.permission-disabled[aria-pressed=true]{background:#fce3df;border-color:#ae493b}
.detail-editor{margin-bottom:28px}
.detail-editor h3{margin-bottom:18px}
.detail-field{font-size:14px;font-weight:500;margin-bottom:16px}
.detail-field input,.detail-field textarea{display:block;margin:8px 0 0;width:100%;font-weight:400}
.detail-save-actions{display:flex;justify-content:flex-end;border-top:1px solid #e1e8ee;margin-top:22px;padding-top:18px}
.detail-save-button{min-height:44px;min-width:160px;font-weight:600}
.detail-danger-actions{margin-top:24px;padding-top:18px;border-top:1px solid #e1e8ee}
.detail-revoke-button{background:transparent;color:#9b392c;border:1px solid #e4b4ac}
#detail button:focus-visible{outline:3px solid #60a5fa;outline-offset:3px}
@media(max-width:700px){.detail-permissions{padding:16px}.detail-save-button{width:100%}.detail-save-actions{padding-top:16px}.detail-revoke-button{width:100%}}

.answer-history-card{background:#fff;border:1px solid #dfe7ed;border-radius:10px;padding:22px;margin:14px 0}
.answer-history-heading{display:flex;justify-content:space-between;gap:14px;align-items:center}
.answer-history-heading h3{margin:0;font-size:18px}
.answer-history-card small{color:#697d90;overflow-wrap:anywhere}
.history-identity{font-size:14px;color:#697d90}
.history-stem{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.7}
.history-answer{display:block;color:#087f68;margin:18px 0;font-size:17px}
.detail-history-button{background:#e4edf3;color:#284455;margin-bottom:18px;width:100%}
nav{flex-wrap:wrap}
@media(max-width:700px){.answer-history-card{padding:16px}.answer-history-heading{align-items:flex-start;flex-direction:column}}

/* Dense history list; full text stays in the authenticated detail dialog. */
.history-table-wrap{overflow-x:auto;border:1px solid #dfe7ed;border-radius:9px;background:#fff}
.history-table{width:100%;min-width:960px;border-collapse:collapse;table-layout:fixed;font-size:13px}
.history-table th{background:#eaf0f5;color:#536b80;text-align:left;font-size:12px;font-weight:600;white-space:nowrap}
.history-table th,.history-table td{padding:10px 9px;border-bottom:1px solid #e7edf2;vertical-align:middle}
.history-table tr:last-child td{border-bottom:0}
.history-table tbody tr:hover{background:#f7fafc}
.history-table th:nth-child(1){width:120px}.history-table th:nth-child(2){width:155px}.history-table th:nth-child(3){width:140px}.history-table th:nth-child(4){width:110px}.history-table th:nth-child(6){width:76px}.history-table th:nth-child(7){width:82px}.history-table th:nth-child(8){width:64px}
.history-table small{display:block;color:#7b8b99;font-size:11px;margin-top:4px}
.history-clamp{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;overflow-wrap:anywhere;line-height:1.5}
.history-time{font-size:12px;color:#697d90;line-height:1.6}
.history-answer-cell strong{color:#087f68;overflow-wrap:anywhere}
.history-table .badge{font-size:11px;padding:4px 7px;white-space:nowrap}
.history-actions button{font-size:12px;padding:7px 10px;min-height:32px}
.collection-card{display:flex;justify-content:space-between;align-items:center;gap:20px;background:white;border:1px solid #dfe7ed;border-radius:9px;padding:16px 20px;margin:10px 0}
.collection-summary{min-width:0}.collection-summary h3{font-size:16px;margin:0;overflow-wrap:anywhere}.collection-summary p{font-size:13px;margin:6px 0 0}
.collection-download{display:inline-block;text-decoration:none;white-space:nowrap;color:#087f86;background:#e3f1f0;border:1px solid #b7dbd6;border-radius:7px;padding:9px 14px;font-size:13px;font-weight:600}
.secondary-button{background:#e5edf2;color:#36546a}.collection-filter-hint{font-size:13px;margin-top:0}
@media(max-width:700px){
 .history-table-wrap{border:0;background:transparent;overflow:visible}.history-table{min-width:0;display:block}.history-table thead{display:none}.history-table tbody{display:block}.history-table tr{display:grid;grid-template-columns:1fr 1fr;gap:8px 14px;background:white;border:1px solid #dfe7ed;border-radius:8px;margin:10px 0;padding:12px}.history-table th,.history-table td{display:block;border:0;padding:0;min-width:0}.history-table td::before{content:attr(data-label);display:block;color:#8392a0;font-size:11px;margin-bottom:3px}.history-table .history-question{grid-column:1/-1}.history-table .history-time{grid-column:1/-1}.history-time::before{display:none!important}.history-table .history-actions{display:flex;align-items:center;justify-content:flex-end}.history-actions::before{display:none!important}.history-table small{margin-top:3px}.collection-card{align-items:flex-start;padding:14px;gap:12px}.collection-download{padding:8px 10px;font-size:12px}
}

nav{flex-wrap:wrap}#whitelistForm{background:#fff;border:1px solid #dfe7ed;border-radius:10px;padding:20px;margin-bottom:18px}#whitelistForm input{display:block;width:100%;max-width:550px}#whitelistRecords button{margin:4px 8px 0 0}

/* Console theme and responsive layout. */
:root{font-family:"Segoe UI","Microsoft YaHei",system-ui,sans-serif;color:#24344b;background:#f5f7fb;font-size:14px;--accent:#285ee8;--line:#e3e9f2;--muted:#758297}
body{line-height:1.55}a{color:var(--accent);text-underline-offset:3px}
header{padding:18px max(24px,calc((100vw - 1280px)/2));background:#fff;color:#182b48;border-bottom:1px solid var(--line);gap:16px}
header strong{display:flex;align-items:center;gap:10px;font-size:21px;letter-spacing:.5px;min-width:0}
header strong>span:not(.brand-mark){color:var(--muted);font-size:13px;margin-left:10px;letter-spacing:0;border-left:1px solid var(--line);padding-left:18px}
header .brand-mark{display:grid;place-items:center;width:34px;height:34px;margin:0;border-radius:10px;background:var(--accent);color:#fff;font-size:21px;font-weight:700;box-shadow:0 4px 10px #285ee825}
#logout{background:#fff;color:#637188;border:1px solid var(--line);font-size:13px;white-space:nowrap}
main{max-width:1280px;margin:32px auto;padding:0 24px}main>*{min-width:0}
h1{font-size:29px;letter-spacing:-.7px;color:#172b49;font-weight:700;margin:4px 0 8px}h2{font-size:21px;margin:0 0 8px}h3{color:#24344b}p{color:var(--muted);line-height:1.75}
.eyebrow{font-size:11px;letter-spacing:1.8px;color:#8290a5;font-weight:600;margin-bottom:8px}.heading p{margin:0}.heading{gap:20px}.heading>div{min-width:0}
button,input,select,textarea{border-radius:9px;min-height:42px;padding:10px 13px;font-size:14px;max-width:100%}
button{background:var(--accent);font-weight:600;transition:background .15s,box-shadow .15s}button:hover{filter:brightness(.97);box-shadow:0 3px 9px #24344b12}button:disabled{opacity:.4;box-shadow:none}
input,select,textarea{border-color:#dbe3ee;color:#24344b}input::placeholder,textarea::placeholder{color:#95a0b0}input[type=checkbox]{min-height:0;width:17px;height:17px;margin:0;flex-shrink:0;accent-color:var(--accent)}
:where(button,input,select,textarea,a):focus-visible{outline:3px solid #86acff;outline-offset:3px}
.stats{gap:16px;margin:26px 0}.stat{position:relative;padding:20px 22px;background:#fff;border:1px solid var(--line);border-radius:14px;color:var(--muted);font-size:13px;box-shadow:0 3px 12px #21365703;overflow:hidden}
.stat:before{content:"";display:block;width:23px;height:3px;border-radius:3px;background:#6088f3;margin-bottom:13px}.stat:nth-child(2):before{background:#2aaf8b}.stat:nth-child(3):before{background:#e7ae4d}.stat:nth-child(4):before{background:#df7985}
.stat strong{font-size:32px;line-height:1.2;color:#1c3152;margin-top:8px;font-variant-numeric:tabular-nums}
nav{padding:6px;gap:5px;background:#eaf0f7;border:1px solid #e3e9f1;border-radius:12px;margin-bottom:24px;display:flex;flex-wrap:wrap}
nav button{flex:1;background:transparent;color:#6b7b92;border:1px solid transparent;white-space:nowrap;font-weight:500;min-height:42px;padding:10px 15px}
nav button[aria-current=page]{background:#fff;color:var(--accent);box-shadow:0 2px 6px #263e6810;border-color:#e3e9f1;font-weight:600}
.filters{padding:18px;background:#fff;border:1px solid var(--line);border-radius:12px;gap:10px;margin-bottom:14px;align-items:center}
.filters input{width:auto;flex:1 1 150px}.filters select{flex:1 1 140px}.filters button{flex:0 0 auto}
.batch{padding:12px 16px;background:#edf2f9;border:1px solid #e3eaf4;border-radius:10px;gap:10px;flex-wrap:wrap;font-size:13px}.batch label{display:flex;align-items:center;gap:8px;margin-right:8px}.batch button{min-height:34px;padding:6px 12px;background:white;border:1px solid #d8e2ef;color:#4d6487;font-weight:500}.batch [data-batch=disabled]{color:#b15c68}#selection{color:var(--muted);margin-left:auto}
.device{grid-template-columns:20px minmax(0,2fr) minmax(0,1.25fr) minmax(0,.8fr) minmax(0,.8fr) auto;gap:18px;padding:20px;border-color:var(--line);border-radius:12px;box-shadow:0 2px 6px #223d5e03}
.device>div{min-width:0;overflow-wrap:anywhere}.device b{font-size:15px;color:#203653}.device small{color:#8995a7;font-size:12px;line-height:1.5}.device>button{background:#eff4ff;color:var(--accent);font-size:12px;min-height:36px;border:1px solid #dee8ff}.devices{gap:10px}
.badge{padding:4px 10px;font-size:12px;background:#edf1f7;color:#6e7c90}.badge.online,.badge.allowed{background:#e6f6ef;color:#218363}.badge.pending,.badge.delayed{background:#fff5df;color:#a87620}.badge.disabled{background:#fcecef;color:#b24d61}
.pager{flex-wrap:wrap;gap:12px;margin:24px 0;color:var(--muted);font-size:13px}.pager button{background:#fff;color:#557093;border:1px solid var(--line);font-weight:500}
#login{max-width:440px;padding:38px;margin:70px auto;border:1px solid var(--line);border-radius:20px;box-shadow:0 16px 50px #243f6b09}#login h1{font-size:27px}#login p{margin-bottom:26px}#login label{font-size:13px;font-weight:500;color:#5b6b82;margin-top:16px}#login input{margin:8px 0 0;min-height:46px}#login button{min-height:46px;margin-top:25px}
.release,.audit,.answer-history-card,.collection-card,#whitelistForm{border-color:var(--line);border-radius:12px;box-shadow:0 2px 8px #24344b03}.release{padding:24px}.release pre,.audit{overflow-wrap:anywhere}.secondary-button,.detail-history-button{background:#edf2fa;color:#506a90}.collection-download{background:#edf3ff;border-color:#dce6ff;color:var(--accent)}
#whitelistForm{padding:24px}#whitelistForm label{color:#596c86;font-size:13px;margin-bottom:16px}#whitelistForm textarea{margin-top:8px}#whitelistForm input{margin-top:8px}#whitelistRecords .audit button{font-size:12px}
#upload{padding:20px;background:#fff;border:1px solid var(--line);border-radius:12px;margin:20px 0}input[type=file]{width:100%;background:#f8faff}pre{overflow-wrap:anywhere}
dialog{padding:20px;border-color:var(--line);border-radius:18px;box-shadow:0 24px 100px #14244038;width:min(680px,calc(100vw - 32px));max-height:calc(100dvh - 32px);overflow:auto}dialog::backdrop{background:#152b4c66;backdrop-filter:blur(3px)}.close{min-height:34px;background:#edf2f9;color:#5b6e88;font-size:12px}#detailContent{padding:42px 6px 6px}.detail-permissions{background:#f7f9fd;border-color:var(--line)}
#status{font-size:12px;color:#697d96;background:#edf2f9;border:1px solid #dee7f2;padding:10px 14px;overflow-wrap:anywhere;margin-top:24px;box-shadow:0 2px 8px #24344b06}
@media(min-width:701px) and (max-width:1000px){.device{grid-template-columns:20px minmax(0,2fr) minmax(0,1.4fr) minmax(0,1fr);gap:14px}.device>div:nth-child(5){grid-column:2/4}.device>button{grid-column:4}.filters input{flex-basis:190px}}
@media(max-width:700px){
 header{padding:14px 16px;gap:8px}header strong{font-size:18px;gap:7px}header strong>span:not(.brand-mark){font-size:12px;margin-left:2px;padding-left:10px}header .brand-mark{width:30px;height:30px;font-size:18px}#logout{font-size:12px;padding:7px 10px;min-height:36px}
 main{padding:0 16px;margin:24px auto}h1{font-size:25px}.eyebrow{font-size:10px}.heading{gap:16px}.heading>button{width:100%}.heading p{font-size:12px}
 .stats{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:20px 0}.stat{padding:16px;font-size:12px}.stat:before{margin-bottom:10px}.stat strong{font-size:28px}
 nav{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;padding:5px;margin-bottom:20px}nav button{padding:10px 3px;font-size:12px;min-width:0;min-height:42px}
 .filters{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));padding:12px;gap:10px}.filters input,.filters select{width:100%;min-width:0}.filters input:first-child{grid-column:1/-1}.filters button{width:100%}.filters input,.filters select,.filters button{font-size:16px;min-height:44px;padding:9px 10px}.collection-filters input{grid-column:1/-1}
 .batch{padding:12px;gap:8px}.batch label{flex:1 1 60%;min-height:32px}#selection{order:0;margin-left:0}.batch button{order:1;flex:1 1 auto;min-height:40px}
 .device{grid-template-columns:20px minmax(0,1fr);padding:16px;gap:12px}.device>input{grid-column:1;grid-row:1;align-self:start;margin-top:4px}.device>div:nth-child(2){grid-column:2;grid-row:1}.device>div:nth-child(n+3){grid-column:2}.device>div:nth-child(5){font-size:13px;color:#647792}.device>button{grid-column:2;width:100%;min-height:42px}.device small{font-size:12px}
 .collection-card{flex-direction:column;gap:14px;padding:16px}.collection-download{width:100%;text-align:center;min-height:42px}.collection-summary{width:100%}.collection-summary h3{font-size:15px}
 .history-table tr{grid-template-columns:repeat(2,minmax(0,1fr));padding:16px;border-radius:12px;gap:12px}.history-table .history-actions button{min-height:42px;padding:9px 14px}.history-table td{overflow-wrap:anywhere}
 .pager{gap:8px;font-size:12px}.pager button{min-height:44px;padding:9px 12px}.pager span{text-align:center;overflow-wrap:anywhere;min-width:0}
 #login{margin:32px auto;padding:26px 22px}#login h1{font-size:24px}#login input{font-size:16px}
 #whitelistForm,#upload,.release{padding:16px}#whitelistForm input,#whitelistForm textarea{font-size:16px;width:100%;min-width:0}#whitelistForm>button{width:100%}input[type=datetime-local]{appearance:none}input[type=file]{min-width:0;font-size:13px}
 dialog{padding:16px;width:calc(100vw - 24px);max-height:calc(100dvh - 24px)}#detailContent{padding:40px 0 0}#detailContent input,#detailContent textarea{font-size:16px}.detail-section-heading{flex-wrap:wrap}.detail-permissions{padding:14px}.detail-permission-actions{gap:8px}.answer-history-heading{align-items:flex-start}
}
@media(prefers-reduced-motion:reduce){button{transition:none}}
/* Refresh messages stay in document flow so they cannot cover mobile controls. */
#status{position:static}

#bankUpload{padding:20px;background:white;border:1px solid var(--line,#dfe7ed);border-radius:12px;margin:20px 0}#bankUpload input{display:block;width:100%;margin:8px 0 16px}.bank-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:16px}#bankProgress{white-space:pre-wrap}#bankRecords h4{line-height:1.7;white-space:pre-wrap;overflow-wrap:anywhere}#bankRecords p{white-space:pre-wrap}nav{flex-wrap:wrap}
