/* ---------------------------------------------------------------------------
   redesign.css — the approved admin redesign (prototype/admin-redesign).

   Loaded last, so it re-skins the existing layers rather than replacing them:
   every class, id and data attribute the page scripts rely on is unchanged.
   Most of the change comes from the tokens below, which every component in
   All.css / custom.css / admin.css / researchx.css already reads; the rest
   restyles the shell and the shared components to the prototype's spacing,
   type and shapes, and adds the components new pages use (rx-page-head,
   rx-tabs, rx-search, the category tree and detail panel).

   Colour roles: indigo is action and focus; green is success; amber, red and
   blue keep their severity / info meanings.
--------------------------------------------------------------------------- */

:root {
    /* surfaces */
    --bg:         #f6f7f9;
    --surface:    #ffffff;
    --surface-2:  #fafbfc;
    --surface-3:  #f2f4f7;
    --line:       #e5e7eb;
    --line-soft:  #eef0f3;
    --line-strong:#d4d8de;

    --fg:         #111827;
    --fg-2:       #374151;
    --fg-muted:   #6b7280;
    --fg-dim:     #9ca3af;

    /* The navigation rail stays dark: navy, with the indigo accent lightened
       for contrast. Text: link 11.9:1, caption 5.6:1, icon 6.9:1 on --side-bg. */
    --side-bg:        #0f172a;
    --side-surface:   #1e293b;
    --side-line:      #1e293b;
    --side-fg:        #f8fafc;
    --side-link:      #cbd5e1;
    --side-muted:     #94a3b8;
    --side-dim:       #8492a6;
    --side-accent:    #818cf8;
    --side-active-bg: rgba(99, 102, 241, .22);
    --side-active-fg: #e0e7ff;

    /* action + focus */
    --brand:      #4f46e5;
    --brand-hover:#4338ca;
    --brand-ink:  #ffffff;
    --brand-bg:   #eef0fe;
    --brand-line: #c7cbf8;
    --brand-text: #3730a3;
    --brand-glow: rgba(79, 70, 229, .2);

    /* success, kept apart from the action colour */
    --ok:      #15803d;
    --ok-dot:  #22c55e;
    --ok-bg:   #e9f8ef;
    --ok-line: #cdeedb;

    --info:       #1d4ed8;
    --info-bg:    #ebf2fe;
    --info-line:  #d3e2fc;

    --r:    8px;
    --r-sm: 7px;
    --r-lg: 16px;

    --sidebar-w: 252px;
    --sidebar-w-mini: 68px;
    --topbar-h: 60px;

    --shadow-xs: 0 1px 2px rgba(16, 24, 40, .04);
    --shadow-sm: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .03);
    --shadow:    0 8px 24px -6px rgba(16, 24, 40, .12), 0 2px 6px rgba(16, 24, 40, .05);
    --shadow-lg: 0 24px 48px -12px rgba(16, 24, 40, .22);
}

/* Bootstrap's own primary (links, pills, badges) follows the same indigo. */
:root {
    --bs-primary: #4f46e5;
    --bs-primary-rgb: 79, 70, 229;
    --bs-link-color: #4f46e5;
    --bs-link-color-rgb: 79, 70, 229;
    --bs-link-hover-color: #4338ca;
    --bs-link-hover-color-rgb: 67, 56, 202;
}

