:root {
  color-scheme: light;
  --ink: #12171c;
  --muted: #3d4a54;
  --line: #c5ced6;
  --paper: #eef1f4;
  --card: #ffffff;
  --bar: #101418;
  --accent: #0f3f6e;
  --save: #0c6b45;
  --high: #8d2a2a;
  --blank: #6a3b12;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: "Segoe UI", "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Hiragino Sans", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-size: 14px;
  line-height: 1.35;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
}

.skip:focus {
  left: 8px;
  top: 8px;
  z-index: 40;
  background: #fff;
  color: var(--ink);
  padding: 6px 8px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  background: var(--bar);
  color: #fff;
}

.brand {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.lang-menu { position: relative; }

.lang-menu summary {
  list-style: none;
  cursor: pointer;
  height: 28px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  border: 1px solid #3c4652;
  border-radius: 3px;
  color: #fff;
  font-size: 13px;
}

.lang-menu summary::-webkit-details-marker { display: none; }

.lang-panel {
  position: absolute;
  right: 0;
  top: 34px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  min-width: 148px;
  display: grid;
  z-index: 30;
}

.lang-panel a {
  padding: 7px 10px;
  text-decoration: none;
  color: inherit;
}

.lang-panel a[aria-current="page"] { font-weight: 700; }

.lang-panel a:hover { background: #f3f5f7; }

.first-screen { align-content: start; }

.first-screen {
  display: grid;
  gap: 8px;
  padding: 10px 16px 12px;
}

h1 {
  max-width: none;
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.03em;
}

@media (min-width: 1440px) {
  h1 { white-space: nowrap; }
}

.dek {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.inputs {
  display: grid;
  grid-template-columns: 1.1fr 1.1fr 1.3fr 1.2fr;
  gap: 8px;
  margin: 0;
}

.field, .tier {
  display: grid;
  gap: 3px;
  align-content: start;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
}

.hint {
  font-weight: 500;
  color: var(--ink);
}

input, select {
  height: 32px;
  width: 100%;
  border: 1px solid #8e9aa6;
  border-radius: 3px;
  padding: 0 8px;
  font: inherit;
  font-weight: 550;
  color: var(--ink);
  background: #fff;
}

.cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: 4px;
  padding: 8px;
  display: grid;
  gap: 3px;
  align-content: start;
  min-width: 0;
}

.card h2 {
  margin: 0;
  font-size: 14px;
  letter-spacing: -0.01em;
}

.permin {
  margin: 2px 0 0;
  font-size: 22px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.scope, .line, .full, .caveat, .marginal, .dirs {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.scope { color: var(--muted); font-size: 12px; }

.line { font-size: 13px; }

.full { font-size: 12px; color: var(--blank); }

.parts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1px 8px;
  margin: 4px 0 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.parts div { display: contents; }

.parts dt { color: var(--muted); }

.parts dd { margin: 0; }

.blank { color: var(--blank); }

.caveat, .marginal, .dirs {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.delta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 6px 8px;
}

.delta-lead {
  margin: 0;
  flex: 1 1 100%;
  font-size: 12px;
  color: var(--muted);
}

.calls {
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pill {
  margin: 0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.pill.base { color: var(--high); }

.pill.save { color: var(--save); }

.input-error {
  margin: 0;
  color: var(--high);
  font-weight: 700;
}

.section {
  padding: 4px 16px 12px;
}

.section h2 {
  margin: 0 0 6px;
  font-size: 16px;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  min-width: 920px;
  font-variant-numeric: tabular-nums;
}

th, td {
  text-align: left;
  padding: 6px 8px;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

thead th {
  background: var(--bar);
  color: #fff;
  font-weight: 650;
}

tbody tr:nth-child(even) { background: #f6f8fa; }

.sub {
  display: block;
  color: var(--muted);
}

.example-lead { margin: 0 0 8px; }

.proof {
  margin: 8px 0 0;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
  overflow-x: auto;
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre;
}

.notes { margin: 0; padding-left: 18px; }

.notes li { margin: 0 0 6px; }

.disclosure {
  margin: 0 16px 12px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 14px;
}

.disclosure a { color: var(--accent); }

.site-foot {
  white-space: nowrap;
  overflow-x: auto;
  height: 32px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  background: #fff;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

.site-foot p { margin: 0; }

.site-foot a { color: var(--accent); text-decoration: none; }

.site-foot a + a::before { content: " · "; color: #5c6770; }

.not-found {
  padding: 24px 16px 48px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

@media (max-width: 1200px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inputs { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  h1 { font-size: 24px; }
  .cards, .inputs { grid-template-columns: 1fr; }
  .topbar { padding: 0 10px; }
}
