@charset "UTF-8";
/* LipiCore-Engine API - the app's complete stylesheet, built on the Insights design
   system vocabulary (the --ins-* variables and ins-* shell classes in the core
   section below, extracted from Insights' insights.css) so the product family
   looks and themes identically. Contract: every color derives from the --ins-*
   theme variables via color-mix(in srgb, ...) - no literal colors - so
   branding/theme.json restyles the whole app. The later sections restyle the
   API's legacy class vocabulary: much of that markup is emitted by inline page
   scripts, so the names must not change - only the look. JS-toggled visibility
   defaults (display: none and friends) are preserved as-is. */

/* ================= Design system core (from Insights' insights.css) =================
   Keep this section in sync with Insights when the design system evolves. The
   injected theme <style> block overrides these :root defaults per deployment.

   The three brand colors stay in their own lanes - usually the three colors of
   the customer's logo - so all three can be fully saturated without any of them
   ending up as body text:
     primary   - actions: links, buttons, active/selected state, focus rings
     secondary - the brand's companion: the product word in the header, and the
                 headings that title a block (card, sidebar group, facet group,
                 table header band). Labels naming a field/column/row stay muted.
     hint      - guidance: explanatory notes, drop zones, help icons. Used on
                 tints, borders and icons ONLY, never as text. */
:root {
    --ins-primary: #5E8FD3;
    /* Complementary brand color for secondary emphasis, and the warm "hint"
       color for guidance/helper affordances - both from theme.json's colors */
    --ins-secondary: #5FB89B;
    --ins-hint: #E39A4E;

    --ins-danger: #d64550;
    --ins-warning: #f59e0b;
    --ins-success: #2f9e5f;

    --ins-background: #f4f5fb;
    --ins-surface: #ffffff;
    --ins-header-bg: #ffffff;
    --ins-on-color: #ffffff;

    --ins-text: #1f2333;
    --ins-muted: #6b7c92;

    --ins-border: #e7eaf3;
    --ins-shadow: #0f172a;

    /* Accent colors (card tints, highlights) - overridable via the theme's "accents" list */
    --ins-accent-1: #5E8FD3;
    --ins-accent-2: #5FB89B;
    --ins-accent-3: #D9AE45;
    --ins-accent-4: #D9755E;
    --ins-accent-5: #866CCB;
    --ins-accent-6: #63B9E5;
    --ins-accent-7: #E287B5;
    --ins-accent-8: #8FAA4D;
    --ins-accent-9: #8E8E8E;
    --ins-accent-10: #E39A4E;

    /* Two shadow depths from --ins-shadow: the resting shadow cards use, and
       the deeper one elevated surfaces add on top. */
    --ins-shadow-light: 0 1px 3px color-mix(in srgb, var(--ins-shadow) 6%, transparent);
    --ins-shadow-strong: color-mix(in srgb, var(--ins-shadow) 25%, transparent);

    --ins-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;

    --ins-control-height: 40px;
    --ins-radius-control: 10px;
    --ins-border-radius: 0.85rem;
    --ins-radius: 12px;

    /* Not a theme knob: the header's floor height, shared with everything that
       sits underneath it (fixed sidebars, sticky toolbars). */
    --ins-header-min-height: 55px;
}

body.ins-body {
    background: var(--ins-background);
    color: var(--ins-text);
    font-family: var(--ins-font-family);
    /* header / main / footer as a column, so the footer never floats mid-screen */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ----- App header (brand bar) ----- */
.ins-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--ins-header-bg);
    border-bottom: 1px solid var(--ins-border);
    padding: 0.55rem 1.25rem;
    min-height: var(--ins-header-min-height);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* The brand is the header's elastic element: any logo and any names must yield
   rather than push controls off the edge, so it truncates first. */
.ins-brand {
    display: flex;
    align-items: center;
    min-width: 0;
    overflow: hidden;
    text-decoration: none;
    color: var(--ins-text);
}

.ins-brand-company,
.ins-brand-product {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ins-header-logo {
    height: 28px;
    width: auto;
}

.ins-separator-left {
    margin-left: 0.5rem;
    padding-left: 0.75rem;
    border-left: 1px solid var(--ins-border);
}

.ins-brand-company {
    font-weight: 700;
    font-size: 1rem;
}

/* The product word beside the brand name carries the companion accent, matching
   how Insights names itself - secondary is the brand's second color, not an action */
.ins-brand-product {
    color: var(--ins-secondary);
    font-weight: 700;
    font-size: 1rem;
}

/* ----- Page head ----- */
.ins-page-head {
    margin-bottom: 0.8rem;
}

.ins-page-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.1rem;
}

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

.ins-page-desc {
    color: var(--ins-muted);
    font-size: 0.86rem;
    margin-bottom: 0;
}

/* ----- Footer ----- */
.ins-footer {
    padding: 0 0 0.5rem 0;
    color: var(--ins-muted);
    text-align: center;
    font-size: 0.7rem;
}

/* ----- Buttons (shared base + the two variants) ----- */
.ins-btn-primary,
.ins-btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    height: var(--ins-control-height);
    padding: 0 1.1rem;
    border: 0;
    border-radius: var(--ins-radius-control);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: filter 0.15s ease, box-shadow 0.15s ease;
}

