/* ==========================================================================
   elluminate Design System
   Self-contained reference stylesheet (no Bootstrap, no DevExtreme).
   All tokens are mirrored from elluminate-ui/src/assets/styles/utils/
   ========================================================================== */

:root {
    /* -- elluminate Palette: PRIMARY (blue) -- */
    --blue-100: #F0F5FA;
    --blue-200: #CADDEE;
    --blue-300: #A3C5E2;
    --blue-400: #82B0D9;
    --blue-500: #3B85C7;
    --blue-600: #1F68A8;
    --blue-700: #215887;
    --blue-800: #1E4060;
    --blue-900: #182B3B;

    /* -- elluminate Palette: NEUTRAL (gray) -- */
    --white: #FFFFFF;
    --gray-100: #F6F6F6;
    --gray-200: #E8E8E8;
    --gray-300: #DDDDDD;
    --gray-400: #BBBBBB;
    --gray-500: #767676;
    --gray-600: #606060;
    --gray-700: #4B4B4B;
    --gray-800: #333333;
    --gray-900: #1A1A1A;
    --black: #000000;

    /* -- elluminate Palette: SUPPORTING -- */
    --green-100: #EDF6EA;
    --green-200: #C0E0B5;
    --green-300: #92CA81;
    --green-400: #6BB859;
    --green-500: #1F8915;
    --green-600: #227817;
    --green-700: #206117;
    --green-800: #1C4614;
    --green-900: #162D11;

    --yellow-100: #FFF2DE;
    --yellow-200: #FDD189;
    --yellow-300: #EEB12B;
    --yellow-400: #D49C21;
    --yellow-500: #96701D;
    --yellow-600: #82601C;
    --yellow-700: #634A18;
    --yellow-800: #4E3A16;
    --yellow-900: #322611;

    --red-100: #FEF1ED;
    --red-200: #FACDC2;
    --red-300: #F2AA98;
    --red-400: #E98E78;
    --red-500: #CD482D;
    --red-600: #BD341F;
    --red-700: #9C2D1B;
    --red-800: #6F2416;
    --red-900: #461B11;

    --indigo-100: #F5F2FC;
    --indigo-200: #DBD3F3;
    --indigo-300: #C0B4EB;
    --indigo-400: #A796E4;
    --indigo-500: #7466D1;
    --indigo-600: #5A52CB;
    --indigo-700: #3F42C5;
    --indigo-800: #2C2F94;
    --indigo-900: #232059;

    /* -- Gradients -- */
    --gradient-blue-100: linear-gradient(180deg, #F0F4FA 0%, #A3BDE2 100%);
    --gradient-blue-200: linear-gradient(180deg, #CAD8EE 0%, #82A9D9 100%);
    --gradient-blue-300: linear-gradient(180deg, #A3BDE2 0%, #3B85C7 100%);
    --gradient-blue-400: linear-gradient(180deg, #3B85C7 0%, #215887 100%);
    --gradient-blue-500: linear-gradient(180deg, #1F6CA8 0%, #1E4060 100%);
    --gradient-blue-600: linear-gradient(180deg, #215887 0%, #18293B 100%);
    --gradient-red-100:  linear-gradient(180deg, #D55B42 0%, #9C2D1B 100%);
    --gradient-red-200:  linear-gradient(180deg, #C4341F 0%, #6F2416 100%);
    --gradient-red-300:  linear-gradient(180deg, #9C2D1B 0%, #461B11 100%);

    /* -- Data-Color Palette (subset shown — full ramps in design.md) -- */
    --data-red-100:    #FFF1ED; --data-red-200:    #FFCBC0; --data-red-500:    #E6190F; --data-red-700:    #A61D19;
    --data-orange-100: #FFF1E8; --data-orange-200: #FFCDAE; --data-orange-400: #F77623; --data-orange-500: #C15406; --data-orange-600: #AA4C0E;
    --data-yellow-100: #FFF4CB; --data-yellow-200: #FAD50F; --data-yellow-300: #DABA16;
    --data-lime-100:   #EBFAC9; --data-lime-200:   #AAEB36; --data-lime-500:   #5E7E25;
    --data-green-100:  #DCFDD6; --data-green-200:  #70F26F; --data-green-500:  #22872A;
    --data-aqua-100:   #D6FBF7; --data-aqua-200:   #47EEE3; --data-aqua-500:   #21837E;
    --data-blue-100:   #EFF9FE; --data-blue-200:   #C8E8FA; --data-blue-500:   #1579C1;
    --data-indigo-100: #F6F1FF; --data-indigo-200: #E0D0FD; --data-indigo-600: #6648F1;
    --data-violet-100: #F8F1FE; --data-violet-200: #E7CEFD; --data-violet-500: #984AF2;
    --data-fuchsia-100:#FFEFFA; --data-fuchsia-200:#FFC7EC; --data-fuchsia-500:#D813B0;

    /* -- Type -- */
    --font-primary: Roboto, 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --font-fa: "Font Awesome 7 Pro", serif;
    --font-size-root: 16px;
    --font-size-body: 12px;
    --font-size-th: 0.70rem;
    --font-size-td: 0.75rem;
    --font-size-minor-header: 0.85rem;
    --font-size-inline-error: 11.5px;

    /* -- Dimensions -- */
    --header-height: 50px;
    --nav-items-height: 38px;
    --tabs-height: 43px;
    --row-height: 22px;
    --row-height-header: 32px;
    --sidebar-width: 220px;
    --field-height: 32px;
    --input-height: 28px;
    --toolbar-height: 32px;
    --button-height-sm: 24px;
    --button-height-md: 32px;
    --button-height-lg: 40px;
    --border-radius: 4px;
    --active-rail-width: 2px;
    --active-rail-color: var(--data-orange-400);
    --focus-outline-color: var(--blue-600);
    --disabled-opacity: 0.4;

    /* -- Effects -- */
    --transition: all 300ms ease;
    --shadow-normal:     0 1px 2px rgba(0, 0, 0, 0.2);    /* PRIMARY — every card & tile */
    --shadow-large:      0 3px 15px 0 rgba(0, 0, 0, 0.4); /* popovers, toasts, dropdowns, sticky headers */
    --shadow-modal:      0 20px 40px 0 rgba(0, 0, 0, 0.4); /* modal-popup mixin */
    --shadow-dropdown:   0 7px 12px 1px rgba(0, 0, 0, 0.4); /* rare — dx-select-box only */
    --shadow-top-normal: 0 -1px 2px rgba(0, 0, 0, 0.2);   /* rare — bottom-anchored bars */
    --popup-backdrop:    rgba(0, 0, 0, 0.4);

    /* -- Buttons -- */
    --primary-button-bg: var(--gradient-blue-400);
    --primary-button-bg-hover: var(--gradient-blue-500);
    --primary-button-bg-active: var(--gradient-blue-600);
    --primary-button-bg-focus: var(--gradient-blue-500);
    --secondary-button-bg: var(--white);
    --secondary-button-bg-hover: var(--blue-100);
    --secondary-button-bg-active: var(--blue-200);
    --secondary-button-color: var(--blue-600);
    --secondary-button-color-hover: var(--blue-700);
    --secondary-button-color-active: var(--blue-800);

    /* -- Risk -- */
    --risk-low: var(--green-500);
    --risk-high-low: var(--green-700);
    --risk-low-medium: var(--yellow-300);
    --risk-high-medium: var(--yellow-400);
    --risk-high: var(--red-600);
    --risk-extreme-high: var(--red-800);
}

/* ============================== Reset ============================== */
*, *::before, *::after { box-sizing: border-box; }
html, body, div, span, h1, h2, h3, h4, h5, h6, p, a, b, i, em, strong, small,
ol, ul, li, fieldset, form, label, table, caption, thead, tbody, tr, th, td,
section, article, header, footer, nav, aside, figure, figcaption, button, input, textarea, select {
    margin: 0;
    padding: 0;
    border: 0;
    vertical-align: baseline;
}
ol, ul { list-style: none; }
table { border-collapse: collapse; border-spacing: 0; }

/* ============================== Base ============================== */
html, body {
    font-family: var(--font-primary);
    font-size: var(--font-size-root);
    color: var(--gray-900);
    background-color: var(--gray-100);
}

body {
    line-height: 1.5;
    min-height: 100vh;
}

p, .text { font-size: 12px; line-height: 1.5; }
h1 { font-size: 1.9rem;     line-height: 1.2;    font-weight: 400; }
h2 { font-size: 1.1875rem;  line-height: 1.25;   font-weight: 400; }
h3 { font-size: 1rem;       line-height: 1.25rem;font-weight: 400; }
h4 { font-size: 0.875rem;   line-height: 1.125rem; font-weight: 400; }
h5 { font-size: 0.75rem;    line-height: 1.125rem; font-weight: 400; }
h6 { font-size: 0.625rem;   line-height: 1.125rem; font-weight: 400; }
label { font-size: 12px; line-height: 1; display: inline-block; }
small { font-size: 0.75rem; }

a {
    text-decoration: none;
    color: var(--blue-600);
    transition: var(--transition);
}
a:hover { color: var(--black); }
a:visited { color: var(--blue-600); }

code, kbd, samp {
    font-family: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, 'Courier New', monospace;
    font-size: 0.85em;
    background-color: var(--gray-100);
    padding: 1px 5px;
    border-radius: 3px;
    color: var(--gray-800);
    border: 1px solid var(--gray-200);
}
pre {
    background-color: var(--gray-900);
    color: var(--gray-100);
    padding: 12px 16px;
    border-radius: var(--border-radius);
    overflow-x: auto;
    font-family: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.5;
}
pre code { background: none; border: none; padding: 0; color: inherit; }

/* ============================== Layout ============================== */
.app {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--header-height) 1fr;
    grid-template-areas:
        "masthead masthead"
        "sidebar  main";
    min-height: 100vh;
}

.masthead {
    grid-area: masthead;
    background: var(--blue-900);
    color: var(--white);
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 0 20px;
    box-shadow: var(--shadow-normal);
    position: sticky;
    top: 0;
    z-index: 10;
}
.masthead-logo {
    font-size: 18px;
    font-weight: 500;
    letter-spacing: 0.5px;
    color: var(--white);
    display: flex;
    align-items: center;
    gap: 10px;
}
.masthead-logo-mark {
    height: 28px;
    width: auto;
    display: block;
    flex: 0 0 auto;
}
.masthead-logo-wordmark { font-weight: 500; }
.masthead-logo-suffix { color: var(--blue-300); font-weight: 300; }
.masthead-spacer { flex: 1; }
.masthead-meta {
    font-size: 12px;
    color: var(--blue-200);
    display: flex;
    gap: 20px;
}

.sidebar {
    grid-area: sidebar;
    background-color: var(--white);
    border-right: 1px solid var(--gray-300);
    padding: 16px 0;
    overflow-y: auto;
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
}
.sidebar-section {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 16px 6px 16px;
}
.sidebar a {
    display: block;
    padding: 6px 16px;
    font-size: 12px;
    color: var(--gray-700);
    border-left: var(--active-rail-width) solid transparent;
    transition: var(--transition);
}
.sidebar a:hover {
    background-color: var(--gray-100);
    color: var(--gray-900);
    border-left-color: var(--gray-300);
}
.sidebar a.active {
    background-color: var(--blue-100);
    color: var(--blue-700);
    border-left-color: var(--active-rail-color);
}

.main {
    grid-area: main;
    padding: 24px 32px 80px 32px;
    max-width: 1400px;
}

/* ============================== One-sheeter hero ============================== */
.hero {
    background: linear-gradient(180deg, #F0F5FA 0%, #FFFFFF 60%);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    padding: 28px 28px 24px 28px;
    margin-bottom: 48px;
    box-shadow: var(--shadow-normal);
}
.hero-title {
    font-size: 30px;
    line-height: 36px;
    font-weight: 400;
    color: var(--gray-900);
    margin-bottom: 4px;
}
.hero-subtitle {
    font-size: 12px;
    color: var(--gray-600);
    margin-bottom: 20px;
}
.hero-stack-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: 12px;
    font-size: 11px;
    color: var(--gray-700);
    margin-right: 6px;
    margin-bottom: 4px;
    font-family: var(--font-primary);
}
.hero-stack-pill .pill-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--blue-500);
}
.hero-color-strip {
    display: flex;
    gap: 6px;
    margin: 20px 0 24px 0;
}
.hero-color {
    flex: 1;
    height: 44px;
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 6px 8px;
    font-size: 10px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--white);
    text-shadow: 0 1px 1px rgba(0,0,0,0.3);
}
.hero-color.is-light {
    color: var(--gray-900);
    text-shadow: none;
    border: 1px solid var(--gray-200);
}
.hero-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}
.hero-tile {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.hero-tile-head {
    padding: 6px 12px;
    background: var(--gray-100);
    border-bottom: 1px solid var(--gray-200);
    font-size: 10px;
    font-weight: 700;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.hero-tile-body {
    padding: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    flex: 1;
}
.hero-tile-body.column { flex-direction: column; align-items: stretch; }
.hero-tile-body .mini-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 11px;
}
.hero-tile-body .mini-table th,
.hero-tile-body .mini-table td {
    padding: 3px 6px;
    border-bottom: 1px solid var(--gray-200);
    text-align: left;
}
.hero-tile-body .mini-table th {
    background: var(--gray-100);
    font-size: 9px;
    font-weight: 400;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.hero-tile-body .mini-modal {
    width: 100%;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-normal);
}
.hero-tile-body .mini-modal-head {
    height: 28px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    padding: 0 8px;
    font-size: 11px;
    font-weight: 500;
    color: var(--gray-900);
    background: var(--white);
}
.hero-tile-body .mini-modal-head .spacer { flex: 1; }
.hero-tile-body .mini-modal-head .x {
    color: var(--gray-500);
    font-size: 10px;
}
.hero-tile-body .mini-modal-body {
    padding: 10px;
    font-size: 11px;
    color: var(--gray-700);
    background: var(--white);
}
.hero-tile-body .mini-modal-foot {
    padding: 6px 8px;
    border-top: 1px solid #eaeaea;
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    background: var(--white);
}
.hero-divider {
    text-align: center;
    margin-top: 4px;
    font-size: 11px;
    color: var(--gray-500);
    font-family: 'JetBrains Mono', monospace;
}
.hero-divider:after {
    content: '↓';
    margin-left: 6px;
}

/* ============================== Page sections ============================== */
.section {
    margin-bottom: 56px;
    /* Reserve space for the sticky masthead so sidebar anchor jumps
       don't land under the header. Uses --header-height (50px). */
    scroll-margin-top: calc(var(--header-height) + 10px);
}
.section[id] { scroll-margin-top: calc(var(--header-height) + 10px); }
.subsection-title[id],
[id]:target {
    scroll-margin-top: calc(var(--header-height) + 10px);
}
.section-title {
    font-size: 1.1875rem;
    color: var(--gray-900);
    margin-bottom: 6px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-300);
    display: flex;
    align-items: baseline;
    gap: 12px;
}
.section-title-num {
    color: var(--gray-400);
    font-size: 0.875rem;
    font-variant-numeric: tabular-nums;
}
.section-lead {
    font-size: 12px;
    color: var(--gray-600);
    max-width: 720px;
    margin-bottom: 20px;
    line-height: 1.6;
}
.subsection-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--gray-800);
    margin: 24px 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Showcase block: a "card" wrapping live examples + caption */
.showcase {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    margin-bottom: 16px;
    overflow: hidden;
}
.showcase-header {
    height: var(--row-height-header);
    background: var(--gray-100);
    border-bottom: 1px solid var(--gray-300);
    border-top: 1px solid var(--gray-300);
    padding: 0 12px;
    display: flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gray-800);
    justify-content: space-between;
}
.showcase-header small { color: var(--gray-500); font-weight: 400; }
.showcase-body {
    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}
.showcase-body.column { flex-direction: column; align-items: stretch; }
.showcase-body.dark {
    background: var(--blue-900);
    color: var(--gray-100);
}
.showcase-caption {
    padding: 10px 12px;
    border-top: 1px solid var(--gray-200);
    font-size: 11px;
    color: var(--gray-500);
    line-height: 1.5;
    background: var(--gray-100);
}

/* ============================== Color swatches ============================== */
.swatch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    width: 100%;
}
.swatch {
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--white);
}
.swatch-fill {
    height: 56px;
    width: 100%;
}
.swatch-meta {
    padding: 6px 8px;
    font-size: 11px;
    font-family: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
    line-height: 1.4;
}
.swatch-meta strong { display: block; color: var(--gray-900); font-weight: 600; }
.swatch-meta span { color: var(--gray-500); }
.swatch-ramp {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 0;
    width: 100%;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    overflow: hidden;
}
.swatch-ramp .stop {
    height: 64px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 6px;
    font-size: 10px;
    font-family: 'JetBrains Mono', monospace;
    line-height: 1.3;
}
.swatch-ramp .stop b { font-weight: 600; }
.gradient-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
    width: 100%;
}
.gradient-card {
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    overflow: hidden;
}
.gradient-fill { height: 70px; }
.gradient-meta {
    padding: 6px 8px;
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--gray-700);
}

