/* ==========================================================================
   Udaan CRM — shared design system
   --------------------------------------------------------------------------
   Loaded globally from layouts/shared/head.blade.php, AFTER the template CSS
   and AFTER each page's own stylesheet, so it is the last word on the
   cross-cutting concerns: colour, type scale, controls, tables and the
   responsive behaviour of the legacy template pages.

   Why this file exists
   --------------------
   Page styles grew one page at a time (assets/css/<page>.css). That left the
   app with ~1,650 distinct hex colours, font sizes down to 8px, and roughly
   70 screens still on the bare Bootstrap template while a handful had been
   redesigned. This layer gives every screen one palette, one readable type
   scale and one set of controls, without rewriting each page.

   Conventions
   -----------
   - Everything is driven by the --u-* tokens below. Change a token, not a rule.
   - !important is used only where a page stylesheet already set the property
     with equal-or-higher specificity; each such block says why.
   - Nothing here depends on JS. Layout fixes are CSS-only and additive.
   ========================================================================== */

:root {
    /* Brand — matches the sidebar active state so the shell and content agree. */
    --u-brand: #5b54d6;
    --u-brand-strong: #4840c2;
    --u-brand-soft: #eeedfc;
    --u-brand-ring: rgba(91, 84, 214, .22);

    /* Semantic */
    --u-success: #11936a;
    --u-success-soft: #e4f6ef;
    --u-warning: #b7791f;
    --u-warning-soft: #fdf3e2;
    --u-danger: #d1485c;
    --u-danger-soft: #fdecef;
    --u-info: #2b6fd4;
    --u-info-soft: #e8f1fd;

    /* Neutral ramp — text, lines and surfaces all come from here. */
    --u-ink: #1b2639;
    --u-ink-2: #3c4a62;
    --u-ink-3: #5d6b83;
    --u-muted: #7a8699;
    --u-faint: #99a3b4;
    --u-line: #e3e8ef;
    --u-line-soft: #eef1f6;
    --u-surface: #ffffff;
    --u-surface-2: #f8fafc;
    --u-canvas: #f4f6fa;

    /* Type scale. Floor: 11px for uppercase micro-labels, 12px for everything
       else. The page stylesheets were swept to match (sizes of 7-9px became 11px,
       10-11px became 12px), so this file only has to hold the line. */
    --u-text-xs: 12px;
    --u-text-sm: 13px;
    --u-text-base: 14px;
    --u-text-md: 15px;
    --u-text-lg: 17px;
    --u-text-xl: 20px;
    --u-text-2xl: 24px;
    --u-text-3xl: 28px;

    /* Radii */
    --u-radius-sm: 7px;
    --u-radius: 10px;
    --u-radius-lg: 14px;

    /* Elevation — low and soft; this is a dense data product, not a landing page. */
    --u-shadow-sm: 0 1px 2px rgba(27, 38, 57, .05);
    --u-shadow: 0 2px 8px rgba(27, 38, 57, .06);
    --u-shadow-lg: 0 12px 32px rgba(27, 38, 57, .10);

    /* Rhythm */
    --u-gap: 16px;
    --u-pad-page: 28px;
}

/* ==========================================================================
   1. Base
   ========================================================================== */

.udan-workspace {
    background: var(--u-canvas);
    color: var(--u-ink-2);
    font-size: var(--u-text-base);
    font-family: "Public Sans", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Keep template pages on the same typography and surface language. */
.udan-workspace h1,
.udan-workspace h2,
.udan-workspace h3,
.udan-workspace h4,
.udan-workspace h5,
.udan-workspace h6 {
    color: var(--u-ink);
    font-family: inherit;
    letter-spacing: -.02em;
}

.udan-workspace .content-wrapper { color: var(--u-ink-2); }
.udan-workspace .card { border-color: var(--u-line); border-radius: var(--u-radius); box-shadow: var(--u-shadow-sm); }
.udan-workspace .card-header { border-bottom-color: var(--u-line-soft); }

.udan-workspace img,
.udan-workspace svg,
.udan-workspace video {
    max-width: 100%;
    height: auto;
}

/* Long unbroken values (emails, URLs, reference ids) used to force horizontal
   page scroll on phones; let them wrap instead. */
.udan-workspace .table td,
.udan-workspace .card-body,
.udan-workspace p {
    overflow-wrap: break-word;
}

/* One visible focus ring everywhere, instead of the template's per-control mix. */
.udan-workspace a:focus-visible,
.udan-workspace button:focus-visible,
.udan-workspace [tabindex]:focus-visible,
.udan-workspace .btn:focus-visible,
.udan-workspace .form-control:focus-visible,
.udan-workspace .form-select:focus-visible,
.udan-workspace .page-link:focus-visible {
    outline: 2px solid var(--u-brand);
    outline-offset: 2px;
    box-shadow: none;
}

/* ==========================================================================
   2. Readability floor
   --------------------------------------------------------------------------
   Page stylesheets set text as small as 8px. Those rules are written as
   `.page-scope .table td { font-size: 10px }` — two classes and an element —
   so they are matched here with the body class prepended to win on
   specificity rather than with a blanket override.
   ========================================================================== */

.udan-workspace .table th,
.udan-workspace .table thead th,
.udan-workspace table.table thead th {
    font-size: var(--u-text-xs) !important;
    font-weight: 600;
    letter-spacing: .2px;
    color: var(--u-ink-3);
    text-transform: none;
}

.udan-workspace .table td,
.udan-workspace table.table td {
    font-size: var(--u-text-sm) !important;
    color: var(--u-ink-2);
    vertical-align: middle;
}

.udan-workspace .badge,
.udan-workspace .table .badge {
    font-size: var(--u-text-xs) !important;
    font-weight: 600;
    letter-spacing: 0;
}

.udan-workspace .form-label,
.udan-workspace label,
.udan-workspace .form-text,
.udan-workspace small,
.udan-workspace .small {
    font-size: var(--u-text-xs) !important;
}

.udan-workspace .form-control,
.udan-workspace .form-select,
.udan-workspace .input-group-text,
.udan-workspace .select2-selection__rendered {
    font-size: var(--u-text-sm) !important;
}

.udan-workspace .btn {
    font-size: var(--u-text-sm) !important;
}

.udan-workspace .btn-sm {
    font-size: var(--u-text-xs) !important;
}

/* DataTables chrome (length menu, info line, pagination). */
.udan-workspace .dataTables_length,
.udan-workspace .dataTables_filter,
.udan-workspace .dataTables_info,
.udan-workspace .dataTables_paginate,
.udan-workspace .dataTables_length select,
.udan-workspace .dataTables_filter input {
    font-size: var(--u-text-xs) !important;
    color: var(--u-muted);
}

/* ==========================================================================
   3. Page shell
   ========================================================================== */

.udan-workspace .container-p-y {
    padding-top: var(--u-pad-page) !important;
    padding-bottom: var(--u-pad-page) !important;
}

.udan-workspace .content-wrapper > .container-xxl,
.udan-workspace .content-wrapper > * > .container-xxl {
    padding-right: var(--u-pad-page);
    padding-left: var(--u-pad-page);
}

/* CRM directories use the full desktop workspace instead of Bootstrap's fixed
   container cap, so tables do not leave unused space beside the content. */
@media (min-width: 992px) {
    .udan-workspace .content-wrapper > .container-xxl,
    .udan-workspace .content-wrapper > * > .container-xxl {
        width: 100%;
        max-width: none !important;
    }
}

/* Legacy page heading: `<h4 class="py-3 mb-4"><span class="text-muted fw-light">
   <a>Dashboard</a> / Client List</span></h4>`. Roughly 70 screens use this or
   the `.card-title` variant. It cannot gain a real title from CSS alone, but it
   can at least read as a deliberate breadcrumb rather than stray grey text. */
.udan-workspace .container-p-y > h4.py-3,
.udan-workspace .container-p-y > h4.mb-4 {
    margin-bottom: 20px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    font-size: var(--u-text-2xl);
    font-weight: 650;
    letter-spacing: -.4px;
    color: var(--u-ink);
}

.udan-workspace .container-p-y > h4 .text-muted.fw-light,
.udan-workspace .card-title > .text-muted.fw-light {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: var(--u-text-xs);
    font-weight: 600 !important;
    letter-spacing: .3px;
    color: var(--u-faint) !important;
    text-transform: uppercase;
}

.udan-workspace .container-p-y > h4 .text-muted.fw-light a,
.udan-workspace .card-title > .text-muted.fw-light a {
    color: var(--u-muted) !important;
    text-decoration: none;
}

.udan-workspace .container-p-y > h4 .text-muted.fw-light a:hover,
.udan-workspace .card-title > .text-muted.fw-light a:hover {
    color: var(--u-brand) !important;
}

/* The breadcrumb and the page name sit on separate lines so the name reads as
   a title even where the markup keeps them in one element. */
.udan-workspace .container-p-y > h4 > .text-muted.fw-light {
    display: block;
    margin-bottom: 7px;
}

.udan-workspace .card-title {
    margin: 0;
    font-size: var(--u-text-md) !important;
    font-weight: 650;
    color: var(--u-ink);
}

/* Shared page-header component (resources/views/components/page-header). */
.udan-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 22px;
}

.udan-page-header__crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-size: var(--u-text-xs);
    font-weight: 600;
    letter-spacing: .3px;
    color: var(--u-faint);
    text-transform: uppercase;
}

.udan-page-header__crumbs a {
    color: var(--u-muted);
    text-decoration: none;
}

.udan-page-header__crumbs a:hover {
    color: var(--u-brand);
}

.udan-page-header h1 {
    margin: 0;
    font-size: var(--u-text-3xl);
    font-weight: 700;
    letter-spacing: -.6px;
    color: var(--u-ink);
    line-height: 1.2;
}

.udan-page-header p {
    margin: 6px 0 0;
    max-width: 62ch;
    font-size: var(--u-text-sm);
    color: var(--u-muted);
}

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

/* ==========================================================================
   4. Surfaces
   ========================================================================== */

.udan-workspace .card {
    border: 1px solid var(--u-line);
    border-radius: var(--u-radius-lg);
    background: var(--u-surface);
    box-shadow: var(--u-shadow);
}

.udan-workspace .card + .card,
.udan-workspace .row + .card {
    margin-top: var(--u-gap);
}

.udan-workspace .card-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--u-line-soft);
    background: transparent;
}

.udan-workspace .card-body {
    padding: 20px;
}

/* Metric tiles on the template pages (`.content-left` + `.avatar`). They were
   plain boxes; this gives them the same weighting as the redesigned pages. */
.udan-workspace .card-body > .d-flex > .content-left > span:first-child {
    display: block;
    font-size: var(--u-text-xs);
    font-weight: 600;
    letter-spacing: .3px;
    color: var(--u-muted);
    text-transform: uppercase;
}

