
        /* =========================================================
           REFERENCE-DERIVED DESIGN SYSTEM
           Geometry is tuned to the supplied 1504 × 1128 reference.
        ========================================================== */

        :root {
            /* ===== Appearance tokens — managed by appearance.js (Settings → Appearance) ===== */

            /* Brand: everything below is derived from --primary */
            --primary: #1a1b7c;
            --on-primary: #ffffff;
            --primary-dark: color-mix(in oklch, var(--primary) 75%, black);
            --primary-soft: color-mix(in oklch, var(--primary) 10.5%, white);
            --primary-soft-2: color-mix(in oklch, var(--primary) 6.2%, white);
            --primary-line: color-mix(in oklch, var(--primary) 20%, white);
            --primary-flash: color-mix(in oklch, var(--primary) 14%, white);
            --primary-bright: color-mix(in oklch, var(--primary) 62%, white);
            --primary-ink: color-mix(in oklch, var(--primary) 38%, black);

            /* Neutrals: one hue/strength pair drives the whole grey scale (cool / warm / pure) */
            --nh: 268;
            --nk: 1;
            --n-25: oklch(.988 calc(.0029 * var(--nk)) var(--nh));
            --n-50: oklch(.977 calc(.0054 * var(--nk)) var(--nh));
            --n-100: oklch(.959 calc(.0068 * var(--nk)) var(--nh));
            --n-200: oklch(.935 calc(.0097 * var(--nk)) var(--nh));
            --n-300: oklch(.885 calc(.0157 * var(--nk)) var(--nh));
            --n-400: oklch(.829 calc(.0176 * var(--nk)) var(--nh));
            --n-500: oklch(.71 calc(.0273 * var(--nk)) var(--nh));
            --n-600: oklch(.544 calc(.035 * var(--nk)) var(--nh));
            --n-700: oklch(.442 calc(.0355 * var(--nk)) var(--nh));
            --n-800: oklch(.369 calc(.0381 * var(--nk)) var(--nh));
            --n-900: oklch(.261 calc(.0301 * var(--nk)) var(--nh));

            --canvas: var(--n-100);
            --frame: #ffffff;
            --surface: #ffffff;
            --surface-soft: var(--n-25);
            --surface-tint: var(--n-50);
            --surface-hover: var(--n-100);
            --text: var(--n-900);
            --text-2: var(--n-600);
            --text-3: var(--n-500);
            --text-secondary: var(--text-2);
            --border: var(--n-200);
            --border-soft: var(--n-100);
            --line: var(--n-200);

            /* Semantic colours stay fixed */
            --blue: #2f7bc4;
            --blue-soft: var(--n-100);
            --orange: #bf8a27;
            --orange-soft: #fff6e1;
            --red: #d64848;
            --red-soft: var(--n-100);

            /* Shape, type, density */
            --radius-k: 1;
            --r-xs: calc(5px * var(--radius-k));
            --r-sm: calc(7px * var(--radius-k));
            --r-md: calc(9px * var(--radius-k));
            --r-lg: calc(11px * var(--radius-k));
            --r-xl: calc(13px * var(--radius-k));
            --pill: 999px;
            --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

            /* Sidebar (light by default; see [data-sidebar] overrides at the end of this file) */
            --sidebar-w: 198px;
            --sb-bg: var(--n-25);
            --sb-border: var(--n-100);
            --sb-text: var(--n-700);
            --sb-text-strong: var(--text);
            --sb-text-muted: var(--text-2);
            --sb-icon: var(--n-600);
            --sb-hover: var(--n-100);
            --sb-active-bg: var(--primary-soft);
            --sb-active-text: var(--primary-dark);
            --sb-active-icon: var(--primary);
            --sb-search-bg: var(--n-100);
            --sb-search-text: var(--n-500);
            --sb-brand-text: var(--text);
            --sb-brand-bg: var(--primary);
            --sb-brand-fg: var(--on-primary);
            --sb-tile-border: var(--n-200);
            --sb-avatar-bg: var(--primary-soft);
            --sb-avatar-text: var(--primary-dark);
        }

        * { box-sizing: border-box; }
        html, body { min-height: 100%; margin: 0; }

        body {
            background: var(--canvas);
            color: var(--text);
            font-family: var(--font-sans);
            font-size: 13px;
            line-height: 1.35;
            -webkit-font-smoothing: antialiased;
            text-rendering: optimizeLegibility;
        }

        button, input { font: inherit; }
        button { border: 0; }
        a { text-decoration: none; color: inherit; }

        /* =========================================================
           APP FRAME
        ========================================================== */

        .app {
            min-height: 100dvh;
            display: flex;
            background: var(--frame);
        }

        .app-frame {
            width: 100%;
            min-height: 100dvh;
            display: flex;
            overflow: hidden;
            background: var(--frame);
        }

        /* =========================================================
           SIDEBAR
        ========================================================== */

        .sidebar {
            width: var(--sidebar-w);
            flex: 0 0 var(--sidebar-w);
            display: flex;
            flex-direction: column;
            background: var(--sb-bg);
            border-right: 1px solid var(--sb-border);
            overflow: hidden;
            transition: width .22s ease, flex-basis .22s ease;
        }

        .sidebar.collapsed {
            width: 62px;
            flex-basis: 62px;
        }

        .sidebar-head {
            padding: 23px 13px 11px;
        }

        .brand {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 0 4px;
        }

        .brand-mark {
            width: 28px;
            height: 28px;
            display: grid;
            place-items: center;
            border-radius: calc(8px * var(--radius-k));
            background: var(--sb-brand-bg);
            color: var(--sb-brand-fg);
            font-size: 15px;
        }

        .brand-name {
            font-size: 15px;
            font-weight: 700;
            letter-spacing: -.025em;
            color: var(--sb-brand-text);
        }

        .collapse-button {
            position: absolute;
            top: 27px;
            right: -10px;
            z-index: 5;
            width: 20px;
            height: 20px;
            padding: 0;
            display: grid;
            place-items: center;
            border-radius: 50%;
            background: var(--surface);
            border: 1px solid var(--border);
            box-shadow: var(--shadow-sm);
            color: var(--n-600);
            cursor: pointer;
        }

        .collapse-button i {
            display: block;
            font-size: 13px;
            line-height: 1;
        }

        .collapse-button:hover {
            background: var(--primary-soft);
            border-color: var(--primary-soft);
            color: var(--primary-dark);
        }

        .sidebar-search {
            height: 31px;
            display: flex;
            align-items: center;
            gap: 7px;
            margin-top: 11px;
            padding: 0 9px;
            border-radius: calc(8px * var(--radius-k));
            background: var(--sb-search-bg);
            color: var(--sb-search-text);
        }

        .sidebar-search i { font-size: 14px; }

        .sidebar-search input {
            width: 100%;
            min-width: 0;
            border: 0;
            outline: 0;
            background: transparent;
            font-size: 12px;
            color: var(--sb-text-strong);
        }

        .sidebar-search input::placeholder { color: var(--sb-search-text); }

        .sidebar-nav {
            min-height: 0;
            flex: 1 1 auto;
            overflow-y: auto;
            padding: 3px 9px 10px;
            scrollbar-width: thin;
            scrollbar-color: var(--n-300) transparent;
        }

        .sidebar-nav::-webkit-scrollbar { width: 4px; }
        .sidebar-nav::-webkit-scrollbar-thumb {
            background: var(--n-300);
            border-radius: 999px;
        }

        .nav-group {
            margin-bottom: 12px;
        }

        .nav-title {
            padding: 0 10px;
            margin-bottom: 4px;
            color: var(--sb-text-muted);
            font-size: 9px;
            font-weight: 600;
            letter-spacing: .05em;
            text-transform: uppercase;
        }

        .nav-item {
            width: 100%;
            min-height: 34px;
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 0 9px;
            margin-bottom: 2px;
            border-radius: calc(7px * var(--radius-k));
            color: var(--sb-text);
            background: transparent;
            cursor: pointer;
            text-align: left;
        }

        .nav-item:hover {
            background: var(--sb-hover);
            color: var(--sb-text-strong);
        }

        .nav-item.active {
            background: var(--sb-active-bg);
            color: var(--sb-active-text);
        }

        .nav-icon {
            width: 18px;
            flex: 0 0 18px;
            display: grid;
            place-items: center;
            color: var(--sb-icon);
            font-size: 16px;
        }

        .nav-item.active .nav-icon {
            color: var(--sb-active-icon);
        }

        .nav-label {
            flex: 1;
            min-width: 0;
            font-size: 12.5px;
            font-weight: 500;
            white-space: nowrap;
        }

        .nav-count {
            color: var(--sb-text-strong);
            font-size: 10.5px;
            font-weight: 600;
        }

        .nav-item.active .nav-count {
            color: var(--sb-active-text);
        }

        .nav-chevron {
            color: var(--sb-icon);
            font-size: 13px;
            transition: transform .16s ease;
        }

        .nav-item.open .nav-chevron {
            transform: rotate(90deg);
        }

        .nav-submenu {
            display: none;
            padding-left: 26px;
            margin-bottom: 3px;
        }

        .nav-submenu.open {
            display: grid;
            gap: 1px;
        }

        .nav-subitem {
            min-height: 28px;
            display: flex;
            align-items: center;
            padding: 0 8px;
            border-radius: calc(6px * var(--radius-k));
            color: var(--sb-text-muted);
            font-size: 11px;
        }

        .nav-subitem:hover {
            background: var(--sb-hover);
            color: var(--sb-text-strong);
        }

        .nav-subitem.active {
            color: var(--sb-active-text);
            font-weight: 600;
        }

        .sidebar-footer {
            flex: 0 0 auto;
            padding: 8px 9px 10px;
            border-top: 1px solid var(--sb-border);
            background: var(--sb-bg);
        }

        .profile-tile {
            display: flex;
            flex-direction: column;
            border: 1px solid var(--sb-tile-border);
            border-radius: calc(10px * var(--radius-k));
            overflow: hidden;
        }

        .profile-tile-main {
            display: flex;
            align-items: center;
            width: 100%;
            gap: 7px;
            padding: 7px 8px;
            cursor: pointer;
            background: transparent;
            text-align: left;
        }

        .profile-tile-main:hover { background: var(--sb-hover); }

        .profile-avatar {
            width: 28px;
            height: 28px;
            flex: 0 0 28px;
            display: grid;
            place-items: center;
            border-radius: 50%;
            background: var(--sb-avatar-bg);
            color: var(--sb-avatar-text);
            font-size: 11px;
            font-weight: 700;
        }

        .profile-copy {
            min-width: 0;
            flex: 1;
        }

        .profile-name {
            display: block;
            overflow: hidden;
            color: var(--sb-text-strong);
            font-size: 12.5px;
            font-weight: 600;
            white-space: nowrap;
            text-overflow: ellipsis;
        }

        .profile-role {
            display: block;
            margin-top: 1px;
            color: var(--sb-text-muted);
            font-size: 10px;
            white-space: nowrap;
        }

        .logout {
            background: transparent;
            display: flex;
            align-items: center;
            gap: 7px;
            min-height: 32px;
            padding: 0 8px;
            color: var(--sb-text-muted);
            font-size: 12px;
            border-top: 1px solid var(--sb-border);
            cursor: pointer;
        }

        .logout:hover {
            background: var(--sb-hover);
            color: var(--sb-text-strong);
        }

        /* Collapsed rail */
        .sidebar.collapsed .brand {
            justify-content: center;
        }

        .sidebar.collapsed .brand-name,
        .sidebar.collapsed .sidebar-search,
        .sidebar.collapsed .nav-title,
        .sidebar.collapsed .nav-label,
        .sidebar.collapsed .nav-count,
        .sidebar.collapsed .nav-chevron,
        .sidebar.collapsed .nav-submenu,
        .sidebar.collapsed .profile-copy,
        .sidebar.collapsed .logout span {
            display: none;
        }

        .sidebar.collapsed .sidebar-head {
            padding: 22px 7px 12px;
        }

        .sidebar.collapsed .sidebar-nav {
            padding-left: 7px;
            padding-right: 7px;
        }

        .sidebar.collapsed .nav-group {
            margin-bottom: 7px;
        }

        .sidebar.collapsed .nav-item {
            min-height: 40px;
            justify-content: center;
            padding: 0;
            border-radius: calc(9px * var(--radius-k));
        }

        .sidebar.collapsed .nav-icon {
            width: auto;
            flex-basis: auto;
            font-size: 18px;
        }

        .sidebar.collapsed .sidebar-footer {
            padding-left: 7px;
            padding-right: 7px;
        }

        .sidebar.collapsed .profile-tile-main {
            justify-content: center;
            padding: 8px 0;
        }

        .sidebar.collapsed .logout {
            justify-content: center;
            padding: 0;
        }

        .sidebar.collapsed .logout i {
            font-size: 17px;
        }

        .tooltip-item { position: relative; }

        /* =========================================================
           MAIN WORKSPACE
        ========================================================== */

        .main {
            min-width: 0;
            flex: 1 1 auto;
            display: flex;
            flex-direction: column;
            background: #fff;
        }

        .content {
            width: 100%;
            min-width: 0;
            padding: 18px 30px 34px;
            overflow-y: auto;
            overflow-x: hidden;
        }

        .page-top {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 15px;
        }

        .page-heading {
            display: flex;
            flex-direction: column;
            gap: 3px;
        }

        .page-title {
            margin: 0;
            color: var(--text);
            font-size: 15px;
            font-weight: 600;
            line-height: 1;
            letter-spacing: -.035em;
        }

        .page-total {
            color: var(--n-500);
            font-size: 11px;
        }

        .new-button {
            height: 33px;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 0 11px;
            border-radius: calc(7px * var(--radius-k));
            background: var(--primary-soft-2);
            color: var(--primary-dark);
            font-size: 12px;
            font-weight: 600;
            cursor: pointer;
        }

        .new-button:hover {
            background: var(--n-100);
        }

        .new-button i {
            color: var(--primary);
            font-size: 14px;
        }

        /* Tabs */
        /* COMPONENT: compact status tabs (.status-tabs / .status-tab) — small inline
           filter tabs with counts; use where a full KPI card row is too heavy
           (e.g. inside drawers, secondary panels, dense list pages). */
        .status-tabs {
            display: flex;
            align-items: center;
            gap: 1px;
            margin-top: 25px;
        }

        .status-tab {
            min-height: 31px;
            display: flex;
            align-items: center;
            gap: 7px;
            padding: 0 11px;
            border-radius: calc(5px * var(--radius-k));
            background: var(--n-50);
            color: var(--n-600);
            font-size: 11.5px;
            cursor: pointer;
        }

        .status-tab + .status-tab {
            margin-left: 2px;
        }

        .status-tab .tab-count {
            min-width: 24px;
            height: 19px;
            display: inline-grid;
            place-items: center;
            padding: 0 5px;
            border-radius: calc(4px * var(--radius-k));
            background: var(--n-200);
            color: var(--n-500);
            font-size: 11px;
            font-weight: 500;
        }

        .status-tab.active {
            background: var(--primary);
            color: var(--on-primary);
        }

        .status-tab.active .tab-count {
            background: rgba(255,255,255,.15);
            color: #fff;
        }

        /* Filters */
        .filters {
            display: grid;
            grid-template-columns: minmax(0, 1fr) 170px 170px;
            gap: 10px;
            margin-top: 20px;
        }

        .search-field,
        .select-field {
            height: 36px;
            display: flex;
            align-items: center;
            gap: 7px;
            padding: 0 10px;
            border: 1px solid var(--n-100);
            border-radius: calc(4px * var(--radius-k));
            background: var(--n-50);
            color: var(--n-500);
        }

        .search-field i,
        .select-field i {
            font-size: 14px;
        }

        .search-field input {
            width: 100%;
            min-width: 0;
            border: 0;
            outline: 0;
            background: transparent;
            color: var(--text);
            font-size: 12px;
        }

        .search-field input::placeholder {
            color: var(--n-500);
        }

        .select-field {
            justify-content: space-between;
            font-size: 12px;
            color: var(--n-700);
        }

        .select-main {
            display: flex;
            align-items: center;
            gap: 7px;
        }

        .select-main .select-icon {
            color: var(--n-500);
        }

        .select-arrow {
            color: var(--n-600);
            font-size: 13px;
        }

        /* Order cards */
        .order-grid {
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 10px;
            margin-top: 20px;
        }

        .order-card {
            min-width: 0;
            min-height: 150px;
            display: grid;
            grid-template-columns: 158px minmax(0, 1fr);
            overflow: hidden;
            border: 1px solid var(--border);
            border-radius: calc(9px * var(--radius-k));
            background: #fff;
            transition: box-shadow .14s ease, border-color .14s ease;
        }

        .order-card:hover {
            border-color: var(--n-300);
            box-shadow: 0 3px 10px rgba(30, 54, 43, .045);
        }

        .order-summary {
            padding: 13px 12px;
        }

        .record-status {
            display: flex;
            align-items: center;
            gap: 5px;
            color: var(--primary-dark);
            font-size: 11px;
            font-weight: 500;
        }

        .record-status.waiting {
            color: var(--blue);
        }

        .record-status.attention {
            color: var(--orange);
        }

        .record-dot {
            width: 5px;
            height: 5px;
            border-radius: 50%;
            background: currentColor;
        }

        .order-id {
            margin-top: 7px;
            color: var(--text);
            font-size: 13.5px;
            font-weight: 600;
            letter-spacing: -.025em;
        }

        .order-client {
            margin-top: 2px;
            color: var(--n-600);
            font-size: 12px;
        }

        .order-kv {
            margin-top: 12px;
        }

        .order-kv-label {
            color: var(--n-500);
            font-size: 11px;
        }

        .order-kv-value {
            margin-top: 2px;
            color: var(--text);
            font-size: 12px;
            font-weight: 600;
        }

        .provider-panel {
            min-width: 0;
            margin: 8px 8px 8px 0;
            padding: 11px 11px 9px;
            border-radius: calc(7px * var(--radius-k));
            background: var(--n-25);
        }

        .provider-top {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
        }

        .provider-title {
            min-width: 0;
            color: var(--text);
            font-size: 12px;
            font-weight: 600;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .provider-meta {
            color: var(--n-500);
            font-size: 11px;
            white-space: nowrap;
        }

        .provider-body {
            display: grid;
            grid-template-columns: 92px minmax(0, 1fr);
            gap: 9px;
            align-items: center;
            margin-top: 8px;
        }

        .timeline {
            position: relative;
            padding-left: 12px;
        }

        .timeline::before {
            content: "";
            position: absolute;
            left: 3px;
            top: 4px;
            bottom: 4px;
            width: 1px;
            background: var(--n-200);
        }

        .timeline-item {
            position: relative;
            min-height: 17px;
            display: flex;
            align-items: center;
            color: var(--n-500);
            font-size: 11px;
            white-space: nowrap;
        }

        .timeline-item::before {
            content: "";
            position: absolute;
            left: -11px;
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: var(--n-300);
            border: 1px solid #fff;
        }

        .timeline-item.active {
            color: var(--text);
            font-weight: 500;
        }

        .timeline-item.active::before {
            background: var(--primary);
        }

        .record-visual {
            position: relative;
            height: 78px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .paper {
            position: absolute;
            width: 48px;
            height: 60px;
            border-radius: calc(3px * var(--radius-k));
            border: 1px solid var(--n-300);
            background: #fff;
            transform: rotate(-7deg);
            box-shadow: 0 3px 8px rgba(22,42,32,.05);
        }

        .paper.back {
            transform: translate(10px, 1px) rotate(5deg);
            background: var(--n-50);
        }

        .paper.front {
            z-index: 2;
            overflow: hidden;
        }

        .paper-front-top {
            height: 12px;
            background: var(--primary);
        }

        .paper-lines {
            padding: 7px 6px;
        }

        .paper-lines span {
            display: block;
            height: 3px;
            margin-bottom: 4px;
            border-radius: 2px;
            background: var(--n-200);
        }

        .paper-lines span:nth-child(1) { width: 80%; }
        .paper-lines span:nth-child(2) { width: 65%; }
        .paper-lines span:nth-child(3) { width: 86%; }
        .paper-lines span:nth-child(4) { width: 54%; }

        .reference-trigger {
            position: fixed;
            right: 14px;
            bottom: 14px;
            z-index: 5000;
            width: 31px;
            height: 31px;
            display: grid;
            place-items: center;
            border-radius: 50%;
            background: rgba(255,255,255,.8);
            border: 1px solid var(--n-300);
            color: var(--n-600);
            cursor: pointer;
            opacity: .35;
            transition: opacity .15s ease, background .15s ease;
        }

        .reference-trigger:hover {
            opacity: 1;
            background: #fff;
        }

        @media (min-width: 1450px) {
            .content {
                padding-left: 34px;
                padding-right: 34px;
            }

            .order-card {
                grid-template-columns: 140px minmax(0, 1fr);
            }

            .provider-body {
                grid-template-columns: 102px minmax(0, 1fr);
            }
        }

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

        @media (max-width: 1000px) {
            :root {
                --sidebar-w: 166px;
            }

            .order-grid {
                grid-template-columns: 1fr;
            }

            .filters {
                grid-template-columns: minmax(0,1fr) 150px 150px;
            }
        }

        @media (max-width: 760px) {
            .app {
                padding: 0;
            }

            .app-frame {
                width: 100%;
                min-height: 100dvh;
                border: 0;
                box-shadow: none;
            }

            .sidebar {
                position: fixed;
                inset: 0 auto 0 0;
                z-index: 6000;
                width: 205px;
                flex-basis: 205px;
                height: 100dvh;
                transform: translateX(-100%);
                box-shadow: 14px 0 30px rgba(0,0,0,.1);
            }

            .sidebar.mobile-open {
                transform: translateX(0);
            }

            .sidebar.collapsed {
                width: 205px;
                flex-basis: 205px;
            }

            .sidebar.collapsed .brand-name,
            .sidebar.collapsed .sidebar-search,
            .sidebar.collapsed .nav-title,
            .sidebar.collapsed .nav-label,
            .sidebar.collapsed .nav-count,
            .sidebar.collapsed .nav-chevron,
            .sidebar.collapsed .nav-submenu,
            .sidebar.collapsed .profile-copy,
            .sidebar.collapsed .logout span {
                display: initial;
            }

            .sidebar.collapsed .brand {
                justify-content: flex-start;
            }

            .sidebar.collapsed .nav-item {
                min-height: 34px;
                justify-content: flex-start;
                padding: 0 9px;
            }

            .sidebar.collapsed .nav-icon {
                width: 18px;
                flex-basis: 18px;
                font-size: 16px;
            }

            .main {
                width: 100%;
            }

            .content {
                padding: 20px 13px 24px;
            }

            .page-top {
                align-items: flex-start;
            }

            .page-title {
                font-size: 15px;
            }

            .filters {
                grid-template-columns: 1fr;
            }

            .order-grid {
                grid-template-columns: 1fr;
            }

            .reference-grid {
                grid-template-columns: 1fr;
            }

            .reference-trigger {
                right: 10px;
                bottom: 10px;
            }
        }

/* =============================================================
   RECORD FLOW SHARED UI LAYER
   Bootstrap is loaded BEFORE this stylesheet. Bootstrap provides
   JS-driven behavior + a small set of primitives; this file owns
   the visual system.
============================================================= */

:root {
    --sidebar-expanded: 198px;
    --sidebar-collapsed: 62px;
    --content-pad-x: 30px;
    --content-pad-y: 18px;
    --field-h: 38px;
    --control-radius: calc(7px * var(--radius-k));
    --shadow-sm: 0 1px 2px rgba(20, 40, 31, .05);
    --shadow-md: 0 10px 30px rgba(20, 40, 31, .08);
    --modal-w: 720px;
}

html,
body {
    width: 100%;
    min-height: 100%;
}

body {
    overflow-x: hidden;
    background: var(--canvas);
}

/* Fixed shell: sidebar owns the left rail, main offsets against it. */
.app,
.app-frame {
    width: 100%;
    min-width: 0;
    min-height: 100dvh;
}

.app-frame {
    display: block;
    position: relative;
    overflow: visible;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    width: var(--sidebar-expanded);
    height: 100dvh;
    flex: 0 0 auto;
    overflow: visible;
    isolation: isolate;
    transition: width .22s ease, box-shadow .22s ease, background .22s ease;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
    flex-basis: var(--sidebar-collapsed);
}

.sidebar-nav {
    overflow-y: auto;
    overflow-x: visible;
}

.main {
    min-width: 0;
    width: auto;
    min-height: 100dvh;
    margin-left: var(--sidebar-expanded);
    transition: margin-left .22s ease;
}

.sidebar.collapsed ~ .main {
    margin-left: var(--sidebar-collapsed);
}

.content {
    min-height: 100dvh;
    padding: var(--content-pad-y) var(--content-pad-x) 34px;
}

/* Small mobile rail button is controlled by app.js. */
.mobile-rail-toggle {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1035;
    display: none;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: calc(9px * var(--radius-k));
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.sidebar-mobile-scrim {
    position: fixed;
    inset: 0;
    z-index: 1030;
    display: none;
    background: rgba(20, 27, 23, .28);
}

/* =============================================================
   TYPOGRAPHY TOKENS
============================================================= */
.ui-eyebrow,
.ui-kicker,
.form-section-kicker,
.drawer-section-kicker {
    margin: 0;
    color: var(--n-600);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.page-title {
    font-size: 15px;
    line-height: 1.05;
    font-weight: 600;
    letter-spacing: -.035em;
}

.page-total,
.ui-meta,
.field-help,
.form-hint {
    color: var(--text-3);
    font-size: 11.5px;
    line-height: 1.4;
}

.field-label,
.form-label {
    margin: 0 0 6px;
    color: var(--text-2);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
}

.form-label.required::after {
    content: " *";
    color: var(--red);
}

/* =============================================================
   BOOTSTRAP FORM OVERRIDES — OWNED BY RECORD FLOW
============================================================= */
.form-control,
.form-select,
.input-group-text,
.form-control:focus,
.form-select:focus {
    font-family: inherit;
    font-size: 12px;
}

.form-control,
.form-select {
    min-height: var(--field-h);
    border: 1px solid var(--border) !important;
    border-radius: var(--control-radius) !important;
    background: var(--n-25) !important;
    color: var(--text) !important;
    box-shadow: none !important;
}

.form-control::placeholder {
    color: var(--n-500);
}

.form-control:hover,
.form-select:hover {
    border-color: var(--n-300) !important;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(24, 168, 116, .55) !important;
    box-shadow: 0 0 0 3px rgba(24, 168, 116, .08) !important;
    background: #fff !important;
}

.form-control-sm,
.form-select-sm {
    min-height: 32px;
    font-size: 12px;
}

textarea.form-control {
    min-height: 94px;
    padding-top: 10px;
    resize: vertical;
}

.form-check {
    min-height: 20px;
    margin: 0;
    padding-left: 1.55rem;
}

.form-check-input {
    width: 14px;
    height: 14px;
    margin-top: .1rem;
    margin-left: -1.55rem;
    border: 1px solid var(--n-300) !important;
    border-radius: calc(4px * var(--radius-k)) !important;
    box-shadow: none !important;
}

.form-check-input:focus {
    border-color: rgba(24, 168, 116, .5) !important;
    box-shadow: 0 0 0 3px rgba(24, 168, 116, .08) !important;
}

.form-check-input:checked {
    border-color: var(--primary) !important;
    background-color: var(--primary) !important;
}

.form-check-label {
    color: var(--text-2);
    font-size: 12px;
}

.form-switch .form-check-input {
    width: 28px;
    border-radius: 999px !important;
}

.form-range {
    height: 22px;
}

.form-range::-webkit-slider-runnable-track,
.form-range::-moz-range-track {
    height: 4px;
    border-radius: 999px;
    background: var(--n-200);
}

.form-range::-webkit-slider-thumb,
.form-range::-moz-range-thumb {
    width: 14px;
    height: 14px;
    margin-top: -5px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .13);
}

.input-group .form-control {
    border-radius: 0 !important;
}

.input-group .form-control:first-child,
.input-group > :first-child {
    border-top-left-radius: var(--control-radius) !important;
    border-bottom-left-radius: var(--control-radius) !important;
}

.input-group .form-control:last-child,
.input-group > :last-child {
    border-top-right-radius: var(--control-radius) !important;
    border-bottom-right-radius: var(--control-radius) !important;
}

.input-group-text {
    border-color: var(--border) !important;
    background: var(--n-50) !important;
    color: var(--text-2);
}

.form-control-color {
    width: 44px;
    height: 38px;
    padding: 3px !important;
}

.form-control[type="file"] {
    padding: 8px 10px;
}

.form-control[type="file"]::file-selector-button {
    margin: -4px 9px -4px -6px;
    padding: 5px 8px;
    border: 0;
    border-right: 1px solid var(--border);
    background: var(--n-50);
    color: var(--text-2);
    font: inherit;
}

/* =============================================================
   BUTTONS — BOOTSTRAP BEHAVIOR, FLUP CHROME
============================================================= */
.btn {
    min-height: 34px;
    border-radius: calc(7px * var(--radius-k)) !important;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    box-shadow: none !important;
}

.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #129967;
    --bs-btn-hover-border-color: #129967;
    --bs-btn-active-bg: #0f8c60;
    --bs-btn-active-border-color: #0f8c60;
}

.btn-light,
.btn-outline-secondary {
    --bs-btn-color: var(--text-2);
    --bs-btn-bg: var(--n-50);
    --bs-btn-border-color: var(--border);
    --bs-btn-hover-color: var(--text);
    --bs-btn-hover-bg: var(--n-100);
    --bs-btn-hover-border-color: var(--n-300);
    --bs-btn-active-color: var(--text);
    --bs-btn-active-bg: var(--n-100);
    --bs-btn-active-border-color: var(--n-300);
}

.btn-sm {
    min-height: 30px;
    padding: .36rem .65rem;
    font-size: 11.5px;
}

/* =============================================================
   DROPDOWN / ACCORDION — BOOTSTRAP DRIVER + CUSTOM CHROME
============================================================= */
.dropdown-menu {
    min-width: 160px;
    margin-top: 6px !important;
    padding: 5px;
    border: 1px solid var(--border) !important;
    border-radius: calc(8px * var(--radius-k)) !important;
    background: #fff;
    box-shadow: var(--shadow-md);
    font-family: inherit;
}

.dropdown-item {
    padding: 7px 9px;
    border-radius: calc(6px * var(--radius-k));
    color: var(--text-2);
    font-size: 12px;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--n-100);
    color: var(--text);
}

.accordion {
    --bs-accordion-bg: transparent;
    --bs-accordion-border-color: var(--border);
    --bs-accordion-border-width: 1px;
    --bs-accordion-btn-bg: var(--n-25);
    --bs-accordion-active-bg: var(--n-50);
    --bs-accordion-active-color: var(--text);
    --bs-accordion-btn-focus-box-shadow: none;
}

.accordion-item {
    border-radius: calc(8px * var(--radius-k)) !important;
    overflow: hidden;
    background: #fff;
}

.accordion-button {
    min-height: 40px;
    padding: 8px 11px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-2);
}

