/* Job Harness — same design language as the ERS Dev 工作台 (front/console/console.html):
   system type, soft grey canvas, white rounded cards, frosted sticky nav, pill buttons, light + dark. */
:root {
  --bg: #f5f5f7; --card: #ffffff; --card2: #fbfbfd; --text: #1d1d1f; --text2: #6e6e73; --text3: #86868b;
  --line: rgba(0, 0, 0, .08); --fill: rgba(118, 118, 128, .12); --fill2: rgba(118, 118, 128, .08);
  --blue: #0071e3; --blue-hover: #0077ed; --blue-soft: rgba(0, 113, 227, .10);
  --green: #1d9e4b; --green-soft: rgba(52, 199, 89, .14); --orange: #c25e00; --orange-soft: rgba(255, 149, 0, .14);
  --red: #d70015; --red-soft: rgba(255, 59, 48, .12); --yellow-soft: rgba(255, 204, 0, .30);
  --shadow: 0 2px 6px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .06);
  --radius: 20px; --radius-s: 12px;
  --nav: rgba(245, 245, 247, .72);
  --series-1: #2a78d6; /* chart: 新发现 */
  --series-2: #1baf7a; /* chart: 匹配 */
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000; --card: #1c1c1e; --card2: #242426; --text: #f5f5f7; --text2: #a1a1a6; --text3: #8e8e93;
    --line: rgba(255, 255, 255, .10); --fill: rgba(118, 118, 128, .24); --fill2: rgba(118, 118, 128, .16);
    --blue: #2997ff; --blue-hover: #47a6ff; --blue-soft: rgba(41, 151, 255, .16);
    --green: #30d158; --green-soft: rgba(48, 209, 88, .16); --orange: #ff9f0a; --orange-soft: rgba(255, 159, 10, .16);
    --red: #ff453a; --red-soft: rgba(255, 69, 58, .16); --yellow-soft: rgba(255, 214, 10, .28);
    --shadow: none; --nav: rgba(22, 22, 23, .72);
    --series-1: #3987e5; --series-2: #199e70;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "PingFang SC", "Hiragino Sans", "Noto Sans CJK SC", system-ui, sans-serif;
  letter-spacing: -.01em; -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; line-height: 1.15; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
h3 { font-size: 15px; font-weight: 600; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid var(--blue-soft); outline-offset: 1px; }

/* nav */
.nav { position: sticky; top: 0; z-index: 20; backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); background: var(--nav); border-bottom: .5px solid var(--line); }
.nav-in { max-width: 1320px; margin: 0 auto; padding: 0 20px; min-height: 52px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 17px; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(135deg, #0a84ff, #5e5ce6); display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 700; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* tabs = segmented control */
.tabs { display: flex; gap: 4px; background: var(--fill2); padding: 3px; border-radius: 10px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { all: unset; cursor: pointer; flex: none; font-size: 13px; font-weight: 500; padding: 6px 14px; border-radius: 8px; color: var(--text); white-space: nowrap; }
.tab.active { background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px var(--line); }
.tab:focus-visible { outline: 3px solid var(--blue-soft); }

.shell { max-width: 1320px; margin: 0 auto; padding: 24px 20px 80px; }
.hero-block { margin: 0 4px 18px; }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--orange); margin-bottom: 2px; }
.section-label { font-size: 12px; font-weight: 600; color: var(--text3); margin-bottom: 2px; }
.lede { font-size: 13px; color: var(--text2); max-width: 820px; margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); border: .5px solid var(--line); font-size: 12px; color: var(--text2); }
.badge.safe::before, .badge.warn::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.badge.warn::before { background: var(--orange); }
.badge.safe { color: var(--text); }

