/* ── Assets list (revamp version D; DESIGN.md §0, §4, §5) ───────────────────
   static/lib/assets/{list,strip,chips,cells,list-states}.js. The table is
   the one primary element: the shared strip of status counts above it
   (kpi.css), then one
   panel holding the saved-view tabs (density + Columns at their end), the
   search and filter chips, the bulk bar and the table. Compact 40px rows by
   default, Comfortable 56px with a second line: the one app-wide density,
   html[data-table-density] (lib/table.js). Colours only via tokens. */

.ast-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* The status strip is the shared strip (kpi.css, lib/kpi.js); the page's
   column gap already spaces it from the panel. */
.ast-strip-slot > .strip { margin-bottom: 0; }

/* ── The panel: views row, toolbar, bulk bar, table, footer ────────────── */
.ast-list-panel {
    min-width: 0;
    background: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: inset 0 0 0 1px var(--border), var(--shadow-1);
}

/* Saved views as underline tabs (A9); density + Columns at the end. */
.ast-views { display: flex; align-items: center; gap: var(--sp-2); padding: 0 12px; border-bottom: 1px solid var(--border-sub); min-width: 0; }
.ast-view-tabs { display: flex; align-items: flex-end; gap: 2px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.ast-view-tabs::-webkit-scrollbar { display: none; }
.ast-view-tabs .tab { height: 42px; }
.ast-view-tabs .tab::after { bottom: 0; }
.ast-view-save { color: var(--text-3); gap: 4px; }
.ast-view-end { display: flex; align-items: center; gap: 6px; flex: none; padding: 6px 0; }

/* Search + filter chips (A2). */
.ast-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 14px; }
.ast-search-wrap {
    position: relative;
    display: flex; align-items: center; gap: 8px;
    flex: 1 1 200px; max-width: 300px;
    height: var(--control-h);
    padding: 0 3px 0 10px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    box-shadow: inset 0 0 0 1px var(--border-strong);
    color: var(--text-3);
}
.ast-search-wrap:focus-within { box-shadow: inset 0 0 0 1px var(--focus), 0 0 0 3px var(--accent-dim); }
/* The text field is borderless inside the pill: the pill is the one
   control. .ast-toolbar is in the selector so it outranks assets.css's
   `.ast-root input:not([type=checkbox]):not([type=radio])` (0,3,1), which
   otherwise drew a second box inside the pill. */
.ast-root .ast-toolbar .ast-search-wrap .ast-search,
.ast-root .ast-toolbar .ast-search-wrap .ast-search:focus,
.ast-root .ast-toolbar .ast-search-wrap .ast-search:focus-visible {
    flex: 1; min-width: 0; height: 100%;
    padding: 0; border: 0; background: transparent; box-shadow: none; outline: none;
    font-size: var(--fs-13);
}
.ast-search-wrap .ast-search-help { width: 26px; height: 26px; font-size: var(--fs-12); color: var(--text-3); }

.ast-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.ast-chip {
    display: inline-flex; align-items: center;
    border-radius: var(--radius-pill);
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--border-strong);
    color: var(--text-2);
    font-size: var(--fs-13);
}
.ast-chip-btn {
    display: inline-flex; align-items: center; gap: 6px;
    height: 30px; padding: 0 10px;
    border-radius: var(--radius-pill);
    white-space: nowrap;
    cursor: pointer;
    list-style: none;
}
.ast-chip-btn::-webkit-details-marker { display: none; }
.ast-chip-btn b { font-weight: 600; color: var(--text); }
.ast-chip-btn svg.i { color: var(--text-3); }
.ast-chip-btn:hover { background: var(--hover); }
.ast-chip.is-set { background: var(--accent-dim); box-shadow: inset 0 0 0 1px var(--accent-border); color: var(--accent-text); }
.ast-chip.is-set b, .ast-chip.is-set .ast-chip-btn svg.i { color: var(--accent-text); }
.ast-chip.is-set .ast-chip-btn { padding-right: 4px; }
.ast-chip.is-set .ast-chip-btn:hover { background: transparent; }
.ast-chip-x {
    display: inline-grid; place-items: center;
    width: 22px; height: 22px; margin-right: 4px; padding: 0;
    border: 0; border-radius: 50%;
    background: transparent; color: inherit; cursor: pointer;
}
.ast-chip-x:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.ast-chip-add > .ast-chip-btn { box-shadow: inset 0 0 0 1px var(--border-strong); color: var(--text-3); border: 1px dashed transparent; }
.ast-chip-menu .ast-menu-list { min-width: 200px; max-height: min(360px, 60vh); overflow-y: auto; }
.ast-menu-list [role="menuitemradio"][aria-checked="true"] { color: var(--accent-text); background: var(--accent-dim); font-weight: 600; }
.ast-clear-all { margin-left: 2px; }

