/* GSES2 DSA / Cis Analysis — compact scientific UI */
.dsa-app {
    --ink: #172b3a; --muted: #617485; --blue: #00639a; --blue-dark: #004f7c;
    --blue-soft: #edf6fa; --line: #ccd8df; --line-soft: #e4ebef; --panel: #f7f9fa;
    width: calc(100% - 24px); max-width: 800px; margin: 16px auto; padding: 20px 22px;
    box-sizing: border-box; color: var(--ink); background: #fff; border: 1px solid var(--line);
    border-radius: 4px; box-shadow: 0 2px 8px rgba(18,48,66,.06);
    font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 1.45;
}
.dsa-app *{box-sizing:border-box}.dsa-app>header{margin-bottom:14px}
.dsa-app>header h2{margin:0;color:#153b55;font-size:22px;font-weight:600;line-height:1.25}
.dsa-app>header p{margin:3px 0 0;color:var(--muted);font-size:13px}

.dsa-mode{display:flex;flex-wrap:wrap;gap:4px 18px;margin:0 0 12px;padding:8px 10px;background:var(--panel);border-top:1px solid var(--line);border-bottom:1px solid var(--line);font-size:13px}
.dsa-mode label,.dsa-checks label{display:inline-flex;align-items:center;gap:6px;cursor:pointer}
.dsa-mode input,.dsa-checks input{margin:0;width:15px;height:15px}
.dsa-field{display:block;margin:9px 0}.dsa-app label span{display:block;margin:0 0 3px;color:#29495f;font-size:12.5px;font-weight:600}
.dsa-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px 12px;margin:8px 0}.dsa-grid label{min-width:0}
.dsa-app input[type="text"],.dsa-app input[type="number"],.dsa-app input:not([type]),.dsa-app select{width:100%;min-height:36px;padding:6px 9px;color:#172d40;background:#fff;border:1px solid #9fb2bf;border-radius:3px;font:inherit}
.dsa-app input:focus,.dsa-app select:focus{outline:2px solid rgba(0,99,154,.18);outline-offset:1px;border-color:var(--blue)}
.dsa-checks{display:flex;flex-wrap:wrap;gap:5px 18px;margin:10px 0;font-size:12.5px}

.dsa-upload{margin:9px 0;padding:10px 12px;background:var(--panel);border:1px solid var(--line);border-left:3px solid #72a8c4;border-radius:3px}
.dsa-upload .dsa-field{margin:3px 0 8px}.dsa-upload input[type="file"]{display:block;width:100%;padding:5px 7px;background:#fff;border:1px solid var(--line);border-radius:3px;font-size:12.5px}
.dsa-upload-note,.dsa-upload-selection,.dsa-source-files{color:var(--muted);font-size:12px;overflow-wrap:anywhere}.dsa-upload-note{margin:3px 0}.dsa-upload-selection{margin:5px 0 0;color:#35536d;font-weight:600}
.dsa-upload-selection-row{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:5px}.dsa-upload-selection-row .dsa-upload-selection{min-width:0;margin:0}.dsa-upload-clear{flex:0 0 auto;min-height:28px;padding:4px 8px;color:#566d7c;background:#fff;border:1px solid #9fb2bf;border-radius:3px;font-family:inherit;font-size:11.5px;font-weight:600;cursor:pointer}.dsa-upload-clear:hover:not(:disabled){color:var(--blue);background:var(--blue-soft)}.dsa-upload-clear:disabled{opacity:.45;cursor:default}

.dsa-submit,.dsa-secondary,.dsa-view,.dsa-delete{min-height:34px;padding:6px 12px;border-radius:3px;font-family:inherit;font-size:12.5px;font-weight:600;line-height:1.2;cursor:pointer}
.dsa-submit{color:#fff;background:var(--blue);border:1px solid var(--blue)}.dsa-submit:hover{background:var(--blue-dark)}
.dsa-secondary,.dsa-view{color:var(--blue);background:#fff;border:1px solid #8fa9b9}.dsa-secondary:hover,.dsa-view:hover{background:var(--blue-soft)}
.dsa-delete{color:#a3312e;background:#fff;border:1px solid #bd5a56}.dsa-delete:hover{background:#fff2f1}.dsa-submit:disabled,.dsa-delete:disabled{opacity:.55;cursor:wait}

.dsa-status{display:flex;align-items:center;gap:8px;margin-top:8px;padding:6px 9px;background:var(--panel);border:1px solid var(--line-soft);border-left:4px solid #6e8797;font-size:12.5px}
.dsa-status.completed{border-left-color:#26825a}.dsa-status.error{border-left-color:#b8423e}
.dsa-status>div:last-child{display:flex;align-items:center;flex-wrap:wrap;gap:4px 8px}.dsa-status strong,.dsa-status p{margin:0}.dsa-status small{display:none}
.dsa-spinner{flex:0 0 auto;width:17px;height:17px;border:2px solid #cbd7de;border-top-color:var(--blue);border-radius:50%;animation:dsa-spin 1s linear infinite}
.dsa-status.completed .dsa-spinner,.dsa-status.error .dsa-spinner{display:none}@keyframes dsa-spin{to{transform:rotate(360deg)}}

.dsa-history{margin-top:18px;padding-top:14px;border-top:2px solid #6f9bb3}.dsa-history-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:9px}
.dsa-history-heading h3{margin:0;color:#153b55;font-size:19px;font-weight:600;line-height:1.3}.dsa-history-heading p{margin:2px 0 0;color:var(--muted);font-size:11.5px}
.dsa-history-scroll{overflow-x:auto;border:1px solid var(--line);border-radius:3px}.dsa-history table{width:100%;min-width:0;table-layout:fixed;border-collapse:collapse;text-align:left}
.dsa-history th{padding:7px 8px;color:#3d5b6e;background:#eef3f5;border-bottom:1px solid #b9c9d2;font-size:11px;font-weight:700;letter-spacing:.025em;text-transform:uppercase}
.dsa-history td{padding:8px;border-top:1px solid var(--line-soft);vertical-align:middle;font-size:12.5px}.dsa-history-row{cursor:pointer}.dsa-history-row:hover{background:#f5f9fb}
.dsa-history-row td:nth-child(1),.dsa-history th:nth-child(1){width:auto}
.dsa-history-row td:nth-child(2),.dsa-history th:nth-child(2){width:145px;white-space:nowrap}
.dsa-history-row td:nth-child(3),.dsa-history th:nth-child(3){width:92px;white-space:nowrap}
.dsa-history-row td:nth-child(4),.dsa-history th:nth-child(4){width:65px;white-space:nowrap}
.dsa-history-row td:nth-child(5),.dsa-history th:nth-child(5){width:82px;white-space:nowrap}
.dsa-history-row td:nth-child(6),.dsa-history th:nth-child(6){width:120px;white-space:nowrap}
.dsa-history-row td:first-child{overflow-wrap:anywhere}.dsa-history-row strong{color:#063e68;font-weight:700}.dsa-history-row small{display:block;margin-top:1px;color:#718396;font-size:10.5px;word-break:normal}
.dsa-badge{display:inline-block;padding:3px 7px;color:#4c6072;background:#e9eef1;border-radius:999px;font-size:11px;font-weight:700}.dsa-badge.completed{color:#17643f;background:#e2f2e9}
.dsa-badge.running,.dsa-badge.queued{color:#135b94;background:#e3f0f7}.dsa-badge.error{color:#982c29;background:#f8e7e6}
.dsa-result-actions{display:flex;align-items:center;flex-wrap:nowrap;gap:4px}.dsa-history .dsa-view,.dsa-history .dsa-delete{min-height:28px;padding:4px 7px;font-size:11px}.dsa-empty{padding:18px!important;color:var(--muted);text-align:center}
.dsa-history-pagination{display:flex;align-items:center;justify-content:center;gap:12px;margin-top:9px;color:#405d70;font-size:12px}.dsa-history-pagination[hidden]{display:none}.dsa-history-pagination span{text-align:center}.dsa-history-pagination small{color:var(--muted);font-size:10.5px}.dsa-history-pagination .dsa-secondary{min-width:76px;min-height:30px;padding:5px 9px}.dsa-history-pagination .dsa-secondary:disabled{opacity:.45;cursor:default}

.dsa-history-detail td{padding:11px;background:#f8fafb;vertical-align:top}.dsa-detail-meta{display:flex;flex-wrap:wrap;gap:4px 18px;margin-bottom:5px;color:#4f6477;font-size:11.5px}
.dsa-history-message,.dsa-muted{margin:6px 0;color:var(--muted);font-size:12px}.dsa-result-summary{margin:8px 0;padding:9px 10px;background:#fff;border:1px solid var(--line);border-left:3px solid #78a9c2;border-radius:3px}
.dsa-result-summary h4{margin:0 0 2px;color:#234b64;font-size:13px}.dsa-summary-name,.dsa-summary-organism{margin:1px 0;color:var(--muted);font-size:11.5px}
.dsa-summary-metrics{display:grid;grid-template-columns:repeat(auto-fit,minmax(92px,1fr));gap:4px;margin-top:6px}.dsa-summary-metric{padding:5px 6px;background:#f1f5f7;border-radius:2px}
.dsa-summary-metric b,.dsa-summary-metric span{display:block}.dsa-summary-metric b{color:var(--muted);font-size:9.5px;overflow-wrap:anywhere}.dsa-summary-metric span{margin-top:1px;color:#18344d;font-size:12px;font-weight:700}
.dsa-preview-link{display:block;margin:8px 0}.dsa-preview{display:block;width:100%;max-width:760px;height:auto;background:#fff;border:1px solid var(--line);border-radius:3px}
.dsa-download-actions{margin:7px 0}.dsa-download-all{display:inline-block;padding:6px 10px;color:#fff!important;background:var(--blue);border-radius:3px;font-size:12px;font-weight:600;text-decoration:none}.dsa-download-all:hover{background:var(--blue-dark)}
.dsa-file-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px}.dsa-file{display:block;margin:0;padding:6px 8px;color:var(--blue);background:#fff;border:1px solid var(--line);border-radius:3px;font-size:11px;overflow-wrap:anywhere;text-decoration:none}.dsa-file:hover{background:var(--blue-soft)}

@media(max-width:720px){
 .dsa-app{width:calc(100% - 12px);margin:6px auto;padding:12px;border-radius:3px;box-shadow:none}.dsa-app>header h2{font-size:20px}.dsa-app>header p{font-size:12px}
 .dsa-grid{grid-template-columns:1fr;gap:6px}.dsa-mode{gap:6px 14px}.dsa-upload-selection-row{align-items:flex-start}.dsa-history-heading{align-items:flex-start}.dsa-history-heading>div{min-width:0}.dsa-history-heading h3{font-size:18px}.dsa-history-heading p{overflow-wrap:anywhere}
 .dsa-history-scroll{overflow:visible;border:0}.dsa-history table,.dsa-history tbody{display:block;width:100%;min-width:0}.dsa-history thead{display:none}
 .dsa-history-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%;margin-top:9px;overflow:hidden;background:#fff;border:1px solid var(--line);border-radius:4px}.dsa-history-row:first-child{margin-top:0}
 .dsa-history .dsa-history-row td:nth-child(n){display:block;width:100%;min-width:0;max-width:none;padding:8px 9px;white-space:normal;word-break:normal;overflow-wrap:anywhere;border-top:1px solid var(--line-soft)}
 .dsa-history-row td::before{display:block;margin-bottom:2px;color:var(--muted);font-size:9.5px;font-weight:700;line-height:1.2;letter-spacing:.025em;text-transform:uppercase}
 .dsa-history-row td:nth-child(1){grid-column:1/-1;border-top:0}.dsa-history-row td:nth-child(6){grid-column:1/-1}
 .dsa-history-row td:nth-child(1)::before{content:"Analysis"}.dsa-history-row td:nth-child(2)::before{content:"Submitted"}.dsa-history-row td:nth-child(3)::before{content:"Status"}
 .dsa-history-row td:nth-child(4)::before{content:"UMF"}.dsa-history-row td:nth-child(5)::before{content:"cis/len (%)"}.dsa-history-row td:nth-child(6)::before{content:"Results"}
 .dsa-result-actions{flex-wrap:wrap;gap:6px}.dsa-history .dsa-view,.dsa-history .dsa-delete{width:auto;min-width:64px}
 .dsa-history-detail[hidden]{display:none!important}.dsa-history-detail:not([hidden]){display:block;width:100%;margin:-1px 0 9px;border:1px solid var(--line);border-radius:0 0 4px 4px}
 .dsa-history .dsa-history-detail td:nth-child(n){display:block;width:100%;min-width:0;max-width:none;padding:9px;white-space:normal;word-break:normal;overflow-wrap:anywhere;border:0}
 .dsa-detail-meta{display:grid;grid-template-columns:1fr;gap:3px}.dsa-summary-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.dsa-file-list{grid-template-columns:1fr}.dsa-download-all{max-width:100%;text-align:center}.dsa-history-pagination{gap:7px}.dsa-history-pagination .dsa-secondary{min-width:68px;padding:5px 7px}
}
@media(max-width:420px){.dsa-history-row{grid-template-columns:1fr}.dsa-history-row td{grid-column:1/-1!important}.dsa-summary-metrics{grid-template-columns:1fr}}
