/* Asset database screens (static/lib/assets/). Colours come only from the
   app.css tokens, so both themes work unchanged. */

.ast-root { display: flex; flex-direction: column; gap: var(--sp-4); }
/* Buttons: the shared .btn in app.css; .ast-primary is the assets alias of .btn-primary. */
.ast-root .btn.ast-primary { background: var(--accent); color: var(--btn-accent-text); border-color: var(--accent); }
/* The device drawer (#deviceDrawerHost) sits outside .ast-root, so its
   forms (New asset, Edit, Change status, Check out, Swap) are named too;
   :where() keeps them at the same specificity as the .ast-root rule. */
.ast-root input:not([type=checkbox]):not([type=radio]), .ast-root select, .ast-root textarea,
:where(.ast-drawer) .ast-field input:not([type=checkbox]):not([type=radio]), :where(.ast-drawer) .ast-field select, :where(.ast-drawer) .ast-field textarea {
    font: inherit; font-size: var(--fs-13); color: var(--text);
    background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); padding: 6px 8px; min-width: 0;
}
.ast-root input:focus, .ast-root select:focus, .ast-root textarea:focus,
:where(.ast-drawer) .ast-field input:focus, :where(.ast-drawer) .ast-field select:focus, :where(.ast-drawer) .ast-field textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim);
}

/* Filters carry their own label: "Type  All ▾". A set filter is highlighted. */
.ast-filters { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.ast-filter {
    display: inline-flex; align-items: center; gap: 6px; padding-left: 10px;
    font-size: var(--fs-12); color: var(--text-3);
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
.ast-filter > span { font-weight: 600; }
.ast-root .ast-filter select { border: 0; background: transparent; padding: 5px 8px 5px 0; color: var(--text); }
.ast-root .ast-filter select:focus { box-shadow: none; }
.ast-filter:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.ast-filter.is-set { border-color: var(--accent-border); background: var(--accent-dim); }
.ast-filter.is-set > span { color: var(--accent); }

/* "More" menu: a native <details>, so it works by keyboard without JS. */
.ast-menu { position: relative; }
.ast-menu > summary { list-style: none; }
.ast-menu > summary::-webkit-details-marker { display: none; }
.ast-menu-list {
    position: absolute; right: 0; top: calc(100% + 4px); z-index: var(--z-menu); min-width: 220px;
    display: flex; flex-direction: column; padding: var(--sp-1);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-2);
}
.ast-menu-list button {
    font: inherit; font-size: var(--fs-13); text-align: left; color: var(--text);
    background: none; border: 0; border-radius: var(--radius-sm); padding: 7px 10px; cursor: pointer;
}
.ast-menu-list button:hover, .ast-menu-list button:focus-visible { background: var(--surface-2); }
.ast-menu-sec { margin: var(--sp-2) 10px 2px; font-size: var(--fs-12); font-weight: 600; color: var(--text-3); }
.ast-menu-start { left: 0; right: auto; }


.ast-count { font-size: var(--fs-14); font-weight: 600; color: var(--text); }
.ast-table { width: 100%; border-collapse: collapse; font-size: var(--fs-13); }
.ast-table-wrap { overflow: auto; }
.ast-table th { text-align: left; color: var(--text-3); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--border); }
.ast-table td { padding: 8px; border-bottom: 1px solid var(--border-sub); }
.ast-table tbody tr[data-asset] { cursor: pointer; }
.ast-table tbody tr[data-asset]:hover, .ast-table tbody tr[data-asset]:focus { background: var(--surface-2); }
.ast-table.ast-compact td, .ast-table.ast-compact th { padding: 4px 8px; }
.ast-archived { opacity: 0.6; }
.ast-mono { font-family: var(--mono); }
.ast-pager { display: flex; gap: var(--sp-2); align-items: center; justify-content: flex-end; padding-top: var(--sp-2); color: var(--text-2); font-size: var(--fs-12); }
.ast-foot .ast-pager { padding-top: 0; }
.ast-empty, .ast-muted { color: var(--text-3); font-size: var(--fs-13); }

/* Status pills (version D, X4): text plus a shape per state, never colour
   alone. dot = fine, ring = ready or neutral, diamond = needs action,
   square = moving, dash = broken. Pairs are the tested --x / --x-dim. */
