@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap');

:root {
    --crm-green: #59c36a;
    --crm-green-dark: #49ae59;
    --crm-text: #111111;
    --crm-text-soft: #5f6b63;
    --crm-border: #e6ece7;
    --crm-border-strong: #d8e2da;
    --crm-bg: #f1f5f2;
    --crm-bg-soft: #e9f5ec;
    --crm-white: #ffffff;
    --crm-error-bg: #fff4f4;
    --crm-error-border: #f1c0c0;
    --crm-error-text: #b42318;
    --crm-success-bg: #eff9f1;
    --crm-success-border: #bfe3c6;
    --crm-success-text: #1f6b2a;
    --crm-shadow: 0 20px 50px rgba(0, 0, 0, 0.08);
    --crm-sidebar-bg: #171b26;
    --crm-sidebar-soft: #1d2230;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Montserrat', sans-serif;
    color: var(--crm-text);
    letter-spacing: -0.3px;
    background: linear-gradient(180deg, var(--crm-bg) 0%, var(--crm-bg-soft) 100%);
}

img {
    max-width: 100%;
}

a {
    color: inherit;
}

button,
input,
textarea,
select {
    font: inherit;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    letter-spacing: -1px;
    margin: 0;
    color: var(--crm-text);
}

h3 {
    font-weight: 600;
}

p,
span,
label,
input,
button,
a,
div {
    letter-spacing: -0.3px;
}

/* Login */

.crm-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.crm-login-wrap {
    width: 100%;
    max-width: 430px;
}

.crm-brand {
    text-align: center;
    margin-bottom: 24px;
}

.crm-brand-logo {
    display: block;
    margin: 0 auto 14px;
    max-width: 280px;
    width: 100%;
    height: auto;
}

.crm-brand-subtitle {
    margin: 0;
    font-size: 14px;
    color: var(--crm-text-soft);
}

.crm-card {
    background: var(--crm-white);
    border-radius: 18px;
    padding: 28px;
    box-shadow: var(--crm-shadow);
    border: 1px solid var(--crm-border);
}

.crm-card-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.crm-card-subtitle {
    font-size: 14px;
    color: #68756d;
    margin-bottom: 22px;
}

.crm-field {
    margin-bottom: 16px;
}

.crm-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.crm-input,
.crm-select {
    width: 100%;
    height: 48px;
    border: 1px solid var(--crm-border-strong);
    border-radius: 12px;
    padding: 0 14px;
    font-size: 15px;
    outline: none;
    background: var(--crm-white);
    transition: 0.2s ease;
    font-family: 'Montserrat', sans-serif;
}

.crm-textarea {
    width: 100%;
    min-height: 120px;
    border: 1px solid var(--crm-border-strong);
    border-radius: 12px;
    padding: 14px;
    font-size: 15px;
    outline: none;
    background: var(--crm-white);
    transition: 0.2s ease;
    font-family: 'Montserrat', sans-serif;
    resize: vertical;
    line-height: 1.6;
}

.crm-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 46px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2354655c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px 16px;
    cursor: pointer;
}

.crm-input:focus,
.crm-select:focus,
.crm-textarea:focus {
    border-color: var(--crm-green);
    box-shadow: 0 0 0 4px rgba(89, 195, 106, 0.12);
}

.crm-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #4d594f;
    margin: 6px 0 18px;
}

.crm-remember input {
    margin: 0;
}

.crm-button {
    width: 100%;
    height: 48px;
    border: 0;
    border-radius: 12px;
    background: var(--crm-green);
    color: var(--crm-white);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s ease;
    font-family: 'Montserrat', sans-serif;
}

.crm-button:hover {
    background: var(--crm-green-dark);
}

.crm-error-box {
    background: var(--crm-error-bg);
    color: var(--crm-error-text);
    border: 1px solid var(--crm-error-border);
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 14px;
}

.crm-success-box {
    background: var(--crm-success-bg);
    color: var(--crm-success-text);
    border: 1px solid var(--crm-success-border);
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 18px;
    font-size: 14px;
    font-weight: 600;
}

.crm-footer-note {
    text-align: center;
    margin-top: 14px;
    color: #7a847d;
    font-size: 12px;
}

/* CRM shell */

.crm-dashboard-page {
    min-height: 100vh;
    background: #eef3ef;
}