/* ============================== Typography demo ============================== */
.type-row {
    display: grid;
    grid-template-columns: 110px 70px 80px 1fr;
    gap: 16px;
    align-items: baseline;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-200);
}
.type-row:last-child { border-bottom: none; }
.type-row .meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--gray-500);
}
.type-row .label {
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-700);
}

/* ============================== Buttons ============================== */
button { font-family: inherit; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: none;
    cursor: pointer;
    border-radius: var(--border-radius);
    font-weight: 500;
    font-size: 12px;
    line-height: 1;
    padding: 0 8px;
    height: var(--button-height-sm);
    min-width: 60px;
    background: transparent;
    color: var(--gray-900);
    transition: var(--transition);
    white-space: nowrap;
    user-select: none;
}
.btn:disabled, .btn.is-disabled {
    opacity: var(--disabled-opacity);
    pointer-events: none;
}

.btn-primary {
    background-image: var(--primary-button-bg);
    color: var(--white);
}
.btn-primary:hover {
    background-image: var(--primary-button-bg-hover);
    color: var(--white);
}
.btn-primary:active {
    background-image: var(--primary-button-bg-active);
}
.btn-primary:focus {
    outline: 1px solid var(--white);
    box-shadow: 0 0 0 3px var(--focus-outline-color);
    background-image: var(--primary-button-bg-focus);
}