body { font-size: 13.5px; color: var(--fg); background: var(--bg); }
::selection { background: rgba(79, 70, 229, .16); }
:focus-visible { outline-color: var(--brand); }
.app-sidebar { scrollbar-color: #334155 transparent; }
.app-sidebar ::-webkit-scrollbar-thumb { background: #334155; border-color: var(--side-bg); }

code {
    color: var(--brand-text);
    background: var(--brand-bg);
    border-color: var(--brand-line);
    border-radius: 5px;
}

/* =========================================================================
   SHELL — sidebar
   ========================================================================= */
.app-sidebar { border-right: 1px solid var(--side-line); }

.sidebar-brand { height: var(--topbar-h); flex-basis: var(--topbar-h); padding: 0 16px; border-bottom-color: var(--side-line); }
.brand-mark {
    width: 34px; height: 34px; flex-basis: 34px; border-radius: 10px;
    background: linear-gradient(140deg, #6366f1, #4338ca);
    color: #fff; font-size: 15px;
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .12);
}
.brand-text strong { font-size: 14.5px; font-weight: 650; color: var(--side-fg); }
.brand-text small {
    font-family: var(--ui); font-size: 12px; text-transform: none; letter-spacing: 0;
    color: var(--side-muted);
}

.sidebar-menu { padding: 10px 10px 18px; }

.sidebar-caption, button.sidebar-caption {
    padding: 14px 10px 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .07em;
    color: var(--side-dim);
}
button.sidebar-caption:hover { color: var(--side-link); }
button.sidebar-caption i { font-size: 9px; }

.sidebar-menu li.side-item > a {
    min-height: 36px;
    padding: 0 10px;
    border-radius: var(--r);
    color: var(--side-link);
    font-size: 13.5px;
    font-weight: 500;
}
.sidebar-menu li.side-item > a i { width: 16px; font-size: 13.5px; color: var(--side-muted); }
.sidebar-menu li.side-item > a:hover { background: var(--side-surface); color: var(--side-fg); }
.sidebar-menu li.side-item > a:hover i { color: var(--side-link); }

.sidebar-menu li.side-item.active > a {
    background: var(--side-active-bg);
    color: var(--side-active-fg);
    font-weight: 600;
}
.sidebar-menu li.side-item.active > a i { color: var(--side-accent); }
.sidebar-menu li.side-item.active > a::before {
    left: -10px; top: 8px; bottom: 8px; width: 3px;
    background: var(--side-accent); border-radius: 0 3px 3px 0;
}
/* The app's indigo focus ring is too dark to see on navy. */
.app-sidebar :focus-visible { outline: 2px solid var(--side-accent); outline-offset: -2px; }

.sidebar-foot { border-top-color: var(--side-line); padding: 12px 16px; }
.sidebar-version { font-family: var(--ui); font-size: 12px; color: var(--side-muted); letter-spacing: 0; }

.sidebar-backdrop { background: rgba(17, 24, 39, .4); }

@media (min-width: 992px) {
    body.sidebar-collapsed .sidebar-menu li.side-item > a { padding: 0; justify-content: center; }
    body.sidebar-collapsed .sidebar-menu li.side-item.active > a::before { left: -6px; }
    body.sidebar-collapsed .sidebar-group::before { border-top-color: var(--side-line); }
}

/* =========================================================================
   SHELL — topbar
   ========================================================================= */
.app-navbar {
    height: var(--topbar-h);
    background: rgba(255, 255, 255, .86);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom-color: var(--line);
    padding: 0 20px;
    gap: 12px;
}

.nav-toggle { width: 36px; height: 36px; justify-content: center; border-radius: var(--r); color: var(--fg-muted); }
.nav-toggle:hover { background: var(--surface-3); color: var(--fg); }

/* Breadcrumbs: section › page, with the page name as the bar's heading. */
.navbar-title { gap: 6px; }
.navbar-title .crumb {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: var(--ui); font-size: 13.5px; letter-spacing: 0;
    color: var(--fg-muted);
}
.navbar-title .crumb a { color: var(--fg-muted); text-transform: capitalize; }
.navbar-title .crumb a:hover { color: var(--fg); }
.navbar-title .crumb .crumb-sep { font-size: 9px; color: var(--fg-dim); }
.navbar-title h1 { font-size: 13.5px; font-weight: 600; color: var(--fg); }

.navbar-actions { gap: 8px; }

/* The active site: the prototype's site pill (styles.css .site-pill / .site-dot)
   and its menu. The badge takes the site's own colours (Site::accent()). */
.site-switcher { display: flex; align-items: center; position: relative; min-width: 0; }
.site-pill {
    display: inline-flex; align-items: center; gap: 8px; min-width: 0;
    height: 36px; padding: 0 10px 0 8px;
    border: 1px solid var(--line); border-radius: var(--r);
    background: var(--surface); box-shadow: var(--shadow-xs); cursor: pointer;
    color: var(--fg); font: 600 13.5px/1 var(--ui); white-space: nowrap;
}
.site-pill:hover { border-color: var(--line-strong); }
.site-pill:focus-visible { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.site-pill .site-name-long { min-width: 0; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.site-pill .site-pill-sub { min-width: 0; max-width: 160px; overflow: hidden; text-overflow: ellipsis; color: var(--fg-muted); font-weight: 500; }
.site-pill > .rx-ico { width: 14px; height: 14px; color: var(--fg-muted); }
.site-dot {
    display: grid; place-items: center; flex: none;
    width: 22px; height: 22px; border-radius: 6px;
    background: var(--site-accent-soft, var(--brand-bg)); color: var(--site-accent, var(--brand-text));
    font-size: 10.5px; font-weight: 700; line-height: 1;
}

.site-menu { width: max-content; min-width: 200px; max-width: min(360px, calc(100vw - 24px)); padding: 6px; }
.site-menu-label { padding: 8px 10px 4px; color: var(--fg-dim); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.site-menu .dropdown-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    min-height: 34px; padding: 6px 10px; border-radius: 7px; color: var(--fg-2); white-space: normal;
}
.site-menu .dropdown-item:hover, .site-menu .dropdown-item:focus-visible { background: var(--surface-3); color: var(--fg); outline: none; }
.site-menu .site-option { align-items: flex-start; padding: 8px 10px; }
.site-menu .site-option .site-dot { margin-top: 1px; }
.site-menu .site-option[aria-checked="true"] { color: var(--fg); font-weight: 600; }
.site-option-text { display: grid; min-width: 0; }
.site-option-text strong { font-weight: 600; overflow-wrap: anywhere; }
.site-option-sub { color: var(--fg-muted); font-size: 11.5px; font-weight: 400; overflow-wrap: anywhere; }
.site-option-check { margin-left: auto; width: 14px; height: 14px; color: var(--brand); align-self: center; }
.site-option-manage > .rx-ico { color: var(--fg-muted); }
.site-menu .dropdown-divider { margin: 6px 4px; border-color: var(--line); }

/* Narrower bars drop the descriptor, then the name, as the prototype does; the
   full name stays in the pill's title and accessible name, and in the menu. */
@media (max-width: 1279.98px) { .site-pill .site-pill-sub { display: none; } }
@media (max-width: 767.98px) { .site-pill .site-name-long { display: none; } }

.nav-clock { font-family: var(--ui); font-size: 12px; color: var(--fg-muted); }

/* Global search */
.rx-global-search { position: relative; width: min(340px, 26vw); flex: 0 1 auto; }
.rx-global-search > i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--fg-dim); font-size: 12.5px; pointer-events: none; }
.rx-global-search .form-control { padding-left: 34px; padding-right: 36px; }
.rx-global-search kbd {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px;
    background: var(--surface); color: var(--fg-muted); font: 500 11px var(--ui); box-shadow: none;
}
.rx-global-search .form-control:focus + kbd { display: none; }
.rx-search-results {
    position: absolute; top: calc(100% + 6px); left: 0; z-index: 1060;
    width: min(460px, calc(100vw - 24px)); max-height: 70vh; overflow-y: auto; padding: 6px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.rx-search-label { padding: 8px 10px 4px; color: var(--fg-dim); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.rx-search-item { display: flex; align-items: flex-start; gap: 10px; padding: 7px 10px; border-radius: 7px; color: var(--fg-2); }
.rx-search-item > i { margin-top: 3px; width: 14px; color: var(--fg-muted); }
.rx-search-item:hover, .rx-search-item.is-active { background: var(--surface-3); color: var(--fg); }
.rx-search-item > span { min-width: 0; display: grid; }
.rx-search-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.rx-search-meta { color: var(--fg-muted); font-size: 12px; }
.rx-search-empty { display: grid; justify-items: center; gap: 4px; padding: 22px 12px; text-align: center; color: var(--fg-muted); font-size: 12.5px; }
.rx-search-empty i { font-size: 16px; }
.rx-search-empty strong { color: var(--fg); }
.app-navbar .rx-search-trigger, .app-navbar .rx-search-close { display: none; }
@media (max-width: 1199.98px) { .rx-global-search { width: 220px; } .rx-global-search kbd { display: none; } }

/* Phones: a search button in the bar opens the same field over the bar. */
@media (max-width: 767.98px) {
    .app-navbar .rx-search-trigger, .app-navbar .rx-search-close {
        display: inline-flex; align-items: center; justify-content: center; flex: none;
        width: 40px; height: 40px; padding: 0; font-size: 15px;
    }
    .app-navbar .rx-search-trigger { margin-left: auto; }
    .rx-global-search { display: none; }
    .rx-global-search.is-open {
        display: flex; align-items: center; gap: 6px;
        position: fixed; top: 0; left: 0; right: 0; z-index: 20; /* above the site switcher's badge (z-index 2) */
        width: auto; height: var(--topbar-h); margin: 0 !important; padding: 0 8px 0 12px;
        background: var(--surface); border-bottom: 1px solid var(--line);
    }
    /* The dimmed page below the bar; a tap on it closes the search. */
    .rx-global-search.is-open::before {
        content: ""; position: fixed; top: var(--topbar-h); right: 0; bottom: 0; left: 0; z-index: -1;
        background: rgba(17, 24, 39, .42);
    }
    .rx-global-search.is-open > i { left: 24px; }
    .rx-global-search.is-open .form-control { flex: 1 1 auto; min-width: 0; height: 40px; font-size: 16px; padding-right: 12px; }
    .rx-global-search.is-open .rx-search-results {
        position: fixed; top: var(--topbar-h); left: 0; right: 0;
        width: auto; max-height: calc(100vh - var(--topbar-h)); max-height: calc(100dvh - var(--topbar-h));
        border-width: 0 0 1px; border-radius: 0 0 14px 14px; padding: 6px 8px 10px;
    }
    .rx-global-search.is-open .rx-search-item { padding: 10px; }
    body.rx-search-open { overflow: hidden; }
    /* A blurred bar would become the box the fixed overlay is placed in. */
    body.rx-search-open .app-navbar { -webkit-backdrop-filter: none; backdrop-filter: none; }
}

.user-chip {
    border: 0; background: none; padding: 4px 8px 4px 4px; gap: 10px;
    font-size: 13.5px; font-weight: 600; color: var(--fg);
}
.user-chip:hover { background: var(--surface-3); color: var(--fg); }
.user-avatar {
    width: 32px; height: 32px; border-radius: 9px; border: 0;
    background: linear-gradient(140deg, #8b5cf6, #6366f1); color: #fff;
    font-family: var(--ui); font-size: 12px;
}

.app-navbar .btn-link { color: var(--fg-muted); border-radius: var(--r); }
.app-navbar .btn-link:hover { color: var(--fg); background: var(--surface-3); }

.gen-chip { border-radius: 999px !important; }

/* =========================================================================
   PAGE
   ========================================================================= */
.page-body { padding: 28px 32px 56px; }

.page-header { margin-bottom: 22px; }
.page-header .eyebrow { font-size: 11px; letter-spacing: .07em; font-weight: 600; color: var(--fg-dim); }
.page-header h4 { font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin: 4px 0 6px; }
.page-header p { font-size: 13.5px; color: var(--fg-muted); max-width: 72ch; }

/* A standard page header given the page's actions by the layout: the text
   keeps the left column, the actions take the right (below it on phones). */
.page-header.has-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; }
.page-header.has-actions > :not(.page-header-actions) { grid-column: 1; }
.page-header-actions {
    grid-column: 2; grid-row: 1 / span 3; align-self: start;
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end;
}
.page-header-actions .btn-sm { min-height: 36px; padding: 0 14px; font-size: 13.5px; border-radius: var(--r); }
.page-header-actions .btn-sm.btn-icon { width: 36px; padding: 0; }
@media (max-width: 767.98px) {
    .page-header.has-actions { grid-template-columns: minmax(0, 1fr); }
    .page-header-actions { grid-column: 1; grid-row: auto; justify-content: flex-start; margin: 8px 0 4px; }
}

/* The redesigned page header: title and purpose on the left, actions right. */
.rx-page-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
    margin-bottom: 20px;
}
.rx-page-title { font-size: 28px; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; margin: 0; }
.rx-page-sub { color: var(--fg-muted); margin: 4px 0 0; max-width: 72ch; }
/* Page content uses the full width beside the sidebar; running text keeps a readable measure. */
.privacy-guide > dl { max-width: 110ch; }
.rx-page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* Pill tabs, as on the prototype's section switchers. */
.rx-tabs {
    display: inline-flex; gap: 2px; padding: 4px; margin-bottom: 16px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
    box-shadow: var(--shadow-xs); max-width: 100%; overflow-x: auto;
}
.rx-tab {
    display: inline-flex; align-items: center; gap: 7px;
    height: 34px; padding: 0 12px; border-radius: var(--r);
    color: var(--fg-muted); font-weight: 600; white-space: nowrap;
}
.rx-tab i { font-size: 12.5px; }
.rx-tab:hover { color: var(--fg); background: var(--surface-2); }
.rx-tab[aria-current="page"] { background: var(--brand-bg); color: var(--brand-text); }
.rx-tab-count {
    padding: 0 6px; border-radius: 999px; background: var(--surface-3);
    font-size: 11px; line-height: 18px; color: var(--fg-muted); font-variant-numeric: tabular-nums;
}
.rx-tab[aria-current="page"] .rx-tab-count { background: #fff; color: var(--brand-text); }

/* Bootstrap pills and tabs, restyled to match the tabs above. */
.nav-pills:not(.flex-column) {
    display: inline-flex; padding: 4px; gap: 2px !important;
    background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-xs);
    max-width: 100%;
}
.nav-pills .nav-link {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 12px; border-radius: var(--r);
    color: var(--fg-muted); font-weight: 600;
}
.nav-pills .nav-link:hover { color: var(--fg); background: var(--surface-2); }
.nav-pills .nav-link.active, .nav-pills .show > .nav-link { background: var(--brand-bg); color: var(--brand-text); }
.nav-pills .nav-link .badge { background: var(--surface-3) !important; color: var(--fg-muted) !important; border-radius: 999px; font-weight: 600; }
.nav-pills .nav-link.active .badge { background: #fff !important; color: var(--brand-text) !important; }

.nav-tabs { border-bottom: 1px solid var(--line); gap: 22px; }
.nav-tabs .nav-link {
    border: 0; border-radius: 0; background: none; padding: 10px 0 12px; margin: 0;
    color: var(--fg-muted); font-weight: 600;
}
.nav-tabs .nav-link:hover { color: var(--fg); }
.nav-tabs .nav-link.active { color: var(--fg); background: none; box-shadow: inset 0 -2px 0 var(--brand); }

.badge.bg-primary { background: var(--brand) !important; }

/* Underline sub-navigation (a module's own sections). */
.rx-underline-tabs {
    position: relative; display: flex; gap: 22px; margin: -6px 0 20px;
    border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none;
}
.rx-underline-tabs::-webkit-scrollbar { display: none; }
.rx-underline-tabs a { position: relative; flex: none; padding: 10px 0 12px; color: var(--fg-muted); font-weight: 600; white-space: nowrap; }
.rx-underline-tabs a:hover { color: var(--fg); }
.rx-underline-tabs a[aria-current="page"] { color: var(--fg); }
.rx-underline-tabs a[aria-current="page"]::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--brand);
}

/* Search field with a leading icon. */
.rx-search { position: relative; flex: 1 1 200px; min-width: 0; }
.rx-search > i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--fg-dim); font-size: 12.5px; pointer-events: none; }
.rx-search .form-control { padding-left: 34px; }

