/* Shared page frame: a left navigation menu next to the page content.
   Uses the colour tokens each page defines (--surface, --ink, --ink-2, --muted, --grid, --border). */
.layout { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
  padding: 18px 12px; background: var(--surface); border-right: 1px solid var(--border); }
.side .brand { display: flex; align-items: center; gap: 8px; padding: 2px 10px 14px; color: var(--ink);
  font-weight: 600; font-size: 15px; text-decoration: none; }
.side .brand svg { color: var(--accent, var(--series-1)); }
.side .nav-label { padding: 6px 10px 4px; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.side a.nav { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px;
  color: var(--ink-2); text-decoration: none; font-size: 14px; }
.side a.nav:hover { background: var(--grid); color: var(--ink); }
.side a.nav[aria-current="page"] { background: var(--grid); color: var(--ink); font-weight: 600; }
.side a.nav svg { flex: none; }
.side .foot { margin-top: auto; padding: 8px 10px; font-size: 11px; line-height: 1.4; color: var(--muted); }
.side .foot a { color: inherit; }
/* The column's width: with its auto margins, main would otherwise be as wide as its widest unbreakable
   content (a grid item with auto margins is not stretched), wider than a phone's screen. */
.layout > main { min-width: 0; width: 100%; }

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: sticky; z-index: 5; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap;
    padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--border); }
  .side .brand { padding: 0 8px 0 0; }
  .side .nav-label, .side .foot { display: none; }
  .side a.nav { padding: 6px 10px; }
}

/* Column filter dialogs (column-filters.js on the catalogue, data-table.js elsewhere). */
.colfilter { position: fixed; inset: auto; margin: 0; width: min(300px, calc(100vw - 16px)); max-height: min(440px, calc(100vh - 16px));
  overflow: auto; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--ink);
  box-shadow: 0 10px 30px rgba(0,0,0,.25); font-size: 13px; }
.colfilter[hidden] { display: none; }
.cf-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.cf-head b { flex: 1; }
.cf-x { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; }
.cf-range { display: flex; gap: 10px; }
.cf-range label { display: grid; gap: 3px; flex: 1; min-width: 0; font-size: 12px; color: var(--ink-2); }
.cf-range input { width: 100%; min-width: 0; }
.cf-hint { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.cf-find { width: 100%; margin-bottom: 8px; }
.cf-list { display: grid; gap: 1px; max-height: 250px; overflow: auto; }
.cf-list label { display: flex; align-items: center; gap: 8px; padding: 5px 4px; border-radius: 6px; cursor: pointer; }
.cf-list label:hover { background: var(--hover, rgba(127,127,127,.1)); }
.cf-list .cf-group { font-weight: 600; border-bottom: 1px solid var(--grid); border-radius: 6px 6px 0 0; margin-bottom: 2px; }
.cf-list label[hidden] { display: none; }
.cf-list input { margin: 0; padding: 0; }
.cf-list .dot { width: 8px; height: 8px; border-radius: 50%; }
.cf-n { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.cf-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.cf-count { color: var(--ink-2); }
/* Sortable, filterable tables (data-table.js): titles sort; a funnel after one, faint until the header is
   hovered and blue when on, opens its filter. */
th .dt-hc { display: inline-flex; align-items: center; gap: 2px; vertical-align: bottom; }
th .dt-sort { all: unset; cursor: pointer; white-space: nowrap; }
th .fbtn { all: unset; display: inline-grid; place-items: center; flex: none; width: 16px; height: 18px; border-radius: 4px;
  color: var(--muted); opacity: .35; cursor: pointer; }
thead:hover th .fbtn, th .fbtn:focus-visible { opacity: 1; }
th .fbtn.on { color: var(--accent, var(--series-1)); opacity: 1; }
th .dt-sort:focus-visible, th .fbtn:focus-visible { outline: 2px solid var(--accent, var(--series-1)); outline-offset: 1px; border-radius: 3px; }
@media (hover: none) { th .fbtn { opacity: .7; } }
.dt-foot { color: var(--muted); font-size: 12px; white-space: normal; }
.dt-link { all: unset; color: var(--accent, var(--series-1)); cursor: pointer; }
.dt-link:hover { text-decoration: underline; }
.dt-link:focus-visible { outline: 2px solid var(--accent, var(--series-1)); border-radius: 3px; }

/* Time window (time-window.js): period buttons and dates, then a range slider over an overview, full width. */
.tw { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.tw-head { display: flex; align-items: center; gap: 8px; flex: none; }
.tw-title { font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.tw-presets { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.tw-presets:empty { display: none; }
.tw .tw-presets button { background: transparent; color: var(--ink-2); border: 0; border-radius: 0; padding: 3px 9px; font: inherit; font-size: 12px; cursor: pointer; }
.tw .tw-presets button + button { border-left: 1px solid var(--border); }
.tw .tw-presets button:hover { color: var(--ink); }
.tw .tw-presets button[aria-pressed="true"] { background: var(--grid); color: var(--ink); }
.tw-track { position: relative; order: 3; flex: 1 1 100%; min-width: 0; height: 48px; border-radius: 6px; background: var(--page);
  touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.tw-track canvas { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 6px; }
.tw-dim { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--surface) 72%, transparent); pointer-events: none; }
.tw-dim.l { left: 0; border-radius: 6px 0 0 6px; }
.tw-dim.r { right: 0; border-radius: 0 6px 6px 0; }
.tw-win { position: absolute; top: 0; bottom: 0; min-width: 2px; box-sizing: border-box; border: 2px solid var(--accent, var(--series-1));
  border-radius: 5px; cursor: grab; }
.tw-win:active { cursor: grabbing; }
.tw-len { position: absolute; top: 2px; left: 50%; transform: translateX(-50%); padding: 0 4px; border-radius: 3px; pointer-events: none;
  font-size: 11px; line-height: 15px; white-space: nowrap; color: var(--ink); background: color-mix(in srgb, var(--surface) 82%, transparent); }
.tw-h { position: absolute; top: 50%; width: 10px; height: 26px; margin-top: -13px; transform: translateX(-50%); box-sizing: border-box;
  border-radius: 4px; background: var(--surface); border: 1.5px solid var(--accent, var(--series-1)); cursor: ew-resize; touch-action: none; }
.tw-h::before { content: ""; position: absolute; inset: -12px -9px; } /* a larger target, for fingers */
.tw-h::after { content: ""; position: absolute; left: 2px; right: 2px; top: 7px; bottom: 7px;
  border-left: 1px solid var(--muted); border-right: 1px solid var(--muted); }
.tw-win:focus-visible, .tw-h:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.tw-dates { display: flex; align-items: center; gap: 6px; flex: none; margin-left: auto; font-size: 12px; color: var(--ink-2); }
.tw .tw-dates input { font: inherit; font-size: 12px; padding: 3px 6px; }
@media (max-width: 800px) {
  .tw-dates { margin-left: 0; }
  .tw-h { width: 12px; height: 30px; margin-top: -15px; }
}