/* buttons */
.primary-button, .secondary-button, .danger-button, .shared-data-button { all: unset; box-sizing: border-box; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: 0 16px; border-radius: 999px; font-size: 14px; font-weight: 500; white-space: nowrap; transition: background .15s, opacity .15s; }
.primary-button { background: var(--blue); color: #fff; }
.primary-button:hover { background: var(--blue-hover); }
.secondary-button, .shared-data-button { background: var(--fill2); color: var(--blue); }
.secondary-button:hover, .shared-data-button:hover { background: var(--fill); }
.danger-button { background: var(--red-soft); color: var(--red); }
.danger-button:hover { background: var(--fill); }
.primary-button:disabled, .secondary-button:disabled, .shared-data-button:disabled { opacity: .4; cursor: default; }
.primary-button:focus-visible, .secondary-button:focus-visible, .danger-button:focus-visible, .shared-data-button:focus-visible { outline: 3px solid var(--blue-soft); outline-offset: 2px; }
.text-button { all: unset; cursor: pointer; padding: 4px 8px; border-radius: 8px; color: var(--blue); font-size: 13px; font-weight: 500; }
.text-button:hover { background: var(--fill2); }
.text-button.danger { color: var(--red); }

/* cards */
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: .5px solid var(--line); padding: 22px; }
.tab-panel > .panel, .two-col { margin-bottom: 16px; }
.panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.microcopy { font-size: 13px; color: var(--text2); }
.error-text { font-size: 13px; color: var(--red); }
.empty { padding: 36px 8px; color: var(--text3); text-align: center; font-size: 14px; }
.runtime-warning { margin: 0 0 16px; padding: 12px 16px; border-radius: var(--radius-s); background: var(--orange-soft); color: var(--orange); font-size: 13px; white-space: pre-wrap; }

/* stat cards */
.budget-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.budget-strip article { background: var(--card); border-radius: 18px; border: .5px solid var(--line); box-shadow: var(--shadow); padding: 16px 18px; min-width: 0; }
.hero { margin: 4px 0 4px; font-size: 30px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.hero small { color: var(--text3); font-size: 15px; font-weight: 500; letter-spacing: -.01em; }
.hero.small { font-size: 20px; margin: 9px 0 9px; }
.meter { height: 5px; margin: 8px 0; border-radius: 999px; background: var(--fill); overflow: hidden; }
.meter-fill { width: 0; height: 100%; border-radius: 999px; background: var(--blue); transition: width .4s; }
.meter-fill.warn { background: var(--orange); }
.meter-fill.over { background: var(--red); }

/* form controls */
input, select, textarea { appearance: none; -webkit-appearance: none; padding: 9px 12px; border: 1px solid transparent; border-radius: var(--radius-s); background: var(--fill2); outline: none; transition: border-color .15s, background .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); background: var(--card); box-shadow: 0 0 0 4px var(--blue-soft); }
input[type="checkbox"] { appearance: auto; -webkit-appearance: auto; width: 16px; height: 16px; padding: 0; accent-color: var(--blue); }
select { padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2386868b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
textarea { width: 100%; resize: vertical; font: 13px/1.6 var(--mono); letter-spacing: 0; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text2); margin-left: 2px; }
.inline-field { display: inline-flex; align-items: center; gap: 8px; color: var(--text2); font-size: 13px; flex-wrap: wrap; }
.inline-field input[type="number"] { width: 84px; }
.inline-row { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; }

