/* =====================================================================
   THE ANSWER CENTER (2026-09-30) - pulse band, command bar, cards, list,
   explorer, map, jobs, the run drawer and its lightbox. Every colour is a
   --theme-* token (mixed with color-mix), so a tenant's theme and dark mode
   carry straight through. Prefix: ansx-.
   ===================================================================== */

.ansx-app {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    padding-bottom: 2rem;
}

/* ---- Header ---------------------------------------------------------- */
.ansx-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--theme-border);
}
.ansx-head-icon { color: var(--theme-offset); }
.ansx-head-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

/* ---- Pulse band ------------------------------------------------------ */
.ansx-pulse {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 0.6rem;
    transition: opacity 200ms ease;
}
.ansx-pulse.is-loading { opacity: 0.6; }
.ansx-kpi {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-height: 96px;
    padding: 0.7rem 0.8rem 0.65rem;
    text-align: left;
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius);
    box-shadow: var(--theme-shadow);
    color: var(--theme-text);
    overflow: hidden;
}
button.ansx-kpi {
    cursor: pointer;
    font: inherit;
    transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}
button.ansx-kpi:hover {
    border-color: color-mix(in srgb, var(--theme-primary) 45%, var(--theme-border));
    transform: translateY(-1px);
    box-shadow: var(--theme-shadow-lg);
}
.ansx-kpi.is-on {
    border-color: var(--theme-primary);
    box-shadow: 0 0 0 1px var(--theme-primary), var(--theme-shadow);
}
.ansx-kpi-hero {
    grid-column: span 2;
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--theme-primary) 14%, var(--theme-surface)),
        var(--theme-surface) 70%);
}
.ansx-kpi-top {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: var(--theme-font-size-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--theme-text-secondary);
}
.ansx-kpi-icon {
    display: inline-grid;
    place-items: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    color: var(--theme-primary);
    background: color-mix(in srgb, var(--theme-primary) 12%, transparent);
}
.ansx-kpi-on { margin-left: auto; color: var(--theme-primary); font-size: 0.75rem; }
.ansx-kpi-value {
    font-size: var(--theme-font-size-2xl);
    font-weight: 750;
    line-height: 1.15;
    color: var(--theme-text-emphasis);
    font-variant-numeric: tabular-nums;
}
.ansx-kpi-hero .ansx-kpi-value { font-size: var(--theme-font-size-3xl); }
.ansx-kpi-sub {
    font-size: var(--theme-font-size-xs);
    color: var(--theme-text-muted);
}
.ansx-kpi-bar {
    height: 4px;
    margin-top: auto;
    border-radius: 99px;
    background: color-mix(in srgb, var(--theme-success) 15%, var(--theme-surface-sunken));
    overflow: hidden;
}
.ansx-kpi-bar > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--theme-success);
}
.ansx-spark {
    position: absolute;
    right: 0.6rem;
    bottom: 0.55rem;
    width: 46%;
    height: 38px;
}
.ansx-spark-line { fill: none; stroke: var(--theme-primary); stroke-width: 1.8; vector-effect: non-scaling-stroke; }
.ansx-spark-area { fill: color-mix(in srgb, var(--theme-primary) 16%, transparent); stroke: none; }

/* status tints on the pulse tiles */
.ansx-kpi-status.is-done .ansx-kpi-icon { color: var(--theme-success); background: color-mix(in srgb, var(--theme-success) 13%, transparent); }
.ansx-kpi-status.is-live .ansx-kpi-icon { color: var(--theme-info); background: color-mix(in srgb, var(--theme-info) 13%, transparent); }
.ansx-kpi-status.is-new .ansx-kpi-icon { color: var(--theme-text-muted); background: var(--theme-surface-sunken); }
.ansx-kpi-status.is-quit .ansx-kpi-icon { color: var(--theme-warning); background: color-mix(in srgb, var(--theme-warning) 14%, transparent); }
.ansx-kpi-status.is-error .ansx-kpi-icon { color: var(--theme-danger); background: color-mix(in srgb, var(--theme-danger) 13%, transparent); }
.ansx-kpi-ai .ansx-kpi-icon { color: var(--theme-accent); background: color-mix(in srgb, var(--theme-accent) 14%, transparent); }

