/*
 * لقطة · Laqta Studio — design tokens, base styles and components.
 *
 * Source of truth: the approved designs (Identity, Main, Overview, Run, BulkReview, Health, Settings).
 * Every class is prefixed with `lq-` so it never collides with the old dashboard styles.
 * Layout uses logical properties (margin-inline, inset-inline, padding-inline) so it reads correctly in RTL.
 * Loaded by resources/views/layouts/laqta.blade.php; fonts come from Google Fonts in that layout's <head>.
 */

/* ==========================================================================
   1. Tokens
   ========================================================================== */

:root {
    /* Brand: teal (buttons, selection, links) */
    --lq-teal-900: #0A4D48;
    --lq-teal-800: #0B5F58;          /* hover */
    --lq-teal-700: #0F766E;          /* primary */
    --lq-teal-500: #14B8A6;          /* bright: progress on dark surfaces */
    --lq-teal-300: #9FC8C5;          /* selected-item ring */
    --lq-teal-100: #CCFBF1;
    --lq-teal-soft: #E7F1F0;         /* tint for chips, soft buttons, selected rows */
    --lq-teal-50: #F0FDFA;
    --lq-teal-glow: rgba(15, 118, 110, 0.25);

    /* Attention: saffron (warnings, counters) */
    --lq-saffron-500: #F59E0B;
    --lq-saffron-700: #B45309;       /* text on light surfaces */
    --lq-saffron-800: #8A4B06;       /* long text inside warning surfaces */
    --lq-saffron-200: #F8DDAA;       /* warning border */
    --lq-saffron-50: #FFF7E6;
    --lq-saffron-ink: #2B1A02;       /* text on saffron-500 */

    /* Ink: the sidebar and dark panels */
    --lq-ink-900: #0B2226;
    --lq-ink-800: #12313A;
    --lq-ink-700: #1C4450;
    --lq-ink-text: #B8CDD1;
    --lq-ink-muted: #8FB0B6;
    --lq-ink-fg: #D7E6E8;

    /* Neutrals */
    --lq-bg: #F3F6F8;
    --lq-surface: #FFFFFF;
    --lq-surface-2: #F8FAFB;
    --lq-surface-3: #E7ECEF;         /* segmented-control track */
    --lq-border: #E2E8EC;
    --lq-border-soft: #EEF2F4;       /* row dividers, progress track */
    --lq-border-strong: #CBD5DB;
    --lq-text: #0E1C24;
    --lq-text-2: #4F6270;
    /* The design's #6B7C89 measures 4.3:1 on white; this shade keeps the same look at >= 4.8:1 on --lq-bg. */
    --lq-text-3: #5E6F7C;
    --lq-text-on-dark: #FFFFFF;

    /* Status */
    --lq-success: #15803D;
    --lq-success-dot: #16A34A;
    --lq-success-bg: #ECFDF3;
    --lq-success-border: #BBE5C8;
    --lq-success-ink: #166534;

    --lq-warning: #B45309;
    --lq-warning-dot: #F59E0B;
    --lq-warning-bg: #FFF7E6;
    --lq-warning-border: #F8DDAA;
    --lq-warning-ink: #8A4B06;

    --lq-danger: #C8313A;
    --lq-danger-text: #B42330;
    --lq-danger-dot: #E5484D;
    --lq-danger-bg: #FEF1F2;
    --lq-danger-border: #F3C4C7;
    --lq-danger-ink: #8E1B25;
    --lq-danger-on-dark: #F8B4B8;

    --lq-info: #2F6FEB;
    --lq-info-text: #1E4FB8;
    --lq-info-bg: #EEF4FF;
    --lq-info-border: #C9DAFB;

    --lq-neutral: #6B7C89;
    --lq-neutral-dot: #8596A3;
    --lq-neutral-bar: #94A3AE;
    --lq-neutral-bg: #EEF2F4;

    --lq-running-on-dark: #6EE7C8;
    --lq-running-dot: #34D399;

    /* Run card on the dark sidebar: paused / stopping text, error and stuck surface */
    --lq-runcard-paused-text: #FCD34D;
    --lq-runcard-error-bg: #2A1F27;
    --lq-runcard-error-border: rgba(229, 72, 77, 0.55);
    --lq-runcard-error-text: #FBD5D7;

    /* Semantic aliases: what a colour means, not which colour it is (a later dark theme redefines only these) */
    --lq-accent: var(--lq-teal-700);
    --lq-accent-hover: var(--lq-teal-800);
    --lq-accent-strong: var(--lq-teal-900);
    --lq-accent-soft: var(--lq-teal-soft);
    --lq-accent-soft-hover: var(--lq-teal-100);
    --lq-accent-ring: var(--lq-teal-300);
    --lq-accent-wash: var(--lq-teal-50);
    --lq-on-accent: var(--lq-text-on-dark);
    --lq-on-accent-tint: rgba(4, 32, 29, 0.24);         /* a count or key inside a solid button: darkens, so white text stays 4.5:1 */
    --lq-on-accent-track: rgba(255, 255, 255, 0.35);    /* a spinner's track inside a solid button */
    --lq-scrim: rgba(11, 34, 38, 0.45);                 /* behind a dialog */
    --lq-ink-hover: rgba(18, 49, 58, 0.6);              /* a sidebar item under the pointer */
    --lq-ink-divider: rgba(255, 255, 255, 0.08);        /* a line on the dark sidebar */
    --lq-swatch-edge: rgba(14, 28, 36, 0.08);           /* the edge of a colour sample */

    /* Text tones: one value per meaning, shared by .lq-text--*, chips and the per-page status texts */
    --lq-text-success: var(--lq-success);
    --lq-text-warning: var(--lq-warning);
    --lq-text-danger: var(--lq-danger-text);
    --lq-text-info: var(--lq-info-text);
    --lq-text-muted: var(--lq-text-2);

    /* Typography: one scale, 2xs → 3xl (+ the KPI number) */
    --lq-font-ui: 'Readex Pro', 'Noto Sans Arabic', sans-serif;
    --lq-font-display: 'Alexandria', 'Readex Pro', 'Noto Sans Arabic', sans-serif;
    --lq-font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    --lq-fs-2xs: 12px;     /* captions, keyboard hints, tiny counters */
    --lq-fs-xs: 13px;      /* secondary text, chips, meta lines, tables */
    --lq-fs-sm: 14px;      /* buttons, controls, descriptions */
    --lq-fs-md: 15px;      /* body text */
    --lq-fs-base: var(--lq-fs-md);
    --lq-fs-lg: 16px;      /* card title */
    --lq-fs-xl: 20px;      /* section title, dialog title */
    --lq-fs-2xl: 26px;     /* page title */
    --lq-fs-3xl: 30px;     /* big running numbers */
    --lq-fs-kpi: 34px;     /* KPI tiles */
    --lq-lh-none: 1;
    --lq-lh-tight: 1.2;
    --lq-lh-snug: 1.4;
    --lq-lh-normal: 1.5;
    --lq-lh-base: 1.6;
    --lq-lh-relaxed: 1.7;
    --lq-lh-loose: 1.8;

    /* Page layout */
    --lq-content-max: 1280px;      /* the widest a page's content gets (start-aligned, next to the sidebar) */
    --lq-measure: 68ch;            /* the longest comfortable line for a lead or description */
    --lq-page-gap: var(--lq-space-5);
    --lq-main-pad-top: var(--lq-space-8);
    --lq-main-pad-inline: var(--lq-space-8);
    --lq-main-pad-bottom: var(--lq-space-10);
    --lq-btn-h-sm: 36px;           /* 44px on touch screens (pointer: coarse) */
    --lq-btn-h: 44px;
    --lq-btn-h-lg: 48px;
    --lq-card-pad: var(--lq-space-5);
    --lq-card-pad-compact: var(--lq-space-4);

    /* Spacing (8-pt grid, with a 4px half step) */
    --lq-space-1: 4px;
    --lq-space-2: 8px;
    --lq-space-3: 12px;
    --lq-space-4: 16px;
    --lq-space-5: 20px;
    --lq-space-6: 24px;
    --lq-space-8: 32px;
    --lq-space-10: 40px;

    /* Radii */
    --lq-radius-sm: 8px;
    --lq-radius-md: 10px;
    --lq-radius-lg: 12px;
    --lq-radius-xl: 16px;
    --lq-radius-pill: 999px;

    /* Elevation */
    --lq-shadow-card: 0 1px 2px rgba(14, 28, 36, 0.04);
    --lq-shadow-raised: 0 1px 3px rgba(14, 28, 36, 0.12);
    --lq-shadow-toast: 0 8px 24px rgba(14, 28, 36, 0.08);
    --lq-shadow-bar: 0 -6px 20px rgba(14, 28, 36, 0.05);
    --lq-shadow-primary: 0 6px 16px var(--lq-teal-glow);
    --lq-shadow-dialog: 0 24px 60px rgba(11, 34, 38, 0.28);
    --lq-shadow-thumb: 0 1px 2px rgba(14, 28, 36, 0.25);
    --lq-shadow-focus: 0 0 0 3px var(--lq-accent-soft);     /* a focused field */

    /* Focus ring */
    --lq-focus: var(--lq-teal-700);
    --lq-focus-on-dark: #5EEAD4;

    /* Shell */
    --lq-sidebar-width: 236px;
    /* the bottom tab bar that replaces the sidebar at 980px and below (0 above it) */
    --lq-tabbar-h: 0px;

    /* Theme-aware extras (the dark set below redefines each one) */
    --lq-inverse-bg: var(--lq-ink-900);                 /* a pressed filter: the strongest surface there is */
    --lq-inverse-fg: var(--lq-text-on-dark);
    --lq-sidebar-edge: transparent;                     /* the line between the sidebar and the page */
    --lq-theme-color: #0B2226;                          /* <meta name="theme-color">: the sidebar's ink */
    --lq-image-surface: #FFFFFF;                        /* behind a product image (never inverted) */
    --lq-image-check: #E7ECEF;                          /* the second square of the transparency checker */
    --lq-select-chevron: 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='%234F6270' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");

    color-scheme: light;
}