.ins-btn-primary {
    background: var(--ins-primary);
    color: var(--ins-on-color);
}

.ins-btn-primary:hover {
    filter: brightness(1.07);
    color: var(--ins-on-color);
    box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--ins-primary) 65%, transparent);
}

/* Quiet sibling of the primary button - actions that should not compete */
.ins-btn-ghost {
    border: 1px solid var(--ins-border);
    background: var(--ins-surface);
    color: var(--ins-text);
    transition: border-color 0.15s ease, color 0.15s ease;
}

.ins-btn-ghost:hover {
    border-color: var(--ins-primary);
    color: var(--ins-primary);
}

/* ----- Card tint slots (set --card-accent; doubled class beats component defaults) ----- */
.ins-tint-1.ins-tint-1 { --card-accent: var(--ins-accent-1); }
.ins-tint-2.ins-tint-2 { --card-accent: var(--ins-accent-2); }
.ins-tint-3.ins-tint-3 { --card-accent: var(--ins-accent-3); }
.ins-tint-4.ins-tint-4 { --card-accent: var(--ins-accent-4); }
.ins-tint-5.ins-tint-5 { --card-accent: var(--ins-accent-5); }
.ins-tint-6.ins-tint-6 { --card-accent: var(--ins-accent-6); }
.ins-tint-7.ins-tint-7 { --card-accent: var(--ins-accent-7); }
.ins-tint-8.ins-tint-8 { --card-accent: var(--ins-accent-8); }
.ins-tint-9.ins-tint-9 { --card-accent: var(--ins-accent-9); }
.ins-tint-10.ins-tint-10 { --card-accent: var(--ins-accent-10); }

/* ================= API page styles ================= */

/* ---------- Utilities the templates rely on (not in Bootstrap) ---------- */
.gap-1 {
    /* legacy value predates Bootstrap; templates lay out on 0.8rem gaps */
    gap: 0.8rem !important;
}

.w-20 {
    width: 20%;
}

.w-30 {
    width: 28.5%;
}

/* ---------- Base ---------- */
a {
    color: var(--ins-primary);
    text-decoration: none;
}

a:hover {
    color: color-mix(in srgb, var(--ins-primary) 75%, var(--ins-text));
}

h1, h2, h3, h4 {
    color: var(--ins-text);
}

.title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--ins-text);
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--ins-text) 18%, transparent);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--ins-text) 32%, transparent);
}

/* ---------- Page scaffold ---------- */
.section-80 {
    margin: 1.5rem auto;
    width: min(1200px, 92%);
    flex: 1;
}

.page-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.page-header .title {
    margin: 0;
}

/* Eyebrow line above a page title - the Insights uppercase micro-label motif */
.page-eyebrow {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ins-muted);
    margin-bottom: 0.1rem;
}

/* ---------- App shell: fixed sidebar + main content ---------- */
.sidebar {
    width: 300px;
    background: var(--ins-surface);
    color: var(--ins-text);
    padding: 0.85rem 0.95rem;
    position: fixed;
    left: 0;
    top: var(--ins-header-min-height);
    height: calc(100vh - var(--ins-header-min-height));
    overflow-y: auto;
    border-right: 1px solid var(--ins-border);
    display: flex;
    flex-direction: column;
}

.sidebar h2 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--ins-text);
    margin: 0 0 0.6rem;
    line-height: 1.2;
}

.sidebar-settings {
    margin-top: 0.9rem;
    border-top: 1px solid var(--ins-border);
    padding-top: 0.6rem;
}

.sidebar-logo {
    padding-bottom: 0.4rem;
    display: flex;
    justify-content: left;
    align-items: center;
    width: 100%;
}

.main-content {
    margin-left: 300px;
    flex: 1;
    min-height: calc(100vh - var(--ins-header-min-height));
    background: var(--ins-background);
}

/* Sticky toolbar row at the top of a shell page; sits just under the app header */
.common-settings {
    padding: 0.75rem 0.95rem;
    border-bottom: 1px solid var(--ins-border);
    position: sticky;
    z-index: 90;
}

/* Viewer pages stack two .common-settings blocks (title row, then the query form).
   Two stickies at the same offset overlap on scroll - let the title row scroll away
   and keep only the form bar pinned. */
.common-settings.viewer-header {
    position: static;
}

.panels-container {
    display: flex;
    gap: 0.6rem;
    overflow: hidden;
    width: 100%;
    padding: 0.6rem 0.75rem 0.75rem;
}