.btn-secondary, .btn-ghost {
    background: var(--secondary-button-bg);
    color: var(--secondary-button-color);
    border: 1px solid var(--secondary-button-color);
    outline: 1px solid transparent;
}
.btn-secondary:hover, .btn-ghost:hover {
    background: var(--secondary-button-bg-hover);
    border-color: var(--secondary-button-color-hover);
    color: var(--secondary-button-color-hover);
}
.btn-secondary:active, .btn-ghost:active {
    background: var(--secondary-button-bg-active);
    border-color: var(--secondary-button-color-active);
    color: var(--secondary-button-color-active);
}
.btn-secondary:focus, .btn-ghost:focus {
    outline: 1px solid var(--white);
    box-shadow: 0 0 0 3px var(--focus-outline-color);
}

.btn-danger {
    background-image: var(--gradient-red-100);
    color: var(--white);
}
.btn-danger:hover { background-image: var(--gradient-red-200); }

.btn-outline {
    background: transparent;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
    height: 28px;
}

.btn-link {
    background: transparent;
    color: var(--blue-600);
    border: none;
    padding: 0;
    height: auto;
    min-width: unset;
    text-align: left;
}
.btn-link:hover { color: var(--black); }

.btn-icon {
    border: none;
    background: transparent;
    color: var(--gray-700);
    padding: 6px 4px;
    min-width: 16px;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: auto;
}
.btn-icon:hover { color: var(--blue-600); background-color: rgba(0,0,0,0.04); }
.btn-icon-for-dark { color: var(--gray-100); }
.btn-icon-for-dark:hover { color: var(--white); background-color: rgba(255,255,255,0.1); }

