:root {
  --bg: #f6f3ec;
  --paper: #ffffff;
  --ink: #1d1d1b;
  --muted: #5f5c55;
  --accent: #1f5f3f;
  --line: #d9d4c7;
  --control-h: 42px;

  /* One column layout shared by the search form and the results table, so
     each field sits above the column it filters: the Sheet column is just
     wide enough for its link (and the two buttons above it), the four data
     columns share the rest equally. */
  --col-sheet: 208px;
  --table-min: 760px; /* below this the table scrolls and the form stacks */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 16px 48px;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 Georgia, "Times New Roman", serif;
  max-width: 1100px;
  margin-inline: auto;
}

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


header { margin: 32px 0 24px; }
header h1 { margin: 0 0 8px; font-size: 2.2rem; font-weight: normal; }
header p { margin: 0; color: var(--muted); max-width: 72ch; }
#coverage { display: block; margin-top: 8px; }

form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) var(--col-sheet);
  align-items: end;
  padding: 12px 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: system-ui, sans-serif;
}
/* Same horizontal inset as the table cells, so a box's edge meets the start
   of its column's text. */
form > * { padding: 0 10px; min-width: 0; }

label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; color: var(--muted); }

.actions { display: flex; gap: 8px; }

@media (max-width: 759px) {
  form {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    padding: 16px;
  }
  form > * { padding: 0; }
}

/* Inputs, drop-downs and buttons share one height so they line up. */
input, select, button {
  height: var(--control-h);
  font: inherit;
  font-size: 1rem;
  line-height: 1.5;
}

input, select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Drop the native select look (Safari ignores padding and border otherwise)
   and draw our own chevron. */
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%235f5c55' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 12px 8px;
  cursor: pointer;
  text-overflow: ellipsis;
}

button {
  padding: 0 20px;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}
button:hover { filter: brightness(1.1); }
button:disabled { opacity: 0.5; cursor: default; filter: none; }

/* Secondary action, e.g. Clear. */
button.ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--line);
}
button.ghost:hover { background: var(--bg); filter: none; }

#status { margin: 16px 0; color: var(--muted); font-family: system-ui, sans-serif; }

.scroll { overflow-x: auto; }

table {
  width: 100%;
  min-width: var(--table-min);
  table-layout: fixed;
  border-collapse: collapse;
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 0.95rem;
}
/* Fixed layout gives columns without a width equal shares of the rest. */
col.sheet { width: var(--col-sheet); }

th, td { padding: 8px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); overflow-wrap: break-word; }
th { font-family: system-ui, sans-serif; font-weight: 600; font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
tbody tr:nth-child(even) { background: #faf8f3; }
td a { white-space: nowrap; }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 16px 0;
  color: var(--muted);
  font-family: system-ui, sans-serif;
}

footer {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
footer p { margin: 0; }
