﻿:root {
    --app-background: #f5f6fa;
    --app-page-padding: 1rem;
    --app-primary: #303030;
    --app-secondary: #4B1070;
    --kendo-color-primary: var(--app-primary);
    --kendo-color-secondary: var(--app-secondary);
    --app-border-subtle: color-mix(in srgb, var(--kendo-color-border) 25%, transparent);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    --small-screen: 720px;
}

* {
    box-sizing: border-box;
}

html {
    background: var(--kendo-color-surface-alt);
    min-width: 20rem;
}

body {
    background: var(--app-background);
    color: var(--kendo-color-on-app-surface);
    margin: 0;
}

button,
input,
select,
textarea {
    font: inherit;
}

a {
    color: inherit;
}

/*Removed this styling as makes inputs have odd border*/
/*a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid rgba(90, 89, 111, 0.45);
    outline-offset: 3px;
}*/

h1[tabindex="-1"]:focus {
    outline: none;
}

/* Table cell text overflow handling for virtual scrolling*/
/* Grid */
.grid-ellipsis td.k-table-td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.k-dialog {
    max-height: 90vh;
}

    /* Confirm and alert dialogs (text-only content) should not stretch edge to edge. */
    .k-dialog:has(> .k-dialog-content:not(:has(*))) {
        max-width: min(32rem, calc(100vw - 2rem));
    }

        .k-dialog:has(> .k-dialog-content:not(:has(*))) > .k-dialog-content {
            padding: 1.25rem 1.5rem;
        }

.k-tabstrip-content:focus, .k-tabstrip-content.k-focus, .k-tabstrip > .k-content:focus, .k-tabstrip > .k-content.k-focus {
    outline: none;
}

.k-tabstrip-items-wrapper .k-tabstrip-item:focus, .k-tabstrip-items-wrapper .k-tabstrip-item.k-focus, .k-tabstrip-items-wrapper .k-item:focus, .k-tabstrip-items-wrapper .k-item.k-focus {
    outline: none;
}

.k-switch:focus::after, .k-switch.k-focus::after {
    outline: none;
}

.app-icon {
    align-items: center;
    display: inline-flex;
    flex: 0 0 auto;
    justify-content: center;
    line-height: 1;
}

.app-icon--small {
    font-size: 0.875rem;
}

.app-icon--medium {
    font-size: 1rem;
}

.app-icon--large {
    font-size: 1.5rem;
}

.app-icon-button {
    min-height: 2.75rem;
    min-width: 2.75rem;
}

.app-record-reference {
    background: var(--kendo-color-base-active);
    border-radius: var(--kendo-border-radius-md);
    font-family: var(--kendo-font-family-monospace);
    font-size: var(--kendo-font-size-sm);
    white-space: nowrap;
    padding: var(--kendo-spacing-1) var(--kendo-spacing-2);
}

.app-field {
    display: grid;
    gap: 0.4rem;
    min-width: 0;
}

/* Record header fields: always reserve a line for the validation message and overlay it there,
   so showing or hiding a message never changes a field's height or moves its neighbours. */
