@charset "UTF-8";
/* Must stay the FIRST bytes of this file - a @charset rule is only honoured at
   byte 0, and without it a browser falls back to a locale default and renders the
   separators below as mojibake ("Working on it Â· 6s"). Static CSS goes out as
   text/css with no charset parameter, so the stylesheet has to declare its own. */

/* LipiCore Insights - the product's own styles: filters, grids, widgets and charts,
   the AI page and the Pin Board. Loaded AFTER the shared lipicore.css (theme
   variables, header, page frame, buttons, forms, login, admin, the home shell and its
   panels), which it extends; every --ins-* variable comes from there. */


/* A dashboard/grid page head: the title and its favorite star on one line, so the
   star reads as belonging to the name - the same relationship it has on the home
   cards. It IS the home cards' control, so it needs their accent variable, and the
   absolute positioning that pins it to a card corner has to go. */

.ins-page-title-row:last-child {
    margin-bottom: 0;
}

.ins-page-title-row .ins-page-title {
    margin-bottom: 0;
}

.ins-page-title-row .ins-fav-form {
    position: static;
}

/* Sized against the 1.3rem title rather than the card's body text */
.ins-page-title-row .ins-fav-btn {
    font-size: 1rem;
}

/* Divider between a page's name and the saved view applied to it - lighter than
   both names so the eye reads two parts rather than one run-on title */

/* ---------- Content: filters + grid ---------- */
/* Compare-with-previous-period switch under the filter heading */
.ins-compare-toggle {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0.15rem 0 0.6rem;
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--ins-muted);
    cursor: pointer;
}

.ins-compare-toggle:has(input:checked) {
    color: var(--ins-primary);
}

.ins-filter-dates {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.ins-date-field {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--ins-muted);
    position: relative;             /* anchors the enhanced field's calendar glyph */
}

.ins-date-field input[type="date"],
.ins-date-field input[type="number"],
.ins-date-field input.ins-date-input,
.ins-date-field select {
    height: 32px;
    border: 1px solid var(--ins-border);
    border-radius: 8px;
    padding: 0 0.5rem;
    font-size: 0.8rem;
    color: var(--ins-text);
    background: var(--ins-surface);
}

/* The visible field of an enhanced date input clears its calendar glyph. */
.ins-date-field input.ins-date-input {
    padding-right: 1.7rem;
}

.ins-date-field input[type="date"]:disabled,
.ins-date-field input.ins-date-input:disabled {
    color: var(--ins-muted);
    opacity: 0.7;
}

/* Calendar glyph on enhanced date fields (the native input drew its own). */
.ins-date-field:has(input.ins-date-input)::after {
    content: "\f1f6";                /* bootstrap-icons: bi-calendar */
    font-family: bootstrap-icons;
    position: absolute;
    right: 0.55rem;
    bottom: 7px;
    font-size: 0.85rem;
    color: var(--ins-muted);
    pointer-events: none;
}

.ins-date-field:has(input.ins-date-input:disabled)::after {
    opacity: 0.5;
}

/* ---------- Themed date picker (flatpickr) ----------
   Recolors the vendored flatpickr calendar with the theme variables (the
   native browser popup cannot be themed at all). Selectors mirror the vendor
   sheet's specificity; this sheet loads after flatpickr.min.css, so source
   order decides. Range and week-number rules are skipped - the app only uses
   single-date pickers. */
.flatpickr-calendar {
    font-family: var(--ins-font-family);
    background: var(--ins-surface);
    border: 1px solid var(--ins-border);
    border-radius: var(--ins-radius-control);
    box-shadow: 0 6px 24px -6px var(--ins-shadow-strong);
}

.flatpickr-calendar.arrowTop::before { border-bottom-color: var(--ins-border); }
.flatpickr-calendar.arrowTop::after { border-bottom-color: var(--ins-surface); }
.flatpickr-calendar.arrowBottom::before { border-top-color: var(--ins-border); }
.flatpickr-calendar.arrowBottom::after { border-top-color: var(--ins-surface); }

.flatpickr-months .flatpickr-month {
    color: var(--ins-text);
    fill: var(--ins-text);
}

.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
    color: var(--ins-muted);
    fill: var(--ins-muted);
}

/* The vendor hover is an off-brand red. */
.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg {
    fill: var(--ins-primary);
}

.numInputWrapper:hover {
    background: var(--ins-background);
}

.numInputWrapper span.arrowUp::after {
    border-bottom-color: var(--ins-muted);
}

.numInputWrapper span.arrowDown::after {
    border-top-color: var(--ins-muted);
}

span.flatpickr-weekday {
    color: var(--ins-muted);
}

.flatpickr-day {
    color: var(--ins-text);
}

.flatpickr-day:hover,
.flatpickr-day.prevMonthDay:hover,
.flatpickr-day.nextMonthDay:hover,
.flatpickr-day:focus,
.flatpickr-day.prevMonthDay:focus,
.flatpickr-day.nextMonthDay:focus {
    background: var(--ins-background);
    border-color: var(--ins-background);
}

.flatpickr-day.today {
    border-color: var(--ins-primary);
}

.flatpickr-day.today:hover,
.flatpickr-day.today:focus {
    border-color: var(--ins-primary);
    background: var(--ins-primary);
    color: var(--ins-on-color);
}

.flatpickr-day.selected,
.flatpickr-day.selected:hover,
.flatpickr-day.selected:focus,
.flatpickr-day.selected.prevMonthDay,
.flatpickr-day.selected.nextMonthDay {
    background: var(--ins-primary);
    border-color: var(--ins-primary);
    color: var(--ins-on-color);
}

.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay,
.flatpickr-day.flatpickr-disabled,
.flatpickr-day.flatpickr-disabled:hover {
    color: color-mix(in srgb, var(--ins-muted) 55%, transparent);
}

/* ---------- Widget rows: each config group is one row, shared equally ---------- */
.ins-rows {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.ins-row {
    display: grid;
    gap: 0.9rem;
    grid-template-columns: 1fr;
    align-items: stretch;
}

.ins-row-2 {
    grid-template-columns: repeat(2, 1fr);
}

.ins-row-3 {
    grid-template-columns: repeat(3, 1fr);
}

.ins-row-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1199.98px) {
    .ins-row-3,
    .ins-row-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 861.98px) {
    /* The dashboard column has the same disease from the same flex geometry: at
       tablet widths .ins-rows shrink-wrapped to its widest natural child (the
       KPI strip) and the widgets stopped ~180px short of the right edge. */
    .ins-rows {
        width: 100%;
    }

    .ins-row-2,
    .ins-row-3,
    .ins-row-4 {
        grid-template-columns: 1fr;
    }
}

