/*
 * FlexCC console shell for MainCRM.
 *
 * The CRM already speaks the FlexCC design language through flx-tokens.css +
 * flx-theme.css. This layer gives it the same *console* look the FlexCC admin
 * and the chat module's admin use (Google Cloud style): the Material token
 * re-point, a 64px top app bar with a pill search and an account chip, a
 * Cloud-console left nav, breadcrumbs, flat cards, rule-less tables and
 * Material buttons, inputs and tabs.
 *
 * Source of truth: flexcc resources/css/design/material-tokens.css and
 * design/pages/admin-workspace.css. Values are copied, re-scoped to .flx-theme.
 *
 * Load after flx-theme.css. Selectors that fight OneUI's dark sidebar/header
 * variants are anchored on #page-container so they outrank
 * `#page-container.sidebar-dark #sidebar …` without !important.
 */

/* ------------------------------------------------------------------ */
/* 1. Material tokens                                                  */
/* ------------------------------------------------------------------ */

.flx-theme {
    --flx-font-family-base: "Google Sans", "Google Sans Text", Roboto, "Helvetica Neue", Arial, sans-serif;
    --flx-font-family-display: "Google Sans", "Google Sans Display", Roboto, "Helvetica Neue", Arial, sans-serif;
    --flx-bg-page: #f8f9fa;
    --flx-bg-surface: #ffffff;
    --flx-bg-subtle: #f1f3f4;
    --flx-text-primary: #202124;
    --flx-text-secondary: #3c4043;
    --flx-text-muted: #5f6368;
    --flx-border: #dadce0;
    --flx-border-strong: #bdc1c6;
    --flx-outline: #80868b;
    --flx-radius-sm: 4px;
    --flx-radius-md: 8px;
    --flx-radius-lg: 8px;
    --flx-radius-xl: 12px;
    --flx-shadow-1: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
    --flx-shadow-2: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 2px 6px 2px rgba(60, 64, 67, 0.15);
    --flx-shadow-overlay: 0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15);
    --flx-dropdown-item-color: #3c4043;
    --flx-dropdown-item-hover-bg: #f1f3f4;
    --flx-dropdown-item-hover-color: #202124;
    --flx-input-alt-bg: #ffffff;
    --flx-input-alt-border: #80868b;
    --flx-input-alt-focus-bg: #ffffff;
    --flx-input-alt-placeholder: #80868b;
    --flx-input-radius: 4px;
    --flx-state-hover: rgba(60, 64, 67, 0.08);
    --flx-state-pressed: rgba(60, 64, 67, 0.12);
    --flx-topbar-height: 64px;
    --bs-border-radius: var(--flx-radius-md);
    -webkit-font-smoothing: antialiased;
}

.flx-theme.dark-mode {
    --flx-bg-page: #202124;
    --flx-bg-surface: #292a2d;
    --flx-bg-subtle: #303134;
    --flx-text-primary: #e8eaed;
    --flx-text-secondary: #bdc1c6;
    --flx-text-muted: #9aa0a6;
    --flx-border: #3c4043;
    --flx-border-strong: #5f6368;
    --flx-outline: #80868b;
    --flx-shadow-1: 0 1px 2px 0 rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15);
    --flx-shadow-2: 0 1px 2px 0 rgba(0, 0, 0, 0.3), 0 2px 6px 2px rgba(0, 0, 0, 0.15);
    --flx-shadow-overlay: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 4px 8px 3px rgba(0, 0, 0, 0.15);
    --flx-dropdown-bg: #303134;
    --flx-dropdown-border: #3c4043;
    --flx-dropdown-item-color: #e8eaed;
    --flx-dropdown-item-hover-bg: rgba(232, 234, 237, 0.08);
    --flx-dropdown-item-hover-color: #e8eaed;
    --flx-input-alt-bg: #303134;
    --flx-input-alt-border: #5f6368;
    --flx-input-alt-focus-bg: #303134;
    --flx-input-alt-placeholder: #9aa0a6;
    --flx-state-hover: rgba(232, 234, 237, 0.08);
    --flx-state-pressed: rgba(232, 234, 237, 0.12);
}

/* The tokens live on #page-container, so <body> (visible under short pages and
 * behind the footer) needs the page fill spelled out. */
#page-container.flx-theme,
#page-container.flx-theme.dark-mode {
    background-color: var(--flx-bg-page);
}

body:has(> #page-container.flx-theme) {
    background-color: #f8f9fa;
}

body:has(> #page-container.flx-theme.dark-mode) {
    background-color: #202124;
}

.flx-theme,
.flx-theme .fs-base,
.flx-theme .tooltip,
.flx-theme .popover {
    font-family: var(--flx-font-family-base);
}

/* ------------------------------------------------------------------ */
/* 2. Top app bar                                                      */
/* ------------------------------------------------------------------ */

#page-container.flx-theme #page-header {
    background: var(--flx-bg-surface);
    border-bottom: 1px solid var(--flx-border);
    box-shadow: none;
    color: var(--flx-text-primary);
}

#page-container.flx-theme #page-header > .flx-topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    height: var(--flx-topbar-height);
    min-height: var(--flx-topbar-height);
    padding: 0 16px;
}

.flx-topbar__start,
.flx-topbar__end {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
}

.flx-topbar__end {
    margin-left: auto;
}

.flx-topbar__end > form,
.flx-topbar__start > form {
    display: contents;
}

.flx-topbar__brand {
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
    margin: 0 8px 0 4px;
    padding: 4px 8px;
    border-radius: var(--flx-radius-sm);
    text-decoration: none;
    white-space: nowrap;
}

.flx-theme a.flx-topbar__brand,
.flx-theme a.flx-topbar__brand:hover {
    color: var(--flx-text-muted);
    text-decoration: none;
}

.flx-topbar__brand:focus-visible {
    outline: none;
    box-shadow: var(--flx-focus-ring);
}

.flx-topbar__product {
    font-family: var(--flx-font-family-display);
    font-size: 22px;
    font-weight: 400;
    line-height: 1;
    color: var(--flx-text-muted);
}

.flx-topbar__version {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: .02em;
    color: var(--flx-text-muted);
}

/* Round 40px icon actions, transparent until hovered (Cloud console app bar) */
#page-container.flx-theme .flx-topbar__icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--flx-text-muted);
    box-shadow: none;
    transition: background-color var(--flx-duration-fast, .12s) ease, color var(--flx-duration-fast, .12s) ease;
}

#page-container.flx-theme .flx-topbar__icon:hover,
#page-container.flx-theme .flx-topbar__icon[aria-expanded="true"] {
    background: var(--flx-state-hover);
    color: var(--flx-text-primary);
}