.ast-pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: var(--radius-pill); font-size: var(--fs-12); font-weight: 500; letter-spacing: 0; line-height: 1; white-space: nowrap; }
.ast-pill::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ast-tone-success, .ast-tone-quiet { color: var(--success); background: var(--success-dim); }
/* Stock ("Ready to Deploy"): what people scan for when picking a device. */
.ast-tone-stock { color: var(--accent-text); background: var(--accent-dim); }
.ast-tone-stock::before, .ast-tone-ghost::before { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
.ast-tone-accent { color: var(--accent-text); background: var(--accent-dim); }
.ast-tone-warn { color: var(--warn); background: var(--warn-dim); }
.ast-tone-warn::before { border-radius: 1px; transform: rotate(45deg); }
.ast-tone-info { color: var(--info); background: var(--info-dim); }
.ast-tone-info::before { border-radius: 1px; }
.ast-tone-ghost { color: var(--ghost); background: var(--ghost-dim); }
.ast-tone-error { color: var(--error); background: var(--error-dim); }
.ast-tone-error::before { width: 8px; height: 2px; border-radius: 1px; }
/* Not ours (BYOD or leased, S3): active but nothing to do. No fill, an
   outline and secondary text, so it reads apart from In transit (blue) and
   from finished devices (filled grey). --text-2 is tested at 4.5:1 and
   --border-strong at 3:1 on every surface, so it holds on any row colour. */
.ast-tone-neutral { color: var(--text-2); background: transparent; box-shadow: inset 0 0 0 1px var(--border-strong); }
.ast-tone-neutral::before { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }

.ast-detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.ast-detail-head h2 { margin: 0; font-size: var(--fs-20); }
.ast-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--sp-3); margin-top: var(--sp-3); }
.ast-wide { grid-column: 1 / -1; }
.ast-form { display: flex; flex-direction: column; gap: var(--sp-3); }
.ast-form h3 { margin: 0; }
.ast-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--sp-3); }
.ast-field { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-12); color: var(--text-2); }
.ast-field small { color: var(--text-3); }
.ast-multi { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.ast-form-actions { display: flex; gap: var(--sp-2); justify-content: flex-end; }
.ast-errors { color: var(--error); background: var(--error-dim); border-radius: var(--radius-sm); padding: var(--sp-2) var(--sp-3); margin: 0; font-size: var(--fs-13); }
.ast-errors li { margin-left: var(--sp-3); }

.ast-dialog { border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-md); padding: var(--sp-4); box-shadow: var(--shadow-2); max-width: 560px; }

.ast-configure { display: flex; flex-direction: column; gap: var(--sp-3); }
.ast-configure h3 small { color: var(--text-3); font-weight: 400; margin-left: var(--sp-2); }
.ast-section { margin: var(--sp-2) 0 0; }
.ast-inline-form { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; margin-top: var(--sp-2); font-size: var(--fs-12); }
.ast-inline-form .ast-needed { border-color: var(--warn); }

.ast-link { font: inherit; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.ast-link:hover { text-decoration: underline; }
.ast-held { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); font-size: var(--fs-13); }

.ast-card-head { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.ast-conflict p { margin: var(--sp-2) 0; font-size: var(--fs-13); }
.ast-conflict-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.ast-import-summary { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; font-size: var(--fs-13); }

.ast-result:empty { display: none; }

.ast-checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); font-size: var(--fs-13); }
.ast-checklist li { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.ast-checklist .ast-done { color: var(--success); }

.ast-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--sp-3); }
.ast-board-col h3 { display: flex; gap: var(--sp-2); align-items: center; }

.ast-low td { color: var(--warn); font-weight: 600; }
/* Settings → Armory (static/lib/settings.js) */
.set-root { display: flex; flex-direction: column; gap: var(--sp-3); }
.set-row { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(200px, 1fr) auto; gap: var(--sp-3); align-items: center; padding: var(--sp-2) 0; border-bottom: 1px solid var(--border-sub); }
.set-help { color: var(--text-3); font-size: var(--fs-12); }
/* Text fields and selects only: a checkbox (the webhook events, the muted
   alert types, a yes/no setting) keeps the shared 16px square of forms.css
   instead of being stretched to full width with the field's padding. */
.set-editor input:not([type=checkbox]):not([type=radio]), .set-editor select, .set-editor textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 6px 8px; width: 100%; }
.set-choices { display: flex; flex-wrap: wrap; gap: var(--sp-2); font-size: var(--fs-12); }
.set-error { grid-column: 1 / -1; color: var(--error); font-size: var(--fs-12); }
.set-error:empty { display: none; }
@media (max-width: 720px) { .set-row { grid-template-columns: 1fr; } }

.set-list { list-style: none; margin: var(--sp-2) 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-12); }
.set-catalogue { border: 0; margin: var(--sp-2) 0 0; padding: 0; min-width: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 4px var(--sp-3); }
.set-event { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; min-width: 0; font-size: var(--fs-12); overflow-wrap: anywhere; }