.crm-shell {
    width: 100%;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 292px minmax(0, 1fr);
    background: #eef3ef;
}

.crm-sidebar-backdrop {
    display: none;
}

.crm-sidebar {
    background: var(--crm-sidebar-bg);
    color: #ffffff;
    padding: 24px 18px 20px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    z-index: 20;
}

.crm-sidebar-head {
    padding: 4px 8px 20px;
    margin-bottom: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.crm-sidebar-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.crm-sidebar-logo-box {
    display: flex;
    align-items: center;
    min-height: 56px;
}

.crm-sidebar-logo {
    display: block;
    width: 100%;
    max-width: 178px;
    height: auto;
}

.crm-sidebar-kicker {
    margin-top: 10px;
    font-size: 13px;
    line-height: 1.5;
    color: #96a59d;
}

.crm-sidebar-close {
    display: none;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
}

.crm-sidebar-close svg {
    width: 18px;
    height: 18px;
}

.crm-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-bottom: 20px;
}

.crm-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #edf2ef;
    padding: 14px 14px;
    border-radius: 14px;
    transition: 0.2s ease;
    font-weight: 600;
}

.crm-nav-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.crm-nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.crm-nav-link.is-active {
    background: var(--crm-green);
    color: #111111;
}

.crm-sidebar-footer {
    margin-top: auto;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    padding: 18px;
}

.crm-sidebar-footer h3 {
    color: #ffffff;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.crm-sidebar-footer p {
    color: #c7d1cb;
    font-size: 14px;
    line-height: 1.55;
    margin: 0 0 18px;
}

.crm-main {
    min-width: 0;
    padding: 18px 34px 38px;
}

.crm-main-topbar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: 48px;
    margin-bottom: 10px;
}

.crm-mobile-toggle {
    display: none;
    width: 48px;
    height: 48px;
    border: 1px solid var(--crm-border);
    border-radius: 16px;
    background: #ffffff;
    color: var(--crm-text);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.04);
}

.crm-mobile-toggle svg {
    width: 20px;
    height: 20px;
}

.crm-mobile-top-logo {
    display: none;
}

.crm-mobile-top-logo img {
    display: block;
    width: 150px;
    height: auto;
}

.crm-user-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #ffffff;
    border: 1px solid var(--crm-border);
    border-radius: 999px;
    padding: 10px 14px;
    white-space: nowrap;
    flex-shrink: 0;
}

.crm-user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--crm-green);
    color: #111111;
    font-weight: 800;
    font-size: 16px;
    flex-shrink: 0;
}

.crm-user-meta {
    min-width: 0;
}

.crm-user-meta strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
}

.crm-user-meta span {
    display: block;
    font-size: 12px;
    color: var(--crm-text-soft);
    line-height: 1.3;
    margin-top: 2px;
}

.crm-topbar-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-left: auto;
}

.crm-notifications {
    position: relative;
    flex-shrink: 0;
}

.crm-notification-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 16px;
    border: 1px solid var(--crm-border);
    background: #ffffff;
    color: var(--crm-text);
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(17, 24, 39, 0.08);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.crm-notification-toggle:hover,
.crm-notifications.is-open .crm-notification-toggle {
    transform: translateY(-1px);
    box-shadow: 0 16px 32px rgba(17, 24, 39, 0.12);
    border-color: rgba(38, 99, 235, 0.22);
}

.crm-notification-toggle:focus-visible,
.crm-notification-mark-all:focus-visible,
.crm-toast-close:focus-visible {
    outline: 3px solid rgba(38, 99, 235, 0.18);
    outline-offset: 2px;
}

.crm-notification-icon {
    display: inline-flex;
    width: 22px;
    height: 22px;
}

.crm-notification-icon svg {
    width: 100%;
    height: 100%;
}

.crm-notification-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: linear-gradient(135deg, #ef4444, #f97316);
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 18px rgba(239, 68, 68, 0.32);
}

.crm-notification-badge.is-hidden {
    display: none;
}

.crm-notification-panel {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: min(420px, calc(100vw - 34px));
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 24px;
    box-shadow: 0 28px 70px rgba(15, 23, 42, 0.18);
    overflow: hidden;
    z-index: 40;
}

.crm-notification-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 18px 14px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}

.crm-notification-panel-title {
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
}