/* ---- Command bar ----------------------------------------------------- */
.ansx-filters {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.7rem 0.8rem;
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius);
}
.ansx-frow {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.ansx-frow-chips { gap: 0.35rem; }
.ansx-fsep {
    width: 1px;
    height: 1.25rem;
    margin: 0 0.2rem;
    background: var(--theme-border);
}
.ansx-fbtn {
    border: 1px solid var(--theme-border);
    background: var(--theme-background-raised);
    color: var(--theme-text);
    border-radius: var(--theme-radius-button);
    white-space: nowrap;
}
.ansx-fbtn:hover { border-color: var(--theme-primary); }
.ansx-fbtn.is-on {
    border-color: var(--theme-primary);
    color: var(--theme-primary);
    background: color-mix(in srgb, var(--theme-primary) 8%, var(--theme-background-raised));
}

.ansx-seg {
    display: inline-flex;
    flex-wrap: wrap;
    padding: 2px;
    gap: 2px;
    background: var(--theme-surface-sunken);
    border: 1px solid var(--theme-border-subtle);
    border-radius: calc(var(--theme-radius-button) + 2px);
}
.ansx-seg-btn {
    border: 0;
    background: transparent;
    color: var(--theme-text-secondary);
    padding: 0.25rem 0.6rem;
    font-size: var(--theme-font-size-sm);
    font-weight: 550;
    border-radius: var(--theme-radius-button);
    cursor: pointer;
    white-space: nowrap;
    transition: background 120ms ease, color 120ms ease;
}
.ansx-seg-btn:hover { color: var(--theme-text-emphasis); background: var(--theme-background-hover); }
.ansx-seg-btn.is-on {
    background: var(--theme-background-raised);
    color: var(--theme-primary);
    box-shadow: var(--theme-shadow);
}
.ansx-seg-sm .ansx-seg-btn { padding: 0.18rem 0.5rem; font-size: var(--theme-font-size-xs); }

.ansx-custom { display: inline-flex; align-items: center; gap: 0.3rem; }
.ansx-custom input { width: 9.5rem; }
.ansx-custom-to { color: var(--theme-text-muted); }
.ansx-basis { width: auto; min-width: 7rem; }

.ansx-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1 1 16rem;
    min-width: 12rem;
}
.ansx-search > .bi-search {
    position: absolute;
    left: 0.6rem;
    color: var(--theme-text-muted);
    pointer-events: none;
}
.ansx-search > input { padding-left: 1.9rem; }
.ansx-search-sm { flex: 0 1 14rem; }
.ansx-search-inans {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: var(--theme-font-size-xs);
    color: var(--theme-text-secondary);
    white-space: nowrap;
    cursor: pointer;
}

.ansx-chips { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; }
.ansx-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    font-size: var(--theme-font-size-sm);
    font-weight: 550;
    color: var(--theme-text-secondary);
    background: var(--theme-background-raised);
    border: 1px solid var(--theme-border);
    border-radius: 99px;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}
.ansx-chip:hover { border-color: var(--theme-primary); color: var(--theme-text-emphasis); }
.ansx-chip.is-on {
    color: var(--theme-primary);
    border-color: var(--theme-primary);
    background: color-mix(in srgb, var(--theme-primary) 9%, var(--theme-background-raised));
}
.ansx-chip-n {
    font-size: var(--theme-font-size-xs);
    font-weight: 650;
    padding: 0 0.4rem;
    border-radius: 99px;
    color: var(--theme-text-muted);
    background: var(--theme-surface-sunken);
    font-variant-numeric: tabular-nums;
}
.ansx-chip.is-on .ansx-chip-n { color: var(--theme-primary); background: color-mix(in srgb, var(--theme-primary) 12%, transparent); }
.ansx-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--ansx-st, var(--theme-text-muted));
}
.is-done { --ansx-st: var(--theme-success); }
.is-live { --ansx-st: var(--theme-info); }
.is-new { --ansx-st: var(--theme-text-muted); }
.is-quit { --ansx-st: var(--theme-warning); }
.is-error { --ansx-st: var(--theme-danger); }

.ansx-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.18rem 0.3rem 0.18rem 0.6rem;
    border-radius: 99px;
    font-size: var(--theme-font-size-sm);
    font-weight: 600;
    color: var(--theme-info);
    background: color-mix(in srgb, var(--theme-info) 12%, transparent);
}
.ansx-pill-x {
    display: inline-grid;
    place-items: center;
    width: 1.2rem;
    height: 1.2rem;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
}
.ansx-pill-x:hover { background: color-mix(in srgb, var(--theme-info) 20%, transparent); }
.ansx-clear { margin-left: auto; text-decoration: none; }

/* workflow picker */
.ansx-wfpick-list {
    width: min(26rem, 92vw);
    max-width: none;
    padding: 0.4rem;
}
.ansx-wfpick-search { position: relative; margin-bottom: 0.3rem; }
.ansx-wfpick-search > i { position: absolute; left: 0.6rem; top: 50%; transform: translateY(-50%); color: var(--theme-text-muted); }
.ansx-wfpick-search > input { padding-left: 1.8rem; }
.ansx-wfpick-scroll { max-height: 18rem; overflow-y: auto; }
.ansx-wfpick-item {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 0.25rem;
    padding: 0.4rem 0.5rem;
    border: 0;
    border-radius: 0.4rem;
    background: transparent;
    color: var(--theme-text);
    font-size: var(--theme-font-size-sm);
    text-align: left;
    cursor: pointer;
}
.ansx-wfpick-item:hover { background: var(--theme-background-hover); }
.ansx-wfpick-item.is-on { color: var(--theme-primary); }
.ansx-wfpick-item > .bi { color: var(--theme-text-muted); }
.ansx-wfpick-item.is-on > .bi { color: var(--theme-primary); }
.ansx-wfpick-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ansx-wfpick-meta { display: inline-flex; align-items: center; gap: 0.45rem; }
.ansx-wfpick-count { font-size: var(--theme-font-size-xs); color: var(--theme-text-muted); font-variant-numeric: tabular-nums; min-width: 1.5rem; text-align: right; }
.ansx-wfpick-bar {
    display: inline-block;
    width: 3rem;
    height: 4px;
    border-radius: 99px;
    background: var(--theme-surface-sunken);
    overflow: hidden;
}
.ansx-wfpick-bar > span { display: block; height: 100%; background: var(--theme-success); border-radius: inherit; }
.ansx-wfpick-empty, .ansx-wfpick-foot { padding: 0.5rem; font-size: var(--theme-font-size-xs); color: var(--theme-text-muted); }
.ansx-wfpick-foot { border-top: 1px solid var(--theme-border-subtle); margin-top: 0.3rem; }