/* Busy button (static/lib/busy.js): small spinner on the app's own spin keyframes. */
.btn-spinner { display: inline-block; width: 12px; height: 12px; vertical-align: -2px;
    border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%;
    animation: spin 0.75s linear infinite; }

/* Menus: rows with a checkbox / label and side buttons; notes and rules. */
.ast-menu-list a { font-size: var(--fs-13); color: var(--text); text-decoration: none; padding: 7px 10px; border-radius: var(--radius-sm); }
.ast-menu-list a:hover, .ast-menu-list a:focus-visible { background: var(--surface-2); }
.ast-menu-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: 0 4px 0 10px; }
.ast-menu-row > button[role="menuitem"] { flex: 1; }
.ast-menu-row label { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-13); padding: 5px 0; cursor: pointer; }
.ast-col-move { display: inline-flex; }
.ast-menu-note { margin: 4px 10px 6px; font-size: var(--fs-12); color: var(--text-3); }
.ast-menu-hr { border: 0; border-top: 1px solid var(--border-sub); margin: 4px 0; }
.ast-cols .ast-menu-list { min-width: 260px; max-height: 70vh; overflow-y: auto; }

/* The bulk panel under the bulk bar. */
.ast-bulk-panel { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3);
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-md); }
.ast-bulk-panel .ast-result, .ast-bulk-panel .ast-form-errors { flex-basis: 100%; }

.ast-board-col h3 .ast-link { font-weight: 600; color: inherit; }

/* Device picker (drawer) */
.ast-picks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.ast-pick { display: flex; gap: var(--sp-3); align-items: center; justify-content: space-between; padding: var(--sp-2) var(--sp-3);
    border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.ast-pick:first-child { border-color: var(--accent-border); }
.ast-pick-main { min-width: 0; font-size: var(--fs-13); }
.ast-pick-main .ast-muted { font-size: var(--fs-12); margin-top: 2px; }
.ast-pick-acts { display: flex; gap: 6px; flex: none; }
/* Reports (lib/assets/reports.js) */
.ast-seg { display: flex; flex-wrap: wrap; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); align-self: flex-start; max-width: 100%; }
.ast-seg-btn {
    font: inherit; font-size: var(--fs-13); color: var(--text-2); background: transparent; cursor: pointer;
    border: 1px solid transparent; border-radius: var(--radius-sm); padding: 5px 12px;
}
.ast-seg-btn:hover { color: var(--text); background: var(--surface); }
.ast-seg-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ast-seg-btn[aria-pressed="true"] { color: var(--accent); background: var(--accent-dim); border-color: var(--accent-border); font-weight: 600; }
.ast-rep-body { display: flex; flex-direction: column; gap: var(--sp-3); }
.ast-rep-form { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: flex-end; }
.ast-rep-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; justify-content: space-between; }
.ast-rep-form .ast-rep-actions { justify-content: flex-start; }
.ast-rep-actions p { margin: 0; }
.ast-rep-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--sp-3); }
.ast-rep-total td { font-weight: 600; border-top: 1px solid var(--border); }
.ast-table .ast-num { text-align: right; font-variant-numeric: tabular-nums; }
.ast-rep-dl { margin-left: auto; font-size: var(--fs-12); font-weight: 400; color: var(--accent); }
.panel-card h3:has(.ast-rep-dl) { display: flex; align-items: baseline; gap: var(--sp-2); }
/* Data quality (static/lib/assets/quality.js) */
.ast-dq-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--sp-3); }
.ast-dq-card {
    font: inherit; color: var(--text); text-align: left; cursor: pointer;
    display: flex; flex-direction: column; gap: var(--sp-2);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--sp-3);
}
.ast-dq-card:hover, .ast-dq-card:focus-visible { border-color: var(--accent-border); outline: none; box-shadow: 0 0 0 3px var(--accent-dim); }
.ast-dq-count { font-size: var(--fs-20); font-weight: 600; }
.ast-dq-bad { color: var(--warn); }
.ast-dq-ok { color: var(--success); }
.ast-dq-label { font-size: var(--fs-13); color: var(--text-2); }
.ast-dq-reasons { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-12); color: var(--text-3); }
.ast-dq-scope { border: 1px solid var(--border-sub); border-radius: var(--radius-sm); padding: var(--sp-2) var(--sp-3); display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-13); }
.ast-dq-scope legend { color: var(--text-3); font-size: var(--fs-12); }
.ast-dq-scope input { width: auto; }
.ast-dq-actions { white-space: nowrap; }
.ast-dq-actions .btn { padding: 4px 8px; font-size: var(--fs-12); }