.request-panel,
.response-panel {
    flex: 1;
    /*background: var(--ins-surface);*/
    /*border: 1px solid var(--ins-border);*/
    /*border-radius: var(--ins-border-radius);*/
    /*box-shadow: var(--ins-shadow-light);*/
    /*padding: 0.75rem 0.85rem;*/
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.request-panel {
    max-width: 45%;
}

.response-panel {
    max-width: 55%;
}

.panel-container {
    position: relative;
    margin-right: 0;
}

/* ---------- Endpoint navigation (panel sidebar) ---------- */
.endpoint-group {
    margin-bottom: 0.7rem;
}

.endpoint-group.collapsed .endpoint-item {
    display: none;
}

.sidebar-settings .endpoint-group {
    margin-bottom: 0;
}

.endpoint-header {
    cursor: pointer;
    display: flex;
    justify-content: start;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    /* A heading that titles a block - secondary lane (see .section-title) */
    color: color-mix(in srgb, var(--ins-secondary) 40%, var(--ins-text));
    padding: 0.3rem 0.2rem;
    user-select: none;
    transition: background 0.12s ease;
}

.endpoint-header::before {
    content: "›";
    font-size: 0.85rem;
    line-height: 1;
    transition: transform 0.15s ease;
}

.endpoint-group:not(.collapsed) .endpoint-header::before {
    transform: rotate(90deg);
}

.endpoint-header:hover {
    /* The heading keeps its color (a lighter mix would lighten a pale brand hue
       below the contrast floor) and the hover reads through a tint instead -
       same affordance as the endpoint items below it. */
    background: color-mix(in srgb, var(--ins-secondary) 8%, transparent);
    border-radius: 8px;
}

.endpoint-item {
    cursor: pointer;
    border-radius: 8px;
    margin: 0.1rem 0 0.1rem 0.5rem;
    padding: 0.3rem 0.5rem;
    color: var(--ins-text);
    font-size: 0.85rem;
    font-weight: 400;
    line-height: 1.35;
    transition: background 0.12s ease, color 0.12s ease;
}

.endpoint-item:hover {
    background: color-mix(in srgb, var(--ins-primary) 8%, transparent);
    color: var(--ins-primary);
}

.endpoint-item:focus {
    outline: none;
}

.endpoint-item.active {
    background: color-mix(in srgb, var(--ins-primary) 12%, transparent);
    color: var(--ins-primary);
    font-weight: 400;
}

/* ---------- Form elements ---------- */
.label,
.form-label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ins-muted);
}

.request-panel .label,
.response-panel .label {
    font-size: 0.7rem;
    font-weight: 700;
}

.form-control,
.token-input,
.collection-input,
.request-body,
.collection-select,
.response-body {
    width: 100%;
    padding: 0 0.7rem;
    border: 1px solid var(--ins-border);
    border-radius: var(--ins-radius-control);
    font-size: 0.85rem;
    height: var(--ins-control-height);
    min-height: var(--ins-control-height);
    box-sizing: border-box;
    background-color: var(--ins-surface);
    color: var(--ins-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.collection-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2371869d' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px 12px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
}

input[type="date"].collection-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371869d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3e%3cline x1='16' y1='2' x2='16' y2='6'/%3e%3cline x1='8' y1='2' x2='8' y2='6'/%3e%3cline x1='3' y1='10' x2='21' y2='10'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 14px 14px;
    -webkit-appearance: none;
}

input[type="date"].collection-select::-webkit-calendar-picker-indicator {
    opacity: 0;
    cursor: pointer;
}

input[type="number"].collection-select {
    background-image: none;
    -webkit-appearance: none;
    -moz-appearance: textfield;
}

input[type="number"].collection-select::-webkit-inner-spin-button,
input[type="number"].collection-select::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.collection-select:focus,
.token-input:focus,
.collection-input:focus,
.form-control:focus,
.form-control:focus-visible,
.request-body:focus,
textarea:focus {
    color: var(--ins-text);
    background-color: var(--ins-surface);
    border-color: color-mix(in srgb, var(--ins-primary) 45%, var(--ins-border));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ins-primary) 12%, transparent);
    outline: 0;
}

.request-body,
.response-body {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.75rem;
    padding: 0.55rem 0.7rem;
    height: auto;
    resize: vertical;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    overflow-x: hidden;
    min-height: calc(100vh - 320px);
}

.response-body {
    resize: none;
    overflow-y: auto;
    flex: 1;
}

.response-body:empty::before {
    content: "After sending request, response will appear here.";
    color: var(--ins-muted);
    font-family: var(--ins-font-family);
}

.form-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.75rem 0.85rem;
}

.form-layout {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.form-field {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.form-field-sm {
    display: flex;
    flex-direction: column;
    min-width: 120px;
}

.form-field-md {
    display: flex;
    flex-direction: column;
    min-width: 180px;
}

.form-field-lg {
    display: flex;
    flex-direction: column;
    min-width: 200px;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    /* bottom-align the buttons with the labelled 40px controls beside them */
    margin-top: 19px;
}

.form-block {
    background: var(--ins-surface);
    border: 1px solid var(--ins-border);
    border-radius: var(--ins-border-radius);
    box-shadow: var(--ins-shadow-light);
    padding: 1.1rem 1.25rem;
    margin: 1rem;
}

/* ---------- Buttons ---------- */
.submit-btn,
.file-upload-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    height: var(--ins-control-height);
    padding: 0 1.1rem;
    border: 0;
    border-radius: var(--ins-radius-control);
    font-size: 0.85rem;
    font-weight: 600;
    background: var(--ins-primary);
    color: var(--ins-on-color);
    cursor: pointer;
    flex-shrink: 0;
    width: fit-content;
    transition: filter 0.15s ease, box-shadow 0.15s ease;
}

.submit-btn:hover,
.file-upload-button:hover {
    filter: brightness(1.07);
    color: var(--ins-on-color);
    box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--ins-primary) 65%, transparent);
}

.btn-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ins-primary);
    padding: 0.35rem 0.6rem;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.12s ease;
}