/* ---- View bar + selection bar --------------------------------------- */
.ansx-viewbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    padding: 0.45rem 0;
    background: var(--theme-background);
    /* paint the scroll container's top padding too - nothing scrolls visibly above the bar */
    box-shadow: 0 -1.5rem 0 var(--theme-background);
}
.ansx-count { font-size: var(--theme-font-size-sm); color: var(--theme-text-secondary); font-variant-numeric: tabular-nums; }
.ansx-inline-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: var(--theme-font-size-xs);
    color: var(--theme-text-muted);
    margin: 0;
}
.ansx-bulk {
    position: sticky;
    top: 2.9rem;
    z-index: 19;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    padding: 0.5rem 0.75rem;
    border-radius: var(--theme-radius);
    color: var(--theme-text-emphasis);
    background: color-mix(in srgb, var(--theme-primary) 10%, var(--theme-surface));
    border: 1px solid color-mix(in srgb, var(--theme-primary) 35%, var(--theme-border));
    box-shadow: var(--theme-shadow-lg);
    animation: ansx-rise 160ms ease;
}
.ansx-bulk-count { font-weight: 650; font-size: var(--theme-font-size-sm); }
.ansx-note {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.75rem;
    border-radius: var(--theme-radius);
    font-size: var(--theme-font-size-sm);
    color: var(--theme-success);
    background: color-mix(in srgb, var(--theme-success) 10%, var(--theme-surface));
    border: 1px solid color-mix(in srgb, var(--theme-success) 30%, var(--theme-border));
}
.ansx-note.is-error {
    color: var(--theme-danger);
    background: color-mix(in srgb, var(--theme-danger) 9%, var(--theme-surface));
    border-color: color-mix(in srgb, var(--theme-danger) 30%, var(--theme-border));
}
@keyframes ansx-rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.ansx-body { min-height: 12rem; }
.ansx-dim { opacity: 0.55; transition: opacity 150ms ease; pointer-events: none; }

/* ---- Cards ----------------------------------------------------------- */
.ansx-grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.85rem;
}
.ansx-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: calc(var(--theme-radius) + 2px);
    box-shadow: var(--theme-shadow);
    overflow: hidden;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
    animation: ansx-rise 200ms ease;
}
.ansx-card:hover, .ansx-card:focus-visible {
    transform: translateY(-2px);
    box-shadow: var(--theme-shadow-lg);
    border-color: color-mix(in srgb, var(--theme-primary) 40%, var(--theme-border));
    outline: none;
}
.ansx-card.is-selected {
    border-color: var(--theme-primary);
    box-shadow: 0 0 0 2px var(--theme-primary), var(--theme-shadow-lg);
}
.ansx-card.is-skeleton { cursor: default; animation: none; }
.ansx-card-hero {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--theme-surface-sunken);
    overflow: hidden;
}
.ansx-card-hero > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 400ms ease;
}
.ansx-card:hover .ansx-card-hero > img { transform: scale(1.04); }
.ansx-card-hero.is-glyph {
    /* no photo: a slim branded band, not a tall empty frame (photo-less tenants stay dense) */
    aspect-ratio: auto;
    height: 3rem;
    background:
        radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--ansx-st, var(--theme-primary)) 26%, transparent), transparent 60%),
        linear-gradient(135deg, color-mix(in srgb, var(--theme-primary) 12%, var(--theme-surface-sunken)), var(--theme-surface-sunken));
}
.ansx-card-glyph {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.6rem;
    color: color-mix(in srgb, var(--theme-primary) 30%, transparent);
}
.ansx-card-more {
    position: absolute;
    right: 0.5rem;
    bottom: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.5rem;
    border: 0;
    border-radius: 99px;
    font-size: var(--theme-font-size-xs);
    font-weight: 650;
    color: var(--theme-text-on-primary);
    background: color-mix(in srgb, var(--theme-text-emphasis) 70%, transparent);
    cursor: pointer;
}
.ansx-card-check {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: inline-grid;
    place-items: center;
    width: 1.8rem;
    height: 1.8rem;
    margin: 0;
    border-radius: 0.45rem;
    color: var(--theme-text-emphasis);
    background: color-mix(in srgb, var(--theme-surface) 85%, transparent);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 120ms ease;
    cursor: pointer;
}
.ansx-card-check > input { position: absolute; opacity: 0; pointer-events: none; }
.ansx-card:hover .ansx-card-check, .ansx-card-check.is-on, .ansx-card:focus-within .ansx-card-check { opacity: 1; }
.ansx-card-check.is-on { color: var(--theme-primary); }
@media (pointer: coarse) { .ansx-card-check { opacity: 1; } }

