@font-face {
    font-family: 'YekanBakhFaNum';
    src: url('../fonts/YekanBakhFaNum-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'YekanBakhFaNum';
    src: url('../fonts/YekanBakhFaNum-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'YekanBakhFaNum';
    src: url('../fonts/YekanBakhFaNum-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'YekanBakhFaNum';
    src: url('../fonts/YekanBakhFaNum-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --crm-primary: #2454ff;
    --crm-primary-rgb: 36, 84, 255;
    --crm-primary-dark: #153ed4;
    --crm-primary-soft: #edf2ff;
    --crm-bg: #eef3fa;
    --crm-app: #ffffff;
    --crm-surface: #ffffff;
    --crm-surface-soft: #f8fbff;
    --crm-text: #0e1324;
    --crm-muted: #667894;
    --crm-muted-2: #94a3b8;
    --crm-border: #e7edf5;
    --crm-border-strong: #dbe5f0;
    --crm-radius: 18px;
    --crm-radius-lg: 26px;
    --crm-shadow: 0 28px 80px rgba(25, 42, 70, .08);
    --crm-shadow-soft: 0 14px 38px rgba(25, 42, 70, .06);
    --crm-font-family: 'YekanBakhFaNum', Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
    min-height: 100vh;
    margin: 0;
    direction: rtl;
    font-family: var(--crm-font-family);
    background: radial-gradient(circle at top left, rgba(var(--crm-primary-rgb), .08), transparent 36%), var(--crm-bg);
    color: var(--crm-text);
    font-size: 14px;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--crm-primary); }
img { max-width: 100%; }

.crm-auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
    background:
        radial-gradient(circle at 20% 10%, rgba(var(--crm-primary-rgb), .18), transparent 32%),
        radial-gradient(circle at 85% 80%, rgba(14, 165, 233, .12), transparent 32%),
        #f3f7fc;
}
.crm-auth-card {
    width: min(440px, 100%);
    background: rgba(255, 255, 255, .94);
    border: 1px solid var(--crm-border);
    border-radius: 30px;
    box-shadow: var(--crm-shadow);
    padding: 34px;
    backdrop-filter: blur(14px);
}
.crm-logo {
    width: 52px;
    height: 52px;
    border-radius: 17px;
    display: inline-grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, var(--crm-primary), #1234c9);
    font-weight: 800;
    letter-spacing: -.03em;
    box-shadow: 0 16px 30px rgba(var(--crm-primary-rgb), .28);
    margin-bottom: 18px;
}

.crm-layout {
    width: min(1680px, calc(100% - 72px));
    min-height: calc(100vh - 84px);
    margin: 42px auto;
    display: grid;
    grid-template-columns: 290px 1fr;
    background: var(--crm-app);
    border: 1px solid var(--crm-border);
    box-shadow: var(--crm-shadow);
    overflow: hidden;
}
.crm-sidebar {
    background: #fbfcff;
    color: #5d6f89;
    padding: 28px 24px;
    border-left: 1px solid var(--crm-border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.crm-sidebar .d-flex.align-items-center.gap-2.mb-4 {
    align-items: center !important;
    padding: 0 4px 25px;
    margin-bottom: 22px !important;
    border-bottom: 1px solid var(--crm-border);
}
.crm-sidebar .crm-logo { width: 38px; height: 38px; border-radius: 13px; margin: 0 !important; font-size: 12px; }
.crm-sidebar strong { color: var(--crm-text); font-weight: 800; font-size: 17px; }
.crm-sidebar small { color: var(--crm-muted-2) !important; }
.crm-sidebar a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    color: #596b84;
    padding: 12px 14px;
    border-radius: 15px;
    margin: 1px 0;
    font-weight: 600;
    transition: .18s ease;
}
.crm-sidebar a::before {
    content: attr(data-icon);
    width: 26px;
    height: 26px;
    border-radius: 10px;
    display: inline-grid;
    place-items: center;
    color: #6f7f98;
    background: transparent;
    font-size: 15px;
    flex: 0 0 26px;
}
.crm-sidebar a:hover {
    color: var(--crm-primary);
    background: var(--crm-primary-soft);
}
.crm-sidebar a:hover::before { color: var(--crm-primary); background: #fff; }
.crm-sidebar a.active {
    color: #fff;
    background: var(--crm-primary);
    box-shadow: 0 14px 32px rgba(var(--crm-primary-rgb), .24);
}
.crm-sidebar a.active::before { color: var(--crm-primary); background: rgba(255,255,255,.94); }
.crm-sidebar a[href*="logout"] { margin-top: auto; color: #ef4444; background: #fff5f5; }
.crm-sidebar a[href*="logout"]::before { content: '⎋'; color: #ef4444; }

.crm-main {
    min-width: 0;
    background: #ffffff;
    padding: 34px 40px;
}
.crm-topbar {
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    margin-bottom: 6px;
}
.crm-topbar h1 { font-size: 25px; font-weight: 800; letter-spacing: -.03em; color: var(--crm-text); }
.crm-topbar small { color: var(--crm-muted); font-size: 13px; }
.crm-topbar > .text-muted.small {
    min-width: 190px;
    border: 1px solid var(--crm-border);
    background: var(--crm-surface-soft);
    border-radius: 999px;
    padding: 10px 15px;
    color: #334155 !important;
    box-shadow: 0 10px 24px rgba(25,42,70,.035);
}

.crm-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}
.crm-stat-card, .crm-panel {
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-lg);
    box-shadow: 0 1px 0 rgba(15, 23, 42, .02);
}
.crm-stat-card {
    position: relative;
    overflow: hidden;
    padding: 22px;
    min-height: 132px;
}
.crm-stat-card::before {
    content: '';
    position: absolute;
    inset-inline-end: 18px;
    top: 18px;
    width: 44px;
    height: 44px;
    border-radius: 16px;
    background: var(--crm-primary-soft);
}
.crm-stat-card::after {
    content: '';
    position: absolute;
    inset-inline-end: 31px;
    top: 31px;
    width: 18px;
    height: 18px;
    border-radius: 7px;
    background: var(--crm-primary);
    box-shadow: 0 8px 20px rgba(var(--crm-primary-rgb), .24);
}
.crm-stat-card small { display: block; color: var(--crm-muted); font-weight: 600; padding-inline-end: 58px; }
.crm-stat-card strong { display: block; font-size: 32px; line-height: 1.1; margin-top: 16px; font-weight: 800; letter-spacing: -.04em; color: var(--crm-text); }
.crm-panel { padding: 24px; }
.crm-panel h2, .crm-panel h3 { color: var(--crm-text); font-weight: 800; }
.crm-page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}
.crm-page-head h2, .crm-page-head h3 { font-weight: 800; letter-spacing: -.025em; }

.crm-dashboard-hero {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1.35fr .65fr;
    gap: 20px;
    align-items: stretch;
    margin-bottom: 24px;
}
.crm-hero-card {
    position: relative;
    min-height: 176px;
    padding: 28px;
    border-radius: 30px;
    color: #fff;
    background:
        radial-gradient(circle at 78% 48%, rgba(255,255,255,.22), transparent 22%),
        radial-gradient(circle at 90% 20%, rgba(255,255,255,.16), transparent 24%),
        linear-gradient(135deg, var(--crm-primary), #1238d8);
    box-shadow: 0 26px 55px rgba(var(--crm-primary-rgb), .24);
    overflow: hidden;
}
.crm-hero-card::after {
    content: '';
    position: absolute;
    inset-inline-end: -40px;
    bottom: -72px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    border: 42px solid rgba(255,255,255,.10);
}
.crm-hero-card h2 { color: #fff; font-size: 26px; font-weight: 800; margin: 0 0 10px; }
.crm-hero-card p { color: rgba(255,255,255,.75); margin: 0 0 20px; max-width: 620px; }
.crm-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.crm-quick-card {
    border: 1px solid var(--crm-border);
    border-radius: 30px;
    padding: 22px;
    background: #fff;
}
.crm-quick-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.crm-quick-item {
    min-height: 74px;
    border: 1px solid var(--crm-border);
    border-radius: 18px;
    background: var(--crm-surface-soft);
    display: grid;
    place-items: center;
    color: var(--crm-text);
    font-weight: 700;
    transition: .18s;
}
.crm-quick-item:hover { border-color: rgba(var(--crm-primary-rgb), .35); background: var(--crm-primary-soft); color: var(--crm-primary); transform: translateY(-2px); }

.crm-input, .form-control, .form-select {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--crm-border-strong);
    border-radius: 16px;
    padding: 12px 15px;
    outline: none;
    background: #fff;
    color: var(--crm-text);
    transition: .18s ease;
    box-shadow: none !important;
}
.crm-input::placeholder { color: #9aa8bc; }
.crm-input:focus, .form-control:focus, .form-select:focus {
    border-color: rgba(var(--crm-primary-rgb), .78);
    box-shadow: 0 0 0 4px rgba(var(--crm-primary-rgb), .10) !important;
}
.crm-form-label, label { font-size: 13px; color: #5c6d86; margin-bottom: 8px; font-weight: 700; }
textarea.crm-input { min-height: 110px; resize: vertical; }
select.crm-input { appearance: auto; padding-left: 30px; }

.crm-btn, .btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    border: 0;
    border-radius: 15px;
    padding: 12px 18px;
    background: var(--crm-primary);
    color: #fff !important;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 14px 28px rgba(var(--crm-primary-rgb), .20);
    transition: .18s ease;
}
.crm-btn:hover, .btn-primary:hover { background: var(--crm-primary-dark); color: #fff !important; transform: translateY(-1px); }
.crm-btn-light {
    background: #f7f9fc;
    color: var(--crm-text) !important;
    border: 1px solid var(--crm-border);
    box-shadow: none;
}
.crm-btn-light:hover { background: var(--crm-primary-soft); color: var(--crm-primary) !important; border-color: rgba(var(--crm-primary-rgb), .25); }
.crm-btn-danger { background: #ef4444; box-shadow: 0 14px 28px rgba(239,68,68,.16); }
.crm-btn-danger:hover { background: #dc2626; }
.crm-actions { white-space: nowrap; }
.crm-actions .crm-btn { min-height: 38px; padding: 8px 13px; border-radius: 12px; font-size: 13px; }

.crm-alert { padding: 13px 15px; border-radius: 17px; margin-bottom: 14px; border: 1px solid transparent; font-weight: 600; }
.crm-alert-error { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.crm-alert-warning { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.crm-alert-success { background: #ecfdf5; color: #047857; border-color: #bbf7d0; }
.crm-alert-info { background: var(--crm-primary-soft); color: var(--crm-primary-dark); border-color: rgba(var(--crm-primary-rgb), .13); }
.crm-flash { margin: 0 0 18px; }
.crm-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 11px;
    border-radius: 999px;
    background: var(--crm-primary-soft);
    color: var(--crm-primary-dark);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}
.crm-badge-priority-urgent, .crm-badge-priority-critical { background: #fff1f2; color: #be123c; }
.crm-badge-priority-high { background: #fff7ed; color: #c2410c; }
.crm-badge-priority-low { background: #ecfdf5; color: #047857; }

.table-responsive { border-radius: 22px; }
.table { --bs-table-bg: transparent; margin-bottom: 0; color: var(--crm-text); }
.table thead th {
    color: #5d6f89;
    font-weight: 800;
    font-size: 13px;
    border-bottom: 1px solid var(--crm-border);
    padding: 16px 14px;
    background: #fbfdff;
}
.table tbody td {
    padding: 16px 14px;
    border-bottom: 1px solid var(--crm-border);
    color: #334155;
    vertical-align: middle;
}
.table tbody tr { transition: .18s ease; }
.table tbody tr:hover { background: #fbfdff; }
.table tbody tr:last-child td { border-bottom: 0; }

.crm-meta-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.crm-meta-grid > div { border: 1px solid var(--crm-border); border-radius: 18px; padding: 15px; background: var(--crm-surface-soft); }
.crm-meta-grid small { display:block; color: var(--crm-muted); margin-bottom: 6px; font-weight: 600; }
.crm-meta-grid strong { display:block; color: var(--crm-text); font-weight: 800; }
.crm-message {
    border: 1px solid var(--crm-border);
    border-radius: 20px;
    padding: 16px;
    margin-bottom: 12px;
    background: #fff;
    box-shadow: 0 1px 0 rgba(15,23,42,.02);
}
.crm-message-internal { background: #fff8ed; border-color: #fed7aa; }
.crm-message-unread { border-inline-start: 4px solid var(--crm-primary); background: var(--crm-primary-soft); }
.crm-file-row { display: flex; flex-direction: column; gap: .25rem; padding: .85rem 0; border-bottom: 1px solid var(--crm-border); }
.crm-file-row:last-child { border-bottom: 0; }
.crm-file-row small { color: var(--crm-muted); }

.row.g-4 > [class*="col-"] .crm-panel,
.row.g-3 > [class*="col-"] .crm-panel { height: 100%; }
.text-muted { color: var(--crm-muted) !important; }
.mb-4 { margin-bottom: 1.35rem !important; }

@media (max-width: 1200px) {
    .crm-layout { width: min(100% - 28px, 1280px); grid-template-columns: 250px 1fr; margin: 18px auto; min-height: calc(100vh - 36px); }
    .crm-main { padding: 28px; }
    .crm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .crm-dashboard-hero { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .crm-layout { display: block; width: 100%; margin: 0; min-height: 100vh; border: 0; }
    .crm-sidebar { border-left: 0; border-bottom: 1px solid var(--crm-border); padding: 18px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .crm-sidebar .d-flex.align-items-center.gap-2.mb-4 { grid-column: 1 / -1; margin-bottom: 10px !important; padding-bottom: 16px; }
    .crm-sidebar a { min-height: 44px; padding: 10px 12px; }
    .crm-sidebar a[href*="logout"] { margin-top: 0; }
    .crm-main { padding: 22px 16px; }
    .crm-topbar { flex-direction: column; align-items: stretch; gap: 14px; }
    .crm-topbar > .text-muted.small { border-radius: 18px; }
    .crm-page-head { align-items: stretch; flex-direction: column; }
    .crm-page-head .crm-btn { width: 100%; }
    .crm-meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 576px) {
    body { font-size: 13px; }
    .crm-auth-card { padding: 24px; border-radius: 24px; }
    .crm-sidebar { grid-template-columns: 1fr; }
    .crm-grid, .crm-meta-grid, .crm-quick-list { grid-template-columns: 1fr; }
    .crm-stat-card strong { font-size: 28px; }
    .crm-hero-card { padding: 22px; min-height: 160px; }
    .crm-hero-card h2 { font-size: 22px; }
    .crm-panel { padding: 18px; border-radius: 22px; }
    .crm-actions { display: flex; gap: 8px; white-space: normal; }
}


@media (max-width: 640px) {
    .table-responsive { overflow: visible; }
    .table-responsive table.crm-responsive-table {
        border-collapse: separate;
        border-spacing: 0 12px;
    }
    .table-responsive table.crm-responsive-table thead { display: none; }
    .table-responsive table.crm-responsive-table tbody,
    .table-responsive table.crm-responsive-table tr,
    .table-responsive table.crm-responsive-table td { display: block; width: 100%; }
    .table-responsive table.crm-responsive-table tr {
        background: #fff;
        border: 1px solid var(--crm-border);
        border-radius: 18px;
        padding: 10px 12px;
        box-shadow: 0 12px 30px rgba(15, 23, 42, .04);
    }
    .table-responsive table.crm-responsive-table td {
        border: 0 !important;
        padding: 9px 4px !important;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
        text-align: left;
    }
    .table-responsive table.crm-responsive-table td::before {
        content: attr(data-label);
        color: var(--crm-muted);
        font-weight: 800;
        text-align: right;
    }
    .table-responsive table.crm-responsive-table td[data-label="موضوع"] {
        align-items: flex-start;
        flex-direction: column;
        text-align: right;
    }
    .table-responsive table.crm-responsive-table td[data-label="موضوع"]::before { margin-bottom: 4px; }
    .table-responsive table.crm-responsive-table .crm-actions {
        justify-content: stretch;
        flex-wrap: wrap;
    }
    .table-responsive table.crm-responsive-table .crm-actions::before { width: 100%; }
    .table-responsive table.crm-responsive-table .crm-actions .crm-btn,
    .table-responsive table.crm-responsive-table td[data-label="عملیات"] .crm-btn {
        flex: 1 1 120px;
        justify-content: center;
    }
}

/* Jalali Datepicker */
.crm-jalali-wrap {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}
.crm-jalali-wrap .crm-jalali-input { flex: 1 1 130px; min-width: 130px; cursor: pointer; background: #fff; }
.crm-jalali-time {
    min-height: 46px;
    width: 98px;
    border: 1px solid var(--crm-border);
    border-radius: 14px;
    padding: 10px 9px;
    color: var(--crm-text);
    background: #fff;
    direction: ltr;
}
.crm-jalali-clear {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 12px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 20px;
    line-height: 1;
}
.crm-jalali-clear:hover { background: #fee2e2; color: #dc2626; }
.crm-jalali-popup {
    position: fixed;
    z-index: 3000;
    top: 0;
    left: 0;
    right: auto;
    width: 306px;
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 14px;
    border: 1px solid var(--crm-border);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 22px 60px rgba(15, 23, 42, .16);
    display: none;
}
.crm-jalali-popup.is-open { display: block; }
.crm-jalali-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.crm-jalali-head strong { font-size: 14px; color: var(--crm-text); }
.crm-jalali-head button,
.crm-jalali-foot button {
    border: 0;
    border-radius: 12px;
    background: var(--crm-primary-soft);
    color: var(--crm-primary);
    min-width: 38px;
    height: 34px;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 1;
}
.crm-jalali-week,
.crm-jalali-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    text-align: center;
}
.crm-jalali-week span {
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    padding-bottom: 4px;
}
.crm-jalali-days button {
    height: 36px;
    border: 0;
    border-radius: 11px;
    background: #f8fafc;
    color: #334155;
    font-weight: 800;
}
.crm-jalali-days button:hover { background: var(--crm-primary-soft); color: var(--crm-primary); }
.crm-jalali-days button.is-selected {
    background: var(--crm-primary);
    color: #fff;
    box-shadow: 0 10px 20px rgba(var(--crm-primary-rgb), .22);
}
.crm-jalali-days button.is-today:not(.is-selected) {
    background: #f97316;
    color: #fff;
    box-shadow: 0 10px 20px rgba(249, 115, 22, .24);
}
.crm-jalali-foot {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
}
@media (max-width: 576px) {
    .crm-jalali-wrap { flex-wrap: wrap; }
    .crm-jalali-time { width: 100%; }
    .crm-jalali-clear { position: absolute; left: 8px; top: 4px; }
    .crm-jalali-popup { width: min(306px, calc(100vw - 24px)); right: auto; border-radius: 18px; }
}

/* v1.3.7 Smart Notifications */
.crm-topbar-tools{display:flex;align-items:center;gap:10px;flex-wrap:wrap;justify-content:flex-end}
.crm-user-card{min-width:190px;border:1px solid var(--crm-border);background:var(--crm-surface-soft);border-radius:999px;padding:10px 15px;color:#334155!important;box-shadow:0 10px 24px rgba(25,42,70,.035)}
.crm-notification-pill,.crm-notification-toggle{min-height:38px;border:1px solid var(--crm-border);background:#fff;color:#40516b;border-radius:999px;padding:8px 12px;font-family:inherit;font-size:12px;font-weight:800;display:inline-flex;align-items:center;gap:8px;box-shadow:0 8px 20px rgba(15,23,42,.035);cursor:pointer}
.crm-notification-pill:hover,.crm-notification-toggle:hover{background:var(--crm-primary-soft);color:var(--crm-primary)}
.crm-notification-dot{min-width:24px;height:24px;padding:0 7px;border-radius:999px;background:#ef4444;color:#fff;display:inline-flex;align-items:center;justify-content:center;font-size:11px;font-weight:900;box-shadow:0 8px 18px rgba(239,68,68,.22)}
.crm-notification-dot.is-empty{background:#dbe5f0;color:#64748b;box-shadow:none}
.crm-toast-wrap{position:fixed;inset-inline-end:24px;bottom:24px;z-index:99999;display:grid;gap:10px;width:min(380px,calc(100vw - 32px));pointer-events:none}
.crm-toast-alert{pointer-events:auto;display:block;background:#fff;border:1px solid var(--crm-border);border-inline-start:5px solid var(--crm-primary);border-radius:18px;padding:14px 16px;box-shadow:0 22px 50px rgba(15,23,42,.16);transform:translateY(12px);opacity:0;transition:.25s;color:var(--crm-text)}
.crm-toast-alert.is-visible{transform:translateY(0);opacity:1}
.crm-toast-alert strong{display:block;font-size:14px;margin-bottom:4px;color:var(--crm-text)}
.crm-toast-alert span{display:block;color:var(--crm-muted);font-size:13px;line-height:1.7}
@media(max-width:860px){.crm-topbar-tools{justify-content:flex-start;margin-top:14px}.crm-user-card{border-radius:18px}.crm-notification-pill,.crm-notification-toggle{flex:1;justify-content:center}.crm-toast-wrap{inset-inline:12px;bottom:14px;width:auto}}

/* v1.5.0 External Notifications */
.crm-subtle-box {
    background: rgba(15, 23, 42, .035);
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 18px;
    padding: 14px;
}
.crm-btn-light {
    background: #f8fafc;
    color: #0f172a;
    border: 1px solid #dbe4f0;
}
.crm-btn-light:hover {
    background: #eef3fb;
    color: #0f172a;
}

/* v1.5.8 - CRM illustrated icons */
.crm-nav-link--image::before { content: none !important; display: none !important; }
.crm-menu-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: inline-grid;
    place-items: center;
    border-radius: 13px;
    background: rgba(255,255,255,.82);
    border: 1px solid rgba(var(--crm-primary-rgb), .08);
    box-shadow: 0 10px 24px rgba(25, 42, 70, .055);
    overflow: hidden;
    transition: .18s ease;
}
.crm-menu-icon img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    display: block;
}
.crm-sidebar a.crm-nav-link--image { gap: 10px; padding-inline-start: 10px; }
.crm-sidebar a.crm-nav-link--image:hover .crm-menu-icon,
.crm-sidebar a.crm-nav-link--image.active .crm-menu-icon {
    background: #fff;
    transform: translateY(-1px);
    border-color: rgba(255,255,255,.82);
}
.crm-sidebar a.crm-nav-link--image.active .crm-menu-icon { box-shadow: 0 12px 26px rgba(15,23,42,.13); }
.crm-sidebar a[href*="logout"]::before { content: '⎋'; color: #ef4444; }

.crm-hero-card { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.crm-hero-content { position: relative; z-index: 2; min-width: 0; }
.crm-hero-illustration {
    position: relative;
    z-index: 2;
    width: 136px;
    height: 136px;
    object-fit: contain;
    flex: 0 0 136px;
    filter: drop-shadow(0 20px 34px rgba(15,23,42,.14));
}
.crm-quick-list--icons .crm-quick-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 106px;
    padding: 14px 10px;
    text-align: center;
}
.crm-quick-icon {
    width: 54px;
    height: 54px;
    display: inline-grid;
    place-items: center;
    border-radius: 20px;
    background: #fff;
    border: 1px solid rgba(var(--crm-primary-rgb), .08);
    box-shadow: 0 12px 28px rgba(25,42,70,.06);
}
.crm-quick-icon img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    display: block;
}
.crm-quick-item:hover .crm-quick-icon { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(var(--crm-primary-rgb), .10); }

@media (max-width: 860px) {
    .crm-menu-icon { width: 30px; height: 30px; flex-basis: 30px; border-radius: 11px; }
    .crm-menu-icon img { width: 25px; height: 25px; }
    .crm-hero-illustration { width: 104px; height: 104px; flex-basis: 104px; }
    .crm-quick-list--icons .crm-quick-item { min-height: 96px; }
}
@media (max-width: 576px) {
    .crm-hero-card { align-items: flex-start; }
    .crm-hero-illustration { width: 86px; height: 86px; flex-basis: 86px; }
}

/* v1.6.0 - Ticketing Core / SLA */
.crm-sla-pill {
    display: inline-flex;
    align-items: center;
    margin-top: 8px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    background: #eef3fb;
    color: #475569;
}
.crm-sla-ok { background: #dcfce7; color: #166534; }
.crm-sla-pending { background: #dbeafe; color: #1d4ed8; }
.crm-sla-late, .crm-badge-danger { background: #fee2e2; color: #b91c1c; }
.crm-sla-unknown { background: #f1f5f9; color: #64748b; }

/* v1.7.0 - Advanced report UI */
.crm-export-panel .table td,
.crm-export-panel .table th { vertical-align: middle; }
.crm-mini-metric {
    min-height: 88px;
    border: 1px solid var(--crm-border);
    border-radius: 18px;
    background: var(--crm-surface-soft);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
}
.crm-mini-metric span { color: var(--crm-muted); font-size: 12px; }
.crm-mini-metric strong { color: var(--crm-text); font-size: 20px; font-weight: 800; }

.crm-captcha-row {
    display: grid;
    grid-template-columns: 132px 1fr;
    gap: 10px;
    align-items: center;
}
.crm-captcha-question {
    min-height: 48px;
    border: 1px solid var(--crm-border-strong);
    border-radius: 15px;
    background: var(--crm-primary-soft);
    color: var(--crm-primary);
    display: grid;
    place-items: center;
    font-weight: 800;
    letter-spacing: .02em;
}
.crm-remember-row {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--crm-muted);
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}
.crm-remember-row input {
    width: 18px;
    height: 18px;
    accent-color: var(--crm-primary);
}
@media (max-width: 575px) {
    .crm-captcha-row { grid-template-columns: 1fr; }
}

/* v1.8.2: clearer remember-me/login persistence hint */
.crm-remember-row span {
    display: flex;
    flex-direction: column;
    gap: 3px;
    line-height: 1.45;
}
.crm-remember-row small {
    color: var(--crm-muted);
    font-size: 11px;
    font-weight: 500;
}

/* v1.8.3 - Login redirect, compact grouped sidebar, dashboard metric typography */
.crm-sidebar {
    overflow-y: auto;
    max-height: calc(100vh - 84px);
    scrollbar-width: thin;
    padding-bottom: 18px;
}
.crm-sidebar-brand {
    margin-bottom: 10px !important;
}
.crm-nav-group {
    border: 1px solid rgba(219, 229, 240, .82);
    background: rgba(255, 255, 255, .66);
    border-radius: 18px;
    padding: 6px;
    margin: 0 0 8px;
}
.crm-nav-group summary {
    list-style: none;
    cursor: pointer;
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 10px;
    color: #475569;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: -.01em;
    border-radius: 13px;
    user-select: none;
}
.crm-nav-group summary::-webkit-details-marker { display: none; }
.crm-nav-group summary::after {
    content: '⌄';
    width: 22px;
    height: 22px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    color: var(--crm-primary);
    background: var(--crm-primary-soft);
    transition: .18s ease;
    font-size: 14px;
    line-height: 1;
}
.crm-nav-group[open] summary::after { transform: rotate(180deg); }
.crm-nav-group-items {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 4px 0 2px;
}
.crm-nav-group .crm-nav-link {
    min-height: 40px;
    padding: 7px 9px;
    border-radius: 13px;
    margin: 0;
    font-size: 13px;
}
.crm-nav-group .crm-menu-icon {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
    border-radius: 12px;
}
.crm-nav-group .crm-menu-icon img {
    width: 25px;
    height: 25px;
}
.crm-sidebar a.crm-logout-link {
    margin-top: 8px;
    min-height: 42px;
    flex-shrink: 0;
}
.crm-stat-card strong.crm-stat-value-text {
    font-size: clamp(18px, 1.65vw, 23px);
    line-height: 1.55;
    letter-spacing: -.02em;
    word-break: keep-all;
    overflow-wrap: anywhere;
}
.crm-stat-card small + strong.crm-stat-value-text { margin-top: 12px; }
@media (max-width: 1280px) {
    .crm-layout { grid-template-columns: 260px 1fr; }
    .crm-sidebar { padding: 22px 18px; }
    .crm-nav-group .crm-nav-link { font-size: 12.5px; }
}
@media (max-width: 860px) {
    .crm-sidebar {
        display: block;
        max-height: none;
        overflow: visible;
        padding: 16px;
    }
    .crm-nav-group { margin-bottom: 8px; }
    .crm-sidebar a.crm-logout-link { margin-top: 8px; }
    .crm-stat-card strong.crm-stat-value-text { font-size: 18px; }
}

/* v1.8.4 - no inner sidebar scrollbar, cleaner pagination and smaller metric text */
.crm-sidebar {
    max-height: none !important;
    overflow: visible !important;
    gap: 6px;
}
.crm-sidebar-brand {
    padding-bottom: 14px !important;
    margin-bottom: 8px !important;
}
.crm-nav-group {
    margin-bottom: 7px;
    padding: 5px;
    border-radius: 17px;
}
.crm-nav-group:not([open]) {
    padding-bottom: 5px;
}
.crm-nav-group:not([open]) .crm-nav-group-items {
    display: none;
}
.crm-nav-group summary {
    min-height: 32px;
    padding: 5px 9px;
}
.crm-nav-group .crm-nav-link {
    min-height: 36px;
    padding: 6px 8px;
    font-size: 12.5px;
}
.crm-nav-group .crm-menu-icon {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
    border-radius: 11px;
}
.crm-nav-group .crm-menu-icon img {
    width: 23px;
    height: 23px;
}
.crm-sidebar a.crm-logout-link {
    min-height: 38px;
    margin-top: 8px;
    justify-content: center;
}
.crm-user-card {
    text-align: center;
    line-height: 1.85;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.crm-stat-card strong.crm-stat-value-text {
    font-size: clamp(15px, 1.15vw, 18px) !important;
    line-height: 1.8;
    letter-spacing: -.015em;
}
.crm-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    flex-wrap: wrap;
    padding-top: 12px;
}
.crm-page-link {
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid var(--crm-border);
    background: #fff;
    color: #40516b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 900;
    text-decoration: none;
    box-shadow: 0 8px 20px rgba(15,23,42,.035);
}
.crm-page-link:hover {
    background: var(--crm-primary-soft);
    color: var(--crm-primary);
}
.crm-page-link.is-active {
    background: var(--crm-primary);
    color: #fff;
    border-color: var(--crm-primary);
    box-shadow: 0 12px 28px rgba(var(--crm-primary-rgb), .18);
}
.crm-page-link.is-disabled {
    pointer-events: none;
    opacity: .48;
    background: #f8fafc;
}
@media (max-width: 1280px) {
    .crm-layout { grid-template-columns: 248px 1fr; }
    .crm-sidebar { padding: 18px 14px; }
    .crm-sidebar-brand .crm-logo { width: 34px; height: 34px; }
    .crm-sidebar strong { font-size: 15px; }
    .crm-sidebar small { font-size: 11px; }
}
@media (max-width: 860px) {
    .crm-stat-card strong.crm-stat-value-text { font-size: 16px !important; }
    .crm-pagination { justify-content: flex-start; }
}

/* v1.9.0 Knowledge Base & canned responses */
.crm-kb-suggestions {
    border: 1px solid var(--crm-border);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(var(--crm-primary-rgb), .055), rgba(255,255,255,.88));
    padding: 14px;
}
.crm-kb-suggestion-item,
.crm-kb-card {
    display: block;
    height: 100%;
    padding: 14px 16px;
    border: 1px solid var(--crm-border);
    border-radius: 16px;
    background: #fff;
    color: var(--crm-text);
    text-decoration: none;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .035);
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.crm-kb-suggestion-item:hover,
.crm-kb-card:hover {
    transform: translateY(-2px);
    border-color: rgba(var(--crm-primary-rgb), .28);
    box-shadow: 0 14px 32px rgba(var(--crm-primary-rgb), .11);
    color: var(--crm-primary);
}
.crm-kb-suggestion-item strong,
.crm-kb-card strong {
    display: block;
    font-size: 13px;
    line-height: 1.9;
}
.crm-kb-suggestion-item small,
.crm-kb-card small {
    display: block;
    margin-top: 4px;
    color: var(--crm-muted);
    font-size: 11.5px;
}
.crm-kb-card p {
    margin: 10px 0 0;
    color: var(--crm-muted);
    font-size: 12.5px;
    line-height: 2;
}
.crm-article-body {
    color: var(--crm-text);
    line-height: 2.35;
    font-size: 14px;
    white-space: normal;
}

/* v2.1.0 - finance module and cleaner information layouts */
.crm-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
}
.crm-info-grid--customer {
    grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
}
.crm-info-card {
    min-height: 86px;
    border: 1px solid var(--crm-border);
    border-radius: 20px;
    padding: 15px 16px;
    background: linear-gradient(180deg, #fff, var(--crm-surface-soft));
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    overflow: hidden;
}
.crm-info-card small {
    display: block;
    color: var(--crm-muted);
    font-size: 12px;
    font-weight: 800;
}
.crm-info-card strong {
    display: block;
    color: var(--crm-text);
    font-size: 14px;
    line-height: 1.65;
    font-weight: 900;
    word-break: break-word;
}
.crm-section-title {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.crm-section-title h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 900;
    color: var(--crm-text);
}
.crm-section-title span {
    color: var(--crm-muted);
    font-size: 12px;
    font-weight: 600;
}
.crm-subpanel {
    border: 1px solid var(--crm-border);
    border-radius: 22px;
    background: #fbfdff;
    padding: 18px;
}
.crm-inline-edit-form {
    display: grid;
    grid-template-columns: minmax(108px, .7fr) minmax(130px, 1fr) auto;
    gap: 8px;
    align-items: center;
    min-width: 360px;
}
.crm-table-modern thead th {
    color: var(--crm-muted);
    font-size: 12px;
    font-weight: 900;
    border-bottom-color: var(--crm-border-strong);
}
.crm-table-modern tbody td {
    vertical-align: middle;
    border-bottom-color: #eef3f8;
}
.crm-total-strip {
    border: 1px solid var(--crm-border);
    border-radius: 16px;
    padding: 10px 16px;
    background: var(--crm-surface-soft);
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-weight: 900;
}
.crm-total-strip span { color: var(--crm-muted); font-size: 12px; }
.crm-total-strip strong { color: var(--crm-primary); font-size: 18px; }
.crm-invoice-paper {
    border: 1px solid var(--crm-border);
    border-radius: 30px;
    background: #fff;
    padding: 28px;
    box-shadow: 0 18px 55px rgba(15,23,42,.05);
}
.crm-invoice-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--crm-border);
}
.crm-invoice-head h2 {
    margin: 10px 0 4px;
    font-size: 24px;
    font-weight: 900;
    letter-spacing: -.03em;
}
.crm-invoice-head p { margin: 0; color: var(--crm-muted); font-weight: 700; }
.crm-invoice-status {
    min-width: 210px;
    border: 1px solid var(--crm-border);
    border-radius: 20px;
    background: var(--crm-surface-soft);
    padding: 14px 16px;
    text-align: center;
}
.crm-invoice-status strong { display:block; color: var(--crm-primary); font-size: 17px; font-weight: 900; }
.crm-invoice-status span { display:block; color: var(--crm-muted); margin-top: 4px; font-size: 12px; font-weight: 800; }
.crm-note-box {
    border: 1px dashed var(--crm-border-strong);
    border-radius: 18px;
    background: #fbfdff;
    padding: 14px 16px;
}
.crm-note-box small { display:block; color: var(--crm-muted); font-weight: 900; margin-bottom: 8px; }
.crm-note-box p { margin: 0; color: #334155; line-height: 1.9; }
.crm-total-box {
    border: 1px solid var(--crm-border);
    border-radius: 22px;
    background: linear-gradient(180deg, #fff, var(--crm-surface-soft));
    padding: 14px;
}
.crm-total-box > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 10px 6px;
    border-bottom: 1px solid #eef3f8;
}
.crm-total-box > div:last-child { border-bottom: 0; }
.crm-total-box span { color: var(--crm-muted); font-size: 12px; font-weight: 800; }
.crm-total-box strong { color: var(--crm-text); font-weight: 900; }
.crm-total-box .is-final {
    margin: 6px 0;
    border: 0;
    border-radius: 16px;
    background: var(--crm-primary);
    color: #fff;
    padding: 12px;
}
.crm-total-box .is-final span,
.crm-total-box .is-final strong { color: #fff; }
@media print {
    body { background: #fff !important; }
    .crm-sidebar, .crm-topbar, .crm-print-hide { display: none !important; }
    .crm-layout { display: block !important; width: 100% !important; margin: 0 !important; border: 0 !important; box-shadow: none !important; }
    .crm-main { padding: 0 !important; }
    .crm-invoice-paper { border: 0; box-shadow: none; border-radius: 0; }
}
@media (max-width: 992px) {
    .crm-inline-edit-form { min-width: 0; grid-template-columns: 1fr; }
    .crm-invoice-head { flex-direction: column; }
    .crm-invoice-status { width: 100%; }
}
@media (max-width: 575px) {
    .crm-info-grid, .crm-info-grid--customer { grid-template-columns: 1fr; }
    .crm-invoice-paper { padding: 18px; border-radius: 22px; }
}


/* v2.1.1 - UI polish, notification pagination, cleaner action forms */
.crm-form-grid {
    display: grid;
    gap: 14px;
    align-items: end;
}
.crm-customer-user-form {
    grid-template-columns: minmax(170px, 1.25fr) minmax(150px, 1fr) minmax(180px, 1.2fr) minmax(128px, .8fr) minmax(104px, auto);
}
.crm-document-upload-form {
    grid-template-columns: minmax(150px, 1fr) minmax(190px, 1.2fr) minmax(120px, .7fr) minmax(110px, auto);
}
.crm-form-action {
    display: flex;
    align-items: end;
    min-width: 104px;
}
.crm-form-action .crm-btn {
    min-width: 96px;
    white-space: nowrap;
}
select.crm-input,
.form-select {
    appearance: none;
    -webkit-appearance: none;
    padding-inline-end: 15px;
    padding-inline-start: 42px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235c6d86' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: 14px 14px;
    background-position: 16px center;
}
.crm-input[type="file"] {
    padding-block: 10px;
    overflow: hidden;
}
.crm-nav-group summary::after {
    content: '▾' !important;
    width: 24px;
    height: 24px;
    min-width: 24px;
    border-radius: 999px;
    background: var(--crm-primary-soft);
    color: var(--crm-primary);
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-family: Arial, sans-serif;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
    transform: none;
    padding: 0;
}
.crm-nav-group[open] summary::after {
    transform: rotate(180deg);
}
.crm-sidebar a.crm-logout-link {
    border: 1px solid #fee2e2;
    background: linear-gradient(180deg, #fff8f8, #fff1f2);
    color: #dc2626 !important;
    border-radius: 18px;
    min-height: 46px;
    box-shadow: 0 12px 28px rgba(239,68,68,.07);
    gap: 9px;
}
.crm-sidebar a.crm-logout-link::before {
    content: '⎋' !important;
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(239,68,68,.09);
    color: #ef4444;
    margin: 0;
    font-size: 14px;
}
.crm-sidebar a.crm-logout-link:hover {
    background: #ef4444;
    color: #fff !important;
    transform: translateY(-1px);
}
.crm-sidebar a.crm-logout-link:hover::before {
    background: rgba(255,255,255,.18);
    color: #fff;
}
.crm-info-grid--profile {
    grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
    align-items: stretch;
}
.crm-info-card {
    min-height: 82px;
    align-items: flex-start;
    text-align: start;
}
.crm-info-card strong {
    max-width: 100%;
    overflow-wrap: anywhere;
}
.crm-subpanel {
    overflow: hidden;
}
.crm-notification-list {
    display: grid;
    gap: 12px;
}
.crm-notification-item {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    border: 1px solid var(--crm-border);
    border-radius: 18px;
    background: #fff;
    padding: 14px;
    box-shadow: 0 10px 24px rgba(15,23,42,.035);
}
.crm-notification-item.is-unread {
    background: linear-gradient(135deg, rgba(var(--crm-primary-rgb), .075), #fff);
    border-color: rgba(var(--crm-primary-rgb), .18);
}
.crm-notification-icon {
    width: 42px;
    height: 42px;
    border-radius: 15px;
    background: var(--crm-primary-soft);
    position: relative;
}
.crm-notification-icon::after {
    content: '';
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: var(--crm-primary);
    position: absolute;
    inset: 0;
    margin: auto;
}
.crm-notification-content { min-width: 0; }
.crm-notification-title-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.crm-notification-content strong {
    font-size: 14px;
    color: var(--crm-text);
}
.crm-notification-content p {
    margin: 7px 0 3px;
    color: var(--crm-muted);
    font-size: 13px;
    line-height: 1.9;
}
.crm-notification-content small {
    color: var(--crm-muted-2);
    font-size: 11.5px;
}
.crm-notification-action .crm-btn {
    min-height: 38px;
    padding: 8px 13px;
}
@media (max-width: 1200px) {
    .crm-customer-user-form,
    .crm-document-upload-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .crm-form-action { min-width: 0; }
}
@media (max-width: 680px) {
    .crm-customer-user-form,
    .crm-document-upload-form {
        grid-template-columns: 1fr;
    }
    .crm-notification-item {
        grid-template-columns: 36px minmax(0, 1fr);
    }
    .crm-notification-action {
        grid-column: 2;
    }
}

/* v2.5.2 - Stable layout grid helpers without experimental drag/drop personalization */
.crm-personal-layout {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 24px;
    align-items: stretch;
}
.crm-personal-layout .crm-layout-col { min-width: 0; }
.crm-layout-span-12 { grid-column: span 12; }
.crm-layout-span-8 { grid-column: span 8; }
.crm-layout-span-7 { grid-column: span 7; }
.crm-layout-span-6 { grid-column: span 6; }
.crm-layout-span-5 { grid-column: span 5; }
.crm-layout-span-4 { grid-column: span 4; }
.crm-personal-layout--dashboard { margin-top: 10px; }
.crm-profile-stat-grid { margin-bottom: 22px; }
@media (max-width: 1199px) {
    .crm-layout-span-8,
    .crm-layout-span-7,
    .crm-layout-span-6,
    .crm-layout-span-5,
    .crm-layout-span-4 { grid-column: span 12; }
}
@media (max-width: 767px) {
    .crm-personal-layout { gap: 16px; }
}

/* v2.2.0 - Projects module small UI helpers */
.crm-check {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    min-height: 44px;
    padding: .65rem .9rem;
    border: 1px solid #dbe7f7;
    border-radius: 16px;
    background: #f8fbff;
    color: #334155;
    font-weight: 800;
}
.crm-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--crm-primary);
}

/* v2.2.3 - Canned responses UX */
.crm-canned-response-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
    width: 100%;
}
.crm-canned-response-row .crm-input {
    min-width: 0;
    flex: 1 1 auto;
}
.crm-canned-response-row .crm-btn {
    flex: 0 0 auto;
    min-width: 112px;
    justify-content: center;
    white-space: nowrap;
}
@media (max-width: 575.98px) {
    .crm-canned-response-row {
        flex-direction: column;
    }
    .crm-canned-response-row .crm-btn {
        width: 100%;
    }
}

/* v2.2.4 - Canned responses department-aware UX */
.crm-canned-response-picker .crm-input:disabled,
.crm-canned-response-picker .crm-btn:disabled {
    opacity: .72;
    cursor: not-allowed;
}
.crm-canned-response-picker [data-canned-response-empty] {
    line-height: 1.9;
}

/* v2.3.0 - System maintenance */
.crm-maintenance-alert {
    border-radius: 18px;
    border: 1px solid #fde68a;
    background: #fffbeb;
    color: #92400e;
}
.crm-maintenance-stat small {
    color: var(--crm-muted);
    font-weight: 700;
}
.crm-maintenance-stat strong {
    display: block;
    margin-top: 8px;
    font-size: 24px;
    font-weight: 900;
    color: var(--crm-text);
}
.crm-maintenance-stat span {
    display: block;
    margin-top: 6px;
    color: var(--crm-muted);
    font-size: 12px;
}
.crm-maintenance-table-wrap {
    max-height: 520px;
    overflow: auto;
    border: 1px solid var(--crm-border);
    border-radius: 18px;
}
.crm-maintenance-table-wrap table {
    margin-bottom: 0;
}
.crm-maintenance-table-wrap thead th {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
}
.crm-cleanup-list .list-group-item {
    border-color: var(--crm-border);
}
.crm-maintenance-health .badge,
.crm-cleanup-list .badge {
    white-space: normal;
    line-height: 1.6;
}
@media (max-width: 767px) {
    .crm-maintenance-table-wrap {
        max-height: none;
    }
    .crm-maintenance-stat strong {
        font-size: 20px;
    }
}

/* v2.4.0 - backup, restore and maintenance mode */
.crm-backup-hero {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 18px;
    padding: 22px;
    border: 1px solid #dbe6fb;
    border-radius: 22px;
    background: linear-gradient(135deg, #ffffff 0%, #f5f8ff 100%);
    box-shadow: 0 16px 40px rgba(31, 56, 110, .06);
}
.crm-backup-hero h2 { margin: 0 0 8px; font-size: 22px; font-weight: 900; color: #17233f; }
.crm-backup-hero p { margin: 0; color: #64748b; line-height: 2; max-width: 760px; }
.crm-backup-stats {
    min-width: 260px;
    display: grid;
    gap: 8px;
    align-content: center;
}
.crm-backup-stats span {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 14px;
    background: rgba(255,255,255,.82);
    border: 1px solid #e4ebfb;
    font-size: 12px;
    color: #506282;
}
.crm-backup-stats strong { color: #1d2a44; }
.crm-soft-badge,
.crm-status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    background: #edf4ff;
    color: #2454ff;
    border: 1px solid #d6e4ff;
    white-space: nowrap;
}
.crm-status-pill.is-success { background: #ecfdf5; color: #047857; border-color: #bbf7d0; }
.crm-status-pill.is-warning { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.crm-checkline {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #e2eaf8;
    border-radius: 14px;
    background: #f8fbff;
    color: #34445f;
    font-size: 13px;
    font-weight: 700;
}
.crm-checkline input { width: 18px; height: 18px; accent-color: var(--crm-primary); }
.crm-actions-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.crm-actions-inline form { display: inline-flex; margin: 0; }
.crm-btn-sm { min-height: 34px; padding: 7px 12px; font-size: 12px; border-radius: 12px; }
.crm-btn-danger { background: #ef4444; border-color: #ef4444; color: #fff; }
.crm-btn-danger:hover { background: #dc2626; border-color: #dc2626; color: #fff; }
.crm-maintenance-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background:
        radial-gradient(circle at 80% 15%, rgba(36,84,255,.14), transparent 28%),
        linear-gradient(135deg, #f7faff 0%, #eef4ff 100%);
    font-family: var(--crm-font-family);
}
.crm-maintenance-card {
    width: min(100%, 560px);
    text-align: center;
    padding: 34px;
    border-radius: 28px;
    background: rgba(255,255,255,.92);
    border: 1px solid #dbe6fb;
    box-shadow: 0 26px 80px rgba(31, 56, 110, .14);
}
.crm-maintenance-badge {
    display: inline-flex;
    margin: 18px 0 12px;
    padding: 8px 14px;
    border-radius: 999px;
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
    font-size: 12px;
    font-weight: 900;
}
.crm-maintenance-card h1 { margin: 0 0 12px; font-size: 24px; font-weight: 900; color: #17233f; }
.crm-maintenance-card p { margin: 0 auto 22px; color: #52627f; line-height: 2.05; }
@media (max-width: 768px) {
    .crm-backup-hero { flex-direction: column; padding: 18px; }
    .crm-backup-stats { min-width: 0; }
    .crm-backup-stats span { align-items: flex-start; flex-direction: column; gap: 4px; }
    .crm-actions-inline { align-items: stretch; }
    .crm-actions-inline .crm-btn,
    .crm-actions-inline form { width: 100%; }
    .crm-actions-inline form .crm-btn { width: 100%; }
    .crm-maintenance-card { padding: 26px 18px; }
}

/* v2.5.2 - final stabilization, upload/schema hardening and module metadata normalization */
.crm-security-card {
    border-color: #dbe6fb;
}
.crm-security-card.is-ok {
    background: linear-gradient(135deg, #ffffff 0%, #f7fffb 100%);
}
.crm-security-card.is-warning {
    background: linear-gradient(135deg, #ffffff 0%, #fffaf0 100%);
}
.crm-security-table-wrap {
    max-height: 620px;
    overflow: auto;
    border: 1px solid var(--crm-border);
    border-radius: 18px;
}
.crm-security-table-wrap table { margin-bottom: 0; }
.crm-security-table-wrap thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fff;
}
.crm-access-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    border: 1px solid transparent;
}
.crm-access-pill.is-allow {
    background: #ecfdf5;
    color: #047857;
    border-color: #bbf7d0;
}
.crm-access-pill.is-deny {
    background: #fff1f2;
    color: #be123c;
    border-color: #fecdd3;
}
.crm-rich-editor {
    border: 1px solid #dbe7f7;
    border-radius: 18px;
    overflow: hidden;
    background: #fff;
}
.crm-rich-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px;
    background: #f8fbff;
    border-bottom: 1px solid #e4edf9;
}
.crm-rich-editor-toolbar button {
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid #d8e4f4;
    border-radius: 10px;
    background: #fff;
    color: #26364d;
    font-weight: 800;
    font-size: 12px;
    cursor: pointer;
}
.crm-rich-editor-toolbar button:hover,
.crm-rich-editor-toolbar button:focus {
    border-color: var(--crm-primary);
    color: var(--crm-primary);
    outline: none;
}
.crm-rich-editor-area {
    min-height: 260px;
    padding: 16px 18px;
    line-height: 2.1;
    color: #17233f;
    background: #fff;
    outline: none;
}
.crm-rich-editor-area:focus {
    box-shadow: inset 0 0 0 2px rgba(36,84,255,.12);
}
.crm-article-body {
    line-height: 2.15;
    color: #17233f;
    word-break: break-word;
}
.crm-article-body h2,
.crm-article-body h3,
.crm-article-body h4 {
    margin: 1.35rem 0 .65rem;
    font-weight: 900;
    color: #14213d;
}
.crm-article-body p { margin: 0 0 1rem; }
.crm-article-body ul,
.crm-article-body ol { padding-inline-start: 1.4rem; margin: .8rem 0 1rem; }
.crm-article-body blockquote {
    margin: 1rem 0;
    padding: 12px 16px;
    border-inline-start: 4px solid var(--crm-primary);
    background: #f7faff;
    border-radius: 14px;
    color: #334155;
}
.crm-article-body pre,
.crm-article-body code {
    direction: ltr;
    text-align: left;
    font-family: Consolas, Monaco, monospace;
}
.crm-article-body pre {
    overflow: auto;
    padding: 14px;
    border-radius: 14px;
    background: #0f172a;
    color: #e2e8f0;
}
.crm-article-body a {
    color: var(--crm-primary);
    font-weight: 800;
    text-decoration: none;
}
.crm-article-body a:hover { text-decoration: underline; }
@media (max-width: 575.98px) {
    .crm-rich-editor-toolbar { align-items: stretch; }
    .crm-rich-editor-toolbar button { flex: 1 1 auto; }
    .crm-rich-editor-area { min-height: 220px; padding: 14px; }
    .crm-security-table-wrap { max-height: none; }
}

/* v1.6.0 - Operational dashboard, mobile polish and action-first UI */
.crm-dashboard-hero-v16 { grid-template-columns: minmax(0, 1fr) 360px; }
.crm-grid-compact { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.crm-stat-card-compact { min-height: 104px; padding: 18px; }
.crm-stat-card-compact::before { width: 36px; height: 36px; border-radius: 13px; }
.crm-stat-card-compact::after { width: 14px; height: 14px; inset-inline-end: 29px; top: 29px; }
.crm-stat-card-compact small { padding-inline-end: 48px; }
.crm-operations-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 24px 26px;
    border-radius: 28px;
    border: 1px solid rgba(var(--crm-primary-rgb), .12);
    background:
        radial-gradient(circle at 12% 18%, rgba(var(--crm-primary-rgb), .10), transparent 28%),
        linear-gradient(135deg, #fff, #f7faff);
    box-shadow: 0 18px 46px rgba(25, 42, 70, .055);
}
.crm-operations-hero h2 { margin: 0 0 8px; font-size: 24px; font-weight: 900; letter-spacing: -.03em; }
.crm-operations-hero p { margin: 0; color: var(--crm-muted); }
.crm-operations-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.crm-ops-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
}
.crm-empty-state {
    min-height: 96px;
    display: grid;
    place-items: center;
    text-align: center;
    border: 1px dashed var(--crm-border-strong);
    border-radius: 20px;
    background: var(--crm-surface-soft);
    color: var(--crm-muted);
    font-weight: 700;
    padding: 18px;
}
.crm-timeline-list { display: grid; gap: 10px; }
.crm-timeline-item {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 13px 14px;
    border: 1px solid var(--crm-border);
    border-radius: 17px;
    background: #fff;
    transition: .18s ease;
}
.crm-timeline-item:hover { background: var(--crm-primary-soft); border-color: rgba(var(--crm-primary-rgb), .24); transform: translateY(-1px); }
.crm-timeline-dot { width: 10px; height: 10px; border-radius: 999px; background: #ef4444; box-shadow: 0 0 0 4px #fee2e2; }
.crm-timeline-item strong { display: block; font-weight: 900; color: var(--crm-text); }
.crm-timeline-item small { display: block; color: var(--crm-muted); margin-top: 3px; }
.crm-timeline-item em { font-style: normal; color: var(--crm-muted); font-weight: 800; font-size: 12px; }
.crm-topbar-tools { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.crm-mobile-actionbar { display: none; }
.crm-panel .table-responsive { max-width: 100%; }
.table-warning td { --bs-table-color: #7c2d12; --bs-table-bg: #fff7ed; }
@media (max-width: 1280px) {
    .crm-dashboard-hero-v16 { grid-template-columns: 1fr; }
    .crm-grid-compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
    .crm-ops-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .crm-operations-hero { flex-direction: column; align-items: stretch; padding: 20px; border-radius: 24px; }
    .crm-operations-actions .crm-btn { flex: 1; }
    .crm-grid-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .crm-mobile-actionbar {
        position: sticky;
        bottom: 10px;
        z-index: 999;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        margin-top: 18px;
        padding: 8px;
        border: 1px solid var(--crm-border);
        border-radius: 20px;
        background: rgba(255,255,255,.92);
        box-shadow: 0 18px 44px rgba(15,23,42,.14);
        backdrop-filter: blur(14px);
    }
    .crm-mobile-actionbar a { min-height: 42px; border-radius: 14px; font-size: 12px; padding: 9px; }
}
@media (max-width: 640px) {
    .table-responsive table.crm-responsive-table td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 3px;
        color: var(--crm-muted);
        font-size: 11px;
        font-weight: 900;
    }
    .crm-timeline-item { grid-template-columns: 14px minmax(0, 1fr); }
    .crm-timeline-item em { grid-column: 2; }
}

/* v1.6.1 Icon System & UI Polish */
.crm-icon {
    width: 20px;
    height: 20px;
    display: inline-block;
    flex: 0 0 20px;
    vertical-align: -0.22em;
    stroke: currentColor;
}
.crm-icon-xs { width: 16px; height: 16px; flex-basis: 16px; }
.crm-icon-sm { width: 15px; height: 15px; flex-basis: 15px; }
.crm-icon-hero { width: 96px; height: 96px; stroke-width: 1.65; }
.crm-sidebar a::before { display: none !important; content: none !important; }
.crm-menu-icon {
    width: 30px;
    height: 30px;
    border-radius: 12px;
    display: inline-grid;
    place-items: center;
    color: #64748b;
    background: #f1f5f9;
    flex: 0 0 30px;
    transition: .18s ease;
}
.crm-sidebar a:hover .crm-menu-icon {
    color: var(--crm-primary);
    background: #fff;
    box-shadow: 0 10px 22px rgba(var(--crm-primary-rgb), .08);
}
.crm-sidebar a.active .crm-menu-icon {
    color: var(--crm-primary);
    background: rgba(255,255,255,.96);
    box-shadow: 0 10px 22px rgba(15,23,42,.08);
}
.crm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.crm-quick-icon {
    width: 38px;
    height: 38px;
    border-radius: 15px;
    display: inline-grid;
    place-items: center;
    background: var(--crm-primary-soft);
    color: var(--crm-primary);
    flex: 0 0 38px;
}
.crm-quick-item:hover .crm-quick-icon {
    background: var(--crm-primary);
    color: #fff;
}
.crm-hero-illustration--svg {
    width: 148px;
    height: 148px;
    border-radius: 42px;
    display: grid;
    place-items: center;
    background: rgba(255,255,255,.16);
    color: rgba(255,255,255,.92);
    border: 1px solid rgba(255,255,255,.22);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 22px 50px rgba(15,23,42,.14);
}
.crm-stat-card::before,
.crm-stat-card::after { display: none; }
.crm-stat-icon {
    position: absolute;
    inset-inline-end: 18px;
    top: 18px;
    width: 44px;
    height: 44px;
    border-radius: 16px;
    display: inline-grid;
    place-items: center;
    background: var(--crm-primary-soft);
    color: var(--crm-primary);
    box-shadow: 0 10px 22px rgba(var(--crm-primary-rgb), .08);
}
.crm-stat-icon .crm-icon { width: 22px; height: 22px; }
.crm-stat-card small { padding-inline-end: 58px; }
.crm-badge .crm-icon { margin-inline-start: -2px; }
.crm-badge-neutral { background: #f1f5f9; color: #475569; }
.crm-badge-status { background: #f1f5f9; color: #475569; }
.crm-badge-status-draft { background: #f8fafc; color: #64748b; }
.crm-badge-status-accepted { background: #ecfdf5; color: #047857; }
.crm-badge-status-sent_to_lab { background: #eff6ff; color: #1d4ed8; }
.crm-badge-status-in_progress { background: #eef2ff; color: #4338ca; }
.crm-badge-status-needs_revision { background: #fff7ed; color: #c2410c; }
.crm-badge-status-returned { background: #fff1f2; color: #be123c; }
.crm-badge-status-ready { background: #ecfdf5; color: #15803d; }
.crm-badge-status-delivered { background: #f0fdf4; color: #166534; }
.crm-badge-status-closed { background: #f1f5f9; color: #334155; }
.crm-badge-status-cancelled { background: #fef2f2; color: #b91c1c; }
.crm-mobile-actionbar .crm-btn { gap: 6px; }
@media (max-width: 860px) {
    .crm-menu-icon { width: 28px; height: 28px; border-radius: 11px; }
    .crm-sidebar a { gap: 10px; }
    .crm-hero-illustration--svg { display: none; }
}

/* v1.6.2 - Sidebar brand, logo placement, user card and Jalali date polish */
.crm-sidebar-brand {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 0 4px 14px !important;
    margin: 0 0 8px !important;
    border-bottom: 1px solid var(--crm-border) !important;
}
.crm-brand-logo-wrap {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 16px;
    display: inline-grid;
    place-items: center;
    background: #fff;
    border: 1px solid rgba(var(--crm-primary-rgb), .10);
    box-shadow: 0 12px 28px rgba(25, 42, 70, .07);
    overflow: hidden;
}
.crm-brand-logo {
    width: 35px;
    height: 35px;
    object-fit: contain;
    display: block;
}
.crm-brand-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.crm-brand-text strong {
    display: block;
    color: var(--crm-text);
    font-weight: 900;
    font-size: 15px;
    line-height: 1.45;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.crm-brand-text small {
    font-size: 11px;
    color: var(--crm-muted-2) !important;
}
.crm-sidebar-user-card {
    margin: 0 0 10px;
    padding: 10px 12px;
    border: 1px solid var(--crm-border);
    border-radius: 16px;
    background: linear-gradient(180deg, #fff, var(--crm-surface-soft));
    color: #475569;
    box-shadow: 0 10px 24px rgba(25,42,70,.035);
    display: grid;
    gap: 4px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.75;
}
.crm-topbar-tools:empty { display: none !important; }
.crm-filter-summary p { font-weight: 700; }
.crm-jalali-wrap { isolation: isolate; }
.crm-jalali-wrap .crm-jalali-input {
    padding-inline-start: 42px;
    text-align: left;
    direction: ltr;
    font-weight: 800;
    letter-spacing: .01em;
    color: var(--crm-text);
    background:
        linear-gradient(90deg, transparent 0, transparent calc(100% - 40px), rgba(var(--crm-primary-rgb), .045) calc(100% - 40px)),
        #fff;
}
.crm-jalali-wrap::before {
    content: '';
    position: absolute;
    inset-inline-start: 14px;
    top: 50%;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
    pointer-events: none;
    opacity: .72;
    background: currentColor;
    color: #64748b;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E") center / contain no-repeat;
}
.crm-jalali-wrap:focus-within::before { color: var(--crm-primary); opacity: 1; }
.crm-jalali-popup {
    direction: rtl;
    font-family: var(--crm-font-family);
    border-color: rgba(var(--crm-primary-rgb), .16);
    background: linear-gradient(180deg, #fff, #f8fbff);
}
.crm-jalali-head strong {
    font-weight: 900;
    letter-spacing: -.02em;
}
.crm-jalali-week span,
.crm-jalali-days button,
.crm-jalali-foot button {
    font-family: var(--crm-font-family);
}
.crm-jalali-days span { min-height: 36px; }
.crm-jalali-days button {
    cursor: pointer;
    transition: .14s ease;
}
.crm-jalali-foot button {
    padding: 0 13px;
    min-width: 70px;
}
@media (max-width: 1280px) {
    .crm-brand-logo-wrap { width: 40px; height: 40px; flex-basis: 40px; border-radius: 14px; }
    .crm-brand-logo { width: 32px; height: 32px; }
    .crm-sidebar-user-card { font-size: 11.5px; padding: 9px 10px; }
}
@media (max-width: 860px) {
    .crm-sidebar-brand { grid-column: 1 / -1; }
    .crm-sidebar-user-card { grid-column: 1 / -1; }
}

/* v1.6.3 - Duplicate title removal and dashboard logo hero */
.crm-duplicate-title-hidden {
    display: none !important;
}
.crm-page-head.crm-page-head--title-hidden {
    align-items: flex-start;
}
.crm-page-head.crm-page-head--title-hidden p {
    margin-top: 0 !important;
}
.crm-hero-illustration--logo {
    width: 168px;
    height: 168px;
    border-radius: 40px;
    display: inline-grid;
    place-items: center;
    background: linear-gradient(160deg, rgba(255,255,255,.96), rgba(255,255,255,.74));
    border: 1px solid rgba(255,255,255,.72);
    box-shadow: 0 24px 60px rgba(15, 23, 42, .18);
    overflow: hidden;
}
.crm-hero-illustration--logo img {
    width: 118px;
    height: 118px;
    object-fit: contain;
    display: block;
}
@media (max-width: 860px) {
    .crm-hero-illustration--logo {
        display: none;
    }
}


/* v1.7.0 clinic settings and print polish */
.crm-settings-stack{display:flex;flex-direction:column;gap:18px}.crm-settings-section{border:1px solid rgba(148,163,184,.28);border-radius:22px;padding:18px;background:rgba(255,255,255,.72)}.crm-settings-section h3{display:flex;align-items:center;gap:8px;font-size:16px;font-weight:900;margin:0 0 16px;color:#0f172a}.crm-check-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.crm-check-grid label{display:flex;align-items:center;gap:8px;border:1px solid rgba(148,163,184,.28);border-radius:14px;padding:10px 12px;background:#fff;font-size:13px;color:#334155}.crm-check-grid input{width:16px;height:16px;accent-color:var(--crm-primary)}.crm-form-actions{display:flex;justify-content:flex-start;gap:10px}.crm-print-logo{background:#fff}.crm-print-footer{font-size:12px}.crm-print-watermark{font-family:var(--crm-font-family)}
@media(max-width:900px){.crm-check-grid{grid-template-columns:1fr}.crm-settings-section{padding:14px}}
.crm-badge-success { background: #ecfdf5; color: #047857; }
.crm-badge-warning { background: #fff7ed; color: #c2410c; }
.crm-health-table td[dir="ltr"] { direction: ltr; text-align: left; }

/* v2.1.0 patient files */
.crm-form-full{grid-column:1/-1}.crm-btn-danger{background:#dc2626;color:#fff;border-color:#dc2626}.crm-btn-danger:hover{background:#b91c1c;color:#fff}.crm-filter-form input[type=file].crm-input{padding:.65rem}

/* v2.2.0 Treatment Plan & Clinical Timeline */
.crm-badge-plan-draft { background: #f8fafc; color: #64748b; }
.crm-badge-plan-active { background: #eff6ff; color: #1d4ed8; }
.crm-badge-plan-completed { background: #ecfdf5; color: #047857; }
.crm-badge-plan-cancelled { background: #fef2f2; color: #b91c1c; }
.crm-badge-step-pending { background: #f8fafc; color: #64748b; }
.crm-badge-step-in_progress { background: #eef2ff; color: #4338ca; }
.crm-badge-step-done { background: #ecfdf5; color: #047857; }
.crm-badge-step-cancelled { background: #fef2f2; color: #b91c1c; }
.crm-clinical-timeline .crm-timeline-item { align-items: flex-start; }
.crm-clinical-timeline .crm-timeline-item em { display: block; margin-top: 6px; line-height: 1.7; }
.crm-inline-edit-form { min-width: 150px; }
@media (max-width: 768px) {
    .crm-clinical-timeline .crm-timeline-item { padding: 12px; }
    .crm-inline-edit-form { min-width: 100%; }
}

.crm-row-attention { background: rgba(255, 193, 7, .08); }
.crm-badge-alert { display:inline-flex; align-items:center; gap:.25rem; border-radius:999px; padding:.25rem .55rem; font-size:.78rem; font-weight:700; background:#eef2ff; color:#334155; }
.crm-badge-alert-low { background:#ecfdf5; color:#047857; }
.crm-badge-alert-medium { background:#fffbeb; color:#b45309; }
.crm-badge-alert-high { background:#fff1f2; color:#be123c; }
.crm-badge-alert-critical { background:#7f1d1d; color:#fff; }

/* v2.4.0 Dental Chart */
.crm-dental-chart{display:grid;grid-template-columns:repeat(16,minmax(52px,1fr));gap:8px;direction:ltr}
.crm-tooth{border:1px solid #d8e0ef;background:#fff;border-radius:14px;min-height:64px;padding:8px 5px;text-align:center;color:#21314d;box-shadow:0 6px 16px rgba(15,23,42,.04);transition:.16s ease;cursor:pointer}
.crm-tooth:hover{transform:translateY(-1px);box-shadow:0 10px 22px rgba(15,23,42,.08)}
.crm-tooth span{display:block;font-weight:800;font-size:15px;line-height:1.2}.crm-tooth small{display:block;font-size:10px;color:#64748b;line-height:1.5;margin-top:4px;direction:rtl}
.crm-tooth-healthy{background:#f8fafc}.crm-tooth-watch{background:#fff7ed;border-color:#fed7aa}.crm-tooth-planned{background:#eff6ff;border-color:#bfdbfe}.crm-tooth-in_treatment{background:#fefce8;border-color:#fde68a}.crm-tooth-treated{background:#ecfdf5;border-color:#bbf7d0}.crm-tooth-missing,.crm-tooth-extracted{background:#f1f5f9;border-color:#cbd5e1;color:#64748b}.crm-tooth-implant,.crm-tooth-crown,.crm-tooth-root_canal{background:#f5f3ff;border-color:#ddd6fe}.crm-tooth-decayed{background:#fef2f2;border-color:#fecaca}
.crm-badge-tooth{background:#eef2ff;color:#1e293b}.crm-badge-tooth-healthy{background:#f8fafc}.crm-badge-tooth-watch{background:#ffedd5}.crm-badge-tooth-planned{background:#dbeafe}.crm-badge-tooth-in_treatment{background:#fef3c7}.crm-badge-tooth-treated{background:#dcfce7}.crm-badge-tooth-decayed,.crm-badge-tooth-extracted{background:#fee2e2}.crm-badge-tooth-missing{background:#e2e8f0}.crm-badge-tooth-implant,.crm-badge-tooth-crown,.crm-badge-tooth-root_canal{background:#ede9fe}
.crm-inline-edit summary{list-style:none}.crm-inline-edit summary::-webkit-details-marker{display:none}.crm-stack{display:grid;gap:8px;min-width:220px}
@media (max-width: 992px){.crm-dental-chart{grid-template-columns:repeat(8,minmax(44px,1fr))}.crm-tooth{min-height:58px}}
@media (max-width: 576px){.crm-dental-chart{grid-template-columns:repeat(4,minmax(54px,1fr))}.crm-tooth small{font-size:9px}}


/* v2.4.1 Dental Chart Visual Upgrade */
.crm-chart-overview{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:14px;margin-bottom:18px}
.crm-chart-summary{display:grid;grid-template-columns:repeat(4,minmax(110px,1fr));gap:10px;flex:1 1 420px}
.crm-chart-stat{background:linear-gradient(180deg,#ffffff,#f8fbff);border:1px solid #d8e0ef;border-radius:16px;padding:12px 14px;box-shadow:0 10px 24px rgba(15,23,42,.04)}
.crm-chart-stat strong{display:block;font-size:20px;line-height:1.2;color:#0f172a}
.crm-chart-stat span{display:block;font-size:12px;color:#64748b;margin-top:4px}
.crm-tooth-legend{display:flex;flex-wrap:wrap;gap:8px 12px;justify-content:flex-end;flex:1 1 280px}
.crm-tooth-legend-item{display:inline-flex;align-items:center;gap:7px;font-size:12px;color:#475569}
.crm-tooth-legend-dot{width:12px;height:12px;border-radius:999px;display:inline-block;border:1px solid rgba(0,0,0,.06)}
.crm-chart-workspace{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(320px,.9fr);gap:18px;align-items:start}
.crm-chart-main{min-width:0}
.crm-chart-sidebar{min-width:0}
.crm-panel-soft{border:1px solid #d8e0ef;background:linear-gradient(180deg,#ffffff,#f8fbff)}
.crm-dental-arches{display:flex;flex-direction:column;gap:18px}
.crm-dental-arch{border:1px solid #e6edf7;border-radius:22px;padding:18px;background:linear-gradient(180deg,#ffffff,#f8fbff)}
.crm-dental-arch-head{display:flex;align-items:end;justify-content:space-between;margin-bottom:14px;color:#334155}
.crm-dental-arch-head span{font-weight:800}
.crm-dental-arch-head small{font-size:11px;color:#94a3b8}
.crm-dental-arch-row{display:grid;grid-template-columns:minmax(0,1fr) 54px minmax(0,1fr);gap:8px;align-items:center}
.crm-dental-arch-group{display:grid;grid-template-columns:repeat(8,minmax(64px,1fr));gap:8px}
.crm-dental-arch-gap{display:flex;align-items:center;justify-content:center;min-height:100%;color:#94a3b8;font-size:10px;letter-spacing:.08em;text-transform:uppercase}
.crm-tooth-card{border:1px solid #d8e0ef;background:#fff;border-radius:18px;padding:10px 8px 8px;text-align:center;color:#21314d;box-shadow:0 8px 20px rgba(15,23,42,.05);transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease;cursor:pointer}
.crm-tooth-card:hover,.crm-tooth-card.is-active{transform:translateY(-2px);box-shadow:0 14px 28px rgba(15,23,42,.10);border-color:#93c5fd}
.crm-tooth-shell{position:relative;display:flex;align-items:center;justify-content:center;min-height:80px}
.crm-tooth-svg{width:50px;height:64px;display:block;fill:currentColor;opacity:.95}
.crm-tooth-number{position:absolute;top:28px;left:50%;transform:translateX(-50%);font-weight:900;font-size:14px;line-height:1;color:#0f172a;background:rgba(255,255,255,.78);padding:2px 4px;border-radius:999px;min-width:28px}
.crm-tooth-surface-pill{position:absolute;top:2px;right:0;font-size:10px;line-height:1;background:#0f172a;color:#fff;padding:4px 5px;border-radius:999px;box-shadow:0 4px 10px rgba(15,23,42,.12)}
.crm-tooth-meta{display:block;margin-top:6px}
.crm-tooth-meta small{display:block;font-size:11px;color:#475569;line-height:1.5;min-height:16px}
.crm-tooth-healthy,.crm-tooth-legend-dot.crm-tooth-healthy{background:#f8fafc;color:#94a3b8;border-color:#e2e8f0}
.crm-tooth-watch,.crm-tooth-legend-dot.crm-tooth-watch{background:#fff7ed;color:#f59e0b;border-color:#fed7aa}
.crm-tooth-planned,.crm-tooth-legend-dot.crm-tooth-planned{background:#eff6ff;color:#3b82f6;border-color:#bfdbfe}
.crm-tooth-in_treatment,.crm-tooth-legend-dot.crm-tooth-in_treatment{background:#fefce8;color:#ca8a04;border-color:#fde68a}
.crm-tooth-treated,.crm-tooth-legend-dot.crm-tooth-treated{background:#ecfdf5;color:#16a34a;border-color:#bbf7d0}
.crm-tooth-missing,.crm-tooth-legend-dot.crm-tooth-missing,.crm-tooth-extracted,.crm-tooth-legend-dot.crm-tooth-extracted{background:#f1f5f9;color:#64748b;border-color:#cbd5e1}
.crm-tooth-implant,.crm-tooth-legend-dot.crm-tooth-implant,.crm-tooth-crown,.crm-tooth-legend-dot.crm-tooth-crown,.crm-tooth-root_canal,.crm-tooth-legend-dot.crm-tooth-root_canal{background:#f5f3ff;color:#7c3aed;border-color:#ddd6fe}
.crm-tooth-decayed,.crm-tooth-legend-dot.crm-tooth-decayed{background:#fef2f2;color:#dc2626;border-color:#fecaca}
.crm-stack-lg{display:grid;gap:14px}
.crm-surface-selector{position:relative;width:190px;height:190px;margin:8px auto 0}
.crm-surface-btn{position:absolute;border:1px solid #d8e0ef;background:#fff;border-radius:14px;box-shadow:0 6px 16px rgba(15,23,42,.04);font-weight:800;color:#334155;transition:.16s ease;min-width:48px;min-height:48px}
.crm-surface-btn:hover,.crm-surface-btn.is-active,.crm-chip-btn.is-active{border-color:#60a5fa;background:#eff6ff;color:#1d4ed8;box-shadow:0 10px 22px rgba(37,99,235,.12)}
.crm-surface-north{top:0;left:50%;transform:translateX(-50%)}
.crm-surface-south{bottom:0;left:50%;transform:translateX(-50%)}
.crm-surface-west{left:0;top:50%;transform:translateY(-50%)}
.crm-surface-east{right:0;top:50%;transform:translateY(-50%)}
.crm-surface-center{left:50%;top:50%;transform:translate(-50%,-50%);width:74px;height:74px;border-radius:22px}
.crm-surface-chips{display:flex;flex-wrap:wrap;gap:8px;justify-content:center}
.crm-chip-btn{border:1px solid #d8e0ef;background:#fff;border-radius:999px;padding:8px 12px;font-size:12px;color:#334155;transition:.16s ease}
.crm-mini-chart{display:flex;flex-direction:column;gap:12px}
.crm-mini-arch{border:1px solid #e6edf7;border-radius:18px;padding:12px;background:#fafcff}
.crm-mini-arch-label{font-size:12px;font-weight:800;color:#475569;margin-bottom:8px}
.crm-mini-arch-row{display:grid;grid-template-columns:minmax(0,1fr) 26px minmax(0,1fr);gap:6px;align-items:center}
.crm-mini-arch-group{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:6px}
.crm-mini-arch-gap{height:1px;background:linear-gradient(90deg,transparent,#cbd5e1,transparent)}
.crm-mini-tooth{display:flex;align-items:center;justify-content:center;min-height:34px;border:1px solid #d8e0ef;border-radius:12px;text-decoration:none;color:#0f172a;font-size:11px;font-weight:800;box-shadow:0 4px 10px rgba(15,23,42,.04)}
.crm-mini-tooth:hover{border-color:#93c5fd;transform:translateY(-1px)}
@media (max-width: 1200px){.crm-dental-arch-group{grid-template-columns:repeat(8,minmax(54px,1fr))}.crm-chart-summary{grid-template-columns:repeat(2,minmax(110px,1fr))}}
@media (max-width: 992px){.crm-chart-workspace{grid-template-columns:1fr}.crm-chart-sidebar{order:-1}.crm-dental-arch-row{grid-template-columns:1fr}.crm-dental-arch-gap{display:none}.crm-dental-arch-group{grid-template-columns:repeat(8,minmax(48px,1fr))}.crm-tooth-legend{justify-content:flex-start}}
@media (max-width: 768px){.crm-chart-summary{grid-template-columns:repeat(2,minmax(120px,1fr))}.crm-dental-arch{overflow-x:auto}.crm-dental-arch-group{min-width:520px}.crm-mini-arch{overflow-x:auto}.crm-mini-arch-group{min-width:280px}.crm-surface-selector{width:170px;height:170px}}
@media (max-width: 576px){.crm-chart-summary{grid-template-columns:1fr 1fr}.crm-tooth-card{padding:8px 6px}.crm-tooth-shell{min-height:70px}.crm-tooth-svg{width:42px;height:56px}.crm-tooth-number{top:25px;font-size:12px;min-width:24px}.crm-tooth-meta small{font-size:10px}}


/* v2.4.2 Dental Chart Layout Hotfix */
.crm-chart-workspace{grid-template-columns:minmax(0,1fr) 320px;gap:16px;align-items:start;max-width:100%;overflow:hidden}
.crm-chart-main{min-width:0;max-width:100%;overflow:hidden}
.crm-chart-sidebar{min-width:0;max-width:320px;position:sticky;top:16px;align-self:start}
.crm-chart-sidebar .crm-panel{padding:16px}
.crm-dental-arches{gap:14px;max-width:100%}
.crm-dental-arch{padding:14px;max-width:100%;overflow-x:auto;overflow-y:hidden;scrollbar-width:thin;-webkit-overflow-scrolling:touch}
.crm-dental-arch::-webkit-scrollbar{height:8px}.crm-dental-arch::-webkit-scrollbar-thumb{background:#cbd5e1;border-radius:999px}.crm-dental-arch::-webkit-scrollbar-track{background:#f1f5f9;border-radius:999px}
.crm-dental-arch-head{position:sticky;right:0;left:0;min-width:760px;margin-bottom:10px;background:linear-gradient(90deg,rgba(248,251,255,.92),rgba(255,255,255,.92));z-index:1;padding:0 2px}
.crm-dental-arch-row{grid-template-columns:minmax(0,1fr) 18px minmax(0,1fr);gap:7px;min-width:760px;max-width:860px;margin:0 auto;align-items:center}
.crm-dental-arch-group{display:grid;grid-template-columns:repeat(8,44px);gap:6px;justify-content:center;align-items:stretch}
.crm-dental-arch-gap{width:18px;height:78px;align-self:center;position:relative;min-height:0;color:transparent;font-size:0;overflow:hidden}
.crm-dental-arch-gap:before{content:"";position:absolute;top:8px;bottom:8px;left:50%;width:1px;background:linear-gradient(180deg,transparent,#cbd5e1,transparent)}
.crm-tooth-card{width:44px;min-height:92px;padding:7px 4px 6px;border-radius:16px;box-shadow:0 7px 16px rgba(15,23,42,.045)}
.crm-tooth-card:hover,.crm-tooth-card.is-active{transform:translateY(-1px);box-shadow:0 10px 22px rgba(15,23,42,.09)}
.crm-tooth-shell{min-height:52px;overflow:visible}.crm-tooth-svg{width:31px;height:43px}.crm-tooth-number{top:19px;font-size:11px;min-width:23px;padding:2px 3px}.crm-tooth-surface-pill{top:-5px;right:-4px;font-size:9px;padding:3px 4px;z-index:2}
.crm-tooth-meta{margin-top:4px}.crm-tooth-meta small{font-size:9px;line-height:1.35;min-height:24px;display:flex;align-items:center;justify-content:center;word-break:normal}
.crm-chart-summary{grid-template-columns:repeat(4,minmax(100px,1fr));gap:8px}.crm-chart-stat{padding:10px 12px;border-radius:14px}.crm-chart-stat strong{font-size:18px}.crm-chart-stat span{font-size:11px}
.crm-tooth-legend{gap:7px 10px}.crm-tooth-legend-item{font-size:11px}.crm-tooth-legend-dot{width:10px;height:10px;flex:0 0 10px}
.crm-surface-selector{width:150px;height:150px}.crm-surface-btn{min-width:42px;min-height:42px;border-radius:12px;font-size:12px}.crm-surface-center{width:62px;height:62px;border-radius:20px}.crm-chip-btn{padding:7px 10px;font-size:11px}
.crm-mini-chart{max-width:100%;overflow:hidden}.crm-mini-arch{overflow-x:auto}.crm-mini-arch-row{min-width:640px;grid-template-columns:minmax(0,1fr) 14px minmax(0,1fr)}.crm-mini-arch-group{grid-template-columns:repeat(8,34px);gap:5px;justify-content:center}.crm-mini-tooth{min-height:31px;border-radius:10px;font-size:10px}
@media (max-width: 1280px){.crm-chart-workspace{grid-template-columns:minmax(0,1fr) 300px}.crm-chart-sidebar{max-width:300px}.crm-dental-arch-row{min-width:720px}.crm-dental-arch-group{grid-template-columns:repeat(8,41px)}.crm-tooth-card{width:41px}.crm-tooth-meta small{font-size:8.5px}}
@media (max-width: 1100px){.crm-chart-workspace{grid-template-columns:1fr;overflow:visible}.crm-chart-sidebar{position:relative;top:auto;max-width:100%;order:-1}.crm-dental-arch-row{min-width:740px}.crm-dental-arch-head{min-width:740px}.crm-chart-summary{grid-template-columns:repeat(2,minmax(120px,1fr))}}
@media (max-width: 768px){.crm-chart-overview{gap:10px}.crm-chart-summary{grid-template-columns:repeat(2,minmax(0,1fr));width:100%}.crm-tooth-legend{justify-content:flex-start}.crm-dental-arch{padding:12px}.crm-dental-arch-row{min-width:700px}.crm-dental-arch-head{min-width:700px}.crm-mini-arch-row{min-width:600px}.crm-surface-selector{width:140px;height:140px}}
@media (max-width: 576px){.crm-chart-summary{grid-template-columns:1fr 1fr}.crm-chart-stat{padding:9px}.crm-dental-arch-row{min-width:660px}.crm-dental-arch-head{min-width:660px}.crm-dental-arch-group{grid-template-columns:repeat(8,38px);gap:5px}.crm-tooth-card{width:38px;min-height:88px}.crm-tooth-svg{width:29px;height:40px}.crm-tooth-number{top:18px;font-size:10px;min-width:21px}.crm-tooth-meta small{font-size:8px}.crm-mini-arch-row{min-width:560px}.crm-mini-arch-group{grid-template-columns:repeat(8,31px)}}


/* v2.5.0 Odontogram Print View */
.crm-print-toolbar{display:flex;gap:10px;justify-content:flex-end;margin-bottom:16px}
.crm-print-sheet{background:#fff;border:1px solid #d8e0ef;border-radius:18px;padding:26px;box-shadow:0 12px 30px rgba(15,23,42,.06);max-width:1120px;margin:0 auto 32px;color:#0f172a}
.crm-print-header{display:flex;justify-content:space-between;gap:20px;border-bottom:2px solid #e2e8f0;padding-bottom:16px;margin-bottom:16px}
.crm-print-header h1{font-size:22px;margin:0 0 4px;font-weight:900}.crm-print-header p{margin:0;color:#475569}.crm-print-header small{display:block;margin-top:6px;color:#64748b}.crm-print-meta{text-align:left;display:grid;gap:6px;color:#334155}.crm-print-meta strong{font-size:17px;color:#0f172a}.crm-print-meta span{font-size:12px;color:#64748b}
.crm-print-patient-box,.crm-print-summary{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-bottom:16px}.crm-print-patient-box div,.crm-print-summary div{border:1px solid #e2e8f0;background:#f8fafc;border-radius:14px;padding:10px 12px}.crm-print-patient-box span,.crm-print-summary span{display:block;font-size:11px;color:#64748b}.crm-print-patient-box strong,.crm-print-summary strong{display:block;font-size:15px;margin-top:4px;color:#0f172a}.crm-print-summary strong{font-size:20px}
.crm-print-odontogram{display:flex;flex-direction:column;gap:14px;margin:18px 0}.crm-print-arch{border:1px solid #e2e8f0;border-radius:16px;padding:12px;background:#fff}.crm-print-arch-title{font-weight:900;color:#334155;margin-bottom:10px;text-align:center;direction:rtl}.crm-print-arch-row{display:grid;grid-template-columns:minmax(0,1fr) 24px minmax(0,1fr);gap:8px;align-items:center}.crm-print-arch-group{display:grid;grid-template-columns:repeat(8,minmax(42px,1fr));gap:6px}.crm-print-midline{height:100%;border-left:1px dashed #cbd5e1;min-height:70px;margin:auto}
.crm-print-tooth{border:1px solid #d8e0ef;border-radius:12px;background:#fff;min-height:72px;padding:6px 4px;text-align:center;position:relative;color:#94a3b8}.crm-print-tooth-svg{width:30px;height:40px;display:block;margin:0 auto 2px;fill:currentColor}.crm-print-tooth strong{font-size:12px;line-height:1;color:#0f172a}.crm-print-tooth small{position:absolute;top:4px;right:4px;background:#0f172a;color:#fff;border-radius:999px;font-size:8px;padding:2px 3px}.crm-print-legend{display:flex;flex-wrap:wrap;gap:8px 14px;border-top:1px solid #e2e8f0;border-bottom:1px solid #e2e8f0;padding:10px 0;margin:16px 0}.crm-print-legend span{display:inline-flex;align-items:center;gap:6px;font-size:11px;color:#475569}.crm-print-legend i{width:12px;height:12px;border-radius:50%;border:1px solid #d8e0ef;display:inline-block}
.crm-print-records h2{font-size:16px;margin:0 0 10px}.crm-print-records table{width:100%;border-collapse:collapse;font-size:12px}.crm-print-records th,.crm-print-records td{border:1px solid #e2e8f0;padding:7px 8px;vertical-align:top}.crm-print-records th{background:#f8fafc;color:#334155}.crm-print-empty{border:1px solid #e2e8f0;background:#f8fafc;border-radius:12px;padding:12px;color:#64748b}.crm-print-footer{display:flex;align-items:center;gap:12px;margin-top:24px;color:#334155}.crm-sign-line{height:1px;background:#0f172a;flex:0 0 240px;display:inline-block}
@media print{body{background:#fff!important}.crm-layout{display:block!important}.crm-sidebar,.crm-topbar,.crm-mobile-actionbar,.no-print{display:none!important}.crm-main{padding:0!important;margin:0!important}.crm-print-sheet{box-shadow:none;border:0;border-radius:0;max-width:none;margin:0;padding:0}.crm-print-header{margin-top:0}.crm-print-records table{font-size:10.5px}.crm-print-arch-group{gap:4px}.crm-print-tooth{min-height:64px;padding:4px 3px}.crm-print-tooth-svg{width:26px;height:34px}@page{size:A4 landscape;margin:10mm}}
@media (max-width: 768px){.crm-print-header,.crm-print-patient-box,.crm-print-summary{grid-template-columns:1fr;display:grid}.crm-print-meta{text-align:right}.crm-print-arch{overflow-x:auto}.crm-print-arch-row{min-width:820px}.crm-print-sheet{padding:16px}.crm-print-toolbar{justify-content:flex-start}}


/* v2.6.0 Clinical Tooth Photos */
.crm-photo-stage-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
.crm-photo-stage-card{border:1px solid #e3ebf6;border-radius:20px;background:linear-gradient(180deg,#fff,#f8fbff);padding:14px;min-width:0}
.crm-photo-stage-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px;color:#21314d}
.crm-photo-stage-head strong{font-weight:900}
.crm-photo-stage-head span{font-size:12px;color:#64748b;background:#eef6ff;border:1px solid #d8eaff;border-radius:999px;padding:4px 9px}
.crm-clinical-photo-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.crm-clinical-photo-card{border:1px solid #dbe6f5;border-radius:18px;background:#fff;overflow:hidden;box-shadow:0 10px 24px rgba(15,23,42,.04)}
.crm-clinical-photo-thumb{display:block;aspect-ratio:4/3;background:#f1f5f9;overflow:hidden}
.crm-clinical-photo-thumb img{width:100%;height:100%;display:block;object-fit:cover;transition:transform .18s ease}
.crm-clinical-photo-thumb:hover img{transform:scale(1.03)}
.crm-clinical-photo-body{padding:11px 12px;display:grid;gap:7px}
.crm-clinical-photo-body strong{font-size:13px;color:#0f172a}
.crm-clinical-photo-meta{display:flex;flex-wrap:wrap;gap:6px;align-items:center;font-size:11px;color:#64748b}
.crm-clinical-photo-meta span{border:1px solid #e2e8f0;background:#f8fafc;border-radius:999px;padding:3px 7px}
.crm-badge-photo-before{background:#eff6ff;color:#1d4ed8;border-color:#bfdbfe}
.crm-badge-photo-during{background:#fefce8;color:#a16207;border-color:#fde68a}
.crm-badge-photo-after{background:#ecfdf5;color:#15803d;border-color:#bbf7d0}
.crm-badge-photo-follow_up{background:#f5f3ff;color:#6d28d9;border-color:#ddd6fe}
@media (max-width: 992px){.crm-photo-stage-grid{grid-template-columns:1fr}.crm-clinical-photo-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (max-width: 576px){.crm-clinical-photo-grid{grid-template-columns:1fr}}


/* v2.7.0 Tooth Treatment Progress Dashboard */
.crm-progress-summary{display:grid;grid-template-columns:repeat(5,minmax(120px,1fr));gap:12px}
.crm-progress-summary-card{border:1px solid #d8e0ef;border-radius:18px;background:#fff;padding:14px 16px;box-shadow:0 8px 22px rgba(15,23,42,.04)}
.crm-progress-summary-card strong{display:block;font-size:22px;line-height:1.2;color:#0f172a}
.crm-progress-summary-card span{display:block;color:#64748b;font-size:12px;margin-top:5px}
.crm-tooth-progress-grid{display:grid;grid-template-columns:repeat(16,minmax(52px,1fr));gap:8px}
.crm-tooth-progress-card{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:86px;border:1px solid #d8e0ef;border-radius:16px;text-decoration:none;background:#fff;color:#0f172a;box-shadow:0 8px 18px rgba(15,23,42,.04);transition:.16s ease;padding:8px;text-align:center}
.crm-tooth-progress-card:hover{transform:translateY(-2px);box-shadow:0 14px 26px rgba(15,23,42,.09);border-color:#93c5fd}
.crm-tooth-progress-card strong{font-size:16px;line-height:1.2}
.crm-tooth-progress-card span{font-size:13px;font-weight:800;margin-top:4px}
.crm-tooth-progress-card small{font-size:10px;color:#475569;margin-top:4px;min-height:14px}
.crm-tooth-progress-card em{font-style:normal;font-size:10px;color:#64748b;margin-top:2px}
.crm-progress-bucket-completed{background:#ecfdf5!important;border-color:#bbf7d0!important}
.crm-progress-bucket-in_progress{background:#eff6ff!important;border-color:#bfdbfe!important}
.crm-progress-bucket-needs_action{background:#fff7ed!important;border-color:#fed7aa!important}
.crm-progress-bucket-no_data{background:#f8fafc!important;border-color:#e2e8f0!important}
.crm-progress-meter{width:120px;max-width:100%;height:8px;border-radius:999px;background:#e2e8f0;overflow:hidden;display:inline-block;vertical-align:middle;margin-inline-end:8px}
.crm-progress-meter span{display:block;height:100%;border-radius:999px;background:#2563eb}
tr.crm-progress-bucket-completed .crm-progress-meter span{background:#16a34a}
tr.crm-progress-bucket-in_progress .crm-progress-meter span{background:#2563eb}
tr.crm-progress-bucket-needs_action .crm-progress-meter span{background:#f59e0b}
tr.crm-progress-bucket-no_data .crm-progress-meter span{background:#94a3b8}
@media (max-width:1200px){.crm-tooth-progress-grid{grid-template-columns:repeat(8,minmax(56px,1fr))}.crm-progress-summary{grid-template-columns:repeat(3,minmax(120px,1fr))}}
@media (max-width:768px){.crm-progress-summary{grid-template-columns:repeat(2,minmax(120px,1fr))}.crm-tooth-progress-grid{grid-template-columns:repeat(4,minmax(62px,1fr))}.crm-tooth-progress-card{min-height:78px}.crm-progress-meter{width:90px}}


/* Dental Lab CRM v0.1.0 */
.lab-check-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.65rem}.lab-check-grid label{padding:.65rem;border:1px solid #e6e9ef;border-radius:.75rem;background:#fff}.crm-tabs{display:flex;flex-wrap:wrap;gap:.5rem}@media(max-width:768px){.lab-check-grid{grid-template-columns:1fr}.crm-tabs{overflow-x:auto;flex-wrap:nowrap;padding-bottom:.35rem}.crm-tabs .crm-btn{white-space:nowrap}}

/* Dental Lab CRM v0.3.0 — workflow */
.lab-workflow-timeline{display:grid;gap:14px}.lab-workflow-step{display:grid;grid-template-columns:42px 1fr;gap:12px;position:relative}.lab-workflow-step:not(:last-child)::after{content:"";position:absolute;right:20px;top:42px;bottom:-14px;width:2px;background:#e2e8f0}.lab-workflow-step-index{width:42px;height:42px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:#e2e8f0;font-weight:800;z-index:1}.lab-workflow-step-body{border:1px solid #e2e8f0;border-radius:16px;padding:16px;background:#fff}.lab-workflow-step.is-current .lab-workflow-step-body{border-color:var(--crm-primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--crm-primary) 12%,transparent)}.lab-workflow-step.completed .lab-workflow-step-index{background:#dcfce7;color:#166534}.lab-workflow-step.in_progress .lab-workflow-step-index{background:#dbeafe;color:#1d4ed8}.lab-workflow-step.pending .lab-workflow-step-index{background:#fef3c7;color:#92400e}.crm-stat-card{height:100%;border:1px solid #e2e8f0;border-radius:16px;padding:16px;background:#fff}.crm-stat-card span{display:block;color:#64748b;font-size:.85rem;margin-bottom:6px}.crm-stat-card strong{font-size:1rem}@media(max-width:767px){.lab-workflow-step{grid-template-columns:34px 1fr}.lab-workflow-step-index{width:34px;height:34px}.lab-workflow-step:not(:last-child)::after{right:16px;top:34px}.lab-workflow-step-body{padding:13px}}

/* Dental Lab CRM v0.5.2 — dashboard layout hotfix */
.crm-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}
.crm-dashboard-grid .crm-stat-card {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
    min-height: 132px;
    height: auto;
    padding: 22px;
    overflow: hidden;
}
.crm-dashboard-grid .crm-stat-content {
    min-width: 0;
    padding-inline-end: 62px;
}
.crm-dashboard-grid .crm-stat-card small {
    display: block;
    padding: 0;
    margin: 0;
    color: var(--crm-muted);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.7;
}
.crm-dashboard-grid .crm-stat-card strong {
    display: block;
    margin-top: 12px;
    color: var(--crm-text);
    font-size: 30px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -.03em;
}
@media (max-width: 1199px) {
    .crm-dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 575px) {
    .crm-dashboard-grid { grid-template-columns: 1fr; gap: 12px; }
    .crm-dashboard-grid .crm-stat-card { min-height: 112px; padding: 18px; }
    .crm-dashboard-grid .crm-stat-card strong { font-size: 27px; }
}

/* Dental Lab CRM v0.7.0 — inventory operations */
.lab-inventory-stats{margin-top:18px}.crm-inline-row{display:grid;grid-template-columns:minmax(240px,2fr) minmax(120px,1fr) minmax(160px,1fr);gap:12px;margin-bottom:12px}.crm-inline-row select,.crm-inline-row input{width:100%}@media(max-width:760px){.crm-inline-row{grid-template-columns:1fr}.lab-inventory-stats{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* Dental Lab CRM v0.7.1 — inventory form styling hotfix */
.lab-inventory-form .crm-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.lab-inventory-form label {
    display: grid;
    gap: 8px;
    margin: 0;
}
.lab-inventory-form .crm-inline-row {
    align-items: end;
}
.lab-inventory-form .crm-inline-row .crm-input {
    margin: 0;
}
.lab-inventory-form textarea.crm-input {
    min-height: 112px;
    resize: vertical;
}
.lab-inventory-form .crm-btn {
    margin-top: 14px;
}
@media (max-width: 760px) {
    .lab-inventory-form .crm-form-grid {
        grid-template-columns: 1fr;
    }
}

/* Dental Lab CRM v0.7.3 — inventory layout stabilization */
.lab-inventory-page {
    display: grid;
    gap: 20px;
    min-width: 0;
}
.lab-inventory-page .crm-page-head {
    margin-bottom: 0;
}
.lab-inventory-page .crm-page-head.crm-page-head--title-hidden {
    justify-content: space-between;
    align-items: center;
}
.lab-inventory-page .crm-page-head p {
    margin: 0;
    color: var(--crm-muted);
}
.lab-inventory-page .crm-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
}
.lab-inventory-page .crm-card {
    min-width: 0;
    padding: 22px;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-lg);
    box-shadow: 0 1px 0 rgba(15, 23, 42, .02);
}
.lab-inventory-page .crm-card > h2,
.lab-inventory-page .crm-card > h3,
.lab-inventory-page .crm-card-head h2,
.lab-inventory-page .crm-card-head h3 {
    margin: 0 0 18px;
    color: var(--crm-text);
    font-size: 18px;
    font-weight: 800;
    line-height: 1.5;
    letter-spacing: 0;
}
.lab-inventory-page .crm-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}
.lab-inventory-page .crm-card-head h2,
.lab-inventory-page .crm-card-head h3 {
    margin: 0;
}
.lab-inventory-page .crm-card-head a {
    color: var(--crm-primary);
    font-size: 12px;
    font-weight: 800;
}
.lab-inventory-page .lab-inventory-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 0;
}
.lab-inventory-page .crm-stat-card {
    min-height: 118px;
}
.lab-inventory-page .crm-stat-card span {
    font-size: 13px;
    line-height: 1.7;
}
.lab-inventory-page .crm-stat-card strong {
    font-size: 27px;
    line-height: 1.25;
    margin-top: 10px;
}
.lab-inventory-page .crm-stat-card strong:last-child {
    white-space: normal;
}
.lab-inventory-page .table-responsive {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--crm-border);
    border-radius: 16px;
}
.lab-inventory-page table.table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    font-size: 13px;
}
.lab-inventory-page table.table th,
.lab-inventory-page table.table td {
    padding: 12px 14px;
    vertical-align: middle;
    text-align: right;
    white-space: nowrap;
    border-bottom: 1px solid var(--crm-border);
}
.lab-inventory-page table.table th {
    color: #50627c;
    background: var(--crm-surface-soft);
    font-weight: 800;
}
.lab-inventory-page table.table tbody tr:last-child td {
    border-bottom: 0;
}
.lab-inventory-page .crm-form-grid {
    gap: 16px;
}
.lab-inventory-page .crm-form-grid label {
    min-width: 0;
}
.lab-inventory-page .crm-input {
    width: 100%;
}
@media (max-width: 1100px) {
    .lab-inventory-page .lab-inventory-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 900px) {
    .lab-inventory-page .crm-grid-2 {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 575px) {
    .lab-inventory-page { gap: 14px; }
    .lab-inventory-page .crm-page-head.crm-page-head--title-hidden {
        align-items: stretch;
    }
    .lab-inventory-page .crm-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
        white-space: normal;
    }
    .lab-inventory-page .lab-inventory-stats {
        grid-template-columns: 1fr;
    }
    .lab-inventory-page .crm-card {
        padding: 16px;
        border-radius: 18px;
    }
    .lab-inventory-page .crm-stat-card {
        min-height: 104px;
    }
    .lab-inventory-page .crm-stat-card strong {
        font-size: 24px;
    }
}


/* v0.8.0: stable RTL table alignment and laboratory accounting */
.crm-aligned-table { width:100%; table-layout:fixed; border-collapse:separate; border-spacing:0; }
.crm-aligned-table thead th,
.crm-aligned-table tbody td { text-align:center; vertical-align:middle; padding:16px 12px; }
.crm-aligned-table thead th:first-child,
.crm-aligned-table tbody td:first-child { text-align:right; }
.crm-aligned-table .crm-actions { display:flex; justify-content:center; align-items:center; gap:6px; flex-wrap:wrap; }
.crm-patients-table th:nth-child(1){width:18%}.crm-patients-table th:nth-child(2){width:15%}.crm-patients-table th:nth-child(3){width:13%}.crm-patients-table th:nth-child(4){width:11%}.crm-patients-table th:nth-child(5){width:14%}.crm-patients-table th:nth-child(6){width:10%}.crm-patients-table th:nth-child(7){width:19%}
.lab-accounting-page { display:grid; gap:18px; }
.lab-accounting-stats { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; }
.lab-accounting-stats .crm-stat-card { min-height:128px; }
.lab-accounting-stats .crm-stat-card span { color:var(--crm-muted); font-weight:600; }
.lab-accounting-stats .crm-stat-card strong { font-size:1.45rem; margin-top:12px; display:block; }
.lab-two-column-page { grid-template-columns:minmax(0,1.25fr) minmax(320px,.75fr); align-items:start; }
.crm-form-card { max-width:980px; }
.crm-form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.crm-form-grid label { display:block; margin-bottom:7px; font-weight:700; color:var(--crm-muted); }
.crm-form-span-2 { grid-column:1/-1; }
.crm-inline-filter { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.crm-inline-filter .crm-input { width:auto; min-width:220px; }
.crm-input-sm { min-height:38px!important; padding:7px 10px!important; width:auto!important; }
@media (max-width:1100px){.lab-accounting-stats{grid-template-columns:repeat(2,minmax(0,1fr))}.lab-two-column-page{grid-template-columns:1fr}}
@media (max-width:767px){.lab-accounting-stats,.crm-form-grid{grid-template-columns:1fr}.crm-form-span-2{grid-column:auto}.crm-aligned-table{min-width:820px;table-layout:auto}.crm-patients-table{min-width:960px}.table-responsive{overflow-x:auto!important}.crm-aligned-table thead th,.crm-aligned-table tbody td{white-space:nowrap}}

/* Dental Lab CRM v0.9.0 — stable order filters and advanced accounting reports */
.lab-orders-page { min-width:0; }
.lab-orders-page-head { align-items:center; }
.lab-order-filters { display:grid; grid-template-columns:minmax(280px,2fr) minmax(190px,1fr) minmax(170px,1fr) minmax(105px,.55fr) minmax(150px,.8fr) minmax(150px,.8fr) auto; gap:12px; align-items:end; }
.lab-order-filter-field { display:grid; gap:7px; min-width:0; }
.lab-order-filter-field label { color:var(--crm-muted); font-size:12px; font-weight:800; }
.lab-order-filter-field .crm-input { width:100%; min-width:0; margin:0; }
.lab-order-filter-actions { display:flex; align-items:center; gap:8px; white-space:nowrap; }
.lab-order-filter-actions .crm-btn { min-height:46px; display:inline-flex; align-items:center; justify-content:center; margin:0; }
.lab-orders-table { min-width:1050px; }
.lab-orders-table th:nth-child(1){width:12%}.lab-orders-table th:nth-child(2){width:15%}.lab-orders-table th:nth-child(3){width:12%}.lab-orders-table th:nth-child(4){width:14%}.lab-orders-table th:nth-child(5){width:14%}.lab-orders-table th:nth-child(6){width:11%}.lab-orders-table th:nth-child(7){width:7%}.lab-orders-table th:nth-child(8){width:6%}.lab-orders-table th:nth-child(9){width:9%}
.lab-accounting-report-filter { display:flex; gap:12px; align-items:end; flex-wrap:wrap; margin-top:18px; }
.lab-accounting-report-filter label { display:grid; gap:7px; font-weight:700; color:var(--crm-muted); }
.lab-accounting-report-filter .crm-input { min-width:180px; }
.lab-accounting-balance-table { min-width:820px; }
@media(max-width:1280px){.lab-order-filters{grid-template-columns:repeat(3,minmax(0,1fr))}.lab-order-filter-search{grid-column:span 2}.lab-order-filter-actions{align-self:end}}
@media(max-width:800px){.lab-order-filters{grid-template-columns:repeat(2,minmax(0,1fr))}.lab-order-filter-search{grid-column:1/-1}.lab-order-filter-actions{grid-column:1/-1}.lab-order-filter-actions .crm-btn{flex:1}}
@media(max-width:575px){.lab-orders-page-head{align-items:stretch}.lab-orders-page-head .crm-btn{width:100%;text-align:center}.lab-order-filters{grid-template-columns:1fr}.lab-order-filter-search,.lab-order-filter-actions{grid-column:auto}.lab-order-filter-actions{display:grid;grid-template-columns:1fr}.lab-accounting-report-filter{display:grid;grid-template-columns:1fr}.lab-accounting-report-filter .crm-input{width:100%;min-width:0}}


/* Dental Lab CRM v0.9.1 — global RTL form consistency */
.crm-ui-form-grid,
.crm-ui-filter-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: end;
}
.crm-ui-field {
    min-width: 0;
}
.crm-ui-field > label,
.crm-ui-filter-grid label,
.crm-ui-form-grid label {
    display: block;
    margin-bottom: 7px;
    color: var(--crm-muted);
    font-size: 13px;
    font-weight: 700;
}
.crm-ui-field .crm-input,
.crm-ui-filter-grid .crm-input,
.crm-ui-form-grid .crm-input {
    width: 100%;
    min-width: 0;
    margin: 0;
}
.crm-ui-span-2 {
    grid-column: 1 / -1;
}
.crm-form-actions {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    width: 100%;
    margin-top: 18px;
    direction: rtl;
}
.crm-form-actions .crm-btn {
    margin: 0;
}
.lab-order-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.lab-order-filter-search {
    grid-column: auto;
}
.lab-order-filter-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
}
.lab-accounting-report-filter {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: end;
}
.lab-accounting-report-filter .crm-form-actions {
    grid-column: 1 / -1;
}
@media (max-width: 767px) {
    .crm-ui-form-grid,
    .crm-ui-filter-grid,
    .lab-order-filters,
    .lab-accounting-report-filter {
        grid-template-columns: 1fr;
    }
    .crm-ui-span-2,
    .lab-order-filter-actions,
    .lab-accounting-report-filter .crm-form-actions {
        grid-column: auto;
    }
    .crm-form-actions {
        display: grid;
        grid-template-columns: 1fr;
    }
    .crm-form-actions .crm-btn {
        width: 100%;
        justify-content: center;
        text-align: center;
    }
}


/* Dental Lab CRM v1.0.0 — release UI stabilization */
.crm-actions,
.crm-actions-inline,
.crm-form-actions,
.lab-order-filter-actions,
.crm-page-head .crm-actions {
    gap: 12px !important;
}
.crm-actions,
.crm-page-head .crm-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}
.crm-actions-inline {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
}
.crm-actions-inline form { margin: 0; }
.crm-actions-inline .crm-btn,
.crm-actions-inline form .crm-btn,
.crm-actions .crm-btn,
.crm-form-actions .crm-btn,
.lab-order-filter-actions .crm-btn { margin: 0 !important; }

.crm-dashboard-grid { gap: 18px; }
.crm-dashboard-grid .crm-stat-card.crm-stat-card--metric,
.crm-dashboard-grid .crm-stat-card.crm-stat-card--accent {
    position: relative;
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    min-width: 0;
    min-height: 132px;
    padding: 22px;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--crm-primary) 18%, #dbe5f1);
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--crm-primary) 13%, #fff) 0%,
        color-mix(in srgb, var(--crm-primary) 6%, #fff) 58%,
        #fff 100%);
    box-shadow: 0 16px 34px rgba(var(--crm-primary-rgb), .08);
}
.crm-dashboard-grid .crm-stat-card.crm-stat-card--accent:nth-child(2n) {
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--crm-primary) 17%, #fff) 0%,
        color-mix(in srgb, var(--crm-primary) 8%, #fff) 58%,
        #fff 100%);
}
.crm-dashboard-grid .crm-stat-card.crm-stat-card--accent:nth-child(3n) {
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--crm-primary) 10%, #fff) 0%,
        color-mix(in srgb, var(--crm-primary) 4%, #f8fbff) 62%,
        #fff 100%);
}
.crm-dashboard-grid .crm-stat-card.crm-stat-card--accent:nth-child(4n) {
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--crm-primary) 20%, #fff) 0%,
        color-mix(in srgb, var(--crm-primary) 9%, #fff) 56%,
        #fff 100%);
}
.crm-dashboard-grid .crm-stat-card.crm-stat-card--metric::before,
.crm-dashboard-grid .crm-stat-card.crm-stat-card--metric::after,
.crm-dashboard-grid .crm-stat-card.crm-stat-card--accent::before,
.crm-dashboard-grid .crm-stat-card.crm-stat-card--accent::after { display: none; }
.crm-dashboard-grid .crm-stat-card.crm-stat-card--metric .crm-stat-icon,
.crm-dashboard-grid .crm-stat-card.crm-stat-card--accent .crm-stat-icon {
    grid-column: 1;
    width: 54px;
    height: 54px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--crm-primary) 12%, #fff);
    color: var(--crm-primary);
    box-shadow: inset 0 0 0 1px rgba(var(--crm-primary-rgb), .11);
}
.crm-dashboard-grid .crm-stat-card.crm-stat-card--metric .crm-stat-content,
.crm-dashboard-grid .crm-stat-card.crm-stat-card--accent .crm-stat-content {
    display: contents;
    padding: 0;
}
.crm-dashboard-grid .crm-stat-card.crm-stat-card--metric .crm-stat-content small,
.crm-dashboard-grid .crm-stat-card.crm-stat-card--accent .crm-stat-content small {
    grid-column: 2;
    min-width: 0;
    margin: 0;
    padding: 0;
    color: #53647c;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.65;
    overflow-wrap: anywhere;
}
.crm-dashboard-grid .crm-stat-card.crm-stat-card--metric .crm-stat-content strong,
.crm-dashboard-grid .crm-stat-card.crm-stat-card--accent .crm-stat-content strong {
    grid-column: 3;
    margin: 0;
    color: #0f172a;
    font-size: 40px;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
    text-align: left;
    font-variant-numeric: tabular-nums;
}
.crm-dashboard-grid--compact .crm-stat-card.crm-stat-card--metric .crm-stat-content strong { font-size: 34px; }
@media (max-width: 1199px) {
    .crm-dashboard-grid .crm-stat-card.crm-stat-card--metric,
    .crm-dashboard-grid .crm-stat-card.crm-stat-card--accent { min-height: 124px; }
    .crm-dashboard-grid .crm-stat-card.crm-stat-card--metric .crm-stat-content strong,
    .crm-dashboard-grid .crm-stat-card.crm-stat-card--accent .crm-stat-content strong { font-size: 35px; }
}
@media (max-width: 767px) {
    .crm-dashboard-grid .crm-stat-card.crm-stat-card--metric,
    .crm-dashboard-grid .crm-stat-card.crm-stat-card--accent {
        grid-template-columns: 48px minmax(0, 1fr) auto;
        gap: 12px;
        min-height: 112px;
        padding: 18px;
    }
    .crm-dashboard-grid .crm-stat-card.crm-stat-card--metric .crm-stat-icon,
    .crm-dashboard-grid .crm-stat-card.crm-stat-card--accent .crm-stat-icon {
        width: 48px;
        height: 48px;
        border-radius: 16px;
    }
    .crm-dashboard-grid .crm-stat-card.crm-stat-card--metric .crm-stat-content small,
    .crm-dashboard-grid .crm-stat-card.crm-stat-card--accent .crm-stat-content small { font-size: 13px; }
    .crm-dashboard-grid .crm-stat-card.crm-stat-card--metric .crm-stat-content strong,
    .crm-dashboard-grid .crm-stat-card.crm-stat-card--accent .crm-stat-content strong { font-size: 29px; }
}


/* Dental Lab CRM v1.0.1 — dashboard card and sidebar navigation hotfix */
.crm-dashboard-grid .crm-stat-card.crm-stat-card--metric,
.crm-dashboard-grid .crm-stat-card.crm-stat-card--accent {
    display: grid !important;
    grid-template-columns: 54px minmax(0, 1fr) auto !important;
    grid-template-areas: "icon label value" !important;
    align-items: center !important;
    column-gap: 16px !important;
}
.crm-dashboard-grid .crm-stat-card .crm-stat-icon {
    grid-area: icon !important;
    position: static !important;
    inset: auto !important;
    margin: 0 !important;
}
.crm-dashboard-grid .crm-stat-card .crm-stat-label {
    grid-area: label !important;
    min-width: 0;
    margin: 0 !important;
    padding: 0 !important;
    color: #53647c;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.65;
    text-align: right;
    overflow-wrap: normal;
    word-break: normal;
}
.crm-dashboard-grid .crm-stat-card .crm-stat-value {
    grid-area: value !important;
    position: static !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #0f172a;
    font-size: 40px;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
    text-align: left;
    font-variant-numeric: tabular-nums;
}
.crm-dashboard-grid .crm-stat-card .crm-stat-content { display: none !important; }
.crm-dashboard-grid--compact .crm-stat-card .crm-stat-value { font-size: 34px; }

.crm-sidebar {
    padding: 16px 12px !important;
    gap: 6px !important;
}
.crm-sidebar-brand {
    margin-bottom: 8px !important;
    padding-bottom: 10px !important;
}
.crm-sidebar-user-card {
    margin-bottom: 6px !important;
    padding: 8px 10px !important;
}
.crm-nav-group {
    margin: 0 0 6px !important;
    border: 1px solid rgba(148,163,184,.18);
    border-radius: 14px;
    background: rgba(255,255,255,.5);
    overflow: hidden;
}
.crm-nav-group summary {
    min-height: 42px;
    padding: 10px 12px !important;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-radius: 0 !important;
    font-size: 13px !important;
    font-weight: 850 !important;
    color: #334155;
    cursor: pointer;
    list-style: none;
}
.crm-nav-group summary::after {
    content: "+" !important;
    width: 24px !important;
    height: 24px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex: 0 0 24px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--crm-primary) 10%, #fff);
    color: var(--crm-primary);
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
    transform: none !important;
}
.crm-nav-group[open] summary::after {
    content: "−" !important;
    transform: none !important;
}
.crm-nav-group[open] summary {
    background: color-mix(in srgb, var(--crm-primary) 7%, #fff);
    color: var(--crm-primary-dark);
}
.crm-nav-group-items {
    display: grid;
    gap: 4px !important;
    padding: 4px 8px 9px !important;
    border-top: 1px solid rgba(148,163,184,.14);
}
.crm-nav-group:not([open]) .crm-nav-group-items { display: none !important; }
.crm-nav-group .crm-nav-link {
    min-height: 38px !important;
    padding: 8px 10px !important;
    margin: 0 !important;
    border-radius: 10px !important;
    font-size: 12.5px !important;
    gap: 9px !important;
}
.crm-nav-group .crm-menu-icon {
    width: 26px !important;
    height: 26px !important;
    border-radius: 8px !important;
}
.crm-sidebar a.crm-logout-link {
    min-height: 40px !important;
    margin-top: 6px !important;
    padding: 9px 11px !important;
}
@media (max-width: 767px) {
    .crm-dashboard-grid .crm-stat-card.crm-stat-card--metric,
    .crm-dashboard-grid .crm-stat-card.crm-stat-card--accent {
        grid-template-columns: 48px minmax(0, 1fr) auto !important;
        column-gap: 12px !important;
    }
    .crm-dashboard-grid .crm-stat-card .crm-stat-value { font-size: 29px; }
}

/* Dental Lab CRM v1.0.2 — sidebar defaults, inline actions, localized cards */
.crm-patients-table .crm-actions {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
}
.crm-patients-table .crm-actions .crm-btn {
    min-width: 84px;
}
@media (max-width: 767px) {
    .crm-patients-table .crm-actions {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: flex-end !important;
    }
}

/* Dental Lab CRM v1.2.0 — professional order form */
.lab-order-form-page .crm-card {
    border: 1px solid rgba(148, 163, 184, .22);
}
.lab-order-tooth-grid {
    display: grid;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 4px;
}
.lab-order-tooth-row {
    display: grid;
    grid-template-columns: 92px repeat(16, minmax(38px, 1fr));
    gap: 7px;
    min-width: 820px;
    align-items: center;
}
.lab-order-tooth-row-label {
    color: #64748b;
    font-size: 13px;
    font-weight: 800;
}
.lab-order-tooth {
    margin: 0;
    cursor: pointer;
}
.lab-order-tooth input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.lab-order-tooth span {
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--crm-border);
    border-radius: 11px;
    background: #fff;
    color: #475569;
    font-weight: 800;
    transition: .15s ease;
}
.lab-order-tooth input:checked + span {
    border-color: var(--crm-primary);
    background: var(--crm-primary);
    color: #fff;
    box-shadow: 0 8px 18px rgba(var(--crm-primary-rgb), .18);
}
.lab-order-file-rows {
    display: grid;
    gap: 12px;
}
.lab-order-file-row {
    display: grid;
    grid-template-columns: minmax(150px, .65fr) minmax(240px, 2fr) auto;
    gap: 12px;
    align-items: center;
}
.lab-order-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(148,163,184,.18);
}
.lab-order-file-item:last-child { border-bottom: 0; }
.lab-order-file-meta {
    min-width: 0;
    display: grid;
    gap: 4px;
}
.lab-order-file-meta strong {
    overflow-wrap: anywhere;
}
.lab-order-file-meta small { color: #64748b; }
@media (max-width: 767px) {
    .lab-order-file-row {
        grid-template-columns: 1fr;
    }
    .lab-order-file-row .crm-btn { width: 100%; }
    .lab-order-file-item {
        align-items: stretch;
        flex-direction: column;
    }
}

/* Dental Lab CRM v1.3.0 — professional print and export */
.crm-report-orders-table .crm-actions-compact{display:flex;gap:10px;flex-wrap:wrap;min-width:360px}
.lab-print-label{box-sizing:border-box;border:1px solid #0f172a;background:#fff;padding:4mm;font-family:var(--crm-font-family),Tahoma,Arial,sans-serif;overflow:hidden;color:#0f172a}
.lab-label-head{display:flex;align-items:center;justify-content:space-between;gap:8px;border-bottom:1px solid #64748b;padding-bottom:2mm;margin-bottom:2mm}
.lab-label-head strong{font-size:18px;direction:ltr}.lab-label-head span{font-size:11px;font-weight:800}
.lab-label-grid{display:grid;grid-template-columns:auto minmax(0,1fr);gap:1.2mm 2mm;font-size:10px;line-height:1.45}
.lab-label-grid b{white-space:nowrap}.lab-label-grid span{min-width:0;overflow-wrap:anywhere}
.lab-label-foot{display:flex;justify-content:space-between;gap:8px;border-top:1px dashed #94a3b8;margin-top:2mm;padding-top:1.5mm;font-size:9px;font-weight:700}
.lab-print-label-cast{padding:3mm}.lab-print-label-cast .lab-label-grid{font-size:9px;gap:.8mm 1.5mm}.lab-print-label-cast .lab-label-head strong{font-size:16px}
.crm-print-card{padding:8mm}.crm-print-card .crm-print-table th{width:18%}
@media print{.lab-print-label{margin:0;box-shadow:none}.crm-report-orders-table{display:none}.crm-print-card{padding:0}}

/* Dental Lab CRM v1.3.1 — order form card cleanup and inline actions */
.crm-card-plain {
    border: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 0 !important;
}
.crm-card-plain .crm-ui-form-grid {
    margin-top: 0;
}
.crm-patients-table td.crm-actions {
    white-space: nowrap;
}
.crm-patients-table td.crm-actions .crm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    margin-bottom: 0;
    min-width: 84px;
}
.crm-patients-table td.crm-actions .crm-btn:last-child {
    margin-left: 0;
}
@media (max-width: 767px) {
    .crm-patients-table td.crm-actions {
        white-space: normal;
    }
    .crm-patients-table td.crm-actions .crm-btn {
        margin-bottom: 8px;
    }
}

/* Dental Lab CRM v1.5.0 — borderless order sections, file manager and personalization */
.lab-order-form-page .crm-card-plain {
    border: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 0 !important;
}
.lab-order-form-page .crm-card-plain + .crm-card-plain {
    padding-top: 22px !important;
    border-top: 1px solid rgba(148, 163, 184, .22) !important;
}
.lab-file-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}
.lab-file-card {
    border: 1px solid #dbe5f1;
    border-radius: 18px;
    background: #fff;
    padding: 16px;
    min-width: 0;
}
.lab-file-card-preview {
    min-height: 86px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--crm-primary) 7%, #fff);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px;
    color: var(--crm-primary);
}
.lab-file-card-preview .crm-icon { width: 34px; height: 34px; }
.lab-file-card-body h3 {
    font-size: 15px;
    margin: 14px 0 8px;
    overflow-wrap: anywhere;
}
.lab-file-meta { display: grid; gap: 6px; margin: 0; }
.lab-file-meta div { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; }
.lab-file-meta dt { color: #64748b; font-weight: 700; }
.lab-file-meta dd { margin: 0; color: #0f172a; text-align: left; overflow-wrap: anywhere; }
.lab-file-edit-form { display: grid; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px dashed #dbe5f1; }
.crm-pagination { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.crm-pagination a { width: 38px; height: 38px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid #dbe5f1; text-decoration: none; }
.crm-pagination a.active { background: var(--crm-primary); color: #fff; border-color: var(--crm-primary); }
body.crm-dashboard-compact .crm-dashboard-grid .crm-stat-card { min-height: 104px !important; padding: 16px !important; }
body:not(.crm-sidebar-compact) .crm-sidebar { padding: 22px 16px !important; }
body:not(.crm-sidebar-compact) .crm-nav-group .crm-nav-link { min-height: 44px !important; font-size: 13.5px !important; }
@media (max-width: 1100px) { .lab-file-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .lab-file-grid { grid-template-columns: 1fr; } }

/* Dental Lab CRM v1.8.1 hotfix — loyalty customers UI */
.lab-loyalty-customers-page { display: grid; gap: 20px; }
.lab-loyalty-page-head { margin-bottom: 0; align-items: flex-end; }
.lab-loyalty-eyebrow {
    margin: 0 0 4px;
    color: var(--crm-primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .02em;
}
.lab-loyalty-filter { padding: 20px 22px; }
.lab-loyalty-filter-grid {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(230px, .72fr) auto;
    gap: 16px;
    align-items: end;
}
.lab-loyalty-search-field label {
    display: block;
    margin-bottom: 7px;
    color: #334155;
    font-weight: 700;
}
.lab-loyalty-check {
    min-height: 48px;
    margin: 0;
    padding: 9px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--crm-border);
    border-radius: 13px;
    background: var(--crm-surface-soft);
    cursor: pointer;
}
.lab-loyalty-check input { width: 17px; height: 17px; accent-color: var(--crm-primary); }
.lab-loyalty-check span { display: grid; line-height: 1.45; }
.lab-loyalty-check strong { color: #334155; font-size: 13px; }
.lab-loyalty-check small { color: var(--crm-muted); font-size: 11px; }
.lab-loyalty-filter-actions { display: flex; gap: 12px; justify-content: flex-end; }
.lab-loyalty-table-card { padding: 0; overflow: hidden; }
.lab-loyalty-table-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 22px;
    border-bottom: 1px solid var(--crm-border);
}
.lab-loyalty-table-head h3 { margin: 0; font-size: 16px; font-weight: 800; }
.lab-loyalty-table-head p { margin: 4px 0 0; color: var(--crm-muted); font-size: 12px; }
.lab-loyalty-customers-table { margin: 0; min-width: 1120px; }
.lab-loyalty-customers-table thead th {
    padding: 13px 14px;
    background: #f8fafc;
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
    border-bottom: 1px solid var(--crm-border);
}
.lab-loyalty-customers-table tbody td {
    padding: 15px 14px;
    vertical-align: middle;
    border-bottom: 1px solid rgba(226,232,240,.8);
}
.lab-loyalty-customers-table tbody tr:last-child td { border-bottom: 0; }
.lab-loyalty-customers-table tbody tr:hover { background: #fbfdff; }
.lab-loyalty-customer-cell { display: flex; align-items: center; gap: 11px; min-width: 190px; }
.lab-loyalty-avatar {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 13px;
    background: color-mix(in srgb, var(--crm-primary) 10%, #fff);
    color: var(--crm-primary);
    font-size: 16px;
    font-weight: 900;
}
.lab-loyalty-customer-meta { min-width: 0; display: grid; gap: 2px; }
.lab-loyalty-customer-meta strong { color: #172033; font-size: 13.5px; white-space: nowrap; }
.lab-loyalty-customer-meta small { color: var(--crm-muted); text-align: right; }
.lab-loyalty-level-badge,
.lab-loyalty-discount {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}
.lab-loyalty-level-badge { background: #eef2ff; color: #4338ca; }
.lab-loyalty-discount { background: #ecfdf5; color: #047857; }
.lab-loyalty-points { color: var(--crm-primary); font-size: 15px; }
.lab-loyalty-money { font-weight: 700; white-space: nowrap; }
.lab-loyalty-date { color: #475569; white-space: nowrap; font-size: 12.5px; }
.lab-loyalty-action-col { min-width: 350px; }
.lab-loyalty-action-cell { min-width: 350px; }
.lab-loyalty-points-form { display: flex; align-items: center; gap: 10px; }
.lab-loyalty-points-inputs { display: grid; grid-template-columns: 118px minmax(150px, 1fr); gap: 8px; flex: 1; }
.lab-loyalty-points-form .crm-input { min-height: 38px; padding: 7px 10px; font-size: 12px; }
.lab-loyalty-points-form .crm-btn { white-space: nowrap; }
.lab-loyalty-empty { min-height: 210px; display: grid; place-content: center; gap: 5px; text-align: center; color: var(--crm-muted); }
.lab-loyalty-empty strong { color: #334155; font-size: 15px; }
@media (max-width: 991px) {
    .lab-loyalty-filter-grid { grid-template-columns: 1fr 1fr; }
    .lab-loyalty-filter-actions { grid-column: 1 / -1; }
}
@media (max-width: 767px) {
    .lab-loyalty-page-head { align-items: stretch; flex-direction: column; }
    .lab-loyalty-page-head .crm-btn { width: 100%; justify-content: center; }
    .lab-loyalty-filter { padding: 16px; }
    .lab-loyalty-filter-grid { grid-template-columns: 1fr; }
    .lab-loyalty-filter-actions { grid-column: auto; display: grid; grid-template-columns: 1fr 1fr; }
    .lab-loyalty-filter-actions .crm-btn { width: 100%; justify-content: center; }
    .lab-loyalty-table-head { padding: 17px 16px; }
    .lab-loyalty-customers-table { min-width: 1040px; }
    .lab-loyalty-points-form { align-items: stretch; flex-direction: column; }
    .lab-loyalty-points-inputs { grid-template-columns: 1fr; }
}

/* v1.9.0 — responsive loyalty customers without page-level horizontal scroll */
.lab-loyalty-customers-page,
.lab-loyalty-table-card,
.lab-loyalty-table-card .table-responsive { max-width: 100%; min-width: 0; }
.lab-loyalty-customers-table { width: 100%; table-layout: fixed; min-width: 0; }
.lab-loyalty-action-col,
.lab-loyalty-action-cell { width: 300px; min-width: 0; }
.lab-loyalty-points-inputs { grid-template-columns: 105px minmax(0, 1fr); min-width: 0; }

@media (max-width: 1399.98px) {
    .lab-loyalty-table-card { padding: 0; overflow: visible; background: transparent; border: 0; box-shadow: none; }
    .lab-loyalty-table-card .table-responsive { overflow: visible; }
    .lab-loyalty-customers-table,
    .lab-loyalty-customers-table tbody,
    .lab-loyalty-customers-table tr,
    .lab-loyalty-customers-table td { display: block; width: 100%; }
    .lab-loyalty-customers-table { table-layout: auto; min-width: 0 !important; }
    .lab-loyalty-customers-table thead { display: none; }
    .lab-loyalty-customers-table tbody { display: grid; gap: 14px; }
    .lab-loyalty-customers-table tbody tr {
        background: #fff;
        border: 1px solid var(--crm-border);
        border-radius: 16px;
        padding: 14px 16px;
        box-shadow: 0 6px 22px rgba(15,23,42,.04);
    }
    .lab-loyalty-customers-table tbody td {
        border: 0;
        padding: 9px 0;
        display: grid;
        grid-template-columns: minmax(110px, 30%) minmax(0, 1fr);
        gap: 12px;
        align-items: center;
        text-align: right;
        min-width: 0 !important;
    }
    .lab-loyalty-customers-table tbody td::before {
        content: attr(data-label);
        color: var(--crm-muted);
        font-size: 12px;
        font-weight: 700;
    }
    .lab-loyalty-customer-cell { grid-template-columns: minmax(110px, 30%) minmax(0, 1fr) !important; }
    .lab-loyalty-customer-cell .lab-loyalty-avatar { display: none; }
    .lab-loyalty-action-cell { width: 100% !important; }
    .lab-loyalty-points-form { width: 100%; align-items: stretch; }
    .lab-loyalty-points-inputs { grid-template-columns: minmax(0, 120px) minmax(0, 1fr); }
}

@media (max-width: 575.98px) {
    .lab-loyalty-customers-table tbody td,
    .lab-loyalty-customer-cell { grid-template-columns: 1fr !important; gap: 5px; }
    .lab-loyalty-points-form,
    .lab-loyalty-points-inputs { display: grid; grid-template-columns: 1fr; }
}

/* Dental Lab CRM v1.9.1 — patients responsive layout without horizontal page scroll */
.crm-patients-page,
.crm-patients-page .crm-panel,
.crm-patients-table-wrap {
    max-width: 100%;
    min-width: 0;
}
.crm-patients-table-wrap { overflow: visible; }
.crm-patients-table { width: 100%; min-width: 0 !important; table-layout: fixed; }
.crm-patients-table th,
.crm-patients-table td { min-width: 0; overflow-wrap: anywhere; white-space: normal; }
.crm-patients-table td.crm-actions { display: flex !important; flex-wrap: wrap !important; gap: 8px !important; white-space: normal !important; }
.crm-patients-table td.crm-actions .crm-btn { min-width: 0; flex: 1 1 78px; margin: 0 !important; }

@media (max-width: 1199.98px) {
    .crm-patients-page .crm-panel:last-child { padding: 0; border: 0; box-shadow: none; background: transparent; }
    .crm-patients-table-wrap { overflow: visible !important; }
    .crm-patients-table,
    .crm-patients-table tbody,
    .crm-patients-table tr,
    .crm-patients-table td { display: block; width: 100%; }
    .crm-patients-table { min-width: 0 !important; table-layout: auto; }
    .crm-patients-table thead { display: none; }
    .crm-patients-table tbody { display: grid; gap: 14px; }
    .crm-patients-table tbody tr {
        background: #fff;
        border: 1px solid var(--crm-border);
        border-radius: 18px;
        padding: 14px 16px;
        box-shadow: 0 8px 24px rgba(15,23,42,.045);
    }
    .crm-patients-table tbody td {
        border: 0 !important;
        padding: 9px 0 !important;
        display: grid;
        grid-template-columns: minmax(110px, 28%) minmax(0, 1fr);
        gap: 12px;
        align-items: center;
        text-align: right;
        min-width: 0 !important;
        white-space: normal !important;
    }
    .crm-patients-table tbody td::before {
        content: attr(data-label);
        color: var(--crm-muted);
        font-size: 12px;
        font-weight: 800;
    }
    .crm-patients-table td.crm-actions {
        display: grid !important;
        grid-template-columns: minmax(110px, 28%) minmax(0, 1fr);
        justify-content: initial !important;
        align-items: center !important;
    }
    .crm-patients-table td.crm-actions::before { width: auto; }
    .crm-patients-table td.crm-actions .crm-btn { flex: initial; width: auto; }
}

@media (max-width: 575.98px) {
    .crm-patients-table tbody td,
    .crm-patients-table td.crm-actions { grid-template-columns: 1fr; gap: 5px; }
    .crm-patients-table td.crm-actions .crm-btn { width: 100%; justify-content: center; }
}


/* v1.9.4 typography hotfix — prevent synthetic Persian font stretching */
@font-face {
    font-family: 'YekanBakhFaNum';
    src: url('../fonts/YekanBakhFaNum-Bold.woff2') format('woff2');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'YekanBakhFaNum';
    src: url('../fonts/YekanBakhFaNum-Bold.woff2') format('woff2');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

html, body, button, input, select, textarea {
    font-synthesis: none;
}

h1, h2, h3, h4, h5, h6,
.crm-topbar h1,
.crm-panel h1, .crm-panel h2, .crm-panel h3,
.crm-card h1, .crm-card h2, .crm-card h3,
.crm-page-head h1, .crm-page-head h2, .crm-page-head h3,
.crm-hero-card h1, .crm-hero-card h2, .crm-hero-card h3,
.crm-operations-hero h1, .crm-operations-hero h2, .crm-operations-hero h3,
.crm-settings-section h1, .crm-settings-section h2, .crm-settings-section h3,
.card-title, .modal-title, .offcanvas-title, .accordion-header,
.lab-accounting-page h1, .lab-accounting-page h2, .lab-accounting-page h3,
.lab-inventory-page h1, .lab-inventory-page h2, .lab-inventory-page h3 {
    font-family: var(--crm-font-family) !important;
    font-style: normal !important;
    font-stretch: normal !important;
    font-weight: 700 !important;
    letter-spacing: normal !important;
    word-spacing: normal !important;
    text-transform: none !important;
    transform: none;
}


/* Dental Lab CRM v2.0.0 — PWA install controls */
.crm-pwa-install[hidden]{display:none!important}
@media (display-mode: standalone){.crm-pwa-install{display:none!important}body{padding-top:env(safe-area-inset-top);padding-bottom:env(safe-area-inset-bottom)}}
@media (max-width:767px){.crm-topbar-tools{display:flex;align-items:center}.crm-pwa-install{white-space:nowrap;min-height:42px}}

/* Dental Lab CRM v2.0.3 Stable — mobile operational dashboard */
.crm-mobile-dashboard-stack{display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;gap:24px}
.crm-mobile-section-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}
.crm-mobile-quick-grid{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:12px}
.crm-mobile-quick-card{display:flex;min-width:0;min-height:96px;flex-direction:column;align-items:center;justify-content:center;gap:9px;padding:14px;border:1px solid #dbe5f5;border-radius:16px;background:#fff;color:#1648c8;text-decoration:none;box-shadow:0 6px 18px rgba(15,23,42,.05);transition:transform .15s ease,box-shadow .15s ease,border-color .15s ease}
.crm-mobile-quick-card:hover{transform:translateY(-2px);border-color:#8fb0ff;box-shadow:0 12px 26px rgba(36,84,255,.1)}
.crm-mobile-quick-card span{font-size:13px;font-weight:700;color:#334155;text-align:center}
.crm-mobile-urgent-panel{border-color:#fecaca;background:linear-gradient(180deg,#fffafa 0%,#fff 100%)}
@media (max-width:1199px){
  .crm-mobile-dashboard-stack{gap:16px;align-content:start;align-items:stretch;justify-content:flex-start}
  .crm-dashboard-heading{margin-bottom:14px!important}
  .crm-dashboard-desktop-actions{display:none}
  .crm-mobile-priority--urgent{order:1}
  .crm-mobile-priority--quick{order:2}
  .crm-mobile-priority--stats{order:3}
  .crm-mobile-priority--details{order:4}
  .crm-mobile-quick-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
  .crm-mobile-quick-card{min-height:88px;padding:12px 8px}
  .crm-dashboard-grid{align-content:start;align-items:start}
}
@media (max-width:767px){
  .crm-main{align-content:start!important;justify-content:flex-start!important}
  .crm-mobile-dashboard-stack{padding-bottom:96px}
  .crm-mobile-quick-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
  .crm-mobile-quick-card{min-height:84px;border-radius:14px}
  .crm-mobile-quick-card .crm-icon{width:24px;height:24px}
  .crm-mobile-section-head{margin-bottom:10px}
  .crm-mobile-urgent-panel{padding:14px}
  .crm-mobile-card-table thead{display:none}
  .crm-mobile-card-table,.crm-mobile-card-table tbody,.crm-mobile-card-table tr,.crm-mobile-card-table td{display:block;width:100%}
  .crm-mobile-card-table tr{margin-bottom:12px;padding:12px;border:1px solid #e2e8f0;border-radius:14px;background:#fff;box-shadow:0 4px 14px rgba(15,23,42,.04)}
  .crm-mobile-card-table td{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:7px 0!important;border:0!important;text-align:left}
  .crm-mobile-card-table td::before{content:attr(data-label);font-weight:700;color:#64748b;text-align:right}
  .crm-mobile-card-table td:last-child{padding-bottom:0!important}
  .crm-responsive-cards{overflow:visible!important}
}
@media (max-width:390px){.crm-mobile-quick-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* v2.1.0 notification center */
.crm-topbar{position:relative;gap:16px}
.crm-notification-toolbar{position:relative;display:flex;align-items:center;gap:8px;margin-inline-start:auto;direction:rtl}
.crm-notification-control{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:42px;padding:8px 13px;border:1px solid #dbe5f4;border-radius:999px;background:#fff;color:#1e293b;font:inherit;font-size:13px;font-weight:700;cursor:pointer;white-space:nowrap}
.crm-notification-control:hover{border-color:var(--crm-primary);color:var(--crm-primary)}
.crm-notification-badge{display:inline-flex;align-items:center;justify-content:center;min-width:22px;height:22px;padding:0 6px;border-radius:999px;background:#edf2f7;color:#64748b;font-size:11px}
.crm-notification-badge.has-items{background:#ef4444;color:#fff}
.crm-notification-popover{position:absolute;z-index:1200;top:calc(100% + 10px);left:0;width:min(390px,calc(100vw - 24px));max-height:min(520px,72vh);overflow:hidden;border:1px solid #dbe5f4;border-radius:18px;background:#fff;box-shadow:0 24px 70px rgba(15,23,42,.2)}
.crm-notification-popover[hidden]{display:none!important}
.crm-notification-head{display:flex;align-items:center;justify-content:space-between;padding:14px 16px;border-bottom:1px solid #edf2f7}
.crm-notification-head button{border:0;background:none;color:var(--crm-primary);font:inherit;font-size:12px;cursor:pointer}
.crm-notification-list{max-height:440px;overflow:auto;padding:8px}
.crm-notification-item{display:block;padding:12px;border-radius:13px;color:inherit;text-decoration:none;border:1px solid transparent}
.crm-notification-item:hover{background:#f8fafc}
.crm-notification-item.is-unread{background:#f4f7ff;border-color:#dfe7ff}
.crm-notification-item strong{display:block;font-size:13px;margin-bottom:3px}
.crm-notification-item p{margin:0;color:#475569;font-size:12px;line-height:1.7}
.crm-notification-item small{display:block;margin-top:5px;color:#94a3b8;font-size:10px}
.crm-notification-item[data-severity="danger"] strong{color:#b91c1c}.crm-notification-item[data-severity="warning"] strong{color:#a16207}
@media(max-width:900px){.crm-topbar{align-items:flex-start;flex-direction:column}.crm-notification-toolbar{width:100%;margin:0;overflow:visible}.crm-notification-control{flex:1;padding-inline:8px;font-size:12px}.crm-notification-popover{position:fixed;right:12px;left:12px;top:72px;width:auto;max-height:calc(100dvh - 100px)}}

/* Dental Lab CRM v2.1.2 — mobile-only off-canvas sidebar */
.crm-sidebar-mobile-head,
.crm-sidebar-toggle,
.crm-sidebar-backdrop { display: none; }

@media (max-width: 860px) {
    body.crm-mobile-client.crm-sidebar-open { overflow: hidden; touch-action: none; }
    body.crm-mobile-client .crm-layout { display: block !important; width: 100% !important; margin: 0 !important; min-height: 100dvh; overflow: clip; }
    body.crm-mobile-client .crm-main { min-width: 0; width: 100%; padding-top: max(16px, env(safe-area-inset-top)); }
    body.crm-mobile-client .crm-sidebar {
        position: fixed !important;
        z-index: 1205;
        inset-block: 0;
        inset-inline-start: 0;
        width: min(88vw, 340px) !important;
        max-width: 340px;
        height: 100dvh;
        max-height: 100dvh !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        display: block !important;
        padding: max(12px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom)) !important;
        background: #fff;
        border: 0 !important;
        border-inline-end: 1px solid var(--crm-border) !important;
        box-shadow: -20px 0 60px rgba(15, 23, 42, .22);
        transform: translateX(110%);
        visibility: hidden;
        transition: transform .24s ease, visibility .24s ease;
        contain: layout paint;
    }
    [dir="rtl"] body.crm-mobile-client .crm-sidebar { transform: translateX(110%); }
    [dir="ltr"] body.crm-mobile-client .crm-sidebar { transform: translateX(-110%); }
    body.crm-mobile-client.crm-sidebar-open .crm-sidebar { transform: translateX(0); visibility: visible; }
    body.crm-mobile-client .crm-sidebar-mobile-head {
        position: sticky;
        z-index: 2;
        top: calc(-1 * max(12px, env(safe-area-inset-top)));
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin: 0 -14px 12px;
        padding: max(12px, env(safe-area-inset-top)) 16px 12px;
        background: rgba(255,255,255,.96);
        border-bottom: 1px solid var(--crm-border);
        backdrop-filter: blur(10px);
    }
    body.crm-mobile-client .crm-sidebar-close {
        display: inline-grid;
        place-items: center;
        width: 42px;
        height: 42px;
        border: 1px solid var(--crm-border);
        border-radius: 14px;
        background: #f8fafc;
        color: var(--crm-text);
        font: inherit;
        font-size: 25px;
        line-height: 1;
    }
    body.crm-mobile-client .crm-sidebar-backdrop {
        position: fixed;
        z-index: 1200;
        inset: 0;
        display: block;
        width: 100%;
        height: 100%;
        padding: 0;
        border: 0;
        background: rgba(15, 23, 42, .48);
        opacity: 0;
        visibility: hidden;
        transition: opacity .2s ease, visibility .2s ease;
    }
    body.crm-mobile-client .crm-sidebar-backdrop[hidden] { display: block !important; }
    body.crm-mobile-client.crm-sidebar-open .crm-sidebar-backdrop { opacity: 1; visibility: visible; }
    body.crm-mobile-client .crm-sidebar-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        min-height: 44px;
        padding: 9px 13px;
        border: 1px solid var(--crm-border);
        border-radius: 14px;
        background: #fff;
        color: var(--crm-text);
        font: inherit;
        font-weight: 700;
        flex: 0 0 auto;
    }
    body.crm-mobile-client .crm-topbar { align-items: flex-start !important; }
    body.crm-mobile-client .crm-sidebar-brand,
    body.crm-mobile-client .crm-sidebar-user-card { grid-column: auto !important; }
    body.crm-mobile-client .crm-sidebar .crm-nav-group,
    body.crm-mobile-client .crm-sidebar .crm-nav-link { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    body.crm-mobile-client .crm-sidebar,
    body.crm-mobile-client .crm-sidebar-backdrop { transition: none !important; }
}