.btn-link:hover {
    color: var(--ins-primary);
    background: color-mix(in srgb, var(--ins-primary) 8%, transparent);
}

/* ---------- Method badge (JS-emitted: method-badge method-<verb>) ---------- */
.method-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: color-mix(in srgb, var(--ins-primary) 12%, var(--ins-surface));
    color: color-mix(in srgb, var(--ins-primary) 70%, var(--ins-text));
}

.method-get {
    background: color-mix(in srgb, var(--ins-success) 12%, var(--ins-surface));
    color: color-mix(in srgb, var(--ins-success) 70%, var(--ins-text));
}

.method-post {
    background: color-mix(in srgb, var(--ins-primary) 12%, var(--ins-surface));
    color: color-mix(in srgb, var(--ins-primary) 70%, var(--ins-text));
}

.method-put {
    background: color-mix(in srgb, var(--ins-warning) 15%, var(--ins-surface));
    color: color-mix(in srgb, var(--ins-warning) 60%, var(--ins-text));
}

.method-delete {
    background: color-mix(in srgb, var(--ins-danger) 12%, var(--ins-surface));
    color: color-mix(in srgb, var(--ins-danger) 70%, var(--ins-text));
}

/* ---------- Messages & alerts ---------- */
.validation-error {
    border-color: var(--ins-danger) !important;
}

.error-message {
    color: var(--ins-danger);
    padding-left: 1.25rem;
    padding-top: 0.6rem;
    display: none;
    font-size: 0.85rem;
    text-align: center;
}

.copy-success {
    font-size: 0.75rem;
    color: var(--ins-success);
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.no-token-message {
    display: none;
    color: var(--ins-danger);
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.6rem;
}

.no-data-message {
    text-align: center;
    color: var(--ins-muted);
    padding: 0 0 0.9rem 0;
    font-size: 0.85rem;
}

.no-data-selected-message {
    display: none;
}

/* ---------- Token management ---------- */
.token-management {
    display: none;
    margin: 1rem;
    background: var(--ins-surface);
    border: 1px solid var(--ins-border);
    border-radius: var(--ins-border-radius);
    box-shadow: var(--ins-shadow-light);
    padding: 1.1rem 1.25rem;
}

.token-management.visible {
    display: block;
}

/* ---------- Collections accordion (config page) ---------- */
.collection {
    border-radius: var(--ins-border-radius);
    margin-bottom: 0.9rem;
}

.collection-header {
    color: var(--ins-text);
    font-size: 0.95rem;
    font-weight: 700;
    padding: 0.85rem 1.1rem;
    cursor: pointer;
    border-radius: var(--ins-border-radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--ins-border);
    background: var(--ins-surface);
    box-shadow: var(--ins-shadow-light);
    transition: border-color 0.15s ease, background 0.15s ease;
}

.collection-header:hover {
    border-color: color-mix(in srgb, var(--ins-primary) 45%, var(--ins-border));
    background: color-mix(in srgb, var(--ins-primary) 4%, var(--ins-surface));
}

.collection-header span {
    text-transform: none;
}

/* The one open block among many closed ones - outlined in secondary, and the
   outline continues into .mappings so header and body read as one region */
.collection-header.active {
    border-radius: var(--ins-border-radius) var(--ins-border-radius) 0 0;
    border-color: color-mix(in srgb, var(--ins-secondary) 35%, var(--ins-border));
}

.toggle-icon {
    font-size: 1.1rem;
    line-height: 1;
    transition: transform 0.2s ease;
}

.toggle-icon.expand::before {
    content: "›";
    color: var(--ins-muted);
    display: inline-block;
}

.toggle-icon.collapse::before {
    content: "›";
    color: var(--ins-primary);
    transform: rotate(90deg);
    display: inline-block;
}

.toggle-icon.expanded {
    color: var(--ins-primary);
    font-weight: bold;
    transform: rotate(180deg);
}

.mappings {
    padding: 1.1rem 1.25rem 1.25rem;
    display: none;
    border: 1px solid color-mix(in srgb, var(--ins-secondary) 35%, var(--ins-border));
    border-radius: 0 0 var(--ins-border-radius) var(--ins-border-radius);
    border-top: 0;
    background: var(--ins-surface);
}

.no-mappings {
    padding: 1.25rem;
    color: var(--ins-muted);
    text-align: center;
    font-style: italic;
    font-size: 0.85rem;
    background: color-mix(in srgb, var(--ins-text) 3%, var(--ins-surface));
    border-radius: calc(var(--ins-border-radius) / 1.6);
    margin: 1rem 0;
}

/* ---------- Cards ---------- */
.cards-container {
    display: flex;
    gap: 0.9rem;
    align-items: flex-start;
}

.cards-column {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    flex: 1;
    min-width: 0;
}

.info-section {
    background: var(--ins-surface);
    border: 1px solid var(--ins-border);
    border-radius: var(--ins-border-radius);
    box-shadow: var(--ins-shadow-light);
    padding: 1rem 1rem;
    width: 100%;
}

/* Headings that title a block (card titles, sidebar group titles) carry the
   secondary lane; labels that merely name a field, column or row stay muted. */
.section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ins-secondary);
    margin: 0 0 0.9rem;
    padding: 0;
    display: inline-block;
}