.crm-notification-panel-subtitle {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
    line-height: 1.45;
}

.crm-notification-mark-all {
    appearance: none;
    border: 0;
    background: rgba(15, 23, 42, 0.04);
    color: #0f172a;
    font-size: 12px;
    font-weight: 700;
    border-radius: 999px;
    padding: 9px 12px;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
    white-space: nowrap;
}

.crm-notification-mark-all:hover:not(:disabled) {
    background: rgba(38, 99, 235, 0.1);
    color: #1d4ed8;
}

.crm-notification-mark-all:disabled {
    opacity: 0.48;
    cursor: default;
}

.crm-notification-list {
    max-height: min(70vh, 560px);
    overflow-y: auto;
    padding: 10px;
}

.crm-notification-state,
.crm-notification-empty {
    padding: 24px 16px;
    text-align: center;
    color: #64748b;
}

.crm-notification-empty {
    display: grid;
    gap: 8px;
}

.crm-notification-empty strong {
    color: #0f172a;
    font-size: 15px;
}

.crm-notification-empty p {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
}

.crm-notification-empty-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto 2px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(38, 99, 235, 0.08);
    color: #2563eb;
}

.crm-notification-empty-icon svg {
    width: 22px;
    height: 22px;
}

.crm-notification-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    padding: 14px;
    border-radius: 18px;
    transition: background 0.18s ease, transform 0.18s ease;
}

.crm-notification-item:hover {
    background: rgba(148, 163, 184, 0.08);
    transform: translateY(-1px);
}

.crm-notification-item.is-unread {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(16, 185, 129, 0.05));
}

.crm-notification-item + .crm-notification-item {
    margin-top: 6px;
}

.crm-notification-item-icon,
.crm-toast-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.crm-notification-item-icon svg,
.crm-toast-icon svg {
    width: 20px;
    height: 20px;
}

.crm-notification-item-icon.is-success,
.crm-toast-icon.is-success {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
}

.crm-notification-item-icon.is-info,
.crm-toast-icon.is-info {
    background: rgba(37, 99, 235, 0.12);
    color: #2563eb;
}

.crm-notification-item-icon.is-neutral,
.crm-toast-icon.is-neutral {
    background: rgba(100, 116, 139, 0.12);
    color: #475569;
}

.crm-notification-item-body {
    min-width: 0;
    display: grid;
    gap: 6px;
    flex: 1;
}

.crm-notification-item-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.crm-notification-item-title {
    font-size: 14px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.3;
}

.crm-notification-item-time {
    font-size: 11px;
    color: #64748b;
    white-space: nowrap;
    padding-top: 1px;
}

.crm-notification-item-text,
.crm-notification-preview {
    font-size: 13px;
    line-height: 1.5;
    color: #475569;
}

.crm-notification-preview {
    margin: 0;
    color: #64748b;
}

.crm-notification-item-link {
    font-size: 12px;
    font-weight: 700;
    color: #1d4ed8;
}

.crm-toast-stack {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 70;
    display: grid;
    gap: 12px;
    width: min(360px, calc(100vw - 28px));
}

.crm-toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 14px 14px 12px;
    border-radius: 20px;
    background: rgba(15, 23, 42, 0.94);
    color: #ffffff;
    box-shadow: 0 22px 48px rgba(15, 23, 42, 0.28);
    animation: crmToastIn 0.22s ease;
}

.crm-toast.is-hiding {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.crm-toast-body {
    flex: 1;
    min-width: 0;
}

.crm-toast-body strong {
    display: block;
    font-size: 14px;
    line-height: 1.3;
}

.crm-toast-body p {
    margin: 4px 0 0;
    font-size: 12px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.78);
}

.crm-toast-close {
    appearance: none;
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.68);
    font-size: 20px;
    line-height: 1;
    padding: 2px 0 0;
    cursor: pointer;
}

.crm-toast-close:hover {
    color: #ffffff;
}

@keyframes crmToastIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.crm-pre-header-actions {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 18px;
}

.crm-main-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 26px;
}

.crm-main-heading {
    min-width: 0;
}

.crm-main-heading-top {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.crm-main-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    margin-left: 2px;
}

.crm-main-header-actions .crm-btn,
.crm-main-header-actions .crm-btn-back {
    margin: 0;
}

