:root {
  color-scheme: light;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #222a26;
  background: #f5f7f5;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #222a26;
  --muted: #727c76;
  --line: #e2e8e3;
  --green: #267348;
  --green-dark: #1e613d;
  --green-pale: #eaf4ed;
  --white: #fff;
}

* { box-sizing: border-box; }
body { min-width: 320px; min-height: 100vh; margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.topbar { height: 60px; padding: 0 32px; display: flex; align-items: center; justify-content: space-between; background: var(--white); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 650; }
.brand-mark { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 5px; background: var(--green); color: white; font-size: 14px; font-weight: 700; }
.service-state { display: flex; align-items: center; gap: 8px; color: #65716a; font-size: 12px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #4aa36a; }
.shell { max-width: 1120px; margin: 0 auto; padding: 34px 32px 26px; }
.intro { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.eyebrow { margin: 0 0 8px; color: var(--muted); font-size: 11px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 24px; font-weight: 650; }
.button { min-height: 36px; padding: 0 13px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 5px; font-size: 13px; font-weight: 600; }
.button-primary { color: #fff; background: var(--green); }
.button-primary:hover { background: var(--green-dark); }
.button-primary span { font-size: 18px; line-height: 12px; }
.button-secondary { color: #34423a; background: var(--white); border-color: #d5ddd7; }
.button-secondary:hover { border-color: #97ad9d; }
.platform-strip { display: grid; grid-template-columns: 1fr 1fr; margin-top: 20px; border: 1px solid var(--line); border-radius: 6px; background: var(--white); }
.platform-entry { min-width: 0; display: flex; align-items: center; gap: 11px; padding: 13px 16px; }
.platform-entry + .platform-entry { border-left: 1px solid var(--line); }
.platform-icon { flex: 0 0 30px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 5px; font-size: 13px; font-weight: 700; }
.vulbox { color: #306c8a; background: #e9f3f7; }
.butian { color: #b36b29; background: #fbf0e3; }
.platform-name { font-size: 13px; font-weight: 600; white-space: nowrap; }
.platform-state { min-width: 0; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.platform-entry a { margin-left: auto; flex: 0 0 auto; color: var(--green); font-size: 12px; text-decoration: none; }
.platform-entry a:hover { text-decoration: underline; }
.work-area { margin-top: 26px; }
.tabs { height: 43px; display: flex; align-items: stretch; gap: 24px; border-bottom: 1px solid var(--line); }
.tab { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 0 1px; border: 0; background: transparent; color: var(--muted); font-size: 13px; }
.tab span { min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 5px; border-radius: 10px; color: #68736c; background: #edf0ed; font-size: 10px; }
.tab.active { color: var(--green-dark); font-weight: 650; }
.tab.active::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: var(--green); content: ""; }
.task-list { min-height: 350px; }
.empty-state { min-height: 350px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-mark { width: 48px; height: 48px; display: grid; place-items: center; margin-bottom: 14px; border: 1px solid #dce5dd; border-radius: 50%; color: var(--green); font-size: 24px; font-weight: 300; }
.empty-state h2 { margin-bottom: 7px; font-size: 15px; font-weight: 650; }
.empty-state p { margin-bottom: 17px; color: var(--muted); font-size: 12px; }
.task-row { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 5px; border-bottom: 1px solid var(--line); }
.task-main h2 { margin-bottom: 5px; font-size: 14px; font-weight: 600; }
.task-main p { margin-bottom: 0; color: var(--muted); font-size: 11px; }
.task-main { min-width: 0; overflow-wrap: anywhere; }
.task-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.badge { min-width: 72px; padding: 5px 8px; border-radius: 4px; text-align: center; font-size: 11px; }
.badge-draft, .badge-rules_pending { color: #7c6430; background: #f6f1e4; }
.badge-authorized { color: #276940; background: var(--green-pale); }
.badge-paused, .badge-expired { color: #805349; background: #f6ece9; }
.badge-archived { color: #616a64; background: #edf0ed; }
.button-small { min-height: 31px; padding: 0 9px; font-size: 11px; }
.button:disabled { cursor: not-allowed; opacity: .55; }
.task-detail { padding: 0 5px 14px; border-bottom: 1px solid var(--line); color: #3f4942; }
.detail-loading, .detail-empty, .detail-error { margin: 11px 0; color: var(--muted); font-size: 12px; }
.detail-error, .run-errors { color: #9a463a; }
.run-entry { padding: 13px 0; border-bottom: 1px solid var(--line); }
.run-entry > summary, .evidence-entry > summary, .ai-suggestion > summary { cursor: pointer; color: #334039; font-size: 12px; font-weight: 600; }
.detail-heading { margin: 15px 0 8px; font-size: 12px; font-weight: 650; }
.finding-entry { padding: 12px 0; border-top: 1px solid #e8ede9; }
.finding-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 7px 12px; font-size: 12px; }
.finding-confidence { color: var(--muted); font-size: 10px; }
.finding-note, .evidence-request { margin: 7px 0; color: #606b64; font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }
.finding-review { display: grid; grid-template-columns: minmax(120px, 180px) minmax(220px, 1fr) auto; align-items: start; gap: 7px; margin-top: 9px; }
.finding-review select, .finding-review textarea { min-width: 0; padding: 7px 8px; border: 1px solid #d9e0da; border-radius: 4px; color: var(--ink); background: #fff; font: inherit; font-size: 11px; }
.finding-review textarea { resize: vertical; }
.evidence-entry { padding: 10px 0; border-top: 1px solid #e8ede9; }
.evidence-body { max-height: 260px; overflow: auto; padding: 10px; border: 1px solid #e5eae6; border-radius: 4px; background: #f8faf8; color: #354039; font: 11px/1.6 Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.evidence-hash { display: block; color: #727c76; font-size: 10px; overflow-wrap: anywhere; }
.ai-suggestion { margin: 10px 0; padding: 10px 0; border-top: 1px dashed #d9e0da; color: #445048; font-size: 11px; line-height: 1.6; }
.ai-suggestion h4 { margin: 10px 0 4px; font-size: 11px; }
.ai-suggestion p { margin: 8px 0; }
.suggestion-list, .run-errors { margin: 4px 0 8px; padding-left: 19px; font-size: 11px; line-height: 1.6; }
.footer { min-height: 45px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-top: 1px solid var(--line); color: #7c867f; font-size: 10px; }
.footer-tools { display: inline-flex; align-items: center; gap: 12px; }
.dialog { width: min(520px, calc(100vw - 28px)); max-height: min(90vh, 760px); padding: 0; border: 1px solid #dce3dd; border-radius: 7px; color: var(--ink); background: var(--white); box-shadow: 0 20px 70px #1b2c2040; }
.run-dialog { width: min(620px, calc(100vw - 28px)); }
.compact-dialog { width: min(430px, calc(100vw - 28px)); }
.dialog::backdrop { background: #18221c66; }
.dialog form { display: grid; max-height: min(90vh, 760px); gap: 14px; overflow-y: auto; padding: 22px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 3px; }
.dialog-heading h2 { margin: 0; font-size: 19px; }
.icon-button { width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 4px; color: #65716a; background: transparent; font-size: 22px; }
.icon-button:hover { background: #eff3ef; }
.dialog label:not(.check-row) { display: grid; gap: 6px; color: #39443d; font-size: 12px; font-weight: 600; }
.dialog input:not([type=checkbox]), .dialog select, .dialog textarea { width: 100%; padding: 9px 10px; border: 1px solid #d9e0da; border-radius: 4px; outline: none; color: var(--ink); background: #fff; font-size: 12px; font-weight: 400; }
.dialog textarea { resize: vertical; }
.dialog input:focus, .dialog select:focus, .dialog textarea:focus { border-color: #5d9a70; box-shadow: 0 0 0 2px #2673481a; }
.dialog [aria-invalid="true"] { border-color: #c7483b; }
.field-error { color: #a33027; font-size: 11px; font-weight: 500; line-height: 1.45; }
.field-error[hidden] { display: none; }
.run-options { display: grid; gap: 12px; min-width: 0; margin: -4px 0 0; padding: 12px; border: 1px solid var(--line); border-radius: 5px; }
.run-options[hidden] { display: none; }
.run-options legend { padding: 0 4px; color: var(--muted); font-size: 11px; }
.check-row { display: flex; align-items: center; gap: 9px; color: #39443d; font-size: 12px; }
.check-row input { width: 15px; height: 15px; accent-color: var(--green); }
.form-note { margin: -3px 0 0; padding: 10px; border-left: 2px solid #d9a347; color: #6f624c; background: #faf7f0; font-size: 11px; line-height: 1.6; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 3px; }
.toast { position: fixed; right: 22px; bottom: 20px; max-width: calc(100vw - 44px); padding: 11px 14px; border-radius: 5px; color: white; background: #27342c; box-shadow: 0 5px 18px #1e2a2340; font-size: 12px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .15s, transform .15s; }
.toast.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 760px) {
  .topbar { height: 54px; padding: 0 16px; }
  .shell { padding: 24px 16px 18px; }
  .platform-strip { grid-template-columns: 1fr; }
  .platform-entry + .platform-entry { border-top: 1px solid var(--line); border-left: 0; }
  .platform-entry { gap: 9px; padding: 11px; }
  .platform-state { flex: 1 1 auto; }
  .task-row { align-items: flex-start; flex-wrap: wrap; }
  .task-main { flex: 1 1 calc(100% - 100px); }
  .task-actions { width: 100%; justify-content: flex-start; }
  .tabs { gap: 17px; overflow-x: auto; }
  .tab { flex: 0 0 auto; }
  .finding-review { grid-template-columns: minmax(0, 1fr); }
  .footer { align-items: flex-start; flex-direction: column; justify-content: center; gap: 5px; padding: 10px 0; }
  .footer-tools { width: 100%; justify-content: space-between; }
  .dialog form { padding: 17px; }
}