.section-sub-title {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: color-mix(in srgb, var(--ins-secondary) 40%, var(--ins-text));
    margin: 0 0 0.7rem;
    padding: 0;
    display: inline-block;
}

.info-content {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--ins-border);
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 600;
    color: var(--ins-muted);
    font-size: 0.8rem;
    flex: 0 0 40%;
}

.info-value {
    color: var(--ins-text);
    font-size: 0.84rem;
    text-align: right;
    flex: 1;
    word-break: break-word;
}

.info-value a {
    color: var(--ins-primary);
    text-decoration: none;
}

.info-value a:hover {
    text-decoration: underline;
}

/* Full-row link rows in the list cards (panels / data viewers): the whole row is
   the click target, and the go-arrow nudges right on hover like the Insights
   catalog cards. Composes with .info-item for the row layout and separator. */
.link-row {
    color: var(--ins-primary);
    font-weight: 600;
    font-size: 0.84rem;
    text-decoration: none;
    padding: 0.5rem 0.5rem;
    transition: background 0.12s ease;
}

.link-row:hover {
    color: var(--ins-primary);
    background: color-mix(in srgb, var(--ins-primary) 6%, transparent);
}

.link-row-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}

/* Optional right-side detail on a link row (e.g. the Reference card's /docs
   paths), sitting muted next to the go-arrow */
.link-row-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--ins-muted);
    font-size: 0.75rem;
    font-weight: 500;
}

.link-row-go {
    color: var(--ins-muted);
    transition: transform 0.15s ease, color 0.15s ease;
}

.link-row:hover .link-row-go {
    color: var(--ins-primary);
    transform: translateX(3px);
}

/* Explanatory asides exist only to tell you what the list below them is - the
   hint lane. Hint colors the surface and its edge only; the prose stays muted so
   a fully saturated brand hue can never become body text. */
.info-note {
    padding: 0.75rem 0.95rem;
    border: 1px solid color-mix(in srgb, var(--ins-hint) 25%, var(--ins-border));
    border-radius: var(--ins-border-radius);
    background: color-mix(in srgb, var(--ins-hint) 7%, var(--ins-surface));
    font-size: 0.8rem;
    color: var(--ins-muted);
    line-height: 1.6;
}

.info-note strong {
    color: var(--ins-text);
    font-weight: 600;
}

@media (max-width: 768px) {
    .cards-container {
        flex-direction: column;
    }

    .cards-column {
        width: 100%;
    }
}

/* ---------- Tables (config page renders bare <table>) ---------- */
table {
    margin-top: 0;
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--ins-border);
}