.btn-round {
    border-radius: 50%;
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    padding: 0 !important;
}

.btn-sm { height: var(--button-height-sm); }
.btn-md { height: var(--button-height-md); }
.btn-lg { height: var(--button-height-lg); padding: 0 14px; }

/* ============================== Forms ============================== */
.form-group {
    margin-bottom: 8px;
    width: 100%;
}
.form-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    margin: 0 0 10px 0;
}

/* Labels-over-inputs spacing —
   when a label is immediately followed by a form input, give it 4px breathing
   room so the label text doesn't crash into the input. Excludes checkbox/radio
   labels (where the input is INSIDE the label, not a sibling).
   Equivalent shorthand for flex-column containers: use `gap: 4px` on the parent. */
label:has(+ input:not([type="checkbox"]):not([type="radio"])),
label:has(+ textarea),
label:has(+ select),
label:has(+ .form-control) {
    display: block;
    margin-bottom: 4px;
}

/* Flex-column form helper — alternative to label margin-bottom; applied via .form-column */
.form-column {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.form-column label:has(+ input, + textarea, + select, + .form-control) {
    margin-bottom: 0;
}

.form-control,
input[type='text'],
input[type='number'],
input[type='email'],
input[type='password'],
textarea,
select {
    color: var(--gray-700);
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-300);
    font-family: var(--font-primary);
    font-size: 0.75rem;
    line-height: 1.125rem;
    padding: 0 0.75rem;
    background: var(--white);
    height: var(--input-height);
    transition: var(--transition);
    outline: none;
    width: 100%;
    max-width: 320px;
}
textarea {
    height: auto;
    padding: 6px 0.75rem;
    resize: vertical;
    min-height: 64px;
}
.form-control[type='text'] { height: var(--field-height); }

