:root {
  color-scheme: light;
  --paper: #edf1fb;
  --white: #fff;
  --ink: #1b2649;
  --muted: #4d5b81;
  --blue: #344da1;
  --line: #d2dcf4;
  --danger: #9b2843;
  font: 16px / 1.55 "Segoe UI Variable", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); }
.bar {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 0 clamp(1rem, 5vw, 3rem);
}
.brand { color: var(--blue); font-size: 1.125rem; letter-spacing: .05em; }
main { width: min(1080px, calc(100% - 2rem)); margin: 0 auto; padding: 2.5rem 0; }
h1, h2, p { margin: 0; }
h1 { font: 700 clamp(2.25rem, 8vw, 4rem) / 1.16 "Microsoft YaHei", "PingFang SC", sans-serif; letter-spacing: -.025em; }
h2 { font-size: 1.25rem; }
p { overflow-wrap: anywhere; }
button, input, select { font: inherit; }
label { font-size: .875rem; font-weight: 650; }
input, select { min-width: 0; color: var(--ink); border: 1px solid #9daed5; border-radius: .55rem; padding: .55rem .7rem; background: var(--white); }
button {
  min-height: 44px;
  cursor: pointer;
  border: 1px solid var(--blue);
  background: var(--blue);
  color: var(--white);
  font-weight: 650;
  padding: .55rem .9rem;
  border-radius: .6rem;
}
button.quiet { border-color: var(--line); background: var(--white); color: var(--blue); }
button:disabled { cursor: wait; opacity: .65; }
:focus-visible { outline: 3px solid #6376bc; outline-offset: 2px; }
form, .login, .panel, .intro > div:first-child { display: grid; gap: .65rem; }
.login {
  width: min(100%, 460px);
  margin: clamp(1rem, 10vh, 7rem) auto 0;
  padding: clamp(1rem, 6vw, 2.2rem);
  background: var(--white);
  border: 1px solid var(--line);
  border-top: .5rem solid var(--blue);
  border-radius: 1rem;
}
.login h1 { font-size: 2.1rem; margin-bottom: .8rem; }
.login .error:empty, #rule-error:empty { display: none; }
.error { color: var(--danger); }
.muted, .date { color: var(--muted); }
.date { color: var(--blue); font-weight: 650; font-variant-numeric: tabular-nums; }
.intro { display: flex; flex-wrap: wrap; gap: 1rem; align-items: end; justify-content: space-between; margin-bottom: 1.3rem; }
.tools { display: flex; flex-wrap: wrap; gap: .45rem; }
.panel { align-content: start; min-width: 0; border: 1px solid var(--line); padding: 1.15rem; background: var(--white); border-radius: 1rem; }
#connect { max-width: 36rem; }
#generate { justify-self: start; }
.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; }
.rows { list-style: none; padding: 0; margin: 0; }
.rows li { display: grid; gap: .35rem; padding: .76rem 0; border-bottom: 1px solid var(--line); }
.rows li:last-child { border-bottom: 0; }
.row-head { display: flex; justify-content: space-between; align-items: center; gap: .7rem; }
.row-head > div { min-width: 0; overflow-wrap: anywhere; }
.row-head span { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.rows .muted { font-size: .875rem; }
progress { appearance: none; width: 100%; height: .4rem; border: 0; background: var(--line); border-radius: 1rem; overflow: hidden; }
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--blue); border-radius: 1rem; }
progress::-moz-progress-bar { background: var(--blue); }
.notice { margin-bottom: .9rem; padding: .65rem .8rem; border-left: .25rem solid var(--blue); background: var(--white); }
.footnote { margin-top: 1rem; font-size: .875rem; }
.pair { padding: .75rem; background: var(--paper); border-radius: .65rem; }
.code { color: var(--blue); font: 700 clamp(1.4rem, 7vw, 2.2rem) / 1.3 ui-monospace, monospace; letter-spacing: .09em; }
dialog { width: min(580px, calc(100% - 1.25rem)); max-height: calc(100% - 1.25rem); padding: 1.2rem; border: 1px solid var(--line); border-radius: 1rem; color: var(--ink); }
dialog::backdrop { background: rgba(27, 38, 73, .55); }
.rule-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
fieldset { min-width: 0; display: grid; gap: .35rem; margin: 0; border: 1px solid var(--line); border-radius: .55rem; padding: .75rem; }
legend { color: var(--blue); font-weight: 650; }
dialog .tools { justify-content: flex-end; }
.sr-only { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
@media (max-width: 640px) {
  main { padding-top: 1.5rem; }
  .report-grid, .rule-fields { grid-template-columns: 1fr; }
}