.crm-main-title {
    font-size: 44px;
    font-weight: 700;
}

.crm-main-subtitle {
    margin-top: 8px;
    color: var(--crm-text-soft);
    font-size: 15px;
    max-width: 860px;
    line-height: 1.65;
}

.crm-section {
    margin-bottom: 28px;
}

.crm-section-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 18px;
}

.crm-page-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.crm-page-toolbar-compact {
    margin-bottom: 18px;
}

.crm-page-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.crm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 18px;
    border-radius: 14px;
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s ease;
}

.crm-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.crm-btn-primary {
    background: var(--crm-green);
    color: #111111;
}

.crm-btn-primary:hover {
    background: var(--crm-green-dark);
    color: #ffffff;
}

.crm-btn-secondary {
    background: #ffffff;
    color: var(--crm-text);
    border-color: var(--crm-border);
}

.crm-btn-secondary:hover {
    border-color: var(--crm-green);
    color: var(--crm-green-dark);
}

.crm-btn-sm {
    min-height: 38px;
    padding: 0 14px;
    border-radius: 12px;
    font-size: 13px;
}

.crm-btn-back {
    min-width: 180px;
}

.crm-inline-form {
    display: inline-flex;
    margin: 0;
}

.crm-card-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.crm-nav-card {
    display: flex;
    flex-direction: column;
    min-height: 220px;
    background: #ffffff;
    border: 1px solid var(--crm-border);
    border-radius: 24px;
    padding: 22px;
    text-decoration: none;
    color: inherit;
    transition: 0.22s ease;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.04);
}

.crm-nav-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 30px rgba(0, 0, 0, 0.07);
}

.crm-nav-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.crm-nav-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: #eef7f0;
    color: var(--crm-green-dark);
    transition: background 0.22s ease, color 0.22s ease, transform 0.22s ease;
}

.crm-nav-card:hover .crm-nav-card-icon {
    background: var(--crm-green);
    color: #ffffff;
    transform: translateY(-1px);
}

.crm-nav-card-icon svg {
    width: 26px;
    height: 26px;
}

.crm-nav-card-arrow {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: #f4f7f4;
    color: #49544d;
}

.crm-nav-card-arrow svg {
    width: 18px;
    height: 18px;
}

.crm-nav-card-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

.crm-card-text {
    font-size: 14px;
    color: var(--crm-text-soft);
    line-height: 1.6;
}

.crm-nav-card-meta {
    margin-top: 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--crm-green-dark);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.crm-nav-card-meta svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Shared panels and tables */

.crm-users-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.crm-users-stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #ffffff;
    border: 1px solid var(--crm-border);
    border-radius: 24px;
    padding: 20px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.04);
}

.crm-users-stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: #eef7f0;
    color: var(--crm-green-dark);
    flex-shrink: 0;
}

.crm-users-stat-icon svg {
    width: 24px;
    height: 24px;
}

.crm-users-stat-label {
    font-size: 13px;
    color: var(--crm-text-soft);
    margin-bottom: 6px;
}

.crm-users-stat-value {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
    word-break: break-word;
}

.crm-users-panel,
.crm-form-panel {
    background: #ffffff;
    border: 1px solid var(--crm-border);
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.04);
}

.crm-users-panel-subtitle {
    margin-top: 8px;
    color: var(--crm-text-soft);
    font-size: 14px;
    line-height: 1.65;
}

.crm-users-table-wrap {
    position: relative;
    overflow-x: auto;
    overflow-y: scroll;
    max-height: min(560px, 62vh);
    scrollbar-gutter: stable;
    border-radius: 24px;
    border: 1px solid rgba(113, 128, 119, 0.12);
    background: #ffffff;
}

.crm-users-table-wrap::before,
.crm-users-table-wrap::after {
    content: none;
}

.crm-users-table-wrap::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.crm-users-table-wrap::-webkit-scrollbar-track {
    background: rgba(113, 128, 119, 0.10);
    border-radius: 999px;
}

.crm-users-table-wrap::-webkit-scrollbar-thumb {
    background: rgba(79, 169, 94, 0.36);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}


.crm-users-table-wrap:not(.is-end) {
    box-shadow: inset 0 -36px 28px -34px rgba(17, 24, 39, 0.12);
}

.crm-users-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
}