.summary-textbox > .app-field {
    padding-block-end: 1.25rem;
    position: relative;
}

    .summary-textbox > .app-field > .validation-message {
        inset-block-end: 0;
        inset-inline: 0;
        line-height: 1.25rem;
        overflow: hidden;
        position: absolute;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .app-field > :is(label, .app-field__label) {
        color: rgb(107, 114, 128);
        text-transform: uppercase;
        font-size: var(--kendo-font-size-sm);
        letter-spacing: var(--kendo-letter-spacing-wide);
    }

    .app-field > .k-input,
    .app-field > .k-dropdownlist,
    .app-field > .k-combobox,
    .app-field > select,
    .app-field > input {
        width: 100%;
    }

    .app-field > small {
        color: #5a596f;
    }

    .app-field > .app-field__error {
        color: #a32020;
    }

/* Shared read/edit form controls. Colours intentionally follow Telerik's Fluent theme. */
.app-editable-value {
    align-items: center;
    display: flex;
    gap: var(--kendo-spacing-2);
    justify-content: space-between;
    min-height: 2rem;
    padding: var(--kendo-spacing-1) var(--kendo-spacing-2);
}

.app-editable-value--copyable {
    cursor: pointer;
}

    .app-editable-value--copyable:hover,
    .app-editable-value--copyable:focus-within {
        background: var(--kendo-color-base-active);
        border-radius: var(--kendo-border-radius-md);
    }

.app-editable-value__text {
    min-width: 0;
    overflow-wrap: anywhere;
}

.app-editable-value__text--truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-editable-value__text--title {
    font-size: var(--kendo-font-size-lg);
    font-weight: var(--kendo-font-weight-semibold);
}

.app-editable-value .app-editable-value__copy {
    flex: 0 0 auto;
}

.app-editable-value__copy {
    flex: 0 0 auto;
    opacity: 0;
}

.app-editable-value:hover .app-editable-value__copy,
.app-editable-value:focus-within .app-editable-value__copy {
    opacity: 1;
}

.app-alert {
    border: 1px solid;
    border-radius: 0.6rem;
    padding: 0.85rem 1rem;
}

.app-alert--info {
    background: #eff5ff;
    border-color: #8aa9d6;
}

.app-alert--success {
    background: #edf8f0;
    border-color: #76aa82;
}

.app-alert--warning {
    background: #fff8e8;
    border-color: #c79a3b;
}

.app-alert--error {
    background: #fff0f0;
    border-color: #c56b6b;
}

.app-chip {
    align-items: center;
    background: #ececf2;
    border: 1px solid transparent;
    border-radius: 999px;
    display: inline-flex;
    gap: 0.3rem;
    padding: 0.3rem 0.65rem;
}

.app-chip--outlined {
    background: transparent;
    border-color: #b8bac6;
}

.app-chip--primary {
    background: var(--kendo-color-primary-subtle);
    color: var(--app-primary);
}

.app-chip--success {
    background: #e5f4e8;
    color: #256033;
}

.app-chip--warning {
    background: #fff2cf;
    color: #75520a;
}

.app-chip--error {
    background: #fbe5e5;
    color: #8b2424;
}

.app-switch,
.app-checkbox {
    align-items: center;
    cursor: pointer;
    display: inline-flex;
    gap: 0.6rem;
}

.app-table-wrap {
    max-width: 100%;
    overflow-x: auto;
}

    .app-table-wrap table {
        border-collapse: collapse;
        width: 100%;
    }

    .app-table-wrap th,
    .app-table-wrap td {
        border-bottom: 1px solid #e4e5eb;
        padding: 0.8rem 0.9rem;
        text-align: left;
        vertical-align: top;
    }

    .app-table-wrap th {
        color: #5a596f;
    }

    .app-table-wrap tbody tr:hover {
        background: #f7f7fa;
    }

.app-nav-menu {
    display: grid;
    gap: 0.25rem;
}

.app-nav-link {
    align-items: center;
    display: flex;
    gap: 0.75rem;
    text-decoration: none;
}

.app-menu {
    position: relative;
}

    .app-menu > summary {
        cursor: pointer;
        list-style: none;
    }

        .app-menu > summary::-webkit-details-marker {
            display: none;
        }

.app-menu__items {
    background: #fff;
    border: 1px solid #d9dae3;
    border-radius: 0.5rem;
    box-shadow: 0 0.75rem 1.75rem rgba(48, 48, 48, 0.16);
    display: grid;
    min-width: 11rem;
    padding: 0.35rem;
    position: absolute;
    right: 0;
    top: calc(100% + 0.35rem);
    z-index: 100;
}

.app-menu__item {
    align-items: center;
    border-radius: 0.35rem;
    display: flex;
    gap: 0.55rem;
    padding: 0.65rem 0.75rem;
    text-decoration: none;
}

    .app-menu__item:hover {
        background: #f1f1f6;
    }

.app-breadcrumb-bar {
    background: transparent;
    margin: 0 0 0.75rem;
    padding: 0;
}

.app-autocomplete {
    position: relative;
}

.app-autocomplete__results {
    background: #fff;
    border: 1px solid #d9dae3;
    border-radius: 0.45rem;
    box-shadow: 0 0.75rem 1.75rem rgba(48, 48, 48, 0.14);
    left: 0;
    list-style: none;
    margin: 0;
    max-height: 16rem;
    overflow-y: auto;
    padding: 0.3rem;
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 50;
}

    .app-autocomplete__results .k-button {
        justify-content: flex-start;
        width: 100%;
    }

.app-progress {
    background: #e1e2e8;
    height: 0.25rem;
    overflow: hidden;
    position: relative;
    width: 100%;
}

    .app-progress > span {
        background: var(--app-primary);
        bottom: 0;
        left: 0;
        position: absolute;
        top: 0;
        width: 45%;
    }

.app-stack {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.app-stack--row {
    align-items: center;
    flex-direction: row;
    justify-content: center;
}

/* Shared record-page composition ---------------------------------------- */

.app-record-page {
    display: grid;
    margin: calc(var(--app-page-padding) * -1);
    min-block-size: 100dvh;
    overflow: visible;
    padding: 0 0.5rem 0.5rem;
}

    .app-record-page > form,
    .app-record-workspace {
        block-size: auto;
        min-block-size: 0;
    }

/* The sticky title bar lives inside the form, so the form must not generate a box of its own
   and the workspace must not be a grid; otherwise the bar's containing block is only as tall as the bar. */
.app-record-workspace {
    --app-record-title-bar-height: 0px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

    .app-record-workspace > .k-form {
        display: contents;
    }

    .app-record-workspace .k-form .k-form-buttons {
        display: none;
    }

    .app-record-workspace div:has(> .app-field) {
        align-content: end;
    }

/* Dock page: a fixed record header above a DockLayout that fills the rest of the viewport.
   The header (.app-dock-page__header) never scrolls or resizes with the dock; the dock
   takes the remaining height. On narrow screens the dock stacks and the page scrolls normally. */
.app-dock-page {
    block-size: 100dvh;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: calc(var(--app-page-padding) * -1);
    min-block-size: 0;
    overflow: hidden;
    padding: 0.5rem;
}

.app-dock-page__header {
    flex: none;
}

    /* A TelerikForm in the header carries the page's edit context; its default buttons are never shown. */
    .app-dock-page__header .k-form .k-form-buttons {
        display: none;
    }

    .app-dock-page__header .k-form {
        padding: 0;
    }

@media (max-width: 45rem) {
    .app-dock-page {
        block-size: auto;
        display: block;
        overflow: visible;
    }

    .app-dock-page__header {
        margin-block-end: 0.75rem;
    }
}

.app-record-title-bar {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    position: sticky;
    top: 0;
    z-index: 5;
}

    .app-record-title-bar .k-card-body {
        padding: 1rem;
    }

/* Stretch to the height of the actions' own line in the record header, not the whole header: when a narrow
   window wraps the actions below the title, height: 100% made them overflow the header and the fields below
   covered the Archive and Open Panel buttons. */
.app-record-title-bar__actions {
    align-items: start;
    align-self: stretch;
    display: flex;
    flex-wrap: wrap;
    gap: var(--kendo-spacing-1);
    justify-content: flex-end;
}

.app-record-title-bar__watchers {
    align-items: center;
    display: inline-flex;
    gap: 0.75rem;
    height: 100%;
}

.app-record-title-bar__watchers-button {
    align-self: center;
}

.app-record-title-bar__watchers-action {
    align-items: center;
    display: flex;
    height: 100%;
    justify-content: flex-end;
}

.app-record-title-bar__watcher-count {
    align-items: center;
    color: var(--kendo-color-subtle);
    display: inline-flex;
    gap: 0.25rem;
}

.app-record-title-bar__watchers-popover {
    display: grid;
    gap: 1rem;
}

.app-record-title-bar__watchers-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

.app-record-content {
    align-items: start;
    block-size: auto;
    overflow: visible;
    padding-top: 1rem;
}

.app-record-content__details {
    block-size: auto;
    display: grid;
    gap: 1rem;
    grid-template-rows: minmax(0, auto) minmax(0, 1fr);
    min-block-size: auto;
    min-inline-size: 0;
    overflow-y: visible;
    align-items: start;
}

.app-record-details-tabs {
    min-block-size: 0;
}

    .app-record-details-tabs .k-tabstrip {
        block-size: 100%;
    }

.app-record-details-tabs__placeholder {
    color: var(--kendo-color-subtle);
    padding: 1rem;
}

.app-record-details-tabs__card {
    block-size: 100%;
}

    .app-record-details-tabs__card > .k-card-body {
        block-size: 100%;
    }

        .app-record-details-tabs__card > .k-card-body > .k-tabstrip > .k-tabstrip-content {
            padding: 0.5rem 0 0;
        }

    .app-record-details-tabs__card .app-record-contacts {
        padding: 0;
    }

.app-record-contacts__grid {
    padding: 0.25rem;
}

.app-record-contacts {
    display: grid;
    gap: 1rem;
    padding: 1rem;
}

/* A tab holding a single card (the Company pane) sizes it like a card in the Individuals pane:
   the same column width as the card grid; its height comes from the shared card minimum below. */
.app-record-contacts--single-card {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 18rem));
}

    .app-record-contacts--single-card > .app-alert {
        grid-column: 1 / -1;
    }

.app-record-contacts__actions {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.app-record-contact-card {
    block-size: 100%;
    container-type: inline-size;
    /* One shared card height for Contacts, Addresses, Individuals and Company so they match exactly. */
    min-block-size: 8.875rem;
}

    .app-record-contact-card .k-card-header {
        border-bottom: 1px solid var(--app-border-subtle);
        padding: 0.65rem 1rem;
        position: relative;
    }

/* Chips (Primary, role, state) sit in the card header above the name, in normal flow, so they
   never overlap the name and are inset by the header's own padding. */
.app-record-contact-card__primary-badge {
    inline-size: fit-content;
    margin-block-end: 0.35rem;
    padding-block: 0.15rem;
    padding-inline: 0.35rem;
    position: static;
}

.app-record-contact-card__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-block-end: 0.35rem;
}

    .app-record-contact-card__badges .app-record-contact-card__primary-badge {
        margin-block-end: 0;
    }

    .app-record-contact-card__badges .app-record-contact-card__role-badge {
        border: 1px solid #000;
    }

.app-record-contact-card__name-row {
    align-items: center;
    display: grid;
    gap: 0.25rem;
    grid-template-columns: minmax(0, 1fr) auto;
}

.app-record-contacts__filter {
    margin-block-end: 0.75rem;
    width: 100%;
}

.app-record-contact-card__identity {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-record-contact-card__job-title {
    color: var(--kendo-color-subtle, #666);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-record-contact-card__actions {
    display: flex;
    gap: 0.125rem;
}

.app-card-action-button {
    align-items: center;
    border-radius: var(--kendo-border-radius-sm);
    color: var(--kendo-color-on-app-surface);
    display: inline-flex;
    flex: 0 0 2rem;
    justify-content: center;
    min-block-size: 2rem;
    min-inline-size: 2rem;
    padding: 0;
    text-decoration: none;
}

    .app-card-action-button:hover {
        color: var(--kendo-color-primary);
        background: var(--kendo-color-primary-subtle);
    }

.app-record-contact-card--add .k-card-body {
    padding: 0;
}

.app-record-contact-card--add {
    background: repeating-linear-gradient( 135deg, var(--kendo-color-primary-subtle) 0 0.5rem, color-mix(in srgb, var(--kendo-color-primary-subtle) 65%, var(--kendo-color-surface-alt)) 0.5rem 1rem);
    border: 1px dotted var(--kendo-color-primary);
    box-shadow: none;
}

.app-record-contact-card__add-trigger {
    align-items: center;
    appearance: none;
    background: transparent;
    border: 0;
    cursor: pointer;
    display: flex;
    justify-content: center;
    min-block-size: 6rem;
    padding: 1rem;
    width: 100%;
    height: 100%;
}

    .app-record-contact-card__add-trigger:disabled {
        cursor: not-allowed;
        opacity: 0.6;
    }

.app-record-contact-card__add-icon {
    align-items: center;
    background: var(--kendo-color-surface-alt);
    border-radius: 5px;
    color: var(--kendo-color-primary);
    display: flex;
    justify-content: center;
    padding: 0.3rem;
}

    .app-record-contact-card__add-icon .k-svg-icon {
        block-size: 2rem;
        inline-size: 2rem;
    }

.app-record-contact-card__fields {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: minmax(12rem, 1fr) 10.5rem;
}

@container (max-width: 23.24rem) {
    .app-record-contact-card__fields {
        grid-template-columns: minmax(0, 1fr);
    }

    .app-record-contact-card__add-trigger {
        min-block-size: calc(6rem + 2rem + 0.75rem);
    }
}

.crm-additional-details-tab {
    display: grid;
    gap: 1rem;
    padding: 0.25rem;
}

.crm-additional-details-tab__group {
    overflow: hidden;
}

    .crm-additional-details-tab__group + .crm-additional-details-tab__group {
        margin-top: 1rem;
    }

.crm-additional-details-tab__group-heading {
    border-bottom: 1px solid var(--app-border-subtle);
    margin-bottom: 1rem;
    padding-bottom: 0.65rem;
}

    .crm-additional-details-tab__group-heading h2 {
        margin: 0;
    }

.crm-additional-details-tab__field {
    display: grid;
    gap: 0.35rem;
    min-width: 0;
}

    .crm-additional-details-tab__field > label,
    .crm-additional-details-tab__label-row > label {
        color: var(--kendo-color-subtle);
    }

.crm-additional-details-tab__label-row {
    align-items: center;
    display: flex;
    gap: 0.15rem;
    min-width: 0;
}

    .crm-additional-details-tab__label-row .crm-additional-details-tab__copy {
        margin: -0.2rem 0;
        min-width: auto;
        padding: 0.1rem 0.25rem;
    }

.crm-additional-details-tab__field .k-input,
.crm-additional-details-tab__field .k-textarea,
.crm-additional-details-tab__field .k-datepicker,
.crm-additional-details-tab__field .k-numerictextbox {
    width: 100%;
}

.crm-additional-details-tab__boolean {
    align-items: center;
    min-height: 2.25rem;
}

.crm-additional-details-tab__hint {
    color: var(--kendo-color-subtle);
}

.crm-additional-details-tab__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

.crm-additional-details-tab__state,
.crm-additional-details-tab__empty {
    align-items: center;
    color: var(--kendo-color-subtle);
    display: flex;
    gap: 0.75rem;
    margin: 0;
    padding: 0.75rem;
}

.app-record-contact-dialog {
    display: grid;
    gap: 1rem;
}

.app-record-contact-dialog__title {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding-inline-end: 1rem;
    width: 100%;
}


.app-section-subheader {
    color: var(--kendo-color-on-app-surface);
    margin: 0;
}

.app-section-content {
    margin-inline: 0.5rem;
}

.k-radio-list.app-record-contact-match-list {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: minmax(0, 1fr);
    max-block-size: min(45vh, 28rem);
    overflow-y: auto;
    padding: 0.125rem 0.25rem 0.25rem;
}

.app-record-contact-match-list .k-radio-item {
    align-items: start;
    display: grid;
    gap: 0.5rem;
    grid-template-columns: auto minmax(0, 1fr);
    margin: 0;
    min-inline-size: 0;
    width: 100%;
}

.app-record-contact-match-list .k-radio-wrap {
    align-self: center;
    padding: 0.25rem;
}

.app-record-contact-match-list .k-radio-label {
    display: block;
    margin: 0;
    min-inline-size: 0;
    width: 100%;
}

.app-record-contact-match-list .k-card {
    width: 100%;
}

.app-record-contact-match {
    cursor: pointer;
}

    .app-record-contact-match .app-record-contact-card__name-row {
        grid-template-columns: minmax(0, 1fr);
    }

.app-record-contact-match--proposed {
    border-color: var(--kendo-color-primary);
}

.app-record-contact-match__choice {
    align-items: center;
    display: flex;
    gap: 0.5rem;
    min-inline-size: 0;
    width: 100%;
}

    .app-record-contact-match__choice .app-editable-value {
        flex: 1 1 auto;
        min-inline-size: 0;
    }

/* Keep the usage chips tight under the dialog title. */
.app-contact-edit-dialog .k-window-titlebar {
    padding-block-end: 0.25rem;
}

.app-contact-edit-dialog .k-window-content,
.app-contact-edit-dialog .k-dialog-content {
    padding-block-start: 0;
}

.app-contact-edit-dialog__header {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding-inline-end: 2.5rem;
}

.app-contact-edit-dialog__content {
    display: grid;
    gap: 1rem;
}

    .app-contact-edit-dialog__content > p {
        margin: 0;
    }

.app-contact-edit-dialog__usage {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.app-contact-edit-dialog__primary-option {
    align-items: center;
    display: flex;
    gap: 0.5rem;
}

.app-record-content__activity-placeholder {
    block-size: 1px;
}

.app-record-content__activity-fixed {
    block-size: var(--app-record-fixed-activity-height, 30rem);
    left: var(--app-record-fixed-activity-left, 0);
    min-block-size: 0;
    position: fixed;
    top: var(--app-record-fixed-activity-top, 0);
    width: var(--app-record-fixed-activity-width, 20rem);
    z-index: 4;
}

.crm-activity-notes-card {
    block-size: 100%;
    container-type: size;
    min-block-size: 0;
}

    .crm-activity-notes-card .k-card-header {
        border-bottom: 1px solid var(--app-border-subtle);
        padding: 0.65rem 1rem;
    }

.crm-activity-notes-card__title {
    color: var(--kendo-color-on-app-surface);
}

.crm-activity-notes-card__editor,
.crm-activity-notes-card__body {
    display: grid;
    gap: 0.75rem;
}

.crm-activity-notes-card .k-card-body {
    display: flex;
    flex-direction: column;
    min-block-size: 0;
    overflow: hidden;
}

.crm-activity-notes-card__editor {
    flex: 0 0 auto;
}

.crm-activity-notes-card textarea {
    min-block-size: 3rem;
    max-block-size: 40cqb;
}

.crm-activity-notes-card__body {
    flex: 1 1 auto;
    min-block-size: 0;
    overflow: hidden;
}

.crm-activity-notes-card__entry-heading {
    align-items: center;
    display: flex;
    justify-content: space-between;
}

.crm-activity-notes-card__tracking {
    margin-top: 0.5rem;
}
/* Matches the established CRM activity-history feed. */
.crm-activity-notes-card__feed {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-block-size: 0;
}

    .crm-activity-notes-card__feed > .k-listview {
        border: 0;
        display: flex;
        flex: 1 1 auto;
        flex-direction: column;
        min-block-size: 0;
    }

    .crm-activity-notes-card__feed .k-listview-content {
        flex: 1 1 auto;
        min-block-size: 0;
        overflow-y: auto;
        scrollbar-gutter: stable;
    }

    .crm-activity-notes-card__feed .k-listview-item {
        border-bottom: 1px solid var(--app-border-subtle);
        padding: 1.1rem 1.25rem;
    }

        .crm-activity-notes-card__feed .k-listview-item:last-child {
            border-bottom: 0;
        }

.crm-activity-notes-card__more {
    border-top: 1px solid var(--app-border-subtle);
    display: flex;
    flex: 0 0 auto;
    justify-content: center;
    padding: .8rem 1.25rem;
}

.crm-activity-notes-card .crm-feed__content {
    margin: 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.crm-activity-notes-card .crm-feed__meta,
.crm-activity-notes-card .crm-activity-notes-card__entry-heading {
    color: var(--kendo-color-subtle);
}

.crm-activity-notes-card .crm-feed__meta {
    margin: 0.55rem 0 0;
}

.crm-activity-notes-card .crm-activity-notes-card__entry-heading {
    align-items: flex-start;
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
    margin-bottom: 0.55rem;
}

.crm-activity-notes-card__entry-summary,
.crm-activity-notes-card__entry-actions,
.crm-activity-notes-card__note-edit-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
}

.crm-activity-notes-card__entry-summary {
    column-gap: 0.4rem;
    min-inline-size: 0;
    row-gap: 0.25rem;
}

.crm-activity-notes-card__entry-actions {
    flex: 0 0 auto;
    gap: 0.15rem;
}

.crm-activity-notes-card__note-edit {
    display: grid;
    gap: 0.5rem;
}

.crm-activity-notes-card__note-edit-actions {
    gap: 0.5rem;
    justify-content: flex-end;
}

.crm-activity-notes-card__edited {
    cursor: help;
    text-decoration: underline dotted;
    text-underline-offset: 0.15em;
}

.crm-activity-notes-card .crm-note--withdrawn {
    background: var(--app-background);
    border-radius: 0.35rem;
    padding: 0.5rem 0.75rem;
}

.crm-activity-notes-card .crm-activity__type {
    color: var(--kendo-color-on-app-surface);
}

.crm-activity-notes-card .crm-changes {
    background: var(--app-background);
    border-radius: 0.5rem;
    display: grid;
    gap: 0.5rem;
    margin: 0.8rem 0 0;
    padding: 0.75rem;
}

    .crm-activity-notes-card .crm-changes div {
        display: grid;
        gap: 0.2rem;
    }

    .crm-activity-notes-card .crm-changes dt {
        color: var(--kendo-color-subtle);
    }

    .crm-activity-notes-card .crm-changes dd {
        margin: 0;
    }
/* Shared page composition ------------------------------------------------- */

.app-page {
    display: grid;
    gap: 1.25rem;
}

    .app-page :is(h1, h2, h3, h4, p) {
        margin-top: 0;
    }

    .app-page h1 {
        color: var(--kendo-color-on-app-surface);
        margin-bottom: 0.65rem;
    }

    .app-page :is(h2, h3, h4) {
        color: var(--kendo-color-on-app-surface);
        margin-bottom: 0.35rem;
    }

    .app-page p {
        color: var(--kendo-color-subtle);
        margin-bottom: 0;
    }

.app-page__surface,
.app-page__hero {
    background: var(--kendo-color-surface);
    border: 1px solid var(--app-border-subtle);
    border-radius: 0.85rem;
    box-shadow: 0 0.45rem 1.25rem rgba(48, 48, 48, 0.045);
    padding: var(--app-page-padding);
}

.app-page__surface--clipped {
    overflow: hidden;
}

.app-page__hero {
    align-items: center;
    background: linear-gradient(135deg, var(--kendo-color-surface), var(--app-background));
    display: flex;
    gap: 1.5rem;
    justify-content: space-between;
}

.app-page__hero-copy,
.app-page__section-heading {
    align-items: center;
    display: flex;
    gap: 1.15rem;
}

.app-page__section-heading {
    gap: 1.5rem;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.app-page__hero-icon,
.app-page__section-icon {
    align-items: center;
    background: var(--kendo-color-secondary-subtle);
    border-radius: 0.8rem;
    color: var(--app-secondary);
    display: inline-flex;
    flex: 0 0 auto;
    height: 3.5rem;
    justify-content: center;
    width: 3.5rem;
}

.app-page__section-icon {
    border-radius: 0.65rem;
    height: 2.75rem;
    width: 2.75rem;
}

.app-page__eyebrow {
    color: var(--kendo-color-subtle) !important;
    margin-bottom: 0.55rem !important;
}

.app-page__state {
    align-items: center;
    color: var(--kendo-color-subtle);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    justify-content: center;
    min-height: 13rem;
    padding: var(--app-page-padding);
    text-align: center;
}

.app-page__state--compact {
    min-height: 7rem;
    padding: 1rem;
}

.app-page__state :is(h3, h4, p) {
    margin: 0;
}

.app-page__secondary {
    color: var(--kendo-color-subtle);
    display: block;
    margin-top: 0.2rem;
    overflow-wrap: anywhere;
}

.app-page__table {
    border-top: 1px solid var(--app-border-subtle);
}

    .app-page__table thead :is(th, td) {
        color: var(--kendo-color-subtle);
    }

    .app-page__table :is(th, td) {
        color: var(--kendo-color-on-app-surface);
        vertical-align: middle;
    }

    .app-page__table tr:hover {
        background: var(--app-background);
    }
/* Shared CRM list shell used by the customer and address pages. */
.crm-customers {
    display: grid;
    gap: 1.25rem;
}

    .crm-customers :is(.crm-customers__hero, .crm-customers__workspace) {
        background: var(--kendo-color-surface);
        border: 1px solid var(--app-border-subtle);
        border-radius: 1rem;
    }

    .crm-customers .crm-customers__hero {
        align-items: center;
        background: linear-gradient(135deg, var(--kendo-color-surface), var(--app-background));
        display: flex;
        justify-content: space-between;
        padding: var(--app-page-padding);
    }

.crm-customers__eyebrow {
    color: var(--kendo-color-subtle);
    margin: 0 0 0.45rem;
}

.crm-customers h1 {
    color: var(--kendo-color-on-app-surface);
    margin: 0;
}

.crm-customers__hero p:last-child {
    color: var(--kendo-color-subtle);
    margin: 0.75rem 0 0;
}

.crm-customers__workspace {
    overflow: hidden;
}

.crm-customers__filters {
    white-space: nowrap;
}

.crm-customers__toolbar,
.crm-customers__filters,
.crm-customers__tabs,
.crm-customers__paging {
    align-items: center;
    display: flex;
    gap: 1rem;
}

.crm-customers__toolbar,
.crm-customers__paging {
    justify-content: space-between;
    padding: 1rem 1.25rem;
}

.crm-customers__toolbar {
    border-bottom: 1px solid var(--app-border-subtle);
}

.crm-customers__filters .app-field {
    min-width: min(22rem, 36vw);
}

.crm-customers thead {
    background: var(--app-background);
}

.crm-customers :is(th, td) {
    border-color: #ececf1;
    padding: 1rem 1.15rem;
}

    .crm-customers :is(th, td) a {
        color: var(--kendo-color-on-app-surface);
    }

.crm-customers__state {
    align-content: center;
    display: grid;
    gap: 1rem;
    justify-items: center;
    min-height: 16rem;
    padding: var(--app-page-padding);
}

.crm-customers__paging {
    border-top: 1px solid var(--app-border-subtle);
    color: var(--kendo-color-subtle);
}
/* Duplicate-record match popovers are shared by company and individual editors. */
.duplicate-match {
    position: relative;
}

.duplicate-match__reason {
    color: #765500;
    display: block;
    margin-top: 0.15rem;
}

.duplicate-match__trigger {
    background: none;
    border: 0;
    color: var(--kendo-color-on-app-surface);
    cursor: pointer;
    font: inherit;
    padding: 0;
    text-decoration: underline;
}

    .duplicate-match__trigger:focus-visible {
        outline: 2px solid var(--kendo-color-subtle);
        outline-offset: 2px;
    }

.duplicate-match__popover {
    background: var(--kendo-color-surface);
    border: 1px solid var(--app-border-subtle);
    border-radius: 0.65rem;
    box-shadow: 0 0.75rem 2rem rgba(48, 48, 48, 0.18);
    color: var(--kendo-color-on-app-surface);
    left: 0;
    margin-top: 0.45rem;
    padding: 0.9rem;
    position: absolute;
    width: min(25rem, calc(100vw - 5rem));
    z-index: 10;
}

    .duplicate-match__popover header {
        align-items: start;
        display: flex;
        justify-content: space-between;
    }

        .duplicate-match__popover header div {
            display: grid;
            gap: 0.15rem;
        }

    .duplicate-match__popover .duplicate-match__popover-actions {
        display: flex;
        gap: 0.15rem;
    }

    .duplicate-match__popover header span,
    .duplicate-match__popover dt {
        color: var(--kendo-color-subtle);
    }

    .duplicate-match__popover dl {
        display: grid;
        gap: 0.3rem 0.75rem;
        grid-template-columns: max-content 1fr;
        margin: 0.85rem 0 0;
    }


    .duplicate-match__popover dd {
        margin: 0;
        overflow-wrap: anywhere;
    }

@media (max-width: 45rem) {
    .app-record-page,
    .app-record-page > form,
    .app-record-workspace {
        block-size: auto;
        overflow: visible;
    }

    .app-record-workspace {
        display: block;
    }

    .app-record-content {
        block-size: auto;
        overflow: visible;
    }

    .app-record-content__details,
    .crm-activity-notes-card__feed .k-listview-content {
        overflow-y: visible;
    }

    .app-record-content__activity,
    .crm-activity-notes-card {
        block-size: auto;
        position: static;
    }

    /* Size containment collapses an auto-height card to 0; the stacked layout sizes from content. */
    .crm-activity-notes-card {
        container-type: normal;
    }

        .crm-activity-notes-card textarea {
            max-block-size: 16rem;
        }

        .crm-activity-notes-card .k-card-body,
        .crm-activity-notes-card__body,
        .crm-activity-notes-card__feed {
            overflow: visible;
        }
}

@media (max-width: 48rem) {
    .app-page__hero,
    .app-page__hero-copy,
    .app-page__section-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .app-page__hero-copy {
        align-items: flex-start;
    }

    .crm-customers .crm-customers__hero,
    .crm-customers__toolbar,
    .crm-customers__filters,
    .crm-customers__paging {
        align-items: stretch;
        flex-direction: column;
    }

        .crm-customers__filters .app-field {
            min-width: 100%;
        }
}

.button {
    align-items: center;
    border: 0;
    border-radius: 0.5rem;
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    min-height: 3rem;
    padding: 0.75rem 1.35rem;
    text-decoration: none;
}

.button--primary {
    background: #303030;
    color: #fff;
}

    .button--primary:hover {
        background: #5a596f;
    }

.button--disabled {
    cursor: wait;
    opacity: 0.66;
}

.app-loading {
    align-items: center;
    background: #fcfcfc;
    color: #5a596f;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    justify-content: center;
    min-height: 100vh;
}

.app-loading__mark {
    color: var(--app-primary);
}

#blazor-error-ui {
    background: #303030;
    bottom: 0;
    color: #fff;
    display: none;
    left: 0;
    padding: 0.9rem 1.25rem;
    position: fixed;
    right: 0;
    z-index: 1000;
}

    #blazor-error-ui .reload {
        margin-left: 0.75rem;
    }

    #blazor-error-ui .dismiss {
        background: transparent;
        border: 0;
        color: #fff;
        cursor: pointer;
        float: right;
    }

.application-error {
    background: #fcfcfc;
    border: 1px solid #d8d8df;
    border-radius: 0.5rem;
    margin: 2rem auto;
    max-width: 36rem;
    padding: 2rem;
    text-align: center;
}

    .application-error code {
        display: block;
        margin: 1rem 0;
    }

.application-error__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1rem;
}


.application-error .application-error__details {
    margin: 0 0 1rem;
    text-align: left;
}

    .application-error .application-error__details summary {
        cursor: pointer;
        text-align: center;
    }

    .application-error .application-error__details pre {
        max-height: 16rem;
        overflow: auto;
        overflow-wrap: anywhere;
        white-space: pre-wrap;
    }
/* The enquiry quick-create dialog is intentionally lightweight and non-modal. */
#enquiry-create-dialog.k-dialog {
    background: #fcfcfc;
    border: 0;
    border-radius: 1rem;
    box-shadow: 0 1.25rem 3.5rem rgba(48, 48, 48, 0.18);
    overflow: hidden;
    pointer-events: auto;
}

    #enquiry-create-dialog.k-dialog:focus,
    #enquiry-create-dialog.k-dialog:focus-visible,
    #enquiry-create-dialog.k-dialog:focus-within,
    #enquiry-create-dialog.k-dialog.k-focus {
        border: 0 !important;
        box-shadow: 0 1.25rem 3.5rem rgba(48, 48, 48, 0.18) !important;
        outline: none !important;
    }

