.client-crm-shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: 28px 18px 60px;
}

.client-crm-hero {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 22px;
    padding: 28px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 24px;
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.22), transparent 34%),
        linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.92));
    color: #f8fafc;
}

.client-crm-hero h1 {
    margin: 8px 0 10px;
    font-size: clamp(2rem, 4vw, 3.7rem);
    letter-spacing: -0.055em;
}

.client-crm-hero p {
    max-width: 760px;
    color: #cbd5e1;
}

.client-crm-tenant {
    min-width: 240px;
    padding: 18px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.28);
}

.client-crm-tenant span {
    display: block;
    color: #94a3b8;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 8px;
}

.client-crm-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 18px 0 24px;
}

.client-crm-nav a,
.client-crm-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 14px;
    border-radius: 999px;
    background: #0f172a;
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
    border: 1px solid rgba(15, 23, 42, 0.12);
}

.client-crm-button.ghost {
    background: #ffffff;
    color: #0f172a;
}

.client-crm-grid {
    display: grid;
    gap: 16px;
}

.stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 16px;
}

.stats-grid article,
.action-grid a,
.client-crm-panel {
    background: #ffffff;
    color: #0f172a;
    border: 1px solid rgba(15, 23, 42, 0.10);
    border-radius: 20px;
    box-shadow: 0 16px 42px rgba(15, 23, 42, 0.08);
}

.stats-grid article {
    padding: 20px;
}