/* ---------- Widget cards ---------- */
.ins-widget {
    background: var(--ins-surface);
    border: 1px solid var(--ins-border);
    border-radius: var(--ins-border-radius);
    box-shadow: var(--ins-shadow-light);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ins-widget-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.95rem;
    font-weight: 600;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--ins-border);
}

.ins-widget-icon {
    display: inline-flex;
    align-items: center;
    color: var(--ins-muted);
    font-size: 0.9rem;
}

.ins-widget-body {
    padding: 0.75rem 0.95rem;
    flex: 1;
    min-width: 0;
}

.ins-widget-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: color-mix(in srgb, var(--ins-warning) 9%, var(--ins-surface));
    border: 1px solid color-mix(in srgb, var(--ins-warning) 30%, var(--ins-surface));
    color: color-mix(in srgb, var(--ins-warning) 60%, black);
    border-radius: calc(var(--ins-border-radius) / 1.6);
    padding: 0.6rem 0.8rem;
    font-size: 0.85rem;
}

/* ---------- Charts ---------- */
.ins-chart,
.ins-breakdown-chart {
    width: 100%;
    height: 290px;
}

.ins-chart--tall {
    height: 400px;
}

/* Drillable charts: segments apply their value as a dashboard filter on click */
.ins-chart--drill {
    cursor: pointer;
}

/* An analysis card's key figures above its chart (chart.summary): before → after,
   the change, what the breakdown found - read first, then the shapes */
.ins-chart-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 20px;
    padding: 2px 2px 10px;
}

.ins-chart-stat {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.ins-chart-stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--ins-muted);
}

.ins-chart-stat-value {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--ins-text);
    overflow-wrap: anywhere;
}

.ins-chart-stat.is-up .ins-chart-stat-value { color: var(--ins-success); }
.ins-chart-stat.is-down .ins-chart-stat-value { color: var(--ins-danger); }
.ins-chart-stat.is-flag .ins-chart-stat-value { color: var(--ins-warning); }

/* ---------- Explorer widgets (breakdown, flow) ---------- */
.ins-explore-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 0.6rem;
}

.ins-explore-controls .ins-select-toggle {
    height: 30px;
    padding: 0 1.9rem 0 0.65rem;
    font-size: 0.8rem;
}

.ins-explore-arrow {
    color: var(--ins-muted);
    font-size: 0.8rem;
}

/* ---------- KPI tiles ---------- */
.ins-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.9rem;
}

.ins-kpi {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--ins-surface);
    border: 1px solid var(--ins-border);
    border-radius: var(--ins-border-radius);
    box-shadow: var(--ins-shadow-light);
    padding: 0.85rem 0.95rem;
    min-width: 0;
}

.ins-kpi-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 1.15rem;
}

.ins-kpi-text {
    min-width: 0;
}

.ins-kpi-label {
    color: var(--ins-muted);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ins-kpi-value {
    font-size: 1.42rem;
    font-weight: 800;
    line-height: 1.15;
}

.ins-kpi-delta {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
}

.ins-kpi-delta--good { color: var(--ins-success); }
.ins-kpi-delta--bad { color: var(--ins-danger); }
.ins-kpi-delta--flat { color: var(--ins-muted); }

/* Baseline note beside the delta, shown only when it is not the default
   preceding period - quiet enough to read as an annotation, not a second figure */
.ins-kpi-basis {
    margin-left: 4px;
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--ins-muted);
    white-space: nowrap;
}

/* Phones: two tiles per row instead of a full-width stack - five KPIs were
   five screens' worth of scrolling before the first chart. The 9.5rem floor
   pairs them on anything from ~360px up and falls back to one column below;
   the tile slims to match (smaller icon chip, tighter padding, value a step
   down). Labels already ellipsize. The pin board's own column-width override
   (.ins-pin-item .ins-kpis) outweighs this and keeps its behaviour. */
@media (max-width: 640px) {
    .ins-kpis {
        grid-template-columns: repeat(auto-fit, minmax(min(9.5rem, 100%), 1fr));
        gap: 0.6rem;
    }

    .ins-kpi {
        gap: 0.6rem;
        padding: 0.7rem 0.75rem;
    }

    .ins-kpi-icon {
        width: 36px;
        height: 36px;
        flex: 0 0 36px;
        font-size: 1rem;
        border-radius: 10px;
    }

    .ins-kpi-value {
        font-size: 1.25rem;
    }
}

/* Icon tints - theme accents with automatically derived soft backgrounds */
/* Accent tint for both the KPI tile icon and the home-card icon (same formula) */
/* (the .ins-home-card-icon half of each row now lives in lipicore.css) */
.ins-tint-1 .ins-kpi-icon { background: color-mix(in srgb, var(--ins-accent-1) 11%, var(--ins-surface)); color: var(--ins-accent-1); }
.ins-tint-2 .ins-kpi-icon { background: color-mix(in srgb, var(--ins-accent-2) 11%, var(--ins-surface)); color: var(--ins-accent-2); }
.ins-tint-3 .ins-kpi-icon { background: color-mix(in srgb, var(--ins-accent-3) 11%, var(--ins-surface)); color: var(--ins-accent-3); }
.ins-tint-4 .ins-kpi-icon { background: color-mix(in srgb, var(--ins-accent-4) 11%, var(--ins-surface)); color: var(--ins-accent-4); }
.ins-tint-5 .ins-kpi-icon { background: color-mix(in srgb, var(--ins-accent-5) 11%, var(--ins-surface)); color: var(--ins-accent-5); }
.ins-tint-6 .ins-kpi-icon { background: color-mix(in srgb, var(--ins-accent-6) 11%, var(--ins-surface)); color: var(--ins-accent-6); }
.ins-tint-7 .ins-kpi-icon { background: color-mix(in srgb, var(--ins-accent-7) 11%, var(--ins-surface)); color: var(--ins-accent-7); }
.ins-tint-8 .ins-kpi-icon { background: color-mix(in srgb, var(--ins-accent-8) 11%, var(--ins-surface)); color: var(--ins-accent-8); }
.ins-tint-9 .ins-kpi-icon { background: color-mix(in srgb, var(--ins-accent-9) 11%, var(--ins-surface)); color: var(--ins-accent-9); }
.ins-tint-10 .ins-kpi-icon { background: color-mix(in srgb, var(--ins-accent-10) 11%, var(--ins-surface)); color: var(--ins-accent-10); }