#enquiry-create-dialog .k-dialog-titlebar {
    background: #fcfcfc;
    border: 0;
    border-bottom: 1px solid #ececf1;
    color: var(--kendo-color-on-app-surface);
    padding: 0.8rem 1rem;
}


#enquiry-create-dialog .k-window-content {
    background: #fcfcfc;
    padding: 0.8rem 1rem;
}

#enquiry-create-dialog .k-dialog-actions {
    background: #fcfcfc;
    border: 0;
    border-top: 1px solid #ececf1;
    padding: 0.65rem 1rem;
}

.k-dialog-wrapper:has(#enquiry-create-dialog) {
    pointer-events: none;
}

    .k-dialog-wrapper:has(#enquiry-create-dialog) > .k-overlay {
        background: transparent;
        pointer-events: none;
    }

.calendar-event-details-dialog.k-dialog {
    overflow: hidden;
    border: 0 !important;
    border-radius: 1.25rem;
    outline: none !important;
    box-shadow: 0 1.25rem 3.5rem rgb(48 48 48 / 20%);
}

    .calendar-event-details-dialog.k-dialog:focus,
    .calendar-event-details-dialog.k-dialog:focus-visible,
    .calendar-event-details-dialog.k-dialog:focus-within,
    .calendar-event-details-dialog.k-dialog.k-focus {
        border: 0 !important;
        outline: none !important;
        box-shadow: 0 1.25rem 3.5rem rgb(48 48 48 / 20%) !important;
    }