/* review */
.review-grid { display: grid; grid-template-columns: minmax(340px, 5fr) minmax(0, 8fr); gap: 16px; align-items: start; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { all: unset; cursor: pointer; font-size: 13px; padding: 5px 11px; border-radius: 999px; background: var(--fill2); color: var(--text); white-space: nowrap; }
.pill:hover { background: var(--fill); }
.pill.active { background: var(--blue); color: #fff; }
.pill b { margin-left: 5px; font-weight: 600; font-variant-numeric: tabular-nums; opacity: .7; }
.pill:focus-visible { outline: 3px solid var(--blue-soft); }
.filters { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
.filters input[type="search"] { flex: 1 1 160px; min-width: 0; }
.job-list { display: grid; gap: 0; max-height: calc(100vh - 190px); overflow-y: auto; border-radius: var(--radius-s); background: var(--fill2); }
.job-card { all: unset; box-sizing: border-box; cursor: pointer; display: grid; grid-template-columns: 44px 1fr; gap: 12px; padding: 12px 14px; border-bottom: .5px solid var(--line); }
.job-card:last-child { border-bottom: 0; }
.job-card:hover { background: var(--fill2); }
.job-card.active { background: var(--blue-soft); }
.job-card:focus-visible { outline: 3px solid var(--blue-soft); outline-offset: -3px; }
.score { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--fill); color: var(--text2); font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.score.hi { background: var(--green-soft); color: var(--green); }
.score.mid { background: var(--orange-soft); color: var(--orange); }
.job-card h3 { margin-bottom: 3px; line-height: 1.4; overflow-wrap: anywhere; }
.job-meta { display: flex; flex-wrap: wrap; gap: 3px 10px; align-items: center; color: var(--text3); font-size: 12px; }
.job-summary { margin-top: 5px; color: var(--text2); font-size: 13px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tag { display: inline-flex; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--fill2); color: var(--text2); }
.tag.apply { background: var(--green-soft); color: var(--green); }
.tag.consider { background: var(--orange-soft); color: var(--orange); }
.tag.skip, .tag.err { background: var(--red-soft); color: var(--red); }

.detail-panel { position: sticky; top: 68px; max-height: calc(100vh - 84px); overflow-y: auto; }
.detail-head { display: flex; gap: 14px; align-items: flex-start; }
.detail-head .score { width: 58px; height: 58px; font-size: 22px; border-radius: 16px; flex: none; }
.detail-title { font-size: 20px; line-height: 1.3; overflow-wrap: anywhere; }
.link-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.link-button { display: inline-flex; align-items: center; min-height: 34px; padding: 0 16px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); font-size: 14px; font-weight: 500; }
.link-button:hover { background: var(--fill); text-decoration: none; }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .5px; margin: 14px 0; border-radius: var(--radius-s); background: var(--line); border: .5px solid var(--line); overflow: hidden; }
.meta-grid div { padding: 10px 14px; background: var(--card2); min-width: 0; }
.meta-grid dt { color: var(--text3); font-size: 12px; }
.meta-grid dd { margin: 1px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.summary { padding: 14px 16px; border-radius: var(--radius-s); background: var(--blue-soft); font-size: 15px; line-height: 1.55; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 12px 0; }
.block { padding: 14px 16px; border-radius: 14px; background: var(--fill2); font-size: 14px; }
.block h3 { margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--text2); }
.block.good h3 { color: var(--green); }
.block.warn h3 { color: var(--orange); }
.block.bad h3 { color: var(--red); }
.block ul { margin: 0; padding-left: 18px; }
.block li { margin: 4px 0; overflow-wrap: anywhere; }
.decision-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; padding-top: 16px; border-top: .5px solid var(--line); }
details { margin-top: 10px; }
summary { color: var(--text2); font-size: 13px; cursor: pointer; }
pre.raw { max-height: 320px; overflow: auto; margin: 8px 0 0; padding: 12px 14px; border-radius: var(--radius-s); background: var(--fill2); font: 12px/1.6 var(--mono); letter-spacing: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text2); }

.materials { margin-top: 18px; padding-top: 18px; border-top: .5px solid var(--line); }
.gen-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.gen-bar select { max-width: 230px; }
.kind-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.material { margin-top: 12px; border-radius: 16px; border: .5px solid var(--line); background: var(--card2); overflow: hidden; }
.material-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; border-bottom: .5px solid var(--line); flex-wrap: wrap; }
.material-body { padding: 16px 20px; overflow-wrap: anywhere; font-size: 15px; line-height: 1.7; }
.material-body h1, .material-body h2, .material-body h3 { margin: 16px 0 6px; letter-spacing: -.01em; }
.material-body h1 { font-size: 19px; } .material-body h2 { font-size: 17px; } .material-body h3 { font-size: 15px; }
.material-body > :first-child { margin-top: 0; }
.material-body p { margin: 8px 0; }
.material-body ul, .material-body ol { margin: 6px 0; padding-left: 22px; }
.material-body hr { border: 0; border-top: .5px solid var(--line); margin: 16px 0; }
.material-body table { border-collapse: collapse; margin: 8px 0; font-size: 14px; }
.material-body td, .material-body th { padding: 6px 10px; border: .5px solid var(--line); text-align: left; vertical-align: top; }
.material-body code { font: 13px var(--mono); background: var(--fill2); padding: 1px 5px; border-radius: 5px; }
.material-body mark { padding: 1px 4px; color: var(--text); background: var(--yellow-soft); border-radius: 4px; }
.material.streaming .material-body::after { content: "▍"; color: var(--blue); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .material.streaming .material-body::after { animation: none; } .meter-fill { transition: none; } }