.ins-tint-1 .ins-kpi-value { color: var(--ins-accent-1); }
.ins-tint-2 .ins-kpi-value { color: var(--ins-accent-2); }
.ins-tint-3 .ins-kpi-value { color: var(--ins-accent-3); }
.ins-tint-4 .ins-kpi-value { color: var(--ins-accent-4); }
.ins-tint-5 .ins-kpi-value { color: var(--ins-accent-5); }
.ins-tint-6 .ins-kpi-value { color: var(--ins-accent-6); }
.ins-tint-7 .ins-kpi-value { color: var(--ins-accent-7); }
.ins-tint-8 .ins-kpi-value { color: var(--ins-accent-8); }
.ins-tint-9 .ins-kpi-value { color: var(--ins-accent-9); }
.ins-tint-10 .ins-kpi-value { color: var(--ins-accent-10); }

/* ---------- Leaderboard widgets ---------- */
.ins-leaders {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.ins-leader {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
}

.ins-leader-rank {
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: color-mix(in srgb, var(--ins-muted) 12%, var(--ins-surface));
    color: var(--ins-muted);
    font-size: 0.75rem;
    font-weight: 700;
}

.ins-leader-main {
    flex: 1;
    min-width: 0;
}

.ins-leader-top {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.ins-leader-label {
    flex: 1;
    min-width: 0;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ins-leader-secondary {
    color: var(--ins-muted);
    font-size: 0.7rem;
    white-space: nowrap;
}

.ins-leader-value {
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.ins-leader-bar {
    height: 6px;
    margin-top: 4px;
    border-radius: 3px;
    background: color-mix(in srgb, var(--ins-primary) 10%, var(--ins-surface));
    overflow: hidden;
}

.ins-leader-bar i {
    display: block;
    height: 100%;
    border-radius: 3px;
    background: var(--ins-primary);
}

/* Contextual column names above the list - the ranked dimension on the left,
   the record count and the measure over the number cluster they describe -
   styled like table headers so they read as labels, not data. */
.ins-leader-head {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding-left: calc(26px + 0.7rem);
    color: var(--ins-muted);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: -0.25rem;
}

.ins-leader-head-name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ins-leader-head-count,
.ins-leader-head-value {
    white-space: nowrap;
}

/* The record count and the measure sit as one right-hand cluster; a middot
   keeps them apart - the same "a · b" join nested row labels use. Pseudo
   content on purpose: it never reaches textContent, so the table view's DOM
   reader and the CSV it feeds stay clean numbers. */
.ins-leader-secondary::after,
.ins-leader-head-count::after {
    content: "·";
    margin-left: 0.3rem;
}

/* 0.3rem air on each side of the dot: the left is the margin above, the right
   is the container's 0.5rem gap pulled back 0.2rem here - on the count box
   itself, so the dot never overhangs it and the label-to-numbers seam keeps
   its own 0.5rem untouched. The count box exists only when a count is shown,
   so no-count rows are unaffected. */
.ins-leader-secondary,
.ins-leader-head-count {
    margin-right: -0.2rem;
}

/* "Nothing came back" inside a widget body: the leaderboard's own note, and the
   one a chart shows in place of empty axes. .ins-chart-empty fills the chart box
   it replaces, so the card keeps the height it reserved rather than collapsing. */
.ins-leaders-empty {
    color: var(--ins-muted);
    font-size: 0.85rem;
    text-align: center;
    padding: 1rem 0;
}

.ins-chart-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 120px;
    color: var(--ins-muted);
    font-size: 0.85rem;
}

/* ---------- Search page ---------- */

/* Phones: the icon carries the button (the label span is markup so it can
   step aside); the input keeps the width for the query itself. */

.ins-didyoumean {
    margin: 0;
    font-size: 0.85rem;
    color: var(--ins-muted);
}

.ins-didyoumean a {
    color: var(--ins-primary);
    font-weight: 600;
    font-style: italic;
    text-decoration: none;
}

.ins-didyoumean a:hover {
    text-decoration: underline;
}

.ins-grid-card {
    background: var(--ins-surface);
    border: 1px solid var(--ins-border);
    border-radius: var(--ins-border-radius);
    box-shadow: var(--ins-shadow-light);
    overflow: hidden;
}

.ins-grid th .ins-sort {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: inherit;
    text-decoration: none;
}

.ins-grid th .ins-sort .bi {
    font-size: 0.65rem;
    opacity: 0.45;
}

.ins-grid th .ins-sort:hover {
    color: var(--ins-primary);
}

.ins-grid th .ins-sort--active,
.ins-grid th .ins-sort--active .bi {
    color: var(--ins-hint);
    opacity: 1;
}

.ins-grid--expandable tbody tr[data-doc-row] {
    cursor: pointer;
}

.ins-grid--expandable tbody tr.ins-grid-row--open > td {
    background-color: color-mix(in srgb, var(--ins-primary) 6%, var(--ins-surface));
}

/* Record dialog: label-over-value cards in as many columns as the dialog
   width fits (one on narrow screens). CSS multi-columns, not grid, so the
   sorted fields read top-to-bottom first, then continue in the next column. */
.ins-doc-section {
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ins-primary);
    margin: 0 0 0.75rem;
}

.ins-doc-fields + .ins-doc-section {
    margin-top: 1.1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--ins-border);
}

.ins-doc-fields {
    columns: 230px;
    column-gap: 1.4rem;
    margin: 0;
    font-size: 0.85rem;
}

.ins-doc-field {
    break-inside: avoid;
    margin-bottom: 0.9rem;
}

.ins-doc-field dt {
    color: var(--ins-muted);
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.15rem;
}

.ins-doc-field dd {
    margin: 0;
    overflow-wrap: anywhere;
}

/* The home pages' shell, facts, toolbar toggles, table view, Overview, Tips & Tricks
   and the favorite star live in lipicore.css ("Home pages", part three). */

/* ---------- Page-head actions & save-view dialog ---------- */

/* A title + description block is taller than the action buttons, so top-aligning
   is what lines the buttons up with the title. A bare title is shorter than they
   are and the same rule leaves it riding ~8px high, so centre that case instead. */

/* ---------------------------------------------------------------- AI page */

/* The assistant is an app shell: the page itself never scrolls - the transcript
   does - so the composer stays put at the foot of the viewport however long the
   conversation runs. dvh, not the shared vh, or mobile browser chrome pushes the
   composer under the fold. */
.ins-body--ai {
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
}

.ins-main--ai {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* The /embed variant: the same shell inside a host application's iframe panel,
   where the surrounding chrome is the host's to spend. The template already
   skips our header and footer; what remains slims to fit a side panel - the
   page head becomes one compact row and the description goes (the host names
   the panel; a narrow column shouldn't open on a paragraph about it). */
.ins-body--embed .ins-main--ai {
    padding-top: 0.6rem;
}

.ins-body--embed .ins-ai-head {
    align-items: center;
}

.ins-body--embed .ins-page-head {
    margin-bottom: 0.4rem;
}

.ins-body--embed .ins-page-title {
    font-size: 1.05rem;
}

.ins-body--embed .ins-page-desc {
    display: none;
}

.ins-ai-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.ins-ai {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1;
    min-height: 0;
}

/* Starters as a tidy grid of answer-type cards - a dozen chips wrap into even
   columns instead of the ragged pill rows a flex wrap made of them. */
.ins-ai-suggestions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 0.5rem;
    margin-top: 1rem;
    text-align: left;
}

/* Every collection's starters are in the page; only the picked one shows.
   Needed because the class above sets display, which beats the UA [hidden]. */
.ins-ai-suggestions[hidden] {
    display: none;
}

.ins-ai-suggestion {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    border: 1px solid var(--ins-border);
    border-radius: 10px;
    background: var(--ins-surface, #fff);
    color: var(--ins-text);
    font: inherit;
    font-size: 0.85rem;
    line-height: 1.35;
    padding: 0.5rem 0.7rem;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s ease, background-color 0.15s ease,
        transform 0.15s ease, box-shadow 0.15s ease;
}

.ins-ai-suggestion .bi {
    font-size: 0.95rem;
    color: var(--ins-primary);
    flex-shrink: 0;
}

.ins-ai-suggestion:hover {
    border-color: var(--ins-primary);
    background: color-mix(in srgb, var(--ins-primary) 5%, var(--ins-surface, #fff));
    transform: translateY(-1px);
    box-shadow: 0 2px 8px color-mix(in srgb, var(--ins-primary) 10%, transparent);
}

.ins-ai-prose p { margin: 0 0 0.5rem; }
.ins-ai-prose p:last-child { margin-bottom: 0; }
.ins-ai-prose pre {
    background: color-mix(in srgb, var(--ins-text) 6%, transparent);
    border-radius: 8px;
    padding: 0.5rem 0.65rem;
    overflow-x: auto;
}
.ins-ai-prose ul, .ins-ai-prose ol { margin: 0 0 0.5rem; padding-left: 1.2rem; }

/* artifact cards fill the row under the assistant's prose */
.ins-ai-widget {
    max-width: 100%;
}

/* Charts don't need the whole row: a pie or a short bar/line reads better at
   about half width, left-aligned under the answer (the assistant column stretches
   its children, so the cap alone parks the card at the left edge). ai.js adds this
   to chart cards by default; it drops it when the model asks for a wide chart
   (width=full) and never adds it to the dense kinds. Falls back to full on narrow
   screens below. */
.ins-ai-widget--half {
    max-width: 55%;
}

/* Two half-width artifacts paired into one row. ai.js reuses the dashboard's
   .ins-row/.ins-row-N grid, so the responsive collapses (two columns under 1200px,
   one under 862px) come for free and the transcript can never drift from the
   dashboards.

   The max-width override is not optional: inside a grid cell that is already half
   the row, a further 55% cap would render the card at ~27% of the transcript - worse
   than the single-column stacking this replaces. The cap exists to stop a LONE card
   spanning the full width; in a pair the grid already does that job. Same reasoning,
   same fix as the pin columns at .ins-pin-item below. */
.ins-ai-row {
    width: 100%;
}

.ins-ai-row .ins-ai-widget--half {
    max-width: 100%;
}

/* A KPI strip is a band, not a card: if one ever lands in a row it spans it. */
.ins-ai-row > .ins-kpis {
    grid-column: 1 / -1;
}

/* Reserve room for the floating controls so a long title doesn't run under them.
   Scoped to the artifact CARD, not to .ins-ai-row: a lone artifact is pushed into
   the transcript unwrapped (buildArtifactRows only builds a row for two or more),
   so a row-scoped reserve missed every full-width card - which is how the switch
   ended up under the pin there (Vishal, 2026-07-31). The wider reserve applies
   only when a card carries the third control. */
.ins-ai-widget .ins-widget-head {
    padding-right: 4.75rem;
}

.ins-ai-widget .ins-widget-head:has(~ .ins-ai-toggle) {
    padding-right: 6.75rem;
}

/* The answer's one-line headline - the finding people read first, so it gets a
   callout treatment rather than a bare bold line: the page's own star icon and
   a 3px accent left border over the findings-box
   tint. Shrink-wraps to its sentence, capped at the answer bubble's own 75%
   measure so banner and bubble read as one column. */
.ins-ai-headline {
    display: flex;
    align-items: baseline;
    gap: 0.55rem;
    width: fit-content;
    max-width: 75%;
    margin: 0 0 0.45rem;
    padding: 0.6rem 0.9rem 0.6rem 0.75rem;
    border-left: 4px solid var(--ins-primary);
    border-radius: 4px;
    background: color-mix(in srgb, var(--ins-primary) 8%, var(--ins-surface, #fff));
    font-size: 1rem;
    font-weight: 650;
    line-height: 1.4;
    color: var(--ins-text);
}

.ins-ai-headline .bi {
    color: var(--ins-primary);
    font-size: 0.95rem;
    flex-shrink: 0;
}

/* The answer's scope - which window and filters the data actually ran under.
   Server-composed fact, styled as quiet metadata riding under the headline. */
.ins-ai-scope {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    margin: -0.05rem 0 0.3rem;
    font-size: 0.8rem;
    color: var(--ins-muted);
}

.ins-ai-scope .bi {
    font-size: 0.7rem;
    flex-shrink: 0;
}

/* Interpretations the model adopted ("rate" read as volume): its own note in the
   partial-note's amber family, so a proxy reading is never mistaken for a data
   fact - but with an info icon, because nothing failed. */
.ins-ai-assumptions {
    display: flex;
    gap: 0.5rem;
    width: fit-content;
    max-width: 80%;
    padding: 0.5rem 0.8rem;
    border-radius: 10px;
    /*background: color-mix(in srgb, var(--ins-warning, #b8860b) 8%, var(--ins-surface));*/
    font-size: 0.75rem;
    line-height: 1.5;
    color: var(--ins-muted);
}

.ins-ai-assumptions > .bi {
    flex-shrink: 0;
    color: var(--ins-hint);
}

.ins-ai-assumptions-body p {
    margin: 0;
}

.ins-ai-assumptions-body p + p {
    margin-top: 0.25rem;
}

/* Recommended actions share the findings box's bones; the accent border says
   "do", not just "know". */
.ins-ai-actions {
    border-left: 3px solid var(--ins-primary);
}

/* A finding shown under the card it came from. Inside the card, so it travels into
   the PNG download and stays put when rows reflow. */
.ins-ai-caption {
    padding: 0 0.95rem 0.7rem;
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--ins-muted);
}

.ins-ai-caption p {
    margin: 0.35rem 0 0;
}

/* The findings that belong to no single card. */
.ins-ai-findings {
    margin-top: 0.2rem;
    padding: 0.75rem 0.95rem 0.85rem;
    border: 1px solid var(--ins-border);
    border-radius: 12px;
}

.ins-ai-findings-head {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0 0 0.4rem;
    font-size: 0.7rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--ins-muted);
}

.ins-ai-findings-list {
    margin: 0;
    padding-left: 1.1rem;
    font-size: 0.85rem;
    line-height: 1.5;
}

.ins-ai-findings-list li {
    margin: 0.2rem 0;
}

/* Follow-ups are prompts, not answer content, and they say so twice: a muted
   "Ask next" mini-heading (the findings-head treatment) and GHOST chips -
   transparent, muted text - that the shared suggestion hover brings to life.
   The empty-state starters keep their solid cards: there they ARE the content. */
.ins-ai-next {
    margin-top: 0.35rem;
}

.ins-ai-next-head {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    font-size: 0.7rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--ins-muted);
}

/* The guidance sections' lead icons take the assumptions note's treatment - a
   hint-colored icon over quiet muted text - so the eye finds each section by its
   warm fleck while the words stay subdued. */
.ins-ai-scope .bi,
.ins-ai-findings-head .bi,
.ins-ai-next-head .bi {
    color: var(--ins-hint);
}

/* The chips reuse the empty state's .ins-ai-suggestions grid wholesale; its
   1rem margin-top is the empty state's spacing, not this section's. */
.ins-ai-followups {
    margin-top: 0.45rem;
}

.ins-ai-followups .ins-ai-suggestion {
    background: transparent;
    color: var(--ins-muted);
}

.ins-ai-followups .ins-ai-suggestion:hover {
    color: var(--ins-text);
    background: color-mix(in srgb, var(--ins-primary) 5%, var(--ins-surface, #fff));
}

/* A clarifying question's choices: the follow-up chips' grid, but at full
   strength - they answer the question just asked rather than suggest a next
   one. Once one is picked the others step back and the pick stays marked. */
.ins-ai-clarify {
    margin-top: 0.35rem;
}

.ins-ai-choices {
    margin-top: 0.45rem;
}

.ins-ai-choice {
    border-color: color-mix(in srgb, var(--ins-primary) 45%, var(--ins-border));
    color: var(--ins-text);
}

.ins-ai-clarify.is-answered .ins-ai-choice:not(.is-picked) {
    opacity: 0.55;
}

.ins-ai-choice.is-picked {
    border-color: var(--ins-primary);
    background: color-mix(in srgb, var(--ins-primary) 8%, var(--ins-surface, #fff));
}

/* An answer the Hub stopped short of finishing. Informational, not an error:
   everything it did build is rendered right above this. */
.ins-ai-partial {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.2rem;
    padding: 0.45rem 0.7rem;
    border-radius: 10px;
    background: color-mix(in srgb, var(--ins-warning, #b8860b) 10%, var(--ins-surface));
    color: var(--ins-muted);
    font-size: 0.8rem;
}

/* Pin control: a small button at an artifact card's top-right that opens an inline
   namer. The card is positioned so the control sits over its head without shifting
   layout; the KPI strip (no head) carries it in the same corner. */
.ins-ai-pinnable {
    position: relative;
}

.ins-ai-pin,
/* The "download this as a PNG" control, wherever a card offers one: floating on
   an AI artifact card, and riding at the end of a dashboard widget's head row.
   Same button, two placements - the appearance lives here once. */
.ins-ai-download,
.ins-ai-toggle,
.ins-widget-download,
.ins-widget-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ins-muted);
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
    transition: color 0.15s ease, background 0.15s ease;
}

/* BOTH floating controls on an AI artifact card corner-anchor against the card
   (.ins-ai-pinnable is the positioned ancestor). The pin MUST be positioned here
   too: left in normal flow it becomes a flex item of whatever it was appended to
   and lands beside the content - on a KPI answer, right in the middle of the
   tile strip (Vishal, 2026-07-29). */
.ins-ai-pin,
.ins-ai-download,
.ins-ai-toggle {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 2;
}

/* The chart/table switch is the leftmost of the floating trio, so it steps aside
   for whichever of the other two the card actually carries (a pin only appears on
   a card with a re-runnable spec). Inserted BEFORE them in the DOM so these
   sibling tests can count what follows it. */
.ins-ai-toggle:has(~ .ins-ai-download) {
    right: 2.5rem;
}

.ins-ai-toggle:has(~ .ins-ai-download):has(~ .ins-ai-pin) {
    right: 4.5rem;
}

/* The widget head is a flex row (icon, title): the controls take the far end and
   never shrink, however long the title runs. On an AI or pinned card the head
   already reserves room on its right for the floating download/pin, so an in-head
   control lands just left of them without any positioning of its own. */
.ins-widget-download,
.ins-widget-toggle {
    margin-left: auto;
    flex: 0 0 auto;
}

/* Only the FIRST control pushes the group right - a second auto margin would
   share out the free space and split the pair apart. */
.ins-widget-toggle ~ .ins-widget-download {
    margin-left: 0;
}

/* Table view of a chart: capped at the height the chart occupied and scrolled
   internally, so switching never makes the dashboard row jump. The capture
   unfurls scrollers, so a downloaded image still carries every row. */
.ins-widget-table {
    max-height: 290px;
    overflow: auto;
}

/* A column of figures, header included: right-aligned on tabular digits so the
   numbers stack by place value and stay scannable down the column - the same
   treatment the home listings' number columns get. */
.ins-cell-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.ins-chart--tall + .ins-widget-table {
    max-height: 400px;
}

/* download sits left of the pin; on spec-less cards (no pin) it takes the corner */
.ins-ai-pin ~ .ins-ai-download,
.ins-ai-download:has(~ .ins-ai-pin) {
    right: 2.5rem;
}

/* A KPI answer is a bare tile strip with no head to hold the controls, so they
   would sit on the first row of tiles: give them a band of their own above it.
   Deep enough to clear a control outright - they start 0.5rem down and stand
   1.75rem tall, so anything under 2.25rem still clips the first row. */
.ins-ai-pinnable.ins-kpis {
    padding-top: 2.6rem;
}

.ins-ai-pin:hover,
.ins-ai-download:hover,
.ins-ai-toggle:hover,
.ins-ai-toggle:focus-visible,
.ins-widget-download:hover,
.ins-widget-download:focus-visible,
.ins-widget-toggle:hover,
.ins-widget-toggle:focus-visible {
    color: var(--ins-primary);
    background: color-mix(in srgb, var(--ins-primary) 10%, var(--ins-surface));
}

.ins-ai-pin--done {
    color: var(--ins-primary);
    background: color-mix(in srgb, var(--ins-primary) 12%, var(--ins-surface));
    cursor: default;
}

/* ---------- Pin Board (home page) ---------- */

/* Masonry: cards flow into columns and stack by height, so different-height cards
   leave no vertical gaps. Reordered by drag (pin-board.js) - the move lands on drop,
   so the columns don't churn under the pointer mid-drag. */
/* The board's one control, the column picker, is the shared segmented control
   (.ins-view-seg in the home toolbar section) - .ins-pin-col-btn survives only
   as pin-board.js's selector hook, with no styling of its own. */

/* JS-built columns in reading order (pin-board.js layout()): flex stacks instead of
   CSS multicol, so which column a card lands in is the user's order, never the
   browser's height balancing. */
.ins-pin-board {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-top: 0.6rem;
}

.ins-pin-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ins-pin-item {
    position: relative;
}

/* pinned cards fill their column, not the chat's half width */
.ins-pin-item .ins-ai-widget--half {
    max-width: 100%;
}

.ins-pin-item--dragging {
    opacity: 0.45;
}

.ins-pin-item--drop {
    outline: 2px dashed var(--ins-primary);
    outline-offset: 3px;
    border-radius: var(--ins-radius, 12px);
}

/* Two top-right controls: the grip handle and the "more" menu holding every
   other action (details, edit, download, remove) as named entries. */
.ins-pin-handle {
    position: absolute;
    top: 0.5rem;
    right: 2.5rem;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 8px;
    color: var(--ins-muted);
    cursor: grab;
}

.ins-pin-handle:hover {
    color: var(--ins-text);
}

.ins-pin-handle:active {
    cursor: grabbing;
}

/* The "more" menu: an anchor for the bootstrap dropdown carrying the pin's
   actions; the trigger wears the same quiet square the old icon row wore. */
.ins-pin-menu {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 2;
}

/* While its dropdown is open (class toggled by pin-board.js on bootstrap's
   dropdown events): the resting z-index of 2 caps the wrapper's stacking
   context, and the menu would paint UNDER the next card's controls, which sit
   at the same 2. */
.ins-pin-menu--open {
    z-index: 1050;
}

.ins-pin-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ins-muted);
    cursor: pointer;
    font-size: 0.8rem;
    line-height: 1;
    transition: color 0.15s ease, background 0.15s ease;
}

.ins-pin-more:hover,
.ins-pin-more[aria-expanded="true"] {
    color: var(--ins-primary);
    background: color-mix(in srgb, var(--ins-primary) 10%, var(--ins-surface));
}

/* The menu's remove entry wears the app-wide danger tint (trash = delete). */
.ins-menu .ins-pin-remove,
.ins-menu .ins-pin-remove .bi {
    color: var(--ins-danger);
}

.ins-menu .ins-pin-remove:hover,
.ins-menu .ins-pin-remove:focus {
    background: color-mix(in srgb, var(--ins-danger) 10%, var(--ins-surface));
    color: var(--ins-danger);
}

/* reserve room for the two controls so a long title doesn't run under them */
.ins-pin-item .ins-widget-head {
    padding-right: 4.75rem;
}

/* The chart/table switch is NOT a floating control here: on a pinned card it is a
   line in the "more" menu beside the download, which is where this card's actions
   already live (Vishal, 2026-07-31). That keeps the card at two icons - the state
   it was deliberately reduced to - and leaves the head's full width to titles,
   which on pins are user-authored, long, and squeezed by a multi-column board.
   The menu's own .ins-menu .dropdown-item rules style it; it needs nothing here. */

/* The pin's label, riding beside the card title - the filter's visual cue.
   Inline (not pushed right): the floating controls own the head's right edge. */
.ins-pin-label {
    flex: 0 0 auto;
    margin-left: 0.5rem;
    padding: 0.1rem 0.45rem;
    border: 1px solid var(--ins-border);
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--ins-muted);
    background: var(--ins-background);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 9rem;
}

/* A board column is routinely narrower than a KPI tile's 180px minimum (four
   columns on a laptop leaves ~135px). A bare minmax(180px, 1fr) track cannot
   shrink past that floor, so the tiles overflowed the column and slid under the
   neighbouring cards - reading as "the other boxes vanished". min() lets the track
   fall back to the column's own width, so the tiles simply stack. */
.ins-pin-item .ins-kpis {
    grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
    gap: 0.5rem;
}

/* A pinned KPI is wrapped in a card like every other pin (pin-board.js), so its
   tiles now sit ON a surface - and a tile carries the same surface, border and
   shadow a card does, which would read as cards stacked on a card. Flatten them to
   softly tinted cells: the accent icon still marks each metric, and the rounded
   card outside is the one frame. */
.ins-pin-item .ins-widget-body > .ins-kpis .ins-kpi {
    background: color-mix(in srgb, var(--ins-text) 3.5%, transparent);
    border: 0;
    box-shadow: none;
    padding: 0.6rem 0.7rem;
}

/* Spec details dialog */
.ins-pin-spec-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.35);
}

.ins-pin-spec {
    width: 100%;
    max-width: 560px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    background: var(--ins-surface, #fff);
    border: 1px solid var(--ins-border);
    border-radius: var(--ins-radius, 12px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.ins-pin-spec-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--ins-border);
}

.ins-pin-spec-title {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--ins-text);
}

.ins-pin-spec-close {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.8rem;
    height: 1.8rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--ins-muted);
    cursor: pointer;
}

.ins-pin-spec-close:hover {
    background: color-mix(in srgb, var(--ins-text) 8%, transparent);
    color: var(--ins-text);
}

.ins-pin-spec-body {
    padding: 0.25rem 1rem 1rem;
    overflow-y: auto;
}

.ins-pin-spec-row {
    padding: 0.6rem 0;
    border-bottom: 1px solid color-mix(in srgb, var(--ins-border) 60%, transparent);
}

.ins-pin-spec-row:last-child {
    border-bottom: none;
}

.ins-pin-spec-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ins-muted);
    margin-bottom: 0.25rem;
}

