/* Lists: a filter bar on top, rows divided by lines with every column lined up, a whole row opening its page, and a
   foot with the count and the pages. Also the access rows, where a choice wears the colour of its record type. */

/* ---------- Filters: one line on top of the list ---------- */
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding-top: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.toolbar .find-field { height: 40px; }
.toolbar .find-field.grow { flex: 1 1 260px; max-width: 420px; }

/* The bulk bar of a list you can select in. */
.bulkbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); background: var(--panel-2); font-size: var(--fs-s); }
.bulkbar .right { display: flex; gap: 8px; margin-left: auto; }
.bulkbar label { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- Rows: one fact per column, the columns set once per list with --rl-cols ---------- */
.rl-head, .rl-row { display: grid; grid-template-columns: var(--rl-cols); gap: 18px; align-items: center; }
.rl-head {
  padding-top: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); background: var(--panel-2);
  font-size: var(--fs-2xs); font-weight: 600; letter-spacing: var(--tr-caps); text-transform: uppercase; color: var(--ink-4);
}
.rl-head .right, .rl-row .right { justify-self: end; text-align: right; }
.rl-row { position: relative; min-height: 64px; padding-top: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); transition: background .15s ease; }
.rl-row:hover { background: var(--panel-2); }
.rl-row[data-tone]::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--edge); }
.rl-row[data-tone="ok"] { --edge: var(--ok); }
.rl-row[data-tone="warn"] { --edge: var(--warn); }
.rl-row[data-tone="bad"] { --edge: var(--bad); }
.rl-row[data-tone="info"] { --edge: var(--brand-text); }
.rl-row[data-tone="mute"] { --edge: var(--line-strong); }
/* The row is a link as a whole; its buttons and menus sit above that link. */
.rl-link { position: absolute; inset: 0; z-index: 0; }
.rl-row a:not(.rl-link), .rl-row button, .rl-row form, .rl-row details, .rl-row label, .rl-row .itip { position: relative; z-index: 1; }
/* An open More menu sits above the rows after it and above sticky lines. */
.rl-row details.more[open] { z-index: 40; }
.rl-row .more-menu { z-index: 30; }
.rl-group {
  padding-top: 9px; padding-bottom: 9px; border-bottom: 1px solid var(--line-soft); background: var(--panel-2);
  font-size: var(--fs-2xs); font-weight: 600; letter-spacing: var(--tr-caps); text-transform: uppercase; color: var(--ink-4);
}

/* What goes in a cell. */
.rl-name { display: grid; gap: 4px; min-width: 0; }
.rl-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-m); font-weight: 600; color: var(--ink); }
.rl-row:hover .rl-name b { color: var(--brand-text); }
.rl-name small { font-size: var(--fs-xs); line-height: 1.4; color: var(--ink-4); }
.rl-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.rl-num { font-variant-numeric: tabular-nums; font-size: var(--fs-s); color: var(--ink-2); }
.rl-num b { display: block; font-size: var(--fs-m); font-weight: 600; color: var(--ink); }
.rl-pair { display: flex; align-items: center; gap: 6px; min-width: 0; }
.rl-pair .brandmark { width: 92px; height: 28px; padding: 0 7px; }
.rl-pair .dir-arrow svg { width: 15px; height: 15px; }
.rl-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