.crm-users-table th,
.crm-users-table td {
    text-align: left;
    vertical-align: middle;
    padding: 16px 12px;
    border-bottom: 1px solid var(--crm-border);
    font-size: 14px;
}

.crm-users-table th {
    font-size: 12px;
    font-weight: 700;
    color: #718077;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.crm-users-table tbody tr:last-child td {
    border-bottom: 0;
}


.crm-users-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #ffffff;
}

.crm-table-sort-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
    cursor: pointer;
}

.crm-table-sort-button:hover,
.crm-table-sort-button.is-active {
    color: var(--crm-green-dark);
}

.crm-table-sort-indicator {
    font-size: 11px;
    line-height: 1;
}

.crm-list-results-meta {
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    background: #f4f6f5;
    color: #526158;
    font-size: 12px;
    font-weight: 700;
}

.crm-users-person {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 220px;
}

.crm-users-person-avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: #eef7f0;
    color: var(--crm-green-dark);
    font-weight: 800;
    flex-shrink: 0;
}

.crm-users-person-meta strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
}

.crm-users-person-meta span {
    display: block;
    font-size: 13px;
    color: var(--crm-text-soft);
    margin-top: 2px;
    line-height: 1.35;
}

.crm-role-badge,
.crm-status-badge,
.crm-locale-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.crm-role-badge.is-admin {
    background: #eef7f0;
    color: #2f6d3c;
}

.crm-role-badge.is-manager {
    background: #f4f6f5;
    color: #526158;
}

.crm-status-badge.is-active {
    background: #eef7f0;
    color: #2f6d3c;
}

.crm-status-badge.is-planning {
    background: #eef4ff;
    color: #365fb7;
}

.crm-status-badge.is-warning {
    background: #fff8dd;
    color: #9a6b00;
}

.crm-status-badge.is-inactive {
    background: #f7f1f1;
    color: #8f4b4b;
}

.crm-status-badge.is-info {
    background: #eef4ff;
    color: #365fb7;
}

.crm-status-badge.is-neutral {
    background: #f4f6f5;
    color: #526158;
}

.crm-status-badge.is-alert {
    background: #fff1f1;
    color: #c73b3b;
}

.crm-locale-badge {
    background: #f4f6f5;
    color: #46544c;
}

.crm-users-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.crm-users-empty {
    padding: 18px 0;
    color: var(--crm-text-soft);
}

.crm-leads-filter-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.crm-leads-filter-search {
    width: 100%;
    max-width: 360px;
}

.crm-leads-filter-search .crm-input {
    padding-left: 42px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23748479' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 14px center;
    background-size: 18px 18px;
}

.crm-leads-filter-chips {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.crm-filter-chip {
    min-height: 38px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid var(--crm-border);
    background: #ffffff;
    color: var(--crm-text);
    cursor: pointer;
    font-weight: 500;
    transition: 0.2s ease;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
}

.crm-filter-chip:hover {
    border-color: var(--crm-green);
    color: var(--crm-green-dark);
}

.crm-filter-chip.is-active {
    background: var(--crm-green);
    border-color: var(--crm-green);
    color: #111111;
}

.crm-lead-offer-stack {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.crm-lead-offer-stack strong {
    font-size: 15px;
    font-weight: 700;
    color: var(--crm-text);
}

.crm-lead-offer-stack span {
    font-size: 12px;
    color: var(--crm-text-soft);
    line-height: 1.5;
}

/* Offers */

.crm-offer-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.crm-offer-summary-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #f8fbf9;
    border: 1px solid var(--crm-border);
    border-radius: 18px;
    padding: 16px;
}

.crm-offer-summary-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: #eef7f0;
    color: var(--crm-green-dark);
    flex-shrink: 0;
}

.crm-offer-summary-icon svg {
    width: 22px;
    height: 22px;
}

.crm-offer-summary-body {
    min-width: 0;
}

.crm-offer-summary-label {
    font-size: 12px;
    font-weight: 700;
    color: #718077;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.crm-offer-summary-value {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--crm-text);
    word-break: break-word;
}

.crm-offer-last-update {
    margin-bottom: 22px;
}

.crm-offer-info-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.crm-offer-info-badge svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.crm-offer-info-badge-muted {
    background: #f4f6f5;
    color: #526158;
}