input:focus, textarea:focus, select:focus, .form-control:focus {
    border: 1px solid var(--blue-600);
}
input:disabled, textarea:disabled, select:disabled, .form-control:disabled {
    opacity: var(--disabled-opacity);
}
input.readonly, textarea.readonly {
    background-color: var(--gray-100);
    color: var(--gray-700);
    pointer-events: none;
}
input.error, .form-control.error,
input.is-invalid, .form-control.is-invalid {
    color: var(--red-500);
    border: 1px solid var(--red-500);
}
input::placeholder, textarea::placeholder { color: #999; }

/* ============================== Alerts ==============================
   Bootstrap-style alert blocks used inline inside dialogs, panels, and
   forms to surface error / warning / info / success messages. The
   elluminate base typography override sets font-size: 12px and line-height: 1.3.

   Pair with:
     .mb-0        — remove default bottom margin when stacking tightly
     .rounded-0   — remove radius for full-width banner alerts (common
                    inside dialog headers)
   ================================================================== */
.alert {
    position: relative;
    display: block;
    padding: 12px 20px;
    margin-bottom: 16px;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    font-family: var(--font-primary);
    font-size: 12px;
    line-height: 1.3;
}
.alert > p,
.alert > ul         { margin-bottom: 0; }
.alert > p + p      { margin-top: 5px; }
.alert h4           { margin-top: 0; font-size: 14px; font-weight: 700; }
.alert .alert-link  { font-weight: 700; color: inherit; text-decoration: underline; }

.alert-success      { background-color: #D4EDDA; border-color: #C3E6CB; color: #155724; }
.alert-info         { background-color: #D1ECF1; border-color: #BEE5EB; color: #0C5460; }
.alert-warning      { background-color: #FFF3CD; border-color: #FFEEBA; color: #856404; }
.alert-danger       { background-color: #F8D7DA; border-color: #F5C6CB; color: #721C24; }
.alert-primary      { background-color: #CCE5FF; border-color: #B8DAFF; color: #004085; }
.alert-secondary    { background-color: var(--gray-100); border-color: var(--gray-300); color: var(--gray-700); }

/* Standard Bootstrap utility helpers used with alerts */
.mb-0               { margin-bottom: 0 !important; }
.rounded-0          { border-radius: 0 !important; }

/* Required asterisk (matches ecsRequired) */
.ecs-required-asterisk {
    color: var(--red-600);
    margin-right: 0.25rem;
    font-size: 16px;
    line-height: 0;
    vertical-align: middle;
}

/* Checkbox + radio (visual proxies) */
input[type='checkbox'], input[type='radio'] {
    width: 14px;
    height: 14px;
    accent-color: var(--blue-600);
    margin: 0 6px 0 0;
    vertical-align: middle;
}

/* ============================== Popup toast alerts ==============================
   DevExtreme dx-toast styling (used via AlertsService → notify()).
   See design.md §6.4 (popup variant). Position: top-center, z-index 9006.
   ============================================================================== */

/* Stage container — gives toasts a "floating" backdrop for the showcase */
.toast-stage {
    position: relative;
    background:
        repeating-linear-gradient(
            45deg,
            rgba(0,0,0,0.025) 0 8px,
            transparent 8px 16px
        ),
        var(--white);
    border: 1px dashed var(--gray-300);
    border-radius: var(--border-radius);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-height: 80px;
}
.toast-stage::before {
    content: 'top-center · z-index 9006 · floats over page content';
    font-size: 10px;
    color: var(--gray-500);
    font-family: 'JetBrains Mono', monospace;
    text-align: center;
    margin-bottom: 4px;
}

/* Toast root — matches production .dx-toast-content */
.popup-toast {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    width: 370px;
    max-width: 100%;
    padding: 15px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-large);
    background: linear-gradient(150deg, rgb(208,208,208) 0%, rgba(255,255,255,1) 50%, rgb(214,214,214) 75%);
    color: var(--gray-900);
    font-family: var(--font-primary);
}

.popup-toast-icon {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    font-size: 26px;
    font-weight: 300;
    line-height: 1;
}
.popup-toast-icon.is-success { color: var(--green-500); }
.popup-toast-icon.is-info    { color: var(--blue-600); }
.popup-toast-icon.is-warning { color: #EC7614; } /* $carrot-orange-F — toast-only warning hue */
.popup-toast-icon.is-error   { color: var(--red-500); }

.popup-toast-message {
    flex: 1;
    padding: 0 15px;
    font-size: 12px;
    line-height: 1.4;
    overflow-wrap: anywhere;
    overflow: auto;
    max-height: 600px;
    color: var(--gray-900);
}
.popup-toast-message strong { font-weight: 500; }

.popup-toast-close {
    position: absolute;
    top: 0;
    right: 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--gray-900);
    font-size: 0.9rem;
    font-weight: 300;
    line-height: 1;
    padding: 6px 0 0 0;
    transition: opacity 200ms linear;
}
.popup-toast-close:hover { opacity: 0.6; }

/* ============================== Badges ============================== */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 400;
    min-width: 22px;
    padding: 3px 6px;
    border-radius: 10px;
    font-size: 12px;
    font-family: var(--font-primary);
    line-height: 1;
    color: var(--white);
    border: 1px solid transparent;
}
/* When a badge starts with a Font Awesome icon, give it 5px breathing room */
.badge > i:first-child,
.badge > .fa,
.badge > .fas:first-child,
.badge > .far:first-child,
.badge > .fal:first-child,
.badge > .fab:first-child,
.badge > .fad:first-child,
.badge > svg:first-child {
    margin-right: 5px;
}
/* Status badges (the dominant set used in production) */
.badge-success    { background: var(--green-500); }
.badge-warning    { background: var(--yellow-300); color: var(--gray-900); }
.badge-danger     { background: var(--red-600); }
.badge-info       { background: var(--blue-100); border-color: var(--blue-300); color: var(--blue-700); }
.badge-secondary  { background: var(--gray-500); }

/* Outline variants — for dense grids/lists */
.badge-outline-success   { background: var(--green-100);  border-color: var(--green-500);  color: var(--green-700); }
.badge-outline-warning   { background: var(--yellow-100); border-color: var(--yellow-400); color: var(--yellow-700); }
.badge-outline-danger    { background: var(--red-100);    border-color: var(--red-600);    color: var(--red-700); }
.badge-outline-info      { background: var(--blue-100);   border-color: var(--blue-600);   color: var(--blue-700); }
.badge-outline-secondary { background: var(--gray-100);   border-color: var(--gray-500);   color: var(--gray-700); }
.badge-outline-primary   { background: var(--blue-100);   border-color: var(--blue-600);   color: var(--blue-600); }
.badge-outline-muted     { background: var(--gray-100);   border-style: dashed; border-color: var(--gray-400); color: var(--gray-700); }

/* ============================== Tables ============================== */
.table {
    table-layout: fixed;
    width: 100%;
    border-collapse: collapse;
    color: var(--gray-900);
}
.table thead tr {
    height: var(--row-height-header);
    background-color: var(--gray-100);
}
.table thead th {
    font-size: var(--font-size-th);
    vertical-align: middle;
    padding: 4px 8px;
    font-weight: 400;
    border: 1px solid var(--gray-300);
    border-bottom-width: 2px;
    text-align: left;
}
.table tbody tr { height: var(--row-height); }
.table tbody td {
    font-size: var(--font-size-td);
    vertical-align: middle;
    padding: 4px 8px;
    border: 1px solid var(--gray-300);
}
.table-no-borders th, .table-no-borders td, .table-no-borders tr { border: none !important; }
.table tbody tr:hover { background-color: var(--data-blue-200); }

/* ============================== Cards / Section headers ============================== */
.card-mixin {
    display: flex;
    flex-direction: column;
    background-color: var(--gray-100);
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-300);
    padding: 12px;
    min-height: 80px;
}
.rounded-borders {
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
    padding: 10px;
    height: 100%;
}
.stats-bg {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    background-color: var(--gray-100);
    padding: 4px;
    min-width: 120px;
}
.stats-bg .stats-label { font-size: 0.625rem; color: var(--gray-500); }
.stats-bg .stats-value { font-size: 1.1875rem; color: var(--gray-900); font-weight: 500; }

.section-header-bar {
    height: var(--row-height-header);
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    padding-left: 12px;
    background-color: var(--gray-100);
    border-bottom: 1px solid var(--gray-300);
    border-top: 1px solid var(--gray-300);
}
.light-blue-section-header {
    display: flex;
    flex-direction: row;
    background-color: var(--blue-100);
    align-items: center;
    height: 32px;
    padding: 0 10px;
    font-size: 0.875rem;
}
.secondary-header {
    background-color: var(--blue-100);
    height: 32px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    font-size: 0.85rem;
}

/* ============================== Toolbars ============================== */
.toolbar {
    height: var(--toolbar-height);
    background-image: var(--gradient-blue-600);
    color: var(--white);
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 0 10px;
    border-radius: var(--border-radius);
}
.toolbar-secondary {
    height: var(--toolbar-height);
    background-color: var(--gray-100);
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-300);
    display: flex;
    align-items: center;
    padding: 0 10px;
}
.toolbar-minimal {
    height: var(--toolbar-height);
    background: transparent;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    padding: 0 10px;
}
.toolbar-title {
    flex: 1;
    font-size: 12px;
    font-weight: 500;
    margin-right: 10px;
}
.toolbar-actions { display: flex; gap: 6px; }

/* ============================== Tabs ============================== */
.nav-tabs {
    display: flex;
    flex-direction: row;
    background-color: var(--white);
    border-bottom: none;
}
.nav-tabs .nav-link {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 20px;
    border: none;
    border-right: 1px solid var(--gray-300);
    border-radius: 0;
    color: var(--gray-800);
    font-size: 12px;
    text-decoration: none;
    background: var(--white);
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}
.nav-tabs .nav-link:hover { color: var(--gray-900); }
.nav-tabs .nav-link::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--active-rail-color);
    opacity: 0;
    transform: scale(0.05);
    transition: transform 0.2s, opacity 0.2s;
}
.nav-tabs .nav-link.active {
    background-color: #f7f7f7;
}
.nav-tabs .nav-link.active::after {
    transform: scale(1) translateX(-1px);
    opacity: 1;
}
.tab-content {
    padding: 20px;
    border-top: 1px solid var(--gray-300);
    font-size: 12px;
    background: var(--white);
}

/* ============================== Dropdown menu ============================== */
.dropdown-menu {
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-dropdown);
    padding: 3px 0;
    font-size: 12px;
    min-width: 180px;
}
.dropdown-header {
    padding: 5px 10px;
    font-size: 11px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.dropdown-item {
    display: block;
    padding: 3px 10px;
    color: var(--gray-800);
    cursor: pointer;
    transition: var(--transition);
}
.dropdown-item:hover { background: var(--gray-100); color: var(--gray-900); }
.dropdown-divider {
    height: 0;
    margin: 3px 0;
    border-top: 1px solid var(--gray-300);
}

/* ============================== Modals (preview – inline rendering) ============================== */
.modal-preview {
    position: relative;
    width: 100%;
    background: var(--popup-backdrop);
    border-radius: var(--border-radius);
    padding: 32px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    overflow: auto;
    box-sizing: border-box;
}
.modal-content {
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-modal);
    width: min(600px, 100%);
    overflow: hidden;
    flex-shrink: 0;
}
/* Modal header — light, NOT the dark page-toolbar gradient */
.modal-header {
    height: var(--toolbar-height);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 0 8px 0 16px;
    gap: 8px;
}
.modal-header h4 {
    flex: 1;
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-900);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.modal-header .modal-close {
    background: transparent;
    border: none;
    color: var(--gray-700);
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: var(--border-radius);
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.modal-header .modal-close:hover {
    background: var(--gray-100);
    color: var(--blue-600);
}
.dialog-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 20px;
    line-height: 1.2;
    font-size: 14px;
    gap: 8px;
}
.dialog-content p { font-size: 14px; }
.dialog-buttons {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid #eaeaea;
    padding: 10px;
}