.rx-card-icon {
    display: grid; place-items: center; flex: none;
    width: 34px; height: 34px; border-radius: 10px;
    background: var(--brand-bg); color: var(--brand); font-size: 14px;
}

/* =========================================================================
   CARDS
   ========================================================================= */
.card {
    border-radius: var(--r-lg);
    border-color: var(--line);
    box-shadow: var(--shadow-xs);
}
.card-header { padding: 14px 18px; min-height: 54px; background: var(--surface); }
.card-header h5 {
    font-size: 14.5px; font-weight: 650; letter-spacing: -.005em;
    text-transform: none; gap: 10px;
}
.card-header h5 i {
    display: inline-grid; place-items: center; width: 30px; height: 30px;
    border-radius: 9px; background: var(--brand-bg); color: var(--brand); font-size: 12.5px;
}
.card-body { padding: 18px; }

/* Metric tiles keep their markup; only their finish changes. */
.metric { border-radius: var(--r-lg); }
.metric .eyebrow, .posture .eyebrow { letter-spacing: .06em; }
.metric-value { font-family: var(--ui); font-weight: 650; letter-spacing: -.025em; }
.metric.good .metric-value { color: var(--ok); }
.posture { border-radius: var(--r-lg); }

/* =========================================================================
   BUTTONS
   ========================================================================= */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 36px; padding: 0 14px;
    border-radius: var(--r);
    font-size: 13.5px; font-weight: 600;
    white-space: nowrap;
}
.btn > i.me-1, .btn > i.me-2 { margin-right: 0 !important; }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-icon { padding: 0; width: 36px; }
.btn-sm.btn-icon { width: 30px; }

.btn-success, .btn-primary {
    --bs-btn-disabled-bg: var(--brand);
    --bs-btn-disabled-border-color: var(--brand);
    --bs-btn-disabled-color: #fff;
    --bs-btn-active-bg: var(--brand-hover);
    --bs-btn-active-border-color: var(--brand-hover);
    background: var(--brand); border-color: var(--brand); color: #fff;
    box-shadow: 0 1px 2px rgba(79, 70, 229, .3), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.btn-success:hover, .btn-primary:hover, .btn-success:focus, .btn-primary:focus {
    background: var(--brand-hover); border-color: var(--brand-hover); color: #fff;
}

.btn-outline-secondary, .btn-outline-primary, .btn-light {
    background: var(--surface); border: 1px solid var(--line); color: var(--fg-2);
    box-shadow: var(--shadow-xs);
}
.btn-outline-secondary:hover, .btn-outline-secondary:focus,
.btn-outline-primary:hover, .btn-outline-primary:focus,
.btn-light:hover {
    background: var(--surface-2); border-color: var(--line-strong); color: var(--fg);
}
.btn-outline-danger { border-radius: var(--r); }
.btn-link { color: var(--fg-2); font-weight: 600; text-decoration: none; }
.btn-link:hover { color: var(--brand); }
.btn:focus-visible { box-shadow: 0 0 0 3px var(--brand-glow) !important; outline: none; }

/* =========================================================================
   BADGES (pill) — rounded, sentence case, dot first
   ========================================================================= */
.pill {
    height: 22px; padding: 0 8px; gap: 5px;
    border-radius: 999px;
    font-size: 11.5px; font-weight: 600;
    letter-spacing: 0; text-transform: none;
}
.pill::before { width: 6px; height: 6px; flex-basis: 6px; }
.pill-success { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-line); }
.pill-success::before { background: var(--ok-dot); }
.pill-primary { color: var(--brand-text); background: var(--brand-bg); border-color: var(--brand-line); }
.pill-info { color: var(--info); background: var(--info-bg); border-color: var(--info-line); }
.pill-secondary { color: var(--fg-muted); background: var(--surface-3); border-color: var(--line); }

.text-success { color: var(--ok) !important; }
.sev-stack .s-ok, .sev-legend i.k-ok { background: var(--ok-dot); }
.file-chip.is-done .file-state, .gen-stat.good b { color: var(--ok); }
.health-ok { color: var(--ok); background: var(--ok-bg); }
.queue-chip.idle .queue-dot { background: var(--ok-dot); }

/* =========================================================================
   FORMS
   ========================================================================= */
.form-control, .form-select {
    min-height: 36px;
    padding: 7px 11px;
    border-radius: var(--r);
    border-color: var(--line);
    font-size: 13.5px;
    box-shadow: var(--shadow-xs);
}
.form-control:hover, .form-select:hover { border-color: var(--line-strong); }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.form-select { padding-right: 32px; }
.form-select-sm, .form-control-sm { min-height: 30px; padding-top: 4px; padding-bottom: 4px; font-size: 12.5px; }
.form-label, .form-label-sm { font-size: 12px; font-weight: 600; color: var(--fg-2); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }

.filter-bar { padding: 14px 18px; background: var(--surface-2); gap: 10px; }
.filter-bar label { font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--fg-2); }

.select2-container--default .select2-selection--single {
    min-height: 36px; border-radius: var(--r) !important; border-color: var(--line) !important;
}
.select2-dropdown { border-radius: 12px !important; border-color: var(--line) !important; box-shadow: var(--shadow) !important; overflow: hidden; }
.select2-container--default .select2-results__option--highlighted[aria-selected],
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background: var(--brand-bg) !important; color: var(--brand-text) !important;
}

/* =========================================================================
   TABLES
   ========================================================================= */
table.table { font-size: 13.5px; }
table.table > thead > tr > th {
    background: var(--surface-2);
    color: var(--fg-muted);
    font-size: 12px; font-weight: 600;
    letter-spacing: 0; text-transform: none;
    padding: 10px 14px;
}
table.table > tbody > tr > td { padding: 12px 14px; }
table.table > tbody > tr:hover > * { background: var(--surface-2); }
.btn_row { border-radius: 7px; padding: 5px 7px; }
.btn_row:hover { background: var(--surface-3); color: var(--brand); }

/* No zebra striping (DataTables adds its own); rows separate by rule and hover. */
table.table.dataTable.table-striped > tbody > tr:nth-of-type(2n+1) > *,
table.dataTable.table-striped > tbody > tr:nth-of-type(2n+1) > *,
table.table-striped > tbody > tr:nth-of-type(odd) > * { box-shadow: none; --bs-table-accent-bg: transparent; }

/* The record-state rail: live is success green, not the action colour. */
tr[data-status="published"] > td:first-child::before,
tr[data-status="active"] > td:first-child::before { background: var(--ok-dot); }
tr[data-status] > td:first-child::before { width: 3px; }

.dt-info { font-family: var(--ui); font-size: 12.5px; color: var(--fg-muted); }

.page-link { border-radius: var(--r) !important; min-width: 32px; text-align: center; font-weight: 600; color: var(--fg-2); border-color: var(--line); margin: 0 2px; }
.page-item.active .page-link { background: var(--brand); border-color: var(--brand); }