.crm-offer-info-badge-success {
    background: #eef7f0;
    color: #2f6d3c;
}

.crm-offer-list {
    display: grid;
    gap: 18px;
}

.crm-offer-card {
    border: 1px solid var(--crm-border);
    border-radius: 22px;
    padding: 20px;
    background: #fbfdfb;
}

.crm-offer-card--accepted {
    border-color: #c9e8d0;
    background: #f7fcf8;
}

.crm-offer-card--submitted {
    border-color: #f0c9c9;
    background: #fff8f8;
}

.crm-offer-card--rejected {
    border-color: #eed5d5;
    background: #fffafa;
}

.crm-offer-card--draft {
    border-color: var(--crm-border);
    background: #fbfdfb;
}

.crm-offer-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.crm-offer-card-heading {
    min-width: 0;
    flex: 1;
}

.crm-offer-card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.crm-offer-card-title {
    font-size: 22px;
    font-weight: 700;
}

.crm-offer-card-badges {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.crm-offer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.crm-offer-actions-top {
    margin-bottom: 6px;
    align-self: flex-start;
}

.crm-offer-details {
    display: block;
}

.crm-offer-card.is-collapsed .crm-offer-details[hidden] {
    display: none;
}

.crm-offer-meta-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.crm-offer-meta-item {
    background: #ffffff;
    border: 1px solid var(--crm-border);
    border-radius: 16px;
    padding: 14px;
}

.crm-offer-meta-label {
    font-size: 12px;
    font-weight: 700;
    color: #718077;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.crm-offer-meta-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--crm-text);
    line-height: 1.5;
    word-break: break-word;
}

.crm-offer-note {
    margin-top: 16px;
    padding: 16px;
    background: #ffffff;
    border: 1px solid var(--crm-border);
    border-radius: 16px;
}

.crm-offer-note-text {
    font-size: 14px;
    color: var(--crm-text);
    line-height: 1.6;
    white-space: pre-line;
}

.crm-offer-review {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Forms */

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

.crm-form-group {
    display: flex;
    flex-direction: column;
}

.crm-form-group-full {
    grid-column: 1 / -1;
}

.crm-phone-grid {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr);
    gap: 12px;
}

.crm-form-note {
    margin-top: 8px;
    font-size: 12px;
    color: var(--crm-text-soft);
    line-height: 1.55;
}

.crm-field-error {
    margin-top: 8px;
    font-size: 13px;
    color: var(--crm-error-text);
    font-weight: 600;
}

.crm-checkbox-card {
    margin-top: 0;
    padding: 18px;
    background: #f8fbf9;
    border: 1px solid var(--crm-border);
    border-radius: 18px;
}

.crm-checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
}

.crm-checkbox-row input {
    margin-top: 3px;
    width: 16px;
    height: 16px;
    accent-color: var(--crm-green);
    flex-shrink: 0;
}

.crm-checkbox-row strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--crm-text);
}

.crm-checkbox-row small {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    color: var(--crm-text-soft);
    line-height: 1.55;
}

.crm-form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 22px;
}

.crm-logout-btn {
    border: 0;
    background: var(--crm-green);
    color: #111111;
    padding: 12px 14px;
    border-radius: 12px;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    width: 100%;
    transition: 0.2s ease;
}

.crm-logout-btn:hover {
    background: var(--crm-green-dark);
    color: #ffffff;
}