/* The pasted-list chip. */
.ast-chip-row { display: flex; padding: 0 14px 10px; }
.ast-paste-chip {
    display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px;
    padding: 3px 4px 3px 12px;
    border-radius: var(--radius-pill);
    background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border);
    font-size: var(--fs-12); color: var(--text-2);
}

/* Bulk bar with a count, under the toolbar (version D keeps it inline). */
.ast-bulk {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    padding: 6px 14px;
    border-top: 1px solid var(--border-sub);
    background: color-mix(in srgb, var(--info) 8%, var(--surface));
    font-size: var(--fs-13);
}
.ast-bulk[hidden] { display: none; }
.ast-bulk b { margin-right: 6px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ast-bulk-end { margin-left: auto; }
.ast-bulk-host:empty { display: none; }
.ast-bulk-host { padding: 8px 14px; border-top: 1px solid var(--border-sub); }
.ast-notice-slot .notice { margin: 0 14px 10px; }
.ast-notice-slot:empty { display: none; }
/* Bulk & import results: read-only CSV cells the import did not apply. */
.ast-result .notice { margin: var(--sp-2) 0 0; }
.ast-ignored { margin: var(--sp-1) 0 0; padding-left: var(--sp-4); }

/* ── The table (DESIGN.md §4) ──────────────────────────────────────────── */
.ast-list .ast-table-wrap {
    position: relative;   /* the containing block of the cells' sr-only text, so it scrolls and clips too */
    overflow: auto;
    max-height: max(320px, calc(100vh - 330px));
    border-top: 1px solid var(--border-sub);
}
.ast-list-table { width: 100%; min-width: 760px; border-collapse: separate; border-spacing: 0; font-size: var(--fs-13); }
.ast-list-table thead { position: static; background: none; border: 0; }
.ast-list-table th, .ast-list-table td { padding: 0 10px; text-align: left; vertical-align: middle; }
.ast-list-table thead th {
    position: sticky; top: 0; z-index: 3;
    height: 34px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    font-family: var(--sans); font-size: var(--fs-12); font-weight: 500; letter-spacing: 0; text-transform: none;
    color: var(--text-3);
    white-space: nowrap;
    cursor: default;
}
.ast-list-table thead th:hover { color: var(--text-3); }
.ast-list-table thead th[aria-sort="ascending"], .ast-list-table thead th[aria-sort="descending"] { color: var(--text); }
.ast-list-table tbody tr { --row-bg: var(--surface); background: var(--row-bg); border: 0; cursor: pointer; }
.ast-list-table tbody tr:nth-child(even) { --row-bg: var(--surface); }
.ast-list-table tbody tr:hover { --row-bg: var(--hover); }
.ast-list-table tbody tr.is-checked { --row-bg: color-mix(in srgb, var(--info) 9%, var(--surface)); }
.ast-list-table tbody tr.is-open { --row-bg: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.ast-list-table tbody tr.is-open > :first-child { box-shadow: inset 3px 0 0 var(--accent); }
.ast-list-table tbody tr:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.ast-list-table tbody td, .ast-list-table tbody th {
    height: var(--row-h);
    max-width: none;
    background: var(--row-bg);
    border-bottom: 1px solid var(--border-sub);
    color: var(--text);
    font-size: var(--fs-13);
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ast-list-table tbody tr:last-child > * { border-bottom: 0; }
html[data-table-density="comfortable"] .ast-list-table tbody td,
html[data-table-density="comfortable"] .ast-list-table tbody th { height: var(--row-h-comfortable); }

/* Sticky identity: the checkbox and the Asset ID stay put sideways. */
.ast-list-table .ast-col-check { position: sticky; left: 0; z-index: 2; width: 1%; min-width: 44px; max-width: 44px; padding: 0; text-overflow: clip; }
.ast-list-table .ast-col-id { position: sticky; left: 44px; z-index: 2; width: 1%; box-shadow: inset -1px 0 0 var(--border-sub); }
/* The whole checkbox cell ticks the row (staging QA 2026-10-07: "clicking
   the nearby area also selects", no misclicks down a run of rows). */
.ast-check-hit { display: flex; align-items: center; justify-content: center; width: 44px; height: var(--row-h); cursor: pointer; }
html[data-table-density="comfortable"] .ast-check-hit { height: var(--row-h-comfortable); }
.ast-list-table thead .ast-check-hit { height: auto; min-height: 34px; }
/* Serial: always shown, fits its content, with the copy-link button. */
.ast-list-table .ast-col-serial { width: 1%; }
.ast-serial { display: inline-flex; align-items: center; gap: 4px; }
.ast-serial .mono { font-size: var(--fs-13); color: var(--text-2); }
.ast-serial .ast-serial-copy { width: 24px; height: 24px; opacity: 0.6; }
.ast-list-table tr:hover .ast-serial-copy, .ast-serial .ast-serial-copy:focus-visible { opacity: 1; }
.ast-list-table thead .ast-col-check, .ast-list-table thead .ast-col-id { z-index: 4; }
.ast-list-table tbody .ast-col-id { font-family: var(--mono); font-weight: var(--mono-font-weight); font-size: var(--fs-13); color: var(--text-2); cursor: pointer; user-select: text; }

/* Widths: the device takes the free width and truncates, the holder too;
   short values fit their content. Numbers right-aligned. */
.ast-list-table .ast-col-dev { max-width: 0; width: 45%; min-width: 200px; }
.ast-list-table .ast-col-holder { max-width: 0; width: 22%; min-width: 150px; }
.ast-list-table .ast-col-text { max-width: 0; width: 14%; min-width: 130px; }
.ast-list-table .ast-col-status, .ast-list-table .ast-col-seen, .ast-list-table .ast-col-fit { width: 1%; }
.ast-list-table .ast-num { text-align: right; font-variant-numeric: tabular-nums; }
.ast-list-table td.ast-col-status .ast-pill + .ast-pill { margin-left: 4px; }

/* Sortable headers are buttons (aria-sort on the th). */
.ast-sort { display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; white-space: nowrap; }
.ast-sort:hover { color: var(--text); }
.ast-sort-ind { display: inline-flex; opacity: 0; transition: opacity var(--dur-med) var(--ease-out); }
.ast-sort-ind.is-on, .ast-sort:hover .ast-sort-ind, .ast-sort:focus-visible .ast-sort-ind { opacity: 1; }
.ast-sort-ind.is-on { color: var(--accent-text); }
.ast-warn-mark { display: inline-flex; vertical-align: -2px; margin-left: 4px; color: var(--warn); }

/* Cells. */
.ast-none { color: var(--text-3); }
.ast-trunc { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.ast-dev { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ast-dev-ico { display: grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: var(--radius-sm); color: var(--text-3); }
.ast-dev-main { display: flex; flex-direction: column; min-width: 0; }
.ast-dev-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; color: var(--text); }
.ast-dev-sub { display: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-12); color: var(--text-3); }
html[data-table-density="comfortable"] .ast-list-table .ast-dev-sub { display: block; }
html[data-table-density="comfortable"] .ast-list-table .ast-dev-ico { width: 32px; height: 32px; background: var(--sunken); }
.ast-holder { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ast-avatar { width: 22px; height: 22px; font-size: var(--fs-10); }
.ast-holder-name { font-weight: 500; }
.ast-seen { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; color: var(--text-2); }
.ast-seen i { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.ast-seen.is-old i { border-radius: 1px; background: var(--warn); transform: rotate(45deg); }
.ast-seen.is-none i { background: transparent; box-shadow: inset 0 0 0 1.5px var(--text-3); }
.ast-seen.is-na { color: var(--text-3); font-style: italic; }
.ast-src-tag {
    display: inline-flex; align-items: center;
    height: 18px; padding: 0 5px; margin-left: 6px;
    border-radius: var(--radius-xs);
    background: var(--sunken);
    font-size: var(--fs-11); font-weight: 600; font-style: normal;
    color: var(--text-3);
    vertical-align: middle;
}

/* Quick actions (A5): shown on hover and keyboard focus, in their own
   column. They used to float over the row's end and covered the holder's
   email when Holder was the last column (owner decision 2026-10-15): the
   column now keeps their width, so they never sit on another cell. Icons
   only (QA 2026-10-17): that width is three 28px buttons (about 108px),
   not the 233px the worded buttons took. */
/* 1%, not 0: a zero-width column took the spare width on very wide screens
   and pushed it into the checkbox column (staging QA 2026-10-07). */
.ast-list-table .ast-col-actions { width: 1%; padding: 0 8px; white-space: nowrap; }
.ast-qa {
    display: flex; align-items: center; justify-content: flex-end; gap: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur-med) var(--ease-out);
}
.ast-qa:empty { display: none; }
/* Hover, or keyboard focus (focus-visible): plain focus-within kept them up
   on a row focused by a mouse click or by closing the drawer, so two rows
   showed actions at once (staging QA 2026-10-07). */
.ast-list-table tr:hover .ast-qa, .ast-list-table tr:focus-visible .ast-qa,
.ast-list-table tr:has(:focus-visible) .ast-qa { opacity: 1; pointer-events: auto; }
.ast-qa .icon-btn, .ast-copy { width: 28px; height: 28px; }
.icon-btn.is-copied, .ast-id-copy.is-copied { color: var(--success); }
/* Touch: no hover, so the actions are always shown. */
@media (hover: none) {
    .ast-qa { opacity: 1; pointer-events: auto; }
}

/* Footer: what is shown, what is not (DESIGN.md §6), prev / next. */
.ast-foot {
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
    padding: 8px 14px;
    border-top: 1px solid var(--border-sub);
    font-size: var(--fs-13); color: var(--text-3);
    font-variant-numeric: tabular-nums;
}
.ast-foot .ast-link { font-weight: 500; color: var(--accent-text); }
.ast-pager { display: flex; gap: 6px; margin-left: auto; }
.btn.ast-icon-only { width: 32px; padding: 0; }
.btn-sm.ast-icon-only { width: 28px; }

/* States inside the panel (shared markup, lib/states.js). */
.ast-list > .empty-state, .ast-list > .error-state { border-top: 1px solid var(--border-sub); }
.ast-list[aria-busy="true"] > .ph { border-top: 1px solid var(--border-sub); }

/* Page header actions (rendered into the shell's #pageMeta). */
.ast-head-actions { display: flex; align-items: center; gap: var(--sp-2); }
.ast-head-actions .ast-menu-list { min-width: 240px; }

@media (max-width: 900px) {
    .ast-views { flex-wrap: wrap; padding: 0 8px; }
    .ast-view-end { flex: 1 1 auto; flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
    .ast-search-wrap { max-width: none; flex-basis: 100%; }
    .ast-list .ast-table-wrap { max-height: none; }
}

/* Columns menu (staging QA 2026-10-07): one list, an on/off switch per
   column (not a checkbox that made the row jump), arrows on shown ones. */
.ast-col-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px; }
.ast-col-row.is-off .ast-switch-label { color: var(--text-2); }
.ast-switch-label { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
/* input.ast-switch[type="checkbox"]: forms.css styles every checkbox
   (input[type="checkbox"], with its checkmark ::after); this outranks it. */
input.ast-switch[type="checkbox"] {
    width: 28px; height: 16px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-pill);
    background: var(--sunken);
    transition: background var(--dur-med) var(--ease-out), border-color var(--dur-med) var(--ease-out);
}
input.ast-switch[type="checkbox"]::after,
input.ast-switch[type="checkbox"]:checked::after {
    content: ""; position: absolute; top: 1px; left: 1px;
    width: 12px; height: 12px; border: 0; border-radius: 50%;
    background: var(--text-3);
    transform: none;
    transition: transform var(--dur-med) var(--ease-out), background var(--dur-med) var(--ease-out);
}
input.ast-switch[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
input.ast-switch[type="checkbox"]:checked::after { transform: translateX(12px); background: var(--on-accent); }
input.ast-switch[type="checkbox"]:disabled { opacity: 0.5; cursor: not-allowed; }
input.ast-switch[type="checkbox"]:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { input.ast-switch[type="checkbox"], input.ast-switch[type="checkbox"]::after { transition: none; } }

/* Configure screen rows (statuses, companies, teams): one editable line
   each; a retired (inactive) row reads quieter. */
.ast-config-row { flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--border-sub); }
.ast-config-row:last-of-type { border-bottom: 0; }
.ast-config-row.is-inactive > input:not([type="checkbox"]), .ast-config-row.is-inactive > select { color: var(--text-3); }
.ast-config-key { min-width: 150px; font-size: var(--fs-12); color: var(--text-3); }

/* Comfortable second lines (user, 2026-10-07): a cell stacks its value and
   a muted line (.ast-dev-sub, shown only in Comfortable). */
.ast-cell-stack { display: inline-flex; flex-direction: column; justify-content: center; min-width: 0; max-width: 100%; vertical-align: middle; }
.ast-cell-stack > span:first-child { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
/* A truncating value (the holder's email) stays a block: an ellipsis never
   applies to text inside a flex container (DESIGN.md §3, QA 2026-10-17). */
.ast-cell-stack > span.ast-trunc { display: block; }