.udan-workspace .card-body > .d-flex > .content-left h4 {
    font-size: var(--u-text-2xl);
    font-weight: 700;
    letter-spacing: -.5px;
    color: var(--u-ink);
}

.udan-workspace hr {
    margin: 18px 0;
    border-color: var(--u-line-soft);
    opacity: 1;
}

.udan-workspace .alert {
    border: 1px solid transparent;
    border-radius: var(--u-radius);
    font-size: var(--u-text-sm);
}

/* ==========================================================================
   5. Controls
   ========================================================================== */

.udan-workspace .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 8px 15px;
    border-radius: var(--u-radius-sm);
    font-weight: 600;
    white-space: nowrap;
    box-shadow: none;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.udan-workspace .btn-sm {
    min-height: 32px;
    padding: 5px 11px;
}

.udan-workspace .btn-primary {
    border-color: var(--u-brand);
    background: var(--u-brand);
    color: #fff;
}

.udan-workspace .btn-primary:hover,
.udan-workspace .btn-primary:focus {
    border-color: var(--u-brand-strong);
    background: var(--u-brand-strong);
    color: #fff;
}

.udan-workspace .btn-outline-primary {
    border-color: var(--u-line);
    background: var(--u-surface);
    color: var(--u-ink-3);
}

.udan-workspace .btn-outline-primary:hover,
.udan-workspace .btn-outline-primary:focus {
    border-color: var(--u-brand);
    background: var(--u-brand-soft);
    color: var(--u-brand);
}

.udan-workspace .btn-secondary,
.udan-workspace .btn-outline-secondary {
    border-color: var(--u-line);
    background: var(--u-surface);
    color: var(--u-ink-3);
}

.udan-workspace .btn-secondary:hover,
.udan-workspace .btn-outline-secondary:hover {
    border-color: var(--u-muted);
    background: var(--u-surface-2);
    color: var(--u-ink);
}

/* `btn-group w-100` is used around single buttons in the filter rows, which
   stretched one button across the whole toolbar. Let them size to content on
   wide screens; the mobile rules below put them back to full width. */
.udan-workspace .dt_adv_search .btn-group.w-100,
.udan-workspace .leads-tools .btn-group.w-100,
.udan-workspace .d-flex > .btn-group.w-100 {
    width: auto !important;
}

.udan-workspace .form-control,
.udan-workspace .form-select {
    min-height: 38px;
    border-color: var(--u-line);
    border-radius: var(--u-radius-sm);
    color: var(--u-ink-2);
    background-color: var(--u-surface);
}

.udan-workspace .form-control::placeholder {
    color: var(--u-faint);
}

.udan-workspace .form-control:focus,
.udan-workspace .form-select:focus {
    border-color: var(--u-brand);
    box-shadow: 0 0 0 3px var(--u-brand-ring);
}

.udan-workspace .form-label {
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--u-ink-3);
}

/* Shared CRM form foundation: every page and slide-over uses the same field rhythm. */
.udan-workspace form .form-label {
    display: block;
    font-size: 12px;
    line-height: 1.3;
}

.udan-workspace form .form-control,
.udan-workspace form .form-select {
    min-height: 40px;
    padding: 9px 12px;
    font-size: 13px;
    line-height: 1.35;
    border-color: var(--u-line);
    box-shadow: none;
}

.udan-workspace form textarea.form-control {
    min-height: 104px;
    resize: vertical;
}

.udan-workspace form .input-group-text {
    min-height: 40px;
    padding: 8px 11px;
    border-color: var(--u-line);
    background: var(--u-surface-2);
    color: var(--u-muted);
    font-size: 12px;
}

.udan-workspace form .form-text,
.udan-workspace form .text-muted {
    margin-top: 5px;
    color: var(--u-muted) !important;
    font-size: 12px;
    line-height: 1.45;
}

.udan-workspace form .form-check-input {
    width: 16px;
    height: 16px;
    margin-top: .14em;
    border-color: #cdd5e1;
}

.udan-workspace form .form-check-input:checked {
    border-color: var(--u-brand);
    background-color: var(--u-brand);
}

.udan-workspace form .select2-container--default .select2-selection--single,
.udan-workspace form .select2-container--default .select2-selection--multiple {
    min-height: 40px;
    font-size: 13px;
}

.udan-workspace form .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 38px;
}

.udan-workspace .modal-header,
.udan-workspace .offcanvas-header {
    border-bottom-color: var(--u-line-soft);
}

.udan-workspace .modal-footer,
.udan-workspace .offcanvas-footer {
    gap: 8px;
    padding: 16px 20px;
    border-top-color: var(--u-line-soft);
}

/* Select2 is used across the filter rows; align it with the native controls. */
.udan-workspace .select2-container--default .select2-selection--single,
.udan-workspace .select2-container--default .select2-selection--multiple {
    min-height: 38px;
    border-color: var(--u-line) !important;
    border-radius: var(--u-radius-sm) !important;
}

.udan-workspace .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 36px;
    color: var(--u-ink-2);
}

.udan-workspace .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px;
}

.udan-workspace .select2-container--default.select2-container--focus .select2-selection,
.udan-workspace .select2-container--default.select2-container--open .select2-selection {
    border-color: var(--u-brand) !important;
    box-shadow: 0 0 0 3px var(--u-brand-ring);
}

/* Filter panel used by the template pages. */
.udan-workspace .dt_adv_search {
    padding: 16px;
    border: 1px solid var(--u-line-soft);
    border-radius: var(--u-radius);
    background: var(--u-surface-2);
}

/* ==========================================================================
   6. Tables
   --------------------------------------------------------------------------
   Every list in the product is a DataTable. The two recurring faults were
   tables overflowing their card with no way to reach the clipped columns, and
   header/body text sized below the readability floor (handled in §2).
   ========================================================================== */

.udan-workspace .card-datatable,
.udan-workspace .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #c8cfdb transparent;
}

.udan-workspace .card-datatable::-webkit-scrollbar,
.udan-workspace .table-responsive::-webkit-scrollbar {
    height: 8px;
}

.udan-workspace .card-datatable::-webkit-scrollbar-thumb,
.udan-workspace .table-responsive::-webkit-scrollbar-thumb {
    border-radius: 8px;
    background: #c8cfdb;
}

.udan-workspace .table {
    margin-bottom: 0;
    border-color: var(--u-line-soft);
}

.udan-workspace .table thead th {
    padding: 13px 14px;
    border-bottom: 1px solid var(--u-line);
    background: var(--u-surface-2);
    color: #687b9c;
    font-size: 12px;
    font-weight: 650;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
}

.udan-workspace .table td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--u-line-soft);
}

.udan-workspace .table tbody tr:last-child td {
    border-bottom: 0;
}

.udan-workspace .table tbody tr:hover {
    background: var(--u-surface-2);
}

.udan-workspace .table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-accent-bg: transparent;
    background: transparent;
}

/* Standard data-register finish. This covers the legacy directories that do
   not have a page-specific workspace stylesheet (users, agents, mail,
   invoices, masters and reports). */
.udan-workspace .card-datatable,
.udan-workspace .dataTables_wrapper {
    background: var(--u-surface);
}

.udan-workspace .dataTables_wrapper > .row:first-child {
    align-items: center;
    margin: 0;
    padding: 10px 14px;
    border-bottom: 1px solid var(--u-line-soft);
}

.udan-workspace .dataTables_wrapper > .row:last-child {
    align-items: center;
    margin: 0;
    padding: 9px 14px;
    border-top: 1px solid var(--u-line-soft);
}

.udan-workspace .dataTables_filter label,
.udan-workspace .dataTables_length label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0;
}

.udan-workspace .dataTables_filter input,
.udan-workspace .dataTables_length select {
    min-height: 34px;
    border-color: var(--u-line);
    border-radius: var(--u-radius-sm);
    color: var(--u-ink-2);
    background: var(--u-surface);
}

.udan-workspace .dataTables_info {
    color: var(--u-muted);
}

/* Empty state — previously a bare "No data available in table" string. */
.udan-workspace .dataTables_empty {
    padding: 56px 20px !important;
    color: var(--u-muted) !important;
    font-size: var(--u-text-sm) !important;
    text-align: center;
    background: var(--u-surface);
}

.udan-workspace .pagination {
    margin: 0;
    gap: 4px;
}

.udan-workspace .pagination .page-link {
    min-width: 32px;
    border: 1px solid var(--u-line);
    border-radius: var(--u-radius-sm);
    color: var(--u-ink-3);
    text-align: center;
}

.udan-workspace .pagination .page-item.active .page-link {
    border-color: var(--u-brand);
    background: var(--u-brand);
    color: #fff;
}

.udan-workspace .pagination .page-item.disabled .page-link {
    color: var(--u-faint);
    background: var(--u-surface-2);
}

/* ==========================================================================
   7. Badges
   ========================================================================== */

.udan-workspace .badge {
    padding: 5px 9px;
    border-radius: 20px;
}

.udan-workspace .bg-label-primary { background: var(--u-brand-soft) !important; color: var(--u-brand) !important; }
.udan-workspace .bg-label-success { background: var(--u-success-soft) !important; color: var(--u-success) !important; }
.udan-workspace .bg-label-warning { background: var(--u-warning-soft) !important; color: var(--u-warning) !important; }
.udan-workspace .bg-label-danger  { background: var(--u-danger-soft)  !important; color: var(--u-danger)  !important; }
.udan-workspace .bg-label-info    { background: var(--u-info-soft)    !important; color: var(--u-info)    !important; }

/* ==========================================================================
   8. Modals
   ========================================================================== */

.udan-workspace .modal-content {
    border: 0;
    border-radius: var(--u-radius-lg);
    box-shadow: var(--u-shadow-lg);
}

.udan-workspace .modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--u-line-soft);
}

/* Bootstrap's .btn-close carries a negative margin (-0.5rem ...) calibrated
   to Bootstrap's own default 1rem header padding, so the button lands flush
   with the header's edge. Our header padding above is different, so that
   margin overshoots and the button pokes out above the header box — this
   was invisible on tall, content-heavy modals and only became obvious on a
   short one. #addLeadModal already carried a page-specific version of this
   same fix (leads-workspace.css); this makes it the default everywhere. */
.udan-workspace .modal-header .btn-close {
    margin: 0;
    padding: 7px;
}

.udan-workspace .modal-title {
    font-size: var(--u-text-lg);
    font-weight: 650;
    color: var(--u-ink);
}

.udan-workspace .modal-body {
    padding: 22px;
}

.udan-workspace .modal-footer {
    padding: 16px 22px;
    border-top: 1px solid var(--u-line-soft);
    gap: 8px;
}