/* ============================== Tooltips ============================== */
/* Bootstrap-style */
.tt-pop {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 28px 18px 12px 18px;
    border: 1px dashed var(--gray-300);
    border-radius: var(--border-radius);
    background: var(--white);
}
.tt-pop::before {
    content: 'simulated open state';
    position: absolute;
    top: 4px;
    left: 8px;
    font-size: 10px;
    color: var(--gray-500);
    font-family: 'JetBrains Mono', monospace;
}
.tooltip-bs {
    background: rgba(0,0,0,0.9);
    color: var(--white);
    padding: 6px 10px;
    border-radius: var(--border-radius);
    font-size: 12px;
    line-height: 1.4;
    max-width: 350px;
    position: relative;
}
.tooltip-bs::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0,0,0,0.9);
    border-bottom: 0;
}

/* ============================== Icons ==============================
   This asset bundles Font Awesome 7 Pro locally (see /fontawesome).
   No external CDN dependency for icons — everything renders offline.

   Icon-weight RULE:
       fal  = default (almost every icon — toolbars, badges, chevrons).
              Inherits the parent's text color.
       fas  = toggled-on / active state ONLY
              (filter when filtered, bell when on, etc.)
              Renders in PRIMARY BLUE (#1F68A8) by default — the standard
              "this is engaged" cue used across toolbars, dropdowns, and
              icon buttons. Don't override with semantic colors (yellow on
              star, red on heart, etc.) — the blue treatment handles all
              toggle states.
   ================================================================== */
/* DEFAULT: solid icons render in primary blue (#1F68A8) — the standard
   "this is engaged / active" cue. */
i.fas,
i.fa-solid {
    color: var(--blue-600);
}

/* Exceptions where the icon inherits its container's color instead of
   the default blue: */

/* (1) Inside primary / danger buttons (white text on a colored fill) */
.btn-primary i.fas,
.btn-primary i.fa-solid,
.btn-danger i.fas,
.btn-danger i.fa-solid {
    color: inherit;
}

/* (2) Inside badges (icon should match the badge's text color) */
.badge i.fas,
.badge i.fa-solid {
    color: inherit;
}

/* (3) On dark surfaces (masthead, dark page toolbar) — icons go light gray */
.btn-icon-for-dark i.fas,
.btn-icon-for-dark i.fa-solid,
.toolbar i.fas,
.toolbar i.fa-solid {
    color: var(--gray-100);
}
.btn-icon-for-dark:hover i.fas,
.btn-icon-for-dark:hover i.fa-solid {
    color: var(--white);
}

/* ============================== Accordion (ngb-accordion proxy) ============================== */
.accordion details {
    border-bottom: 1px solid var(--gray-300);
    background: var(--white);
}
.accordion details summary {
    list-style: none;
    cursor: pointer;
    height: var(--toolbar-height);
    background-color: var(--gray-100);
    border-bottom: 1px solid var(--gray-300);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 500;
}
.accordion details summary::-webkit-details-marker { display: none; }
/* Disclosure chevron — light, rotates 90° when expanded. Never plus/minus. */
.accordion details summary::before {
    content: '\f054'; /* fa-chevron-right */
    font-family: 'Font Awesome 7 Pro';
    font-weight: 300; /* light weight */
    display: inline-block;
    width: 12px;
    font-size: 11px;
    color: var(--gray-700);
    transition: transform 200ms ease, color 200ms ease;
}
.accordion details[open] summary::before {
    transform: rotate(90deg);
    color: var(--blue-600);
}
.accordion details .body {
    padding: 12px 16px;
    font-size: 12px;
    color: var(--gray-700);
}

/* ============================== Risk levels ============================== */
.risk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
    width: 100%;
}
.risk-pill {
    border-radius: var(--border-radius);
    padding: 12px;
    text-align: center;
    font-size: 12px;
    font-weight: 500;
}
.risk-level-undefined  { background: var(--gray-200);          color: var(--gray-900); }
.risk-level-low        { background: var(--risk-low);          color: var(--white); }
.risk-level-high-low   { background: var(--risk-high-low);     color: var(--white); }
.risk-level-low-medium { background: var(--risk-low-medium);   color: var(--black); }
.risk-level-high-medium{ background: var(--risk-high-medium);  color: var(--black); }
.risk-level-high       { background: var(--risk-high);         color: var(--white); }
.risk-level-extreme-high { background: var(--risk-extreme-high); color: var(--white); }

/* ============================== Misc utilities ============================== */
.bg-warning, .bg-critical { background-color: var(--yellow-300) !important; }
.bg-success { background-color: var(--green-500) !important; color: var(--white); }
.bg-danger  { background-color: var(--red-600) !important;   color: var(--white); }
.bg-highlight { background-color: var(--blue-200); }
.bg-info { background-color: var(--blue-500) !important; color: var(--white); }
.bg-unknown { background-color: var(--gray-600) !important; color: var(--white); }
.text-danger   { color: var(--red-600) !important; }
.text-success  { color: var(--green-500) !important; }
.text-info     { color: var(--blue-500) !important; }
.text-primary  { color: var(--blue-600) !important; }
.text-gray     { color: var(--gray-500) !important; }
.text-warning  { color: var(--data-orange-600) !important; }

.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.gap-4 { gap: 24px; }
.overflow-ellipsis { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ============================== Z-index reference ============================== */
.zindex-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.zindex-table th, .zindex-table td {
    padding: 6px 10px;
    border: 1px solid var(--gray-300);
    text-align: left;
}
.zindex-table th { background: var(--gray-100); font-weight: 700; font-size: 0.70rem; }
.zindex-table td:first-child { font-family: 'JetBrains Mono', monospace; }
.zindex-table td:last-child  { text-align: right; font-family: 'JetBrains Mono', monospace; color: var(--blue-700); font-weight: 600; }

/* ============================== Shadows reference ============================== */
.shadow-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 24px;
    padding: 12px;
}
.shadow-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 16px;
    text-align: center;
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--gray-700);
}
.s-normal     { box-shadow: var(--shadow-normal); }
.s-large      { box-shadow: var(--shadow-large); }
.s-modal      { box-shadow: var(--shadow-modal); }
.s-dropdown   { box-shadow: var(--shadow-dropdown); }
.s-top-normal { box-shadow: var(--shadow-top-normal); }