#page-container.flx-theme .flx-topbar__icon:focus-visible,
#page-container.flx-theme .flx-topbar__chip:focus-visible {
    outline: none;
    box-shadow: var(--flx-focus-ring);
}

.flx-topbar svg,
.flx-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.flx-topbar__dot {
    position: absolute;
    top: 9px;
    right: 9px;
    width: 8px;
    height: 8px;
    border: 2px solid var(--flx-bg-surface);
    border-radius: 50%;
    background: var(--flx-danger);
    box-sizing: content-box;
}

/* Language and account chips */
#page-container.flx-theme .flx-topbar__chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 8px 0 10px;
    border: 0;
    border-radius: var(--flx-radius-xl);
    background: transparent;
    color: var(--flx-text-secondary);
    font-size: var(--flx-font-size-sm);
    font-weight: 500;
    box-shadow: none;
}

#page-container.flx-theme .flx-topbar__chip:hover,
#page-container.flx-theme .flx-topbar__chip[aria-expanded="true"] {
    background: var(--flx-state-hover);
    color: var(--flx-text-primary);
}

.flx-topbar__chip svg {
    width: 18px;
    height: 18px;
}

#page-container.flx-theme .flx-topbar__account {
    gap: 10px;
    padding: 2px 8px 2px 4px;
    color: var(--flx-text-primary);
}

.flx-topbar__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border-radius: 50%;
    background: #007dfb;
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.flx-topbar__avatar--lg {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
    font-size: 15px;
}

.flx-topbar__name {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Pill search, the Cloud console's wide search field */
.flx-topbar__search {
    position: relative;
    flex: 1 1 auto;
    max-width: 720px;
    min-width: 0;
}

.flx-topbar__search-field {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    margin: 0;
    padding: 0 12px 0 14px;
    border-radius: var(--flx-radius-pill);
    background: var(--flx-bg-subtle);
    color: var(--flx-text-muted);
    cursor: text;
    transition: background-color .12s ease, box-shadow .12s ease;
}

.flx-topbar__search-field:hover,
.flx-topbar__search-field:focus-within {
    background: var(--flx-bg-surface);
    box-shadow: var(--flx-shadow-1);
}

#page-container.flx-theme .flx-topbar__search-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--flx-text-primary);
    font-size: var(--flx-font-size-sm);
    box-shadow: none;
    outline: none;
}

#page-container.flx-theme .flx-topbar__search-input::placeholder {
    color: var(--flx-text-muted);
}

.flx-topbar__kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border: 1px solid var(--flx-border);
    border-radius: var(--flx-radius-sm);
    background: var(--flx-bg-surface);
    color: var(--flx-text-muted);
    font-family: inherit;
    font-size: 12px;
    line-height: 1;
}

/* Customer search results drop straight under the pill */
#page-container.flx-theme #page-header .flx-topbar__results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 6px;
    z-index: 1060;
}

/* Header dropdowns: Material menus */
#page-container.flx-theme #page-header .dropdown-menu {
    margin-top: 6px;
    padding: 8px 0;
    border: 1px solid var(--flx-dropdown-border);
    border-radius: var(--flx-radius-md);
    background: var(--flx-dropdown-bg);
    box-shadow: var(--flx-dropdown-shadow);
}

#page-container.flx-theme #page-header .dropdown-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 40px;
    padding: 0 16px;
    border-radius: 0;
    font-size: var(--flx-font-size-sm);
    font-weight: 400;
    color: var(--flx-dropdown-item-color);
}

#page-container.flx-theme #page-header .dropdown-menu .dropdown-item:hover,
#page-container.flx-theme #page-header .dropdown-menu .dropdown-item:focus {
    background: var(--flx-dropdown-item-hover-bg);
    color: var(--flx-dropdown-item-hover-color);
}

#page-container.flx-theme #page-header .dropdown-menu .dropdown-item svg {
    width: 18px;
    height: 18px;
    color: var(--flx-text-muted);
}

#page-container.flx-theme #page-header .dropdown-menu .dropdown-item.is-current {
    color: var(--flx-primary);
    font-weight: 500;
}

.flx-topbar__menu-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px 12px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--flx-border);
}

.flx-topbar__menu-name {
    font-size: var(--flx-font-size-sm);
    font-weight: 500;
    color: var(--flx-text-primary);
}

.flx-topbar__menu-role {
    font-size: var(--flx-font-size-xs);
    color: var(--flx-text-muted);
}

.flx-topbar__menu-label {
    padding: 4px 16px 8px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--flx-text-muted);
}

#page-container.flx-theme #page-header #page-header-loader,
#page-container.flx-theme #page-header #page-header-search {
    background: var(--flx-bg-surface);
}

@media (max-width: 991.98px) {
    .flx-topbar__brand,
    .flx-topbar__kbd,
    .flx-topbar__name {
        display: none;
    }

    #page-container.flx-theme #page-header > .flx-topbar {
        gap: 8px;
        padding: 0 8px;
    }
}

@media (max-width: 575.98px) {
    .flx-topbar__hide-sm {
        display: none !important;
    }

    .flx-topbar__search-field {
        min-height: 40px;
    }
}

/* ------------------------------------------------------------------ */
/* 3. Left nav (Cloud console section nav, single level with groups)  */
/* ------------------------------------------------------------------ */

#page-container.flx-theme #sidebar {
    background: var(--flx-bg-surface);
    border-right: 1px solid var(--flx-border);
    box-shadow: none;
    color: var(--flx-text-secondary);
}

#page-container.flx-theme #sidebar > .content-header {
    height: var(--flx-topbar-height);
    min-height: var(--flx-topbar-height);
    padding: 0 16px 0 20px;
    border-bottom: 1px solid var(--flx-border);
    background: var(--flx-bg-surface);
}

#page-container.flx-theme #sidebar .content-side {
    padding: 8px 12px 24px 0;
}

/* OneUI bleeds the list 20px past .content-side on both sides; the Cloud nav is flush left */
#page-container.flx-theme #sidebar .nav-main,
#page-container.flx-theme #sidebar .nav-main-submenu,
#page-container.flx-theme #sidebar .nav-main-item {
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
}

#page-container.flx-theme #sidebar .nav-main-heading {
    margin: 16px 0 4px;
    padding: 0 24px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--flx-text-muted);
}

#page-container.flx-theme #sidebar .nav-main-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 40px;
    margin: 1px 0;
    padding: 8px 16px 8px 24px;
    border: 0;
    border-radius: 0 var(--flx-radius-xl) var(--flx-radius-xl) 0;
    background: transparent;
    color: var(--flx-text-secondary);
    font-size: var(--flx-font-size-sm);
    font-weight: 400;
    line-height: 20px;
    letter-spacing: 0;
}