/* ==========================================================================
   9. Responsive
   --------------------------------------------------------------------------
   Breakpoints follow Bootstrap 5 so they interleave predictably with the
   template's own rules: 1199.98 (sidebar collapses), 991.98, 767.98, 575.98.
   ========================================================================== */

@media (max-width: 1199.98px) {
    :root {
        --u-pad-page: 22px;
    }

    /* The fixed hamburger sits at top-left; keep page content clear of it. */
    .udan-workspace .content-wrapper > .container-xxl,
    .udan-workspace .content-wrapper > * > .container-xxl {
        padding-top: 8px;
    }
}

@media (max-width: 991.98px) {
    :root {
        --u-pad-page: 18px;
        --u-text-3xl: 25px;
        --u-text-2xl: 22px;
    }

    /* Filter rows: let every field take half a row instead of being squeezed
       into the desktop column spans. */
    .udan-workspace .dt_adv_search .row > [class*="col-"] {
        flex: 0 0 auto;
        width: 50%;
    }
}

@media (max-width: 767.98px) {
    :root {
        --u-pad-page: 14px;
        --u-gap: 12px;
        --u-text-3xl: 23px;
        --u-text-2xl: 20px;
    }

    .udan-workspace .card-body,
    .udan-workspace .card-header {
        padding: 16px;
    }

    /* Toolbars inside cards: the template puts title and buttons in one
       `d-flex justify-content-between`, which crushed both on a phone. */
    .udan-workspace .card-body > .d-flex.justify-content-between {
        flex-direction: column;
        align-items: stretch !important;
        gap: 12px;
    }

    .udan-workspace .dt_adv_search .row > [class*="col-"] {
        width: 100%;
    }

    .udan-workspace .dt_adv_search .btn-group.w-100,
    .udan-workspace .d-flex > .btn-group.w-100 {
        width: 100% !important;
    }

    /* Icon-only buttons on phones are unlabelled guesses; the template hides
       the label with `d-none d-sm-inline-block`. Show it again — there is room
       once the toolbar stacks. */
    .udan-workspace .btn .d-none.d-sm-inline-block {
        display: inline-block !important;
    }

    /* Keep tables scrollable rather than clipped, and stop them collapsing to
       unreadable column widths. */
    .udan-workspace .card-datatable table,
    .udan-workspace .table-responsive table {
        min-width: 620px;
    }

    /* DataTables length/search/info/pagination rows. */
    .udan-workspace .dataTables_wrapper > .row > [class*="col-"] {
        width: 100%;
        text-align: left !important;
    }

    .udan-workspace .dataTables_paginate,
    .udan-workspace .dataTables_info {
        display: flex;
        justify-content: center;
        padding: 10px 0 !important;
        text-align: center;
    }

    .udan-workspace .dataTables_paginate {
        flex-wrap: wrap;
    }

    /* Tap targets. */
    .udan-workspace .btn,
    .udan-workspace .page-link {
        min-height: 40px;
    }

    .udan-workspace .btn-sm {
        min-height: 34px;
    }
}

@media (max-width: 575.98px) {
    /* Centred dialogs become a full-height sheet; the workspace's right-hand
       slide-over panels (handled in workspace.css) already fill the screen. */
    .udan-workspace .modal:not(.modal-right) .modal-dialog {
        width: 100vw;
        max-width: 100vw !important;
    }

    .udan-workspace .modal-footer {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .udan-workspace .modal-footer > .btn {
        width: 100%;
        margin: 0;
    }

    /* Toolbar buttons go full width so labels are never truncated. */
    .udan-workspace .udan-page-header__actions,
    .udan-workspace .udan-page-header__actions > .btn,
    .udan-workspace .udan-page-header__actions > a.btn {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .udan-workspace * {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}

/* ==========================================================================
   10. Print — invoices, estimates and reports are printed from the browser.
   ========================================================================== */

@media print {
    .udan-workspace #layout-menu,
    .udan-workspace #layout-navbar,
    .udan-workspace .udan-mobile-menu-trigger,
    .udan-workspace .content-footer,
    .udan-workspace .dataTables_length,
    .udan-workspace .dataTables_paginate,
    .udan-workspace .btn {
        display: none !important;
    }

    .udan-workspace .layout-page {
        margin: 0 !important;
        padding: 0 !important;
    }

    .udan-workspace .card {
        border: 1px solid #ccc;
        box-shadow: none;
    }
}

/* ==========================================================================
   11. Page-level responsive corrections
   --------------------------------------------------------------------------
   Faults found by auditing every screen at 360 / 390 / 768 / 1024 / 1440 and
   measuring real overflow in the browser. Each one is a flex row built from
   fixed-width children that was never allowed to wrap, so it pushed a
   horizontal scrollbar onto the whole page. They are collected here rather
   than appended to the minified page stylesheets, which is how those files
   became unmaintainable in the first place.
   ========================================================================== */

/* Agents — the header's action buttons ran 436px wide inside a 317px column
   at 360px, so the page scrolled sideways. */
.udan-workspace .agents-heading,
.udan-workspace .agents-heading-actions {
    flex-wrap: wrap;
}

.udan-workspace .agents-heading-actions > .btn {
    flex: 1 1 auto;
}

/* Activities — `.activities-filters` is a flex row of fixed-width selects with
   no wrap above 1200px, which overflowed a 1440px window by 31px. */
.udan-workspace .activities-filters {
    flex-wrap: wrap;
    row-gap: 8px;
}

.udan-workspace .activities-filters > .btn {
    margin-left: auto;
}

/* Reports — the filter card only collapsed below 700px, so it overflowed
   between 701px and 820px. */
@media (max-width: 820px) {
    .udan-workspace .rw-filters .row > [class*="col-"] {
        flex: 1 1 220px;
        width: auto;
        max-width: 100%;
    }

    .udan-workspace .rw-filters .btn {
        width: 100%;
    }
}

/* ==========================================================================
   12. Tap targets
   --------------------------------------------------------------------------
   Controls (not inline prose links) need a usable touch area. The audit found
   buttons and row actions as short as 13px on phone widths. The query covers
   tablets and any coarse pointer, not just phone widths, because a 768px
   tablet is touched the same way a 390px phone is.
   ========================================================================== */

@media (max-width: 991.98px), (pointer: coarse) {
    .udan-workspace .table td a,
    .udan-workspace .table td button,
    .udan-workspace .activities-reset,
    .udan-workspace .pipe-clear,
    .udan-workspace .lp-back,
    .udan-workspace .lp-shortcut,
    .udan-workspace .dash-text-link,
    .udan-workspace .duplicate-open-link,
    .udan-workspace .duplicate-delete-button,
    .udan-workspace .msg-open-drafts {
        display: inline-flex;
        align-items: center;
        min-height: 32px;
    }

    /* Icon-only row actions also need width, not just height. */
    .udan-workspace .table td .btn-icon,
    .udan-workspace .table td button.btn {
        min-width: 32px;
    }

    /* Anything clickable that is not a dismiss affordance: segmented view
       toggles, DataTables pager links and the "view all" links in panels. */
    .udan-workspace button:not(.btn-close):not(.navbar-toggler),
    .udan-workspace .dataTables_paginate a,
    .udan-workspace .paginate_button {
        min-height: 32px;
    }
}

/* ==========================================================================
   13. Fallout from the type sweep
   --------------------------------------------------------------------------
   A few captions were sized to fit on one line at 9-11px and were set to
   truncate with an ellipsis. At the readability floor they no longer fit, so
   let them wrap rather than hide their own text.
   ========================================================================== */

.udan-workspace .dash-metric > small,
.udan-workspace .dash-metric-label,
.udan-workspace .lead-summary-item small,
.udan-workspace .lead-summary-label {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
}

/* The toolbar-stacking rule in §9 also caught the template's metric tiles,
   which use the same `d-flex justify-content-between` shape to put a value on
   the left and an icon on the right. Those should stay side by side.
   Written as a restore so browsers without :has() keep the stacked layout,
   which is merely plainer, not broken. */
@media (max-width: 767.98px) {
    .udan-workspace .card-body > .d-flex.justify-content-between:has(> .content-left) {
        flex-direction: row;
        align-items: flex-start !important;
    }
}

/* ==========================================================================
   14. Table viewport — the list pattern every CRM screen uses
   --------------------------------------------------------------------------
   The complaint was that scrolling the rows scrolled the whole page, so the
   column headers left the screen and you lost track of which column you were
   reading. The fix is to give the table its own scroll box and pin the header
   to the top of it, which is what the reference CRM does.

   Opt in by adding `u-table-viewport` next to `card-datatable`; height comes
   from the viewport minus whatever sits above the table, passed in as
   --u-table-offset so each page can tune it without new CSS.
   ========================================================================== */

.udan-workspace .u-table-viewport {
    --u-table-offset: 330px;
    max-height: calc(100vh - var(--u-table-offset));
    overflow: auto;
    overscroll-behavior: contain;
}

/* The header row is pinned to the top of the scroll box. Each cell needs its
   own background, because a sticky <tr> leaves the cells transparent and the
   rows would show through as they pass underneath. */
.udan-workspace .u-table-viewport thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--u-surface-2) !important;
    box-shadow: inset 0 -1px 0 var(--u-line);
    border-bottom: 0;
}

/* Keep the row actions reachable without scrolling back, the way the first
   column of a spreadsheet stays put. */
.udan-workspace .u-table-viewport thead th:last-child,
.udan-workspace .u-table-viewport tbody td:last-child {
    position: sticky;
    right: 0;
    z-index: 2;
    background: var(--u-surface);
    box-shadow: inset 1px 0 0 var(--u-line-soft);
}

.udan-workspace .u-table-viewport thead th:last-child {
    z-index: 4;
    background: var(--u-surface-2) !important;
}

.udan-workspace .u-table-viewport tbody tr:hover td:last-child {
    background: var(--u-surface-2);
}

/* Sortable headers: the affordance has to be visible before the click, so the
   arrow is always rendered and only gains contrast once a column is active. */
.udan-workspace .u-table-viewport thead th.sorting,
.udan-workspace .u-table-viewport thead th.sorting_asc,
.udan-workspace .u-table-viewport thead th.sorting_desc {
    position: sticky;
    padding-right: 26px;
    cursor: pointer;
    user-select: none;
}

.udan-workspace .u-table-viewport thead th.sorting::after,
.udan-workspace .u-table-viewport thead th.sorting_asc::after,
.udan-workspace .u-table-viewport thead th.sorting_desc::after {
    position: absolute;
    top: 50%;
    right: 9px;
    width: 12px;
    content: "";
    opacity: .35;
    transform: translateY(-50%);
    aspect-ratio: 1;
    background: currentColor;
    transition: opacity .15s ease;
    /* Up/down chevron pair, so the column reads as sortable at rest. */
    -webkit-mask: var(--u-sort-icon) center / 12px no-repeat;
    mask: var(--u-sort-icon) center / 12px no-repeat;
    --u-sort-icon: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5-5 5 5H7zm0 4h10l-5 5-5-5z'/%3E%3C/svg%3E");
}

.udan-workspace .u-table-viewport thead th.sorting:hover::after {
    opacity: .6;
}

.udan-workspace .u-table-viewport thead th.sorting_asc::after {
    opacity: 1;
    color: var(--u-brand);
    --u-sort-icon: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 14l5-5 5 5H7z'/%3E%3C/svg%3E");
}

.udan-workspace .u-table-viewport thead th.sorting_desc::after {
    opacity: 1;
    color: var(--u-brand);
    --u-sort-icon: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5H7z'/%3E%3C/svg%3E");
}

/* DataTables draws its own sort arrows through these pseudo-elements on the
   wrapper; ours replace them. */
.udan-workspace .u-table-viewport thead .dt-column-order,
.udan-workspace .u-table-viewport table.dataTable thead th.sorting::before,
.udan-workspace .u-table-viewport table.dataTable thead th.sorting::after:not(:only-child) {
    display: none !important;
}

@media (max-width: 991.98px) {
    .udan-workspace .u-table-viewport {
        --u-table-offset: 280px;
        max-height: calc(100vh - var(--u-table-offset));
    }
}

@media (max-width: 767.98px) {
    /* On a phone the page itself is the scroll surface; pinning a short box
       inside it fights the browser's own scrolling. */
    .udan-workspace .u-table-viewport {
        max-height: none;
        overflow-x: auto;
        overflow-y: visible;
    }

    .udan-workspace .u-table-viewport thead th {
        position: static;
    }

    .udan-workspace .u-table-viewport thead th:last-child,
    .udan-workspace .u-table-viewport tbody td:last-child {
        position: static;
        box-shadow: none;
    }
}

/* ==========================================================================
   15. Sidebar
   --------------------------------------------------------------------------
   Rewritten as one section. It used to be three layers -- the vendor theme,
   a block in workspace.css behind `#layout-menu`, and an earlier pass here
   -- each overriding the next by id or !important. That is what produced
   the faults the client listed: a section and the child selected inside it
   were both drawn as filled pills, so an open group read as two headings;
   nothing marked a group as having children at all; the submenu labels ran
   past the sidebar's edge and wrapped; and collapsing jumped rather than
   animated.

   The rules below own the sidebar outright: workspace.css now keeps only
   the shell (the box, its internal scroll) and the floating navbar.

   The shape is the one current admin sidebars use: a quiet list of 38px
   rows, one filled pill for where you actually are, a chevron on anything
   that opens, and children hanging off a rail under their parent.

   One selector note, because it cost a round: `.menu-vertical` is a class
   on #layout-menu ITSELF, not on anything inside it, so
   `#layout-menu .menu-vertical .menu-item` matches nothing. Every rule
   here is scoped by `#layout-menu` alone.
   ========================================================================== */

.udan-workspace #layout-menu {
    --u-sidebar-w: 268px;
    --u-sidebar-w-collapsed: 76px;
    --u-sidebar-brand-h: 64px;
    --u-sidebar-footer-h: 72px;
    --u-sidebar-ease: cubic-bezier(.4, 0, .2, 1);
}