table th {
    /* the band that titles the columns - tinted, but the label text stays muted
       so 0.7rem uppercase keeps its contrast on any tenant hue */
    background: color-mix(in srgb, var(--ins-secondary) 8%, var(--ins-surface));
    color: var(--ins-muted);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

table td {
    font-size: 0.84rem;
    color: var(--ins-text);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* ---------- File upload / import ---------- */
/* The drop zone is an instruction ("drop a file here"), so the zone itself is
   hint while the button inside it stays primary - guidance never competes with
   the control it contains */
.file-upload-container {
    border: 2px dashed color-mix(in srgb, var(--ins-hint) 40%, var(--ins-border));
    border-radius: var(--ins-border-radius);
    padding: 1.25rem;
    text-align: center;
    background: color-mix(in srgb, var(--ins-hint) 5%, var(--ins-surface));
    margin-bottom: 0.9rem;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.file-upload-container:hover,
.file-upload-container.drag-over {
    /* deepen the same hue so the zone never changes identity mid-gesture */
    border-color: color-mix(in srgb, var(--ins-hint) 70%, var(--ins-border));
    background: color-mix(in srgb, var(--ins-hint) 10%, var(--ins-surface));
}

.file-input {
    display: none;
}

.file-selected {
    margin-top: 0.6rem;
    padding: 0.6rem 0.75rem;
    background: var(--ins-surface);
    border: 1px solid var(--ins-border);
    border-radius: var(--ins-radius-control);
    color: var(--ins-text);
    font-size: 0.85rem;
}

.file-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.remove-file {
    background: color-mix(in srgb, var(--ins-danger) 10%, var(--ins-surface));
    color: var(--ins-danger);
    border: none;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    transition: background 0.15s ease;
}

.remove-file:hover {
    background: color-mix(in srgb, var(--ins-danger) 18%, var(--ins-surface));
}

.csv-upload-section {
    display: none;
}

.form-group.file-upload-group {
    margin-bottom: 0.9rem;
}

/* Import panel notes (moved here from panel-collection's inline style block) */
.import-data-panel .import-muted {
    color: var(--ins-muted);
    font-size: 0.75rem;
    font-weight: normal;
}

.import-data-panel .import-step {
    color: var(--ins-text);
    margin-top: 10px;
}

.import-data-panel .import-step:first-of-type {
    margin-top: 0;
}

.import-data-panel summary {
    color: var(--ins-text);
    font-size: 0.8rem;
    cursor: pointer;
    user-select: none;
}

/* ---------- JSON viewer (all JS-emitted; names are load-bearing) ---------- */
.json {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    overflow-x: hidden;
}

.json pre {
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    overflow-x: hidden !important;
}

.json-viewer {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.75rem;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    overflow-x: hidden;
    overflow-y: auto;
    min-height: calc(100vh - 320px);
    border: 1px solid var(--ins-border);
    border-radius: var(--ins-radius-control);
    background: var(--ins-surface);
    padding: 0.55rem 0.7rem;
}

.json-object,
.json-array {
    margin: 0;
    padding: 0;
}

.json-key {
    color: var(--ins-primary);
    font-weight: 600;
}

.json-string {
    color: color-mix(in srgb, var(--ins-success) 75%, var(--ins-text));
}

.json-number {
    color: color-mix(in srgb, var(--ins-accent-5) 75%, var(--ins-text));
}

.json-boolean {
    color: color-mix(in srgb, var(--ins-warning) 60%, var(--ins-text));
}

.json-null {
    color: var(--ins-muted);
}

.json-toggle {
    cursor: pointer;
    user-select: none;
    margin-right: 5px;
    display: inline-block;
    width: 16px;
    text-align: center;
    color: var(--ins-muted);
    font-weight: bold;
}

.json-toggle:hover {
    color: var(--ins-text);
}

.json-toggle.collapsed::before {
    content: '+';
}

.json-toggle.expanded::before {
    content: '−';
}

.json-content {
    margin-left: 20px;
    border-left: 1px solid var(--ins-border);
    padding-left: 10px;
}

.json-content.collapsed {
    display: none;
}

.json-property {
    margin: 2px 0;
}

.json-comma {
    color: var(--ins-muted);
}

.json-bracket,
.json-brace {
    color: color-mix(in srgb, var(--ins-text) 70%, var(--ins-muted));
    font-weight: bold;
}

.json-editable {
    background: transparent;
    border: 1px solid transparent;
    padding: 2px 4px;
    border-radius: 4px;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    min-width: 50px;
}

.json-editable:hover {
    border-color: var(--ins-border);
    background: color-mix(in srgb, var(--ins-text) 3%, var(--ins-surface));
}

.json-editable:focus {
    outline: none;
    border-color: color-mix(in srgb, var(--ins-primary) 45%, var(--ins-border));
    background: var(--ins-surface);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ins-primary) 12%, transparent);
}

.json-value-editable,
.json-key-editable {
    cursor: text;
}

/* ---------- Link cards (panel/viewer list pages) ---------- */
.icon-muted {
    color: var(--ins-muted);
}

.panel-collection {
    color: var(--ins-primary);
    text-decoration: none;
    font-weight: 600;
}

.panel-collection:hover {
    color: color-mix(in srgb, var(--ins-primary) 75%, var(--ins-text));
    text-decoration: underline;
}

/* ---------- Error page ---------- */
.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    width: 100%;
    text-align: center;
    padding: 2.5rem 1.25rem;
    flex: 1;
}

.error-page-code {
    font-size: 6rem;
    font-weight: 800;
    color: var(--ins-danger);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.error-page-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--ins-text);
    margin-bottom: 0.6rem;
}

.error-page-message {
    font-size: 0.86rem;
    color: var(--ins-muted);
    max-width: 420px;
    line-height: 1.6;
    margin-bottom: 1.4rem;
}

.error-page-details {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.75rem;
    color: var(--ins-muted);
    background: var(--ins-surface);
    border: 1px solid var(--ins-border);
    border-radius: calc(var(--ins-border-radius) / 1.6);
    padding: 0.6rem 0.95rem;
    margin-bottom: 1.4rem;
    max-width: 420px;
    text-align: left;
}

.error-page-back,
.error-page-home {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    height: var(--ins-control-height);
    padding: 0 1.1rem;
    border-radius: var(--ins-radius-control);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: filter 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.error-page-back {
    background: var(--ins-surface);
    color: var(--ins-text);
    border: 1px solid var(--ins-border);
}

.error-page-back:hover {
    border-color: var(--ins-primary);
    color: var(--ins-primary);
}

.error-page-home {
    background: var(--ins-primary);
    color: var(--ins-on-color);
    border: 0;
}

.error-page-home:hover {
    filter: brightness(1.07);
    color: var(--ins-on-color);
    box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--ins-primary) 65%, transparent);
}

/* ---------- Data viewer: field list sidebar ---------- */
.sidebar-section {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.sidebar-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: color-mix(in srgb, var(--ins-secondary) 40%, var(--ins-text));
    padding-bottom: 4px;
}

.fields-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.select-all-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--ins-border);
}

.select-all-container a {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ins-primary);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: background 0.12s ease;
}

.select-all-container a:hover {
    background: color-mix(in srgb, var(--ins-primary) 8%, transparent);
    color: var(--ins-primary);
}

.field-checkbox {
    display: flex;
    align-items: center;
    padding: 0.25rem 0;
    cursor: pointer;
}

.field-checkbox label {
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--ins-text);
}

.field-checkbox .field-type {
    font-size: 0.7rem;
    color: var(--ins-muted);
    margin-left: 6px;
}

/* Themed checkbox for the JS-emitted inputs (same drawing as .ins-checkbox: the
   tick stays --ins-on-color on any theme hue, unlike native accent-color) */