/* =========================================================================
   MENUS, MODALS, TOASTS, CONFIRMATIONS
   ========================================================================= */
.dropdown-menu {
    border-radius: 12px; border-color: var(--line);
    box-shadow: var(--shadow); padding: 6px; font-size: 13.5px;
}
.dropdown-item { border-radius: 7px; padding: 7px 10px; color: var(--fg-2); }
.dropdown-item:hover, .dropdown-item:focus { background: var(--surface-3); color: var(--fg); }
.dropdown-item:disabled, .dropdown-item.disabled,
.dropdown-item.text-danger:disabled { color: var(--fg-dim) !important; background: none; cursor: not-allowed; }

.modal-content { border-radius: var(--r-lg); border: 0; box-shadow: var(--shadow-lg); overflow: hidden; }
.modal-header { background: var(--surface); padding: 18px 20px 14px; }
.modal-title { font-size: 16px; font-weight: 650; }
.modal-title i { color: var(--brand) !important; }
.modal-body { padding: 18px 20px; }
.modal-footer { padding: 14px 20px; background: var(--surface-2); }
.modal-backdrop.show { opacity: .42; }

.swal2-popup { border-radius: var(--r-lg) !important; }
.swal2-styled.swal2-confirm { background: var(--brand) !important; border-radius: var(--r) !important; }
.swal2-styled.swal2-cancel { border-radius: var(--r) !important; }

/* =========================================================================
   NOTIFICATIONS — ported from the approved prototype
   (prototype/admin-redesign: styles.css .toasts / .toast / .callout / .error,
   ui.js toast()). Values are the prototype's own; only the selectors differ.

   Toasts: toastr still queues, times and dismisses them (common.js), but it
   draws into #rx-toasts with classes of our own, so neither toastr.min.css
   nor the old custom.css skin applies. Callouts: .rx-callout-* and
   Bootstrap's .alert-* share the four prototype tones. Field errors:
   .invalid-feedback is the prototype's .error line.
   ========================================================================= */
:root {
    --rx-ico-check-circle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m8.5 12 2.5 2.5 4.5-5'/%3E%3C/svg%3E");
    --rx-ico-info: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4M12 8h.01'/%3E%3C/svg%3E");
    --rx-ico-alert-circle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 8v4M12 16h.01'/%3E%3C/svg%3E");
    --rx-ico-alert: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21.7 18-8-14a2 2 0 0 0-3.5 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.7-3'/%3E%3Cpath d='M12 9v4M12 17h.01'/%3E%3C/svg%3E");
    --rx-ico-shield-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E");
    --rx-ico-x: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E");
    --rx-ico-chevron-down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    --rx-ico-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
    --rx-ico-globe: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18'/%3E%3Cpath d='M12 3a14 14 0 0 1 0 18a14 14 0 0 1 0-18'/%3E%3C/svg%3E");

    /* prototype callout tones: background, border, text */
    --rx-success-soft: #e9f8ef; --rx-success-line: #c9ecd7; --rx-success-ink: #14532d;
    --rx-warning-soft: #fef5e6; --rx-warning-line: #f6dca8; --rx-warning-ink: #78350f;
    --rx-info-soft:    #ebf2fe; --rx-info-line:    #cfe0fb; --rx-info-ink:    #1e3a8a;
    --rx-danger-soft:  #fdeeee; --rx-danger-line:  #f5c7c7; --rx-danger-ink:  #7f1d1d;
    --rx-danger: #b91c1c;

    /* Bootstrap's own invalid state (checkboxes, radios, …) in the same red. */
    --bs-form-invalid-color: #b91c1c;
    --bs-form-invalid-border-color: #b91c1c;
}

/* A prototype icon: 16px, in the current text colour. */
.rx-ico {
    display: inline-block; flex: none; width: 16px; height: 16px;
    background-color: currentColor;
    -webkit-mask: var(--rx-ico) center / contain no-repeat;
    mask: var(--rx-ico) center / contain no-repeat;
}
.rx-ico-check-circle { --rx-ico: var(--rx-ico-check-circle); }
.rx-ico-info { --rx-ico: var(--rx-ico-info); }
.rx-ico-alert-circle { --rx-ico: var(--rx-ico-alert-circle); }
.rx-ico-alert { --rx-ico: var(--rx-ico-alert); }
.rx-ico-shield-check { --rx-ico: var(--rx-ico-shield-check); }
.rx-ico-x { --rx-ico: var(--rx-ico-x); }
.rx-ico-chevron-down { --rx-ico: var(--rx-ico-chevron-down); }
.rx-ico-check { --rx-ico: var(--rx-ico-check); }
.rx-ico-globe { --rx-ico: var(--rx-ico-globe); }

/* --- toasts -------------------------------------------------------------- */
@keyframes rx-rise { from { opacity: 0; transform: translateY(8px) scale(.985); } }

#rx-toasts {
    position: fixed; right: 20px; bottom: 20px; z-index: 1090;
    display: grid; gap: 8px;
    pointer-events: none;
}
/* The report editor's save bar is pinned to the bottom: stack above it. */
body:has(.form-actions) #rx-toasts { bottom: 92px; }

#rx-toasts > .rx-toast {
    display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; column-gap: 10px; align-items: start;
    width: min(380px, calc(100vw - 40px)); margin: 0; padding: 12px 14px;
    background: #111827; color: #f9fafb; border: 0; border-radius: 12px;
    box-shadow: var(--shadow-lg);
    font: 400 13.5px/1.5 var(--ui);
    pointer-events: auto; opacity: 1;
    animation: rx-rise .2s ease-out;
}
/* The tone icon: success, and the prototype's amber "info" for warnings.
   Errors and plain information are not toast tones in the prototype; they
   take its matching icons in the same light-on-dark palette. */
#rx-toasts > .rx-toast::before {
    content: ""; grid-column: 1; grid-row: 1 / span 2;
    width: 16px; height: 16px; margin-top: 2px;
    background-color: #86efac;
    -webkit-mask: var(--rx-ico-check-circle) center / contain no-repeat;
    mask: var(--rx-ico-check-circle) center / contain no-repeat;
}
#rx-toasts > .toast-warning::before { background-color: #fcd34d; -webkit-mask-image: var(--rx-ico-info); mask-image: var(--rx-ico-info); }
#rx-toasts > .toast-info::before { background-color: #93c5fd; -webkit-mask-image: var(--rx-ico-info); mask-image: var(--rx-ico-info); }
#rx-toasts > .toast-error::before { background-color: #fca5a5; -webkit-mask-image: var(--rx-ico-alert-circle); mask-image: var(--rx-ico-alert-circle); }