.calendar-event-details-dialog.k-dialog,
.calendar-dialog--editor.k-dialog,
.calendar-dialog--subscription.k-dialog,
.event-type-editor-dialog.k-dialog,
.customer-create-popover.k-dialog,
.contact-edit-dialog.k-dialog,
#enquiry-create-dialog.k-dialog {
    max-height: calc(100vh - 2rem);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}


.crm-search-page {
    display: grid;
    gap: 0;
}

    .crm-search-page h1 {
        color: #303030;
        margin: 0;
    }

    .crm-search-page .crm-search-page__archive-toggle {
        margin: 0;
        white-space: nowrap;
    }

    .crm-search-page .crm-search-page__table-card,
    .crm-search-page .crm-search-page__state,
    .crm-search-page .crm-search-page__error {
        background: #fcfcfc;
        border: 1px solid #e4e5eb;
        border-radius: 0.5rem;
        overflow: hidden;
    }

/*
 * Record lists (Companies, Individuals, Contacts, Enquiries) fill the page and scroll the grid's rows
 * virtually instead of paging. Telerik needs a definite grid height, so each ancestor passes its height down.
 */
.app-shell__main:has(.crm-search-page--fill) {
    height: 100%;
}

.app-shell__content:has(.crm-search-page--fill) {
    box-sizing: border-box;
    height: 100%;
}