/* ============================== Indicators ============================== */
.thinking-indicator {
    display: flex;
    flex-direction: row;
    align-items: center;
    height: 20px;
}
.thinking-indicator .thinking-text {
    font-size: 12px;
    background: linear-gradient(
        90deg,
        var(--gray-500) 0%,
        var(--gray-500) 32%,
        var(--gray-500) 36%,
        var(--gray-600) 40%,
        var(--gray-900) 46%,
        var(--gray-900) 54%,
        var(--gray-600) 60%,
        var(--gray-500) 64%,
        var(--gray-500) 100%
    );
    background-size: 400% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: thinkingGradient 1s linear infinite;
}
.thinking-indicator .thinking-circle {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin: 0 8px;
    background-color: var(--blue-600);
    animation: breathe 2.5s ease-in-out infinite;
}
@keyframes thinkingGradient {
    0%   { background-position: 100% 50%; }
    100% { background-position: 0%   50%; }
}
@keyframes breathe {
    0%, 100% { transform: scale(0.85); opacity: 0.70; }
    50%      { transform: scale(1.30); opacity: 1; }
}

/* ============================== Reference token grid ============================== */
.token-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.token-table th, .token-table td {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    text-align: left;
    vertical-align: top;
}
.token-table th { background: var(--gray-100); font-weight: 700; font-size: 0.70rem; }
.token-table code { font-size: 11px; }

/* ============================== Footer ============================== */
.footer {
    padding-top: 24px;
    border-top: 1px solid var(--gray-300);
    color: var(--gray-500);
    font-size: 11px;
    text-align: center;
    line-height: 1.6;
}

/* ============================== Masthead components ==============================
   Production-accurate styles for the 50px top app bar and its sub-elements.
   Mirrors elluminate-ui/src/app/core/components/header/modules/masthead/.
   See design.md §6.16 for the full spec.
   ============================================================================== */

/* Masthead-only accent token — active filter icon in .ecs-masthead-toolbar */
:root { --masthead-accent-aqua: #4EE5FB; }

/* Stage container — provides a dark backdrop frame around demo mastheads */
.masthead-stage {
    background-color: var(--blue-900);
    border-radius: var(--border-radius);
    overflow: hidden;
    width: 100%;
}

/* The masthead shell — 50px tall horizontal flex row */
.ecs-masthead {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    width: 100%;
    height: var(--header-height);
    background-color: var(--blue-900);
    color: var(--white);
    box-shadow: inset 1px 4px 9px -6px rgba(0, 0, 0, 0.3);
    font-family: var(--font-primary);
}

/* App-grid menu trigger (leftmost) — 9-dot launcher */
.ecs-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 100%;
    margin-left: 10px;
    background: transparent;
    border: none;
    color: var(--white);
    cursor: pointer;
    transition: var(--transition);
}
.ecs-menu-btn i { font-size: 18px; color: var(--white); }
.ecs-menu-btn:hover { background-color: var(--blue-800); }
.ecs-menu-btn:hover i { color: var(--white); }

/* Brand mark slot in masthead */
.eclinical-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    margin: 0 15px;
    padding: 2px 4px 0 0;
    background: transparent;
    border: none;
    cursor: pointer;
}
.eclinical-logo img { height: 28px; width: auto; display: block; }

/* Header label & badges (.ecs-header) */
.ecs-masthead-header {
    display: flex;
    align-items: center;
    height: 100%;
}
.ecs-header {
    display: flex;
    align-items: center;
    gap: 10px;
}
.ecs-header-label {
    font-family: var(--font-primary);
    font-size: 16px;
    font-weight: bold;
    color: var(--blue-200);
    margin-right: 15px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}
.ecs-header-label i { font-size: 10px; color: var(--blue-200); }

/* Masthead navigation column (dropdowns + tabs) */
.ecs-masthead-navigation {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    height: 100%;
}
.ecs-masthead-navigation-dropdowns,
.ecs-masthead-navigation-tabs {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    height: 100%;
}
.ecs-masthead-navigation-dropdowns-container {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    height: 100%;
    border-left: 1px solid var(--blue-700);
    margin-left: 15px;
}

/* Masthead navigation dropdown trigger */
.ecs-dropdown {
    display: flex;
    align-items: stretch;
    height: 100%;
}
.ecs-dropdown-button {
    display: flex;
    flex-direction: row;
    align-items: center;
    height: 100%;
    padding: 17px 15px 15px 15px;
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: 300;
    color: var(--blue-200);
    background: transparent;
    border: none;
    border-right: 1px solid var(--blue-700);
    cursor: pointer;
    transition: var(--transition);
}
.ecs-dropdown-button:hover {
    background-color: var(--blue-800);
    color: var(--white);
}
.ecs-dropdown-button .ecs-dropdown-chevron {
    font-size: 12px;
    margin-left: 15px;
    margin-top: -2px;
}

/* Demo helper to show a "hover" state inline */
.ecs-dropdown-button.is-hover-demo {
    background-color: var(--blue-800);
    color: var(--white);
}

/* Masthead sub-nav tabs (horizontal, dark variant) */
.ecs-masthead .sub-nav-container-horizontal {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    height: 100%;
    font-size: 14px;
}
.ecs-masthead .sub-nav-container-horizontal .sub-nav {
    display: flex;
    align-items: stretch;
}
.ecs-masthead .sub-nav-container-horizontal .sub-nav-item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 140px;
    height: 49px;
    padding: 8px 15px;
    color: var(--white);
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
}
.ecs-masthead .sub-nav-container-horizontal .sub-nav-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    right: 50%;
    height: 3px;
    width: 0;
    background-color: var(--data-orange-400);
    transition: all 300ms ease;
}
.ecs-masthead .sub-nav-container-horizontal .sub-nav-item:hover {
    background-color: var(--blue-800);
}
.ecs-masthead .sub-nav-container-horizontal .sub-nav-item-active,
.ecs-masthead .sub-nav-container-horizontal .sub-nav-item-active:hover {
    background-color: var(--blue-800);
}
.ecs-masthead .sub-nav-container-horizontal .sub-nav-item-active::after {
    width: 100%;
    left: 0;
    right: 0;
}
.ecs-masthead .sub-nav-container-horizontal .sub-nav-item-icon {
    margin-right: 8px;
    font-size: 14px;
}

/* Filter pills row (in masthead) */
.ecs-masthead-filters-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 5px;
    overflow: hidden;
    flex: 1;
    padding: 0 10px;
    min-width: 0;
}

