@font-face {
    font-family: "Roboto";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("/assets/fonts/roboto/roboto-cyrillic-ext.woff2") format("woff2");
    unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

/* Продажи: поиск участников и единый стиль со списком клиентов. */
.sales-stage-pills {
    gap: 8px;
    margin: 0 0 18px;
}

.sales-stage-pills > a {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    color: #42534d;
    background: #f1f5f3;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: .84rem;
    font-weight: 700;
    text-decoration: none;
}

.sales-stage-pills > a:hover,
.sales-stage-pills > a.is-active {
    color: var(--primary-hover);
    background: var(--primary-soft);
    border-color: #aad8c7;
}

.sales-stage-pills b {
    min-width: 24px;
    padding: 2px 6px;
    background: rgba(18, 132, 95, .1);
    border-radius: 999px;
    font-size: 12px;
    text-align: center;
}

.sales-filters-panel .filter-search {
    flex: 1 1 420px;
}

.sales-filters-panel .filter-select {
    flex: 0 1 210px;
}

.panel.simple-deal-list {
    padding: 0;
    overflow: hidden;
}

.simple-deal-card {
    display: grid;
    min-height: 92px;
    grid-template-columns: 40px minmax(210px, 1.25fr) minmax(190px, .9fr) minmax(135px, .65fr) minmax(145px, .72fr) 128px 120px;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    color: var(--text);
    background: #fff;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    transition: background .18s ease, box-shadow .18s ease;
}

.simple-deal-card:last-of-type {
    border-bottom: 0;
}

.simple-deal-card:hover,
.simple-deal-card:focus-visible {
    color: var(--text);
    background: #f4fbf8;
    box-shadow: inset 4px 0 var(--primary);
}

.simple-deal-icon {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    color: var(--primary-dark);
    background: var(--primary-soft);
    border-radius: 12px;
    font-size: 19px;
    font-weight: 800;
}

.simple-deal-main,
.simple-deal-company,
.simple-deal-date,
.simple-deal-assignee {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.simple-deal-card small {
    color: var(--muted);
    font-size: 13px;
}

.simple-deal-main strong {
    overflow: hidden;
    font-size: 17px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.simple-deal-company b,
.simple-deal-date b,
.simple-deal-assignee b {
    overflow: hidden;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.simple-deal-company em,
.simple-deal-date em {
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.simple-deal-date.deal-date-overdue em,
.simple-deal-date.deal-date-overdue b {
    color: #a13a30;
}

.simple-deal-amount,
.simple-deal-open {
    white-space: nowrap;
}

.simple-deal-amount {
    font-size: 16px;
    text-align: right;
}

.simple-deal-card > .deal-stage-badge {
    justify-self: start;
}

.simple-deal-open {
    color: var(--primary-dark);
    font-weight: 800;
}

.deal-party-search {
    position: relative;
}

.deal-form-section .field > label:first-child {
    color: #536075;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .025em;
}

.deal-party-input {
    position: relative;
    display: flex;
    align-items: center;
}

.deal-party-input > span {
    position: absolute;
    z-index: 2;
    left: 14px;
    color: var(--muted);
    pointer-events: none;
}

.deal-party-input input {
    width: 100%;
    min-height: 46px;
    padding-left: 40px;
    padding-right: 42px;
}

.deal-party-input button {
    position: absolute;
    z-index: 2;
    right: 8px;
    display: grid;
    width: 30px;
    height: 30px;
    padding: 0;
    place-items: center;
    color: #64756e;
    background: transparent;
    border: 0;
    border-radius: 50%;
    font-size: 21px;
}

.deal-party-input button:hover {
    color: var(--text);
    background: #edf3f0;
}

.deal-party-results {
    position: absolute;
    z-index: 80;
    top: calc(100% + 7px);
    right: 0;
    left: 0;
    max-height: 330px;
    padding: 6px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 13px;
}

.deal-party-option {
    display: grid;
    width: 100%;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
    padding: 10px;
    color: var(--text);
    background: transparent;
    border: 0;
    border-radius: 9px;
    text-align: left;
}

.deal-party-option:hover,
.deal-party-option:focus-visible {
    background: var(--primary-soft);
}

.deal-party-option > span:nth-child(2) {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.deal-party-option strong,
.deal-party-option small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.deal-party-option small {
    color: var(--muted);
    font-size: 12px;
}

.deal-party-option > b {
    color: var(--primary-dark);
    font-size: 12px;
}

.deal-party-empty,
.deal-party-error {
    padding: 12px;
    color: var(--muted);
    text-align: center;
}

.deal-party-error {
    color: #8b302a;
    background: #fff0ee;
    border-radius: 10px;
    text-align: left;
}

.panel.deal-company-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
    padding: 17px 18px;
}

.deal-company-icon {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    background: var(--primary-soft);
    border-radius: 13px;
    font-size: 21px;
}

.deal-company-card > div {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.deal-company-card small,
.deal-company-card span:not(.deal-company-icon) {
    color: var(--muted);
    font-size: 13px;
}

.deal-company-card strong {
    overflow: hidden;
    font-size: 19px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.client-deals-list {
    display: grid;
    gap: 0;
}

.client-deals-list > .client-deal-card {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto minmax(125px, auto) auto;
    align-items: center;
    gap: 14px;
    padding: 14px 15px;
    color: var(--text);
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    text-decoration: none;
}

.client-deals-list > .client-deal-card:last-child {
    border-bottom: 0;
}

.client-deals-list > .client-deal-card:hover {
    color: var(--text);
    background: #f4fbf8;
    border-color: #aad8c7;
}

.client-deal-main {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.client-deal-main small {
    color: var(--muted);
    font-size: 12px;
}

.client-deal-main strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.client-deal-amount {
    text-align: right;
    white-space: nowrap;
}

.client-deal-open {
    color: var(--primary-dark);
    font-weight: 800;
    white-space: nowrap;
}

@media (max-width: 1350px) {
    .simple-deal-card {
        grid-template-columns: 40px minmax(210px, 1.2fr) minmax(180px, .9fr) minmax(135px, .65fr) 128px 120px;
    }

    .simple-deal-assignee {
        display: none;
    }
}

@media (max-width: 1050px) {
    .simple-deal-card {
        grid-template-columns: 40px minmax(210px, 1.2fr) minmax(170px, .8fr) 128px 120px;
    }

    .simple-deal-date {
        display: none;
    }
}

@media (max-width: 760px) {
    .sales-stage-pills {
        flex-wrap: nowrap;
        padding-bottom: 6px;
        overflow-x: auto;
    }

    .simple-deal-card {
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 10px 12px;
        align-items: start;
    }

    .simple-deal-main {
        grid-column: 2;
    }

    .simple-deal-company {
        grid-column: 2 / -1;
    }

    .simple-deal-card .deal-stage-badge {
        grid-column: 2;
        justify-self: start;
    }

    .simple-deal-amount {
        grid-column: 3;
        grid-row: 1;
    }

    .simple-deal-open {
        grid-column: 2 / -1;
    }

    .deal-company-card {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .deal-company-card .button {
        grid-column: 1 / -1;
        width: 100%;
    }

    .client-deals-list > .client-deal-card {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .client-deal-amount,
    .client-deal-open {
        grid-column: 1;
        text-align: left;
    }

    .client-deal-open {
        grid-column: 2;
        grid-row: 2 / 4;
        align-self: center;
    }
}

@font-face {
    font-family: "Roboto";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("/assets/fonts/roboto/roboto-cyrillic.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: "Roboto";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("/assets/fonts/roboto/roboto-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Roboto";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("/assets/fonts/roboto/roboto-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --bg: #f4f8f6;
    --surface: #ffffff;
    --surface-soft: #f7faf8;
    --surface-strong: #eaf2ee;
    --text: #1c2b27;
    --muted: #61726d;
    --subtle: #62746c;
    --border: #dfe9e4;
    --border-strong: #cfddd6;
    --primary: #168f6a;
    --primary-hover: #0f7657;
    --primary-dark: #0b684c;
    --primary-soft: #e6f5ef;
    --sidebar: #10251f;
    --sidebar-soft: #18352d;
    --green: #168f6a;
    --green-soft: #e6f5ef;
    --amber: #d89016;
    --amber-soft: #fff7e6;
    --red: #d94b60;
    --red-soft: #fff0f2;
    --blue: #238d76;
    --blue-soft: #e7f5f1;
    --purple: #3d9274;
    --bs-primary: #168f6a;
    --bs-primary-rgb: 22, 143, 106;
    --bs-link-color: #147d5e;
    --bs-link-hover-color: #0f644b;
    --bs-body-color: #1c2b27;
    --bs-body-bg: #f4f8f6;
    --bs-border-color: #dfe9e4;
    --bs-font-sans-serif: "Roboto", Arial, sans-serif;
    --bs-body-font-family: var(--bs-font-sans-serif);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .035);
    --shadow-md: 0 18px 48px rgba(15, 23, 42, .10);
    --shadow-lg: 0 24px 64px rgba(15, 23, 42, .16);
    --radius: 16px;
    --radius-sm: 11px;
    --sidebar-width: 268px;
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    font-size: 16px;
    font-family: "Roboto", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Roboto", Arial, sans-serif;
    font-weight: 400;
    line-height: 1.62;
    letter-spacing: -.005em;
}

input,
select,
textarea,
button {
    font: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    color: inherit;
}

button,
select {
    cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid rgba(22, 143, 106, .24);
    outline-offset: 2px;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

.app-shell {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    display: flex;
    width: var(--sidebar-width);
    flex-direction: column;
    overflow-y: auto;
    background:
        radial-gradient(circle at 15% 4%, rgba(40, 166, 125, .2), transparent 28%),
        linear-gradient(180deg, #123129 0%, #0b211b 100%);
    color: #e8edf7;
    border-right: 1px solid rgba(255, 255, 255, .05);
}

.sidebar-brand-row {
    display: flex;
    min-height: 82px;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 82px;
    padding: 17px 24px;
    min-width: 0;
    flex: 1;
}

.brand-copy {
    min-width: 0;
}

.brand-copy strong,
.brand-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-collapse-button {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    margin-right: 12px;
    padding: 0;
    place-items: center;
    color: #9fb0a9;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 9px;
}

.sidebar-collapse-button:hover {
    color: #fff;
    background: rgba(255, 255, 255, .1);
}

.sidebar-collapse-button svg,
.nav-icon svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-icon svg path[d^="M4 4"] {
    fill: currentColor;
    stroke: none;
}

.brand-mark {
    display: inline-flex;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: linear-gradient(145deg, #34b889, #11805d);
    color: #fff;
    box-shadow: 0 10px 24px rgba(12, 103, 74, .3);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .08em;
}

.brand-mark-large {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    font-size: 15px;
}

.brand-logo {
    display: block;
    max-width: 100%;
    object-fit: contain;
}

.brand-logo-sidebar,
.brand-logo-mobile {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    padding: 3px;
    background: rgba(255, 255, 255, .96);
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(5, 40, 30, .25);
}

.brand-logo-login {
    width: auto;
    max-width: 150px;
    height: 54px;
    padding: 5px 8px;
    background: rgba(255, 255, 255, .96);
    border-radius: 13px;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    color: #fff;
    font-size: 17px;
    letter-spacing: -.02em;
}

.brand small {
    margin-top: 1px;
    color: #7f8ca5;
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.main-nav {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 5px;
    padding: 24px 16px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 13px;
    min-height: 46px;
    padding: 10px 13px;
    border: 1px solid transparent;
    border-radius: 11px;
    color: #9ca8bc;
    font-size: 14px;
    font-weight: 600;
    transition: .18s ease;
}

.nav-link:hover {
    background: rgba(255, 255, 255, .045);
    color: #e8edf7;
}

.nav-link.is-active {
    border-color: rgba(101, 207, 170, .18);
    background: linear-gradient(90deg, rgba(22, 143, 106, .28), rgba(22, 143, 106, .11));
    color: #fff;
    box-shadow: inset 3px 0 0 #49c295;
}

.nav-icon {
    display: inline-flex;
    width: 26px;
    height: 26px;
    align-items: center;
    justify-content: center;
    color: #8695b1;
    font-size: 19px;
    font-weight: 400;
}

.nav-link.is-active .nav-icon {
    color: #7bdbb8;
}

.nav-section-label {
    padding: 23px 13px 8px;
    color: #596781;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, .07);
}

.profile-card {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px;
    border-radius: 12px;
    transition: .18s ease;
}

.profile-card:hover {
    background: rgba(255, 255, 255, .055);
}

.profile-copy {
    min-width: 0;
    flex: 1;
}

.profile-copy strong,
.profile-copy small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-copy strong {
    color: #f8fafc;
    font-size: 13px;
}

.profile-copy small {
    margin-top: 2px;
    color: #72819c;
    font-size: 11px;
}

.profile-arrow {
    color: #62708a;
    font-size: 20px;
}

.workspace {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    transition: margin-left .2s ease;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 25;
    display: flex;
    min-height: 82px;
    align-items: center;
    gap: 18px;
    padding: 0 34px;
    border-bottom: 1px solid rgba(215, 222, 234, .82);
    background: rgba(255, 255, 255, .88);
    backdrop-filter: blur(16px);
}

.global-search {
    position: relative;
    display: flex;
    width: min(530px, 46vw);
    align-items: center;
}

.global-search input {
    width: 100%;
    height: 44px;
    padding: 0 68px 0 42px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #f8fafc;
    outline: none;
    color: var(--text);
    font-size: 13px;
    transition: .18s ease;
}

.global-search input:focus {
    border-color: #82bda7;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(22, 143, 106, .1);
}

.search-icon {
    position: absolute;
    left: 15px;
    z-index: 1;
    color: #8d99ab;
    font-size: 21px;
}

.global-search kbd {
    position: absolute;
    right: 10px;
    padding: 3px 7px;
    border: 1px solid var(--border);
    border-bottom-color: #c8d0dc;
    border-radius: 6px;
    background: #fff;
    color: #8994a6;
    font-family: inherit;
    font-size: 10px;
}

.topbar-actions {
    display: flex;
    margin-left: auto;
    align-items: center;
    gap: 9px;
}

.topbar-actions form {
    display: flex;
}

.icon-button {
    display: inline-flex;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #fff;
    color: #657187;
    transition: .16s ease;
}

.icon-button:hover {
    border-color: #cbd3df;
    background: #f8fafc;
    color: var(--text);
}

.menu-toggle {
    display: none;
}

.content {
    width: min(1640px, 100%);
    margin: 0 auto;
    padding: 34px;
}

.page-heading,
.record-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 26px;
}

.page-heading h1,
.record-heading h1 {
    margin-bottom: 5px;
    color: #172033;
    font-size: clamp(27px, 2.4vw, 36px);
    line-height: 1.12;
    letter-spacing: -.035em;
}

.page-heading p,
.record-heading p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 14px;
}

.eyebrow {
    display: block;
    margin-bottom: 8px;
    color: var(--primary);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.eyebrow.light {
    color: #9fe3c8;
}

.heading-count {
    color: #9aa6b8;
    font-size: .58em;
    font-weight: 600;
    vertical-align: middle;
}

.back-link {
    display: inline-block;
    margin-bottom: 12px;
    color: #748096;
    font-size: 13px;
    font-weight: 600;
}

.back-link:hover,
.text-link:hover {
    color: var(--primary);
}

.date-chip {
    padding: 9px 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    transition: transform .14s ease, box-shadow .14s ease, background .14s ease, border-color .14s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button-primary {
    background: linear-gradient(135deg, #1da678, #12845f);
    color: #fff;
    box-shadow: 0 8px 18px rgba(18, 132, 95, .2);
}

.button-primary:hover {
    background: linear-gradient(135deg, #188f69, #0e7152);
    box-shadow: 0 10px 24px rgba(15, 113, 82, .25);
}

.button-secondary {
    border-color: var(--border-strong);
    background: #fff;
    color: #445068;
}

.button-secondary:hover {
    border-color: #bcc6d6;
    box-shadow: var(--shadow-sm);
}

.button-ghost {
    border-color: transparent;
    background: transparent;
    color: #758197;
}

.button-ghost:hover {
    background: #edf1f6;
    color: #3f4b62;
}

.button-large {
    min-height: 49px;
    padding-inline: 20px;
}

.button-compact {
    min-height: 40px;
}

.button-full {
    width: 100%;
}

.panel {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 24px;
    border-bottom: 1px solid var(--border);
}

.panel-header h2 {
    margin-bottom: 3px;
    font-size: 16px;
    letter-spacing: -.015em;
}

.panel-header p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 12px;
}

.text-link {
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.metric-card {
    position: relative;
    display: grid;
    min-height: 154px;
    grid-template-columns: 46px 1fr;
    grid-template-rows: 1fr auto;
    gap: 12px;
    overflow: hidden;
    padding: 21px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.metric-card::after {
    position: absolute;
    top: -48px;
    right: -34px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: currentColor;
    content: "";
    opacity: .045;
}

.metric-icon {
    display: inline-flex;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: currentColor;
    color: inherit;
    font-size: 21px;
    box-shadow: inset 0 0 0 30px rgba(255, 255, 255, .88);
}

.metric-card > div:nth-child(2) {
    display: flex;
    flex-direction: column;
}

.metric-card span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.metric-card strong {
    margin-top: 3px;
    color: var(--text);
    font-size: 31px;
    line-height: 1.1;
    letter-spacing: -.04em;
}

.metric-card a {
    grid-column: 1 / -1;
    color: currentColor;
    font-size: 11px;
    font-weight: 700;
}

.metric-indigo { color: #168f6a; }
.metric-emerald { color: #2a9d74; }
.metric-amber { color: #d48b12; }
.metric-slate { color: #4f806e; }

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(300px, .75fr);
    gap: 22px;
}

.client-list {
    padding: 6px 14px 12px;
}

.client-row {
    display: grid;
    grid-template-columns: 42px minmax(180px, 1fr) auto 80px 18px;
    align-items: center;
    gap: 13px;
    min-height: 66px;
    padding: 10px;
    border-bottom: 1px solid #edf0f5;
    border-radius: 10px;
    transition: .15s ease;
}

.client-row:last-child {
    border-bottom: 0;
}

.client-row:hover {
    background: #f8fafc;
}

.company-avatar {
    display: inline-flex;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border: 1px solid #cfe9df;
    border-radius: 12px;
    background: linear-gradient(145deg, #f0faf6, #e3f4ed);
    color: #168f6a;
    font-size: 14px;
    font-weight: 800;
}

.company-avatar.small {
    width: 36px;
    height: 36px;
    border-radius: 10px;
}

.company-avatar-xl {
    width: 68px;
    height: 68px;
    border-radius: 18px;
    font-size: 24px;
}

.client-identicon {
    position: relative;
    overflow: hidden;
    color: hsl(var(--icon-hue) 52% 28%);
    background:
        radial-gradient(circle at 76% 22%, hsl(var(--icon-hue-secondary) 78% 78%) 0 18%, transparent 19%),
        linear-gradient(145deg, hsl(var(--icon-hue) 72% 92%), hsl(var(--icon-hue-secondary) 67% 78%));
    border-color: hsl(var(--icon-hue) 42% 75%);
}

.client-identicon::after {
    position: absolute;
    right: -8%;
    bottom: -24%;
    width: 65%;
    height: 65%;
    content: "";
    background: hsl(var(--icon-hue) 72% 46% / .18);
    border-radius: 45% 45% 12% 45%;
    transform: rotate(26deg);
}

.client-identicon i {
    position: relative;
    z-index: 1;
    font-style: normal;
    text-shadow: 0 1px 0 rgb(255 255 255 / .65);
}

.client-main,
.table-client > span:last-child,
.table-contact {
    min-width: 0;
}

.client-main strong,
.client-main small,
.table-client strong,
.table-client small,
.table-contact strong,
.table-contact small {
    display: block;
}

.client-main strong,
.table-client strong,
.table-contact strong {
    overflow: hidden;
    color: #243047;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.client-main small,
.table-client small,
.table-contact small {
    margin-top: 2px;
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.client-date {
    color: #8b96a7;
    font-size: 11px;
}

.row-arrow {
    color: #a3adbd;
    font-size: 20px;
}

.status {
    display: inline-flex;
    width: max-content;
    min-height: 25px;
    align-items: center;
    justify-content: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}

.status-green { background: var(--green-soft); color: #087a54; }
.status-blue { background: var(--blue-soft); color: #18735f; }
.status-amber { background: var(--amber-soft); color: #a66805; }
.status-slate { background: #eef2f7; color: #536176; }
.status-gray { background: #f0f2f5; color: #7b8492; }

.department-summary {
    padding: 10px 20px 20px;
}

.department-summary-row {
    display: flex;
    gap: 12px;
    padding: 13px 3px;
    border-bottom: 1px solid #edf0f5;
}

.department-summary-row:last-child {
    border-bottom: 0;
}

.department-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    flex: 0 0 auto;
    margin-top: 5px;
    border-radius: 50%;
    background: var(--department-color, #64748b);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--department-color, #64748b) 12%, transparent);
}

.department-dot.large {
    width: 12px;
    height: 12px;
}

.department-summary-main {
    min-width: 0;
    flex: 1;
}

.department-summary-main > span:first-child {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.department-summary-main strong {
    overflow: hidden;
    color: #354056;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.department-summary-main b {
    color: #5b667a;
    font-size: 12px;
}

.department-summary-main small {
    color: #8c97a9;
    font-size: 10px;
}

.progress {
    display: block;
    height: 4px;
    margin: 8px 0 4px;
    overflow: hidden;
    border-radius: 99px;
    background: #edf0f5;
}

.progress i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--department-color, var(--primary));
}

.filter-bar {
    display: flex;
    align-items: end;
    gap: 10px;
    margin-bottom: 16px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.filter-search {
    position: relative;
    display: flex;
    min-width: 260px;
    flex: 1;
    align-items: center;
}

.filter-search > span {
    position: absolute;
    left: 13px;
    color: #929dad;
    font-size: 19px;
}

.filter-search input,
.filter-select select {
    width: 100%;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f8fafc;
    outline: none;
    font-size: 12px;
}

.filter-search input {
    padding: 0 12px 0 38px;
}

.filter-select {
    min-width: 155px;
}

.filter-select > span {
    display: block;
    margin: 0 0 4px 2px;
    color: #8792a4;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.filter-select select {
    padding: 0 34px 0 11px;
}

.employee-filter {
    max-width: 660px;
}

.table-panel {
    overflow: hidden;
}

.client-table-settings {
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.client-table-settings > div {
    display: grid;
}

.client-table-settings strong {
    font-size: .9rem;
}

.client-table-settings > div > span {
    color: var(--muted);
    font-size: .78rem;
}

.client-table-settings > div > span.is-error {
    color: var(--red);
}

.data-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    height: 46px;
    padding: 10px 13px;
    border-bottom: 1px solid var(--border);
    background: #fafbfd;
    color: #7d889a;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .07em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

.data-table th:first-child,
.data-table td:first-child {
    padding-left: 20px;
}

.data-table th:last-child,
.data-table td:last-child {
    padding-right: 20px;
}

.data-table td {
    height: 68px;
    padding: 10px 13px;
    border-bottom: 1px solid #edf0f5;
    color: #4d596e;
    font-size: 12px;
    vertical-align: middle;
}

.data-table tbody tr {
    transition: .12s ease;
}

.data-table tbody tr:hover {
    background: #fafbfe;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.clients-table {
    width: var(--client-table-width, 1120px);
    min-width: max(100%, var(--client-table-width, 1120px));
    table-layout: fixed;
}

.clients-table .client-check-col,
.clients-table .client-actions-col {
    width: 50px;
}

.clients-table th[data-column] {
    position: relative;
}

.clients-table th[data-column] .sortable-heading {
    display: block;
    padding-right: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.clients-table td[data-column] {
    overflow: hidden;
}

.clients-table .table-client {
    min-width: 0;
}

.clients-table .table-client > span,
.clients-table .table-contact,
.clients-table .assignee {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.clients-table .table-client strong,
.clients-table .table-client small,
.clients-table .table-contact strong,
.clients-table .table-contact small,
.clients-table .assignee {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.clients-table .table-cell-clamp {
    min-width: 0;
    max-width: none;
}

button.column-resizer:not(:disabled) {
    position: absolute;
    z-index: 3;
    top: 3px;
    right: -8px;
    bottom: 3px;
    width: 16px;
    padding: 0;
    touch-action: none;
    cursor: col-resize;
    background: transparent;
    border: 0;
}

.column-resizer::after {
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 50%;
    width: 1px;
    content: '';
    background: #d8e0dd;
    border-radius: 2px;
    transform: translateX(-50%);
    transition: background-color .15s ease;
}

.column-resizer > .column-resizer-icon {
    position: absolute;
    z-index: 2;
    top: 50%;
    left: 50%;
    display: grid;
    width: 18px;
    height: 22px;
    place-items: center;
    color: #6f857c;
    background: transparent !important;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    opacity: 0;
    transform: translate(-50%, -50%);
    transition: opacity .14s ease, color .14s ease;
}

.column-resizer > .column-resizer-icon::before {
    content: '↔';
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.column-resizer:hover .column-resizer-icon,
.column-resizer:focus-visible .column-resizer-icon,
.column-resizer.is-active .column-resizer-icon {
    color: var(--primary);
    opacity: 1;
}

.column-resizer:hover::after,
.column-resizer:focus-visible::after,
.column-resizer.is-active::after {
    background: var(--primary);
}

.column-resizer:focus-visible {
    outline: 0;
}

html.is-resizing-column,
html.is-resizing-column * {
    cursor: col-resize !important;
    user-select: none !important;
}

.table-client {
    display: flex;
    min-width: 210px;
    align-items: center;
    gap: 10px;
}

.table-secondary {
    color: #566474 !important;
    white-space: nowrap;
}

.department-pill {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 7px;
    color: #536074;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.department-pill i,
.permission-department i {
    display: inline-block;
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--department-color, #64748b);
}

.assignee {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}

.avatar {
    display: inline-flex;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border: 1px solid #dce2f1;
    border-radius: 11px;
    background: linear-gradient(145deg, #f2f4fb, #e7ebf5);
    color: #52627e;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.avatar-xs {
    width: 27px;
    height: 27px;
    border-radius: 9px;
    font-size: 8px;
}

.avatar-large {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    font-size: 16px;
}

.avatar-xxl {
    width: 82px;
    height: 82px;
    border-radius: 23px;
    font-size: 24px;
}

.row-menu {
    display: inline-flex;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #8792a4;
    font-size: 18px;
}

.row-menu:hover {
    background: #eef2f7;
    color: #45526a;
}

.row-menu-danger:hover {
    color: #a63f35;
    background: #fff0ed;
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

.table-footer {
    display: flex;
    min-height: 58px;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 10px 20px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 11px;
}

.pagination {
    display: flex;
    gap: 5px;
}

.pagination a {
    display: inline-flex;
    width: 31px;
    height: 31px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: #667286;
    font-size: 11px;
    font-weight: 700;
}

.pagination a.is-current {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.empty-state {
    display: flex;
    min-height: 330px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 36px;
    color: var(--muted);
    text-align: center;
}

.empty-state.compact {
    min-height: 290px;
}

.empty-state > span {
    display: inline-flex;
    width: 58px;
    height: 58px;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    border-radius: 17px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 25px;
}

.empty-state h2,
.empty-state h3 {
    margin-bottom: 5px;
    color: var(--text);
    font-size: 18px;
}

.empty-state p {
    max-width: 380px;
    margin-bottom: 18px;
    font-size: 13px;
}

.departments-stack {
    display: grid;
    gap: 28px;
}

.department-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 13px;
}

.department-heading h2 {
    margin: 0;
    font-size: 16px;
}

.department-heading > span:last-child {
    display: inline-flex;
    min-width: 24px;
    height: 24px;
    align-items: center;
    justify-content: center;
    border-radius: 99px;
    background: #e9edf3;
    color: #68758a;
    font-size: 10px;
    font-weight: 800;
}

.employee-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.employee-card {
    position: relative;
    min-height: 230px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: #fff;
    box-shadow: var(--shadow-sm);
    transition: .18s ease;
}

.employee-card:hover {
    transform: translateY(-2px);
    border-color: #d5dcef;
    box-shadow: 0 14px 32px rgba(22, 34, 58, .07);
}

.employee-top {
    position: relative;
    display: flex;
    align-items: flex-start;
    margin-bottom: 14px;
}

.status-dot {
    position: absolute;
    bottom: 1px;
    left: 42px;
    width: 11px;
    height: 11px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #aab3c0;
}

.status-dot.online {
    background: #19ad7a;
}

.card-action {
    margin-left: auto;
    padding: 5px 4px;
    color: #9aa4b3;
    letter-spacing: 1px;
}

.employee-card h3 {
    margin-bottom: 3px;
    overflow: hidden;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.employee-card > p {
    min-height: 21px;
    margin-bottom: 14px;
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.employee-contacts {
    display: grid;
    gap: 5px;
    margin-bottom: 17px;
}

.employee-contacts a {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 7px;
    overflow: hidden;
    color: #647087;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.company-communications {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: .75rem;
}

.communication-item {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    padding: .7rem .85rem;
    border: 1px solid var(--border-color, #dbe5df);
    border-radius: .75rem;
    background: #f7fbf8;
}

.communication-item small {
    color: var(--text-muted, #66756d);
}

.company-communications-editor {
    gap: .65rem;
}

.communication-editor-list {
    display: grid;
    gap: .6rem;
}

.communication-editor-row {
    display: grid;
    grid-template-columns: 125px minmax(180px, 1fr) minmax(180px, 1fr) 40px;
    gap: .55rem;
    align-items: center;
}

@media (max-width: 760px) {
    .communication-editor-row {
        grid-template-columns: 110px 1fr 40px;
    }

    .communication-editor-row input[name="communication_label[]"] {
        grid-column: 1 / -1;
        grid-row: 2;
    }
}

.employee-contacts a:hover {
    color: var(--primary);
}

.employee-contacts span {
    width: 14px;
    color: #9aa5b7;
}

.role-chip,
.mini-tag {
    display: inline-flex;
    width: max-content;
    align-items: center;
    padding: 4px 8px;
    border: 1px solid #e0e5f4;
    border-radius: 7px;
    background: #f4f6fb;
    color: #68748a;
    font-size: 9px;
    font-weight: 700;
}

.record-form {
    width: 100%;
}

.form-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 270px;
    align-items: start;
    gap: 20px;
}

.form-main {
    display: grid;
    gap: 17px;
}

.form-section {
    padding: 25px;
}

.section-heading {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    margin-bottom: 22px;
}

.section-number {
    display: inline-flex;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 10px;
    font-weight: 800;
}

.section-heading h2 {
    margin: 1px 0 3px;
    font-size: 16px;
}

.section-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.compact-grid {
    gap: 11px;
}

.field {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 6px;
}

.field > span:first-child {
    color: #536075;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .025em;
}

.field > span b {
    color: var(--red);
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 43px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: #fff;
    outline: none;
    color: #263248;
    font-size: 12px;
    transition: .15s ease;
}

.field input,
.field select {
    padding: 0 12px;
}

.field textarea {
    min-height: 76px;
    padding: 10px 12px;
    resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder {
    color: #657182;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: #79b9a1;
    box-shadow: 0 0 0 4px rgba(22, 143, 106, .1);
}

.field.has-error input,
.field.has-error select,
.field.has-error textarea {
    border-color: #e58b98;
    box-shadow: 0 0 0 3px rgba(217, 75, 96, .07);
}

.field-span-2 {
    grid-column: 1 / -1;
}

.field-hint,
.field-error {
    font-size: 9px;
}

.field-hint {
    color: #8b96a8;
}

.field-error {
    color: var(--red);
    font-weight: 700;
}

.password-control {
    position: relative;
    display: block;
}

.password-control input {
    padding-right: 78px;
}

.password-control button {
    position: absolute;
    top: 50%;
    right: 7px;
    padding: 5px 7px;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--primary);
    font-size: 9px;
    font-weight: 800;
}

.check-card {
    display: flex;
    min-height: 60px;
    align-items: center;
    gap: 11px;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #fafbfd;
}

.check-card input,
.simple-check input {
    width: 17px;
    height: 17px;
    accent-color: var(--primary);
}

.check-card strong,
.check-card small {
    display: block;
}

.check-card strong {
    color: #455168;
    font-size: 11px;
}

.check-card small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 9px;
}

.compact-check {
    align-self: end;
}

.form-sidebar {
    min-width: 0;
}

.sticky-actions {
    position: sticky;
    top: 103px;
    padding: 21px;
}

.sticky-actions h3 {
    margin-bottom: 5px;
    font-size: 15px;
}

.sticky-actions p {
    margin-bottom: 18px;
    color: var(--muted);
    font-size: 11px;
}

.sticky-actions .button + .button {
    margin-top: 7px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 21px;
}

.form-divider {
    height: 1px;
    margin: 27px 0;
    border: 0;
    background: var(--border);
}

.alert {
    padding: 13px 15px;
    border: 1px solid;
    border-radius: 11px;
    font-size: 12px;
}

.alert p {
    margin: 0;
}

.alert-error {
    border-color: #f1c7ce;
    background: var(--red-soft);
    color: #a92f43;
}

.form-alert {
    margin-bottom: 17px;
}

.form-alert strong {
    display: block;
    margin-bottom: 3px;
}

.form-stack {
    display: grid;
    gap: 15px;
}

.record-heading {
    align-items: center;
}

.record-title-row {
    display: flex;
    align-items: center;
    gap: 17px;
}

.record-number {
    color: #7d899b;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .07em;
}

.record-title h1 {
    margin: 2px 0 8px;
}

.record-meta,
.record-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 315px;
    align-items: start;
    gap: 20px;
}

.detail-main,
.detail-sidebar {
    display: grid;
    gap: 17px;
}

.detail-section .panel-header {
    padding: 20px 23px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px 28px;
    margin: 0;
    padding: 23px;
}

.detail-grid > div {
    min-width: 0;
}

.detail-grid dt,
.side-dates dt {
    margin-bottom: 5px;
    color: #8b96a8;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.detail-grid dd,
.side-dates dd {
    margin: 0;
    color: #37445a;
    font-size: 12px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.detail-grid dd a {
    color: var(--primary);
}

.detail-span-2 {
    grid-column: 1 / -1;
}

.contact-person {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 23px;
}

.contact-person-main {
    min-width: 0;
    flex: 1;
}

.contact-person h3 {
    margin-bottom: 2px;
    font-size: 14px;
}

.contact-person p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 11px;
}

.contact-person-links {
    display: grid;
    gap: 5px;
}

.contact-person-links a {
    color: var(--primary);
    font-size: 11px;
    font-weight: 600;
}

.inline-empty,
.notes-content {
    padding: 23px;
    color: var(--muted);
    font-size: 12px;
}

.notes-content {
    color: #4d596e;
    line-height: 1.75;
}

.notes-content span {
    color: var(--muted);
}

.detail-side-card {
    padding: 21px;
}

.detail-side-card h3 {
    margin-bottom: 15px;
    font-size: 13px;
}

.side-person {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    padding-bottom: 17px;
    border-bottom: 1px solid var(--border);
}

.side-person strong,
.side-person small {
    display: block;
}

.side-person strong {
    font-size: 11px;
}

.side-person small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 9px;
}

.side-dates {
    display: grid;
    gap: 13px;
    margin: 0;
}

.side-dates > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.side-dates dt {
    margin: 0;
}

.side-dates dd {
    text-align: right;
    font-size: 10px;
}

.timeline {
    display: grid;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.timeline li {
    position: relative;
    display: flex;
    gap: 11px;
    min-height: 52px;
}

.timeline li::before {
    position: absolute;
    top: 12px;
    bottom: -3px;
    left: 4px;
    width: 1px;
    background: #e1e6ee;
    content: "";
}

.timeline li:last-child::before {
    display: none;
}

.timeline i {
    position: relative;
    z-index: 1;
    width: 9px;
    height: 9px;
    flex: 0 0 auto;
    margin-top: 4px;
    border: 2px solid #9bd2bd;
    border-radius: 50%;
    background: #fff;
}

.timeline strong,
.timeline span {
    display: block;
}

.timeline strong {
    color: #526076;
    font-size: 10px;
}

.timeline span {
    margin-top: 3px;
    color: #929cad;
    font-size: 8px;
}

.muted {
    color: var(--muted) !important;
}

.profile-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 760px);
    align-items: start;
    gap: 20px;
}

.profile-summary {
    padding: 28px;
    text-align: center;
}

.profile-summary .avatar {
    margin-bottom: 15px;
}

.profile-summary h2 {
    margin-bottom: 4px;
    font-size: 17px;
}

.profile-summary > p {
    margin-bottom: 11px;
    color: var(--muted);
    font-size: 11px;
}

.profile-summary dl {
    display: grid;
    gap: 12px;
    margin: 23px 0 0;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    text-align: left;
}

.profile-summary dl > div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.profile-summary dt {
    color: var(--muted);
    font-size: 10px;
}

.profile-summary dd {
    margin: 0;
    color: #49566d;
    font-size: 10px;
    font-weight: 700;
    text-align: right;
}

.permission-matrix {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.permission-row {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) 100px 100px;
    min-height: 52px;
    align-items: center;
    padding: 7px 15px;
    border-bottom: 1px solid var(--border);
}

.permission-row:last-child {
    border-bottom: 0;
}

.permission-head {
    min-height: 39px;
    background: #f8fafc;
    color: #8792a4;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.permission-head span:not(:first-child),
.permission-row > label {
    justify-self: center;
}

.permission-department {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #465268;
    font-size: 11px;
    font-weight: 700;
}

.switch-check {
    position: relative;
    display: inline-flex;
}

.switch-check input {
    position: absolute;
    opacity: 0;
}

.switch-check span {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    border-radius: 99px;
    background: #dce2ea;
    transition: .18s ease;
}

.switch-check span::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
    content: "";
    transition: .18s ease;
}

.switch-check input:checked + span {
    background: var(--primary);
}

.switch-check input:checked + span::after {
    transform: translateX(16px);
}

.admin-role-note {
    display: none;
    margin-top: 12px;
    padding: 11px 13px;
    border-radius: 10px;
    background: var(--primary-soft);
    color: #176f55;
    font-size: 10px;
    font-weight: 600;
}

[data-permissions-section].is-admin-role .permission-matrix {
    opacity: .35;
    pointer-events: none;
}

[data-permissions-section].is-admin-role .admin-role-note {
    display: block;
}

.admin-split {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    align-items: start;
    gap: 20px;
}

.admin-create-card {
    position: sticky;
    top: 103px;
}

.department-admin-list,
.field-admin-list {
    display: grid;
    gap: 10px;
}

.admin-accordion {
    overflow: hidden;
}

.admin-accordion summary {
    display: flex;
    min-height: 74px;
    align-items: center;
    gap: 13px;
    padding: 14px 18px;
    list-style: none;
    cursor: pointer;
}

.admin-accordion summary::-webkit-details-marker {
    display: none;
}

.admin-accordion[open] summary {
    border-bottom: 1px solid var(--border);
    background: #fbfcfe;
}

.admin-accordion.is-disabled {
    opacity: .72;
}

.accordion-main {
    min-width: 0;
    flex: 1;
}

.accordion-main strong,
.accordion-main small {
    display: block;
}

.accordion-main strong {
    color: #344057;
    font-size: 13px;
}

.accordion-main small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
}

.accordion-arrow {
    color: #8c97a8;
    font-size: 16px;
    transition: transform .18s ease;
}

.admin-accordion[open] .accordion-arrow {
    transform: rotate(180deg);
}

.accordion-form {
    padding: 19px;
}

.accordion-form > .button {
    margin-top: 16px;
}

.delete-related-form {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 19px 19px;
    border-top: 1px solid #f0d7d3;
    background: #fffaf9;
}

.delete-related-form > .field {
    width: min(520px, 100%);
}

.delete-related-form > div {
    display: grid;
    gap: 3px;
}

.delete-related-form > div small {
    color: var(--muted);
}

.danger-zone {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 20px;
    padding: 20px 22px;
    border-color: #f0cbc6;
    background: #fffaf9;
}

.danger-zone h2,
.danger-zone p {
    margin: 0;
}

.danger-zone h2 {
    margin-bottom: 4px;
    font-size: 1rem;
}

.danger-zone p {
    color: var(--muted);
}

.color-input {
    padding: 5px !important;
}

.checks-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.simple-check {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #58657a;
    font-size: 10px;
    font-weight: 700;
}

.field-type-icon {
    display: inline-flex;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 13px;
    font-weight: 800;
}

.toast-stack {
    position: fixed;
    top: 96px;
    right: 25px;
    z-index: 80;
    display: grid;
    width: min(370px, calc(100vw - 30px));
    gap: 8px;
}

.toast {
    display: grid;
    grid-template-columns: 28px 1fr 25px;
    align-items: center;
    gap: 9px;
    padding: 12px 13px;
    border: 1px solid;
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--shadow-md);
    animation: toast-in .24s ease both;
}

.toast > span {
    display: inline-flex;
    width: 27px;
    height: 27px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 800;
}

.toast p {
    margin: 0;
    font-size: 11px;
    font-weight: 600;
}

.toast button {
    border: 0;
    background: transparent;
    color: #929cab;
    font-size: 17px;
}

.toast-success {
    border-color: #c9eadf;
    color: #177456;
}

.toast-success > span {
    background: var(--green-soft);
}

.toast-error {
    border-color: #f1c7ce;
    color: #a92f43;
}

.toast-error > span {
    background: var(--red-soft);
}

.toast.is-hiding {
    animation: toast-out .22s ease both;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-8px) translateX(8px); }
}

@keyframes toast-out {
    to { opacity: 0; transform: translateY(-6px) translateX(15px); }
}

.error-page {
    display: flex;
    min-height: calc(100vh - 150px);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 30px;
    text-align: center;
}

.error-code {
    color: var(--primary);
    font-size: 74px;
    font-weight: 800;
    letter-spacing: -.08em;
}

.error-page h1 {
    margin-bottom: 7px;
    font-size: 25px;
}

.error-page p {
    max-width: 460px;
    margin-bottom: 22px;
    color: var(--muted);
}

.auth-body {
    overflow-x: hidden;
    background: #f4f6fb;
}

.auth-shell {
    min-height: 100vh;
}

.login-layout {
    display: grid;
    min-height: 100vh;
    grid-template-columns: minmax(420px, .95fr) minmax(480px, 1.05fr);
}

.login-story {
    position: relative;
    display: flex;
    min-height: 100vh;
    justify-content: space-between;
    flex-direction: column;
    overflow: hidden;
    padding: 46px clamp(38px, 5vw, 80px);
    background:
        radial-gradient(circle at 78% 18%, rgba(54, 190, 143, .27), transparent 28%),
        radial-gradient(circle at 12% 78%, rgba(98, 205, 167, .15), transparent 25%),
        linear-gradient(150deg, #102b24 0%, #163d32 52%, #0c211b 100%);
    color: #fff;
}

.login-story::before,
.login-story::after {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 50%;
    content: "";
}

.login-story::before {
    top: 18%;
    right: -170px;
    width: 480px;
    height: 480px;
}

.login-story::after {
    top: 27%;
    right: -65px;
    width: 260px;
    height: 260px;
}

.story-brand {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 13px;
    font-size: 17px;
    font-weight: 800;
}

.story-content {
    position: relative;
    z-index: 1;
    max-width: 590px;
}

.story-content h1 {
    max-width: 560px;
    margin-bottom: 20px;
    font-size: clamp(38px, 4.3vw, 64px);
    line-height: 1.05;
    letter-spacing: -.055em;
}

.story-content p {
    max-width: 490px;
    margin-bottom: 0;
    color: #9eabc1;
    font-size: 15px;
    line-height: 1.75;
}

.story-stats {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 45px;
}

.story-stats > div {
    display: flex;
    flex-direction: column;
}

.story-stats strong {
    color: #fff;
    font-size: 20px;
}

.story-stats span {
    color: #7f8da7;
    font-size: 10px;
}

.login-panel {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 45px;
}

.login-card {
    width: min(420px, 100%);
}

.login-card h2 {
    margin-bottom: 7px;
    font-size: 32px;
    letter-spacing: -.04em;
}

.login-card > .muted {
    margin-bottom: 28px;
    font-size: 13px;
}

.login-card .alert {
    margin-bottom: 18px;
}

.login-card .field > span:first-child {
    font-size: 11px;
}

.login-card .field input {
    min-height: 49px;
    border-radius: 11px;
    background: #fff;
    font-size: 13px;
}

.login-help {
    margin: 22px 0 0;
    color: #929cad;
    font-size: 10px;
    text-align: center;
}

.mobile-login-brand {
    display: none;
}

.sidebar-overlay {
    display: none;
}

/* Typography scale v2 */
body {
    font-size: 17px;
    line-height: 1.62;
}

/* Bootstrap theme alignment */
.btn-primary {
    --bs-btn-bg: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary-hover);
    --bs-btn-hover-border-color: var(--primary-hover);
    --bs-btn-active-bg: #0b684c;
    --bs-btn-active-border-color: #0b684c;
    --bs-btn-disabled-bg: var(--primary);
    --bs-btn-disabled-border-color: var(--primary);
}

.form-control:focus,
.form-select:focus {
    border-color: #79b9a1;
    box-shadow: 0 0 0 .25rem rgba(22, 143, 106, .14);
}

.form-check-input:focus {
    border-color: #79b9a1;
    box-shadow: 0 0 0 .25rem rgba(22, 143, 106, .14);
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.text-primary,
.link-primary {
    color: var(--primary) !important;
}

.brand strong {
    font-size: 18px;
}

.brand small {
    font-size: 12px;
}

.brand-mark {
    font-size: 14px;
}

.nav-link {
    font-size: 15px;
}

.nav-section-label {
    font-size: 11px;
}

.profile-copy strong {
    font-size: 14px;
}

.profile-copy small {
    font-size: 12px;
}

.global-search input {
    font-size: 14px;
}

.global-search kbd {
    font-size: 11px;
}

.page-heading p,
.record-heading p {
    font-size: 16px;
}

.eyebrow {
    font-size: 12px;
}

.back-link {
    font-size: 14px;
}

.date-chip {
    font-size: 13px;
}

.button {
    font-size: 14px;
}

.panel-header h2 {
    font-size: 18px;
}

.panel-header p,
.text-link {
    font-size: 14px;
}

.metric-card span {
    font-size: 14px;
}

.metric-card strong {
    font-size: 34px;
}

.metric-card a {
    font-size: 13px;
}

.client-main strong,
.table-client strong,
.table-contact strong {
    font-size: 15px;
}

.client-main small,
.table-client small,
.table-contact small {
    font-size: 13px;
}

.client-date,
.department-pill,
.assignee {
    font-size: 13px;
}

.status {
    min-height: 28px;
    padding-inline: 11px;
    font-size: 12px;
}

.department-summary-main strong,
.department-summary-main b {
    font-size: 14px;
}

.department-summary-main small {
    font-size: 12px;
}

.filter-search input,
.filter-select select {
    height: 46px;
    font-size: 14px;
}

.filter-select > span {
    font-size: 11px;
}

.data-table th {
    font-size: 11px;
}

.data-table td {
    height: 74px;
    font-size: 14px;
}

.table-footer,
.pagination a {
    font-size: 13px;
}

.empty-state h2,
.empty-state h3 {
    font-size: 20px;
}

.empty-state p {
    font-size: 15px;
}

.department-heading h2 {
    font-size: 18px;
}

.department-heading > span:last-child {
    font-size: 12px;
}

.employee-card h3 {
    font-size: 16px;
}

.employee-card > p {
    font-size: 13px;
}

.employee-contacts a {
    font-size: 12px;
}

.role-chip,
.mini-tag {
    font-size: 11px;
}

.section-number {
    font-size: 12px;
}

.section-heading h2 {
    font-size: 18px;
}

.section-heading p {
    font-size: 13px;
}

.field > span:first-child {
    font-size: 13px;
}

.field input,
.field select {
    min-height: 47px;
    font-size: 15px;
}

.field textarea {
    font-size: 15px;
}

.field-hint,
.field-error {
    font-size: 12px;
}

.password-control button {
    font-size: 11px;
}

.check-card strong {
    font-size: 13px;
}

.check-card small {
    font-size: 11px;
}

.sticky-actions h3 {
    font-size: 17px;
}

.sticky-actions p {
    font-size: 13px;
}

.detail-grid dt,
.side-dates dt {
    font-size: 11px;
}

.detail-grid dd,
.side-dates dd {
    font-size: 14px;
}

.contact-person h3 {
    font-size: 16px;
}

.contact-person p,
.contact-person-links a,
.inline-empty,
.notes-content {
    font-size: 14px;
}

.detail-side-card h3 {
    font-size: 15px;
}

.side-person strong {
    font-size: 13px;
}

.side-person small,
.side-dates dd {
    font-size: 11px;
}

.timeline strong {
    font-size: 12px;
}

.timeline span {
    font-size: 10px;
}

.profile-summary h2 {
    font-size: 19px;
}

.profile-summary > p {
    font-size: 13px;
}

.profile-summary dt,
.profile-summary dd {
    font-size: 12px;
}

.permission-head {
    font-size: 11px;
}

.permission-department {
    font-size: 13px;
}

.admin-role-note {
    font-size: 12px;
}

.accordion-main strong {
    font-size: 15px;
}

.accordion-main small,
.simple-check {
    font-size: 12px;
}

.toast p {
    font-size: 13px;
}

.login-card > .muted,
.login-card .field input {
    font-size: 15px;
}

.login-card .field > span:first-child {
    font-size: 13px;
}

.login-help {
    font-size: 12px;
}

@media (max-width: 1360px) {
    .employee-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .form-grid-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1180px) {
    :root {
        --sidebar-width: 234px;
    }

    .content,
    .topbar {
        padding-right: 24px;
        padding-left: 24px;
    }

    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .employee-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-layout,
    .detail-layout {
        grid-template-columns: minmax(0, 1fr) 240px;
    }

    .admin-split {
        grid-template-columns: 300px minmax(0, 1fr);
    }
}

@media (max-width: 960px) {
    .sidebar {
        width: 268px;
        transform: translateX(-100%);
        box-shadow: 18px 0 55px rgba(5, 12, 25, .22);
        transition: transform .22s ease;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        z-index: 35;
        display: block;
        visibility: hidden;
        background: rgba(8, 15, 29, .44);
        opacity: 0;
        transition: .22s ease;
    }

    .sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-open .sidebar-overlay {
        visibility: visible;
        opacity: 1;
    }

    .workspace {
        margin-left: 0;
    }

    .menu-toggle {
        display: inline-flex;
    }

    .topbar {
        min-height: 72px;
    }

    .form-layout,
    .detail-layout,
    .profile-layout,
    .admin-split {
        grid-template-columns: 1fr;
    }

    .form-sidebar {
        order: -1;
    }

    .sticky-actions,
    .admin-create-card {
        position: static;
    }

    .sticky-actions {
        display: grid;
        grid-template-columns: 1fr auto auto;
        align-items: center;
        gap: 10px;
    }

    .sticky-actions h3 {
        margin: 0;
    }

    .sticky-actions p {
        display: none;
    }

    .sticky-actions .button {
        width: auto;
        margin: 0 !important;
    }

    .profile-layout {
        max-width: 780px;
    }

    .login-layout {
        grid-template-columns: 1fr;
    }

    .login-story {
        display: none;
    }

    .login-panel {
        padding: 28px;
    }

    .mobile-login-brand {
        display: flex;
        align-items: center;
        gap: 11px;
        margin-bottom: 48px;
    }
}

@media (max-width: 720px) {
    .topbar {
        gap: 9px;
        padding: 0 15px;
    }

    .global-search {
        width: auto;
        flex: 1;
    }

    .global-search kbd {
        display: none;
    }

    .global-search input {
        padding-right: 12px;
    }

    .topbar-actions .button {
        width: 42px;
        padding: 0;
        font-size: 0;
    }

    .topbar-actions .button span {
        font-size: 18px;
    }

    .content {
        padding: 24px 15px;
    }

    .page-heading,
    .record-heading {
        align-items: flex-start;
        flex-direction: column;
        margin-bottom: 21px;
    }

    .page-heading > .button {
        width: 100%;
    }

    .metric-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .metric-card {
        min-height: 139px;
        grid-template-columns: 38px 1fr;
        padding: 15px;
    }

    .metric-icon {
        width: 37px;
        height: 37px;
        border-radius: 10px;
        font-size: 18px;
    }

    .metric-card strong {
        font-size: 25px;
    }

    .client-row {
        grid-template-columns: 38px 1fr auto;
    }

    .client-row .status,
    .client-date {
        display: none;
    }

    .filter-bar {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .filter-search {
        grid-column: 1 / -1;
        min-width: 0;
    }

    .filter-select {
        min-width: 0;
    }

    .employee-filter {
        grid-template-columns: 1fr auto;
    }

    .employee-grid {
        grid-template-columns: 1fr;
    }

    .form-section {
        padding: 19px;
    }

    .form-grid,
    .form-grid-3 {
        grid-template-columns: 1fr;
    }

    .field-span-2 {
        grid-column: auto;
    }

    .sticky-actions {
        grid-template-columns: 1fr;
    }

    .sticky-actions h3 {
        margin-bottom: 4px;
    }

    .sticky-actions .button {
        width: 100%;
    }

    .record-title-row {
        align-items: flex-start;
    }

    .company-avatar-xl {
        width: 52px;
        height: 52px;
        border-radius: 14px;
        font-size: 18px;
    }

    .record-actions {
        width: 100%;
    }

    .record-actions .button {
        flex: 1;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-span-2 {
        grid-column: auto;
    }

    .contact-person {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .contact-person-links {
        width: 100%;
        padding-left: 68px;
    }

    .permission-row {
        grid-template-columns: minmax(130px, 1fr) 70px 70px;
        padding-inline: 11px;
    }

    .admin-accordion summary {
        flex-wrap: wrap;
    }

    .admin-accordion summary .status {
        margin-left: 51px;
    }

    .mini-tag {
        display: none;
    }

    .toast-stack {
        top: 82px;
        right: 15px;
    }
}

@media (max-width: 460px) {
    .metric-grid {
        grid-template-columns: 1fr;
    }

    .metric-card {
        min-height: 120px;
    }

    .filter-bar {
        grid-template-columns: 1fr;
    }

    .filter-search {
        grid-column: auto;
    }

    .filter-bar .button {
        width: 100%;
    }

    .table-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .login-panel {
        align-items: flex-start;
        padding: 24px 18px;
    }

    .login-card {
        padding-top: 24px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* Client workspace */
[hidden] {
    display: none !important;
}

mark {
    padding: 0 .08em;
    color: inherit;
    background: #c9f3df;
    border-radius: 3px;
}

.filters-panel {
    margin-bottom: 18px;
    padding: 18px;
    overflow: visible;
}

.filters-panel .filter-bar {
    margin: 0;
}

.advanced-filters {
    margin-top: 14px;
    border-top: 1px solid var(--border);
}

.advanced-filters > summary {
    display: flex;
    gap: 8px;
    align-items: center;
    width: max-content;
    padding-top: 14px;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

.advanced-filters > summary::-webkit-details-marker,
.columns-picker > summary::-webkit-details-marker {
    display: none;
}

.advanced-filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(170px, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.filter-extras {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 16px;
}

.columns-picker {
    position: relative;
}

.columns-popover {
    position: absolute;
    z-index: 25;
    top: calc(100% + 8px);
    left: 0;
    display: grid;
    gap: 8px;
    min-width: 280px;
    max-height: 360px;
    padding: 16px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
}

.columns-popover label {
    display: flex;
    gap: 9px;
    align-items: center;
    cursor: pointer;
}

.button-count {
    display: inline-grid;
    min-width: 23px;
    height: 23px;
    margin-left: 4px;
    padding: 0 6px;
    place-items: center;
    color: var(--primary);
    font-size: .75rem;
    font-weight: 800;
    background: var(--primary-soft);
    border-radius: 999px;
}

.columns-settings-modal .modal-content {
    overflow: hidden;
    color: var(--text);
    background: var(--surface);
    border: 0;
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
}

.columns-settings-modal .modal-header {
    align-items: flex-start;
    padding: 20px 22px 16px;
    border-color: var(--border);
}

.columns-settings-modal .modal-header > div {
    display: grid;
    gap: 3px;
}

.columns-settings-modal .modal-title {
    font-size: 1.35rem;
}

.columns-settings-modal .modal-header p {
    margin: 0;
    color: var(--muted);
    font-size: .9rem;
}

.columns-settings-modal .modal-body {
    padding: 0;
}

.columns-settings-modal .modal-footer {
    padding: 14px 20px;
    border-color: var(--border);
}

.columns-configurator {
    display: grid;
    grid-template-columns: minmax(300px, .9fr) minmax(340px, 1.1fr);
    min-height: min(610px, 68vh);
}

.columns-config-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
}

.columns-config-panel + .columns-config-panel {
    border-left: 1px solid var(--border);
}

.columns-config-panel > header {
    display: grid;
    gap: 10px;
    padding: 15px 18px;
    background: var(--surface-soft);
    border-bottom: 1px solid var(--border);
}

.columns-config-panel > header > div {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
}

.columns-config-panel h3 {
    margin: 0;
    font-size: 1rem;
}

.columns-config-panel > header > div > span {
    display: inline-grid;
    min-width: 26px;
    height: 26px;
    place-items: center;
    color: var(--primary);
    font-size: .78rem;
    font-weight: 800;
    background: var(--primary-soft);
    border-radius: 999px;
}

.columns-config-panel > header p {
    margin: 0;
    color: var(--muted);
    font-size: .82rem;
}

.available-columns-list,
.selected-columns-list {
    overflow: auto;
    min-height: 0;
    padding: 14px;
}

.column-option-group + .column-option-group {
    margin-top: 15px;
}

.column-option-group h4 {
    margin: 0 0 6px;
    padding: 0 5px;
    color: var(--muted);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .055em;
    text-transform: uppercase;
}

.column-option {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 9px 10px;
    text-align: left;
    color: var(--text);
    background: transparent;
    border: 0;
    border-radius: 9px;
}

.column-option:hover {
    color: var(--primary-hover);
    background: var(--primary-soft);
}

.column-option.is-selected {
    color: var(--text);
    background: var(--primary-soft);
}

.column-option > span,
.selected-column-item > span:nth-child(2) {
    display: grid;
    min-width: 0;
}

.column-option strong,
.selected-column-item strong {
    overflow: hidden;
    font-size: .88rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.column-option small,
.selected-column-item small {
    color: var(--muted);
    font-size: .72rem;
}

.column-option b {
    display: inline-grid;
    width: 25px;
    height: 25px;
    flex: 0 0 auto;
    place-items: center;
    color: var(--primary);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 7px;
}

.column-option.is-selected b {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}

.selected-columns-list {
    position: relative;
    display: grid;
    align-content: start;
    gap: 7px;
    background: linear-gradient(180deg, rgb(244 248 246 / .45), transparent 80px);
}

.selected-columns-list.is-empty::before {
    content: attr(data-empty-text);
    display: grid;
    min-height: 180px;
    place-items: center;
    color: var(--muted);
    text-align: center;
    border: 2px dashed var(--border);
    border-radius: 13px;
}

.selected-column-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 11px;
    cursor: grab;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease, opacity .15s ease;
}

.selected-column-item:hover {
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
    box-shadow: var(--shadow-sm);
}

.selected-column-item.is-dragging {
    border-color: var(--primary);
    opacity: .4;
    transform: scale(.985);
}

.column-drag-handle {
    display: inline-grid;
    width: 28px;
    height: 34px;
    place-items: center;
    color: var(--primary);
    font-weight: 800;
    letter-spacing: -3px;
    background: var(--primary-soft);
    border-radius: 8px;
}

.selected-column-actions {
    display: inline-flex;
    gap: 3px;
}

.selected-column-actions button {
    display: inline-grid;
    width: 27px;
    height: 27px;
    padding: 0;
    place-items: center;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-radius: 7px;
}

.selected-column-actions button:hover {
    color: var(--primary);
    background: var(--primary-soft);
}

.selected-column-actions [data-column-remove]:hover {
    color: var(--red);
    background: var(--red-soft);
}

.table-cell-clamp {
    display: -webkit-box;
    overflow: hidden;
    min-width: 100px;
    max-width: 280px;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.saved-views-panel {
    position: relative;
    display: grid;
    gap: 12px;
    margin: -6px 0 16px;
    padding: 15px 17px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
}

.saved-views-heading {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    justify-content: space-between;
}

.saved-views-heading > div:first-child {
    display: grid;
    gap: 2px;
}

.saved-views-heading strong {
    color: var(--text);
    font-size: .95rem;
}

.saved-views-heading small,
.saved-view-manager-header small {
    color: var(--muted);
    font-size: .78rem;
}

.saved-view-pills {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.saved-view {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    overflow: hidden;
    background: #f1f5f3;
    border: 1px solid transparent;
    border-radius: 999px;
    transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.saved-view:hover {
    border-color: #c9ded5;
    background: #edf8f3;
}

.saved-view.is-active {
    background: var(--primary-soft);
    border-color: #aad8c7;
    box-shadow: inset 0 0 0 1px rgba(18, 132, 95, .05);
}

.saved-view > a {
    color: #42534d;
    font-size: .84rem;
    font-weight: 700;
}

.saved-view-name,
.saved-view-all {
    padding: 7px 12px;
}

.saved-view.is-active > a {
    color: var(--primary-hover);
}

.saved-view-clear {
    display: inline-grid;
    width: 30px;
    height: 30px;
    margin-right: 3px;
    padding: 0;
    place-items: center;
    border-radius: 50%;
    font-size: 1.1rem !important;
    line-height: 1;
}

.saved-view-clear:hover {
    background: rgba(18, 132, 95, .12);
}

.saved-views-management {
    position: relative;
}

.saved-views-management > summary,
.smart-list-management > summary {
    display: inline-flex;
    gap: 7px;
    align-items: center;
    color: var(--primary-hover);
    font-size: .82rem;
    font-weight: 750;
    cursor: pointer;
    list-style: none;
}

.saved-views-management > summary::-webkit-details-marker,
.smart-list-management > summary::-webkit-details-marker {
    display: none;
}

.saved-views-management > summary b,
.smart-list-management > summary b {
    display: inline-grid;
    min-width: 23px;
    height: 23px;
    padding: 0 6px;
    place-items: center;
    background: var(--primary-soft);
    border-radius: 999px;
    font-size: .72rem;
}

.saved-view-manager-menu {
    position: absolute;
    z-index: 70;
    top: calc(100% + 10px);
    right: 0;
    width: min(520px, calc(100vw - 64px));
    padding: 10px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 18px 42px rgba(25, 50, 42, .18);
}

.saved-view-manager-header,
.smart-list-management-intro {
    display: grid;
    gap: 2px;
    padding: 5px 7px 10px;
}

.saved-view-manager-row,
.smart-list-management-row {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    min-height: 54px;
    padding: 7px;
    border-top: 1px solid #edf2ef;
}

.saved-view-manager-row > span,
.smart-list-management-row > span {
    min-width: 0;
    overflow: hidden;
    font-size: .86rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.saved-view-manager-row > div,
.smart-list-management-row > div {
    display: flex;
    gap: 5px;
    align-items: center;
    flex: 0 0 auto;
}

.saved-view-manager-row form,
.smart-list-management-row form {
    display: inline-flex;
    margin: 0;
}

.active-list-rules {
    display: grid;
    gap: 7px;
    padding: 11px 12px;
    background: #f6faf8;
    border: 1px solid #dbeae4;
    border-radius: 11px;
}

.active-list-rules > strong {
    color: var(--primary-hover);
    font-size: .78rem;
}

.active-list-rules > div {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.active-list-rules span {
    padding: 5px 8px;
    color: #4d5f58;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: .74rem;
}

.active-list-rules span b {
    margin-right: 3px;
    color: var(--primary);
    font-size: .66rem;
}

.button-danger {
    color: #a63f35;
    background: #fff4f2;
    border-color: #f0cbc6;
}

.button-danger:hover {
    color: #8f2f27;
    background: #ffe9e6;
    border-color: #eab8b1;
}

.search-suggestions {
    position: absolute;
    z-index: 80;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    min-width: min(520px, 90vw);
    padding: 7px;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.filter-search .search-suggestions {
    top: calc(100% + 5px);
}

.search-suggestion {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
    padding: 10px;
    text-align: left;
    background: transparent;
    border: 0;
    border-radius: 10px;
}

.search-suggestion:hover,
.search-suggestion:focus {
    background: var(--primary-soft);
}

.search-suggestion > span:not(.company-avatar) {
    display: grid;
    min-width: 0;
}

.search-suggestion strong,
.search-suggestion small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-suggestion small,
.suggestion-caption,
.suggestion-empty {
    color: var(--muted);
    font-size: .8rem;
}

.suggestion-caption,
.suggestion-empty {
    padding: 9px 10px;
}

.bulk-toolbar {
    position: sticky;
    z-index: 35;
    top: 74px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 12px;
    padding: 12px 16px;
    border-color: #a7dbc4;
    box-shadow: var(--shadow-md);
}

.bulk-toolbar .form-select {
    width: auto;
    min-width: 190px;
}

.check-column {
    width: 42px;
    text-align: center;
}

.clients-table .form-check-input,
.contact-client-table .form-check-input {
    position: relative;
    z-index: 2;
}

.duplicate-alert {
    margin-bottom: 18px;
    border-color: #f0cf85;
}

.duplicate-alert h2 {
    margin: 0 0 4px;
    font-size: 1.05rem;
}

.duplicate-list {
    display: grid;
    gap: 7px;
    margin-top: 12px;
}

.duplicate-list a {
    display: grid;
    padding: 10px 12px;
    background: rgba(255, 255, 255, .65);
    border-radius: 9px;
}

.duplicate-list span {
    color: var(--muted);
    font-size: .85rem;
}

.link-button {
    padding: 0;
    color: var(--primary);
    font: inherit;
    font-weight: 600;
    background: transparent;
    border: 0;
}

.keyboard-hint {
    display: block;
    margin-top: 10px;
    color: var(--subtle);
    text-align: center;
}

.client-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
    gap: 1px;
    margin-bottom: 14px;
    overflow: hidden;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.client-summary-grid > div {
    display: grid;
    align-content: center;
    min-height: 96px;
    padding: 16px;
    background: var(--surface);
}

.client-summary-grid span {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .045em;
}

.client-summary-grid strong {
    margin-top: 5px;
    font-size: 1rem;
}

.client-summary-grid small {
    color: var(--muted);
}

.client-summary-grid .is-empty strong {
    color: var(--subtle);
    font-weight: 500;
}

.record-tabs {
    position: sticky;
    z-index: 20;
    top: 70px;
    display: flex;
    gap: 3px;
    margin-bottom: 18px;
    padding: 6px;
    overflow-x: auto;
    background: rgba(244, 248, 246, .94);
    border: 1px solid var(--border);
    border-radius: 13px;
    backdrop-filter: blur(12px);
}

.record-tabs a {
    flex: 0 0 auto;
    padding: 8px 12px;
    font-weight: 600;
    border-radius: 9px;
}

.record-tabs a:hover {
    color: var(--primary);
    background: var(--primary-soft);
}

.record-tabs span {
    display: inline-grid;
    min-width: 21px;
    height: 21px;
    margin-left: 3px;
    place-items: center;
    color: var(--primary);
    font-size: .75rem;
    background: var(--primary-soft);
    border-radius: 999px;
}

.attention-chip {
    padding: 4px 9px;
    color: #8b5d00;
    font-size: .78rem;
    font-weight: 600;
    background: var(--amber-soft);
    border: 1px solid #f1d89c;
    border-radius: 999px;
}

.show-empty-fields {
    display: block;
    margin: -4px 0 20px auto;
}

.contact-list,
.activity-list,
.document-list {
    display: grid;
    gap: 0;
}

.contact-list {
    gap: 0;
}

.contact-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 13px;
    align-items: start;
    padding: 14px;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
}

.contact-card:last-child {
    border-bottom: 0;
}

.contact-card h3,
.activity-item h3 {
    margin: 0;
    font-size: 1rem;
}

.contact-card p,
.activity-item p {
    margin: 2px 0;
    color: var(--muted);
}

.contact-card .mini-tag {
    margin-left: 6px;
}

.contact-card-actions {
    display: flex;
    gap: 4px;
}

.contact-card-actions form {
    display: inline-flex;
}

.contact-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 5px;
    color: var(--primary);
    font-size: .88rem;
}

.inline-create-form {
    margin-top: 14px;
    padding: 16px;
    background: var(--primary-soft);
    border: 1px solid #bee6d4;
    border-radius: 13px;
}

.inline-create-form > .button {
    margin-top: 12px;
}

.document-upload-form {
    --document-input-height: 43px;
}

body[data-ui-mode="simple"] .document-upload-form {
    --document-input-height: 48px;
}

.document-upload-form .field input {
    min-height: var(--document-input-height);
}

.document-upload-form .field .document-file-input {
    min-width: 0;
    padding: 0 10px 0 0;
    line-height: 1.5;
}

.document-upload-form .document-file-input::file-selector-button {
    height: calc(var(--document-input-height) - 2px);
    margin: 0 10px 0 0;
    padding: 0 12px;
    border: 0;
    border-inline-end: 1px solid var(--border-strong);
    background: #edf7f2;
    color: var(--primary-dark);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.document-upload-form .document-file-input:hover::file-selector-button {
    background: #dff0e8;
}

.document-upload-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-top: 12px;
}

.document-upload-form .document-upload-actions .field-hint {
    font-size: .875rem;
    line-height: 1.45;
}

.activity-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: start;
    padding: 14px;
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
}

.activity-item:last-child {
    border-bottom: 0;
}

.activity-type {
    padding: 5px 8px;
    color: var(--primary-hover);
    font-size: .75rem;
    font-weight: 700;
    background: var(--primary-soft);
    border-radius: 8px;
}

.activity-item small {
    color: var(--muted);
}

.activity-item.is-completed {
    opacity: .66;
    background: var(--surface-soft);
}

.activity-item.is-completed h3 {
    text-decoration: line-through;
}

.activity-item.is-overdue {
    border-color: #edb4bc;
    background: var(--red-soft);
}

.activity-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.document-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
}

.document-item:last-child {
    border-bottom: 0;
}

.document-item:hover {
    border-color: #9fd4bd;
    background: var(--primary-soft);
}

.document-download {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    min-width: 0;
    padding: 12px;
}

.document-item > form {
    padding-right: 8px;
}

.document-download > span:nth-child(2) {
    display: grid;
    min-width: 0;
}

.document-download small {
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    color: var(--primary);
    font-size: .7rem;
    font-weight: 800;
    background: var(--primary-soft);
    border-radius: 10px;
}

@media (max-width: 760px) {
    .delete-related-form,
    .danger-zone {
        align-items: stretch;
        flex-direction: column;
    }

    .delete-related-form .button,
    .danger-zone .button {
        width: 100%;
    }

    .document-download {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .document-download > span:last-child {
        display: none;
    }
}

.quick-edit-card form {
    display: grid;
    gap: 12px;
}

.quick-edit-card .field {
    gap: 4px;
}

.sortable-heading {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    color: inherit;
    white-space: nowrap;
}

.sortable-heading:hover {
    color: var(--primary);
}

.smart-lists-panel {
    margin-bottom: 18px;
    padding: 20px;
}

.smart-list-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(230px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.smart-list-card {
    position: relative;
    display: flex;
    min-height: 92px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.smart-list-card:hover {
    border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.smart-list-grid > a.smart-list-card-featured {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: 12px;
    align-items: center;
    width: 100%;
    padding: 15px;
    color: inherit;
}

.smart-list-card-featured {
    background: linear-gradient(135deg, var(--primary-soft), var(--surface));
}

.smart-list-icon {
    display: inline-grid;
    width: 38px;
    height: 38px;
    place-items: center;
    color: var(--primary);
    font-size: 1.15rem;
    font-weight: 800;
    background: var(--primary-soft);
    border-radius: 11px;
}

.smart-list-copy {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.smart-list-copy strong {
    overflow: hidden;
    font-size: .94rem;
    text-overflow: ellipsis;
}

.smart-list-copy small {
    display: -webkit-box;
    overflow: hidden;
    color: var(--muted);
    font-size: .79rem;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.smart-list-grid > a.smart-list-card-featured > b {
    color: var(--primary);
    font-size: 1.25rem;
}

.smart-list-management,
.smart-list-builder {
    margin-top: 14px;
    border-top: 1px solid var(--border);
}

.smart-list-management > summary {
    padding: 15px 0 3px;
}

.smart-list-management-body {
    margin-top: 12px;
    padding: 10px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.smart-list-builder > summary {
    display: inline-flex;
    width: auto;
    gap: 10px;
    align-items: center;
    padding: 15px 0 3px;
    color: var(--primary);
    cursor: pointer;
    list-style: none;
}

.smart-list-builder > summary::-webkit-details-marker {
    display: none;
}

.smart-list-builder > summary > span:last-child {
    display: grid;
    gap: 1px;
}

.smart-list-builder > summary strong {
    font-size: .87rem;
}

.smart-list-builder > summary small {
    color: var(--muted);
    font-size: .76rem;
    font-weight: 500;
}

.smart-list-summary-icon {
    display: inline-grid;
    width: 30px;
    height: 30px;
    place-items: center;
    background: var(--primary-soft);
    border-radius: 9px;
    font-size: 1.05rem;
    font-weight: 800;
}

.smart-list-builder > form {
    margin-top: 14px;
    padding: 16px;
    background: var(--surface-soft);
    border-radius: 14px;
}

.smart-list-form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(170px, 1fr));
    gap: 12px;
}

.smart-list-name {
    grid-column: span 2;
}

.smart-list-rule-builder {
    margin-top: 14px;
    padding: 14px;
    background: #f6faf8;
    border: 1px solid #dcebe5;
    border-radius: 13px;
}

.smart-list-rule-heading {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 11px;
}

.smart-list-rule-heading > div {
    display: grid;
    gap: 2px;
}

.smart-list-rule-heading strong {
    font-size: .88rem;
}

.smart-list-rule-heading small {
    color: var(--muted);
    font-size: .74rem;
}

.smart-list-rule-list {
    display: grid;
    gap: 8px;
}

.smart-list-rule-row {
    display: grid;
    grid-template-columns: 48px minmax(210px, 1.25fr) minmax(180px, .85fr) minmax(180px, 1fr) 38px;
    gap: 8px;
    align-items: center;
}

.smart-list-rule-join {
    color: var(--primary);
    font-size: .66rem;
    font-weight: 850;
    text-align: center;
}

.smart-list-rule-row .form-select,
.smart-list-rule-row .form-control {
    width: 100%;
    min-height: 42px;
    font-size: .82rem;
}

.smart-list-rule-value {
    display: block;
    min-width: 0;
}

.smart-list-rule-row .icon-button:disabled {
    cursor: not-allowed;
    opacity: .35;
}

.saved-view-edit-form {
    width: 100%;
    padding: 24px;
}

.saved-view-edit-form > .panel-header {
    margin-bottom: 20px;
    padding: 0 0 18px;
}

.saved-view-edit-grid,
.saved-view-base-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(170px, 1fr));
    gap: 13px;
}

.saved-view-edit-name {
    grid-column: span 2;
}

.saved-view-base-filters {
    margin-top: 18px;
    border: 1px solid var(--border);
    border-radius: 13px;
}

.saved-view-base-filters > summary {
    display: flex;
    gap: 4px;
    padding: 14px 16px;
    flex-direction: column;
    cursor: pointer;
    list-style: none;
}

.saved-view-base-filters > summary::-webkit-details-marker {
    display: none;
}

.saved-view-base-filters > summary span {
    color: var(--text);
    font-size: .88rem;
    font-weight: 750;
}

.saved-view-base-filters > summary small {
    color: var(--muted);
    font-size: .74rem;
}

.saved-view-base-filters[open] > summary {
    border-bottom: 1px solid var(--border);
}

.saved-view-base-grid {
    padding: 15px;
}

.saved-view-rule-builder {
    margin-top: 18px;
}

.smart-list-rule-empty {
    padding: 16px;
    color: var(--muted);
    background: #fff;
    border: 1px dashed #cbded6;
    border-radius: 10px;
    font-size: .8rem;
    text-align: center;
}

.saved-view-edit-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.smart-list-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 14px;
}

.smart-list-actions small {
    color: var(--muted);
}

.dadata-inn-control > input {
    width: 100%;
}

.dadata-suggestions {
    position: absolute;
    z-index: 80;
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    overflow: auto;
    max-height: 390px;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 13px;
}

.dadata-suggestion {
    display: grid;
    width: 100%;
    gap: 2px;
    padding: 10px 12px;
    text-align: left;
    color: var(--text);
    background: transparent;
    border: 0;
    border-radius: 9px;
}

.dadata-suggestion:hover,
.dadata-suggestion.is-active {
    background: var(--primary-soft);
}

.dadata-suggestion strong,
.dadata-suggestion span,
.dadata-suggestion small {
    overflow: hidden;
    text-overflow: ellipsis;
}

.dadata-suggestion span {
    color: var(--primary);
    font-size: .82rem;
    font-weight: 700;
}

.dadata-suggestion small {
    color: var(--muted);
    font-size: .78rem;
    white-space: nowrap;
}

[data-dadata-status][data-state="loading"] {
    color: var(--primary);
}

[data-dadata-status][data-state="success"] {
    color: #087653;
    font-weight: 600;
}

[data-dadata-status][data-state="warning"] {
    color: #9a6200;
    font-weight: 600;
}

[data-dadata-status][data-state="error"] {
    color: var(--red);
    font-weight: 600;
}

.layout-toolbar {
    position: sticky;
    z-index: 30;
    top: 72px;
    display: flex;
    gap: 18px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding: 16px 18px;
    box-shadow: var(--shadow-md);
}

.layout-toolbar > div:first-child {
    display: grid;
}

.layout-toolbar span,
.global-layout-option small {
    color: var(--muted);
    font-size: .88rem;
}

.global-layout-option {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 14px;
    padding: 16px 18px;
    cursor: pointer;
}

.global-layout-option > span {
    display: grid;
}

.field-layout-board {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    width: min(100%, 1080px);
    margin: 0 auto;
}

.field-layout-section {
    overflow: hidden;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.field-layout-section > header {
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: space-between;
    padding: 17px 18px;
    background: var(--surface-soft);
    border-bottom: 1px solid var(--border);
}

.field-layout-section-heading {
    display: flex;
    gap: 12px;
    align-items: center;
}

.field-layout-section h2 {
    margin: 0;
    font-size: 1.08rem;
}

.field-layout-count {
    display: inline-grid;
    min-width: 25px;
    height: 25px;
    padding: 0 7px;
    place-items: center;
    color: var(--primary);
    font-size: .78rem;
    font-weight: 700;
    background: var(--primary-soft);
    border-radius: 999px;
}

.field-layout-section header p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: .84rem;
}

.field-layout-dropzone {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    min-height: 112px;
    padding: 12px;
    transition: background .15s ease, outline-color .15s ease;
}

.field-layout-section.is-empty .field-layout-dropzone::before {
    content: attr(data-empty-text);
    display: grid;
    grid-column: 1 / -1;
    min-height: 84px;
    place-items: center;
    color: var(--muted);
    font-size: .84rem;
    text-align: center;
    border: 2px dashed var(--border);
    border-radius: 12px;
}

.field-layout-dropzone.is-drag-over {
    background: var(--primary-soft);
    outline: 2px solid color-mix(in srgb, var(--primary) 55%, transparent);
    outline-offset: -4px;
}

.is-dragging-field .field-layout-section {
    border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
}

.is-dragging-field .field-layout-section:has(.is-drag-over) {
    border-color: var(--primary);
    box-shadow: 0 12px 28px rgb(18 126 82 / .13);
    transform: translateY(-2px);
}

.field-layout-item {
    display: grid;
    grid-template-columns: auto minmax(110px, 1fr);
    gap: 10px;
    align-items: center;
    min-height: 62px;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 11px;
    cursor: grab;
    user-select: none;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease, opacity .15s ease;
}

.field-layout-item:hover {
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.field-layout-item:active {
    cursor: grabbing;
}

.field-layout-item.is-dragging {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    opacity: .35;
    transform: rotate(1deg) scale(.98);
}

.drag-handle {
    display: inline-grid;
    width: 28px;
    height: 36px;
    place-items: center;
    color: var(--primary);
    font-weight: 700;
    letter-spacing: -3px;
    background: var(--primary-soft);
    border-radius: 8px;
}

.field-layout-copy {
    display: grid;
    min-width: 0;
}

.field-layout-copy strong,
.field-layout-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.field-layout-copy small {
    color: var(--muted);
    font-size: .75rem;
}

.field-layout-item label {
    grid-column: 2;
}

.layout-select-fallback {
    display: none;
    grid-template-columns: auto minmax(110px, 1fr);
    gap: 8px;
    align-items: center;
}

.layout-select-fallback > span {
    color: var(--muted);
    font-size: .72rem;
    white-space: nowrap;
}

.field-layout-item .form-select {
    font-size: .8rem;
}

.mobile-save-bar {
    display: none;
}

/* Compact editing surfaces and application-owned dialogs. */
.app-dialog-modal .modal-dialog {
    max-width: 460px;
}

.app-dialog-modal .modal-content {
    overflow: hidden;
    border: 0;
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(15, 35, 29, .2);
}

.app-dialog-modal [hidden] {
    display: none !important;
}

.app-dialog-body {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 13px;
    padding: 22px 22px 17px;
}

.app-dialog-icon {
    display: inline-grid;
    width: 42px;
    height: 42px;
    place-items: center;
    color: #9a6200;
    font-size: 1.1rem;
    font-weight: 800;
    background: var(--amber-soft);
    border-radius: 12px;
}

.app-dialog-modal[data-dialog-tone="danger"] .app-dialog-icon {
    color: var(--red);
    background: var(--red-soft);
}

.app-dialog-modal[data-dialog-tone="info"] .app-dialog-icon {
    color: var(--primary);
    background: var(--primary-soft);
}

.app-dialog-body h2 {
    margin: 1px 0 5px;
    font-size: 1.15rem;
}

.app-dialog-body p {
    margin: 0;
    color: var(--muted);
    font-size: .92rem;
    line-height: 1.45;
}

.app-dialog-input {
    display: grid;
    grid-column: 1 / -1;
    gap: 6px;
    margin-top: 4px;
    font-size: .82rem;
    font-weight: 600;
}

.app-dialog-input[hidden] {
    display: none;
}

.app-dialog-modal .modal-footer {
    gap: 8px;
    padding: 12px 18px;
    background: var(--surface-soft);
    border-color: var(--border);
}

.record-form {
    max-width: 1320px;
    margin: 0 auto;
}

.form-layout {
    grid-template-columns: minmax(0, 1fr) 250px;
    gap: 14px;
}

.form-main {
    gap: 12px;
}

.form-section {
    padding: 18px;
}

.section-heading {
    gap: 10px;
    margin-bottom: 14px;
}

.section-number {
    width: 30px;
    height: 30px;
    border-radius: 9px;
}

.section-heading h2 {
    margin-bottom: 1px;
}

.form-grid {
    column-gap: 14px;
    row-gap: 12px;
}

.field {
    gap: 4px;
}

.field input,
.field select {
    min-height: 42px;
}

.field textarea {
    min-height: 76px;
}

.sticky-actions {
    padding: 16px;
}

.sticky-actions p {
    margin-bottom: 12px;
}

.columns-settings-modal .modal-header {
    padding: 16px 18px 12px;
}

.columns-settings-modal .modal-footer {
    padding: 10px 16px;
}

.columns-configurator {
    min-height: min(500px, 60vh);
}

.columns-config-panel > header {
    gap: 7px;
    padding: 11px 14px;
}

.page-heading-compact {
    width: min(100%, 1080px);
    margin-right: auto;
    margin-bottom: 14px;
    margin-left: auto;
}

.page-heading-compact h1 {
    font-size: clamp(26px, 2vw, 32px);
}

.page-heading-compact .back-link {
    margin-bottom: 7px;
}

.page-heading-compact .eyebrow {
    margin-bottom: 5px;
}

.layout-toolbar {
    width: min(100%, 1080px);
    margin: 0 auto 10px;
    padding: 10px 14px;
    box-shadow: var(--shadow-sm);
}

.layout-toolbar span,
.global-layout-option small {
    font-size: .8rem;
}

.global-layout-option {
    width: min(100%, 1080px);
    margin: 0 auto 10px;
    padding: 11px 14px;
}

.field-layout-board {
    gap: 10px;
}

.field-layout-section > header {
    padding: 11px 14px;
}

.field-layout-section header p {
    margin-top: 1px;
    font-size: .78rem;
}

.field-layout-dropzone {
    gap: 7px;
    min-height: 76px;
    padding: 8px;
}

.field-layout-section.is-empty .field-layout-dropzone::before {
    min-height: 56px;
}

.field-layout-item {
    min-height: 52px;
    padding: 8px 10px;
}

.drag-handle {
    width: 26px;
    height: 32px;
}

.client-table-settings-copy {
    gap: 6px;
}

.client-table-settings .column-resize-tip {
    display: inline-flex;
    width: max-content;
    max-width: 100%;
    align-items: center;
    gap: 7px;
    padding: 5px 9px;
    color: #356b59;
    background: var(--primary-soft);
    border: 1px solid #cce8dc;
    border-radius: 8px;
}

.column-resize-tip b,
.client-table-scroll-guide b {
    color: var(--primary);
    font-size: 1rem;
}

.client-table-scroll-guide {
    display: grid;
    grid-template-columns: max-content minmax(160px, 1fr);
    gap: 14px;
    align-items: center;
    padding: 7px 14px;
    color: #48675c;
    font-size: .78rem;
    font-weight: 600;
    background: #f0f8f4;
    border-bottom: 1px solid #d6e8df;
}

.client-table-scroll-guide[hidden] {
    display: none;
}

.client-table-scroll-guide > span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.client-table-top-scroll {
    height: 14px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-color: var(--primary) #dfeae5;
    scrollbar-width: auto;
}

.client-table-top-scroll > div {
    height: 1px;
}

.data-table-wrap {
    position: relative;
    scrollbar-color: var(--primary) #dfeae5;
}

.data-table-wrap.has-horizontal-overflow:not(.is-scroll-end) {
    box-shadow: inset -18px 0 16px -18px rgba(16, 64, 49, .75);
}

.data-table-wrap.has-horizontal-overflow.is-scrolled {
    box-shadow:
        inset 18px 0 16px -18px rgba(16, 64, 49, .6),
        inset -18px 0 16px -18px rgba(16, 64, 49, .75);
}

.data-table-wrap.has-horizontal-overflow.is-scrolled.is-scroll-end {
    box-shadow: inset 18px 0 16px -18px rgba(16, 64, 49, .6);
}

@media (max-width: 960px) {
    .form-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1100px) {
    .smart-list-grid,
    .smart-list-form-grid {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }

    .advanced-filter-grid {
        grid-template-columns: repeat(2, minmax(170px, 1fr));
    }

    .smart-list-rule-row {
        grid-template-columns: 42px minmax(190px, 1fr) minmax(160px, .8fr) minmax(160px, 1fr) 38px;
    }

    .saved-view-edit-grid,
    .saved-view-base-grid {
        grid-template-columns: repeat(2, minmax(170px, 1fr));
    }

}

@media (max-width: 700px) {
    .app-dialog-modal .modal-dialog {
        margin: 12px;
    }

    .app-dialog-body {
        padding: 18px 17px 14px;
    }

    .form-section {
        padding: 14px;
    }

    .client-table-settings {
        align-items: stretch;
        flex-direction: column;
    }

    .client-table-settings .button {
        width: 100%;
    }

    .client-table-settings .column-resize-tip {
        width: 100%;
    }

    .client-table-scroll-guide {
        grid-template-columns: 1fr;
        gap: 3px;
        padding: 6px 10px;
    }

    .columns-settings-modal .modal-dialog {
        margin: 8px;
    }

    .columns-settings-modal .modal-header {
        padding: 16px;
    }

    .columns-configurator {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .columns-config-panel {
        min-height: 360px;
    }

    .columns-config-panel + .columns-config-panel {
        border-top: 1px solid var(--border);
        border-left: 0;
    }

    .smart-lists-panel {
        padding: 15px;
    }

    .saved-views-panel {
        padding: 14px;
    }

    .saved-views-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .saved-views-management > summary {
        width: fit-content;
    }

    .saved-view-manager-menu {
        position: static;
        width: 100%;
        margin-top: 10px;
        box-shadow: var(--shadow-sm);
    }

    .saved-view-manager-row,
    .smart-list-management-row {
        align-items: stretch;
        flex-direction: column;
    }

    .saved-view-manager-row > div,
    .smart-list-management-row > div {
        width: 100%;
    }

    .saved-view-manager-row .button,
    .smart-list-management-row .button {
        min-height: 38px;
        flex: 1 1 auto;
    }

    .saved-view-manager-row form,
    .smart-list-management-row form {
        flex: 1 1 auto;
    }

    .saved-view-manager-row form .button,
    .smart-list-management-row form .button {
        width: 100%;
    }

    .smart-list-grid,
    .smart-list-form-grid {
        grid-template-columns: 1fr;
    }

    .smart-list-grid > a.smart-list-card-featured {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .smart-list-grid > a.smart-list-card-featured > b {
        display: none;
    }

    .smart-list-name {
        grid-column: auto;
    }

    .smart-list-rule-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .smart-list-rule-heading .button {
        width: 100%;
    }

    .smart-list-rule-row {
        grid-template-columns: 38px minmax(0, 1fr) 38px;
        padding: 10px 0;
        border-top: 1px solid #dce8e3;
    }

    .smart-list-rule-row:first-child {
        padding-top: 0;
        border-top: 0;
    }

    .smart-list-rule-row [data-list-rule-field],
    .smart-list-rule-row [data-list-rule-operator],
    .smart-list-rule-row [data-list-rule-value-wrap] {
        grid-column: 2;
    }

    .smart-list-rule-row [data-list-rule-field] {
        grid-row: 1;
    }

    .smart-list-rule-row [data-list-rule-operator] {
        grid-row: 2;
    }

    .smart-list-rule-row [data-list-rule-value-wrap] {
        grid-row: 3;
    }

    .smart-list-rule-row [data-list-rule-join] {
        grid-column: 1;
        grid-row: 1;
    }

    .smart-list-rule-row [data-remove-list-rule] {
        grid-column: 3;
        grid-row: 1;
    }

    .saved-view-edit-form {
        padding: 16px;
    }

    .saved-view-edit-grid,
    .saved-view-base-grid {
        grid-template-columns: 1fr;
    }

    .saved-view-edit-name,
    .saved-view-base-grid .field-span-2 {
        grid-column: auto;
    }

    .saved-view-edit-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .saved-view-edit-actions .button {
        width: 100%;
    }

    .smart-list-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .smart-list-actions .button {
        width: 100%;
    }

    .advanced-filter-grid {
        grid-template-columns: 1fr;
    }

    .bulk-toolbar {
        top: 64px;
    }

    .bulk-toolbar .form-select,
    .bulk-toolbar .button {
        width: 100%;
    }

    .client-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .record-tabs {
        top: 62px;
    }

    .activity-item {
        grid-template-columns: 1fr;
    }

    .contact-card {
        grid-template-columns: auto 1fr;
    }

    .contact-card > form {
        grid-column: 2;
    }

    .layout-toolbar {
        position: static;
        align-items: stretch;
        flex-direction: column;
    }

    .field-layout-board {
        grid-template-columns: 1fr;
    }

    .field-layout-dropzone {
        grid-template-columns: 1fr;
    }

    .layout-select-fallback {
        display: grid;
    }

    .field-layout-item {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .mobile-save-bar {
        position: sticky;
        z-index: 30;
        bottom: 8px;
        display: block;
        padding: 8px;
        background: rgb(244 248 246 / .9);
        border-radius: 13px;
        backdrop-filter: blur(10px);
    }
}

/* Notification center and automation rules */
.notification-bell {
    position: relative;
}

.notification-bell-button {
    position: relative;
}

.notification-bell-button svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.notification-badge,
.nav-counter {
    display: grid;
    place-items: center;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    color: #fff;
    background: #e04e40;
    border: 2px solid #fff;
    border-radius: 999px;
    font-size: .65rem;
    font-weight: 800;
    line-height: 1;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
}

.nav-counter {
    margin-left: auto;
    border-color: transparent;
}

.app-shell.is-sidebar-collapsed .nav-counter {
    position: absolute;
    top: 4px;
    right: 3px;
    min-width: 16px;
    height: 16px;
    padding: 0 3px;
}

.notification-dropdown {
    position: absolute;
    z-index: 1090;
    top: calc(100% + 10px);
    right: 0;
    width: min(390px, calc(100vw - 24px));
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
}

.notification-dropdown-head,
.notification-dropdown-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
}

.notification-dropdown-head {
    border-bottom: 1px solid var(--border-soft);
}

.notification-dropdown-head button {
    padding: 0;
    color: var(--primary);
    background: none;
    border: 0;
    font-size: .78rem;
    font-weight: 700;
}

.notification-dropdown-list {
    max-height: min(480px, 65vh);
    overflow-y: auto;
}

.notification-dropdown-item {
    position: relative;
    display: grid;
    gap: 3px;
    padding: 12px 16px 12px 21px;
    color: var(--text);
    border-bottom: 1px solid var(--border-soft);
    text-decoration: none;
}

.notification-dropdown-item::before {
    position: absolute;
    top: 16px;
    left: 9px;
    width: 6px;
    height: 6px;
    background: #aab6b2;
    border-radius: 50%;
    content: '';
}

.notification-dropdown-item.severity-warning::before { background: #e6a73c; }
.notification-dropdown-item.severity-danger::before { background: #df5548; }
.notification-dropdown-item.is-unread { background: #f1fbf7; }
.notification-dropdown-item:hover { color: var(--text); background: #f6faf8; }
.notification-dropdown-item strong { font-size: .86rem; }
.notification-dropdown-item span { overflow: hidden; color: var(--muted); font-size: .77rem; text-overflow: ellipsis; white-space: nowrap; }
.notification-dropdown-item small { color: #88938f; font-size: .7rem; }
.notification-dropdown-footer { justify-content: center; color: var(--primary); font-size: .8rem; font-weight: 700; text-decoration: none; }
.notification-loading,
.notification-dropdown-empty { padding: 28px 16px; color: var(--muted); text-align: center; }

.notification-page-heading h1 span {
    color: var(--primary);
    font-size: .55em;
    vertical-align: super;
}

.notification-tabs {
    display: flex;
    gap: 5px;
    margin: -4px 0 16px;
}

.notification-tabs a {
    padding: 8px 14px;
    color: var(--muted);
    border-radius: 9px;
    font-size: .85rem;
    font-weight: 700;
    text-decoration: none;
}

.notification-tabs a.is-active { color: var(--primary-dark); background: #e6f7f0; }
.notification-center { overflow: visible; background: #fff; }
.notification-center-list { display: grid; }

.notification-card {
    position: relative;
    display: grid;
    grid-template-columns: 12px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-soft);
    transition: opacity .2s, transform .2s, background .2s;
}

.notification-card:last-child { border-bottom: 0; }
.notification-card.is-unread { background: #f5fcf9; }
.notification-card.is-resolving { opacity: 0; transform: translateX(12px); }
.notification-status-dot { width: 9px; height: 9px; background: #84a49a; border-radius: 50%; box-shadow: 0 0 0 5px #edf4f1; }
.notification-card.severity-warning .notification-status-dot { background: #e4a43a; box-shadow: 0 0 0 5px #fff6e5; }
.notification-card.severity-danger .notification-status-dot { background: #df5548; box-shadow: 0 0 0 5px #fff0ee; }
.notification-card-body { min-width: 0; }
.notification-card-body h2 { margin: 3px 0 5px; font-size: 1rem; }
.notification-card-body p { margin: 0 0 4px; color: #41534d; font-size: .86rem; }
.notification-card-body small { color: var(--muted); font-size: .75rem; }
.notification-card-meta { display: flex; gap: 12px; color: var(--muted); font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.notification-card-actions { display: flex; gap: 8px; align-items: center; }
.notification-snooze { position: relative; }
.notification-snooze-menu { position: absolute; z-index: 10; top: calc(100% + 6px); right: 0; min-width: 170px; padding: 5px; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.notification-snooze-menu button { display: block; width: 100%; padding: 8px 10px; color: var(--text); background: none; border: 0; border-radius: 7px; text-align: left; font-size: .78rem; }
.notification-snooze-menu button:hover { background: #edf8f3; }
.notification-empty { display: grid; justify-items: center; padding: 58px 24px; text-align: center; }
.notification-empty > span { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 14px; color: var(--primary); background: #e3f7ef; border-radius: 16px; font-size: 1.5rem; }
.notification-empty h2 { margin-bottom: 6px; font-size: 1.1rem; }
.notification-empty p { margin: 0; color: var(--muted); }

.agent-status {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
    padding: 13px 16px;
}
.agent-status-indicator { width: 10px; height: 10px; background: var(--primary); border-radius: 50%; box-shadow: 0 0 0 5px #e3f7ef; }
.agent-status.has-error .agent-status-indicator { background: var(--red); box-shadow: 0 0 0 5px #fff0ee; }
.agent-status > div { display: grid; gap: 2px; }
.agent-status small { color: var(--muted); font-size: .75rem; }
.notification-rule-editor { margin-bottom: 18px; padding: 20px; }
.rule-condition-block { padding: 16px; background: #f6faf8; border: 1px solid var(--border-soft); border-radius: 12px; }
.rule-condition-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.rule-condition-heading > div { display: grid; gap: 2px; }
.rule-condition-heading small { color: var(--muted); font-size: .75rem; }
.rule-condition-list { display: grid; gap: 8px; }
.rule-condition-row { display: grid; grid-template-columns: 46px minmax(170px, 1.2fr) minmax(150px, 1fr) minmax(150px, 1fr) 38px; gap: 8px; align-items: center; }
.rule-condition-row select,
.rule-condition-row input { width: 100%; min-height: 40px; padding: 8px 10px; background: #fff; border: 1px solid var(--border); border-radius: 8px; font-size: .82rem; }
.rule-condition-and { color: var(--primary); font-size: .68rem; font-weight: 800; }
.notification-rules-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; }
.notification-rule-card { position: relative; display: grid; gap: 16px; padding: 18px; overflow: hidden; }
.notification-rule-card::before { position: absolute; inset: 0 auto 0 0; width: 4px; background: #7da99a; content: ''; }
.notification-rule-card.severity-warning::before { background: #e4a43a; }
.notification-rule-card.severity-danger::before { background: #df5548; }
.notification-rule-card.is-disabled { opacity: .62; }
.notification-rule-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.notification-rule-card-head h2 { margin: 7px 0 0; font-size: 1rem; }
.rule-state,
.rule-global { display: inline-flex; margin-right: 5px; padding: 3px 7px; color: #17795a; background: #e4f7ef; border-radius: 6px; font-size: .65rem; font-weight: 800; text-transform: uppercase; }
.notification-rule-card.is-disabled .rule-state { color: #6d7774; background: #eef1f0; }
.rule-global { color: #725a1f; background: #fff3d5; }
.rule-incidents { display: grid; place-items: center; min-width: 31px; height: 31px; color: var(--primary-dark); background: #eaf7f2; border-radius: 9px; font-weight: 800; }
.rule-readable-conditions { display: grid; gap: 7px; }
.rule-readable-conditions div { color: #40514b; font-size: .8rem; }
.rule-readable-conditions div > span { display: inline-block; width: 36px; color: var(--muted); font-size: .68rem; font-weight: 800; text-transform: uppercase; }
.rule-card-meta { display: flex; flex-wrap: wrap; gap: 8px 15px; color: var(--muted); font-size: .73rem; }
.notification-rule-card-actions { display: flex; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.activity-item[data-priority="high"],
.activity-item[data-priority="urgent"] { border-left: 3px solid #df5548; }

@media (max-width: 850px) {
    .notification-card { grid-template-columns: 12px minmax(0, 1fr); }
    .notification-card-actions { grid-column: 2; flex-wrap: wrap; }
    .rule-condition-row { grid-template-columns: 36px 1fr 38px; }
    .rule-condition-row select,
    .rule-condition-row input { grid-column: 2; }
    .rule-condition-row .icon-button { grid-column: 3; grid-row: 1; }
    .notification-rules-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .notification-dropdown { position: fixed; top: 68px; right: 10px; left: 10px; width: auto; }
    .notification-card { padding: 15px 13px; }
    .notification-card-actions { align-items: stretch; flex-direction: column; }
    .notification-card-actions .button { width: 100%; }
}

/* Standalone client contacts */
.contact-filter-panel {
    margin-bottom: 16px;
    padding: 16px;
}

.contact-filter-form {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(150px, 190px) minmax(170px, 220px) auto auto;
    gap: 10px;
    align-items: end;
}

.contacts-list-panel {
    padding: 0;
    overflow: hidden;
}

.contacts-list-panel > .panel-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-soft);
}

.list-bulk-toolbar {
    margin: 12px 16px;
}

.contact-client-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    background: #fff;
}

.contact-client-table {
    width: 100%;
    min-width: 1100px;
    border-collapse: collapse;
}

.contact-client-table th {
    padding: 11px 14px;
    color: var(--muted);
    background: #f8faf9;
    border-bottom: 1px solid var(--border);
    font-size: .68rem;
    font-weight: 800;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.contact-client-table td {
    padding: 12px 14px;
    color: #33463f;
    border-bottom: 1px solid var(--border-soft);
    font-size: .82rem;
    vertical-align: middle;
}

.contact-client-table tbody tr:hover {
    background: #f6fbf9;
}

.contact-client-table a {
    color: #294e42;
    text-decoration: none;
}

.contact-client-table a:hover {
    color: var(--primary);
}

.contact-person-cell {
    display: flex;
    gap: 10px;
    align-items: center;
    min-width: 220px;
}

.contact-person-cell > span:last-child {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.contact-person-cell strong {
    overflow: hidden;
    color: var(--text);
    font-size: .88rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.contact-person-cell small {
    color: var(--muted);
    font-size: .72rem;
}

.row-arrow-link {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1.15rem;
}

.contact-form-panel {
    max-width: 1060px;
    padding: 22px;
}

.source-contact-notice {
    padding: 11px 13px;
    color: #50655d;
    background: #edf8f3;
    border: 1px solid #cee9de;
    border-radius: 9px;
    font-size: .78rem;
}

.contact-detail-heading {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 18px;
}

.contact-title-row {
    display: flex;
    gap: 13px;
    align-items: center;
    margin-top: 10px;
}

.contact-title-row h1 {
    margin: 0;
    font-size: clamp(1.45rem, 2.4vw, 2rem);
}

.contact-title-row p {
    margin: 3px 0 0;
    color: var(--muted);
}

.contact-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
    gap: 16px;
    align-items: start;
}

.contact-detail-main,
.contact-detail-side {
    padding: 20px;
}

.contact-data-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    margin: 8px 0 0;
}

.contact-data-list > div {
    display: grid;
    gap: 4px;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-soft);
}

.contact-data-list > div:nth-child(odd) {
    padding-right: 18px;
}

.contact-data-list dt {
    color: var(--muted);
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.contact-data-list dd {
    margin: 0;
    color: var(--text);
    font-size: .9rem;
    font-weight: 600;
}

.contact-data-list a {
    color: var(--primary-dark);
    text-decoration: none;
}

.contact-notes {
    margin-top: 18px;
    padding: 14px;
    background: #f7faf9;
    border-radius: 10px;
}

.contact-notes p {
    margin: 6px 0 0;
    color: #475c54;
}

.contact-detail-side h2 {
    margin: 0 0 14px;
    font-size: 1rem;
}

@media (max-width: 1050px) {
    .contact-filter-form {
        grid-template-columns: minmax(240px, 1fr) repeat(2, minmax(150px, 1fr));
    }

    .contact-filter-form .button {
        width: fit-content;
    }
}

@media (max-width: 760px) {
    .contact-filter-form,
    .contact-detail-grid,
    .contact-data-list {
        grid-template-columns: 1fr;
    }

    .contact-detail-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .contact-detail-heading > .button {
        width: fit-content;
    }

    .contact-data-list > div:nth-child(odd) {
        padding-right: 0;
    }
}

/* CRM navigation and client-list refinements */
@media (min-width: 961px) {
    .app-shell.sidebar-collapsed {
        --sidebar-width: 78px;
    }

    .sidebar-collapsed .sidebar {
        overflow-x: hidden;
    }

    .sidebar-collapsed .sidebar-brand-row {
        flex-direction: column;
        min-height: 116px;
        justify-content: center;
        gap: 7px;
    }

    .sidebar-collapsed .brand {
        min-height: auto;
        flex: 0 0 auto;
        justify-content: center;
        padding: 8px;
    }

    .sidebar-collapsed .brand-copy,
    .sidebar-collapsed .nav-label,
    .sidebar-collapsed .profile-copy,
    .sidebar-collapsed .profile-arrow {
        display: none;
    }

    .sidebar-collapsed .sidebar-collapse-button {
        width: 30px;
        height: 26px;
        margin: 0;
    }

    .sidebar-collapsed .sidebar-collapse-button svg {
        transform: rotate(180deg);
    }

    .sidebar-collapsed .main-nav {
        padding: 18px 10px;
    }

    .sidebar-collapsed .nav-link {
        justify-content: center;
        padding: 9px;
    }

    .sidebar-collapsed .nav-section-label {
        height: 25px;
        margin: 8px 5px 4px;
        padding: 0;
        overflow: hidden;
        color: transparent;
        border-top: 1px solid rgba(255, 255, 255, .1);
    }

    .sidebar-collapsed .sidebar-footer {
        padding: 12px 10px;
    }

    .sidebar-collapsed .profile-card {
        justify-content: center;
        padding: 8px;
    }
}

.advanced-filters > summary .details-chevron {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin: -4px 2px 0 3px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform .18s ease, margin .18s ease;
}

.advanced-filters[open] > summary .details-chevron {
    margin-top: 4px;
    transform: rotate(225deg);
}

.admin-settings-panel {
    width: min(620px, 100%);
    padding: 22px;
}

.brand-logo-setting {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 18px;
    align-items: center;
    max-width: 760px;
    padding: 16px;
    background: #f7faf8;
    border: 1px solid var(--border);
    border-radius: 14px;
}

.brand-logo-preview {
    display: grid;
    width: 150px;
    height: 94px;
    padding: 10px;
    place-items: center;
    overflow: hidden;
    background: #fff;
    border: 1px dashed #b9cec4;
    border-radius: 12px;
}

.brand-logo-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-logo-preview-fallback {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    color: #fff;
    background: linear-gradient(145deg, #34b889, #11805d);
    border-radius: 14px;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: .08em;
}

.brand-logo-setting-copy {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.brand-logo-setting-copy .field {
    margin: 0;
}

.client-table-settings > .client-table-settings-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.client-list-tool {
    display: grid;
    width: 38px;
    height: 38px;
    padding: 0;
    place-items: center;
    color: #52665f;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 9px;
}

.client-list-tool svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.client-list-tool:hover,
.client-list-tool[aria-pressed="true"] {
    color: var(--primary);
    background: var(--primary-soft);
    border-color: #b9ddce;
}

.column-width-status:empty {
    display: none;
}

.column-width-status:not(:empty) {
    color: #557066;
    font-size: .8rem;
}

[data-bulk-form]:not(.is-bulk-mode) .check-column {
    width: 0 !important;
    max-width: 0;
    padding: 0 !important;
    overflow: hidden;
    visibility: hidden;
    border: 0;
}

[data-bulk-form]:not(.is-bulk-mode) col.client-check-col {
    width: 0 !important;
}

[data-bulk-form].is-bulk-mode col.client-check-col {
    width: 50px !important;
}

.table-panel,
.clients-table,
.clients-table th,
.clients-table td {
    background: #fff;
}

.clients-table tbody tr:hover td {
    background: #f7fbf9;
}

.client-table-viewport {
    position: relative;
}

.client-table-edge-button {
    position: absolute;
    z-index: 18;
    top: var(--edge-button-top, 50%);
    display: grid;
    width: 58px;
    height: 84px;
    padding: 0;
    place-items: center;
    color: rgba(255, 255, 255, .96);
    background: rgba(14, 75, 57, .52);
    border: 1px solid rgba(255, 255, 255, .46);
    border-radius: 20px;
    box-shadow: 0 12px 32px rgba(11, 57, 43, .2);
    opacity: .72;
    font-size: 52px;
    font-weight: 300;
    line-height: .8;
    cursor: pointer;
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
    transform: translateY(-50%);
    transition: opacity .16s ease, background-color .16s ease, border-color .16s ease,
        box-shadow .16s ease, transform .16s ease;
    will-change: top, transform;
}

.client-table-edge-button:hover,
.client-table-edge-button:focus-visible {
    color: #fff;
    background: rgba(11, 104, 76, .76);
    border-color: rgba(255, 255, 255, .72);
    box-shadow: 0 16px 38px rgba(11, 57, 43, .3);
    opacity: .96;
    transform: translateY(-50%) scale(1.06);
}

.client-table-edge-button.is-left {
    left: 12px;
}

.client-table-edge-button.is-right {
    right: 12px;
}

@media (max-width: 700px) {
    .client-table-edge-button {
        width: 46px;
        height: 70px;
        border-radius: 17px;
        font-size: 43px;
        opacity: .8;
    }

    .client-table-edge-button.is-left {
        left: 6px;
    }

    .client-table-edge-button.is-right {
        right: 6px;
    }
}

.data-table-wrap.has-horizontal-overflow:not(.is-scroll-end),
.data-table-wrap.has-horizontal-overflow.is-scrolled,
.data-table-wrap.has-horizontal-overflow.is-scrolled.is-scroll-end {
    box-shadow: none;
}

.client-table-settings .column-resize-tip,
.client-table-scroll-guide {
    display: none !important;
}

[data-client-list-panel].is-loading .client-table-viewport,
[data-client-list-panel].is-loading .table-footer {
    opacity: .55;
    pointer-events: none;
}

.dadata-company-control {
    display: block;
}

.dadata-company-control > input {
    width: 100%;
}

.dadata-field-control {
    display: block;
    width: 100%;
}

.dadata-field-control > input,
.dadata-field-control > textarea {
    width: 100%;
}

.dadata-field-status {
    display: block;
    margin-top: 5px;
}

[data-dadata-company-status][data-state="loading"],
[data-dadata-field-status][data-state="loading"],
[data-dadata-status][data-state="loading"] {
    color: #687a73;
}

[data-dadata-company-status][data-state="success"],
[data-dadata-field-status][data-state="success"],
[data-dadata-status][data-state="success"] {
    color: var(--primary);
}

[data-dadata-company-status][data-state="warning"],
[data-dadata-field-status][data-state="warning"],
[data-dadata-status][data-state="warning"] {
    color: #a66a11;
}

[data-dadata-company-status][data-state="error"],
[data-dadata-field-status][data-state="error"],
[data-dadata-status][data-state="error"] {
    color: #b42318;
}

@media (max-width: 700px) {
    .client-table-settings {
        align-items: flex-start;
    }

    .client-table-settings-actions {
        width: 100%;
        justify-content: flex-end;
    }

}

/* Client card editor, DaData mapping and unambiguous saved-state feedback. */
.admin-settings-wide {
    width: min(820px, 100%);
}

.settings-section + .settings-section {
    margin-top: 8px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}

.settings-toggle {
    margin-bottom: 14px;
}

.dadata-clear-token {
    margin-top: 4px;
    color: #9b372e;
}

.settings-inline-link {
    display: inline-flex;
    margin-top: 8px;
    font-weight: 650;
}

.dadata-mapping-panel {
    margin-bottom: 18px;
    overflow: hidden;
}

.dadata-mapping-panel > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 17px 20px;
    cursor: pointer;
    list-style: none;
    background: var(--surface-soft);
}

.dadata-mapping-panel > summary::-webkit-details-marker {
    display: none;
}

.dadata-mapping-panel > summary > span:first-child {
    display: grid;
}

.dadata-mapping-panel > summary small {
    margin-top: 3px;
    color: var(--muted);
    font-weight: 400;
}

.dadata-mapping-panel[open] .accordion-arrow {
    transform: rotate(180deg);
}

.dadata-mapping-form {
    display: grid;
    gap: 20px;
    padding: 20px;
    border-top: 1px solid var(--border);
}

.dadata-mapping-group h2 {
    margin: 0 0 12px;
    font-size: 1rem;
}

.dadata-mapping-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.dadata-mapping-grid .field > span small {
    color: var(--muted);
    font-weight: 400;
}

.card-layout-config-section {
    width: min(100%, 1080px);
    margin: 0 auto 14px;
    padding: 18px;
}

.card-layout-config-heading,
.field-layout-intro {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.card-layout-config-heading {
    margin-bottom: 16px;
}

.field-layout-intro {
    width: min(100%, 1080px);
    margin: 24px auto 12px;
}

.card-layout-config-heading h2,
.field-layout-intro h2 {
    margin: 0;
    font-size: 1.12rem;
}

.card-layout-config-heading p,
.field-layout-intro p {
    margin: 3px 0 0;
    color: var(--muted);
}

.summary-layout-columns {
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(280px, .88fr);
    gap: 16px;
}

.summary-layout-column {
    min-width: 0;
}

.summary-layout-column h3 {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: .78rem;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.summary-layout-list {
    display: grid;
    gap: 7px;
    min-height: 84px;
    padding: 9px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.summary-layout-list.is-empty::before {
    content: attr(data-empty-text);
    display: grid;
    min-height: 62px;
    place-items: center;
    color: var(--muted);
    font-size: .84rem;
    text-align: center;
    border: 1px dashed #c9d8d2;
    border-radius: 9px;
}

.summary-layout-item,
.summary-layout-option {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 9px;
    align-items: center;
    min-height: 54px;
    padding: 8px 10px;
    text-align: left;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.summary-layout-option {
    grid-template-columns: auto minmax(0, 1fr);
    color: inherit;
    cursor: pointer;
}

.summary-layout-option:hover {
    border-color: #9fceb9;
    background: #fbfefc;
}

.summary-layout-item > span:nth-child(2),
.summary-layout-option > span:nth-child(2) {
    display: grid;
    min-width: 0;
}

.summary-layout-item small,
.summary-layout-option small {
    overflow: hidden;
    color: var(--muted);
    font-size: .75rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.summary-layout-item [data-summary-remove],
.summary-layout-item [data-property-remove] {
    width: 30px;
    height: 30px;
    padding: 0;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-radius: 7px;
    font-size: 20px;
}

.summary-layout-item [data-summary-remove]:hover,
.summary-layout-item [data-property-remove]:hover {
    color: var(--red);
    background: #fff2f0;
}

.summary-layout-item.is-dragging {
    opacity: .35;
}

.section-copy-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.section-copy-card {
    display: grid;
    grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
    gap: 10px;
    padding: 12px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 11px;
}

.field-layout-section-heading {
    flex: 1;
    min-width: 0;
}

.field-layout-section-copy {
    display: grid;
    grid-template-columns: minmax(180px, .8fr) minmax(240px, 1.2fr);
    gap: 10px;
    width: 100%;
}

.field-layout-section-copy label {
    display: grid;
    gap: 4px;
}

.field-layout-section-copy label > span {
    color: var(--muted);
    font-size: .7rem;
    font-weight: 650;
    text-transform: uppercase;
}

.field-layout-section-copy input {
    width: 100%;
    min-height: 38px;
    padding: 7px 10px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.detail-side-subtitle {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: .78rem;
}

.client-table-settings > .client-table-settings-copy > .column-width-status:not(:empty) {
    display: inline-flex;
    width: fit-content;
    min-height: 0;
    margin: 0;
    padding: 0;
    align-items: center;
    color: #60736c;
    font-size: .78rem;
    line-height: 1.35;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.client-table-settings > .client-table-settings-copy > .column-width-status[data-state="error"] {
    color: var(--red);
}

@media (min-width: 961px) {
    .sidebar-collapsed .main-nav {
        min-width: 0;
        align-items: stretch;
        overflow-x: hidden;
    }

    .sidebar-collapsed .nav-section-label {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        font-size: 0;
    }

    .sidebar-collapsed .nav-icon {
        display: inline-flex !important;
        width: 34px;
        height: 34px;
        flex: 0 0 34px;
        align-items: center;
        justify-content: center;
        position: relative;
        z-index: 1;
        color: #e1eee9;
        opacity: 1;
        overflow: visible;
        visibility: visible;
    }

    .sidebar-collapsed .nav-icon svg {
        display: block !important;
        width: 22px;
        height: 22px;
        min-width: 22px;
        flex: 0 0 22px;
        color: inherit;
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        opacity: 1;
        overflow: visible;
        visibility: visible;
    }

    .sidebar-collapsed .nav-link {
        width: 46px;
        min-width: 46px;
        align-self: center;
        margin: 0;
        padding: 6px;
    }

    .sidebar-collapsed .nav-link.is-active .nav-icon {
        color: #7bdbb8;
    }
}

.record-form[data-client-form] {
    width: 100%;
    max-width: none;
    margin-right: 0;
    margin-left: 0;
}

@media (max-width: 900px) {
    .dadata-mapping-grid,
    .section-copy-grid,
    .summary-layout-columns {
        grid-template-columns: 1fr;
    }

    .field-layout-section-copy,
    .section-copy-card {
        grid-template-columns: 1fr;
    }
}

/* Full-width, collapsed-by-default client card property editor. */
.page-heading-compact,
.layout-toolbar,
.global-layout-option,
.card-layout-collapsible,
.field-layout-intro,
.field-layout-board {
    width: 100%;
    max-width: none;
}

.page-heading-compact {
    margin-right: 0;
    margin-left: 0;
}

.card-layout-collapsible {
    margin: 0 0 14px;
    overflow: hidden;
}

.card-layout-collapsible-summary,
.property-layout-section > summary {
    display: grid;
    gap: 12px;
    align-items: center;
    min-height: 68px;
    padding: 13px 16px;
    cursor: pointer;
    list-style: none;
    background: var(--surface-soft);
}

.card-layout-collapsible-summary {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
}

.property-layout-section > summary {
    grid-template-columns: minmax(0, 1fr) auto auto;
}

.card-layout-collapsible-summary::-webkit-details-marker,
.property-layout-section > summary::-webkit-details-marker {
    display: none;
}

.card-layout-collapsible-summary > span:nth-child(2),
.property-layout-section .field-layout-section-heading > span:nth-child(2) {
    display: grid;
    min-width: 0;
}

.card-layout-collapsible-summary strong,
.property-layout-section summary strong {
    font-size: 1rem;
}

.card-layout-collapsible-summary small,
.property-layout-section summary small {
    overflow: hidden;
    color: var(--muted);
    font-size: .8rem;
    font-weight: 400;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.layout-chevron {
    width: 9px;
    height: 9px;
    margin-right: 3px;
    border-right: 2px solid #698078;
    border-bottom: 2px solid #698078;
    transform: rotate(45deg);
    transition: transform .16s ease;
}

.card-layout-collapsible[open] .layout-chevron,
.property-layout-section[open] .layout-chevron {
    transform: rotate(225deg);
}

.card-layout-collapsible-body,
.property-layout-section-body {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.property-layout-section-body .field-layout-section-copy {
    margin-bottom: 12px;
}

.property-layout-columns {
    margin-top: 14px;
}

.property-layout-selected,
.property-layout-available {
    max-height: 390px;
    align-content: start;
    overflow-y: auto;
    scrollbar-color: #b9d5ca transparent;
    scrollbar-width: thin;
}

.property-layout-option small {
    max-width: 100%;
}

.property-layout-dropzone {
    grid-template-columns: repeat(3, minmax(260px, 1fr));
    min-height: 76px;
    padding: 0;
}

.property-layout-section.is-empty .property-layout-dropzone::before {
    min-height: 64px;
}

.property-layout-item {
    grid-template-columns: auto minmax(130px, 1fr) auto;
    min-height: 54px;
}

.property-layout-item .property-card-actions {
    display: flex;
    grid-column: 3;
    gap: 7px;
    align-items: center;
    justify-content: flex-end;
}

.property-remove-button {
    width: 31px;
    height: 31px;
    flex: 0 0 31px;
    padding: 0;
    color: #8a6762;
    background: #fff;
    border: 1px solid #ead7d4;
    border-radius: 8px;
    font-size: 19px;
    line-height: 1;
}

.property-remove-button:hover {
    color: var(--red);
    background: #fff4f2;
    border-color: #e9bdb7;
}

[data-property-section="available"] .property-remove-button {
    display: none;
}

.property-target-select {
    display: grid;
    grid-template-columns: auto minmax(120px, 170px);
    grid-column: auto !important;
    gap: 6px;
    align-items: center;
}

.property-target-select > span {
    color: var(--muted);
    font-size: .7rem;
    white-space: nowrap;
}

.property-target-select select {
    min-height: 32px;
    padding: 4px 28px 4px 8px;
    font-size: .76rem;
    background-color: #fff;
    border: 1px solid var(--border);
    border-radius: 7px;
}

.property-layout-item.is-dragging {
    opacity: .35;
}

.is-dragging-property .property-layout-section {
    border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
}

@media (max-width: 1250px) {
    .property-layout-dropzone {
        grid-template-columns: repeat(2, minmax(250px, 1fr));
    }

    .property-layout-item {
        grid-template-columns: auto minmax(120px, 1fr) auto;
    }

    .property-layout-item .property-card-actions {
        grid-column: 2;
        justify-content: flex-start;
    }
}

@media (max-width: 700px) {
    .card-layout-collapsible-summary {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .property-layout-section > summary {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .card-layout-collapsible-summary .field-layout-count,
    .property-layout-section > summary .field-layout-count {
        display: none;
    }

    .property-layout-dropzone {
        grid-template-columns: 1fr;
    }

    .property-target-select {
        grid-template-columns: 1fr;
    }
}
/* Резервные копии */
.backup-page-heading { align-items: center; }
.backup-health { display: inline-flex; align-items: center; gap: 9px; padding: 9px 13px; border-radius: 999px; background: #fff; border: 1px solid var(--border); color: var(--muted); font-size: .82rem; font-weight: 700; }
.backup-health i, .backup-agent-status i { width: 9px; height: 9px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 5px #fff0ee; flex: 0 0 auto; }
.backup-health.is-ready i, .backup-agent-status:not(.has-error) i { background: var(--primary); box-shadow: 0 0 0 5px #e3f7ef; }
.backup-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(320px, .75fr); gap: 22px; align-items: start; }
.backup-schedule-card, .backup-manual-card, .backup-list-card { padding: 24px; }
.backup-schedule-card .panel-header, .backup-manual-card .panel-header, .backup-list-card .panel-header { padding: 0 0 20px; margin-bottom: 20px; }
.backup-schedule-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.backup-main-toggle { background: #f1faf6; border-color: #cfe9de; }
.backup-agent-status { display: flex; align-items: flex-start; gap: 13px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: #f8fbfa; }
.backup-agent-status i { margin-top: 5px; }
.backup-agent-status > div { display: grid; gap: 3px; min-width: 0; }
.backup-agent-status small { color: var(--muted); overflow-wrap: anywhere; }
.backup-agent-status.is-inactive i { background: #98a6a0; box-shadow: 0 0 0 5px #edf2f0; }
.backup-last-run { background: #fff; }
[data-schedule-field][hidden], [data-cleanup-field][hidden] { display: none !important; }
.backup-requirements { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 20px; margin-top: 20px; border-top: 1px solid var(--border); }
.backup-requirements strong { width: 100%; margin-bottom: 3px; }
.backup-requirements span { padding: 5px 9px; border-radius: 999px; font-size: .72rem; font-weight: 700; background: #f0f2f5; color: #6d7888; }
.backup-requirements span.is-ok { background: #e7f8f1; color: #087653; }
.backup-requirements span.is-bad { background: #fff0ee; color: #a13a30; }
.backup-list-card { margin-top: 22px; }
.backup-list { display: grid; }
.backup-item { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; align-items: center; gap: 15px; padding: 15px 0; border-bottom: 1px solid var(--border); }
.backup-item:last-child { border-bottom: 0; padding-bottom: 0; }
.backup-file-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: #eef3f7; color: #526274; font-size: .68rem; font-weight: 800; }
.backup-file-icon.is-encrypted { background: #e3f7ef; color: #07835c; font-size: 1rem; }
.backup-item-copy { display: grid; gap: 3px; min-width: 0; }
.backup-item-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.backup-item-copy span { color: var(--muted); font-size: .78rem; }
.backup-item-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.backup-item-actions form { margin: 0; }
.backup-empty { display: grid; justify-items: center; gap: 5px; padding: 42px 20px; color: var(--muted); text-align: center; }
.backup-empty strong { color: var(--text); font-size: 1rem; }

@media (max-width: 1100px) {
    .backup-layout { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .brand-logo-setting {
        grid-template-columns: 1fr;
    }

    .brand-logo-preview {
        width: 100%;
    }

    .backup-schedule-grid { grid-template-columns: 1fr; }
    .backup-item { grid-template-columns: 42px minmax(0, 1fr); }
    .backup-item-actions { grid-column: 1 / -1; justify-content: flex-start; }
    .backup-page-heading { align-items: flex-start; }
}

/* Доступный интерфейс: простой режим и понятные ежедневные сценарии. */
.simple-client-list,
.client-form-progress,
.simple-details-toggle,
.wizard-actions,
.optional-section-toggle,
.logout-button b,
.labeled-icon-button b { display: none; }

.ui-mode-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ui-mode-option { display: block; cursor: pointer; }
.ui-mode-option input { position: absolute; opacity: 0; pointer-events: none; }
.ui-mode-option > span { min-height: 112px; display: flex; flex-direction: column; justify-content: center; gap: 7px; padding: 20px; border: 2px solid var(--border); border-radius: 16px; background: #fff; transition: border-color .18s ease, box-shadow .18s ease, background .18s ease; }
.ui-mode-option strong { font-size: 18px; color: var(--text); }
.ui-mode-option small { color: var(--muted); line-height: 1.45; }
.ui-mode-option input:checked + span { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 4px rgba(16, 185, 129, .12); }
.ui-mode-option input:focus-visible + span { outline: 3px solid rgba(16, 185, 129, .3); outline-offset: 3px; }
.ui-mode-link { min-height: 40px; display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; border: 1px solid var(--border); border-radius: 12px; color: var(--muted); font-size: 13px; font-weight: 700; text-decoration: none; background: #fff; }
.ui-mode-link:hover { color: var(--primary-dark); border-color: #a9ddca; background: #f3faf7; }
.ui-mode-link span { color: var(--primary-dark); font-weight: 900; }

.draft-recovery-banner { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; margin-bottom: 18px; padding: 16px 18px; border-color: #9bd8c5; background: #f2fbf7; }
.draft-recovery-banner[hidden] { display: none; }
.draft-recovery-icon, .getting-started-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; border-radius: 12px; background: #dff6ec; color: #087a58; font-size: 19px; font-weight: 800; }
.draft-recovery-banner strong, .draft-recovery-banner p { display: block; margin: 0; }
.draft-recovery-banner p { margin-top: 3px; color: var(--muted); }
.draft-recovery-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.getting-started { display: grid; grid-template-columns: minmax(230px, .8fr) minmax(460px, 1.4fr) auto; align-items: center; gap: 24px; margin-bottom: 20px; padding: 18px 22px; border-color: #bce7d7; background: linear-gradient(135deg, #f2fbf7, #fff); }
.getting-started[hidden] { display: none; }
.getting-started > div { display: flex; align-items: center; gap: 12px; }
.getting-started strong, .getting-started p { display: block; margin: 0; }
.getting-started p { color: var(--muted); margin-top: 2px; }
.getting-started nav { display: flex; gap: 8px; flex-wrap: wrap; }
.getting-started nav a, .getting-started > button { min-height: 42px; display: inline-flex; align-items: center; padding: 9px 14px; border: 1px solid var(--border); border-radius: 12px; background: #fff; color: var(--text); font-weight: 700; text-decoration: none; }
.getting-started > button { color: var(--primary-dark); }

.today-panel { margin-bottom: 22px; padding: 0; overflow: hidden; }
.today-panel .panel-header { padding: 22px 24px; }
.today-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--border); }
.today-action { min-height: 154px; display: grid; grid-template-columns: auto 1fr; grid-template-areas: "icon count" "title title" "copy copy"; align-content: center; gap: 5px 12px; padding: 22px; color: var(--text); text-decoration: none; border-right: 1px solid var(--border); background: #fff; transition: background .18s ease; }
.today-action:last-child { border-right: 0; }
.today-action:hover { background: #f7fcfa; color: var(--text); }
.today-action > span { grid-area: icon; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--primary-soft); color: var(--primary-dark); font-size: 18px; font-weight: 800; }
.today-action > b { grid-area: count; align-self: center; font-size: 30px; line-height: 1; }
.today-action > strong { grid-area: title; margin-top: 8px; font-size: 16px; }
.today-action > small { grid-area: copy; color: var(--muted); }
.today-action.is-urgent { background: #fff8f5; }
.today-action.is-urgent > span { background: #fee9df; color: #b94b19; }

.client-next-step { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; margin: 16px 0; padding: 18px 20px; border-color: #a9ddca; background: linear-gradient(135deg, #f0faf6, #fff); }
.client-next-step-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--primary); color: #fff; font-size: 22px; font-weight: 800; }
.client-next-step > div { display: grid; gap: 2px; }
.client-next-step small, .client-next-step span { color: var(--muted); }
.client-next-step strong { font-size: 18px; }
.client-next-step.is-empty .client-next-step-icon { background: #dff6ec; color: var(--primary-dark); }

body[data-ui-mode="simple"] { font-size: 17px; line-height: 1.55; }
body[data-ui-mode="simple"] :focus-visible { outline: 3px solid rgba(8, 122, 88, .42); outline-offset: 3px; }
body[data-ui-mode="simple"] .advanced-only, body[data-ui-mode="simple"] .nav-admin-item { display: none !important; }
body[data-ui-mode="simple"] .content { padding-top: 30px; }
body[data-ui-mode="simple"] .page-heading h1, body[data-ui-mode="simple"] .record-heading h1 { font-size: clamp(30px, 2.4vw, 40px); line-height: 1.18; }
body[data-ui-mode="simple"] .page-heading p, body[data-ui-mode="simple"] .panel-header p, body[data-ui-mode="simple"] .field-hint { font-size: 15px; line-height: 1.5; }
body[data-ui-mode="simple"] .button, body[data-ui-mode="simple"] .icon-button, body[data-ui-mode="simple"] input, body[data-ui-mode="simple"] select, body[data-ui-mode="simple"] textarea { min-height: 48px; font-size: 16px; }
body[data-ui-mode="simple"] .button.button-compact { min-height: 44px; padding-inline: 15px; }
body[data-ui-mode="simple"] .nav-link { min-height: 52px; font-size: 16px; }
body[data-ui-mode="simple"] .nav-label, body[data-ui-mode="simple"] .profile-copy strong { font-size: 16px; }
body[data-ui-mode="simple"] .logout-button { width: auto; min-width: 48px; padding-inline: 13px; gap: 7px; }
body[data-ui-mode="simple"] .logout-button b { display: inline; font-size: 15px; }

body[data-ui-mode="simple"] .client-form-progress { display: grid; grid-template-columns: repeat(4, minmax(110px, 1fr)); gap: 8px; margin-bottom: 18px; padding: 12px; }
body[data-ui-mode="simple"] .client-form-progress button { min-height: 58px; display: flex; align-items: center; justify-content: center; gap: 9px; border: 1px solid transparent; border-radius: 12px; background: transparent; color: var(--muted); font-weight: 700; }
body[data-ui-mode="simple"] .client-form-progress button b { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #edf2f0; color: #5a6b65; }
body[data-ui-mode="simple"] .client-form-progress button.is-active { border-color: #a9ddca; background: var(--primary-soft); color: var(--primary-dark); }
body[data-ui-mode="simple"] .client-form-progress button.is-active b, body[data-ui-mode="simple"] .client-form-progress button.is-complete b { background: var(--primary); color: #fff; }
body[data-ui-mode="simple"] .client-form-progress > small { grid-column: 1 / -1; text-align: center; color: var(--muted); font-weight: 700; }
body[data-ui-mode="simple"] .record-form[data-client-form] .form-layout { grid-template-columns: minmax(0, 1fr); }
body[data-ui-mode="simple"] .record-form[data-client-form] [data-form-step]:not(.is-active) { display: none; }
body[data-ui-mode="simple"] .record-form[data-client-form] .form-section { padding: 26px; }
body[data-ui-mode="simple"] .optional-section-toggle { display: inline-flex; margin-left: auto; }
body[data-ui-mode="simple"] .optional-form-section:not(.is-expanded) > .form-grid { display: none; }
body[data-ui-mode="simple"] .optional-form-section:not(.is-expanded) { padding-bottom: 20px; }
body[data-ui-mode="simple"] .optional-form-section .section-heading { margin-bottom: 0; }
body[data-ui-mode="simple"] .optional-form-section.is-expanded .section-heading { margin-bottom: 22px; }
body[data-ui-mode="simple"] .record-form[data-client-form] .form-sidebar { position: sticky; bottom: 12px; z-index: 20; }
body[data-ui-mode="simple"] .record-form[data-client-form] .sticky-actions { display: grid; grid-template-columns: minmax(180px, 1fr) auto auto; align-items: center; gap: 12px; padding: 14px 18px; box-shadow: 0 14px 38px rgba(15, 50, 40, .16); }
body[data-ui-mode="simple"] .record-form[data-client-form] .sticky-actions h3, body[data-ui-mode="simple"] .record-form[data-client-form] .sticky-actions p, body[data-ui-mode="simple"] .record-form[data-client-form] .keyboard-hint { display: none; }
body[data-ui-mode="simple"] .record-form[data-client-form] .wizard-actions { display: flex; gap: 10px; }
body[data-ui-mode="simple"] .record-form[data-client-form] .wizard-actions .button, body[data-ui-mode="simple"] .record-form[data-client-form] [data-final-submit], body[data-ui-mode="simple"] .record-form[data-client-form] .sticky-actions > .button-ghost { width: auto; min-width: 150px; }

body[data-ui-mode="simple"] .simple-client-list { display: block; padding: 0; overflow: hidden; }
.simple-client-list-heading { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 20px 22px; border-bottom: 1px solid var(--border); }
.simple-client-list-heading div { display: grid; gap: 2px; }
.simple-client-list-heading small { color: var(--muted); }
.simple-client-list-heading > span { min-width: 44px; padding: 6px 11px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-dark); font-weight: 800; text-align: center; }
.simple-client-card { min-height: 88px; display: grid; grid-template-columns: auto minmax(240px, 1.5fr) minmax(170px, .9fr) minmax(150px, .8fr) auto auto; align-items: center; gap: 16px; padding: 16px 20px; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border); background: #fff; transition: background .18s ease, box-shadow .18s ease; }
.simple-client-card:last-child { border-bottom: 0; }
.simple-client-card:hover, .simple-client-card:focus-visible { background: #f4fbf8; color: var(--text); box-shadow: inset 4px 0 var(--primary); }
.simple-client-main, .simple-client-contact, .simple-client-assignee { min-width: 0; display: grid; gap: 2px; }
.simple-client-main strong { overflow: hidden; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.simple-client-card small { color: var(--muted); font-size: 13px; }
.simple-client-contact b, .simple-client-assignee b { overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.simple-client-open { color: var(--primary-dark); font-weight: 800; white-space: nowrap; }

body[data-ui-mode="simple"] .simple-details-toggle { display: inline-flex; margin: 0 0 16px; }
body[data-ui-mode="simple"] .detail-main:not(.show-simple-details) .custom-section, body[data-ui-mode="simple"] .detail-main:not(.show-simple-details) [data-show-empty-fields] { display: none; }
body[data-ui-mode="simple"] .labeled-icon-button { width: auto; padding-inline: 13px; gap: 7px; }
body[data-ui-mode="simple"] .labeled-icon-button b { display: inline; font-size: 14px; }

@media (max-width: 1199.98px) {
    .today-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .today-action:nth-child(2) { border-right: 0; }
    .today-action:nth-child(-n + 2) { border-bottom: 1px solid var(--border); }
    .getting-started { grid-template-columns: 1fr; }
    .simple-client-card { grid-template-columns: auto minmax(220px, 1fr) minmax(160px, .8fr) auto; }
    .simple-client-assignee, .simple-client-card .status { display: none; }
}

@media (max-width: 767.98px) {
    .ui-mode-options, .today-actions { grid-template-columns: 1fr; }
    .today-action, .today-action:nth-child(2) { border-right: 0; border-bottom: 1px solid var(--border); }
    .today-action:last-child { border-bottom: 0; }
    .client-next-step, .draft-recovery-banner { grid-template-columns: 1fr; }
    body[data-ui-mode="simple"] .client-form-progress { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    body[data-ui-mode="simple"] .record-form[data-client-form] .sticky-actions { grid-template-columns: 1fr; }
    body[data-ui-mode="simple"] .record-form[data-client-form] .wizard-actions, body[data-ui-mode="simple"] .record-form[data-client-form] .wizard-actions .button, body[data-ui-mode="simple"] .record-form[data-client-form] [data-final-submit], body[data-ui-mode="simple"] .record-form[data-client-form] .sticky-actions > .button-ghost { width: 100%; }
    .simple-client-card { grid-template-columns: auto minmax(0, 1fr); gap: 10px 12px; }
    .simple-client-contact, .simple-client-open { grid-column: 2; }
    .simple-client-open { margin-top: 4px; }
}

/* Продажи: простые сделки и товарные позиции. */
.sales-page-heading {
    margin-bottom: 20px;
}

.sales-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.sales-metric-card {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
}

.sales-metric-icon {
    display: grid;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    place-items: center;
    color: #157455;
    background: #e8f7f1;
    border-radius: 13px;
    font-size: 20px;
    font-weight: 800;
}

.sales-metric-card.is-success .sales-metric-icon {
    color: #087653;
    background: #dff6ed;
}

.sales-metric-card.is-warning .sales-metric-icon {
    color: #a2590b;
    background: #fff0da;
}

.sales-metric-card > div {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.sales-metric-card small,
.sales-metric-card span {
    color: var(--muted);
}

.sales-metric-card strong {
    overflow: hidden;
    color: var(--text);
    font-size: clamp(20px, 1.7vw, 27px);
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.deal-stage-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    padding: 3px 2px 8px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.deal-stage-tabs a {
    display: inline-flex;
    min-height: 42px;
    flex: 0 0 auto;
    align-items: center;
    gap: 9px;
    padding: 8px 13px;
    color: #53655e;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 11px;
    text-decoration: none;
    font-weight: 700;
}

.deal-stage-tabs a:hover,
.deal-stage-tabs a.is-active {
    color: var(--primary-dark);
    background: var(--primary-soft);
    border-color: #9ed8c3;
}

.deal-stage-tabs b {
    min-width: 25px;
    padding: 3px 7px;
    background: rgba(16, 143, 105, .1);
    border-radius: 999px;
    font-size: 12px;
    text-align: center;
}

.deal-stage-tabs .stage-lost.is-active,
.deal-stage-tabs .stage-lost:hover {
    color: #9c3933;
    background: #fff0ee;
    border-color: #efc2bd;
}

.sales-filter-panel {
    margin-bottom: 18px;
    padding: 16px 18px;
}

.sales-filter-form {
    display: grid;
    grid-template-columns: minmax(260px, 1.5fr) repeat(3, minmax(160px, .75fr)) auto auto;
    gap: 10px;
    align-items: end;
}

.sales-filter-form .field {
    margin: 0;
}

.sales-filter-form .button {
    min-height: 44px;
}

.deals-list-panel {
    padding: 0;
    overflow: hidden;
}

.deals-list-panel > .panel-header {
    padding: 18px 20px;
}

.deals-table-wrap,
.deal-products-table-wrap {
    overflow-x: auto;
}

.deals-table,
.deal-products-table {
    width: 100%;
    border-collapse: collapse;
}

.deals-table {
    min-width: 1050px;
}

.deals-table th,
.deals-table td,
.deal-products-table th,
.deal-products-table td {
    padding: 13px 15px;
    border-top: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

.deals-table th,
.deal-products-table th {
    color: #74847d;
    background: #f8faf9;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.deals-table tbody tr:hover {
    background: #f7fcfa;
}

.deal-main-cell {
    display: grid;
    min-width: 210px;
    gap: 3px;
    color: var(--text);
    text-decoration: none;
}

.deal-main-cell small,
.deal-table-subline {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.deal-main-cell strong {
    font-size: 15px;
}

.deal-stage-badge {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    padding: 4px 10px;
    color: #315e50;
    background: #e8f3ef;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.deal-stage-badge.stage-new { color: #345e8c; background: #eaf2fb; }
.deal-stage-badge.stage-qualification { color: #745b16; background: #fff4d8; }
.deal-stage-badge.stage-proposal { color: #6851a2; background: #f0ebff; }
.deal-stage-badge.stage-negotiation { color: #9a5b0a; background: #ffeed9; }
.deal-stage-badge.stage-won { color: #087653; background: #dff6ed; }
.deal-stage-badge.stage-lost { color: #a13a30; background: #fff0ee; }

.deal-stage-badge-large {
    min-height: 38px;
    padding: 8px 14px;
    font-size: 14px;
}

.deal-date-overdue {
    color: #a13a30;
    font-weight: 700;
}

.deal-date-overdue small {
    display: block;
    font-size: 11px;
}

.money-cell {
    text-align: right !important;
    white-space: nowrap;
}

.sales-empty {
    display: grid;
    justify-items: center;
    gap: 7px;
    padding: 54px 20px;
    color: var(--muted);
    text-align: center;
}

.sales-empty > span {
    display: grid;
    width: 58px;
    height: 58px;
    place-items: center;
    color: var(--primary);
    background: var(--primary-soft);
    border-radius: 18px;
    font-size: 26px;
    font-weight: 800;
}

.sales-empty h2,
.sales-empty p {
    margin: 0;
}

.sales-empty h2 {
    color: var(--text);
}

.sales-empty .button {
    margin-top: 9px;
}

.deal-form,
.sales-form-heading,
.deal-detail-heading,
.deal-summary-grid,
.deal-detail-layout {
    width: 100%;
    max-width: none;
}

.deal-form-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 18px;
    align-items: start;
}

.deal-form-main {
    display: grid;
    gap: 18px;
    min-width: 0;
}

.deal-form-section {
    padding: 22px;
}

.deal-form-section .section-heading {
    margin-bottom: 20px;
}

.deal-items-heading {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
}

.deal-items-heading .button {
    align-self: center;
}

.deal-items-table {
    display: grid;
    gap: 7px;
}

.deal-item-head,
.deal-item-row {
    display: grid;
    grid-template-columns: minmax(220px, 2.4fr) minmax(100px, .7fr) minmax(70px, .45fr) minmax(130px, .9fr) minmax(130px, .9fr) 36px;
    gap: 8px;
    align-items: center;
}

.deal-item-head {
    padding: 0 2px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.deal-item-row {
    padding: 8px;
    background: #f8faf9;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.deal-item-row .form-control {
    min-width: 0;
    min-height: 42px;
}

.deal-item-field { min-width: 0; margin: 0; }
.deal-item-field > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.deal-item-total {
    overflow: hidden;
    font-size: 14px;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.deal-item-remove {
    display: grid;
    width: 34px;
    height: 34px;
    padding: 0;
    place-items: center;
    color: #a13a30;
    background: #fff;
    border: 1px solid #ecd2ce;
    border-radius: 9px;
    font-size: 22px;
}

.deal-item-remove:hover {
    background: #fff0ee;
}

.deal-items-error {
    margin-bottom: 12px;
    padding: 10px 12px;
    color: #8b302a;
    background: #fff0ee;
    border-radius: 10px;
}

.deal-items-summary {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 20px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.deal-items-summary span {
    color: var(--muted);
    font-weight: 700;
}

.deal-items-summary strong {
    min-width: 150px;
    font-size: 22px;
    text-align: right;
}

.deal-form-aside {
    position: sticky;
    top: 96px;
}

.deal-save-card {
    display: grid;
    gap: 10px;
    padding: 20px;
}

.deal-save-card > span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.deal-save-card > strong {
    font-size: 27px;
}

.deal-save-card > p {
    margin: -4px 0 8px;
    color: var(--muted);
    font-size: 13px;
}

.deal-detail-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.deal-detail-heading h1 {
    margin: 5px 0 4px;
    font-size: clamp(29px, 3vw, 42px);
}

.deal-detail-heading p {
    margin: 0;
    color: var(--muted);
}

.deal-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.deal-summary-grid > section {
    display: grid;
    min-width: 0;
    gap: 4px;
    padding: 17px 18px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
}

.deal-summary-grid small,
.deal-summary-grid span {
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.deal-summary-grid strong {
    overflow: hidden;
    font-size: 19px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.deal-summary-grid .is-overdue {
    border-color: #efc2bd;
    background: #fff8f7;
}

.deal-summary-grid .is-overdue strong,
.deal-summary-grid .is-overdue span {
    color: #a13a30;
}

.deal-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 18px;
    align-items: start;
}

.deal-detail-main {
    display: grid;
    gap: 18px;
    min-width: 0;
}

.deal-products-card,
.deal-notes-card,
.deal-side-card {
    padding: 20px;
}

.deal-products-card .panel-header {
    padding: 0 0 16px;
}

.deal-products-table th,
.deal-products-table td {
    padding-inline: 12px;
}

.deal-products-table th:first-child,
.deal-products-table td:first-child {
    padding-left: 0;
}

.deal-products-table th:last-child,
.deal-products-table td:last-child {
    padding-right: 0;
    text-align: right;
}

.deal-products-table tfoot td {
    padding-top: 16px;
    font-size: 18px;
    font-weight: 800;
}

.deal-products-table tfoot td:first-child {
    text-align: right;
}

.deal-items-empty {
    display: grid;
    justify-items: center;
    gap: 5px;
    padding: 36px 15px;
    color: var(--muted);
    text-align: center;
}

.deal-items-empty > span {
    font-size: 28px;
}

.deal-items-empty p {
    margin: 0;
}

.deal-notes-card h2,
.deal-side-card h2 {
    margin: 0 0 14px;
    font-size: 18px;
}

.deal-notes-card p {
    margin: 0;
    line-height: 1.6;
}

.deal-side-card dl {
    display: grid;
    gap: 12px;
    margin: 0 0 18px;
}

.deal-side-card dl > div {
    display: grid;
    gap: 2px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.deal-side-card dt {
    color: var(--muted);
    font-size: 12px;
}

.deal-side-card dd {
    margin: 0;
    font-weight: 700;
}

.client-deals-list {
    display: grid;
}

.client-deals-list > a {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto minmax(130px, auto) 20px;
    gap: 14px;
    align-items: center;
    padding: 13px 0;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    text-decoration: none;
}

.client-deals-list > a:last-child {
    border-bottom: 0;
}

.client-deals-list > a:hover strong {
    color: var(--primary);
}

.client-deals-list > a > span:first-child {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.client-deals-list small {
    color: var(--muted);
}

.client-deals-list strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.client-deals-list b {
    text-align: right;
    white-space: nowrap;
}

.client-deals-list i {
    color: var(--primary);
    font-size: 24px;
    font-style: normal;
}

@media (max-width: 1250px) {
    .sales-filter-form {
        grid-template-columns: minmax(240px, 1.4fr) repeat(3, minmax(145px, .8fr));
    }

    .sales-filter-form .button {
        width: 100%;
    }

    .deal-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1050px) {
    .sales-metrics {
        grid-template-columns: 1fr;
    }

    .sales-filter-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sales-search-field {
        grid-column: 1 / -1;
    }

    .deal-form-layout,
    .deal-detail-layout {
        grid-template-columns: 1fr;
    }

    .deal-form-aside {
        position: static;
    }

    .deal-save-card {
        grid-template-columns: minmax(0, 1fr) auto auto;
        align-items: center;
    }

    .deal-save-card > p {
        display: none;
    }

    .deal-save-card .button {
        width: auto;
    }
}

@media (max-width: 760px) {
    .sales-filter-form,
    .deal-summary-grid {
        grid-template-columns: 1fr;
    }

    .sales-search-field {
        grid-column: auto;
    }

    .deal-detail-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .deal-detail-heading .record-actions {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
    }

    .deal-detail-heading .record-actions .button,
    .deal-detail-heading .record-actions form,
    .deal-detail-heading .record-actions form .button {
        width: 100%;
    }

    .deal-items-heading {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .deal-items-heading .button {
        grid-column: 1 / -1;
        width: 100%;
    }

    .deal-item-head {
        display: none;
    }

    .deal-item-row {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 36px;
    }

    .deal-item-row .deal-item-name-field {
        grid-column: 1 / -1;
    }

    .deal-item-row .deal-item-field:nth-child(3) {
        grid-column: 1;
    }

    .deal-item-total {
        grid-column: 1 / 3;
        text-align: left;
    }

    .deal-item-remove {
        grid-column: 3;
        grid-row: 2;
    }

    .deal-items-summary {
        justify-content: space-between;
    }

    .deal-save-card {
        grid-template-columns: 1fr;
    }

    .deal-save-card .button {
        width: 100%;
    }

    .client-deals-list > a {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .client-deals-list .deal-stage-badge {
        justify-self: start;
    }

    .client-deals-list b {
        grid-column: 1;
        text-align: left;
    }

    .client-deals-list i {
        grid-column: 2;
        grid-row: 1 / 3;
    }
}

/* Единые правила для панелей действий и компактных кнопок. */
.ui-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

.button {
    flex: 0 0 auto;
    max-width: 100%;
    white-space: nowrap;
    transform: none !important;
    transition: box-shadow .14s ease, background-color .14s ease, border-color .14s ease, color .14s ease;
}

.button:hover,
.button:focus-visible,
.button:active {
    transform: none !important;
}

.button-icon {
    width: 42px;
    min-width: 42px;
    height: 42px;
    padding: 0;
}

.button-compact.button-icon {
    width: 38px;
    min-width: 38px;
    min-height: 38px;
    height: 38px;
    padding: 0;
}

.icon-button .ui-icon,
.row-menu .ui-icon {
    width: 17px;
    height: 17px;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.panel-header,
.panel-header > :first-child,
.page-heading,
.page-heading > :first-child {
    min-width: 0;
}

.panel-header > .button,
.panel-header > form,
.panel-header > form .button,
.page-heading > .button,
.page-heading > form,
.page-heading > form .button {
    flex: 0 0 auto;
}

.page-actions,
.record-actions,
.form-actions,
.table-actions,
.topbar-actions,
.contact-card-actions,
.activity-actions,
.client-table-settings-actions,
.selected-column-actions,
.saved-view-edit-actions,
.smart-list-actions,
.draft-recovery-actions,
.notification-card-actions,
.notification-rule-card-actions,
.backup-item-actions,
.saved-view-manager-row > div,
.smart-list-management-row > div {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
}

.record-actions form,
.notification-card-actions form,
.notification-rule-card-actions form,
.backup-item-actions form,
.saved-view-manager-row form,
.smart-list-management-row form {
    flex: 0 0 auto;
    margin: 0;
}

[data-href] {
    cursor: pointer;
}

.data-table tbody tr[data-href]:hover,
.contact-client-table tbody tr[data-href]:hover {
    background: #f4fbf8;
}

/* Вся карточка уже открывает запись, поэтому отдельная колонка действия не нужна. */
.simple-client-card {
    grid-template-columns: auto minmax(240px, 1.5fr) minmax(170px, .9fr) minmax(150px, .8fr) auto;
}

.simple-deal-card {
    grid-template-columns: 40px minmax(210px, 1.25fr) minmax(190px, .9fr) minmax(135px, .65fr) minmax(145px, .72fr) 128px 120px;
}

.client-deals-list > .client-deal-card {
    grid-template-columns: minmax(220px, 1fr) auto minmax(125px, auto);
}

@media (max-width: 1350px) {
    .simple-deal-card {
        grid-template-columns: 40px minmax(210px, 1.2fr) minmax(180px, .9fr) minmax(135px, .65fr) 128px 120px;
    }
}

@media (max-width: 1199.98px) {
    .simple-client-card {
        grid-template-columns: auto minmax(220px, 1fr) minmax(160px, .8fr);
    }
}

@media (max-width: 1050px) {
    .simple-deal-card {
        grid-template-columns: 40px minmax(210px, 1.2fr) minmax(170px, .8fr) 128px 120px;
    }
}

@media (max-width: 760px) {
    .simple-client-card {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .simple-client-contact {
        grid-column: 2;
    }

    .simple-deal-card {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .deal-detail-heading .record-actions,
    .contact-detail-heading .record-actions {
        width: 100%;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
    }

    .deal-detail-heading .record-actions form,
    .deal-detail-heading .record-actions form .button,
    .contact-detail-heading .record-actions form,
    .contact-detail-heading .record-actions form .button {
        width: auto;
    }

    .notification-card-actions {
        align-items: center;
        flex-direction: row;
    }

    .notification-card-actions .button {
        width: auto;
    }

    .client-deals-list > .client-deal-card {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .client-deal-amount {
        grid-column: 1;
        text-align: left;
    }
}

/* Исправления проверки интерфейса: 19.10.2026. */
.field-hint,
.field small:not(.field-error),
.table-secondary { color: #566474; }
.data-table th { color: #566474; }
.deal-party-input > input { padding-left: 40px; padding-right: 42px; }
input::placeholder,
textarea::placeholder { color: #657182; opacity: 1; }
.client-next-step .client-next-step-icon { color: #fff; }
.client-next-step.is-empty .client-next-step-icon { color: var(--primary-dark); }
.client-detail-heading { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.client-detail-heading .record-title,
.client-detail-heading .record-title-row,
.client-detail-heading .record-title-row > div { min-width: 0; }
.client-detail-heading h1 { overflow-wrap: anywhere; }
.client-detail-heading .record-actions { flex-wrap: wrap; justify-content: flex-start; min-width: 0; }
.client-detail-heading .record-actions > .button { width: auto; }
.action-menu { position: relative; margin: 0; }
.action-menu > summary { list-style: none; cursor: pointer; }
.action-menu > summary::-webkit-details-marker { display: none; }
.action-menu-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; display: grid; gap: 6px; width: max-content; max-width: min(300px, calc(100vw - 40px)); padding: 10px; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-md); }
.action-menu-panel .button { width: 100%; justify-content: flex-start; white-space: normal; }
.layout-order-controls { display: flex; align-items: center; gap: 4px; }
.summary-layout-item { grid-template-columns: 24px minmax(0, 1fr) auto auto; }
.summary-layout-item > span { min-width: 0; overflow-wrap: anywhere; }
.summary-layout-item .layout-order-controls button { display: grid; place-items: center; width: 36px; height: 36px; padding: 5px; color: var(--primary-dark); background: #f2f7f5; border: 1px solid var(--border); border-radius: 8px; }
.layout-order-controls button[aria-disabled="true"] { opacity: .4; cursor: default; }
.getting-started { display: block; padding: 0; }
.getting-started > summary { display: flex; align-items: center; gap: 12px; padding: 16px 20px; cursor: pointer; list-style: none; }
.getting-started > summary::after { content: '+'; margin-left: auto; color: var(--primary-dark); font-size: 24px; }
.getting-started[open] > summary::after { content: '−'; }
.getting-started > summary::-webkit-details-marker { display: none; }
.getting-started > .getting-started-body { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 0 20px 16px; }
.getting-started-body > button { min-height: 42px; padding: 9px 14px; border: 1px solid var(--border); border-radius: 12px; color: var(--primary-dark); background: #fff; font-weight: 700; }
.mobile-navigation-open { overflow: hidden; }
body[data-ui-mode="simple"] .record-form[data-client-form] .form-sidebar { position: static; order: 0; }
body[data-ui-mode="simple"] .record-form[data-client-form] .wizard-actions { flex-wrap: wrap; }
body[data-ui-mode="simple"] .record-form[data-client-form][data-quick="1"] [data-form-step="1"] { display: block; }
body[data-ui-mode="simple"] .record-form[data-client-form][data-quick="1"] .client-form-progress,
body[data-ui-mode="simple"] .record-form[data-client-form][data-quick="1"] .wizard-actions { display: none; }

@media (max-width: 1250px) and (min-width: 761px) {
    .deal-item-head, .deal-item-row { grid-template-columns: minmax(130px, 2fr) minmax(70px, 1fr) minmax(55px, .6fr) minmax(85px, 1fr) minmax(85px, 1fr) 36px; }
}
@media (max-width: 960px) {
    .record-form[data-client-form] .form-sidebar { order: 0; }
    .record-form[data-client-form] .sticky-actions { grid-template-columns: minmax(0, 1fr); }
    .record-form[data-client-form] .sticky-actions .button { width: 100%; white-space: normal; }
}
@media (max-width: 760px) {
    .deal-item-field > span { display: block; position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal; margin-bottom: 5px; color: #566474; font-size: 12px; font-weight: 700; }
    .client-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .client-summary-grid > div { min-width: 0; overflow-wrap: anywhere; }
    .contact-card { grid-template-columns: 40px minmax(0, 1fr); }
    .contact-card > div { min-width: 0; overflow-wrap: anywhere; }
    .contact-card .contact-card-actions { grid-column: 2; flex-wrap: wrap; }
    .deal-item-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 36px; align-items: end; }
    .deal-item-row .deal-item-field:nth-child(2) { grid-column: 1; grid-row: 2; }
    .deal-item-row .deal-item-field:nth-child(3) { grid-column: 2 / -1; grid-row: 2; }
    .deal-item-row .deal-item-field:nth-child(4) { grid-column: 1 / 3; grid-row: 3; }
    .deal-item-row .deal-item-remove { grid-column: 3; grid-row: 3; margin-bottom: 4px; }
    .deal-item-row .deal-item-total { grid-column: 1 / -1; }
    .deal-items-heading > div { min-width: 0; }
    .summary-layout-item { grid-template-columns: 18px minmax(0, 1fr) 36px; gap: 8px; }
    .summary-layout-item .layout-order-controls { grid-column: 2; grid-row: 2; }
    .summary-layout-item > button { grid-column: 3; grid-row: 1; }
    .summary-layout-item .layout-order-controls button { width: 44px; height: 44px; }
    .users-table, .users-table tbody { display: block; width: 100%; min-width: 0; }
    .users-table thead { display: none; }
    .users-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr); padding: 16px; border-bottom: 1px solid var(--border); }
    .users-table tbody tr:last-child { border-bottom: 0; }
    .users-table tbody td { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; width: 100%; min-width: 0; height: auto; min-height: 36px; padding: 6px 0; border: 0; background: transparent; white-space: normal; overflow-wrap: anywhere; }
    .users-table tbody td:first-child { padding: 0 0 12px; }
    .users-table .department-pill { white-space: normal; }
    .users-table td[data-label]::before { content: attr(data-label); min-width: 106px; color: #566474; font-size: 12px; }
    .users-table .table-client, .users-table .table-client > span { min-width: 0; }
    .users-table .table-client strong, .users-table .table-client small { white-space: normal; overflow-wrap: anywhere; }
    .users-table .table-client .avatar { flex-shrink: 0; }
    .users-table .table-actions { flex-wrap: wrap; }
    .users-table .row-menu { width: 44px; height: 44px; }
    .today-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .today-panel .panel-header { padding: 16px; align-items: stretch; flex-direction: column; gap: 12px; }
    .today-action { min-height: 154px; padding: 14px 12px; gap: 6px; border-right: 1px solid var(--border); }
    .today-action:nth-child(2n) { border-right: 0; }
    .today-action:nth-child(n + 3) { border-bottom: 0; }
    .today-action > strong { font-size: 14px; overflow-wrap: anywhere; }
    .today-action > small { font-size: 12px; }
    .today-action > span { width: 30px; height: 30px; }
    .today-action > b { font-size: 25px; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .metric-card { min-height: 132px; grid-template-columns: 1fr; gap: 8px; padding: 14px; }
    .metric-card .metric-icon { display: none; }
    .metric-card a { grid-column: 1; white-space: normal; }
    .getting-started p { font-size: 12px; }
}
@media (max-width: 720px) {
    .topbar .topbar-action-label,
    body[data-ui-mode="simple"] .topbar .logout-button b { display: none; }
    .topbar .topbar-new-client,
    body[data-ui-mode="simple"] .topbar .topbar-new-client { width: 42px; min-width: 42px; padding: 0; }
    body[data-ui-mode="simple"] .topbar .logout-button { width: 42px; min-width: 42px; padding: 0; }
    .topbar-actions { gap: 6px; }
    .topbar .global-search { min-width: 0; }
    .topbar .global-search input { min-width: 0; width: 100%; }
    .client-detail-heading .record-actions { gap: 8px; }
    .client-detail-heading .record-actions > .button { flex: 1 1 120px; justify-content: center; white-space: normal; }
    .client-detail-heading .record-actions > .button-icon { flex: 0 0 44px; }
    .client-detail-heading .action-menu { flex: 1 1 170px; }
    .client-detail-heading .action-menu > summary { width: 100%; }
    .client-detail-heading .action-menu-panel { width: 100%; }
    body[data-ui-mode="simple"] .record-form[data-client-form] .wizard-actions .button { flex: 1 1 120px; min-width: 0; width: auto; }
}