.stats-grid span {
    display: block;
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.stats-grid strong {
    display: block;
    font-size: 2.45rem;
    margin: 6px 0;
}

.stats-grid p,
.action-grid span,
.client-crm-panel p,
.client-crm-feature-list span {
    color: #64748b;
}

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

.action-grid a {
    padding: 24px;
    text-decoration: none;
}

.action-grid strong {
    display: block;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.client-crm-panel {
    padding: 26px;
}

.client-crm-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.client-crm-panel h2 {
    margin-top: 0;
    font-size: 2rem;
    letter-spacing: -0.035em;
}

.client-crm-feature-list {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 22px;
}

.client-crm-feature-list div {
    padding: 18px;
    border-radius: 16px;
    background: #f8fafc;
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.client-crm-feature-list strong {
    display: block;
    margin-bottom: 6px;
}

.client-crm-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

@media (max-width: 900px) {
    .client-crm-hero,
    .client-crm-panel-head {
        flex-direction: column;
    }

    .stats-grid,
    .action-grid,
    .client-crm-feature-list {
        grid-template-columns: 1fr;
    }
}

.client-crm-alert {
    margin: 0 0 18px;
    padding: 14px 16px;
    border-radius: 16px;
    background: #eff6ff;
    border: 1px solid rgba(37, 99, 235, 0.18);
    color: #1e3a8a;
}

.client-crm-alert.danger {
    background: #fff7ed;
    border-color: rgba(234, 88, 12, 0.22);
    color: #9a3412;
}

.client-crm-split-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.client-crm-large-action {
    display: block;
    padding: 24px;
    border-radius: 20px;
    text-decoration: none;
    background: #0f172a;
    color: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.14);
}

.client-crm-large-action:nth-child(2) {
    background: #ffffff;
    color: #0f172a;
}

.client-crm-large-action strong {
    display: block;
    margin-bottom: 8px;
    font-size: 1.25rem;
}

.client-crm-large-action span {
    color: inherit;
    opacity: 0.78;
}

@media (max-width: 900px) {
    .client-crm-split-actions {
        grid-template-columns: 1fr;
    }
}

/* CRM_UI_CLIENT_FOUNDATION */
.client-crm-page,
.hu-dashboard,
.profile-shell{
    width:min(1120px,calc(100% - 32px));
    max-width:1120px;
    margin:0 auto;
    padding:42px 0 80px;
}
.client-crm-card,
.client-crm-panel,
.todo-card,
.profile-card,
.hu-section,
.hu-card{
    border:1px solid rgba(148,163,184,.24)!important;
    border-radius:22px!important;
    background:rgba(15,23,42,.72)!important;
    color:#eaf2ff!important;
    box-shadow:0 18px 50px rgba(0,0,0,.20)!important;
}
.client-crm-card,
.profile-card,
.hu-section{
    padding:24px!important;
    margin:16px 0;
}
.client-crm-card h2,
.profile-card h2,
.hu-section h2,
.todo-card h3{
    color:#fff!important;
}
.client-crm-card p,
.profile-card p,
.hu-section p{
    color:#a9bdd6!important;
}
.client-crm-nav{
    justify-content:center;
}
.client-crm-nav a,
.client-crm-button,
.hu-button,
.profile-btn,
.profile-btn.secondary{
    border:1px solid rgba(87,195,255,.28)!important;
    border-radius:999px!important;
    background:rgba(53,195,255,.14)!important;
    color:#dff7ff!important;
    text-decoration:none!important;
    font-weight:900!important;
}
.client-crm-button:not(.ghost),
.hu-button:not(.secondary),
.profile-btn:not(.secondary){
    background:#35c3ff!important;
    color:#06111f!important;
}
.client-crm-card table,
.profile-card table{
    width:100%;
    border-collapse:collapse;
}
.client-crm-card th,
.client-crm-card td{
    padding:13px 14px;
    border-bottom:1px solid rgba(148,163,184,.20);
}
.client-crm-card th{
    color:#9fb3cf;
    font-size:12px;
    letter-spacing:.12em;
    text-transform:uppercase;
}
.client-crm-form input,
.client-crm-form select,
.client-crm-form textarea{
    width:100%;
    border:1px solid rgba(148,163,184,.24);
    border-radius:14px;
    background:#020617;
    color:#f8fafc;
}

/* CRM_UI_UNIFIED_V2 */
.client-crm-page,
.profile-shell,
.hu-dashboard{
    width:min(1120px,calc(100% - 32px))!important;
    max-width:1120px!important;
    margin:0 auto!important;
    padding:42px 0 80px!important;
}

.client-crm-hero,
.profile-hero,
.hu-hero{
    border:1px solid rgba(87,195,255,.22)!important;
    border-radius:28px!important;
    padding:34px!important;
    background:radial-gradient(circle at top right,rgba(57,190,255,.20),transparent 34%),linear-gradient(135deg,#10233d 0%,#0c1628 62%,#07101e 100%)!important;
    color:#f8fafc!important;
    box-shadow:0 24px 60px rgba(0,0,0,.22)!important;
}

.client-crm-hero h1,
.profile-hero h1,
.hu-hero h1{
    color:#fff!important;
    font-size:clamp(38px,5vw,66px)!important;
    line-height:.95!important;
    letter-spacing:-.05em!important;
}

.client-crm-card,
.client-crm-panel,
.todo-card,
.profile-card,
.hu-section,
.hu-card,
.action-grid a{
    border:1px solid rgba(148,163,184,.24)!important;
    border-radius:22px!important;
    background:rgba(10,21,38,.76)!important;
    color:#eaf2ff!important;
    box-shadow:0 18px 50px rgba(0,0,0,.20)!important;
}

.client-crm-card,
.profile-card,
.hu-section,
.action-grid a{
    padding:24px!important;
    margin:16px 0!important;
}

.client-crm-card h2,
.profile-card h2,
.hu-section h2,
.todo-card h3,
.action-grid strong{
    color:#fff!important;
}

.client-crm-card p,
.profile-card p,
.hu-section p,
.action-grid span,
.todo-empty{
    color:#a9bdd6!important;
}

.client-crm-nav,
.hu-nav{
    display:flex!important;
    justify-content:center!important;
    flex-wrap:wrap!important;
    gap:10px!important;
    margin:18px 0 24px!important;
}

.client-crm-nav a,
.hu-nav a,
.client-crm-button,
.profile-btn,
.profile-btn.secondary,
.hu-button,
.hu-button.secondary,
.client-crm-page button,
.profile-shell button{
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    min-height:40px!important;
    padding:10px 15px!important;
    border:1px solid rgba(87,195,255,.30)!important;
    border-radius:999px!important;
    background:rgba(15,23,42,.92)!important;
    color:#dff7ff!important;
    text-decoration:none!important;
    font-weight:900!important;
    line-height:1!important;
    box-shadow:none!important;
}

.client-crm-page button,
.profile-shell button,
.client-crm-button:not(.ghost),
.profile-btn:not(.secondary),
.hu-button:not(.secondary){
    background:#35c3ff!important;
    color:#06111f!important;
}

.client-crm-button.ghost,
.profile-btn.secondary,
.hu-button.secondary{
    background:rgba(15,23,42,.92)!important;
    color:#dff7ff!important;
}

.client-crm-page a:not(.client-crm-button):not(.hu-card):not(.hu-button),
.profile-shell a:not(.client-crm-button):not(.profile-btn){
    color:#35c3ff!important;
    font-weight:900!important;
    text-decoration:none!important;
}

.client-crm-form input,
.client-crm-form select,
.client-crm-form textarea,
.profile-card input,
.profile-card select,
.profile-card textarea{
    width:100%!important;
    border:1px solid rgba(148,163,184,.24)!important;
    border-radius:14px!important;
    background:#020617!important;
    color:#f8fafc!important;
    padding:13px 14px!important;
}

.client-crm-card table{
    width:100%!important;
    border-collapse:collapse!important;
}

.client-crm-card th,
.client-crm-card td{
    padding:13px 14px!important;
    border-bottom:1px solid rgba(148,163,184,.20)!important;
    text-align:left!important;
    vertical-align:top!important;
}

.client-crm-card th{
    color:#9fb3cf!important;
    font-size:12px!important;
    letter-spacing:.12em!important;
    text-transform:uppercase!important;
}

.profile-grid{
    display:grid!important;
    grid-template-columns:1.2fr .8fr!important;
    gap:18px!important;
    margin-top:18px!important;
}

.profile-row{
    display:grid!important;
    grid-template-columns:160px 1fr!important;
    gap:14px!important;
    padding:11px 0!important;
    border-bottom:1px solid rgba(148,163,184,.18)!important;
}

.profile-row strong{
    color:#9fb3cf!important;
}

.profile-row span{
    color:#f8fafc!important;
}

.profile-pill{
    display:inline-flex!important;
    align-items:center!important;
    min-height:30px!important;
    padding:6px 11px!important;
    border-radius:999px!important;
    background:rgba(53,195,255,.14)!important;
    color:#dff7ff!important;
    border:1px solid rgba(87,195,255,.30)!important;
    font-weight:900!important;
    margin-right:6px!important;
}

.todo-grid{
    display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:14px!important;
    margin:18px 0!important;
}

.todo-item{
    padding:12px 0!important;
    border-top:1px solid rgba(148,163,184,.18)!important;
    color:#c7d8ee!important;
    line-height:1.45!important;
}

.todo-item:first-of-type{
    border-top:0!important;
}

@media(max-width:900px){
    .profile-grid,
    .todo-grid,
    .action-grid{
        grid-template-columns:1fr!important;
    }

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

/* Tenant dashboard cleanup */
.client-crm-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: .65rem;
    flex-wrap: wrap;
}

.client-crm-dashboard-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 680px;
    margin-inline: auto;
}

.client-crm-card-link {
    display: block;
    min-width: 0;
    text-decoration: none;
}

.client-crm-today-panel {
    max-width: 980px;
    margin-inline: auto;
}

.client-crm-todo-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    align-items: stretch;
}

.client-crm-todo-card {
    min-width: 0;
    overflow: hidden;
    text-align: center;
    border: 1px solid rgba(148, 163, 184, .22);
    border-radius: 18px;
    padding: 1.1rem;
}

.client-crm-todo-card h3 {
    margin-top: 0;
}

.client-crm-todo-card .client-crm-list-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    text-align: center;
    min-width: 0;
}