.crm-search-page.crm-search-page--fill {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    height: 100%;
    min-height: 0;
}

.crm-search-page--fill > .crm-search-page__table-card {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    min-height: 0;
}

.crm-search-page--fill > .crm-search-page__table-card--top {
    display: flex;
    flex: none;
    flex-direction: column;
    min-height: 0;
}

.crm-search-page__grid-fill {
    flex: 1 1 0;
    min-height: 0;
}

.crm-search-page__table-heading {
    align-items: center;
    border-bottom: 1px solid #e4e5eb;
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
    min-height: 2.5rem;
    padding: 0.35rem 0.55rem;
}

.crm-search-page__table-actions {
    align-items: center;
    display: flex;
    flex-wrap: nowrap;
    gap: 0.45rem;
}

.crm-search-page .crm-search-page__search {
    min-width: min(15rem, 28vw);
}

    .crm-search-page .crm-search-page__search .app-field {
        margin: 0;
    }

.crm-search-page .crm-search-page__table-actions .app-switch {
    margin: 0;
}

.crm-search-page .crm-search-page__table {
    background: transparent;
}

    .crm-search-page .crm-search-page__table thead {
        background: #f7f7fa;
    }

    .crm-search-page .crm-search-page__table :is(th, td) {
        border-color: #ececf1;
        padding: 0.42rem 0.6rem;
        vertical-align: middle;
    }

    .crm-search-page .crm-search-page__table .k-filter-row .k-input,
    .crm-search-page .crm-search-page__table .k-filter-row .k-picker {
        font-size: 0.75rem;
        font-weight: 500;
        letter-spacing: normal;
        min-width: 0;
        text-transform: none;
        width: 100%;
    }

    .crm-search-page .crm-search-page__table .k-filter-row .k-input-inner {
        padding-block: 0.25rem;
    }

    .crm-search-page .crm-search-page__table .k-filter-row :is(th, td) {
        background: #f7f7fa;
        padding: 0.3rem 0.6rem;
    }

    .crm-search-page .crm-search-page__table tr:hover {
        background: #f8f8fb;
    }

