:root {
  --bg: #f7f8fa;
  --panel: #ffffff;
  --line: #dde1e7;
  --fg: #1d2129;
  --dim: #626a77;
  --accent: #0b6bcb;
  --stripe: #f1f3f6;
  --hover: #e6ecf4;
  --warn: #b3261e;
  color-scheme: light;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}
/* Dark: when the system asks for it (unless overridden to light), or when
   overridden to dark. The override is data-theme on <html>. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161a;
    --panel: #1c1f25;
    --line: #2c313a;
    --fg: #e6e8ec;
    --dim: #949aa6;
    --accent: #7cc4ff;
    --stripe: #21252c;
    --hover: #2c333e;
    --warn: #ff7b72;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14161a;
  --panel: #1c1f25;
  --line: #2c313a;
  --fg: #e6e8ec;
  --dim: #949aa6;
  --accent: #7cc4ff;
  --stripe: #21252c;
  --hover: #2c333e;
  --warn: #ff7b72;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0; padding: 14px 16px;
  background: var(--bg); color: var(--fg);
  font: 14px/1.35 system-ui, -apple-system, "Segoe UI", sans-serif;
}
header, nav, .panel, footer { max-width: 1400px; }
h1 { font-size: 16px; margin: 0; display: inline; }
.sub { color: var(--dim); font-size: 12px; margin-left: 8px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Folder tabs: the current one is the panel's colour and opens into the
   panel below it (its bottom edge covers the panel's top border); the rest
   sit behind, on the page's own background. */
nav { display: flex; flex-wrap: wrap; gap: 2px 3px; margin: 10px 0 0; padding: 0 6px; }
nav a {
  position: relative; margin-bottom: -1px; padding: 5px 12px 4px;
  background: var(--stripe); color: var(--dim);
  border: 1px solid var(--line); border-radius: 6px 6px 0 0;
}
nav a:hover { background: var(--hover); color: var(--fg); text-decoration: none; }
nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
nav a[aria-current="page"] {
  z-index: 1; background: var(--panel); color: var(--fg);
  border-top: 2px solid var(--accent); border-bottom-color: var(--panel); padding-top: 4px;
}
nav + .panel { margin-top: 0; }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 6px; padding: 8px 10px; margin: 10px 0;
}
.controls { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
button {
  background: var(--stripe); color: var(--fg); border: 1px solid var(--line);
  border-radius: 4px; padding: 3px 9px; font: inherit; font-size: 12px; cursor: pointer;
}
button:hover { border-color: var(--accent); }
.status { color: var(--dim); font-size: 12px; }
.controls .end { margin-left: auto; display: flex; gap: 6px; }
.error { border-color: var(--warn); }
.error p { color: var(--warn); margin: 0 0 6px; }

.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 3px 8px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child, th.left, td.left { text-align: left; }
th {
  font-size: 11px; color: var(--dim); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  position: sticky; top: 0; background: var(--panel);
}
tbody tr:nth-child(even) { background: var(--stripe); }
tbody tr:hover { background: var(--hover); }
td.num { font-family: var(--mono); font-size: 12px; }
td.note { color: var(--dim); font-style: italic; font-family: inherit; }
td:first-child { white-space: normal; }
td.model-cell { min-width: 14em; }
.mname { font-weight: 600; margin-right: 4px; }
.idline { display: block; }
.mid {
  font-family: var(--mono); font-size: 12px; color: var(--accent);
  background: none; border: 0; padding: 0; text-align: left;
  overflow-wrap: anywhere; cursor: copy;
}
.mid:hover { text-decoration: underline; }
.mid.copied::after { content: " copied"; color: var(--dim); font-family: system-ui, sans-serif; }
.ext { margin-left: 6px; }
.badge {
  display: inline-block; font-size: 10px; line-height: 1.4; padding: 0 5px; margin: 0 3px 0 0;
  border: 1px solid var(--line); border-radius: 8px; color: var(--dim); white-space: nowrap;
  vertical-align: 1px;
}
.badge.warn { color: var(--warn); border-color: var(--warn); }
.badge.free { color: var(--accent); border-color: var(--accent); }
.badge.tiered { cursor: help; border-style: dashed; }
td.more { text-decoration: underline dotted var(--dim); text-underline-offset: 3px; cursor: help; }
.badge.new { color: var(--bg); background: var(--accent); border-color: var(--accent); }
a.badge.page { color: var(--fg); text-decoration: none; }
a.badge.page:hover { border-color: var(--accent); color: var(--accent); }
tr.model { cursor: pointer; }
tr.model.open { background: var(--hover); }
tr.desc td {
  white-space: normal; text-align: left; color: var(--dim);
  font-size: 13px; padding: 4px 10px 8px; background: var(--panel);
}
th button.sort {
  background: none; border: 0; padding: 0; font: inherit; color: inherit;
  text-transform: inherit; letter-spacing: inherit; cursor: pointer;
}
th button.sort:hover { color: var(--fg); }
th[aria-sort] { color: var(--fg); }
.filters label[hidden] { display: none; }
.filters label { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--dim); }
.filters .grow { flex: 1 1 12em; }
.filters input[type="search"] { flex: 1; min-width: 0; }
#newWindow { width: 4.5em; }
select, input[type="search"], input[type="number"] {
  font: inherit; font-size: 13px; color: var(--fg); background: var(--panel);
  border: 1px solid var(--line); border-radius: 4px; padding: 2px 6px;
}
select { max-width: 14em; }
.workload input[type="number"] { width: 8.5em; }
.wl-title { font-size: 12px; font-weight: 600; }
.wl-hint { min-width: 3em; font-family: var(--mono); font-size: 11px; }
td.reason { cursor: help; }
td.reason .why { margin-left: 6px; font-size: 11px; }
td.estimate { cursor: help; text-decoration: underline dotted var(--dim); text-underline-offset: 3px; }
td .at { color: var(--dim); font-size: 11px; }
.placeholder { color: var(--dim); padding: 12px 4px; margin: 0; }
.page-intro { margin: 2px 4px 8px; font-size: 13px; color: var(--dim); }
/* The current tab's description: the first line of the panel the tab opens into. */
.page-description { flex-basis: 100%; margin: 0 0 2px; font-size: 13px; color: var(--dim); }
.page-description:empty { display: none; }
td.flag { text-align: center; color: var(--accent); }
footer { color: var(--dim); font-size: 11px; padding: 0 2px 6px; }
