/* Everything beyond the export's look: top nav, login, table grids and coverage. Same tokens as catalog.css. */

header h1 a.home { color: inherit; text-decoration: none; }
/* the search box (now with a "what" select) gets the room first; the stats line yields with an ellipsis */
header .search { flex: 0 1 600px; }
header .search select { flex: none; }
header .stats { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------------------------------------------ top nav */
.topnav { display: flex; align-items: center; gap: 14px; margin-left: auto; font-size: 13px; white-space: nowrap; }
.topnav > a, .topnav summary { color: var(--muted); }
.topnav > a.on, .topnav summary.on { color: var(--text); font-weight: 600; }
.topnav .logout { display: flex; align-items: center; gap: 8px; margin: 0; }
.topnav .who { color: var(--muted); font-size: 12px; }
.topnav .version { color: var(--muted); font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--chip); border-radius: 9px; padding: 1px 7px; }
button, .button {
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px;
  padding: 5px 10px; font: inherit; font-size: 12px; cursor: pointer; text-decoration: none; display: inline-block;
}
button:hover, .button:hover { background: var(--hover); text-decoration: none; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-size: 14px; padding: 8px 12px; }
button.primary:hover { filter: brightness(1.08); background: var(--accent); }

/* <details> dropdowns (Tables, Columns, Filter syntax) */
details.menu { position: relative; }
details.menu summary { list-style: none; cursor: pointer; user-select: none; }
details.menu summary::-webkit-details-marker { display: none; }
details.menu summary::after { content: " ▾"; font-size: 10px; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 190px; max-height: 70vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18);
  padding: 6px 0; display: flex; flex-direction: column;
}
.topnav .menu-list { left: 0; right: auto; }
.menu-list > a { padding: 6px 12px; color: var(--text); }
.menu-list > a:hover { background: var(--hover); text-decoration: none; }
.menu-list > a.on { color: var(--accent); }
.menu-list label { display: flex; gap: 8px; align-items: center; padding: 4px 12px; cursor: pointer; white-space: nowrap; }
.menu-list label:hover { background: var(--hover); }
.help-text { width: min(440px, 90vw); padding: 8px 14px; white-space: normal; font-size: 12px; }
.help-text p { margin: 4px 0; }
code { background: var(--chip); border-radius: 4px; padding: 0 4px; font-size: 12px; }

/* ------------------------------------------------------------------ login */
main.center { align-items: center; justify-content: center; padding: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 22px 24px; }
form.login { width: min(340px, 100%); display: flex; flex-direction: column; gap: 12px; }
form.login h2 { margin: 0; font-size: 18px; }
form.login .sub { margin: -6px 0 4px; color: var(--muted); font-size: 13px; }
form.login label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
form.login input { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font: inherit; }
.error { background: rgba(220, 38, 38, .12); color: #dc2626; border-radius: 6px; padding: 8px 10px; font-size: 13px; }

/* ------------------------------------------------------------------ table pages */
main.grid-page, main.report { flex-direction: column; min-width: 0; }
.toolbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; flex-wrap: wrap; border-bottom: 1px solid var(--line); background: var(--panel); }
.page-title { margin: 0; font-size: 15px; }
.toolbar .desc { color: var(--muted); font-size: 12px; max-width: 760px; }
.toolbar .spacer { flex: 1; }
.toolbar details.menu summary { border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; font-size: 12px; background: var(--panel); }

.grid-wrap { flex: 1; overflow: auto; min-height: 0; background: var(--panel); }
/* Auto layout + nowrap: every column is as wide as its widest content (header or any cell shown),
   never narrower. Filter inputs use percentage widths, so they follow the column, not the reverse. */
table.grid { border-collapse: separate; border-spacing: 0; font-size: 13px; table-layout: auto; }
table.grid th, table.grid td {
  padding: 5px 8px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line);
  white-space: nowrap; text-align: left;
}
table.grid thead th { position: sticky; top: 0; z-index: 2; background: var(--bg); font-weight: 600; vertical-align: top; }
table.grid thead tr.filters th { top: 30px; padding: 3px 4px 5px; font-weight: 400; }
table.grid th .head { display: flex; align-items: center; gap: 4px; cursor: pointer; user-select: none; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; height: 19px; }
table.grid th .head .lbl { white-space: nowrap; }
table.grid th .head .arrow { color: var(--accent); font-size: 10px; }
table.grid th .head .arrow sup { font-size: 9px; }
table.grid th.sorted .head { color: var(--text); }
table.grid tbody tr:hover td { background: var(--hover); }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid td.dim { color: var(--muted); }
table.grid td.links { white-space: nowrap; }
table.grid td.links a + a { margin-left: 8px; }
.yes { color: #16a34a; }
.no { color: var(--warn); }

/* header filters */
.f { display: flex; gap: 3px; width: 100%; min-width: 4.5em; }
.f input, .f .pick {
  width: 100%; min-width: 2.5em; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 5px;
  padding: 3px 6px; font: inherit; font-size: 12px;
}
.f input.active, .f .pick.active { border-color: var(--accent); background: var(--accent-soft); }
.f .pick { text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 0; flex: 1 1 auto; }
.f .list { flex: none; padding: 1px 5px; font-size: 11px; color: var(--muted); }
.f .list.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.f input.bad { border-color: #dc2626; }
.choices {
  position: fixed; z-index: 30; background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18); width: 280px; max-height: 360px; display: flex; flex-direction: column;
}
.choices .top { padding: 8px; display: flex; gap: 6px; border-bottom: 1px solid var(--line); }
.choices .top input { flex: 1; min-width: 0; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 5px; padding: 4px 7px; font: inherit; font-size: 12px; }
.choices .opts { overflow: auto; flex: 1; padding: 4px 0; }
.choices label { display: flex; gap: 8px; align-items: center; padding: 3px 10px; font-size: 12px; cursor: pointer; }
.choices label:hover { background: var(--hover); }
.choices label .n { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.choices .bottom { padding: 8px; display: flex; gap: 6px; justify-content: flex-end; border-top: 1px solid var(--line); }

.pager { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-top: 1px solid var(--line); background: var(--panel); font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.pager .spacer { flex: 1; }
.pager select, .pager input { padding: 3px 6px; font-size: 12px; }
.pager input { width: 64px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; }
.pager .err { color: #dc2626; }
.grid-wrap.loading tbody { opacity: .45; }

/* ------------------------------------------------------------------ coverage */
table.coverage { table-layout: auto; }
table.coverage th { white-space: normal; font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
table.coverage thead tr:nth-child(2) th { top: 27px; text-transform: none; letter-spacing: 0; font-weight: 500; min-width: 84px; }
table.coverage th.group { text-align: center; color: var(--text); }
table.coverage td.name { font-weight: 600; }
table.coverage td.problem a { color: var(--warn); font-weight: 700; }
table.coverage td.when { color: var(--muted); font-size: 12px; }
table.coverage tfoot td { position: sticky; bottom: 0; background: var(--bg); font-weight: 600; border-top: 2px solid var(--line); }

@media (max-width: 800px) {
  header .search { flex: 1 1 100%; flex-wrap: wrap; min-width: 0; }
  header .search input { flex: 1 1 100%; }
  header .search select { flex: 1 1 0; min-width: 0; }
  .topnav { margin-left: 0; width: 100%; flex-wrap: wrap; }
  .toolbar .desc { display: none; }
}

/* ------------------------------------------------------------------ update banner (version.js) */
#update-banner {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 100;
  display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px);
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 8px; padding: 8px 12px; box-shadow: 0 8px 24px rgba(0,0,0,.18); font-size: 13px;
}
#update-banner button { flex: none; }