.crm-search-page__record-link {
    font-weight: var(--kendo-font-weight-bold);
    text-decoration: none;
}

    .crm-search-page__record-link:hover {
        color: #5a596f;
        text-decoration: underline;
        text-underline-offset: 0.22em;
    }

.crm-search-page__open-link {
    align-items: center;
    color: #303030;
    display: inline-flex;
    font-size: 0.82rem;
    font-weight: 750;
    gap: 0.35rem;
    justify-content: flex-end;
    text-decoration: none;
    white-space: nowrap;
}

    .crm-search-page__open-link:hover {
        color: #5a596f;
    }

/* Grids whose data rows open a record on click (OnRowClick). Data rows only: header, filter and footer rows are excluded. */
.app-grid--row-link .k-master-row {
    cursor: pointer;
}

.crm-search-page .crm-search-page__table .k-pager {
    min-height: 2.5rem;
    padding-block: 0.3rem;
}

.crm-search-page__state {
    align-content: center;
    color: #5a596f;
    display: grid;
    justify-items: center;
    min-height: 8rem;
    padding: 1rem;
    text-align: center;
}

    .crm-search-page__state h2 {
        color: #303030;
        margin: 1rem 0 0.5rem;
    }

    .crm-search-page__state p {
        margin: 0;
        max-width: 34rem;
    }

    .crm-search-page__state > span {
        margin-top: 0.85rem;
    }