#page-container.flx-theme #sidebar .nav-main-link .nav-main-link-icon {
    width: 20px;
    min-width: 20px;
    margin: 0;
    font-size: 17px;
    line-height: 20px;
    text-align: center;
    color: var(--flx-text-muted);
}

#page-container.flx-theme #sidebar .nav-main-link .nav-main-link-name {
    flex: 1 1 auto;
    min-width: 0;
}

#page-container.flx-theme #sidebar .nav-main-link:hover,
#page-container.flx-theme #sidebar .nav-main-link:focus {
    background: var(--flx-state-hover);
    color: var(--flx-text-primary);
    outline: none;
}

#page-container.flx-theme #sidebar .nav-main-link:focus-visible {
    box-shadow: var(--flx-focus-ring);
}

#page-container.flx-theme #sidebar .nav-main-link.active,
#page-container.flx-theme #sidebar .nav-main-link.active:hover,
#page-container.flx-theme #sidebar .nav-main-link.active:focus {
    background: var(--flx-action-bg);
    color: var(--flx-action-fg);
    font-weight: 500;
}

#page-container.flx-theme #sidebar .nav-main-link.active:hover {
    background: var(--flx-action-bg-hover);
}

#page-container.flx-theme #sidebar .nav-main-link.active .nav-main-link-icon {
    color: var(--flx-action-fg);
}

/* Expand/collapse groups: chevron on the right, the open group's label in ink */
#page-container.flx-theme #sidebar .nav-main-link-submenu {
    padding-right: 36px;
}

#page-container.flx-theme #sidebar .nav-main-link-submenu::before,
#page-container.flx-theme #sidebar .nav-main-link-submenu::after {
    right: 14px;
    color: var(--flx-text-muted);
    font-size: 10px;
    opacity: 1;
}

#page-container.flx-theme #sidebar .nav-main-item.open > .nav-main-link-submenu {
    color: var(--flx-text-primary);
    font-weight: 500;
}

#page-container.flx-theme #sidebar .nav-main-submenu {
    padding: 0;
    background: transparent;
}

#page-container.flx-theme #sidebar .nav-main-item.open > .nav-main-submenu {
    padding: 2px 0 6px;
}

#page-container.flx-theme #sidebar .nav-main-submenu .nav-main-link {
    min-height: 36px;
    margin: 1px 0;
    padding: 6px 16px 6px 56px;
    font-size: 13px;
    opacity: 1;
}

#page-container.flx-theme #sidebar .nav-main-submenu .nav-main-link::before {
    display: none;
}

#page-container.flx-theme #sidebar .nav-main-submenu .nav-main-link > i:empty {
    display: none;
}

/* Collapsed (mini) sidebar: the open group's submenu is hidden, so its icon
 * carries the "you are here" colour instead. */
@media (min-width: 992px) {
    #page-container.flx-theme.sidebar-mini.sidebar-o #sidebar:not(:hover) .nav-main-item.open > .nav-main-link-submenu .nav-main-link-icon {
        color: var(--flx-primary);
    }
}

/* ------------------------------------------------------------------ */
/* 4. Content area, breadcrumbs, footer                                */
/* ------------------------------------------------------------------ */

.flx-theme .flx-content {
    padding: 8px 24px 32px;
}

.flx-theme .flx-content > .flx-breadcrumbs {
    padding: 12px 0 16px;
}

.flx-theme .flx-breadcrumbs__list {
    font-size: 13px;
}

.flx-theme a.flx-breadcrumbs__link {
    padding: 2px 4px;
    margin: 0 -4px;
    border-radius: var(--flx-radius-sm);
    color: var(--flx-text-muted);
}

.flx-theme a.flx-breadcrumbs__link:hover,
.flx-theme a.flx-breadcrumbs__link:focus-visible {
    background: var(--flx-state-hover);
    color: var(--flx-text-primary);
}

.flx-theme .flx-breadcrumbs__current {
    font-weight: 500;
    color: var(--flx-text-primary);
}

.flx-theme .flx-page-header__title {
    font-family: var(--flx-font-family-display);
    font-size: 22px;
    font-weight: 400;
    line-height: 28px;
}

/* OneUI's uppercase section headings read as the Cloud console's 16px headings */
.flx-theme .content-heading {
    margin-bottom: 12px;
    padding-top: 8px;
    border-bottom: 0;
    font-family: var(--flx-font-family-display);
    font-size: 18px;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    color: var(--flx-text-primary);
}

#page-container.flx-theme #page-footer {
    background: transparent !important;
    border-top: 1px solid var(--flx-border);
    color: var(--flx-text-muted);
}

#page-container.flx-theme #page-footer .content {
    padding-top: 12px !important;
    padding-bottom: 12px !important;
}

#page-container.flx-theme #page-footer,
#page-container.flx-theme #page-footer strong,
#page-container.flx-theme #page-footer b {
    font-size: 12px;
    font-weight: 400;
}

#page-container.flx-theme #page-footer a {
    color: var(--flx-text-muted);
    font-weight: 500;
}

@media (max-width: 991.98px) {
    .flx-theme .flx-content {
        padding: 8px 16px 24px;
    }
}

/* ------------------------------------------------------------------ */
/* 5. Cards                                                            */
/* ------------------------------------------------------------------ */

.flx-theme .block {
    border: 1px solid var(--flx-border);
    border-radius: var(--flx-radius-md);
    box-shadow: none !important;
}

#page-container.flx-theme .block .block-header-default {
    background-color: var(--flx-bg-surface) !important;
}

.flx-theme .block-header,
.flx-theme .block-header-default {
    min-height: 56px;
    padding: 12px 20px;
    background: var(--flx-bg-surface);
    border-bottom: 1px solid var(--flx-border);
}

.flx-theme .block-header .block-title,
.flx-theme .block-title {
    font-family: var(--flx-font-family-base);
    font-size: var(--flx-font-size-base);
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    color: var(--flx-text-primary);
}

.flx-theme .block-header .block-title.text-primary {
    color: var(--flx-text-primary) !important;
}

.flx-theme .block-title small {
    color: var(--flx-text-muted);
    font-weight: 400;
}

.flx-theme .block-content {
    padding: 20px 20px 4px;
}

.flx-theme .block-content.block-content-full {
    padding-bottom: 20px;
}

.flx-theme .btn-block-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    color: var(--flx-text-muted);
    opacity: 1;
}

.flx-theme .btn-block-option:hover,
.flx-theme .btn-block-option:focus {
    background: var(--flx-state-hover);
    color: var(--flx-text-primary);
}

