:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #667085;
  --line: #dce3ea;
  --soft: #f5f7f9;
  --paper: #ffffff;
  --green: #17745b;
  --green-soft: #e8f4ef;
  --amber: #ad6b16;
  --amber-soft: #fff3df;
  --red: #b42318;
  --red-soft: #feeceb;
  --blue: #285b96;
  --blue-soft: #eaf1f8;
}
* { box-sizing: border-box; }
html { background: transparent; }
body { margin: 0; color: var(--ink); background: #f0f3f6; font: 14px/1.55 Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif; letter-spacing: 0; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
.workspace { max-width: 1500px; margin: 0 auto; min-height: 760px; background: var(--paper); border: 1px solid var(--line); }
.workspace-head { min-height: 118px; padding: 24px 28px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); background: linear-gradient(110deg, #f8fafb 0 70%, #e8f4ef 70%); }
.eyebrow { margin: 0 0 4px; color: var(--green); font-size: 12px; font-weight: 700; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: 26px; line-height: 1.25; }
h2 { margin-bottom: 2px; font-size: 16px; }
.subtitle, .block-head p, .toolbar p { margin-bottom: 0; color: var(--muted); }
.head-actions, .toolbar-actions, .filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.connection { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); white-space: nowrap; }
.connection i { width: 8px; height: 8px; border-radius: 50%; background: #98a2b3; }
.connection.ready i { background: var(--green); box-shadow: 0 0 0 4px rgba(23,116,91,.12); }
.connection.error i { background: var(--red); }
.button { min-height: 38px; border: 1px solid var(--green); border-radius: 5px; padding: 7px 15px; color: white; background: var(--green); font-weight: 650; }
.button:hover { filter: brightness(.96); }
.button.secondary { color: var(--ink); border-color: #cbd5df; background: white; }
.button.danger { color: var(--red); border-color: #e9b9b5; background: white; }
.text-button { border: 0; padding: 3px; color: var(--green); background: transparent; font-weight: 650; }
.tabs { height: 54px; display: flex; align-items: stretch; gap: 2px; padding: 0 22px; border-bottom: 1px solid var(--line); overflow-x: auto; background: #fbfcfd; }
.tabs button { position: relative; min-width: 96px; padding: 0 14px; border: 0; color: #596273; background: transparent; white-space: nowrap; font-weight: 650; }
.tabs button.active { color: var(--green); }
.tabs button.active::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 3px; background: var(--green); }
.notice { margin: 16px 24px 0; padding: 10px 13px; border: 1px solid #a9d4c6; color: #0f5c47; background: var(--green-soft); }
.notice.error { border-color: #efb9b5; color: var(--red); background: var(--red-soft); }
.hidden { display: none !important; }
.panel { display: none; padding: 22px 24px 30px; }
.panel.active { display: block; }
.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric { min-height: 102px; padding: 16px; border: 1px solid var(--line); border-top: 3px solid #7d8da1; background: #fff; }
.metric:nth-child(2) { border-top-color: var(--red); }
.metric:nth-child(3) { border-top-color: var(--amber); }
.metric:nth-child(4) { border-top-color: var(--blue); }
.metric:nth-child(5) { border-top-color: var(--green); }
.metric-label { color: var(--muted); font-size: 13px; }
.metric-value { margin: 7px 0 1px; font-size: 25px; line-height: 1.15; font-weight: 760; font-variant-numeric: tabular-nums; }
.metric-note { color: #788293; font-size: 12px; }
.visual-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, .75fr); gap: 16px; margin-bottom: 16px; }
.visual-block, .table-block { border: 1px solid var(--line); background: white; }
.block-head { min-height: 68px; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 15px; border-bottom: 1px solid var(--line); }
.bar-chart { min-height: 230px; padding: 20px; display: grid; gap: 15px; align-content: center; }
.bar-row { display: grid; grid-template-columns: 80px 1fr 90px; gap: 12px; align-items: center; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.bar-track { height: 12px; background: #edf0f3; }
.bar-fill { height: 100%; min-width: 2px; background: var(--green); }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; }
.status-chart { min-height: 230px; padding: 20px; display: grid; grid-template-columns: 140px 1fr; gap: 24px; align-items: center; justify-content: center; }
.donut { width: 136px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--amber) 0 25%, var(--green) 25% 50%, var(--red) 50% 75%, #98a2b3 75%); }
.donut::after { content: attr(data-total); width: 86px; aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; background: white; font-size: 23px; font-weight: 750; }
.legend { display: grid; gap: 9px; }
.legend-row { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 8px; }
.legend-row i { width: 8px; height: 8px; border-radius: 50%; }
.toolbar { min-height: 66px; padding: 0 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.toolbar h2 { margin: 0 0 2px; }
input, select, textarea { min-height: 38px; max-width: 100%; border: 1px solid #cbd5df; border-radius: 4px; padding: 7px 10px; color: var(--ink); background: white; }
input[type="search"] { width: 235px; }
textarea { min-height: 78px; resize: vertical; }
.inline-field { display: flex; align-items: center; gap: 8px; color: var(--muted); white-space: nowrap; }
.table-block.flush { width: 100%; overflow: hidden; }
.table-wrap { width: 100%; overflow: auto; }
table { width: 100%; min-width: 940px; border-collapse: collapse; }
th, td { padding: 11px 12px; border-bottom: 1px solid #e8edf1; text-align: left; vertical-align: top; }
th { color: #556070; background: #f7f9fa; font-size: 12px; white-space: nowrap; }
td { overflow-wrap: anywhere; }
tbody tr:hover { background: #fafcfb; }
.number { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tag { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 8px; border-radius: 3px; color: #53606f; background: #edf1f4; font-size: 12px; white-space: nowrap; }
.tag.good { color: #0f604a; background: var(--green-soft); }
.tag.warn { color: #8a4d08; background: var(--amber-soft); }
.tag.bad { color: var(--red); background: var(--red-soft); }
.tag.info { color: var(--blue); background: var(--blue-soft); }
.row-actions { display: flex; gap: 9px; align-items: center; white-space: nowrap; }
.row-actions button { padding: 0; border: 0; color: var(--green); background: transparent; }
.row-actions button.reject { color: var(--red); }
.cell-note { max-width: 280px; color: var(--muted); font-size: 12px; }
.empty { height: 140px; color: #8b95a5; text-align: center; vertical-align: middle; }
.metrics.compact { grid-template-columns: repeat(3, minmax(0, 220px)); }
html.embedded-dialog-open, body.embedded-dialog-open { overflow: hidden !important; }
dialog { width: min(680px, calc(100vw - 28px)); max-height: calc(100dvh - 30px); margin: auto; padding: 0; overflow: auto; border: 0; border-radius: 6px; color: var(--ink); box-shadow: 0 22px 70px rgba(17,24,39,.25); }
dialog::backdrop { background: rgba(20,29,41,.48); }
.dialog-head { min-height: 74px; padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; font-size: 19px; }
.close-button { width: 34px; height: 34px; border: 0; border-radius: 4px; color: #667085; background: #f2f4f6; font-size: 24px; line-height: 1; }
.dialog-body { max-height: calc(100vh - 190px); padding: 18px 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; overflow-y: auto; }
.field { display: grid; gap: 5px; }
.field label { color: #505a69; font-size: 13px; font-weight: 650; }
.field.wide { grid-column: 1 / -1; }
.check-field { min-height: 38px; display: flex; align-items: center; gap: 8px; }
.check-field input { min-height: 0; }
.dialog-actions { padding: 13px 20px; display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line); background: #fafbfc; }
.request-lines { grid-column: 1 / -1; display: grid; gap: 8px; }
.request-line { display: grid; grid-template-columns: minmax(260px, 1fr) 120px 110px 34px; gap: 8px; }
.purpose-cell, .purpose-display { white-space: pre-wrap; overflow-wrap: anywhere; }
.remove-line { min-height: 38px; border: 1px solid #e0c2bf; color: var(--red); background: white; }
.add-line { justify-self: start; border: 0; padding: 4px 0; color: var(--green); background: transparent; font-weight: 650; }
.qr-layout { display: grid; grid-template-columns: minmax(320px, .7fr) minmax(0, 1.3fr); gap: 16px; }
.qr-block { border: 1px solid var(--line); background: white; }
.qr-content { min-height: 400px; padding: 28px; display: grid; justify-items: center; align-content: center; gap: 14px; text-align: center; color: var(--muted); }
.qr-content img { width: min(320px, 100%); aspect-ratio: 1; border: 1px solid var(--line); background: white; object-fit: contain; }
.qr-settings { min-height: 0; }
.qr-fields { padding: 22px; display: grid; gap: 16px; }
.qr-fields label { display: grid; gap: 6px; color: #505a69; font-size: 13px; font-weight: 650; }
.qr-fields input { width: 100%; }
.config-state { padding: 10px 12px; border: 1px solid #cbd5df; color: var(--muted); background: #f7f9fa; }
.config-state.good { border-color: #a9d4c6; color: #0f604a; background: var(--green-soft); }
.config-state.bad { border-color: #efb9b5; color: var(--red); background: var(--red-soft); }
.calculation-preview { grid-column: 1 / -1; padding: 11px 12px; border-left: 3px solid var(--blue); color: #354052; background: var(--blue-soft); }
@media (max-width: 900px) {
  .workspace-head { align-items: flex-start; background: #f8fafb; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .visual-grid { grid-template-columns: 1fr; }
  .qr-layout { grid-template-columns: 1fr; }
  .status-chart { grid-template-columns: 140px minmax(140px, 1fr); }
}
@media (max-width: 620px) {
  .workspace-head, .toolbar { align-items: stretch; flex-direction: column; }
  .workspace-head { padding: 20px; }
  .head-actions { justify-content: space-between; }
  .panel { padding: 18px 14px 24px; }
  .tabs { padding: 0 8px; }
  .metrics, .metrics.compact { grid-template-columns: 1fr 1fr; }
  .metric { min-height: 90px; }
  .visual-grid { grid-template-columns: minmax(0, 1fr); }
  .status-chart { grid-template-columns: 1fr; justify-items: center; }
  .legend { width: 100%; }
  .filters { align-items: stretch; flex-direction: column; }
  .filters input, .filters select { width: 100%; }
  .dialog-body { grid-template-columns: 1fr; }
  .field.wide { grid-column: auto; }
  .request-lines { grid-column: auto; }
  .request-line { grid-template-columns: minmax(0, 1fr) 110px 90px 34px; }
}