/*
 * Dark theme. <html data-theme="dark"> forces it, data-theme="light" forces the light set above, no attribute
 * follows the system. Only tokens change; components keep var(--lq-*). The two blocks carry the same values
 * (tests/test_dark_mode_shell.py compares them). Theme-independent on purpose: the teal and saffron primitives,
 * the *-on-dark texts, the ink texts and the run card's own colours (they sit on the always-dark sidebar).
 */
:root[data-theme="dark"] {
    --lq-bg: #0B1418;
    --lq-surface: #121E23;
    --lq-surface-2: #17252B;
    --lq-surface-3: #1F3038;
    --lq-border: #24363E;
    --lq-border-soft: #1C2C33;
    --lq-border-strong: #355058;
    --lq-text: #E6EEF0;
    --lq-text-2: #B4C4CA;
    --lq-text-3: #93A7AF;

    --lq-ink-900: #060D10;
    --lq-ink-800: #10232A;
    --lq-ink-700: #1A3640;

    --lq-success: #4CC97A;
    --lq-success-dot: #34C76A;
    --lq-success-bg: #0F2A1C;
    --lq-success-border: #1E5236;
    --lq-success-ink: #9BE5B4;
    --lq-warning: #F0A84A;
    --lq-warning-dot: #F59E0B;
    --lq-warning-bg: #2D2110;
    --lq-warning-border: #5C4417;
    --lq-warning-ink: #F5CF8E;
    --lq-danger: #F0646B;
    --lq-danger-text: #FF8A8F;
    --lq-danger-dot: #F0585E;
    --lq-danger-bg: #2E1518;
    --lq-danger-border: #5E2A2F;
    --lq-danger-ink: #FFB8BB;
    --lq-info: #6FA0FF;
    --lq-info-text: #8DB4FF;
    --lq-info-bg: #13213A;
    --lq-info-border: #2A4371;
    --lq-neutral: #8FA0AB;
    --lq-neutral-dot: #6F818C;
    --lq-neutral-bar: #4F616B;
    --lq-neutral-bg: #1C2A30;

    --lq-accent: #3CC9B7;
    --lq-accent-hover: #5ED8C8;
    --lq-accent-strong: #8BE6DA;
    --lq-accent-soft: #123B39;
    --lq-accent-soft-hover: #17504B;
    --lq-accent-ring: #2A8F86;
    --lq-accent-wash: #0E2A29;
    --lq-on-accent: #04201D;
    --lq-on-accent-tint: rgba(4, 32, 29, 0.18);
    --lq-on-accent-track: rgba(4, 32, 29, 0.3);
    --lq-scrim: rgba(0, 0, 0, 0.65);
    --lq-ink-hover: rgba(26, 54, 64, 0.6);
    --lq-ink-divider: rgba(255, 255, 255, 0.07);
    --lq-swatch-edge: rgba(255, 255, 255, 0.14);

    --lq-shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4);
    --lq-shadow-raised: 0 1px 3px rgba(0, 0, 0, 0.5);
    --lq-shadow-toast: 0 8px 24px rgba(0, 0, 0, 0.45);
    --lq-shadow-bar: 0 -6px 20px rgba(0, 0, 0, 0.35);
    --lq-shadow-primary: 0 6px 16px rgba(60, 201, 183, 0.16);
    --lq-shadow-dialog: 0 24px 60px rgba(0, 0, 0, 0.6);
    --lq-shadow-thumb: 0 1px 2px rgba(0, 0, 0, 0.5);
    --lq-shadow-focus: 0 0 0 3px rgba(60, 201, 183, 0.35);
    --lq-focus: #5EEAD4;

    --lq-inverse-bg: #E6EEF0;
    --lq-inverse-fg: #0B1418;
    --lq-sidebar-edge: #1C2C33;
    --lq-theme-color: #060D10;
    --lq-image-surface: #E9EEF0;
    --lq-image-check: #CBD5DB;
    --lq-select-chevron: 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='%23B4C4CA' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");

    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --lq-bg: #0B1418;
        --lq-surface: #121E23;
        --lq-surface-2: #17252B;
        --lq-surface-3: #1F3038;
        --lq-border: #24363E;
        --lq-border-soft: #1C2C33;
        --lq-border-strong: #355058;
        --lq-text: #E6EEF0;
        --lq-text-2: #B4C4CA;
        --lq-text-3: #93A7AF;

        --lq-ink-900: #060D10;
        --lq-ink-800: #10232A;
        --lq-ink-700: #1A3640;

        --lq-success: #4CC97A;
        --lq-success-dot: #34C76A;
        --lq-success-bg: #0F2A1C;
        --lq-success-border: #1E5236;
        --lq-success-ink: #9BE5B4;
        --lq-warning: #F0A84A;
        --lq-warning-dot: #F59E0B;
        --lq-warning-bg: #2D2110;
        --lq-warning-border: #5C4417;
        --lq-warning-ink: #F5CF8E;
        --lq-danger: #F0646B;
        --lq-danger-text: #FF8A8F;
        --lq-danger-dot: #F0585E;
        --lq-danger-bg: #2E1518;
        --lq-danger-border: #5E2A2F;
        --lq-danger-ink: #FFB8BB;
        --lq-info: #6FA0FF;
        --lq-info-text: #8DB4FF;
        --lq-info-bg: #13213A;
        --lq-info-border: #2A4371;
        --lq-neutral: #8FA0AB;
        --lq-neutral-dot: #6F818C;
        --lq-neutral-bar: #4F616B;
        --lq-neutral-bg: #1C2A30;

        --lq-accent: #3CC9B7;
        --lq-accent-hover: #5ED8C8;
        --lq-accent-strong: #8BE6DA;
        --lq-accent-soft: #123B39;
        --lq-accent-soft-hover: #17504B;
        --lq-accent-ring: #2A8F86;
        --lq-accent-wash: #0E2A29;
        --lq-on-accent: #04201D;
        --lq-on-accent-tint: rgba(4, 32, 29, 0.18);
        --lq-on-accent-track: rgba(4, 32, 29, 0.3);
        --lq-scrim: rgba(0, 0, 0, 0.65);
        --lq-ink-hover: rgba(26, 54, 64, 0.6);
        --lq-ink-divider: rgba(255, 255, 255, 0.07);
        --lq-swatch-edge: rgba(255, 255, 255, 0.14);

        --lq-shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4);
        --lq-shadow-raised: 0 1px 3px rgba(0, 0, 0, 0.5);
        --lq-shadow-toast: 0 8px 24px rgba(0, 0, 0, 0.45);
        --lq-shadow-bar: 0 -6px 20px rgba(0, 0, 0, 0.35);
        --lq-shadow-primary: 0 6px 16px rgba(60, 201, 183, 0.16);
        --lq-shadow-dialog: 0 24px 60px rgba(0, 0, 0, 0.6);
        --lq-shadow-thumb: 0 1px 2px rgba(0, 0, 0, 0.5);
        --lq-shadow-focus: 0 0 0 3px rgba(60, 201, 183, 0.35);
        --lq-focus: #5EEAD4;

        --lq-inverse-bg: #E6EEF0;
        --lq-inverse-fg: #0B1418;
        --lq-sidebar-edge: #1C2C33;
        --lq-theme-color: #060D10;
        --lq-image-surface: #E9EEF0;
        --lq-image-check: #CBD5DB;
        --lq-select-chevron: 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='%23B4C4CA' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");

        color-scheme: dark;
    }
}

/* ==========================================================================
   2. Base
   ========================================================================== */

.lq-body,
.lq-body *,
.lq-body *::before,
.lq-body *::after {
    box-sizing: border-box;
}

html:has(.lq-body) {
    background: var(--lq-bg);
}

.lq-body {
    margin: 0;
    min-height: 100vh;
    background: var(--lq-bg);
    color: var(--lq-text);
    font-family: var(--lq-font-ui);
    font-size: var(--lq-fs-base);
    line-height: var(--lq-lh-base);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.lq-body a {
    color: var(--lq-accent);
}

.lq-body a:hover {
    color: var(--lq-accent-hover);
}

.lq-body button,
.lq-body input,
.lq-body select,
.lq-body textarea {
    font-family: inherit;
    font-size: inherit;
}

.lq-body h1,
.lq-body h2,
.lq-body h3,
.lq-body h4,
.lq-body p {
    margin: 0;
}

.lq-body img {
    max-width: 100%;
}

.lq-body :focus-visible {
    outline: 2px solid var(--lq-focus);
    outline-offset: 2px;
}

.lq-body :focus:not(:focus-visible) {
    outline: none;
}

.lq-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.lq-skip-link {
    position: absolute;
    inset-block-start: var(--lq-space-2);
    inset-inline-start: var(--lq-space-2);
    z-index: 100;
    padding: var(--lq-space-2) var(--lq-space-4);
    border-radius: var(--lq-radius-md);
    background: var(--lq-surface);
    color: var(--lq-text);
    font-weight: 600;
    transform: translateY(-200%);
}

.lq-skip-link:focus {
    transform: none;
}

.lq-icon {
    display: inline-block;
    flex-shrink: 0;
    vertical-align: middle;
}

.lq-ltr {
    direction: ltr;
    unicode-bidi: isolate;
}

.lq-num {
    font-variant-numeric: tabular-nums;
}

.lq-muted {
    color: var(--lq-text-2);
}

.lq-subtle {
    color: var(--lq-text-3);
}

/* Text tones: the colour of a status said in words (the per-page status texts use the same tokens) */
.lq-text--success { color: var(--lq-text-success); }
.lq-text--warning { color: var(--lq-text-warning); }
.lq-text--danger { color: var(--lq-text-danger); }
.lq-text--info { color: var(--lq-text-info); }
.lq-text--muted { color: var(--lq-text-muted); }

/* «الشيت: X · الورقة: Y» (components/lq/sheet-line): a small line; a long sheet name wraps */
.lq-sheet-line {
    margin: 0;
    font-size: var(--lq-fs-xs);
    line-height: var(--lq-lh-base);
    overflow-wrap: anywhere;
}

/* A section, alert or button a script hides with the hidden attribute stays hidden, whatever display its
   component gives it (was repeated per page: home, run, setup). */
.lq-body [hidden] {
    display: none !important;
}

.lq-link {
    color: var(--lq-accent);
    font-weight: 500;
    text-decoration: none;
}

.lq-link:hover {
    color: var(--lq-accent-hover);
    text-decoration: underline;
}

/* Layout helpers */
.lq-stack {
    display: flex;
    flex-direction: column;
    gap: var(--lq-space-4);
}

.lq-stack--sm {
    gap: var(--lq-space-2);
}

.lq-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--lq-space-3);
}