.flx-theme .card {
    border-radius: var(--flx-radius-md);
    box-shadow: none;
}

.flx-theme .card-header {
    padding: 14px 20px;
    background: var(--flx-bg-surface);
    border-bottom-color: var(--flx-border);
    font-weight: 500;
}

/* ------------------------------------------------------------------ */
/* 6. Tables                                                           */
/* ------------------------------------------------------------------ */

.flx-theme .table {
    --bs-table-hover-bg: var(--flx-state-hover);
    --bs-table-striped-bg: transparent;
    margin-bottom: 16px;
    color: var(--flx-text-primary);
}

.flx-theme .table > :not(caption) > * > * {
    padding: 12px 16px;
    border-bottom-color: var(--flx-border);
    vertical-align: middle;
}

.flx-theme .table > thead,
.flx-theme .table > thead > tr > th {
    background: var(--flx-bg-surface);
}

.flx-theme .table > thead th,
.flx-theme .table thead th {
    padding-top: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--flx-border);
    color: var(--flx-text-muted);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
}

/* No vertical rules: bordered tables keep only the row dividers */
.flx-theme .table-bordered,
.flx-theme .table-bordered > :not(caption) > * {
    border-width: 0;
}

.flx-theme .table-bordered > :not(caption) > * > * {
    border-width: 0 0 1px;
}

/* DataTables' bootstrap5 skin re-adds side rules to the first and last cells */
#page-container.flx-theme table.dataTable.table-bordered > :not(caption) > * > *,
#page-container.flx-theme table.table-bordered > :not(caption) > * > * {
    border-left-width: 0;
    border-right-width: 0;
}

.flx-theme .table > tbody > tr:last-child > * {
    border-bottom-color: transparent;
}

.flx-theme .table-hover > tbody > tr:hover > * {
    --bs-table-accent-bg: var(--flx-state-hover);
}

.flx-theme .table-vcenter > :not(caption) > * > * {
    vertical-align: middle;
}

/* DataTables chrome */
.flx-theme .dataTables_wrapper .dataTables_length label,
.flx-theme .dataTables_wrapper .dataTables_filter label,
.flx-theme .dataTables_wrapper .dataTables_info {
    color: var(--flx-text-muted);
    font-size: 13px;
}

.flx-theme .dataTables_wrapper .dataTables_filter input,
.flx-theme .dataTables_wrapper .dataTables_length select {
    border-radius: var(--flx-radius-sm);
}

.flx-theme .page-link {
    border-radius: var(--flx-radius-sm) !important;
    border-color: transparent;
    background: transparent;
    color: var(--flx-text-secondary);
    font-size: 13px;
}

.flx-theme .page-link:hover {
    background: var(--flx-state-hover);
    color: var(--flx-text-primary);
}

/* Anchored on #page-container: flx-theme's bare-link colour rule would otherwise
 * paint the current page number the same blue as its fill. */
#page-container.flx-theme .page-item.active .page-link,
#page-container.flx-theme .page-item.active a.page-link:hover {
    color: var(--flx-action-fg);
}

.flx-theme .page-item.active .page-link {
    background: var(--flx-action-bg);
    border-color: var(--flx-action-bg);
    color: var(--flx-action-fg);
}

.flx-theme .page-item.disabled .page-link {
    background: transparent;
    color: var(--flx-text-muted);
    opacity: .6;
}

/* ------------------------------------------------------------------ */
/* 7. Buttons, inputs, tabs                                            */
/* ------------------------------------------------------------------ */

.flx-theme .btn {
    --bs-btn-border-radius: var(--flx-radius-sm);
    --bs-btn-font-weight: 500;
    min-height: 36px;
    font-weight: 500;
    letter-spacing: .01em;
}

.flx-theme .btn-sm {
    min-height: 30px;
}

#page-container.flx-theme .form-control,
#page-container.flx-theme .form-select,
#page-container.flx-theme .form-control-alt,
#page-container.flx-theme .select2-container--default .select2-selection--single,
#page-container.flx-theme .select2-container--default .select2-selection--multiple {
    border-color: var(--flx-input-alt-border);
    border-radius: var(--flx-input-radius);
}

#page-container.flx-theme .form-control:focus,
#page-container.flx-theme .form-select:focus,
#page-container.flx-theme .form-control-alt:focus {
    border-color: var(--flx-primary);
    box-shadow: inset 0 0 0 1px var(--flx-primary);
}

.flx-theme label,
.flx-theme .form-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--flx-text-secondary);
}

.flx-theme .nav-tabs {
    gap: 0;
    border-bottom: 1px solid var(--flx-border);
}

.flx-theme .nav-tabs .nav-link {
    position: relative;
    min-height: 44px;
    margin-bottom: -1px;
    padding: 0 16px;
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: var(--flx-radius-md) var(--flx-radius-md) 0 0;
    background: transparent;
    color: var(--flx-text-muted);
    font-size: var(--flx-font-size-sm);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.flx-theme .nav-tabs .nav-link:hover {
    background: var(--flx-state-hover);
    color: var(--flx-text-primary);
}

.flx-theme .nav-tabs .nav-link.active {
    border-bottom-color: var(--flx-primary);
    background: transparent;
    color: var(--flx-primary);
}

.flx-theme .alert {
    border-radius: var(--flx-radius-md);
    box-shadow: none;
}

/* ------------------------------------------------------------------ */
/* 8. Page sections (FlexCC page structure)                            */
/*    partials/shell-sections tags every full-width top-level card as  */
/*    .flx-section: its header (title + actions) sits above the card   */
/*    as a page header, and only the body is the card. The first one   */
/*    is the page title (22px), the rest are section headings.         */
/* ------------------------------------------------------------------ */

#page-container.flx-theme .block.flx-section {
    margin-bottom: 28px;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
}

#page-container.flx-theme .block.flx-section > .block-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-height: 0;
    padding: 0 0 16px;
    border: 0;
    background: transparent !important;
}

#page-container.flx-theme .block.flx-section > .block-header .block-title {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    font-family: var(--flx-font-family-display);
    font-size: 18px;
    font-weight: 400;
    line-height: 26px;
    color: var(--flx-text-primary) !important;
}

#page-container.flx-theme .block.flx-section--lead > .block-header .block-title {
    font-size: 22px;
    line-height: 28px;
}

#page-container.flx-theme .block.flx-section > .block-content {
    border: 1px solid var(--flx-border);
    border-radius: var(--flx-radius-md);
    background: var(--flx-bg-surface);
    padding: 16px 20px 8px;
}

#page-container.flx-theme .block.flx-section > .block-content + .block-content {
    margin-top: 12px;
}

