/* CRM — محیط مستقل از پنل نماینده */

body.crm-app {
    background:
        radial-gradient(1200px 600px at 100% 0%, rgba(var(--brand-primary-rgb), 0.12), transparent 55%),
        radial-gradient(900px 500px at 0% 100%, rgba(var(--brand-deep-rgb), 0.08), transparent 50%),
        #f3f6f5;
    padding-top: 72px;
}

.crm-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1200;
    height: 64px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.crm-topbar-inner {
    height: 100%;
    max-width: 100%;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.crm-topbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.crm-topbar-menu-toggle {
    display: none;
}

.crm-topbar-logo {
    width: auto;
    height: 40px;
    max-width: 150px;
    object-fit: contain;
    flex-shrink: 0;
}

.crm-topbar-titles {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.crm-topbar-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-deep));
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    flex-shrink: 0;
}

.crm-topbar-title {
    display: block;
    font-size: 15px;
    color: #1f2937;
    line-height: 1.3;
}

.crm-topbar-subtitle {
    display: block;
    font-size: 12px;
    color: #6b7280;
    line-height: 1.3;
}

.crm-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 10px;
    background: var(--brand-tint);
    color: var(--brand-deep);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid rgba(var(--brand-primary-rgb), 0.22);
    white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.crm-back-btn:hover {
    background: rgba(var(--brand-primary-rgb), 0.16);
    border-color: rgba(var(--brand-primary-rgb), 0.35);
}

.crm-back-btn svg {
    flex-shrink: 0;
}

body.crm-app .sidebar {
    top: 84px;
    height: calc(100vh - 104px);
}

body.crm-app .main-content {
    min-height: calc(100vh - 72px);
}

.crm-sidebar .sidebar-header {
    text-align: center;
}

.crm-brand-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 4px;
    padding: 4px 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-deep));
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.crm-user-role {
    display: block;
    font-size: 11px;
    color: #6b7280;
    margin-top: 2px;
}

.crm-main {
    min-height: calc(100vh - 72px);
}

@media (max-width: 768px) {
    body.crm-app {
        padding-top: 64px;
    }

    body.crm-app.has-mobile-bottom-nav .crm-main {
        padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    }

    body.crm-app .mobile-header {
        display: none !important;
    }

    .crm-topbar-inner {
        padding: 0 12px;
        gap: 10px;
    }

    .crm-topbar-menu-toggle {
        display: inline-flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 5px;
        width: 42px;
        height: 42px;
        border: none;
        background: transparent;
        padding: 0;
        cursor: pointer;
        flex-shrink: 0;
    }

    .crm-topbar-menu-toggle .hamburger-line {
        display: block;
        width: 20px;
        height: 2px;
        background: #333;
        border-radius: 2px;
    }

    .crm-topbar-logo {
        display: none;
    }

    .crm-topbar-subtitle {
        display: none;
    }

    .crm-topbar-title {
        font-size: 14px;
    }

    .crm-back-btn {
        padding: 8px 10px;
        font-size: 12px;
        gap: 6px;
    }

    .crm-back-btn span {
        max-width: 90px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    body.crm-app .sidebar {
        top: 0;
        height: 100vh;
    }
}

.crm-panel[hidden] {
    display: none !important;
}

.crm-home-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-top: 8px;
}

.crm-stat-card,
.crm-empty-card {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.crm-stat-card {
    padding: 20px 18px;
}

.crm-stat-label {
    display: block;
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 8px;
}

.crm-stat-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--brand-deep);
    line-height: 1.2;
}

.crm-stat-hint {
    margin-top: 8px;
    font-size: 12px;
    color: #9ca3af;
}

.crm-empty-card {
    padding: 40px 24px;
    text-align: center;
}

.crm-empty-card h2 {
    font-size: 20px;
    color: var(--brand-deep);
    margin-bottom: 8px;
}

.crm-empty-card p {
    color: #6b7280;
    font-size: 14px;
}

.crm-form-error {
    color: var(--danger);
    font-size: 13px;
    margin: 0 0 10px;
}

.crm-people-section {
    width: 100%;
}

.crm-people-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.crm-add-person-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-deep));
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(var(--brand-primary-rgb), 0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.crm-add-person-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(var(--brand-primary-rgb), 0.3);
}

.crm-people-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1 1 280px;
    justify-content: flex-end;
}

.crm-people-search,
.crm-people-filter {
    min-width: 0;
    flex: 1 1 140px;
    max-width: 220px;
}

.crm-people-filter {
    flex: 1 1 160px;
    max-width: 240px;
}