/* ---- The box ------------------------------------------------------------
   Width lives here and nowhere else, in both states explicitly. An earlier
   pass found that overriding only the collapsed case from this file did not
   reliably win the cascade (template-customizer.js re-inserts the vendor
   stylesheet at runtime, landing it later than expected), so the competing
   declaration in workspace.css was removed outright rather than
   out-specified. That still holds: this is the only source for the
   property.

   268px, not the old 236px: "WhatsApp Templates" and "Attendance Register"
   are real labels in this menu and at 236px they wrapped onto a second line
   inside a 40px row. The collapsed width matches core.css's own 5.25rem. */
.udan-workspace #layout-menu {
    position: relative;
    width: var(--u-sidebar-w) !important;
    /* workspace.css sets `height: auto !important`, written when the menu
       was long enough to fill the screen on its own. A user whose role
       only unlocks two or three items got a 250px white box in an 800px
       window with Log out stranded in the middle of it. The sidebar is a
       column of the window, so it is as tall as the window whatever is in
       it. */
    height: 100vh !important;
    height: 100dvh !important;
    background: var(--u-surface) !important;
    border-right: 1px solid var(--u-line);
    box-shadow: none;
    transition: width .24s var(--u-sidebar-ease);
}

html.layout-menu-collapsed:not(.layout-menu-hover) .udan-workspace #layout-menu {
    width: var(--u-sidebar-w-collapsed) !important;
}

/* The rule above has an ID selector, which outranks the vendor's own
   `.layout-menu-fixed .layout-menu { position: fixed }` (core.css, >=1200px)
   on specificity alone -- that silently turned the sidebar back into a
   normal in-flow element, so it scrolled away with the page. Restore the
   vendor's fixed positioning at the same breakpoint it used, and reserve
   the space it no longer occupies in the flex flow. */
@media (min-width: 1200px) {
    .udan-workspace #layout-menu {
        position: fixed;
        top: 0;
        right: auto;
        bottom: 0;
        left: 0;
    }

    .udan-workspace .layout-page {
        margin-left: var(--u-sidebar-w, 268px);
        transition: margin-left .24s var(--u-sidebar-ease);
    }

    html.layout-menu-collapsed .udan-workspace .layout-page {
        margin-left: var(--u-sidebar-w-collapsed, 76px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .udan-workspace #layout-menu,
    .udan-workspace .layout-page,
    .udan-workspace #layout-menu .menu-link > div,
    .udan-workspace #layout-menu .menu-toggle::after {
        transition: none !important;
    }
}

/* ---- The brand row ------------------------------------------------------ */
.udan-workspace .udan-brand {
    display: flex;
    align-items: center;
    min-height: var(--u-sidebar-brand-h);
    padding: 12px 16px;
    overflow: hidden;
    border-bottom: 1px solid var(--u-line-soft);
}

.udan-workspace .udan-brand .app-brand-link {
    display: flex;
    min-width: 0;
    align-items: center;
    overflow: hidden;
}

.udan-workspace .udan-brand img {
    width: 112px;
    max-width: 100%;
    height: auto;
    transition: width .24s var(--u-sidebar-ease), opacity .15s ease;
}

/* ---- The scrolling list ------------------------------------------------
   An explicit calc against the viewport, not flex: 1 1 0 -- #layout-menu's
   own height is auto (it only caps at 100dvh), and a flex-basis:0 child in
   an auto-height column has no available space to grow into, so the menu
   nearly disappeared when that was tried. */
.udan-workspace #layout-menu > .menu-inner {
    flex: 0 1 auto !important;
    max-height: calc(100vh - var(--u-sidebar-brand-h) - var(--u-sidebar-footer-h)) !important;
    max-height: calc(100dvh - var(--u-sidebar-brand-h) - var(--u-sidebar-footer-h)) !important;
    /* The 7px scrollbar is drawn inside this element, so the rows stop
       short of it rather than running under it -- the chevrons on the
       sections used to be half-hidden behind the thumb. */
    padding: 10px 0 14px !important;
    overflow-x: hidden !important;
    scrollbar-color: #c7cedb transparent;
}

.udan-workspace #layout-menu > .menu-inner::-webkit-scrollbar { width: 7px; }

.udan-workspace #layout-menu > .menu-inner::-webkit-scrollbar-thumb {
    background: #c7cedb;
    border: 1px solid var(--u-surface);
    border-radius: 7px;
}

.udan-workspace #layout-menu > .menu-inner::-webkit-scrollbar-thumb:hover { background: #a7b1c4; }

/* vendor/js/menu.js starts Perfect Scrollbar on .menu-inner whenever
   window.PerfectScrollbar exists -- true here -- but perfect-scrollbar.css
   was never linked, so PS's injected rails fell back to position:static and
   rendered their JS-measured height as literal block content, roughly
   doubling the menu's scrollHeight. This element has a working native
   scrollbar; PS is duplicate machinery, so its markup is hidden outright. */
.udan-workspace #layout-menu > .menu-inner > .ps__rail-x,
.udan-workspace #layout-menu > .menu-inner > .ps__rail-y { display: none !important; }

/* A quiet, constant cue that the list continues, sitting just above the
   pinned footer rather than at the sidebar's own bottom edge. */
.udan-workspace #layout-menu::after {
    position: absolute;
    right: 1px;
    bottom: var(--u-sidebar-footer-h);
    left: 0;
    z-index: 2;
    height: 24px;
    content: "";
    pointer-events: none;
    background: linear-gradient(to bottom, transparent, var(--u-surface) 85%);
}

/* ---- A row -------------------------------------------------------------
   38px, 13px text, one weight for everything that is not where you are.
   The old rows were 46px tall at 14px/600, which made eighteen ordinary
   links all shout and fit nine of them on a laptop screen. */
/* The gutter lives on the link, not on the <li> and not on the list.
   .menu-inner is a flex container and the rows are its items, so neither a
   margin on the <li> nor padding on the list reliably inset them -- the row
   kept stretching to the full width and the chevrons ended up half under
   the scrollbar. A margin on the link always insets it, whatever the <li>
   is doing. 16px on the right rather than 10 leaves room for the 7px
   scrollbar beside it. */
.udan-workspace #layout-menu .menu-inner > .menu-item { margin: 1px 0; }

.udan-workspace #layout-menu .menu-item .menu-link {
    position: relative;
    display: flex;
    min-height: 38px;
    align-items: center;
    gap: 10px;
    /* The vendor gives .menu-link `margin: 0 1rem`, which pushed every row
       16px right of the <li> that is supposed to position it -- harmless
       while expanded, visibly off-centre at 76px wide. The gutter belongs
       to the <li>. */
    margin: 0 16px 0 10px;
    padding: 8px 12px;
    border-radius: 9px;
    color: var(--u-ink-3);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    transition: background-color .15s ease, color .15s ease;
}

/* The label, not the link, is what must not overflow: a long one is cut
   with an ellipsis instead of wrapping into a second line or running past
   the sidebar's edge, which is what "WhatsApp Templates" used to do. */
.udan-workspace #layout-menu .menu-link > div {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: opacity .12s ease;
}

.udan-workspace #layout-menu .menu-item .menu-link .menu-icon {
    display: inline-flex;
    width: 22px;
    height: 22px;
    flex: none;
    align-items: center;
    justify-content: center;
    margin: 0;
    color: var(--u-muted);
    font-size: 19px;
    transition: color .15s ease;
}

.udan-workspace #layout-menu .menu-item .menu-link:hover {
    background: var(--u-surface-2);
    color: var(--u-ink);
}

.udan-workspace #layout-menu .menu-item .menu-link:hover .menu-icon { color: var(--u-ink-2); }

