:root {
  font-family: Inter, "Microsoft YaHei", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: #20313a;
  background: #f3f6f8;
  --text: #20313a;
  --muted: #536a76;
  --border: #dbe4e8;
  --accent: #086d69;
  --surface: #fff;
  --radius: 14px;
  --gutter: clamp(16px, 4vw, 40px);
  --card-pad: clamp(18px, 3vw, 30px);
  --section-gap: 22px;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
:where(button, a, input, select, textarea, summary):focus-visible { outline: 2px solid #0b867f; outline-offset: 3px; }
a { color: var(--accent); text-underline-offset: .18em; }
.shell { min-height: 100vh; }
.topbar {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px 24px;
  min-height: 68px; padding: 14px max(var(--gutter), calc((100vw - 1160px) / 2));
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-size: clamp(17px, 2vw, 20px); font-weight: 750; color: #173942; }
.eyebrow, .user, .muted { color: var(--muted); }
.eyebrow, .user, .hint, .small { font-size: .875rem; }
.wrap { max-width: 1240px; margin: 0 auto; padding: clamp(24px, 5vw, 46px) var(--gutter) 56px; }
.heading { margin-bottom: 18px; }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { font-size: clamp(24px, 4vw, 34px); line-height: 1.25; margin-bottom: 0; }
h2 { font-size: 1.3rem; line-height: 1.35; margin-bottom: 16px; }
h3 { font-size: 1.05rem; line-height: 1.45; margin-bottom: 8px; }
p { margin-bottom: 12px; line-height: 1.7; }
p:last-child { margin-bottom: 0; }
.nav, .steps { display: flex; gap: 8px; margin-bottom: var(--section-gap); }
.nav { flex-wrap: wrap; border-bottom: 1px solid var(--border); padding-bottom: 13px; }
.nav button, .step {
  border: 1px solid var(--border); background: var(--surface); border-radius: 8px; color: #405762;
  padding: 9px 14px; min-height: 42px;
}
.nav .selected, .step.selected { background: #e5f2f0; color: #075750; border-color: #afd1cd; font-weight: 650; }
.steps { overflow-x: auto; padding: 3px 3px 8px; }
.step { flex: 0 0 auto; white-space: nowrap; text-align: left; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--card-pad); margin-bottom: var(--section-gap);
  box-shadow: 0 2px 7px #17384007;
}
.card:has(> .field) { max-width: 940px; }
.card:has(> #aiForm, > #caseSettings) { max-width: 850px; }
.card > :last-child { margin-bottom: 0; }
.field + .field { border-top: 1px solid #edf1f2; }
.field { padding: 16px 0 18px; }
.field label.title { display: block; font-size: 15px; font-weight: 650; margin: 0 0 8px; }
.req, .error { color: #a33443; }
.hint { color: var(--muted); margin: 4px 0 9px; }
.control {
  display: block; width: 100%; max-width: 660px; min-height: 44px; border: 1px solid #bacbd2;
  border-radius: 8px; padding: 9px 12px; background: #fff; color: var(--text);
}
.control[readonly] { background: #f2f5f7; }
textarea.control { resize: vertical; }
.stack { display: grid; gap: 16px; }
.card h2 + .stack { margin-top: 18px; }
.stack label:not(.choice) { display: grid; gap: 6px; max-width: 660px; font-weight: 600; }
.stack .control { font-weight: 400; }
.stack > .choice { justify-self: start; }
.stack > .toolbar { margin-bottom: 0; }
.options, .actions, .toolbar { display: flex; flex-wrap: wrap; gap: 10px; }
.choice {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 12px; background: #fff; max-width: 100%; min-height: 42px; cursor: pointer;
}
.choice:has(input:checked) { background: #e5f2f0; border-color: #84bdb7; color: #075750; }
.choice input { margin: 0; accent-color: var(--accent); flex: 0 0 auto; }
.error { font-size: .875rem; margin-top: 8px; }
.actions { justify-content: space-between; border-top: 1px solid var(--border); margin-top: 12px; padding-top: 18px; }
.toolbar { margin-bottom: 16px; align-items: center; }
.primary,.secondary,.danger {
  border: 1px solid var(--accent); border-radius: 8px; padding: 9px 15px; min-height: 42px; font-weight: 650;
}
.primary { background: var(--accent); color: #fff; }
.secondary { background: #fff; color: var(--accent); }
.danger { background: #fff; color: #a33443; border-color: #e1bac0; }
.notice { border-radius: 8px; background: #edf6f5; color: #244b4a; padding: 12px 16px; margin: 12px 0 18px; }
.warn { background: #fff3e6; color: #754822; }
.grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,220px),1fr)); gap: 14px; }
.stat { background: #f4f8f8; border-radius: 8px; padding: 14px 16px; }
.stat b { display: block; font-size: 1.1rem; }
.tablewrap { overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; min-width: 630px; }
th, td { padding: 12px 14px; border-bottom: 1px solid #e8eef0; text-align: left; font-size: .94rem; vertical-align: middle; }
th { color: #435a65; background: #f3f6f8; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td:last-child { white-space: nowrap; }
td button { padding: 6px 7px; border: 0; background: transparent; color: var(--accent); text-decoration: underline; text-underline-offset: .16em; }
.row { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.row > * { flex: 1 1 180px; }
.row > :is(button,.choice) { flex: 0 0 auto; }
.card > .row:first-child { padding-bottom: 16px; }
.card > .row:first-child h2 { margin-bottom: 5px; }
.card > .row:first-child:has(+ .tablewrap) { align-items: center; }
.pill { display: inline-block; background: #e8f2f2; color: #195d5e; border-radius: 24px; padding: 4px 9px; font-size: .85rem; }
.report-item { border-top: 1px solid #e8eef0; padding: 16px 0; overflow-wrap: anywhere; }
.report-item p { white-space: pre-wrap; }
.report-item:first-child { border: 0; }
.report-item > div + div, .report-item > .pill + div { margin-top: 8px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.loading { margin: 80px auto; text-align: center; color: var(--muted); }
details summary { cursor: pointer; padding: 8px 0; }
#modelResult:empty, #document-status:empty, [data-review-status]:empty { display: none; }
#modelResult:not(:empty) { padding: 10px 13px; border: 1px solid var(--border); border-radius: 8px; max-width: 660px; }
#modelResult.error { background: #fff3f3; border-color: #f0d0d6; }
#modelResult.success { color: #075750; background: #eaf5f2; }
.model-overview { display: flex; flex-wrap: wrap; align-items: start; gap: 12px 20px; margin-bottom: 22px; padding: 15px; border: 1px solid var(--border); border-radius: 10px; background: #f7fafb; }
.model-overview > div { flex: 1 1 250px; }
.model-connection { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.model-connected { background: #dff3e9; color: #0b6040; }
.model-failed { background: #fae7eb; color: #922d3e; }
.model-unknown { background: #ebf0f2; color: #4a626e; }
.model-usage { display: flex; gap: 8px 28px; flex-wrap: wrap; margin: 12px 0 8px; }
.model-usage dt { font-size: .875rem; color: var(--muted); }
.model-usage dd { margin: 1px 0 0; font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 600px) {
  :root { --section-gap: 16px; }
  .topbar { padding: 12px var(--gutter); }
  .wrap { padding-bottom: 32px; }
  .nav { gap: 6px; }
  .nav button, .step { padding-inline: 11px; }
  .field { padding-block: 14px; }
  .split { grid-template-columns: 1fr; }
  .card > .row:first-child > button { margin-left: auto; }
}