.lq-row--sm {
    gap: var(--lq-space-2);
}

.lq-row--between {
    justify-content: space-between;
}

.lq-grid {
    display: grid;
    gap: var(--lq-space-4);
}

.lq-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lq-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ==========================================================================
   3. App shell and sidebar
   ========================================================================== */

.lq-shell {
    display: flex;
    min-height: 100vh;
    background: var(--lq-bg);
}

.lq-sidebar {
    width: var(--lq-sidebar-width);
    flex-shrink: 0;
    border-inline-end: 1px solid var(--lq-sidebar-edge);
    background: var(--lq-ink-900);
    color: var(--lq-ink-fg);
}

/* The dark column runs the full page height; its content stays in view while the page scrolls. */
.lq-sidebar__inner {
    position: sticky;
    inset-block-start: 0;
    display: flex;
    flex-direction: column;
    gap: 22px;
    height: 100vh;
    padding: var(--lq-space-5) 14px;
    overflow-y: auto;
}

.lq-sidebar :focus-visible {
    outline-color: var(--lq-focus-on-dark);
}

.lq-brand {
    display: flex;
    align-items: center;
    gap: var(--lq-space-3);
    padding: var(--lq-space-1) var(--lq-space-2);
    border-radius: var(--lq-radius-md);
    text-decoration: none;
}

.lq-brand__mark {
    flex-shrink: 0;
}

.lq-brand__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.lq-body .lq-brand__name,
.lq-brand__name {
    font-family: var(--lq-font-display);
    font-weight: 700;
    font-size: var(--lq-fs-xl);
    line-height: var(--lq-lh-tight);
    color: var(--lq-text-on-dark);
}

.lq-brand__tagline {
    font-size: var(--lq-fs-xs);
    color: var(--lq-ink-muted);
}

.lq-nav {
    display: flex;
    flex-direction: column;
    gap: var(--lq-space-1);
}

.lq-body .lq-nav__item,
.lq-nav__item {
    display: flex;
    align-items: center;
    gap: var(--lq-space-3);
    padding: 11px var(--lq-space-3);
    border-radius: var(--lq-radius-md);
    color: var(--lq-ink-text);
    font-size: var(--lq-fs-base);
    font-weight: 500;
    line-height: var(--lq-lh-snug);
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.lq-body .lq-nav__item:hover,
.lq-nav__item:hover {
    background: var(--lq-ink-hover);
    color: var(--lq-text-on-dark);
}

.lq-body .lq-nav__item.is-active,
.lq-body .lq-nav__item[aria-current="page"],
.lq-nav__item.is-active,
.lq-nav__item[aria-current="page"] {
    background: var(--lq-ink-800);
    color: var(--lq-text-on-dark);
}

.lq-nav__label {
    flex-grow: 1;
}

/* the tab bar's short label (980px and below) */
.lq-nav__short {
    display: none;
}

.lq-nav__badge {
    min-width: 22px;
    padding: 2px var(--lq-space-2);
    border-radius: var(--lq-radius-pill);
    background: var(--lq-saffron-500);
    color: var(--lq-saffron-ink);
    font-size: var(--lq-fs-xs);
    font-weight: 600;
    line-height: var(--lq-lh-normal);
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.lq-nav__badge[hidden] {
    display: none;
}

/* The tab bar's «حسابي» and the run dot (980px and below); the sidebar has the user row and the run card instead */
.lq-body .lq-nav__account,
.lq-nav__dot,
.lq-account-sheet {
    display: none;
}

.lq-nav__account {
    border: 0;
    background: transparent;
    font-family: inherit;
    cursor: pointer;
}

.lq-nav__dot {
    position: absolute;
    inset-block-start: 8px;
    inset-inline-start: calc(50% + 8px);
    width: 9px;
    height: 9px;
    border: 2px solid var(--lq-ink-900);
    border-radius: 50%;
    background: var(--lq-ink-muted);
    box-sizing: content-box;
}

.lq-nav__dot[data-state="running"] { background: var(--lq-running-dot); }
.lq-nav__dot[data-state="paused"],
.lq-nav__dot[data-state="stopping"] { background: var(--lq-saffron-500); }
.lq-nav__dot[data-state="error"],
.lq-nav__dot[data-state="stuck"] { background: var(--lq-danger-dot); }

.lq-sidebar__spacer {
    flex-grow: 1;
}

/* Approvals running on the server (batch-status.approvals) */
.lq-runcard__approvals {
    margin-top: 8px;
    font-size: var(--lq-fs-2xs);
    color: var(--lq-ink-fg);
}

.lq-runcard__approvals.has-failures {
    color: var(--lq-warning-dot);
}

.lq-runcard__approvals-link {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Session expired (401 / 419): one banner on top of the page, stays until the reviewer signs in again */
.lq-session-expired {
    position: sticky;
    top: 0;
    z-index: 60;
    margin: var(--lq-space-3);
}

.lq-session-expired__pending {
    margin-top: 2px;
    font-size: var(--lq-fs-xs);
    font-weight: 400;
}

.lq-session-expired__name {
    font-weight: 600;
}

/* Signed-in user + sign-out (sidebar foot); the theme switch takes the row above them */
.lq-sidebar__user {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--lq-ink-divider);
}

.lq-sidebar__user-name {
    color: var(--lq-ink-muted);
    font-size: var(--lq-fs-xs);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lq-body .lq-sidebar__user .lq-btn--ghost {
    color: var(--lq-ink-fg);
}

.lq-sidebar__user .lq-theme-switch {
    flex-basis: 100%;
}

/* «فاتح / غامق / تلقائي» (layout.js setTheme): a segmented control, full width wherever it sits */
.lq-segmented.lq-theme-switch {
    display: grid;
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
    width: 100%;
}

.lq-body .lq-theme-switch .lq-segmented__item {
    padding: 0 var(--lq-space-2);
}

.lq-account-sheet .lq-theme-switch {
    margin-top: var(--lq-space-2);
}

/* the segmented control on the dark sidebar */
.lq-segmented.lq-segmented--ink {
    background: var(--lq-ink-800);
}

.lq-body .lq-segmented--ink .lq-segmented__item,
.lq-segmented--ink .lq-segmented__item {
    color: var(--lq-ink-muted);
}

.lq-body .lq-segmented--ink .lq-segmented__item:hover,
.lq-segmented--ink .lq-segmented__item:hover {
    color: var(--lq-text-on-dark);
}

.lq-body .lq-segmented--ink .lq-segmented__item[aria-pressed="true"],
.lq-segmented--ink .lq-segmented__item[aria-pressed="true"] {
    background: var(--lq-ink-700);
    color: var(--lq-text-on-dark);
    box-shadow: none;
}

/* A product image's frame: its own light surface, a checker behind transparent PNGs, never an inverted image */
.lq-image-frame {
    background-color: var(--lq-image-surface);
    background-image: repeating-conic-gradient(var(--lq-image-check) 0% 25%, transparent 0% 50%);
    background-size: 16px 16px;
}

/* Run-status mini card (sidebar) */
.lq-runcard {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    border: 1px solid transparent;
    border-radius: 14px;
    background: var(--lq-ink-800);
    color: var(--lq-text-on-dark);
}

.lq-runcard__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--lq-space-2);
}

.lq-runcard__title {
    font-size: var(--lq-fs-xs);
    color: var(--lq-ink-muted);
    white-space: nowrap;
}

.lq-runcard__state {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--lq-fs-xs);
    color: var(--lq-ink-muted);
    white-space: nowrap;
}

.lq-runcard__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--lq-ink-muted);
}

.lq-runcard__text {
    font-size: var(--lq-fs-xs);
    line-height: var(--lq-lh-normal);
    color: var(--lq-text-on-dark);
    overflow-wrap: anywhere;
}

.lq-runcard__text strong {
    font-weight: 600;
}

.lq-runcard__bar {
    height: 6px;
    overflow: hidden;
    border-radius: var(--lq-radius-pill);
    background: var(--lq-ink-700);
}

.lq-runcard__bar[hidden] {
    display: none;
}

.lq-runcard__fill {
    width: 0;
    height: 100%;
    border-radius: var(--lq-radius-pill);
    background: var(--lq-teal-500);
    transition: width 0.4s ease;
}

.lq-body .lq-runcard__link,
.lq-runcard__link {
    align-self: flex-start;
    font-size: var(--lq-fs-xs);
    color: var(--lq-ink-muted);
    text-decoration: none;
}

.lq-body .lq-runcard__link:hover,
.lq-runcard__link:hover {
    color: var(--lq-text-on-dark);
    text-decoration: underline;
}

.lq-runcard[data-state="running"] .lq-runcard__state { color: var(--lq-running-on-dark); }
.lq-runcard[data-state="running"] .lq-runcard__dot { background: var(--lq-running-dot); }

.lq-runcard[data-state="paused"] .lq-runcard__state { color: var(--lq-runcard-paused-text); }
.lq-runcard[data-state="paused"] .lq-runcard__dot { background: var(--lq-saffron-500); }
.lq-runcard[data-state="paused"] .lq-runcard__fill { background: var(--lq-saffron-500); }

.lq-runcard[data-state="error"] {
    border-color: var(--lq-runcard-error-border);
    background: var(--lq-runcard-error-bg);
}

.lq-runcard[data-state="error"] .lq-runcard__state { color: var(--lq-danger-on-dark); }
.lq-runcard[data-state="error"] .lq-runcard__dot { background: var(--lq-danger-dot); }
.lq-runcard[data-state="error"] .lq-runcard__text { color: var(--lq-runcard-error-text); }
.lq-runcard[data-state="stopping"] .lq-runcard__state { color: var(--lq-runcard-paused-text); }
.lq-runcard[data-state="stopping"] .lq-runcard__dot { background: var(--lq-saffron-500); }
.lq-runcard[data-state="stopping"] .lq-runcard__fill { background: var(--lq-saffron-500); }
.lq-runcard[data-state="stuck"] { border-color: var(--lq-runcard-error-border); background: var(--lq-runcard-error-bg); }
.lq-runcard[data-state="stuck"] .lq-runcard__state { color: var(--lq-danger-on-dark); }
.lq-runcard[data-state="stuck"] .lq-runcard__dot { background: var(--lq-danger-dot); }
.lq-runcard[data-state="stuck"] .lq-runcard__text { color: var(--lq-runcard-error-text); }