.client-crm-todo-card .client-crm-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

.client-crm-todo-card strong,
.client-crm-todo-card p {
    overflow-wrap: anywhere;
}

@media (max-width: 900px) {
    .client-crm-dashboard-cards,
    .client-crm-todo-grid {
        grid-template-columns: 1fr;
    }
}

/* Contact action controls */
.client-crm-danger-zone {
    border-color: rgba(248, 113, 113, .35);
}

.client-crm-danger-zone form {
    margin: 0;
}

.client-crm-button.danger {
    background: rgba(248, 113, 113, .12);
    border-color: rgba(248, 113, 113, .55);
    color: #fecaca;
}

.client-crm-button.danger:hover {
    background: rgba(248, 113, 113, .2);
}

/* Tenant task action controls */
.client-crm-table-actions {
    display: flex;
    align-items: center;
    gap: .45rem;
    flex-wrap: wrap;
}

.client-crm-table-actions form {
    margin: 0;
}

.client-crm-table-actions .client-crm-button {
    white-space: nowrap;
}

@media (max-width: 900px) {
    .client-crm-table-actions {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Mobile responsive contact list */
.client-crm-form-actions,
.client-crm-pagination {
    display: flex;
    align-items: center;
    gap: .65rem;
    flex-wrap: wrap;
}

.client-crm-pagination {
    justify-content: center;
    margin-top: 1.25rem;
}

.client-crm-contact-table th,
.client-crm-contact-table td {
    text-align: left;
}

@media (max-width: 760px) {
    .client-crm-actions,
    .client-crm-form-actions,
    .client-crm-pagination {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .client-crm-actions .client-crm-button,
    .client-crm-form-actions .client-crm-button,
    .client-crm-form-actions button,
    .client-crm-pagination .client-crm-button {
        width: 100%;
        box-sizing: border-box;
        text-align: center;
        justify-content: center;
    }

    .client-crm-contact-table td[data-label="Email"],
    .client-crm-contact-table td[data-label="Phone"] {
        overflow-wrap: anywhere;
    }
}

/* TRG tenant mobile containment - hard override */
@media (max-width: 760px) {
    *,
    *::before,
    *::after {
        box-sizing: border-box;
    }

    html,
    body {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        overflow-x: hidden !important;
    }

    body.is-client-user {
        min-width: 0 !important;
    }

    .topbar,
    .main-nav,
    .shell,
    .client-crm-page,
    .client-page-head,
    .client-crm-card,
    .client-crm-grid,
    .client-crm-dashboard-cards,
    .client-crm-today-panel,
    .client-crm-todo-grid,
    .client-crm-table-wrap,
    .client-crm-form {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .shell {
        padding: 1rem !important;
    }

    .client-crm-page {
        padding: 0 !important;
    }

    .client-page-head {
        padding: 1.15rem !important;
        border-radius: 18px !important;
    }

    .client-page-head h1 {
        font-size: clamp(2rem, 11vw, 3rem) !important;
        line-height: .95 !important;
        letter-spacing: -0.05em !important;
        overflow-wrap: anywhere !important;
    }

    .client-page-head p,
    .client-crm-card p,
    .client-crm-card strong,
    .topbar strong,
    .topbar span {
        overflow-wrap: anywhere !important;
    }

    .topbar {
        display: grid !important;
        grid-template-columns: 1fr auto !important;
        align-items: start !important;
        gap: .75rem !important;
        padding: .85rem 1rem !important;
    }

    .logout-form {
        display: grid !important;
        gap: .35rem !important;
        justify-items: end !important;
        min-width: 0 !important;
    }

    .logout-form span {
        max-width: 8rem !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    .main-nav,
    .client-crm-nav {
        display: flex !important;
        justify-content: flex-start !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        gap: .5rem !important;
        padding: .75rem 1rem !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .main-nav a,
    .client-crm-nav a {
        flex: 0 0 auto !important;
        white-space: nowrap !important;
    }

    .client-crm-card {
        padding: 1rem !important;
        border-radius: 18px !important;
        overflow: hidden !important;
    }

    .client-crm-actions,
    .client-crm-form-actions,
    .client-crm-pagination {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: .65rem !important;
        width: 100% !important;
    }

    .client-crm-button,
    .client-crm-actions a,
    .client-crm-actions button,
    .client-crm-form-actions button,
    .client-crm-pagination a {
        width: 100% !important;
        min-height: 44px !important;
        justify-content: center !important;
        text-align: center !important;
    }

    input,
    select,
    textarea,
    button {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .client-crm-table-wrap {
        overflow: visible !important;
    }

    .client-crm-table,
    .client-crm-table thead,
    .client-crm-table tbody,
    .client-crm-table tr,
    .client-crm-table th,
    .client-crm-table td {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .client-crm-table thead {
        display: none !important;
    }

    .client-crm-table tr {
        border: 1px solid rgba(148, 163, 184, .22) !important;
        border-radius: 16px !important;
        padding: .85rem !important;
        margin-bottom: .9rem !important;
        background: rgba(2, 6, 23, .32) !important;
        overflow: hidden !important;
    }

    .client-crm-table td {
        border: 0 !important;
        padding: .45rem 0 !important;
        display: grid !important;
        grid-template-columns: minmax(5.25rem, 34%) minmax(0, 1fr) !important;
        gap: .65rem !important;
        align-items: start !important;
        overflow-wrap: anywhere !important;
    }

    .client-crm-table td::before {
        content: attr(data-label) !important;
        color: #93a4bd !important;
        font-size: .72rem !important;
        font-weight: 800 !important;
        letter-spacing: .08em !important;
        text-transform: uppercase !important;
    }

    .client-crm-table td[data-label="Open"],
    .client-crm-table td[data-label="Actions"] {
        display: block !important;
    }

    .client-crm-table td[data-label="Open"]::before,
    .client-crm-table td[data-label="Actions"]::before {
        display: block !important;
        margin-bottom: .65rem !important;
    }

    .client-crm-table-actions {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: .5rem !important;
        width: 100% !important;
    }

    .client-crm-table-actions form,
    .client-crm-table-actions a,
    .client-crm-table-actions button {
        width: 100% !important;
    }
}

@media (max-width: 430px) {
    .shell {
        padding: .75rem !important;
    }

    .client-page-head,
    .client-crm-card {
        padding: .9rem !important;
    }

    .client-crm-table td {
        grid-template-columns: 1fr !important;
        gap: .25rem !important;
    }

    .client-crm-table td::before {
        margin-bottom: .1rem !important;
    }
}