/* The section is the page, so OneUI's fullscreen / collapse / close toggles go */
#page-container.flx-theme .block.flx-section > .block-header .btn-block-option[data-toggle="block-option"],
#page-container.flx-theme .btn-block-option[data-action="fullscreen_toggle"],
#page-container.flx-theme .btn-block-option[data-action="close"] {
    display: none;
}

#page-container.flx-theme .block.flx-section > .block-header .block-options:not(:has(> :not([data-toggle="block-option"]))) {
    display: none;
}

/* Header actions: one filled primary, everything else outlined (Material) */
#page-container.flx-theme .flx-section > .block-header .btn {
    width: auto;
    min-height: 36px;
    margin: 0 !important;
    padding: 0 16px;
}

#page-container.flx-theme .flx-section > .block-header .btn:not(.btn-primary):not(.btn-alt-primary):not(.btn-danger):not(.btn-alt-danger) {
    --bs-btn-bg: var(--flx-bg-surface);
    --bs-btn-color: var(--flx-text-secondary);
    --bs-btn-border-color: var(--flx-border);
    --bs-btn-hover-bg: var(--flx-state-hover);
    --bs-btn-hover-color: var(--flx-text-primary);
    --bs-btn-hover-border-color: var(--flx-border);
    background: var(--flx-bg-surface);
    border-color: var(--flx-border);
    color: var(--flx-text-secondary);
}

#page-container.flx-theme .flx-section > .block-header > a:not(.btn) {
    text-decoration: none;
}

/* A bare icon link next to the actions reads as an outlined icon button */
#page-container.flx-theme .flx-section > .block-header > a:not(.btn):has(> i:only-child) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 0 !important;
    border: 1px solid var(--flx-border);
    border-radius: var(--flx-radius-sm);
    background: var(--flx-bg-surface);
    color: var(--flx-text-secondary);
}

#page-container.flx-theme .flx-section > .block-header > a:not(.btn):has(> i:only-child):hover {
    background: var(--flx-state-hover);
    color: var(--flx-text-primary);
}

#page-container.flx-theme .flx-section > .block-header > a:not(.btn) > i {
    font-size: 16px;
}

@media (max-width: 767.98px) {
    #page-container.flx-theme .block.flx-section > .block-header .block-title {
        flex-basis: 100%;
    }
}

/* ------------------------------------------------------------------ */
/* 9. Table toolbar, stripes, scrollbars                               */
/* ------------------------------------------------------------------ */

/* DataTables' search reads as FlexCC's "Filter rows…" field */
#page-container.flx-theme .dataTables_wrapper .dataTables_filter label {
    display: inline-flex;
    align-items: center;
    margin: 0;
    font-size: 0;
}

#page-container.flx-theme .dataTables_wrapper .dataTables_filter input {
    width: 280px;
    max-width: 100%;
    height: 40px;
    margin: 0;
    padding: 0 12px 0 38px;
    border-radius: var(--flx-radius-sm);
    background: var(--flx-input-alt-bg) no-repeat 12px center / 18px 18px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235f6368' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    font-size: var(--flx-font-size-sm);
}

#page-container.flx-theme .dataTables_wrapper .dataTables_length label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

#page-container.flx-theme .dataTables_wrapper .dataTables_length select {
    width: auto;
    height: 40px;
    min-width: 72px;
}

#page-container.flx-theme .dataTables_wrapper > .row:first-child {
    align-items: center;
    margin-bottom: 8px;
}

#page-container.flx-theme .dataTables_wrapper > .row:last-child {
    align-items: center;
    padding-top: 4px;
}

/* No zebra rows: Cloud console tables separate rows with rules only */
#page-container.flx-theme table.dataTable.table-striped > tbody > tr > *,
#page-container.flx-theme .table-striped > tbody > tr > * {
    box-shadow: none !important;
    --bs-table-bg-type: transparent;
}

#page-container.flx-theme table.dataTable > tbody > tr:hover > * {
    box-shadow: inset 0 0 0 9999px var(--flx-state-hover) !important;
}

/* Slim grey scrollbars instead of scrollbars.css' thick navy thumb */
.flx-theme ::-webkit-scrollbar,
html:has(#page-container.flx-theme)::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.flx-theme ::-webkit-scrollbar-track,
html:has(#page-container.flx-theme)::-webkit-scrollbar-track {
    background: transparent;
}

.flx-theme ::-webkit-scrollbar-thumb,
html:has(#page-container.flx-theme)::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 10px;
    background: rgba(95, 99, 104, 0.35);
    background-clip: content-box;
}

.flx-theme ::-webkit-scrollbar-thumb:hover {
    background: rgba(95, 99, 104, 0.6);
    background-clip: content-box;
}

/* ------------------------------------------------------------------ */
/* 10. Dashboard (GA4 scorecards, today strip, chart card)             */
/* ------------------------------------------------------------------ */

.flx-dash {
    padding-top: 16px;
}

.flx-dash .flx-page-header {
    margin-bottom: 20px;
}

.flx-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.flx-kpi {
    --kpi: var(--flx-primary);
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 168px;
    padding: 16px 20px 0;
    border: 1px solid var(--flx-border);
    border-radius: var(--flx-radius-md);
    background: var(--flx-bg-surface);
    overflow: hidden;
}

.flx-kpi::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: var(--kpi);
}

.flx-kpi--warning { --kpi: #f29900; }
.flx-kpi--danger  { --kpi: #c81018; }
.flx-kpi--success { --kpi: #1e8e3e; }
.flx-kpi--info    { --kpi: #12b5cb; }
.flx-kpi--neutral { --kpi: #5f6368; }

.flx-kpi__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.flx-kpi__label {
    font-size: 13px;
    font-weight: 500;
    color: var(--flx-text-secondary);
}

.flx-kpi__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border-radius: 50%;
    background: var(--flx-bg-subtle);
    background: color-mix(in srgb, var(--kpi) 12%, var(--flx-bg-surface));
    color: var(--kpi);
    font-size: 15px;
}

.flx-kpi__value {
    margin-top: 8px;
    font-family: var(--flx-font-family-display);
    font-size: 36px;
    font-weight: 400;
    line-height: 44px;
    color: var(--flx-text-primary);
    font-variant-numeric: tabular-nums;
}

.flx-kpi__value .fa-spinner {
    font-size: 20px;
    color: var(--flx-text-muted);
}

.flx-kpi__meta {
    min-height: 18px;
    font-size: 12px;
    color: var(--flx-text-muted);
}

#page-container.flx-theme a.flx-kpi__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: auto -20px 0;
    padding: 12px 20px;
    border-top: 1px solid var(--flx-border);
    color: var(--flx-primary);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

#page-container.flx-theme a.flx-kpi__link:hover {
    background: var(--flx-state-hover);
}

.flx-kpi__link .fa {
    font-size: 12px;
}

.flx-dash__section {
    margin-bottom: 32px;
}

.flx-dash__section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 16px;
}

.flx-theme .flx-dash__section-title {
    margin: 0;
    font-family: var(--flx-font-family-display);
    font-size: 18px;
    font-weight: 400;
    line-height: 26px;
    color: var(--flx-text-primary);
}

.flx-dash__section-note {
    font-size: 13px;
    color: var(--flx-text-muted);
}

.flx-today {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    border: 1px solid var(--flx-border);
    border-radius: var(--flx-radius-md);
    background: var(--flx-bg-surface);
    overflow: hidden;
}

.flx-today__item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 20px 18px;
    border-left: 1px solid var(--flx-border);
}

.flx-today__item:first-child {
    border-left: 0;
}

.flx-today__label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--flx-text-secondary);
}

