* { box-sizing: border-box; }
:root {
    color-scheme: light;
    --ink: #172138;
    --muted: #53627b;
    --line: #dce4f1;
    --blue: #244be6;
    --blue-hover: #1939c3;
    --blue-soft: #eaf0ff;
    --canvas: #f3f6fc;
    --workspace-background: radial-gradient(ellipse at 88% 0%, #e9effe, transparent 780px), var(--canvas);
    --sidebar: #101a31;
    --sidebar-width: 182px;
    --sidebar-icon-size: 21px;
    --panel-shadow: 0 3px 5px #1a2a4c06, 0 12px 32px #1a2a4c08;
    --surface: #fff;
    --font-ui: system-ui, sans-serif;
    --text-body: 0.875rem;
    --text-small: 0.75rem;
    --text-caption: 0.6875rem;
    --text-page: clamp(1.5rem, 2.3vw, 1.875rem);
    --text-section: 1rem;
    --weight-medium: 600;
    --weight-heading: 700;
    --danger: #bf2638;
    --danger-hover: #961b2b;
    --danger-surface: #fff0f2;
}
body { min-height: 100vh; margin: 0; background: var(--workspace-background); background-attachment: fixed; background-repeat: no-repeat; color: var(--ink); font: var(--text-body)/1.5 var(--font-ui); }
.sidebar { position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; width: var(--sidebar-width); overflow-y: auto; padding: 16px 10px 12px; background: linear-gradient(160deg, #19294b, var(--sidebar) 62%); color: white; }
.sidebar-nav { display: flex; flex: 1; flex-direction: column; }
#settings-gear { display: grid; place-items: center; align-self: flex-start; margin-top: auto; width: 36px; height: 36px; padding: 0; background: #ffffff0a; border: 1px solid #ffffff20; }
#settings-gear svg { width: var(--sidebar-icon-size); height: var(--sidebar-icon-size); }
#settings-gear:hover, #settings-gear.active { background: #ffffff20; }
.sidebar-modules { display: flex; flex-direction: column; }
.sidebar-module { display: flex; align-items: center; gap: 8px; cursor: grab; touch-action: none; user-select: none; }
.sidebar-modules .sidebar-module.sortable-dragging { background: #3656bc; color: white; }
.sidebar-modules .sortable-placeholder { background: #314777; }
.sidebar-modules .sortable-placeholder.sortable-outside { background: transparent; }
.sidebar-module svg { width: var(--sidebar-icon-size); height: var(--sidebar-icon-size); flex: 0 0 auto; }
.sidebar-module.active { background: #3656bc; box-shadow: 0 4px 14px #060e2d55; }
.brand { --brand-logo-height: 72px; --brand-mark-size: 54px; display: flex; flex: 0 0 auto; flex-direction: column; align-items: center; gap: 8px; text-align: center; color: white; font-size: var(--text-section); font-weight: var(--weight-heading); padding: 4px 6px 12px; margin-bottom: 12px; border-bottom: 1px solid #ffffff20; }
.brand-mark { display: grid; place-items: center; width: var(--brand-mark-size); height: var(--brand-mark-size); border-radius: 12px; background: #a9c5ff; color: #142039; font-size: 1.4rem; }
.brand-logo { display: block; width: min(100%, 128px); height: var(--brand-logo-height); object-fit: contain; padding: 5px; border-radius: 10px; background: white; }
.brand-text { min-width: 0; max-width: 100%; line-height: 1.25; overflow-wrap: anywhere; }
nav { display: grid; gap: 6px; }
nav a { color: #c1cde1; padding: 7px 10px; border-radius: 8px; font-weight: var(--weight-medium); }
nav a:hover, nav .active { color: white; background: #263a60; text-decoration: none; }
main {
    --page-inset: clamp(14px, 1.5vw, 28px); --page-start: 20px; --workspace-topbar-height: 56px;
    margin-left: var(--sidebar-width); padding: var(--page-start) var(--page-inset) 20px;
}
.page-heading {
    position: sticky; top: 0; z-index: 12; display: grid; align-items: center;
    grid-template-columns: minmax(0, 1fr) minmax(150px, min(28%, 400px)) minmax(0, 1fr);
    grid-template-areas: "title search actions"; gap: 8px 12px;
    min-height: 56px; margin: calc(-1 * var(--page-start)) calc(-1 * var(--page-inset)) 12px;
    padding: 7px var(--page-inset);
    /* Match the page gradient in viewport coordinates, not coordinates local to the bar. */
    background: var(--workspace-background); background-attachment: fixed; background-repeat: no-repeat;
}
.page-heading > .page-title { grid-area: title; display: flex; align-items: center; gap: 10px; min-width: 0; }
.page-title-text { min-width: 0; }
.page-heading .page-title-text:has(> .breadcrumb) { display: flex; align-items: center; gap: 8px; }
.page-heading .breadcrumb { flex: 0 0 auto; }
.page-title-text h1 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.page-heading > .global-search { grid-area: search; align-self: center; }
.page-heading > .page-actions { grid-area: actions; min-width: 0; margin: 0; gap: 6px; }
.page-heading > .page-actions > .button { text-align: center; }
.page-heading > .page-actions .job-values { justify-content: flex-end; }
.breadcrumb { display: inline-flex; color: var(--muted); font-size: var(--text-small); font-weight: var(--weight-medium); }
@media (max-width: 700px) {
    .page-heading {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-areas: "title actions" "search search";
        gap: 5px 8px;
    }
    .page-heading > .global-search { width: min(100%, 400px); justify-self: center; }
    .page-heading h1 { font-size: 1.25rem; }
    main { --workspace-topbar-height: 86px; }
}
.breadcrumb:hover { color: var(--blue); }
h1 { margin: 0; font-size: var(--text-page); letter-spacing: -.045em; line-height: 1.15; overflow-wrap: anywhere; }
h1, h2, h3, .settings-section > summary { font-weight: var(--weight-heading); }
h2, .settings-section > summary { font-size: var(--text-section); line-height: 1.3; }
h2 { margin: 0 0 12px; }
h3 { margin: 0; font-size: var(--text-body); overflow-wrap: anywhere; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 10px; box-shadow: var(--panel-shadow); }
.automation-builder > .panel:first-of-type, .panel-accent { background: linear-gradient(110deg, #f1f5ff, white 70%); border-color: #cfddf6; }
.record-anchor#details, .related-records {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
}
.record-anchor#details { background: #ffffff80; }
.related-records { margin-top: 14px; background: #e9effb; border-color: #d7e1f4; }
.record-anchor#details > .panel:last-child, .related-records > .panel:last-of-type { margin-bottom: 0; }
.related-records > h2 { margin-bottom: 12px; }
.related-records > .panel > .diary-toolbar + .table-scroll { margin-top: 8px; }
.directory { padding: 0; overflow: hidden; }
.profile-layouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 8px; max-width: 760px; }
.profile-layout-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 42px; padding: 4px 7px 4px 10px; border: 1px solid var(--line); border-radius: 8px; }
.profile-layout-row > span { font-weight: var(--weight-medium); }
.profile-layout-row .profile-layout-reset { width: 30px; height: 30px; color: var(--blue); }
.filters, .toolbar, .inline { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.filters { padding: 11px 12px; background: #fff; }
.filters label:not(.search) { min-width: min(130px, 100%); }
.search { position: relative; flex: 1 1 220px; }
.search input { padding-inline-start: 35px; background: #f8faff; }
.search::before { content: ''; position: absolute; bottom: 12px; left: 11px; width: 10px; height: 10px; border: 1.5px solid var(--muted); border-radius: 50%; pointer-events: none; }
.search::after { content: ''; position: absolute; bottom: 10px; left: 21px; width: 6px; height: 1.5px; background: var(--muted); transform: rotate(45deg); pointer-events: none; }
.toolbar { justify-content: space-between; margin-bottom: 16px; }
.page-actions { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
main > .settings-tabs:has(+ .page-actions) { margin-bottom: 8px; }
.inline { margin: 12px 0; }
.table-scroll { overflow: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; }
th, td { padding: 8px 12px; border-bottom: 1px solid #e8edf6; overflow-wrap: anywhere; }
th:first-child, td:first-child { padding-inline-start: 12px; }
th { background: #eef3fb; white-space: nowrap; border-top: 1px solid var(--line); font-size: var(--text-small); }
th[aria-sort] a { color: var(--blue); }
th a { display: inline-flex; gap: 8px; color: var(--ink); }
tbody tr:hover { background: #f8faff; }
.contact-link { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: var(--weight-heading); }
.directory .contact-link { font-weight: 400; }
.contact-link:hover { color: var(--blue); text-decoration: none; }
tr:nth-child(3n + 2) .avatar { background: #e4f4f0; color: #176951; }
tr:nth-child(3n + 3) .avatar { background: #f1eaff; color: #6335a5; }
.avatar { display: inline-grid; place-items: center; flex: 0 0 auto; width: 28px; height: 28px; border-radius: 8px; background: #e9efff; color: #2449ae; font-size: var(--text-caption); font-weight: 800; }
.directory td.directory-leading-badge { position: relative; padding-inline-start: 50px; }
.directory td.directory-leading-badge > .avatar { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); }
.page-heading .avatar { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(145deg, #dfe8ff, #eef2ff); border: 1px solid #cfdcfa; font-size: var(--text-section); }
.table-footer { display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 5px 12px; font-size: var(--text-small); color: var(--muted); background: #fbfcff; }
.directory:has([data-directory-pagination]) .table-footer { flex-wrap: wrap; }
.directory-paging { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; }
.directory-page-size label { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.directory-page-size select { min-height: 28px; padding: 2px 6px; font-size: inherit; width: auto; }
.directory-pagination:not([hidden]) { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.directory-pagination .button { min-height: 28px; padding: 3px 8px; }
.column-picker { width: min(480px, calc(100% - 28px)); max-height: calc(100% - 28px); padding: 22px; border: 1px solid var(--line); border-radius: 18px; color: var(--ink); box-shadow: 0 24px 80px #0c17364a; }
.column-picker::backdrop { background: #101a316f; backdrop-filter: blur(3px); }
.column-group { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; }
.column-group > summary { padding: 10px 12px; }
.column-group > summary::marker { color: var(--blue); }
.column-group[open] > summary { border-bottom: 1px solid var(--line); }
.column-group .grid { padding: 10px 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 175px), 1fr)); }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 12px; }
.empty { text-align: center; padding: 32px; color: var(--muted); }
input, select, textarea, button, .button { font: inherit; font-size: var(--text-body); border: 1px solid #cbd6e9; border-radius: 8px; padding: 6px 9px; background: white; color: inherit; }
input[type="number"] { appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
select:not([multiple], [size]) {
    appearance: none;
    min-width: 0;
    padding-inline-end: 32px;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: right 15px center, right 10px center;
    background-size: 5px 5px;
    background-repeat: no-repeat;
    cursor: pointer;
}
select:not([multiple], [size]):enabled:hover { border-color: #aebfe0; background-color: #f8faff; }
select:disabled { cursor: default; opacity: .65; }

@supports (appearance: base-select) and selector(select::picker(select)) {
    select:not([multiple], [size]), select:not([multiple], [size])::picker(select) {
        appearance: base-select;
    }
    select:not([multiple], [size]) {
        gap: 10px;
        padding-inline-end: 12px;
        background-image: none;
    }
    select:not([multiple], [size]):open { border-color: var(--blue); background-color: #f8faff; }
    select::picker-icon { color: var(--muted); }
    select:open::picker-icon { color: var(--blue); rotate: 180deg; }
    select::picker(select) {
        min-inline-size: max(anchor-size(width), 144px);
        max-inline-size: min(380px, calc(100vw - 24px));
        max-block-size: min(320px, 45dvh);
        margin-block: 6px;
        padding: 5px;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: var(--surface);
        color: var(--ink);
        box-shadow: 0 10px 28px #17213826;
        overscroll-behavior: contain;
    }
    select option {
        gap: 8px;
        min-block-size: 34px;
        padding: 7px 9px;
        border: 0;
        border-radius: 7px;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    select option:checked { background: var(--blue-soft); color: var(--blue); font-weight: var(--weight-medium); }
    select option:enabled:hover, select option:enabled:focus-visible { background: #e0eaff; color: var(--blue-hover); }
    select option:focus-visible { outline-offset: -2px; }
    select option:disabled { color: var(--muted); opacity: .65; }
    select option::checkmark { order: 1; margin-inline-start: auto; color: var(--blue); }
    select optgroup { padding-block: 3px; font-size: var(--text-small); color: var(--muted); }
}
input[type="checkbox"] { accent-color: var(--blue); }
label { display: grid; gap: 5px; font-size: var(--text-small); font-weight: var(--weight-medium); }
label input, label textarea { width: 100%; min-width: 0; }
textarea { resize: vertical; }
.check { display: flex; align-items: center; }
.check input { width: auto; }
button, .button, summary { cursor: pointer; font-weight: var(--weight-medium); }
.button { display: inline-block; }
button:hover, .button:hover { text-decoration: none; background: #edf2fc; }
button:disabled { cursor: default; opacity: .55; }
input::placeholder { color: #697992; opacity: 1; }
.primary { color: white; background: var(--blue); border-color: var(--blue); box-shadow: 0 3px 6px #234be629; }
.primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
.danger-button { color: white; background: var(--danger); border-color: var(--danger); }
.danger-button:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.quiet { border-color: transparent; background: transparent; color: var(--blue); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 205px), 1fr)); gap: 12px; margin: 0 0 10px; }
.grid:last-child { margin-bottom: 0; }
.contact-tabs { display: flex; gap: 4px; margin-bottom: 14px; overflow-x: auto; padding: 5px; border: 1px solid var(--line); border-radius: 13px; }
.contact-tabs a { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; padding: 7px 13px; border: 1px solid transparent; border-radius: 9px; color: var(--muted); }
.contact-tabs a:hover { background: #e7eeff; color: var(--blue); }
.contact-tabs a[aria-current="location"] { background: var(--blue-soft); border-color: #dce6ff; color: var(--blue); }
.contact-tabs a:focus-visible { outline-offset: -3px; }
.tab-count { min-width: 20px; padding: 0 5px; border-radius: 12px; background: #e7eeff; color: var(--blue); text-align: center; font-size: var(--text-caption); }
dt, .muted, time { color: var(--muted); font-size: var(--text-small); }
dd { margin: 3px 0 0; overflow-wrap: anywhere; }
.note { padding: 12px 0; border-bottom: 1px solid var(--line); }
.notes-heading, .note-header, .note-title-group, .note-actions { display: flex; align-items: center; gap: 8px; }
.notes-heading, .note-header { justify-content: space-between; flex-wrap: wrap; }
.notes-heading h2 { margin: 0; }
.notes-heading { margin-bottom: 12px; }
.note p { margin: 5px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-actions { flex-wrap: wrap; }
.note-metadata { display: inline-flex; flex-wrap: wrap; gap: 3px 7px; color: var(--muted); font-size: var(--text-small); }
.note .edit-note { padding: 4px 8px; font-size: var(--text-small); }
.note-handle { width: 26px; height: 26px; }
.note.sortable-dragging { padding-inline: 10px; }
#note-order-form:not([hidden]), .note-editor-form { display: grid; gap: 12px; }
#note-order-form { margin-top: 14px; }
#note-order-form button { justify-self: start; }
.record-anchor { scroll-margin-top: 64px; }
.contact-tabs { position: sticky; z-index: 3; top: 5px; background: #ffffffee; backdrop-filter: blur(12px); }
:focus-visible { outline: 3px solid #3676db; outline-offset: 2px; }
@media (max-width: 700px) {
    .sidebar { position: static; width: auto; overflow-y: visible; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 12px 16px; }
    .sidebar-nav { flex: 1 1 100%; min-width: 0; flex-direction: row; align-items: center; gap: 8px; }
    .sidebar-modules { flex: 1; flex-direction: row; min-width: 0; overflow-x: auto; }
    .sidebar-module { flex: 0 0 auto; touch-action: pan-y; }
    #settings-gear { margin-top: 0; }
    .brand { --brand-logo-height: 54px; --brand-mark-size: 42px; flex: 1 1 100%; min-width: 0; margin: 0; padding: 0 4px 4px; border: 0; }
    nav { display: flex; }
    main { --page-start: 16px; --page-inset: 12px; margin: 0; padding-bottom: 16px; }
    .panel:not(.directory) { padding: 12px; }
    .filters, .table-footer { padding-inline: 12px; }
}

.section-choices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 175px), 1fr));
    gap: 8px;
}
.section-choices .check {
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
}
.section-choices input { flex: 0 0 auto; margin: 0; }

.settings-tabs { display: flex; gap: 4px; width: fit-content; max-width: 100%; padding: 4px; margin: 0 0 16px; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff9; }
.settings-nav-row { display: flex; align-items: flex-start; gap: 8px; min-width: 0; margin-bottom: 16px; }
.settings-nav-row:has(+ .settings-tabs, + .page-actions, + .settings-template-toolbar) { margin-bottom: 8px; }
.settings-nav-row > .settings-tabs { flex: 0 0 auto; margin-bottom: 0; }
.settings-nav-row > .settings-module-tabs { flex: 0 1 auto; min-width: 0; }
.settings-tabs a { flex: 0 0 auto; padding: 6px 13px; border-radius: 8px; color: var(--muted); }
.settings-tabs a:hover { color: var(--blue); background: #e7eeff; }
.settings-tabs a[aria-current="page"] { color: var(--blue); background: var(--blue-soft); }
.settings-tabs a:focus-visible { outline-offset: -3px; }
@media (max-width: 720px) {
    .settings-nav-row { flex-wrap: wrap; }
}
.integration-settings > ul { margin-bottom: 0; }
[data-cleanup-options] [hidden] { display: none; }
.cleanup-value { white-space: pre-wrap; overflow-wrap: anywhere; }

.settings-section > summary::marker { color: var(--blue); }
.module-settings .panel { margin-bottom: 12px; }
.module-settings .panel > :last-child:not(script) { margin-bottom: 0; }
.module-settings form > button[type="submit"] { margin-block: 10px 0; }
.module-settings .choice-field { min-width: 0; }
.module-settings .settings-section {
    margin-top: 8px; border: 1px solid var(--line); border-radius: 10px;
}
.module-settings .settings-section > summary { padding: 10px 12px; cursor: pointer; overflow-wrap: anywhere; }
.module-settings .settings-section[open] > summary {
    background: var(--blue-soft); border-radius: 9px 9px 0 0;
}
.settings-field-form { padding: 12px; }
.settings-field-row { position: relative; margin-bottom: 8px; }
.module-settings .settings-add-field > details { border: 0; }
.module-settings .settings-add-field > details > summary.add-field-row {
    display: block; list-style: none; text-align: center; padding: 12px; border-radius: 8px;
    font-size: var(--text-body); font-weight: var(--weight-medium); line-height: inherit;
}
.module-settings .settings-add-field > details > summary.add-field-row:not(:hover) { background: white; }
.module-settings .settings-add-field > details > summary::-webkit-details-marker { display: none; }
.module-settings .settings-add-field > details > form {
    margin-top: 8px; border: 1px solid var(--line); border-radius: 10px;
}
.ticket-visibility-settings [hidden] { display: none; }
.module-settings .settings-field-row > .settings-section { margin-top: 0; }
.settings-field-row[data-field-id] summary { padding-inline-end: 84px; min-height: 42px; }
.settings-field-actions {
    position: absolute; inset-block-start: 5px; inset-inline-end: 8px;
    display: flex; align-items: center; gap: 4px;
}
.settings-field-type { display: grid; align-content: center; gap: 4px; }
.settings-field-type > span { color: var(--muted); font-size: var(--text-small); }
.builder-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.company-form { display: grid; align-items: start; gap: 16px 22px; }
.company-identity { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; min-width: 0; }
.company-name, .company-logo, .company-form-actions { grid-column: 1 / -1; }
.company-identity label > select { min-width: 0; width: 100%; }
.company-logo { border-top: 1px solid var(--line); padding-top: 12px; }
.company-logo-label { display: block; margin-bottom: 5px; }
#company-logo-upload { margin-top: 6px; }
#company-logo { width: 100%; min-width: 0; }
.company-logo .muted { margin: 5px 0 9px; }
.company-form-actions { display: flex; justify-content: flex-end; }
.general-settings { padding: 14px; }
.general-settings > h2 { padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid #e9edf5; }
@media (min-width: 1020px) {
    .company-form { grid-template-columns: minmax(0, 1fr) minmax(310px, 1fr); }
}
@media (max-width: 420px) {
    .company-identity { grid-template-columns: minmax(0, 1fr); }
}
.logo-preview { display: block; width: 90px; height: 60px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; margin: 0 0 8px; }

.working-hours { min-width: 0; margin: 0; padding: 10px 13px; border: 1px solid var(--line); border-radius: 12px; background: #f7f9fe; }
.working-hours legend { padding: 0 5px; font-size: var(--text-small); font-weight: var(--weight-medium); }
.workday { display: grid; grid-template-columns: minmax(0, 1.2fr) repeat(2, minmax(0, 1fr)); align-items: center; gap: 8px; padding: 3px 0; }
.workday-header { font-size: var(--text-small); font-weight: var(--weight-medium); color: var(--muted); }
.workday .check { gap: 5px; overflow-wrap: anywhere; }
.workday .check input { flex: 0 0 auto; margin: 0; }
.workday input[type="time"] { width: 100%; min-width: 0; padding: 6px 4px; }
.workday input:disabled { background: #edf2fa; color: var(--muted); }
.legacy-hours { white-space: pre-wrap; overflow-wrap: anywhere; }

.section-save-error { margin-top: 0; color: var(--danger-hover); }
.section-field-scroll { overflow-x: auto; }
.section-field-list {
    --layout-gap: 12px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 170px;
    gap: var(--layout-gap);
    min-width: 460px;
}
.section-field-list > *, .field-layout > [style] {
    grid-row: var(--slot-row);
    grid-column: var(--slot-column) / span var(--slot-width, 1);
    justify-self: var(--slot-align, stretch);
    inline-size: var(--slot-inline-size, auto);
}
.section-field-row { display: grid; align-content: start; gap: 6px; padding: 8px 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcff; min-width: 0; }
.save-toast { position: fixed; z-index: 5; top: 18px; right: 18px; max-width: calc(100% - 36px); margin: 0; padding: 10px 16px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); box-shadow: 0 4px 16px #16294820; font-weight: var(--weight-medium); }
.job-tba-toast { display: flex; flex-wrap: wrap; gap: 8px 12px; }
.section-field-row label { gap: 2px; }
.section-field-row input, .section-field-row select { padding: 4px 7px; min-width: 0; }
.section-field-row select:not([multiple], [size]) { padding-inline-end: 24px; }
.field-actions { display: flex; justify-content: space-between; }
.field-actions-left { display: flex; align-items: center; gap: 4px; }
.move-contact-field { color: var(--muted); }
.field-move-destinations { display: grid; gap: 6px; max-height: min(48vh, 380px); overflow: auto; }
.field-move-destinations .button { justify-content: flex-start; text-align: left; }
.core-section-settings dt:has(.move-contact-field) { display: flex; align-items: center; gap: 4px; }
.field-actions-right { display: flex; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; }
.field-handle { border: 0; padding: 1px 6px; line-height: 1.2; }
.field-handle { cursor: grab; touch-action: none; user-select: none; color: var(--muted); }
.icon-button { display: inline-grid; place-items: center; flex: 0 0 auto; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 6px; background: transparent; }
.icon-button svg { width: 16px; height: 16px; }
.phone-value { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.phone-value .whatsapp-link { color: #126942; }
.whatsapp-link:hover, .whatsapp-link:focus-visible { background: #e4f5eb; color: #0b5132; }
.whatsapp-link svg { width: 20px; height: 20px; }
.remove-button { color: var(--danger); }
.remove-button:hover, .remove-button:focus-visible, .remove-button[aria-pressed="true"] { color: var(--danger-hover); background: var(--danger-surface); }
.logo-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.logo-actions .logo-preview { margin: 0; }
.field-dragging { z-index: 2; opacity: .82; pointer-events: none; }
.field-drop-target { z-index: 1; pointer-events: none; border: 2px dashed var(--blue); border-radius: 9px; background: #e7eeff88; }
.add-field-row { width: 100%; margin-top: 12px; padding: 12px; border-style: dashed; color: var(--blue); }
.field-layout { --layout-gap: 17px; align-items: start; }
.field-layout dd { white-space: pre-wrap; }
@media (min-width: 900px) {
    #contact-editor #contact-section--1 .field-layout > div > label.check:has(> input[type="checkbox"]),
    #contact-editor .contact-email-options {
        margin-block-start: calc(var(--text-small) * 1.5 + 5px);
        min-height: calc(var(--text-body) * 1.5 + 14px);
    }
}
.multiline-input { display: block; height: calc(3em + 20px); line-height: 1.5; overflow-y: auto; resize: none; }
.field-layout .multiline-value { max-height: 3em; line-height: 1.5; overflow-y: auto; }
.multiline-width { gap: 6px; }
.multiline-width[hidden] { display: none; }
.multiline-width input { flex: 0 0 auto; margin: 0; }

@media (min-width: 900px) {
    .field-layout { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: minmax(54px, auto); }
}
@media (max-width: 899px) {
    .field-layout > [style] { grid-area: auto; justify-self: stretch; inline-size: auto; }
}

.configure-field { padding: 1px 7px; font-size: var(--text-small); }
#formula-settings > label, #contact-formula-settings > label { margin-bottom: 8px; }
#add-contact-formula-field { display: block; margin: 0 auto 10px; }
.choice-option-row { display: flex; align-items: end; gap: 8px; margin-bottom: 10px; }
.choice-option-row label { flex: 1; }
.choice-option-row .remove-button { margin-bottom: 7px; }
.choice-field { min-width: 0; margin: 0; padding: 5px 8px 8px; border: 1px solid var(--line); border-radius: 8px; }
.choice-field legend, .field-label { font-size: var(--text-small); font-weight: var(--weight-medium); }
.choice-field .check, .field-layout .check { gap: 6px; overflow-wrap: anywhere; }
.choice-field .check input, .field-layout .check input { width: auto; flex: 0 0 auto; }
.computed-field { margin: 4px 0 0; }

.choice-option-row .option-handle { align-self: end; margin-bottom: 7px; width: 26px; height: 26px; }

.contact-sections-panel { padding: clamp(12px, 2vw, 20px); }
.section-list-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.section-list-heading :is(h2,h3) { margin: 0 0 4px; }
.contact-additional-sections { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.contact-additional-sections > .section-list-heading { margin-bottom: 8px; }
.section-list-heading p { margin: 0; }
.contact-section-card { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.contact-section-card > summary, .contact-section-core-heading {
    min-height: 44px; display: flex; align-items: center; gap: 9px; padding: 8px 12px;
    list-style: none; border-radius: 9px; color: #1b3253; overflow-wrap: anywhere;
}
.contact-section-card > summary::-webkit-details-marker { display: none; }
.contact-section-card > summary::before {
    content: ""; display: block; flex: 0 0 auto; width: 7px; height: 7px; margin-inline: 2px 4px;
    border: solid var(--blue); border-width: 0 2px 2px 0; transform: rotate(-45deg);
}
.contact-section-card[open] > summary::before { transform: rotate(45deg); }
.contact-section-card > summary:hover { background: #f4f8ff; }
.contact-section-card[open] > summary, .contact-section-core-heading { background: var(--blue-soft); border-radius: 9px 9px 0 0; }
.contact-section-count {
    flex: 0 0 auto; padding: 2px 8px; border-radius: 999px; background: #edf2fb; color: #425774;
    font-size: var(--text-small); font-weight: var(--weight-medium);
}
.contact-section-card[open] .contact-section-count, .contact-section-core-heading .contact-section-count { background: var(--surface); }
/* Ticket field editors share the collapsible Contacts cards without changing field behavior. */
.ticket-fields-settings > .section-list-heading { margin-bottom: 8px; }
.ticket-fields-settings .contact-section-card > summary { padding-inline-end: 84px; cursor: pointer; }
.ticket-fields-settings .contact-section-card > summary .section-summary-title { min-width: 0; }
.ticket-fields-settings .contact-section-count { flex: 0 1 auto; min-width: 0; }
.contact-sections-panel .section-builder { padding: 12px; }
.contact-section-toolbar { display: flex; align-items: end; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.contact-section-toolbar .section-name-field { flex: 1 1 230px; min-width: 0; max-width: 420px; }
.contact-section-buttons { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-inline-start: auto; }
.contact-sections-panel .section-field-list { grid-auto-rows: 154px; }
.contact-sections-panel .section-field-list:empty { display: none; }
.contact-card-preview { margin: 12px; border: 1px solid #cbd9fb; border-radius: 12px; }
.core-field-hint { margin: 0 0 10px; font-size: var(--text-small); }
.core-field-title {
    display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
    padding: 2px 4px; border: 1px solid transparent; border-radius: 6px; background: transparent;
    color: var(--blue); font-size: inherit; font-weight: inherit; text-align: start; overflow-wrap: anywhere;
}
.core-field-title:is(:hover,:focus-visible) { background: var(--blue-soft); border-color: var(--line); }
#rename-core-field [data-rename-error][hidden] { display: none; }
.contact-card-sample-values {
    --layout-gap: 12px;
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: center; gap: 3px var(--layout-gap); margin: 0;
}
.contact-card-sample-values > div { min-width: 0; padding-inline-start: 12px; border-inline-start: 1px solid #d4e0f4; }
.contact-card-sample-values dt { font-size: var(--text-small); color: var(--muted); margin-bottom: 2px; line-height: 1.25; }
.contact-card-preview .contact-card-sample-values dd { margin: 0; overflow-wrap: anywhere; }
.contact-card-sample-values > [style] {
    grid-row: var(--slot-row);
    grid-column: var(--slot-column) / span var(--slot-width);
    justify-self: var(--slot-align, stretch);
    inline-size: var(--slot-inline-size, auto);
}
.contact-card-preview span:is(.job-map-link, .whatsapp-link) { cursor: default; }
.contact-card-preview .job-map-link { padding: 3px 7px; font-size: var(--text-small); }
.sample-address-one-line { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) {
    .contact-card-sample-values { grid-template-columns: repeat(auto-fit, minmax(min(165px, 100%), 1fr)); }
    .contact-card-sample-values > [style] { grid-area: auto; justify-self: stretch; inline-size: auto; }
}
#new-section { margin-top: 8px; }
.section-item { position: relative; margin-top: 8px; }
.section-item > details > summary { padding-inline-end: 73px; }
.section-list-actions { position: absolute; top: 9px; inset-inline-end: 10px; display: flex; align-items: center; gap: 4px; }
.section-list-actions .section-handle { width: 26px; height: 26px; }
.contact-sections-empty { margin: 10px 0 0; }
#editable-section-list:not(:empty) + .contact-sections-empty { display: none; }
#section-order-form:not([hidden]) { display: flex; justify-content: flex-end; margin-top: 10px; }
.sortable-dragging {
    position: fixed;
    z-index: 10;
    top: var(--drag-top);
    left: var(--drag-left);
    width: var(--drag-width);
    pointer-events: none;
    border-radius: 10px;
    background: var(--surface);
    box-shadow: 0 8px 24px #16294830;
    opacity: .85;
}
.sortable-placeholder { border: 2px dashed var(--blue); border-radius: 9px; background: #e7eeff88; }
.sortable-placeholder.sortable-outside { border-color: transparent; background: transparent; }

.bulk-controls:has(> :not(dialog):not([hidden])) {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 8px 0;
}
.bulk-controls .check, .bulk-selection { display: flex; align-items: center; gap: 8px; }
.bulk-selection[hidden] { display: none; }
[data-bulk-count] { padding: 4px 8px; }
.bulk-selection { flex-wrap: wrap; }
.bulk-selection [data-bulk-delete] { color: #a12430; }
.bulk-edit-form { display: grid; gap: 12px; }
.bulk-edit-form .check { gap: 6px; }
.bulk-stage-message { margin: 0; }
.bulk-field-sections { display: grid; gap: 8px; min-width: 0; margin: 0; padding: 0; border: 0; }
.bulk-field-sections legend { margin-bottom: 6px; font-weight: 600; }
.bulk-edit-form [hidden] { display: none; }
.bulk-edit-form [data-bulk-value] > span { display: block; }
.bulk-select-column, .directory .bulk-select-cell { width: 40px; }
.directory .bulk-select-cell { padding: 4px; text-align: center; }
[data-bulk-all], [data-bulk-record] { width: 14px; height: 14px; margin: 0; vertical-align: middle; cursor: pointer; }
[data-bulk-all]:disabled { cursor: default; }
.directory table { table-layout: fixed; width: 100%; }
.directory th[data-column] { position: relative; padding-inline-end: 22px; }
.directory .column-title { vertical-align: middle; white-space: nowrap; }
.directory span.column-title { display: inline-block; }
.column-grip { margin-inline-end: 5px; padding-inline: 2px; vertical-align: middle; }
.column-resize { position: absolute; inset: 4px 0 4px auto; width: 12px; padding: 0; border: 0; border-radius: 3px; background: transparent; cursor: col-resize; touch-action: none; }
.directory th:last-child .column-resize { display: none; }
.column-resize::after { content: ""; position: absolute; inset: 5px 4px 5px auto; width: 1px; background: #9baed0; }
.column-resize:hover::after, .column-resize:focus-visible::after { width: 2px; background: var(--blue); }
.column-drag-preview {
    position: fixed; top: 0; left: 0; z-index: 30; pointer-events: none;
    background: var(--surface); box-shadow: 0 8px 24px #16294830;
    outline: 1px solid #9bb1f0; opacity: .94;
}
.column-drag-preview th { background: #e5edff; }
.directory .column-drag-placeholder { background: #e7eeff; color: transparent; }
.column-drag-placeholder > * { visibility: hidden; }
.clear-filters[hidden] { display: none; }

.history-list { margin: 0 0 14px; padding: 0 0 0 20px; list-style: none; border-left: 2px solid #dce6fc; }
.history-event { position: relative; padding: 0 0 14px; }
.history-event + .history-event { padding-top: 14px; border-top: 1px solid var(--line); }
.history-event::before { content: ""; position: absolute; left: -26px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 4px var(--surface); }
.history-event + .history-event::before { top: 19px; }
.history-event-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; }
.history-metadata { display: grid; justify-items: end; gap: 2px; margin-inline-start: auto; text-align: end; }
.history-metadata span { font-size: var(--text-small); color: var(--muted); }
.history-change { margin: 9px 0 0; padding: 9px 12px; background: #f6f8fd; border: 1px solid #e6edf9; border-radius: 9px; }
.history-change h4 { margin: 0 0 5px; font-size: var(--text-small); overflow-wrap: anywhere; }
.history-change dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.history-change dd { white-space: pre-wrap; }

.company-form-actions:has(> button[hidden]) { display: none; }

/* Jobs and engineer diary */
.jobs-header-totals .job-values { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 0 4px 0 0; font-variant-numeric: tabular-nums; }
.jobs-header-totals .job-values > div { display: flex; align-items: baseline; gap: 5px; white-space: nowrap; }
.jobs-header-totals .job-values dd { margin: 0; font-weight: 700; }
.jobs-list-schedule > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 7px; }
.jobs-list-address { white-space: pre-line; }
.jobs-list-schedule > .muted { display: block; margin-top: 4px; }
.jobs-list-money { font-variant-numeric: tabular-nums; }
.diary-toolbar, .diary-team > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.diary-toolbar h2, .diary-team h2 { margin: 0; }
.diary-job p { margin: 4px 0; }
.job-title { font-weight: 700; overflow-wrap: anywhere; }
.job-inline-contact, .job-values { margin-top: 14px; }
.job-item { display: grid; grid-template-columns: 2fr minmax(90px, .65fr) 1.4fr auto; gap: 10px; align-items: end; margin-bottom: 9px; }
.job-record-actions, .job-contact-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.job-values dd { margin: 4px 0 0; overflow-wrap: anywhere; }
.job-values dt { font-size: .84rem; color: #435675; }
.diary-note-editor label { margin-bottom: 8px; }
.diary-note p { white-space: pre-wrap; overflow-wrap: anywhere; }
.job-error { color: #a01b32; }
.diary-date-controls, .diary-date-controls form, .diary-row-actions { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.diary-date-controls input { margin: 0; width: auto; }
.diary-days { position: relative; display: flex; gap: 5px; padding: 8px 0 4px; margin-top: 10px; overflow-x: auto; }
.diary-days a { flex: 1 0 39px; display: grid; justify-items: center; gap: 4px; padding: 6px 3px; border-radius: 8px; background: #f0f4fb; color: #273b61; }
.diary-days a span { font-size: .75rem; }
.diary-note { border-top: 1px solid #dbe4f3; padding: 9px 0; margin-top: 9px; }
.diary-note-dialog { width: min(540px, calc(100% - 28px)); padding: 0; }
.diary-note-dialog header { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; background: #203b63; color: white; }
.diary-note-dialog header h2 { margin: 0; }
.diary-note-dialog header button { background: transparent; color: white; border-color: #ffffff66; padding: 2px 8px; }
.diary-note-dialog header button:hover { background: #ffffff25; }
.diary-note-dialog-body { display: grid; gap: 9px; padding: 14px; }
.diary-note-dialog .diary-supplier { border: 0; padding: 0; min-width: 0; margin: 0; }
.diary-note-dialog .diary-supplier[hidden] { display: none; }
.diary-supplier { margin-top: 9px; }
.diary-heading { margin-bottom: 10px; }
.diary-grid { display: grid; grid-template-columns: .8fr 1.15fr 1.65fr .75fr 1fr 1fr; gap: 10px; }
.diary-grid > * { min-width: 0; overflow-wrap: anywhere; }
.diary-column-headings { padding: 8px 12px; color: #435675; font-size: .8rem; font-weight: 700; }
.diary-team { border: 1px solid #d7e1f4; border-radius: 12px; margin-bottom: 14px; background: white; }
.diary-team > header { background: #e9effb; padding: 8px 12px; border-radius: 11px 11px 0 0; }
.diary-job { padding: 9px 12px; border-top: 1px solid #e2e9f5; }
.diary-job .job-contact-actions { gap: 5px; margin-top: 6px; }
.diary-job .job-contact-actions .button { min-height: 0; padding: 4px 6px; font-size: .78rem; }
.diary-row-actions { margin-top: 8px; justify-content: flex-end; align-items: start; }
.job-status { background: var(--stage-bg, #e9effb); color: var(--stage-ink, #234085); border-radius: 6px; display: inline-block; padding: 3px 6px; font-size: .8rem; }
@media (max-width: 760px) {
    .diary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .diary-column-headings { display: none; }
    .job-item { grid-template-columns: 1fr 1fr; }
}
.job-receipt iframe { display: block; width: 100%; min-height: 72vh; border: 1px solid var(--line); border-radius: 8px; background: white; }

/* Compact diary sheet */
.diary-calendar { margin-bottom: 12px; }
.diary-banner { padding: 12px 14px; background: #203b63; color: white; border-radius: 10px 10px 3px 3px; }
.diary-banner .diary-selected-date { color: inherit; font-size: clamp(1.1rem, 2vw, 1.5rem); }
.diary-banner .button { background: #ffffff13; border-color: #ffffff46; color: white; }
.diary-banner .button:hover { background: #ffffff29; }
.diary-banner .diary-date-controls { display: grid; grid-template-columns: 30px 11rem auto 30px; margin-inline-start: auto; }
.diary-banner .button { text-align: center; }
.diary-month { padding: 6px 9px; border: 1px solid #ffffff46; border-radius: 8px; background: #ffffff13; font-weight: 700; }
@media (max-width: 400px) {
    .diary-banner .diary-date-controls { width: 100%; grid-template-columns: 28px minmax(0, 1fr) auto 28px; }
}
.diary-days { gap: 4px; padding: 5px; margin-top: 4px; background: #e4eaf4; border-radius: 7px; }
.diary-days a { flex: 1 0 28px; padding: 4px 2px; background: white; border: 1px solid #d0daeb; border-radius: 5px; font-size: var(--text-caption); }
.diary-days [aria-current="date"] { color: white; background: #203b63; border-color: #203b63; }
.diary-days [data-non-working] { color: #a41e37; background: #fcecf0; border-color: #efccd3; }
.diary-days [data-today] { border-color: #3478db; box-shadow: inset 0 0 0 1px #3478db; }
.diary-days [data-non-working][aria-current="date"] { border-color: #a41e37; }
.diary-days .diary-weekday { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.diary-notes { border: 1px solid #eee1bb; border-radius: 9px; background: white; margin-bottom: 10px; }
.diary-notes > header { padding: 7px 11px; background: #fff6dc; border-radius: 8px 8px 0 0; align-items: start; }
.diary-note-actions { display: flex; align-items: start; gap: 8px; }
.diary-note-button {
    display: inline-block; list-style: none; font-size: var(--text-small); line-height: 1.35;
    padding: 4px 8px; border: 1px solid #cbd6e9; border-radius: 6px;
    background: white; color: #203b63; font-weight: 700;
}
.diary-note-button::-webkit-details-marker { display: none; }
.diary-note-button:hover, .diary-note-button:focus-visible { background: #e9eff9; }
.diary-note-add { padding: 5px 9px; border-color: var(--ink); background: #fff6dc; color: var(--ink); }
.diary-note-add:hover, .diary-note-add:focus-visible { background: #f7eac3; }
.diary-note-delete { background: #fff2f3; color: #bf2638; border-color: #f2a4ae; }
.diary-note-delete:hover, .diary-note-delete:focus-visible { background: #fadce1; color: #a41e32; }
.diary-notes .diary-note { display: flex; align-items: start; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; padding: 7px 11px; margin: 0; border-color: #f0e9d8; }
.diary-note p { margin: 0; color: var(--muted); font-size: var(--text-small); }
.diary-heading { justify-content: flex-end; }
.diary-engineer-filter { max-width: min(100%, 24rem); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.diary-engineer-options { display: grid; gap: 8px; max-height: 45vh; overflow: auto; padding: 4px 2px; }
.diary-grid { grid-template-columns: minmax(80px, .8fr) minmax(100px, 1.15fr) minmax(170px, 3.5fr) minmax(120px, 1.35fr) minmax(110px, 1fr); gap: 0; }
.diary-grid > * { padding: 6px 9px; }
.diary-grid > * + * { border-inline-start: 1px solid #dce4f1; }
.diary-column-headings { padding: 0; background: #dce5f2; border-radius: 6px 6px 0 0; color: #283b58; }
.diary-team > header { background: #d6ebe3; color: #285b4d; border-bottom: 1px solid #bddbd0; padding: 5px 9px; }
.diary-team > header .button { background: #ffffff70; color: inherit; border-color: currentColor; padding: 3px 8px; }
.diary-team > header .button:hover { background: #ffffffc7; }
.diary-team > header[data-booked-out] { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); background: #f5e2df; color: #773d39; border-bottom-color: #e8c8c4; }
.diary-division-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.diary-booked-out-badge { justify-self: center; padding: 3px 8px; border-radius: 4px; background: #f0ceca; color: #773d39; font-size: var(--text-body); font-weight: var(--weight-medium); }
@media (max-width: 640px) {
    .diary-team > header[data-booked-out] { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .diary-booked-out-badge { grid-column: 1 / -1; grid-row: 2; }
}

.diary-empty { margin: 0; padding: 10px; }
.diary-job { padding: 0; }
.diary-row-actions { margin-top: 0; padding: 4px 8px; background: #f7f9fd; }
.diary-row-actions .button, .diary-row-actions button { padding: 3px 7px; font-size: var(--text-small); }
.diary-work-items { padding: 0; margin: 5px 0 0; list-style: none; }
.diary-work-items li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 8px; padding: 3px 0; border-top: 1px solid #edf1f6; }
.diary-work-items small { flex-basis: 100%; color: var(--muted); }
.diary-staff { color: #954641; font-weight: 700; }
.diary-time-booking { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.diary-booking { margin: 0; }
.diary-booking button { padding: 2px 6px; background: #f1f5f9; color: #435675; font-size: var(--text-small); }
.diary-booking button[data-tbc="true"] { background: #fff0b8; border-color: #e2ba53; color: #6e4500; }
.diary-address { display: flex; align-items: start; justify-content: space-between; gap: 6px 10px; flex-wrap: wrap; margin-bottom: 6px; }
.diary-address p { margin: 0; white-space: pre-line; }
.diary-address .button { min-height: 0; padding: 3px 6px; font-size: var(--text-small); }
.diary-amounts { margin: 4px 0 0; }
.diary-amounts > div { display: flex; justify-content: space-between; gap: 8px; padding-top: 3px; }
.diary-amounts > div:first-child { padding: 5px 7px; border-radius: 5px; background: #edf2fa; font-size: 1.05rem; }
.diary-amounts dd { margin: 0; color: #954641; font-weight: 700; }
.diary-amounts > div:first-child dt { color: #954641; font-size: inherit; font-weight: 700; }
.diary-amounts > div:last-child { border-top: 1px solid var(--line); margin-top: 3px; font-weight: 700; }
.job-note-box { display: grid; align-content: start; gap: 4px; }
.job-note-box textarea { display: block; width: 100%; min-height: 0; padding: 5px 6px; resize: vertical; }
.job-note-box textarea::placeholder { font-style: italic; }
.job-note-box small { color: var(--danger); }
.diary-job-stage .job-status { display: block; padding: 6px 8px; text-align: center; font-weight: 750; }
.diary-payment-method { margin: 6px 0 0; text-align: center; font-size: var(--text-small); }
.diary-status-actions { display: grid; gap: 5px; }
.diary-status-actions:not(:empty) { margin-top: 12px; }
.diary-status-actions > button { padding: 4px 6px; font-size: var(--text-small); }
[data-stage="tba"] { --stage-bg: #dce4ff; --stage-ink: #243d76; --stage-accent: #7889bd; }
[data-stage="scheduled"] { --stage-bg: #e4e5e7; --stage-ink: #353b45; --stage-accent: #777d86; }
[data-stage="pending"] { --stage-bg: #f4d5fa; --stage-ink: #69247d; --stage-accent: #ae42c4; }
[data-stage="debt"] { --stage-bg: #ffd9db; --stage-ink: #8f212a; --stage-accent: #d7464c; }
[data-stage="completed"] { --stage-bg: #d5f1dc; --stage-ink: #205c34; --stage-accent: #42995b; }
[data-stage="cancelled"] { --stage-bg: #d2eaff; --stage-ink: #174c78; --stage-accent: #358ed4; }
@media (max-width: 880px) {
    .diary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .diary-column-headings { display: none; }
    .diary-job .diary-grid > * { border: 0; }
    .diary-work { grid-column: 1 / -1; }
}

.diary-confirmation { width: min(400px, calc(100% - 28px)); }
.diary-confirmation p { margin: 0; }
.diary-confirmation .diary-delete-warning { margin-top: 5px; color: var(--danger); }

.job-overview { padding: clamp(14px, 2vw, 24px); }
.job-overview,
#contact-editor:not([action$="?id=0"]) #contact-section--1 {
    background: linear-gradient(115deg, #edf3ff, white 75%);
    border-color: #cbd9fb;
}
.contact-overview-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-bottom: 14px; }
.contact-overview-heading > h2 { margin: 0; }
.contact-option-badge {
    padding: 3px 7px; border: 1px solid; border-radius: 7px;
    font-size: var(--text-small); font-weight: var(--weight-medium);
}
.contact-billing-status { color: #244580; background: #edf3ff; border-color: #cbd8fb; }
.contact-billing-status[data-billing-enabled="1"] { background: #e0eaff; }
.contact-email-optout-status { color: #684208; background: #fff5dd; border-color: #ebd8a2; }
.contact-email-optout-status[data-email-optout-enabled="1"] { background: #ffebbd; }
.contact-option-pair { display: grid; justify-items: start; gap: 3px; white-space: normal; }
.contact-overview > .field-layout { --layout-gap: 16px; row-gap: 3px; grid-auto-rows: auto; }
.contact-overview > .field-layout > div {
    min-width: 0; padding: 3px 12px; border-inline-start: 1px solid #d4e0f4;
}
.contact-overview dt { font-weight: 700; overflow-wrap: anywhere; }
.contact-overview > .field-layout dt { line-height: 1.25; }
.contact-overview > .field-layout dd { margin-block-start: 2px; }
.contact-overview dd { font-size: 1rem; font-weight: 600; }
.contact-overview .contact-overview-name dd { font-size: clamp(1.25rem, 2vw, 1.75rem); }
.job-overview-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, .8fr); gap: 20px; }
.job-overview-grid > div + div { border-inline-start: 1px solid #d4e0f4; padding-inline-start: 20px; }
.job-overview-label { display: block; color: var(--muted); font-size: var(--text-small); font-weight: 700; margin-bottom: 5px; }
.job-customer { font-size: clamp(1.25rem, 2vw, 1.75rem); margin-bottom: 8px; overflow-wrap: anywhere; }
.job-overview-phone { font-size: 1.125rem; font-weight: 650; gap: 8px; }
.job-location-address { font-size: 1.125rem; font-weight: 650; margin: 0 0 8px; white-space: pre-line; overflow-wrap: anywhere; }
.job-map-link { display: inline-flex; align-items: center; gap: 5px; }
.job-map-link svg { width: 16px; height: 16px; flex: 0 0 auto; }
.job-appointment { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 8px; }
.job-appointment time, .job-appointment span { font-size: 1.15rem; font-weight: 650; color: var(--ink); }
.job-appointment time.job-appointment-time { font-size: 1.55rem; color: #203b63; }
@media (max-width: 900px) {
    .job-overview-grid { grid-template-columns: 1fr; gap: 12px; }
    .job-overview-grid > div + div { padding-inline-start: 0; border-inline-start: 0; border-top: 1px solid #d4e0f4; padding-top: 10px; }
}

.job-finances { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 325px); gap: 16px; align-items: start; }
.job-work-table, .job-payment-summary { border: 1px solid var(--line); border-radius: 10px; }
.job-work-table th { border-top: 0; background: #f4f7fc; }
.job-work-table tr:last-child td { border-bottom: 0; }
.job-work-table th:nth-child(2), .job-work-table td:nth-child(2) { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.job-work-empty { margin: 0; padding: 12px; border: 1px dashed var(--line); border-radius: 10px; }
.job-payment-summary { overflow: hidden; background: #f9fbff; }
.job-payment-summary .job-values { display: block; margin: 0; }
.job-payment-summary .job-values > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 7px 12px; }
.job-payment-summary .job-values > div + div { border-top: 1px solid var(--line); }
.job-payment-summary .job-values dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 650; }
.job-payment-summary .job-values > div:last-child { background: var(--blue-soft); padding-block: 10px; }
.job-payment-summary .job-values > div:last-child dt { font-weight: 700; color: var(--ink); }
.job-payment-summary .job-values > div:last-child dd { font-size: 1.3rem; color: #204696; }
.job-payment-summary .job-record-actions:not(:empty) { padding: 10px 12px; border-top: 1px solid var(--line); }
@media (max-width: 760px) {
    .job-finances { grid-template-columns: minmax(0, 1fr); }
    .job-payment-summary { width: min(100%, 325px); justify-self: end; }
}


.job-overview-footer { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; border-top: 1px solid #d4e0f4; padding-top: 10px; margin-top: 16px; }
.job-overview-footer .job-values { flex: 1 1 280px; margin: 0; grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr)); }
.job-overview-footer .job-record-actions { margin-inline-start: auto; gap: 8px; }
.customer-debt-notice, .invoice-number-notice { padding: 8px 12px; border: 1px solid #edc797; border-radius: 8px; background: #fff1d9; color: #713809; font-weight: 700; }

.job-contact-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 24px; align-items: start; margin-bottom: 8px; }
.job-selected-customer { padding: 4px clamp(16px, 3vw, 48px); text-align: center; overflow-wrap: anywhere; }
#job-contact-selected { margin: 0; color: #203b63; font-size: clamp(1.2rem, 2vw, 1.6rem); font-weight: 700; }
#job-contact-address { margin: 2px 0 0; color: var(--muted); white-space: pre-line; }
#job-contact-status { margin: 5px 0; color: var(--muted); }
#job-contact-address:empty, #job-contact-status:empty { display: none; }
.job-selected-customer [data-clear-contact] { margin-top: 6px; }
@media (max-width: 700px) {
    .job-contact-layout { grid-template-columns: minmax(0, 1fr); }
    .job-selected-customer { padding-inline: 12px; }
}
#job-contact-results { list-style: none; margin: 5px 0 0; padding: 4px; border: 1px solid var(--line); border-radius: 8px; max-height: 16rem; overflow-y: auto; }
#job-contact-results button { width: 100%; border: 0; text-align: start; overflow-wrap: anywhere; }
#job-contact-results button:focus-visible { outline-offset: -2px; }

.job-details-columns { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: clamp(16px, 2vw, 30px); }
.job-booking-editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); align-items: start; gap: 10px 14px; padding-inline-start: clamp(16px, 2vw, 30px); border-inline-start: 1px solid var(--line); }
.job-title-editor input { font-size: 1.125rem; font-weight: 700; padding-block: 8px; }
.job-schedule-editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .8fr) minmax(0, 1.4fr); gap: 10px; margin-top: 10px; }
.job-schedule-editor select, .job-booking-confirmation select { width: 100%; }
.job-booking-extras { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.job-additional-dates { flex: 1 1 12.5rem; min-width: 0; }
.job-duration-editor { display: inline-flex; align-items: center; gap: 6px; margin-inline-start: auto; }
.job-duration-editor input {
    inline-size: calc(3ch + 14px); min-inline-size: 0; padding-inline: 5px;
    text-align: center; appearance: textfield;
}
.job-duration-editor input::-webkit-inner-spin-button,
.job-duration-editor input::-webkit-outer-spin-button { appearance: none; margin: 0; }
#job-dates { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); column-gap: 12px; }
.job-date-row { display: flex; align-items: end; gap: 8px; margin-bottom: 6px; }
.job-date-row label { min-width: 0; width: min(13rem, 100%); }
.job-additional-dates button { padding: 4px 8px; font-size: var(--text-small); }
.job-additional-dates small { margin-inline-start: 6px; }
.job-engineers { border: 0; padding: 0; margin: 0; min-width: 0; }
.job-engineers legend { padding: 0; margin-bottom: 5px; color: var(--muted); font-size: var(--text-small); font-weight: 650; }
.job-engineer-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.job-engineer-choices .check { display: inline-flex; gap: 6px; padding: 3px 9px; border: 1px solid var(--line); border-radius: 16px; background: white; cursor: pointer; }
.job-engineer-choices .check:has(:checked) { border-color: #b8cbf5; background: var(--blue-soft); color: #204696; }
.job-engineer-choices input { margin: 0; flex: 0 0 auto; }
.job-settings-form { display: grid; gap: 12px; margin-bottom: 12px; }
.job-settings-card, .job-settings-card-body, .job-settings-options > * { min-width: 0; }
.job-settings-card h2 { margin: 0; }
.job-settings-card-body { padding: 12px; }
.job-settings-card-body > .muted { margin: 0 0 10px; }
.job-settings-options {
    display: grid; gap: 10px 12px;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 185px), 1fr));
    align-items: start;
}
.job-setting-list { padding: 8px; }
.job-setting-rows { display: grid; gap: 5px; }
.job-setting-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px; }
.job-setting-row input { min-width: 0; width: 100%; padding: 5px 8px; }
.job-setting-add { width: 100%; padding: 5px 8px; border-style: dashed; color: var(--blue); }
.job-setting-rows:not(:empty) + template + .job-setting-add { margin-top: 6px; }
.job-settings-card-body .check { gap: 6px; overflow-wrap: anywhere; }
.job-settings-card-body .check:has(:disabled) { cursor: default; }
.job-settings-rule {
    display: flex; flex-wrap: wrap; align-items: end; gap: 8px 12px;
    margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line);
}
.job-settings-rule label { min-width: 0; }
.job-settings-rule p { margin: 0 0 5px; }
.job-settings-actions { display: flex; justify-content: flex-end; }
.job-settings-actions:not(:has(button:not([hidden]))) { display: none; }
@media (max-width: 1000px) {
    .job-details-columns { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .job-booking-editor { padding-inline-start: 0; padding-top: 12px; border-inline-start: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 540px) {
    .job-schedule-editor { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .job-schedule-editor > label:last-child { grid-column: 1 / -1; }
    .job-booking-editor { grid-template-columns: minmax(0, 1fr); }
}

.temporal-field { position: relative; display: block; min-width: 0; }
.temporal-field > input { width: 100%; padding-inline-end: 34px; }
.temporal-field > input::-webkit-calendar-picker-indicator { display: none; }
.workday .temporal-field > input { padding-inline-end: 26px; }
.temporal-trigger { position: absolute; inset: 3px 3px 3px auto; display: grid; place-items: center; width: 26px; padding: 0; border: 0; background: transparent; color: var(--blue); }
.workday .temporal-trigger { width: 22px; }
.temporal-trigger::before { content: ""; box-sizing: border-box; width: 14px; height: 13px; border: 1.5px solid currentColor; border-radius: 3px; background: linear-gradient(currentColor, currentColor) 0 3px / 100% 1px no-repeat; }
.temporal-trigger[data-kind="time"]::before { height: 14px; border-radius: 50%; background: linear-gradient(currentColor, currentColor) 50% 2px / 1px 5px no-repeat, linear-gradient(currentColor, currentColor) 65% 55% / 4px 1px no-repeat; }
.temporal-dialog { width: min(355px, calc(100% - 28px)); padding: 0; }
.temporal-dialog > header { display: flex; align-items: center; justify-content: space-between; padding: 10px 13px; background: #203b63; color: white; }
.temporal-dialog > header h2 { margin: 0; }
.temporal-close { padding: 2px 8px; color: white; background: transparent; border-color: #ffffff66; }
.temporal-close:hover { background: #ffffff25; }
.temporal-dialog > div { padding: 12px; }
.temporal-month-header { display: grid; grid-template-columns: 34px 1fr 34px; gap: 5px; align-items: center; text-align: center; margin-bottom: 8px; }
.temporal-month-header strong { text-transform: capitalize; }
.temporal-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; }
.temporal-days span { color: var(--muted); font-size: var(--text-caption); }
.temporal-days button { padding: 6px 0; border-color: transparent; }
.temporal-days button[data-today] { border-color: #7298ed; }
.temporal-days button[aria-pressed="true"] { color: white; background: var(--blue); border-color: var(--blue); }
.temporal-time { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.temporal-calendar + .temporal-time { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }

.temporal-quarters { display: flex; gap: 6px; grid-column: 1 / -1; }
.temporal-quarters button { flex: 1; padding: 4px 6px; }
.booking-reasons { margin: 0; padding-inline-start: 20px; }
.booking-reasons li + li { margin-top: 6px; }

.job-line-items-editor { min-width: 0; }
.job-line-items-editor .job-item { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #f9fbff; }
.job-line-items-editor .job-item input[name="item_price"] { text-align: end; font-variant-numeric: tabular-nums; }
.job-line-items-editor #add-job-item { color: var(--blue); border-style: dashed; }
.job-payment-inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding: 10px 12px; }
.job-payment-inputs > label:last-child { grid-column: 1 / -1; }
.job-payment-summary .job-editor-totals { border-top: 1px solid var(--line); }
@media (max-width: 950px) {
    .job-finances-editor { grid-template-columns: minmax(0, 1fr); }
    .job-finances-editor .job-payment-summary { width: min(100%, 325px); justify-self: end; }
}

/* Fictional local role preview. */
.role-preview-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 16px; padding: 8px 12px; margin-bottom: 12px; border: 1px solid #cbd9fb; border-radius: 9px; background: #edf3ff; color: #204696; }
.role-preview-bar small { display: inline-block; margin-inline-start: 10px; color: var(--muted); }
.role-intro p, .role-card p { margin-block: 4px 10px; }
.role-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 10px; }
.role-grid .role-card { margin: 0; }
.role-card header { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: baseline; margin-bottom: 6px; }
.role-card h2 { margin: 0; }
.role-toggles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 5px 10px; margin-block: 10px; }
.role-add { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.role-add label { min-width: min(100%, 225px); }
.role-note { display: grid; gap: 8px; justify-items: start; }
.role-note label { width: min(100%, 640px); }
.role-person { margin: -6px 0 12px; color: var(--muted); }
.user-directory th, .user-directory td { text-align: start; }
.user-directory td a { font-weight: var(--weight-medium); }
.user-directory td.user-directory-action { width: 1%; text-align: end; }
.staff-contact-search { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-block: 8px 12px; }

.task-list { min-width: 680px; }
.task-list th:nth-child(3), .task-list td:nth-child(3) { white-space: nowrap; }
.task-form .panel { padding: clamp(14px, 2vw, 24px); }
.task-editor-grid { display: grid; grid-template-columns: minmax(240px, 2fr) repeat(3, minmax(0, 1fr)); gap: 12px 18px; align-items: end; }
@media (max-width: 980px) {
    .task-editor-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .task-editor-subject { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
    .task-editor-grid { grid-template-columns: minmax(0, 1fr); }
}
.task-directory { --task-action-width: 54px; }
.task-action-column, .task-list .task-list-action { width: var(--task-action-width); }
.task-list .task-list-action { padding: 4px 8px 4px 12px; }
.task-directory [data-task-completion-error]:not([hidden]) { margin: 0 12px 8px; }
.task-list th:has(+ .task-list-action) .column-resize { display: none; }
.task-complete-button {
    display: grid; place-items: center; width: 28px; height: 28px; padding: 0;
    border: 1px solid #abd7bd; border-radius: 8px; background: #edf8f1; color: #216446;
}
.task-complete-button:hover, .task-complete-button:focus-visible { background: #d7f0e1; }
.task-complete-button svg { width: 16px; height: 16px; }
.task-reopen-button { border-color: #b6c9f5; background: #eef3ff; color: #2850ad; }
.task-reopen-button:hover, .task-reopen-button:focus-visible { background: #dfeaff; }
.task-overview dd { margin-inline-start: 0; }


fieldset.job-inline-contact { border: 0; padding: 0; min-width: 0; }

/* Tickets uses the shared plain contact and gradient detail panels. */
.ticket-wide { grid-column: 1 / -1; }
.ticket-field-value { white-space: pre-line; overflow-wrap: anywhere; }
.ticket-record-fields dl { gap: 10px; }
.ticket-record-fields dl > div {
    min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
}
.ticket-record-fields dt { font-weight: var(--weight-heading); overflow-wrap: anywhere; }
.ticket-workflow-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 12px 20px; }
.ticket-workflow-controls .check { min-height: 36px; }
.ticket-workflow-controls [hidden] { display: none; }
.ticket-config-step {
    display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin-bottom: 12px;
    border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px;
}
.ticket-config-step > label { flex: 1 1 180px; }
.ticket-config-step .icon-button, .ticket-step-number { align-self: center; }
.ticket-config-step [data-workflow-handle] { cursor: grab; touch-action: none; }
.ticket-step-number { display: none; }
.ticket-steps-ordered .ticket-step-number {
    position: relative; display: grid; place-items: center; width: 26px; height: 26px;
    border-radius: 50%; background: #e7eeff; color: #2344a0; font-size: 12px; font-weight: 700;
}
.ticket-steps-ordered .ticket-config-step:has(+ .ticket-config-step) .ticket-step-number::after {
    content: "↓"; position: absolute; top: calc(100% + 2px); color: #526b9b;
    font-size: 10px; line-height: 1; pointer-events: none;
}
.ticket-config-add { margin-bottom: 10px; }
form:has(> .ticket-signoff-actions) > label { display: block; width: 100%; }
form:has(> .ticket-signoff-actions) input[name="completion_note"] {
    display: block; width: 100%; max-width: 100%;
}
.ticket-signoff-actions { justify-content: center; margin: 12px 0 0; }
.page-actions button[name="action"][value="reopen"] { background: #fff0c9; color: #704700; border-color: #c58d36; font-weight: 700; }
.page-actions button[name="action"][value="reopen"]:hover { background: #ffe4a5; }

.product-values dd { white-space: pre-wrap; }
.product-description { margin: 12px 0; }
.product-gross-price { display: block; border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; background: var(--surface); font-size: var(--text-body); font-weight: 700; }

.company-layout-settings { margin-top: 12px; }
.company-layout-settings > button { margin-top: 8px; }
.task-list + [data-layout-reset], .directory > [data-layout-reset] { margin: 8px 12px; }

.field-api-section { margin-bottom: 12px; }
.field-api-section h2 { margin-bottom: 8px; }
.field-api-section table { table-layout: fixed; }
.field-api-section th:first-child { width: 33.3333%; }
.field-api-section code { user-select: all; }
.field-api-section small { margin-inline-start: 6px; color: var(--muted); }

.sidebar-utilities { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.sidebar-utilities #settings-gear { margin-top: 0; flex: 0 0 auto; }
.sidebar-utility { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; background: #ffffff0a; border: 1px solid #ffffff20; }
.sidebar-utility svg { width: var(--sidebar-icon-size); height: var(--sidebar-icon-size); }
.sidebar-utility[aria-current="page"] { background: #3656bc; }
.sidebar .sidebar-toggle {
  flex: 0 0 auto; margin-inline-start: auto; color: #c1cde1;
}
.sidebar .sidebar-toggle:hover { color: white; background: #263a60; }
.sidebar .sidebar-toggle[hidden], .sidebar-icon-label[hidden] { display: none; }
.sidebar-icon-label {
  position: fixed; z-index: 30; transform: translateY(-50%); pointer-events: none;
  background: var(--sidebar); color: white; padding: 4px 8px; border-radius: 6px;
  box-shadow: var(--panel-shadow); font-size: var(--text-small);
}
@media (min-width: 701px) {
  body[data-sidebar-collapsed] { --sidebar-width: 56px; }
  body[data-sidebar-collapsed] .sidebar { padding-block-start: 42px; }
  body[data-sidebar-collapsed] .sidebar .brand,
  body[data-sidebar-collapsed] .sidebar-module-label { display: none; }
  body[data-sidebar-collapsed] .sidebar .sidebar-toggle { margin-inline-start: 0; }
  body[data-sidebar-collapsed] .sidebar-toggle-arrow { transform: rotate(180deg); transform-origin: 14.5px 12px; }
  body[data-sidebar-collapsed] .sidebar-module { justify-content: center; padding-inline: 4px; }
  body[data-sidebar-collapsed] .sidebar-utilities { flex-direction: column; align-items: center; }
}
.template-editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.template-source { display: grid; align-content: start; gap: 12px; }
.template-tools { display: flex; align-items: end; flex-wrap: wrap; gap: 8px; }
.template-source textarea { display: block; min-height: 320px; font-family: monospace; }
.template-source [role="status"]:empty { display: none; }
.template-sumup-option { display: grid; gap: 4px; justify-items: start; }
.template-sumup-option label { display: inline-flex; gap: 7px; align-items: center; }
.template-sumup-option input[type="checkbox"] { width: auto; margin: 0; }
.template-details { grid-column: 1 / -1; margin-bottom: 0; }
.template-details [data-custom-sender][hidden] { display: none; }
.template-preview h2 { margin-bottom: 8px; }
.template-preview iframe { display: block; width: 100%; height: 620px; border: 1px solid var(--line); border-radius: 8px; background: white; }
@media (max-width: 950px) {
    .template-editor { grid-template-columns: minmax(0, 1fr); }
    .sidebar-utilities { flex-wrap: nowrap; }
}
.template-row-action { width: 54px; text-align: end; }
.template-handoff { width: min(780px, calc(100% - 28px)); }
.template-handoff textarea { display: block; width: 100%; margin: 10px 0; resize: vertical; font-family: monospace; }
.template-handoff [role="status"]:empty { display: none; }
.template-field-picker { position: relative; flex: 1 1 220px; min-width: 0; }
.template-field-picker input { width: 100%; }
.template-field-menu {
    position: absolute; inset: calc(100% + 4px) 0 auto; z-index: 5; max-height: min(320px, 45vh);
    overflow: auto; padding: 5px; border: 1px solid var(--line); border-radius: 8px;
    background: var(--surface); box-shadow: 0 8px 24px #16294830;
}
.template-field-group { margin: 0 -5px 4px; padding: 6px 13px; background: var(--blue-soft); color: #284779; font-size: var(--text-small); font-weight: 700; }
.template-field-menu [role="group"] + [role="group"] { margin-top: 5px; }
.template-field-option { padding: 5px 8px; border-radius: 5px; cursor: pointer; overflow-wrap: anywhere; }
.template-field-option:is(:hover, .template-field-active, [aria-selected="true"]) { background: #e7eeff; }
.template-field-menu p { margin: 4px 8px; }

.quote-editor { display: grid; gap: 12px; }
.quote-description { display: block; margin-top: 12px; }
.quote-line { container-type: inline-size; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.quote-line + .quote-line { margin-top: 8px; }
[data-quote-lines]:not(:empty) + .quote-line-actions { margin-top: 10px; }
.quote-line-fields { display: grid; grid-template-columns: minmax(180px, 3fr) repeat(3, minmax(76px, 1fr)) auto; align-items: start; gap: 8px; }
.quote-line-fields .remove-button { margin-top: 20px; }
.quote-line-item { display: grid; gap: 5px; min-width: 0; }
.quote-item-description { margin-top: 3px; color: var(--muted); font-size: var(--text-small); font-weight: 400; }
.quote-line-item textarea { width: 100%; min-width: 0; }
.quote-multiline { white-space: pre-wrap; overflow-wrap: anywhere; }
.quote-record-items { margin-top: 12px; }
.quote-record-items h2 { margin-bottom: 8px; }
.customer-overview-email { margin-top: 6px; overflow-wrap: anywhere; }
@media (min-width: 901px) {
    .job-overview-grid.overview-two-columns { grid-template-columns: 1fr 1fr; }
}
@container (max-width: 490px) {
    .quote-line-fields { grid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr)); }
}
select[data-sales-stage], select[data-ticket-stage], select[data-stage-colour-select] { background-color: var(--stage-bg); color: var(--stage-ink); font-weight: 600; }
[data-sales-stage-form] { margin-top: 3px; }
.sales-record-status-division { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 16px; }
.sales-record-status-division .sales-record-division { align-self: center; }
.sales-record-division .job-overview-label { margin: 0; }
[data-sales-stage-form] select { max-width: 220px; }
[data-list-stage-form] { display: inline-block; max-width: 100%; margin: 0 0 2px; vertical-align: middle; }
[data-list-stage-form] select { max-width: 100%; font-size: var(--text-small); padding-block: 3px; }
.sales-stage-panel > p { margin: 6px 0 12px; }
.sales-stage-list { display: grid; gap: 8px; }
.sales-stage-option {
    display: grid; grid-template-columns: minmax(140px, 1.3fr) minmax(162px, .95fr) minmax(156px, .85fr) minmax(90px, .7fr) 32px;
    align-items: end; gap: 8px 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
}
.sales-stage-new { margin: 12px 0; background: #f5f8fe; }
.remove-sales-stage { align-self: end; justify-self: end; margin-bottom: 4px; }
.sales-stage-preview { align-self: center; display: flex; align-items: center; min-height: 36px; overflow-wrap: anywhere; }
.sales-stage-preview [hidden] { display: none; }
.sales-stage-palette { min-width: 0; border: 0; padding: 0; margin: 0; }
.sales-stage-palette legend { padding: 0; margin-bottom: 4px; }
.sales-stage-palette > div { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 36px; }
.sales-stage-swatch { position: relative; display: grid; place-items: center; width: 22px; height: 22px; cursor: pointer; }
.sales-stage-swatch input { position: absolute; width: 22px; height: 22px; margin: 0; opacity: 0; cursor: pointer; }
.sales-stage-swatch span { width: 17px; height: 17px; border-radius: 50%; background: var(--stage-accent); pointer-events: none; }
.sales-stage-swatch input:checked + span { outline: 2px solid var(--stage-ink); outline-offset: 2px; }
.sales-stage-swatch input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 3px; }
.sales-stage-panel > [data-layout-reset] { margin-top: 10px; }
@media (max-width: 880px) {
    .sales-stage-option { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.sales-stage-custom > div { gap: 6px 8px; }
.sales-stage-custom [data-stage-custom] { flex: 0 0 auto; margin: 0; }
.sales-stage-custom input[type="color"] { width: 36px; height: 30px; padding: 2px; cursor: pointer; }
.sales-stage-custom [data-stage-hex] { width: 88px; padding: 4px 6px; font-family: monospace; }

.fixed-stage-name { align-self: center; min-height: 36px; display: flex; align-items: center; font-weight: 600; }
.fixed-stage-option { grid-template-columns: minmax(140px, 1.3fr) minmax(162px, .95fr) minmax(156px, .85fr) minmax(90px, .7fr); }
.sales-stage-panel .sales-stage-list + button { margin-top: 10px; }
.diary-team > header[data-stage] { background: var(--stage-bg); color: var(--stage-ink); border-bottom-color: var(--stage-accent, currentColor); }
.diary-team > header[data-stage] .diary-booked-out-badge { background: var(--stage-bg); color: var(--stage-ink); outline: 1px solid currentColor; }
.diary-booking button[data-stage] { background: var(--stage-bg); color: var(--stage-ink); border-color: var(--stage-accent, currentColor); }
@media (max-width: 880px) {
    .fixed-stage-option { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.workspace-access { max-width: 36rem; margin: 7vh auto; padding: 1rem; }
.workspace-access form, .workspace-access label { display: grid; gap: .5rem; }
.workspace-access form { gap: 1rem; }
.workspace-background { min-height: 100vh; margin: 0; background: linear-gradient(150deg, #eff7ff, #f8fafc 65%); }
.workspace-access { display: grid; min-height: 100vh; place-items: center; margin: 0 auto; }
.workspace-card { width: 100%; border-top: 5px solid #2773ce; padding: clamp(1.25rem, 4vw, 2.5rem); }
.workspace-card h1 { margin: .55rem 0; }
.workspace-brand { color: #1b5f9f; font-size: 1.2rem; margin-top: 0; }
.workspace-card form { margin: 1.25rem 0; }
.workspace-notice { background: #edf6ff; border-radius: .5rem; padding: .75rem; }
.workspace-access .workspace-remember { display: flex; align-items: center; gap: .6rem; width: fit-content; cursor: pointer; }
.workspace-remember input[type="checkbox"] { width: 1rem; height: 1rem; min-height: 0; padding: 0; margin: 0; accent-color: var(--blue); }
.workspace-remember input:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.workspace-remember-note { color: var(--muted); font-size: .84rem; margin: -.62rem 0 0 1.6rem; }

.workspace-account-links { display: flex; flex-wrap: wrap; gap: .55rem; margin-bottom: 0; }
.workspace-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; margin: .75rem 0; }

.password-rules { list-style: none; padding: 0; margin: 0; display: grid; gap: .25rem; font-size: .9rem; }
.password-rules li { display: flex; gap: .6rem; align-items: baseline; color: #982a2a; }
.password-rules li[data-met="true"] { color: #146237; }
.password-rule-symbol { display: inline-block; width: 1rem; font-weight: bold; text-align: center; }
.password-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.ticket-filter-button, .manage-columns { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; }
.ticket-filter-button svg, .manage-columns svg { width: 19px; height: 19px; }
.ticket-filter-button.is-active { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
.ticket-filter-dialog { width: min(680px, calc(100% - 28px)); }
.ticket-filter-dialog[open] { display: flex; flex-direction: column; }
.ticket-filter-dialog > :not(.ticket-filter-body) { flex: none; }
.ticket-filter-body { min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; padding: 3px; margin: -3px; }
.ticket-filter-dialog > .ticket-filter-switch { align-self: flex-start; }
@media (max-height: 520px) {
    .ticket-filter-dialog { padding: 12px; }
    .ticket-filter-dialog > h2 { margin-block: 0 8px; }
    .ticket-filter-dialog > .ticket-filter-switch { margin-bottom: 10px; }
}
.list-column-picker { width: min(600px, calc(100% - 28px)); }
.list-column-picker > p { margin: -4px 0 14px; }
.list-column-groups { display: grid; gap: 8px; }
.list-column-picker .column-group { margin: 0; border-radius: 10px; background: var(--surface); }
.list-column-picker .column-group > summary {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 12px; border-radius: 10px; background: var(--canvas); font-weight: var(--weight-medium);
    list-style: none;
}
.list-column-picker .column-group > summary::-webkit-details-marker { display: none; }
.list-column-picker .column-group > summary::after {
    content: ""; width: 7px; height: 7px; margin: 0 4px 3px; border: solid currentColor;
    border-width: 0 1px 1px 0; transform: rotate(45deg);
}
.list-column-picker .column-group[open] > summary { border-radius: 10px 10px 0 0; }
.list-column-picker .column-group[open] > summary::after { transform: rotate(225deg); margin-block: 3px 0; }
.list-column-picker .column-group .grid { gap: 8px; }
.list-column-picker label.check {
    min-width: 0; min-height: 36px; padding: 6px 9px; border: 1px solid var(--line);
    border-radius: 8px; background: var(--surface); overflow-wrap: anywhere;
}
.list-column-picker label.check:has(:checked) { background: var(--blue-soft); border-color: #cbd8fb; }
.list-column-picker label.check:has(:disabled) { cursor: default; }
.list-column-picker .dialog-actions { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }

[data-clear-ticket-list] { min-height: 36px; }
.ticket-filter-switch {
    display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 16px;
    border-radius: 10px; background: var(--canvas);
}
.ticket-filter-switch button { border-color: transparent; background: transparent; }
.ticket-filter-switch button[aria-pressed="true"] {
    background: var(--surface); color: var(--blue); box-shadow: 0 1px 4px #17213816;
}
.ticket-filter-dialog [hidden] { display: none; }
.ticket-saved-filter-picker > summary {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; list-style: none;
}
.ticket-saved-filter-picker > summary::-webkit-details-marker { display: none; }
.ticket-saved-filter-picker > summary::after {
    content: ""; width: 7px; height: 7px; margin: 0 3px 3px;
    border: solid currentColor; border-width: 0 1px 1px 0; transform: rotate(45deg);
}
.ticket-saved-filter-picker[open] > summary::after { transform: rotate(225deg); margin-block: 3px 0; }
.ticket-saved-filter-picker > div {
    display: grid; gap: 3px; padding: 5px; margin-top: 6px;
    border: 1px solid var(--line); border-radius: 8px;
}
.ticket-saved-filter-picker p { margin: 6px; }
.ticket-saved-filter-entry { display: flex; align-items: center; gap: 8px; padding-inline-end: 4px; }
.ticket-saved-filter-entry > [data-apply-saved-filter] {
    flex: 1; min-width: 0; text-align: start; overflow-wrap: anywhere;
}
.ticket-filter-row {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
    gap: 8px; align-items: end; padding: 0 0 12px;
}
.ticket-filter-row + .ticket-filter-row { padding-top: 10px; border-top: 1px solid var(--line); }
.ticket-filter-join { grid-column: 1 / -1; }
.ticket-filter-join select { width: auto; color: var(--blue); background-color: var(--blue-soft); }
.ticket-filter-row .remove-ticket-condition { grid-column: -2; margin-bottom: 5px; }
.ticket-filter-condition-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ticket-filter-footer {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
    margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
}
.ticket-filter-footer-save { display: flex; flex-wrap: wrap; gap: 8px; }
.ticket-filter-footer .dialog-actions { margin-inline-start: auto; padding: 0; }
@media (max-width: 560px) {
    .ticket-filter-row { grid-template-columns: minmax(0, 1fr) auto; }
    .ticket-filter-row label { grid-column: 1; }
}

.automation-fields { min-width: 0; }
.automation-fields[hidden], [data-automation-address][hidden] { display: none; }
.automation-fields > p { margin: 0 0 12px; }
.automation-fields > label { max-width: 360px; }
.automation-fields > .muted { margin: 10px 0 0; }

/* Workflow rule builder */
.automation-builder { display: grid; gap: 12px; }
.automation-builder > .panel { margin: 0; display: grid; gap: 12px; }
.automation-builder > .panel:nth-of-type(n+3) { position: relative; margin-top: 20px; }
.automation-builder > .panel:nth-of-type(n+3)::before {
  content: ""; position: absolute; top: -25px; left: calc(50% - 9px);
  width: 18px; height: 18px; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%235374a6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 3.5v12m-4-4 4 4 4-4'/%3E%3C/svg%3E") center / contain no-repeat;
}
.automation-builder .panel h2, .automation-builder .panel p { margin: 0; }
.automation-builder [hidden] { display: none !important; }
.automation-builder [data-duration], .automation-builder [data-builder-email] { display: grid; gap: 10px; }
.automation-builder [data-duration] > label,
.automation-builder [data-builder-stage] > label { max-width: 360px; }
.automation-builder [data-builder-add] { justify-self: start; }
.automation-builder [data-builder-conditions] { display: grid; gap: 8px; }
.automation-builder [data-builder-conditions]:empty { display: none; }
.automation-condition {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.3fr) auto;
  align-items: end; gap: 10px; border-radius: 8px; padding: 10px; background: var(--canvas, #f6f8fb);
}
.automation-condition select, .automation-condition input { width: 100%; min-width: 0; }
.automation-condition .automation-remove { grid-column: 4; min-width: 36px; font-size: 1.25rem; }

.automation-builder [data-condition-controls] { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 10px; }
.automation-builder [data-criteria-pattern] { max-width: 360px; }
.automation-condition[data-condition-number]::before {
  content: attr(data-condition-number); grid-row: 1; grid-column: 1 / -1;
  color: var(--muted); font-weight: 600; font-size: .8em;
}

.automation-builder .automation-trigger-width { width: min(100%, 360px); }
.automation-builder .automation-date-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.automation-builder [data-date-trigger] { display: grid; gap: 8px; }
.automation-builder .automation-date-pair :is(select, input) { min-width: 0; }

.automation-builder [data-builder-conditions] { gap: 38px; }
.automation-condition { position: relative; }
.automation-condition [data-criteria-join] {
  position: absolute; top: -34px; left: 50%; transform: translateX(-50%);
  min-width: 52px; min-height: 26px; padding: 2px 8px; border-radius: 20px;
}

/* Desktop automation flow, staggered to keep Conditions and Action roomy. */
@media (min-width: 1040px) {
  .automation-builder {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 34px 0;
    align-items: start;
  }
  .automation-builder > .panel:nth-of-type(1) { grid-column: 1 / -1; grid-row: 1; }
  .automation-builder > .panel:nth-of-type(2) {
    grid-column: 1 / 5; grid-row: 2;
    width: calc(100% + 12px); gap: 10px;
  }
  .automation-builder > .panel:nth-of-type(3) {
    grid-column: 3 / -1; grid-row: 3; margin-top: 8px;
  }
  .automation-builder > .panel:nth-of-type(4) {
    grid-column: 1 / 11; grid-row: 4; margin-top: 22px;
  }
  .automation-builder > .panel:nth-of-type(3)::before,
  .automation-builder > .panel:nth-of-type(4)::before {
    background-size: 100% 100%;
  }
  .automation-builder > .panel:nth-of-type(3)::before {
    left: calc(20% + 18px); top: -96px;
    width: clamp(145px, 23%, 230px); height: 91px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 210 91' preserveAspectRatio='none' fill='none' stroke='%235374a6' stroke-width='6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath vector-effect='non-scaling-stroke' d='M6 24 H145 Q188 24 188 61 V82'/%3E%3C/svg%3E");
  }
  .automation-builder > .panel:nth-of-type(4)::before {
    left: auto; right: calc(18px - 20%); top: -52px;
    width: calc(20% - 26px); height: 130px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 150 130' preserveAspectRatio='none' fill='none' stroke='%235374a6' stroke-width='6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath vector-effect='non-scaling-stroke' d='M142 6 V73 Q142 106 109 106 H7'/%3E%3C/svg%3E");
  }
}
@media (min-width: 1040px) {
  /* One pixel-sized chevron for both arrows, independent of the stretched shafts. */
  .automation-builder > .panel:nth-of-type(3)::after,
  .automation-builder > .panel:nth-of-type(4)::after {
    content: ""; position: absolute; width: 36px; height: 24px; pointer-events: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 24' fill='none' stroke='%235374a6' stroke-width='6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 4 L18 20 L32 4'/%3E%3C/svg%3E") center / 36px 24px no-repeat;
  }
  .automation-builder > .panel:nth-of-type(3)::after {
    left: calc(20% + 18px + clamp(129.81px, 20.59%, 205.90px));
    top: -14px; transform: translate(-50%, -20px);
  }
  .automation-builder > .panel:nth-of-type(4)::after {
    left: calc(100.933333% + 14.786667px);
    top: 54px; transform: translate(-50%, -50%) rotate(90deg);
  }
}
@media (min-width: 1040px) and (prefers-reduced-motion: no-preference) {
  .automation-builder > .panel:nth-of-type(3)::before { animation: automation-curve-in 320ms ease-out both; }
  .automation-builder > .panel:nth-of-type(4)::before { animation: automation-curve-back 320ms 100ms ease-out both; }
  @keyframes automation-curve-in { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0); } }
  @keyframes automation-curve-back { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(0); } }
}

/* Trigger controls use the full inside width of their own card. */
.automation-builder > .panel:nth-of-type(2) .automation-trigger-width { width: 100%; max-width: none; }

.automation-builder > .panel:nth-of-type(3) .automation-trigger-width { width: 100%; max-width: none; }
.automation-trigger-hints { display: grid; }
.automation-trigger-hints > p { grid-area: 1 / 1; visibility: hidden; }
.automation-trigger-hints[data-trigger-hints="time_in_stage"] [data-trigger-stage-hint],
.automation-trigger-hints[data-trigger-hints="record_action"] [data-trigger-record-hint],
.automation-trigger-hints[data-trigger-hints="date_field"] [data-trigger-date-hint] { visibility: visible; }

.automation-builder .automation-date-pair:has([data-stage-selector]:not([hidden])) {
  grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr) minmax(59px, .55fr);
  align-items: end;
  gap: 7px;
}
.automation-builder .automation-date-pair:has([data-stage-selector]:not([hidden])) select {
  padding-inline-start: 7px;
  padding-inline-end: 24px;
  height: 35px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.automation-list-delete-column { width: 52px; }
.directory .automation-list-delete { padding-inline: 6px 10px; text-align: right; white-space: nowrap; }
.directory .automation-list-delete .remove-button { vertical-align: middle; }

.template-settings-directory { width: 100%; max-width: none; }
.template-settings-directory > [role="status"] { margin: 12px 14px; }
.template-settings-directory .template-description-column { width: 50%; }
.template-settings-directory .template-restore-column { width: 180px; }

.template-handoff-trigger { white-space: nowrap; min-height: 35px; }
.template-default-choice { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; }
.template-default-choice select { flex: 1 1 170px; min-width: 0; }

/* Keep template view tabs immediately above the content, below the workspace header. */
.settings-template-toolbar { margin-bottom: 12px; }
.settings-template-toolbar > .settings-subtabs { min-width: 0; margin-block: 0; }

.related-sales-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.recurring-invoice-schedules {
  margin: 10px 0;
  padding: 8px 0;
  border-block: 1px solid var(--line);
}
.recurring-invoice-schedules h3 { margin: 0 0 6px; }
.recurring-invoice-schedules :is(th, td) { padding-block: 4px; }
.recurring-row-actions { display: flex; align-items: center; gap: 4px; }
.recurring-edit:hover, .recurring-edit:focus-visible { background: var(--line); }
.recurring-invoice-enabled { margin-top: 12px; }
.quote-editor [data-recurring-monthly][hidden],
.quote-editor [data-recurring-interval][hidden] { display: none; }

.recurring-customer-card {
  padding: 6px;
  background: #f5f8ff;
}
.recurring-customer-card .job-error { margin: 8px 12px 0; }
.recurring-customer-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 8px;
}
.recurring-customer-link:hover { background: var(--blue-soft); text-decoration: none; }
.recurring-customer-link:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.recurring-customer-link .avatar {
  width: 38px;
  height: 38px;
  border: 1px solid #cfdcfa;
  border-radius: 10px;
  background: linear-gradient(145deg, #dfe8ff, #eef2ff);
  font-size: var(--text-section);
}
.recurring-customer-identity { min-width: 0; flex: 1 1 auto; }
.recurring-customer-identity h2 {
  margin: 0 0 2px;
  font-size: var(--text-caption);
  color: var(--muted);
}
.recurring-customer-name {
  color: var(--ink);
  font-size: var(--text-section);
  font-weight: 700;
  overflow-wrap: anywhere;
}
.recurring-customer-visit {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-caption);
  font-weight: 650;
}
.recurring-customer-visit svg { flex: 0 0 16px; width: 16px; height: 16px; }

.ticket-editor-status { display: grid; justify-items: start; align-content: start; gap: 4px; }

.recurring-inline-fields:not([hidden]) { display: contents; }
.recurring-inline-help { grid-column: 1 / -1; }
.recurring-inline-help .recurring-invoice-enabled { margin-top: 0; }
.recurring-inline-help p:last-child { margin-bottom: 0; }
.quote-editor [data-invoice-stage][hidden], .recurring-inline-fields[hidden] { display: none; }
[data-make-recurring][aria-expanded="true"] { background: var(--blue-soft); color: var(--blue); }

.sales-history-summary { margin: 0 0 14px; }
.sales-history-summary > div { padding: 8px 10px; border-radius: 8px; background: var(--canvas); }
.sales-history-summary dt { font-size: var(--text-small); color: var(--muted); }
.sales-history-summary dd { margin: 3px 0 0; }

tr[data-record-row] { cursor: pointer; }
tr[data-record-row] a:not(.button):not(.icon-button):hover {
  color: var(--blue);
  text-decoration: none;
}

.customer-name-link { color: var(--ink); }
.customer-name-link:hover, .customer-name-link:focus-visible,
.recurring-customer-link:hover .recurring-customer-name,
.recurring-customer-link:focus-visible .recurring-customer-name {
  color: var(--blue);
  text-decoration: none;
}

.quote-validity-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; }
.quote-validity-form input { width: 7rem; }
.sales-number-preview {
  display: flex;
  align-items: baseline;
  gap: 8px 12px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--blue-soft);
}
.sales-number-preview output {
  font-weight: var(--weight-heading);
  overflow-wrap: anywhere;
}

.contact-billing-document-settings {
    margin-block: 12px; padding: 12px;
    border: 1px solid var(--line); border-radius: 12px;
}
.contact-billing-document-settings h3,
.contact-billing-document-settings p { margin: 0 0 6px; }
.contact-billing-document-controls, .contact-billing-document-options {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
}
.contact-billing-document-controls { justify-content: space-between; }
.contact-billing-document-options .check { gap: 6px; cursor: pointer; }
.contact-email-options { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
#contact-editor .billing-opt-in { gap: 6px; }
#contact-editor .billing-opt-in input { margin: 0; }
.contact-billing-fallback { margin-top: 6px; }
.contact-billing-panel fieldset { border: 0; padding: 0; }
.contact-billing-panel[hidden],
#contact-editor:not(:has([name="billing_enabled"]:checked)) [data-contact-billing-panel] { display: none; }
@media (min-width: 850px) {
    .contact-billing-panel > .grid { grid-template-columns: minmax(0, 1fr) minmax(0, .7fr) minmax(0, 1.6fr); align-items: start; }
}
@media (max-width: 849px) {
    .contact-billing-panel .billing-address-input { grid-column: 1 / -1; }
}

.contact-duplicate-card { padding-block: 10px; }
.contact-duplicate-card > .toolbar { align-items: center; margin: 0; }
.contact-duplicate-results-heading { align-items: center; margin-bottom: 12px; }
#duplicate-match-results thead th:last-child { width: 1%; }
.contact-duplicate-row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin: 0; }
.contact-duplicate-row-actions > :is(a, button) { white-space: nowrap; }
:is(.contact-duplicate-card, .contact-duplicate-results-heading) h2 { margin: 0 0 4px; }
:is(.contact-duplicate-card, .contact-duplicate-results-heading) p { margin: 0; }
.contact-duplicate-review-heading { align-items: flex-start; margin-bottom: 10px; }
.contact-duplicate-review-heading h2, .contact-duplicate-review-heading p { margin: 0 0 4px; }
.transfer-export-actions { justify-content: flex-start; }
.transfer-export-actions > select { min-inline-size: min(150px, 100%); }
.data-transfer-preview { overflow-x: auto; margin-bottom: 10px; }
.data-transfer-preview table { width: 100%; }
[data-transfer-issues]:focus, [data-transfer-mapping-step]:focus,
[data-transfer-confirm]:focus { outline: none; }
.transfer-step > summary { font-size: var(--text-section); line-height: 1.3; }
.transfer-step[open] > summary { margin-bottom: 10px; }
[data-transfer-confirm] > :is(h3, p[role="status"]) {
  max-inline-size: 46rem;
  margin-inline: auto;
  text-align: start;
  overflow-wrap: anywhere;
}
.transfer-step[hidden], [data-transfer-reuse-help][hidden] { display: none; }
.transfer-draft-list { list-style: none; margin: 0; padding: 0; }
.transfer-draft-list > li { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding-block: 7px; }
.transfer-draft-list > li + li { border-top: 1px solid var(--line); }
.transfer-draft-list .toolbar { margin: 0; }
.transfer-draft-list small { color: var(--muted); }
.transfer-draft-sticky {
  position: sticky; inset-block-end: max(12px, env(safe-area-inset-bottom)); z-index: 3;
  display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end;
  width: max-content; max-width: 100%; margin: 0 12px 10px auto;
  padding: 4px; border-radius: 10px; background: var(--surface); box-shadow: var(--panel-shadow);
}
.transfer-issue-complete, [data-transfer-issue-filter]:has(option.transfer-issue-complete:checked) { color: #17653a; font-weight: var(--weight-medium); }
/* Keep bulk actions together at the standard toolbar gap, like the draft actions. */
[data-transfer-issue-controls] { justify-content: flex-end; }
[data-transfer-issue-controls] > label { margin-inline-end: auto; }
[data-transfer-clear-shown][hidden] { display: none; }
@media (max-width: 680px) {
  .transfer-draft-sticky { inset-block-end: max(8px, env(safe-area-inset-bottom)); margin-inline-end: 4px; }
}
/* Issue rows grow with the page; the shared table wrapper still handles horizontal overflow. */
.transfer-issue-results thead { position: sticky; top: 0; z-index: 1; }
.transfer-issue-results td small { display: block; }
.transfer-duplicate-layout table { table-layout: fixed; min-width: 760px; }
.transfer-issue-number { width: 3.25rem; }
.transfer-duplicate-layout th:first-child, .transfer-duplicate-layout td:first-child {
  padding-inline: 6px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.transfer-issue-record { width: 24%; }
.transfer-issue-result { width: 27%; }
.transfer-issue-action { width: 23%; }
.transfer-duplicate-layout td { vertical-align: top; overflow-wrap: anywhere; }
.transfer-issue-results tr[data-transfer-issue-group]:has(details[open]) { background: #f8faff; }
.transfer-duplicate-matches { margin-top: 4px; }
.transfer-new-match-note { margin-top: 4px; }
.transfer-duplicate-layout tr:not(:has([data-transfer-duplicate-values][open])) .transfer-duplicate-matches dl { display: none; }
.transfer-duplicate-matches > [data-transfer-merge-match] + [data-transfer-merge-match] { margin-top: 10px; }
.transfer-merge-value { display: flex; align-items: baseline; gap: 5px; }
.transfer-merge-value > input { flex: none; width: auto; margin: 0; }
.transfer-merge-value > input[hidden], [data-transfer-merge-field][hidden], [data-transfer-merge-match][hidden],
[data-transfer-optout-review][hidden], .transfer-issue-results [data-transfer-resolution-help][hidden] { display: none; }
[data-transfer-duplicate-action] > select { width: 100%; min-width: 0; }
.transfer-issue-results [data-transfer-resolution-help]:not([hidden]) { margin-top: 4px; }
:is([data-transfer-email-action], [data-transfer-value-action]) { display: flex; align-items: center; gap: 6px; }
:is([data-transfer-email-action], [data-transfer-value-action]) > input { flex: 1 1 0; min-width: 0; width: 0; }
:is([data-transfer-email-action], [data-transfer-value-action]) > .check { flex: none; align-items: center; margin: 0; line-height: 1.1; }
[data-transfer-email-action] > .check span { text-align: center; white-space: nowrap; }
.data-transfer-preview details { margin-top: 4px; }
.data-transfer-preview dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 12px; margin: 6px 0 0; }
.data-transfer-preview dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
[data-transfer-upload] > button { margin-block-start: 10px; }
[data-transfer-mapping] .toolbar { margin-block: 10px; }
.transfer-mapping-toolbar:not([hidden]) {
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 16px;
    margin-block: 10px;
}
.transfer-mapping-filters {
    display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px;
    border: 1px solid var(--line); border-radius: 12px;
}
.transfer-mapping-filters button { border: 0; background: transparent; padding: 6px 10px; }
.transfer-mapping-filters button[aria-pressed="true"] { background: var(--blue-soft); color: var(--blue); }
.transfer-mapping-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.transfer-mapping-table { table-layout: fixed; min-width: 555px; }
.transfer-mapping-table thead th:nth-child(2) { width: 30%; }
.transfer-mapping-table thead th:nth-child(3) { width: 20%; }
.transfer-mapping-table tbody th { background: var(--surface); white-space: normal; font-size: var(--text-body); }
.transfer-mapping-table tbody tr:nth-child(even) :is(th,td) { background: #f9fbff; }
.transfer-mapping-table tbody tr[data-transfer-mapping-error] > :is(th, td) {
    background: #fff1f1; border-bottom-color: #eab9ba;
}
.transfer-mapping-table tr[data-transfer-mapping-error] > th { box-shadow: inset 4px 0 #bd2634; }
.transfer-mapping-table [aria-invalid="true"] { border-color: #bd2634; }
.transfer-mapping-message:not([hidden]) { display: block; margin-top: 6px; color: #8d1725; line-height: 1.35; }
.transfer-mapping-table select { width: 100%; max-width: 26rem; min-width: 0; }

[data-cleanup-phone][hidden] { display: none; }
/* Let the three columns share the width equally, regardless of their content. */
.cleanup-comparison { border: 1px solid var(--line); border-radius: 8px; }
.cleanup-comparison table { table-layout: fixed; }
.cleanup-comparison :is(th, td) { vertical-align: top; white-space: normal; }
.cleanup-comparison tr > :not(:first-child) { border-inline-start: 1px solid var(--line); }
.cleanup-comparison tbody th { background: var(--surface); font-size: var(--text-body); }
.cleanup-comparison tbody th a { display: inline; }
.cleanup-comparison tbody .cleanup-value { white-space: pre-wrap; }
.cleanup-comparison .cleanup-before { background: #f7f9fc; }
.cleanup-comparison .cleanup-after { background: var(--blue-soft); }
.cleanup-comparison tbody tr:last-child > * { border-bottom: 0; }
.cleanup-preview-actions, .cleanup-preview-pages { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cleanup-preview-actions > button { margin-inline-start: auto; }

.transfer-field-preview { white-space: pre-wrap; overflow-wrap: anywhere; vertical-align: middle; }
.transfer-mapping-table select[hidden] { display: none; }
.transfer-field-trigger {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    text-align: start; width: 100%; max-width: 26rem; min-height: 34px;
}
.transfer-field-trigger > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transfer-field-trigger::after {
    content: ""; flex: 0 0 6px; height: 6px; margin-inline: 4px;
    border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg);
}
.transfer-field-picker[hidden] { display: none; }
.transfer-field-picker {
    position: fixed; z-index: 25; padding: 6px; border: 1px solid var(--line); border-radius: 10px;
    background: var(--surface); box-shadow: 0 8px 22px #182b4c26; box-sizing: border-box;
}
.transfer-field-picker input { width: 100%; }
.transfer-picker-rename:not([hidden]) { display: flex; gap: 6px; align-items: center; margin-block: 6px; }
.transfer-picker-rename input { min-width: 0; }
.transfer-picker-rename button { flex: none; white-space: nowrap; }
.transfer-source-picker { display: block; position: relative; min-width: 0; }
.transfer-source-picker > input { width: 100%; padding-inline-end: 28px; }
.transfer-source-picker::after {
    content: ""; pointer-events: none; position: absolute; inset-inline-end: 13px; inset-block-start: 12px;
    width: 6px; height: 6px; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg);
}
.transfer-source-picker > .transfer-field-choices:not([hidden]) {
    display: block; position: absolute; z-index: 25; inset-inline: 0; inset-block-start: 100%;
    max-height: 12rem; padding: 4px; border: 1px solid var(--line); border-radius: 8px;
    background: var(--surface); box-shadow: 0 8px 22px #182b4c26;
}
.transfer-source-picker [role="option"] { display: block; }
.transfer-field-choices { overflow-y: auto; margin-top: 4px; position: relative; }
.transfer-field-choices [role="option"] {
    padding: 6px 8px; cursor: pointer; border-radius: 5px; overflow-wrap: anywhere;
}
.transfer-field-choices [role="option"]:is([data-active],:hover) { background: var(--blue-soft); }
.transfer-field-choices [role="option"][aria-selected="true"] { font-weight: var(--weight-medium); }

.mass-delete-preview-header { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 16px; margin-bottom: 12px; }
.mass-delete-preview-header p:last-child { margin-bottom: 0; }
.mass-delete-review { margin-inline-start: auto; }
.mass-delete-confirm { width: min(425px, calc(100% - 28px)); }
.mass-delete-confirm .dialog-actions { flex-wrap: wrap; gap: 8px; }
.mass-delete-confirm .dialog-actions .check { flex-basis: 100%; }

[data-numbering-ack], label.check:has([name="invoice_delete_ack"]) { gap: 6px; }
[data-numbering-ack][hidden] { display: none; }

.mass-delete-confirm [hidden] { display: none; }
.mass-delete-confirm ul { margin: 8px 0 12px; padding-inline-start: 22px; }

.mass-delete-confirm:has([data-mass-delete-kept]:not([hidden])) { width: min(720px, calc(100% - 28px)); }
.mass-delete-kept-groups { display: grid; gap: 8px; max-height: min(55vh, 440px); overflow: auto; padding: 2px 4px 2px 2px; }
.mass-delete-reason { border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; }
.mass-delete-reason summary { cursor: pointer; padding: 9px 0; font-weight: var(--weight-medium); }
.mass-delete-reason > p { margin: 0 0 8px; }
.mass-delete-confirm .mass-delete-kept-list { list-style: none; padding: 0; margin: 0 0 8px; }
.mass-delete-kept-list li { display: grid; gap: 2px; padding: 6px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.mass-delete-linked { font-size: .9em; }

.mass-delete-kept-record { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }

/* Global search fills the centre cell of the shared workspace header. */
.global-search { position: relative; width: 100%; min-width: 0; margin: 0; }
.global-search-control {
    display: flex; align-items: center; min-height: 37px; border: 1px solid var(--line); border-radius: 10px;
    background: var(--surface); overflow: hidden;
}
.global-search-control:focus-within { border-color: var(--blue); box-shadow: 0 0 0 2px #416adc2b; }
.global-search-control button {
    display: grid; place-items: center; flex: 0 0 40px; padding: 6px; border: 0; border-radius: 0;
    color: var(--muted); background: transparent;
}
.global-search-control button svg { width: 21px; height: 21px; }
.global-search-control input { flex: 1 1 auto; min-width: 0; width: auto; margin: 0; border: 0; padding: 7px 10px 7px 0; line-height: 1.3; background: transparent; }
.global-search-control input:focus { outline: none; box-shadow: none; }
.global-search-matches {
    position: absolute; inset: calc(100% + 6px) 0 auto;
    border-radius: 13px; border: 1px solid var(--line); overflow: hidden;
    background: var(--surface); box-shadow: 0 12px 32px #16294830;
}
.global-search-preview-groups {
    display: grid; gap: 8px; max-height: min(52vh, 420px); overflow: auto;
    padding: 8px; background: #f4f7fd; overscroll-behavior: contain;
}
.global-search-group {
    min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
    scroll-margin-top: calc(var(--workspace-topbar-height) + 12px);
}
.global-search-group-heading {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0;
    padding: 9px 12px; border-radius: 9px 9px 0 0; border-bottom: 1px solid var(--line);
    background: #ecf2fd; color: #27446f;
}
.global-search-matches .global-search-group-heading { font-size: var(--text-small); padding: 6px 9px; }
.global-search-count {
    display: inline-grid; place-items: center; min-width: 22px; padding: 2px 6px;
    border-radius: 999px; color: #244777; background: #dbe7fa;
    font-size: var(--text-small); font-weight: 700; font-variant-numeric: tabular-nums;
}
.global-search-group ul { padding: 0; margin: 0; list-style: none; }
.global-search-group li + li { border-top: 1px solid #edf1f8; }
.global-search-group li a {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 10px 13px; color: var(--ink); font-weight: var(--weight-medium); overflow-wrap: anywhere;
}
.global-search-matches li a { padding: 6px 9px; }
.global-search-group li:last-child > a { border-radius: 0 0 9px 9px; }
.global-search-group li a::after {
    content: ""; flex: none; width: 6px; height: 6px; margin-inline-end: 3px;
    border: solid currentColor; border-width: 1.5px 1.5px 0 0; transform: rotate(45deg); opacity: .55;
}
.global-search-group li a:is(:hover, :focus-visible) {
    color: var(--blue); background: #f2f6ff; text-decoration: none; outline-offset: -2px;
}
.global-search-preview-footer { padding: 8px; border-top: 1px solid var(--line); }
.global-search-all { width: 100%; color: var(--blue); }
.global-search-preview-empty { margin: 0; padding: 12px; color: var(--muted); }
.global-search-announcement { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
.global-search-results { display: grid; gap: 13px; }
.global-search-result-text { display: grid; min-width: 0; gap: 2px; }
.global-search-result-title { font-weight: 700; }
.global-search-matched-fields { display: flex; flex-wrap: wrap; gap: 3px 14px; }
.global-search-match { min-width: 0; color: var(--muted); font-size: var(--text-small); font-weight: 400; overflow-wrap: anywhere; }
.global-search-match strong { font-weight: 650; }
.global-search-match mark { padding: 0 1px; border-radius: 3px; color: #204074; background: #e3edff; font-weight: 700; }
.global-search-summary, .global-search-empty {
    padding: clamp(13px, 2vw, 22px); border: 1px solid #cfddf6; border-radius: 12px;
    background: linear-gradient(108deg, #eaf2ff, var(--surface) 88%);
}
.global-search-summary p {
    margin: 0 0 4px; color: #2e5084; font-size: var(--text-small); font-weight: 700;
}
.global-search-summary h2 { margin: 0; font-size: clamp(1.05rem, 2vw, 1.35rem); overflow-wrap: anywhere; }
.global-search-empty h2 { margin: 0; }
.global-search-empty p { margin: 5px 0 0; color: var(--muted); }
.global-search-jumps { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.global-search-jumps a {
    display: inline-flex; align-items: center; gap: 7px; padding: 3px 4px 3px 9px;
    border: 1px solid #d5e2f8; border-radius: 999px; color: #244777; background: var(--surface);
}
.global-search-jumps a:is(:hover, :focus-visible) { color: var(--blue); background: #f2f6ff; }
.global-search-group-note { padding: 8px 13px; margin: 0; color: var(--muted); border-top: 1px solid var(--line); }
main:has(> [data-workspace-topbar]) .contact-tabs { top: var(--workspace-topbar-height); }
main:has(> [data-workspace-topbar]) .record-anchor { scroll-margin-top: calc(var(--workspace-topbar-height) + 62px); }

/* View tabs share the title cell instead of pushing the module content down. */
.page-heading .page-title:has(> .module-tabs) { gap: 7px; }
.page-heading .page-title:has(> .module-tabs) h1 {
    display: block; white-space: nowrap; text-overflow: ellipsis;
    font-size: clamp(1rem, 1.65vw, var(--text-page));
}
.page-heading .module-tabs {
    flex: 0 1 auto; min-width: 0; max-width: 72%; margin: 0; padding: 2px; gap: 1px;
    border-radius: 8px; scrollbar-width: thin; align-items: center;
}
/* Size each Jobs title slot against the same translated headings, not the current title. */
.page-heading .page-title-text[data-diary-title] { display: grid; flex: none; }
.page-heading .page-title-text[data-diary-title] h1,
.page-heading .page-title-text[data-diary-title]::before,
.page-heading .page-title-text[data-diary-title]::after {
    grid-area: 1 / 1; white-space: nowrap; font-size: clamp(1rem, 1.65vw, var(--text-page));
    font-weight: var(--weight-heading); letter-spacing: -.045em; line-height: 1.15;
}
.page-heading .page-title-text[data-diary-title]::before { content: attr(data-diary-title); visibility: hidden; }
.page-heading .page-title-text[data-diary-title]::after { content: attr(data-unscheduled-title); visibility: hidden; }
.page-heading [data-jobs-view-tabs] { max-width: none; }
.page-heading .module-tabs a {
    display: inline-flex; align-items: center; min-height: 30px; padding: 4px 8px;
    font-size: 0.8125rem; line-height: 1.15; white-space: nowrap; border-radius: 5px;
}
@media (min-width: 701px) {
    .page-heading:has([data-jobs-view-tabs]) {
        grid-template-columns: minmax(max-content, 1fr) minmax(125px, min(23%, 400px)) minmax(0, 1fr);
    }
}
@media (max-width: 700px) {
    .page-heading:has([data-jobs-view-tabs]) {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-areas: "title title" "search actions";
    }
    .page-heading:has([data-jobs-view-tabs]):not(:has(> .page-actions)) {
        grid-template-areas: "title title" "search search";
    }
}

@media (max-width: 700px) {
    .page-heading .page-title-text:has(> .breadcrumb) { display: grid; gap: 0; }
}
@media (min-width: 701px) {
    .global-search-matches {
        inset-inline: 50% auto; transform: translateX(-50%);
        width: max(100%, 300px);
    }
}
@media (max-width: 700px) {
    .page-heading:has([data-jobs-view-tabs]):has(> .page-actions) .global-search-matches {
        inset-inline-end: auto; width: min(340px, calc(100vw - 24px));
    }
}

/* Keep the full results compact; the narrower live dropdown keeps its stacked detail. */
.global-search-results .global-search-result-text { display: flex; align-items: baseline; gap: 10px; }
.global-search-results .global-search-result-title {
    flex: 0 1 auto; min-width: 0; max-width: 50%;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.global-search-results .global-search-matched-fields {
    flex: 1 1 0; min-width: 0; display: block;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted);
}
.global-search-results .global-search-match + .global-search-match::before {
    content: "·"; margin-inline: 8px; color: var(--muted);
}

.global-search-announcement.global-search-live-error {
    position: static; width: auto; height: auto; clip-path: none;
    padding: 9px 12px; margin: 0 0 10px; border: 1px solid var(--danger);
    border-radius: 8px; background: var(--danger-surface); color: var(--danger-hover);
}

.global-search-history-tag {
    flex: 0 0 auto; white-space: nowrap; padding: 2px 7px; border-radius: 999px;
    color: #4c3409; background: #ffedb9; font-size: var(--text-small); font-weight: 700;
}
.global-search-result-text:has(.global-search-history-tag) .global-search-result-title { max-width: 35%; }
.history-event[id^="history-event-"] { scroll-margin-top: calc(var(--workspace-topbar-height, 56px) + 12px); }
.history-event[id^="history-event-"]:target { outline: 2px solid var(--blue); outline-offset: 2px; }
@media (max-width: 540px) {
    .global-search-results .global-search-result-text:has(.global-search-history-tag) {
        display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 8px;
    }
    .global-search-result-text:has(.global-search-history-tag) .global-search-result-title { max-width: none; }
    .global-search-result-text:has(.global-search-history-tag) .global-search-matched-fields {
        grid-column: 1 / -1; grid-row: 2;
    }
    .global-search-history-meta { grid-column: 2; grid-row: 1; }
}


.global-search-history-meta { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.global-search-history-date { color: var(--muted); font-size: var(--text-caption); font-weight: 400; font-variant-numeric: tabular-nums; }
.temporal-display { display: none; }
.temporal-field[data-date-present] > input:not(:focus) { color: transparent; -webkit-text-fill-color: transparent; }
.temporal-field[data-date-present] > input:not(:focus) ~ .temporal-display {
    position: absolute; inset: 0 34px 0 9px; display: flex; align-items: center;
    width: auto; overflow: hidden; white-space: nowrap; pointer-events: none;
    color: var(--ink); font: inherit;
}
.temporal-field[data-date-present] > input:disabled ~ .temporal-display { color: var(--muted); }


.editor-detail-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.editor-detail-heading > button { margin-bottom: 10px; }
.editor-secondary-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }


.ticket-filter-row {
    --filter-option-hover: #e0eaff;
    --filter-picker-shadow: 0 10px 28px #17213826;
}
.record-filter-field-picker, [data-condition-multi-picker] { display: block; min-width: 0; }
.ticket-filter-row :is(select[data-condition-field], select[data-condition-operator],
    [data-condition-single] > select, .record-filter-field-trigger) {
    width: 100%; min-width: 0; min-height: 34px;
    font: inherit; font-size: var(--text-body); font-weight: var(--weight-medium);
    color: var(--ink);
}
.record-filter-field-trigger {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    text-align: start; overflow-wrap: anywhere;
    padding-inline: 9px 32px;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: right 15px center, right 10px center;
    background-size: 5px 5px; background-repeat: no-repeat;
}
.record-filter-field-trigger:hover { border-color: #aebfe0; background-color: #f8faff; }
.record-filter-field-trigger[aria-expanded="true"] { border-color: var(--blue); background-color: #f8faff; }
.record-filter-field-menu {
    /* A fixed overlay does not contribute overflow to the modal or its scrollable body. */
    position: fixed; inset: auto; z-index: 8; display: flex; flex-direction: column; padding: 5px;
    background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px;
    box-shadow: var(--filter-picker-shadow);
}
.record-filter-field-menu > input { flex: none; width: 100%; }
.record-filter-field-options {
    display: grid; grid-template-columns: minmax(0, 1fr);
    min-height: 0; max-height: min(320px, 45dvh); overflow-y: auto; overscroll-behavior-y: contain;
}
.record-filter-field-menu > input + .record-filter-field-options { margin-top: 4px; }
.record-filter-field-options button {
    display: grid; grid-template-columns: minmax(0, 1fr) 12px; align-items: center; gap: 8px;
    width: 100%; min-height: 34px; padding: 7px 9px; border: 0; border-radius: 7px;
    text-align: start; color: var(--ink); background: transparent;
    font: inherit; font-size: var(--text-body); font-weight: normal; overflow-wrap: anywhere;
}
.record-filter-field-options button[aria-pressed="true"] {
    background: var(--blue-soft); color: var(--blue); font-weight: var(--weight-medium);
}
.record-filter-field-options button:hover, .record-filter-field-options button:focus-visible {
    background: var(--filter-option-hover); color: var(--blue-hover);
}
.record-filter-field-options button:focus-visible { outline: 2px solid currentColor; outline-offset: -2px; }
.record-filter-field-options button[aria-pressed="true"]::after {
    content: "✓"; grid-column: 2; justify-self: end; color: var(--blue); line-height: 1;
}
@supports (appearance: base-select) and selector(select::picker(select)) {
    .record-filter-field-trigger { padding-inline-end: 12px; background-image: none; }
    .record-filter-field-trigger::after {
        content: ""; flex: none; width: 8px; height: 7px; color: var(--muted);
        background: currentColor; clip-path: polygon(0 0, 100% 0, 50% 100%);
    }
    .record-filter-field-trigger[aria-expanded="true"]::after { color: var(--blue); rotate: 180deg; }
    .ticket-filter-row select option { font-weight: normal; }
    .ticket-filter-row select option:checked { font-weight: var(--weight-medium); }
}
.record-filter-field-empty { display: block; padding: 5px 7px; color: var(--muted); }

.record-filter-field-cell, .record-filter-value-cell { min-width: 0; }
[data-condition-multi] {
    display: grid; gap: 5px; font-size: var(--text-small); font-weight: var(--weight-medium);
}
[data-condition-multi-picker] .record-filter-field-trigger > span {
    min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
@media (max-width: 560px) {
    .ticket-filter-row :is(.record-filter-field-cell, .record-filter-value-cell) { grid-column: 1; }
}

.holiday-heading, .holiday-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; }
.holiday-heading { justify-content: space-between; align-items: center; }
.holiday-policy-dates { border-top: 1px solid var(--line); padding-top: .75rem; }
.holiday-policy-dates h3 { margin: 0; }
.holiday-policy-dates > p { margin: .35rem 0 .65rem; }
.holiday-policy-dates > ul { margin-bottom: 0; }
.holiday-controls label { min-width: max-content; }
.holiday-controls input[type="number"] { max-width: 7rem; }
.holiday-controls .check { align-self: center; }
.holiday-balance { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: .75rem; }
.holiday-balance div { background: var(--blue-soft); border-radius: .55rem; padding: .6rem .8rem; }
.holiday-balance dt { color: var(--muted); font-size: .85rem; }
.holiday-balance dd { margin: .2rem 0 0; font-size: 1.15rem; font-weight: 600; }
.holiday-request { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem; padding: .7rem 0; border-top: 1px solid var(--line); }
.holiday-request p { margin: .25rem 0 0; }
.holiday-state, .holiday-conflict { font-size: .85rem; color: var(--muted); }
.holiday-closures { padding: 0; list-style: none; }
.holiday-closures li { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; padding: .45rem 0; border-top: 1px solid var(--line); }
.holiday-closures li form { margin-left: auto; }
.holiday-blocked { color: var(--muted); }

.holiday-calendar-dialog { width: min(460px, calc(100% - 24px)); }
.holiday-calendar-dialog p { margin: 0; }
.holiday-calendar-nav { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.holiday-calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .25rem; text-align: center; }
.holiday-calendar-grid[data-calendar-days] { user-select: none; touch-action: none; }
.holiday-calendar-grid button { width: 100%; min-width: 0; padding: .4rem 0; }
.holiday-calendar-grid button[aria-pressed="true"] { color: white; background: var(--blue); border-color: var(--blue); }
.holiday-calendar-grid button[data-ineligible], .holiday-calendar-grid button:disabled { color: var(--muted); background: #f0f3f8; }
.holiday-calendar-grid button[data-ineligible][data-in-range] { background: var(--blue-soft); color: var(--muted); border-color: var(--line); }
.holiday-calendar-grid button[aria-current="date"] { font-weight: 700; text-decoration: underline; }
.holiday-calendar-fields { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.holiday-controls [data-calendar-native][hidden] { display: none; }

/* Public account pages share the marketing site's pale blue and wordmark. */
.workspace-site-header{width:min(70rem,100%);margin:0 auto;padding:1rem clamp(1rem,4vw,2.7rem);display:flex;align-items:center;justify-content:space-between;gap:.8rem}
.workspace-wordmark{display:inline-flex;align-items:center;gap:.55rem;color:#172138;font-size:1.19rem;letter-spacing:-.04em;font-weight:770;white-space:nowrap}
.workspace-wordmark img{display:block;width:2rem;height:2rem}
.workspace-wordmark small{font-size:.68em;color:#53627b;letter-spacing:0}
.workspace-home{font-size:.875rem;font-weight:650;color:#365591;white-space:nowrap}
.workspace-site-header + .workspace-access{min-height:0;padding:clamp(1rem,4vh,3rem) 1rem 2.5rem}
.workspace-site-header + .workspace-access--split{width:min(61rem,100%);max-width:none;grid-template-columns:minmax(0,1.04fr) minmax(0,.96fr);gap:clamp(1rem,4vw,3rem);align-items:center}
.workspace-site-header + .workspace-access .workspace-card{border:1px solid #d6e0f0;border-radius:14px;background:#fff;box-shadow:0 12px 32px #152b5310}
.workspace-card .workspace-account-links{gap:.65rem 1rem;font-size:.875rem}
.workspace-card .workspace-account-links a,.workspace-story a{color:#2548a2;font-weight:650}
.workspace-card .workspace-account-links a:hover,.workspace-story a:hover,.workspace-home:hover{text-decoration:underline;text-underline-offset:3px}
.workspace-story{display:grid;align-content:center;gap:.9rem;width:100%;padding:clamp(1rem,2.6vw,2rem);color:#19294b}
.workspace-story h2{margin:0;font-size:clamp(1.9rem,3.8vw,3rem);line-height:1.08;letter-spacing:-.04em}
.workspace-story p{margin:0;color:#53627b}
.workspace-story .workspace-kicker{font-size:.86rem;font-weight:750;color:#365591}
@media(max-width:700px){.workspace-site-header + .workspace-access--split{max-width:36rem;grid-template-columns:1fr;gap:1rem}.workspace-story{padding:.75rem .4rem}.workspace-story h2{font-size:1.45rem}}
.workspace-access label[hidden]{display:none}