.ansx-stamp {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.14rem 0.55rem;
    font-size: var(--theme-font-size-xs);
    font-weight: 700;
    letter-spacing: 0.02em;
    border-radius: 99px;
    color: var(--ansx-st);
    background: color-mix(in srgb, var(--ansx-st) 14%, var(--theme-surface));
    white-space: nowrap;
}
.ansx-card-hero > .ansx-stamp {
    position: absolute;
    top: 0.55rem;
    left: 0.55rem;
    background: color-mix(in srgb, var(--theme-surface) 88%, transparent);
    backdrop-filter: blur(4px);
    box-shadow: var(--theme-shadow);
}
.ansx-stamp-sm { padding: 0.08rem 0.45rem; }
.ansx-stamp-dot { width: 0.55rem; height: 0.55rem; padding: 0; background: var(--ansx-st); }

.ansx-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.75rem 0.85rem 0.6rem;
    flex: 1;
}
.ansx-who { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.ansx-who-text { min-width: 0; display: flex; flex-direction: column; gap: 0.2rem; flex: 1; }
.ansx-who-name {
    font-weight: 700;
    color: var(--theme-text-emphasis);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ansx-who-sub {
    font-size: var(--theme-font-size-xs);
    color: var(--theme-text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.ansx-avatar {
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 750;
    letter-spacing: 0.02em;
    color: var(--ansx-av);
    background: color-mix(in srgb, var(--ansx-av) 16%, var(--theme-surface));
    border: 1px solid color-mix(in srgb, var(--ansx-av) 28%, transparent);
}
.ansx-avatar-sm { width: 1.6rem; height: 1.6rem; font-size: 0.62rem; }
.ansx-avatar-lg { width: 3.2rem; height: 3.2rem; font-size: 1.05rem; }
.ansx-av-0 { --ansx-av: var(--theme-primary); }
.ansx-av-1 { --ansx-av: var(--theme-accent); }
.ansx-av-2 { --ansx-av: var(--theme-offset); }
.ansx-av-3 { --ansx-av: var(--theme-info); }
.ansx-av-4 { --ansx-av: var(--theme-success); }
.ansx-av-5 { --ansx-av: var(--theme-warning); }

.ansx-card-wf { display: flex; align-items: baseline; gap: 0.5rem; font-size: var(--theme-font-size-sm); }
.ansx-card-wfname {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    color: var(--theme-text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ansx-card-ago { font-size: var(--theme-font-size-xs); color: var(--theme-text-muted); white-space: nowrap; }
.ansx-card-ai {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
    padding: 0.45rem 0.55rem;
    font-size: var(--theme-font-size-sm);
    line-height: 1.4;
    color: var(--theme-text);
    border-radius: 0.5rem;
    background: color-mix(in srgb, var(--theme-accent) 8%, var(--theme-surface));
    border-left: 3px solid var(--theme-accent);
}
.ansx-card-ai > .bi { color: var(--theme-accent); margin-right: 0.35rem; }
.ansx-card-hl { margin: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.ansx-hl-row { display: flex; gap: 0.5rem; font-size: var(--theme-font-size-sm); min-width: 0; }
.ansx-hl-row dt {
    flex: 0 0 40%;
    max-width: 40%;
    font-weight: 500;
    color: var(--theme-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ansx-hl-row dd {
    flex: 1;
    min-width: 0;
    margin: 0;
    font-weight: 600;
    color: var(--theme-text-emphasis);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* The work this run belongs to - leads the card, quieter than the answers under it. */
.ansx-card-facts .ansx-hl-row dd { font-weight: 650; color: var(--theme-text); }
.ansx-card-facts + .ansx-card-hl,
.ansx-card-facts + .ansx-card-ai {
    padding-top: 0.35rem;
    border-top: 1px dashed var(--theme-border);
}
.ansx-card-quiet, .ansx-card-err { font-size: var(--theme-font-size-sm); color: var(--theme-text-muted); }
.ansx-card-err { color: var(--theme-warning); }
.ansx-card-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    padding: 0.5rem 0.85rem;
    border-top: 1px solid var(--theme-border-subtle);
    background: color-mix(in srgb, var(--theme-surface-sunken) 55%, var(--theme-surface));
}
.ansx-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: var(--theme-font-size-xs);
    color: var(--theme-text-secondary);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.ansx-meta > .bi { color: var(--theme-text-muted); }
.ansx-meta-job { color: var(--theme-offset); }
.ansx-meta-code { color: var(--theme-info); }

/* skeletons */
.ansx-skel {
    display: block;
    border-radius: 0.35rem;
    background: linear-gradient(90deg,
        var(--theme-surface-sunken) 0%,
        color-mix(in srgb, var(--theme-surface-sunken) 50%, var(--theme-surface)) 50%,
        var(--theme-surface-sunken) 100%);
    background-size: 200% 100%;
    animation: ansx-shimmer 1.3s ease-in-out infinite;
}
.ansx-skel-hero { position: absolute; inset: 0; border-radius: 0; }
.ansx-skel-line { height: 0.7rem; }
.w-40 { width: 40%; }
.w-60 { width: 60%; }
.w-70 { width: 70%; }
.w-80 { width: 80%; }
.w-90 { width: 90%; }
@keyframes ansx-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---- Tables (List / Explorer / Jobs) --------------------------------- */
.ansx-table-wrap { display: flex; flex-direction: column; gap: 0.5rem; }
.ansx-table-tools { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.ansx-table-scroll {
    overflow: auto;
    max-height: calc(100vh - 13rem);
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius);
    background: var(--theme-surface);
}
.ansx-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: var(--theme-font-size-sm);
}
.ansx-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 0.5rem 0.65rem;
    text-align: left;
    font-size: var(--theme-font-size-xs);
    font-weight: 650;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--theme-text-secondary);
    background: var(--theme-surface-sunken);
    border-bottom: 1px solid var(--theme-border);
    white-space: nowrap;
}
.ansx-table td {
    white-space: nowrap;
    padding: 0.5rem 0.65rem;
    border-bottom: 1px solid var(--theme-border-subtle);
    color: var(--theme-text);
    vertical-align: middle;
    background: var(--theme-surface);
}
.ansx-table tbody tr { cursor: pointer; }
.ansx-table tbody tr:hover td { background: var(--theme-background-hover); }
.ansx-table tbody tr.is-selected td { background: color-mix(in srgb, var(--theme-primary) 8%, var(--theme-surface)); }
.ansx-table .is-num { text-align: right; font-variant-numeric: tabular-nums; }
.ansx-col-check { width: 2.2rem; text-align: center; }
.ansx-th-sort {
    border: 0;
    padding: 0;
    background: transparent;
    font: inherit;
    color: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
    cursor: pointer;
}
.ansx-th-sort.is-on, .ansx-th-sort:hover { color: var(--theme-primary); }
.ansx-cell-who { display: inline-flex; align-items: center; gap: 0.45rem; white-space: nowrap; }
.ansx-cell-ai {
    display: inline-block;
    max-width: 28rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--theme-text-secondary);
}
.ansx-cell-val {
    display: inline-block;
    max-width: 22rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ansx-nowrap { white-space: nowrap; }
.ansx-thumbs { display: inline-flex; gap: 0.25rem; }
.ansx-thumbs > img {
    width: 2.4rem;
    height: 2.4rem;
    object-fit: cover;
    border-radius: 0.35rem;
    border: 1px solid var(--theme-border);
    background: var(--theme-surface-sunken);
}
.ansx-grid .ansx-sticky-0 { position: sticky; left: 0; z-index: 1; }
.ansx-grid .ansx-sticky-1 {
    position: sticky;
    left: 2.2rem;
    z-index: 1;
    box-shadow: 1px 0 0 var(--theme-border);
}
.ansx-grid th.ansx-sticky-0, .ansx-grid th.ansx-sticky-1 { z-index: 3; }

.ansx-colpick { min-width: 15rem; }
.ansx-colpick-wide { width: min(22rem, 92vw); max-width: none; }
.ansx-colpick-scroll { max-height: 18rem; overflow-y: auto; }
.ansx-colpick-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.35rem 0.5rem;
    border: 0;
    border-radius: 0.35rem;
    background: transparent;
    color: var(--theme-text);
    font-size: var(--theme-font-size-sm);
    text-align: left;
    cursor: pointer;
}
.ansx-colpick-item:hover { background: var(--theme-background-hover); }
.ansx-colpick-item > .bi-check-square-fill { color: var(--theme-primary); }
.ansx-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    font-size: var(--theme-font-size-xs);
    color: var(--theme-text-secondary);
    cursor: pointer;
}
.ansx-muted { color: var(--theme-text-muted); font-size: var(--theme-font-size-xs); }

/* Explorer picker */
.ansx-explore-pick {
    padding: 1.25rem;
    border: 1px dashed var(--theme-border);
    border-radius: var(--theme-radius);
    background: var(--theme-surface);
}
.ansx-explore-pick-head { display: flex; gap: 0.8rem; align-items: center; margin-bottom: 1rem; }
.ansx-explore-pick-head > .bi { font-size: 1.8rem; color: var(--theme-primary); }
.ansx-explore-pick-title { font-weight: 700; color: var(--theme-text-emphasis); }
.ansx-explore-pick-sub { font-size: var(--theme-font-size-sm); color: var(--theme-text-secondary); }
.ansx-explore-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 0.6rem;
}
.ansx-explore-tile {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.75rem 0.85rem;
    text-align: left;
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius);
    background: var(--theme-background-raised);
    color: var(--theme-text);
    cursor: pointer;
    transition: border-color 120ms ease, transform 120ms ease;
}
.ansx-explore-tile:hover { border-color: var(--theme-primary); transform: translateY(-1px); }
.ansx-explore-tile-name { font-weight: 650; color: var(--theme-text-emphasis); }
.ansx-explore-tile-n { font-size: var(--theme-font-size-xs); color: var(--theme-text-muted); }
.ansx-explore-tile .ansx-wfpick-bar { width: 100%; }
.ansx-explore-title { font-weight: 700; color: var(--theme-text-emphasis); }

/* Map */
.ansx-map { display: flex; flex-direction: column; gap: 0.5rem; }
.ansx-map-hint { font-size: var(--theme-font-size-sm); color: var(--theme-text-secondary); }
.ansx-map-canvas {
    height: max(420px, calc(100vh - 16rem));
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius);
    overflow: hidden;
}

/* Empty states + pager */
.ansx-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 3rem 1rem;
    text-align: center;
    border: 1px dashed var(--theme-border);
    border-radius: var(--theme-radius);
    background: var(--theme-surface);
}
.ansx-empty > .bi { font-size: 2.4rem; color: var(--theme-text-muted); }
.ansx-empty-title { font-weight: 700; font-size: var(--theme-font-size-lg); color: var(--theme-text-emphasis); }
.ansx-empty-sub { max-width: 34rem; font-size: var(--theme-font-size-sm); color: var(--theme-text-secondary); }
.ansx-empty-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: center; margin-top: 0.6rem; }
.ansx-empty-inline { padding: 1rem; font-size: var(--theme-font-size-sm); color: var(--theme-text-muted); }
.ansx-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1rem;
    font-size: var(--theme-font-size-sm);
    color: var(--theme-text-secondary);
}