.lq-runcard[data-state="unknown"] .lq-runcard__text,
.lq-runcard[data-state="loading"] .lq-runcard__text,
.lq-runcard[data-state="idle"] .lq-runcard__text { color: var(--lq-ink-text); }

/* Main column */
.lq-main {
    flex-grow: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--lq-page-gap);
    padding: var(--lq-main-pad-top) var(--lq-main-pad-inline) var(--lq-main-pad-bottom);
}

/* A page's content stops at --lq-content-max on a wide screen and stays on the start side, next to the sidebar
   (right in RTL): the flex column stretches each child up to that width. A full-bleed work screen opts out. */
.lq-main:not(.lq-main--flush) > * {
    max-width: var(--lq-content-max);
}

.lq-main--flush {
    gap: 0;
    padding: 0;
}

.lq-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--lq-space-4);
}

.lq-page-header__text {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.lq-page-header__eyebrow {
    font-size: var(--lq-fs-xs);
    color: var(--lq-text-2);
}

.lq-body .lq-page-title,
.lq-page-title {
    margin: 0;
    font-family: var(--lq-font-display);
    font-weight: 600;
    font-size: var(--lq-fs-2xl);
    line-height: var(--lq-lh-snug);
}

.lq-page-header__desc,
.lq-card__lead {
    max-width: var(--lq-measure);
    font-size: var(--lq-fs-sm);
    line-height: var(--lq-lh-base);
    color: var(--lq-text-2);
}

.lq-page-header__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

/* One heading system: page title (--lq-fs-2xl, display face) > section title (--lq-fs-xl) > card title (--lq-fs-lg).
   Pages do not resize these. */
.lq-body .lq-section-title,
.lq-section-title {
    margin: 0;
    font-size: var(--lq-fs-xl);
    font-weight: 600;
    line-height: var(--lq-lh-snug);
}

/* Sticky action bar at the bottom of a work screen (above the phone tab bar) */
.lq-actionbar {
    position: sticky;
    inset-block-end: var(--lq-tabbar-h);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--lq-space-3);
    padding: 14px 28px;
    border-block-start: 1px solid var(--lq-border);
    background: var(--lq-surface);
    box-shadow: var(--lq-shadow-bar);
}

.lq-actionbar__aside {
    margin-inline-start: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    font-size: var(--lq-fs-xs);
    color: var(--lq-text-3);
}

/* ==========================================================================
   4. Cards, KPI tiles, stat tiles
   ========================================================================== */

/* Raised card (default): a block you act in. Every card has the same padding; pages do not change it. */
.lq-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
    padding: var(--lq-card-pad);
    border: 1px solid var(--lq-border);
    border-radius: var(--lq-radius-xl);
    background: var(--lq-surface);
    box-shadow: var(--lq-shadow-card);
}

.lq-card--compact {
    gap: var(--lq-space-3);
    padding: var(--lq-card-pad-compact);
}

/* Flat card: a block you read (reference, explanation, a summary): no shadow, a soft surface and edge */
.lq-card--flat {
    border-color: var(--lq-border-soft);
    background: var(--lq-surface-2);
    box-shadow: none;
}

.lq-card--flush {
    gap: 0;
    padding: 0;
    overflow: hidden;
}

.lq-card--muted {
    background: var(--lq-surface-2);
    box-shadow: none;
}

.lq-card--dark {
    border-color: var(--lq-ink-900);
    background: var(--lq-ink-900);
    color: var(--lq-ink-fg);
}

.lq-card--dark .lq-card__title {
    color: var(--lq-text-on-dark);
}

.lq-card--dark .lq-card__meta {
    color: var(--lq-ink-muted);
}

.lq-card__header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--lq-space-2) var(--lq-space-3);
}

.lq-body .lq-card__title,
.lq-card__title {
    margin: 0;
    font-size: var(--lq-fs-lg);
    font-weight: 600;
    line-height: var(--lq-lh-snug);
}

.lq-card__meta {
    font-size: var(--lq-fs-xs);
    color: var(--lq-text-2);
}

.lq-card__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--lq-space-2);
}

.lq-card__body {
    display: flex;
    flex-direction: column;
    gap: var(--lq-space-3);
    min-width: 0;
}

.lq-card__footer {
    font-size: var(--lq-fs-xs);
    color: var(--lq-text-3);
    line-height: var(--lq-lh-relaxed);
}

.lq-kpi {
    display: flex;
    flex-direction: column;
    gap: var(--lq-space-2);
    min-width: 0;
    padding: 18px;
    border: 1px solid var(--lq-border);
    border-radius: var(--lq-radius-xl);
    background: var(--lq-surface);
    box-shadow: var(--lq-shadow-card);
    color: var(--lq-text);
    text-decoration: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.lq-body a.lq-kpi {
    color: var(--lq-text);
}

.lq-body a.lq-kpi:hover,
a.lq-kpi:hover {
    border-color: var(--lq-border-strong);
    box-shadow: var(--lq-shadow-raised);
    color: var(--lq-text);
}

.lq-kpi__label {
    display: flex;
    align-items: center;
    gap: var(--lq-space-2);
    font-size: var(--lq-fs-xs);
    color: var(--lq-text-2);
}

.lq-kpi__value {
    font-size: var(--lq-fs-kpi);
    font-weight: 600;
    line-height: var(--lq-lh-tight);
    font-variant-numeric: tabular-nums;
}

.lq-kpi__note {
    font-size: var(--lq-fs-xs);
    color: var(--lq-text-2);
}

.lq-kpi__note--success { color: var(--lq-text-success); }
.lq-kpi__note--warning { color: var(--lq-text-warning); }
.lq-kpi__note--danger { color: var(--lq-text-danger); }
.lq-kpi__note--muted { color: var(--lq-text-muted); }

/* Small result tile (Overview "last run", Health) */
.lq-stat {
    display: flex;
    flex-direction: column;
    gap: var(--lq-space-1);
    padding: var(--lq-space-3);
    border-radius: var(--lq-radius-lg);
    background: var(--lq-bg);
}

.lq-stat__value {
    font-size: var(--lq-fs-2xl);
    font-weight: 600;
    line-height: var(--lq-lh-snug);
    font-variant-numeric: tabular-nums;
}

.lq-stat__label {
    font-size: var(--lq-fs-xs);
    color: var(--lq-text-2);
}

.lq-stat--success { background: var(--lq-success-bg); }
.lq-stat--success .lq-stat__value { color: var(--lq-text-success); }
.lq-stat--warning { background: var(--lq-warning-bg); }
.lq-stat--warning .lq-stat__value { color: var(--lq-text-warning); }
.lq-stat--danger { background: var(--lq-danger-bg); }
.lq-stat--danger .lq-stat__value { color: var(--lq-text-danger); }
.lq-stat--info { background: var(--lq-info-bg); }
.lq-stat--info .lq-stat__value { color: var(--lq-text-info); }
.lq-stat--teal { background: var(--lq-accent-soft); }
.lq-stat--teal .lq-stat__value { color: var(--lq-accent); }
.lq-stat--muted { background: var(--lq-bg); }
.lq-stat--muted .lq-stat__value { color: var(--lq-text-2); }

/* Status dot (services, legends, KPI labels) */
.lq-dot {
    display: inline-block;
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--lq-neutral-dot);
}

.lq-dot--lg { width: 10px; height: 10px; }
.lq-dot--success { background: var(--lq-success-dot); }
.lq-dot--warning { background: var(--lq-warning-dot); }
.lq-dot--saffron { background: var(--lq-saffron-500); }
.lq-dot--danger { background: var(--lq-danger-dot); }
.lq-dot--info { background: var(--lq-info); }
.lq-dot--teal { background: var(--lq-accent); }
.lq-dot--muted { background: var(--lq-border-strong); }

.lq-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: var(--lq-fs-xs);
}

.lq-status__note {
    color: var(--lq-text-3);
}

/* ==========================================================================
   5. Buttons and keyboard keys
   ========================================================================== */

.lq-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--lq-space-2);
    height: var(--lq-btn-h);
    padding: 0 var(--lq-space-5);
    border: 1px solid transparent;
    border-radius: var(--lq-radius-lg);
    background: transparent;
    color: var(--lq-text);
    font-size: var(--lq-fs-sm);
    font-weight: 500;
    line-height: var(--lq-lh-none);
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.lq-body .lq-btn--primary,
.lq-btn--primary {
    padding-inline: 22px;
    border-color: var(--lq-accent);
    background: var(--lq-accent);
    color: var(--lq-on-accent);
    font-weight: 600;
}

.lq-body .lq-btn--primary:hover,
.lq-btn--primary:hover {
    border-color: var(--lq-accent-hover);
    background: var(--lq-accent-hover);
    color: var(--lq-on-accent);
}

.lq-body .lq-btn--secondary,
.lq-btn--secondary {
    border-color: var(--lq-border-strong);
    background: var(--lq-surface);
    color: var(--lq-text);
}

.lq-body .lq-btn--secondary:hover,
.lq-btn--secondary:hover {
    background: var(--lq-surface-2);
    color: var(--lq-text);
}

.lq-body .lq-btn--danger,
.lq-btn--danger {
    border-color: var(--lq-danger-border);
    background: var(--lq-surface);
    color: var(--lq-text-danger);
    font-weight: 600;
}

.lq-body .lq-btn--danger:hover,
.lq-btn--danger:hover {
    background: var(--lq-danger-bg);
    color: var(--lq-text-danger);
}

.lq-body .lq-btn--danger-solid,
.lq-btn--danger-solid {
    border-color: var(--lq-danger);
    background: var(--lq-danger);
    color: var(--lq-on-accent);
    font-weight: 600;
}

.lq-body .lq-btn--danger-solid:hover,
.lq-btn--danger-solid:hover {
    border-color: var(--lq-danger-text);
    background: var(--lq-danger-text);
    color: var(--lq-on-accent);
}