.ins-pin-spec-value {
    font-size: 0.9rem;
    color: var(--ins-text);
    word-break: break-word;
}

.ins-pin-spec-json {
    margin: 0;
    padding: 0.6rem 0.75rem;
    background: color-mix(in srgb, var(--ins-text) 6%, transparent);
    border-radius: 8px;
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--ins-text);
    overflow-x: auto;
    white-space: pre;
}

/* The unpin form lives inside the "more" menu now - a plain wrapper around its
   Remove entry (the entry itself is a themed dropdown-item, danger-tinted above). */
.ins-pin-unpin {
    margin: 0;
}

/* No min-height on the body: the loading placeholder below carries its own, and
   once real content lands the card must hug it - a floor here left short content
   (a lone KPI tile) with invisible dead space that read as a broken gap. */
.ins-pin-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 220px;
    color: var(--ins-muted);
    font-size: 0.9rem;
    border: 1px dashed var(--ins-border);
    border-radius: var(--ins-radius, 12px);
}

.ins-pin-loading .bi {
    animation: ins-pin-spin 1s linear infinite;
}

@keyframes ins-pin-spin {
    to {
        transform: rotate(360deg);
    }
}

.ins-ai-grid-meta {
    margin-top: 0.45rem;
    font-size: 0.8rem;
    color: var(--ins-muted);
}