.crm-search-page__error {
    display: grid;
    gap: 1rem;
    justify-items: start;
    padding: 1.25rem;
}

@media (max-width: 48rem) {
    .crm-search-page .crm-search-page__table .app-table-wrap {
        overflow: visible;
    }

    .crm-search-page .crm-search-page__table tr {
        border: 1px solid #e4e5eb;
        border-radius: 0.75rem;
        margin: 0.85rem;
        overflow: hidden;
    }
}

@media (max-width: 32rem) {
    .crm-search-page__table-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .crm-search-page .crm-search-page__search {
        min-width: 12rem;
    }
}

/*
 * Notifications popover: it is taller than the space beside the bell, so Telerik shifts it up to fit
 * and its callout (centred by default) no longer points at the bell. The bell sits at a fixed distance
 * from the bottom of the window, so pin the callout to that distance instead.
 */
.k-popover:has(.notification-popup__actions) > .k-popover-callout {
    top: calc(100% - 2rem);
}

body:has(.app-shell__sidebar--collapsed) .k-popover:has(.notification-popup__actions) > .k-popover-callout {
    top: calc(100% - 4.85rem);
}

/*
 * Search results popover (side-panel layout): the search box sits 7rem from the top of the window.
 * A tall panel is shifted down to fit, so keep the callout level with the box; a short panel stays
 * centred on it, which min() preserves.
 */
.k-popover:has(.crm-nav-search__side) > .k-popover-callout {
    top: min(50%, 7rem);
}

/* Preserve line breaks in note text (the card root does not carry .crm-activity-notes-card). */
.crm-activity-notes-card__feed .crm-feed__content {
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}
