/* Pre-Mortem forensic workspace */
:root {
  color-scheme: dark;
  --bg: #090a0c;
  --bg-soft: #0f1114;
  --panel: #14161a;
  --panel-2: #1a1d22;
  --border: #2b2e34;
  --border-soft: #22252a;
  --text: #ece9e5;
  --text-dim: #aaa6a0;
  --text-faint: #74716d;
  --red: #9f2940;
  --red-strong: #b93650;
  --red-soft: rgba(159, 41, 64, .15);
  --green: #789586;
  --green-soft: rgba(120, 149, 134, .14);
  --amber: #a58b63;
  --amber-soft: rgba(165, 139, 99, .14);
  --blue: #8c99a7;
  --blue-soft: rgba(140, 153, 167, .13);
  --mark-bg: #444950;
  --mark-border: #777d86;
  --mark-text: #f2f3f4;
  --mark-detail: #aeb3ba;
  --shadow: 0 24px 70px rgba(0, 0, 0, .24);
  --radius: 14px;
  --radius-sm: 8px;
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f3f1;
  --bg-soft: #eceae7;
  --panel: #fbfaf8;
  --panel-2: #f0eeeb;
  --border: #d4d0cb;
  --border-soft: #e2dfda;
  --text: #1b1b1d;
  --text-dim: #625f5b;
  --text-faint: #89847e;
  --red: #8e1f2f;
  --red-strong: #741827;
  --red-soft: rgba(142, 31, 47, .09);
  --green: #4d7060;
  --green-soft: rgba(77, 112, 96, .1);
  --amber: #806842;
  --amber-soft: rgba(128, 104, 66, .1);
  --blue: #586978;
  --blue-soft: rgba(88, 105, 120, .1);
  --mark-bg: #666b72;
  --mark-border: #3f444a;
  --mark-text: #ffffff;
  --mark-detail: #d9dcdf;
  --shadow: 0 24px 70px rgba(32, 26, 22, .09);
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
html { background: var(--bg); }
body { margin: 0; color: var(--text); background: var(--bg); font-family: var(--font); font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none; opacity: .46; background-image: linear-gradient(var(--border-soft) 1px, transparent 1px), linear-gradient(90deg, var(--border-soft) 1px, transparent 1px); background-size: 64px 64px; mask-image: linear-gradient(to bottom, #000 0%, rgba(0,0,0,.72) 45%, transparent 88%); }
body::after { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: linear-gradient(90deg, transparent 0 76%, var(--red-soft) 76% 76.08%, transparent 76.08%); opacity: .48; }
[hidden] { display: none !important; }
::selection { color: #fff; background: var(--red); }
button, input, select, textarea { font: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
.app { display: flex; min-height: 100vh; }
.sidebar { position: sticky; top: 0; width: 264px; height: 100vh; flex-shrink: 0; display: flex; flex-direction: column; padding: 26px 20px 22px; overflow: hidden; background: color-mix(in srgb, var(--bg-soft) 96%, transparent); border-right: 1px solid var(--border); }
.sidebar::after { content: ""; position: absolute; inset: auto 0 0; height: 28%; pointer-events: none; background: linear-gradient(to top, var(--red-soft), transparent); opacity: .42; }
.brand, .nav, .sidebar-footer, .protocol-label { position: relative; z-index: 1; }
.brand { display: flex; align-items: center; gap: 13px; padding: 0 8px 26px; border-bottom: 1px solid var(--border); }
.brand-mark { position: relative; display: grid; width: 42px; height: 48px; flex: 0 0 42px; place-items: center; overflow: hidden; color: var(--mark-text); background: var(--mark-bg); border: 1px solid var(--mark-border); border-radius: 20px 20px 7px 7px; box-shadow: inset 0 0 0 4px color-mix(in srgb, var(--mark-bg) 72%, var(--mark-border)); }
.brand-mark::after { content: ""; position: absolute; right: 7px; bottom: 6px; left: 7px; height: 1px; background: var(--mark-detail); }
.brand-mark span { font-family: var(--mono); font-size: 10px; font-weight: 900; letter-spacing: 1px; }
.brand-copy { min-width: 0; }
.brand-name { font-size: 13px; font-weight: 850; letter-spacing: 2px; }
.brand-tag { margin-top: 3px; color: var(--red-strong); font-family: var(--mono); font-size: 9px; font-weight: 800; letter-spacing: 2.4px; }
.protocol-label, .workspace-bar, .panel-kicker, .archive-head { display: flex; align-items: center; justify-content: space-between; color: var(--text-faint); font-family: var(--mono); font-size: 9px; font-weight: 700; letter-spacing: 1.3px; }
.protocol-label { padding: 22px 12px 8px; }
.nav { display: flex; flex-direction: column; gap: 5px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 13px; width: 100%; min-height: 45px; padding: 10px 12px; color: var(--text-dim); background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm); cursor: pointer; text-align: left; transition: color .18s ease, background .18s ease, border-color .18s ease, transform .18s ease; }
.nav-item:hover { color: var(--text); background: var(--panel); border-color: var(--border-soft); transform: translateX(2px); }
.nav-item.active { color: var(--text); background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 42%, transparent); }
.nav-item.active::before { content: ""; position: absolute; top: 9px; bottom: 9px; left: -1px; width: 2px; background: var(--red); }
.nav-item.active::after { content: ""; width: 5px; height: 5px; margin-left: auto; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.nav-index { width: 23px; color: var(--text-faint); font-family: var(--mono); font-size: 9px; letter-spacing: 1px; }
.nav-item.active .nav-index { color: var(--red-strong); }
.sidebar-footer { display: flex; flex-direction: column; gap: 13px; margin-top: auto; }
.system-state { display: flex; align-items: center; gap: 8px; color: var(--green); font-family: var(--mono); font-size: 9px; font-weight: 800; letter-spacing: 1.4px; }
.sidebar-actions { display: flex; gap: 8px; }
.icon-btn { width: 42px; flex: 0 0 42px; padding: 0; }
.hint { color: var(--text-faint); font-family: var(--mono); font-size: 9px; line-height: 1.7; }
.status-dot, .pulse { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
.system-state .status-dot { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.main { flex: 1; min-width: 0; padding: 28px clamp(26px, 5vw, 80px) 76px; }
.workspace-bar { max-width: 1180px; margin: 0 auto 54px; }
.workspace-line { height: 1px; flex: 1; margin: 0 15px; background: var(--border-soft); }
.view { display: none; max-width: 1180px; margin: 0 auto; animation: reveal .32s ease both; }
.view.active { display: block; }
@keyframes reveal { from { opacity: 0; transform: translateY(8px); } }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 26px; padding-bottom: 25px; border-bottom: 1px solid var(--border); }
.head-copy { min-width: 0; }
.eyebrow { margin-bottom: 9px; color: var(--red); font-family: var(--mono); font-size: 10px; font-weight: 800; letter-spacing: 2px; }
.view-head h1 { max-width: 760px; margin: 0 0 7px; font-size: clamp(30px, 4vw, 46px); font-weight: 720; line-height: 1.05; letter-spacing: -1.7px; text-wrap: balance; }
.view-head .sub { max-width: 720px; margin: 0; color: var(--text-dim); font-size: 14px; line-height: 1.6; text-wrap: pretty; }
.case-stamp { display: flex; width: 170px; flex: 0 0 170px; flex-direction: column; gap: 2px; padding: 12px 14px; color: var(--text-faint); background: var(--bg-soft); border: 1px solid var(--border); border-left: 2px solid var(--red); border-radius: var(--radius-sm); font-family: var(--mono); font-size: 8px; letter-spacing: 1.2px; }
.case-stamp strong { color: var(--red-strong); font-size: 11px; letter-spacing: 1.5px; }
.case-stamp small { font-size: 8px; }
.panel, .report-list-panel, .report-view-panel { background: color-mix(in srgb, var(--panel) 97%, transparent); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel { position: relative; margin-bottom: 18px; padding: 28px; }
.panel::before { content: ""; position: absolute; top: -1px; left: 28px; width: 66px; height: 2px; background: var(--red); }
.panel-kicker { margin-bottom: 22px; padding-bottom: 11px; border-bottom: 1px solid var(--border-soft); }
.intake-panel { padding: 30px; }
.notice-panel { box-shadow: none; }
.field-label, .form-field, .select-label { color: var(--text-dim); font-size: 12px; font-weight: 700; }
.field-label { display: block; margin-bottom: 9px; }
.textarea-shell { position: relative; }
.corner-mark { position: absolute; right: 8px; bottom: 8px; width: 12px; height: 12px; pointer-events: none; border-right: 1px solid var(--red); border-bottom: 1px solid var(--red); }
textarea, input[type="text"], input[type="password"], input[type="number"], select { width: 100%; padding: 12px 13px; color: var(--text); background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); transition: border-color .16s, box-shadow .16s, background .16s; }
textarea:hover, input:hover, select:hover { border-color: var(--text-faint); }
textarea:focus, input:focus, select:focus { outline: none; background: var(--panel); border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
textarea { min-height: 178px; padding: 16px; resize: vertical; line-height: 1.7; }
textarea::placeholder, input::placeholder { color: var(--text-faint); opacity: .75; }
select { appearance: none; cursor: pointer; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%), linear-gradient(135deg, var(--text-dim) 50%, transparent 50%); background-position: calc(100% - 17px) 54%, calc(100% - 12px) 54%; background-size: 5px 5px; background-repeat: no-repeat; }
.btn { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 7px; padding: 10px 18px; color: var(--text); background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm); font-weight: 750; cursor: pointer; white-space: nowrap; transition: transform .17s ease, background .17s ease, border-color .17s ease, color .17s ease; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { color: #fff; background: var(--red); border-color: var(--red); box-shadow: 0 10px 24px var(--red-soft); }
.btn-primary:hover:not(:disabled) { background: var(--red-strong); border-color: var(--red-strong); }
.btn-danger { color: var(--red-strong); background: var(--red-soft); border-color: var(--red); }
.btn-ghost { color: var(--text-dim); background: var(--panel); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { color: var(--text); background: var(--panel-2); border-color: var(--text-faint); }
.btn-block { width: 100%; }
.run-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; margin-top: 18px; }
.intake-note { margin: 0; color: var(--text-faint); font-family: var(--mono); font-size: 9px; letter-spacing: .6px; }
.select-label, .form-field { display: flex; flex-direction: column; gap: 7px; }
.select-label select { width: 210px; }
.run-actions { display: flex; gap: 9px; margin-left: auto; }
.live-head { display: flex; align-items: center; gap: 9px; margin-bottom: 20px; color: var(--text-dim); font-family: var(--mono); font-size: 10px; }
.live-head strong { color: var(--text); letter-spacing: 1.4px; }
.live-divider { width: 32px; height: 1px; background: var(--border); }
.pulse { animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px var(--red-soft); } }
.budget-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 15px; }
.budget-head { display: flex; justify-content: space-between; margin-bottom: 7px; color: var(--text-dim); font-family: var(--mono); font-size: 9px; text-transform: uppercase; }
.budget-track { height: 6px; overflow: hidden; background: var(--bg-soft); border: 1px solid var(--border-soft); border-radius: 9px; }
.budget-fill { height: 100%; background: var(--blue); transition: width .35s ease; }
.budget-fill.danger { background: var(--red); }
.usage-row { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 13px; }
.usage-chip, .basis, .status-tag { border-radius: 99px; }
.usage-chip { padding: 4px 9px; color: var(--text-dim); background: var(--bg-soft); border: 1px solid var(--border-soft); font-family: var(--mono); font-size: 10px; }
.usage-chip b { color: var(--text); }
.log { max-height: 340px; overflow: auto; padding: 16px; color: var(--text-dim); background: var(--bg-soft); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); font-family: var(--mono); font-size: 11px; line-height: 1.75; scrollbar-color: var(--border) transparent; }
.log-line { position: relative; padding: 3px 0 3px 13px; white-space: pre-wrap; word-break: break-all; }
.log-line::before { content: ""; position: absolute; top: 11px; left: 0; width: 4px; height: 4px; border-radius: 50%; background: var(--border); }
.log-search, .risk-source, .md-report a { color: var(--blue); }
.log-fetch { color: var(--green); }
.log-nudge { color: var(--amber); }
.log-thinking { color: var(--text-faint); }
.report { animation: reveal .3s ease; }
.report-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.verdict { display: inline-flex; align-items: center; gap: 13px; padding: 14px 20px; border: 1px solid; border-radius: var(--radius-sm); font-family: var(--mono); letter-spacing: 2px; }
.verdict-label { font-size: 10px; opacity: .75; }
.verdict-value { font-size: 20px; font-weight: 900; }
.verdict-kill { color: var(--red-strong); background: var(--red-soft); }
.verdict-pivot { color: var(--amber); background: var(--amber-soft); }
.verdict-build { color: var(--green); background: var(--green-soft); }
.report-meta, .usage-foot { color: var(--text-faint); font-family: var(--mono); font-size: 10px; }
.r-section { margin-bottom: 30px; }
.r-section h3 { margin: 0 0 12px; font-size: 13px; letter-spacing: .5px; }
.r-section p { margin: 0; }

/* 打分卡：verdict 是用这些分数算出来的，不是模型自称的结论——公式明细要
   显眼地放在报告最上面，紧跟着 verdict，而不是藏在报告末尾没人看的地方。 */
.scorecard-section, .evidence-pyramid-section { padding: 16px; background: var(--panel-2); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); }
.scorecard-formula { margin: 0 0 14px; font-size: 12px; color: var(--text-dim); }
.scorecard-formula b { color: var(--text); font-family: var(--mono); }
.formula-note { color: var(--text-faint); font-size: 10.5px; }
.scorecard-bars { display: flex; flex-direction: column; gap: 9px; }
.scorecard-row { display: grid; grid-template-columns: 150px 1fr 34px; align-items: center; gap: 10px; font-size: 11.5px; }
.scorecard-dim { color: var(--text-dim); }
.scorecard-bar { position: relative; height: 7px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.scorecard-bar span { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--amber), var(--red-strong)); border-radius: 99px; }
.scorecard-val { text-align: right; font-family: var(--mono); color: var(--text); }

.pyramid-bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--bg); margin-bottom: 10px; }
.pyramid-evidence { background: var(--green); }
.pyramid-inference { background: var(--blue); }
.pyramid-hypothesis { background: var(--amber); }
.pyramid-legend { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 8px; font-size: 11px; color: var(--text-dim); }
.legend-evidence { color: var(--green); }
.legend-inference { color: var(--blue); }
.legend-hypothesis { color: var(--amber); }
.pyramid-signal-note { margin: 0; font-size: 11px; color: var(--text-faint); }