/* Grid detail layout: one label/value card per record - the record dialog's
   field styling (.ins-doc-*) inside a bordered card, stacked per record. */
.ins-ai-detail-card {
    background: var(--ins-surface);
    border: 1px solid var(--ins-border);
    border-radius: var(--ins-border-radius);
    box-shadow: var(--ins-shadow-light);
    padding: 0.85rem 1rem 0.35rem;
    margin-bottom: 0.7rem;
}

/* One part of an answer entering the transcript. The answer arrives whole, but
   ai.js places its parts (headline, prose blocks, card rows, findings, chips)
   one by one so it reads as being written - this is each part's entrance. Only
   `from` is declared: the end state is the element's own, so the animation can
   never leave a lingering transform behind (the pin/download controls position
   against these cards). */
.ins-ai-enter {
    animation: ins-ai-enter 0.35s ease both;
}

@keyframes ins-ai-enter {
    from { opacity: 0; transform: translateY(8px); }
}

@media (prefers-reduced-motion: reduce) {
    .ins-ai-enter {
        animation: none;
    }
}

/* The row above the draft box, straight on the background: which data the
   conversation is about (icon + picker + live count) and the send-gesture hint.
   Pulling it out of the composer keeps the box itself a slim input strip. */
/* Right padding trails the transcript's scrollbar lane, so this row's controls
   stop where the message cards above them do. */
