:root {
  color-scheme: light;
  --ink: #10213f;
  --muted: #66748b;
  --line: #dce3ed;
  --soft-line: #ebeff5;
  --canvas: #f4f7fb;
  --surface: #ffffff;
  --primary: #1768e8;
  --primary-dark: #0e4fb8;
  --danger: #d92d20;
  --danger-soft: #fff2f0;
  --success: #087a5b;
  --success-soft: #eaf8f2;
  --radius: 10px;
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
}

button, input, select { font: inherit; }

button {
  min-height: 46px;
  border: 0;
  border-radius: 7px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  padding: 0 20px;
}

button:hover { background: var(--primary-dark); }
button:disabled { cursor: wait; opacity: .65; }

input, select {
  min-width: 0;
  min-height: 46px;
  border: 1px solid #b9c6d9;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
}

input:focus, select:focus, button:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(23, 104, 232, .25);
  outline-offset: 2px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 100px;
  padding: 14px max(32px, calc((100vw - 1400px) / 2));
  background: #071f4d;
  color: #fff;
}

.topbar h1, .topbar p, h2, p { margin: 0; }
.topbar h1 { font-size: clamp(26px, 2.35vw, 32px); letter-spacing: -.04em; }
.eyebrow, .section-kicker { font-size: 12px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.eyebrow { color: #9fcbff; margin-top: 5px !important; }
.topbar-note { color: #c5d7f3; font-size: 14px; }
.topbar-utility { display: flex; align-items: center; gap: 22px; }

.workspace {
  width: min(1400px, calc(100% - 64px));
  margin: 32px auto 36px;
}

.query-strip, .result-panel, .list-panel { border: 1px solid var(--line); background: var(--surface); }

.query-strip {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 28px;
  border-radius: var(--radius);
  padding: 28px 24px;
}

.section-kicker { color: #587093; margin-bottom: 5px !important; }
h2 { font-size: 22px; letter-spacing: -.025em; }

.query-strip h2 { font-size: 25px; }
.query-strip form { display: grid; grid-template-columns: auto minmax(240px, 1fr) auto; gap: 12px; width: min(920px, 100%); }

.notice { min-height: 0; margin: 5px 0 0; color: var(--danger); font-size: 14px; font-weight: 650; }
.notice.success { color: var(--success); }

.result-panel, .list-panel { border-radius: var(--radius); padding: 25px; }
.result-panel { margin-top: 20px; }
.list-panel { margin-top: 24px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding-bottom: 22px; border-bottom: 1px solid var(--soft-line); }
.list-heading { align-items: center; }

.status-tag { display: inline-flex; align-items: center; min-height: 28px; border-radius: 999px; font-size: 13px; font-weight: 750; padding: 0 10px; white-space: nowrap; }
.status-tag.neutral { background: #edf1f6; color: #536176; }
.status-tag.danger { background: var(--danger-soft); color: var(--danger); }
.status-tag.success { background: var(--success-soft); color: var(--success); }

.result-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 30px; margin: 0; }
.result-list > div { display: grid; grid-template-columns: 132px 1fr; gap: 20px; padding: 17px 0; border-bottom: 1px solid var(--soft-line); }
.result-list > div:nth-child(odd) { grid-column: 1; }
.result-list > div:nth-child(even) { grid-column: 2; }
.result-list dt { color: var(--muted); font-size: 14px; }
.result-list dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.result-list .flow-value dd { color: var(--danger); font-size: 38px; letter-spacing: -.055em; line-height: .8; }
.result-footnote { margin-top: 21px; color: #587093; font-size: 13px; line-height: 1.6; }
.ratio-unavailable { color: #536176; font-weight: 750; }

.secondary-button { min-height: 38px; border: 1px solid #b7c5d8; background: #fff; color: #18345d; padding: 0 14px; }
.secondary-button:hover { background: #edf4ff; }

.inspection-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 20px 0; padding: 14px; border: 1px solid var(--soft-line); border-radius: 8px; background: #f8faff; }
.filter-controls, .toolbar-actions, .threshold-controls { display: flex; align-items: center; gap: 9px; }
.filter-controls label { color: #536176; font-size: 13px; font-weight: 750; white-space: nowrap; }
.filter-controls select { min-height: 40px; padding: 0 30px 0 11px; }
.threshold-custom { width: 158px; min-height: 40px; }
.threshold-controls.is-hidden, .threshold-custom.is-hidden { display: none; }
.toolbar-actions button { min-height: 40px; }
.run-status { margin: 0; font-size: 13px; font-weight: 750; text-align: right; }
.run-status.neutral { color: #536176; }
.run-status.running { color: #1768e8; }
.run-status.success { color: var(--success); }
.run-status.danger { color: var(--danger); }

.is-hidden { display: none; }
.inspection-progress { margin: -8px 0 20px; padding: 12px 14px; border: 1px solid var(--soft-line); border-radius: 8px; background: #f8faff; }
.inspection-progress-copy { display: flex; align-items: center; justify-content: space-between; gap: 16px; color: #536176; font-size: 13px; font-weight: 750; }
.inspection-progress-copy strong { color: var(--ink); }
.inspection-progress-track { height: 8px; margin-top: 10px; overflow: hidden; border-radius: 999px; background: #dfe8f6; }
.inspection-progress-fill { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--primary); transition: width 180ms ease-out; }
.inspection-progress-track.is-indeterminate .inspection-progress-fill { width: 38%; animation: inspection-progress-slide 1.1s ease-in-out infinite; }

@keyframes inspection-progress-slide {
  from { transform: translateX(-110%); }
  to { transform: translateX(290%); }
}

.table-wrap { max-width: 100%; min-width: 0; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 1060px; }
th, td { padding: 14px 12px; border-bottom: 1px solid var(--soft-line); text-align: left; white-space: nowrap; font-size: 14px; }
th { color: #536176; font-size: 12px; font-weight: 800; letter-spacing: .045em; }
td.flow-danger { color: var(--danger); font-weight: 800; }
.empty-row { color: var(--muted); padding: 36px 12px; text-align: center; }
.table-summary { margin-top: 16px; color: var(--muted); font-size: 13px; }

.integration-bar { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: center; border-top: 1px solid var(--line); background: #fff; color: #4b5d77; font-size: 14px; padding: 18px max(32px, calc((100vw - 1400px) / 2)); }
.integration-bar > :first-child { color: var(--ink); font-weight: 800; }
.integration-bar .ready { color: var(--success); }
.integration-bar .waiting { color: var(--muted); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

@media (max-width: 920px) {
  .result-list { grid-template-columns: 1fr; }
  .result-list > div:nth-child(n) { grid-column: auto; grid-row: auto; }
  .inspection-toolbar { align-items: flex-start; flex-direction: column; }
  .toolbar-actions { width: 100%; justify-content: flex-end; }
  table { min-width: 920px; }
}

@media (max-width: 680px) {
  .topbar, .query-strip, .topbar-utility { align-items: flex-start; flex-direction: column; }
  .workspace { width: min(100% - 28px, 1400px); margin-top: 16px; }
  .topbar { min-height: auto; padding: 20px 14px; }
  .query-strip, .result-panel, .list-panel { padding: 18px; }
  .query-strip form { grid-template-columns: 1fr; }
  .result-list > div { grid-template-columns: 1fr; gap: 5px; }
  .filter-controls, .threshold-controls { width: 100%; align-items: stretch; flex-direction: column; }
  .filter-controls select, .threshold-custom { width: 100%; }
  .toolbar-actions { justify-content: stretch; }
  .toolbar-actions button { flex: 1; }
  .integration-bar { padding: 16px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .inspection-progress-fill { transition: none; }
  .inspection-progress-track.is-indeterminate .inspection-progress-fill { animation: none; }
}