.lq-body .lq-btn--soft,
.lq-btn--soft {
    border-color: var(--lq-accent-soft);
    background: var(--lq-accent-soft);
    color: var(--lq-accent);
    font-weight: 600;
}

.lq-body .lq-btn--soft:hover,
.lq-btn--soft:hover {
    border-color: var(--lq-accent-soft-hover);
    background: var(--lq-accent-soft-hover);
    color: var(--lq-accent-hover);
}

.lq-body .lq-btn--ghost,
.lq-btn--ghost {
    padding-inline: var(--lq-space-3);
    background: transparent;
    color: var(--lq-accent);
}

.lq-body .lq-btn--ghost:hover,
.lq-btn--ghost:hover {
    background: var(--lq-accent-soft);
    color: var(--lq-accent-hover);
}

.lq-btn--sm {
    height: var(--lq-btn-h-sm);
    padding-inline: 14px;
    border-radius: var(--lq-radius-md);
    font-size: var(--lq-fs-xs);
    gap: 6px;
}

.lq-btn--lg {
    height: var(--lq-btn-h-lg);
    padding-inline: 26px;
    font-size: var(--lq-fs-md);
    gap: 10px;
}

.lq-btn--primary.lq-btn--lg {
    box-shadow: var(--lq-shadow-primary);
}

.lq-btn--block {
    display: flex;
    width: 100%;
}

.lq-btn--icon {
    width: var(--lq-btn-h);
    padding: 0;
}

.lq-btn--icon.lq-btn--sm { width: var(--lq-btn-h-sm); padding: 0; }
.lq-btn--icon.lq-btn--lg { width: var(--lq-btn-h-lg); padding: 0; }

.lq-btn:disabled,
.lq-btn[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

a.lq-btn[aria-disabled="true"] {
    pointer-events: none;
}

.lq-btn.is-loading {
    cursor: progress;
}

.lq-btn__count {
    padding: 2px 9px;
    border-radius: var(--lq-radius-pill);
    background: var(--lq-on-accent-tint);
    font-size: var(--lq-fs-xs);
    font-weight: 500;
    line-height: var(--lq-lh-normal);
    font-variant-numeric: tabular-nums;
}

.lq-btn--secondary .lq-btn__count,
.lq-btn--ghost .lq-btn__count {
    background: var(--lq-bg);
}

.lq-kbd {
    display: inline-block;
    min-width: 1.6em;
    padding: 4px 9px;
    border: 1px solid var(--lq-border);
    border-radius: 6px;
    background: var(--lq-bg);
    color: var(--lq-text);
    font-family: inherit;
    font-size: var(--lq-fs-xs);
    font-weight: 500;
    line-height: var(--lq-lh-snug);
    text-align: center;
    direction: ltr;
}

.lq-btn .lq-kbd {
    padding: 2px 7px;
    font-size: var(--lq-fs-xs);
}

.lq-btn--primary .lq-kbd,
.lq-btn--danger-solid .lq-kbd {
    border-color: transparent;
    background: var(--lq-on-accent-tint);
    color: inherit;
}

.lq-btn--danger .lq-kbd {
    border-color: var(--lq-danger-border);
    background: var(--lq-danger-bg);
    color: inherit;
}

/* Filter pill (review and bulk filters) */
.lq-body .lq-filter,
.lq-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 var(--lq-space-3);
    border: 1px solid var(--lq-border-strong);
    border-radius: var(--lq-radius-pill);
    background: var(--lq-surface);
    color: var(--lq-text);
    font-size: var(--lq-fs-xs);
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.lq-filter:hover {
    background: var(--lq-surface-2);
}

.lq-body .lq-filter[aria-pressed="true"],
.lq-body .lq-filter.is-active,
.lq-filter[aria-pressed="true"],
.lq-filter.is-active {
    border-color: var(--lq-inverse-bg);
    background: var(--lq-inverse-bg);
    color: var(--lq-inverse-fg);
}

.lq-filter__count {
    font-weight: 600;
    opacity: 0.85;
    font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   6. Chips / status pills
   ========================================================================== */

.lq-chip {
    --lq-chip-dot: var(--lq-neutral-dot);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px var(--lq-space-3);
    border-radius: var(--lq-radius-pill);
    background: var(--lq-neutral-bg);
    color: var(--lq-text-2);
    font-size: var(--lq-fs-xs);
    font-weight: 500;
    line-height: var(--lq-lh-snug);
    white-space: nowrap;
}

.lq-chip__dot {
    width: 7px;
    height: 7px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--lq-chip-dot);
}

.lq-chip--sm {
    gap: 5px;
    padding: 3px 9px;
    font-size: var(--lq-fs-xs);
}

/* Tone modifiers: what the chip says (success / warning / danger / info / neutral / teal). The product-status
   names (proposed, none, not-found, approved, error) are aliases kept for the views and scripts that build them. */
.lq-chip--success,
.lq-chip--proposed {
    --lq-chip-dot: var(--lq-success-dot);
    background: var(--lq-success-bg);
    color: var(--lq-text-success);
}

.lq-chip--warning {
    --lq-chip-dot: var(--lq-warning-dot);
    background: var(--lq-warning-bg);
    color: var(--lq-text-warning);
}

.lq-chip--danger,
.lq-chip--error {
    --lq-chip-dot: var(--lq-danger-dot);
    background: var(--lq-danger-bg);
    color: var(--lq-text-danger);
}

.lq-chip--info,
.lq-chip--not-found {
    --lq-chip-dot: var(--lq-info);
    background: var(--lq-info-bg);
    color: var(--lq-text-info);
}

.lq-chip--neutral,
.lq-chip--none {
    --lq-chip-dot: var(--lq-neutral-dot);
    background: var(--lq-neutral-bg);
    color: var(--lq-text-muted);
}

.lq-chip--teal,
.lq-chip--approved {
    --lq-chip-dot: var(--lq-accent);
    background: var(--lq-accent-soft);
    color: var(--lq-accent);
}

/* ==========================================================================
   7. Alerts and banners
   ========================================================================== */

.lq-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: var(--lq-space-3) 14px;
    border: 1px solid transparent;
    border-radius: var(--lq-radius-lg);
    font-size: var(--lq-fs-xs);
    line-height: var(--lq-lh-base);
}

.lq-alert__icon {
    flex-shrink: 0;
    margin-top: 2px;
}

.lq-alert__body {
    flex-grow: 1;
    min-width: 0;
}

.lq-alert__title {
    font-weight: 600;
}

.lq-body .lq-alert__action,
.lq-alert__action {
    flex-shrink: 0;
    align-self: center;
    color: inherit;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.lq-body .lq-alert__action:hover {
    color: inherit;
    text-decoration-thickness: 2px;
}

.lq-alert--info {
    border-color: var(--lq-info-border);
    background: var(--lq-info-bg);
    color: var(--lq-text-info);
}

.lq-alert--warning {
    border-color: var(--lq-warning-bg);
    background: var(--lq-warning-bg);
    color: var(--lq-warning-ink);
}

.lq-alert--danger {
    border-color: var(--lq-danger-border);
    background: var(--lq-danger-bg);
    color: var(--lq-danger-ink);
}

.lq-alert--success {
    border-color: var(--lq-success-border);
    background: var(--lq-success-bg);
    color: var(--lq-success-ink);
}

.lq-alert--neutral {
    border-color: var(--lq-border);
    background: var(--lq-surface-2);
    color: var(--lq-text-2);
}

.lq-alert--banner {
    align-items: center;
    gap: var(--lq-space-3);
    padding: 14px var(--lq-space-4);
    border-radius: 14px;
    font-size: var(--lq-fs-sm);
}

.lq-alert--banner .lq-alert__icon {
    margin-top: 0;
}

/* ==========================================================================
   8. Form controls
   ========================================================================== */

.lq-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: var(--lq-fs-xs);
    color: var(--lq-text-2);
}

.lq-field__label {
    font-weight: 500;
}

.lq-field__hint {
    font-size: var(--lq-fs-xs);
    color: var(--lq-text-3);
}

.lq-field__error {
    font-size: var(--lq-fs-xs);
    color: var(--lq-text-danger);
}

.lq-input,
.lq-select,
.lq-textarea {
    width: 100%;
    height: 42px;
    padding: 0 var(--lq-space-3);
    border: 1px solid var(--lq-border-strong);
    border-radius: var(--lq-radius-md);
    background: var(--lq-surface);
    color: var(--lq-text);
    font-size: var(--lq-fs-base);
    line-height: var(--lq-lh-snug);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.lq-textarea {
    height: auto;
    min-height: 96px;
    padding: 10px var(--lq-space-3);
    resize: vertical;
}

.lq-select {
    padding-inline-end: 34px;
    appearance: none;
    background-image: var(--lq-select-chevron);
    background-repeat: no-repeat;
    background-position: left 12px center;
    background-size: 16px;
}

[dir="ltr"] .lq-select {
    background-position: right 12px center;
}

.lq-input::placeholder,
.lq-textarea::placeholder {
    color: var(--lq-text-3);
    opacity: 1;
}

.lq-input:hover,
.lq-select:hover,
.lq-textarea:hover {
    border-color: var(--lq-text-3);
}

.lq-body .lq-input:focus-visible,
.lq-body .lq-select:focus-visible,
.lq-body .lq-textarea:focus-visible,
.lq-input:focus,
.lq-select:focus,
.lq-textarea:focus {
    outline: none;
    border-color: var(--lq-accent);
    box-shadow: var(--lq-shadow-focus);
}

.lq-input[aria-invalid="true"],
.lq-select[aria-invalid="true"],
.lq-textarea[aria-invalid="true"] {
    border-color: var(--lq-danger);
}

.lq-input:disabled,
.lq-select:disabled,
.lq-textarea:disabled {
    background: var(--lq-surface-2);
    color: var(--lq-text-3);
    cursor: not-allowed;
}

.lq-input--sm {
    height: 40px;
    font-size: var(--lq-fs-xs);
}

/* Search box: icon + borderless input inside a label */
.lq-search {
    display: flex;
    align-items: center;
    gap: var(--lq-space-2);
    height: 40px;
    padding: 0 var(--lq-space-3);
    border: 1px solid var(--lq-border-strong);
    border-radius: var(--lq-radius-md);
    background: var(--lq-surface-2);
    color: var(--lq-text-3);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.lq-search:focus-within {
    border-color: var(--lq-accent);
    box-shadow: var(--lq-shadow-focus);
}

.lq-search__input {
    flex-grow: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    background: transparent;
    color: var(--lq-text);
    font-size: var(--lq-fs-sm);
}

.lq-body .lq-search__input:focus-visible,
.lq-search__input:focus {
    outline: none;
}

.lq-search__input::placeholder {
    color: var(--lq-text-3);
    opacity: 1;
}

/* Checkbox and radio with a label */
.lq-check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: var(--lq-fs-xs);
    color: var(--lq-text);
    cursor: pointer;
}

.lq-check input {
    width: 18px;
    height: 18px;
    margin: 0;
    flex-shrink: 0;
    accent-color: var(--lq-accent);
    cursor: pointer;
}

.lq-check input:disabled,
.lq-check input:disabled + span {
    cursor: not-allowed;
    opacity: 0.6;
}

/* Toggle switch: <label class="lq-switch"><input class="lq-switch__input" type="checkbox" role="switch">... */
.lq-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: var(--lq-fs-sm);
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
}