.field-checkbox input[type="checkbox"],
.facet-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin: 0 8px 0 0;
    border: 1.5px solid var(--ins-border);
    border-radius: 4px;
    background: var(--ins-surface);
    cursor: pointer;
    position: relative;
}

.facet-item input[type="checkbox"] {
    margin-right: 0;
}

.field-checkbox input[type="checkbox"]:checked,
.facet-item input[type="checkbox"]:checked {
    background: var(--ins-primary);
    border-color: var(--ins-primary);
}

.field-checkbox input[type="checkbox"]:checked::after,
.facet-item input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 4.5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid var(--ins-on-color);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.field-checkbox input[type="checkbox"]:focus-visible,
.facet-item input[type="checkbox"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ins-primary) 25%, transparent);
}

/* ---------- Data viewer: table ---------- */
.data-table-container {
    overflow-x: auto;
    overflow-y: visible;
    margin-top: 0.5rem;
    width: 100%;
    position: relative;
    -webkit-overflow-scrolling: touch;
    background: var(--ins-surface);
    border: 1px solid var(--ins-border);
    border-radius: calc(var(--ins-border-radius) / 1.6);
}

.data-table {
    width: 100%;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    table-layout: fixed;
    background: var(--ins-surface);
}

.data-table th,
.data-table td {
    padding: 0.55rem 0.75rem;
    text-align: left;
    vertical-align: top;
    min-width: 120px;
    max-width: 400px;
    overflow: hidden;
    border-bottom: 1px solid var(--ins-border);
}

.data-table th.record-number-column,
.data-table td.record-number-column {
    width: 50px !important;
    min-width: 55px !important;
    max-width: 60px !important;
    padding: 0.55rem 4px !important;
    text-align: center !important;
    box-sizing: border-box !important;
}

.data-table td {
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    position: relative;
    color: var(--ins-text);
}

.data-table td .cell-content {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: calc(1.5em * 4);
    line-height: 1.5;
    word-break: break-word;
}

.data-table th {
    /* mixed against --ins-surface, never transparent: this header is sticky and
       rows must not show through as they scroll under it */
    background: var(--ins-background);
    color: var(--ins-muted);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
}

.data-table tbody tr {
    transition: background-color 0.12s ease;
}

.data-table tbody tr:nth-child(even) {
    background: color-mix(in srgb, var(--ins-text) 2%, var(--ins-surface));
}

.data-table tbody tr:hover,
.data-table tbody tr:nth-child(even):hover {
    background: color-mix(in srgb, var(--ins-primary) 5%, var(--ins-surface));
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-content {
    position: relative;
    min-height: 400px;
    padding: 0.5rem 1rem 0.5rem 1rem;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}

/* ---------- Data viewer: pagination ---------- */
.pagination-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.6rem;
}

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

.pagination-controls {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 0.6rem;
    border: 1px solid var(--ins-border);
    border-radius: 8px;
    background: var(--ins-surface);
    color: var(--ins-text);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 400;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.pagination-btn:hover:not(:disabled) {
    border-color: var(--ins-primary);
    color: var(--ins-primary);
}

.pagination-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.pagination-btn.active {
    background: var(--ins-primary);
    color: var(--ins-on-color);
    border-color: var(--ins-primary);
}

.page-size-select {
    height: 32px;
    padding: 0 0.5rem;
    border: 1px solid var(--ins-border);
    border-radius: 8px;
    background: var(--ins-surface);
    color: var(--ins-text);
    font-size: 0.8rem;
    cursor: pointer;
}

/* Compact ghost buttons inside the pagination bar (e.g. "Copy as CSV") so they
   line up with the 32px pager controls instead of the 40px default */
.pagination-info .ins-btn-ghost,
.pagination-container .ins-btn-ghost {
    height: 32px;
    padding: 0 0.7rem;
    font-size: 0.75rem;
}

/* Muted "to" separator between from/to range filter inputs */
.range-sep {
    color: var(--ins-muted);
    font-size: 0.75rem;
}

/* ---------- Data viewer: loading ---------- */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: color-mix(in srgb, var(--ins-background) 75%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--ins-border);
    border-top-color: var(--ins-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ---------- Data viewer: wide sidebar variant ---------- */
.data-viewer-sidebar {
    width: 380px;
    min-width: 380px;
    padding: 0.85rem 1.1rem 0.5rem;
    font-size: 0.9rem;
}

.data-viewer-main-content {
    margin-left: 380px;
    width: calc(100% - 380px);
    max-width: calc(100% - 380px);
    overflow-x: hidden;
}

.data-viewer-sidebar .fields-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
    min-height: 0;
}

.data-viewer-sidebar .field-checkbox {
    padding: 0.2rem 0;
}

.data-viewer-sidebar .field-checkbox label {
    font-size: 0.82rem;
    flex: 1;
}

/* ---------- Tooltip ---------- */
/* The (i) affordance only ever explains, so it wears the hint lane rather than
   primary, which would promise an action it never performs. An icon needs 3:1,
   not 4.5:1, so a saturated hint is safe here where hint-as-text would not be. */
.tooltip-icon {
    cursor: pointer;
    color: color-mix(in srgb, var(--ins-hint) 60%, var(--ins-muted));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    transition: color 0.15s ease;
    position: relative;
    margin-left: 4px;
    vertical-align: middle;
}

.tooltip-icon svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.tooltip-icon:hover {
    color: color-mix(in srgb, var(--ins-hint) 70%, var(--ins-text));
}

.tooltip-icon .tooltip-text {
    visibility: hidden;
    opacity: 0;
    background: var(--ins-text);
    color: var(--ins-surface);
    text-align: left;
    border-radius: 8px;
    padding: 0.4rem 0.65rem;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 0;
    transform: none;
    font-size: 0.7rem;
    font-weight: normal;
    box-shadow: 0 2px 8px var(--ins-shadow-strong);
    transition: opacity 0.3s, visibility 0.3s;
    pointer-events: none;
    line-height: 1.4;
    white-space: normal;
    min-width: 180px;
    max-width: 280px;
}

.tooltip-icon .tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 10px;
    transform: none;
    border: 5px solid transparent;
    border-top-color: var(--ins-text);
}

