/* Shared visual language for the staff workspace, owner admin and customer portal. */
body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) {
    --admin-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    --admin-ink: #202428;
    --admin-body: #30363c;
    --admin-muted: #525c66;
    --admin-line: #d5d9de;
    --admin-canvas: #f0f1f2;
    --admin-surface: #fff;
    --admin-subtle: #f6f7f7;
    --admin-blue: #3450d7;
    --admin-link: #2944bd;
    --admin-pressed: #2138a1;
    --admin-sidebar: #1d2327;
    --admin-sidebar-hover: #30373d;
    background: var(--admin-canvas);
    color: var(--admin-body);
    font-family: var(--admin-font);
    font-size: 14px;
    line-height: 1.5;
}

.crm-app {
    --crm-ink: var(--admin-ink);
    --crm-muted: var(--admin-muted);
    --crm-line: var(--admin-line);
    --crm-bg: var(--admin-canvas);
    --crm-card: var(--admin-surface);
    --crm-violet: var(--admin-link);
    --crm-violet-dark: var(--admin-pressed);
    --crm-teal: var(--admin-blue);
}

.platform-app {
    --ink: var(--admin-ink);
    --muted: var(--admin-muted);
    --teal: var(--admin-blue);
    --line: var(--admin-line);
}

body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) main {
    min-width: 0;
    color: var(--admin-body);
    font-size: 14px;
    line-height: 1.5;
}

body:is(.crm-app, .platform-app) main { max-width: none; margin: 0; padding: 22px 26px 48px; }
body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) main h1 {
    color: var(--admin-ink);
    font: 500 clamp(24px, 2.1vw, 31px)/1.2 var(--admin-font);
    letter-spacing: -.025em;
    margin-block: 4px 8px;
    overflow-wrap: anywhere;
}

body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) main h2 {
    color: var(--admin-ink);
    font: 650 18px/1.35 var(--admin-font);
    letter-spacing: 0;
    background: none;
    border: 0;
    border-radius: 0;
    padding: 0;
    margin: 0 0 12px;
}

body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) main h3 {
    color: var(--admin-ink);
    font: 650 15px/1.4 var(--admin-font);
    letter-spacing: 0;
}

body:is(.crm-app, .platform-app) main .eyebrow,
.customer-portal-app .eyebrow {
    color: var(--admin-muted);
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .075em;
}

body:is(.crm-app, .platform-app) main :is(p, li) { line-height: 1.5; }
body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) main .card {
    background: var(--admin-surface);
    border: 1px solid var(--admin-line);
    border-radius: 0;
    box-shadow: none;
    padding: 17px 18px;
    margin-bottom: 15px;
    min-width: 0;
}

body:is(.crm-app, .platform-app) main :is(.card > h2, .card > .panel-heading) {
    border-bottom: 1px solid var(--admin-line);
    padding-bottom: 10px;
}
.crm-app main .panel-heading { gap: 10px; margin-bottom: 13px; }
.crm-app main .panel-heading h2 { margin: 3px 0 0; }
.crm-app main .panel-heading > .section-action,
.platform-app main .panel-heading > .section-action {
    flex: 0 1 auto;
    max-width: 100%;
    text-align: center;
}
@media (max-width: 600px) {
    .crm-app main .panel-heading:has(> .section-action),
    .platform-app main .panel-heading:has(> .section-action) {
        flex-wrap: wrap;
        align-items: flex-start;
    }
    .crm-app main .panel-heading > .section-action,
    .platform-app main .panel-heading > .section-action { min-height: 44px; }
}
.crm-app main .bar, .crm-app main .dashboard-welcome { gap: 12px; margin-bottom: 15px; }
.crm-app main .bar > div > p:last-child { margin: 5px 0 0; }
.crm-app main .grid, .crm-app main .dashboard-grid { gap: 14px; }
.crm-app main .fields { gap: 14px 18px; }
.crm-app main .fields > *, .crm-app main .filters > * { min-width: 0; }
.crm-app main .facts { gap: 14px; }
.crm-app main :is(.facts dt, .muted, .record-muted), .platform-app main .muted { color: var(--admin-muted); }
.crm-app main .facts :is(strong, dd) { color: var(--admin-ink); }
.crm-app main .property-hero-copy .record-price { color: var(--admin-ink); }
.crm-app main .recent-strip { border-color: var(--admin-line); }

body:is(.crm-app, .platform-app, .portal-app) main a:not(.button,.badge,.contact-role-badge,.metric-card,.money-card,.quick-action,.property-hero-image,.media-card-preview),
.customer-portal-app :is(main,footer) a:not(.button) { color: var(--admin-link); }
body:is(.crm-app, .platform-app, .portal-app) main a:not(.button,.badge,.contact-role-badge,.metric-card,.money-card,.quick-action,.property-hero-image,.media-card-preview):visited,
.customer-portal-app :is(main,footer) a:not(.button):visited { color: #4f3f92; }
body:is(.crm-app, .platform-app, .portal-app) main a:not(.button,.badge,.contact-role-badge,.metric-card,.money-card,.quick-action):hover,
.customer-portal-app :is(main,footer) a:not(.button):hover { color: var(--admin-pressed); background: transparent; }
body:is(.crm-app, .platform-app) main :is(td,th) a:not(.button,.badge,.contact-role-badge) { text-decoration: none; }
body:is(.crm-app, .platform-app) main :is(td,th) a:not(.button,.badge,.contact-role-badge):hover { text-decoration: underline; }
body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) :is(a,button,summary,input,select,textarea):focus-visible {
    outline: 2px solid var(--admin-blue);
    outline-offset: 2px;
}
body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) ::selection { color: var(--admin-ink); background: #dce3ff; }

body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) main label {
    color: var(--admin-ink);
    font-size: 13px;
    line-height: 1.35;
    font-weight: 650;
    margin-bottom: 5px;
}
body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) main small,
body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) main .field-help {
    color: var(--admin-muted);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.45;
}
body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) main :is(input,select,textarea) + :is(small,.field-help) {
    display: block;
    margin-top: 5px;
}
body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) main :is(input:not([type=checkbox],[type=radio],[type=range],[type=color]),select,textarea):not(.ql-toolbar *) {
    background: var(--admin-surface);
    border: 1px solid #89939c;
    border-radius: 0;
    color: var(--admin-ink);
    font-size: 14px;
    font-weight: 400;
    padding: 7px 9px;
    min-width: 0;
    max-width: 100%;
    min-height: 36px;
    line-height: 1.4;
}
body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) main :is(input,select,textarea)[aria-invalid=true] { border-color: #a92725; }
body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) main :is(input,textarea)[readonly] { background: var(--admin-subtle); }
body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) :is(input[type=checkbox],input[type=radio]) { accent-color: var(--admin-blue); }
body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) ::placeholder { color: #636e77; opacity: 1; }

body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) :is(main,header) :is(.button,button):not(.secondary,.quiet,.danger,.sidebar-toggle,.ql-toolbar *,.mail-row-menu *,[aria-label="Close navigation"],.record-picker-clear) {
    color: #fff;
    background: var(--admin-blue);
    border: 1px solid var(--admin-blue);
}
body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) :is(main,header) :is(.button,button):not(.secondary,.quiet,.danger,.sidebar-toggle,.ql-toolbar *,.mail-row-menu *,[aria-label="Close navigation"],.record-picker-clear):hover {
    background: var(--admin-pressed);
    border-color: var(--admin-pressed);
}
body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) :is(main,header) :is(.button,button):not(.ql-toolbar *) {
    border-radius: 0;
    box-shadow: none;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    min-height: 36px;
    padding: 7px 12px;
    transform: none;
}
body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) :is(main,header) :is(.button,button).secondary,
body:is(.crm-app, .platform-app) main :is(td, th) :is(.button,button).secondary {
    color: var(--admin-link);
    background: #fff;
    border: 1px solid #8091d1;
}
body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) :is(main,header) :is(.button,button).secondary:hover {
    color: var(--admin-pressed) !important;
    background: #eef1ff;
    border-color: var(--admin-pressed);
}
body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) :is(main,header) :is(button:disabled,.button[aria-disabled=true]) { opacity: .6; }

