
  :root{
    --sidebar-w:236px;
    --radius:14px;
    --shadow:0 10px 24px rgba(15,23,42,.08);
  }
  body[data-theme="dark"]{
    --bg:#090f1d;
    --bg-2:#0d1324;
    --panel:#131b2e;
    --panel-2:#0f1728;
    --line:#27324a;
    --line-soft:#1b2438;
    --text:#eef2ff;
    --muted:#9ea9c7;
    --brand:#7c8dff;
    --brand-soft:#1b2340;
    --ok:#52d690;
    --ok-bg:#112e25;
    --warn:#f0c56a;
    --warn-bg:#33260e;
    --bad:#ff7b88;
    --bad-bg:#351821;
    --surface:#101729;
  }
  body[data-theme="light"]{
    --bg:#f4f7fb;
    --bg-2:#eef3f9;
    --panel:#ffffff;
    --panel-2:#f9fbfe;
    --line:#dce4f0;
    --line-soft:#edf2f8;
    --text:#162033;
    --muted:#66758f;
    --brand:#4f63ff;
    --brand-soft:#edf0ff;
    --ok:#198754;
    --ok-bg:#eaf8f0;
    --warn:#9a6700;
    --warn-bg:#fff5dc;
    --bad:#d92d20;
    --bad-bg:#fff0ee;
    --surface:#ffffff;
  }
  *{box-sizing:border-box}
  html,body{height:100%}
  body{margin:0;background:linear-gradient(180deg,var(--bg-2),var(--bg));color:var(--text);font:14px/1.45 Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
  button,select,textarea,input{font:inherit}
  .app{display:grid;grid-template-columns:var(--sidebar-w) minmax(0,1fr);min-height:100vh}
  .sidebar{background:#050b17;border-right:1px solid rgba(255,255,255,.05);padding:14px 14px 18px;display:flex;flex-direction:column;gap:16px}
  body[data-theme="light"] .sidebar{background:#0f1728}
  .logo-card{padding:10px 10px 14px;border-radius:14px;background:rgba(255,255,255,.03);border:1px solid rgba(255,255,255,.06)}
  .logo-title{font-size:26px;font-weight:900;line-height:1;color:#fff;margin-bottom:8px}
  .logo-sub{font-size:12px;color:#b5c0db;line-height:1.5}
  .nav-group-title{font-size:11px;font-weight:800;color:#7e8bad;text-transform:uppercase;letter-spacing:.08em;margin:4px 8px 2px}
  .nav-stack{display:grid;gap:8px}
  .nav-btn{width:100%;height:44px;border-radius:12px;border:1px solid transparent;background:transparent;color:#dce4fb;padding:0 14px;text-align:left;font-weight:750;cursor:pointer}
  .nav-btn:hover{background:rgba(124,141,255,.08)}
  .nav-btn.active{background:#19253f;border-color:#223152;color:#fff}
  .sidebar-footer{margin-top:auto}
  .theme-btn{width:100%;height:40px;border-radius:12px;border:1px solid rgba(255,255,255,.08);background:rgba(255,255,255,.04);color:#fff;font-weight:700;cursor:pointer}
  .main{min-width:0;display:flex;flex-direction:column}
  .topbar{height:56px;padding:0 20px;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;gap:16px;background:rgba(5,11,23,.55);backdrop-filter:blur(10px);position:sticky;top:0;z-index:10}
  body[data-theme="light"] .topbar{background:rgba(255,255,255,.75)}
  .topbar-title{display:flex;flex-direction:column;min-width:0}
  .topbar-title strong{font-size:15px;line-height:1.2}
  .topbar-title span{font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .toolbar{display:flex;align-items:center;gap:10px}
  .pill{height:34px;padding:0 12px;border-radius:999px;border:1px solid var(--line);background:var(--panel);display:inline-flex;align-items:center;color:var(--muted);font-size:12px;font-weight:800}
  .content{padding:16px 20px 20px;min-width:0}
  .hidden{display:none!important}
  .page-head{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;margin-bottom:12px}
  .page-head h1{font-size:20px;line-height:1.2;margin:0 0 4px}
  .page-head p{margin:0;color:var(--muted);font-size:12px}
  .page-actions{display:flex;gap:8px;align-items:center}
  .btn{height:38px;border-radius:10px;border:1px solid var(--line);background:var(--panel);padding:0 12px;color:var(--text);font-weight:750;cursor:pointer}
  .btn.primary{background:var(--brand);border-color:var(--brand);color:#fff}
  .btn.primary:disabled{opacity:.45;cursor:not-allowed}
  .btn.ghost{background:transparent}
  .grid-2{display:grid;grid-template-columns:1.2fr .8fr;gap:14px}
  .section{margin-top:14px}
  .card{background:linear-gradient(180deg,var(--panel),var(--panel-2));border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow)}
  .card-pad{padding:14px}
  .order-form{display:grid;grid-template-columns:1fr 1fr auto;gap:12px;align-items:end}
  .field label{display:block;font-size:11px;font-weight:800;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);margin-bottom:6px}
  select,.prompt-input,.derivation-input{width:100%;border:1px solid var(--line);border-radius:10px;padding:0 12px;background:var(--surface);color:var(--text)}
  select{height:38px}
  .fixed-note{margin-top:10px;color:var(--muted);font-size:12px}
  .section-head{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:10px}
  .section-head h2{font-size:14px;margin:0}
  .compact-note{font-size:12px;color:var(--muted)}
  table{width:100%;border-collapse:collapse}
  .table-wrap{overflow:auto}
  th,td{padding:10px 12px;border-bottom:1px solid var(--line-soft);text-align:left;vertical-align:top;white-space:nowrap}
  th{font-size:11px;text-transform:uppercase;letter-spacing:.05em;color:var(--muted);background:rgba(255,255,255,.02)}
  tbody tr:last-child td{border-bottom:0}
  tbody tr.clickable:hover{background:rgba(124,141,255,.06);cursor:pointer}
  .status{display:inline-flex;align-items:center;border-radius:999px;padding:4px 8px;font-size:11px;font-weight:800;border:1px solid transparent}
  .status.run{background:var(--warn-bg);color:var(--warn)}
  .status.ok{background:var(--ok-bg);color:var(--ok)}
  .status.bad{background:var(--bad-bg);color:var(--bad)}
  .subtabs{display:flex;gap:8px;margin-bottom:10px}
  .subtab{height:36px;border-radius:10px;border:1px solid var(--line);background:var(--panel);color:var(--muted);padding:0 12px;font-weight:750;cursor:pointer}
  .subtab.active{background:var(--brand-soft);border-color:rgba(124,141,255,.4);color:var(--brand)}
  .toolbar-line{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:12px 14px;border-bottom:1px solid var(--line)}
  .grade-wrap{display:flex;align-items:center;gap:10px;min-width:0}
  .grade-label{font-size:11px;font-weight:800;text-transform:uppercase;letter-spacing:.04em;color:var(--muted)}
  .grade-input{height:36px;min-width:180px;max-width:220px}
  .topic-badge{display:inline-flex;align-items:center;height:32px;padding:0 12px;border-radius:999px;background:var(--brand-soft);color:var(--brand);font-weight:800}
  .matrix-wrap{overflow:auto;padding:14px}
  .matrix{display:grid;grid-template-columns:180px repeat(3,minmax(260px,1fr));min-width:980px;border:1px solid var(--line);border-radius:14px;overflow:hidden}
  .matrix-head,.matrix-row-head{background:rgba(255,255,255,.02);font-weight:800}
  .matrix-head{padding:12px;border-right:1px solid var(--line);border-bottom:1px solid var(--line);text-align:center}
  .matrix-row-head{padding:12px;border-right:1px solid var(--line);border-bottom:1px solid var(--line)}
  .matrix-cell{padding:12px;border-right:1px solid var(--line);border-bottom:1px solid var(--line);min-height:210px}
  .matrix-cell:nth-child(4n){border-right:0}
  .matrix > :nth-last-child(-n+4){border-bottom:0}
  .cell-code{font-size:11px;font-weight:900;color:var(--brand);margin-bottom:8px}
  .cell-block-title{font-size:10px;font-weight:900;color:var(--muted);text-transform:uppercase;letter-spacing:.06em;margin:9px 0 6px}
  .sample-box{border:1px dashed var(--line);border-radius:10px;padding:10px;background:rgba(255,255,255,.02)}
  .sample-file-name{font-size:12px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-bottom:8px}
  .sample-file-name.empty{color:var(--muted);font-weight:600}
  .sample-file-btn{height:30px;border-radius:8px;border:1px solid var(--line);background:var(--panel);color:var(--brand);padding:0 10px;font-weight:800;cursor:pointer}
  .sample-file-input{display:none}
  .derivation-input{min-height:76px;resize:vertical;padding:10px 12px;line-height:1.45}
  .prompt-stack{display:grid;grid-template-columns:1fr 1fr;gap:14px}
  .prompt-card{padding:14px}
  .prompt-card h3{margin:0 0 10px;font-size:13px}
  .prompt-input{min-height:260px;resize:vertical;padding:10px 12px;line-height:1.5}
  .detail-head{display:flex;align-items:center;gap:10px}
  .live{display:inline-flex;align-items:center;gap:6px;color:var(--muted);font-size:12px}
  .pulse{width:8px;height:8px;border-radius:50%;background:var(--warn);animation:pulse 1s infinite}
  @keyframes pulse{50%{opacity:.25}}
  .kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
  .kpi{padding:14px;border-top:2px solid rgba(82,214,144,.8);min-height:104px}
  .kpi .label{font-size:11px;font-weight:800;color:var(--muted);text-transform:uppercase;letter-spacing:.04em}
  .kpi .value{font-size:26px;font-weight:900;line-height:1.2;margin-top:6px}
  .kpi .sub{font-size:11px;color:var(--muted);line-height:1.5;margin-top:6px}
  .progress{height:6px;background:var(--line-soft);border-radius:999px;overflow:hidden;margin-top:8px}
  .progress span{display:block;height:100%;background:var(--brand)}
  .results-head{display:flex;align-items:center;gap:8px}
  .count{font-size:12px;color:var(--muted)}
  .question-link{color:var(--brand);font-weight:800;cursor:pointer}
  .empty{padding:28px 14px;text-align:center;color:var(--muted)}
  .fail-box{margin-top:8px;padding:10px;border-radius:10px;background:var(--bad-bg);color:var(--bad);font-size:12px}
  .modal{position:fixed;inset:0;background:rgba(2,6,23,.52);display:grid;place-items:center;padding:20px;z-index:50}
  .modal-card{width:min(860px,100%);background:var(--panel);border:1px solid var(--line);border-radius:16px;overflow:hidden;box-shadow:0 30px 80px rgba(0,0,0,.32)}
  .modal-head{padding:14px 16px;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;align-items:center}
  .modal-body{padding:16px}
  .close{border:0;background:transparent;color:var(--text);font-size:24px;cursor:pointer}
  .detail-list{display:grid;grid-template-columns:180px 1fr;border:1px solid var(--line);border-radius:12px;overflow:hidden}
  .detail-list div{padding:10px 12px;border-bottom:1px solid var(--line)}
  .detail-list div:nth-last-child(-n+2){border-bottom:0}
  .detail-list .key{background:rgba(255,255,255,.02);color:var(--muted);font-weight:800}
  .question-render{display:grid;gap:10px;white-space:normal}
  .question-instruction{font-size:12px;color:var(--muted);font-style:italic}
  .question-stem{font-weight:700;line-height:1.55}
  .answer-options,.ordering-list,.matching-list{display:grid;gap:7px}
  .answer-option,.ordering-item,.matching-side{padding:8px 10px;border:1px solid var(--line);border-radius:10px;background:rgba(255,255,255,.02)}
  .answer-line{font-size:12px;font-weight:900;color:var(--ok)}
  .matching-row{display:grid;grid-template-columns:minmax(0,1fr) 24px minmax(0,1fr);align-items:center;gap:7px}
  .matching-arrow{text-align:center;color:var(--muted);font-weight:900}
  @media(max-width:1200px){.grid-2,.prompt-stack,.kpis{grid-template-columns:1fr 1fr}.kpis{grid-template-columns:repeat(2,minmax(0,1fr))}}
  @media(max-width:960px){.app{grid-template-columns:1fr}.sidebar{position:sticky;top:0;z-index:20;flex-direction:row;align-items:center;overflow:auto}.logo-card,.nav-group-title{display:none}.nav-stack{display:flex}.topbar{top:58px}.order-form{grid-template-columns:1fr}.grid-2,.prompt-stack,.kpis{grid-template-columns:1fr}.content{padding:12px}}

  /* ===== UX/UI compact optimization ===== */
  :root{--sidebar-w:204px;--radius:12px;--shadow:0 6px 18px rgba(15,23,42,.06)}
  body{font-size:13px}
  .sidebar{padding:12px 10px 14px;gap:12px}
  .logo-card{padding:8px 9px 10px;border-radius:12px}
  .logo-title{font-size:22px;margin-bottom:5px}
  .logo-sub{font-size:11px}
  .nav-stack{gap:5px}
  .nav-btn{height:38px;border-radius:9px;padding:0 11px;font-size:13px}
  .theme-btn{height:36px;border-radius:9px}
  .topbar{height:50px;padding:0 16px}
  .topbar-title strong{font-size:14px}
  .topbar-title span{font-size:11px}
  .toolbar{gap:7px}
  .pill{height:30px;padding:0 10px}
  .content{padding:12px 16px 16px}
  .page-head{margin-bottom:9px;align-items:center}
  .page-head h1{font-size:18px;margin-bottom:2px}
  .page-head p{font-size:11px}
  .btn{height:34px;border-radius:8px;padding:0 10px;font-size:12px}
  .card-pad{padding:12px}
  .order-form{grid-template-columns:minmax(220px,1fr) minmax(220px,1fr) auto;gap:10px}
  .field label{margin-bottom:4px;font-size:10px}
  select{height:34px}
  select,.prompt-input,.derivation-input{border-radius:8px;padding-left:10px;padding-right:10px}
  .fixed-note{margin-top:7px;font-size:11px}
  .section{margin-top:10px}
  .section-head{margin-bottom:7px}
  .section-head h2{font-size:13px}
  .table-wrap{border-radius:12px}
  th,td{padding:8px 10px}
  th{font-size:10px;position:sticky;top:0;z-index:2;background:var(--panel-2)}
  .status{padding:3px 7px;font-size:10px}
  .subtabs{gap:6px;margin-bottom:8px}
  .subtab{height:32px;border-radius:8px;padding:0 10px;font-size:12px}
  .toolbar-line{padding:9px 12px;position:sticky;top:50px;z-index:6;background:var(--panel)}
  .grade-wrap{gap:8px}
  .grade-input{height:32px;min-width:150px;max-width:190px}
  .topic-badge{height:28px;padding:0 10px;font-size:12px}
  .matrix-wrap{padding:10px}
  .matrix{grid-template-columns:150px repeat(3,minmax(230px,1fr));min-width:860px;border-radius:11px}
  .matrix-head,.matrix-row-head{padding:9px}
  .matrix-head{position:sticky;top:0;z-index:4;background:var(--panel-2)}
  .matrix-row-head{font-size:12px}
  .matrix-cell{padding:9px;min-height:168px}
  .cell-code{font-size:10px;margin-bottom:5px}
  .cell-block-title{font-size:9px;margin:6px 0 4px}
  .sample-box{padding:7px;border-radius:8px;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:7px}
  .sample-file-name{margin-bottom:0;font-size:11px}
  .sample-file-btn{height:27px;border-radius:7px;padding:0 8px;font-size:11px}
  .derivation-input{min-height:86px;padding:8px 9px;font-size:12px}
  .prompt-stack{gap:10px}
  .prompt-card{padding:11px}
  .prompt-card h3{margin-bottom:7px;font-size:12px}
  .prompt-input{min-height:220px;padding:9px 10px;font-size:12px}
  .detail-head{gap:7px}
  .kpis{grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
  .kpi{padding:10px;min-height:88px}
  .kpi .label{font-size:9px}
  .kpi .value{font-size:21px;margin-top:4px}
  .kpi .sub{font-size:10px;margin-top:4px}
  .progress{height:5px;margin-top:6px}
  .modal-card{width:min(920px,calc(100vw - 32px));max-height:88vh;display:flex;flex-direction:column}
  .modal-head{padding:10px 14px;flex:0 0 auto}
  .modal-body{padding:12px;overflow:auto}
  .detail-list{grid-template-columns:150px 1fr;border-radius:10px}
  .detail-list div{padding:8px 10px}
  .question-render{gap:8px}
  .answer-option,.ordering-item,.matching-side{padding:7px 9px;border-radius:8px}
  @media(max-width:1200px){.kpis{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-2,.prompt-stack{grid-template-columns:1fr 1fr}}
  @media(max-width:1050px){.kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.order-form{grid-template-columns:1fr 1fr auto}}
  @media(max-width:960px){.toolbar-line{top:58px}.order-form{grid-template-columns:1fr}.kpis,.prompt-stack,.grid-2{grid-template-columns:1fr}.content{padding:10px}.matrix-wrap{padding:8px}}


.model-capability{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;margin:.5rem 0}.model-capability .status{font-size:.875rem}.model-capability .btn{padding:.35rem .6rem;font-size:.875rem}.key-line select{min-width:0;flex:1}

.capability-batch-progress{flex-basis:100%;font-size:.875rem;color:var(--muted);line-height:1.5}

.embedded-orders{margin-top:2rem;padding-top:1.5rem;border-top:1px solid var(--line)}

.exact-prompt{white-space:pre-wrap;overflow-wrap:anywhere;max-width:100%;font:inherit;line-height:1.65;padding:1rem;background:var(--panel);border:1px solid var(--line);border-radius:10px;text-align:left}.snapshot-file summary{cursor:pointer;overflow-wrap:anywhere}

.prompt-formats{min-width:600px;width:100%;table-layout:fixed}.prompt-formats caption{text-align:left;font-weight:600;padding:1rem 0}.prompt-formats th:first-child{width:22%}.prompt-formats th:nth-child(2){width:42%}.prompt-formats td{vertical-align:top;white-space:normal}.prompt-formats code{white-space:pre-wrap;overflow-wrap:anywhere;font-size:.875rem}

#promptsPage .prompt-input{min-height:100px;margin:8px 0 12px}
#promptsPage .prompt-card>label{font-size:12px;color:var(--muted)}

/* Prompt edits use an explicit draft after the warning dialog. */
.prompt-edit{margin:8px 0;font-size:12px}.prompt-formats .prompt-edit{display:block}.prompt-input[readonly]{cursor:default;background:var(--bg)}#promptEditorText{min-height:360px;resize:vertical}

.probe-summary{font-size:14px;color:var(--muted);margin:8px 0}.probe-failures{display:flex;gap:8px;flex-wrap:wrap;margin:8px 0}.probe-failure{font-size:13px;border:1px solid var(--line);padding:4px 8px;border-radius:6px;color:var(--warn)}.probe-image{width:100%;max-width:640px;height:auto;display:block;background:white;border-radius:8px;margin:12px 0}.probe-evidence-test{padding:16px 0;border-bottom:1px solid var(--line)}.probe-evidence-test h4{margin:12px 0 6px}.probe-answer-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}.probe-result[data-state=passed]{color:var(--good)}.probe-result[data-state=failed],.probe-result[data-state=unsupported]{color:var(--bad)}.probe-api-request{padding:12px 0}#probeEvidenceBody .exact-prompt{overflow-wrap:anywhere;white-space:pre-wrap}@media(max-width:600px){.probe-answer-grid{grid-template-columns:1fr}}
.worker-summary{margin:.75rem 0;font-size:.875rem}.worker-summary summary{cursor:pointer;font-weight:600}.worker-summary .table-wrap{margin-top:.75rem}.worker-summary td small{display:block;color:var(--muted);margin-top:.25rem}

.prompt-references{margin-top:24px}.prompt-reference-table{width:100%;min-width:560px;table-layout:fixed}.prompt-reference-table th:first-child{width:34%}.prompt-reference-table th[scope="row"]{font-size:14px;font-weight:600;white-space:normal}.prompt-reference-table .pack-version{display:block;margin-top:4px}.prompt-reference-file{display:flex;align-items:center;justify-content:space-between;gap:12px}.prompt-reference-file>span{min-width:0;overflow-wrap:anywhere;white-space:normal;font-size:14px}.prompt-reference-file>.btn{flex-shrink:0}

.connection-image-models{margin-top:20px;border-top:1px solid var(--line);padding-top:12px}.connection-image-models h4{font-size:14px;margin:0 0 12px}.capability-tag.generation{color:var(--brand);border-color:var(--brand);background:var(--brand-soft)}

.learning-panel{margin-bottom:24px}.learning-settings{display:flex;flex-wrap:wrap;gap:16px;margin:16px 0}.learning-settings label{display:flex;flex-direction:column;gap:6px;max-width:300px}.learning-settings input[type=checkbox]{width:18px;height:18px}.learning-version{padding:12px 0;border-top:1px solid var(--border,#304056)}.learning-note{padding:12px;border-radius:8px;background:var(--panel,#172033)}.learning-panel .exact-prompt{max-height:260px;overflow:auto;white-space:pre-wrap}.learning-panel table{width:100%;margin:12px 0}