@media (max-width: 1460px) {
    .crm-card-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1280px) {
    .crm-users-stats-grid,
    .crm-offer-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

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

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

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

    .crm-sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(10, 14, 20, 0.5);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: 0.2s ease;
        z-index: 18;
    }

    .crm-sidebar-backdrop.is-visible {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .crm-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 292px;
        max-width: calc(100vw - 36px);
        min-height: 100vh;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.24s ease;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
    }

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

    .crm-sidebar-close {
        display: inline-flex;
    }

    .crm-main {
        padding: 18px 18px 28px;
    }

    .crm-main-topbar {
        justify-content: space-between;
        min-height: 56px;
        margin-bottom: 34px;
    }

    .crm-mobile-toggle {
        display: inline-flex;
        position: relative;
        z-index: 2;
    }

    .crm-mobile-top-logo {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        z-index: 1;
    }

    .crm-topbar-actions {
        gap: 8px;
    }

    .crm-notification-toggle {
        width: 44px;
        height: 44px;
        border-radius: 14px;
    }

    .crm-notification-panel {
        right: -6px;
        width: min(400px, calc(100vw - 20px));
    }

    .crm-user-chip {
        background: transparent;
        border: 0;
        padding: 0;
        gap: 8px;
        border-radius: 0;
        max-width: 120px;
        justify-content: flex-end;
    }

    .crm-user-avatar {
        width: 40px;
        height: 40px;
        font-size: 15px;
    }

    .crm-user-meta strong {
        font-size: 12px;
        font-weight: 600;
    }

    .crm-user-meta span {
        display: none;
    }

    .crm-pre-header-actions {
        justify-content: stretch;
        margin-bottom: 18px;
    }

    .crm-main-title {
        font-size: 40px;
    }

    .crm-main-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .crm-main-heading-top {
        align-items: flex-start;
        gap: 14px;
    }

    .crm-main-header-actions {
        width: auto;
        flex-wrap: wrap;
    }
}

@media (max-width: 720px) {
    .crm-card-grid,
    .crm-users-stats-grid,
    .crm-form-grid,
    .crm-phone-grid,
    .crm-offer-meta-grid,
    .crm-offer-summary-grid {
        grid-template-columns: 1fr;
    }

    .crm-main-title {
        font-size: 34px;
    }

    .crm-section-title {
        font-size: 24px;
    }

    .crm-nav-link {
        padding: 12px 14px;
    }

    .crm-mobile-top-logo img {
        width: 138px;
    }

    .crm-users-panel,
    .crm-form-panel,
    .crm-offer-card {
        padding: 20px;
    }

    .crm-page-toolbar,
    .crm-form-actions,
    .crm-main-header-actions,
    .crm-offer-card-top {
        flex-direction: column;
        align-items: stretch;
    }

    .crm-btn,
    .crm-btn-back {
        width: 100%;
    }

    .crm-leads-filter-toolbar {
        align-items: stretch;
    }

    .crm-leads-filter-search {
        max-width: none;
    }

    .crm-offer-actions,
    .crm-offer-card-badges {
        justify-content: flex-start;
    }

    .crm-users-table {
        min-width: 860px;
    }
}

@media (max-width: 540px) {
    .crm-topbar-actions {
        gap: 6px;
    }

    .crm-notification-panel {
        right: -8px;
        width: min(360px, calc(100vw - 16px));
    }

    .crm-notification-panel-header {
        padding: 16px 16px 12px;
    }

    .crm-notification-mark-all {
        padding: 8px 10px;
    }

    .crm-toast-stack {
        left: 12px;
        right: 12px;
        bottom: 12px;
        width: auto;
    }

    .crm-user-chip {
        max-width: 48px;
    }

    .crm-user-meta {
        display: none;
    }

    .crm-main-subtitle {
        font-size: 14px;
        line-height: 1.7;
    }
}

@media (max-width: 640px) {
    .crm-login-page {
        padding: 18px;
    }

    .crm-card {
        padding: 22px;
    }

    .crm-brand-logo {
        max-width: 220px;
    }

    .crm-card-title {
        font-size: 24px;
    }
}
/* Documentation + simplified pricing fix */
.crm-doc-simple-meta,
.crm-doc-simple-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.crm-doc-simple-list {
    margin: 0;
    padding-left: 20px;
    display: grid;
    gap: 12px;
}

.crm-doc-simple-list-numbered {
    padding-left: 24px;
}

.crm-doc-simple-list li {
    color: var(--crm-text-soft);
    line-height: 1.65;
}

.crm-pricing-simple-panel .crm-users-table th,
.crm-pricing-simple-panel .crm-users-table td {
    vertical-align: middle;
}

.crm-pricing-simple-toolbar {
    display: grid;
    grid-template-columns: minmax(240px, 320px) minmax(280px, 360px) auto;
    gap: 18px;
    align-items: end;
    margin-bottom: 24px;
}

.crm-pricing-date-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 16px;
}

.crm-pricing-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

@media (max-width: 1100px) {
    .crm-pricing-simple-toolbar {
        grid-template-columns: 1fr;
    }

    .crm-pricing-date-fields {
        grid-template-columns: 1fr 1fr;
    }
}

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