.flx-today__label i {
    color: var(--flx-text-muted);
    font-size: 15px;
}

.flx-today__value {
    font-family: var(--flx-font-family-display);
    font-size: 28px;
    font-weight: 400;
    line-height: 36px;
    color: var(--flx-text-primary);
    font-variant-numeric: tabular-nums;
}

.flx-today__value .fa-spinner {
    font-size: 18px;
    color: var(--flx-text-muted);
}

@media (max-width: 1199.98px) {
    .flx-today {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .flx-today__item:nth-child(3n + 1) {
        border-left: 0;
    }

    .flx-today__item:nth-child(n + 4) {
        border-top: 1px solid var(--flx-border);
    }
}

@media (max-width: 575.98px) {
    .flx-today {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .flx-today__item:nth-child(3n + 1) {
        border-left: 1px solid var(--flx-border);
    }

    .flx-today__item:nth-child(2n + 1) {
        border-left: 0;
    }

    .flx-today__item:nth-child(n + 3) {
        border-top: 1px solid var(--flx-border);
    }
}

/* Chart card: controls in the header, a fixed-height plot */
.flx-chart-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.flx-theme .flx-chart-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--flx-text-muted);
    cursor: pointer;
}

.flx-chart-toggle .form-check-input {
    margin: 0;
    float: none;
}

.flx-chart-controls .form-select {
    width: auto;
    min-width: 110px;
    height: 36px;
    padding-top: 0;
    padding-bottom: 0;
}

.flx-chart-canvas {
    position: relative;
    height: 340px;
    padding: 8px 0 12px;
}

/* ------------------------------------------------------------------ */
/* 11. Record pages (customer, ticket): header, chips, key/value card  */
/* ------------------------------------------------------------------ */

.flx-record {
    margin-bottom: 24px;
}

.flx-record > .flx-breadcrumbs {
    padding: 12px 0 16px;
}

.flx-record__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}

.flx-record__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    flex: 0 0 56px;
    border-radius: 50%;
    background: #007dfb;
    color: #ffffff;
    font-family: var(--flx-font-family-display);
    font-size: 22px;
    font-weight: 500;
}

.flx-record__text {
    flex: 1 1 320px;
    min-width: 0;
}

.flx-theme .flx-record__title {
    margin: 0 0 6px;
    font-family: var(--flx-font-family-display);
    font-size: 24px;
    font-weight: 400;
    line-height: 32px;
    color: var(--flx-text-primary);
}

.flx-record__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.flx-theme .flx-record__chip,
.flx-theme a.flx-record__chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 26px;
    padding: 0 10px;
    border: 1px solid var(--flx-border);
    border-radius: var(--flx-radius-pill);
    background: var(--flx-bg-surface);
    color: var(--flx-text-secondary);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
}

.flx-theme a.flx-record__chip:hover {
    background: var(--flx-state-hover);
    color: var(--flx-text-primary);
}

.flx-theme .flx-record__chip--type {
    border-color: transparent;
    background: var(--flx-primary-50);
    color: var(--flx-primary-700);
}

.flx-record__chip i {
    font-size: 12px;
    color: var(--flx-text-muted);
}

.flx-record__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

#page-container.flx-theme .flx-record__actions .btn:not(.btn-alt-primary):not(.btn-alt-danger) {
    --bs-btn-bg: var(--flx-bg-surface);
    --bs-btn-color: var(--flx-text-secondary);
    --bs-btn-border-color: var(--flx-border);
    --bs-btn-hover-bg: var(--flx-state-hover);
    --bs-btn-hover-color: var(--flx-text-primary);
    --bs-btn-hover-border-color: var(--flx-border);
}

/* Label / value rows: Cloud console "details" panel */
.flx-kv-card .block-content > .row {
    align-items: baseline;
    margin: 0;
    padding: 10px 0;
    border-bottom: 1px solid var(--flx-border);
}

.flx-kv-card .block-content > .row:last-child {
    border-bottom: 0;
}

.flx-kv-card .block-content > .row > [class*="col"] {
    padding-left: 0;
    padding-right: 8px;
}

.flx-theme .flx-kv-card .block-content > .row label {
    margin: 0;
    font-size: 13px;
    font-weight: 400;
    color: var(--flx-text-muted);
}

.flx-kv-card .block-content > .row p {
    margin: 0;
    color: var(--flx-text-primary);
}

.flx-kv-card .block-content > .row ul {
    margin: 0;
    padding: 0;
}

/* Buttons inside the details panel are row actions, not full-width bars */
#page-container.flx-theme .flx-kv-card .block-content .btn {
    width: auto !important;
    float: none !important;
    min-height: 32px;
    --bs-btn-bg: var(--flx-bg-surface);
    --bs-btn-color: var(--flx-primary);
    --bs-btn-border-color: var(--flx-border);
    --bs-btn-hover-bg: var(--flx-state-hover);
    --bs-btn-hover-color: var(--flx-primary);
    --bs-btn-hover-border-color: var(--flx-border);
}

#page-container.flx-theme .flx-kv-card .block-content .btn.btn-alt-danger {
    --bs-btn-color: var(--flx-danger);
    --bs-btn-hover-color: var(--flx-danger);
}

/* Cloud console cards don't collapse; only cards that start collapsed keep the toggle */
#page-container.flx-theme .block:not(.block-mode-hidden) > .block-header .btn-block-option[data-action="content_toggle"] {
    display: none;
}

.flx-record__avatar--ticket {
    border-radius: var(--flx-radius-md);
    background: var(--flx-primary-50);
    color: var(--flx-primary-700);
    font-size: 24px;
}