.accordion-button:not(.collapsed) {
    color: var(--text);
    box-shadow: none;
}

.accordion-body {
    padding: 10px 11px 12px;
    color: var(--text-2);
    font-size: 12px;
}

/* =============================================================
   MODAL — FULLY OVERRIDDEN CHROME
============================================================= */
.modal-backdrop.show {
    opacity: .26;
}

.modal-dialog {
    max-width: var(--modal-w);
    margin: 1.5rem auto;
}

.modal-content {
    overflow: hidden;
    border: 1px solid var(--border) !important;
    border-radius: calc(13px * var(--radius-k)) !important;
    background: #fff;
    box-shadow: 0 24px 70px rgba(25, 39, 33, .18);
}

.modal-header {
    min-height: 58px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--border-soft) !important;
}

.modal-title {
    margin: 0;
    color: var(--text);
    font-size: 15px;
    font-weight: 650;
    letter-spacing: -.01em;
}

.modal-body {
    padding: 16px;
}

.modal-footer {
    padding: 11px 16px;
    border-top: 1px solid var(--border-soft) !important;
}

/* Global close button: always a compact 32px ghost icon pinned to the header's right edge. */
.btn-close,
.offcanvas-header .btn-close,
.modal-header .btn-close {
    box-sizing: border-box;
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    margin: 0 0 0 auto !important;
    padding: 0 !important;
    border: 0;
    border-radius: calc(8px * var(--radius-k));
    opacity: .6;
    background-color: transparent;
    background-size: 12px;
    transition: background-color .15s ease, opacity .15s ease;
}