.r-summary { padding: 21px; background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.chain { display: flex; flex-wrap: wrap; gap: 8px; }
.chain-node, .risk-card, .conditions li, .exp-item { background: var(--panel-2); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); }
.chain-node { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-size: 12px; }
.chain-arrow { color: var(--red); }
.basis, .status-tag { padding: 2px 7px; font-size: 9px; font-weight: 800; letter-spacing: .4px; }
.basis-evidence, .status-proven, .status-likely { color: var(--green); background: var(--green-soft); }
.basis-inference { color: var(--blue); background: var(--blue-soft); }
.basis-hypothesis, .status-uncertain, .status-unknown { color: var(--amber); background: var(--amber-soft); }
.status-disproven, .status-unlikely { color: var(--red-strong); background: var(--red-soft); }
.risks { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 12px; }
.risk-card { display: flex; flex-direction: column; gap: 9px; padding: 16px; transition: border-color .17s ease, transform .17s ease; }
.risk-card:hover { border-color: var(--text-faint); transform: translateY(-2px); }
.risk-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.risk-title { font-weight: 750; }
.confidence { display: flex; align-items: center; gap: 6px; color: var(--text-dim); font-family: var(--mono); font-size: 10px; }
.confidence-bar { position: relative; width: 42px; height: 4px; overflow: hidden; background: var(--bg); border-radius: 9px; }
.confidence-bar::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--pct); background: var(--red); }
.risk-evidence { color: var(--text-dim); font-size: 12px; }
.risk-source { font-size: 10px; word-break: break-all; text-decoration: none; }
.risk-signals { display: flex; flex-wrap: wrap; gap: 6px; }
.signal-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border-radius: 99px; color: var(--text-dim); background: var(--bg-soft); border: 1px solid var(--border-soft); font-family: var(--mono); font-size: 10px; }
.signal-chip b { color: var(--text); }
.signal-chip a { color: var(--blue); text-decoration: none; margin-left: 2px; }
.conditions { display: flex; flex-direction: column; gap: 7px; margin: 0; padding: 0; list-style: none; }
.conditions li { display: flex; align-items: center; gap: 9px; padding: 10px 12px; font-size: 12px; }
.status-tag { margin-left: auto; }
.kv { display: flex; gap: 12px; margin-bottom: 9px; }
.kv .k { min-width: 110px; color: var(--text-dim); font-weight: 700; }
.experiment-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.exp-item { display: flex; flex-direction: column; gap: 5px; padding: 14px; font-size: 12px; }
.exp-item .k { color: var(--red); font-family: var(--mono); font-size: 9px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; }
.usage-foot { margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--border-soft); }
.settings-panel { padding: 0; overflow: hidden; }
.settings-panel::before { left: 30px; }
.settings-section { padding: 28px 30px; border-bottom: 1px solid var(--border-soft); }
.section-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; }
.section-code { display: grid; width: 24px; height: 24px; place-items: center; color: var(--red-strong); background: var(--red-soft); border: 1px solid color-mix(in srgb, var(--red) 35%, transparent); border-radius: 50%; font-family: var(--mono); font-size: 9px; font-weight: 900; }
.section-title { margin: 0; color: var(--text); font-family: var(--mono); font-size: 11px; font-weight: 850; letter-spacing: 1.4px; text-transform: uppercase; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.field-wide { grid-column: 1 / -1; }
.form-grid-5 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.form-note { margin: 3px 0 15px; color: var(--text-faint); font-size: 12px; line-height: 1.6; }
.form-field .form-note { margin: 0; font-weight: 400; }
.config-actions { display: flex; gap: 10px; margin-top: 24px; }
.config-actions-inline { align-items: center; margin-top: 12px; }
.config-actions-inline .form-note { margin: 0; }
.config-actions-inline + .conn-result { margin-top: 10px; }
.save-actions { align-items: center; justify-content: flex-end; margin: 0; padding: 22px 30px; background: var(--bg-soft); }
.save-caption { margin-right: auto; color: var(--text-faint); font-family: var(--mono); font-size: 9px; letter-spacing: .6px; }
.conn-result { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border-soft); }
.conn-row { padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); font-size: 12px; }
.conn-row.ok { border-color: var(--green); }
.conn-row.fail { border-color: var(--red); }
.conn-detail { margin-top: 3px; color: var(--text-dim); font-family: var(--mono); font-size: 10px; word-break: break-all; }
.conn-total { padding: 8px 11px; font-weight: 700; }
.conn-total.ok { color: var(--green); }
.conn-total.fail { color: var(--red); }
.conn-loading { color: var(--text-dim); }
.reports-layout { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.report-list-panel { max-height: calc(100vh - 230px); overflow: auto; padding: 10px; }
.archive-head { margin: 0 3px 9px; padding: 7px 7px 11px; border-bottom: 1px solid var(--border-soft); }
.report-list { display: flex; flex-direction: column; gap: 4px; }
.report-view-panel { min-height: 60vh; padding: 20px 30px 30px; }
.report-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 11px; color: var(--text-dim); background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm); cursor: pointer; text-align: left; transition: color .15s, background .15s, border-color .15s; }
.report-item:hover { color: var(--text); background: var(--panel-2); }
.report-item.active { color: var(--text); background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 35%, transparent); }
.report-item-name { font-family: var(--mono); font-size: 10px; word-break: break-all; }
.report-item-meta { color: var(--text-faint); font-size: 9px; white-space: nowrap; }
.report-item-del { padding: 4px; color: var(--text-faint); background: transparent; border: 0; cursor: pointer; }
.report-item-del:hover { color: var(--red); }
.empty { padding: 70px 12px; color: var(--text-faint); font-family: var(--mono); font-size: 11px; text-align: center; }
.md-report { line-height: 1.75; }
.md-report h2 { margin: 28px 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border-soft); font-size: 20px; }
.md-report h2:first-child { margin-top: 0; }
.md-report h3 { margin: 22px 0 8px; font-size: 15px; }
.md-report h4 { margin: 18px 0 6px; color: var(--text-dim); }
.md-report p { margin: 8px 0; }
.md-report ul { padding-left: 20px; }
.md-report blockquote { margin: 10px 0; padding: 11px 16px; color: var(--text-dim); background: var(--panel-2); border-left: 2px solid var(--red); }
.md-report a { text-decoration: none; }
.md-report code { padding: 2px 5px; background: var(--bg-soft); border: 1px solid var(--border-soft); border-radius: 4px; font-family: var(--mono); }
.md-report strong { color: var(--text); }
.md-score-summary { display: flex; align-items: baseline; gap: 12px; margin: 16px 0 14px; padding: 16px 18px; background: linear-gradient(110deg, var(--panel-2), var(--bg-soft)); border: 1px solid var(--border); border-left: 3px solid var(--red); border-radius: var(--radius-sm); }
.md-score-label { color: var(--text-dim); font-family: var(--mono); font-size: 10px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; }
.md-score-summary strong { color: var(--red-strong); font-family: var(--mono); font-size: 26px; line-height: 1; }
.md-score-summary strong small { color: var(--text-faint); font-size: 12px; font-weight: 500; }
.md-score-note { margin-left: auto; color: var(--text-faint); font-size: 11px; }
.md-table-wrap { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--border-soft); border-radius: var(--radius-sm); }
.md-table { width: 100%; min-width: 360px; border-collapse: collapse; background: var(--panel-2); font-size: 12px; }
.md-table th { padding: 10px 13px; color: var(--text-faint); background: var(--bg-soft); font-family: var(--mono); font-size: 9px; letter-spacing: 1px; text-align: left; text-transform: uppercase; }
.md-table td { padding: 12px 13px; border-top: 1px solid var(--border-soft); color: var(--text-dim); }
.md-table td:last-child { color: var(--text); font-family: var(--mono); font-weight: 800; text-align: right; }
.md-table tr:hover td { background: color-mix(in srgb, var(--red-soft) 24%, transparent); }
.free-tier-row { display: flex; align-items: center; gap: 8px; color: var(--text-dim); font-size: 13px; }
.free-tier-row.exhausted { color: var(--red-strong); font-weight: 650; }
.free-tier-row a { color: inherit; text-decoration: underline; cursor: pointer; }
#toast { position: fixed; left: 50%; bottom: 28px; z-index: 100; max-width: 80vw; padding: 11px 18px; color: var(--text); background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translate(-50%, 16px); transition: opacity .22s, transform .22s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar { position: sticky; z-index: 10; width: 100%; height: auto; padding: 11px 16px; flex-direction: row; align-items: center; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar::after, .protocol-label { display: none; }
  .brand { padding: 0 14px 0 0; border: 0; }
  .brand-mark { width: 34px; height: 38px; flex-basis: 34px; }
  .brand-tag { display: none; }
  .nav { flex-direction: row; margin-left: auto; }
  .nav-item { width: auto; min-height: 40px; padding: 8px 10px; }
  .nav-item.active::before, .nav-item.active::after, .sidebar-footer .hint, .system-state { display: none; }
  .sidebar-footer { margin: 0; }
  .main { padding: 24px 18px 54px; }
  .workspace-bar { margin-bottom: 30px; }
  .reports-layout { grid-template-columns: 1fr; }
  .report-list-panel { max-height: 240px; }
  .report-view-panel { min-height: 40vh; padding: 18px 22px 24px; }
  .budget-grid { grid-template-columns: repeat(2, 1fr); }
  .run-actions { width: 100%; margin-left: 0; }
  .run-actions .btn { flex: 1; }
  .intake-note { width: 100%; }
}
@media (max-width: 580px) {
  .sidebar { align-items: stretch; }
  .brand { flex: 1; }
  .brand-name { font-size: 11px; }
  .nav { order: 3; width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 10px; }
  .nav-item { justify-content: center; font-size: 12px; }
  .nav-index { display: none; }
  .main { padding-top: 20px; }
  .workspace-bar { display: none; }
  .view-head { align-items: flex-start; flex-direction: column; gap: 16px; }
  .case-stamp { width: 100%; flex-basis: auto; }
  .panel, .intake-panel { padding: 20px 16px; }
  .settings-panel { padding: 0; }
  .settings-section { padding: 24px 16px; }
  .run-controls { align-items: stretch; }
  .select-label, .select-label select { width: 100%; }
  .report-head, .kv { align-items: flex-start; flex-direction: column; }
  .report-meta { word-break: break-all; }
  .conditions li { align-items: flex-start; flex-wrap: wrap; }
  .status-tag { margin-left: 0; }
  .config-actions { flex-direction: column; }
  .config-actions .btn { width: 100%; }
  .save-actions { align-items: stretch; padding: 20px 16px; }
  .save-caption { margin-right: 0; }
  .budget-grid { grid-template-columns: 1fr; }
}