/* Invoice registry filters */
.crm-invoices-filter-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 20px;
}

.crm-invoices-filter-fields {
    display: grid;
    grid-template-columns: 190px 190px minmax(280px, 1fr);
    gap: 12px;
    align-items: center;
}

.crm-invoices-date-input,
.crm-invoices-search-wrap {
    min-width: 0;
    width: 100%;
}

.crm-search-input-wrap {
    position: relative;
}

.crm-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #748479;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.crm-search-icon svg {
    width: 18px;
    height: 18px;
    display: block;
}

.crm-search-input-wrap .crm-search-input {
    padding-left: 46px;
}

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

    .crm-invoices-search-wrap {
        grid-column: 1 / -1;
    }
}

@media (max-width: 720px) {
    .crm-invoices-filter-fields {
        grid-template-columns: 1fr;
    }

    .crm-invoices-search-wrap {
        grid-column: auto;
    }
}


.crm-table-sort-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: inherit;
    text-decoration: none;
    transition: color .18s ease;
}

.crm-table-sort-link span {
    font-size: 11px;
    line-height: 1;
}

.crm-table-sort-link:hover,
.crm-table-sort-link.is-active {
    color: var(--crm-green-dark);
}

.crm-order-pipeline-shell {
    transition: opacity .18s ease;
}

.crm-order-pipeline-shell.is-loading {
    opacity: .72;
}

.crm-order-filter-toolbar {
    margin-bottom: 20px;
}

.crm-order-filter-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(380px, 560px);
    align-items: start;
    gap: 14px;
}

.crm-order-filter-chips {
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding-bottom: 2px;
}

.crm-order-filter-chips .crm-filter-chip {
    padding: 0 14px;
}

.crm-order-filter-fields {
    display: grid;
    grid-template-columns: minmax(220px, 300px) minmax(160px, 220px);
    align-items: center;
    gap: 10px;
    justify-self: end;
}

.crm-order-filter-field {
    min-width: 0;
}

.crm-order-filter-field .crm-input,
.crm-order-filter-field .crm-select {
    width: 100%;
}

.crm-order-search-field .crm-input {
    min-width: 0;
}

.crm-order-filter-select {
    min-width: 220px;
}

.crm-orders-table-wrap {
    max-height: 560px;
    overflow-y: auto;
    overflow-x: auto;
    border-radius: 24px;
}

.crm-orders-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #ffffff;
}

@media (max-width: 1500px) {
    .crm-order-filter-row {
        grid-template-columns: 1fr;
    }

    .crm-order-filter-chips {
        flex-wrap: wrap;
    }

    .crm-order-filter-fields {
        width: 100%;
        grid-template-columns: minmax(220px, 1fr) minmax(180px, 240px);
    }
}

@media (max-width: 900px) {
    .crm-order-filter-fields {
        grid-template-columns: 1fr;
    }
}


.crm-role-badge.is-admin {
    background: #fff1f8;
    color: #ad3f72;
}

.crm-role-badge.is-manager {
    background: #eef7f0;
    color: #2f6d3c;
}

.crm-role-badge.is-planner {
    background: #eef4ff;
    color: #365fb7;
}

.crm-role-badge.is-storage {
    background: #fff8dd;
    color: #9a6b00;
}

.crm-role-badge.is-carrier {
    background: #edf9f2;
    color: #238157;
}

.crm-status-badge.is-delivered {
    background: #eef8ff;
    color: #226a91;
}

.crm-status-badge.is-draft {
    background: #f4f6f5;
    color: #526158;
}

.crm-status-badge.is-sent {
    background: #eef4ff;
    color: #365fb7;
}

.crm-status-badge.is-overdue {
    background: #fff1f1;
    color: #c73b3b;
}


.crm-table-select-cell {
    text-align: center;
    width: 74px;
}

.crm-table-select-wrap {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.crm-table-select-all {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.crm-btn-danger {
  background: #b42318;
  color: #fff;
  border-color: #b42318;
}

.crm-btn-danger:hover {
  background: #912018;
  border-color: #912018;
}

.crm-role-badge.is-client {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

[data-crm-page-shell] {
  transition: opacity .14s ease;
}

[data-crm-page-shell].is-crm-ajax-loading {
  opacity: .58;
  pointer-events: none;
}