/* ---- "This one opens" --------------------------------------------------
   Nothing used to distinguish a section from a link, so Templates, Reports
   and Settings looked exactly like Activities until you clicked one. The
   vendor draws a caret with a bordered ::after; it is given a real size and
   colour here and it turns as the section opens. */
/* Room for the chevron, so a long section name is cut by the ellipsis
   before it reaches it rather than running underneath. */
.udan-workspace #layout-menu .menu-link.menu-toggle { padding-right: 30px; }

.udan-workspace #layout-menu .menu-item .menu-toggle::after {
    right: 12px;
    width: .4em;
    height: .4em;
    border-width: 1.5px;
    border-color: var(--u-faint);
    opacity: 1;
    transition: transform .22s var(--u-sidebar-ease), border-color .15s ease, opacity .12s ease;
}

.udan-workspace #layout-menu .menu-item .menu-toggle:hover::after { border-color: var(--u-ink-3); }

.udan-workspace #layout-menu .menu-item.open:not(.menu-item-closing) > .menu-toggle::after {
    border-color: var(--u-brand);
}

/* ---- Where you are -----------------------------------------------------
   One filled pill on the page you are actually on, and only one. A leaf
   item in the top list takes it; so does the selected child of an open
   section. The section's own row never does -- it is a container, not a
   destination, and filling it as well put two pills one inside the other.
   That is the "dono selected" the client described. */
.udan-workspace #layout-menu .menu-item.active > .menu-link:not(.menu-toggle) {
    background: var(--u-brand-soft) !important;
    color: var(--u-brand) !important;
    font-weight: 650;
}

.udan-workspace #layout-menu .menu-item.active > .menu-link:not(.menu-toggle) .menu-icon {
    color: var(--u-brand) !important;
}

/* An open or current section instead says "you are inside here" with its
   icon and a firmer label -- no fill, so the child's pill is the only
   filled thing in the group. */
.udan-workspace #layout-menu .menu-item.open > .menu-link.menu-toggle,
.udan-workspace #layout-menu .menu-item.active > .menu-link.menu-toggle {
    background: transparent !important;
    color: var(--u-ink) !important;
    font-weight: 600;
}

.udan-workspace #layout-menu .menu-item.open > .menu-link.menu-toggle:hover,
.udan-workspace #layout-menu .menu-item.active > .menu-link.menu-toggle:hover {
    background: var(--u-surface-2) !important;
}

.udan-workspace #layout-menu .menu-item.open > .menu-link.menu-toggle .menu-icon,
.udan-workspace #layout-menu .menu-item.active > .menu-link.menu-toggle .menu-icon {
    color: var(--u-brand) !important;
}

/* The vendor theme's own left bracket on an active top-level item sat at
   left:-10px, outside the row, and drew a stray mark next to the pill. The
   pill is the marker. */
.udan-workspace #layout-menu .menu-inner > .menu-item.active > .menu-link::before,
.udan-workspace #layout-menu .menu-inner > .menu-item.active::before { display: none !important; }

/* ---- Children ----------------------------------------------------------
   They hang off a rail under their parent, each with its own smaller icon,
   so the group reads as a parent and its children rather than a flat list
   that happens to be indented. */
.udan-workspace #layout-menu .menu-sub {
    position: relative;
    margin: 2px 0 6px;
    padding-left: 0;
}

.udan-workspace #layout-menu .menu-sub::before {
    position: absolute;
    top: 2px;
    bottom: 2px;
    /* Measured, not guessed: .menu-sub starts at x=10 inside the sidebar and
       a child's pill at x=48, so 40 here and -8 on the lit segment below
       put both on the same 40px line, between the parent's icon (x=22) and
       the child's (x=59). */
    left: 40px;
    width: 1.5px;
    content: "";
    border-radius: 2px;
    background: var(--u-line);
}

.udan-workspace #layout-menu .menu-sub .menu-item { margin: 1px 0; }

.udan-workspace #layout-menu .menu-sub .menu-link {
    min-height: 34px;
    /* The pill starts to the right of the rail (x=40) rather than
       swallowing it, so the rail reads as the thing the children hang off
       instead of a line drawn through them. */
    margin: 0 16px 0 48px;
    padding: 6px 11px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 500;
}

.udan-workspace #layout-menu .menu-sub .menu-link .menu-icon {
    width: 18px !important;
    height: 18px !important;
    font-size: 15px !important;
}

.udan-workspace #layout-menu .menu-sub .menu-item.active > .menu-link {
    background: var(--u-brand-soft) !important;
    color: var(--u-brand) !important;
    font-weight: 650;
}

.udan-workspace #layout-menu .menu-sub .menu-item.active > .menu-link .menu-icon { color: var(--u-brand) !important; }

/* The lit length of rail: this is the part that says "inside this section",
   which brand-coloured text alone never did. */
.udan-workspace #layout-menu .menu-sub .menu-item.active > .menu-link:not(.menu-toggle)::after {
    position: absolute;
    top: 50%;
    left: -8px;
    width: 1.5px;
    height: 18px;
    content: "";
    transform: translateY(-50%);
    border-radius: 2px;
    background: var(--u-brand);
}

/* The vendor draws a bullet dot before every submenu label. The icon and
   the pill already identify the row; the dot is clutter. */
.udan-workspace #layout-menu .menu-sub > .menu-item > .menu-link:before,
.udan-workspace #layout-menu .menu-sub > .menu-item.active > .menu-link:not(.menu-toggle):before { display: none !important; }

.udan-workspace #layout-menu #crm-settings-menu .menu-link.menu-toggle { padding-inline-end: 26px; }
.udan-workspace #layout-menu .crm-settings-submenu::before { inset-inline-start: 55px; }
.udan-workspace #layout-menu .crm-settings-submenu .menu-link { margin-inline-start: 63px; }
.udan-workspace #layout-menu .crm-settings-submenu .menu-link > div {
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.3;
}

/* ---- Section headings --------------------------------------------------- */
.udan-workspace #layout-menu .menu-header {
    margin: 16px 0 4px;
    padding: 0 22px;
}

.udan-workspace #layout-menu .menu-header-text {
    color: var(--u-faint);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .7px;
    white-space: nowrap;
}

/* ---- The pinned footer -------------------------------------------------
   A sibling of .menu-inner (menu.blade.php), not one of its list items, so
   Log out never scrolls away with the rest of the menu. Its height is the
   same value the bottom fade and the list's max-height key off. */
.udan-workspace .udan-sidebar-footer {
    flex: 0 0 auto;
    /* Pushed to the foot of the column rather than left trailing whatever
       the menu's own length happens to be: the client's "logout button
       bottom me hi honi chahiye, chahe beech me space rahe". */
    margin-top: auto;
    min-height: var(--u-sidebar-footer-h);
    border-top: 1px solid var(--u-line-soft);
}

.udan-workspace .udan-sidebar-logout {
    display: flex;
    width: 100%;
    min-height: 44px;
    align-items: center;
    gap: 10px;
    margin: 8px 10px 0;
    padding: 8px 11px;
    width: calc(100% - 20px);
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--u-ink-3);
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
}

.udan-workspace .udan-sidebar-logout .menu-icon {
    display: inline-flex;
    width: 22px;
    height: 22px;
    flex: none;
    align-items: center;
    justify-content: center;
    /* The vendor gives .menu-icon its own margin and colour; both have to go
       or the icon sits off-centre in the collapsed rail and stays black
       while the label beside it is muted. */
    margin: 0 !important;
    color: inherit;
    font-size: 19px;
}

.udan-workspace .udan-sidebar-logout:hover {
    background: var(--u-danger-soft);
    color: var(--u-danger);
}

.udan-workspace .udan-sidebar-copyright {
    padding: 4px 16px 8px;
    color: var(--u-faint);
    font-size: 10.5px;
    text-align: center;
    white-space: nowrap;
}

/* ---- The collapse toggle -----------------------------------------------
   theme-default.css ships its own `.app-brand .layout-menu-toggle` rule
   (position:absolute; left:15rem; opacity:1) for the vendor's hover-reveal
   flyout toggle, and main.js adds `.d-block` to `.layout-menu-toggle` 300ms
   after hovering the menu -- implying it is invisible the rest of the time.
   That is a reasonable pattern for ITS placement and wrong for this one,
   which sits in the brand row and should always be visible. Pinning
   position/opacity here is what opts this button out of both behaviours. */
.udan-workspace .udan-sidebar-toggle {
    position: static !important;
    left: auto !important;
    display: inline-flex;
    width: 28px;
    height: 28px;
    flex: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--u-line);
    border-radius: 8px;
    background: var(--u-surface);
    color: var(--u-ink-3);
    font-size: 18px;
    opacity: 1 !important;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

/* The mobile close (x) carries the same vendor baggage as the desktop
   toggle -- theme-default.css absolutely positions `.app-brand
   .layout-menu-toggle` at left:15rem, which hung it half outside the
   drawer's own edge. It belongs in the brand row, at its end. */
.udan-workspace .udan-brand .udan-menu-button {
    position: static !important;
    left: auto !important;
    flex: none;
    margin-left: auto;
    border-radius: 8px;
    opacity: 1 !important;
    transform: none !important;
}

.udan-workspace .udan-sidebar-toggle:hover {
    border-color: var(--u-brand);
    background: var(--u-brand-soft);
    color: var(--u-brand);
}

.udan-workspace .udan-sidebar-toggle i {
    display: block;
    transition: transform .24s var(--u-sidebar-ease);
}

/* The chevron points at what the next click will do. */
html.layout-menu-collapsed .udan-workspace .udan-sidebar-toggle i { transform: rotate(180deg); }

/* ---- Collapsed ---------------------------------------------------------
   Icon-only. The labels fade out rather than vanishing on the first frame,
   and nothing re-wraps on the way (every row is white-space:nowrap and the
   list clips its overflow), which is what made the old collapse look like
   a jolt rather than a slide.

   toggleCollapsed() puts the class on <html>, not on the <body
   class="udan-workspace"> the rest of these rules key off, so these
   selectors deliberately do not require .udan-workspace on the same
   element. */
html.layout-menu-collapsed:not(.layout-menu-hover) .udan-workspace #layout-menu .menu-link > div,
html.layout-menu-collapsed:not(.layout-menu-hover) .udan-workspace .udan-sidebar-logout span,
html.layout-menu-collapsed:not(.layout-menu-hover) .udan-workspace .menu-header-text {
    opacity: 0;
}

html.layout-menu-collapsed:not(.layout-menu-hover) .udan-workspace #layout-menu .menu-item .menu-link,
html.layout-menu-collapsed:not(.layout-menu-hover) .udan-workspace .udan-sidebar-logout {
    justify-content: center !important;
    gap: 0;
    margin: 0 10px;
    padding-right: 8px;
    padding-left: 8px;
}

