body#crm-app.crm-v2:has(#view-dashboard.active) {
    --v2-side: clamp(210px, 16.63vw, 278px);
    --v2-bg: #f7f9f6;
    --v2-ink: #102822;
    --v2-muted: #415d55;
    --v2-line: #cdd8d1;
    --home-green: #07513c;
    --home-mint: #e0efe5;
    font-family: "Instrument Sans", Inter, system-ui, sans-serif;
}

body#crm-app.crm-v2 main:has(#view-dashboard.active) {
    max-width: 1820px !important;
    padding: 18px clamp(22px, 1.4vw, 34px) 36px clamp(22px, 1.65vw, 34px) !important;
}

body#crm-app.crm-v2:has(#view-dashboard.active) .v2-sidebar {
    padding: 32px 14px 28px;
    gap: 40px;
    background: #eff3ee;
    border: 0;
    overflow-y: auto;
}

body#crm-app.crm-v2:has(#view-dashboard.active) .v2-sidebar .ry-brand-lockup {
    padding-inline: clamp(8px, 1.2vw, 20px);
}

body#crm-app.crm-v2:has(#view-dashboard.active) .v2-sidebar .ry-brand-mark {
    width: clamp(33px, 2.5vw, 42px);
    height: clamp(33px, 2.5vw, 42px);
}

body#crm-app.crm-v2:has(#view-dashboard.active) .v2-sidebar .ry-brand-name {
    color: var(--v2-ink);
    font-family: "Bricolage Grotesque", Inter, sans-serif;
    font-size: clamp(23px, 2.05vw, 35px);
}

body#crm-app.crm-v2:has(#view-dashboard.active) .v2-sidebar .v2-menu a {
    gap: 17px;
    padding: 10px 16px 10px clamp(12px, 1.35vw, 23px);
    min-height: clamp(44px, 3.45vw, 58px);
    font-size: clamp(16px, 1.3vw, 22px);
    color: var(--v2-ink);
}

body#crm-app.crm-v2:has(#view-dashboard.active) .v2-sidebar .v2-menu a[aria-current="page"] {
    color: var(--home-green);
    background: #dceee3;
    box-shadow: inset 4px 0 #06965f !important;
    font-weight: 700;
}

body#crm-app.crm-v2:has(#view-dashboard.active) .v2-sidebar .v2-menu svg {
    width: clamp(20px, 1.55vw, 26px);
    height: clamp(20px, 1.55vw, 26px);
}

#view-dashboard {
    --home-title-font: "Bricolage Grotesque", Inter, system-ui, sans-serif;
    --home-number-font: "IBM Plex Mono", ui-monospace, monospace;
    font-size: clamp(16px, 1.27vw, 22px);
}

#view-dashboard [hidden] { display: none !important; }

.home-toolbar,
.home-toolbar-actions,
.home-priority-actions { display: flex; align-items: center; }

.home-toolbar { justify-content: space-between; gap: 16px; margin-bottom: clamp(22px, 1.8vw, 30px); }
.home-toolbar-actions { gap: clamp(12px, 1.8vw, 30px); flex: none; }
.home-toolbar-actions #home-new-order { padding-inline: clamp(12px, 1.4vw, 24px); }

.home-business-picker {
    width: min(100%, 288px);
    min-width: 0;
    position: relative;
}

body#crm-app.crm-v2 #home-business {
    appearance: none;
    width: 100%;
    min-height: clamp(44px, 2.8vw, 48px);
    padding: 6px 40px 6px 20px;
    border: 1px solid #b9c8bf !important;
    border-radius: 12px !important;
    background: transparent;
    color: var(--v2-ink);
    font-size: inherit !important;
    font-weight: 600;
    cursor: pointer;
    text-overflow: ellipsis;
}

.home-business-picker svg { position: absolute; top: 50%; right: 15px; width: 20px; transform: translateY(-50%); pointer-events: none; }

.home-button {
    min-height: 50px;
    padding: .58em 1.2em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 1px solid var(--home-green);
    border-radius: 12px;
    color: #fff;
    background: var(--home-green);
    text-decoration: none;
    font-weight: 700;
    line-height: 1.2;
}