.crm-modal {
    position: fixed;
    inset: 0;
    z-index: 1400;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.crm-modal.open {
    display: flex;
}

body.crm-modal-open {
    overflow: hidden;
}

.crm-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.crm-modal-box {
    position: relative;
    z-index: 1;
    width: min(640px, 100%);
    max-height: 90vh;
    overflow: auto;
    background: #fff;
    border-radius: 16px;
    padding: 22px 22px 18px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
}

.crm-modal-close {
    position: absolute;
    top: 10px;
    left: 12px;
    border: none;
    background: transparent;
    font-size: 26px;
    line-height: 1;
    color: #64748b;
    cursor: pointer;
}

.crm-modal-box .shop-form-header {
    padding-left: 28px;
}

.crm-modal-box .form-actions {
    margin-bottom: 0;
}

.crm-people-table td {
    vertical-align: middle;
}

.crm-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.crm-badge-cold {
    background: #eef2ff;
    color: #3730a3;
}

.crm-badge-warm {
    background: #fff7ed;
    color: #c2410c;
}

.crm-badge-hot {
    background: #fef2f2;
    color: #b91c1c;
}

.crm-actions-cell {
    white-space: nowrap;
    position: relative;
    overflow: visible;
}

.crm-action-btn {
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #fff;
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    margin-left: 4px;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.crm-action-edit:hover {
    background: var(--brand-tint);
    border-color: rgba(var(--brand-primary-rgb), 0.35);
    color: var(--brand-deep);
}

.crm-action-transfer {
    color: var(--brand-deep, #0f766e);
}

.crm-action-transfer:hover {
    background: var(--brand-tint);
    border-color: rgba(var(--brand-primary-rgb), 0.35);
}

.crm-action-ops {
    color: var(--brand-deep, #0f766e);
    border-color: rgba(var(--brand-primary-rgb), 0.35);
}

.crm-action-ops:hover {
    background: var(--brand-tint);
    border-color: rgba(var(--brand-primary-rgb), 0.45);
}

.crm-ops-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #fff;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    color: inherit;
}

.crm-ops-back-btn:hover {
    background: var(--brand-tint, #ecfdf5);
}

.crm-ops-card {
    padding: 20px;
    margin-bottom: 16px;
}

.crm-ops-section-title {
    margin: 0 0 14px;
    font-size: 16px;
    font-weight: 700;
}

.crm-ops-flow-card {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.crm-ops-flow {
    min-height: 160px;
}

.crm-flow-canvas {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    padding: 16px 12px 24px;
    width: max-content;
    min-width: 100%;
    margin: 0;
    direction: ltr;
}

.crm-flow-step {
    width: auto;
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.crm-flow-connector {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 40px;
    height: auto;
    flex: 0 0 40px;
    position: relative;
}

.crm-flow-line {
    height: 3px;
    width: auto;
    flex: 1;
    background: linear-gradient(90deg, #94a3b8 0%, #0f766e 100%);
    border-radius: 2px;
}

.crm-flow-arrow {
    width: 0;
    height: 0;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-left: 9px solid #0f766e;
    border-right: 0;
    margin-top: 0;
    margin-left: -1px;
    flex-shrink: 0;
}

.crm-flow-node {
    width: 220px;
    min-height: 120px;
    text-align: center;
    padding: 14px 14px 12px;
    border: 2px solid #cbd5e1;
    background: #fff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
    position: relative;
    box-sizing: border-box;
}

.crm-flow-node-start {
    border-radius: 999px;
    border-color: #0f766e;
    background: #ecfdf5;
    width: 160px;
    min-height: 88px;
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.crm-flow-node-process {
    border-radius: 14px;
    border-color: #94a3b8;
}

.crm-flow-node-next {
    border-radius: 14px;
    border-style: dashed;
    border-color: #d97706;
    background: #fffbeb;
    box-shadow: 0 8px 22px rgba(217, 119, 6, 0.12);
}

.crm-flow-node-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: #e2e8f0;
    color: #334155;
    margin-bottom: 8px;
}

.is-start .crm-flow-node-badge {
    background: #0f766e;
    color: #fff;
}

.is-next .crm-flow-node-badge {
    background: #d97706;
    color: #fff;
}

.type-meeting .crm-flow-node-badge {
    background: #dbeafe;
    color: #1d4ed8;
}

.type-next_meeting .crm-flow-node-badge {
    background: #ffedd5;
    color: #c2410c;
}

.type-call .crm-flow-node-badge {
    background: #ede9fe;
    color: #6d28d9;
}

.type-note .crm-flow-node-badge {
    background: #e2e8f0;
    color: #475569;
}

.crm-flow-node-date {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 6px;
}

.crm-flow-node-desc {
    margin: 0;
    font-size: 13px;
    line-height: 1.7;
    color: #475569;
    white-space: pre-wrap;
}

.crm-flow-node-meta {
    margin-top: 8px;
    font-size: 12px;
    color: #b45309;
    font-weight: 600;
}

.crm-flow-node .crm-ops-del-btn {
    margin-top: 10px;
}

.crm-ops-fields {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 0;
}

.crm-ops-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid rgba(15, 23, 42, 0.06);
}

.crm-ops-label {
    font-size: 12px;
    color: #64748b;
}

.crm-ops-value {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    word-break: break-word;
}

.crm-ops-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.crm-ops-loading {
    color: #64748b;
    padding: 12px 0;
}

@media (max-width: 640px) {
    .crm-flow-node {
        width: 180px;
    }

    .crm-flow-node-start {
        width: 140px;
    }

    .crm-flow-connector {
        width: 28px;
        flex-basis: 28px;
    }
}

.crm-transfer-wrap {
    position: relative;
    display: inline-block;
    margin-left: 4px;
    vertical-align: middle;
}

.crm-transfer-wrap .crm-action-transfer {
    margin-left: 0;
}

.crm-transfer-menu {
    position: absolute;
    top: calc(100% + 4px);
    bottom: auto;
    left: 0;
    z-index: 40;
    min-width: 168px;
    padding: 6px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #fff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
    display: none;
    flex-direction: column;
    gap: 2px;
}

.crm-transfer-wrap.open .crm-transfer-menu {
    display: flex;
}

#crmPeopleTableWrap {
    overflow-x: auto;
    overflow-y: visible;
}

.crm-people-table {
    overflow: visible;
}

.crm-transfer-item {
    border: 0;
    background: transparent;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 12px;
    font-family: inherit;
    text-align: right;
    cursor: pointer;
    color: inherit;
    width: 100%;
}

.crm-transfer-item:hover {
    background: var(--brand-tint, #ecfdf5);
    color: var(--brand-deep, #0f766e);
}

.crm-action-delete {
    color: var(--danger);
}

.crm-action-delete:hover {
    background: var(--danger-tint);
    border-color: rgba(var(--danger-rgb), 0.35);
}

.crm-due-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin: 4px 0 18px;
}

.crm-due-toolbar-label {
    font-size: 13px;
    color: #4b5563;
    font-weight: 600;
}

.crm-due-window {
    max-width: 200px;
    min-width: 160px;
}

.crm-due-range-label {
    font-size: 13px;
    color: #6b7280;
    font-weight: 600;
}

.crm-due-date {
    max-width: 150px;
    min-width: 128px;
}

.crm-due-date-wrap {
    max-width: 176px;
    min-width: 154px;
    flex: 0 1 auto;
}

.crm-due-date-wrap .crm-due-date {
    max-width: none;
    min-width: 0;
}

.crm-due-insurance {
    max-width: 200px;
    min-width: 160px;
}

.crm-due-grid {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.crm-due-section-desc {
    margin: 4px 0 0;
    font-size: 13px;
    color: #6b7280;
}

.crm-due-section-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.crm-due-table td {
    vertical-align: middle;
}

.crm-due-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: #f3f4f6;
    color: #4b5563;
}

.crm-due-badge-soon,
.crm-due-badge-today {
    background: #fff7ed;
    color: #c2410c;
}

.crm-due-badge-later {
    background: #ecfdf5;
    color: #047857;
}

.crm-due-badge-past {
    background: #fef2f2;
    color: #b91c1c;
}

.crm-ext-row-soon td {
    background: rgba(255, 247, 237, 0.45);
}

.crm-genealogy-hint {
    margin: 0;
    font-size: 13px;
    color: #6b7280;
}

.crm-genealogy-card {
    padding: 16px;
    min-height: 280px;
}

.crm-genealogy-viewport {
    overflow: auto;
    max-width: 100%;
    padding: 12px 8px 28px;
    background:
        radial-gradient(circle at 1px 1px, rgba(var(--brand-primary-rgb), 0.08) 1px, transparent 0);
    background-size: 18px 18px;
    border-radius: 12px;
}

.crm-genealogy-tree {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: flex-start;
    gap: 36px;
    min-width: min-content;
    margin: 0 auto;
    direction: ltr;
    text-align: center;
}

.crm-gen-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    position: relative;
}

.crm-gen-card {
    width: 200px;
    padding: 14px 12px 12px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
    direction: rtl;
    text-align: center;
    position: relative;
    box-sizing: border-box;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.crm-gen-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.1);
    border-color: rgba(var(--brand-primary-rgb), 0.35);
}

.crm-gen-card.is-root {
    width: 220px;
    border-color: rgba(var(--brand-primary-rgb), 0.45);
    box-shadow: 0 6px 18px rgba(var(--brand-primary-rgb), 0.18);
}

.crm-gen-avatar {
    width: 42px;
    height: 42px;
    margin: 0 auto 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(var(--brand-primary-rgb), 0.18), rgba(var(--brand-deep-rgb), 0.12));
    color: var(--brand-deep);
    font-size: 15px;
    font-weight: 800;
}

.crm-gen-name {
    display: block;
    font-size: 14px;
    font-weight: 800;
    color: var(--brand-deep);
    line-height: 1.35;
    word-break: break-word;
}

.crm-gen-phone {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #64748b;
    direction: ltr;
    unicode-bidi: plaintext;
}

.crm-gen-notes {
    display: block;
    margin-top: 6px;
    font-size: 11px;
    color: #94a3b8;
    line-height: 1.4;
    max-height: 2.8em;
    overflow: hidden;
}

.crm-gen-badge {
    display: inline-flex;
    margin-top: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(var(--brand-primary-rgb), 0.1);
    color: var(--brand-deep);
    font-size: 11px;
    font-weight: 700;
}

.crm-gen-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    margin-top: 10px;
}

.crm-gen-actions .crm-action-btn {
    margin: 0;
    padding: 4px 8px;
    font-size: 11px;
}

.crm-gen-toggle {
    position: absolute;
    bottom: -11px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: var(--brand-primary);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(var(--brand-primary-rgb), 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.crm-gen-children {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: flex-start;
    position: relative;
    margin-top: 22px;
    padding-top: 22px;
}

.crm-gen-children.collapsed {
    display: none;
}

.crm-gen-children::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 22px;
    margin-left: -1px;
    background: rgba(var(--brand-primary-rgb), 0.35);
}

.crm-gen-child {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 0 10px;
}

.crm-gen-child::before {
    content: '';
    position: absolute;
    top: -22px;
    right: 0;
    left: 0;
    height: 2px;
    background: rgba(var(--brand-primary-rgb), 0.35);
}

.crm-gen-child::after {
    content: '';
    position: absolute;
    top: -22px;
    left: 50%;
    width: 2px;
    height: 22px;
    margin-left: -1px;
    background: rgba(var(--brand-primary-rgb), 0.35);
}

.crm-gen-child:first-child::before {
    left: 50%;
    right: 0;
}

.crm-gen-child:last-child::before {
    left: 0;
    right: 50%;
}

.crm-gen-child:only-child::before {
    display: none;
}

.crm-gen-wrap .crm-gen-wrap .crm-gen-card {
    width: 180px;
    padding: 12px 10px 10px;
}

.crm-gen-wrap .crm-gen-wrap .crm-gen-avatar {
    width: 36px;
    height: 36px;
    font-size: 13px;
}

.crm-gen-wrap .crm-gen-wrap .crm-gen-name {
    font-size: 13px;
}

.crm-gen-wrap .crm-gen-wrap .crm-gen-wrap .crm-gen-card {
    width: 160px;
}

.crm-genealogy-parent-label {
    margin: 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(var(--brand-primary-rgb), 0.08);
    color: var(--brand-deep);
    font-weight: 600;
    font-size: 13px;
}

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

@media (max-width: 640px) {
    .crm-home-grid {
        grid-template-columns: 1fr;
    }

    .crm-due-window,
    .crm-due-date,
    .crm-due-date-wrap,
    .crm-due-insurance {
        max-width: none;
        width: 100%;
    }

    .crm-people-toolbar-row {
        flex-direction: column;
        align-items: stretch;
    }

    .crm-add-person-btn {
        justify-content: center;
        width: 100%;
    }

    .crm-ops-actions {
        flex-direction: column;
    }

    .crm-ops-actions .crm-action-btn,
    .crm-ops-actions button,
    .crm-ops-actions a {
        width: 100%;
        justify-content: center;
    }

    .crm-genealogy-viewport {
        padding: 8px 4px 20px;
    }

    .crm-gen-card,
    .crm-gen-card.is-root {
        width: 160px;
    }
}