html.layout-menu-collapsed:not(.layout-menu-hover) .udan-workspace #layout-menu .menu-link > div,
html.layout-menu-collapsed:not(.layout-menu-hover) .udan-workspace .udan-sidebar-logout span {
    width: 0;
    flex: 0 0 0;
    overflow: hidden;
}

html.layout-menu-collapsed:not(.layout-menu-hover) .udan-workspace #layout-menu .menu-toggle::after { opacity: 0; }

html.layout-menu-collapsed:not(.layout-menu-hover) .udan-workspace .udan-brand {
    justify-content: center;
    padding-right: 8px;
    padding-left: 8px;
}

/* The logo is a wordmark, so there is no 40px version of it that reads as
   anything. Collapsed, the row carries the toggle alone, centred. */
html.layout-menu-collapsed:not(.layout-menu-hover) .udan-workspace .udan-brand .app-brand-link { display: none; }
html.layout-menu-collapsed:not(.layout-menu-hover) .udan-workspace .udan-sidebar-toggle { margin: 0 auto !important; }

html.layout-menu-collapsed .udan-workspace .udan-sidebar-copyright { display: none; }

/* The fade only makes sense while the list is genuinely icon-only, not
   during the vendor's hover flyout. */
html.layout-menu-collapsed:not(.layout-menu-hover) .udan-workspace #layout-menu::after { display: none; }

/* ---- Off-canvas, below 1200px ------------------------------------------
   The vendor slides the whole sidebar in from the left with a backdrop; all
   this adds is that it slides at the same speed and curve as everything
   else, and that it is never left at the collapsed width on a phone --
   where there is no toggle to bring it back. */
@media (max-width: 1199.98px) {
    .udan-workspace #layout-menu {
        width: min(var(--u-sidebar-w), 86vw) !important;
        transition: transform .24s var(--u-sidebar-ease);
    }

    .udan-workspace .layout-page { margin-left: 0 !important; }

    .udan-workspace #layout-menu .menu-link > div,
    .udan-workspace .udan-sidebar-logout span,
    .udan-workspace .menu-header-text { opacity: 1 !important; }

    .udan-workspace #layout-menu .menu-item .menu-link {
        justify-content: flex-start;
        gap: 10px;
    }
}

/* ==========================================================================
   16. Lead filters — one trigger instead of five competing controls
   --------------------------------------------------------------------------
   The toolbar used to be: a user picker, a search box, a status select, a
   source select, and a follow-up-date select, all fighting for the same row
   and wrapping awkwardly below ~1100px. Only Search stays inline now; every
   other field moved into #leadFiltersModal (see leads/index.blade.php) with
   the same ids, so new_lead.js's existing change handlers did not change.
   ========================================================================== */

.udan-workspace .lead-filters-trigger {
    position: relative;
    gap: 7px;
}

.udan-workspace .lead-filters-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--u-brand);
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1;
}

/* This modal carries the .modal-right class to opt OUT of workspace.css's
   generic "every modal is a full-height right-slide panel" rule — the same
   escape hatch #assignLeadModal already uses — then defines its own small
   centred dialog here, which fits four fields far better than a full-height
   drawer would. */
/* The vendor theme already renders .modal-dialog as a flex container with
   align-items:center, which is what vertically centres it — not a margin
   trick. Setting a vertical margin here (as #assignLeadModal's own override
   does) stacks on top of that flex centring instead of replacing it, which
   inflates the dialog's own box well past its content and made the close
   button, positioned relative to the header, land above the visible card.
   Horizontal sizing only; vertical stays with the theme's flex centring. */
.udan-workspace #leadFiltersModal .modal-dialog {
    width: calc(100% - 28px);
    max-width: 420px !important;
}

.udan-workspace #leadFiltersModal .modal-content {
    border: 1px solid var(--u-line) !important;
    border-radius: var(--u-radius-lg) !important;
    box-shadow: var(--u-shadow-lg);
}

.udan-workspace .lead-filters-modal .modal-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.udan-workspace .lead-filters-modal .modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.udan-workspace .lead-filters-modal .lead-filter-field {
    display: block;
    width: 100%;
}

.udan-workspace .lead-filters-modal .lead-filter-field > label {
    display: block;
    margin-bottom: 6px;
    font-size: var(--u-text-xs);
    font-weight: 650;
    color: var(--u-ink-3);
}

.udan-workspace .lead-filters-modal .lead-followup-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.udan-workspace .lead-filters-modal .lead-custom-date-range {
    display: flex;
    gap: 10px;
}

.udan-workspace .lead-filters-modal .lead-custom-date-range label {
    flex: 1;
    font-size: var(--u-text-xs);
    color: var(--u-muted);
}

/* ==========================================================================
   17. Lead directory search bar
   --------------------------------------------------------------------------
   Now that only Search + the Filters trigger + Reset remain, the row reads
   as one coherent toolbar instead of a shelf of dropdowns. The search box's
   own rule (leads-workspace.css) is `width: min(420px, 100%)`; as a flex item
   with the default flex-basis:auto, that computed width becomes its flex
   basis, and the `100%` branch of min() resolves against this row rather
   than staying capped at 420px — it grew to fill the whole toolbar instead
   of sitting beside Filters. flex-basis here is what actually constrains it.
   ========================================================================== */

.udan-workspace .leads-toolbar-find .lead-search {
    flex: 0 1 320px;
    width: auto;
    max-width: 420px;
}

/* ==========================================================================
   18. Action column
   --------------------------------------------------------------------------
   The column had no width constraint, so the table gave it whatever space
   was left over after the other columns, leaving the icons stranded on the
   left with a wide gutter of nothing to their right. It also used flat white
   30px boxes with no visual distinction between WhatsApp / SMS / Call /
   Follow-up — functional, but forgettable. Tightened to content width, and
   recoloured each action with a soft tint of its own.
   ========================================================================== */

/* leads-workspace.css fixes the last column at 210px with !important (a
   leftover from an earlier redesign pass), AND forces table-layout:fixed
   !important on this table. Those two combine badly: under fixed layout a
   column's width is taken literally rather than grown to fit content, so
   `width: 1%` — the normal "shrink to content" trick — collapsed the column
   to nothing instead of sizing it, clipping the action icons out of view.
   Fixed layout needs a real pixel width; 132px fits 3 icons (28px, 4px gap)
   plus the cell's own padding, with a little room to spare. */
.udan-workspace table.data-table th.u-col-actions,
.udan-workspace table.data-table td:has(.crm-lead-actions),
.udan-workspace .leads-workspace table.data-table th:last-child,
.udan-workspace .leads-workspace table.data-table td:last-child {
    width: 132px !important;
    min-width: 132px !important;
    max-width: 132px !important;
    white-space: nowrap;
}

.udan-workspace table.data-table th.u-col-name {
    min-width: 170px;
}

.udan-workspace .crm-lead-actions {
    display: inline-flex;
    gap: 4px;
}

.udan-workspace .lead-quick-icon {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--u-surface-2);
    color: var(--u-muted);
    transition: transform .12s ease, background-color .12s ease, color .12s ease, border-color .12s ease;
}

.udan-workspace .lead-quick-icon i {
    font-size: 15px;
}

.udan-workspace .lead-quick-icon:hover {
    transform: translateY(-1px);
    border-color: transparent;
}

.udan-workspace .lead-quick-icon.is-whatsapp {
    background: #e4f6ef;
    color: #15935f;
}

.udan-workspace .lead-quick-icon.is-whatsapp:hover {
    background: #c9edda;
    color: #0d7a4c;
}

.udan-workspace .lead-quick-icon.is-sms {
    background: var(--u-brand-soft);
    color: var(--u-brand);
}

.udan-workspace .lead-quick-icon.is-sms:hover {
    background: #e0deff;
    color: var(--u-brand-strong);
}

.udan-workspace .lead-quick-icon.is-call {
    background: var(--u-info-soft);
    color: var(--u-info);
}

.udan-workspace .lead-quick-icon.is-call:hover {
    background: #d7e8fc;
    color: #1d5cb8;
}

.udan-workspace .lead-quick-icon.is-activity {
    width: 28px;
    min-width: 28px;
    background: var(--u-warning-soft);
    color: var(--u-warning);
}

.udan-workspace .lead-quick-icon.is-activity:hover {
    background: #faeac6;
    color: #93631a;
}

.udan-workspace .lead-quick-icon.is-activity span {
    display: none;
}

/* ==========================================================================
   19. Lead quick-view panel (right-side drawer)
   --------------------------------------------------------------------------
   Opens on a lead-name click instead of the old full-page navigation to
   leads/show. Content is a server-rendered fragment
   (leads/partials/quick-panel.blade.php) fetched by lead-quick-panel.js and
   injected whole, so its styling lives here rather than scattered across the
   page stylesheets the rest of this file is already cleaning up after.
   ========================================================================== */

.udan-workspace .lead-quick-panel {
    width: min(420px, 100vw);
    border-left: 1px solid var(--u-line);
}

.udan-workspace .lead-quick-panel .offcanvas-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--u-line-soft);
}

.udan-workspace .lead-quick-panel .offcanvas-title {
    font-size: var(--u-text-lg);
    font-weight: 650;
    color: var(--u-ink);
}

.udan-workspace .lead-quick-panel .offcanvas-body {
    padding: 22px;
}

.udan-workspace .lqp-loading,
.udan-workspace .lqp-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 60px 10px;
    color: var(--u-muted);
    font-size: var(--u-text-sm);
    text-align: center;
}

.udan-workspace .lqp-error i {
    font-size: 28px;
    color: var(--u-danger);
}

.udan-workspace .lqp-person {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--u-line-soft);
}

.udan-workspace .lqp-avatar {
    display: grid;
    width: 46px;
    height: 46px;
    flex: none;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--u-brand), var(--u-brand-strong));
    color: #fff;
    font-size: 18px;
    font-weight: 700;
}

.udan-workspace .lqp-person-main {
    flex: 1;
    min-width: 0;
}

.udan-workspace .lqp-name {
    margin: 0;
    overflow: hidden;
    color: var(--u-ink);
    font-size: var(--u-text-lg);
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.udan-workspace .lqp-code {
    display: block;
    margin-top: 2px;
    color: var(--u-faint);
    font-size: var(--u-text-xs);
    letter-spacing: .3px;
}

.udan-workspace .lqp-person-side {
    display: flex;
    flex: none;
    align-items: center;
    gap: 8px;
}

.udan-workspace .lqp-edit-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--u-line);
    border-radius: var(--u-radius-sm);
    color: var(--u-muted);
    font-size: 15px;
    text-decoration: none;
}

.udan-workspace .lqp-edit-link:hover {
    border-color: var(--u-brand);
    background: var(--u-brand-soft);
    color: var(--u-brand);
}

