:root{font-family:system-ui,-apple-system,Segoe UI,sans-serif;background:#f4f5f7;color:#172033}*{box-sizing:border-box}body{margin:0}header{position:sticky;z-index:3;top:0;display:flex;justify-content:space-between;align-items:center;padding:14px 18px;background:#111827;color:white}.brand{display:flex;gap:8px;align-items:baseline}.brand span{font-size:.82rem;opacity:.72}header nav{display:flex;gap:8px}button,select,textarea,input{font:inherit}button{border:0;border-radius:10px;padding:11px 16px;background:#111827;color:#fff;cursor:pointer}button:disabled{opacity:.55;cursor:default}.header-btn{padding:7px 10px;background:#273244}.secondary{background:#e5e7eb;color:#111827}main{max-width:820px;margin:auto;padding:18px}.card{background:white;border:1px solid #e5e7eb;border-radius:16px;padding:20px;box-shadow:0 4px 20px rgba(0,0,0,.05)}textarea,input{width:100%;border:1px solid #cbd5e1;border-radius:10px;padding:12px;margin:10px 0}.actions,.result-head{display:flex;gap:14px;align-items:center;justify-content:space-between}.result-head{align-items:flex-start;border-bottom:1px solid #e5e7eb;padding-bottom:14px}.result-head h2{margin:0}.mode-hint{margin:6px 0 0;color:#64748b;font-size:.86rem}.mode-picker{display:flex;align-items:center;gap:8px;color:#64748b;font-size:.82rem}.mode-picker select{border:1px solid #cbd5e1;border-radius:9px;background:#fff;padding:7px 9px;color:#172033}.result-section{padding:17px 0;border-bottom:1px solid #e5e7eb}.result-section h3{margin:0 0 7px;font-size:1rem;color:#111827}.result-text{line-height:1.58;color:#263247}.result-ket_luan{background:#f8fafc;margin:14px -10px 0;padding:16px 10px;border-radius:10px;border-bottom:0}.result-ket_luan h3{font-size:1.05rem}.result-do_tin_cay{border-bottom:0}.technical-details{margin-top:8px;padding:12px 0;border-top:1px solid #e5e7eb}.technical-details summary{cursor:pointer;font-weight:600;color:#475569}.new-question{margin-top:14px}.muted,footer{color:#64748b;font-size:.86rem}footer{max-width:820px;margin:0 auto;padding:0 18px 30px}ol{min-height:40px;padding-left:28px}details{margin-top:18px}.history-item{display:flex;width:100%;text-align:left;flex-direction:column;gap:5px;margin:8px 0;padding:12px;background:#f8fafc;color:#172033;border:1px solid #e2e8f0}.history-item span{font-size:.8rem;color:#64748b}.history-item:hover{background:#f1f5f9}@media(max-width:560px){main{padding:10px}.card{border-radius:12px;padding:16px}.actions{align-items:stretch;flex-direction:column}.actions button{width:100%}header{padding:12px}.brand span{display:none}.result-head{gap:10px}.mode-picker{align-items:flex-end;flex-direction:column}.mode-picker span{display:none}.result-ket_luan{margin-left:-6px;margin-right:-6px}.result-text{line-height:1.52}}
.feedback-card{margin-top:18px;padding:16px;border:1px solid #dbe4ef;border-radius:14px;background:#f8fafc}.feedback-card h3{margin:0 0 8px}.feedback-card p{line-height:1.5}.feedback-ratings{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:14px 0 4px}.feedback-ratings button{padding:10px}.link-button{background:transparent;color:#475569;padding:8px 0;text-decoration:underline}.consent-box{margin:12px 0;padding:12px;border:1px solid #dbe4ef;border-radius:10px;background:#fff}.consent-box p{margin:6px 0 0;color:#475569;font-size:.9rem}.feedback-card textarea{background:#fff}.new-question:not([hidden]){display:inline-block}.feedback-card[hidden],.new-question[hidden]{display:none}@media(max-width:560px){.feedback-ratings{grid-template-columns:1fr}.feedback-card .actions{gap:8px}.feedback-card .actions button{width:100%}}
.qi-card{margin:12px 0;padding:14px;border:1px solid #dbe4ef;border-radius:12px;background:#f8fafc}.qi-card h3{margin:0 0 7px;font-size:1rem}.qi-card p{margin:7px 0;line-height:1.5}.qi-suggestion{padding:10px;border-radius:9px;background:#fff;border:1px solid #e2e8f0;color:#334155}.qi-actions{display:flex;gap:8px;margin-top:12px}.qi-candidates{display:grid;gap:8px;margin-top:10px}.qi-candidate{width:100%;text-align:left;background:#fff;color:#172033;border:1px solid #cbd5e1}.qi-candidate:hover{background:#f1f5f9}.qi-card[hidden],#qiChecking[hidden],.qi-actions[hidden],.qi-candidates[hidden],.qi-suggestion[hidden]{display:none}@media(max-width:560px){.qi-actions{flex-direction:column}.qi-actions button{width:100%}}
.result-experience{padding-top:16px}.result-question{margin:0 0 12px;color:#475569;font-weight:600}.result-status{display:inline-flex;align-items:center;border-radius:999px;padding:7px 11px;margin:0 0 12px;font-size:.82rem;font-weight:700;border:1px solid #cbd5e1;background:#f8fafc}.result-status-thuan{border-color:#a7d7bd;background:#f0faf4}.result-status-thuan_co_dieu_kien{border-color:#dccb9e;background:#fffaf0}.result-status-chua_ro{border-color:#cbd5e1;background:#f8fafc}.result-status-bat_loi{border-color:#e3b6ad;background:#fff7f5}.result-status-nen_tranh{border-color:#dda9a9;background:#fff3f3}.result-summary-block{margin:0 0 14px;padding:15px;border:1px solid #e2e8f0;border-radius:12px;background:#fff}.result-summary-block h3{margin:0 0 8px;font-size:.96rem;color:#111827}.result-summary-block p{margin:0;line-height:1.58;color:#263247}.result-summary-block:first-of-type{background:#f8fafc}.result-reasons{display:grid;gap:10px}.result-reason{padding-top:10px;border-top:1px solid #eef2f7}.result-reason:first-child{padding-top:0;border-top:0}.result-reason strong{font-size:.86rem;color:#475569}.result-reason p{margin:3px 0 0}.result-summary-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}.result-summary-block.compact{margin:0}.result-summary-block.compact .muted{margin-top:6px}.result-systems{display:grid;gap:7px}.result-system{display:flex;justify-content:space-between;gap:10px;padding:7px 0;border-bottom:1px solid #eef2f7}.result-system:last-child{border-bottom:0}.result-system span{color:#64748b;font-size:.82rem}.result-detail{margin-top:18px;padding-top:14px;border-top:1px solid #e5e7eb}.result-detail>summary{cursor:pointer;font-weight:700;color:#334155}.result-detail .result-ket_luan{margin-top:12px}@media(max-width:560px){.result-summary-grid{grid-template-columns:1fr}.result-summary-block{padding:13px}.result-system{align-items:flex-start;flex-direction:column;gap:2px}}

.result-trend-list{display:grid;gap:10px}.result-trend-item{padding:10px 12px;border:1px solid var(--line,#ddd);border-radius:10px}.result-trend-item p,#resultCondition p{margin:4px 0 0}

.analysis-mode-row{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:2px 0 12px}.analysis-mode-row select{min-width:150px;border:1px solid #cbd5e1;border-radius:9px;background:#fff;padding:8px 10px;color:#172033}.expert-controls{margin:12px 0;padding:15px;border:1px solid #cbd5e1;border-radius:12px;background:#f8fafc}.expert-controls h3{margin:0 0 4px}.expert-controls>.muted,.expert-controls div>.muted{margin:4px 0 0}.expert-mode-options{display:grid;gap:8px;margin-top:12px}.expert-mode-option{display:flex;align-items:flex-start;gap:10px;padding:11px;border:1px solid #dbe4ef;border-radius:10px;background:#fff;cursor:pointer}.expert-mode-option input{width:auto;margin:3px 0 0}.expert-mode-option span{display:grid;gap:2px}.expert-mode-option small{color:#64748b;line-height:1.35}.expert-systems{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:12px 0 0;padding:12px;border:1px solid #dbe4ef;border-radius:10px;background:#fff}.expert-systems legend{padding:0 6px;font-weight:700;font-size:.9rem}.expert-systems label{display:flex;align-items:center;gap:7px;padding:7px 4px}.expert-systems input{width:auto;margin:0}.expert-validation{margin:10px 0 0;padding:9px 11px;border:1px solid #efc0b8;border-radius:9px;background:#fff6f4;color:#8b2e21;font-size:.9rem}.expert-controls[hidden],.expert-systems[hidden],.expert-validation[hidden]{display:none}.expert-execution-summary{margin:0 0 14px;padding:14px;border:1px solid #cbd5e1;border-radius:12px;background:#f8fafc}.expert-execution-summary h3{margin:0 0 8px;font-size:.96rem}.expert-execution-summary p{margin:5px 0;line-height:1.5}.expert-execution-summary ul{margin:7px 0 0;padding-left:20px}.expert-execution-summary li{margin:4px 0}.expert-execution-summary[hidden]{display:none}@media(max-width:560px){.analysis-mode-row{align-items:stretch;flex-direction:column}.analysis-mode-row select{width:100%}.expert-systems{grid-template-columns:1fr}}
.expert-result-view{margin-top:16px;padding-top:2px}.expert-result-title{margin-bottom:10px}.expert-result-title h3{margin:0 0 4px}.expert-system-cards{display:grid;gap:12px}.expert-system-card{padding:14px;border:1px solid #dbe4ef;border-radius:12px;background:#f8fafc}.expert-system-card-head{display:flex;align-items:center;justify-content:space-between;gap:10px}.expert-system-card h4{margin:0;font-size:1rem}.expert-role{font-size:.8rem;color:#64748b}.expert-system-conclusion{margin:9px 0 5px;line-height:1.55}.expert-axes{display:grid;gap:7px;margin-top:10px}.expert-axis{display:grid;grid-template-columns:minmax(120px,.7fr) 1.3fr;gap:10px;padding:7px 0;border-top:1px solid #e2e8f0}.expert-axis span{color:#334155}.expert-system-summary{margin-top:10px}.expert-system-summary summary,.expert-technical-records summary{cursor:pointer;font-weight:600;color:#475569}.expert-tech-grid{display:grid;gap:6px;margin-top:8px}.expert-tech-grid>div{display:grid;grid-template-columns:minmax(120px,.7fr) 1.3fr;gap:10px}.expert-tech-grid span{overflow-wrap:anywhere}.expert-limitations{margin:10px 0 0;padding-top:8px;border-top:1px solid #e2e8f0;color:#64748b;font-size:.86rem}.expert-difference-block,.expert-skipped-block{margin-top:14px;padding:13px;border:1px solid #e2e8f0;border-radius:12px}.expert-difference-block h3,.expert-skipped-block h3{margin:0 0 7px;font-size:.94rem}.expert-difference-block p{margin:5px 0}.expert-skipped-block ul{margin:0;padding-left:20px}.expert-technical-records{margin-top:16px;padding-top:12px;border-top:1px solid #e5e7eb}.expert-raw-record{margin:10px 0}.expert-raw-record pre{max-height:420px;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere;padding:12px;border-radius:10px;background:#111827;color:#e5e7eb;font:12px/1.45 ui-monospace,SFMono-Regular,Consolas,monospace}.expert-result-view[hidden],.expert-difference-block[hidden],.expert-skipped-block[hidden],.expert-technical-records[hidden]{display:none}@media(max-width:560px){.expert-axis,.expert-tech-grid>div{grid-template-columns:1fr;gap:2px}.expert-system-card-head{align-items:flex-start;flex-direction:column;gap:2px}}

/* MLAS 1.9 Result UX V2 */
.result-conclusion-block{border-color:#cbd5e1;background:#f8fafc}
.result-conclusion-block #resultConclusion{font-size:1.05rem;font-weight:650;line-height:1.62}
.result-caution-block{border-color:#e7d5aa;background:#fffaf0}
.result-more-hint{margin-top:10px!important;padding-top:9px;border-top:1px dashed #dbe4ef}
#resultConfidenceText{margin-top:6px}
.result-summary-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
#resultExperience[data-display-mode="nguoi_moi"] .result-summary-block{scroll-margin-top:76px}
#resultExperience[data-display-mode="chuyen_gia"] .expert-result-view{border-top:1px solid #e5e7eb;padding-top:16px}
@media(max-width:720px){.result-summary-grid{grid-template-columns:1fr}}

/* MLAS 1.9 Case Library V2 */
.history-toolbar{display:grid;grid-template-columns:minmax(220px,2fr) repeat(3,minmax(120px,1fr));gap:8px;margin:14px 0}
.history-toolbar input,.history-toolbar select{margin:0}
.history-favorite-filter{display:flex;align-items:center;gap:7px;grid-column:1/-1;color:#475569;font-size:.9rem}
.history-favorite-filter input{width:auto;margin:0}
.history-card{margin:10px 0;padding:12px;border:1px solid #e2e8f0;border-radius:12px;background:#f8fafc}
.history-card-top{display:flex;gap:8px;align-items:stretch}
.history-open{display:flex;flex:1;min-width:0;text-align:left;flex-direction:column;gap:5px;background:transparent;color:#172033;border:0;padding:4px}
.history-open strong{overflow-wrap:anywhere}
.history-open span{font-size:.8rem;color:#64748b}
.history-favorite{flex:0 0 42px;padding:7px;background:#fff;color:#9a6700;border:1px solid #dbe4ef;font-size:1.35rem}
.history-tags{display:flex;flex-wrap:wrap;gap:6px;margin-top:9px}
.history-tags span{padding:4px 8px;border-radius:999px;background:#eef2ff;color:#4338ca;font-size:.78rem}
.history-note{margin:9px 0 0;color:#334155;line-height:1.45}
.history-meta-editor{margin-top:10px;border-top:1px solid #e2e8f0;padding-top:8px}
.history-meta-editor summary{cursor:pointer;font-weight:600;color:#475569}
.history-meta-editor textarea,.history-meta-editor input{background:#fff}
.history-meta-editor button{margin-top:4px}
@media(max-width:720px){.history-toolbar{grid-template-columns:1fr}.history-favorite-filter{grid-column:auto}.history-card-top{align-items:flex-start}.history-favorite{flex-basis:40px}}

/* MLAS 1.9 Share / Export V1 */
.share-export-actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:16px 0}
.share-export-actions p{flex-basis:100%;margin:0}
.print-report{display:none}
.print-report pre{white-space:pre-wrap;overflow-wrap:anywhere;font:14px/1.6 system-ui,-apple-system,Segoe UI,sans-serif;color:#172033}
@media(max-width:560px){.share-export-actions{align-items:stretch;flex-direction:column}.share-export-actions button{width:100%}}
@media print{
 @page{margin:16mm}
 body{background:#fff;color:#111}
 body>header,body>footer,#questionScreen,#prepareScreen,#castScreen,#analysisScreen,#historyScreen{display:none!important}
 main{max-width:none;margin:0;padding:0}
 #resultScreen{display:block!important;border:0;box-shadow:none;padding:0}
 #resultScreen>*:not(#printReport){display:none!important}
 #printReport{display:block!important}
 #printReport h1{margin:0 0 18px;font-size:20pt}
 #printReport pre{font-size:11pt;line-height:1.55}
}

/* MLAS 1.9 PWA and operational polish */
.runtime-status-bar{max-width:820px;margin:10px auto 0;padding:9px 14px;border:1px solid #cbd5e1;border-radius:10px;background:#f8fafc;color:#475569;font-size:.86rem}
.runtime-status-bar[data-kind="offline"]{border-color:#f0c6a3;background:#fff8f1;color:#8a4b13}
.runtime-status-bar[data-kind="warming"],.runtime-status-bar[data-kind="updating"]{border-color:#d9c994;background:#fffbea;color:#715c13}
.runtime-status-bar[data-kind="warning"]{border-color:#e3b6ad;background:#fff7f5;color:#8b2e21}
.runtime-status-bar[data-kind="ready"]{border-color:#b7d9c4;background:#f3faf6;color:#24613c}
@media(max-width:840px){.runtime-status-bar{margin:8px 10px 0}}