.rx-toast-title, .rx-toast-message { grid-column: 2; min-width: 0; overflow-wrap: anywhere; }
/* A titled toast reads as the prototype's text + <small> line. */
.rx-toast-title + .rx-toast-message { margin-top: 2px; color: #9ca3af; font-size: 11.25px; }
.rx-toast-message a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* Not in the prototype: every toast here can be dismissed, and some stay
   until it is (finished AI jobs). Sized to the text line, so a one-line
   toast keeps the prototype's height. */
.rx-toast-close {
    grid-column: 3; grid-row: 1;
    display: grid; place-items: center;
    width: 24px; height: 24px; margin: -2px -6px -2px 0; padding: 0;
    border: 0; border-radius: 6px; background: transparent; color: #9ca3af; cursor: pointer;
}
.rx-toast-close::before {
    content: ""; width: 12px; height: 12px; background-color: currentColor;
    -webkit-mask: var(--rx-ico-x) center / contain no-repeat;
    mask: var(--rx-ico-x) center / contain no-repeat;
}
.rx-toast-close:hover, .rx-toast-close:focus-visible { color: #f9fafb; background: rgba(255, 255, 255, .1); }
.rx-toast-close:focus-visible { outline: 2px solid #a5b4fc; outline-offset: 0; }

/* --- callouts (and Bootstrap alerts) ----------------------------------------- */
.rx-callout {
    display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px;
    padding: 12px 14px; border: 1px solid; border-radius: 12px;
    font-size: 13.5px; line-height: 1.5;
}
.rx-callout > .rx-ico { margin-top: 2px; }
.rx-callout > div { min-width: 0; }
.rx-callout ul { margin: 6px 0 0; padding-left: 18px; }

.alert { padding: 12px 14px; border-width: 1px; border-style: solid; border-radius: 12px; font-size: 13.5px; line-height: 1.5; }
.alert.small { font-size: 12px; }

.rx-callout strong, .alert strong { font-weight: 650; }
.rx-callout a:not(.btn), .alert a:not(.btn) { color: inherit; text-decoration: underline; }

.rx-callout-success, .alert-success { background: var(--rx-success-soft); border-color: var(--rx-success-line); color: var(--rx-success-ink); }
.rx-callout-warning, .alert-warning { background: var(--rx-warning-soft); border-color: var(--rx-warning-line); color: var(--rx-warning-ink); }
.rx-callout-info,    .alert-info    { background: var(--rx-info-soft);    border-color: var(--rx-info-line);    color: var(--rx-info-ink); }
.rx-callout-danger,  .alert-danger  { background: var(--rx-danger-soft);  border-color: var(--rx-danger-line);  color: var(--rx-danger-ink); }

/* --- field errors ------------------------------------------------------------ */
.invalid-feedback, .is-invalid ~ .invalid-feedback {
    display: flex; align-items: center; gap: 5px; margin-top: 6px;
    color: var(--rx-danger); font-size: 12px; font-weight: 400; line-height: 1.5;
}
.invalid-feedback::before {
    content: ""; flex: none; width: 12px; height: 12px; background-color: currentColor;
    -webkit-mask: var(--rx-ico-alert-circle) center / contain no-repeat;
    mask: var(--rx-ico-alert-circle) center / contain no-repeat;
}
/* A red border, no tint and no icon inside the field, as in the prototype. */
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--rx-danger); background-color: var(--surface); }
.form-control.is-invalid, textarea.form-control.is-invalid { background-image: none; padding-right: 11px; }
.form-select.is-invalid:not([multiple]):not([size]),
.form-select.is-invalid:not([multiple])[size="1"] { --bs-form-select-bg-icon: none; padding-right: 32px; }
.form-control.is-invalid:focus, .form-select.is-invalid:focus { border-color: var(--rx-danger); box-shadow: 0 0 0 3px rgba(220, 38, 38, .16); }
select.is-invalid + .select2-container--default .select2-selection--single { border-color: var(--rx-danger) !important; background-color: var(--surface); }
select.is-invalid + .select2-container--focus .select2-selection--single,
select.is-invalid + .select2-container--open .select2-selection--single { border-color: var(--rx-danger) !important; box-shadow: 0 0 0 3px rgba(220, 38, 38, .16); }

@media (prefers-reduced-motion: reduce) {
    #rx-toasts > .rx-toast { animation: none; }
}

/* =========================================================================
   EMPTY + LOADING STATES
   ========================================================================= */
.empty-state { padding: 48px 24px; color: var(--fg-muted); }
.empty-state > i {
    width: 48px; height: 48px; border: 0; border-radius: 14px;
    background: var(--surface-3); color: var(--fg-muted); font-size: 18px; margin-bottom: 14px;
}
.empty-state h6 { font-size: 15px; font-weight: 650; color: var(--fg); }
.empty-state p { font-size: 13.5px; color: var(--fg-muted); max-width: 44ch; margin: 4px auto 0; }

.table-loading { color: var(--fg-muted); }
.spinner { border-top-color: var(--brand) !important; }
.custom-loader { border-top-color: var(--brand); }

/* =========================================================================
   SHARED WIDGETS — banner, KPI tiles, charts, lists (dashboard, sites, …)
   ========================================================================= */
.rx-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.rx-grid-7-5 { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 16px; margin-top: 16px; }
.rx-grid-5-7 { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; margin-top: 16px; }
.rx-grid-3 > .card, .rx-grid-7-5 > .card, .rx-grid-5-7 > .card { min-width: 0; }

.rx-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 28px 0 12px; }
.rx-section-title { font-size: 15px; font-weight: 650; margin: 0; }

.rx-seg { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--surface-3); border: 1px solid var(--line); }
.rx-seg button {
    height: 28px; padding: 0 10px; border: 0; border-radius: 7px; background: none;
    font-size: 12.5px; font-weight: 600; color: var(--fg-muted); cursor: pointer; white-space: nowrap;
}
.rx-seg button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: var(--shadow-xs); }
.rx-seg-sm button { height: 24px; padding: 0 8px; font-size: 12px; }
.card-header .rx-seg { margin-left: auto; }

.rx-card-sub { color: var(--fg-muted); font-size: 12.5px; margin: -6px 0 14px; }
.rx-overline { color: var(--fg-dim); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 8px; }
.rx-card-foot { padding: 10px 18px; border-top: 1px solid var(--line); text-align: right; font-size: 12.5px; }
.rx-hint { margin-top: 14px; font-size: 12px; color: var(--fg-muted); }
.rx-hint summary { cursor: pointer; }
.rx-hint ul { margin: 6px 0 0; padding-left: 18px; }
.rx-empty-sm { padding: 28px 16px; }
.rx-empty-sm > i { width: 40px; height: 40px; font-size: 15px; margin-bottom: 10px; }

/* Status banner */
.rx-banner { margin-bottom: 16px; }
.rx-banner-top { display: flex; align-items: flex-start; gap: 16px; padding: 20px 22px; }
.rx-banner-icon {
    display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 12px;
    background: var(--ok-bg); color: var(--ok); font-size: 20px;
}
.rx-banner-icon.is-idle { background: var(--surface-3); color: var(--fg-muted); }
.rx-banner-main { min-width: 0; flex: 1 1 auto; }
.rx-banner-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rx-banner-title { font-size: 17px; font-weight: 650; letter-spacing: -.01em; margin: 0; }
.rx-banner-meta { color: var(--fg-muted); margin: 2px 0 0; }
.rx-banner-sub { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; font-size: 12.5px; color: var(--fg-muted); }
.rx-banner-sub strong { color: var(--fg); font-weight: 600; margin-right: 4px; }
.rx-banner-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.rx-banner-strip {
    display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 11px 22px;
    border-top: 1px solid var(--line); background: var(--surface-2);
    font-size: 12.5px; color: var(--fg-muted);
}
.rx-banner-strip > span { display: inline-flex; align-items: center; gap: 6px; }
.rx-banner-strip strong { color: var(--fg); font-weight: 600; }

.rx-dot { display: inline-block; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--fg-dim); margin-right: 6px; vertical-align: middle; }
.rx-dot.ok { background: var(--ok-dot); box-shadow: 0 0 0 3px rgba(34, 197, 94, .14); }
.rx-dot.warn { background: var(--fill-high); box-shadow: 0 0 0 3px rgba(245, 158, 11, .16); }
.rx-dot.bad { background: var(--fill-crit); box-shadow: 0 0 0 3px rgba(225, 29, 72, .14); }