/* ---- Jobs lens ------------------------------------------------------- */
.ansx-jobs { display: flex; flex-direction: column; gap: 0.75rem; }
.ansx-jobs-tools { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.ansx-kits { display: flex; flex-direction: column; gap: 0.6rem; }
.ansx-kit {
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius);
    background: var(--theme-surface);
    overflow: hidden;
}
.ansx-kit.is-open { box-shadow: var(--theme-shadow-lg); border-color: color-mix(in srgb, var(--theme-primary) 35%, var(--theme-border)); }
.ansx-kit-head {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 0;
    background: transparent;
    color: var(--theme-text);
    text-align: left;
    cursor: pointer;
}
.ansx-kit-head:hover { background: var(--theme-background-hover); }
.ansx-kit-icon {
    display: inline-grid;
    place-items: center;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 0.55rem;
    color: var(--theme-offset);
    background: color-mix(in srgb, var(--theme-offset) 13%, transparent);
}
.ansx-kit-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ansx-kit-name { font-weight: 700; color: var(--theme-text-emphasis); }
.ansx-kit-anchor { font-size: var(--theme-font-size-sm); color: var(--theme-text-secondary); }
.ansx-kit-progress { display: inline-flex; align-items: center; gap: 0.45rem; font-size: var(--theme-font-size-sm); font-variant-numeric: tabular-nums; }
.ansx-kit-bar { width: 4.5rem; height: 6px; border-radius: 99px; background: var(--theme-surface-sunken); overflow: hidden; }
.ansx-kit-bar > span { display: block; height: 100%; background: var(--theme-success); border-radius: inherit; }
.ansx-kit-chev { color: var(--theme-text-muted); transition: transform 150ms ease; }
.ansx-kit.is-open .ansx-kit-chev { transform: rotate(90deg); }
.ansx-kit-body { padding: 0.4rem 0.9rem 0.9rem 3.9rem; }
.ansx-kit-steps { list-style: none; margin: 0; padding: 0; position: relative; }
.ansx-kit-steps::before {
    content: "";
    position: absolute;
    left: 0.32rem;
    top: 0.6rem;
    bottom: 0.6rem;
    width: 2px;
    background: var(--theme-border);
}
.ansx-kit-step {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.45rem 0;
}
.ansx-kit-step-dot {
    position: relative;
    z-index: 1;
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 50%;
    background: var(--ansx-st);
    box-shadow: 0 0 0 3px var(--theme-surface);
}
.ansx-kit-step-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ansx-kit-step-name { font-weight: 600; color: var(--theme-text-emphasis); }
.ansx-kit-reports {
    margin-top: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 0.5rem;
    background: var(--theme-surface-sunken);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.ansx-kit-reports-head { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; font-weight: 600; font-size: var(--theme-font-size-sm); }
.ansx-kit-report { display: flex; align-items: center; gap: 0.5rem; font-size: var(--theme-font-size-sm); }

/* ---- The run drawer -------------------------------------------------- */
.ansx-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: color-mix(in srgb, var(--theme-text-emphasis) 32%, transparent);
    animation: ansx-fade 160ms ease;
}
.ansx-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1041;
    width: min(46rem, 100vw);
    display: flex;
    flex-direction: column;
    background: var(--theme-background);
    border-left: 1px solid var(--theme-border);
    box-shadow: var(--theme-shadow-lg);
    animation: ansx-slide 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes ansx-slide { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ansx-fade { from { opacity: 0; } to { opacity: 1; } }
.ansx-drawer-head {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.75rem 1.1rem 0;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--theme-primary) 9%, var(--theme-surface)), var(--theme-surface));
    border-bottom: 1px solid var(--theme-border);
}
.ansx-drawer-nav { display: flex; align-items: center; gap: 0.35rem; }
.ansx-drawer-runid { font-size: var(--theme-font-size-xs); color: var(--theme-text-muted); font-variant-numeric: tabular-nums; }
.ansx-iconbtn {
    display: inline-grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid var(--theme-border);
    border-radius: 0.5rem;
    background: var(--theme-background-raised);
    color: var(--theme-text);
}
.ansx-iconbtn:hover:not(:disabled) { border-color: var(--theme-primary); color: var(--theme-primary); }
.ansx-drawer-who { display: flex; align-items: center; gap: 0.85rem; }
.ansx-drawer-who-text { min-width: 0; }
.ansx-drawer-name a { color: inherit; text-decoration: none; }
.ansx-drawer-name { font-size: var(--theme-font-size-xl); font-weight: 750; color: var(--theme-text-emphasis); line-height: 1.2; }
.ansx-drawer-contact { display: flex; flex-wrap: wrap; gap: 0.3rem 0.9rem; font-size: var(--theme-font-size-sm); margin-top: 0.2rem; }
.ansx-drawer-contact a { color: var(--theme-primary); text-decoration: none; }
.ansx-drawer-contact a:hover { text-decoration: underline; }
.ansx-drawer-title { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.ansx-drawer-wf { font-weight: 650; color: var(--theme-text-secondary); }
.ansx-drawer-facts { display: flex; flex-wrap: wrap; gap: 0.3rem 0.9rem; }
/* The run's context facts (Dispatch # / PO # / Location ...) - a two-column fact sheet. */
.ansx-drawer-context {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
    gap: 0.45rem 1rem;
    margin: 0;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius);
    background: var(--theme-surface);
}
.ansx-drawer-context dt {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--theme-text-muted);
}
.ansx-drawer-context dd { margin: 0; font-weight: 600; color: var(--theme-text-emphasis); overflow-wrap: anywhere; }
.ansx-drawer-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
/* "Include internal steps" - quiet while it is off (the customer copy), amber while it is on. */
.ansx-internal-switch {
    padding: 0.2rem 0.55rem;
    border: 1px dashed var(--theme-border);
    border-radius: var(--theme-radius);
}
.ansx-internal-switch.is-on {
    border-style: solid;
    border-color: var(--theme-warning);
    color: var(--theme-warning);
    font-weight: 650;
}
.ansx-drawer-error { font-size: var(--theme-font-size-sm); color: var(--theme-danger); }
.ansx-tabs { display: flex; gap: 0.25rem; margin-top: 0.1rem; overflow-x: auto; }
.ansx-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 0.55rem 0.8rem;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--theme-text-secondary);
    font-weight: 600;
    font-size: var(--theme-font-size-sm);
    cursor: pointer;
    white-space: nowrap;
}
.ansx-tab:hover { color: var(--theme-text-emphasis); }
.ansx-tab.is-on { color: var(--theme-primary); border-bottom-color: var(--theme-primary); }
.ansx-tab-n {
    margin-left: 0.35rem;
    padding: 0 0.4rem;
    border-radius: 99px;
    font-size: var(--theme-font-size-xs);
    background: var(--theme-surface-sunken);
}
.ansx-tab-dot { width: 0.4rem; height: 0.4rem; margin-left: 0.35rem; border-radius: 50%; background: var(--theme-accent); }
.ansx-drawer-body { flex: 1; min-height: 0; overflow-y: auto; padding: 1rem 1.1rem 2rem; }
.ansx-drawer-loading { padding: 1.5rem; font-size: var(--theme-font-size-sm); color: var(--theme-text-muted); }