.rl-do { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.rl-do .more > summary { width: 32px; height: 32px; }
.rl-do .btn { min-width: var(--rl-btn, auto); }
.rl-add { display: flex; align-items: center; gap: 10px; min-height: 52px; color: var(--brand-text); font-size: var(--fs-s); font-weight: 600; }
.rl-add .ic-add { display: grid; place-items: center; width: 34px; height: 34px; border: 1px dashed var(--brand-line); border-radius: var(--r-m); }
.rl-add svg { width: 16px; height: 16px; }

/* A record type in front of its name: its own colour, one look everywhere. */
.rt-ic { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: var(--r-m); background: color-mix(in srgb, var(--rtc) 13%, transparent); color: var(--rtc); }
.rt-ic svg { width: 16px; height: 16px; }
.rt-ic.sm { width: 26px; height: 26px; border-radius: 8px; }
.rt-ic.sm svg { width: 14px; height: 14px; }
.rt-ic.brand { --rtc: var(--brand-text); }
.rt-ic.plain { --rtc: var(--ink-3); }
.dot.mute { background: var(--line-strong); }
.rl-type { display: flex; align-items: center; gap: 12px; min-width: 0; }

/* ---------- The foot: the count and the pages, always, also when everything fits on one page ---------- */
.rl-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding-top: 10px; padding-bottom: 10px; font-size: var(--fs-xs); color: var(--ink-4); }
.rl-foot .pages { display: flex; gap: 6px; }

/* A list you pick rows in: a checkbox in front, and the picked row tinted. */
label.rl-row.pickrow { cursor: pointer; }
.pickrow input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); }
.pickrow:has(input:checked) { background: color-mix(in srgb, var(--brand-text) 6%, var(--panel)); }
label.rl-row.pickrow.is-off { cursor: not-allowed; opacity: .55; }

/* ---------- Data tables inside a zone keep to the content column ---------- */
.edge-pad table.data thead th { background: var(--panel-2); }
.edge-pad table.data :is(th, td):first-child { padding-left: 0; }
.edge-pad table.data :is(th, td):last-child { padding-right: 0; }
.edge-pad table.data tbody tr[data-tone] td:first-child { padding-left: 10px; }
/* A table that groups rows under a record: the record is a row of its own, so every column lines up. */
table.data tr.rec-group td { padding-top: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); background: var(--panel-2); }
.rec-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rec-h b { font-size: var(--fs-s); color: var(--ink); }
.rec-type { font-size: var(--fs-xs); color: var(--ink-4); }

/* ---------- Access: one row sets every record type at once ---------- */
.rl-access { --rl-cols: minmax(0, 1fr) auto; }
/* A choice wears the colour of its record type; Nothing stays neutral. */
.rl-row.access-all { background: var(--panel-2); }
.rl-row .seg { flex-wrap: nowrap; }
.access-all .seg label:has(input:checked) { background: color-mix(in srgb, var(--brand-text) 16%, var(--panel)); color: var(--brand-text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand-text) 38%, transparent); }
.seg.rtc label:has(input:checked) { background: color-mix(in srgb, var(--rtc) 16%, var(--panel)); color: var(--rtc); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rtc) 38%, transparent); }
.seg.rtc label:has(input[value="Off"]:checked), .access-all .seg label:has(input[value="Off"]:checked) { background: var(--panel); color: var(--ink-2); box-shadow: var(--sh-xs); }

@container page (max-width: 1180px) {
  .rl-head, .rl-row { grid-template-columns: var(--rl-cols-md, var(--rl-cols)); }
  .hide-md { display: none !important; }
}

@container page (max-width: 820px) {
  .toolbar .find-field, .toolbar .find-field.grow { flex: 1 1 220px; max-width: none; }
}

/* Access rows on a phone: the choice goes under the record type, so its name stays readable. */
@container page (max-width: 520px) {
  .rl-access .rl-head { display: none; }
  .rl-access .rl-row { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .rl-access .rl-row .seg { justify-self: start; }
}

/* On a phone a list stacks: the first column and the actions on one line, the other facts under it. */
@container page (max-width: 640px) {
  .rl-row .seg { flex-wrap: wrap; }
  .rl-stack .rl-head { display: none; }
  .rl-stack .rl-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; }
  .rl-stack .rl-row > * { grid-column: 1 / -1; }
  .rl-stack .rl-row > :first-child:not(.rl-link), .rl-stack .rl-row > .rl-link + * { grid-column: 1; grid-row: 1; }
  .rl-stack .rl-row > .rl-do { grid-column: 2; grid-row: 1; }
  .hide-sm { display: none !important; }
  .toolbar .find-field, .toolbar .find-field.grow { flex: 1 1 100%; }
}
