:root {
  --bg: #fff;
  --text: #1c1c1c;
  --muted: #6a6a6a;
  --line: #e3e3e3;
  --soft: #f4f4f4;
  --accent: #0b6e4f;
  --dot: #088a60;
  --on-accent: #fff;
  --bad: #b3261e;
  --shadow: 0 1px 6px rgb(32 33 36 / 0.22);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ---- header: centered on the home page, a bar on a firm page ---- */

header { display: flex; align-items: center; gap: 20px; padding: 14px 20px; }
.mark { color: var(--text); text-decoration: none; font-weight: 400; letter-spacing: -0.03em; font-size: 1.5rem; }
.search { position: relative; flex: 1; max-width: 584px; }
.tag { margin: 0; color: var(--muted); font-size: 0.9rem; text-align: center; }

.home header { flex-direction: column; gap: 26px; padding-top: 21vh; }
.home .mark { font-size: clamp(3rem, 13vw, 4.6rem); line-height: 1; }
.home .search { flex: none; width: 100%; }
.firm header { border-bottom: 1px solid var(--line); }
.firm .tag { display: none; }

#q {
  width: 100%;
  height: 46px;
  padding: 0 22px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  outline: none;
}
#q:hover, #q:focus { box-shadow: var(--shadow); border-color: transparent; }

#options {
  position: absolute;
  z-index: 2;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: min(340px, 50vh);
  overflow-y: auto;
  margin: 0;
  padding: 8px 0;
  list-style: none;
  background: var(--bg);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
#options li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 22px; cursor: pointer; }
#options li:hover, #options li.active { background: var(--soft); }
#options .n, .muted, th { color: var(--muted); }
#options .n { font-size: 0.85rem; font-variant-numeric: tabular-nums; }
#options .none { color: var(--muted); cursor: default; background: none; }

/* ---- a firm ---- */

main { width: 100%; max-width: 780px; margin: 0 auto; padding: 30px 20px 56px; }
h1 { margin: 0; font-size: 1.7rem; font-weight: 600; letter-spacing: -0.02em; }
h2 { margin: 40px 0 6px; font-size: 1rem; font-weight: 600; }
.muted { margin: 2px 0 0; }

#filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.chip {
  padding: 5px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }

.scroll { overflow-x: auto; margin-top: 14px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; white-space: nowrap; }
th, td { padding: 9px 0 9px 18px; border-bottom: 1px solid var(--line); text-align: right; font-weight: 400; }
th:first-child { padding-left: 0; text-align: left; }
thead th { font-size: 0.82rem; }
tbody th { color: var(--text); }
#summary tbody tr:first-child :is(th, td) { font-weight: 600; }
#summary th:first-child { white-space: normal; }
#rows :is(th, td):nth-child(2) { text-align: left; }

/* ---- charts ---- */

#charts { position: relative; }
#charts svg { display: block; width: 100%; margin-top: 14px; overflow: visible; touch-action: pan-y; }
#charts text { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
#charts .name { fill: var(--text); font-size: 13px; }
.note { font-size: 0.86rem; }
.grid { stroke: var(--line); }
.median { stroke: var(--text); stroke-width: 2; stroke-linecap: round; }
.dot { fill: var(--dot); stroke: var(--bg); stroke-width: 4; paint-order: stroke; }
.dot.faint { fill: #c2c2c2; }
.dot.on { stroke: var(--text); }
.line { fill: none; stroke: var(--dot); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.tip {
  position: absolute;
  z-index: 1;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--bg);
  box-shadow: var(--shadow);
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
  pointer-events: none;
}
.tip :is(strong, span) { display: block; }
.tip strong { color: var(--text); font-size: 1rem; font-weight: 600; }

/* ---- the form ---- */

.btn {
  margin-top: 24px;
  padding: 9px 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.btn:hover { box-shadow: var(--shadow); }
.btn.primary { margin-top: 20px; background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn:disabled { opacity: 0.6; cursor: default; }
.link { margin-left: 10px; border: 0; background: none; color: var(--muted); font: inherit; cursor: pointer; }

form { margin-top: 26px; padding: 22px; border: 1px solid var(--line); border-radius: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px 20px; }
label, legend { display: block; font-size: 0.86rem; color: var(--muted); }
.grid input[type="number"], .grid select {
  display: block;
  width: 100%;
  height: 40px;
  margin-top: 5px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.grid :is(input, select):focus-visible, .btn:focus-visible, .chip:focus-visible, .link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.hint { display: block; min-height: 1.3em; margin-top: 3px; font-variant-numeric: tabular-nums; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
fieldset label { display: inline-block; margin: 12px 18px 0 0; color: var(--text); font-size: 1rem; }
fieldset:disabled { opacity: 0.45; }
.fine { margin: 18px 0 0; font-size: 0.82rem; color: var(--muted); max-width: 62ch; }
.err { margin: 16px 0 0; color: var(--bad); }
.ok { margin: 22px 0 0; color: var(--accent); font-weight: 600; }

footer { margin-top: auto; padding: 18px 20px; text-align: center; font-size: 0.8rem; color: var(--muted); }