.lq-switch__input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
}

.lq-switch__track {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
    width: 44px;
    height: 26px;
    border-radius: var(--lq-radius-pill);
    background: var(--lq-border-strong);
    transition: background-color 0.18s ease;
}

.lq-switch__thumb {
    position: absolute;
    inset-block-start: 3px;
    inset-inline-end: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--lq-surface);
    box-shadow: var(--lq-shadow-thumb);
    transition: inset-inline-end 0.18s ease;
}

.lq-switch__input:checked + .lq-switch__track {
    background: var(--lq-accent);
}

.lq-switch__input:checked + .lq-switch__track .lq-switch__thumb {
    inset-inline-end: 21px;
}

.lq-switch__input:focus-visible + .lq-switch__track {
    outline: 2px solid var(--lq-focus);
    outline-offset: 2px;
}

.lq-switch__input:disabled + .lq-switch__track {
    opacity: 0.5;
}

.lq-switch__input:disabled ~ .lq-switch__state {
    color: var(--lq-text-3);
}

.lq-switch:has(.lq-switch__input:disabled) {
    cursor: not-allowed;
}

.lq-switch__label {
    color: var(--lq-text);
}

.lq-switch__state {
    color: var(--lq-text);
}

.lq-switch__on {
    display: none;
}

.lq-switch__input:checked ~ .lq-switch__state .lq-switch__on {
    display: inline;
}

.lq-switch__input:checked ~ .lq-switch__state .lq-switch__off {
    display: none;
}

/* Segmented control: buttons with aria-pressed/aria-checked, or radio inputs followed by .lq-segmented__item */
.lq-segmented {
    display: inline-flex;
    align-self: flex-start;
    max-width: 100%;
    gap: var(--lq-space-1);
    padding: var(--lq-space-1);
    border-radius: 11px;
    background: var(--lq-surface-3);
}

.lq-segmented--fill {
    display: grid;
    align-self: stretch;
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
    gap: var(--lq-space-2);
    border-radius: var(--lq-radius-lg);
    background: var(--lq-bg);
}

.lq-segmented__option {
    position: relative;
    display: flex;
}

.lq-segmented__option input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
}

.lq-body .lq-segmented__item,
.lq-segmented__item {
    display: inline-flex;
    flex-grow: 1;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 14px;
    border: 0;
    border-radius: var(--lq-radius-sm);
    background: transparent;
    color: var(--lq-text-2);
    font-size: var(--lq-fs-sm);
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.lq-segmented--fill .lq-segmented__item {
    height: 40px;
    border-radius: 9px;
}

.lq-segmented--sm .lq-segmented__item {
    height: 34px;
    font-size: var(--lq-fs-xs);
}

.lq-body .lq-segmented__item:hover,
.lq-segmented__item:hover {
    color: var(--lq-text);
}

.lq-body .lq-segmented__item[aria-pressed="true"],
.lq-body .lq-segmented__item[aria-checked="true"],
.lq-body .lq-segmented__item[aria-current="page"],
.lq-body .lq-segmented__item.is-active,
.lq-segmented__item[aria-pressed="true"],
.lq-segmented__item[aria-checked="true"],
.lq-segmented__item[aria-current="page"],
.lq-segmented__item.is-active,
.lq-segmented__option input:checked + .lq-segmented__item {
    background: var(--lq-surface);
    color: var(--lq-text);
    font-weight: 600;
    box-shadow: var(--lq-shadow-raised);
}

.lq-segmented__option input:focus-visible + .lq-segmented__item {
    outline: 2px solid var(--lq-focus);
    outline-offset: 2px;
}

.lq-segmented__option input:disabled + .lq-segmented__item {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==========================================================================
   9. Progress
   ========================================================================== */

.lq-progress {
    display: flex;
    width: 100%;
    height: 8px;
    overflow: hidden;
    border-radius: var(--lq-radius-pill);
    background: var(--lq-border-soft);
}

.lq-progress--sm { height: 6px; }
.lq-progress--lg { height: 10px; }
.lq-progress--xl { height: 16px; }

.lq-progress__bar {
    height: 100%;
    border-radius: var(--lq-radius-pill);
    background: var(--lq-accent);
    transition: width 0.4s ease;
}

.lq-progress--stacked {
    gap: 2px;
}

.lq-progress__seg {
    height: 100%;
    min-width: 0;
    flex-shrink: 1;
    background: var(--lq-neutral-bar);
    transition: width 0.4s ease;
}

.lq-tone--teal { background: var(--lq-accent); }
.lq-tone--bright { background: var(--lq-teal-500); }
.lq-tone--success { background: var(--lq-success-dot); }
.lq-tone--warning { background: var(--lq-saffron-500); }
.lq-tone--danger { background: var(--lq-danger-dot); }
.lq-tone--info { background: var(--lq-info); }
.lq-tone--muted { background: var(--lq-neutral-bar); }
.lq-tone--empty { background: var(--lq-border-strong); }

.lq-progress-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.lq-progress-block__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--lq-space-3);
    font-size: var(--lq-fs-xs);
}

.lq-progress-block__meta {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.lq-progress-block__note {
    font-size: var(--lq-fs-xs);
    color: var(--lq-text-2);
}

.lq-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--lq-space-2) var(--lq-space-4);
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: var(--lq-fs-xs);
}

.lq-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.lq-legend__swatch {
    width: 9px;
    height: 9px;
    flex-shrink: 0;
    border-radius: 3px;
}

.lq-legend__value {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   10. Table
   ========================================================================== */

.lq-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--lq-border);
    border-radius: var(--lq-radius-lg);
    background: var(--lq-surface);
}

.lq-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--lq-fs-xs);
}

.lq-table th {
    padding: 11px var(--lq-space-4);
    background: var(--lq-surface-2);
    color: var(--lq-text-2);
    font-size: var(--lq-fs-xs);
    font-weight: 500;
    text-align: start;
    white-space: nowrap;
}

.lq-table td {
    padding: var(--lq-space-3) var(--lq-space-4);
    border-block-start: 1px solid var(--lq-border-soft);
    text-align: start;
    vertical-align: middle;
}

.lq-table tbody tr:hover td {
    background: var(--lq-surface-2);
}

.lq-table__num {
    font-variant-numeric: tabular-nums;
}

.lq-table__strong {
    font-weight: 600;
}

/* ==========================================================================
   11. Sheet-vs-image check row
   ========================================================================== */

.lq-checks {
    display: flex;
    flex-direction: column;
}

.lq-check-row {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1fr) 26px;
    align-items: center;
    gap: 10px;
    padding: 9px 0;
    border-block-start: 1px solid var(--lq-border-soft);
    font-size: var(--lq-fs-xs);
}

.lq-check-row--boxed {
    grid-template-columns: 70px minmax(0, 1fr) minmax(0, 1fr) 26px;
    padding: 10px 14px;
    border: 1px solid var(--lq-border);
    border-radius: var(--lq-radius-lg);
}

.lq-check-row__label {
    color: var(--lq-text-3);
}

.lq-check-row__sheet,
.lq-check-row__image {
    min-width: 0;
    overflow-wrap: anywhere;
    text-align: right;
}

[dir="ltr"] .lq-check-row__sheet,
[dir="ltr"] .lq-check-row__image {
    text-align: left;
}

.lq-check-row__image {
    font-weight: 500;
}

.lq-check-row__status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--lq-neutral-bg);
    color: var(--lq-text-2);
}

.lq-check-row__status--match { background: var(--lq-success-bg); color: var(--lq-text-success); }
.lq-check-row__status--unsure { background: var(--lq-warning-bg); color: var(--lq-text-warning); }
.lq-check-row__status--mismatch { background: var(--lq-danger-bg); color: var(--lq-text-danger); }
.lq-check-row__status--unknown { background: var(--lq-neutral-bg); color: var(--lq-text-2); }

/* ==========================================================================
   12. Toast, spinner
   ========================================================================== */

.lq-toast-region {
    position: fixed;
    inset-block-end: var(--lq-space-6);
    inset-inline-end: var(--lq-space-6);
    z-index: 60;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--lq-space-2);
    max-width: min(440px, calc(100vw - 32px));
    pointer-events: none;
}

.lq-toast {
    display: flex;
    align-items: center;
    gap: var(--lq-space-3);
    padding: var(--lq-space-3) var(--lq-space-4);
    border: 1px solid var(--lq-border);
    border-radius: var(--lq-radius-lg);
    background: var(--lq-surface);
    box-shadow: var(--lq-shadow-toast);
    color: var(--lq-text);
    font-size: var(--lq-fs-xs);
    line-height: var(--lq-lh-normal);
    pointer-events: auto;
}

.lq-toast__icon {
    flex-shrink: 0;
}

.lq-toast__text {
    flex-grow: 1;
    min-width: 0;
}

.lq-toast__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border: 0;
    border-radius: var(--lq-radius-sm);
    background: transparent;
    color: var(--lq-text-3);
    cursor: pointer;
}

.lq-toast__close:hover {
    background: var(--lq-bg);
    color: var(--lq-text);
}