.home-button:hover { background: #064331; color: #fff; }
.home-button svg { width: 1.23em; height: 1.23em; flex: none; }
.home-button-secondary { background: transparent; color: var(--home-green); }
.home-button-secondary:hover { background: #d3e7da; color: var(--home-green); }

.home-notifications { position: relative; }
@media (min-width: 768px) {
    .home-notifications { padding-right: clamp(12px, 1.75vw, 29px); border-right: 1px solid #b9c8bf; }
}
.home-notifications summary {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    position: relative;
    cursor: pointer;
    list-style: none;
}
.home-notifications summary::-webkit-details-marker { display: none; }
.home-notifications summary > svg { width: 30px; height: 30px; }
.home-notifications summary:focus-visible { outline: 3px solid #399d79; outline-offset: 2px; }
#home-notifications-dot { position: absolute; top: 4px; right: 5px; width: 12px; height: 12px; border: 2px solid var(--v2-bg); border-radius: 50%; background: #087f63; }
.home-notifications-panel {
    position: absolute;
    z-index: 30;
    right: 0;
    top: calc(100% + 8px);
    width: min(360px, calc(100vw - 32px));
    background: #fff;
    padding: 16px;
    border: 1px solid var(--v2-line);
    border-radius: 12px;
    box-shadow: 0 8px 28px #10282218;
    font-size: 15px;
}
.home-notifications-panel h2 { font-weight: 700; }
.home-notifications-panel ul { max-height: 260px; overflow: auto; }
.home-notifications-panel li { padding-block: 10px; border-bottom: 1px solid var(--v2-line); overflow-wrap: anywhere; }
.home-notifications-panel button { margin-top: 12px; min-height: 44px; }

body#crm-app.crm-v2 #view-dashboard .home-title {
    font-family: var(--home-title-font);
    font-size: clamp(29px, 2.65vw, 45px) !important;
    font-weight: 800 !important;
    line-height: 1.1;
    letter-spacing: -.045em;
    margin: 0 0 clamp(16px, 1.2vw, 21px);
}

.home-priority {
    position: relative;
    display: grid;
    align-items: center;
    min-height: clamp(240px, 18.2vw, 306px);
    border-radius: 16px;
    overflow: hidden;
    background: linear-gradient(105deg, #e4f1e8, #dbeee1);
}

.home-priority-copy {
    z-index: 1;
    position: relative;
    min-width: 0;
    max-width: 61%;
    padding: clamp(23px, 2.15vw, 36px);
    padding-bottom: clamp(27px, 2.5vw, 42px);
}

.home-priority-photo {
    position: absolute;
    inset: 0 0 0 auto;
    width: 44%;
    height: 100%;
    clip-path: polygon(8% 0, 100% 0, 100% 100%, 0 100%);
    object-fit: cover;
    object-position: 48% 55%;
}

.home-priority-label {
    display: inline-block;
    margin-bottom: 12px;
    padding: 4px 13px;
    border-radius: 9px;
    background: #c9e3d3;
    font: 600 clamp(15px, 1.55vw, 25px)/1.35 var(--home-number-font);
}

body#crm-app.crm-v2 .home-priority h2 {
    margin: 0;
    font: 800 clamp(26px, 2.68vw, 46px)/1.06 var(--home-title-font);
    letter-spacing: -.044em;
    overflow-wrap: anywhere;
}

.home-priority p {
    margin: 10px 0 0;
    font-size: clamp(17px, 1.69vw, 28px);
    line-height: 1.27;
    overflow-wrap: anywhere;
}

.home-priority-actions { flex-wrap: wrap; gap: 10px clamp(12px, 1.2vw, 20px); margin-top: clamp(18px, 1.6vw, 27px); }
.home-priority-actions .home-button { min-height: clamp(46px, 3.7vw, 62px); padding-inline: clamp(14px, 2.2vw, 37px); font-size: clamp(17px, 1.47vw, 25px); }

.home-work {
    display: grid;
    grid-template-columns: minmax(0, 43fr) minmax(0, 57fr);
    margin-block: clamp(22px, 1.75vw, 30px);
}

.home-work section { min-width: 0; }
.home-work section:first-child { padding-right: clamp(18px, 2.15vw, 36px); }
.home-work section + section { padding-left: clamp(18px, 2.15vw, 36px); border-left: 1px solid var(--v2-line); }
body#crm-app.crm-v2 .home-work h2 { font: 800 clamp(23px, 1.97vw, 33px)/1.08 var(--home-title-font); letter-spacing: -.04em; margin: 0 0 10px; }

.home-list { padding: 0; margin: 0; list-style: none; }
.home-list li + li { border-top: 1px solid var(--v2-line); }
.home-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: clamp(10px, 1.15vw, 20px);
    min-height: clamp(64px, 5.2vw, 88px);
    padding: 8px 3px;
    color: var(--v2-ink);
    text-decoration: none;
}
.home-row:hover { background: #eaf3eb; }
.home-row-icon {
    display: grid;
    place-items: center;
    width: clamp(42px, 3.9vw, 66px);
    height: clamp(42px, 3.65vw, 61px);
    border-radius: 13px;
    color: var(--home-green);
    background: var(--home-mint);
}
.home-row-icon svg { width: 52%; height: 52%; }
.home-row-title, .home-row-detail { display: block; overflow-wrap: anywhere; line-height: 1.24; }
.home-row-title { font-weight: 700; }
.home-row-detail { color: var(--v2-muted); margin-top: 4px; }
.home-row > svg { width: 19px; }
.home-activity .home-row { min-height: clamp(58px, 4.48vw, 75px); font-size: .92em; }
.home-activity .home-row-icon { width: clamp(39px, 3.3vw, 55px); height: clamp(39px, 3.1vw, 52px); }
.home-activity :is(.home-row-title, .home-row-detail) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-activity time { color: var(--v2-muted); white-space: nowrap; font-size: .86em; }
.home-list-empty { color: var(--v2-muted); padding: 16px 3px; }

.home-metrics {
    display: grid;
    grid-template-columns: minmax(0, 1.26fr) minmax(0, .88fr) minmax(0, 1.12fr) minmax(0, 1.32fr);
    gap: clamp(10px, 2.75vw, 46px);
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid var(--v2-line);
}
.home-metric { display: flex; flex-direction: column; min-width: 0; gap: 7px; color: var(--v2-ink); text-decoration: none; }
.home-metric:not(:last-child) { border-right: 1px solid #c3d0c8; padding: 0 8px 0 clamp(0px, .65vw, 11px); }
.home-metric:first-child { padding-left: clamp(0px, 2.1vw, 35px); }
.home-metric strong { font: 600 clamp(17px, 1.95vw, 33px)/1.2 var(--home-number-font); overflow-wrap: anywhere; }
.home-metric-outstanding { background: #f7ebda; color: #723b08; border-radius: 12px; padding: 8px clamp(10px, 1.65vw, 28px); }
.home-metric:is(a):hover span { text-decoration: underline; text-underline-offset: 3px; }

.home-progress { display: none; }

@media (max-width: 1023px) {
    body#crm-app.crm-v2 main:has(#view-dashboard.active) { padding: 18px clamp(14px, 3vw, 27px) 28px !important; }
    .home-priority-copy { max-width: 63%; }

    .home-progress {
        display: block;
        margin-block: 18px 22px;
        padding: clamp(13px, 4vw, 20px);
        border: 1px solid #21654f;
        border-radius: 18px;
        background: linear-gradient(150deg, #175d46 0%, #0a3c30 68%);
        color: #f4fbf6;
    }
    .home-progress-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 1px 12px; }
    body#crm-app.crm-v2 #home-progress-title {
        margin: 0;
        color: #f4fbf6;
        font: 800 clamp(25px, 5vw, 33px)/1.1 var(--home-title-font);
        letter-spacing: -.035em;
    }
    .home-progress-heading p { color: #bfe0ce; font-size: 13px; margin: 3px 0 0; overflow-wrap: anywhere; }
    .home-progress-heading-icon {
        display: grid;
        place-items: center;
        flex: none;
        width: 40px;
        height: 40px;
        border: 1px solid #73a691;
        border-radius: 13px;
        background: #2b7059;
        color: #e0f6bb;
    }
    .home-progress-heading-icon svg { width: 21px; height: 21px; }
    .home-progress-tracks { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
    .home-progress-track {
        display: grid;
        grid-template-columns: 34px minmax(0, 1fr) 14px;
        align-items: center;
        gap: 8px;
        min-height: 52px;
        padding: 7px 8px;
        border: 1px solid #497967;
        border-radius: 11px;
        color: #f4fbf6;
        background: #ffffff0c;
        text-decoration: none;
    }
    .home-progress-track:active { background: #ffffff22; }
    .home-progress-track:focus-visible { outline: 2px solid #ddf2a8; outline-offset: 2px; }
    .home-progress-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; color: #d3f2e3; background: #2e6b57; }
    .home-progress-icon svg { width: 17px; height: 17px; }
    .home-progress-copy { min-width: 0; display: grid; gap: 5px; }
    .home-progress-line { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 2px 8px; font-size: 14px; line-height: 1.15; }
    .home-progress-line strong { color: #d0eedf; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
    .home-progress-arrow { width: 14px; height: 14px; color: #bfe0ce; }
    .home-progress-track progress {
        appearance: none;
        display: block;
        width: 100%;
        height: 5px;
        border: 0;
        border-radius: 99px;
        overflow: hidden;
        background: #477965;
    }
    .home-progress-track progress::-webkit-progress-bar { background: #477965; border-radius: 99px; }
    .home-progress-track progress::-webkit-progress-value { background: #9cd9b7; border-radius: 99px; }
    .home-progress-track progress::-moz-progress-bar { background: #9cd9b7; border-radius: 99px; }
    .home-progress-tracks [data-state="complete"] .home-progress-icon { color: #224829; background: #d6efa9; position: relative; }
    .home-progress-tracks [data-state="complete"] .home-progress-icon::after {
        content: "";
        position: absolute;
        top: 5px;
        right: 5px;
        width: 7px;
        height: 4px;
        border: solid currentColor;
        border-width: 0 0 1.5px 1.5px;
        transform: rotate(-45deg);
    }
    .home-progress-tracks [data-state="complete"] .home-progress-line strong { color: #e1f6b8; }
    .home-progress-tracks [data-state="complete"] progress::-webkit-progress-value { background: #d6efa9; }
    .home-progress-tracks [data-state="complete"] progress::-moz-progress-bar { background: #d6efa9; }
    .home-progress-tracks :is([data-state="loading"], [data-state="empty"], [data-state="unavailable"]) progress { visibility: hidden; }
}

@media (max-width: 1023px) and (prefers-reduced-motion: no-preference) {
    .home-progress-tracks [data-state="complete"] .home-progress-icon { animation: home-progress-acknowledge 340ms ease-out; }
    @keyframes home-progress-acknowledge {
        0% { transform: scale(.92); }
        60% { transform: scale(1.09); }
        100% { transform: scale(1); }
    }
}

@media (max-width: 640px) {
    .home-toolbar { gap: 8px; margin-bottom: 20px; }
    .home-toolbar-actions { gap: 3px; position: relative; }
    .home-toolbar-actions #home-new-order { min-height: 44px; font-size: 14px; padding: 8px 10px; gap: 5px; }
    .home-notifications summary > svg { width: 24px; height: 24px; }
    .home-notifications { position: static; }
    .home-notifications-panel { right: 0; }
    body#crm-app.crm-v2 #home-business { padding: 6px 28px 6px 9px; font-size: 14px !important; }
    .home-business-picker svg { right: 7px; width: 16px; }
    .home-priority { min-height: 0; }
    .home-priority-copy { max-width: none; padding: 19px 16px 17px; }
    .home-priority-photo { position: static; width: 100%; height: clamp(96px, 27vw, 155px); clip-path: none; }
    .home-priority-actions { gap: 8px; }
    .home-priority-actions .home-button { flex: 1 0 auto; min-height: 46px; font-size: 16px; padding-inline: 10px; }
    .home-work { grid-template-columns: 1fr; gap: 22px; }
    .home-work section:first-child, .home-work section + section { padding: 0; border: 0; }
    .home-activity .home-row { grid-template-columns: auto minmax(0, 1fr); }
    .home-activity :is(.home-row-title, .home-row-detail) { white-space: normal; }
    .home-activity time { grid-column: 2; margin-top: -6px; }
    .home-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 9px; }
    .home-metric:not(:last-child), .home-metric:first-child { padding: 7px 6px; border: 0; }
    .home-metric span { font-size: 14px; }
}