/* Assigned to — a quiet row between the action icons and the field grid,
   collapsing to a plain name when the viewer cannot reassign. */
.udan-workspace .lqp-assigned {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.udan-workspace .lqp-assigned-label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--u-muted);
    font-size: var(--u-text-xs);
    font-weight: 600;
}

.udan-workspace .lqp-assigned-label i {
    font-size: 15px;
    color: var(--u-faint);
}

.udan-workspace .lqp-assigned-name {
    color: var(--u-ink);
    font-size: var(--u-text-sm);
}

.udan-workspace .lqp-assigned-control {
    display: flex;
    gap: 6px;
    max-width: 230px;
}

.udan-workspace .lqp-assigned-control .form-select {
    min-height: 32px;
    font-size: 12px;
}

.udan-workspace .lqp-assigned-control .lqp-assign-submit {
    flex: none;
    width: 32px;
    height: 32px;
    padding: 0;
}

/* Missing-phone prompt — only the WhatsApp/SMS/Call buttons actually need a
   number, so this explains the gap rather than leaving the fields silently
   blank. */
.udan-workspace .lqp-missing-phone {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px solid var(--u-warning-soft);
    border-radius: var(--u-radius);
    background: var(--u-warning-soft);
}

.udan-workspace .lqp-missing-phone i {
    flex: none;
    font-size: 20px;
    color: var(--u-warning);
}

.udan-workspace .lqp-missing-phone strong {
    display: block;
    color: var(--u-ink);
    font-size: var(--u-text-xs);
}

.udan-workspace .lqp-missing-phone p {
    margin: 3px 0 0;
    color: var(--u-ink-3);
    font-size: 11.5px;
    line-height: 1.5;
}

.udan-workspace .lqp-actions {
    display: flex;
    gap: 8px;
    margin: 16px 0;
}

.udan-workspace .lqp-actions .lead-quick-icon,
.udan-workspace .lqp-actions .lead-action-form {
    width: auto;
    min-width: 0;
    flex: 1;
}

.udan-workspace .lqp-actions .lead-quick-icon {
    width: 100%;
    height: 38px;
    border-radius: var(--u-radius-sm);
}

.udan-workspace .lqp-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 18px;
    margin: 0;
    padding: 16px;
    border: 1px solid var(--u-line-soft);
    border-radius: var(--u-radius);
    background: var(--u-surface-2);
}

.udan-workspace .lqp-fields > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.udan-workspace .lqp-fields dt {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--u-muted);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .3px;
    text-transform: uppercase;
}

.udan-workspace .lqp-fields dt i {
    font-size: 13px;
    color: var(--u-faint);
}

.udan-workspace .lqp-fields dd {
    margin: 0;
    color: var(--u-ink);
    font-size: var(--u-text-sm);
    font-weight: 650;
}

.udan-workspace .lqp-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.udan-workspace .lqp-note {
    margin-top: 16px;
    padding: 14px;
    border: 1px solid var(--u-line-soft);
    border-radius: var(--u-radius);
    background: var(--u-surface-2);
}

.udan-workspace .lqp-note strong {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--u-ink-3);
    font-size: var(--u-text-xs);
}

.udan-workspace .lqp-note p {
    margin: 8px 0 0;
    color: var(--u-ink-2);
    font-size: var(--u-text-sm);
    line-height: 1.6;
    white-space: pre-line;
}

.udan-workspace .lqp-history {
    margin-top: 20px;
}

.udan-workspace .lqp-history-heading strong {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--u-ink-3);
    font-size: var(--u-text-xs);
}

.udan-workspace .lqp-history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.udan-workspace .lqp-history-loading,
.udan-workspace .lqp-history-empty {
    color: var(--u-faint);
    font-size: var(--u-text-xs);
}

.udan-workspace .lqp-history-item {
    padding: 10px 12px;
    border: 1px solid var(--u-line-soft);
    border-radius: var(--u-radius-sm);
    background: var(--u-surface-2);
}

.udan-workspace .lqp-history-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.udan-workspace .lqp-history-item-top strong {
    color: var(--u-ink-2);
    font-size: var(--u-text-xs);
}

.udan-workspace .lqp-history-item-top span {
    color: var(--u-faint);
    font-size: 10.5px;
    white-space: nowrap;
}

.udan-workspace .lqp-history-item p {
    margin: 6px 0 0;
    color: var(--u-ink-3);
    font-size: var(--u-text-xs);
    line-height: 1.5;
}

.udan-workspace .lqp-history-item small {
    display: block;
    margin-top: 4px;
    color: var(--u-faint);
    font-size: 10.5px;
}

.udan-workspace .lqp-footer {
    display: flex;
    gap: 8px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--u-line-soft);
}

.udan-workspace .lqp-footer .btn {
    flex: 1;
}

@media (max-width: 575.98px) {
    .udan-workspace .lead-quick-panel {
        width: 100vw;
    }

    .udan-workspace .lqp-footer {
        flex-direction: column;
    }
}

/* ==========================================================================
   20. Leads toolbar
   --------------------------------------------------------------------------
   Search/Filters/Reset (what you reach for to find something) sit left;
   the occasional utility actions — Calls today, Assign, Download template,
   Import — are icon-only buttons on the right, full label on hover via the
   browser's own tooltip. A Pipeline shortcut used to live here too; it has
   its own entry under Lead Management in the sidebar, so this was a
   duplicate and is gone.
   ========================================================================== */

.udan-workspace .leads-toolbar-find {
    flex: 1 1 320px;
    min-width: 0;
}

.udan-workspace .leads-toolbar-tools {
    flex: 0 0 auto;
}

.udan-workspace .leads-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--u-line);
    border-radius: var(--u-radius-sm);
    background: var(--u-surface);
    color: var(--u-ink-3);
    font-size: 17px;
    text-decoration: none;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.udan-workspace .leads-tool-btn:hover {
    border-color: var(--u-brand);
    background: var(--u-brand-soft);
    color: var(--u-brand);
}

/* Calls-today carries a count, so it is slightly wider than a square icon
   button rather than truncating the badge. */
.udan-workspace .leads-tool-btn.lead-calls-link {
    width: auto;
    min-width: 38px;
    padding: 0 9px;
}

.udan-workspace .leads-tool-badge {
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--u-danger-soft);
    color: var(--u-danger);
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1.5;
}

@media (max-width: 575.98px) {
    .udan-workspace .leads-toolbar-find,
    .udan-workspace .leads-toolbar-tools {
        flex-basis: 100%;
    }

    .udan-workspace .leads-toolbar-tools {
        justify-content: flex-end;
    }
}