.lq-toast__action {
    flex-shrink: 0;
    padding: 4px 10px;
    border: 1px solid var(--lq-border);
    border-radius: var(--lq-radius-sm);
    background: var(--lq-surface);
    color: var(--lq-text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.lq-toast__action:hover {
    background: var(--lq-bg);
}

.lq-toast--success .lq-toast__icon { color: var(--lq-text-success); }
.lq-toast--warning .lq-toast__icon { color: var(--lq-text-warning); }
.lq-toast--danger { border-color: var(--lq-danger-border); }
.lq-toast--danger .lq-toast__icon { color: var(--lq-text-danger); }
.lq-toast--info .lq-toast__icon { color: var(--lq-text-info); }

.lq-spinner {
    display: inline-block;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border: 2.5px solid var(--lq-accent-soft);
    border-top-color: var(--lq-accent);
    border-radius: 50%;
    animation: lq-spin 0.8s linear infinite;
}

.lq-btn--primary .lq-spinner {
    border-color: var(--lq-on-accent-track);
    border-top-color: var(--lq-on-accent);
}

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

/* ==========================================================================
   13. Empty state, skeleton
   ========================================================================== */

.lq-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: var(--lq-space-10) var(--lq-space-6);
    border: 1.5px dashed var(--lq-border-strong);
    border-radius: var(--lq-radius-xl);
    background: var(--lq-surface);
    text-align: center;
}

.lq-empty--plain {
    border: 0;
    background: transparent;
}

.lq-empty__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin-bottom: var(--lq-space-1);
    border-radius: 50%;
    background: var(--lq-accent-soft);
    color: var(--lq-accent);
}

.lq-body .lq-empty__title,
.lq-empty__title {
    margin: 0;
    font-size: var(--lq-fs-lg);
    font-weight: 600;
}

.lq-empty__text {
    max-width: 440px;
    margin: 0;
    font-size: var(--lq-fs-xs);
    line-height: var(--lq-lh-relaxed);
    color: var(--lq-text-2);
}

.lq-empty__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: var(--lq-space-2);
}

.lq-skeleton {
    display: block;
    height: 12px;
    border-radius: var(--lq-radius-sm);
    background: linear-gradient(90deg, var(--lq-border-soft) 25%, var(--lq-surface-2) 50%, var(--lq-border-soft) 75%);
    background-size: 200% 100%;
    animation: lq-shimmer 1.4s ease-in-out infinite;
}

.lq-skeleton--title { width: 45%; height: 20px; }
.lq-skeleton--text { width: 100%; }
.lq-skeleton--short { width: 60%; }
.lq-skeleton--thumb { width: 52px; height: 52px; flex-shrink: 0; border-radius: var(--lq-radius-md); }

@keyframes lq-shimmer {
    from { background-position: 100% 0; }
    to { background-position: -100% 0; }
}

/* ==========================================================================
   14. Dark log panel (Health)
   ========================================================================== */

.lq-log {
    margin: 0;
    padding: 0;
    color: var(--lq-ink-text);
    font-family: var(--lq-font-mono);
    font-size: var(--lq-fs-xs);
    line-height: var(--lq-lh-loose);
    direction: ltr;
    text-align: left;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.lq-log__error {
    color: var(--lq-danger-on-dark);
}

/* ==========================================================================
   14b. Questions in the page (Laqta.ask, instead of window.confirm)
   ========================================================================== */

.lq-dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--lq-space-4);
    background: var(--lq-scrim);
}

.lq-dialog {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: min(520px, 100%);
    max-height: calc(100vh - 32px);
    padding: var(--lq-space-6);
    overflow-y: auto;
    border-radius: var(--lq-radius-xl);
    background: var(--lq-surface);
    box-shadow: var(--lq-shadow-toast);
}

.lq-body .lq-dialog__title,
.lq-dialog__title {
    margin: 0;
    font-family: var(--lq-font-display);
    font-size: var(--lq-fs-xl);
    font-weight: 600;
    line-height: var(--lq-lh-snug);
}

.lq-dialog__text {
    margin: 0;
    color: var(--lq-text-2);
    line-height: var(--lq-lh-loose);
    white-space: pre-line;
}

.lq-dialog__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--lq-space-3);
}

/* ==========================================================================
   15. Responsive: the shell stacks at 980px
   ========================================================================== */

/* 980px and below: the sidebar becomes a bottom tab bar with the five destinations (icon over a short label); the
   brand and the run card leave it (the Run page and Home show the run). Content keeps clear of it with
   --lq-tabbar-h, which sticky bars at the bottom of a page add to their offset. */
@media (max-width: 980px) {
    :root {
        --lq-tabbar-h: calc(64px + env(safe-area-inset-bottom, 0px));
        --lq-main-pad-top: var(--lq-space-6);
        --lq-main-pad-inline: var(--lq-space-4);
        --lq-main-pad-bottom: var(--lq-space-8);
    }

    .lq-shell {
        flex-direction: column;
        padding-block-end: var(--lq-tabbar-h);
    }

    .lq-sidebar {
        position: fixed;
        inset-inline: 0;
        inset-block-end: 0;
        z-index: 60;
        width: auto;
        height: var(--lq-tabbar-h);
        padding-block-end: env(safe-area-inset-bottom, 0px);
        border-block-start: 1px solid var(--lq-ink-800);
        border-inline-end: 0;
    }

    .lq-sidebar__inner {
        position: static;
        height: 100%;
        gap: 0;
        padding: 0;
        overflow: visible;
    }

    .lq-sidebar .lq-goto-open,
    .lq-sidebar .lq-brand,
    .lq-sidebar__spacer,
    .lq-sidebar__user,
    .lq-sidebar .lq-runcard {
        display: none;
    }

    .lq-nav {
        flex-direction: row;
        align-items: stretch;
        gap: 0;
        height: 100%;
    }

    .lq-body .lq-nav__item,
    .lq-nav__item {
        position: relative;
        flex: 1 1 0;
        flex-direction: column;
        justify-content: center;
        gap: 2px;
        min-width: 0;
        padding: 6px 2px;
        border-radius: 0;
        font-size: var(--lq-fs-xs);
        line-height: var(--lq-lh-tight);
        text-align: center;
        white-space: nowrap;
    }

    .lq-body .lq-nav__item.is-active,
    .lq-body .lq-nav__item[aria-current="page"],
    .lq-nav__item.is-active,
    .lq-nav__item[aria-current="page"] {
        background: transparent;
        color: var(--lq-running-on-dark);
        box-shadow: inset 0 3px 0 var(--lq-running-on-dark);
    }

    .lq-nav__label {
        flex-grow: 0;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* a long label gives its place to its short form; the full one stays for screen readers */
    .lq-nav__item:has(.lq-nav__short) .lq-nav__label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .lq-nav__short {
        display: block;
    }

    .lq-nav__badge {
        position: absolute;
        inset-block-start: 4px;
        inset-inline-start: calc(50% + 6px);
        min-width: 20px;
        padding: 0 5px;
    }

    .lq-body .lq-nav__account {
        display: flex;
    }

    .lq-body .lq-nav__account[aria-expanded="true"] {
        color: var(--lq-running-on-dark);
    }

    /* the run dot: what the sidebar card says, for the owner (loading / unknown: no dot) */
    .lq-nav__dot:not([data-state="loading"]):not([data-state="unknown"]) {
        display: block;
    }

    /* «حسابي»: a small card above the tab bar, on the side of its button */
    .lq-account-sheet:not([hidden]) {
        position: fixed;
        inset-inline-end: var(--lq-space-3);
        inset-block-end: calc(var(--lq-tabbar-h) + var(--lq-space-2));
        z-index: 61;
        display: flex;
        flex-direction: column;
        gap: 4px;
        width: min(280px, calc(100vw - 24px));
        padding: var(--lq-space-4);
        border: 1px solid var(--lq-border);
        border-radius: var(--lq-radius-lg);
        background: var(--lq-surface);
        box-shadow: var(--lq-shadow-toast);
    }

    .lq-account-sheet__label,
    .lq-account-sheet__role {
        color: var(--lq-text-2);
        font-size: var(--lq-fs-xs);
    }

    .lq-account-sheet__name {
        overflow: hidden;
        font-weight: 600;
        text-align: start;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .lq-account-sheet__goto,
    .lq-account-sheet__logout {
        margin-top: var(--lq-space-2);
    }

    .lq-main--flush {
        padding: 0;
    }

    .lq-grid--2 {
        grid-template-columns: minmax(0, 1fr);
    }

    .lq-grid--4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .lq-actionbar {
        padding: var(--lq-space-3) var(--lq-space-4);
    }

    .lq-actionbar__aside {
        margin-inline-start: 0;
        align-items: flex-start;
    }

    .lq-toast-region {
        inset-inline: var(--lq-space-4);
        inset-block-end: calc(var(--lq-space-4) + var(--lq-tabbar-h));
        align-items: stretch;
    }
}

/* A phone on its side (about 390px tall): the tab bar puts each icon beside its label, 48px instead of 64px */
@media (max-width: 980px) and (orientation: landscape) and (max-height: 500px) {
    :root {
        --lq-tabbar-h: calc(48px + env(safe-area-inset-bottom, 0px));
    }

    .lq-body .lq-nav__item,
    .lq-nav__item {
        flex-direction: row;
        gap: var(--lq-space-2);
    }

    .lq-nav__badge {
        inset-block-start: 2px;
    }
}

@media (max-width: 560px) {
    :root {
        --lq-card-pad: var(--lq-space-4);
    }

    .lq-grid--4 {
        grid-template-columns: minmax(0, 1fr);
    }

    .lq-page-title,
    .lq-body .lq-page-title {
        font-size: var(--lq-fs-xl);
    }

    .lq-kpi__value {
        font-size: var(--lq-fs-3xl);
    }

    .lq-check-row,
    .lq-check-row--boxed {
        grid-template-columns: 56px minmax(0, 1fr) minmax(0, 1fr) 24px;
        gap: var(--lq-space-2);
    }
}

/* «روح على» (components/lq/jump-links): in-page links to the cards of a long page */
.lq-jump {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--lq-space-2);
}

.lq-jump__label {
    color: var(--lq-text-3);
    font-size: var(--lq-fs-xs);
}

.lq-jump__list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--lq-space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.lq-jump__link {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding-inline: 12px;
    border: 1px solid var(--lq-border);
    border-radius: var(--lq-radius-pill);
    background: var(--lq-surface);
    color: var(--lq-text-2);
    font-size: var(--lq-fs-xs);
    font-weight: 500;
    text-decoration: none;
}

.lq-jump__link:hover {
    border-color: var(--lq-accent-ring);
    background: var(--lq-accent-soft);
    color: var(--lq-accent-strong);
}

/* a card reached by its #id does not land under the page's top edge */
.lq-main [id] {
    scroll-margin-block-start: var(--lq-space-4);
}

/* «روح لـ…» (public/js/jump.js): one box from any page to any page, card, setting or product */
.lq-goto-open {
    display: flex;
    align-items: center;
    gap: var(--lq-space-2);
    width: 100%;
    min-height: 40px;
    margin-block-end: var(--lq-space-3);
    padding-inline: 12px;
    border: 1px solid var(--lq-ink-700);
    border-radius: var(--lq-radius-md);
    background: var(--lq-ink-800);
    color: var(--lq-ink-text);
    font: inherit;
    font-size: var(--lq-fs-sm);
    cursor: pointer;
}

.lq-goto-open:hover {
    color: var(--lq-ink-fg);
    border-color: var(--lq-ink-muted);
}

.lq-goto-open__label {
    flex: 1;
    text-align: start;
}

.lq-goto-open kbd,
.lq-goto__hint kbd {
    padding: 1px 6px;
    border: 1px solid currentColor;
    border-radius: 5px;
    font-family: var(--lq-font-mono);
    font-size: var(--lq-fs-2xs);
}

.lq-goto-backdrop {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 12vh var(--lq-space-4) var(--lq-space-4);
    background: var(--lq-scrim);
}

.lq-goto {
    display: flex;
    flex-direction: column;
    width: min(620px, 100%);
    max-height: 70vh;
    overflow: hidden;
    border-radius: var(--lq-radius-xl);
    background: var(--lq-surface);
    box-shadow: var(--lq-shadow-dialog);
}

.lq-goto__field {
    display: flex;
    align-items: center;
    gap: var(--lq-space-2);
    padding: var(--lq-space-3) var(--lq-space-4);
    border-block-end: 1px solid var(--lq-border-soft);
    color: var(--lq-text-3);
}

.lq-goto__input {
    flex: 1;
    min-width: 0;
    min-height: 40px;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--lq-text);
    font: inherit;
    font-size: var(--lq-fs-lg);
}