.ansx-qa { width: 100%; border-collapse: collapse; font-size: var(--theme-font-size-sm); }
.ansx-qa th, .ansx-qa td { padding: 0.55rem 0.4rem; border-bottom: 1px solid var(--theme-border-subtle); vertical-align: top; }
.ansx-qa th { width: 42%; font-weight: 550; color: var(--theme-text-secondary); }
.ansx-qa td { font-weight: 600; color: var(--theme-text-emphasis); overflow-wrap: anywhere; }
.ansx-qa tr.is-internal th, .ansx-qa tr.is-internal td { background: color-mix(in srgb, var(--theme-warning) 6%, transparent); }
.ansx-qa-ent { font-weight: 400; margin-top: 0.15rem; }
.ansx-round {
    display: inline-grid;
    place-items: center;
    min-width: 1.2rem;
    height: 1.2rem;
    margin-left: 0.3rem;
    padding: 0 0.3rem;
    border-radius: 99px;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--theme-offset);
    background: color-mix(in srgb, var(--theme-offset) 14%, transparent);
}
.ansx-internal {
    margin-left: 0.35rem;
    font-size: 0.62rem;
    font-weight: 750;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--theme-warning);
}

.ansx-photos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.6rem;
}
.ansx-photo {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    border: 1px solid var(--theme-border);
    border-radius: 0.6rem;
    background: var(--theme-surface-sunken);
    overflow: hidden;
    cursor: zoom-in;
    color: var(--theme-text);
    text-decoration: none;
}
.ansx-photo > img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; transition: transform 300ms ease; }
.ansx-photo:hover > img { transform: scale(1.05); }
.ansx-photo.is-sig > img { object-fit: contain; background: var(--theme-background-raised); }
.ansx-photo.is-file { cursor: pointer; align-items: center; justify-content: center; aspect-ratio: 1 / 1; font-size: 2rem; color: var(--theme-text-muted); }
.ansx-photo-cap {
    padding: 0.35rem 0.5rem;
    font-size: var(--theme-font-size-xs);
    color: var(--theme-text-secondary);
    background: var(--theme-surface);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ansx-ai-text {
    white-space: pre-line;
    line-height: 1.55;
    padding: 0.9rem 1rem;
    border-radius: 0.6rem;
    background: color-mix(in srgb, var(--theme-accent) 7%, var(--theme-surface));
    border-left: 3px solid var(--theme-accent);
}

/* lightbox */
.ansx-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1060;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem 4rem;
    background: color-mix(in srgb, black 88%, transparent);
    animation: ansx-fade 150ms ease;
}
.ansx-lightbox figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 0.6rem; max-width: 100%; max-height: 100%; }
.ansx-lightbox img { max-width: 100%; max-height: calc(100vh - 8rem); object-fit: contain; border-radius: 0.4rem; box-shadow: var(--theme-shadow-lg); }
.ansx-lightbox figcaption { display: flex; gap: 1rem; align-items: center; color: white; font-size: var(--theme-font-size-sm); }
.ansx-lightbox figcaption .ansx-muted { color: color-mix(in srgb, white 65%, transparent); }
.ansx-lightbox-open { color: white; text-decoration: none; opacity: 0.8; }
.ansx-lightbox-open:hover { opacity: 1; text-decoration: underline; }
.ansx-lightbox-x, .ansx-lightbox-nav {
    position: absolute;
    display: inline-grid;
    place-items: center;
    width: 2.6rem;
    height: 2.6rem;
    border: 0;
    border-radius: 50%;
    color: white;
    background: color-mix(in srgb, white 14%, transparent);
    cursor: pointer;
}
.ansx-lightbox-x:hover, .ansx-lightbox-nav:hover { background: color-mix(in srgb, white 26%, transparent); }
.ansx-lightbox-x { top: 1rem; right: 1rem; }
.ansx-lightbox-nav.is-prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.ansx-lightbox-nav.is-next { right: 1rem; top: 50%; transform: translateY(-50%); }