.tooltip-icon:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* ---------- Viewer header row ---------- */
.viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
}

.viewer-header-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}

.viewer-header-title h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.viewer-breadcrumb {
    display: flex;
    align-items: center;
}

/* ---------- Active filters bar (viewer-name; JS toggles visibility) ---------- */
.active-filters-bar {
    display: none;
    padding: 0.5rem 1.25rem 0;
}

.active-filters-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.active-filters-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ins-muted);
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: color-mix(in srgb, var(--ins-primary) 12%, var(--ins-surface));
    color: color-mix(in srgb, var(--ins-primary) 70%, var(--ins-text));
    border-radius: 99px;
    padding: 0.2rem 0.65rem;
    font-size: 0.72rem;
    font-weight: 600;
    margin: 2px 4px 2px 0;
    cursor: default;
}

.filter-tag .remove-filter {
    cursor: pointer;
    font-weight: bold;
    margin-left: 2px;
    font-size: 0.8rem;
    color: inherit;
    line-height: 1;
}

.filter-tag .remove-filter:hover {
    color: var(--ins-danger);
}

/* ---------- Facets (viewer-name; JS-emitted) ---------- */
.facet-section {
    margin-bottom: 0.9rem;
}

.facet-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: color-mix(in srgb, var(--ins-secondary) 40%, var(--ins-text));
    padding: 0.5rem 0 0.25rem;
    border-bottom: 1px solid var(--ins-border);
    margin-bottom: 0.35rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.facet-section-title .arrow {
    font-size: 0.7rem;
    transition: transform 0.2s;
    display: inline-block;
    color: var(--ins-muted);
    font-weight: normal;
    margin-right: 4px;
}

.facet-section-title.collapsed .arrow {
    transform: rotate(-90deg);
}

.facet-items {
    padding: 0;
    max-height: 180px;
    overflow-y: scroll;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}

.facet-items:hover {
    scrollbar-color: color-mix(in srgb, var(--ins-text) 20%, transparent) transparent;
}

.facet-items.hidden {
    display: none;
}

.facet-items::-webkit-scrollbar {
    width: 5px;
    background: transparent;
}

.facet-items::-webkit-scrollbar-track {
    background: transparent;
}

.facet-items::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 3px;
}

.facet-items:hover::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--ins-text) 20%, transparent);
}

.facet-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.2rem 0;
    font-size: 0.8rem;
    color: var(--ins-text);
    cursor: pointer;
}

.facet-item label {
    cursor: pointer;
    flex: 1;
    display: flex;
    justify-content: space-between;
}

.facet-item .facet-count {
    color: var(--ins-muted);
    font-size: 0.72rem;
}

.facet-show-more {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--ins-primary);
    cursor: pointer;
    padding: 0.25rem 0;
    border: none;
    background: none;
    text-decoration: none;
}

.facet-show-more:hover {
    text-decoration: underline;
}

.no-facets-message {
    font-size: 0.75rem;
    color: var(--ins-muted);
    padding: 0.5rem 0;
}

/* ---------- Facet toggle controls (JS toggles visibility) ---------- */
.facet-controls {
    display: none;
    font-size: 0.72rem;
    gap: 6px;
    align-items: center;
    font-weight: normal;
    text-transform: none;
    letter-spacing: normal;
}

.facet-control-link {
    color: var(--ins-primary);
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.facet-control-link:hover {
    text-decoration: underline;
}

.facet-control-separator {
    color: var(--ins-border);
}

/* ---------- Thin horizontal scrollbar (data table) ---------- */
.data-table-container-thin {
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--ins-text) 20%, transparent) transparent;
}

.data-table-container-thin::-webkit-scrollbar {
    height: 5px;
}

.data-table-container-thin::-webkit-scrollbar-track {
    background: transparent;
}

.data-table-container-thin::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--ins-text) 20%, transparent);
    border-radius: 3px;
}

.data-table-container-thin::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--ins-text) 32%, transparent);
}

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: 0.25rem 0.7rem;
    border-radius: 99px;
    font-size: 0.72rem;
    font-weight: 700;
}

.badge-success {
    background: color-mix(in srgb, var(--ins-success) 10%, var(--ins-surface));
    color: var(--ins-success);
}

.badge-error {
    background: color-mix(in srgb, var(--ins-danger) 10%, var(--ins-surface));
    color: var(--ins-danger);
}