.lq-goto__list {
    flex: 1;
    margin: 0;
    padding: var(--lq-space-2);
    overflow-y: auto;
    list-style: none;
}

.lq-goto__options {
    margin: 0;
    padding: 0;
    list-style: none;
}

.lq-goto__group {
    display: block;
    padding: var(--lq-space-2) var(--lq-space-3) var(--lq-space-1);
    color: var(--lq-text-3);
    font-size: var(--lq-fs-2xs);
    font-weight: 600;
}

.lq-goto__item {
    display: flex;
    align-items: center;
    gap: var(--lq-space-3);
    min-height: 44px;
    padding: var(--lq-space-2) var(--lq-space-3);
    border-radius: var(--lq-radius-md);
    color: var(--lq-text);
    cursor: pointer;
}

.lq-goto__item[aria-selected="true"] {
    background: var(--lq-accent-soft);
    color: var(--lq-accent-strong);
}

.lq-goto__title {
    flex: 1;
    min-width: 0;
}

.lq-goto__where {
    color: var(--lq-text-3);
    font-size: var(--lq-fs-2xs);
}

.lq-goto__empty {
    padding: var(--lq-space-4);
    color: var(--lq-text-3);
    text-align: center;
}

.lq-goto__hint {
    display: flex;
    flex-wrap: wrap;
    gap: var(--lq-space-3);
    padding: var(--lq-space-2) var(--lq-space-4);
    border-block-start: 1px solid var(--lq-border-soft);
    color: var(--lq-text-3);
    font-size: var(--lq-fs-2xs);
}

/* touch screens: every button and pill is at least 44px tall (the small buttons are 36px for the mouse) */
@media (pointer: coarse) {
    .lq-body .lq-btn--sm {
        min-height: var(--lq-btn-h);
    }

    .lq-body .lq-btn--icon.lq-btn--sm {
        min-width: var(--lq-btn-h);
    }

    .lq-body .lq-jump__link {
        min-height: 44px;
    }

    .lq-goto__hint {
        display: none;
    }

    /* iOS zooms the page on focus when a field's text is under 16px: every field is --lq-fs-lg (16px) on touch */
    .lq-body .lq-input,
    .lq-body .lq-select,
    .lq-body .lq-textarea,
    .lq-body .lq-search__input,
    .lq-body .lq-goto__input,
    .lq-input,
    .lq-select,
    .lq-textarea {
        font-size: var(--lq-fs-lg);
    }

    /* a checkbox, radio or switch row is tapped by its whole label: 44px tall, not the 18–26px of the text line */
    .lq-check,
    .lq-switch,
    label.lq-login__remember {
        min-height: 44px;
    }

    /* links and «تفاصيل» toggles that stand on their own line: a 44px tap row (24px at least for the ones in a sentence) */
    .lq-body .lq-alert__action,
    .lq-body a.lq-notices__text {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
    }

    .lq-body .lq-link {
        padding-block: var(--lq-space-1);
    }

    .lq-body details > summary:not([class]),
    .lq-body details > summary.lq-link {
        padding-block: var(--lq-space-3);
    }
}

@media (prefers-reduced-motion: reduce) {
    .lq-body *,
    .lq-body *::before,
    .lq-body *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media print {
    .lq-sidebar,
    .lq-toast-region,
    .lq-actionbar {
        display: none;
    }

    .lq-main {
        padding: 0;
    }
}

/* «التنبيهات» (public/js/notices.js): the bell under «روح لـ…» and its panel (a modal dialog, not a page). The panel
   sits beside the sidebar on a wide screen and above the tab bar on the phone (the bell is then in «حسابي») */
.lq-notices-open {
    display: flex;
    align-items: center;
    gap: var(--lq-space-2);
    width: 100%;
    min-height: 40px;
    margin-block: calc(-1 * var(--lq-space-1)) var(--lq-space-3);
    padding-inline: 12px;
    border: 1px solid var(--lq-ink-700);
    border-radius: var(--lq-radius-md);
    background: transparent;
    color: var(--lq-ink-text);
    font: inherit;
    font-size: var(--lq-fs-sm);
    cursor: pointer;
}

.lq-notices-open:hover {
    color: var(--lq-ink-fg);
    border-color: var(--lq-ink-muted);
}

.lq-notices-open__label {
    flex: 1;
    text-align: start;
}

.lq-notices-open__badge {
    min-width: 22px;
    padding: 1px var(--lq-space-2);
    border-radius: var(--lq-radius-pill);
    background: var(--lq-saffron-500);
    color: var(--lq-saffron-ink);
    font-size: var(--lq-fs-2xs);
    font-weight: 600;
    line-height: var(--lq-lh-normal);
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.lq-account-sheet__notices {
    gap: var(--lq-space-2);
    margin-top: var(--lq-space-2);
}

.lq-notices:not([hidden]) {
    position: fixed;
    inset-block-start: var(--lq-space-4);
    inset-inline-start: calc(var(--lq-sidebar-width) + var(--lq-space-3));
    z-index: 62;
    display: flex;
    flex-direction: column;
    width: min(380px, calc(100vw - 2 * var(--lq-space-4)));
    max-height: calc(100vh - 2 * var(--lq-space-4));
    border: 1px solid var(--lq-border);
    border-radius: var(--lq-radius-lg);
    background: var(--lq-surface);
    color: var(--lq-text);
    box-shadow: var(--lq-shadow-dialog);
}

.lq-notices__head,
.lq-notices__foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--lq-space-2);
    padding: var(--lq-space-3) var(--lq-space-4);
}

.lq-notices__head {
    justify-content: space-between;
    border-block-end: 1px solid var(--lq-border-soft);
}

.lq-notices__foot {
    border-block-start: 1px solid var(--lq-border-soft);
}

.lq-notices__title {
    margin: 0;
    font-family: var(--lq-font-display);
    font-size: var(--lq-fs-md);
    font-weight: 600;
}

.lq-notices__note {
    margin-inline-start: auto;
    color: var(--lq-text-3);
    font-size: var(--lq-fs-2xs);
}

.lq-notices__list {
    flex: 1;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
}

.lq-notices__item {
    display: flex;
    align-items: flex-start;
    gap: var(--lq-space-3);
    padding: var(--lq-space-3) var(--lq-space-4);
    border-block-end: 1px solid var(--lq-border-soft);
}

.lq-notices__item.is-new {
    background: var(--lq-accent-wash);
}

.lq-notices__icon { flex: none; margin-top: 2px; color: var(--lq-text-info); }
.lq-notices__item--success .lq-notices__icon { color: var(--lq-text-success); }
.lq-notices__item--warning .lq-notices__icon { color: var(--lq-text-warning); }
.lq-notices__item--danger .lq-notices__icon { color: var(--lq-text-danger); }

.lq-notices__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.lq-notices__text {
    color: var(--lq-text);
    font-size: var(--lq-fs-sm);
    line-height: var(--lq-lh-snug);
}

a.lq-notices__text {
    text-decoration: underline;
    text-decoration-color: var(--lq-border-strong);
    text-underline-offset: 3px;
}

a.lq-notices__text:hover {
    color: var(--lq-accent);
}

.lq-notices__when {
    color: var(--lq-text-3);
    font-size: var(--lq-fs-2xs);
}

.lq-notices__empty {
    margin: 0;
    padding: var(--lq-space-5) var(--lq-space-4);
    color: var(--lq-text-2);
    font-size: var(--lq-fs-sm);
    text-align: center;
}

@media (max-width: 980px) {
    .lq-sidebar .lq-notices-open {
        display: none;
    }

    .lq-notices:not([hidden]) {
        inset-block: auto calc(var(--lq-tabbar-h) + var(--lq-space-2));
        inset-inline: var(--lq-space-3);
        width: auto;
        max-height: 70vh;
    }
}