/* ---------------------------------------------------------------------------
   Dark mode bridge.

   The workspace stylesheets were written with light colours baked in, so the
   Light/Dark switch in the header left every custom page white. Rather than
   restyle 38 files, each baked-in colour is rewritten as
   var(--udn-x, <the original colour>): the token is defined only here, under
   html.dark-style, so light mode keeps the exact colour it always had and
   dark mode flips.

   Values follow the theme's own Bootstrap variables so the two stay in step.
--------------------------------------------------------------------------- */
html.dark-style {
    --udn-surface: var(--bs-card-bg, #2b2c40);
    --udn-surface-2: #2f3048;
    --udn-canvas: var(--bs-body-bg, #232333);
    --udn-line: var(--bs-border-color, #444564);
    --udn-line-soft: #3a3b53;
    --udn-ink: #d7d8ea;
    --udn-ink-2: var(--bs-body-color, #a3a4cc);
    --udn-muted: #9a9bb8;
    /* Brand colour used as TEXT: #5b54d6 is unreadable on #232333,
       so it lifts here without touching brand fills elsewhere. */
    --udn-brand-text: #a9a2ff;

    /* The design system's own tokens are used 263 times by this file alone
       and were light-only, which left the whole workspace chrome -- sidebar,
       cards, headers -- white behind the dark theme. */
    --u-surface: var(--bs-card-bg, #2b2c40);
    --u-surface-2: #2f3048;
    --u-canvas: var(--bs-body-bg, #232333);
    --u-line: var(--bs-border-color, #444564);
    --u-line-soft: #3a3b53;

    --u-ink: #d7d8ea;
    --u-ink-2: var(--bs-body-color, #a3a4cc);
    --u-ink-3: #9293b5;
    --u-muted: #8a8ba6;
    --u-faint: #8a8cab;

    /* Accents keep their hue but lift off the dark background. Brand stays
       dark enough that white button text is still legible on it. */
    --u-brand: #7a72e3;
    --u-brand-strong: #938cf0;
    --u-brand-soft: rgba(122, 114, 227, .18);
    --u-brand-ring: rgba(122, 114, 227, .34);
    --u-success: #3ddba4;
    --u-success-soft: rgba(61, 219, 164, .14);
    --u-warning: #e8b457;
    --u-warning-soft: rgba(232, 180, 87, .14);
    --u-danger: #f2748a;
    --u-danger-soft: rgba(242, 116, 138, .14);
    --u-info: #6ea8f5;
    --u-info-soft: rgba(110, 168, 245, .14);

    /* On a dark surface a shadow has to be darker, not lighter. */
    --u-shadow-sm: 0 1px 2px rgba(0, 0, 0, .30);
    --u-shadow: 0 2px 8px rgba(0, 0, 0, .35);
    --u-shadow-lg: 0 12px 32px rgba(0, 0, 0, .45);
}

/* The vendor dark theme's muted grey sits just under a 3:1 ratio on the dark
   canvas, which is where most secondary copy on these pages lives. */
html.dark-style .text-muted { color: #9a9bb8 !important; }

/* ==========================================================================
   Lead chips: status and source
   --------------------------------------------------------------------------
   A status is a state and a source is background, so they are not drawn the
   same. The status is a tinted pill with a dot in its own colour; the source
   is a quiet outline whose only colour is its channel's mark. Both were
   `badge bg-*` before, which is one solid block of saturated colour -- fine
   for a single warning, loud as a column of twenty-five, and no help at all
   in telling the two kinds of fact apart.
   ========================================================================== */

.u-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 23px;
    padding: 0 10px 0 8px;
    border: 1px solid;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    vertical-align: middle;
}

.u-chip .u-chip-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    /* A halo rather than a bigger dot: it reads at a glance without taking
       the weight a second block of colour would. */
    box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 20%, transparent);
}

.u-chip.tone-brand { color: #4f46c9; background: #eeedfc; border-color: #ddd9fa; }
.u-chip.tone-good  { color: #0b7a52; background: #e6f7ef; border-color: #c9ecdd; }
.u-chip.tone-bad   { color: #b4324a; background: #fdecef; border-color: #f8d4db; }
.u-chip.tone-warn  { color: #9a6410; background: #fff4e0; border-color: #fbe3bd; }
.u-chip.tone-info  { color: #1f6bc7; background: #e9f2fe; border-color: #cfe2fb; }
.u-chip.tone-teal  { color: #0b7d85; background: #e5f6f7; border-color: #c6e9ec; }
.u-chip.tone-calm  { color: #5a6a83; background: #f1f4f9; border-color: #e2e8f1; }

html.dark-style .u-chip.tone-brand { color: #a79fff; background: rgba(122,114,227,.16); border-color: rgba(122,114,227,.3); }
html.dark-style .u-chip.tone-good  { color: #5fd3a0; background: rgba(28,160,110,.16); border-color: rgba(28,160,110,.32); }
html.dark-style .u-chip.tone-bad   { color: #ff8f9f; background: rgba(214,70,96,.16); border-color: rgba(214,70,96,.32); }
html.dark-style .u-chip.tone-warn  { color: #f0b163; background: rgba(214,146,38,.16); border-color: rgba(214,146,38,.32); }
html.dark-style .u-chip.tone-info  { color: #7fb4f5; background: rgba(50,122,214,.16); border-color: rgba(50,122,214,.32); }
html.dark-style .u-chip.tone-teal  { color: #5ecfd8; background: rgba(28,150,160,.16); border-color: rgba(28,150,160,.32); }
html.dark-style .u-chip.tone-calm  { color: #9aa7bd; background: rgba(140,155,180,.14); border-color: rgba(140,155,180,.26); }

/* ---- Source --------------------------------------------------------- */

.u-source {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 23px;
    padding: 0 9px 0 7px;
    border: 1px solid var(--u-line, #e3e8ef);
    border-radius: 7px;
    background: var(--u-surface, #fff);
    color: var(--u-ink-3, #5d6b83);
    font-size: 11px;
    font-weight: 650;
    line-height: 1;
    white-space: nowrap;
    vertical-align: middle;
}

.u-source i { font-size: 14px; color: var(--u-muted, #7a8699); }
.u-source.is-google i { color: #d64b3d; }
.u-source.is-facebook i { color: #2b6ad4; }
.u-source.is-instagram i { color: #c4347e; }
.u-source.is-site i { color: #2a9d8f; }
.u-source.is-walkin i { color: #b8762a; }
.u-source.is-reference i { color: #6c59d6; }
.u-source.is-partner i { color: #0f8a93; }

.u-chip-muted { color: var(--u-muted, #7a8699); font-size: 11px; }

/* A collapsed sidebar shows its submenus as flyout panels, where the rail
   and the indent that place a child under its parent have nothing to be
   placed against -- the parent is not on screen. */
html.layout-menu-collapsed .udan-workspace .menu-sub::before { display: none; }
html.layout-menu-collapsed .udan-workspace .menu-sub .menu-item { margin-left: 10px; }

/* The source chip's own dark values, rather than leaning on --u-surface:
   that resolves through the vendor's card background, which is the one
   token that is light until the dark theme's own stylesheet has loaded. */
html.dark-style .u-source {
    border-color: rgba(255, 255, 255, .11);
    background: rgba(255, 255, 255, .04);
    color: #b9bcd0;
}

html.dark-style .u-source i { color: #8a8ba6; }
html.dark-style .u-source.is-google i { color: #ef7363; }
html.dark-style .u-source.is-facebook i { color: #6d9ef3; }
html.dark-style .u-source.is-instagram i { color: #e96bb0; }
html.dark-style .u-source.is-site i { color: #4ec9b8; }
html.dark-style .u-source.is-walkin i { color: #e0a358; }
html.dark-style .u-source.is-reference i { color: #a79cff; }
html.dark-style .u-source.is-partner i { color: #5ecfd8; }

/* ---------------------------------------------------------------------------
   Deals & Payments section strip.

   Defined here rather than in one workspace stylesheet because the three
   pages it appears on load two different ones (deals-workspace.css and
   payments-workspace.css); a shared component needs a shared home.
   --------------------------------------------------------------------------- */
.udan-workspace .deals-sectionnav{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 18px}
.udan-workspace .deals-sectionnav a{display:inline-flex;align-items:center;gap:7px;height:36px;padding:0 14px;border:1px solid var(--u-line);border-radius:999px;background:var(--u-surface);color:var(--u-ink-2);font-size:12px;font-weight:650;text-decoration:none}
.udan-workspace .deals-sectionnav a:hover{border-color:var(--u-brand);color:var(--u-brand)}
.udan-workspace .deals-sectionnav a i{font-size:16px}
.udan-workspace .deals-sectionnav a.is-current{border-color:var(--u-brand);background:var(--u-brand-soft);color:var(--u-brand)}

/* ---------------------------------------------------------------------------
   Sidebar: compact.

   The client's note was "reduce the width, it takes too much screen", with
   bolder menu names and an icon on every row. The width itself is set above
   (236px, down from 272; collapsed 76 from 84) because that number has to
   stay in step with .layout-page's margin, and splitting it across two
   places is how the two get out of step.

   What is left here is the inside of the sidebar: the brand row, the row
   height and the type. Each row loses 6px of height and 1px of type but
   gains weight, which is what makes a narrower menu read as deliberate
   rather than squeezed. An icon was already on every item; the icons are
   kept at 19px so they, not the labels, carry the row when it collapses.
   --------------------------------------------------------------------------- */
.udan-workspace .udan-brand {
    min-height: 60px;
    padding: 13px 16px;
}

.udan-workspace .udan-brand img {
    width: 104px;
}

.udan-workspace .menu-vertical .menu-inner {
    padding: 10px 9px 18px !important;
}

.udan-workspace .menu-vertical .menu-inner > .menu-item {
    margin: 2px 0;
}

.udan-workspace .menu-vertical .menu-item .menu-link {
    min-height: 38px;
    padding: 8px 11px;
    border-radius: 9px;
    font-size: 13px;
    /* Bolder than the old 600: at this width the label is the only thing
       distinguishing one row from the next, so it carries the weight. */
    font-weight: 700;
    letter-spacing: -.1px;
}

.udan-workspace .menu-vertical .menu-item .menu-link .menu-icon {
    margin-right: 9px;
    font-size: 19px;
}

.udan-workspace .menu-vertical .menu-sub .menu-link {
    min-height: 34px;
    padding-left: 38px;
    font-size: 12.5px;
    font-weight: 600;
}

.udan-workspace .menu-vertical .menu-sub .menu-link .menu-icon {
    margin-right: 7px;
    font-size: 16px;
}

.udan-workspace .menu-vertical .menu-header {
    margin: 16px 11px 6px;
    font-size: 9.5px !important;
    letter-spacing: .1em;
}

.udan-workspace .udan-sidebar-logout {
    min-height: 38px;
    padding: 7px 11px;
    font-size: 13px;
    font-weight: 700;
}

.udan-workspace .udan-sidebar-copyright {
    font-size: 10px;
}

/* The menu's own scroll budget is brand row + pinned footer; both just
   shrank, so the list may grow into what they gave back. */
.udan-workspace #layout-menu > .menu-inner {
    max-height: calc(100vh - 60px - var(--u-sidebar-footer-h, 53px)) !important;
    max-height: calc(100dvh - 60px - var(--u-sidebar-footer-h, 53px)) !important;
}

/* ---------------------------------------------------------------------------
   List pages scroll their list, not the page.

   On the leads screen the table body scrolls inside the card while the
   heading, the filters and the column names stay put -- that is a DataTables
   `scrollY` body, which only that one table asks for. Everywhere else the
   whole page moved, so reading row 90 meant losing the filters, the totals
   and the column names off the top. The client asked for the leads
   behaviour on the other screens.

   Doing it with a sticky header and a scrolling wrapper rather than by
   turning on DataTables' own scroller: it works for the hand-written tables
   too (payments, deals, the attendance register, call history), it needs no
   per-page JavaScript, and it does not fight the horizontal scroller the
   wide tables already have.

   Only from 992px up. On a phone a tall page that scrolls as one is right;
   a short scroll box inside a short screen is not.
   --------------------------------------------------------------------------- */
@media (min-width: 992px) {
    /* A table already inside a DataTables scroll body has its own scroller;
       giving it a second one nests two scrollbars in the same place. And a
       table inside a modal is bounded by the modal, not the viewport. */
    .udan-workspace .card-datatable:not(:has(.dataTables_scrollBody)):not(.modal .card-datatable),
    .udan-workspace .pay-table-card > .table-responsive,
    .udan-workspace .deal-table-card > .table-responsive,
    .udan-workspace .calling-table-card > .table-responsive,
    .udan-workspace .att-table-wrap {
        /* Pixels, not rem: the shell above a list (heading, filter row,
           summary tiles) is laid out in pixels, so a rem budget drifts with
           the root font size and the box stops matching the page. */
        max-height: calc(100dvh - 300px);
        min-height: 260px;
        overflow: auto;
        overscroll-behavior: contain;
    }

    /* The column names are what makes row 90 readable, so they stay. A
       background is not optional here: without one the rows scroll
       underneath and show through. */
    .udan-workspace .card-datatable:not(:has(.dataTables_scrollBody)):not(.modal .card-datatable) > table > thead > tr > th,
    .udan-workspace .pay-table-card > .table-responsive > table > thead > tr > th,
    .udan-workspace .deal-table-card > .table-responsive > table > thead > tr > th,
    .udan-workspace .calling-table-card > .table-responsive > table > thead > tr > th {
        position: sticky;
        top: 0;
        z-index: 3;
        background: var(--u-surface-2);
    }

    /* A page may say it would rather scroll as a whole. */
    .udan-workspace .udn-page-scroll .card-datatable,
    .udan-workspace .udn-page-scroll .table-responsive {
        max-height: none;
        overflow: auto;
    }
}

/* ==========================================================================
   18. The status chip as a control
   --------------------------------------------------------------------------
   The client asked for the enrollment register's "pencil on the status" to
   work the same way in the other registers. The state you want to change
   is where a reader already looks, so the chip itself opens the drawer
   rather than a second button sitting beside it in an Actions column.

   One class, used by every register that has it (enrollment case status,
   lead status), because two copies of one control is how they drift apart.
   A row whose status is final renders the plain chip with nothing to press.
   ========================================================================== */

.udan-workspace .u-status-edit {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 5px 3px 3px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease;
}

.udan-workspace .u-status-edit > i {
    color: var(--u-faint);
    font-size: 14px;
    opacity: 0;
    transition: opacity .15s ease;
}

.udan-workspace .u-status-edit:hover,
.udan-workspace .u-status-edit:focus-visible {
    border-color: var(--u-line);
    background: var(--u-surface);
    outline: 0;
}

.udan-workspace .u-status-edit:hover > i,
.udan-workspace .u-status-edit:focus-visible > i {
    color: var(--u-brand);
    opacity: 1;
}

.udan-workspace table td .u-chip { height: 24px; }