.btn-close:hover {
    opacity: 1;
    background-color: var(--n-100);
}

.btn-close:focus,
.btn-close:focus-visible {
    opacity: 1;
    outline: 0;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

/* =============================================================
   OFFCANVAS — BOOTSTRAP DRIVER + FLUP VISUAL SYSTEM
============================================================= */
.offcanvas {
    --bs-offcanvas-width: 470px;
    background: #fff;
    border-left: 1px solid var(--border) !important;
    box-shadow: -18px 0 40px rgba(26, 42, 34, .11);
}

.offcanvas-header {
    min-height: 68px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-soft) !important;
}

.offcanvas-title {
    margin: 0;
    color: var(--text);
    font-size: 15px;
    font-weight: 650;
    letter-spacing: -.01em;
}

.offcanvas-body {
    padding: 0;
}

.offcanvas-backdrop.show {
    opacity: .20;
}

.record-drawer-tabs {
    display: flex;
    gap: 2px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--border-soft);
    background: var(--n-25);
}

.record-drawer-tabs .nav-link {
    min-height: 30px;
    padding: 7px 9px;
    border: 0;
    border-radius: calc(6px * var(--radius-k));
    color: var(--n-700);
    font-size: 11.5px;
    font-weight: 600;
}

.record-drawer-tabs .nav-link:hover {
    background: var(--n-100);
    color: var(--text);
}

.record-drawer-tabs .nav-link.active {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.drawer-pane {
    padding: 15px;
}

.drawer-card {
    border: 1px solid var(--border);
    border-radius: calc(9px * var(--radius-k));
    background: #fff;
}

.drawer-card + .drawer-card {
    margin-top: 9px;
}

.drawer-card-head {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-soft);
}

.drawer-card-body {
    padding: 10px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 10px;
}

.detail-item-label {
    color: var(--n-700);
    font-size: 11.5px;
    font-weight: 500;
}

.detail-item-value {
    margin-top: 3px;
    color: var(--text);
    font-size: 12.5px;
    font-weight: 600;
}

.subject-row,
.provider-row {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 0;
}

.subject-row + .subject-row,
.provider-row + .provider-row {
    border-top: 1px solid var(--n-100);
}

.avatar-tile {
    width: 29px;
    height: 29px;
    flex: 0 0 29px;
    display: grid;
    place-items: center;
    border-radius: calc(8px * var(--radius-k));
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 8px;
    font-weight: 700;
}

.timeline-compact {
    position: relative;
    display: grid;
    gap: 10px;
    padding-left: 13px;
}

.timeline-compact::before {
    content: "";
    position: absolute;
    left: 3px;
    top: 3px;
    bottom: 3px;
    width: 1px;
    background: var(--n-200);
}

.timeline-compact-item {
    position: relative;
}

.timeline-compact-item::before {
    content: "";
    position: absolute;
    left: -13px;
    top: 2px;
    width: 7px;
    height: 7px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--n-300);
    box-shadow: 0 0 0 1px var(--n-300);
}

.timeline-compact-item.active::before {
    background: var(--primary);
    box-shadow: 0 0 0 1px #a8dcca;
}

/* =============================================================
   FORM SCREEN
============================================================= */
.form-shell {
    max-width: 1180px;
}

.form-page-actions {
    display: flex;
    align-items: center;
    gap: 7px;
}

.form-sections {
    display: grid;
    gap: 12px;
    margin-top: 22px;
}

.form-section {
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: calc(11px * var(--radius-k));
    background: #fff;
}

.form-section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 13px;
}

.form-section-title {
    margin: 3px 0 0;
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: -.02em;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0,1fr));
    gap: 13px 12px;
}

.form-field {
    min-width: 0;
}

.form-field.span-2 { grid-column: span 2; }
.form-field.span-3 { grid-column: 1 / -1; }

.inline-options {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    min-height: 38px;
}