/* stats */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.tile { padding: 14px 16px; border-radius: 16px; background: var(--fill2); }
.tile b { display: block; font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile span { color: var(--text2); font-size: 13px; }
.tile small { display: block; color: var(--text3); font-size: 12px; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { padding: 8px 10px; color: var(--text3); border-bottom: .5px solid var(--line); font-size: 12px; font-weight: 600; text-align: left; white-space: nowrap; }
table.data td { padding: 9px 10px; border-bottom: .5px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover td { background: var(--fill2); }
.bar-cell { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.bar-track { flex: 1; height: 8px; border-radius: 4px; background: var(--fill); }
.bar-fill { height: 100%; min-width: 2px; border-radius: 0 4px 4px 0; background: var(--series-2); }
.bar-cell span { width: 30px; text-align: right; font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--green); }
.dot.bad { background: var(--red); } .dot.warn { background: var(--orange); } .dot.off { background: var(--text3); opacity: .5; }
.legend { display: flex; align-items: center; gap: 14px; color: var(--text2); font-size: 13px; }
.swatch { display: inline-block; width: 10px; height: 10px; margin-right: 5px; border-radius: 3px; }
.swatch.s1 { background: var(--series-1); } .swatch.s2 { background: var(--series-2); }
.chart svg { display: block; width: 100%; height: auto; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart text { fill: var(--text3); font-size: 11px; font-family: var(--mono); }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: var(--fill2); }
.tooltip { position: fixed; z-index: 50; padding: 8px 12px; border-radius: 12px; background: var(--card); border: .5px solid var(--line); box-shadow: 0 2px 6px rgba(0, 0, 0, .08), 0 12px 32px rgba(0, 0, 0, .14); font-size: 12px; pointer-events: none; white-space: pre; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 16px; }
.two-col > .panel { margin: 0; }
.three-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }

/* dev */
.routes { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; margin: 14px 0; }
.route { padding: 16px; border-radius: 16px; background: var(--fill2); }
.route h3 { margin-bottom: 4px; }
.route .field input, .route .field select { width: 100%; background: var(--card); }
.template { margin-bottom: 10px; padding: 14px; border-radius: 16px; background: var(--fill2); }
.template textarea { background: var(--card); }
.template-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.template-head input[type="text"] { flex: 1 1 200px; background: var(--card); }
.result-card { margin: 12px 0; padding: 14px 16px; border-radius: 14px; background: var(--fill2); font-size: 13px; }
.result-card ul { margin: 6px 0 0; padding-left: 18px; }

/* login, dialog, toast */
.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-card { display: grid; gap: 16px; width: min(400px, 100%); }
.login-card input { width: 100%; }
.login-card .brand { font-size: 20px; }
dialog { width: min(640px, calc(100% - 32px)); color: var(--text); }
dialog::backdrop { background: rgba(0, 0, 0, .4); backdrop-filter: blur(4px); }
dialog h2 { margin: 2px 0 8px; }
dialog input { width: 100%; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translateX(-50%); max-width: min(560px, calc(100% - 32px)); padding: 10px 18px; border-radius: 999px; background: var(--text); color: var(--bg); box-shadow: 0 8px 24px rgba(0, 0, 0, .2); font-size: 14px; }
.toast.error { background: var(--red); color: #fff; border-radius: 16px; }

@media (max-width: 980px) {
  .review-grid { grid-template-columns: 1fr; }
  .detail-panel { position: static; max-height: none; }
  .job-list { max-height: 60vh; }
  .budget-strip { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .shell { padding: 16px 12px 60px; }
  .nav-in { padding: 6px 12px; gap: 8px; }
  .budget-strip { grid-template-columns: 1fr; }
  .panel { padding: 16px; border-radius: 16px; }
  .hero { font-size: 26px; }
  .top-actions { margin-left: 0; }
}