/* Filter pill — common shell */
.filter-pill {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    overflow: hidden;
    height: 36px;
    max-width: 320px;
    padding: 2px;
    transition: all 200ms ease;
    background: transparent;
}
.filter-pill button {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 8px;
    background: transparent;
    border: none;
    transition: all 200ms ease;
    cursor: pointer;
    outline: 1px solid transparent;
    font-family: var(--font-primary);
}
.filter-pill button:disabled { opacity: var(--disabled-opacity); pointer-events: none; }
.filter-pill button:first-of-type {
    overflow: hidden;
    border-radius: 4px 0 0 4px;
    font-size: 11px;
    line-height: 1.2;
    border-right: none;
}
.filter-pill button:first-of-type > div {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    overflow: hidden;
}
.filter-pill button:first-of-type > div span {
    display: block;
    overflow: hidden;
    width: 100%;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.filter-pill button:first-of-type > div span + span {
    font-size: 12px;
    font-weight: 400;
}
.filter-pill button:last-of-type {
    border-radius: 0 4px 4px 0;
    font-size: 16px;
}

/* Filter pill — dark (used inside masthead) */
.filter-pill-dark button {
    background-color: var(--blue-800);
    color: var(--white);
    border: 1px solid var(--blue-400);
}
.filter-pill-dark button:first-of-type { border-right: none; }
.filter-pill-dark button:hover { background-color: var(--blue-700); }
.filter-pill-dark button:active { background-color: var(--blue-600); }
.filter-pill-dark button:focus {
    outline: 1px solid var(--white);
    outline-offset: -3px;
    background-color: var(--blue-700);
}

/* Filter pill — light (used on light page bodies) */
.filter-pill-light { padding: 0; }
.filter-pill-light button {
    background-color: var(--white);
    color: var(--gray-900);
    border: 1px solid var(--gray-400);
}
.filter-pill-light button:first-of-type { border-right: none; }
.filter-pill-light button:hover { background-color: var(--gray-100); }
.filter-pill-light button:active { background-color: var(--gray-200); }
.filter-pill-light button:focus {
    outline: 1px solid var(--blue-600);
    outline-offset: -3px;
    background-color: var(--gray-100);
}

/* Filter pill +N overflow */
.ecs-pill-overflow-dropdown {
    display: flex;
    align-items: center;
    height: 46px;
}
.ecs-pill-overflow-dropdown-button-container {
    height: 100%;
    padding: 4px 0 4px 6px;
    border-left: 1px solid var(--blue-700);
    display: flex;
    align-items: center;
}
.ecs-pill-overflow-dropdown-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 100%;
    background: transparent;
    border: none;
    color: var(--gray-100);
    font-size: 12px;
    cursor: pointer;
    gap: 4px;
    transition: var(--transition);
    border-radius: var(--border-radius);
}
.ecs-pill-overflow-dropdown-button:hover {
    background-color: var(--blue-700);
    color: var(--white);
}

/* Trailing toolbar (right-aligned actions) */
.ecs-masthead-toolbar {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-left: auto;
    padding: 0 10px;
    height: 100%;
}

/* Active filter icon — masthead-only aqua accent */
.ecs-masthead-toolbar .filter-active i { color: var(--masthead-accent-aqua); }

/* Search slot — Pattern A (search-only) and standalone shell */
.ecs-masthead-search {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 6px;
    position: relative;
}
.ecs-masthead-search input {
    height: 30px;
    width: 240px;
    background-color: var(--blue-800);
    border: 1px solid var(--blue-700);
    color: var(--white);
    border-radius: var(--border-radius);
    padding: 0 30px 0 10px;
    font-size: 12px;
    font-family: var(--font-primary);
}
.ecs-masthead-search > i {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--blue-200);
    font-size: 12px;
    pointer-events: none;
}
.ecs-masthead-search input::placeholder { color: var(--blue-200); opacity: 0.7; }
.ecs-masthead-search input:focus { outline: 1px solid var(--blue-400); outline-offset: 0; }

/* Search group — Pattern B (search-by picker joined to search input) */
.ecs-masthead-search-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    height: 100%;
    padding: 0 6px;
    gap: 0;
}
.ecs-masthead-search-by-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: 30px;
    min-width: 180px;
    padding: 0 10px;
    background-color: var(--blue-900);
    border: 1px solid var(--blue-700);
    border-right: none;
    border-radius: 4px 0 0 4px;
    color: var(--white);
    font-size: 12px;
    font-family: var(--font-primary);
    cursor: pointer;
    transition: var(--transition);
}
.ecs-masthead-search-by-btn:hover { background-color: var(--blue-800); }
.ecs-masthead-search-by-btn.is-open-demo { background-color: var(--blue-800); }
.ecs-masthead-search-by-label {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ecs-masthead-search-by-btn > i { font-size: 10px; color: var(--white); }

/* Inside a group, the search input joins seamlessly to the picker on its left */
.ecs-masthead-search-group .ecs-masthead-search { padding: 0; }
.ecs-masthead-search-group .ecs-masthead-search input { border-radius: 0 4px 4px 0; }
.ecs-masthead-search-group .ecs-masthead-search > i { right: 12px; }

/* Search-by popover — multi-select checkbox menu (Pattern B open state) */
.ecs-masthead-search-by-popover-stage {
    background: rgba(0,0,0,0.04);
    padding: 12px 16px 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}
.ecs-masthead-search-by-popover-stage::before {
    content: '↓ popover anchored to the picker trigger above';
    font-size: 10px;
    color: var(--gray-500);
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 6px;
    align-self: center;
}
.ecs-masthead-search-by-popover {
    display: inline-flex;
    flex-direction: column;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-large);
    min-width: 220px;
    padding: 6px 0;
}
.search-by-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    font-size: 12px;
    color: var(--gray-900);
    cursor: pointer;
    transition: background-color 200ms linear;
    margin: 0;
    user-select: none;
}
.search-by-option:hover { background-color: var(--blue-100); }
.search-by-option input[type="checkbox"] {
    margin: 0;
    width: 14px;
    height: 14px;
    accent-color: var(--blue-600);
    cursor: pointer;
}

/* Toolbar badge — count chip on masthead actions */
.toolbar-badge {
    margin-left: 4px;
    z-index: 9000;
}
.toolbar-badge:first-child { margin-left: 0; }
.toolbar-badge-clickable { cursor: pointer; }

/* Token swatch grid for masthead-only colors */
.masthead-token-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 8px;
    width: 100%;
}
.masthead-token-grid .token {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--white);
}
.masthead-token-grid .token-fill {
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.95);
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
}
.masthead-token-grid .token-fill.is-light { color: var(--gray-900); }
.masthead-token-grid .token-meta {
    padding: 6px 8px;
    font-size: 11px;
    line-height: 1.3;
}
.masthead-token-grid .token-meta strong { display: block; font-size: 11px; color: var(--gray-900); }
.masthead-token-grid .token-meta span { color: var(--gray-500); font-family: 'JetBrains Mono', monospace; }

/* ============================== Print-friendly ============================== */
@media print {
    .sidebar, .masthead { display: none; }
    .app { grid-template-columns: 1fr; grid-template-areas: "main"; }
}