.flx-theme .flx-record__chip--success {
    border-color: transparent;
    background: var(--flx-success-50);
    color: var(--flx-success-700);
}

/* Panel: a titled card built from plain markup (record pages) */
.flx-panel {
    height: 100%;
    border: 1px solid var(--flx-border);
    border-radius: var(--flx-radius-md);
    background: var(--flx-bg-surface);
}

.flx-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 52px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--flx-border);
}

.flx-theme .flx-panel__title {
    margin: 0;
    font-size: var(--flx-font-size-base);
    font-weight: 500;
    line-height: 24px;
    color: var(--flx-text-primary);
}

.flx-theme a.flx-panel__link {
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

.flx-panel__body {
    padding: 16px 20px 20px;
}

.flx-panel__text {
    margin: 0;
    color: var(--flx-text-primary);
    white-space: pre-line;
}

.flx-kv {
    margin: 0;
    padding: 4px 20px 8px;
}

.flx-kv__row {
    display: grid;
    grid-template-columns: minmax(120px, 38%) 1fr;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--flx-border);
}

.flx-kv__row:last-child {
    border-bottom: 0;
}

.flx-theme .flx-kv dt {
    font-size: 13px;
    font-weight: 400;
    color: var(--flx-text-muted);
}

.flx-theme .flx-kv dd {
    margin: 0;
    color: var(--flx-text-primary);
    overflow-wrap: anywhere;
}

.flx-attachments {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Activity timeline */
.flx-activity + .flx-activity {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--flx-border);
}

.flx-theme .flx-activity__title {
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: .02em;
    color: var(--flx-text-secondary);
}

.flx-activity__empty {
    margin: 0;
    font-size: 13px;
    color: var(--flx-text-muted);
}

.flx-timeline {
    position: relative;
    margin: 0;
    padding: 0 0 0 20px;
    list-style: none;
}

.flx-timeline::before {
    content: "";
    position: absolute;
    top: 6px;
    bottom: 6px;
    left: 5px;
    width: 2px;
    background: var(--flx-border);
}

.flx-timeline__item {
    --dot: var(--flx-primary);
    position: relative;
    padding: 0 0 14px;
}

.flx-timeline__item:last-child {
    padding-bottom: 0;
}

.flx-timeline__item::before {
    content: "";
    position: absolute;
    top: 5px;
    left: -20px;
    width: 12px;
    height: 12px;
    border: 2px solid var(--flx-bg-surface);
    border-radius: 50%;
    background: var(--dot);
    box-sizing: border-box;
}

.flx-timeline__item--warning { --dot: #f29900; }
.flx-timeline__item--success { --dot: #1e8e3e; }

.flx-timeline__meta {
    font-size: 12px;
    color: var(--flx-text-muted);
}

.flx-timeline__meta strong {
    font-weight: 500;
    color: var(--flx-text-secondary);
}

.flx-timeline__text {
    margin-top: 2px;
    color: var(--flx-text-primary);
    white-space: pre-line;
}

/* ------------------------------------------------------------------ */
/* 12. Forms: labels above fields (FlexCC), one field height           */
/*     OneUI forms pair `label.col-form-label` + input column inside a  */
/*     `.form-group.row`. A two-row, column-flow grid stacks each label */
/*     over its own field while pairs keep sharing the row.            */
/* ------------------------------------------------------------------ */

@media (min-width: 768px) {
    #page-container.flx-theme .form-group.row:has(> label.col-form-label) {
        display: grid;
        grid-auto-flow: column;
        grid-template-rows: auto auto;
        grid-auto-columns: minmax(0, 1fr);
        align-content: start;
        column-gap: 16px;
        row-gap: 6px;
        margin-left: 0;
        margin-right: 0;
        margin-top: 0 !important;
        margin-bottom: 16px !important;
        padding-left: calc(var(--bs-gutter-x, 1.5rem) * .5);
        padding-right: calc(var(--bs-gutter-x, 1.5rem) * .5);
    }
}

#page-container.flx-theme .form-group.row:has(> label.col-form-label) > * {
    width: auto;
    max-width: none;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-left: 0;
    padding-right: 0;
}

#page-container.flx-theme .form-group.row > label.col-form-label {
    align-self: end;
    padding: 0;
    text-align: left !important;
    font-size: 13px;
    font-weight: 500;
    line-height: 18px;
    color: var(--flx-text-secondary);
}

@media (max-width: 767.98px) {
    #page-container.flx-theme .form-group.row:has(> label.col-form-label) {
        margin-bottom: 14px;
        row-gap: 6px;
    }

    #page-container.flx-theme .form-group.row:has(> label.col-form-label) > * {
        margin-bottom: 6px !important;
    }
}

/* One control height: inputs, selects and select2 */
#page-container.flx-theme .form-control:not(textarea):not([type="file"]):not(.form-control-sm):not(.form-control-lg),
#page-container.flx-theme .form-select:not(.form-select-sm):not([multiple]) {
    min-height: 40px;
}

#page-container.flx-theme .select2-container--default .select2-selection--single {
    height: 40px;
    display: flex;
    align-items: center;
}

#page-container.flx-theme .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 38px;
    padding-left: 12px;
    color: var(--flx-text-primary);
}

#page-container.flx-theme .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 38px;
}

#page-container.flx-theme .select2-container--default.select2-container--focus .select2-selection--single,
#page-container.flx-theme .select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--flx-primary);
    box-shadow: inset 0 0 0 1px var(--flx-primary);
}

#page-container.flx-theme .flx-section > .block-content > form > hr,
#page-container.flx-theme .flx-section > .block-content form.row > hr {
    width: auto;
    flex: 1 1 100%;
    margin: 4px calc(var(--bs-gutter-x, 1.5rem) * .5) 20px;
    border-color: var(--flx-border);
    opacity: 1;
}

/* ------------------------------------------------------------------ */
/* 13. Launcher (Settings hub), like the console home                  */
/* ------------------------------------------------------------------ */

.flx-launcher {
    padding-top: 12px;
}

.flx-launcher__search {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 560px;
    min-height: 44px;
    margin: 0 0 24px;
    padding: 0 14px;
    border-radius: var(--flx-radius-pill);
    background: var(--flx-bg-subtle);
    color: var(--flx-text-muted);
    cursor: text;
}

.flx-launcher__search:focus-within {
    background: var(--flx-bg-surface);
    box-shadow: var(--flx-shadow-1);
}

.flx-launcher__search input {
    flex: 1 1 auto;
    min-width: 0;
    height: 40px;
    border: 0;
    background: transparent;
    color: var(--flx-text-primary);
    font-size: var(--flx-font-size-sm);
    outline: none;
}