.form-actions-bar {
    position: sticky;
    bottom: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
    padding: 10px 0 2px;
    background: linear-gradient(to bottom, rgba(255,255,255,0), #fff 20%);
}

.form-actions-right {
    display: flex;
    align-items: center;
    gap: 7px;
}

/* =============================================================
   ORDER LIST EXTRAS
============================================================= */
.order-card {
    cursor: pointer;
}

.order-card-action {
    position: absolute;
    right: 8px;
    top: 8px;
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: calc(6px * var(--radius-k));
    background: rgba(255,255,255,.9);
    color: var(--n-500);
    opacity: 0;
    transition: opacity .15s ease, background .15s ease, color .15s ease;
}

.order-card:hover .order-card-action,
.order-card:focus-within .order-card-action {
    opacity: 1;
}

.order-card-action:hover {
    background: #fff;
    color: var(--text);
}

.order-card {
    position: relative;
}

.bootstrap-lab-button {
    height: 33px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: calc(7px * var(--radius-k));
    background: #fff;
    color: var(--text-2);
    font-size: 12px;
    font-weight: 600;
}

.bootstrap-lab-button:hover {
    background: var(--n-50);
    color: var(--text);
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 7px;
}

/* =============================================================
   RESPONSIVE FIXES
============================================================= */
@media (max-width: 900px) {
    :root {
        --content-pad-x: 18px;
    }

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

    .form-field.span-3 {
        grid-column: 1 / -1;
    }
}

@media (max-width: 760px) {
    .mobile-rail-toggle {
        display: grid;
    }

    .sidebar {
        width: 205px;
        transform: translateX(-100%);
        box-shadow: 15px 0 35px rgba(0,0,0,.10);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main,
    .sidebar.collapsed ~ .main {
        margin-left: 0;
    }

    .sidebar.collapsed {
        width: 205px;
    }

    .sidebar.collapsed .brand-name,
    .sidebar.collapsed .sidebar-search,
    .sidebar.collapsed .nav-title,
    .sidebar.collapsed .nav-label,
    .sidebar.collapsed .nav-count,
    .sidebar.collapsed .nav-chevron,
    .sidebar.collapsed .nav-submenu,
    .sidebar.collapsed .profile-copy,
    .sidebar.collapsed .logout span {
        display: initial;
    }

    .sidebar.collapsed .nav-item {
        min-height: 34px;
        justify-content: flex-start;
        padding: 0 9px;
    }

    .sidebar.collapsed .nav-icon {
        width: 18px;
        flex-basis: 18px;
        font-size: 16px;
    }

    .sidebar-mobile-scrim.visible {
        display: block;
    }

    .content {
        padding: 64px 13px 24px;
    }

    .page-top,
    .form-section-head,
    .form-actions-bar {
        align-items: flex-start;
        flex-direction: column;
    }

    .page-actions,
    .form-page-actions,
    .form-actions-right {
        width: 100%;
    }

    .page-actions > *,
    .form-page-actions > *,
    .form-actions-right > * {
        flex: 1 1 auto;
    }

    .filters {
        grid-template-columns: 1fr !important;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-field.span-2,
    .form-field.span-3 {
        grid-column: auto;
    }

    .offcanvas {
        --bs-offcanvas-width: min(470px, 92vw);
    }

    .modal-dialog {
        margin: .75rem;
    }
}

/* Bootstrap utility helpers should not silently change our font system. */
.text-body,
.text-secondary,
.text-muted,
.small {
    font-family: inherit;
}



/* Mini rail flyout is intentionally not a Bootstrap component. */
.mini-menu-popover {
    position: fixed;
    z-index: 2000;
    width: 176px;
    padding: 5px;
    border: 1px solid var(--border);
    border-radius: calc(9px * var(--radius-k));
    background: var(--surface);
    box-shadow: 0 14px 32px rgba(25, 40, 32, .14);
}
.mini-menu-title {
    padding: 7px 8px 6px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border-soft);
    color: var(--text-2);
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.mini-menu-item {
    display: block;
    padding: 8px 9px;
    border-radius: calc(6px * var(--radius-k));
    color: var(--n-700);
    font-size: 12px;
    font-weight: 500;
}
.mini-menu-item:hover {
    background: var(--primary-soft);
    color: var(--primary-dark);
}
.mini-menu-item.active {
    background: transparent;
    color: var(--primary-dark);
    font-weight: 700;
}

/* Rail tooltip: JS-positioned so it escapes the sidebar-nav's scroll clipping. */
.rail-tooltip {
    position: fixed;
    z-index: 2100;
    padding: 6px 9px;
    border-radius: calc(6px * var(--radius-k));
    background: var(--n-900);
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
}
.nav-divider {
    height: 1px;
    margin: 7px 10px 13px;
    background: var(--sb-border);
}
.invalid-feedback {
    color: #c86060;
}

/* =============================================================
   DASHBOARD
============================================================= */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.kpi-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--surface);
}

.kpi-top {
    display: flex;
    align-items: center;
    gap: 7px;
}

.kpi-icon {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    display: grid;
    place-items: center;
    border-radius: calc(7px * var(--radius-k));
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 13px;
}

.kpi-label {
    color: var(--text-2);
    font-size: 11.5px;
    font-weight: 500;
}

.kpi-value {
    color: var(--text);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -.02em;
}

.kpi-trend {
    display: flex;
    align-items: center;
    gap: 3px;
    color: var(--text-2);
    font-size: 11px;
    font-weight: 600;
}

.kpi-trend.up { color: var(--primary-dark); }
.kpi-trend.down { color: var(--red); }
.kpi-trend span { color: var(--text-2); font-weight: 500; }

.kpi-add {
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 90px;
    border-style: dashed;
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
}

.kpi-add:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.kpi-add i { font-size: 18px; }

/* KPI cards used as clickable filters (e.g. Orders page). */
.kpi-filter {
    width: 100%;
    align-items: stretch;
    justify-content: flex-start;
    text-align: left;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}

.kpi-filter:hover { border-color: var(--primary-line); }

.kpi-filter.active {
    border-color: var(--primary);
    background: var(--primary-soft-2);
    box-shadow: 0 0 0 1px var(--primary) inset;
}

.kpi-filter.active .kpi-icon {
    background: var(--primary);
    color: var(--on-primary);
}

.kpi-grid.kpi-grid-tight { margin-bottom: 18px; }

/* Compact KPI: label + value only (no trend line). */
.kpi-compact { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kpi-compact .kpi-card { gap: 6px; padding: 11px 14px; }
.kpi-compact .kpi-icon { width: 22px; height: 22px; flex-basis: 22px; font-size: 12px; }
.kpi-compact .kpi-value { font-size: 20px; }

.dashboard-columns {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.section-title {
    margin: 0;
    color: var(--text);
    font-size: 13.5px;
    font-weight: 600;
}

.section-link {
    display: flex;
    align-items: center;
    gap: 3px;
    color: var(--primary-dark);
    font-size: 11.5px;
    font-weight: 600;
}

.attention-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.order-grid-stack {
    grid-template-columns: 1fr;
}

@media (max-width: 980px) {
    .dashboard-columns {
        grid-template-columns: 1fr;
    }
}

/* =============================================================
   RF DATA TABLE (ported from team-members-datatable-final.html —
   the shared datatable pattern for directory-style screens)
============================================================= */
.rf-pill-tabs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 16px; padding: 3px; width: fit-content; max-width: 100%; border: 1px solid var(--border-soft); border-radius: calc(10px * var(--radius-k)); background: var(--n-50); }
.rf-pill { appearance: none; border: 1px solid transparent; background: transparent; color: var(--n-600); display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 0 12px; border-radius: calc(8px * var(--radius-k)); font-size: 12px; font-weight: 600; cursor: pointer; transition: .15s ease; }
.rf-pill:hover { background: #fff; color: var(--text); }
.rf-pill.active { background: #fff; color: var(--primary-dark); border-color: var(--primary-line); box-shadow: 0 2px 5px color-mix(in srgb, var(--primary) 8%, transparent); }
.rf-pill .count { min-width: 22px; height: 20px; padding: 0 6px; border-radius: calc(5px * var(--radius-k)); display: inline-grid; place-items: center; background: var(--n-100); color: var(--n-500); font-size: 10px; font-weight: 700; }
.rf-pill.active .count { background: var(--primary-soft); color: var(--primary-dark); }

.rf-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; }
.rf-toolbar-left, .rf-toolbar-right { display: flex; align-items: center; gap: 7px; min-width: 0; }
.rf-toolbar-left { flex: 1; }
.rf-control { min-height: 36px; display: flex; align-items: center; gap: 7px; padding: 0 11px; border: 1px solid var(--border); border-radius: calc(7px * var(--radius-k)); background: var(--n-25); color: var(--text-2); font-size: 12px; }
.rf-control input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; }
.rf-control.search { flex: 1; max-width: 430px; }
.rf-control.search i { font-size: 14px; color: var(--n-500); }
.rf-control:hover { border-color: var(--n-300); background: #fff; }
.rf-btn { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 12px; border: 1px solid var(--border); border-radius: calc(7px * var(--radius-k)); background: #fff; color: var(--text-2); font-size: 12px; font-weight: 600; cursor: pointer; }
.rf-btn:hover { background: var(--n-25); color: var(--text); border-color: var(--n-300); }
.rf-btn.primary { border-color: transparent; background: var(--primary); color: var(--on-primary); }
.rf-btn.primary:hover { background: var(--primary-dark); }
.rf-btn.soft { border-color: transparent; background: var(--primary-soft-2); color: var(--primary-dark); }
.rf-btn.soft:hover { background: var(--n-100); color: var(--primary-dark); border-color: transparent; } .rf-btn.soft > i { color: var(--primary); }
.rf-btn.icon-only { width: 36px; padding: 0; }
.rf-toolbar .dropdown-menu, .rf-action-menu .dropdown-menu { min-width: 165px; padding: 5px; border: 1px solid var(--border); border-radius: calc(9px * var(--radius-k)); box-shadow: 0 12px 30px rgba(20, 22, 60, .12); }

.rf-selection-bar { display: none; align-items: center; justify-content: space-between; gap: 8px; margin-top: 9px; padding: 8px 10px; border: 1px solid var(--primary-line); border-radius: calc(7px * var(--radius-k)); background: var(--primary-soft-2); }
.rf-selection-bar.show { display: flex; }
.rf-selection-copy { color: var(--primary-dark); font-size: 11.5px; font-weight: 600; }

.rf-table-wrap { margin-top: 12px; overflow: hidden; border: 1px solid var(--border); border-radius: calc(10px * var(--radius-k)); background: #fff; }
.rf-table-scroll { overflow-x: auto; overflow-y: hidden; }
.rf-table { width: 100%; min-width: 1180px; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.rf-table thead th { position: sticky; top: 0; z-index: 2; padding: 10px; border-bottom: 1px solid var(--border); background: var(--n-25); color: var(--n-500); font-size: 10px; font-weight: 700; letter-spacing: .035em; text-transform: uppercase; text-align: left; white-space: nowrap; }
.rf-table tbody td { padding: 11px 10px; border-bottom: 1px solid var(--n-100); color: var(--n-700); vertical-align: middle; white-space: nowrap; }
.rf-table tbody tr:hover td { background: var(--n-25); }
.rf-table tbody tr:last-child td { border-bottom: 0; }
.rf-table .check-col { width: 36px; text-align: center; }
.rf-table .action-col { position: sticky; right: 0; z-index: 3; width: 48px; text-align: right; background: #fff; box-shadow: -10px 0 18px rgba(27, 38, 33, .035); }
.rf-table tbody tr:hover .action-col { background: var(--n-25); }
.rf-th-sort { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.rf-th-sort i { font-size: 13px; color: var(--n-400); }

.rf-member { display: flex; align-items: center; gap: 9px; min-width: 210px; }
.rf-avatar { width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center; border-radius: calc(8px * var(--radius-k)); background: var(--primary-soft); color: var(--primary-dark); font-size: 10.5px; font-weight: 800; }
.rf-member-copy { min-width: 0; }
.rf-member-name { color: var(--text); font-size: 12.5px; font-weight: 650; }
.rf-member-email { margin-top: 2px; color: var(--text-2); font-size: 10.5px; }

.rf-status { display: inline-flex; align-items: center; gap: 5px; min-height: 24px; padding: 0 9px; border-radius: 999px; font-size: 10.5px; font-weight: 700; }
.rf-status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.rf-status.active { color: #16835a; background: var(--n-100); }
.rf-status.onboarding { color: #477da3; background: var(--n-100); }
.rf-status.pending { color: #ad7a29; background: #fff6e4; }
.rf-status.suspended { color: #ad5959; background: var(--n-100); }
.rf-status.inactive { color: var(--n-600); background: var(--n-100); }

.rf-tag-list { display: flex; gap: 4px; align-items: center; }
.rf-tag { display: inline-flex; align-items: center; min-height: 22px; padding: 0 7px; border-radius: calc(6px * var(--radius-k)); background: var(--n-100); color: var(--n-600); font-size: 10px; font-weight: 600; }
.rf-tag.more { background: var(--primary-soft-2); color: var(--primary-dark); }

.rf-stack { display: flex; align-items: center; }
.rf-stack .rf-mini { width: 24px; height: 24px; margin-left: -5px; display: grid; place-items: center; border: 2px solid #fff; border-radius: 50%; background: #dde0f5; color: #363a8f; font-size: 8.5px; font-weight: 800; }
.rf-stack .rf-mini:first-child { margin-left: 0; }
.rf-stack .rf-mini.more { background: var(--primary-soft-2); color: var(--primary-dark); }

.rf-progress { width: 100px; }
.rf-progress-top { display: flex; justify-content: space-between; gap: 6px; color: var(--n-600); font-size: 10px; }
.rf-progress-bar { height: 5px; margin-top: 5px; overflow: hidden; border-radius: 999px; background: var(--n-100); }
.rf-progress-bar span { display: block; height: 100%; border-radius: inherit; background: var(--primary); }

.rf-content-cell { max-width: 240px; white-space: normal !important; }
.rf-readmore { display: inline; line-height: 1.45; }
.rf-readmore-toggle { margin-left: 4px; padding: 0; border: 0; background: transparent; color: var(--primary-dark); font-size: 10.5px; font-weight: 700; cursor: pointer; }

.rf-action-menu .btn { width: 30px; height: 30px; display: inline-grid; place-items: center; padding: 0; border: 0; border-radius: calc(7px * var(--radius-k)); background: transparent; color: var(--n-600); }
.rf-action-menu .btn:hover { background: var(--n-100); color: var(--text); }

.rf-table-loading { padding: 22px; }
.rf-skeleton-row { height: 44px; border-bottom: 1px solid var(--n-100); background: linear-gradient(90deg, var(--n-25) 25%, var(--n-50) 50%, var(--n-25) 75%); background-size: 220% 100%; animation: rfShimmer 1.1s linear infinite; }
@keyframes rfShimmer { to { background-position: -220% 0; } }

.rf-empty { padding: 54px 20px; text-align: center; }
.rf-empty-icon { width: 48px; height: 48px; margin: 0 auto 10px; display: grid; place-items: center; border-radius: calc(12px * var(--radius-k)); background: var(--n-100); color: var(--n-500); font-size: 21px; }
.rf-empty-title { color: var(--text); font-size: 13px; font-weight: 700; }
.rf-empty-copy { margin-top: 4px; color: var(--text-2); font-size: 11px; }

.rf-table-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 11px; border-top: 1px solid var(--border); background: var(--n-25); }
.rf-page-meta { color: var(--text-2); font-size: 11px; white-space: nowrap; }
.rf-page-controls { display: flex; align-items: center; gap: 3px; }
.rf-page-btn { min-width: 28px; height: 28px; display: inline-grid; place-items: center; padding: 0 8px; border: 1px solid transparent; border-radius: calc(6px * var(--radius-k)); background: transparent; color: var(--n-600); font-size: 11px; font-weight: 650; cursor: pointer; }
.rf-page-btn:hover { background: var(--n-100); color: var(--text); }
.rf-page-btn.active { border-color: var(--primary-line); background: var(--primary-soft); color: var(--primary-dark); }
.rf-page-btn:disabled { opacity: .42; cursor: not-allowed; }
.rf-per-page { display: flex; align-items: center; gap: 5px; color: var(--text-2); font-size: 10.5px; }
.rf-per-page select { height: 28px; padding: 0 7px; border: 1px solid var(--border); border-radius: calc(6px * var(--radius-k)); background: #fff; color: var(--n-600); font: inherit; }

.rf-filter-offcanvas { width: min(400px, 100vw) !important; }
.rf-filter-offcanvas .offcanvas-body { padding: 8px 20px 18px; }

.rf-filter-section { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--n-100); }
.rf-filter-label { margin-bottom: 7px; color: var(--n-700); font-size: 11px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; }
.rf-filter-check { display: flex; align-items: center; gap: 9px; min-height: 34px; color: var(--n-700); font-size: 13px; }
.rf-filter-check input { accent-color: var(--primary); }
.rf-filter-offcanvas .form-control, .rf-filter-offcanvas .form-select { min-height: 38px; padding: 7px 11px; border: 1px solid var(--border); border-radius: calc(9px * var(--radius-k)); background: #fff; color: var(--text); box-shadow: none; font-size: 13px; }
.rf-filter-offcanvas .form-control:focus, .rf-filter-offcanvas .form-select:focus { border-color: var(--primary-line); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 8%, transparent); background: #fff; }
.rf-filter-footer { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 7px; padding-top: 12px; border-top: 1px solid var(--border); background: var(--surface); }

.rf-api-note { margin-top: 10px; color: var(--text-2); font-size: 10.5px; }
.rf-api-note code { color: var(--primary-dark); font-size: 10.5px; }

@media (max-width: 900px) {
    .rf-toolbar { align-items: flex-start; flex-direction: column; }
    .rf-toolbar-left, .rf-toolbar-right { width: 100%; }
    .rf-control.search { max-width: none; }
}

@media (max-width: 620px) {
    .rf-pill-tabs { width: 100%; }
    .rf-pill { flex: 1 1 calc(50% - 5px); justify-content: center; }
    .rf-table-footer { align-items: flex-start; flex-direction: column; }
}

.rf-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-top: 12px; }
.rf-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.rf-card-top { display: flex; align-items: flex-start; gap: 10px; }
.rf-card-copy { min-width: 0; flex: 1; }
.rf-card-name { color: var(--text); font-size: 13px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rf-card-email { margin-top: 1px; color: var(--text-2); font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rf-card-body { display: flex; flex-direction: column; gap: 7px; padding-top: 10px; border-top: 1px solid var(--border-soft); }
.rf-card-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 11.5px; }
.rf-card-row-label { color: var(--text-2); }
.rf-card-row-value { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }


/* KPI strip: single segmented bar of status counts, for internal list pages. */
.kpi-strip { display: flex; margin-bottom: 18px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.kpi-seg { flex: 1; display: flex; align-items: center; gap: 9px; min-width: 0; padding: 13px 16px; border-right: 1px solid var(--border-soft); background: transparent; text-align: left; cursor: pointer; box-shadow: inset 0 -2px 0 transparent; transition: background .15s ease, box-shadow .15s ease; }
.kpi-seg:last-child { border-right: 0; }
.kpi-seg:hover { background: var(--surface-soft); }
.kpi-seg.active { background: var(--primary-soft-2); box-shadow: inset 0 -2px 0 var(--primary); }
.kpi-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: var(--dot, var(--primary)); }
.kpi-seg-label { flex: 1; min-width: 0; color: var(--text-2); font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-seg.active .kpi-seg-label { color: var(--primary-dark); }
.kpi-seg-count { color: var(--text); font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.kpi-seg.active .kpi-seg-count { color: var(--primary-dark); }
@media (max-width: 700px) { .kpi-strip { flex-wrap: wrap; } .kpi-seg { flex: 1 1 50%; border-bottom: 1px solid var(--border-soft); } }

/* Space between the page header and the KPI row that follows it. */
.page-top + .kpi-strip,
.page-top + .kpi-grid,
.page-top + #pfHero { margin-top: 18px; }

/* The sidebar's .nav-item rule must not leak into Bootstrap tab lists (drawer tabs). */
.record-drawer-tabs .nav-item {
    width: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    display: block;
    background: transparent;
    color: inherit;
    border-radius: 0;
}
.record-drawer-tabs .nav-item:hover { background: transparent; color: inherit; }

/* =============================================================
   APPEARANCE VARIANTS (driven by data-attributes set in appearance.js)
============================================================= */

/* ---- Sidebar: tinted ---- */
[data-sidebar="tinted"] {
    --sb-bg: var(--primary-soft-2);
    --sb-border: color-mix(in oklch, var(--primary) 9%, white);
    --sb-hover: color-mix(in oklch, var(--primary) 8%, white);
    --sb-search-bg: #ffffff;
    --sb-search-text: var(--n-500);
    --sb-active-bg: #ffffff;
    --sb-tile-border: var(--primary-line);
    --sb-avatar-bg: #ffffff;
}
[data-sidebar="tinted"] .nav-item.active { box-shadow: 0 1px 3px color-mix(in srgb, var(--primary) 14%, transparent); }

/* ---- Sidebar: dark ---- */
[data-sidebar="dark"] {
    --sb-bg: color-mix(in oklch, var(--primary) 34%, #04050d);
    --sb-border: rgba(255, 255, 255, .08);
    --sb-text: rgba(255, 255, 255, .74);
    --sb-text-strong: #ffffff;
    --sb-text-muted: rgba(255, 255, 255, .52);
    --sb-icon: rgba(255, 255, 255, .62);
    --sb-hover: rgba(255, 255, 255, .08);
    --sb-active-bg: rgba(255, 255, 255, .14);
    --sb-active-text: #ffffff;
    --sb-active-icon: color-mix(in oklch, var(--primary) 35%, white);
    --sb-search-bg: rgba(255, 255, 255, .08);
    --sb-search-text: rgba(255, 255, 255, .55);
    --sb-brand-text: #ffffff;
    --sb-brand-bg: color-mix(in oklch, var(--primary) 55%, white);
    --sb-brand-fg: color-mix(in oklch, var(--primary) 30%, black);
    --sb-tile-border: rgba(255, 255, 255, .12);
    --sb-avatar-bg: rgba(255, 255, 255, .16);
    --sb-avatar-text: #ffffff;
}
[data-sidebar="dark"] .sidebar-nav { scrollbar-color: rgba(255, 255, 255, .22) transparent; }
[data-sidebar="dark"] .sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .22); }

/* ---- Sidebar: custom (--sbc is the background; --sbc-hover, -text, -icon, -bg, -hover-text, -active-bg, -active-text, -active-icon, -label are optional own colours for the menu) ---- */
[data-sidebar="custom"] {
    --sb-bg: var(--sbc, #1e2a4a);
    --sb-border: color-mix(in srgb, var(--sb-text-strong) 12%, var(--sb-bg));
    --sb-hover: var(--sbc-hover, color-mix(in srgb, var(--sb-text-strong) 7%, var(--sb-bg)));
    --sb-active-bg: var(--sbc-active-bg, color-mix(in srgb, var(--sb-hover) 82%, var(--sb-text-strong)));
    --sb-search-bg: color-mix(in srgb, var(--sb-text-strong) 8%, var(--sb-bg));
    --sb-tile-border: color-mix(in srgb, var(--sb-text-strong) 14%, var(--sb-bg));
    --sb-avatar-bg: color-mix(in srgb, var(--sb-text-strong) 14%, var(--sb-bg));
    --sb-avatar-text: var(--sb-text-strong);
}
[data-sidebar="custom"][data-sb-tone="dark"] {
    --sb-text: var(--sbc-text, rgba(255, 255, 255, .76)); --sb-text-strong: #ffffff; --sb-text-muted: var(--sbc-label, rgba(255, 255, 255, .54)); --sb-icon: var(--sbc-icon, rgba(255, 255, 255, .64));
    --sb-active-text: var(--sbc-active-text, #ffffff); --sb-active-icon: var(--sbc-active-icon, #ffffff); --sb-search-text: rgba(255, 255, 255, .56);
    --sb-brand-text: #ffffff; --sb-brand-bg: #ffffff; --sb-brand-fg: var(--sb-bg);
}
[data-sidebar="custom"][data-sb-tone="light"] {
    --sb-text: var(--sbc-text, color-mix(in srgb, #0b1020 78%, var(--sb-bg))); --sb-text-strong: #0b1020; --sb-text-muted: var(--sbc-label, color-mix(in srgb, #0b1020 56%, var(--sb-bg))); --sb-icon: var(--sbc-icon, color-mix(in srgb, #0b1020 62%, var(--sb-bg)));
    --sb-active-text: var(--sbc-active-text, #0b1020); --sb-active-icon: var(--sbc-active-icon, var(--primary-dark)); --sb-search-text: color-mix(in srgb, #0b1020 58%, var(--sb-bg));
    --sb-brand-text: #0b1020; --sb-brand-bg: var(--primary); --sb-brand-fg: var(--on-primary);
}
[data-sidebar="custom"] .nav-item:not(:hover):not(.active) { background: var(--sbc-bg, transparent); }
[data-sidebar="custom"] .nav-item:hover, [data-sidebar="custom"] .nav-subitem:hover { color: var(--sbc-hover-text, var(--sb-text-strong)); }
[data-sidebar="custom"] .nav-item:hover .nav-icon { color: var(--sbc-hover-text, var(--sb-icon)); }
[data-sidebar="custom"][data-sb-tone="dark"] .sidebar-nav { scrollbar-color: rgba(255, 255, 255, .22) transparent; } [data-sidebar="custom"][data-sb-tone="dark"] .sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .22); }

/* ---- The logo on the sidebar: when it would disappear into the sidebar colour it is turned white or dark (Settings > Appearance > Sidebar > Logo) ---- */
[data-logo-fx="white"] .sidebar .brand-logo, [data-logo-fx="white"] .sidebar .brand-mark.has-logo img { filter: brightness(0) invert(1); }
[data-logo-fx="dark"] .sidebar .brand-logo, [data-logo-fx="dark"] .sidebar .brand-mark.has-logo img { filter: brightness(0); }

/* ---- Brand logo (uploaded image) ---- */
.brand-mark.has-logo { background: transparent; overflow: hidden; }
.brand-mark img { width: 100%; height: 100%; display: block; object-fit: contain; }

/* ---- Density ---- */
[data-density="compact"] { --content-pad-x: 22px; --content-pad-y: 14px; }
[data-density="compact"] .nav-item { min-height: 30px; margin-bottom: 1px; }
[data-density="compact"] .nav-subitem { min-height: 25px; }
[data-density="compact"] .page-top { gap: 10px; }
[data-density="compact"] .rfdt { --dt-row-h: 40px; }
[data-density="compact"] .rfdt-btn, [data-density="compact"] .rfdt-search .rf-control { min-height: 34px; }
[data-density="compact"] .form-control, [data-density="compact"] .form-select { min-height: 34px; }
[data-density="compact"] .kpi-card { padding: 12px; }
[data-density="compact"] .kpi-seg { padding-top: 9px; padding-bottom: 9px; }

/* Order type colour coding (order drawer summary) */
[data-s="type"][data-type="Authorization Provided"] { color: #15704a; }
[data-s="type"][data-type="Subpoena Provided"] { color: #2f4ec4; }
[data-s="type"][data-type="Authorization to be prepared"] { color: #a8690c; }
[data-s="type"][data-type="Subpoena to be prepared"] { color: #b8365a; }

.record-offcanvas .ui-meta { color: var(--n-600); }
.record-offcanvas .provider-title { font-size: 12.5px; }
.record-offcanvas .record-status { font-size: 11.5px; }

/* Sub-order accordion (order drawer) */
.drawer-card-body:has(> .so-item) { padding: 0; }
.so-item + .so-item { border-top: 1px solid var(--border-soft); }
.so-head { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; background: transparent; text-align: left; cursor: pointer; }
.so-head:hover { background: var(--n-25); }
.so-head:focus-visible { outline: 2px solid var(--primary-bright); outline-offset: -2px; }
.so-title { min-width: 0; }
.so-state { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.so-stage { color: var(--n-700); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.so-chev { color: var(--n-600); font-size: 18px; transition: transform .15s ease; }
.so-item.open .so-chev { transform: rotate(180deg); }
.so-item.open .so-head { background: var(--n-25); }
.so-body { padding: 4px 12px 14px; background: var(--n-25); }
.so-sec { padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--border-soft); }
.so-sec .drawer-section-kicker { margin-bottom: 9px; }
.so-sec .subject-row:first-of-type { padding-top: 0; }
.so-stepper { display: flex; padding: 10px 0 2px; }
.so-step { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.so-step::before { content: ""; position: absolute; top: 5px; left: -50%; right: 50%; height: 2px; background: var(--n-200); }
.so-step:first-child::before { display: none; }
.so-step span { position: relative; z-index: 1; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--n-300); background: #fff; }
.so-step em { font-style: normal; color: var(--n-600); font-size: 11px; font-weight: 500; }
.so-step.done::before, .so-step.current::before { background: var(--primary); }
.so-step.done span { border-color: var(--primary); background: var(--primary); }
.so-step.current span { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.so-step.current.issue span { border-color: var(--orange); box-shadow: 0 0 0 3px #fff1dc; }
.so-step.done em, .so-step.current em { color: var(--text); font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .so-chev { transition: none; } }
.so-body .detail-grid > div { min-width: 0; }
.so-body .detail-item-value { overflow-wrap: anywhere; }

/* Order drawer: wider to fit sub-order detail */
.offcanvas.record-offcanvas { --bs-offcanvas-width: min(720px, 96vw); }
#odSummary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.so-body .detail-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.so-body .so-sec:last-child .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { #odSummary, .so-body .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.so-step.skipped span { border-style: dashed; border-color: var(--n-400); background: var(--n-100); }
.so-step.skipped em { color: var(--n-600); text-decoration: line-through; text-decoration-color: var(--n-400); font-weight: 500; }
.so-step.skipped small { margin-top: -3px; color: var(--n-600); font-size: 10.5px; }
.so-step.skipped.passed::before { background: var(--primary); }
.so-step { text-align: center; }

/* Sub-order cards: each one is its own separated card */
.drawer-card-body:has(> .so-item) { display: grid; gap: 10px; padding: 10px; }
.so-item { border: 1px solid var(--border); border-radius: calc(9px * var(--radius-k)); background: #fff; overflow: hidden; transition: border-color .15s ease, box-shadow .15s ease; }
.so-item + .so-item { border-top: 1px solid var(--border); }
.so-item.open { border-color: var(--primary-line); box-shadow: 0 2px 10px color-mix(in srgb, var(--primary) 7%, transparent); }
.so-item.open .so-head { background: var(--primary-soft-2); border-bottom: 1px solid var(--primary-line); }
.so-item .so-body { background: #fff; }

/* Order card: extended data (stage, type, progress, flag, footer) */
.rfdt-card.is-flush .order-card { grid-template-columns: 168px minmax(0, 1fr); grid-template-rows: 1fr auto; }
.oc-stage { margin-top: 3px; padding-left: 20px; color: var(--n-700); font-size: 11.5px; font-weight: 600; }
.oc-type { margin-top: 9px; font-size: 11.5px; font-weight: 650; line-height: 1.3; }
.oc-type[data-type="Authorization Provided"] { color: #15704a; }
.oc-type[data-type="Subpoena Provided"] { color: #2f4ec4; }
.oc-type[data-type="Authorization to be prepared"] { color: #a8690c; }
.oc-type[data-type="Subpoena to be prepared"] { color: #b8365a; }
.oc-progress { padding: 0 12px 2px; }
.oc-progress-row { display: flex; justify-content: space-between; margin-bottom: 5px; color: var(--n-700); font-size: 11.5px; }
.oc-progress-row b { color: var(--text); font-weight: 700; }
.oc-bar { height: 5px; border-radius: 3px; background: var(--n-100); overflow: hidden; }
.oc-bar i { display: block; height: 100%; border-radius: 3px; background: var(--primary); }
.oc-foot { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 12px; border-top: 1px solid var(--border-soft); background: var(--n-25); color: var(--n-700); font-size: 11.5px; }
.oc-foot i { margin-right: 5px; color: var(--n-500); font-size: 13px; vertical-align: -1px; }
.oc-foot b { color: var(--text); font-weight: 600; }
.oc-flag { position: absolute; top: 0; right: 0; z-index: 2; width: 32px; height: 32px; border-radius: 0 calc(9px * var(--radius-k)) 0 100%; font-size: 14px; }
.oc-flag i { position: absolute; top: 6px; right: 6px; line-height: 1; }
.oc-flag.rush { background: #fff1dc; color: #a8690c; }
.oc-flag.urgent { background: #fde8ec; color: #b8365a; }
.oc-progress { padding: 0 0 9px; }
.oc-foot { padding-right: 44px; }
.rfdt-card.is-flush .rfdt-card-menu { bottom: 3px; right: 6px; }

/* Drafts list (orders page) */
.dr-list { display: grid; gap: 10px; }
.dr-item { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) auto auto; align-items: center; gap: 18px; padding: 14px 16px; border: 1px solid var(--border); border-radius: calc(10px * var(--radius-k)); background: #fff; }
.dr-item:hover { border-color: var(--primary-line); box-shadow: 0 3px 10px color-mix(in srgb, var(--primary) 6%, transparent); }
.dr-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.5px; font-weight: 650; }
.dr-id { color: var(--n-600); font-size: 11.5px; font-weight: 500; }
.dr-rush { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: 999px; background: #fff1dc; color: #a8690c; font-size: 11px; font-weight: 700; }
.dr-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; color: var(--n-700); font-size: 12px; }
.dr-stepbar { height: 5px; border-radius: 3px; background: var(--n-100); overflow: hidden; } .dr-stepbar i { display: block; height: 100%; background: var(--primary); border-radius: 3px; }
.dr-step small { display: block; margin-top: 5px; color: var(--n-700); font-size: 11.5px; }
.dr-when { color: var(--n-700); font-size: 12px; white-space: nowrap; } .dr-when i { margin-right: 5px; color: var(--n-500); }
.dr-actions { display: flex; align-items: center; gap: 6px; }
.dr-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--border); border-radius: calc(8px * var(--radius-k)); background: #fff; color: var(--n-700); font-size: 12px; font-weight: 600; text-decoration: none; }
.dr-btn.primary { border-color: transparent; background: var(--primary); color: var(--on-primary); } .dr-btn.primary:hover { background: var(--primary-dark); }
.dr-icon { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: calc(8px * var(--radius-k)); background: transparent; color: var(--n-600); font-size: 16px; cursor: pointer; } .dr-icon:hover { background: #fdeceb; color: #ab3530; }
.dr-empty { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 44px 16px; border: 1px dashed var(--n-300); border-radius: calc(12px * var(--radius-k)); background: #fff; color: var(--n-700); font-size: 12.5px; text-align: center; } .dr-empty i { color: var(--n-500); font-size: 28px; } .dr-empty b { color: var(--text); font-size: 13.5px; } .dr-empty .dr-btn { margin-top: 8px; }
@media (max-width: 900px) { .dr-item { grid-template-columns: 1fr; } }
.oc-flag { border-radius: 0 calc(9px * var(--radius-k) - 1px) 0 100%; }

/* Provider master */
.pv-sub { display: block; margin-top: 1px; color: var(--n-700); font-size: 11.5px; }
.pv-chip { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; background: var(--n-100); color: var(--n-800); font-size: 11px; font-weight: 600; }
.pv-notes { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-soft); } .pv-notes p { margin: 4px 0 0; color: var(--text); font-size: 12.5px; line-height: 1.5; }
.pv-stamp { margin-top: 12px; text-align: center; }
.record-status.muted { color: var(--n-500); }
.pv-drawer { --bs-offcanvas-width: min(720px, 96vw); }
.pv-drawer .offcanvas-body { padding: 0; }
.pv-drawer-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); background: #fff; }
.pv-btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border: 1px solid var(--border); border-radius: calc(8px * var(--radius-k)); background: #fff; color: var(--n-700); font-size: 12.5px; font-weight: 600; text-decoration: none; cursor: pointer; }
.pv-btn:hover { background: var(--n-25); border-color: var(--n-300); color: var(--text); }
.pv-btn.primary { border-color: transparent; background: var(--primary); color: var(--on-primary); } .pv-btn.primary:hover { background: var(--primary-dark); }

/* Provider card (same structure as the order card) */
.pv-card .pv-facility { font-size: 12.5px; font-weight: 650; color: var(--text); margin-top: 2px; }
.pv-card .pv-person { margin-top: 1px; color: var(--n-700); font-size: 11.5px; }
.pv-card .pv-spec { margin-top: 8px; color: var(--primary-dark); }
.pv-card .provider-title i { color: var(--n-600); font-size: 14px; vertical-align: -2px; }
.pc-lines { display: grid; gap: 7px; margin: 2px 0 10px; }
.pc-lines > div { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--n-700); }
.pc-lines i { color: var(--n-500); font-size: 14px; }
.pc-lines span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-lines b { color: var(--text); font-weight: 600; white-space: nowrap; }
.pc-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pc-stats > div { padding: 7px 9px; border-radius: calc(7px * var(--radius-k)); background: #fff; border: 1px solid var(--border-soft); }
.pc-stats small { display: block; color: var(--n-700); font-size: 10.5px; } .pc-stats b { display: block; margin-top: 1px; font-size: 12px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rfdt-card.is-flush .pv-card .oc-flag.rush { background: #fff1dc; color: #a8690c; }
.pc-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* provider card: clean two-column details, two-row footer, round checkbox in the corner cut */
.pv-card .pc-panel { padding: 12px 14px; }
.pc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.pc-kv { min-width: 0; }
.pc-kv small { display: block; color: var(--n-700); font-size: 11px; font-weight: 500; }
.pc-kv b { display: block; margin-top: 2px; color: var(--text); font-size: 12px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-card .pc-foot { flex-direction: column; align-items: flex-start; gap: 3px; padding: 9px 44px 9px 12px; }
.pv-card .pc-foot span { display: block; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rfdt-card:has(.pv-card) .rfdt-card-check { background: var(--n-100); width: 30px; height: 30px; }
.rfdt-card:has(.pv-card) .rfdt-card-check .form-check-input { appearance: none; -webkit-appearance: none; top: 7px; left: 7px; width: 14px; height: 14px; border: 1.5px solid var(--n-400); border-radius: 50%; background-color: #fff; background-size: 10px; background-position: center; background-repeat: no-repeat; box-shadow: none; }
.rfdt-card:has(.pv-card) .rfdt-card-check .form-check-input:checked { border-color: var(--primary); background-color: var(--primary); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M2.5 6.5l2.3 2.3 4.7-5'/%3E%3C/svg%3E"); }
.rfdt-card:has(.pv-card).selected .rfdt-card-check, .rfdt-card:has(.pv-card) .rfdt-card-check:hover { background: var(--n-100); }

.rfdt-cards.is-wide:has(.pv-card) { grid-template-columns: repeat(auto-fill, minmax(470px, 1fr)); }
.rfdt-card.is-flush .pv-card { grid-template-columns: 150px minmax(0, 1fr); }

/* ===== Provider card: cleaner presentation (same shell as the order card) ===== */
.rfdt-card.is-flush .pv-card { grid-template-columns: 200px minmax(0, 1fr); }
.pv-card .order-summary { padding: 14px 14px 12px 14px; }
.pv-card .record-status { padding-left: 22px; }
.pv-card .pv-kicker { margin-top: 5px; padding-left: 22px; color: var(--n-700); font-size: 11px; font-weight: 500; }
.pv-card .pv-facility { margin-top: 14px; padding-left: 0; color: var(--text); font-size: 14px; font-weight: 650; line-height: 1.25; letter-spacing: -.01em; }
.pv-card .pv-person { margin-top: 3px; color: var(--n-700); font-size: 12px; }
.pv-card .pv-spec { display: inline-flex; align-items: center; gap: 5px; margin-top: 12px; padding: 3px 9px 3px 7px; border-radius: 999px; background: var(--primary-soft-2); color: var(--primary-dark); font-size: 11.5px; font-weight: 600; }
.pv-card .pv-spec i { font-size: 13px; }
.pv-card .pc-panel { margin: 0; padding: 14px 18px; border-left: 1px solid var(--border-soft); background: transparent; display: flex; align-items: center; }
.pv-card .pc-panel .pc-grid { width: 100%; gap: 14px 20px; }
.pc-kv small { color: var(--n-600); font-size: 11px; letter-spacing: .01em; }
.pc-kv b { margin-top: 3px; font-size: 12.5px; font-weight: 600; }
.pv-card .pc-foot { padding: 9px 50px 9px 14px; gap: 2px; background: transparent; border-top: 1px solid var(--border-soft); color: var(--n-600); font-size: 11.5px; }
.pv-card .pc-foot b { color: var(--n-800); font-weight: 500; margin-left: 3px; }
.rfdt-card:has(.pv-card) .rfdt-card-menu { opacity: .55; }
.rfdt-card:has(.pv-card):hover .rfdt-card-menu, .rfdt-card:has(.pv-card) .rfdt-card-menu:focus-visible { opacity: 1; }

/* ===== Provider card with a full-width header (long names get room) ===== */
.rfdt-card.is-flush .pv-card { display: flex; flex-direction: column; min-height: 0; }
.rfdt-cards.is-wide:has(.pv-card) { grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); }
.pc-head { padding: 12px 44px 13px 14px; }
.pc-kicker { display: flex; align-items: center; gap: 8px; min-height: 18px; padding-left: 22px; color: var(--n-700); font-size: 11.5px; font-weight: 500; white-space: nowrap; overflow: hidden; }
.pc-kicker .record-status { padding-left: 0; font-size: 11.5px; }
.pc-dot-sep { width: 3px; height: 3px; flex: none; border-radius: 50%; background: var(--n-400); }
.pc-title { margin-top: 9px; color: var(--text); font-size: 15px; font-weight: 650; line-height: 1.3; letter-spacing: -.01em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pc-person { margin-top: 3px; color: var(--n-700); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-card .pc-head .pv-spec { margin-top: 10px; }
.pv-card .pc-panel { display: block; margin: 0; padding: 14px; border-left: 0; border-top: 1px solid var(--border-soft); background: transparent; }
.pv-card .pc-panel .pc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; }
.pv-card .pc-foot { margin-top: auto; }
@media (max-width: 520px) { .pv-card .pc-panel .pc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* provider drawer: sub-orders tab */
.pv-so-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.pv-so { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 1px solid var(--border); border-radius: calc(10px * var(--radius-k)); background: #fff; }
.pv-so:hover { border-color: var(--n-300); }
.pv-so-main { flex: 1; min-width: 0; }
.pv-so-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pv-so-top b { color: var(--text); font-size: 13px; font-weight: 650; }
.pv-so-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 5px; color: var(--n-700); font-size: 12px; }
.pv-so-meta i { margin-right: 4px; color: var(--n-500); font-size: 13px; vertical-align: -2px; }
.pv-so-meta a { color: var(--primary-dark); font-weight: 600; text-decoration: none; } .pv-so-meta a:hover { text-decoration: underline; }
@media (max-width: 520px) { .pv-so { flex-direction: column; align-items: stretch; } }

/* provider drawer: notes tab */
.pv-tabcount:not(:empty) { display: inline-grid; place-items: center; min-width: 18px; height: 16px; margin-left: 5px; padding: 0 5px; border-radius: 999px; background: var(--n-100); color: var(--n-700); font-size: 10.5px; font-weight: 700; }
.record-drawer-tabs .nav-link.active .pv-tabcount { background: #fff; color: var(--primary-dark); }
.pv-notes-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.pv-notes-sub { margin-top: 3px; color: var(--n-700); font-size: 12.5px; }
.pv-composer { margin-bottom: 16px; padding: 14px; border: 1px solid var(--primary-line); border-radius: calc(10px * var(--radius-k)); background: var(--primary-soft-2); }
.pv-label { display: block; margin-bottom: 6px; color: var(--n-800); font-size: 12px; font-weight: 600; }
.pv-composer .form-control { font-size: 13px; background: #fff; }
.pv-err { margin-top: 6px; color: #b42318; font-size: 12px; font-weight: 500; }
.pv-composer-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.pv-notelist { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.pv-note { display: flex; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: calc(10px * var(--radius-k)); background: #fff; }
.pv-note.editing { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent); }
.pv-note-av { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%; background: var(--primary-soft); color: var(--primary-dark); font-size: 11px; font-weight: 700; }
.pv-note-main { flex: 1; min-width: 0; }
.pv-note-top { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; } .pv-note-top b { font-size: 12.5px; } .pv-note-top span { color: var(--n-700); font-size: 11.5px; }
.pv-note p { margin: 5px 0 0; color: var(--text); font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.pv-note-actions { display: flex; gap: 2px; align-items: flex-start; opacity: 0; transition: opacity .12s; } .pv-note:hover .pv-note-actions, .pv-note:focus-within .pv-note-actions { opacity: 1; }
.pv-icon { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: calc(7px * var(--radius-k)); background: transparent; color: var(--n-600); font-size: 15px; cursor: pointer; } .pv-icon:hover { background: var(--n-100); color: var(--text); } .pv-icon.danger:hover { background: #fdeceb; color: #ab3530; } .pv-icon:focus-visible { outline: 2px solid var(--primary-bright); }
.pv-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 36px 16px; border: 1px dashed var(--n-300); border-radius: calc(12px * var(--radius-k)); color: var(--n-700); font-size: 12.5px; text-align: center; } .pv-empty i { color: var(--n-500); font-size: 26px; } .pv-empty b { color: var(--text); font-size: 13.5px; } .pv-empty .pv-btn { margin-top: 8px; }
@media (hover: none) { .pv-note-actions { opacity: 1; } }

/* rich text editor */
.rte { border: 1px solid var(--border); border-radius: calc(10px * var(--radius-k)); background: #fff; overflow: hidden; }
.rte:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent); }
.rte-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; padding: 6px 8px; border-bottom: 1px solid var(--border-soft); background: var(--n-25); }
.rte-btn { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: calc(7px * var(--radius-k)); background: transparent; color: var(--n-700); font-size: 16px; cursor: pointer; }
.rte-btn:hover { background: var(--n-100); color: var(--text); }
.rte-btn.on { background: var(--primary-soft); color: var(--primary-dark); }
.rte-btn:focus-visible { outline: 2px solid var(--primary-bright); outline-offset: 1px; }
.rte-sep { width: 1px; height: 18px; margin: 0 5px; background: var(--border); }
.rte-linkbar { display: flex; align-items: center; gap: 8px; padding: 8px; border-bottom: 1px solid var(--border-soft); background: #fff; }
.rte-linkbar[hidden] { display: none; }
.rte-linkbar .form-control { flex: 1; height: 32px; font-size: 13px; }
.rte-apply, .rte-cancel { height: 32px; padding: 0 12px; border: 1px solid var(--border); border-radius: calc(7px * var(--radius-k)); background: #fff; color: var(--n-700); font-size: 12px; font-weight: 600; cursor: pointer; }
.rte-apply { border-color: transparent; background: var(--primary); color: var(--on-primary); }
.rte-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.rte-area { min-height: 110px; max-height: 280px; overflow-y: auto; padding: 10px 12px; font-size: 13px; line-height: 1.55; outline: none; }
.rte-area:empty::before { content: attr(data-placeholder); color: var(--n-500); pointer-events: none; }
.rte-area p, .pv-rich p { margin: 0 0 6px; } .rte-area p:last-child, .pv-rich p:last-child { margin-bottom: 0; }
.rte-area ul, .rte-area ol, .pv-rich ul, .pv-rich ol { margin: 0 0 6px; padding-left: 22px; }
.rte-area a, .pv-rich a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.pv-rich { margin-top: 5px; color: var(--text); font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.pv-composer .rte { background: #fff; }

/* Tiptap editing surface */
.rte-area.tt { position: relative; padding: 0; min-height: 0; max-height: none; overflow: visible; }
.rte-area.tt .rte-content { min-height: 110px; max-height: 280px; overflow-y: auto; padding: 10px 12px; font-size: 13px; line-height: 1.55; outline: none; }
.rte-area.tt.is-empty::before { content: attr(data-placeholder); position: absolute; top: 10px; left: 12px; color: var(--n-500); font-size: 13px; pointer-events: none; }
.rte-area.tt p { margin: 0 0 6px; } .rte-area.tt p:last-child { margin-bottom: 0; }
.rte-area.tt ul, .rte-area.tt ol { margin: 0 0 6px; padding-left: 22px; }
.rte-area.tt a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; cursor: text; }
.rte-btn:disabled { opacity: .35; cursor: default; }

/* Active / Inactive badges: clear colour states (used by Providers, Roles and Team members) */
.rf-status.active { color: #15704a; background: #e6f6ee; }
.rf-status.inactive { color: #ab3530; background: #fdeceb; }


/* COMPONENT: alert banners (.rf-alerts > .rf-alert) — dismissible notices above a page's content.
   Tones: warn (default) · info · danger · success. Put .rf-alerts directly before .kpi-strip or the content; it adds its own bottom spacing.
   Dismiss with a button.rf-alert-close; remember dismissals per alert key so a changed situation shows again. */
.rf-alerts { display: grid; gap: 8px; margin: 14px 0 18px; }
.rf-alerts[hidden] { display: none; }
.rf-alert { --a-bg: #fff7ef; --a-line: #f6d6ad; --a-ink: #c46a0a; display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border: 1px solid var(--a-line); border-radius: calc(10px * var(--radius-k, 1)); background: var(--a-bg); font-size: 13px; }
.rf-alert.info { --a-bg: #f1f5ff; --a-line: #cfdbff; --a-ink: #2f4ec4; } .rf-alert.danger { --a-bg: #fff4f3; --a-line: #f3c5c2; --a-ink: #ab3530; } .rf-alert.success { --a-bg: #f0faf5; --a-line: #bfe6d2; --a-ink: #15704a; }
.rf-alert > i:first-child { color: var(--a-ink); font-size: 18px; flex: none; } .rf-alert > span { flex: 1; min-width: 0; line-height: 1.45; }
.rf-alert-close { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border: 0; border-radius: 8px; background: none; color: var(--a-ink); font-size: 18px; cursor: pointer; } .rf-alert-close:hover { background: rgba(0, 0, 0, .06); } .rf-alert-close:focus-visible { outline: 2px solid var(--primary-bright); outline-offset: 1px; }
.rf-alerts + .kpi-strip { margin-top: 0; }
.rf-alerts[hidden] + .kpi-strip { margin-top: 18px; } /* no alerts showing: keep the normal gap under the page header */


/* COMPONENT: buttons — the canonical set is .rf-btn (+ variants). Older families (.wz-btn, .pv-btn, .dr-btn, .od-btn, .new-button) look the same and are being folded into it.
   Variants: primary · soft (the page-header "Add new" style, same look as .new-button) · danger · ghost · sm · icon-only · loading · disabled */
.rf-btn:focus-visible { outline: 2px solid var(--primary-bright); outline-offset: 2px; }
.rf-btn:disabled, .rf-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.rf-btn.danger { border-color: transparent; background: #c94444; color: #fff; } .rf-btn.danger:hover { background: #b23838; color: #fff; }
.rf-btn.ghost { border-color: transparent; background: transparent; } .rf-btn.ghost:hover { background: var(--n-100); border-color: transparent; }
.rf-btn.sm { min-height: 30px; padding: 0 10px; font-size: 12px; } .rf-btn.sm.icon-only { width: 30px; padding: 0; }
.rf-btn.lg { min-height: 42px; padding: 0 18px; font-size: 13.5px; }
.rf-btn.loading { position: relative; color: transparent !important; pointer-events: none; } .rf-btn.loading > * { opacity: 0; }
.rf-btn.loading::after { content: ""; position: absolute; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; color: var(--text-2); animation: rfbtn-spin .7s linear infinite; }
.rf-btn.primary.loading::after, .rf-btn.danger.loading::after { color: #fff; }
@keyframes rfbtn-spin { to { transform: rotate(360deg); } }
.rf-btn-group { display: inline-flex; } .rf-btn-group .rf-btn { border-radius: 0; margin-left: -1px; } .rf-btn-group .rf-btn:first-child { margin-left: 0; border-radius: calc(7px * var(--radius-k)) 0 0 calc(7px * var(--radius-k)); } .rf-btn-group .rf-btn:last-child { border-radius: 0 calc(7px * var(--radius-k)) calc(7px * var(--radius-k)) 0; }
@media (prefers-reduced-motion: reduce) { .rf-btn.loading::after { animation-duration: 2s; } }


/* COMPONENT: badges — .rf-badge + a tone. Tones: neutral (default) · primary · success · warning · danger · info · violet.
   Styles: soft (default) · outline · dot · square · sm · count. A <button class="rf-badge"> is clickable (for example a status toggle).
   Older badge classes (.sp-st, .rf-status, .cl-type, .pl-aud, .ac-sev, .ac-rev, .ac-out, ...) map onto these tones. */
.rf-badge { --b-fg: #2a2f45; --b-bg: color-mix(in srgb, var(--b-fg) 10%, #fff); --b-line: color-mix(in srgb, var(--b-fg) 28%, #fff); --b-solid: var(--b-fg); display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border: 1px solid transparent; border-radius: 999px; background: var(--b-bg); color: var(--b-fg); font: inherit; font-size: 11.5px; font-weight: 650; line-height: 1; white-space: nowrap; vertical-align: middle; }
.rf-badge > i { font-size: 13px; }
.rf-badge.outline { background: transparent; border-color: var(--b-line); }
.rf-badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.rf-badge.square { border-radius: 6px; } .rf-badge.sm { height: 18px; padding: 0 7px; font-size: 10.5px; }
.rf-badge.count { min-width: 22px; padding: 0 6px; justify-content: center; font-variant-numeric: tabular-nums; }
button.rf-badge { cursor: pointer; } button.rf-badge:hover { filter: brightness(.96); } button.rf-badge:focus-visible { outline: 2px solid var(--primary-bright); outline-offset: 2px; }

/* badges: more tones and variants */
 .rf-badge.primary { --b-solid: var(--primary); } .rf-badge.success { --b-solid: #12805a; } .rf-badge.warning { --b-solid: #a8620a; } .rf-badge.danger { --b-solid: #d33a35; } .rf-badge.info { --b-solid: #3b5bdb; } .rf-badge.violet { --b-solid: #7a52d1; }
.rf-badge.solid { background: var(--b-solid); color: #fff; border-color: transparent; }
.rf-badge.bordered { border-color: var(--b-line); }
.rf-badge.lg { height: 28px; padding: 0 12px; font-size: 12.5px; } .rf-badge.lg > i { font-size: 15px; }
.rf-badge.pulse::before { animation: rfbadge-pulse 1.8s ease-out infinite; }
@keyframes rfbadge-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 45%, transparent); } 80%, 100% { box-shadow: 0 0 0 6px transparent; } }
.rf-badge.chip { padding-right: 3px; gap: 4px; } .rf-badge-x { display: grid; place-items: center; width: 18px; height: 18px; border: 0; border-radius: 50%; background: none; color: inherit; font-size: 13px; cursor: pointer; } .rf-badge-x:hover { background: rgba(0, 0, 0, .1); } .rf-badge-x:focus-visible { outline: 2px solid var(--primary-bright); outline-offset: 1px; }
.rf-badge-split { display: inline-flex; vertical-align: middle; } .rf-badge-split > * { height: 22px; display: inline-flex; align-items: center; padding: 0 8px; font-size: 11.5px; font-weight: 650; white-space: nowrap; } .rf-badge-split > :first-child { border-radius: 6px 0 0 6px; background: var(--n-100); color: var(--n-800); } .rf-badge-split > :last-child { border-radius: 0 6px 6px 0; background: var(--b-solid, var(--primary)); color: #fff; }
.rf-badge-split.success { --b-solid: #12805a; } .rf-badge-split.warning { --b-solid: #a8620a; } .rf-badge-split.danger { --b-solid: #d33a35; } .rf-badge-split.info { --b-solid: #3b5bdb; }
.rf-badge-wrap { position: relative; display: inline-flex; } .rf-badge-wrap > .rf-badge.float { position: absolute; top: -7px; right: -7px; box-shadow: 0 0 0 2px #fff; } .rf-badge.dot-only { width: 10px; height: 10px; min-width: 0; padding: 0; border-radius: 50%; background: var(--b-solid); } .rf-badge.dot-only::before { display: none; }
.rf-badge.tag { border-radius: 6px; border-left: 3px solid var(--b-solid); }
@media (prefers-reduced-motion: reduce) { .rf-badge.pulse::before { animation: none; } }

/* badges: extended palette (19 tones in total) */

/* badge step number (order stages) */
.rf-badge-step { display: inline-grid; place-items: center; width: 15px; height: 15px; margin-left: -4px; border-radius: 50%; background: var(--b-solid); color: #fff; font-size: 9.5px; font-weight: 700; line-height: 1; }
.rf-badge.sm .rf-badge-step { width: 13px; height: 13px; font-size: 8.5px; } .rf-badge.outline .rf-badge-step { background: transparent; border: 1px solid currentColor; color: inherit; }

/* badges: ONE colour per meaning. Each tone below is just the text colour; the badge background, border and solid fill are derived from it,
   so changing the colour here changes the text, the soft badge, the outline, the dot and the solid badge together. */
.rf-badge.primary { --b-fg: var(--primary-dark); }
.rf-badge.success { --b-fg: #15704a; }
.rf-badge.warning { --b-fg: #8f5608; }
.rf-badge.danger { --b-fg: #ab3530; }
.rf-badge.info { --b-fg: #2f4ec4; }
.rf-badge.violet { --b-fg: #6a48c2; }
.rf-badge.teal { --b-fg: #0f6d6a; }
.rf-badge.rose { --b-fg: #b8365a; }
.rf-badge.orange { --b-fg: #a8480d; }
.rf-badge.slate { --b-fg: #2a3047; }
.rf-badge.lime { --b-fg: #4a6a0c; }
.rf-badge.yellow { --b-fg: #7a6100; }
.rf-badge.sky { --b-fg: #0b6288; }
.rf-badge.blue { --b-fg: #1f4fbf; }
.rf-badge.indigo { --b-fg: #3c3bb5; }
.rf-badge.pink { --b-fg: #a3226b; }
.rf-badge.brown { --b-fg: #6b4423; }

/* COMPONENT: search field (.od-search, also .rf-search) — same look as the datatable search. Loaded globally so any page or drawer can use it.
   <label class="rf-search"><i class="ri-search-line"></i><input type="search" placeholder="Search…" aria-label="Search"></label> */
.od-search, .rf-search { position: relative; display: block; flex: 1 1 200px; min-width: 180px; }
.od-search i, .rf-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--n-600); font-size: 15px; pointer-events: none; }
.od-search input, .rf-search input { width: 100%; height: 38px; padding: 0 12px 0 36px; border: 1px solid transparent; border-radius: calc(10px * var(--radius-k)); background: var(--n-50); color: var(--text); font-size: 13px; transition: background .15s ease, border-color .15s ease, box-shadow .15s ease; -webkit-appearance: none; appearance: none; }
.od-search input::placeholder, .rf-search input::placeholder { color: var(--n-500); }
.od-search input:hover, .rf-search input:hover { background: var(--n-100); }
.od-search input:focus, .od-search input:focus-visible, .rf-search input:focus, .rf-search input:focus-visible { outline: none; background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent); }
.od-search input::-webkit-search-cancel-button, .rf-search input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* notification center */
.nc-bell { position: relative; display: inline-grid; place-items: center; width: 33px; height: 33px; border: 1px solid var(--border); border-radius: calc(7px * var(--radius-k, 1)); background: #fff; color: var(--text-2, #475467); font-size: 16px; cursor: pointer; transition: background .15s, border-color .15s; }
.nc-bell:hover { background: var(--n-50); } .nc-bell[aria-expanded="true"] { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary-dark); } .nc-bell:focus-visible { outline: 2px solid var(--primary-bright); outline-offset: 2px; }
.nc-badge { position: absolute; top: -7px; left: calc(100% - 9px); min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px; background: #d92d20; color: #fff; font-size: 9.5px; font-weight: 700; line-height: 15px; letter-spacing: -.01em; text-align: center; white-space: nowrap; box-shadow: 0 0 0 2px #fff; box-sizing: border-box; pointer-events: none; }
.page-actions .nc-bell { margin-right: 8px; }
.nc-panel { position: fixed; z-index: 1080; max-height: min(620px, calc(100vh - 90px)); display: flex; flex-direction: column; background: #fff; border: 1px solid var(--border); border-radius: calc(14px * var(--radius-k, 1)); box-shadow: 0 18px 48px rgba(16, 24, 40, .18); overflow: hidden; } .nc-panel[hidden] { display: none; }
.nc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 14px 14px 10px 16px; } .nc-head b { display: block; font-size: 15px; } .nc-head small { color: var(--n-700); font-size: 12px; } .nc-headact { display: flex; align-items: center; gap: 4px; }
.nc-tabs { margin: 0 16px 8px; align-self: flex-start; } .nc-n { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: var(--primary); color: #fff; font-size: 10.5px; line-height: 18px; text-align: center; }
.nc-list { overflow: auto; border-top: 1px solid var(--border-soft); flex: 1 1 auto; min-height: 0; }
.nc-item { position: relative; display: flex; gap: 12px; padding: 12px 14px 12px 16px; border-bottom: 1px solid var(--n-100); cursor: pointer; } .nc-item:hover { background: var(--n-25); } .nc-item:focus-visible { outline: 2px solid var(--primary-bright); outline-offset: -2px; }
.nc-item.unread { background: var(--primary-soft-2); } .nc-item.unread::before { content: ""; position: absolute; left: 6px; top: 22px; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
.nc-ico { flex: 0 0 34px; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; background: #eef1ff; color: #3b4cc0; } .nc-ico.success { background: #e3f6ee; color: #1f8a5b; } .nc-ico.warning { background: #fff1dc; color: #a8690c; } .nc-ico.danger { background: #fde8ec; color: #b8365a; }
.nc-body { flex: 1; min-width: 0; display: grid; gap: 2px; } .nc-body b { font-size: 13px; font-weight: 600; } .nc-msg { color: var(--n-700); font-size: 12.5px; line-height: 1.4; } .nc-body small { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; color: var(--n-700); font-size: 11.5px; margin-top: 2px; }
.nc-cat { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: #3b4cc0; } .nc-cat.green { color: #1f8a5b; } .nc-cat.orange { color: #a8690c; } .nc-cat.violet { color: #6a48c2; } .nc-cat.gray { color: #667085; } .nc-cat.blue { color: #2a6f9e; }
.nc-act { flex: 0 0 auto; align-self: center; width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--n-700); opacity: 0; cursor: pointer; } .nc-item:hover .nc-act, .nc-act:focus-visible { opacity: 1; } .nc-act:hover { background: var(--n-100); }
.nc-empty { display: grid; justify-items: center; gap: 4px; padding: 44px 24px; text-align: center; color: var(--n-700); font-size: 12.5px; } .nc-empty i { font-size: 30px; color: var(--n-400); } .nc-empty b { color: var(--text); font-size: 14px; }
.nc-foot { display: flex; justify-content: center; align-items: center; gap: 6px; padding: 12px; border-top: 1px solid var(--border-soft); font-size: 13px; font-weight: 600; color: var(--primary-dark); text-decoration: none; } .nc-foot:hover { background: var(--n-25); } .nc-foot:focus-visible { outline: 2px solid var(--primary-bright); outline-offset: -2px; }
@media (hover: none) { .nc-act { opacity: 1; } } @media (prefers-reduced-motion: no-preference) { .nc-panel:not([hidden]) { animation: ncIn .14s ease-out; } @keyframes ncIn { from { opacity: 0; transform: translateY(-4px); } } }
.nt-cell { display: flex; gap: 12px; align-items: center; } .nt-cell.unread .rfdt-strong { font-weight: 700; } .nt-prefs { display: grid; gap: 10px; max-width: 720px; }
.page-actions .nc-bell { align-self: stretch; height: auto; min-height: 33px; }

.nc-tabs { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: calc(9px * var(--radius-k, 1)); background: var(--n-50); }
.nc-tabs button { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 12px; border: 0; border-radius: calc(7px * var(--radius-k, 1)); background: transparent; color: var(--n-700); font-size: 12.5px; font-weight: 600; cursor: pointer; transition: background .15s, color .15s; }
.nc-tabs button:hover { color: var(--text); } .nc-tabs button.on { background: #fff; color: var(--primary-dark); box-shadow: 0 1px 2px rgba(16, 24, 40, .1); } .nc-tabs button:focus-visible { outline: 2px solid var(--primary-bright); outline-offset: 1px; }

.profile-avatar.has-img { background-size: cover; background-position: center; background-repeat: no-repeat; color: transparent; }

.rf-badge.text { display: inline-flex; align-items: center; gap: 5px; height: auto; min-height: 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; color: var(--b-fg, var(--n-700)); font-weight: 600; font-size: inherit; line-height: 1.4; white-space: nowrap; }
.rf-badge.text i { font-size: 1.1em; color: inherit; }