.ansx-modal { background: color-mix(in srgb, var(--theme-text-emphasis) 45%, transparent); z-index: 1070; }
.ansx-readonly { background: var(--theme-surface-sunken); }

/* ---- Phone ----------------------------------------------------------- */
@media (max-width: 720px) {
    /* presets and chips become swipeable rows - the command bar stays short on a phone */
    .ansx-filters .ansx-seg, .ansx-frow-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        max-width: 100%;
        scrollbar-width: none;
    }
    .ansx-filters .ansx-seg::-webkit-scrollbar, .ansx-frow-chips::-webkit-scrollbar { display: none; }
    .ansx-frow-chips .ansx-chips { flex-wrap: nowrap; }
    .ansx-frow-chips > *, .ansx-chip { flex: 0 0 auto; }
    .ansx-viewbar .ansx-seg { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; }
    .ansx-kpi-hero { grid-column: span 2; }
    .ansx-pulse { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ansx-head-actions .btn { padding: 0.25rem 0.5rem; }
    .ansx-search { flex-basis: 100%; }
    .ansx-grid-cards { grid-template-columns: 1fr; }
    .ansx-bulk { top: 0; }
    .ansx-kit-body { padding-left: 0.9rem; }
    .ansx-lightbox { padding: 3.5rem 0.5rem; }
    .ansx-lightbox-nav { top: auto; bottom: 1rem; transform: none; }
    .ansx-lightbox-nav.is-prev { left: 30%; top: auto; transform: none; }
    .ansx-lightbox-nav.is-next { right: 30%; top: auto; transform: none; }
}