.flx-launcher__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.flx-launcher__cell[hidden] {
    display: none;
}

#page-container.flx-theme a.flx-launcher__item {
    display: flex;
    align-items: center;
    gap: 14px;
    height: 100%;
    min-height: 64px;
    padding: 12px 16px;
    border: 1px solid var(--flx-border);
    border-radius: var(--flx-radius-md);
    background: var(--flx-bg-surface);
    color: var(--flx-text-primary);
    text-decoration: none;
    transition: border-color .12s ease, box-shadow .12s ease;
}

#page-container.flx-theme a.flx-launcher__item:hover,
#page-container.flx-theme a.flx-launcher__item:focus-visible {
    border-color: var(--flx-primary-200);
    box-shadow: var(--flx-shadow-1);
    outline: none;
}

.flx-launcher__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: var(--flx-radius-md);
    background: var(--flx-primary-50);
    color: var(--flx-primary-700);
    font-size: 18px;
}

.flx-launcher__name {
    font-size: var(--flx-font-size-sm);
    font-weight: 500;
    line-height: 20px;
}

.flx-launcher__empty {
    margin: 16px 0 0;
    color: var(--flx-text-muted);
}

/* page-header partial used outside breadcrumbs-first pages */
.flx-launcher .flx-page-header {
    margin-bottom: 16px;
}

/* ------------------------------------------------------------------ */
/* 14. Sign-in pages (auth layout): centred Material card              */
/* Styled like the console (and the FlexCC/chat sign-in): 8px card at   */
/* 1dp on the grey page, 4px fields, 4px filled button, regular titles. */
/* Sizes are unchanged on purpose: the card keeps its width and height. */
/* ------------------------------------------------------------------ */

#page-container.flx-auth-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--flx-bg-page);
}

#page-container.flx-auth-page #main-container {
    display: flex;
    flex: 1 0 auto;
    align-items: center;
    justify-content: center;
    padding: 72px 16px 32px;
}

.flx-auth-main {
    width: 100%;
}

.flx-auth-toolbar {
    position: absolute;
    top: 12px;
    right: 16px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 4px;
}

#page-container.flx-theme .flx-auth-toolbar .dropdown-menu {
    margin-top: 6px;
    padding: 8px 0;
    border: 1px solid var(--flx-dropdown-border);
    border-radius: var(--flx-radius-md);
    background: var(--flx-dropdown-bg);
    box-shadow: var(--flx-dropdown-shadow);
}

#page-container.flx-theme .flx-auth-toolbar .dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 40px;
    padding: 0 16px;
    font-size: var(--flx-font-size-sm);
    color: var(--flx-dropdown-item-color);
}

#page-container.flx-theme .flx-auth-toolbar .dropdown-item:hover {
    background: var(--flx-dropdown-item-hover-bg);
}

#page-container.flx-theme .flx-auth-toolbar .dropdown-item.is-current {
    color: var(--flx-primary);
    font-weight: 500;
}

#page-container.flx-theme .flx-auth-toolbar .dropdown-item svg {
    width: 18px;
    height: 18px;
}

/* The card: two panes on desktop, one column below 768px */
.flx-auth {
    display: flex;
    justify-content: center;
    width: 100%;
}

.flx-auth__card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 48px;
    width: 100%;
    max-width: 960px;
    padding: 40px;
    border: 1px solid transparent;
    border-radius: var(--flx-radius-md);
    background: var(--flx-bg-surface);
    box-shadow: var(--flx-shadow-1);
}

/* Shadows vanish on dark surfaces, so dark mode keeps a hairline instead */
.flx-theme.dark-mode .flx-auth__card {
    border-color: var(--flx-border);
}

/* Identity pane: centred in its half, like the organisation column used to be */
.flx-auth__brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.flx-auth__logo {
    display: block;
    height: 40px;
    width: auto;
    margin: 0 auto 24px;
}

.flx-theme .flx-auth__title {
    margin: 0 0 8px;
    font-family: var(--flx-font-family-display);
    font-size: 24px;
    font-weight: 400;
    line-height: 44px;
    color: var(--flx-text-primary);
}

.flx-auth__subtitle {
    margin: 0;
    font-size: 16px;
    color: var(--flx-text-secondary);
}

.flx-auth__org {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 32px;
    padding: 12px 14px;
    border: 1px solid var(--flx-border);
    border-radius: var(--flx-radius-md);
    max-width: 360px;
    text-align: left;
}

.flx-auth__org img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    flex: 0 0 44px;
}

.flx-auth__org div {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.flx-auth__org strong {
    font-size: 14px;
    font-weight: 500;
    color: var(--flx-text-primary);
}

.flx-auth__org span {
    font-size: 12px;
    color: var(--flx-text-muted);
}

.flx-auth__form {
    align-self: center;
}

.flx-auth__field {
    margin-bottom: 20px;
}

.flx-theme .flx-auth__field .form-label {
    margin-bottom: 6px;
}

#page-container.flx-theme .flx-auth__field .form-control {
    min-height: 48px;
    font-size: 16px;
}

.flx-auth__password {
    position: relative;
}

#page-container.flx-theme .flx-auth__password .form-control {
    padding-right: 48px;
}

.flx-auth__reveal {
    position: absolute;
    top: 50%;
    right: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--flx-text-muted);
    transform: translateY(-50%);
}

.flx-auth__reveal:hover {
    background: var(--flx-state-hover);
    color: var(--flx-text-primary);
}

.flx-auth__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 24px;
    font-size: 14px;
}

.flx-theme .flx-auth__row .form-check-label {
    font-size: 14px;
    font-weight: 400;
    color: var(--flx-text-secondary);
}

.flx-theme .flx-auth__row a {
    font-weight: 500;
    color: var(--flx-primary-700);
    text-decoration: none;
}

.flx-theme .flx-auth__row a:hover,
.flx-theme .flx-auth__row a:focus-visible {
    text-decoration: underline;
}

#page-container.flx-theme .flx-auth__submit {
    min-height: 44px;
    border-radius: var(--flx-radius-sm);
    box-shadow: none;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: .01em;
}

#page-container.flx-theme .flx-auth__submit:hover {
    box-shadow: var(--flx-shadow-1);
}

#page-container.flx-auth-page #page-footer {
    flex: 0 0 auto;
}

@media (max-width: 767.98px) {
    .flx-auth__card {
        grid-template-columns: 1fr;
        gap: 28px;
        padding: 28px 20px;
        border-radius: var(--flx-radius-md);
    }

    .flx-theme .flx-auth__title {
        font-size: 22px;
        line-height: 36px;
    }

    .flx-auth__org {
        margin-top: 20px;
    }
}