/* KPI tiles */
.rx-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; }
.rx-kpi { display: flex; flex-direction: column; padding: 16px 18px 18px; color: inherit; transition: border-color .12s, box-shadow .12s; }
a.rx-kpi:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); color: inherit; }
.rx-kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rx-kpi-label { color: var(--fg-muted); font-size: 12.5px; font-weight: 500; }
.rx-kpi-icon { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 8px; font-size: 12.5px; }
.rx-kpi-value { font-size: 28px; font-weight: 650; letter-spacing: -.025em; margin-top: 8px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.rx-kpi-note { color: var(--fg-muted); font-size: 12.5px; margin-top: 4px; }
.rx-delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
.rx-delta i { font-size: 10px; }
.rx-delta.up { color: var(--ok); }
.rx-delta.down { color: var(--crit); }

.tone-primary { background: var(--brand-bg); color: var(--brand); }
.tone-info { background: var(--info-bg); color: var(--info); }
.tone-success { background: var(--ok-bg); color: var(--ok); }
.tone-warning { background: var(--high-bg); color: var(--high); }
.tone-danger { background: var(--crit-bg); color: var(--crit); }
.tone-violet { background: #f3efff; color: #6d28d9; }

/* Bar list */
.rx-barlist { display: grid; gap: 12px; }
.rx-barlist-row { display: grid; grid-template-columns: minmax(110px, 40%) 1fr 48px; align-items: center; gap: 12px; }
.rx-barlist-label { min-width: 0; display: grid; }
.rx-barlist-label span { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rx-barlist-label small { color: var(--fg-muted); font-size: 11.5px; }
.rx-bar { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.rx-bar i { display: block; height: 100%; min-width: 2px; border-radius: 4px; background: var(--brand); }
.rx-bar i.soft { background: #c7cbf8; }
.rx-barlist-value { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Column chart */
.rx-columns { display: flex; align-items: flex-end; gap: 8px; height: 170px; padding-top: 20px; border-bottom: 1px solid var(--line); }
.rx-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.rx-col-value { font-size: 11px; font-weight: 600; color: var(--fg-2); margin-bottom: 4px; font-variant-numeric: tabular-nums; min-height: 15px; }
.rx-col-stack { width: min(26px, 70%); display: flex; flex-direction: column-reverse; border-radius: 5px 5px 2px 2px; overflow: hidden; min-height: 0; }
.rx-col-stack i { display: block; width: 100%; background: var(--brand); }
.rx-col-stack i.soft { background: #c7cbf8; }
.rx-col-labels { display: flex; gap: 8px; margin-top: 8px; }
.rx-col-labels span { flex: 1; text-align: center; font-size: 11px; color: var(--fg-muted); white-space: nowrap; overflow: hidden; }

.rx-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 12.5px; color: var(--fg-muted); }
.rx-legend > * { display: inline-flex; align-items: center; gap: 6px; color: var(--fg-muted); }
.rx-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; background: var(--brand); }
.rx-legend i.soft { background: #c7cbf8; }
.rx-legend strong { color: var(--fg); }

.rx-stackbar { display: flex; gap: 2px; height: 10px; border-radius: 5px; overflow: hidden; background: var(--surface-3); }
.rx-stackbar i { display: block; height: 100%; }
.rx-stackbar .tone-ok, .rx-legend i.tone-ok { background: var(--ok-dot); }
.rx-stackbar .tone-primary-soft, .rx-legend i.tone-primary-soft { background: #a5b4fc; }
.rx-stackbar .tone-neutral, .rx-legend i.tone-neutral { background: #d1d5db; }

/* Ranked / linked lists */
.rx-list { list-style: none; margin: 0; padding: 0; }
.rx-list > li { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); }
.rx-list > li:first-child { border-top: 0; }
.rx-list > li:hover { background: var(--surface-2); }
.rx-list-rank { width: 18px; flex: none; text-align: right; color: var(--fg-dim); font-size: 12px; font-variant-numeric: tabular-nums; }
.rx-list-main { flex: 1 1 auto; min-width: 0; }
.rx-list-title { display: block; font-weight: 600; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.rx-list-title:hover { color: var(--brand); }
.rx-list-meta { color: var(--fg-muted); font-size: 12px; margin-top: 1px; }
.rx-list-chevron { color: var(--fg-dim); font-size: 11px; }
.rx-score {
    display: inline-grid; place-items: center; flex: none; min-width: 38px; height: 28px; padding: 0 8px;
    border-radius: 8px; font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums;
    background: var(--high-bg); color: #92400e; border: 1px solid var(--high-line);
}
.rx-score.hi { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }

.rx-sources { display: grid; gap: 10px; }
.rx-source { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.rx-source-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rx-source-name { font-weight: 600; }
.rx-source-meta { color: var(--fg-muted); font-size: 12px; margin-top: 2px; }

table.rx-plain-table > tbody > tr > td { vertical-align: top; }

.rx-skeleton-card .skeleton { display: block; height: 12px; border-radius: 6px; margin-bottom: 12px; }
#dashboard-overview.is-loading { opacity: .6; }

/* Toolbar strip (search + filters + actions) and its result summary. */
.rx-toolbar-card { margin-bottom: 16px; }
.rx-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 14px 16px; }
.rx-toolbar > .form-select { width: auto; min-width: 150px; flex: 0 1 auto; }
.rx-chips {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    padding: 10px 16px; border-top: 1px solid var(--line); background: var(--surface-2);
    border-radius: 0 0 var(--r-lg) var(--r-lg); font-size: 12.5px; color: var(--fg-muted);
}
.rx-chips:empty { display: none; }
.rx-chips-count strong { color: var(--fg); }
.card > .rx-chips { border-radius: 0; border-top: 0; border-bottom: 1px solid var(--line); }
.rx-chip {
    display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 4px 0 9px;
    border-radius: 999px; background: var(--brand-bg); color: var(--brand-text); border: 1px solid var(--brand-line);
    font-size: 12px; font-weight: 600;
}
.rx-chip button {
    display: grid; place-items: center; width: 18px; height: 18px; border: 0; border-radius: 50%;
    background: none; color: inherit; cursor: pointer; font-size: 10px;
}
.rx-chip button:hover { background: #fff; }
.rx-chips-reset {
    display: inline-flex; align-items: center; gap: 5px; margin-left: auto; border: 0; background: none;
    color: var(--crit); font-weight: 600; font-size: 12px; cursor: pointer;
}
button.rx-tab { border: 0; background: none; cursor: pointer; }
button.rx-tab[aria-pressed="true"] { background: var(--brand-bg); color: var(--brand-text); }
button.rx-tab[aria-pressed="true"] .rx-tab-count { background: #fff; color: var(--brand-text); }

/* =========================================================================
   LISTING TABLES — one scroll box, pinned columns, wrapping text
   Every listing table sits in one .rx-table-scroll box that scrolls on both
   axes (RX.scrollBox): the header row sticks to its top and, in a
   .rx-sticky-table, the serial number (.Clabel) and the record's primary
   column (.rx-sticky-col) stick to its left while the rest scroll behind.
   Borders must be `separate` — a collapsed border is drawn by the table, not
   the cell, and vanishes from a stuck cell.

   Column classes, declared on the header (RX.dataTable copies them to the
   cells; server-rendered tables put them on both):
     .Clabel          the serial number: 52px, pinned first
     .rx-sticky-col   the primary column, pinned beside it; wraps; 260px
     .rx-col-text     long text that wraps (titles, topics, emails); 200px
     .rx-col-sm/md/lg sets either width to 150 / 200 / 300px
   Every other column keeps DataTables' nowrap and its natural width, so
   dates, badges and figures stay on one line.
   ========================================================================= */
.rx-table-scroll {
    position: relative;
    overflow: auto;
    max-height: calc(100vh - var(--topbar-h) - 150px);
    min-height: 160px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    border-bottom: 1px solid var(--line);
}
.rx-table-scroll:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.rx-table-scroll > table.table {
    width: max-content !important;
    min-width: 100%;
    margin: 0 !important;
    border-collapse: separate;
    border-spacing: 0;
}
.rx-table-scroll > table.table > thead > tr > th { position: sticky; top: 0; z-index: 3; }

.rx-col-sm { --rx-col-w: 150px; }
.rx-col-md { --rx-col-w: 200px; }
.rx-col-lg { --rx-col-w: 300px; }

/*
 * The selectors below start `.rx-table-scroll > table.table` on purpose:
 * Bootstrap and DataTables style cells with selectors such as
 * `table.table.dataTable > :not(caption) > * > *` (transparent background)
 * and `table.dataTable.nowrap td` (no wrapping), and these have to outrank
 * both. A set width is what a cell's text wraps within: max-width alone is
 * not honoured by table layout.
 */
.rx-table-scroll > table.table > :not(caption) > tr > .rx-col-text {
    width: var(--rx-col-w, 200px);
    min-width: var(--rx-col-w, 200px);
    white-space: normal;
    overflow-wrap: anywhere;
}
.rx-table-scroll > table.table > :not(caption) > tr > :is(.rx-col-text, .rx-sticky-col) small { white-space: normal; overflow-wrap: anywhere; }

/* Pinned: the serial number, then the primary column. Opaque, so nothing
   scrolling behind shows through. */
.rx-table-scroll > table.table.rx-sticky-table > :not(caption) > tr > :is(.Clabel, .rx-sticky-col) {
    position: sticky;
    z-index: 2;
    background-color: var(--surface);
}
.rx-table-scroll > table.table.rx-sticky-table > :not(caption) > tr > .Clabel {
    left: 0;
    width: 52px;
    min-width: 52px;
    max-width: 52px;
    padding-left: 8px;
    padding-right: 8px;
    text-align: center;
}
.rx-table-scroll > table.table.rx-sticky-table > :not(caption) > tr > .rx-sticky-col {
    left: 52px;
    width: var(--rx-col-w, 260px);
    min-width: var(--rx-col-w, 260px);
    max-width: var(--rx-col-w, 260px);
    white-space: normal;
    overflow-wrap: anywhere;
    box-shadow: inset -1px 0 0 var(--line);
}
.rx-table-scroll > table.table.rx-sticky-table:not(:has(> thead .Clabel)) > :not(caption) > tr > .rx-sticky-col { left: 0; }
.rx-table-scroll > table.table.rx-sticky-table > tbody > tr:hover > :is(.Clabel, .rx-sticky-col) { background-color: var(--surface-2); }
.rx-table-scroll > table.table.rx-sticky-table > thead > tr > th { background-color: var(--surface-2); }
/* The corner cells are stuck on both axes, so they sit above both. */
.rx-table-scroll > table.table.rx-sticky-table > thead > tr > th:is(.Clabel, .rx-sticky-col) { z-index: 4; }
.rx-table-scroll.is-scrolled > table.table.rx-sticky-table > :not(caption) > tr > .rx-sticky-col {
    box-shadow: inset -1px 0 0 var(--line), 8px 0 10px -8px rgba(16, 24, 40, .22);
}

/* =========================================================================
   EDITOR WITH OUTLINE (report editor)
   ========================================================================= */
.rx-editor { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 24px; align-items: start; }
.rx-editor > form { min-width: 0; }
.rx-editor > form > .card + .card { margin-top: 16px; }
.rx-editor-card { scroll-margin-top: calc(var(--topbar-h) + 16px); }
.rx-editor-side {
    position: sticky; top: calc(var(--topbar-h) + 16px);
    display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr);
    max-height: calc(100vh - var(--topbar-h) - 32px); overflow-y: auto;
}
.rx-editor-progress { padding: 14px; }
.rx-editor-progress-top { display: flex; justify-content: space-between; align-items: baseline; color: var(--fg-muted); font-size: 12.5px; margin-bottom: 8px; }
.rx-editor-progress-top strong { color: var(--fg); font-size: 14px; }
.rx-editor-progress-note { margin-top: 6px; color: var(--fg-muted); font-size: 12px; }
.rx-progress { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.rx-progress i { display: block; height: 100%; border-radius: 3px; background: var(--ok-dot); }

.rx-editor-nav ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.rx-editor-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 7px 10px; border: 1px solid transparent; border-radius: var(--r);
    color: var(--fg-2); font-weight: 500; font-size: 13px;
}
.rx-editor-nav a:hover { background: var(--surface); color: var(--fg); }
.rx-editor-nav a.is-active { background: var(--surface); border-color: var(--line); box-shadow: var(--shadow-xs); color: var(--fg); font-weight: 600; }
.rx-editor-nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rx-editor-nav-n { margin-left: auto; color: var(--fg-dim); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.rx-step {
    display: grid; place-items: center; flex: none; width: 18px; height: 18px; border-radius: 50%;
    border: 1.5px solid var(--line-strong); font-size: 9px;
}
.rx-step.s-done { background: var(--ok-dot); border-color: var(--ok-dot); color: #fff; }
.rx-step.s-warn { border-color: var(--fill-high); background: var(--high-bg); }
.rx-step.s-error { border-color: var(--fill-crit); background: var(--crit-bg); color: var(--crit); }

@media (max-width: 1023.98px) {
    .rx-editor { grid-template-columns: minmax(0, 1fr); }
    .rx-editor-side { position: static; max-height: none; overflow: visible; }
    .rx-editor-nav ol { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; position: relative; }
    .rx-editor-nav a, .rx-editor-nav a.is-active { white-space: nowrap; border-color: var(--line); background: var(--surface); padding: 5px 10px; }
    .rx-editor-nav-label { overflow: visible; }
}

/* Site cards */
.rx-site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.rx-site { display: flex; flex-direction: column; min-width: 0; }
.rx-site[hidden] { display: none; }
.rx-site.is-active { border-color: var(--brand-line); box-shadow: 0 0 0 3px var(--brand-bg); }
.rx-site-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px 4px; }
.rx-site-dot {
    display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 10px;
    background: var(--brand-bg); color: var(--brand-text); font-size: 13px; font-weight: 700;
}
.rx-site-title { flex: 1 1 auto; min-width: 0; }
.rx-site-title h3 { font-size: 15px; font-weight: 650; margin: 0; }
.rx-site-title h3 a { color: var(--fg); }
.rx-site-title h3 a:hover { color: var(--brand); }
.rx-site-title p { margin: 2px 0 0; color: var(--fg-muted); font-size: 12.5px; }
.rx-site-facts {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 0; padding: 14px 18px;
}
.rx-site-facts dt { color: var(--fg-muted); font-size: 12px; font-weight: 500; }
.rx-site-facts dd { margin: 0; font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }
.rx-site-facts dd small { font-size: 12px; font-weight: 500; color: var(--fg-dim); }
.rx-site-facts .rx-site-wide { grid-column: 1 / -1; }
.rx-site-facts .rx-site-wide dd { font-size: 13px; display: flex; align-items: center; gap: 8px; }
.rx-site-desc { margin: 0; padding: 0 18px 12px; color: var(--fg-muted); font-size: 12.5px; }
.rx-site-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
    margin-top: auto; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2);
    border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.rx-site-current { display: inline-flex; align-items: center; gap: 6px; color: var(--brand-text); font-weight: 600; font-size: 12.5px; }
.rx-site-current.is-muted { color: var(--fg-muted); font-weight: 500; }
.rx-site-actions { display: flex; gap: 6px; margin-left: auto; }

/* =========================================================================
   CATEGORY TREE + DETAIL PANEL
   ========================================================================= */
.cat-layout {
    display: grid;
    grid-template-columns: minmax(280px, 400px) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

/* The tree keeps its own scroll on wide screens, so the panel beside it is
   always in view however long the taxonomy is. */
.cat-tree-card { display: flex; flex-direction: column; min-width: 0; }
@media (min-width: 1024px) {
    .cat-tree-card {
        position: sticky;
        top: calc(var(--topbar-h) + 16px);
        max-height: calc(100vh - var(--topbar-h) - 32px);
    }
}

.cat-tree-tools { display: grid; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); }
.cat-tree-filters { display: flex; gap: 6px; align-items: center; }
.cat-tree-filters .form-select { flex: 1 1 0; min-width: 0; }
.cat-tree-buttons { display: flex; gap: 4px; flex: none; }

.cat-tree-host { flex: 1 1 auto; min-height: 120px; overflow: auto; padding: 6px; }
.cat-tree-host .table-loading { padding: 28px 12px; }
.cat-tree-foot {
    display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 10px 18px; border-top: 1px solid var(--line);
    color: var(--fg-muted); font-size: 12px;
}

.cat-tree, .cat-tree ul { list-style: none; margin: 0; padding: 0; }
.cat-tree ul { padding-left: 18px; }
.cat-node { outline: none; }
.cat-node[aria-expanded="false"] > ul { display: none; }
.cat-node.is-filtered-out { display: none; }

.cat-row {
    display: flex; align-items: center; gap: 6px;
    min-height: 34px; padding: 0 8px 0 4px;
    border-radius: var(--r);
    cursor: pointer; user-select: none;
}
.cat-row:hover { background: var(--surface-2); }
.cat-node[aria-selected="true"] > .cat-row { background: var(--brand-bg); }
.cat-node[aria-selected="true"] > .cat-row .cat-name { color: var(--brand-text); font-weight: 650; }
.cat-node[aria-selected="true"] > .cat-row .cat-icon { color: var(--brand); }
.cat-node:focus-visible > .cat-row { box-shadow: inset 0 0 0 2px var(--brand); }

.cat-toggle {
    display: grid; place-items: center; flex: none;
    width: 22px; height: 22px; border-radius: 6px;
    color: var(--fg-muted); font-size: 10px;
}
.cat-toggle[data-toggle]:hover { background: var(--surface-3); color: var(--fg); }
.cat-toggle i { transition: transform .15s ease; }
.cat-node[aria-expanded="false"] > .cat-row .cat-toggle i { transform: rotate(-90deg); }

.cat-icon { width: 14px; text-align: center; font-size: 12px; color: var(--fg-dim); flex: none; }
.cat-name {
    flex: 1 1 auto; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-weight: 500; color: var(--fg);
}
.cat-node[aria-level="1"] > .cat-row .cat-name { font-weight: 600; }
.cat-node.is-match > .cat-row .cat-name { font-weight: 650; text-decoration: underline; text-decoration-color: var(--brand-line); text-underline-offset: 3px; }
.cat-row .pill { flex: none; height: 18px; font-size: 10.5px; padding: 0 6px; }
.cat-count {
    flex: none; min-width: 22px; text-align: right;
    color: var(--fg-dim); font-size: 11.5px; font-variant-numeric: tabular-nums;
}

/* Detail panel */
.cat-detail { min-width: 0; transition: opacity .15s ease; }
.cat-detail.is-loading { opacity: .55; }
.cat-detail-head {
    display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap;
    padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.cat-detail-title { flex: 1 1 220px; min-width: 0; }
.cat-detail-title h3 {
    font-size: 17px; font-weight: 650; letter-spacing: -.01em; margin: 0;
    overflow-wrap: anywhere;
}
.cat-detail-title p { margin: 2px 0 0; color: var(--fg-muted); font-size: 12.5px; }
.cat-detail-title p a { color: var(--fg-2); font-weight: 600; }
.cat-detail-title p a:hover { color: var(--brand); }
.cat-detail-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-left: auto; }

.cat-detail-body { padding: 18px; display: grid; gap: 16px; }
.cat-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.cat-stat {
    padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
    display: grid; gap: 2px; min-width: 0;
}
.cat-stat-label { color: var(--fg-muted); font-size: 12px; font-weight: 500; }
.cat-stat strong { font-size: 22px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.cat-stat small { color: var(--fg-dim); font-size: 11.5px; }

.cat-facts { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px 14px; margin: 0; font-size: 13px; }
.cat-facts dt { color: var(--fg-muted); font-weight: 500; }
.cat-facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.cat-copy { color: var(--fg-2); font-size: 13px; }
.cat-copy p { margin: 0 0 6px; }
.cat-note {
    display: flex; gap: 8px; align-items: flex-start; margin: 0;
    padding: 10px 12px; border-radius: 10px;
    background: var(--surface-2); border: 1px dashed var(--line-strong);
    color: var(--fg-muted); font-size: 12.5px;
}
.cat-note i { margin-top: 3px; }

.cat-section-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 18px 8px; border-top: 1px solid var(--line);
}
.cat-section-head h4 { margin: 0; font-size: 14px; font-weight: 650; }
.cat-section-head .btn-link { min-height: 28px; padding: 0 6px; font-size: 12.5px; }
.cat-section-empty { margin: 0; padding: 4px 18px 16px; color: var(--fg-muted); font-size: 13px; }

.cat-list { list-style: none; margin: 0 0 6px; padding: 0; }
.cat-list li {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 18px; border-top: 1px solid var(--line-soft);
}
.cat-list li:first-child { border-top: 0; }
.cat-list li:hover { background: var(--surface-2); }
.cat-list-main { flex: 1 1 auto; min-width: 0; display: grid; color: inherit; }
a.cat-list-main:hover .cat-list-name { color: var(--brand); }
.cat-list-name { font-weight: 600; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-list-meta { color: var(--fg-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-list .pill { flex: none; }

/* =========================================================================
   PRIVACY — document readiness
   One card per policy document. A required document carries an indigo rule
   on its left edge; the pill says where it stands.
   ========================================================================= */
.rx-ready-section { margin-bottom: 16px; }
.rx-ready-section > .rx-section-head { margin-top: 4px; }

.rx-ready-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.rx-ready {
    display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 14px 16px;
    border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-xs);
}
.rx-ready.is-required { box-shadow: inset 3px 0 0 var(--brand), var(--shadow-xs); }
.rx-ready-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.rx-ready-name { margin: 0; font-size: 14px; font-weight: 650; line-height: 1.35; min-width: 0; }
.rx-ready-name a { color: var(--fg); }
.rx-ready-name a:hover { color: var(--brand); }
.rx-ready-top .pill { flex: none; }
.rx-ready-req { margin: 0; color: var(--fg-muted); font-size: 12px; }
.rx-ready-facts { display: grid; gap: 4px; margin: 0; font-size: 12.5px; }
.rx-ready-facts > div { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 8px; }
.rx-ready-facts dt { color: var(--fg-dim); font-weight: 500; }
.rx-ready-facts dd { margin: 0; color: var(--fg-2); overflow-wrap: anywhere; }
.rx-ready-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 4px; }
.rx-ready-actions:empty { display: none; }

/* =========================================================================
   CONTENT — card view (Blogs, Press releases, Newsletters)
   The cards are the DataTable's current page; info and paging stay below.
   ========================================================================= */
.rx-view-toggle { flex: none; }
.rx-view-toggle button { width: 32px; padding: 0; font-size: 12.5px; }

.rx-article-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px;
    padding: 16px; transition: opacity .15s;
}
.rx-article-grid[aria-busy="true"] { opacity: .5; pointer-events: none; }
.rx-article-empty { grid-column: 1 / -1; }

.rx-article {
    display: flex; flex-direction: column; min-width: 0; overflow: hidden;
    border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
    transition: border-color .12s, box-shadow .12s;
}
.rx-article:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }

.rx-article-cover { display: grid; place-items: center; height: 120px; overflow: hidden; background: var(--surface-3); }
.rx-article-cover img { width: 100%; height: 100%; object-fit: cover; }
.rx-article-cover.is-empty {
    background: linear-gradient(135deg, var(--brand-bg), #f6f5ff 60%, var(--surface-2));
    color: var(--brand); font-size: 22px;
}
.rx-article[data-status="archived"] .rx-article-cover { filter: grayscale(.7); }

.rx-article-body { display: grid; align-content: start; gap: 8px; flex: 1 1 auto; padding: 14px 16px; }
.rx-article-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.rx-article-tag {
    display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px;
    background: var(--brand-bg); color: var(--brand-text); font-size: 11.5px; font-weight: 600;
}
.rx-article-title {
    margin: 0; font-size: 14.5px; font-weight: 650; line-height: 1.35; overflow-wrap: anywhere;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.rx-article-title a { color: var(--fg); }
.rx-article-title a:hover { color: var(--brand); }
.rx-article-excerpt {
    margin: 0; color: var(--fg-muted); font-size: 12.5px; line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.rx-article-where { margin: 0; color: var(--fg-dim); font-size: 12px; }

.rx-article-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px 12px 16px; border-top: 1px solid var(--line); }
.rx-article-meta { flex: 1 1 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-muted); font-size: 12px; }
.rx-article-actions { display: flex; flex: none; gap: 4px; }
.rx-article-actions .btn { width: 30px; }
.rx-article-actions .is-danger:hover, .rx-article-actions .is-danger:focus-visible { color: var(--crit); border-color: var(--crit-line); background: var(--crit-bg); }

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 1279.98px) {
    .rx-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .rx-ready-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1199.98px) {
    .page-body { padding: 24px; }
}

@media (max-width: 1023.98px) {
    .rx-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .rx-grid-3 > .rx-span-md { grid-column: 1 / -1; }
    .rx-grid-7-5, .rx-grid-5-7 { grid-template-columns: minmax(0, 1fr); }
    .rx-banner-top { flex-wrap: wrap; }
    .rx-banner-actions { margin-left: 0; width: 100%; justify-content: flex-start; }
    .cat-layout { grid-template-columns: minmax(0, 1fr); }
    .cat-tree-host { max-height: 60vh; }
}

@media (max-width: 991.98px) {
    .app-sidebar { box-shadow: none; }
    .app-sidebar.open { box-shadow: var(--shadow-lg); }
    .page-body { padding: 20px 16px 40px; }
}

@media (max-width: 767.98px) {
    .rx-grid-3 { grid-template-columns: minmax(0, 1fr); }
    .rx-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .rx-kpi { padding: 12px 14px 14px; }
    .rx-kpi-value { font-size: 22px; }
    .rx-banner-top, .rx-banner-strip { padding-left: 16px; padding-right: 16px; }
    .rx-section-head { flex-wrap: wrap; }
    .rx-list > li { padding: 12px 14px; }
    .rx-page-head { flex-direction: column; }
    .rx-page-actions { justify-content: flex-start; }
    .rx-page-title { font-size: 22px; }
    .page-header h4 { font-size: 22px; }
    .app-navbar { padding: 0 12px; }
    .navbar-title .crumb { display: none; }
    .cat-stats { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .cat-stats .cat-stat:last-child { grid-column: 1 / -1; }
    .cat-facts { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    .cat-facts dd { margin-bottom: 8px; }
    .cat-detail-actions { margin-left: 0; }
    .cat-tree-filters { flex-wrap: wrap; }
    .cat-tree-filters .form-select { flex-basis: calc(50% - 3px); }
    .rx-table-scroll { max-height: 70vh; }
    .form-actions .form-actions-note { display: none; }
    .rx-table-scroll > table.table.rx-sticky-table > :not(caption) > tr > .Clabel { width: 40px; min-width: 40px; max-width: 40px; padding-left: 4px; padding-right: 4px; }
    .rx-table-scroll > table.table.rx-sticky-table > :not(caption) > tr > .rx-sticky-col { left: 40px; --rx-col-w: 150px; }
    .rx-table-scroll > table.table.rx-sticky-table:not(:has(> thead .Clabel)) > :not(caption) > tr > .rx-sticky-col { left: 0; }
    /* A table drawn as cards (.rx-stack) is a list: no inner scrolling, no pins, no set widths. */
    .rx-table-scroll:has(> table.rx-stack) { max-height: none; min-height: 0; overflow: visible; border-bottom: 0; }
    .rx-table-scroll > table.table.rx-stack > tbody > tr > td,
    .rx-table-scroll > table.table.rx-stack.rx-sticky-table > tbody > tr > td {
        position: static; left: auto; z-index: auto;
        width: auto; min-width: 0; max-width: none;
        box-shadow: none; background-color: transparent;
    }
    /* …and its header, which is the sort strip of chips (custom.css). */
    .rx-table-scroll > table.table.rx-stack > thead > tr > th,
    .rx-table-scroll > table.table.rx-stack.rx-sticky-table > thead > tr > th {
        position: relative; left: auto; z-index: auto;
        width: auto; min-width: 0; max-width: none;
        box-shadow: none;
    }
    .rx-table-scroll > table.table.rx-stack.rx-sticky-table > thead > tr > th:not(.dt-ordering-asc):not(.dt-ordering-desc) { background-color: var(--surface); }
    .rx-toolbar > .form-select { flex: 1 1 140px; }
    .rx-ready-grid { grid-template-columns: minmax(0, 1fr); }
    .rx-article-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 12px; }
    .rx-article-cover { height: 104px; }
    .rx-article-actions .btn { width: 36px; min-height: 36px; }
    /* With the view switch the strip is too full for one row: search goes first, on its own. */
    .card-header:has(.rx-view-toggle) #inp_searchInDT { flex-basis: 100%; order: -1; }
}
