:root {
    --crm-orange: #df550c;
    --crm-orange-dark: #ba4307;
    --crm-orange-soft: #fff2e9;
    --crm-purple: #6f56d9;
    --crm-ink: #211f35;
    --crm-muted: #777381;
    --crm-border: #e7e4eb;
    --crm-canvas: #f6f5f8;
    --crm-surface: #ffffff;
    --crm-danger: #d84b54;
    --crm-success: #2d9a69;
    --crm-sidebar-width: 272px;
    --crm-sidebar-collapsed: 82px;
    --crm-topbar-height: 78px;
    --crm-shadow: 0 16px 44px rgba(31, 29, 54, .08);
}

.crm-shell-body,
.crm-shell-body * { box-sizing: border-box; }
.crm-shell-body { margin: 0; color: var(--crm-ink); background: var(--crm-canvas); font-family: "Plus Jakarta Sans", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
.crm-shell-body button,
.crm-shell-body input,
.crm-shell-body select,
.crm-shell-body textarea { font-family: inherit; }
.crm-shell-body a { color: inherit; }
.crm-shell { min-height: 100vh; display: flex; }
.crm-workspace { width: calc(100% - var(--crm-sidebar-width)); min-width: 0; margin-left: var(--crm-sidebar-width); transition: width .24s ease, margin-left .24s ease; }

.crm-sidebar { width: var(--crm-sidebar-width); height: 100vh; border-right: 1px solid var(--crm-border); position: fixed; inset: 0 auto 0 0; z-index: 1000; display: flex; flex-direction: column; background: rgba(255,255,255,.97); box-shadow: 8px 0 30px rgba(31,29,54,.025); backdrop-filter: blur(16px); transition: width .24s ease, transform .24s ease; }
.crm-sidebar__brand { min-height: var(--crm-topbar-height); padding: 0 17px; border-bottom: 1px solid #efedf2; display: flex; align-items: center; gap: 10px; }
.crm-sidebar__brand > a { min-width: 0; flex: 1; display: flex; align-items: center; gap: 11px; text-decoration: none; }
.crm-sidebar__brand img,
.crm-brand-mark { width: 42px; height: 42px; flex: 0 0 42px; border: 1px solid var(--crm-border); border-radius: 13px; display: flex; align-items: center; justify-content: center; object-fit: contain; background: #fff; }
.crm-brand-mark { border: 0; color: #fff; background: linear-gradient(135deg, var(--crm-orange), #f58b3d); font-size: 14px; font-weight: 800; box-shadow: 0 8px 20px rgba(223,85,12,.22); }
.crm-brand-copy { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; white-space: nowrap; transition: opacity .17s ease, width .17s ease; }
.crm-brand-copy strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; }
.crm-brand-copy small { margin-top: 3px; color: var(--crm-muted); font-size: 9px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }
.crm-sidebar__collapse { width: 31px; height: 31px; flex: 0 0 31px; border: 1px solid var(--crm-border); border-radius: 9px; color: #96919f; background: #faf9fb; cursor: pointer; transition: color .18s, background .18s, transform .24s; }
.crm-sidebar__collapse:hover { color: var(--crm-orange); background: var(--crm-orange-soft); }
.crm-sidebar__nav { padding: 17px 12px 28px; flex: 1; overflow-x: hidden; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #d7d3dc transparent; }
.crm-menu-group + .crm-menu-group { margin-top: 18px; padding-top: 16px; border-top: 1px solid #f0eef2; }
.crm-menu-group > p { margin: 0 10px 7px; color: #aaa5b0; font-size: 8px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; transition: opacity .16s; }
.crm-menu-item { min-height: 43px; margin: 3px 0; padding: 0 10px; border-radius: 12px; position: relative; display: flex; align-items: center; gap: 11px; color: #676270; font-size: 11px; font-weight: 700; text-decoration: none; white-space: nowrap; transition: color .18s, background .18s, transform .18s; }
.crm-menu-item:hover { color: var(--crm-ink); background: #f6f4f8; transform: translateX(2px); }
.crm-menu-item.is-active { color: #fff; background: linear-gradient(135deg, var(--crm-orange), #e96924); box-shadow: 0 9px 20px rgba(223,85,12,.2); }
.crm-menu-item__icon { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: #817b89; background: #f1eff4; font-size: 11px; transition: color .18s, background .18s; }
.crm-menu-item:hover .crm-menu-item__icon { color: var(--crm-orange); background: var(--crm-orange-soft); }
.crm-menu-item.is-active .crm-menu-item__icon { color: #fff; background: rgba(255,255,255,.16); }
.crm-menu-item__label { overflow: hidden; text-overflow: ellipsis; }
.crm-sidebar__account { padding: 13px; border-top: 1px solid var(--crm-border); }
.crm-sidebar-user { min-height: 55px; padding: 8px; border-radius: 13px; display: flex; align-items: center; gap: 10px; background: #faf9fb; text-decoration: none; }
.crm-avatar { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; color: #fff; background: linear-gradient(135deg, var(--crm-purple), #8d78eb); font-size: 12px; font-weight: 800; }
.crm-avatar img { width: 100%; height: 100%; object-fit: cover; }
.crm-sidebar-user__copy { min-width: 0; display: flex; flex-direction: column; }
.crm-sidebar-user__copy strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.crm-sidebar-user__copy small { margin-top: 2px; color: var(--crm-muted); font-size: 8px; }

.crm-shell.is-collapsed .crm-sidebar { width: var(--crm-sidebar-collapsed); }
.crm-shell.is-collapsed .crm-workspace { width: calc(100% - var(--crm-sidebar-collapsed)); margin-left: var(--crm-sidebar-collapsed); }
.crm-shell.is-collapsed .crm-brand-copy,
.crm-shell.is-collapsed .crm-menu-group > p,
.crm-shell.is-collapsed .crm-menu-item__label,
.crm-shell.is-collapsed .crm-sidebar-user__copy { width: 0; opacity: 0; pointer-events: none; }
.crm-shell.is-collapsed .crm-sidebar__brand { padding-inline: 20px; }
.crm-shell.is-collapsed .crm-sidebar__brand > a { flex: 0; }
.crm-shell.is-collapsed .crm-sidebar__collapse { position: absolute; right: -15px; background: #fff; box-shadow: 0 5px 16px rgba(31,29,54,.12); transform: rotate(180deg); }
.crm-shell.is-collapsed .crm-menu-item { padding-inline: 15px; justify-content: center; }
.crm-shell.is-collapsed .crm-menu-item:hover { transform: none; }
.crm-shell.is-collapsed .crm-sidebar-user { padding-inline: 10px; justify-content: center; }

.crm-topbar { min-height: var(--crm-topbar-height); padding: 12px clamp(18px, 2.5vw, 36px); border-bottom: 1px solid var(--crm-border); position: sticky; top: 0; z-index: 800; display: flex; align-items: center; justify-content: space-between; gap: 22px; background: rgba(255,255,255,.92); backdrop-filter: blur(18px); }
.crm-topbar__lead { min-width: 0; display: flex; align-items: center; gap: 13px; }
.crm-topbar__lead > div { min-width: 0; }
.crm-topbar__eyebrow { display: block; color: var(--crm-orange); font-size: 8px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.crm-topbar h1 { margin: 2px 0 1px; overflow: hidden; font-size: clamp(18px, calc(2vw + 1px), 22px); font-weight: 700 !important; line-height: 1.2; letter-spacing: -.025em; text-overflow: ellipsis; white-space: nowrap; }
.crm-topbar p { margin: 0; overflow: hidden; color: var(--crm-muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.crm-topbar__actions { display: flex; align-items: center; gap: 8px; }
.crm-icon-button { width: 40px; height: 40px; padding: 0; border: 1px solid var(--crm-border); border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; color: #6f6977; background: #fff; cursor: pointer; transition: color .18s, background .18s, border-color .18s, transform .18s; }
.crm-icon-button:hover { border-color: #d8d3dd; color: var(--crm-orange); background: var(--crm-orange-soft); transform: translateY(-1px); }
.crm-mobile-menu { display: none; }
.crm-account-button { min-height: 42px; padding: 3px 11px 3px 3px; border: 1px solid var(--crm-border); border-radius: 13px; display: flex; align-items: center; gap: 9px; background: #fff; text-decoration: none; transition: border-color .18s, box-shadow .18s; }
.crm-account-button:hover { border-color: #d8d3dd; box-shadow: 0 8px 22px rgba(31,29,54,.07); }
.crm-avatar--topbar { width: 34px; height: 34px; flex-basis: 34px; border-radius: 10px; }
.crm-account-button > span:last-child { min-width: 0; display: flex; flex-direction: column; }
.crm-account-button strong { font-size: 9px; }
.crm-account-button small { max-width: 120px; margin-top: 2px; overflow: hidden; color: var(--crm-muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.crm-logout-form { margin: 0; }
.crm-logout-form .crm-icon-button:hover { color: var(--crm-danger); background: #fff1f2; }

.crm-popover { position: relative; }
.crm-notification-button { position: relative; }
.crm-notification-count { min-width: 18px; height: 18px; padding: 0 5px; border: 2px solid #fff; border-radius: 999px; position: absolute; top: -6px; right: -6px; display: inline-flex; align-items: center; justify-content: center; color: #fff; background: var(--crm-danger); font-size: 7px; font-weight: 800; box-shadow: 0 4px 10px rgba(216,75,84,.25); }
.crm-notification-panel { width: min(390px, calc(100vw - 24px)); max-height: min(610px, calc(100vh - 96px)); border: 1px solid var(--crm-border); border-radius: 17px; position: absolute; top: 49px; right: 0; overflow: hidden; background: #fff; box-shadow: 0 24px 70px rgba(31,29,54,.18); }
.crm-notification-panel > header { min-height: 66px; padding: 13px 15px; border-bottom: 1px solid #efedf2; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.crm-notification-panel > header > div { display: flex; flex-direction: column; }
.crm-notification-panel > header strong { font-size: 12px; }
.crm-notification-panel > header small { margin-top: 3px; color: var(--crm-muted); font-size: 8px; }
.crm-notification-panel > header button { padding: 6px 8px; border: 0; border-radius: 8px; color: var(--crm-orange); background: var(--crm-orange-soft); font-size: 8px; font-weight: 800; cursor: pointer; }
.crm-notification-panel > header button:disabled { opacity: .62; cursor: wait; }
.crm-notification-list { max-height: 480px; padding: 7px; overflow-y: auto; }
.crm-notification-error { margin: 5px; padding: 10px 11px; border: 1px solid #f3c8c8; border-radius: 10px; display: flex; align-items: flex-start; gap: 8px; color: #9f3030; background: #fff3f3; font-size: 9px; line-height: 1.45; }
.crm-notification-error i { margin-top: 2px; }
.crm-notification-item { min-height: 72px; padding: 10px; border-radius: 12px; display: flex; align-items: flex-start; gap: 10px; text-decoration: none; transition: background .18s; }
.crm-notification-item:hover { background: #f8f7f9; }
.crm-notification-item.is-unread { background: #fff8f3; }
.crm-notification-item__icon { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: var(--crm-orange); background: var(--crm-orange-soft); font-size: 11px; }
.crm-notification-item__copy { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.crm-notification-item__copy strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.crm-notification-item__copy > span { margin-top: 3px; overflow: hidden; display: -webkit-box; color: #77717e; font-size: 8px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.crm-notification-item__copy small { margin-top: 4px; color: #a49faa; font-size: 7px; }
.crm-notification-item.is-unread .crm-notification-item__copy strong::after { content: ""; width: 6px; height: 6px; margin-left: 6px; border-radius: 50%; display: inline-block; background: var(--crm-orange); }
.crm-notification-empty { min-height: 210px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #a39eaa; text-align: center; }
.crm-notification-empty i { margin-bottom: 11px; font-size: 24px; }
.crm-notification-empty strong { color: #5e5966; font-size: 11px; }
.crm-notification-empty span { margin-top: 4px; font-size: 8px; }

.crm-main { min-height: calc(100vh - var(--crm-topbar-height)); padding: clamp(18px, 2.6vw, 36px); position: relative; overflow: hidden; }
.crm-main--module { padding: 0; overflow: visible; }
.crm-main--module .tasks-app,
.crm-main--module .projects-app { min-height: calc(100vh - var(--crm-topbar-height)); }
.crm-toast { max-width: min(430px, calc(100vw - 28px)); min-height: 50px; padding: 12px 14px; border-radius: 13px; position: fixed; z-index: 3000; top: 92px; right: 20px; display: flex; align-items: center; gap: 10px; color: #fff; background: var(--crm-danger); box-shadow: 0 18px 44px rgba(31,29,54,.2); font-size: 10px; font-weight: 700; }
.crm-toast.is-success { background: var(--crm-success); }
.crm-toast button { margin-left: auto; border: 0; color: inherit; background: transparent; cursor: pointer; }
.crm-sidebar-overlay { display: none; }

@media (max-width: 1020px) {
    .crm-sidebar { transform: translateX(-105%); box-shadow: 20px 0 60px rgba(31,29,54,.18); }
    .crm-workspace,
    .crm-shell.is-collapsed .crm-workspace { width: 100%; margin-left: 0; }
    .crm-shell.is-mobile-open .crm-sidebar { width: min(290px, calc(100vw - 44px)); transform: translateX(0); }
    .crm-shell.is-mobile-open .crm-brand-copy,
    .crm-shell.is-mobile-open .crm-menu-group > p,
    .crm-shell.is-mobile-open .crm-menu-item__label,
    .crm-shell.is-mobile-open .crm-sidebar-user__copy { width: auto; opacity: 1; pointer-events: auto; }
    .crm-sidebar__collapse { display: none; }
    .crm-mobile-menu { display: inline-flex; }
    .crm-sidebar-overlay { position: fixed; inset: 0; z-index: 990; background: rgba(24,22,35,.46); backdrop-filter: blur(3px); }
    .crm-shell.is-mobile-open .crm-sidebar-overlay { display: block; }
}

@media (max-width: 680px) {
    :root { --crm-topbar-height: 68px; }
    .crm-topbar { padding: 9px 12px; }
    .crm-topbar__eyebrow,
    .crm-topbar p { display: none; }
    .crm-topbar h1 { max-width: 43vw; font-size: 16px; }
    .crm-account-button { width: 40px; height: 40px; padding: 2px; justify-content: center; }
    .crm-account-button > span:last-child { display: none; }
    .crm-avatar--topbar { width: 34px; height: 34px; }
    .crm-topbar__actions { gap: 5px; }
    .crm-main { padding: 14px 12px 82px; }
    .crm-main--module { padding: 0; }
    .crm-notification-panel { position: fixed; top: 64px; right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
    .crm-shell *, .crm-shell *::before, .crm-shell *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