/* Guided setup progress stays legible in every step state. */
body.crm-app main nav.money-flow[aria-label] > :is(button, span) {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    min-height: 44px;
    padding: 8px 12px;
    color: var(--admin-ink);
    background: #fff;
    border: 1px solid #9caac4;
    border-radius: 0;
    line-height: 1.35;
    overflow-wrap: normal;
    word-break: normal;
}
body.crm-app main nav.money-flow[aria-label] > button:is(:hover, :focus-visible) {
    color: var(--admin-link);
    background: #eef1ff;
    border-color: var(--admin-blue);
}
body.crm-app main nav.money-flow[aria-label] > :is(button, span)[aria-current="step"],
body.crm-app main nav.money-flow[aria-label] > button[aria-current="step"]:is(:hover, :focus-visible) {
    color: #fff;
    background: var(--admin-pressed);
    border-color: var(--admin-pressed);
}
body.crm-app main nav.money-flow[aria-label] > :is(button, span) > :is(span, b) {
    flex: 0 0 26px;
    margin: 0;
    color: #20335a;
    background: #e5edff;
}
body.crm-app main nav.money-flow[aria-label] > [aria-current="step"] > :is(span, b) {
    background: #fff;
}

/* Disclosure controls. Menus and existing button summaries keep their own layout. */
body:is(.crm-app, .platform-app, .portal-app) main details > summary {
    background: var(--admin-subtle);
    color: var(--admin-ink);
    border: 1px solid var(--admin-line);
    border-radius: 0;
    font-size: 14px;
    font-weight: 600;
    min-height: 36px;
    padding: 8px 10px;
}
body:is(.crm-app, .platform-app, .portal-app) main details[open] > summary {
    background: #eef1ff;
    border-color: #a8b5e8;
    margin-bottom: 12px;
}
body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) main details > summary:where(:not(.button, .workspace-page-tools summary, .mail-row-menu summary, .mail-folder-menu summary, .mail-tools summary)) {
    position: relative;
    box-sizing: border-box;
    list-style: none;
    cursor: pointer;
    background: #f0f5fc;
    color: #214c7e;
    border: 1px solid #9db1d2;
    border-radius: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
    min-height: 38px;
    padding: 8px 40px 8px 12px;
    overflow-wrap: anywhere;
}
body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) main details > summary:where(:not(.button, .workspace-page-tools summary, .mail-row-menu summary, .mail-folder-menu summary, .mail-tools summary))::-webkit-details-marker {
    display: none;
}
body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) main details > summary:where(:not(.button, .workspace-page-tools summary, .mail-row-menu summary, .mail-folder-menu summary, .mail-tools summary))::after {
    content: "";
    position: absolute;
    inset-inline-end: 16px;
    top: 50%;
    width: 8px;
    height: 8px;
    border: solid currentColor;
    border-width: 0 2px 2px 0;
    transform: translateY(-70%) rotate(45deg);
    pointer-events: none;
}
body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) main details[open] > summary:where(:not(.button, .workspace-page-tools summary, .mail-row-menu summary, .mail-folder-menu summary, .mail-tools summary))::after {
    transform: translateY(-25%) rotate(225deg);
}
body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) main details > summary:where(:not(.button, .workspace-page-tools summary, .mail-row-menu summary, .mail-folder-menu summary, .mail-tools summary)):hover,
body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) main details[open] > summary:where(:not(.button, .workspace-page-tools summary, .mail-row-menu summary, .mail-folder-menu summary, .mail-tools summary)) {
    background: #e1ecfc;
    border-color: #657fae;
}
body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) main details[open] > summary:where(:not(.button, .workspace-page-tools summary, .mail-row-menu summary, .mail-folder-menu summary, .mail-tools summary)) {
    margin-bottom: 12px;
}
body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) main details > summary.disclosure-action {
    width: fit-content;
    max-width: 100%;
    background: var(--admin-blue);
    border-color: var(--admin-blue);
    color: #fff;
    font-weight: 650;
}
body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) main details > summary.disclosure-action:hover,
body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) main details[open] > summary.disclosure-action {
    background: var(--admin-pressed);
    border-color: var(--admin-pressed);
    color: #fff;
}
.crm-app main details.card { padding: 0; }
.crm-app main details.card > summary:not(.disclosure-action) { margin: -1px; padding-block: 12px; }
.crm-app main details.card > summary.disclosure-action { margin: 12px 16px; max-width: calc(100% - 32px); }
.crm-app main details.card[open] { padding-bottom: 16px; }
.crm-app main details.card > :not(summary) { margin-inline: 16px; }
.crm-app main details.card > .fields { margin-top: 14px; }
.crm-app main details.card > summary > span:not(.badge) { margin-inline-start: 0; font-size: 12px; color: var(--admin-muted); font-weight: 400; }
.crm-app main details.card > summary.disclosure-action > span:not(.badge) { color: #e5ebff; }

body:is(.crm-app, .platform-app, .portal-app) main th {
    background: #fff;
    color: var(--admin-ink);
    font-size: 13px;
    font-weight: 650;
    letter-spacing: normal;
    text-transform: none;
    border-bottom: 1px solid var(--admin-line);
}
body:is(.crm-app, .platform-app, .portal-app) main :is(td,th) {
    padding: 10px 11px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}
body:is(.crm-app, .platform-app, .portal-app) main td { font-size: 13px; border-bottom-color: #e5e7ea; }
.crm-app main td strong { font-size: inherit; }
.crm-app main td a.small-link { font-size: inherit; font-weight: normal; }
body:is(.crm-app, .platform-app, .portal-app) main table { background: #fff; }
body:is(.crm-app, .platform-app, .portal-app) main tbody tr:nth-child(odd) { background: var(--admin-subtle); }
body:is(.crm-app, .platform-app, .portal-app) main tbody tr:hover { background: #edf0fa; }
.crm-app main thead th:is(:first-child,:last-child) { border-radius: 0; }
.crm-app main :is(.table-wrap,.table-scroll) { max-width: 100%; }
.crm-app main .badge { font-size: 11px; font-weight: 600; border-radius: 0; padding: 3px 6px; }
.crm-app main .badge::before { border-radius: 1px; width: 6px; height: 6px; }
.crm-app main :is(.notice,.errors) { border-radius: 0; border-left-width: 4px; box-shadow: none; padding: 9px 12px; margin-bottom: 14px; }

.admin-icon { width: 17px; height: 17px; flex: none; vertical-align: -.17em; }
.crm-app .crm-sidebar, .platform-app .platform-sidebar { background: var(--admin-sidebar); border-color: #101416; box-shadow: none; }
.crm-app .crm-sidebar { width: 218px; padding: 0; }
.crm-app .crm-workspace { margin-left: 218px; min-width: 0; }
.crm-app .sidebar-head { min-height: 47px; padding: 8px 12px; border-bottom: 1px solid #3d454c; }
.crm-app .crm-skip:focus {
    clip: auto;
    width: auto;
    height: auto;
    z-index: 100;
    padding: 9px 12px;
    margin: 5px;
    background: #fff;
}
.crm-app .sidebar-search { display: none; }
.crm-app .crm-sidebar .crm-brand { color: #fff !important; font-size: 13px; letter-spacing: 0; gap: 8px; }
.crm-app .crm-brand strong { color: inherit; }
.crm-app .crm-brand img { width: 24px; height: 24px; border-radius: 0; }
.crm-app .agency-switcher { display: none; }
.crm-app .crm-nav { padding: 0 0 8px; scrollbar-width: thin; scrollbar-color: #616a73 transparent; }
.crm-app .crm-nav .nav-heading { color: #bcc5ce; margin: 11px 12px 4px; font-size: 10px; font-weight: 650; }
.crm-app .crm-nav a, .platform-app .platform-sidebar nav a {
    color: #f3f4f5;
    border-radius: 0;
    margin: 0;
    padding: 6px 10px;
    min-height: 32px;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.25;
}
.crm-app .crm-nav a:hover, .platform-app .platform-sidebar nav a:hover { color: #fff; background: var(--admin-sidebar-hover); }
.crm-app .crm-nav a.active, .platform-app .platform-sidebar nav a.active { color: #fff; background: var(--admin-blue); box-shadow: inset 3px 0 #a9b7ff; }
.crm-app .crm-nav a .nav-icon { width: 22px; height: 20px; color: #c5cbd1; font-size: 15px; }
.crm-app .crm-nav a.active .nav-icon { color: #fff; }
.crm-app .crm-nav .nav-group { margin: 0; }
.crm-app .crm-nav .nav-group > summary { color: #e3e8ec; padding: 6px 12px 6px 22px; font-size: 12px; }
.crm-app .crm-nav .nav-group a { padding-left: 34px; }
.crm-app .sidebar-footer { padding: 4px 8px; border-top: 1px solid #3d454c; }
.crm-app .sidebar-footer .user-card { color: #fff !important; padding: 4px; grid-template-columns: 25px minmax(0,1fr) auto; border-radius: 0; }
.crm-app .sidebar-footer .user-card:hover, .crm-app .sidebar-footer .signout-button:hover { background: var(--admin-sidebar-hover); }
.crm-app .sidebar-footer .user-avatar { width: 25px; height: 25px; background: #424b55; color: #fff; border-radius: 0; }
.crm-app .sidebar-footer :is(.signout-button, small) { color: #d5dde3; }
.crm-app .sidebar-footer .signout-button { min-height: 30px; padding: 3px 5px; font-size: 12px; border-radius: 0; }
.crm-app .sidebar-close { color: #fff; border-radius: 0; }
.crm-app .sidebar-close:hover { background: var(--admin-sidebar-hover); }
.crm-app .workspace-topbar {
    height: 52px;
    padding: 0 20px;
    gap: 12px;
    background: #fff;
    backdrop-filter: none;
    border-bottom: 1px solid var(--admin-line);
}
.crm-app .workspace-topbar :is(.sidebar-toggle,.global-search input,.global-search button) { border-radius: 0; }
.crm-app .desktop-menu-toggle { display: none; }
@media screen and (min-width: 901px) {
    .crm-app .workspace-topbar .desktop-menu-toggle:not([hidden]) {
        display: inline-flex;
        flex: none;
        width: 36px;
        height: 36px;
        padding: 0;
        border-radius: 0;
        border-color: var(--admin-line);
        background: #fff;
        color: var(--admin-link);
        font-size: 23px;
        line-height: 1;
    }
    .crm-app .workspace-topbar .desktop-menu-toggle:not([hidden]):hover {
        background: var(--admin-subtle);
        color: var(--admin-pressed);
        transform: none;
    }
    .desktop-menu-collapsed .crm-app .crm-sidebar { display: none; }
    .desktop-menu-collapsed .crm-app .crm-workspace { margin-left: 0; }
}
.crm-app .workspace-topbar .global-search > button { border-radius: 0; }
.crm-app .workspace-topbar .global-search input { background: #fff; }
.crm-app .topbar-context small { color: var(--admin-muted); }
.crm-app .topbar-actions { min-width: 0; }
.crm-app .topbar-primary { min-height: 36px; }
.crm-app .topbar-primary .admin-icon { width: 16px; height: 16px; }
.crm-app .workspace-topbar .topbar-primary { background: var(--admin-blue); border-color: var(--admin-blue); border-radius: 0; color: #fff; }
.crm-app .workspace-topbar .topbar-primary:hover { background: var(--admin-pressed); border-color: var(--admin-pressed); }
.crm-app .workspace-quick-add > div { border-radius: 0; border-color: var(--admin-line); }
.crm-app .workspace-quick-add > div > a { border-radius: 0; color: var(--admin-link); }
.crm-app .recent-strip { padding-block: 4px; }
.crm-app .recent-strip a { border-radius: 0; background: var(--admin-subtle); }
.platform-app .platform-topbar { background: #fff; color: var(--admin-body); border-bottom: 1px solid var(--admin-line); }
.platform-app .platform-topbar a { color: var(--admin-link); }
.platform-app .platform-menu { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.platform-app .platform-sidebar .platform-menu-website,
.platform-app .platform-menu-toggle[hidden] { display: none; }

@media (max-width: 760px) {
    .platform-app .platform-sidebar.platform-phone-menu {
        position: sticky;
        top: 0;
        z-index: 5;
        max-height: 80vh;
        max-height: 80dvh;
        padding: 5px 10px;
    }
    .platform-app .platform-phone-menu .platform-brand,
    .platform-app .platform-phone-menu:not(.platform-menu-open) .platform-menu,
    .platform-app .platform-phone-menu + .platform-workspace .platform-topbar { display: none; }
    .platform-app .platform-menu-toggle {
        display: flex;
        justify-content: space-between;
        width: 100%;
        min-height: 44px;
        border: 0;
        border-radius: 0;
        gap: 10px;
        text-align: start;
    }
    .platform-app .platform-menu-toggle:hover { background: var(--admin-sidebar-hover); }
    .platform-app .platform-menu-toggle span { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
    .platform-app .platform-menu-toggle small { min-width: 0; color: #d7dde1; overflow-wrap: break-word; }
    .platform-app .platform-phone-menu nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; margin-top: 6px; }
    .platform-app .platform-sidebar.platform-phone-menu nav a { min-height: 44px; white-space: normal; padding: 8px; gap: 6px; }
    .platform-app .platform-phone-menu nav .platform-menu-website { display: flex; grid-column: 1 / -1; }
    .platform-app .platform-phone-menu .platform-owner button { min-height: 44px; }
    .platform-app main :is(.card-header,.list-row) > * { min-width: 0; }
    .platform-app main :is(.card-header,.list-row) { flex-wrap: wrap; gap: 9px; }
    .platform-app main :is(.card-header,.list-row) > div { flex: 1 1 9rem; overflow-wrap: anywhere; }
    .platform-app main .metric strong { font-size: clamp(19px, 5.4vw, 24px); overflow-wrap: anywhere; }
    .platform-app main :is(.filter,.workspace-page-tools) { gap: 8px; }
    .platform-app main .workspace-page-tools > strong { width: 100%; }
    .platform-app main .workspace-page-tools details { flex-basis: 100%; min-width: 0; margin-inline-start: 0; }
    .platform-app main [id] { scroll-margin-top: 64px; }
}

.crm-app main :is(.record-tabs, .workspace-page-tools, .save-dock, .guide-controls) {
    border: 1px solid var(--admin-line);
    border-radius: 0;
    background: #fff;
    box-shadow: none;
}
.crm-app main .record-tabs { top: 52px; gap: 1px; padding: 0; margin-bottom: 14px; }
.crm-app main .record-tabs a {
    color: var(--admin-link) !important;
    border-radius: 0;
    border-bottom: 2px solid transparent;
    padding: 9px 11px;
    font-size: 13px;
    font-weight: 600;
}
.crm-app main .record-tabs a:hover,
.crm-app main .record-tabs a:focus-visible,
.crm-app main .record-tabs a[aria-current] {
    background: #eef1ff;
    border-bottom-color: var(--admin-blue);
    color: var(--admin-pressed) !important;
}
.crm-app :is(.property-editor, .property-editor > form, .workspace-section-layout, .workspace-section-content) { min-width: 0; }
.crm-app :is(.property-editor-nav, .workspace-section-nav) > strong { display: none; }
.crm-app .property-editor-nav a { display: flex; align-items: center; gap: 7px; }
@media screen and (min-width: 1150px) {
    .crm-app :is(.property-editor, .workspace-section-layout) {
        display: grid;
        grid-template-columns: 170px minmax(0, 1fr);
        gap: 15px;
        align-items: start;
    }
    .crm-app main :is(.property-editor-nav, .workspace-section-nav) {
        display: grid;
        position: sticky;
        top: 66px;
        max-height: calc(100dvh - 82px);
        overflow-y: auto;
        overscroll-behavior: contain;
    }
    .crm-app :is(.property-editor-nav, .workspace-section-nav) > strong {
        display: block;
        padding: 9px 11px;
        font-size: 12px;
        color: var(--admin-muted);
        background: var(--admin-subtle);
    }
    .crm-app main :is(.property-editor-nav, .workspace-section-nav) a {
        border-bottom: 1px solid var(--admin-line);
        white-space: normal;
    }
    .crm-app :is(.property-editor-nav, .workspace-section-nav) a[aria-current] { box-shadow: inset 3px 0 var(--admin-blue); }
    .crm-app main :is(.workspace-section-fallback, .workspace-tools-jump-only) { display: none; }
}
@media print { .crm-app main :is(.property-editor-nav, .workspace-section-nav) { display: none; } }
.crm-app main .workspace-page-tools { padding: 7px 9px; gap: 8px; margin-bottom: 13px; align-items: center; }
.crm-app main .workspace-page-tools > strong { padding: 0; font-size: 11px; color: var(--admin-muted); }
.crm-app main .workspace-page-tools .quick-action { border-radius: 0; min-height: 34px; padding: 6px 9px; }
.crm-app main .workspace-page-tools .quick-action.is-priority { background: var(--admin-blue); color: #fff !important; border-color: var(--admin-blue); }
.crm-app main .workspace-page-tools .quick-action.is-priority:hover { background: var(--admin-pressed) !important; color: #fff !important; }
.crm-app main .workspace-page-tools details { min-width: 0; }
.crm-app main .workspace-page-tools details > summary { min-height: 34px; padding: 6px 9px; }
.crm-app main .workspace-page-tools .section-jumps a { border-radius: 0; }
.crm-app main :is(.metric-card, .metric-icon, .date-tile, .pulse-grid a, .calendar-day, .calendar-entry, .mail-stream, .mail-day-heading, .mail-reading-workbench, .record-picker-current, .record-picker-results, .record-picker-multiple, .access-option, .workflow-steps li, .progression-summary > div) {
    border-radius: 0;
    box-shadow: none;
}
.crm-app main .metric-card { min-height: 100px; padding: 13px; border: 1px solid var(--admin-line); background: #fff; border-top: 3px solid var(--admin-blue); transform: none; }
.crm-app main .metric-card:hover { background: #f5f6ff; }
.crm-app main .metric-card strong { font-size: 28px; }
.crm-app main .metric-card small { font-size: 11px; font-weight: 650; }
.crm-app main .metric-card div > span { font-size: 11px; color: var(--admin-muted); }
.crm-app main .metric-icon { background: #ebeeff; color: var(--admin-link); }
.crm-app main .mail-day-heading { border-color: var(--admin-line); background: var(--admin-subtle); }
.crm-app main .mail-row.is-unread { border-left-color: var(--admin-blue); }
.crm-app main .mail-row.is-unread .mail-row-open::before { background: var(--admin-blue); }

.crm-app main .sort-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--admin-link);
    font-weight: 650;
}
.sort-indicator { font-size: 14px; line-height: 1; }
.mobile-list-sort { display: none; }
.crm-app .property-list-identity { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.crm-app .property-list-cover { flex: none; }
.crm-app .property-list-cover img { display: block; width: 56px; height: 44px; object-fit: cover; border: 1px solid var(--admin-line); }
.crm-app .property-directory-table :is(th,td):first-child { width: 23%; }
.crm-app .property-directory-table :is(th,td):last-child { width: 16%; }
.crm-app .property-directory-table th .sort-link { white-space: nowrap; }
.crm-app .property-list-assignment { display: block; margin-top: 3px; }
.crm-app main .directory-filters > summary { display: none; }
.crm-app main .directory-filters > summary .admin-icon { margin-inline: 2px 3px; }

@media (min-width: 1200px) {
    .crm-app .property-filters { grid-template-columns: minmax(160px, 2fr) repeat(4, minmax(100px,1fr)) auto; gap: 10px; }
    .crm-app .property-filters > div:first-child, .crm-app .property-filters > .filter-actions { grid-column: auto; }
    .crm-app .property-filters > .filter-actions { gap: 9px; }
}

@media (max-width: 900px) {
    .crm-app .crm-workspace { margin-left: 0; }
    .crm-app .crm-sidebar { width: min(84vw, 270px); }
    .crm-app:not(.sidebar-open) .crm-sidebar { visibility: hidden; }
    .crm-app .workspace-topbar { padding-inline: 12px; }
    .crm-app .sidebar-head .crm-brand img { display: none; }
    .crm-app .sidebar-head { min-height: 44px; padding-block: 0; }
    .crm-app .sidebar-search { display: flex; align-items: stretch; padding: 8px 10px 0; }
    .crm-app .sidebar-search input { background: #fff; border-color: #89939c; border-radius: 0; flex: 1; min-width: 0; font-size: 16px; }
    .crm-app .sidebar-search button { margin: 0; padding: 7px 10px; min-width: 42px; border-radius: 0; background: var(--admin-blue); border-color: var(--admin-blue); }
    .crm-app .sidebar-close { min-height: 44px; min-width: 44px; }
    .crm-app .crm-nav a { min-height: 40px; }
    .crm-app .sidebar-footer { display: flex; justify-content: space-between; align-items: center; }
    .crm-app .sidebar-footer .user-card { grid-template-columns: minmax(0,1fr); }
    .crm-app .sidebar-footer :is(.user-avatar,.user-arrow,small) { display: none; }
    .crm-app .sidebar-footer :is(.user-card,.signout-button) { min-height: 44px; }
}

@media (max-width: 760px) {
    body:is(.crm-app, .platform-app) main { padding: 13px 10px 34px; }
    body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) main .card { padding: 12px; margin-bottom: 11px; }
    .crm-app main details.card { padding: 0; }
    .crm-app main .record-tabs { position: static; }
    .crm-app main .workspace-page-tools > strong { width: auto; }
    .crm-app main .workspace-page-tools details { flex: 1 1 auto; width: auto; }
    .crm-app main .bar { flex-direction: row; align-items: flex-start; }
    .crm-app main .bar > div:first-child { flex: 1 1 180px; }
    .crm-app main .bar > :is(a,button,.actions) { max-width: 100%; }
    .crm-app .recent-strip { display: none; }
    .platform-app .platform-sidebar { padding: 5px 9px; }
    .platform-app .platform-brand { padding: 0 0 4px; }
    .platform-app .platform-brand img, .platform-app .platform-brand small, .platform-app .platform-footer { display: none; }
    .platform-app .platform-sidebar nav a { min-height: 40px; }
    .crm-app .mobile-list-sort { display: block; margin: 0 0 9px; }
    .crm-app .mobile-list-sort .actions { padding: 3px 2px 8px; }
    .crm-app .mobile-list-sort a { display: inline-flex; min-height: 44px; align-items: center; padding: 4px 8px; }
    .crm-app main .directory-filters > summary { display: list-item; margin-bottom: 9px; }
}

@media (max-width: 700px) {
    body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) :is(main,header) :is(.button,button):not(.ql-toolbar *) { min-height: 44px; }
    body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) main :is(input:not([type=checkbox],[type=radio],[type=range],[type=color]),select,textarea):not(.ql-toolbar *) {
        min-height: 44px;
        font-size: 16px;
    }
    body:is(.crm-app, .platform-app, .portal-app, .customer-portal-app) main details > summary { min-height: 44px; }
    .crm-app .mobile-record-table tbody [data-mobile-label]::before {
        color: var(--admin-muted);
        font-size: 11px;
        font-weight: 600;
        letter-spacing: 0;
        text-transform: none;
    }
    .crm-app .mobile-record-table tbody tr { border-color: var(--admin-line); border-radius: 0; }
    .crm-app .mobile-record-table tbody tr:nth-child(even) { background: var(--admin-subtle); }
    .crm-app .mobile-record-table tbody td { padding: 8px 10px !important; }
    .crm-app .mobile-record-table thead .sort-link { visibility: hidden; }
    .crm-app .property-directory-table.mobile-record-table tbody tr:has(td:nth-child(2)) { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
    .crm-app .property-directory-table.mobile-record-table tbody td:is(:first-child,:last-child) { grid-column: 1 / -1; }
    .crm-app .workspace-topbar .sidebar-toggle { min-width: 44px; }
    .crm-app .workspace-topbar .topbar-primary { font-size: 13px !important; }
    .crm-app .workspace-topbar .topbar-primary::after { content: none; }
    .crm-app .workspace-topbar .topbar-context { margin-left: 0; }
}

@media print {
    body:is(.crm-app,.platform-app,.portal-app,.customer-portal-app) { background: #fff; }
    .crm-app .crm-workspace { margin: 0; }
    body:is(.crm-app,.platform-app) main { padding: 0; }
    .crm-app .property-editor-nav, .mobile-list-sort { display: none; }
}

.mobile-table-scroll { display: contents; }
.mobile-table-scroll-hint { display: none; }

@media screen and (max-width: 700px) {
    body:is(.crm-app,.platform-app,.portal-app,.customer-portal-app) main :is(.fields > *, .grid > *, .facts > *, .filters > *, .table-wrap, form, fieldset, legend) {
        min-width: 0;
        max-width: 100%;
    }
    body:is(.crm-app,.platform-app,.portal-app,.customer-portal-app) main :is(.button,button,label,legend,summary,h1,h2,h3) {
        overflow-wrap: break-word;
        word-break: normal;
    }
    body:is(.crm-app,.platform-app,.portal-app,.customer-portal-app) main :is(input,select,textarea) {
        min-width: 0;
        max-width: 100%;
    }
    body:is(.crm-app,.platform-app,.portal-app,.customer-portal-app) main input[type="file"] {
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .crm-app main .contact-picker { grid-template-columns: minmax(0, 1fr); }
    .crm-app main .property-record-hero {
        grid-template-columns: minmax(68px, 96px) minmax(0, 1fr);
        gap: 14px;
    }
    .crm-app main .property-hero-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: stretch;
    }
    .crm-app main .tenancy-directory-body > .actions {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
        align-items: stretch;
    }
    .crm-app main :is(.property-hero-actions, .tenancy-directory-body > .actions) > .button {
        width: 100%;
        min-width: 0;
        padding-inline: 10px;
        font-size: 14px;
        white-space: normal;
        overflow-wrap: normal;
        text-align: center;
    }
    .crm-app main .workspace-page-tools > strong { width: 100%; padding: 0; }
    .crm-app main .workspace-page-tools details { flex-basis: 100%; min-width: 0; margin-inline-start: 0; }

    body:is(.crm-app,.platform-app,.portal-app,.customer-portal-app) main .mobile-record-table {
        display: block;
        width: 100% !important;
        min-width: 0 !important;
        table-layout: auto !important;
    }
    body:is(.crm-app,.platform-app,.portal-app,.customer-portal-app) main .mobile-record-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        overflow: hidden;
        clip-path: inset(50%);
    }
    body:is(.crm-app,.platform-app,.portal-app,.customer-portal-app) main .mobile-record-table :is(tbody,tfoot,tr) {
        display: block;
        max-width: 100%;
    }
    body:is(.crm-app,.platform-app,.portal-app,.customer-portal-app) main .mobile-record-table tbody tr {
        margin-bottom: 10px;
        border: 1px solid var(--admin-line);
        background: var(--admin-paper, #fff);
    }
    body:is(.crm-app,.platform-app,.portal-app,.customer-portal-app) main .mobile-record-table tbody tr:nth-child(even) {
        background: var(--admin-subtle);
    }
    body:is(.crm-app,.platform-app,.portal-app,.customer-portal-app) main .mobile-record-table :is(tbody,tfoot) :is(td,th) {
        display: block;
        width: auto !important;
        min-width: 0 !important;
        max-width: 100%;
        padding: 8px 10px !important;
        white-space: normal !important;
        overflow-wrap: break-word;
        text-align: start !important;
    }
    body:is(.crm-app,.platform-app,.portal-app,.customer-portal-app) main .mobile-record-table [data-mobile-label]::before {
        content: attr(data-mobile-label);
        display: block;
        margin-bottom: 3px;
        color: var(--admin-muted);
        font-size: 12px;
        font-weight: 600;
        letter-spacing: 0;
        text-transform: none;
    }
    body:is(.crm-app,.platform-app,.portal-app,.customer-portal-app) main .mobile-record-table td:not([data-mobile-label])::before {
        content: none;
    }
    body:is(.crm-app,.platform-app,.portal-app,.customer-portal-app) main .mobile-record-table .mobile-table-wide-row {
        background: var(--admin-subtle);
    }
    body:is(.crm-app,.platform-app,.portal-app,.customer-portal-app) main .mobile-record-table .mobile-table-wide-row > td {
        color: var(--admin-muted);
        padding: 14px 12px !important;
    }
    .crm-app main .property-directory-table.mobile-record-table tbody tr:has(td:nth-child(2)) { display: grid; }
    .mobile-table-scroll {
        display: block;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
    }
    body:is(.crm-app,.platform-app,.portal-app,.customer-portal-app) main .mobile-table-scroll > table {
        min-width: max(100%, calc(var(--mobile-table-columns) * 7rem)) !important;
        table-layout: auto !important;
    }
    body:is(.crm-app,.platform-app,.portal-app,.customer-portal-app) main .mobile-table-scroll > table th {
        word-break: normal;
        overflow-wrap: normal;
    }
    .mobile-table-scroll-hint { display: block; margin: 0 0 6px; font-size: 12px; }
}

@media screen and (max-width: 350px) {
    .crm-app main .property-hero-actions { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 600px) {
    .crm-app .workspace-topbar .topbar-context { display: none; }
    .crm-app .workspace-topbar { gap: 8px; }
    .crm-app .workspace-topbar .topbar-actions { margin-left: auto; }
    .crm-app .workspace-topbar .topbar-primary { min-height: 38px; }
    .crm-app main .fields { gap: 12px; }
}

/* Agency-branded customer workspace. */
.customer-portal-app {
    margin: 0;
    min-height: 100vh;
    overflow-wrap: anywhere;
}
.customer-portal-app *, .customer-portal-app *::before, .customer-portal-app *::after { box-sizing: border-box; }
.customer-portal-app [hidden] { display: none !important; }
.customer-portal-app:not(.portal-entry) {
    display: grid;
    grid-template-columns: 218px minmax(0, 1fr);
    grid-template-rows: auto 1fr auto;
}
.customer-portal-app :is(main, .portal-topbar, .portal-footer) { grid-column: 2; min-width: 0; }
.customer-portal-app main { padding: 22px 26px 32px; }
.customer-portal-app .portal-sidebar {
    grid-area: 1 / 1 / -1;
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    background: var(--admin-sidebar);
    color: #fff;
}
.customer-portal-app .portal-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 18px 13px 14px;
    border-bottom: 1px solid #424a51;
}
.customer-portal-app .portal-brand img {
    display: block;
    max-width: 100%;
    max-height: 57px;
    object-fit: contain;
    background: #fff;
    padding: 5px;
    margin-bottom: 5px;
}
.customer-portal-app .portal-kind {
    color: #c4ccd4;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .07em;
    text-transform: uppercase;
}
.customer-portal-app .portal-navigation { display: grid; padding: 7px 0; }
.customer-portal-app .portal-navigation :is(a, button) {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    width: 100%;
    padding: 8px 12px;
    border: 0;
    color: #f1f4f6;
    background: transparent;
    text-decoration: none;
    text-align: left;
    font: 500 13px/1.4 var(--admin-font);
    cursor: pointer;
}
.customer-portal-app .portal-navigation :is(a, button):hover { color: #fff; background: var(--admin-sidebar-hover); }
.customer-portal-app .portal-navigation a[aria-current] { color: #fff; background: var(--admin-blue); }
.customer-portal-app .portal-navigation :focus-visible { outline: 2px solid #c7d3ff; outline-offset: -3px; }
.customer-portal-app .portal-navigation form { margin: 8px 0 0; border-top: 1px solid #424a51; }
.customer-portal-app .portal-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 56px;
    padding: 7px 26px;
    border-bottom: 1px solid var(--admin-line);
    background: var(--admin-surface);
}
.customer-portal-app .portal-topbar-name { display: grid; min-width: 0; gap: 1px; }
.customer-portal-app .portal-topbar-name span { font-size: 12px; color: var(--admin-muted); }
.customer-portal-app .portal-topbar > .button { flex-shrink: 0; margin-left: auto; white-space: nowrap; }
.customer-portal-app :is(.button, button) { font-family: inherit; }
.customer-portal-app .button { display: inline-flex; align-items: center; gap: 5px; text-decoration: none; }
.customer-portal-app :is(.portal-mobile-menu, .portal-skip) { display: none; }
.customer-portal-app .portal-skip:focus {
    display: block;
    position: fixed;
    top: 4px;
    left: 4px;
    z-index: 5;
    padding: 10px;
    background: var(--admin-surface);
}
.customer-portal-app .portal-skip:not(:focus) {
    display: block;
    position: fixed;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
}
.customer-portal-app .portal-entry-header { background: var(--admin-sidebar); color: #fff; }
.customer-portal-app.portal-entry .portal-brand { align-items: center; text-align: center; padding: 20px 16px; }
.customer-portal-app.portal-entry .portal-brand img { max-height: 72px; max-width: min(100%, 190px); }
.customer-portal-app.portal-entry .portal-brand strong { font-size: 18px; }
.customer-portal-app.portal-entry main { max-width: 505px; margin: 12px auto 0; padding-bottom: 8px; }
.customer-portal-app.portal-entry main button { width: 100%; }
.customer-portal-app .portal-footer {
    padding: 16px 26px;
    border-top: 1px solid var(--admin-line);
    background: var(--admin-surface);
    font-size: 13px;
    color: var(--admin-muted);
}
.customer-portal-app .portal-footer p { margin: 3px 0; }
.customer-portal-app .portal-footer strong { color: var(--admin-ink); }
.customer-portal-app .portal-powered-by {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    color: var(--admin-muted);
    font-size: 12px;
}
.customer-portal-app .portal-powered-by img { flex: none; }
.customer-portal-app.portal-entry .portal-footer { text-align: center; background: transparent; border: 0; }
.customer-portal-app .portal-contact-links { display: flex; gap: 6px 16px; flex-wrap: wrap; }
.customer-portal-app.portal-entry .portal-contact-links { justify-content: center; }

.customer-portal-app .portal-welcome { margin-bottom: 18px; }
.customer-portal-app .portal-welcome p { margin: 6px 0; color: var(--admin-muted); }
.customer-portal-app .portal-section { margin-bottom: 16px; }
.customer-portal-app .grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: 14px;
}
.customer-portal-app main .grid > .card { margin-bottom: 0; }
.customer-portal-app .portal-tabs + .grid:not(:empty) { margin-bottom: 15px; }
.customer-portal-app .property-overview-card { display: flex; flex-direction: column; align-items: flex-start; gap: 9px; }
.customer-portal-app .property-overview-card :is(h3, p) { margin: 0; }
.customer-portal-app .property-overview-card .button { margin-top: auto; }
.customer-portal-app .property-overview-card .property-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding-bottom: 5px; }
.customer-portal-app main .card > h2,
.customer-portal-app main .section-heading { padding-bottom: 9px; border-bottom: 1px solid var(--admin-line); }
.customer-portal-app .section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-bottom: 12px;
}
.customer-portal-app main .section-heading h2 { margin: 0; }
.customer-portal-app :is(.actions, .reader-actions, .pagination, .portal-tabs) { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.customer-portal-app .portal-tabs {
    margin: 0 0 15px;
    border: 1px solid var(--admin-line);
    background: var(--admin-surface);
}
.customer-portal-app .portal-tabs a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 7px 12px;
    color: var(--admin-link);
    font-weight: 600;
    text-decoration: none;
}
.customer-portal-app .portal-tabs a:hover { color: var(--admin-pressed); background: #edf0ff; }
.customer-portal-app .portal-tabs .tab-action { background: #edf0ff; }
.customer-portal-app :is(section[id], form[id], footer[id]) { scroll-margin-top: 16px; }
.customer-portal-app main > a:first-child { display: inline-block; margin-bottom: 10px; }
.customer-portal-app .pagination { justify-content: space-between; margin-top: 14px; }
.customer-portal-app .muted { color: var(--admin-muted); }
.customer-portal-app .pre { white-space: pre-wrap; }
.customer-portal-app .empty-state { margin-bottom: 0; padding: 12px; background: var(--admin-subtle); color: var(--admin-muted); }
.customer-portal-app dl { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 8px; }
.customer-portal-app dt { color: var(--admin-muted); }
.customer-portal-app dd { margin: 0; color: var(--admin-ink); font-weight: 600; }
.customer-portal-app .rent-entry { margin: 10px 0; padding: 12px; border: 1px solid var(--admin-line); background: var(--admin-subtle); }
.customer-portal-app .rent-entry h3 { margin: 0 0 8px; }
.customer-portal-app .rent-entry dl { margin: 0; }
.customer-portal-app .notice { padding: 12px; margin-bottom: 14px; border: 1px solid #e2c691; border-left-width: 4px; background: #fff5df; }
.customer-portal-app .portal-success { border-color: #8bb8a3; background: #eef8f2; }
.customer-portal-app .portal-errors { border-color: #c47773; background: #fff1ef; }
.customer-portal-app .portal-errors p { margin: 4px 0; }

.customer-portal-app main a.message-row:any-link {
    display: block;
    padding: 12px 10px;
    border-bottom: 1px solid var(--admin-line);
    color: var(--admin-ink);
    text-decoration: none;
}
.customer-portal-app a.message-row:nth-of-type(odd) { background: var(--admin-subtle); }
.customer-portal-app main a.message-row:hover { color: var(--admin-ink); background: #edf0ff; }
.customer-portal-app .message-top { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: baseline; gap: 1px 12px; }
.customer-portal-app .message-top time { font-size: 12px; color: var(--admin-muted); }
.customer-portal-app .message-subject { display: block; margin: 3px 0; font-size: 15px; font-weight: 600; }
.customer-portal-app .message-preview {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--admin-muted);
}
.customer-portal-app .message-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 7px; font-size: 12px; }
.customer-portal-app .message-meta > span:last-child { margin-left: auto; color: var(--admin-link); }
.customer-portal-app :is(.channel-label, .badge) { padding: 3px 6px; background: #edf0ff; color: var(--admin-link); font-size: 11px; font-weight: 600; }
.customer-portal-app .message-photo-strip { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.customer-portal-app .message-photo-strip:empty { display: none; }
.customer-portal-app .message-photo-strip img { width: 56px; height: 56px; object-fit: cover; border: 1px solid var(--admin-line); }
.customer-portal-app .reader-heading { padding-bottom: 9px; margin-bottom: 10px; border-bottom: 1px solid var(--admin-line); }
.customer-portal-app .reader-heading p { margin: 6px 0 0; }
.customer-portal-app .email-frame { display: block; width: 100%; height: clamp(350px, 65vh, 900px); border: 1px solid var(--admin-line); margin: 10px 0; background: #fff; }
.customer-portal-app .portal-message-frame { height: 280px; }

.customer-portal-app :is(input, select, textarea):not(.ql-toolbar *, .ql-tooltip *) { display: block; width: 100%; max-width: 100%; min-width: 0; }
.customer-portal-app input[type=file] { font-size: 13px; }
.customer-portal-app input[type=file]::file-selector-button {
    border: 1px solid var(--admin-line);
    background: var(--admin-subtle);
    padding: 4px 7px;
    margin-inline-end: 8px;
    color: var(--admin-ink);
}
.customer-portal-app label { display: block; margin-top: 13px; }
.customer-portal-app .compose-section .rich-compose { margin-top: 14px; }
.customer-portal-app .rich-compose :is(.ql-toolbar, .ql-container) { border-color: var(--admin-line); background: var(--admin-surface); }
.customer-portal-app .rich-compose .ql-toolbar { background: var(--admin-subtle); display: flex; align-items: center; flex-wrap: wrap; gap: 2px 6px; }
.customer-portal-app .rich-compose .ql-toolbar .ql-formats { display: inline-flex; align-items: center; margin: 0; }
.customer-portal-app .rich-compose .ql-toolbar :is(button, .ql-picker) { height: 34px; }
.customer-portal-app .rich-compose .ql-toolbar button { width: 34px; }
.customer-portal-app .rich-compose .ql-toolbar .ql-picker-label { display: flex; align-items: center; }
.customer-portal-app .rich-message-editor .ql-editor { min-height: 155px; font: 16px/1.5 var(--admin-font); }
.customer-portal-app .editor-hint { display: block; margin-top: 6px; }
.customer-portal-app [data-message-status] { white-space: pre-wrap; font-weight: 600; }
.customer-portal-app :is(.portal-photo-previews, .portal-email-attachment-grid) {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr));
    gap: 10px;
    list-style: none;
    margin: 12px 0;
    padding: 0;
}
.customer-portal-app .portal-photo-previews:empty { display: none; }
.customer-portal-app :is(.portal-photo-card, .portal-email-attachment-card) {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--admin-line);
    background: var(--admin-surface);
}
.customer-portal-app :is(.portal-photo-card, .portal-email-attachment-card) img { display: block; width: 100%; height: 140px; object-fit: contain; background: var(--admin-subtle); }
.customer-portal-app :is(.portal-photo-card, .portal-email-attachment-card) strong { font-size: 13px; }
.customer-portal-app .portal-photo-card progress { width: 100%; }
.customer-portal-app .portal-photo-card p { margin: 0; }
.customer-portal-app :is(.portal-file-icon, .file-label) { padding: 20px 8px; text-align: center; background: var(--admin-subtle); color: var(--admin-muted); }

@media (max-width: 760px) {
    .customer-portal-app:not(.portal-entry) { display: flex; flex-direction: column; }
    .customer-portal-app .portal-sidebar { display: none; }
    .customer-portal-app .portal-topbar {
        position: sticky;
        z-index: 3;
        top: 0;
        gap: 8px;
        min-height: 53px;
        padding: 4px 10px;
        background: var(--admin-sidebar);
        color: #fff;
    }
    .customer-portal-app .portal-topbar-name { flex: 1; font-size: 12px; }
    .customer-portal-app .portal-topbar-name span { color: #c4ccd4; font-size: 10px; }
    .customer-portal-app .portal-topbar > .button { font-size: 12px; padding-inline: 7px; min-height: 44px; }
    .customer-portal-app .portal-topbar > .button .admin-icon { width: 13px; }
    .customer-portal-app .portal-mobile-menu { display: block; flex: none; }
    .customer-portal-app .portal-mobile-menu summary {
        display: flex;
        align-items: center;
        gap: 4px;
        min-height: 44px;
        padding: 0 6px;
        font-size: 12px;
        cursor: pointer;
    }
    .customer-portal-app .portal-mobile-menu summary::-webkit-details-marker { display: none; }
    .customer-portal-app .portal-mobile-menu .portal-navigation {
        position: absolute;
        top: 100%;
        left: 0;
        width: min(100%, 275px);
        max-height: calc(100dvh - 65px);
        overflow: auto;
        background: var(--admin-sidebar);
        border: 1px solid #424a51;
        box-shadow: 0 6px 12px #0003;
    }
    .customer-portal-app .portal-navigation :is(a, button) { min-height: 44px; }
    .customer-portal-app main { flex: 1; padding: 14px 10px 22px; }
    .customer-portal-app .portal-footer { padding: 12px 10px; }
    .customer-portal-app .portal-contact-links a { display: inline-flex; align-items: center; min-height: 44px; }
    .customer-portal-app .grid { grid-template-columns: 1fr; gap: 10px; }
    .customer-portal-app :is(main[id], section[id], form[id], footer[id]) { scroll-margin-top: 65px; }
    .customer-portal-app .portal-tabs a { min-height: 44px; padding-inline: 8px; }
    .customer-portal-app dl { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
    .customer-portal-app dd { text-align: right; }
    .customer-portal-app .email-frame { min-height: 310px; height: 60svh; }
    .customer-portal-app .portal-message-frame { min-height: 220px; height: 45svh; }
    .customer-portal-app :is(.portal-photo-previews, .portal-email-attachment-grid) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .customer-portal-app :is(.portal-photo-card, .portal-email-attachment-card) img { height: 100px; }
    .customer-portal-app .rich-compose .ql-toolbar :is(button, .ql-picker) { min-height: 40px; }
}
@media print {
    .customer-portal-app:not(.portal-entry) { display: block; }
    .customer-portal-app :is(.portal-sidebar, .portal-topbar, .reader-actions, .portal-tabs, .portal-skip, .compose-section, button) { display: none; }
    .customer-portal-app main { padding: 0; }
    .customer-portal-app .rent-entry { break-inside: avoid; }
}

/* Record lifecycle labels stay readable across the CRM and customer portal. */
body .badge.status-badge-active {
    background: #14633c;
    color: #fff;
}

body .badge.status-badge-ended {
    background: #831f32;
    color: #fff;
}

body .badge:is(.status-badge-active, .status-badge-ended) {
    font-weight: 700;
}


/* Contact role badges share the shape and marker of record status badges. */
.crm-app main .badge.contact-role-badge {
    border: 0;
    line-height: inherit;
}

.crm-app .badge.contact-role-badge.role-tenant {
    background: #cd7f32;
    color: #fff;
    text-shadow: 0 1px 2px #07111b, 0 0 2px #07111b;
}

.crm-app .badge.contact-role-badge.role-landlord {
    background: #9400d3;
    color: #fff;
}

.crm-app .badge.contact-role-badge.role-vendor {
    background: #007fff;
    color: #fff;
    text-shadow: 0 1px 2px #07111b, 0 0 2px #07111b;
}

.crm-app .badge.contact-role-badge.role-buyer {
    background: #e7effa;
    color: #27578a;
}

.crm-app .badge.contact-role-badge.role-other {
    background: #edf0f4;
    color: #526173;
}

@media (max-width: 760px) {
    .crm-app main a.badge.contact-role-badge {
        min-height: 24px;
    }
}


/* Highlight the people already selected for this property. */
.crm-app .contact-choice.is-linked {
    background: #edf7f5;
    border-color: #7bb0a5;
}

.crm-app .contact-choice.is-main-contact {
    background: #daefe9;
    border-inline-start: 4px solid #087b72;
}

.contact-choice-name {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px 10px;
}

.contact-choice-label {
    color: #145c4c;
    background: #d7eee7;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 700;
}

.let-stage-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
}

.let-stage-summary p {
    margin: 0;
}

.let-stage-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 155px), 1fr));
    gap: 8px;
    margin: 14px 0;
    padding: 0;
    list-style: none;
}

.let-stage-list li {
    display: grid;
    align-content: start;
    gap: 4px;
    border: 1px solid #d4dee6;
    padding: 10px 12px;
}

.let-stage-list [aria-current="step"] {
    border-color: #368a7b;
    background: #e2f3ed;
    color: #154e43;
}

@media (max-width: 600px) {
    .let-stage-list {
        grid-template-columns: 1fr;
    }
}

.record-context {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 24px;
    margin: 0 0 18px;
    padding: 14px 18px;
    border: 1px solid #b9c6ec;
    border-inline-start: 5px solid var(--admin-blue);
    background: #eef2ff;
    color: #16264d;
}

.record-context-items {
    flex: 1 1 24rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
    gap: 12px 18px;
    min-width: 0;
    margin: 0;
}

.record-context-item {
    min-width: 0;
    overflow-wrap: anywhere;
}

.record-context-item dt {
    margin-bottom: 3px;
    color: #334978;
    font-size: 13px;
    font-weight: 650;
}

.record-context-item dd {
    margin: 0;
    font-size: clamp(17px, 2vw, 22px);
    font-weight: 700;
    line-height: 1.35;
}

.record-context-item dd small {
    display: block;
    margin-top: 5px;
    color: #334978;
    font-weight: 500;
}

.record-context .record-context-actions {
    margin: 0;
    max-width: 100%;
}

.valuation-report-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
    align-items: start;
    gap: 12px;
    margin: 0 0 18px;
    padding: 0;
    list-style: none;
}

.valuation-report-cards > li {
    min-width: 0;
    padding: 14px 16px;
    border: 1px solid var(--admin-line);
    background: var(--admin-subtle);
}

.valuation-report-cards > li > p { margin: 7px 0; }
.valuation-report-options { margin-top: 9px; }
.valuation-report-options > form { margin-top: 14px; }

.crm-app main details > .valuation-compact-summary {
    width: fit-content;
    max-width: 100%;
    min-height: 44px;
    padding-block: 9px;
    padding-inline: 12px 40px;
    white-space: normal;
}

.valuation-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px 14px;
}

.crm-app main .valuation-section-heading h2 {
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
}

.crm-app main .valuation-section-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    min-height: 44px;
    font-size: 17px;
    font-weight: 700;
}

.valuation-section-chevron {
    display: inline-block;
    font-size: 23px;
    line-height: 1;
}

[data-section-toggle][aria-expanded="true"] .valuation-section-chevron { transform: rotate(90deg); }
.valuation-section-fields { margin-top: 12px; }
.valuation-section-fields > .valuation-include-all { margin-bottom: 12px; }

@media (max-width: 600px) {
    .record-context {
        align-items: stretch;
        gap: 10px;
        padding: 12px;
    }

    .record-context .button {
        min-height: 44px;
    }
}