.ins-ai-context {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.3rem calc(0.7rem + var(--ins-scrollbar-inset)) 0.2rem 0;
}

.ins-ai-context-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

/* same accent-tinted square the widget heads use, so "this is the data" reads
   instantly next to the picker */
.ins-ai-collection-icon {
    width: 1.8rem;
    height: 1.8rem;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: color-mix(in srgb, var(--ins-primary) 12%, transparent);
    color: var(--ins-primary);
    flex-shrink: 0;
}

.ins-ai-collection-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--ins-text);
}

.ins-ai-count {
    font-size: 0.75rem;
    color: var(--ins-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.ins-ai-collection {
    max-width: 260px;
}

/* The enhanced picker must yield when the context row is pinched (a long
   collection name in a 340px embed panel). The .ins-select wrap is the
   toggle's sizing reference - an inline-block sized by the label - so IT is
   what shrinks and caps: a max-width on the toggle resolves against this
   same wrap and bounds nothing, which is how the white toggle used to paint
   right over the record count. With the wrap yielding, the toggle's
   width:100% follows and the label's own ellipsis takes it from there. */
.ins-ai-context .ins-select {
    min-width: 0;
    max-width: 100%;
}

.ins-ai-collection--single {
    display: none;
}

.ins-ai-hint {
    font-size: 0.75rem;
    color: var(--ins-muted);
}

.ins-ai-reset {
    white-space: nowrap;
    margin-right: var(--ins-scrollbar-inset);
}

/* The send hint and the AI-reliance info icon sit together at the right of the
   context row. */
.ins-ai-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

/* The reliance note (what the Terms' AI-content section points at) lives behind
   this info icon instead of a standing line under the composer - present, out of
   the way. */
.ins-ai-info {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ins-hint);
    cursor: help;
    font-size: 0.8rem;
    line-height: 1;
}

.ins-ai-info:hover,
.ins-ai-info:focus-visible {
    color: var(--ins-hint);
}

/* The bubble: revealed on hover and on focus (a click/tap focuses the button, so
   touch gets it too). Right-anchored so it never runs off the page edge; dark
   surface for contrast in either theme. */
.ins-ai-info-tip {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    width: max-content;
    max-width: 320px;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    background: var(--ins-text);
    color: var(--ins-surface, #fff);
    font-size: 0.7rem;
    line-height: 1.4;
    text-align: left;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    opacity: 0;
    visibility: hidden;
    transform: translateY(3px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
    z-index: 5;
    pointer-events: none;
}

.ins-ai-info:hover .ins-ai-info-tip,
.ins-ai-info:focus .ins-ai-info-tip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Phones: the hint costs a line it cannot spare, and Enter is not the gesture */
@media (max-width: 640px) {
    .ins-ai-hint {
        display: none;
    }

    /* No room to go half here - a chart at 55% of a phone is unreadable. */
    .ins-ai-widget--half {
        max-width: 100%;
    }

    /* The page head un-flexes: side by side, the New Conversation button was
       squeezing the title into a half-width column. The button shrinks to its
       icon in the top corner (the label span steps aside) and the title keeps
       clear of it. Tighter bottom margin: with only the title left, 0.8rem of
       air above the chat is air the transcript needs more. */
    .ins-ai-head {
        display: block;
        position: relative;
        margin-bottom: 0.4rem;
    }

    /* On this page the head never scrolls away (only the transcript scrolls),
       so every line of it is permanent chrome - and the tagline is the first
       thing a small screen can spare. The embed drops it at every width for
       the same reason (the host names the panel); this also settles their
       overlap: below 640px this rule now speaks for both surfaces, instead of
       the old two-line clamp re-revealing what the embed had hidden. */
    .ins-ai-head .ins-page-desc {
        display: none;
    }

    /* The title keeps clear of the floating corner button - 3.5rem clears the
       40px button plus the scrollbar-lane margin it keeps on lane-bearing
       (non-touch) narrow windows. The 40px line box does two jobs: it centers
       the one-line title against that button, and it keeps the head as tall
       as the button now that no description runs below it. */
    .ins-ai-head .ins-page-title {
        padding-right: 3.5rem;
        line-height: 40px;
    }

    .ins-ai-reset {
        position: absolute;
        top: 0;
        right: 0;
        width: 40px;
        padding: 0;
        justify-content: center;
    }

    .ins-ai-reset .ins-ai-reset-label {
        display: none;
    }

    /* A phone column IS the readable measure - the desktop caps that keep an
       answer off ultra-wide sprawl only waste width here. The user's own
       bubble keeps its 85%: the indent is what tells the two voices apart. */
    .ins-ai-headline,
    .ins-ai-assumptions {
        max-width: 100%;
    }

    .ins-ai-suggestions {
        gap: 0.45rem;
    }

    /* Context row: the collection field yields with an ellipsis instead of
       shoving the record count and info dot off the edge (the .ins-select
       wrap inside it yields too - the base .ins-ai-context .ins-select rule). */
    .ins-ai-context .ins-home-tool-field {
        min-width: 0;
        flex: 0 1 auto;
    }

    .ins-ai-collection {
        max-width: 100%;
    }

    /* Answer cards: desktop-scale padding spends too much of a 375px row on
       air (the .ins-admin-card reasoning). Chat cards only - the dashboards
       keep their scale. The head shorthand must restate the right-hand
       reserve for the floating controls, and the toggle-bearing variant
       must follow it to keep its wider one. */
    .ins-ai-widget .ins-widget-head {
        padding: 0.55rem 4.75rem 0.55rem 0.7rem;
    }

    .ins-ai-widget .ins-widget-head:has(~ .ins-ai-toggle) {
        padding-right: 6.75rem;
    }

    .ins-ai-widget .ins-widget-body {
        padding: 0.65rem 0.7rem;
    }

    .ins-ai-detail-card {
        padding: 0.7rem 0.75rem 0.25rem;
    }

    /* The viewport-locked chat shell renders the footer as permanent chrome -
       everywhere else it scrolls in at the document's end - and on a phone
       that line belongs to the transcript. The embed never renders it at all. */
    .ins-body--ai .ins-footer {
        display: none;
    }

    /* Home-indicator clearance when the app runs edge-to-edge (standalone /
       viewport-fit=cover); resolves to the same 0.5rem everywhere else.
       The right padding stops double-paying for a gutter: on lane-bearing
       (non-touch) narrow viewports - a desktop-hosted embed panel, a narrow
       desktop window - the transcript's reserved scrollbar lane + gap
       (--ins-scrollbar-inset, ~15px) sat ON TOP of the page's own 0.75rem,
       leaving cards 27px short of the right edge against 12px on the left.
       Folding the page padding away lets the lane itself be the right
       gutter (~15px, reading as symmetric, thumb riding the edge the way a
       native scrollbar would). On touch the inset is 0px, so this resolves
       right back to the 0.75rem the left side keeps - flush stays flush.
       The 0.75rem here IS .ins-main's narrow-screen gutter; keep in step. */
    .ins-main--ai {
        padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
        padding-right: max(0px, calc(0.75rem - var(--ins-scrollbar-inset)));
    }
}

/* ---------- Touch-first form controls ----------
   iOS Safari zooms the page in when a focused control's computed font-size is
   under 16px - and never zooms back out on its own. That "everything is
   suddenly cropped" jolt was most of what made the chat feel broken on a
   phone: the composer sits at 14.7px. Touch-first devices get 16px controls
   across the app; desktop keeps its compact sizes, where focus never zooms.
   (Buttons and the enhanced select TOGGLES are exempt - zoom only bites
   text-entry controls and native selects.) */
@media (hover: none) and (pointer: coarse) {
    .ins-date-field input[type="date"],
    .ins-date-field input[type="number"],
    .ins-date-field input.ins-date-input,
    .ins-date-field select,
    .ins-flow-level {
        font-size: 1rem;
    }
}
