:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-soft: #eaf0f8;
    --text: #18212f;
    --muted: #607086;
    --line: #d7e0ec;
    --accent: #1266db;
    --accent-strong: #0d4fae;
    --success: #15815d;
    --warning: #9f6500;
    --danger: #b63a43;
    --shadow: 0 18px 44px rgba(30, 51, 83, 0.12);
}

/* Dashboard rich lead cards v1 */
body.profile-garage .dashboard-lead-summary {
    align-items: stretch;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(220px, .72fr) minmax(0, 1.28fr);
    min-width: 0;
}

body.profile-garage .dashboard-lead-contact,
body.profile-garage .dashboard-lead-data {
    display: grid;
    gap: 9px;
    min-width: 0;
}

body.profile-garage .dashboard-lead-contact {
    align-content: start;
}

body.profile-garage .dashboard-lead-contact h2 {
    color: var(--ui-ink);
    font-size: 1.16rem;
    line-height: 1.25;
    margin: 0;
    overflow-wrap: anywhere;
}

body.profile-garage .dashboard-lead-address {
    color: #40516a;
    font-size: .88rem;
    font-weight: 750;
    margin: 0;
    overflow-wrap: anywhere;
}

body.profile-garage .dashboard-lead-source,
body.profile-garage .dashboard-lead-block {
    border: 1px solid #e1e7f0;
    border-radius: 11px;
    display: grid;
    gap: 3px;
    min-width: 0;
    padding: 9px 10px;
}

body.profile-garage .dashboard-lead-source {
    align-content: start;
    background: #f6f8fb;
}

body.profile-garage :is(.dashboard-lead-source, .dashboard-lead-block) small,
body.profile-garage .attention-details small {
    color: #718099;
    font-size: .61rem;
    font-weight: 900;
    letter-spacing: .055em;
    line-height: 1.2;
    text-transform: uppercase;
}

body.profile-garage .dashboard-lead-source strong {
    color: #263a58;
    font-size: .86rem;
    overflow-wrap: anywhere;
}

body.profile-garage .dashboard-lead-source span {
    color: #607086;
    font-size: .76rem;
    overflow-wrap: anywhere;
}

body.profile-garage .dashboard-lead-block {
    background: #f7f9fc;
}

body.profile-garage .dashboard-lead-block p {
    color: var(--ui-ink);
    font-size: .9rem;
    line-height: 1.42;
    margin: 0;
    overflow: visible;
    overflow-wrap: anywhere;
    white-space: pre-line;
}

body.profile-garage .dashboard-lead-comment,
body.profile-garage .attention-comment {
    background: #fff7df;
    border-color: #efd58f;
}

body.profile-garage .dashboard-lead-comment p,
body.profile-garage .attention-comment strong {
    color: #5f4712;
    font-weight: 850;
}

body.profile-garage .dashboard-lead-quiz,
body.profile-garage .attention-quiz {
    background: #f2f6fc;
    border-color: #dce5f1;
}

body.profile-garage .dashboard-lead-page,
body.profile-garage .attention-page {
    background: #fafbfe;
}

body.profile-garage .attention-details {
    border: 1px solid #e1e7f0;
    display: grid;
    gap: 4px;
    white-space: normal;
}

body.profile-garage .attention-details strong {
    color: #263a58;
    font-size: .82rem;
    line-height: 1.38;
    overflow-wrap: anywhere;
    white-space: pre-line;
}

@media (max-width: 719px) {
    body.profile-garage .dashboard-lead-summary {
        gap: 9px;
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-garage .dashboard-lead-contact,
    body.profile-garage .dashboard-lead-data {
        gap: 7px;
    }

    body.profile-garage .dashboard-lead-source,
    body.profile-garage .dashboard-lead-block {
        padding: 8px 9px;
    }

    body.profile-garage .dashboard-lead-block p {
        font-size: .8rem;
        line-height: 1.36;
    }

    body.profile-garage .attention-facts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.profile-garage .attention-details strong {
        font-size: .76rem;
        line-height: 1.34;
    }
}

* {
    box-sizing: border-box;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
    margin: 0;
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
}

.app-header {
    align-items: center;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr auto;
    padding: 14px clamp(16px, 4vw, 40px);
    position: sticky;
    top: 0;
    z-index: 2;
}

.brand,
.app-nav,
.page-intro,
.lead-topline,
.lead-body,
.event-list li div {
    align-items: center;
    display: flex;
}

.brand {
    gap: 10px;
    font-weight: 800;
    text-decoration: none;
}

.brand-mark {
    align-items: center;
    background: var(--text);
    border-radius: 8px;
    color: var(--surface);
    display: inline-flex;
    font-size: 1rem;
    height: 34px;
    justify-content: center;
    width: 34px;
}

.brand-mark-large {
    font-size: 1.35rem;
    height: 52px;
    width: 52px;
}

.app-nav {
    gap: 8px;
    grid-column: 1 / -1;
    overflow-x: auto;
}

.app-nav a,
.icon-action,
.primary-link,
.open-link {
    border-radius: 8px;
    text-decoration: none;
}

.app-nav a {
    color: var(--muted);
    padding: 9px 12px;
}

.app-nav a:hover {
    background: var(--surface-soft);
    color: var(--text);
}

.icon-action {
    background: var(--surface-soft);
    border: 0;
    color: var(--text);
    cursor: pointer;
    min-height: 40px;
    padding: 0 14px;
}

.app-shell {
    margin: 0 auto;
    max-width: 1240px;
    padding: clamp(22px, 5vw, 48px) clamp(16px, 4vw, 40px);
}

.page-intro {
    flex-wrap: wrap;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 24px;
}

.eyebrow {
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 800;
    margin: 0 0 8px;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    font-size: clamp(2rem, 6vw, 3.4rem);
    line-height: 1.05;
    margin-bottom: 0;
}

h2 {
    font-size: 1.15rem;
}

.primary-link,
.login-form button {
    background: var(--accent);
    border: 0;
    color: var(--surface);
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    min-height: 48px;
    padding: 14px 18px;
}

.primary-link:hover,
.login-form button:hover {
    background: var(--accent-strong);
}

.metric-grid,
.quick-grid,
.detail-layout {
    display: grid;
    gap: 16px;
}

.metric-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-bottom: 20px;
}

.metric-card,
.quick-card,
.lead-card,
.record-panel,
.login-panel,
.empty-state {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.metric-card {
    display: grid;
    gap: 16px;
    min-height: 168px;
    padding: 24px;
}

.metric-card span,
.lead-card time,
.event-list time,
dt {
    color: var(--muted);
}

.metric-card strong {
    font-size: 3rem;
    line-height: 1;
}

.workspace-band {
    background: #172a46;
    border-radius: 8px;
    color: var(--surface);
    display: grid;
    gap: 18px;
    padding: clamp(20px, 4vw, 34px);
}

.workspace-band .eyebrow,
.workspace-band span {
    color: #c6d5ea;
}

.quick-card {
    color: var(--text);
    display: grid;
    gap: 10px;
    min-height: 156px;
    padding: 22px;
    text-decoration: none;
}

.lead-list {
    display: grid;
    gap: 14px;
}

.lead-card {
    box-shadow: var(--shadow);
    display: grid;
    gap: 18px;
    padding: 20px;
}

.lead-list-intro {
    margin-bottom: 14px;
}

.lead-tools,
.lead-search,
.lead-search label,
.search-actions,
.lead-card-main,
.dashboard-filter-links {
    display: grid;
    gap: 10px;
}

.lead-tools {
    margin-bottom: 16px;
}

.lead-search {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
}

.lead-search label {
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 800;
}

.lead-search input,
.lead-search select {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    min-height: 50px;
    min-width: 0;
    padding: 0 13px;
    width: 100%;
}

.search-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.search-actions button,
.search-actions a,
.lead-pagination a,
.lead-pagination span {
    align-items: center;
    border: 0;
    border-radius: 8px;
    display: inline-flex;
    justify-content: center;
    min-height: 46px;
    padding: 11px 13px;
    text-decoration: none;
}

.search-actions button,
.lead-pagination a {
    background: var(--accent);
    color: var(--surface);
    cursor: pointer;
}

.search-actions a,
.lead-pagination span {
    background: var(--surface-soft);
    color: var(--muted);
}

.lead-counters {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.lead-counters span,
.lead-counters a {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    display: grid;
    font-size: 0.78rem;
    gap: 2px;
    min-width: 0;
    padding: 9px 7px;
    text-align: center;
    text-decoration: none;
}

.lead-counters b {
    color: var(--text);
    font-size: 1.12rem;
}

.status-chips {
    display: flex;
    gap: 8px;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 3px;
}

.status-chips a {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    flex: 0 0 auto;
    font-size: 0.9rem;
    font-weight: 800;
    min-height: 42px;
    padding: 11px 13px;
    text-decoration: none;
}

.status-chips .is-active {
    background: var(--text);
    border-color: var(--text);
    color: var(--surface);
}

.lead-results {
    color: var(--muted);
    font-size: 0.88rem;
    margin-bottom: 11px;
}

.lead-results p,
.lead-source,
.lead-snippet {
    margin-bottom: 0;
}

.compact-lead-card {
    gap: 12px;
    padding: 15px;
}

.compact-lead-card .lead-topline {
    align-items: flex-start;
}

.compact-lead-card .lead-topline strong {
    font-size: 1rem;
}

.compact-lead-card .lead-topline time {
    font-size: 0.82rem;
}

.lead-card-main h2 {
    font-size: 1.18rem;
    margin-bottom: 7px;
}

.lead-card-main p,
.lead-source,
.lead-snippet {
    overflow-wrap: anywhere;
}

.lead-card-main p,
.lead-source {
    color: var(--muted);
}

.lead-call {
    align-items: center;
    background: var(--surface-soft);
    border-radius: 8px;
    display: inline-flex;
    min-height: 42px;
    padding: 9px 11px;
    text-decoration: none;
}

.lead-source {
    font-size: 0.84rem;
    font-weight: 800;
}

.lead-owner {
    background: var(--surface-soft);
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 800;
    margin-bottom: 0;
    overflow-wrap: anywhere;
    padding: 8px 10px;
}

.lead-owner.is-mine {
    background: #d9f3e8;
    color: var(--success);
}

.lead-owner.is-other {
    background: #fff0ca;
    color: var(--warning);
}

.lead-snippet {
    color: var(--text);
    display: -webkit-box;
    font-size: 0.93rem;
    line-height: 1.35;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.lead-empty {
    display: grid;
    gap: 12px;
}

.lead-empty .primary-link {
    justify-self: stretch;
}

.lead-pagination {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 16px;
}

.dashboard-links {
    gap: 14px;
}

.dashboard-filter-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-filter-links .quick-card {
    min-height: 106px;
    padding: 16px;
}

.dashboard-filter-links .quick-card span {
    font-size: 1.6rem;
    font-weight: 900;
}

.intro-note {
    color: var(--muted);
    margin: 11px 0 0;
}

.dashboard-counters {
    margin-bottom: 14px;
}

.dashboard-actions,
.dashboard-queues,
.queue-list,
.owner-actions,
.manual-lead-form,
.manual-extra-fields {
    display: grid;
    gap: 10px;
}

.dashboard-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 16px;
}

.dashboard-actions a,
.dashboard-actions span,
.manual-form-actions a,
.manual-form-actions button,
.owner-actions button {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    display: inline-flex;
    font-weight: 800;
    justify-content: center;
    min-height: 48px;
    padding: 12px;
    text-align: center;
    text-decoration: none;
}

.dashboard-actions span {
    color: var(--muted);
    cursor: not-allowed;
}

.dashboard-actions .primary-link {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--surface);
}

.dashboard-queues {
    align-items: start;
}

.queue-panel h2,
.owner-panel h2,
.source-panel h2 {
    margin-bottom: 0;
}

.queue-head {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    margin-bottom: 12px;
}

.queue-head a {
    color: var(--accent-strong);
    font-weight: 900;
}

.queue-lead {
    background: var(--surface-soft);
    border-radius: 8px;
    display: grid;
    gap: 4px;
    min-height: 58px;
    overflow-wrap: anywhere;
    padding: 11px;
    text-decoration: none;
}

.queue-lead span,
.queue-empty {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 0;
}

.source-panel,
.owner-panel {
    padding: 16px;
}

.source-grid {
    display: grid;
    gap: 8px;
    margin: 14px 0 0;
}

.source-grid div,
.owner-state {
    background: var(--surface-soft);
    border-radius: 8px;
    min-width: 0;
    overflow-wrap: anywhere;
    padding: 10px;
}

.source-grid dd {
    font-size: 0.94rem;
}

.owner-state {
    font-weight: 900;
    margin: 12px 0 8px;
}

.owner-warning {
    background: #fff0ca;
    border-radius: 8px;
    color: var(--warning);
    margin-bottom: 10px;
    padding: 10px;
}

.claim-form button {
    font-size: 1.02rem;
    min-height: 56px;
}

.locked-panel {
    background: var(--surface);
    display: grid;
    gap: 10px;
    padding: 16px;
}

.locked-panel p {
    background: var(--surface-soft);
    border-radius: 8px;
    color: var(--muted);
    margin-bottom: 0;
    padding: 12px;
}

.readonly-grid {
    margin-top: 0;
}

.owner-actions button,
.manual-form-actions button {
    background: var(--accent);
    border: 0;
    color: var(--surface);
    cursor: pointer;
}

.manager-transfer {
    width: 100%;
}

.manual-lead-form {
    margin: 0 auto;
    max-width: 720px;
    padding: 16px;
}

.manual-lead-form label {
    color: var(--muted);
    display: grid;
    font-size: 0.92rem;
    font-weight: 800;
    gap: 8px;
}

.manual-lead-form input,
.manual-lead-form select,
.manual-lead-form textarea {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    min-height: 48px;
    min-width: 0;
    padding: 11px 12px;
    width: 100%;
}

.manual-lead-form textarea {
    min-height: 78px;
    resize: vertical;
}

.manual-extra {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.manual-extra summary {
    cursor: pointer;
    font-weight: 900;
    list-style: none;
    min-height: 48px;
    padding: 14px;
}

.manual-extra summary::-webkit-details-marker {
    display: none;
}

.manual-extra-fields {
    padding: 0 12px 12px;
}

.manual-form-actions {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.manual-form-actions button:disabled {
    background: var(--muted);
    cursor: not-allowed;
}

.lead-topline,
.lead-body {
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
}

.lead-body h2 {
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.lead-body p {
    color: var(--muted);
    margin-bottom: 0;
}

.phone-link,
dd a {
    color: var(--accent-strong);
    font-weight: 700;
}

.status-pill {
    background: #dceafe;
    border: 1px solid rgba(36, 99, 235, 0.16);
    border-radius: 999px;
    color: var(--accent-strong);
    display: inline-flex;
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.02em;
    min-height: 32px;
    padding: 7px 12px;
    text-transform: uppercase;
}

.status-new {
    background: #dceafe;
    border-color: rgba(36, 99, 235, 0.22);
    color: #1d4ed8;
}

.status-in_work {
    background: #fff0ca;
    border-color: rgba(180, 83, 9, 0.2);
    color: var(--warning);
}

.status-measurement {
    background: #ede9fe;
    border-color: rgba(109, 40, 217, 0.18);
    color: #6d28d9;
}

.status-thinking {
    background: #ffedd5;
    border-color: rgba(194, 65, 12, 0.18);
    color: #c2410c;
}

.status-agreement {
    background: #e0f2fe;
    border-color: rgba(3, 105, 161, 0.18);
    color: #0369a1;
}

.status-construction {
    background: #e5e7eb;
    border-color: rgba(55, 65, 81, 0.18);
    color: #374151;
}

.status-done {
    background: #d9f3e8;
    border-color: rgba(21, 128, 61, 0.18);
    color: var(--success);
}

.status-rejected {
    background: #f1f5f9;
    border-color: rgba(71, 85, 105, 0.18);
    color: #475569;
}

.open-link {
    background: var(--surface-soft);
    color: var(--text);
    display: inline-flex;
    justify-content: center;
    min-height: 46px;
    padding: 13px 16px;
}

.empty-state {
    padding: 28px;
}

.back-link {
    color: var(--accent-strong);
    display: inline-block;
    font-weight: 800;
    margin-bottom: 16px;
}

.detail-intro {
    align-items: flex-end;
}

.record-panel {
    overflow: hidden;
    padding: 22px;
}

.field-grid {
    display: grid;
    gap: 14px;
    margin: 0;
}

.field-grid div {
    background: var(--surface-soft);
    border-radius: 8px;
    min-width: 0;
    padding: 14px;
}

dt {
    font-size: 0.84rem;
    font-weight: 800;
    margin-bottom: 6px;
    text-transform: uppercase;
}

dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.event-list {
    display: grid;
    gap: 12px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.event-list li {
    background: var(--surface-soft);
    border-radius: 8px;
    padding: 14px;
}

.event-list li div {
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between;
}

.event-list p,
.event-list small {
    display: block;
    margin: 10px 0 0;
    overflow-wrap: anywhere;
}

.login-shell {
    align-items: center;
    display: grid;
    min-height: 100vh;
    padding: clamp(16px, 5vw, 48px);
}

.login-panel {
    box-shadow: var(--shadow);
    display: grid;
    gap: 28px;
    margin: 0 auto;
    max-width: 880px;
    overflow: hidden;
    padding: clamp(24px, 5vw, 54px);
    width: 100%;
}

.login-copy p {
    color: var(--muted);
    font-size: 1.08rem;
    line-height: 1.5;
    margin: 18px 0 0;
    max-width: 32rem;
}

.login-form {
    display: grid;
    gap: 16px;
}

.login-form label {
    color: var(--muted);
    display: grid;
    font-size: 0.92rem;
    font-weight: 800;
    gap: 8px;
}

.login-form input {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    min-height: 52px;
    padding: 0 14px;
}

.notice {
    border-radius: 8px;
    margin: -4px 0 18px;
    padding: 14px 16px;
}

.notice-success {
    background: #d9f3e8;
    color: var(--success);
}

.notice-error {
    background: #fde0e3;
    color: var(--danger);
}

.deleted-warning,
.deleted-card-actions,
.phone-history-list,
.delete-lead-form,
.deleted-lead-list {
    display: grid;
    gap: 10px;
}

.deleted-warning {
    background: #fff0ca;
    border: 1px solid #f1cf75;
    border-radius: 8px;
    margin-bottom: 18px;
    padding: 14px;
}

.deleted-warning p {
    color: var(--warning);
    margin: 5px 0 0;
}

.deleted-warning button,
.deleted-card-actions button,
.delete-lead-form button {
    background: var(--accent);
    border: 0;
    border-radius: 8px;
    color: var(--surface);
    cursor: pointer;
    min-height: 48px;
    padding: 12px 14px;
    width: 100%;
}

.lead-hero,
.compact-workspace {
    display: grid;
    gap: 14px;
}

.lead-hero {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 18px;
    padding: 18px;
}

.lead-hero h1 {
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.lead-hero-head,
.hero-meta,
.form-actions {
    display: flex;
    gap: 10px;
}

.lead-hero-head {
    align-items: flex-start;
    flex-wrap: wrap;
    justify-content: space-between;
}

.hero-phone {
    color: var(--accent-strong);
    display: inline-flex;
    font-size: 1.16rem;
    font-weight: 800;
    text-decoration: none;
}

.hero-address {
    font-size: 1.02rem;
    font-weight: 700;
    margin: 0;
}

.call-link,
.quick-actions button,
.action-drop summary,
.action-drop button,
.inline-field button {
    background: var(--accent);
    border: 0;
    border-radius: 8px;
    color: var(--surface);
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    min-height: 48px;
    padding: 12px 14px;
    text-decoration: none;
    width: 100%;
}

.call-link {
    align-items: center;
    font-weight: 800;
}

.hero-meta {
    color: var(--muted);
    flex-wrap: wrap;
    font-size: 0.88rem;
    margin: 0;
    overflow-wrap: anywhere;
}

.hero-meta span + span::before {
    content: "·";
    margin-right: 10px;
}

.compact-workspace {
    align-items: start;
}

.action-panel,
.fields-panel,
.history-panel {
    padding: 16px;
}

.quick-actions,
.secondary-actions,
.inline-fields,
.action-drop form,
.inline-field form {
    display: grid;
    gap: 10px;
}

.quick-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.quick-actions > :last-child {
    grid-column: 1 / -1;
}

.secondary-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 10px;
}

.action-drop,
.inline-field,
.history-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    min-width: 0;
}

.action-drop {
    background: var(--surface-soft);
    overflow: hidden;
}

.action-drop summary {
    align-items: center;
    list-style: none;
}

.action-drop summary::-webkit-details-marker,
.inline-field summary::-webkit-details-marker,
.history-panel > summary::-webkit-details-marker {
    display: none;
}

.action-drop form,
.inline-field form {
    background: var(--surface-soft);
    padding: 12px;
}

.action-drop label,
.inline-field label {
    color: var(--muted);
    display: grid;
    font-size: 0.9rem;
    font-weight: 800;
    gap: 8px;
}

.action-drop input,
.action-drop textarea,
.inline-field input,
.inline-field select,
.inline-field textarea {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    min-height: 46px;
    padding: 10px 12px;
    width: 100%;
}

.action-drop textarea,
.inline-field textarea {
    min-height: 82px;
    resize: vertical;
}

.reject-drop summary,
.action-drop .danger-button {
    background: var(--danger);
}

.stage-facts {
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    font-size: 0.88rem;
    gap: 8px;
    margin-top: 12px;
}

.stage-facts span {
    background: var(--surface-soft);
    border-radius: 8px;
    max-width: 100%;
    overflow-wrap: anywhere;
    padding: 7px 9px;
}

.inline-fields {
    gap: 8px;
}

.inline-field {
    background: var(--surface-soft);
    overflow: hidden;
}

.inline-field summary,
.history-panel > summary {
    cursor: pointer;
    list-style: none;
}

.inline-field summary {
    align-items: center;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 60px;
    padding: 11px 12px;
}

.inline-field summary span {
    display: grid;
    gap: 4px;
    min-width: 0;
    overflow-wrap: anywhere;
}

.inline-field summary b {
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
}

.inline-field summary i {
    background: var(--surface);
    border-radius: 8px;
    color: var(--accent-strong);
    font-style: normal;
    font-weight: 900;
    padding: 8px 10px;
}

.form-actions {
    align-items: center;
    flex-wrap: wrap;
}

.form-actions span {
    color: var(--muted);
    font-size: 0.82rem;
}

.form-actions button {
    width: auto;
}

.history-panel,
.phone-history-panel,
.more-panel {
    background: var(--surface);
}

.history-panel > summary,
.phone-history-panel > summary,
.more-panel > summary {
    color: var(--accent-strong);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 900;
    list-style: none;
}

.history-panel > summary::-webkit-details-marker,
.phone-history-panel > summary::-webkit-details-marker,
.more-panel > summary::-webkit-details-marker {
    display: none;
}

.history-panel[open] > summary,
.phone-history-panel[open] > summary,
.more-panel[open] > summary {
    margin-bottom: 14px;
}

.phone-history-panel {
    padding: 16px;
}

.phone-history-card,
.deleted-meta div {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 8px;
    min-width: 0;
    overflow-wrap: anywhere;
    padding: 12px;
}

.phone-history-card.is-deleted {
    border-color: #efb0b6;
}

.locked-fact {
    background: var(--surface);
    border-radius: 8px;
    color: var(--muted);
    display: inline-flex;
    font-weight: 800;
    justify-content: center;
    min-height: 44px;
    padding: 12px;
}

.more-panel {
    padding: 16px;
}

.delete-lead-form {
    background: var(--surface-soft);
    border-radius: 8px;
    padding: 12px;
}

.delete-lead-form p {
    color: var(--warning);
    margin-bottom: 0;
}

.delete-lead-form label {
    color: var(--muted);
    display: grid;
    font-size: 0.92rem;
    font-weight: 800;
    gap: 7px;
}

.delete-lead-form select,
.delete-lead-form textarea {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    min-height: 48px;
    padding: 11px 12px;
    width: 100%;
}

.delete-lead-form textarea {
    min-height: 76px;
    resize: vertical;
}

.delete-lead-form .danger-button {
    background: var(--danger);
}

.deleted-search {
    grid-template-columns: 1fr;
}

.deleted-lead-card {
    gap: 10px;
    padding: 15px;
}

.deleted-lead-card > p,
.deleted-meta {
    margin-bottom: 0;
}

.deleted-meta {
    display: grid;
    gap: 8px;
}

.deleted-card-actions form,
.deleted-card-actions button {
    width: 100%;
}

.form-error {
    background: #fde0e3;
    border-radius: 8px;
    color: var(--danger);
    margin-bottom: 0;
    padding: 12px;
}

.intro-actions,
.work-tabs,
.work-board,
.work-mini-list,
.work-lead-list,
.directory-grid,
.directory-list,
.settings-create form {
    display: grid;
    gap: 10px;
}

.intro-actions {
    width: 100%;
}

.intro-actions > a,
.work-tabs a {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: inline-flex;
    font-weight: 800;
    justify-content: center;
    min-height: 48px;
    padding: 12px;
    text-decoration: none;
}

.intro-actions .primary-link {
    background: var(--accent);
    border-color: var(--accent);
}

.work-tabs {
    display: flex;
    margin-bottom: 16px;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 3px;
}

.work-tabs a {
    flex: 0 0 auto;
    min-height: 44px;
    white-space: nowrap;
}

.work-tabs .danger-chip {
    background: #fde0e3;
    color: var(--danger);
}

.work-column,
.settings-create,
.directory-card {
    padding: 16px;
}

.work-mini-card {
    background: var(--surface-soft);
    border: 1px solid transparent;
    border-radius: 8px;
    display: grid;
    gap: 4px;
    min-height: 76px;
    overflow-wrap: anywhere;
    padding: 11px;
    text-decoration: none;
}

.work-mini-card span,
.work-mini-card small,
.work-mini-card time,
.directory-card p,
.date-fact {
    color: var(--muted);
    margin-bottom: 0;
}

.work-lead-card {
    gap: 10px;
    padding: 15px;
}

.work-lead-card h2,
.directory-card h2 {
    margin-bottom: 0;
}

.work-lead-card > p {
    margin-bottom: 0;
    overflow-wrap: anywhere;
}

.date-overdue {
    border-color: #efb0b6;
}

.date-overdue .date-fact,
.date-overdue small {
    color: var(--danger);
    font-weight: 800;
}

.date-today {
    border-color: #f1cf75;
}

.date-future {
    border-color: #c7d9f4;
}

.date-today .date-fact {
    color: var(--warning);
    font-weight: 800;
}

.work-card-actions {
    display: grid;
    gap: 9px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.work-card-actions form,
.work-card-actions button {
    width: 100%;
}

.work-card-actions button,
.settings-create button {
    background: var(--accent);
    border: 0;
    border-radius: 8px;
    color: var(--surface);
    cursor: pointer;
    min-height: 46px;
    padding: 11px;
}

.directory-grid a,
.directory-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    min-width: 0;
}

.directory-grid a {
    display: grid;
    gap: 5px;
    min-height: 88px;
    padding: 16px;
    text-decoration: none;
}

.directory-grid span {
    color: var(--muted);
}

.settings-head h1 {
    margin-bottom: 16px;
}

.settings-create {
    margin-bottom: 14px;
}

.settings-create > summary {
    color: var(--accent-strong);
    cursor: pointer;
    font-weight: 900;
    list-style: none;
}

.settings-create > summary::-webkit-details-marker {
    display: none;
}

.settings-create[open] > summary {
    margin-bottom: 12px;
}

.settings-create label {
    color: var(--muted);
    display: grid;
    font-size: 0.92rem;
    font-weight: 800;
    gap: 7px;
}

.settings-create input {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    min-height: 48px;
    padding: 11px 12px;
    width: 100%;
}

.directory-card {
    display: grid;
    gap: 8px;
}

.state-on,
.state-off {
    border-radius: 999px;
    display: inline-flex;
    font-size: 0.85rem;
    font-weight: 900;
    justify-self: start;
    min-height: 32px;
    padding: 7px 11px;
}

.state-on {
    background: #d9f3e8;
    color: var(--success);
}

.state-off {
    background: #fde0e3;
    color: var(--danger);
}

@media (min-width: 720px) {
    .app-header {
        grid-template-columns: auto 1fr auto;
    }

    .app-nav {
        grid-column: auto;
    }

    .quick-grid,
    .login-panel {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .field-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .compact-workspace {
        grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
    }

    .history-panel {
        grid-column: 1 / -1;
    }

    .phone-history-panel,
    .more-panel {
        grid-column: 1 / -1;
    }

    .lead-hero {
        padding: 24px;
    }

    .call-link {
        justify-self: start;
        min-width: 180px;
    }

    .lead-search {
        align-items: end;
        grid-template-columns: minmax(0, 1fr) minmax(200px, 0.55fr) auto;
    }

    .deleted-search {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .search-actions {
        min-width: 240px;
    }

    .lead-counters {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .lead-card-main {
        align-items: center;
        grid-template-columns: minmax(0, 1fr) minmax(220px, 0.72fr);
    }

    .dashboard-filter-links {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .dashboard-counters {
        grid-template-columns: repeat(7, minmax(0, 1fr));
    }

    .dashboard-actions {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .dashboard-queues {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .source-panel {
        grid-column: 1 / -1;
    }

    .source-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .open-link {
        justify-self: end;
        min-width: 120px;
    }

    .intro-actions {
        grid-template-columns: repeat(2, minmax(160px, auto));
        justify-content: end;
        width: auto;
    }

    .work-board,
    .directory-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .work-lead-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .deleted-warning {
        align-items: center;
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .phone-history-list,
    .deleted-lead-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .deleted-card-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .directory-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.push-status[hidden] {
    display: none !important;
}

.push-status {
    color: var(--muted);
    font-size: 0.78rem;
}

.browser-push-prompt[hidden] {
    display: none !important;
}

.browser-push-prompt {
    align-items: center;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 14px;
    box-shadow: 0 16px 38px rgba(15, 23, 42, 0.16);
    display: grid;
    gap: 12px;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    left: 50%;
    max-width: min(760px, calc(100vw - 32px));
    padding: 13px 14px;
    position: fixed;
    top: 78px;
    transform: translateX(-50%);
    width: max-content;
    z-index: 1200;
}

.browser-push-icon {
    color: #2563eb;
    font-size: 1.1rem;
}

.browser-push-prompt strong {
    color: #0f172a;
    display: block;
    font-size: 0.92rem;
}

.browser-push-prompt p {
    color: #475569;
    font-size: 0.82rem;
    margin: 2px 0 0;
}

.browser-push-prompt button {
    background: #172033;
    border: 0;
    border-radius: 9px;
    color: #ffffff;
    cursor: pointer;
    font-weight: 700;
    min-height: 40px;
    padding: 0 14px;
    white-space: nowrap;
}

.browser-push-prompt button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.browser-push-prompt .browser-push-close {
    background: transparent;
    color: #64748b;
    font-size: 1.4rem;
    min-height: 36px;
    padding: 0 8px;
}

@media (max-width: 719px) {
    .browser-push-prompt {
        align-items: start;
        grid-template-columns: auto minmax(0, 1fr) auto;
        top: 68px;
    }

    .browser-push-prompt > button[data-enable-browser-push] {
        grid-column: 2 / 4;
        width: 100%;
    }
}


.brand-logo {
    display: none;
}

.login-logo {
    width: 280px;
    max-width: min(76vw, 280px);
    height: auto;
    max-height: 200px;
    object-fit: contain;
    display: block;
    margin: 0 0 16px;
}

@media (max-width: 719px) {
    .login-logo {
        width: 240px;
        max-width: 78vw;
        max-height: 172px;
    }
}

/* P35: dashboard as working inbox */
.dashboard-inbox {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 14px;
    padding: clamp(16px, 4vw, 24px);
}

.dashboard-inbox-hot {
    border-color: rgba(36, 99, 235, 0.28);
}

.dashboard-inbox-clear {
    background: linear-gradient(135deg, #ffffff 0%, #f5f8fd 100%);
}

.inbox-head {
    align-items: flex-start;
    display: flex;
    gap: 14px;
    justify-content: space-between;
}

.inbox-head h1 {
    font-size: clamp(1.65rem, 7vw, 2.5rem);
}

.new-lead-list {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

.dashboard-new-lead {
    border-color: rgba(36, 99, 235, 0.2);
    box-shadow: none;
    color: var(--text);
}

.dashboard-phone {
    font-size: 1.15rem;
    font-weight: 900;
}

.dashboard-card-actions {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compact-dashboard-counters {
    margin-bottom: 12px;
}

.compact-dashboard-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 14px;
}

.quick-control-list .queue-lead strong {
    font-size: 1rem;
}

.app-nav a[href="/crm/work"] {
    display: none;
}

@media (max-width: 719px) {
    .app-header {
        gap: 8px;
        padding: 10px 12px;
    }

    .app-nav {
        gap: 6px;
    }

    .app-nav a {
        font-size: 0.88rem;
        min-height: 38px;
        padding: 8px 10px;
        white-space: nowrap;
    }

    .app-shell {
        padding: 14px 12px 28px;
    }

    .inbox-head {
        display: grid;
    }

    .inbox-head .primary-link {
        width: 100%;
    }

    .dashboard-card-actions,
    .compact-dashboard-actions {
        grid-template-columns: 1fr;
    }

    .compact-dashboard-counters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-queues {
        gap: 12px;
    }
}

/* P39: new lead reaction traffic light */
.new-lead-age {
    border-radius: 999px;
    display: inline-flex;
    font-size: 0.78rem;
    font-weight: 900;
    min-height: 30px;
    padding: 6px 10px;
}

.new-lead-age-ok,
.new-lead-age.new-age-ok {
    background: #dceafe;
    color: #1d4ed8;
}

.new-lead-age-warn,
.new-lead-age.new-age-warn {
    background: #fff0ca;
    color: var(--warning);
}

.new-lead-age-danger,
.new-lead-age.new-age-danger {
    background: #fde0e3;
    color: var(--danger);
}

.dashboard-new-lead.new-age-warn {
    border-color: rgba(180, 83, 9, 0.32);
}

.dashboard-new-lead.new-age-danger {
    border-color: rgba(190, 18, 60, 0.34);
    box-shadow: 0 12px 34px rgba(190, 18, 60, 0.08);
}

/* P43: dashboard attention block */
.attention-panel {
    background: var(--surface);
    border: 1px solid rgba(180, 83, 9, 0.24);
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 14px;
    padding: clamp(14px, 4vw, 20px);
}

.attention-list {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.attention-card {
    align-items: center;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr auto;
    padding: 12px;
    text-decoration: none;
}

.attention-card strong,
.attention-card span {
    display: block;
}

.attention-card div > span {
    color: var(--muted);
    font-size: 0.9rem;
    margin-top: 4px;
    overflow-wrap: anywhere;
}

.attention-warn {
    border-color: rgba(180, 83, 9, 0.28);
}

.attention-danger,
.attention-critical {
    border-color: rgba(190, 18, 60, 0.34);
}

.attention-badge {
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 900;
    min-height: 30px;
    padding: 7px 10px;
    white-space: nowrap;
}

.attention-badge-warn {
    background: #fff0ca;
    color: var(--warning);
}

.attention-badge-danger,
.attention-badge-critical {
    background: #fde0e3;
    color: var(--danger);
}

@media (max-width: 719px) {
    .attention-card {
        align-items: flex-start;
        grid-template-columns: 1fr;
    }

    .attention-badge {
        justify-self: start;
        white-space: normal;
    }
}

/* P48: lead detail phone visual improvement only */
.hero-phone-main {
    background: #dceafe;
    border-radius: 8px;
    color: #1d4ed8;
    font-size: clamp(1.35rem, 6vw, 2rem);
    font-weight: 950;
    letter-spacing: 0.01em;
    min-height: 48px;
    padding: 8px 12px;
}

.lead-hero .call-link {
    font-size: 1rem;
    font-weight: 950;
}

/* P49: compact client name in lead detail */
.hero-client-name {
    color: var(--text);
    display: grid;
    font-size: clamp(1.08rem, 4.6vw, 1.45rem);
    font-weight: 900;
    gap: 4px;
    line-height: 1.18;
    margin: 0 0 10px;
    overflow-wrap: anywhere;
}

.hero-client-name span {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.lead-hero .eyebrow {
    margin-bottom: 6px;
}

/* P52: recent history in lead detail, template-only */
.recent-history-panel {
    margin-bottom: 14px;
    padding: 16px;
}

.recent-history-head {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    margin-bottom: 12px;
}

.recent-history-head h2 {
    margin: 0;
}

.recent-history-head a {
    color: var(--accent-strong);
    font-weight: 900;
}

.recent-event-list {
    display: grid;
    gap: 10px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.recent-event-list li {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

.recent-event-list li div {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between;
}

.recent-event-list time,
.recent-event-list small {
    color: var(--muted);
}

.recent-event-list p,
.recent-event-list small {
    display: block;
    margin: 8px 0 0;
    overflow-wrap: anywhere;
}

@media (max-width: 719px) {
    .recent-history-head {
        align-items: flex-start;
        display: grid;
    }
}


/* P85: lead detail useful data first */
.lead-data-panel {
    display: grid;
    gap: 14px;
}

.panel-headline {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.panel-headline h2 {
    margin: 0;
}

.panel-headline span {
    background: var(--surface-soft);
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 800;
    padding: 8px 12px;
}

.lead-data-grid {
    display: grid;
    gap: 10px;
}

.lead-data-card {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 6px;
    padding: 14px;
}

.lead-data-card dt {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.lead-data-card dd {
    font-size: clamp(1.05rem, 3vw, 1.32rem);
    font-weight: 800;
    line-height: 1.25;
    margin: 0;
    white-space: pre-line;
}

.source-panel-compact {
    box-shadow: none;
}

.source-grid-useful dd {
    word-break: break-word;
}

.source-grid-summary {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.source-grid-summary .source-summary-primary dd {
    font-size: 1.05rem;
    font-weight: 900;
}

.source-channel {
    color: var(--muted);
    font-weight: 700;
}

.attribution-details-panel {
    background: var(--surface);
    grid-column: 1 / -1;
    padding: 16px;
    width: 100%;
}

.attribution-details-panel > summary {
    align-items: baseline;
    color: var(--accent-strong);
    cursor: pointer;
    display: flex;
    flex-wrap: wrap;
    font-size: 1rem;
    font-weight: 900;
    gap: 6px 12px;
    list-style: none;
}

.attribution-details-panel > summary::-webkit-details-marker {
    display: none;
}

.attribution-details-panel > summary::before {
    content: "›";
    font-size: 1.25rem;
    line-height: 1;
}

.attribution-details-panel[open] > summary::before {
    transform: rotate(90deg);
}

.attribution-details-panel > summary small {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
}

.attribution-details-panel[open] > summary {
    margin-bottom: 14px;
}

/* Garage lead list: desktop workspace, responsive single-column mobile cards. */
.garage-lead-card {
    box-shadow: 0 8px 24px rgba(23, 42, 70, 0.08);
    gap: 0;
    overflow: hidden;
    padding: 0;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.garage-lead-card:hover {
    border-color: #b8c8dc;
    box-shadow: 0 12px 30px rgba(23, 42, 70, 0.12);
    transform: translateY(-1px);
}

.garage-lead-card .garage-lead-card-header {
    align-items: center;
    background: #f8fafc;
    border-bottom: 1px solid #dbe4ef;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(72px, auto) minmax(0, 1fr) max-content;
    min-height: 50px;
    padding: 12px 18px;
}

.garage-lead-card-header > strong {
    color: #13233a;
    font-size: 1rem;
}

.garage-lead-state {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.garage-lead-card-header time {
    color: #64748b;
    font-size: 0.82rem;
    white-space: nowrap;
}

.garage-lead-card-grid {
    align-items: stretch;
    display: grid;
    grid-template-columns: minmax(230px, 0.82fr) minmax(340px, 1.38fr) minmax(230px, 0.78fr);
}

.garage-lead-client,
.garage-lead-request,
.garage-lead-workflow {
    min-width: 0;
    padding: 18px;
}

.garage-lead-request,
.garage-lead-workflow {
    border-left: 1px solid #dbe4ef;
}

.garage-lead-workflow {
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.garage-lead-label {
    color: #60738d;
    display: block;
    font-size: 0.72rem;
    font-weight: 900;
    line-height: 1.25;
    text-transform: uppercase;
}

.garage-lead-name {
    color: #13233a;
    font-size: 1.28rem;
    line-height: 1.2;
    margin: 5px 0 10px;
    overflow-wrap: anywhere;
}

.garage-lead-card .lead-call {
    background: #edf5ff;
    color: #075fc5;
    font-size: 0.96rem;
    font-weight: 900;
    min-height: 40px;
    padding: 9px 11px;
}

.garage-lead-source {
    border-top: 1px solid #e2e8f0;
    display: grid;
    gap: 4px;
    margin-top: 14px;
    padding-top: 13px;
}

.garage-lead-source strong,
.garage-lead-route strong,
.garage-lead-owner strong {
    color: #24364f;
    font-size: 0.93rem;
    overflow-wrap: anywhere;
}

.garage-lead-source > span:not(.garage-lead-label),
.garage-lead-route > span:not(.garage-lead-label),
.garage-lead-muted {
    color: #6f8096;
    font-size: 0.84rem;
    overflow-wrap: anywhere;
}

.garage-lead-field {
    border-left: 3px solid #1f6fe5;
    display: grid;
    gap: 6px;
    padding-left: 13px;
}

.garage-lead-field strong {
    color: #13233a;
    font-size: 1.04rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.garage-lead-text-row {
    border-top: 1px solid #e2e8f0;
    display: grid;
    gap: 6px;
    margin-top: 15px;
    min-width: 0;
    padding-top: 13px;
}

.garage-lead-text-preview {
    color: #344861;
    display: -webkit-box;
    line-height: 1.45;
    overflow: hidden;
    overflow-wrap: anywhere;
    white-space: pre-line;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.garage-lead-comment .garage-lead-text-preview {
    -webkit-line-clamp: 2;
}

.garage-lead-owner,
.garage-lead-route {
    border-bottom: 1px solid #dbe4ef;
    display: grid;
    gap: 5px;
    padding-bottom: 12px;
}

.garage-lead-owner.is-mine strong {
    color: #14714b;
}

.garage-lead-owner.is-other strong {
    color: #8a5a00;
}

.garage-lead-open {
    align-items: center;
    align-self: stretch;
    background: #1668d8;
    color: #ffffff;
    display: inline-flex;
    font-weight: 900;
    justify-content: center;
    margin-top: auto;
    min-height: 44px;
    padding: 11px 14px;
}

.garage-lead-open:hover {
    background: #0d57bc;
}

.garage-lead-card > .lead-date-facts {
    border-top: 1px solid #dbe4ef;
    gap: 0;
}

.garage-lead-card > .lead-date-facts .date-fact {
    border: 0;
    border-radius: 0;
    padding: 11px 18px;
}

@media (max-width: 1020px) {
    .garage-lead-card-grid {
        grid-template-columns: minmax(220px, 0.85fr) minmax(0, 1.15fr);
    }

    .garage-lead-workflow {
        align-items: end;
        border-left: 0;
        border-top: 1px solid #dbe4ef;
        display: grid;
        grid-column: 1 / -1;
        grid-template-columns: minmax(180px, 0.8fr) minmax(220px, 1fr) minmax(180px, auto);
    }

    .garage-lead-owner,
    .garage-lead-route {
        border-bottom: 0;
        padding-bottom: 0;
    }

    .garage-lead-open {
        margin-top: 0;
        min-width: 180px;
    }
}

@media (max-width: 720px) {
    .garage-lead-card:hover {
        transform: none;
    }

    .garage-lead-card .garage-lead-card-header {
        align-items: center;
        grid-template-columns: minmax(0, 1fr) max-content;
        padding: 12px 14px;
    }

    .garage-lead-state {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-content: flex-start;
    }

    .garage-lead-card-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .garage-lead-client,
    .garage-lead-request,
    .garage-lead-workflow {
        padding: 16px;
    }

    .garage-lead-request,
    .garage-lead-workflow {
        border-left: 0;
        border-top: 1px solid #dbe4ef;
    }

    .garage-lead-workflow {
        align-items: stretch;
        display: flex;
        grid-column: auto;
    }

    .garage-lead-owner,
    .garage-lead-route {
        border-bottom: 1px solid #dbe4ef;
        padding-bottom: 12px;
    }

    .garage-lead-open {
        margin-top: 0;
        min-width: 0;
        width: 100%;
    }

    .garage-lead-card > .lead-date-facts .date-fact {
        padding: 11px 16px;
    }
}

/* Messenger lifecycle, unanswered state, and fast-navigation feedback. */
.chat-lifecycle-tabs {
    align-items: center;
    display: flex;
    gap: 8px;
    margin: 0 0 12px;
}

.chat-lifecycle-tabs a {
    background: rgba(255, 255, 255, .68);
    border: 1px solid #d8e1ed;
    border-radius: 10px;
    color: #617188;
    font-size: .8rem;
    font-weight: 800;
    padding: 7px 12px;
    text-decoration: none;
}

.chat-lifecycle-tabs a:hover,
.chat-lifecycle-tabs a.is-active {
    background: #fff;
    border-color: #9fb7d6;
    box-shadow: 0 5px 14px rgba(31, 49, 76, .07);
    color: #172a46;
}

.chat-preview-footer > span:first-child {
    align-items: flex-start;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-preview-unanswered,
.status-pill.status-unanswered,
.chat-preview-delivery-blocked,
.status-pill.status-delivery-blocked {
    background: #fee4e2;
    border: 1px solid #f4b9b5;
    border-radius: 999px;
    color: #b42318;
    font-size: .66rem;
    font-weight: 950;
    letter-spacing: .01em;
    padding: 3px 7px;
    text-transform: uppercase;
}

.chat-thread-header {
    grid-template-columns: 46px minmax(0, 1fr) auto 40px;
}

.chat-thread-state .status-unreviewed {
    background: #fff5df;
    border-color: #efd6a3;
    color: #8a5a00;
    font-weight: 900;
}

.chat-thread-more {
    align-self: center;
    position: relative;
}

.chat-thread-more > summary {
    align-items: center;
    background: #eef3f9;
    border: 1px solid #d7e0ec;
    border-radius: 11px;
    color: #52647c;
    cursor: pointer;
    display: flex;
    font-size: 1rem;
    font-weight: 900;
    height: 38px;
    justify-content: center;
    list-style: none;
    padding: 0;
    width: 42px;
}

.chat-thread-more > summary span {
    font-size: 1.45rem;
    line-height: 1;
    transform: translateY(-3px);
}

.chat-thread-more > summary::-webkit-details-marker {
    display: none;
}

.chat-thread-more[open] > summary {
    background: #172a46;
    color: #fff;
}

.chat-thread-more-menu {
    background: #fff;
    border: 1px solid #d7e0ec;
    border-radius: 13px;
    box-shadow: 0 18px 42px rgba(25, 43, 70, .19);
    display: grid;
    gap: 4px;
    min-width: 220px;
    padding: 7px;
    position: absolute;
    right: 0;
    top: 46px;
    z-index: 30;
}

.chat-thread-more-menu > p {
    border-bottom: 1px solid #e7ecf3;
    color: #73839a;
    font-size: .68rem;
    font-weight: 900;
    letter-spacing: .045em;
    margin: 0 0 4px;
    padding: 5px 10px 9px;
    text-transform: uppercase;
}

.chat-thread-more-menu form {
    margin: 0;
}

.chat-thread-more-menu button {
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: #253b58;
    cursor: pointer;
    font: inherit;
    font-size: .8rem;
    font-weight: 750;
    padding: 9px 10px;
    text-align: left;
    width: 100%;
}

.chat-thread-more-menu button:hover {
    background: #eef4fb;
}

.chat-thread-more-menu button.is-danger {
    color: #bd3340;
}

.chat-thread-more-menu button.is-danger:hover {
    background: #fff0f1;
}

.chat-readonly-note {
    background: #fff9e9;
    border-top: 1px solid #ead9aa;
    color: #725719;
    font-size: .82rem;
    font-weight: 700;
    padding: 14px 20px;
}

.chat-workspace.is-loading .chat-thread-panel {
    opacity: .62;
    pointer-events: none;
    transition: opacity .12s ease;
}

.chat-message-row.is-automated .chat-message-avatar {
    background: #eee8ff;
    color: #6e45cc;
}

.chat-message-row.is-automated .chat-message-card {
    background: #f7f4ff;
    border-color: #dfd6fa;
    border-left-color: #8b56e9;
}

.chat-message-row.is-automated .chat-message-role {
    background: #e9e1ff;
    color: #6841be;
}

.chat-action-inline {
    margin: 0;
}

.chat-action-dismiss {
    align-items: center;
    background: #fff5f5;
    border: 1px solid #f1d3d7;
    border-radius: 10px;
    color: var(--danger);
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-size: .8rem;
    font-weight: 900;
    justify-content: center;
    min-height: 40px;
    padding: 8px 13px;
}

.chat-action-dismiss:hover {
    background: #ffecee;
    border-color: #e8b8bf;
}

@media (max-width: 720px) {
    .chat-thread-more {
        grid-column: 1 / -1;
        justify-self: end;
        margin-top: -48px;
    }

    .chat-thread-more-menu {
        max-width: calc(100vw - 52px);
    }

    .chat-action-inline,
    .chat-action-dismiss {
        width: 100%;
    }
}

.muted-line {
    color: var(--muted);
    margin: 0;
}

@media (min-width: 900px) {
    .lead-data-panel {
        grid-column: 1 / -1;
    }

    .lead-data-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .lead-data-card:first-child:last-child {
        grid-column: 1 / -1;
    }
}

/* P87B: clean duplicated history and readable quiz snippets */
.lead-snippet-structured {
    white-space: pre-line;
    line-height: 1.45;
}

.lead-card .lead-snippet-structured,
.work-lead-card .lead-snippet-structured {
    font-size: 0.95rem;
}

/* P89: take first before call/open */
.hero-primary-actions {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.hero-take-form,
.inline-take-form {
    display: grid;
    margin: 0;
}

.hero-take-form button,
.inline-take-form button {
    background: var(--ink);
    border: 0;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 900;
    min-height: 44px;
    padding: 12px 14px;
    width: 100%;
}

.dashboard-card-actions-take-first {
    display: grid;
    gap: 10px;
}

@media (min-width: 720px) {
    .hero-primary-actions {
        grid-template-columns: 1fr 1fr;
    }
}

/* P90: take first buttons */
.hero-primary-actions {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.hero-take-form,
.inline-take-form {
    display: grid;
    margin: 0;
}

.hero-take-form button,
.inline-take-form button {
    appearance: none;
    background: #111827;
    border: 0;
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-weight: 900;
    min-height: 44px;
    padding: 12px 14px;
    width: 100%;
}

.dashboard-card-actions {
    gap: 10px;
}

@media (min-width: 720px) {
    .hero-primary-actions {
        grid-template-columns: 1fr 1fr;
    }
}


/* P106: clean bottom search/stat/archive disclosure on leads page */
.lead-tools-details {
    background: transparent;
    border: 0;
    margin: 18px 0 0;
    padding: 0;
}

.lead-tools-details > summary {
    align-items: center;
    background: #eef2f7;
    border: 1px solid #d8e0ea;
    border-radius: 12px;
    color: #334155;
    cursor: pointer;
    display: flex;
    font-size: 0.95rem;
    font-weight: 900;
    gap: 8px;
    justify-content: center;
    min-height: 46px;
    padding: 12px 16px;
    user-select: none;
}

.lead-tools-details > summary::marker {
    color: #64748b;
    font-size: 0.85rem;
}

.lead-tools-details[open] > summary {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom-color: transparent;
}

.lead-tools-details .lead-tools {
    background: #ffffff;
    border: 1px solid #d8e0ea;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 14px;
}

.lead-tools-details .lead-search {
    background: transparent;
    border: 0;
    box-shadow: none;
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
}

.lead-tools-details .lead-search label {
    color: #475569;
    display: grid;
    font-size: 0.82rem;
    font-weight: 900;
    gap: 6px;
}

.lead-tools-details .lead-search input,
.lead-tools-details .lead-search select {
    background: #f8fafc;
    border: 1px solid #d8e0ea;
    border-radius: 10px;
    color: #0f172a;
    font-size: 0.95rem;
    min-height: 44px;
    padding: 10px 12px;
    width: 100%;
}

.lead-tools-details .search-actions {
    display: grid;
    gap: 8px;
}

.lead-tools-details .search-actions button,
.lead-tools-details .search-actions a,
.lead-tools-details .archive-actions a {
    align-items: center;
    border-radius: 10px;
    display: inline-flex;
    font-size: 0.95rem;
    font-weight: 900;
    justify-content: center;
    min-height: 44px;
    padding: 10px 14px;
    text-decoration: none;
}

.lead-tools-details .search-actions button {
    background: #2563eb;
    border: 0;
    color: #ffffff;
}

.lead-tools-details .search-actions a,
.lead-tools-details .archive-actions a {
    background: #f1f5f9;
    border: 1px solid #d8e0ea;
    color: #475569;
}

.lead-tools-details .lead-counters {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
}

.lead-tools-details .lead-counters span {
    background: #f8fafc;
    border: 1px solid #d8e0ea;
    border-radius: 10px;
    color: #64748b;
    display: grid;
    font-size: 0.78rem;
    font-weight: 800;
    gap: 2px;
    min-height: 54px;
    padding: 8px 10px;
    text-align: center;
}

.lead-tools-details .lead-counters b {
    color: #0f172a;
    font-size: 1.05rem;
}

.lead-tools-details .archive-actions {
    display: grid;
}

@media (min-width: 760px) {
    .lead-tools-details .lead-search {
        align-items: end;
        grid-template-columns: minmax(280px, 1fr) minmax(220px, 0.8fr) minmax(120px, auto);
    }

    .lead-tools-details .lead-counters {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .lead-tools-details .archive-actions {
        justify-content: end;
    }

    .lead-tools-details .archive-actions a {
        min-width: 190px;
    }
}

/* P109: richer dashboard attention cards */
.attention-panel-rich {
    overflow: hidden;
}

.attention-list-rich {
    gap: 10px;
}

.attention-card-rich {
    align-items: stretch;
    display: block;
    padding: 12px;
}

.attention-main {
    display: grid;
    gap: 7px;
    min-width: 0;
    width: 100%;
}

.attention-title-row {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.attention-title-row strong {
    color: #0f172a;
    font-size: 1rem;
    line-height: 1.2;
}

.attention-phone,
.attention-meta,
.attention-date {
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1.25;
}

.attention-details {
    background: rgba(241, 245, 249, 0.9);
    border-radius: 10px;
    color: #0f172a;
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1.35;
    padding: 8px 10px;
    white-space: pre-line;
}

.attention-card-rich.attention-danger .attention-details,
.attention-card-rich.attention-critical .attention-details {
    background: rgba(254, 226, 226, 0.65);
}

.attention-card-rich.attention-warn .attention-details {
    background: rgba(254, 243, 199, 0.55);
}

@media (max-width: 640px) {
    .attention-title-row {
        align-items: flex-start;
        display: grid;
    }

    .attention-title-row .attention-badge {
        justify-self: start;
    }
}

/* P92: CRM leads filters and visible stage dates */
.primary-filter-row {
    margin-bottom: 8px;
}

.secondary-filter-row {
    margin-bottom: 14px;
}

.assigned-chips.primary-filter-row a {
    background: #eef4ff;
    border-color: #c8d8f3;
    color: #27476f;
}

.assigned-chips.primary-filter-row .is-active {
    background: var(--text);
    border-color: var(--text);
    color: var(--surface);
}

.lead-date-facts {
    display: grid;
    gap: 7px;
}

.lead-date-facts:empty {
    display: none;
}

.date-fact {
    background: #fff7df;
    border: 1px solid rgba(159, 101, 0, 0.22);
    border-radius: 8px;
    color: #6f4700;
    font-size: 0.95rem;
    font-weight: 900;
    line-height: 1.25;
    margin: 0;
    overflow-wrap: anywhere;
    padding: 10px 12px;
}

.date-fact-measurement {
    background: #eaf2ff;
    border-color: rgba(18, 102, 219, 0.24);
    color: #0d4fae;
}

.date-fact-thinking {
    background: #fff7df;
    border-color: rgba(159, 101, 0, 0.28);
    color: #6f4700;
}

.date-fact-work {
    background: #eaf8f2;
    border-color: rgba(21, 129, 93, 0.24);
    color: #0b6849;
}

.work-mini-card .date-fact {
    font-size: 0.84rem;
    padding: 7px 9px;
}

/* P92B: visible stage date inside lead detail data block */
.lead-stage-date-card {
    border-width: 2px;
    grid-column: 1 / -1;
    padding: 14px 16px;
}

.lead-stage-date-card dt {
    color: inherit;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.lead-stage-date-card dd {
    color: inherit;
    font-size: clamp(1.08rem, 2.6vw, 1.45rem);
    font-weight: 950;
    line-height: 1.2;
    margin: 0;
}

/* P93A-2: structured manual lead form */
.manual-form-section {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 12px;
    display: grid;
    gap: 12px;
    padding: 14px;
}

.manual-form-section h2 {
    font-size: 1rem;
    margin: 0;
}

.manual-checkbox-group {
    border: 1px solid var(--line);
    border-radius: 10px;
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin: 0;
    padding: 12px;
}

.manual-checkbox-group legend {
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 900;
    padding: 0 6px;
}

.manual-checkbox {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 10px;
    min-height: 42px;
    padding: 10px 12px;
}

.manual-checkbox input[type="checkbox"] {
    accent-color: var(--accent);
    height: 18px;
    margin: 0;
    min-height: 0;
    padding: 0;
    width: 18px;
}

.manual-checkbox label {
    cursor: pointer;
    display: block;
    font-size: 0.95rem;
    font-weight: 900;
    line-height: 1.2;
    margin: 0;
}

.manual-status-fields {
    display: grid;
    gap: 10px;
}

.manual-status-fields [hidden] {
    display: none !important;
}

/* P93A-4: simple category checkboxes */
.manual-category-block {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px;
}

.manual-category-title {
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 900;
    margin: 0 0 10px;
}

.manual-category-list {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.manual-lead-form .manual-category-row {
    align-items: center !important;
    background: transparent;
    border: 0;
    cursor: pointer;
    display: grid !important;
    gap: 8px !important;
    grid-template-columns: 18px minmax(0, 1fr) !important;
    line-height: 1.2;
    margin: 0 !important;
    min-height: 28px;
    padding: 0 !important;
}

.manual-lead-form .manual-category-row input[type="checkbox"] {
    appearance: auto;
    accent-color: var(--accent);
    display: block !important;
    height: 16px !important;
    margin: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    width: 16px !important;
}

.manual-lead-form .manual-category-row span {
    color: var(--text);
    display: block;
    font-size: 0.95rem;
    font-weight: 900;
    overflow-wrap: anywhere;
}

/* P93A-5: final compact manual categories */
.manual-category-block {
    border: 1px solid var(--line) !important;
    border-radius: 10px !important;
    padding: 8px !important;
}

.manual-category-title {
    font-size: 0.82rem !important;
    font-weight: 900 !important;
    margin: 0 0 6px !important;
}

.manual-category-list {
    display: grid !important;
    gap: 4px 8px !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

.manual-lead-form .manual-category-row {
    align-items: center !important;
    border: 0 !important;
    display: grid !important;
    grid-template-columns: 14px minmax(0, 1fr) !important;
    gap: 5px !important;
    line-height: 1.05 !important;
    margin: 0 !important;
    min-height: 20px !important;
    padding: 0 !important;
}

.manual-lead-form .manual-category-row input[type="checkbox"] {
    appearance: auto !important;
    accent-color: var(--accent) !important;
    height: 13px !important;
    margin: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    width: 13px !important;
}

.manual-lead-form .manual-category-row span {
    font-size: 0.78rem !important;
    font-weight: 800 !important;
    line-height: 1.05 !important;
}



/* System page readable monitoring layout */
.system-page {
    display: grid;
    gap: 16px;
    max-width: min(1240px, 100%);
}

.system-page .record-panel {
    overflow: visible;
}

.system-panel {
    min-width: 0;
}

.system-kpi-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.system-kpi {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 6px;
    min-width: 0;
    padding: 13px;
}

.system-kpi span {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
}

.system-kpi strong {
    display: block;
    font-size: 1.35rem;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.system-page .table-wrap {
    margin-top: 10px;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.system-page .records-table {
    min-width: 900px;
    table-layout: auto;
}

.system-page .records-table th,
.system-page .records-table td {
    vertical-align: top;
    white-space: normal;
}

.system-page .records-table td.muted {
    overflow-wrap: anywhere;
}

@media (max-width: 719px) {
    .system-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .system-kpi {
        padding: 11px;
    }

    .system-kpi strong {
        font-size: 1.08rem;
    }

    .system-page .records-table {
        min-width: 820px;
    }
}


/* Backup monitoring block polish */
.system-backup-panel {
    background: linear-gradient(180deg, var(--surface), var(--surface-soft));
}

.backup-hero {
    align-items: stretch;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.95fr);
}

.backup-hero-main {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    display: grid;
    gap: 8px;
    min-width: 0;
    padding: 16px;
}

.backup-label {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.backup-file {
    display: block;
    font-size: 1.18rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.backup-meta-line {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.backup-health-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.backup-health-grid > div {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    display: grid;
    gap: 5px;
    padding: 13px;
}

.backup-health-grid span {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 900;
    text-transform: uppercase;
}

.backup-health-grid strong {
    font-size: 1.15rem;
    line-height: 1.15;
}

.backup-table-wrap {
    margin-top: 14px;
}

.system-page .backup-table {
    min-width: 980px;
}

.backup-table th {
    font-size: 0.78rem;
    text-transform: uppercase;
}

.backup-table td {
    font-size: 0.9rem;
}

.backup-time {
    white-space: nowrap !important;
    width: 150px;
}

.backup-file-cell {
    font-weight: 800;
    overflow-wrap: anywhere;
    width: 260px;
}

.backup-git {
    color: var(--text);
    max-width: 360px;
    overflow-wrap: anywhere;
}

.backup-ok {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 800;
    margin: 2px 4px 2px 0;
    padding: 4px 8px;
    white-space: nowrap;
}

@media (max-width: 920px) {
    .backup-hero {
        grid-template-columns: 1fr;
    }

    .backup-health-grid {
        grid-template-columns: repeat(4, minmax(110px, 1fr));
        overflow-x: auto;
    }
}

@media (max-width: 719px) {
    .backup-hero-main {
        padding: 13px;
    }

    .backup-file {
        font-size: 1rem;
    }

    .backup-health-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow-x: visible;
    }

    .system-page .backup-table {
        min-width: 860px;
    }
}

/* CRM detail: readable lead data values */
.lead-data-edit-fields .inline-field summary {
    min-height: 68px;
    padding: 14px 14px;
}

.lead-data-edit-fields .inline-field summary span {
    gap: 6px;
}

.lead-data-edit-fields .inline-field summary span {
    color: var(--text);
    font-size: clamp(1.08rem, 2.4vw, 1.28rem);
    font-weight: 900;
    line-height: 1.25;
}

.lead-data-edit-fields .inline-field summary b {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.lead-data-edit-fields .inline-field summary i {
    font-size: 1rem;
}

.lead-data-edit-fields .inline-field input,
.lead-data-edit-fields .inline-field select,
.lead-data-edit-fields .inline-field textarea {
    font-size: 1.05rem;
    font-weight: 700;
}

.lead-data-edit-fields .inline-field textarea {
    line-height: 1.35;
}

/* Operational telephony queue */
.calls-nav-link {
    align-items: center;
    display: inline-flex !important;
    gap: 4px;
}

.calls-nav-badge {
    color: var(--danger, #b42318);
    font-size: 0.8rem;
    font-weight: 950;
    line-height: 1;
}

.calls-page-intro {
    align-items: end;
    gap: 20px;
}

.calls-intro-note {
    color: var(--muted);
    margin: 5px 0 0;
}

.calls-quick-search {
    align-items: center;
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(220px, 320px) auto auto;
}

.calls-quick-search input {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--text);
    min-height: 42px;
    padding: 9px 11px;
    width: 100%;
}

.calls-quick-search button,
.calls-quick-search a {
    align-items: center;
    border-radius: 9px;
    display: inline-flex;
    font-weight: 850;
    justify-content: center;
    min-height: 42px;
    padding: 9px 14px;
    text-decoration: none;
}

.calls-quick-search button {
    background: var(--text);
    border: 1px solid var(--text);
    color: var(--surface);
}

.calls-quick-search a {
    border: 1px solid var(--line);
    color: var(--text);
}

.calls-tabs {
    margin-top: 6px;
}

.calls-tabs a {
    align-items: center;
    display: inline-flex;
    gap: 7px;
}

.calls-tabs b {
    background: rgba(255, 255, 255, 0.75);
    border-radius: 999px;
    font-size: 0.72rem;
    min-width: 20px;
    padding: 2px 6px;
    text-align: center;
}

.calls-tabs .is-active b {
    background: rgba(255, 255, 255, 0.18);
}

.calls-results {
    color: var(--muted);
    font-size: 0.86rem;
    margin: 10px 0;
}

.call-list {
    display: grid;
    gap: 12px;
}

.call-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 13px;
    display: grid;
    gap: 14px;
    padding: 16px;
}

.call-status-unreviewed {
    border-left: 5px solid var(--danger, #b42318);
}

.call-card.is-historical {
    background: var(--surface-soft);
}

.call-card-header {
    align-items: start;
    display: flex;
    gap: 14px;
    justify-content: space-between;
}

.call-card-header > div:first-child {
    display: grid;
    gap: 4px;
}

.call-card-header time {
    color: var(--muted);
    font-size: 0.82rem;
}

.call-statuses {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.call-card-body {
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(240px, 0.8fr) minmax(360px, 1.2fr);
}

.call-primary {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 11px;
    display: grid;
    gap: 8px;
    padding: 14px;
}

.call-label,
.call-primary-facts span,
.call-facts dt {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
}

.call-phone {
    color: var(--text);
    font-size: clamp(1.3rem, 2.7vw, 1.75rem);
    font-weight: 950;
    overflow-wrap: anywhere;
    text-decoration: none;
}

.call-primary-facts {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 6px;
}

.call-primary-facts div {
    display: grid;
    gap: 3px;
}

.call-facts {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
}

.call-facts div {
    border: 1px solid var(--line);
    border-radius: 10px;
    display: grid;
    gap: 4px;
    padding: 11px 12px;
}

.call-facts dd {
    font-weight: 800;
    margin: 0;
    overflow-wrap: anywhere;
}

.call-card-actions {
    align-items: center;
    border-top: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
    padding-top: 13px;
}

.call-card-actions form {
    margin: 0;
}

.call-card-actions button {
    background: var(--text);
    border: 1px solid var(--text);
    border-radius: 9px;
    color: var(--surface);
    cursor: pointer;
    font-weight: 900;
    min-height: 42px;
    padding: 9px 18px;
}

.call-note {
    border-left: 3px solid var(--line);
    color: var(--muted);
    margin: 0;
    padding-left: 10px;
}

.status-unreviewed {
    background: #fee4e2;
    color: #b42318;
    font-weight: 950;
}

.status-taken {
    background: #dbeafe;
    color: #1d4ed8;
    font-weight: 950;
}

.call-business-missed {
    background: #fff1f2;
    color: #be123c;
}

.call-business-answered {
    background: #dcfce7;
    color: #166534;
}

@media (max-width: 920px) {
    .calls-page-intro {
        align-items: stretch;
        grid-template-columns: 1fr;
    }

    .call-card-body {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 719px) {
    .calls-quick-search {
        grid-template-columns: 1fr auto;
    }

    .calls-quick-search a {
        grid-column: 1 / -1;
    }

    .calls-tabs {
        display: flex;
        gap: 7px;
        overflow-x: auto;
        padding-bottom: 5px;
    }

    .calls-tabs a {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .call-card {
        padding: 13px;
    }

    .call-card-header {
        display: grid;
    }

    .call-statuses {
        justify-content: flex-start;
    }

    .call-primary-facts,
    .call-facts {
        grid-template-columns: 1fr;
    }

    .call-card-actions,
    .call-card-actions form,
    .call-card-actions button,
    .call-card-actions .open-link {
        width: 100%;
    }

    .call-card-actions button,
    .call-card-actions .open-link {
        justify-content: center;
        text-align: center;
    }
}


.call-action-primary {
    align-items: center;
    background: var(--text);
    border: 1px solid var(--text);
    border-radius: 9px;
    color: var(--surface);
    display: inline-flex;
    font-weight: 900;
    justify-content: center;
    min-height: 42px;
    padding: 9px 18px;
    text-decoration: none;
}

.call-action-details {
    min-width: 220px;
}

.call-action-details summary {
    border: 1px solid var(--line);
    border-radius: 9px;
    cursor: pointer;
    font-weight: 850;
    list-style: none;
    min-height: 42px;
    padding: 10px 14px;
    text-align: center;
}

.call-action-details summary::-webkit-details-marker {
    display: none;
}

.call-action-details[open] {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px;
}

.call-action-details[open] summary {
    border: 0;
    min-height: auto;
    padding: 0 0 9px;
    text-align: left;
}

.call-action-details form,
.call-action-details label {
    display: grid;
    gap: 8px;
}

.call-action-details form {
    min-width: min(360px, 78vw);
}

.call-action-details input,
.call-action-details select,
.call-action-details textarea {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    padding: 9px 10px;
    width: 100%;
}

.call-action-details textarea {
    min-height: 76px;
    resize: vertical;
}

.call-related-hints {
    display: grid;
    gap: 6px;
}

.call-related-hints button {
    background: var(--surface);
    border-color: var(--line);
    color: var(--text);
    font-size: 0.78rem;
    min-height: 34px;
    padding: 6px 8px;
    text-align: left;
}

.call-dismiss-details summary {
    color: var(--danger, #b42318);
}

.call-dismiss-details form > button {
    background: var(--danger, #b42318);
    border-color: var(--danger, #b42318);
}

@media (max-width: 719px) {
    .call-action-primary,
    .call-action-details {
        width: 100%;
    }

    .call-action-details form {
        min-width: 0;
        width: 100%;
    }
}

.call-link-dialog-open {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--text);
    cursor: pointer;
    font-weight: 850;
    min-height: 44px;
    padding: 10px 16px;
}

.call-link-dialog {
    background: transparent;
    border: 0;
    height: min(760px, calc(100dvh - 48px));
    margin: auto;
    max-height: none;
    max-width: none;
    padding: 0;
    width: min(760px, calc(100vw - 40px));
}

.call-link-dialog::backdrop {
    background: rgba(15, 23, 42, 0.62);
    backdrop-filter: blur(2px);
}

.call-link-dialog-shell {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.call-link-dialog-header {
    align-items: flex-start;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 16px;
    justify-content: space-between;
    padding: 18px 20px;
}

.call-link-dialog-header h2,
.call-link-dialog-header p {
    margin: 0;
}

.call-link-dialog-header > div {
    display: grid;
    gap: 4px;
}

.call-link-dialog-close {
    align-items: center;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 44px;
    font-size: 1.6rem;
    height: 44px;
    justify-content: center;
    padding: 0;
}

.call-link-manual-form,
.call-link-search {
    border-bottom: 1px solid var(--line);
    padding: 14px 20px;
}

.call-link-manual-form label,
.call-link-search label {
    display: grid;
    font-size: 0.8rem;
    font-weight: 850;
    gap: 7px;
}

.call-link-manual-form label > span {
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr auto;
}

.call-link-manual-form input,
.call-link-search input {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--text);
    min-height: 44px;
    padding: 10px 12px;
    width: 100%;
}

.call-link-manual-form button {
    background: var(--text);
    border: 1px solid var(--text);
    border-radius: 9px;
    color: var(--surface);
    cursor: pointer;
    font-weight: 900;
    min-height: 44px;
    padding: 10px 18px;
}

.call-link-results {
    display: grid;
    flex: 1 1 auto;
    gap: 8px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px 20px;
}

.call-link-result {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 11px;
    color: var(--text);
    cursor: pointer;
    display: grid;
    gap: 7px;
    min-height: 44px;
    padding: 12px;
    text-align: left;
    width: 100%;
}

.call-link-result:hover,
.call-link-result:focus-visible {
    border-color: var(--text);
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.1);
}

.call-link-result-head,
.call-link-result-client,
.call-link-result-meta {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 7px 12px;
}

.call-link-result-head time {
    color: var(--muted);
    font-size: 0.75rem;
    margin-left: auto;
}

.call-link-match {
    background: #dcfce7;
    border-radius: 999px;
    color: #166534;
    font-size: 0.7rem;
    font-weight: 900;
    padding: 3px 7px;
}

.call-link-result-client span,
.call-link-result-meta,
.call-link-result-preview {
    color: var(--muted);
    font-size: 0.8rem;
}

.call-link-result-preview {
    display: -webkit-box;
    line-height: 1.35;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.call-link-more {
    background: var(--surface-soft);
    border: 0;
    border-top: 1px solid var(--line);
    color: var(--text);
    cursor: pointer;
    font-weight: 900;
    min-height: 52px;
    padding: 12px 20px;
    width: 100%;
}

.call-link-loading,
.call-link-empty,
.call-link-error {
    color: var(--muted);
    margin: auto;
    padding: 28px;
    text-align: center;
}

.call-link-error {
    color: var(--danger, #b42318);
}

body.has-call-link-dialog {
    overflow: hidden;
}

@media (max-width: 719px) {
    .call-link-dialog {
        height: 100dvh;
        width: 100vw;
    }

    .call-link-dialog-shell {
        border: 0;
        border-radius: 0;
    }

    .call-link-dialog-header {
        padding: max(14px, env(safe-area-inset-top))
            14px 12px;
    }

    .call-link-manual-form,
    .call-link-search {
        padding: 12px 14px;
    }

    .call-link-results {
        padding: 10px 12px;
    }

    .call-link-result {
        padding: 12px;
    }

    .call-link-result-head time {
        margin-left: 0;
        width: 100%;
    }

    .call-link-manual-form label > span {
        grid-template-columns: 1fr;
    }

    .call-link-manual-form button {
        width: 100%;
    }
}


/* Lead picker visual correction */
.call-link-dialog {
    height: min(820px, calc(100dvh - 32px));
    width: min(900px, calc(100vw - 32px));
}

.call-link-dialog-shell {
    background: #f8fafc;
}

.call-link-dialog-header {
    background: #ffffff;
    flex: 0 0 auto;
    padding: 18px 22px;
}

.call-link-dialog-header h2 {
    font-size: 1.35rem;
    line-height: 1.15;
}

.call-link-dialog-header p:last-child {
    color: var(--muted);
    font-size: 0.9rem;
}

.call-link-manual-form {
    background: #ffffff;
    padding: 14px 22px;
}

.call-link-search {
    background: #ffffff;
    padding: 14px 22px;
    position: sticky;
    top: 0;
    z-index: 2;
}

.call-link-manual-form label,
.call-link-search label {
    color: var(--text);
    font-size: 0.78rem;
}

.call-link-results {
    align-content: start;
    background: #f1f5f9;
    gap: 10px;
    padding: 14px 18px;
}

/*
 * Важно: более специфичные правила отменяют общий тёмный стиль
 * .call-card-actions button.
 */
.call-card-actions .call-link-result {
    align-items: stretch;
    background: #ffffff;
    border: 1px solid #d8e0ea;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    color: var(--text);
    display: grid;
    gap: 8px;
    height: auto;
    justify-content: stretch;
    min-height: 118px;
    overflow: visible;
    padding: 13px 15px;
    text-align: left;
    white-space: normal;
    width: 100%;
}

.call-card-actions .call-link-result:hover {
    background: #ffffff;
    border-color: #94a3b8;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.call-card-actions .call-link-result:focus-visible {
    background: #ffffff;
    border-color: #1e293b;
    box-shadow: 0 0 0 3px rgba(30, 41, 59, 0.14);
    outline: none;
}

.call-link-result-head {
    align-items: center;
    display: grid;
    gap: 8px;
    grid-template-columns: auto auto 1fr;
}

.call-link-result-head strong {
    color: #0f172a;
    font-size: 0.95rem;
    line-height: 1.2;
}

.call-link-result-head time {
    color: #64748b;
    font-size: 0.75rem;
    justify-self: end;
    margin: 0;
}

.call-link-result-client {
    align-items: baseline;
    display: flex;
    gap: 8px 14px;
}

.call-link-result-client b {
    color: #0f172a;
    font-size: 0.9rem;
}

.call-link-result-client span {
    color: #475569;
    font-size: 0.86rem;
}

.call-link-result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.call-link-result-meta > span {
    background: #e8eef5;
    border-radius: 999px;
    color: #334155;
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 1;
    padding: 5px 8px;
}

.call-link-result-preview {
    color: #475569;
    display: -webkit-box;
    font-size: 0.82rem;
    line-height: 1.4;
    max-height: 2.8em;
    overflow: hidden;
    overflow-wrap: anywhere;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.call-link-match {
    align-self: center;
    background: #dcfce7;
    color: #166534;
    white-space: nowrap;
}

.call-card-actions .call-link-more {
    background: #ffffff;
    border: 0;
    border-top: 1px solid #d8e0ea;
    border-radius: 0;
    color: #0f172a;
    flex: 0 0 auto;
    font-weight: 900;
    min-height: 52px;
    padding: 13px 20px;
    width: 100%;
}

.call-card-actions .call-link-more:hover {
    background: #f8fafc;
}

@media (max-width: 719px) {
    .call-link-dialog {
        height: 100dvh;
        width: 100vw;
    }

    .call-link-dialog-header {
        padding:
            max(12px, env(safe-area-inset-top))
            14px
            12px;
    }

    .call-link-dialog-header h2 {
        font-size: 1.15rem;
    }

    .call-link-manual-form,
    .call-link-search {
        padding: 11px 12px;
    }

    .call-link-results {
        gap: 8px;
        padding: 10px;
    }

    .call-card-actions .call-link-result {
        min-height: 132px;
        padding: 12px;
    }

    .call-link-result-head {
        grid-template-columns: auto 1fr;
    }

    .call-link-result-head time {
        grid-column: 1 / -1;
        justify-self: start;
    }

    .call-link-result-client {
        align-items: flex-start;
        display: grid;
        gap: 3px;
    }

    .call-link-result-preview {
        font-size: 0.8rem;
        -webkit-line-clamp: 3;
        max-height: 4.2em;
    }
}


/* Lead picker Russian status and preview fix */
.call-card-actions .call-link-result {
    align-content: start;
    grid-auto-rows: auto;
    height: auto !important;
    max-height: none !important;
    min-height: 0;
    overflow: visible !important;
    padding: 14px 15px 16px;
}

.call-card-actions .call-link-result > span {
    height: auto;
    max-height: none;
    min-height: 0;
    overflow: visible;
    white-space: normal;
}

.call-link-result-head,
.call-link-result-client,
.call-link-result-meta {
    flex: 0 0 auto;
    min-height: 0;
}

.call-link-result-preview {
    color: #475569;
    display: block !important;
    font-size: 0.82rem;
    line-height: 1.42;
    margin-top: 2px;
    max-height: none !important;
    min-height: 1.42em;
    overflow: visible !important;
    overflow-wrap: anywhere;
    text-overflow: clip;
    white-space: normal !important;
    -webkit-box-orient: initial;
    -webkit-line-clamp: unset !important;
}

.call-link-result-meta > span {
    line-height: 1.15;
}

@media (max-width: 719px) {
    .call-card-actions .call-link-result {
        height: auto !important;
        max-height: none !important;
        min-height: 0;
        padding: 13px 13px 15px;
    }

    .call-link-result-preview {
        display: block !important;
        font-size: 0.8rem;
        line-height: 1.42;
        max-height: none !important;
        overflow: visible !important;
        -webkit-line-clamp: unset !important;
    }
}


/* Lead picker stable flex rows */
.call-link-results {
    align-content: normal !important;
    display: flex !important;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

.call-card-actions .call-link-result {
    all: unset;
    background: #ffffff;
    border: 1px solid #d8e0ea;
    border-radius: 12px;
    box-sizing: border-box;
    color: #0f172a;
    cursor: pointer;
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 7px;
    min-height: 116px;
    padding: 13px 15px;
    text-align: left;
    width: 100%;
}

.call-card-actions .call-link-result:hover {
    background: #ffffff;
    border-color: #94a3b8;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.call-card-actions .call-link-result:focus-visible {
    background: #ffffff;
    border-color: #0f172a;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.16);
    outline: none;
}

.call-card-actions .call-link-result > span {
    box-sizing: border-box;
    flex: 0 0 auto;
    height: auto;
    min-height: 0;
    width: 100%;
}

.call-link-result-head {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
}

.call-link-result-head time {
    color: #64748b;
    margin-left: auto;
}

.call-link-result-client {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: 5px 12px;
}

.call-link-result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.call-link-result-preview {
    color: #475569;
    display: -webkit-box !important;
    font-size: 0.82rem;
    line-height: 1.4;
    margin-top: 1px;
    max-height: 2.8em !important;
    min-height: 0;
    overflow: hidden !important;
    overflow-wrap: anywhere;
    white-space: normal !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
}

@media (max-width: 719px) {
    .call-link-results {
        gap: 8px;
    }

    .call-card-actions .call-link-result {
        min-height: 128px;
        padding: 12px;
    }

    .call-link-result-head time {
        margin-left: 0;
        width: 100%;
    }

    .call-link-result-client {
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
    }

    .call-link-result-preview {
        max-height: 4.2em !important;
        -webkit-line-clamp: 3 !important;
    }
}


/* Structured rejection form */
.reject-drop[open] {
    grid-column: 1 / -1;
}

.reject-drop form {
    align-items: end;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
}

.reject-drop select {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    min-height: 46px;
    min-width: 0;
    padding: 10px 12px;
    width: 100%;
}

.reject-drop .danger-button {
    grid-column: 1 / -1;
}

@media (max-width: 719px) {
    .reject-drop form {
        grid-template-columns: 1fr;
    }

    .reject-drop .danger-button {
        grid-column: auto;
    }
}


/* Lead analytics */
.analytics-shell {
    max-width: 1720px;
}

.analytics-page {
    display: grid;
    gap: 24px;
    min-width: 0;
}

.analytics-page > *,
.analytics-hero > *,
.analytics-period-card > *,
.analytics-source-status > div {
    min-width: 0;
}

.analytics-hero {
    background:
        radial-gradient(circle at 92% 8%, rgba(31, 111, 235, 0.14), transparent 34%),
        linear-gradient(145deg, #ffffff 0%, #f6f9ff 100%);
    border: 1px solid #d4e0f0;
    border-radius: 24px;
    box-shadow: 0 18px 48px rgba(25, 52, 86, 0.08);
    display: grid;
    gap: 18px;
    overflow: hidden;
    padding: clamp(20px, 3vw, 34px);
    position: relative;
}

.analytics-hero::before {
    background: linear-gradient(90deg, var(--accent), #59a4ff);
    content: "";
    height: 5px;
    inset: 0 0 auto;
    position: absolute;
}

.analytics-hero .analytics-head h1 {
    font-size: clamp(2rem, 4vw, 3.35rem);
    letter-spacing: -0.035em;
    line-height: 1.05;
    max-width: 980px;
}

.analytics-hero .intro-note {
    font-size: 0.98rem;
    line-height: 1.6;
    max-width: 1000px;
}

.analytics-period-card {
    align-items: end;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid #dbe5f2;
    border-radius: 18px;
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 16px;
}

.analytics-control-label {
    color: var(--muted);
    display: block;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.analytics-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.analytics-presets a {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text);
    font-weight: 700;
    padding: 9px 15px;
    text-decoration: none;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.analytics-presets a:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
}

.analytics-presets a[aria-current="page"] {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.analytics-filter {
    align-items: end;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(170px, 240px) minmax(170px, 240px) max-content;
}

.analytics-filter label {
    color: var(--muted);
    display: grid;
    font-size: 0.86rem;
    font-weight: 700;
    gap: 6px;
}

.analytics-filter input,
.analytics-filter button {
    border-radius: 10px;
    min-height: 42px;
}

.analytics-filter button {
    background: var(--accent);
    border: 1px solid var(--accent);
    color: #fff;
    cursor: pointer;
    font-weight: 800;
    padding-inline: 18px;
}

.analytics-source-status {
    align-items: center;
    background: #e8f5ec;
    border: 1px solid #86b99a;
    border-radius: 16px;
    display: flex;
    gap: 13px;
    padding: 14px 16px;
}

.analytics-source-status.is-warning,
.analytics-source-status.is-stale {
    background: #fff6dd;
    border-color: #e7c66b;
}

.analytics-source-status > div {
    display: grid;
    gap: 3px;
}

.analytics-source-status > div span {
    color: var(--muted);
    font-size: 0.88rem;
}

.analytics-source-icon {
    align-items: center;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid currentColor;
    border-radius: 999px;
    color: #177245;
    display: inline-flex;
    flex: 0 0 32px;
    font-size: 0.92rem;
    font-weight: 900;
    height: 32px;
    justify-content: center;
}

.analytics-source-status.is-warning .analytics-source-icon,
.analytics-source-status.is-stale .analytics-source-icon {
    color: #946200;
}

.analytics-kpi-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.analytics-kpi-grid article {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
    padding: 18px;
    transition: box-shadow 160ms ease, transform 160ms ease;
}

.analytics-kpi-grid article:hover {
    box-shadow: 0 10px 28px rgba(25, 52, 86, 0.08);
    transform: translateY(-2px);
}

.analytics-kpi-grid article.is-success {
    border-color: #86b99a;
}

.analytics-kpi-grid span,
.analytics-kpi-grid small {
    color: var(--muted);
}

.analytics-kpi-grid strong {
    font-size: clamp(1.65rem, 3vw, 2.25rem);
    line-height: 1;
}

.analytics-delta {
    font-size: 0.78rem;
}

.analytics-delta.is-up {
    color: #177245;
}

.analytics-delta.is-down {
    color: #a33b42;
}

.analytics-trend {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.analytics-source-cards,
.analytics-seo-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.analytics-source-cards article,
.analytics-seo-grid article {
    background: linear-gradient(145deg, #f8fbff, #eef4fb);
    border: 1px solid #dbe5f2;
    border-radius: 15px;
    display: grid;
    gap: 8px;
    padding: 17px;
}

.analytics-source-cards article.is-total {
    background: linear-gradient(145deg, #15345f, #1f6feb);
    border-color: transparent;
    color: #fff;
}

.analytics-source-cards article.is-seo,
.analytics-seo-grid article.is-result {
    background: linear-gradient(145deg, #ebf8ef, #dff2e6);
    border-color: #9bc9aa;
}

.analytics-source-cards article > span,
.analytics-source-cards article > small,
.analytics-seo-grid article > span,
.analytics-seo-grid article > small {
    color: var(--muted);
}

.analytics-source-cards article.is-total > span,
.analytics-source-cards article.is-total > small {
    color: rgba(255, 255, 255, 0.82);
}

.analytics-source-cards strong,
.analytics-seo-grid strong {
    font-size: 2rem;
    line-height: 1;
}

.analytics-trend article {
    background: linear-gradient(145deg, #f8fbff, #eef4fb);
    border: 1px solid #dbe5f2;
    border-radius: 15px;
    display: grid;
    gap: 10px;
    min-width: 0;
    padding: 14px;
}

.analytics-trend-head {
    align-items: baseline;
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.analytics-trend-head time {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
}

.analytics-trend-head strong {
    font-size: 1.35rem;
}

.analytics-trend-head strong small {
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 700;
}

.analytics-trend meter {
    height: 12px;
    width: 100%;
}

.analytics-trend dl {
    display: grid;
    gap: 7px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
}

.analytics-trend dl div {
    align-items: center;
    background: rgba(255, 255, 255, 0.78);
    border-radius: 9px;
    display: flex;
    justify-content: space-between;
    padding: 7px 8px;
}

.analytics-trend dl div.is-result {
    background: #e5f5eb;
    color: #176a3e;
}

.analytics-trend dt,
.analytics-trend dd {
    font-size: 0.76rem;
    margin: 0;
}

.analytics-trend dd {
    font-weight: 900;
}

.analytics-split {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.analytics-split-thirds {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr);
}

.analytics-table td strong,
.analytics-table td small {
    display: block;
}

.analytics-table td small {
    color: var(--muted);
    margin-top: 3px;
}

.analytics-table-wide {
    min-width: 980px;
}

.analytics-url {
    max-width: 420px;
    overflow-wrap: anywhere;
}

.analytics-url a {
    color: var(--accent);
    line-height: 1.45;
    text-decoration: none;
}

.analytics-url a:hover {
    text-decoration: underline;
}

.analytics-methodology summary {
    cursor: pointer;
    font-weight: 800;
}

.analytics-methodology p {
    color: var(--muted);
    line-height: 1.55;
    margin: 0;
}

.analytics-head,
.analytics-section-head {
    align-items: flex-start;
    display: flex;
    gap: 20px;
    justify-content: space-between;
}

.analytics-head h1,
.analytics-section-head h2 {
    margin: 0;
}

.analytics-section-head > p {
    color: var(--muted);
    margin: 0;
    max-width: 520px;
}

.analytics-grid,
.analytics-funnel,
.analytics-quality-grid {
    display: grid;
    gap: 14px;
}

.analytics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.analytics-funnel,
.analytics-quality-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.analytics-card,
.analytics-funnel article,
.analytics-quality-grid article,
.analytics-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
}

.analytics-table-wrap {
    overflow-x: auto;
}

.analytics-table {
    border-collapse: collapse;
    min-width: 720px;
    width: 100%;
}

.analytics-table th,
.analytics-table td {
    border-bottom: 1px solid var(--line);
    padding: 11px 10px;
    text-align: left;
    vertical-align: top;
}

.analytics-table th {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
}

.source-id {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    overflow-wrap: anywhere;
}

.source-evidence-note {
    color: var(--muted);
    font-size: 0.86rem;
    margin: 14px 0 0;
}

.analytics-card,
.analytics-funnel article,
.analytics-quality-grid article {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
    padding: 18px;
}

.analytics-card span,
.analytics-funnel span,
.analytics-quality-grid span {
    color: var(--muted);
    font-size: 0.9rem;
}

.analytics-card strong,
.analytics-funnel strong,
.analytics-quality-grid strong {
    font-size: 2rem;
    line-height: 1;
}

.analytics-card small,
.analytics-funnel small,
.analytics-quality-grid small {
    color: var(--muted);
    line-height: 1.4;
}

.analytics-card-success {
    border-color: #86b99a;
}

.analytics-panel {
    display: grid;
    gap: 18px;
    min-width: 0;
    overflow: hidden;
    padding: 20px;
}

.analytics-table-wrap {
    max-width: 100%;
    min-width: 0;
    width: 100%;
}

@media (max-width: 900px) {
    .analytics-period-card {
        align-items: stretch;
        grid-template-columns: 1fr;
    }

    .analytics-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .analytics-source-cards,
    .analytics-seo-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .analytics-split,
    .analytics-split-thirds {
        grid-template-columns: 1fr;
    }

    .analytics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .analytics-funnel,
    .analytics-quality-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 719px) {
    .analytics-page,
    .analytics-page > *,
    .analytics-hero,
    .analytics-period-card,
    .analytics-filter,
    .analytics-kpi-grid,
    .analytics-source-cards,
    .analytics-seo-grid,
    .analytics-trend {
        box-sizing: border-box;
        max-width: 100%;
        min-width: 0;
        width: 100%;
    }

    .analytics-shell {
        overflow-x: clip;
    }

    .analytics-hero {
        border-radius: 18px;
        padding: 20px 16px;
    }

    .analytics-hero .analytics-head h1 {
        font-size: 2rem;
    }

    .analytics-period-card {
        overflow: hidden;
        padding: 13px;
    }

    .analytics-filter {
        grid-template-columns: 1fr;
    }

    .analytics-filter label,
    .analytics-filter input,
    .analytics-filter button {
        box-sizing: border-box;
        max-width: 100%;
        min-width: 0;
        width: 100%;
    }

    .analytics-presets {
        flex-wrap: nowrap;
        max-width: 100%;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .analytics-source-status strong,
    .analytics-source-status span {
        overflow-wrap: anywhere;
    }

    .analytics-source-status {
        align-items: flex-start;
        flex-direction: column;
    }

    .analytics-kpi-grid {
        grid-template-columns: 1fr;
    }

    .analytics-source-cards,
    .analytics-seo-grid {
        grid-template-columns: 1fr;
    }

    .analytics-trend {
        grid-template-columns: 1fr;
    }

    .analytics-head,
    .analytics-section-head {
        align-items: stretch;
        flex-direction: column;
    }

    .analytics-grid,
    .analytics-funnel,
    .analytics-quality-grid {
        grid-template-columns: 1fr;
    }
}


/* Analytics card inside settings */
.settings-analytics-section {
    display: grid;
    gap: 12px;
    margin-top: 24px;
}

.settings-section-title h2 {
    margin-bottom: 0;
}

.settings-analytics-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 5px;
    min-height: 88px;
    min-width: 0;
    padding: 16px;
    text-decoration: none;
}

.settings-analytics-card span {
    color: var(--muted);
}

/* Mobile-only navigation and settings fixes */
@media (max-width: 719px) {
    .app-nav {
        align-items: center;
        max-width: 100%;
        padding-bottom: 2px;
    }

    .app-nav a,
    .calls-nav-link {
        align-items: center;
        box-sizing: border-box;
        display: inline-flex !important;
        flex: 0 0 auto;
        justify-content: center;
        line-height: 1.2;
        min-height: 38px;
    }

    .app-shell,
    .page-intro,
    .settings-head,
    .directory-grid,
    .directory-list,
    .system-page,
    .record-panel,
    .table-wrap {
        box-sizing: border-box;
        max-width: 100%;
        min-width: 0;
    }

    .directory-grid,
    .directory-list {
        grid-template-columns: minmax(0, 1fr);
        width: 100%;
    }

    .directory-grid a,
    .directory-card,
    .settings-analytics-card,
    .settings-create {
        max-width: 100%;
        overflow-wrap: anywhere;
        width: 100%;
    }

    .settings-create form {
        grid-template-columns: minmax(0, 1fr);
    }

    .settings-head h1,
    .page-intro h1 {
        font-size: clamp(1.8rem, 9vw, 2.35rem);
        overflow-wrap: anywhere;
    }

    .table-wrap,
    .system-page .table-wrap,
    .settings-head + .record-panel .table-wrap {
        max-width: 100%;
        overflow-x: auto;
        width: 100%;
        -webkit-overflow-scrolling: touch;
    }

    .system-page .record-panel {
        overflow: hidden;
    }

    .backup-file,
    .backup-file-cell,
    .backup-git,
    .muted {
        overflow-wrap: anywhere;
        word-break: break-word;
    }
}

/* Preserve manager-entered line breaks in lead comments */
.lead-data-edit-fields .inline-field summary .lead-comment-value {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* Lead comment copy action */
.lead-data-edit-fields .inline-field summary .lead-comment-actions {
    align-items: center;
    display: inline-flex;
    flex: 0 0 auto;
    gap: 8px;
    margin-left: auto;
}

.lead-data-edit-fields .inline-field summary .lead-comment-copy-button {
    align-items: center;
    background: #ffffff !important;
    border: 1px solid #d9e2ec !important;
    border-radius: 9px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    color: #1e40af !important;
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 36px;
    height: 36px;
    justify-content: center;
    min-height: 36px;
    padding: 0;
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.15s ease;
    width: 36px;
}

.lead-comment-copy-button svg {
    fill: none;
    pointer-events: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.lead-data-edit-fields .inline-field summary .lead-comment-copy-button:hover {
    background: #f8fafc !important;
    border-color: #b8c7d9 !important;
    box-shadow: 0 2px 5px rgba(15, 23, 42, 0.1);
}

.lead-data-edit-fields .inline-field summary .lead-comment-copy-button:active {
    background: #eef4fb !important;
    box-shadow: none;
    transform: translateY(1px);
}

.lead-data-edit-fields .inline-field summary .lead-comment-copy-button:focus,
.lead-data-edit-fields .inline-field summary .lead-comment-copy-button:focus-visible {
    background: #ffffff !important;
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
    outline: none;
}

.lead-data-edit-fields .inline-field summary .lead-comment-copy-button.is-copied,
.lead-data-edit-fields .inline-field summary .lead-comment-copy-button:disabled {
    background: #ecfdf3 !important;
    border-color: #86d3a6 !important;
    color: var(--success) !important;
    cursor: default;
    opacity: 1;
}

/* Lead detail: match manual-create category checkbox layout */
.lead-data-edit-fields .lead-category-edit-list {
    display: grid !important;
    gap: 4px 8px !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

.lead-data-edit-fields
.lead-category-edit-list
.manual-category-row {
    align-items: center !important;
    background: transparent !important;
    border: 0 !important;
    cursor: pointer;
    display: grid !important;
    gap: 5px !important;
    grid-template-columns: 14px minmax(0, 1fr) !important;
    line-height: 1.05 !important;
    margin: 0 !important;
    min-height: 20px !important;
    padding: 0 !important;
}

.lead-data-edit-fields
.lead-category-edit-list
.manual-category-row
input[type="checkbox"] {
    appearance: auto !important;
    accent-color: var(--accent) !important;
    display: block !important;
    flex: none !important;
    font-size: initial !important;
    height: 13px !important;
    margin: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    width: 13px !important;
}

.lead-data-edit-fields
.lead-category-edit-list
.manual-category-row
span {
    color: var(--text);
    display: block;
    font-size: 0.78rem !important;
    font-weight: 800 !important;
    line-height: 1.05 !important;
    min-width: 0;
    overflow-wrap: anywhere;
}


/* Customer card v1 */
.customer-card-link,
.customer-lead-call {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    display: inline-flex;
    font-weight: 900;
    justify-content: center;
    min-height: 48px;
    padding: 11px 14px;
    text-decoration: none;
}

.customer-hero {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 18px;
    margin-bottom: 16px;
    padding: 20px;
}

.customer-hero-head,
.customer-section-head,
.customer-timeline-head {
    align-items: flex-start;
    display: flex;
    gap: 14px;
    justify-content: space-between;
}

.customer-hero h1,
.customer-section-head h2 {
    margin: 0;
}

.customer-main-phone {
    color: var(--accent-strong);
    display: inline-flex;
    font-size: clamp(1.35rem, 6vw, 2rem);
    font-weight: 950;
    margin-top: 10px;
    overflow-wrap: anywhere;
    text-decoration: none;
}

.customer-summary {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(110px, 1fr));
    min-width: min(360px, 100%);
}

.customer-summary span {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    font-size: 0.8rem;
    gap: 3px;
    padding: 10px;
}

.customer-summary b {
    color: var(--text);
    font-size: 1.2rem;
}

.customer-workspace {
    align-items: start;
    display: grid;
    gap: 16px;
}

.customer-leads-panel,
.customer-timeline-panel {
    padding: 16px;
}

.customer-section-head {
    margin-bottom: 14px;
}

.customer-section-head > span {
    background: var(--surface-soft);
    border-radius: 999px;
    font-weight: 900;
    min-width: 34px;
    padding: 6px 10px;
    text-align: center;
}

.customer-lead-list,
.customer-timeline {
    display: grid;
    gap: 10px;
}

.customer-lead-card {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 9px;
    display: grid;
    gap: 8px;
    overflow-wrap: anywhere;
    padding: 13px;
}

.customer-lead-card.is-deleted {
    border-color: #efb0b6;
}

.customer-lead-card p,
.customer-timeline p,
.customer-timeline small {
    margin: 0;
}

.customer-lead-manager,
.customer-lead-source,
.customer-timeline-lead {
    color: var(--muted);
    font-size: 0.86rem;
}

.customer-lead-actions {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.customer-locked-history {
    background: var(--surface);
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.84rem;
    padding: 9px 10px;
}

.customer-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
}

.customer-timeline li {
    border: 1px solid var(--line);
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    display: grid;
    gap: 8px;
    padding: 12px;
}

.customer-timeline li.customer-timeline-call {
    border-left-color: #16a34a;
}

.customer-timeline-head {
    align-items: center;
    flex-wrap: wrap;
}

.customer-timeline time,
.customer-timeline small {
    color: var(--muted);
}

.customer-timeline-empty {
    color: var(--muted);
    text-align: center;
}

@media (min-width: 980px) {
    .customer-workspace {
        grid-template-columns:
            minmax(0, 0.92fr)
            minmax(0, 1.08fr);
    }
}

@media (max-width: 719px) {
    .customer-hero-head,
    .customer-section-head,
    .customer-timeline-head {
        display: grid;
    }

    .customer-summary,
    .customer-lead-actions {
        grid-template-columns: 1fr;
        min-width: 0;
        width: 100%;
    }

    .customer-card-link,
    .customer-lead-call {
        width: 100%;
    }
}

/* Task UI v1 */
.task-work-panel,
.lead-tasks-panel,
.customer-tasks-panel {
    display: grid;
    gap: 14px;
    margin-bottom: 16px;
    padding: 16px;
}

.task-section-head,
.task-group-head,
.task-card-head {
    align-items: flex-start;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.task-section-head h2,
.task-group-head h3,
.task-card-head strong {
    margin: 0;
}

.task-section-head > span,
.task-group-head > span {
    background: var(--surface-soft);
    border-radius: 999px;
    font-weight: 900;
    min-width: 34px;
    padding: 6px 10px;
    text-align: center;
}

.task-groups {
    display: grid;
    gap: 12px;
}

.task-group {
    border: 1px solid var(--line);
    border-radius: 9px;
    display: grid;
    gap: 10px;
    min-width: 0;
    padding: 12px;
}

.task-group-overdue {
    border-color: #efb0b6;
}

.task-group-unassigned {
    border-color: #e7c66a;
}

.task-list {
    display: grid;
    gap: 10px;
}

.task-card {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    display: grid;
    gap: 10px;
    min-width: 0;
    overflow-wrap: anywhere;
    padding: 12px;
}

.task-card.is-unassigned {
    border-left-color: #d09300;
}

.task-card.is-closed {
    opacity: 0.72;
}

.task-card-head > div {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.task-card-head time,
.task-card-meta,
.task-card-links {
    color: var(--muted);
    font-size: 0.86rem;
}

.task-type-label {
    color: var(--accent-strong);
    font-size: 0.76rem;
    font-weight: 900;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.task-card-comment,
.task-empty {
    margin: 0;
}

.task-card-comment {
    white-space: pre-wrap;
}

.task-empty {
    color: var(--muted);
    padding: 8px 2px;
}

.task-card-meta,
.task-card-links,
.task-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
}

.task-card-links a {
    color: var(--accent-strong);
    font-weight: 800;
}

.task-card-actions {
    align-items: end;
}

.task-card-actions form,
.task-reschedule {
    margin: 0;
}

.task-card-actions button,
.task-create-form button,
.task-reschedule summary {
    align-items: center;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    font-weight: 900;
    justify-content: center;
    min-height: 42px;
    padding: 10px 13px;
}

.task-card-actions button,
.task-create-form button {
    background: var(--accent);
    color: var(--surface);
}

.task-card-actions .task-complete-button {
    background: var(--success);
}

.task-card-actions .task-cancel-button {
    background: var(--danger);
}

.task-assign-form {
    align-items: end;
    display: grid;
    gap: 7px;
    grid-template-columns: minmax(150px, 1fr) auto;
}

.task-assign-form label,
.task-create-form label,
.task-reschedule label {
    color: var(--muted);
    display: grid;
    font-size: 0.84rem;
    font-weight: 800;
    gap: 6px;
}

.task-assign-form select,
.task-create-form input,
.task-create-form select,
.task-create-form textarea,
.task-reschedule input {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    min-height: 44px;
    padding: 9px 11px;
    width: 100%;
}

.task-create {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.task-create > summary,
.task-reschedule > summary {
    cursor: pointer;
    list-style: none;
}

.task-reschedule > summary {
    background: var(--surface-soft);
}

.task-create > summary {
    background: var(--surface);
    color: var(--text);
    font-weight: 900;
    min-height: 48px;
    padding: 13px 14px;
    transition: background-color 120ms ease;
}

.task-create > summary:hover,
.task-create[open] > summary {
    background: #f7f8fa;
}

.task-create > summary:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: -3px;
}

.task-create[open] > summary {
    border-bottom: 1px solid var(--line);
}

.task-create > summary::-webkit-details-marker,
.task-reschedule > summary::-webkit-details-marker {
    display: none;
}

.task-create-form,
.task-reschedule form {
    display: grid;
    gap: 10px;
    padding: 12px;
}

.task-comment-field {
    grid-column: 1 / -1;
}

.task-create-form textarea {
    min-height: 82px;
    resize: vertical;
}

.task-create-form button {
    grid-column: 1 / -1;
}

.task-reschedule {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.task-reschedule > summary {
    color: var(--text);
}

@media (min-width: 720px) {
    .task-groups {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .task-group-later {
        grid-column: 1 / -1;
    }

    .task-create-form {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 719px) {
    .task-section-head,
    .task-group-head,
    .task-card-head {
        display: grid;
    }

    .task-card-actions,
    .task-card-links,
    .task-card-meta {
        display: grid;
    }

    .task-card-actions form,
    .task-card-actions button,
    .task-reschedule,
    .task-assign-form {
        width: 100%;
    }

    .task-assign-form {
        grid-template-columns: 1fr;
    }
}
.sr-only {
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.chat-app-shell {
    max-width: 1500px;
    padding-top: 26px;
}

.chat-page-heading {
    align-items: flex-end;
    display: flex;
    gap: 24px;
    justify-content: space-between;
    margin-bottom: 20px;
}

.chat-page-heading h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    margin-bottom: 8px;
}

.chat-page-heading p:last-child {
    color: var(--muted);
    margin: 0;
}

.chat-heading-summary {
    align-items: flex-end;
    display: grid;
    gap: 8px;
    justify-items: end;
}

.chat-heading-summary > span:first-child {
    color: var(--muted);
    font-size: .84rem;
}

.chat-heading-summary b {
    color: var(--text);
    font-size: 1.1rem;
}

.chat-live-dot {
    align-items: center;
    color: var(--success);
    display: inline-flex;
    font-size: .82rem;
    font-weight: 800;
    gap: 7px;
}

.chat-live-dot::before {
    background: #22a06b;
    border: 3px solid #d9f6e9;
    border-radius: 50%;
    content: "";
    height: 12px;
    width: 12px;
}

.chat-live-dot.is-offline {
    color: var(--danger);
}

.chat-live-dot.is-offline::before {
    background: var(--danger);
    border-color: #fde2e2;
}

.chat-channel-tab-email .chat-channel-icon {
    background: #fff0d8;
    color: #9a5a00;
}

.chat-preview-email.is-selected::before {
    background: #d98a16;
}

.chat-notice {
    border-radius: 12px;
    margin: 0 0 16px;
}

.chat-controls {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 12px;
}

.chat-channel-tabs,
.chat-status-tabs {
    align-items: center;
    display: flex;
    gap: 8px;
}

.chat-channel-tabs {
    background: #e9eef6;
    border: 1px solid #dbe3ee;
    border-radius: 14px;
    padding: 5px;
}

.chat-channel-tab {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--muted);
    display: inline-flex;
    font-size: .88rem;
    font-weight: 800;
    gap: 8px;
    min-height: 42px;
    padding: 6px 11px;
    text-decoration: none;
    transition: background .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease;
}

.chat-channel-tab:hover,
.chat-channel-tab.is-active {
    background: #fff;
    border-color: #d7e0ec;
    box-shadow: 0 5px 15px rgba(31, 49, 76, .08);
    color: var(--text);
}

.chat-channel-tab b {
    align-items: center;
    background: #eef2f7;
    border-radius: 999px;
    display: inline-flex;
    font-size: .73rem;
    justify-content: center;
    min-width: 23px;
    padding: 3px 7px;
}

.chat-channel-icon {
    align-items: center;
    background: #6b7c93;
    border-radius: 8px;
    color: #fff;
    display: inline-flex;
    font-size: .76rem;
    font-style: normal;
    font-weight: 900;
    height: 26px;
    justify-content: center;
    width: 26px;
}

.chat-channel-tab-telegram .chat-channel-icon {
    background: #229ed9;
}

.chat-channel-tab-max .chat-channel-icon {
    background: linear-gradient(135deg, #7058f6, #b44bd8);
}

.chat-channel-tab-whatsapp .chat-channel-icon {
    background: #25d366;
}

.chat-search {
    align-items: stretch;
    display: flex;
    gap: 8px;
    min-width: min(100%, 390px);
}

.chat-search label {
    display: flex;
    flex: 1 1 auto;
}

.chat-search input {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 11px;
    min-height: 44px;
    padding: 0 14px;
    width: 100%;
}

.chat-search input:focus,
.chat-composer textarea:focus,
.chat-action-menu input:focus,
.chat-action-menu select:focus,
.chat-action-menu textarea:focus {
    border-color: #6aa2ec;
    box-shadow: 0 0 0 3px rgba(18, 102, 219, .12);
    outline: 0;
}

.chat-search button,
.chat-composer button,
.chat-action-menu button {
    background: var(--text);
    border: 0;
    border-radius: 11px;
    color: #fff;
    cursor: pointer;
    font-weight: 800;
    padding: 0 18px;
}

.chat-status-tabs {
    margin: 0 0 16px;
    overflow-x: auto;
    padding: 2px 0;
}

.chat-status-tabs a {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--muted);
    display: inline-flex;
    flex: 0 0 auto;
    font-size: .84rem;
    font-weight: 800;
    gap: 8px;
    padding: 8px 13px;
    text-decoration: none;
}

.chat-status-tabs a:hover {
    background: #e9eef6;
    color: var(--text);
}

.chat-status-tabs a.is-active {
    background: #172a46;
    color: #fff;
}

.chat-status-tabs b {
    background: rgba(96, 112, 134, .12);
    border-radius: 999px;
    font-size: .74rem;
    min-width: 23px;
    padding: 3px 7px;
    text-align: center;
}

.chat-status-tabs .is-active b {
    background: rgba(255, 255, 255, .18);
}

.chat-workspace {
    background: #fff;
    border: 1px solid #d7e0ec;
    border-radius: 18px;
    box-shadow: 0 20px 55px rgba(30, 51, 83, .12);
    display: grid;
    grid-template-columns: minmax(300px, 365px) minmax(0, 1fr);
    min-height: 670px;
    overflow: hidden;
}

.chat-sidebar {
    background: #fbfcfe;
    border-right: 1px solid #dce4ef;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-sidebar-heading {
    align-items: center;
    border-bottom: 1px solid #e3e9f2;
    display: flex;
    justify-content: space-between;
    min-height: 70px;
    padding: 14px 16px;
}

.chat-sidebar-heading > div {
    display: grid;
    gap: 3px;
}

.chat-sidebar-heading strong {
    font-size: 1rem;
}

.chat-sidebar-heading span {
    color: var(--muted);
    font-size: .78rem;
}

.chat-filter-pill {
    background: #e9eef6;
    border-radius: 999px;
    color: var(--text) !important;
    font-weight: 800;
    padding: 5px 9px;
}

.chat-conversation-list {
    display: grid;
    overflow-y: auto;
}

.chat-preview {
    border-bottom: 1px solid #e7ecf3;
    color: inherit;
    display: grid;
    gap: 11px;
    grid-template-columns: 42px minmax(0, 1fr);
    padding: 15px 16px;
    position: relative;
    text-decoration: none;
    transition: background .14s ease;
}

.chat-preview::before {
    background: transparent;
    content: "";
    inset: 0 auto 0 0;
    position: absolute;
    width: 4px;
}

.chat-preview:hover {
    background: #f2f6fb;
}

.chat-preview.is-selected {
    background: #eef5ff;
}

.chat-preview-telegram.is-selected::before {
    background: #229ed9;
}

.chat-preview-max.is-selected::before {
    background: linear-gradient(#7058f6, #b44bd8);
}

.chat-preview-whatsapp.is-selected::before {
    background: #25d366;
}

.chat-preview-avatar,
.chat-thread-avatar,
.chat-message-avatar {
    align-items: center;
    border-radius: 12px;
    display: inline-flex;
    flex: 0 0 auto;
    font-weight: 900;
    justify-content: center;
}

.chat-preview-avatar {
    background: #e8eef7;
    color: #38506e;
    height: 42px;
    width: 42px;
}

.chat-preview-telegram .chat-preview-avatar {
    background: #dff3fc;
    color: #087caf;
}

.chat-preview-max .chat-preview-avatar {
    background: #eee8ff;
    color: #6e45cc;
}

.chat-preview-whatsapp .chat-preview-avatar {
    background: #dcf8e7;
    color: #087f3e;
}

.chat-preview-body,
.chat-preview-topline,
.chat-preview-channel,
.chat-preview-text,
.chat-preview-footer {
    min-width: 0;
}

.chat-preview-body {
    display: grid;
    gap: 6px;
}

.chat-preview-topline,
.chat-preview-footer {
    align-items: center;
    display: flex;
    gap: 8px;
    justify-content: space-between;
}

.chat-preview-topline strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-preview-topline time,
.chat-preview-footer,
.chat-preview-channel {
    color: var(--muted);
    font-size: .72rem;
}

.chat-preview-topline time {
    flex: 0 0 auto;
}

.chat-preview-channel {
    align-items: center;
    display: flex;
    font-weight: 800;
    gap: 5px;
}

.chat-preview-channel i,
.chat-thread-channel i {
    background: #6b7c93;
    border-radius: 50%;
    display: inline-block;
    height: 7px;
    width: 7px;
}

.chat-preview-telegram .chat-preview-channel i,
.chat-thread-header-telegram .chat-thread-channel i {
    background: #229ed9;
}

.chat-preview-max .chat-preview-channel i,
.chat-thread-header-max .chat-thread-channel i {
    background: #8b56e9;
}

.chat-preview-whatsapp .chat-preview-channel i,
.chat-thread-header-whatsapp .chat-thread-channel i {
    background: #25d366;
}

.chat-preview-channel span {
    font-weight: 500;
}

.chat-preview-text {
    display: block;
    font-size: .86rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-preview-text b {
    color: var(--accent);
}

.chat-preview-status {
    border-radius: 999px;
    font-size: .66rem;
    font-weight: 900;
    padding: 3px 7px;
    text-transform: uppercase;
}

.chat-preview-status.status-unreviewed,
.chat-preview-status.status-taken {
    background: #fff0d5;
    color: #9b5d00;
}

.chat-preview-status.status-converted,
.chat-preview-status.status-linked {
    background: #ddf5e9;
    color: #14724f;
}

.chat-preview-status.status-dismissed {
    background: #edf0f4;
    color: #66758a;
}

.chat-sidebar-empty,
.chat-thread-empty,
.chat-thread-placeholder {
    color: var(--muted);
    display: grid;
    gap: 7px;
    justify-items: center;
    padding: 42px 24px;
    text-align: center;
}

.chat-sidebar-empty strong,
.chat-thread-placeholder strong {
    color: var(--text);
}

.chat-pagination {
    border-top: 1px solid #e3e9f2;
    display: flex;
    gap: 8px;
    justify-content: space-between;
    margin-top: auto;
    padding: 12px 16px;
}

.chat-pagination a,
.chat-pagination span {
    color: var(--muted);
    font-size: .8rem;
    font-weight: 800;
    text-decoration: none;
}

.chat-pagination span {
    opacity: .45;
}

.chat-thread-panel {
    background: #f4f7fb;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-thread-header {
    align-items: center;
    background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid #dce4ef;
    display: grid;
    gap: 13px;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    min-height: 82px;
    padding: 14px 20px;
}

.chat-thread-avatar {
    background: #e8eef7;
    color: #38506e;
    height: 46px;
    width: 46px;
}

.chat-thread-header-telegram .chat-thread-avatar {
    background: #dff3fc;
    color: #087caf;
}

.chat-thread-header-max .chat-thread-avatar {
    background: #eee8ff;
    color: #6e45cc;
}

.chat-thread-identity {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.chat-thread-identity > div {
    align-items: center;
    display: flex;
    gap: 10px;
}

.chat-thread-identity strong {
    font-size: 1.02rem;
}

.chat-thread-channel {
    align-items: center;
    background: #f0f3f7;
    border-radius: 999px;
    color: var(--muted);
    display: inline-flex;
    font-size: .72rem;
    font-weight: 800;
    gap: 5px;
    padding: 4px 8px;
}

.chat-thread-identity p {
    color: var(--muted);
    font-size: .78rem;
    margin: 0;
}

.chat-thread-state {
    align-items: flex-end;
    display: grid;
    gap: 5px;
    justify-items: end;
}

.chat-thread-state time {
    color: var(--muted);
    font-size: .72rem;
}

.chat-thread-panel .chat-transcript {
    align-content: start;
    display: grid;
    flex: 1 1 auto;
    gap: 12px;
    max-height: 510px;
    min-height: 300px;
    overflow-y: auto;
    padding: 20px;
}

.chat-message-row {
    align-items: start;
    display: grid;
    gap: 11px;
    grid-template-columns: 36px minmax(0, 1fr);
    width: 100%;
}

.chat-message-avatar {
    background: #e2e8f1;
    color: #47617f;
    font-size: .78rem;
    height: 36px;
    width: 36px;
}

.chat-message-row.is-outbound .chat-message-avatar {
    background: #dcecff;
    color: #1266db;
}

.chat-message-card {
    background: #fff;
    border: 1px solid #dde5ef;
    border-left: 4px solid #9fb0c5;
    border-radius: 5px 13px 13px 5px;
    box-shadow: 0 5px 16px rgba(31, 49, 76, .05);
    min-width: 0;
    padding: 12px 14px;
}

.chat-message-row.is-outbound .chat-message-card {
    background: #edf6ff;
    border-color: #cfe3f8;
    border-left-color: #3b8eea;
}

.chat-message-card header {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.chat-message-card header > div {
    align-items: center;
    display: flex;
    gap: 8px;
    min-width: 0;
}

.chat-message-card strong {
    font-size: .82rem;
}

.chat-message-role {
    background: #edf0f4;
    border-radius: 999px;
    color: var(--muted);
    font-size: .64rem;
    font-weight: 900;
    padding: 3px 6px;
    text-transform: uppercase;
}

.chat-message-row.is-outbound .chat-message-role {
    background: #d9eaff;
    color: #155da9;
}

.chat-message-card time {
    color: var(--muted);
    flex: 0 0 auto;
    font-size: .7rem;
}

.chat-message-card p {
    line-height: 1.5;
    margin: 8px 0 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.chat-attachment-count {
    color: var(--muted);
    display: inline-block;
    font-size: .72rem;
    margin-top: 8px;
}

.chat-email-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 10px;
}

.chat-email-attachments a {
    background: #fff4df;
    border: 1px solid #f0d5a5;
    border-radius: 8px;
    color: #7a4b00;
    font-size: .75rem;
    font-weight: 800;
    padding: 6px 9px;
    text-decoration: none;
}

.chat-mail-readonly {
    background: #fff8e8;
    border-top: 1px solid #eed7aa;
    display: grid;
    gap: 4px;
    padding: 16px 20px;
}

.chat-mail-readonly span {
    color: var(--muted);
    font-size: .78rem;
}

.chat-composer {
    background: #fff;
    border-top: 1px solid #dce4ef;
    display: grid;
    gap: 8px;
    padding: 16px 20px 12px;
}

.chat-composer > label {
    color: var(--text);
    font-size: .78rem;
    font-weight: 900;
}

.chat-composer > div {
    align-items: stretch;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) auto;
}

.chat-composer textarea {
    border: 1px solid var(--line);
    border-radius: 12px;
    min-height: 76px;
    padding: 12px 14px;
    resize: vertical;
}

.chat-composer button {
    align-self: stretch;
    min-width: 118px;
}

.chat-composer small {
    color: var(--muted);
    font-size: .7rem;
}

.chat-composer-hint {
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.chat-composer button:disabled {
    cursor: wait;
    opacity: .65;
}

.chat-thread-actions {
    align-items: center;
    background: #fff;
    border-top: 1px solid #edf0f4;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 20px 16px;
    position: relative;
    z-index: 4;
}

.chat-action-primary,
.chat-action-link,
.chat-action-menu > summary {
    align-items: center;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    font-size: .8rem;
    font-weight: 900;
    justify-content: center;
    min-height: 40px;
    padding: 8px 13px;
    text-decoration: none;
}

.chat-action-primary {
    background: #172a46;
    color: #fff;
}

.chat-action-link,
.chat-action-menu > summary {
    background: #f1f4f8;
    border: 1px solid #dbe3ee;
    color: var(--text);
    list-style: none;
}

.chat-action-menu {
    position: relative;
}

.chat-action-menu > summary::-webkit-details-marker {
    display: none;
}

.chat-action-danger > summary {
    color: var(--danger);
}

.chat-action-menu form {
    background: #fff;
    border: 1px solid #d7e0ec;
    border-radius: 12px;
    box-shadow: 0 18px 44px rgba(30, 51, 83, .18);
    display: grid;
    gap: 9px;
    bottom: calc(100% + 7px);
    left: 0;
    max-height: min(360px, calc(100vh - 180px));
    min-width: 260px;
    overflow-y: auto;
    padding: 12px;
    position: absolute;
    top: auto;
    z-index: 3;
}

.chat-action-menu input,
.chat-action-menu select,
.chat-action-menu textarea {
    border: 1px solid var(--line);
    border-radius: 9px;
    min-height: 40px;
    padding: 8px 10px;
}

.chat-action-menu textarea {
    min-height: 66px;
    resize: vertical;
}

.chat-action-menu button {
    min-height: 40px;
}

.chat-thread-placeholder {
    margin: auto;
}

.chat-thread-placeholder > span {
    align-items: center;
    background: #e7edf6;
    border-radius: 18px;
    color: #667b97;
    display: inline-flex;
    font-size: 1.5rem;
    height: 58px;
    justify-content: center;
    width: 58px;
}

.phone-history-panel .chat-transcript {
    background: #f7f8fa;
    border: 1px solid var(--line);
    border-radius: 12px;
    display: grid;
    gap: 9px;
    max-height: 32rem;
    overflow: auto;
    padding: 12px;
}

.phone-history-panel .chat-message {
    background: #fff;
    border: 1px solid #e2e6eb;
    border-radius: 12px;
    max-width: 86%;
    padding: 10px 12px;
}

.phone-history-panel .chat-message.is-outbound {
    background: #eaf5ff;
    justify-self: end;
}

.phone-history-panel .chat-message > div {
    display: flex;
    font-size: .8rem;
    gap: 12px;
    justify-content: space-between;
}

.phone-history-panel .chat-message p {
    margin: 6px 0 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

@media (max-width: 980px) {
    .chat-workspace {
        grid-template-columns: 1fr;
    }

    .chat-sidebar {
        border-bottom: 1px solid #dce4ef;
        border-right: 0;
    }

    .chat-conversation-list {
        max-height: 350px;
    }

    .chat-thread-panel .chat-transcript {
        max-height: 520px;
    }
}

@media (max-width: 720px) {
    .chat-app-shell {
        padding-left: 12px;
        padding-right: 12px;
        padding-top: 16px;
    }

    .chat-page-heading {
        align-items: flex-start;
        margin-bottom: 16px;
    }

    .chat-heading-summary {
        display: none;
    }

    .chat-page-heading h1 {
        font-size: 2rem;
    }

    .chat-page-heading p:last-child {
        font-size: .84rem;
    }

    .chat-controls {
        align-items: stretch;
        display: grid;
    }

    .chat-channel-tabs {
        overflow-x: auto;
    }

    .chat-channel-tab {
        flex: 1 0 auto;
        justify-content: center;
    }

    .chat-search {
        min-width: 0;
        width: 100%;
    }

    .chat-workspace {
        border-radius: 14px;
        min-height: 0;
    }

    .chat-sidebar-heading {
        min-height: 60px;
    }

    .chat-conversation-list {
        max-height: 310px;
    }

    .chat-preview {
        padding: 13px 14px;
    }

    .chat-thread-panel {
        scroll-margin-top: 120px;
    }

    .chat-thread-header {
        gap: 10px;
        grid-template-columns: 42px minmax(0, 1fr);
        padding: 13px 14px;
    }

    .chat-thread-avatar {
        height: 42px;
        width: 42px;
    }

    .chat-thread-state {
        align-items: center;
        display: flex;
        grid-column: 1 / -1;
        justify-content: space-between;
        justify-items: stretch;
    }

    .chat-thread-panel .chat-transcript {
        gap: 10px;
        max-height: none;
        min-height: 240px;
        padding: 14px;
    }

    .chat-message-row {
        gap: 8px;
        grid-template-columns: 32px minmax(0, 1fr);
    }

    .chat-message-avatar {
        height: 32px;
        width: 32px;
    }

    .chat-message-card {
        padding: 10px 11px;
    }

    .chat-message-card header {
        align-items: flex-start;
    }

    .chat-message-card header > div {
        align-items: flex-start;
        display: grid;
        gap: 4px;
    }

    .chat-composer {
        padding: 14px;
    }

    .chat-composer > div {
        grid-template-columns: 1fr;
    }

    .chat-composer button {
        min-height: 46px;
    }

    .chat-desktop-shortcut {
        display: none;
    }

    .chat-thread-actions {
        align-items: stretch;
        display: grid;
        grid-template-columns: 1fr;
        padding: 12px 14px 16px;
    }

    .chat-action-menu > summary,
    .chat-action-primary,
    .chat-action-link {
        width: 100%;
    }

    .chat-action-menu form {
        margin-top: 8px;
        min-width: 0;
        position: static;
        width: 100%;
    }
}

/* Keep the lifecycle action column after the base chat layout rules above. */
.chat-thread-header {
    grid-template-columns: 46px minmax(0, 1fr) auto 40px;
}

@media (max-width: 720px) {
    .chat-thread-header {
        grid-template-columns: 42px minmax(0, 1fr);
    }
}

/* Garage CRM unified visual system v1
   Presentation-only layer. It intentionally preserves document structure,
   form behavior, route contracts and all application content. */
body.profile-garage {
    --ui-ink: #132238;
    --ui-muted: #667892;
    --ui-line: #dbe4f0;
    --ui-panel: rgba(255, 255, 255, .94);
    --ui-panel-soft: #f6f8fc;
    --ui-indigo: #5569ef;
    --ui-indigo-deep: #304a89;
    --ui-cyan: #28a9d8;
    --ui-violet: #9b57e8;
    --ui-green: #22b480;
    --ui-amber: #f1a340;
    --ui-rose: #eb6476;
    --ui-radius-lg: 22px;
    --ui-radius-md: 16px;
    --ui-shadow: 0 14px 38px rgba(31, 51, 83, .075);
    --ui-shadow-hover: 0 20px 46px rgba(31, 51, 83, .13);
    background:
        radial-gradient(circle at 8% 4%, rgba(85, 105, 239, .065), transparent 27rem),
        radial-gradient(circle at 94% 24%, rgba(40, 169, 216, .06), transparent 31rem),
        #f4f7fb;
    color: var(--ui-ink);
}

body.profile-garage::before {
    background: linear-gradient(90deg, #5569ef, #28a9d8, #9b57e8);
    content: "";
    height: 3px;
    left: 0;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 120;
}

body.profile-garage .app-header {
    backdrop-filter: blur(18px) saturate(145%);
    background: rgba(255, 255, 255, .88);
    border-bottom: 1px solid rgba(209, 220, 235, .85);
    box-shadow: 0 6px 24px rgba(31, 51, 83, .055);
    min-height: 72px;
    padding-left: max(24px, calc((100vw - 1440px) / 2));
    padding-right: max(24px, calc((100vw - 1440px) / 2));
    position: sticky;
    top: 0;
    z-index: 100;
}

body.profile-garage .brand {
    align-items: center;
    color: var(--ui-ink);
    display: inline-flex;
    font-size: 1rem;
    font-weight: 900;
    gap: 10px;
    letter-spacing: -.02em;
}

body.profile-garage .brand::before {
    background: linear-gradient(135deg, #5368ef, #7657da);
    border-radius: 10px;
    box-shadow: 0 7px 18px rgba(83, 104, 239, .26);
    content: "F";
    color: #fff;
    display: grid;
    font-size: .76rem;
    height: 31px;
    letter-spacing: 0;
    place-items: center;
    width: 31px;
}

body.profile-garage .app-nav {
    align-items: center;
    gap: 4px;
}

body.profile-garage .app-nav a {
    border-radius: 10px;
    color: #5c6e88;
    font-weight: 650;
    padding: 10px 12px;
    position: relative;
    transition: background-color .18s ease, color .18s ease, transform .18s ease;
}

body.profile-garage .app-nav a:hover {
    background: #edf1fb;
    color: #304a89;
    transform: translateY(-1px);
}

body.profile-garage .app-nav a::after {
    background: linear-gradient(90deg, #5368ef, #8b63e7);
    border-radius: 999px;
    bottom: 4px;
    content: "";
    height: 2px;
    left: 50%;
    position: absolute;
    transform: translateX(-50%) scaleX(0);
    transition: transform .18s ease;
    width: calc(100% - 24px);
}

body.profile-garage .app-nav a:hover::after { transform: translateX(-50%) scaleX(1); }

body.profile-garage .icon-action {
    background: #edf2f9;
    border: 1px solid #dfe7f1;
    border-radius: 11px;
    box-shadow: none;
    color: #263a58;
    min-height: 42px;
    padding: 0 16px;
}

body.profile-garage .icon-action:hover {
    background: #17243a;
    border-color: #17243a;
    color: #fff;
}

body.profile-garage .calls-nav-badge {
    background: linear-gradient(135deg, #ef6374, #d9465f);
    border: 2px solid #fff;
    box-shadow: 0 4px 11px rgba(217, 70, 95, .28);
}

body.profile-garage .app-shell {
    animation: garage-page-in .34s cubic-bezier(.2, .75, .25, 1);
    max-width: 1280px;
    padding: 34px 28px 56px;
    width: 100%;
}

body.profile-garage .page-intro,
body.profile-garage .lead-hero,
body.profile-garage .customer-hero,
body.profile-garage .engineer-hero,
body.profile-garage .engineer-lead-hero,
body.profile-garage .manual-lead-intro,
body.profile-garage .calls-page-intro,
body.profile-garage .chat-page-heading {
    background:
        radial-gradient(circle at 88% 12%, rgba(255, 255, 255, .2), transparent 27%),
        linear-gradient(125deg, #17233a 0%, #304a89 58%, #656ded 100%);
    border: 0;
    border-radius: 24px;
    box-shadow: 0 20px 48px rgba(24, 42, 78, .17);
    color: #fff;
    margin-bottom: 20px;
    min-height: 140px;
    overflow: hidden;
    padding: 27px 32px;
    position: relative;
}

body.profile-garage .page-intro::after,
body.profile-garage .lead-hero::after,
body.profile-garage .customer-hero::after,
body.profile-garage .engineer-hero::after,
body.profile-garage .engineer-lead-hero::after,
body.profile-garage .manual-lead-intro::after,
body.profile-garage .calls-page-intro::after,
body.profile-garage .chat-page-heading::after {
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 50%;
    content: "";
    height: 190px;
    pointer-events: none;
    position: absolute;
    right: -38px;
    top: -72px;
    width: 190px;
}

body.profile-garage .page-intro > *,
body.profile-garage .lead-hero > *,
body.profile-garage .customer-hero > *,
body.profile-garage .engineer-hero > *,
body.profile-garage .engineer-lead-hero > *,
body.profile-garage .manual-lead-intro > *,
body.profile-garage .calls-page-intro > *,
body.profile-garage .chat-page-heading > * { position: relative; z-index: 1; }

body.profile-garage :is(.page-intro, .lead-hero, .customer-hero, .engineer-hero, .engineer-lead-hero, .manual-lead-intro, .calls-page-intro, .chat-page-heading) h1,
body.profile-garage :is(.page-intro, .lead-hero, .customer-hero, .engineer-hero, .engineer-lead-hero, .manual-lead-intro, .calls-page-intro, .chat-page-heading) h2 { color: #fff; letter-spacing: -.03em; }

body.profile-garage :is(.page-intro, .lead-hero, .customer-hero, .engineer-hero, .engineer-lead-hero, .manual-lead-intro, .calls-page-intro, .chat-page-heading) p,
body.profile-garage :is(.page-intro, .lead-hero, .customer-hero, .engineer-hero, .engineer-lead-hero, .manual-lead-intro, .calls-page-intro, .chat-page-heading) span,
body.profile-garage :is(.page-intro, .lead-hero, .customer-hero, .engineer-hero, .engineer-lead-hero, .manual-lead-intro, .calls-page-intro, .chat-page-heading) .eyebrow { color: rgba(255, 255, 255, .78); }

body.profile-garage :is(.page-intro, .lead-hero, .customer-hero, .engineer-hero, .engineer-lead-hero, .manual-lead-intro, .calls-page-intro, .chat-page-heading) a:not(.primary-link) { color: #fff; }

/* Customer summary desktop fix v1 */
body.profile-garage .customer-summary {
    min-width: 0;
    width: min(500px, 100%);
}

body.profile-garage .customer-summary span {
    background: rgba(255, 255, 255, .94);
    border-color: rgba(255, 255, 255, .48);
    color: #5f6f88;
}

body.profile-garage .customer-summary b {
    color: #17233a;
}

@media (min-width: 720px) {
    body.profile-garage .customer-hero-head {
        align-items: center;
    }

    body.profile-garage .customer-hero-head > :first-child {
        min-width: 0;
    }

    body.profile-garage .customer-summary {
        display: flex;
    }

    body.profile-garage .customer-summary > span {
        flex: 1 1 0;
        min-width: 0;
    }
}

@media (max-width: 719px) {
    body.profile-garage .customer-hero-head {
        justify-content: stretch;
    }
}

body.profile-garage .eyebrow {
    color: #64779a;
    font-size: .7rem;
    font-weight: 900;
    letter-spacing: .075em;
}

body.profile-garage .primary-link,
body.profile-garage .open-link,
body.profile-garage button:not(.icon-action):not(.lead-comment-copy-button),
body.profile-garage input[type="submit"] {
    background: linear-gradient(135deg, #455fe8, #6173f2);
    border: 0;
    border-radius: 11px;
    box-shadow: 0 8px 20px rgba(69, 95, 232, .2);
    color: #fff;
    font-weight: 800;
    transition: box-shadow .18s ease, filter .18s ease, transform .18s ease;
}

body.profile-garage .primary-link:hover,
body.profile-garage .open-link:hover,
body.profile-garage button:not(.icon-action):not(.lead-comment-copy-button):hover,
body.profile-garage input[type="submit"]:hover {
    box-shadow: 0 12px 27px rgba(69, 95, 232, .29);
    filter: saturate(1.08);
    transform: translateY(-1px);
}

body.profile-garage :is(button, a, input, select, textarea, summary):focus-visible {
    outline: 3px solid rgba(83, 104, 239, .27);
    outline-offset: 3px;
}

body.profile-garage :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
    background: #fff;
    border: 1px solid #d6e0ed;
    border-radius: 11px;
    box-shadow: 0 1px 2px rgba(19, 34, 56, .025);
    color: var(--ui-ink);
    min-height: 44px;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

body.profile-garage :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea):hover { border-color: #b8c7da; }
body.profile-garage :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea):focus {
    border-color: #7182ee;
    box-shadow: 0 0 0 4px rgba(83, 104, 239, .11);
}

body.profile-garage :is(.record-panel, .dashboard-inbox, .attention-panel, .lead-card, .empty-state, .queue-panel, .source-panel, .analytics-panel, .history-panel, .owner-panel, .locked-panel, .system-panel, .system-backup-panel, .customer-history-panel, .customer-profile-panel, .customer-leads-panel, .customer-tasks-panel, .lead-data-panel, .lead-tasks-panel, .production-panel, .production-comments-panel, .production-files-panel) {
    background: var(--ui-panel);
    border: 1px solid var(--ui-line);
    border-radius: var(--ui-radius-lg);
    box-shadow: var(--ui-shadow);
}

body.profile-garage :is(.record-panel, .dashboard-inbox, .attention-panel, .lead-card, .empty-state, .queue-panel, .source-panel, .analytics-panel, .history-panel, .customer-history-panel, .customer-profile-panel, .customer-leads-panel, .customer-tasks-panel, .lead-data-panel, .lead-tasks-panel, .production-panel, .production-comments-panel, .production-files-panel) {
    transition: border-color .2s ease, box-shadow .22s ease, transform .22s ease;
}

body.profile-garage :is(.lead-card, .attention-card, .queue-lead, .work-mini-card, .work-lead-card, .engineer-job-card, .customer-lead-card):hover {
    border-color: rgba(83, 104, 239, .34);
    box-shadow: var(--ui-shadow-hover);
    transform: translateY(-3px);
}

body.profile-garage .impersonation-panel {
    background: linear-gradient(125deg, #fff, #f4f6ff);
    border-color: #d9e1f2;
    overflow: hidden;
    position: relative;
}

body.profile-garage .impersonation-panel::before {
    background: linear-gradient(180deg, #5368ef, #9a5ce5);
    bottom: 0;
    content: "";
    left: 0;
    position: absolute;
    top: 0;
    width: 4px;
}

body.profile-garage .dashboard-inbox-clear {
    background:
        radial-gradient(circle at 88% 12%, rgba(255, 255, 255, .2), transparent 27%),
        linear-gradient(125deg, #17233a 0%, #304a89 58%, #656ded 100%);
}

body.profile-garage .dashboard-inbox {
    background:
        radial-gradient(circle at 88% 12%, rgba(255, 255, 255, .2), transparent 27%),
        linear-gradient(125deg, #17233a 0%, #304a89 58%, #656ded 100%);
    border: 0;
    box-shadow: 0 20px 48px rgba(24, 42, 78, .17);
    color: #fff;
    min-height: 142px;
    overflow: hidden;
    padding: 27px 32px;
    position: relative;
}

body.profile-garage .dashboard-inbox::after {
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 50%;
    content: "";
    height: 190px;
    pointer-events: none;
    position: absolute;
    right: -38px;
    top: -72px;
    width: 190px;
}

body.profile-garage .dashboard-inbox > * { position: relative; z-index: 1; }
body.profile-garage .dashboard-inbox .inbox-head :is(h1, h2) { color: #fff; letter-spacing: -.03em; }
body.profile-garage .dashboard-inbox .inbox-head :is(p, .eyebrow) { color: rgba(255, 255, 255, .78); }
body.profile-garage .dashboard-inbox .primary-link {
    background: #fff;
    box-shadow: 0 9px 24px rgba(13, 26, 52, .17);
    color: #1d3150;
}

body.profile-garage .attention-panel { border-color: #efdbc6; }
body.profile-garage .attention-card-rich {
    background: linear-gradient(135deg, #f7f9fd, #f2f5fb);
    border: 1px solid #e1e7f0;
    border-left: 3px solid var(--ui-amber);
    border-radius: 14px;
}

body.profile-garage .attention-badge {
    border: 0;
    box-shadow: inset 0 0 0 1px rgba(190, 93, 93, .12);
}

body.profile-garage .lead-counters,
body.profile-garage .engineer-summary,
body.profile-garage .system-kpi-grid {
    gap: 12px;
}

body.profile-garage .lead-counters > *,
body.profile-garage .engineer-summary > *,
body.profile-garage .system-kpi {
    background: rgba(255, 255, 255, .95);
    border: 1px solid var(--ui-line);
    border-radius: 16px;
    box-shadow: 0 9px 26px rgba(31, 51, 83, .055);
    overflow: hidden;
    position: relative;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

body.profile-garage .lead-counters > *::before,
body.profile-garage .engineer-summary > *::before,
body.profile-garage .system-kpi::before {
    background: linear-gradient(90deg, #5368ef, #28a9d8);
    content: "";
    height: 3px;
    left: 0;
    opacity: .8;
    position: absolute;
    right: 0;
    top: 0;
}

body.profile-garage .lead-counters > *:hover,
body.profile-garage .engineer-summary > *:hover {
    border-color: rgba(83, 104, 239, .32);
    box-shadow: 0 15px 34px rgba(31, 51, 83, .11);
    transform: translateY(-2px);
}

body.profile-garage .dashboard-actions,
body.profile-garage .status-chips,
body.profile-garage .work-tabs,
body.profile-garage .calls-tabs,
body.profile-garage .chat-channel-tabs,
body.profile-garage .chat-status-tabs,
body.profile-garage .chat-lifecycle-tabs {
    background: #e9eef7;
    border: 1px solid #d8e1ee;
    border-radius: 16px;
    gap: 5px;
    padding: 5px;
}

body.profile-garage :is(.dashboard-actions, .status-chips, .work-tabs, .calls-tabs, .chat-channel-tabs, .chat-status-tabs, .chat-lifecycle-tabs) a,
body.profile-garage :is(.chat-channel-tab, .chat-filter-pill) {
    background: transparent;
    border: 0;
    border-radius: 11px;
    box-shadow: none;
    color: #5b6d87;
    transition: background .18s ease, box-shadow .18s ease, color .18s ease, transform .18s ease;
}

body.profile-garage :is(.dashboard-actions, .status-chips, .work-tabs, .calls-tabs, .chat-channel-tabs, .chat-status-tabs, .chat-lifecycle-tabs) a:hover,
body.profile-garage :is(.chat-channel-tab, .chat-filter-pill):hover {
    background: rgba(255, 255, 255, .72);
    color: var(--ui-ink);
    transform: translateY(-1px);
}

body.profile-garage :is(.dashboard-actions, .status-chips, .work-tabs, .calls-tabs, .chat-channel-tabs, .chat-status-tabs, .chat-lifecycle-tabs) .is-active,
body.profile-garage :is(.chat-channel-tab, .chat-filter-pill).is-active {
    background: #fff;
    box-shadow: 0 5px 17px rgba(31, 51, 83, .1);
    color: #243957;
}

body.profile-garage .lead-card {
    border-left: 3px solid #cbd6e6;
    overflow: hidden;
}
body.profile-garage .lead-card.status-new,
body.profile-garage .lead-card.new-age-ok { border-left-color: var(--ui-green); }
body.profile-garage .lead-card.new-age-warn { border-left-color: var(--ui-amber); }
body.profile-garage .lead-card.new-age-danger { border-left-color: var(--ui-rose); }

body.profile-garage .lead-topline {
    border-bottom: 1px solid #e8edf4;
    padding-bottom: 10px;
}

body.profile-garage .spb-zpi-card-rail,
body.profile-garage .lead-static-summary,
body.profile-garage .customer-lead-fields > div,
body.profile-garage .customer-profile-grid > div,
body.profile-garage .call-facts > div,
body.profile-garage .stage-facts > div {
    background: var(--ui-panel-soft);
    border-color: #e4eaf2;
    border-radius: 12px;
}

body.profile-garage .status-pill,
body.profile-garage .new-lead-age,
body.profile-garage .lead-card-meta-chips span,
body.profile-garage .task-type-label {
    border-radius: 999px;
    font-weight: 850;
    letter-spacing: .015em;
}

body.profile-garage .queue-head,
body.profile-garage .section-head,
body.profile-garage .task-section-head,
body.profile-garage .customer-section-head,
body.profile-garage .panel-headline {
    border-bottom-color: #e7edf5;
    padding-bottom: 14px;
}

body.profile-garage .task-card,
body.profile-garage .dashboard-task-item,
body.profile-garage .queue-lead,
body.profile-garage .work-mini-card,
body.profile-garage .engineer-job-card,
body.profile-garage .customer-lead-card,
body.profile-garage .phone-history-card {
    background: linear-gradient(135deg, #fff, #f9fbfe);
    border: 1px solid #e1e8f1;
    border-radius: 14px;
    box-shadow: 0 7px 20px rgba(31, 51, 83, .045);
}

body.profile-garage .task-card { border-left: 3px solid #7384eb; }
body.profile-garage .task-card.is-overdue,
body.profile-garage .dashboard-task-item.is-overdue { border-left-color: var(--ui-rose); }

body.profile-garage .work-board,
body.profile-garage .dashboard-queues,
body.profile-garage .task-groups,
body.profile-garage .dashboard-task-groups,
body.profile-garage .engineer-job-grid {
    gap: 16px;
}

body.profile-garage .settings-section-title {
    align-items: end;
    display: flex;
    justify-content: space-between;
    margin: 28px 0 12px;
}

body.profile-garage .directory-grid { gap: 14px; }
body.profile-garage .directory-grid a,
body.profile-garage .directory-card,
body.profile-garage .settings-create {
    background: linear-gradient(135deg, #fff, #f8faff);
    border: 1px solid var(--ui-line);
    border-radius: 16px;
    box-shadow: 0 10px 28px rgba(31, 51, 83, .06);
    transition: border-color .18s ease, box-shadow .2s ease, transform .2s ease;
}

body.profile-garage .directory-grid a:hover,
body.profile-garage .directory-card:hover {
    border-color: rgba(83, 104, 239, .32);
    box-shadow: 0 16px 36px rgba(31, 51, 83, .11);
    transform: translateY(-3px);
}

body.profile-garage .settings-create > summary,
body.profile-garage details > summary {
    border-radius: 12px;
    transition: background .18s ease, color .18s ease;
}
body.profile-garage details > summary:hover { background: #f0f3fb; color: #304a89; }

body.profile-garage .records-table,
body.profile-garage .backup-table,
body.profile-garage .report-table {
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
}

body.profile-garage :is(.records-table, .backup-table, .report-table) th {
    background: #f4f7fb;
    color: #667894;
    font-size: .69rem;
    letter-spacing: .055em;
    text-transform: uppercase;
}

body.profile-garage :is(.records-table, .backup-table, .report-table) td {
    border-bottom-color: #e8edf4;
    transition: background .16s ease;
}
body.profile-garage :is(.records-table, .backup-table, .report-table) tr:hover td { background: #f8faff; }

body.profile-garage .calls-quick-search,
body.profile-garage .lead-search,
body.profile-garage .deleted-search,
body.profile-garage .chat-controls {
    background: rgba(255, 255, 255, .88);
    border: 1px solid var(--ui-line);
    border-radius: 17px;
    box-shadow: 0 10px 30px rgba(31, 51, 83, .055);
    padding: 12px;
}

body.profile-garage .call-card {
    background: #fff;
    border: 1px solid var(--ui-line);
    border-left: 3px solid var(--ui-cyan);
    border-radius: 18px;
    box-shadow: var(--ui-shadow);
    overflow: hidden;
    transition: border-color .2s ease, box-shadow .22s ease, transform .22s ease;
}
body.profile-garage .call-card:hover {
    border-color: rgba(40, 169, 216, .38);
    box-shadow: var(--ui-shadow-hover);
    transform: translateY(-2px);
}
body.profile-garage .call-card.is-historical { border-left-color: #a9b6c8; opacity: .92; }

body.profile-garage .call-card-header,
body.profile-garage .call-card-actions { background: #f8faff; border-color: #e7edf5; }

body.profile-garage .chat-workspace {
    background: rgba(255, 255, 255, .96);
    border: 1px solid var(--ui-line);
    border-radius: 22px;
    box-shadow: 0 18px 44px rgba(31, 51, 83, .09);
    overflow: hidden;
}

body.profile-garage .chat-sidebar { background: #f7f9fc; border-color: #e2e8f1; }
body.profile-garage .chat-sidebar-heading,
body.profile-garage .chat-thread-header,
body.profile-garage .chat-thread-actions,
body.profile-garage .chat-composer { background: rgba(255, 255, 255, .94); border-color: #e4eaf2; }

body.profile-garage .chat-preview {
    border-left: 3px solid transparent;
    transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
body.profile-garage .chat-preview:hover { background: #edf2fa; transform: translateX(2px); }
body.profile-garage .chat-preview.is-active { background: #e9effd; border-left-color: var(--ui-indigo); }

body.profile-garage .chat-transcript {
    background:
        radial-gradient(circle at 10% 10%, rgba(83, 104, 239, .045), transparent 18rem),
        #f4f7fb;
}

body.profile-garage .chat-message-card {
    border-radius: 16px;
    box-shadow: 0 6px 18px rgba(31, 51, 83, .045);
}

body.profile-garage .chat-message-row.is-manager .chat-message-card,
body.profile-garage .chat-message-row.is-outbound .chat-message-card {
    background: linear-gradient(135deg, #eaf2ff, #edf0ff);
    border-color: #ccdafa;
}

body.profile-garage .chat-live-dot,
body.profile-garage .report-hero-status > span {
    animation: garage-status-pulse 2.2s ease-in-out infinite;
}

body.profile-garage .notice,
body.profile-garage .flash,
body.profile-garage .chat-notice {
    border: 0;
    border-left: 4px solid currentColor;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(31, 51, 83, .06);
    padding: 14px 16px;
}

body.profile-garage .empty-state {
    background:
        radial-gradient(circle at 92% 0, rgba(83, 104, 239, .07), transparent 30%),
        #fff;
    padding: 28px;
}

body.profile-garage .pagination,
body.profile-garage .lead-pagination,
body.profile-garage .chat-pagination { gap: 6px; }
body.profile-garage :is(.pagination, .lead-pagination, .chat-pagination) a {
    background: #fff;
    border: 1px solid var(--ui-line);
    border-radius: 10px;
    box-shadow: 0 4px 13px rgba(31, 51, 83, .045);
}

body.profile-garage .danger-button,
body.profile-garage .chat-action-dismiss,
body.profile-garage .delete-lead-form button {
    background: linear-gradient(135deg, #df5368, #c83f58) !important;
    box-shadow: 0 8px 20px rgba(207, 65, 89, .2) !important;
}

body.profile-garage .secondary-link,
body.profile-garage .button-dark,
body.profile-garage .secondary-actions button,
body.profile-garage .search-actions a {
    background: #edf2f8;
    border: 1px solid #dce5ef;
    border-radius: 10px;
    box-shadow: none;
    color: #40536f;
}

body.profile-garage .report-page-modern { animation: none; }
body.profile-garage .report-panel,
body.profile-garage .report-kpis-modern article,
body.profile-garage .report-toolbar-modern { backdrop-filter: blur(8px); }

body.page-login {
    background:
        radial-gradient(circle at 16% 15%, rgba(108, 118, 239, .34), transparent 28rem),
        radial-gradient(circle at 86% 82%, rgba(40, 169, 216, .2), transparent 30rem),
        linear-gradient(135deg, #111c31 0%, #263d70 56%, #4d5fd0 100%);
}

body.page-login .login-shell { position: relative; }
body.page-login .login-shell::before,
body.page-login .login-shell::after {
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 50%;
    content: "";
    pointer-events: none;
    position: fixed;
}
body.page-login .login-shell::before { height: 360px; right: -110px; top: -140px; width: 360px; }
body.page-login .login-shell::after { bottom: -170px; height: 420px; left: -130px; width: 420px; }

body.page-login .login-panel {
    animation: garage-page-in .45s cubic-bezier(.2, .75, .25, 1) both;
    backdrop-filter: blur(18px) saturate(130%);
    background: rgba(255, 255, 255, .94);
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: 26px;
    box-shadow: 0 30px 80px rgba(5, 16, 38, .3);
    position: relative;
    z-index: 1;
}

body.page-login .login-copy {
    align-content: center;
    display: grid;
}
body.page-login .login-logo {
    border-radius: 18px;
    box-shadow: 0 14px 34px rgba(31, 51, 83, .14);
    max-height: 92px;
}
body.page-login .login-copy h1 { color: #14233a; letter-spacing: -.035em; }
body.page-login .login-form {
    background: linear-gradient(135deg, #f5f7fd, #eef2fb);
    border: 1px solid #dfe6f1;
    border-radius: 18px;
    padding: 22px;
}
body.page-login .login-form input {
    background: #fff;
    border: 1px solid #d4deeb;
    border-radius: 11px;
    box-shadow: 0 1px 2px rgba(19, 34, 56, .03);
}
body.page-login .login-form input:focus {
    border-color: #7182ee;
    box-shadow: 0 0 0 4px rgba(83, 104, 239, .11);
    outline: 0;
}
body.page-login .login-form button {
    background: linear-gradient(135deg, #455fe8, #7359dd);
    border: 0;
    border-radius: 11px;
    box-shadow: 0 10px 24px rgba(69, 95, 232, .25);
    color: #fff;
    font-weight: 850;
    transition: box-shadow .18s ease, transform .18s ease;
}
body.page-login .login-form button:hover { box-shadow: 0 14px 30px rgba(69, 95, 232, .34); transform: translateY(-1px); }

@keyframes garage-page-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes garage-status-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 180, 128, .28); }
    50% { box-shadow: 0 0 0 7px rgba(34, 180, 128, 0); }
}

@media (max-width: 900px) {
    body.profile-garage .app-header {
        padding-left: 18px;
        padding-right: 18px;
    }

    body.profile-garage .app-shell { padding: 24px 18px 44px; }
}

@media (max-width: 719px) {
    body.profile-garage .app-header {
        align-items: center;
        display: grid;
        gap: 10px;
        grid-template-columns: minmax(0, 1fr) auto;
        padding: 12px 14px;
    }

    body.profile-garage .brand::before { height: 28px; width: 28px; }
    body.profile-garage .app-nav {
        display: flex;
        gap: 4px;
        grid-column: 1 / -1;
        overflow-x: auto;
        padding: 2px 0 5px;
        scrollbar-width: none;
    }
    body.profile-garage .app-nav::-webkit-scrollbar { display: none; }
    body.profile-garage .app-nav a { flex: 0 0 auto; padding: 8px 10px; }
    body.profile-garage .app-shell { padding: 18px 12px 38px; }

    body.profile-garage .page-intro,
    body.profile-garage .lead-hero,
    body.profile-garage .customer-hero,
    body.profile-garage .engineer-hero,
    body.profile-garage .engineer-lead-hero,
    body.profile-garage .manual-lead-intro,
    body.profile-garage .calls-page-intro,
    body.profile-garage .chat-page-heading {
        align-items: flex-start;
        border-radius: 18px;
        min-height: 0;
        padding: 22px 19px;
    }

    body.profile-garage :is(.page-intro, .lead-hero, .customer-hero, .engineer-hero, .engineer-lead-hero, .manual-lead-intro, .calls-page-intro, .chat-page-heading) h1 { font-size: clamp(1.8rem, 9vw, 2.35rem); }

    body.profile-garage .dashboard-actions,
    body.profile-garage .status-chips,
    body.profile-garage .work-tabs,
    body.profile-garage .calls-tabs,
    body.profile-garage .chat-channel-tabs,
    body.profile-garage .chat-status-tabs,
    body.profile-garage .chat-lifecycle-tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow: visible;
    }

    body.profile-garage :is(.dashboard-actions, .status-chips, .work-tabs, .calls-tabs, .chat-channel-tabs, .chat-status-tabs, .chat-lifecycle-tabs) > * {
        justify-content: center;
        min-width: 0;
        text-align: center;
        width: 100%;
    }

    body.profile-garage :is(.record-panel, .dashboard-inbox, .attention-panel, .lead-card, .empty-state, .queue-panel, .source-panel, .analytics-panel, .history-panel, .owner-panel, .locked-panel, .system-panel, .system-backup-panel, .customer-history-panel, .customer-profile-panel, .customer-leads-panel, .customer-tasks-panel, .lead-data-panel, .lead-tasks-panel, .production-panel, .production-comments-panel, .production-files-panel) {
        border-radius: 17px;
    }

    body.profile-garage .chat-workspace { border-radius: 17px; }
    body.profile-garage .directory-grid { grid-template-columns: minmax(0, 1fr); }
    body.page-login .login-panel { border-radius: 20px; padding: 20px; }
    body.page-login .login-form { padding: 17px; }
}

@media (prefers-reduced-motion: reduce) {
    body.profile-garage .app-shell,
    body.profile-garage .chat-live-dot,
    body.profile-garage .report-hero-status > span { animation: none; }
    body.profile-garage *,
    body.profile-garage *::before,
    body.profile-garage *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

/* Garage CRM mobile density and quiet status system v1 */
body.profile-garage .calls-nav-badge {
    background: #fff1f3;
    border: 1px solid #f3cbd1;
    border-radius: 999px;
    box-shadow: none;
    color: #b33e52;
    font-size: .66rem;
    font-weight: 850;
    line-height: 1;
    min-width: 20px;
    padding: 3px 5px;
    text-align: center;
}

body.profile-garage .calls-tabs b,
body.profile-garage .dashboard-task-group-head span,
body.profile-garage .task-group-head > span {
    background: #f6f8fb;
    border: 1px solid #e2e8f0;
    box-shadow: none;
    color: #65758c;
    font-size: .68rem;
    font-weight: 800;
    min-width: 22px;
    padding: 3px 6px;
}

body.profile-garage .calls-tabs .is-active b {
    background: #eef1ff;
    border-color: #d9defa;
    color: #4659c9;
}

body.profile-garage .call-statuses .status-pill {
    background: #fff;
    border: 1px solid #dfe6ef;
    box-shadow: none;
    color: #57677d;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .025em;
    min-height: 0;
    padding: 6px 10px;
}

body.profile-garage .call-statuses .status-unreviewed {
    background: #fffaf4;
    border-color: #efd8bd;
    color: #9b5c18;
}

body.profile-garage .call-statuses .status-taken {
    background: #f6f8ff;
    border-color: #d8dff5;
    color: #4d5f9d;
}

body.profile-garage .call-statuses .call-business-answered {
    background: #f4fbf7;
    border-color: #cce8d8;
    color: #347557;
}

body.profile-garage .call-statuses .call-business-missed {
    background: #fff7f8;
    border-color: #efcfd5;
    color: #a34859;
}

body.profile-garage .call-primary {
    background: linear-gradient(135deg, #f8fafc, #f4f7fb);
    border-color: #e1e8f1;
    border-radius: 13px;
}

body.profile-garage .call-facts div {
    background: #fafbfd;
    border-color: #e5eaf1;
}

body.profile-garage .attention-panel {
    border-color: #e4e9f0;
    padding: 18px;
}

body.profile-garage .attention-panel .queue-head {
    border-bottom: 0;
    padding-bottom: 4px;
}

body.profile-garage .attention-list-rich { margin-top: 10px; }

body.profile-garage .attention-card-rich,
body.profile-garage .attention-card-rich.attention-danger,
body.profile-garage .attention-card-rich.attention-critical,
body.profile-garage .attention-card-rich.attention-warn {
    background: #fff;
    border-color: #e1e7ef;
    border-left-color: #dba04e;
    border-left-width: 3px;
    box-shadow: 0 6px 18px rgba(31, 51, 83, .04);
}

body.profile-garage .attention-card-rich.attention-danger,
body.profile-garage .attention-card-rich.attention-critical { border-left-color: #c95a6b; }

body.profile-garage .attention-badge,
body.profile-garage .attention-badge-danger,
body.profile-garage .attention-badge-critical,
body.profile-garage .attention-badge-warn {
    background: #fff;
    border: 1px solid #dfe5ed;
    box-shadow: none;
    color: #65758b;
    font-size: .68rem;
    font-weight: 800;
    min-height: 0;
    padding: 6px 9px;
}

body.profile-garage .attention-badge-danger,
body.profile-garage .attention-badge-critical {
    background: #fff8f9;
    border-color: #efcdd3;
    color: #a94758;
}

body.profile-garage .attention-badge-warn {
    background: #fffbf4;
    border-color: #eddcc1;
    color: #936326;
}

body.profile-garage .attention-details,
body.profile-garage .attention-card-rich.attention-danger .attention-details,
body.profile-garage .attention-card-rich.attention-critical .attention-details,
body.profile-garage .attention-card-rich.attention-warn .attention-details {
    background: #f7f9fc;
    border: 1px solid #e8edf3;
    border-radius: 10px;
    color: #4b5d75;
    font-weight: 700;
    padding: 8px 10px;
}

body.profile-garage .dashboard-task-group {
    background: #fff;
    border: 1px solid #e0e7f0;
    border-left: 3px solid #7183e8;
    border-radius: 15px;
    gap: 9px;
    padding: 14px;
}

body.profile-garage .dashboard-task-group-overdue { border-left-color: #c95668; }
body.profile-garage .dashboard-task-group-unassigned { border-left-color: #d29a42; }
body.profile-garage .dashboard-task-group-tomorrow,
body.profile-garage .dashboard-task-group-later { border-left-color: #8492a6; }

body.profile-garage .dashboard-task-list {
    background: #fafbfd;
    border: 1px solid #e8edf3;
    border-radius: 11px;
    overflow: hidden;
    padding: 0 12px;
}

body.profile-garage .dashboard-task-item {
    background: transparent;
    border: 0;
    border-bottom: 1px solid #e7ecf2;
    border-radius: 0;
    box-shadow: none;
    padding: 12px 0;
    transform: none;
}

body.profile-garage .dashboard-task-item:last-child { border-bottom: 0; }
body.profile-garage .dashboard-task-item:hover {
    background: transparent;
    border-color: #e7ecf2;
    box-shadow: none;
    transform: none;
}

body.profile-garage .dashboard-task-item strong { line-height: 1.24; }
body.profile-garage .dashboard-task-item-main small { line-height: 1.35; }

@media (max-width: 719px) {
    body.profile-garage .app-header {
        gap: 9px 12px;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: auto auto;
        padding: 12px 14px 10px;
    }

    body.profile-garage .brand {
        grid-column: 1;
        grid-row: 1;
        min-width: 0;
    }

    body.profile-garage .app-header > form {
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
        margin: 0;
    }

    body.profile-garage .app-header .icon-action {
        font-size: .76rem;
        min-height: 36px;
        padding: 0 11px;
    }

    body.profile-garage .app-nav {
        grid-column: 1 / -1;
        grid-row: 2;
        margin: 0 -2px;
        max-width: calc(100vw - 28px);
        padding: 1px 2px 4px;
        scroll-snap-type: x proximity;
        white-space: nowrap;
    }

    body.profile-garage .app-nav a {
        font-size: .78rem;
        min-height: 34px;
        padding: 7px 9px;
        scroll-snap-align: start;
    }

    body.profile-garage .brand::before { border-radius: 9px; height: 28px; width: 28px; }
    body.profile-garage .brand span { font-size: .9rem; white-space: nowrap; }

    body.profile-garage .app-shell { padding: 14px 12px 34px; }

    body.profile-garage .dashboard-inbox,
    body.profile-garage .page-intro,
    body.profile-garage .lead-hero,
    body.profile-garage .customer-hero,
    body.profile-garage .engineer-hero,
    body.profile-garage .engineer-lead-hero,
    body.profile-garage .manual-lead-intro,
    body.profile-garage .calls-page-intro,
    body.profile-garage .chat-page-heading {
        border-radius: 17px;
        margin-bottom: 14px;
        padding: 20px 18px;
    }

    body.profile-garage .dashboard-inbox { min-height: 0; }
    body.profile-garage .calls-page-intro { gap: 15px; }
    body.profile-garage .calls-quick-search { padding: 10px; width: 100%; }
    body.profile-garage .calls-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    body.profile-garage .call-list { gap: 10px; }
    body.profile-garage .call-card { gap: 11px; padding: 14px; }
    body.profile-garage .call-card-header { gap: 10px; }
    body.profile-garage .call-statuses { gap: 5px; }
    body.profile-garage .call-card-body { gap: 10px; }
    body.profile-garage .call-primary { gap: 7px; padding: 12px; }
    body.profile-garage .call-facts { gap: 7px; }
    body.profile-garage .call-facts div { padding: 10px 11px; }

    body.profile-garage .attention-panel { padding: 15px; }
    body.profile-garage .attention-list-rich { margin-top: 8px; }
    body.profile-garage .attention-card-rich { padding: 13px; }
    body.profile-garage .attention-main { gap: 8px; }
    body.profile-garage .attention-title-row { gap: 8px; }
    body.profile-garage .attention-phone,
    body.profile-garage .attention-meta,
    body.profile-garage .attention-date { font-size: .82rem; line-height: 1.35; }

    body.profile-garage .dashboard-task-panel { gap: 11px; padding: 15px; }
    body.profile-garage .dashboard-task-groups { gap: 10px; }
    body.profile-garage .dashboard-task-group { padding: 12px; }
    body.profile-garage .dashboard-task-list { padding: 0 10px; }
    body.profile-garage .dashboard-task-item { gap: 5px; padding: 11px 0; }
}

/* Garage CRM compact lead-detail density and motion v1 */
body.profile-garage .lead-data-panel {
    overflow: hidden;
}

body.profile-garage .lead-data-edit-fields {
    gap: 7px;
}

body.profile-garage .lead-data-edit-fields .inline-field {
    background: #f8fafc;
    border-color: #e2e8f1;
    border-radius: 12px;
    transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

body.profile-garage .lead-data-edit-fields .inline-field:hover {
    background: #fff;
    border-color: rgba(69, 95, 232, .28);
    box-shadow: 0 7px 20px rgba(31, 51, 83, .055);
    transform: translateX(2px);
}

body.profile-garage .lead-data-edit-fields .lead-next-action-field {
    background: linear-gradient(135deg, #fffaf2, #fff);
    border-left: 3px solid var(--ui-amber);
}

body.profile-garage .lead-data-edit-fields .inline-field[open] {
    background: #fff;
    border-color: rgba(69, 95, 232, .28);
    box-shadow: 0 10px 28px rgba(31, 51, 83, .075);
}

body.profile-garage .lead-data-edit-fields .inline-field[open] > form {
    animation: garage-details-in .2s ease both;
}

body.profile-garage .lead-edit-icon svg {
    fill: none;
    pointer-events: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

body.profile-garage .lead-data-edit-fields .lead-details-field {
    background: linear-gradient(135deg, #f7f9ff 0%, #fbfdff 100%);
    border-color: rgba(88, 111, 232, .22);
}

body.profile-garage .lead-data-edit-fields .lead-details-summary {
    gap: 7px;
}

body.profile-garage .lead-data-edit-fields .lead-details-value {
    background: rgba(255, 255, 255, .78);
    border-left: 3px solid rgba(69, 95, 232, .7);
    border-radius: 8px;
    color: var(--ui-ink);
    font-size: .95rem;
    font-weight: 760;
    line-height: 1.35;
    min-width: 0;
    overflow-wrap: anywhere;
    padding: 8px 10px;
    white-space: pre-line;
}

body.profile-garage .lead-data-edit-fields .lead-details-value.is-empty {
    border-left-color: #cbd5e1;
    color: var(--ui-muted);
    font-weight: 650;
}

body.profile-garage :is(
    .lead-list > .lead-card,
    .attention-list > .attention-card,
    .call-list > .call-card,
    .directory-grid > *,
    .task-list > .task-card,
    .chat-preview-list > .chat-preview
) {
    animation: garage-card-in .38s cubic-bezier(.2, .75, .25, 1) both;
}

body.profile-garage :is(
    .lead-list > .lead-card,
    .attention-list > .attention-card,
    .call-list > .call-card,
    .directory-grid > *,
    .task-list > .task-card,
    .chat-preview-list > .chat-preview
):nth-child(2) { animation-delay: 35ms; }

body.profile-garage :is(
    .lead-list > .lead-card,
    .attention-list > .attention-card,
    .call-list > .call-card,
    .directory-grid > *,
    .task-list > .task-card,
    .chat-preview-list > .chat-preview
):nth-child(3) { animation-delay: 70ms; }

body.profile-garage :is(
    .lead-list > .lead-card,
    .attention-list > .attention-card,
    .call-list > .call-card,
    .directory-grid > *,
    .task-list > .task-card,
    .chat-preview-list > .chat-preview
):nth-child(n + 4) { animation-delay: 100ms; }

body.profile-garage :is(
    .page-intro,
    .lead-hero,
    .customer-hero,
    .manual-lead-intro,
    .calls-page-intro,
    .chat-page-heading,
    .dashboard-inbox
)::after {
    animation: garage-orb-drift 10s ease-in-out infinite;
}

body.profile-garage :is(button, .primary-link, .open-link, .call-link, .chat-action-link):active {
    transform: translateY(1px) scale(.985);
}

@keyframes garage-card-in {
    from { opacity: 0; transform: translateY(7px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes garage-details-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes garage-orb-drift {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(-12px, 9px, 0) scale(1.06); }
}

@media (max-width: 719px) {
    body.profile-garage .lead-data-panel,
    body.profile-garage .lead-tasks-panel,
    body.profile-garage .owner-panel,
    body.profile-garage .action-panel,
    body.profile-garage .source-panel,
    body.profile-garage .history-panel {
        padding: 13px;
    }

    body.profile-garage .lead-data-panel .panel-headline {
        align-items: center;
        margin-bottom: 9px;
        padding-bottom: 9px;
    }

    body.profile-garage .lead-data-panel .panel-headline h2 {
        font-size: 1rem;
        margin: 0;
    }

    body.profile-garage .lead-data-panel .panel-headline > span {
        font-size: .68rem;
        max-width: 42%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    body.profile-garage .lead-data-edit-fields {
        gap: 5px;
    }

    body.profile-garage .lead-data-edit-fields .inline-field {
        border-radius: 10px;
    }

    body.profile-garage .lead-data-edit-fields .inline-field summary {
        box-sizing: border-box;
        gap: 6px;
        grid-template-columns: minmax(0, 1fr) auto;
        min-height: 43px;
        overflow: hidden;
        padding: 6px 8px;
        width: 100%;
    }

    body.profile-garage .lead-data-edit-fields .inline-field summary > span:first-child {
        align-items: baseline;
        color: var(--ui-ink);
        display: grid;
        font-size: .88rem;
        font-weight: 780;
        gap: 3px 8px;
        grid-template-columns: minmax(88px, 37%) minmax(0, 1fr);
        line-height: 1.22;
        min-width: 0;
        overflow-wrap: anywhere;
        width: 100%;
    }

    body.profile-garage .lead-data-edit-fields .lead-details-field summary {
        align-items: start;
        padding: 8px;
    }

    body.profile-garage .lead-data-edit-fields .lead-details-field summary > .lead-details-summary {
        gap: 6px;
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-garage .lead-data-edit-fields .lead-details-value {
        font-size: .82rem;
        line-height: 1.32;
        padding: 7px 8px;
    }

    body.profile-garage .lead-data-edit-fields .inline-field summary b {
        font-size: .62rem;
        letter-spacing: .045em;
        line-height: 1.2;
    }

    body.profile-garage .lead-data-edit-fields .inline-field summary i,
    body.profile-garage .lead-data-edit-fields .lead-comment-copy-button {
        align-items: center;
        display: inline-flex;
        font-size: .78rem;
        height: 29px;
        justify-content: center;
        min-height: 29px;
        padding: 0;
        width: 29px;
    }

    body.profile-garage .lead-data-edit-fields .lead-comment-actions {
        gap: 4px;
        margin-left: 0;
        max-width: 62px;
    }

    body.profile-garage .lead-data-edit-fields .lead-comment-value,
    body.profile-garage .lead-data-edit-fields .lead-comment-text {
        min-width: 0;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    body.profile-garage .lead-data-edit-fields .inline-field form {
        gap: 8px;
        padding: 9px;
    }

    body.profile-garage .lead-data-edit-fields .inline-field :is(input, select, textarea) {
        font-size: .9rem;
        min-height: 41px;
        padding: 8px 10px;
    }

    body.profile-garage .lead-data-edit-fields .inline-field textarea {
        min-height: 72px;
    }

    body.profile-garage .status-pill,
    body.profile-garage .new-lead-age,
    body.profile-garage .lead-card-meta-chips span,
    body.profile-garage .task-type-label,
    body.profile-garage .attention-badge {
        font-size: .64rem;
        line-height: 1.1;
        min-height: 0;
        padding: 5px 8px;
    }

    body.profile-garage .attention-panel {
        padding: 13px;
    }

    body.profile-garage .attention-card-rich {
        gap: 8px;
        padding: 11px;
    }

    body.profile-garage .attention-details {
        font-size: .78rem;
        line-height: 1.3;
        padding: 7px 8px;
    }

    body.profile-garage .lead-hero {
        gap: 9px;
        padding: 16px;
    }

    body.profile-garage .lead-hero-head {
        gap: 7px;
    }

    body.profile-garage .hero-client-name {
        font-size: 1.28rem;
        line-height: 1.12;
    }

    body.profile-garage .hero-phone-main {
        font-size: 1.08rem;
        min-height: 40px;
        padding: 6px 9px;
    }

    body.profile-garage .hero-primary-actions {
        gap: 7px;
    }

    body.profile-garage .hero-primary-actions :is(a, button) {
        min-height: 40px;
        padding: 9px 11px;
    }

    body.profile-garage .dashboard-inbox .primary-link {
        min-height: 42px;
        padding: 10px 14px;
    }

    body.profile-garage .chat-thread-header {
        gap: 8px;
        padding: 12px;
    }

    body.profile-garage .chat-thread-statuses {
        gap: 5px;
    }

    body.profile-garage .chat-action-menu form {
        border-radius: 13px;
        box-shadow: 0 14px 34px rgba(31, 51, 83, .14);
    }
}

/* Garage CRM compact lead preview v4 */
@media (max-width: 719px) {
    body.profile-garage .lead-list {
        gap: 11px;
        padding-inline: 3px;
    }

    body.profile-garage .garage-lead-card {
        border-radius: 17px;
        box-shadow: 0 8px 22px rgba(31, 51, 83, .075);
    }

    body.profile-garage .garage-lead-card .garage-lead-card-header {
        gap: 7px;
        grid-template-columns: max-content minmax(0, 1fr) max-content;
        min-height: 0;
        padding: 9px 11px;
    }

    body.profile-garage .garage-lead-card-header > strong {
        font-size: .9rem;
    }

    body.profile-garage .garage-lead-state {
        grid-column: auto;
        grid-row: auto;
        justify-content: flex-start;
        min-width: 0;
    }

    body.profile-garage .garage-lead-state :is(.status-pill, .new-lead-age) {
        font-size: .57rem;
        max-width: 100%;
        overflow: hidden;
        padding: 4px 6px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    body.profile-garage .garage-lead-card-header time {
        font-size: .68rem;
    }

    body.profile-garage .garage-lead-card-grid {
        display: grid;
        gap: 0;
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-garage .garage-lead-client {
        align-items: center;
        display: grid;
        gap: 2px 8px;
        grid-template-columns: minmax(0, 1fr) max-content;
        padding: 11px;
    }

    body.profile-garage .garage-lead-client > .garage-lead-label,
    body.profile-garage .garage-lead-name {
        grid-column: 1;
    }

    body.profile-garage .garage-lead-name {
        font-size: 1rem;
        line-height: 1.15;
        margin: 1px 0 0;
    }

    body.profile-garage .garage-lead-card .lead-call {
        font-size: .76rem;
        grid-column: 2;
        grid-row: 1 / 3;
        min-height: 34px;
        padding: 7px 9px;
        white-space: nowrap;
    }

    body.profile-garage .garage-lead-source {
        align-items: baseline;
        background: #f6f8fb;
        border: 0;
        border-radius: 9px;
        display: flex;
        flex-wrap: wrap;
        gap: 3px 7px;
        grid-column: 1 / -1;
        margin-top: 7px;
        padding: 7px 8px;
    }

    body.profile-garage .garage-lead-source .garage-lead-label {
        flex: 0 0 100%;
    }

    body.profile-garage .garage-lead-source strong {
        font-size: .78rem;
    }

    body.profile-garage .garage-lead-source > span:not(.garage-lead-label) {
        font-size: .7rem;
    }

    body.profile-garage .garage-lead-request {
        background: #fbfcfe;
        border-top: 1px solid #e6ebf2;
        display: grid;
        gap: 7px;
        grid-template-columns: minmax(105px, .72fr) minmax(0, 1.28fr);
        padding: 9px 11px;
    }

    body.profile-garage .garage-lead-object,
    body.profile-garage .garage-lead-text-row {
        background: #fff;
        border: 1px solid #e7ecf2;
        border-radius: 9px;
        margin: 0;
        min-width: 0;
        padding: 7px 8px;
    }

    body.profile-garage .garage-lead-object {
        border-left: 3px solid #2c74df;
    }

    body.profile-garage .garage-lead-field strong {
        font-size: .78rem;
        line-height: 1.25;
    }

    body.profile-garage .garage-lead-text-preview {
        font-size: .72rem;
        line-height: 1.3;
        -webkit-line-clamp: 3;
    }

    body.profile-garage .garage-lead-comment {
        grid-column: 1 / -1;
    }

    body.profile-garage .garage-lead-comment .garage-lead-text-preview {
        -webkit-line-clamp: 1;
    }

    body.profile-garage .garage-lead-workflow {
        align-items: stretch;
        background: #f4f7fb;
        border-top: 1px solid #e1e7ef;
        display: grid;
        gap: 7px;
        grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr) max-content;
        padding: 9px 11px;
    }

    body.profile-garage .garage-lead-owner,
    body.profile-garage .garage-lead-route {
        border: 0;
        gap: 2px;
        padding: 0;
    }

    body.profile-garage .garage-lead-owner strong,
    body.profile-garage .garage-lead-route strong {
        font-size: .72rem;
        line-height: 1.2;
    }

    body.profile-garage .garage-lead-route > span:not(.garage-lead-label) {
        font-size: .64rem;
    }

    body.profile-garage .garage-lead-open {
        align-self: center;
        font-size: 0;
        height: 34px;
        min-height: 34px;
        min-width: 34px;
        padding: 0;
        width: 34px;
    }

    body.profile-garage .garage-lead-open::after {
        content: "→";
        font-size: 1rem;
    }

    body.profile-garage .garage-lead-card > .lead-date-facts .date-fact {
        font-size: .72rem;
        line-height: 1.2;
        padding: 8px 11px;
    }

    body.profile-garage .garage-lead-label {
        font-size: .56rem;
        letter-spacing: .035em;
    }

    body.profile-garage .quick-actions input[type="datetime-local"] {
        font-size: .82rem;
        inline-size: 100%;
        max-inline-size: 100%;
        min-inline-size: 0;
    }
}

@media (max-width: 374px) {
    body.profile-garage .garage-lead-client {
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-garage .garage-lead-card .lead-call {
        grid-column: 1;
        grid-row: auto;
        justify-self: start;
        margin-top: 5px;
    }

    body.profile-garage .garage-lead-request {
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-garage .garage-lead-comment {
        grid-column: auto;
    }

    body.profile-garage .garage-lead-workflow {
        grid-template-columns: repeat(2, minmax(0, 1fr)) max-content;
    }
}

/* Garage CRM compact workflow and attention cards v3 */
body.profile-garage .hero-source-meta {
    align-items: stretch;
    display: flex;
    gap: 8px;
    margin: 0;
}

body.profile-garage .hero-source-meta > span {
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 11px;
    display: grid;
    gap: 2px;
    min-width: 0;
    padding: 7px 10px;
}

body.profile-garage .hero-source-meta > span + span::before {
    content: none;
    display: none;
}

body.profile-garage .hero-source-meta small {
    color: rgba(255, 255, 255, .68);
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .055em;
    line-height: 1;
    text-transform: uppercase;
}

body.profile-garage .hero-source-meta strong {
    color: #fff;
    font-size: .82rem;
    line-height: 1.2;
}

body.profile-garage .attention-card-rich {
    border-left-width: 4px;
    padding: 14px 15px;
}

body.profile-garage .attention-main {
    gap: 11px;
}

body.profile-garage .attention-identity {
    display: grid;
    gap: 2px;
    min-width: 0;
}

body.profile-garage .attention-identity small {
    color: #7a889b;
    font-size: .64rem;
    font-weight: 850;
    letter-spacing: .055em;
    text-transform: uppercase;
}

body.profile-garage .attention-identity strong {
    color: var(--ui-ink);
    font-size: 1.06rem;
}

body.profile-garage .attention-contact {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
}

body.profile-garage .attention-contact > span {
    color: #40516a;
    font-size: .86rem;
    font-weight: 780;
    line-height: 1.3;
}

body.profile-garage .attention-contact .attention-phone {
    color: #173253;
    font-variant-numeric: tabular-nums;
    font-weight: 900;
}

body.profile-garage .attention-facts {
    display: grid;
    gap: 7px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.profile-garage .attention-facts > span {
    background: #f6f8fb;
    border: 1px solid #e7ecf2;
    border-radius: 10px;
    display: grid;
    gap: 2px;
    min-width: 0;
    padding: 8px 9px;
}

body.profile-garage .attention-facts small {
    color: #758398;
    font-size: .6rem;
    font-weight: 850;
    letter-spacing: .045em;
    line-height: 1.15;
    text-transform: uppercase;
}

body.profile-garage .attention-facts strong {
    color: #293b54;
    font-size: .78rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

body.profile-garage .attention-date {
    border-top: 1px solid #e8edf3;
    color: #40516a;
    font-size: .82rem;
    padding-top: 9px;
}

@media (max-width: 719px) {
    body.profile-garage .primary-filter-row,
    body.profile-garage .secondary-filter-row {
        -webkit-overflow-scrolling: touch;
        align-items: center;
        display: flex;
        gap: 6px;
        margin: 0 0 7px;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        padding: 5px;
        scrollbar-width: none;
        scroll-snap-type: x proximity;
    }

    body.profile-garage .primary-filter-row::-webkit-scrollbar,
    body.profile-garage .secondary-filter-row::-webkit-scrollbar {
        display: none;
    }

    body.profile-garage .primary-filter-row a,
    body.profile-garage .secondary-filter-row a {
        flex: 0 0 auto;
        font-size: .73rem;
        line-height: 1.1;
        min-height: 34px;
        padding: 8px 11px;
        scroll-snap-align: start;
        white-space: nowrap;
        width: auto;
    }

    body.profile-garage .lead-results {
        margin-top: 5px;
    }

    body.profile-garage .lead-hero .hero-phone-main {
        align-items: center;
        display: flex;
        justify-content: center;
        margin-inline: 0;
        max-width: 100%;
        text-align: center;
        width: 100%;
    }

    body.profile-garage .hero-source-meta {
        display: grid;
        grid-template-columns: minmax(0, 1.35fr) minmax(0, .65fr);
    }

    body.profile-garage .hero-source-meta > span {
        padding: 6px 8px;
    }

    body.profile-garage .hero-source-meta strong {
        font-size: .76rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    body.profile-garage .attention-panel .queue-head {
        align-items: center;
    }

    body.profile-garage .attention-card-rich {
        padding: 11px 10px 11px 12px;
    }

    body.profile-garage .attention-main {
        gap: 8px;
    }

    body.profile-garage .attention-title-row {
        align-items: start;
        display: flex;
        gap: 8px;
    }

    body.profile-garage .attention-title-row .attention-badge {
        flex: 0 0 auto;
        justify-self: auto;
    }

    body.profile-garage .attention-identity strong {
        font-size: .98rem;
    }

    body.profile-garage .attention-contact {
        gap: 3px 9px;
    }

    body.profile-garage .attention-contact > span {
        font-size: .76rem;
    }

    body.profile-garage .attention-facts {
        gap: 5px;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    body.profile-garage .attention-facts > span {
        border-radius: 8px;
        padding: 6px 7px;
    }

    body.profile-garage .attention-facts small {
        font-size: .54rem;
    }

    body.profile-garage .attention-facts strong {
        font-size: .7rem;
    }

    body.profile-garage .attention-details {
        font-size: .72rem;
        line-height: 1.28;
        padding: 6px 7px;
    }

    body.profile-garage .attention-date {
        font-size: .74rem;
        padding-top: 7px;
    }

    body.profile-garage .quick-actions > .action-drop,
    body.profile-garage .quick-actions > .action-drop > form,
    body.profile-garage .quick-actions > .action-drop label {
        box-sizing: border-box;
        min-inline-size: 0;
        min-width: 0;
        width: 100%;
    }

    body.profile-garage .quick-actions > .action-drop[open] {
        grid-column: 1 / -1 !important;
    }

    body.profile-garage .quick-actions > .action-drop[open] > form {
        display: grid;
        gap: 8px;
        padding: 9px;
    }

    body.profile-garage .quick-actions input[type="datetime-local"] {
        appearance: auto;
        display: block;
        font-size: .82rem;
        inline-size: 100%;
        min-inline-size: 0;
        overflow: hidden;
    }
}

@media (max-width: 390px) {
    body.profile-garage .attention-facts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Garage CRM lead-detail contrast and action consistency hotfix v2 */
body.profile-garage .lead-hero .hero-phone-main {
    background: rgba(255, 255, 255, .96);
    border: 1px solid rgba(255, 255, 255, .82);
    box-shadow: 0 8px 24px rgba(12, 28, 58, .2);
    color: #14243c !important;
    text-shadow: none;
}

body.profile-garage .lead-hero .status-pill {
    background: rgba(255, 255, 255, .94);
    border: 1px solid rgba(255, 255, 255, .8);
    box-shadow: 0 6px 18px rgba(12, 28, 58, .16);
    color: #263954;
    text-shadow: none;
}

body.profile-garage .lead-hero .status-in_work {
    background: #fff1b8;
    border-color: #efd77c;
    color: #704b00;
}

body.profile-garage .lead-hero .status-measurement {
    background: #eee9ff;
    border-color: #d8cdfd;
    color: #5c35a8;
}

body.profile-garage .lead-hero .status-thinking {
    background: #fff0dd;
    border-color: #f0d0a8;
    color: #8b4b16;
}

body.profile-garage .lead-hero .status-done {
    background: #e4f7ee;
    border-color: #bee6d2;
    color: #176a4b;
}

body.profile-garage .lead-hero .status-rejected {
    background: #fff0f2;
    border-color: #efc8cf;
    color: #9e374a;
}

body.profile-garage :is(
    .quick-actions > form button,
    .quick-actions > .action-drop:not(.reject-drop) > summary,
    .secondary-actions > .action-drop:not(.reject-drop) > summary,
    .hero-take-form button,
    .call-link
) {
    background: linear-gradient(135deg, #2563df, #5268ef);
    border: 0;
    box-shadow: 0 8px 20px rgba(45, 91, 218, .2);
    color: #fff;
    font-weight: 850;
}

body.profile-garage :is(
    .quick-actions > form button,
    .quick-actions > .action-drop:not(.reject-drop) > summary,
    .secondary-actions > .action-drop:not(.reject-drop) > summary,
    .hero-take-form button,
    .call-link
):hover {
    background: linear-gradient(135deg, #1e56ca, #465bd9);
    box-shadow: 0 11px 25px rgba(45, 91, 218, .27);
}

body.profile-garage .reject-drop > summary,
body.profile-garage .reject-drop .danger-button {
    background: linear-gradient(135deg, #d34d62, #b9364d) !important;
    color: #fff;
}

@media (max-width: 719px) {
    body.profile-garage .lead-hero .hero-phone-main {
        font-size: 1.13rem;
        font-weight: 900;
        letter-spacing: .01em;
    }

    body.profile-garage .lead-hero .status-pill {
        font-size: .72rem;
        line-height: 1.1;
        padding: 7px 10px;
    }

    body.profile-garage :is(
        .quick-actions > form button,
        .quick-actions > .action-drop > summary,
        .secondary-actions > .action-drop > summary
    ) {
        font-size: .94rem;
        min-height: 48px;
        padding: 11px 12px;
    }

    body.profile-garage .quick-actions > .action-drop[open] {
        grid-column: 1 / -1;
        width: 100%;
    }

    body.profile-garage .quick-actions > .action-drop[open] > form {
        overflow: hidden;
        width: 100%;
    }

    body.profile-garage .quick-actions > .action-drop[open] input[type="datetime-local"],
    body.profile-garage .secondary-actions > .action-drop[open] input[type="datetime-local"] {
        box-sizing: border-box;
        font-size: .92rem;
        font-variant-numeric: tabular-nums;
        max-width: 100%;
        min-width: 0;
        width: 100%;
    }

    body.profile-garage .lead-data-edit-fields .inline-field summary .lead-comment-value > .lead-comment-text {
        color: var(--ui-ink);
        font-size: .88rem !important;
        font-weight: 780 !important;
        letter-spacing: 0;
        line-height: 1.22 !important;
    }

    body.profile-garage .lead-data-edit-fields .inline-field summary .lead-comment-value > b {
        overflow-wrap: normal;
        word-break: normal;
    }
}

@media (max-width: 390px) {
    body.profile-garage .lead-data-edit-fields .inline-field summary > span:first-child {
        grid-template-columns: minmax(78px, 35%) minmax(0, 1fr);
    }

    body.profile-garage .lead-data-edit-fields .inline-field summary b {
        font-size: .59rem;
    }

    body.profile-garage .lead-data-edit-fields .inline-field summary {
        padding-left: 7px;
        padding-right: 7px;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.profile-garage :is(
        .lead-list > .lead-card,
        .attention-list > .attention-card,
        .call-list > .call-card,
        .directory-grid > *,
        .task-list > .task-card,
        .chat-preview-list > .chat-preview,
        .lead-data-edit-fields .inline-field[open] > form
    ),
    body.profile-garage :is(
        .page-intro,
        .lead-hero,
        .customer-hero,
        .manual-lead-intro,
        .calls-page-intro,
        .chat-page-heading,
        .dashboard-inbox
    )::after {
        animation: none;
    }
}

@media (max-width: 719px) {
    body.profile-garage .quick-actions > .action-drop[open] input[type="datetime-local"] {
        box-sizing: border-box;
        font-size: .82rem;
        inline-size: 100%;
        max-inline-size: 100%;
        min-inline-size: 0;
        width: 100%;
    }
}

/* Garage CRM compact manual lead form v5 */
body.profile-garage .manual-lead-form [hidden] {
    display: none !important;
}

@media (max-width: 719px) {
    body.profile-garage .manual-lead-intro {
        gap: 5px;
        margin-bottom: 10px;
        padding: 14px 15px;
    }

    body.profile-garage .manual-lead-intro .back-link {
        font-size: .72rem;
    }

    body.profile-garage .manual-lead-intro .eyebrow {
        font-size: .6rem;
        margin-top: 7px;
    }

    body.profile-garage .manual-lead-intro h1 {
        font-size: 1.48rem;
        line-height: 1.08;
        margin-top: 2px;
    }

    body.profile-garage .manual-lead-form {
        gap: 9px;
        padding: 10px;
    }

    body.profile-garage .manual-form-section {
        border-radius: 11px;
        gap: 8px;
        padding: 10px;
    }

    body.profile-garage .manual-form-section h2 {
        font-size: .92rem;
        grid-column: 1 / -1;
        line-height: 1.15;
    }

    body.profile-garage .manual-lead-form label {
        font-size: .72rem;
        gap: 4px;
        line-height: 1.15;
        min-width: 0;
    }

    body.profile-garage .manual-lead-form :is(input:not([type="checkbox"]), select, textarea) {
        border-radius: 9px;
        font-size: 16px;
        line-height: 1.2;
        min-height: 41px;
        padding: 8px 10px;
    }

    body.profile-garage .manual-lead-form textarea {
        min-height: 62px;
    }

    body.profile-garage .manual-form-section-client,
    body.profile-garage .manual-form-section-object,
    body.profile-garage .manual-form-section-status {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.profile-garage .manual-form-section-client > label:nth-of-type(n + 3),
    body.profile-garage .manual-form-section-client > [data-other-source-field],
    body.profile-garage .manual-form-section-object > .manual-category-block,
    body.profile-garage .manual-form-section-object > label:last-child,
    body.profile-garage .manual-form-section-status > .manual-status-fields {
        grid-column: 1 / -1;
    }

    body.profile-garage .manual-form-section-status > .manual-extra {
        grid-column: 2;
        grid-row: 2;
    }

    body.profile-garage .manual-category-block {
        border-radius: 9px !important;
        padding: 7px !important;
    }

    body.profile-garage .manual-category-title {
        font-size: .68rem !important;
        margin-bottom: 5px !important;
    }

    body.profile-garage .manual-category-list {
        gap: 3px 7px !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }

    body.profile-garage .manual-lead-form .manual-category-row {
        gap: 4px !important;
        grid-template-columns: 13px minmax(0, 1fr) !important;
        min-height: 19px !important;
    }

    body.profile-garage .manual-lead-form .manual-category-row input[type="checkbox"] {
        height: 13px !important;
        width: 13px !important;
    }

    body.profile-garage .manual-lead-form .manual-category-row span {
        font-size: .66rem !important;
        line-height: 1.08 !important;
    }

    body.profile-garage .manual-extra {
        align-self: end;
        border-radius: 9px;
    }

    body.profile-garage .manual-extra summary {
        align-items: center;
        display: flex;
        font-size: .74rem;
        min-height: 41px;
        padding: 8px 10px;
    }

    body.profile-garage .manual-extra-fields {
        padding: 0 8px 8px;
    }

    body.profile-garage .manual-form-actions {
        gap: 7px;
    }

    body.profile-garage .manual-form-actions :is(button, a) {
        border-radius: 10px;
        font-size: .82rem;
        min-height: 42px;
        padding: 8px 10px;
    }
}

@media (max-width: 390px) {
    body.profile-garage .manual-category-list {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* Garage lead rows: hard mobile containment after all legacy overrides. */
@media (max-width: 719px) {
    body.profile-garage .app-shell,
    body.profile-garage .compact-workspace,
    body.profile-garage .lead-data-panel,
    body.profile-garage .lead-data-edit-fields,
    body.profile-garage .lead-data-edit-fields .inline-field {
        box-sizing: border-box;
        max-width: 100%;
        min-width: 0;
        width: 100%;
    }

    body.profile-garage .app-shell {
        overflow-x: clip;
    }

    body.profile-garage .compact-workspace,
    body.profile-garage .lead-data-panel,
    body.profile-garage .lead-data-edit-fields {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    body.profile-garage .lead-data-panel > * {
        max-width: 100%;
        min-width: 0;
    }

    body.profile-garage .lead-data-edit-fields .inline-field summary {
        grid-template-columns: minmax(0, 1fr) 31px;
        max-width: 100%;
        min-width: 0;
        overflow: hidden;
        position: relative;
        width: 100%;
    }

    body.profile-garage .lead-data-edit-fields .lead-next-action-field summary {
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-garage .lead-data-edit-fields .inline-field summary > .lead-field-row {
        align-items: center;
        box-sizing: border-box;
        display: grid;
        gap: 6px;
        grid-template-columns: minmax(76px, 30%) minmax(0, 1fr);
        max-width: 100%;
        min-width: 0;
        overflow: hidden;
        width: 100%;
    }

    body.profile-garage .lead-data-edit-fields .inline-field summary .lead-field-value {
        box-sizing: border-box;
        display: block;
        font-size: .84rem;
        font-weight: 800;
        line-height: 1.2;
        max-width: 100%;
        min-width: 0;
        overflow: hidden;
        overflow-wrap: anywhere;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    body.profile-garage .lead-data-edit-fields .inline-field summary .lead-field-phone {
        font-variant-numeric: tabular-nums;
        letter-spacing: -.015em;
    }

    body.profile-garage .lead-data-edit-fields .lead-details-field summary > .lead-details-summary {
        grid-template-columns: minmax(76px, 30%) minmax(0, 1fr);
    }

    body.profile-garage .lead-data-edit-fields .lead-details-field summary .lead-details-value {
        border-left-width: 2px;
        border-radius: 6px;
        padding: 5px 7px;
    }

    body.profile-garage .lead-data-edit-fields .inline-field summary > .lead-edit-icon {
        align-self: center;
        background: #fff;
        border: 1px solid #d7e2f0;
        border-radius: 8px;
        box-sizing: border-box;
        color: #0d4fae !important;
        display: inline-flex !important;
        flex: 0 0 27px;
        height: 27px;
        justify-self: end;
        margin: 0;
        max-width: 27px;
        min-width: 27px;
        opacity: 1 !important;
        overflow: visible;
        visibility: visible !important;
        width: 27px;
        z-index: 2;
    }

    body.profile-garage .lead-data-edit-fields .inline-field summary > .lead-edit-icon svg {
        display: block !important;
        flex: 0 0 16px;
        height: 16px;
        stroke: #0d4fae;
        width: 16px;
    }

    body.profile-garage .lead-data-edit-fields .inline-field summary > .lead-comment-actions {
        box-sizing: border-box;
        justify-content: flex-end;
        max-width: 62px;
        min-width: 0;
        width: 100%;
    }

    body.profile-garage .lead-data-edit-fields .inline-field .lead-comment-summary {
        grid-template-columns: minmax(0, 1fr) minmax(0, 62px);
    }
}

/* Estimate and contract workspace */
body.profile-garage .lead-estimate-panel {
    background: linear-gradient(145deg, #ffffff 0%, #f3f6ff 100%);
    border-color: #d7ddff;
}

body.profile-garage .lead-cost-line {
    align-items: center;
    display: flex !important;
    flex-wrap: wrap;
    gap: 6px !important;
}

body.profile-garage .lead-cost-source {
    background: #eef1ff;
    border: 1px solid #d7ddff;
    border-radius: 999px;
    color: #4855bf;
    font-size: .65rem;
    font-weight: 850;
    line-height: 1;
    padding: 5px 7px;
    white-space: nowrap;
}

body.profile-garage .lead-cost-source.is-final {
    background: #eef7ff;
    border-color: #cae3fb;
    color: #1765a4;
}

body.profile-garage .lead-cost-source.is-confirmed {
    background: #e9f8f1;
    border-color: #bfe8d4;
    color: #127653;
}

body.profile-garage .quick-action-button-wrap {
    display: flex;
    width: 100%;
}

body.profile-garage .quick-action-button-wrap > button {
    background: linear-gradient(135deg, #2563df, #5268ef);
    border: 0;
    box-shadow: 0 8px 20px rgba(45, 91, 218, .2);
    color: #fff;
    font-weight: 850;
    width: 100%;
}

body.profile-garage .quick-action-button-wrap > button:hover {
    background: linear-gradient(135deg, #1e56ca, #465bd9);
    box-shadow: 0 11px 25px rgba(45, 91, 218, .27);
}

body.profile-garage .lead-completion-dialog {
    background: transparent;
    border: 0;
    inset: 0;
    margin: auto;
    max-height: calc(100dvh - 24px);
    max-width: 520px;
    overflow: visible;
    padding: 0;
    position: fixed;
    width: calc(100vw - 24px);
}

body.profile-garage .lead-completion-dialog::backdrop {
    background: rgba(20, 31, 55, .56);
    backdrop-filter: blur(3px);
}

body.profile-garage .lead-completion-card {
    background: #fff;
    border: 1px solid #dce3f1;
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(25, 38, 70, .26);
    display: grid;
    gap: 13px;
    max-height: calc(100dvh - 24px);
    overflow: auto;
    padding: 20px;
}

body.profile-garage .lead-completion-heading {
    align-items: flex-start;
    display: grid;
    gap: 11px;
    grid-template-columns: 38px minmax(0, 1fr);
}

body.profile-garage .lead-completion-icon {
    align-items: center;
    background: linear-gradient(135deg, #22ad78, #109465);
    border-radius: 12px;
    color: #fff;
    display: inline-flex;
    font-size: 1.15rem;
    font-weight: 900;
    height: 38px;
    justify-content: center;
    width: 38px;
}

body.profile-garage .lead-completion-heading h2,
body.profile-garage .lead-completion-heading p {
    margin: 0;
}

body.profile-garage .lead-completion-heading h2 {
    font-size: 1.15rem;
}

body.profile-garage .lead-completion-heading p {
    color: var(--muted);
    font-size: .82rem;
    line-height: 1.45;
    margin-top: 3px;
}

body.profile-garage .lead-completion-contract {
    background: #f2f5ff;
    border: 1px solid #dce3ff;
    border-radius: 11px;
    display: grid;
    gap: 3px;
    padding: 10px 12px;
}

body.profile-garage .lead-completion-contract small {
    color: var(--muted);
    font-size: .7rem;
}

body.profile-garage .lead-completion-card > label {
    color: #52617a;
    display: grid;
    font-size: .76rem;
    font-weight: 800;
    gap: 6px;
}

body.profile-garage .lead-completion-card > label[hidden] {
    display: none;
}

body.profile-garage .lead-completion-card :is(input, textarea) {
    background: #fff;
    border: 1px solid #cfd9e8;
    border-radius: 11px;
    color: var(--text);
    font: inherit;
    font-size: .95rem;
    min-height: 44px;
    padding: 10px 12px;
    width: 100%;
}

body.profile-garage .lead-completion-card textarea {
    min-height: 92px;
    resize: vertical;
}

body.profile-garage .lead-completion-card label > small {
    color: var(--muted);
    font-size: .68rem;
    font-weight: 500;
}

body.profile-garage .lead-completion-actions {
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, .72fr) minmax(0, 1.4fr);
}

body.profile-garage .lead-completion-actions button {
    border: 0;
    border-radius: 11px;
    cursor: pointer;
    font-weight: 850;
    min-height: 43px;
    padding: 9px 12px;
}

body.profile-garage .lead-completion-actions button[type="submit"] {
    background: linear-gradient(135deg, #4f5df5, #6959dd);
    color: #fff;
}

body.profile-garage .lead-completion-actions .secondary-button {
    background: #eef2f8;
    color: #39475f;
}

@media (max-width: 719px) {
    body.profile-garage .lead-cost-line {
        align-items: flex-start;
    }

    body.profile-garage .lead-cost-source {
        font-size: .58rem;
        padding: 4px 6px;
    }

    body.profile-garage .lead-completion-card {
        border-radius: 14px;
        gap: 10px;
        padding: 14px;
    }

    body.profile-garage .lead-completion-heading {
        gap: 9px;
        grid-template-columns: 32px minmax(0, 1fr);
    }

    body.profile-garage .lead-completion-icon {
        height: 32px;
        width: 32px;
    }

    body.profile-garage .lead-completion-heading h2 {
        font-size: 1rem;
    }

    body.profile-garage .lead-completion-heading p {
        font-size: .72rem;
    }

    body.profile-garage .lead-completion-card :is(input, textarea) {
        font-size: .86rem;
        min-height: 40px;
        padding: 8px 10px;
    }

    body.profile-garage .lead-completion-card textarea {
        min-height: 76px;
    }

    body.profile-garage .lead-completion-actions button {
        font-size: .75rem;
        min-height: 40px;
        padding: 7px 8px;
    }

    body.profile-garage .quick-action-button-wrap > button {
        font-size: .94rem;
        min-height: 48px;
        padding: 11px 12px;
    }
}

body.profile-garage .customer-document-profile {
    grid-column: 1 / -1;
    position: relative;
}

/* Customer field editor v2 */
body.profile-garage .customer-inline-field,
body.profile-garage .customer-inline-field summary {
    min-width: 0;
}

body.profile-garage .customer-inline-field summary {
    align-items: center;
    cursor: pointer;
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) 30px;
    list-style: none;
}

body.profile-garage .customer-inline-field summary::-webkit-details-marker {
    display: none;
}

body.profile-garage .customer-field-copy,
body.profile-garage .customer-field-label,
body.profile-garage .customer-field-copy strong {
    display: block;
    min-width: 0;
}

body.profile-garage .customer-field-label {
    color: var(--muted);
    font-size: .68rem;
    font-weight: 800;
    margin-bottom: 3px;
    text-transform: uppercase;
}

body.profile-garage .customer-field-copy strong {
    font-size: .82rem;
    overflow-wrap: anywhere;
}

body.profile-garage .customer-inline-field summary > .lead-edit-icon {
    align-items: center;
    align-self: center;
    background: #fff;
    border: 1px solid #d7e2f0;
    border-radius: 8px;
    color: #0d4fae;
    display: inline-flex;
    height: 28px;
    justify-content: center;
    width: 28px;
}

body.profile-garage .customer-inline-field[open] summary > .lead-edit-icon {
    background: #eef3ff;
    border-color: #aebff0;
}

body.profile-garage .customer-inline-form {
    display: grid;
    gap: 7px;
    grid-template-columns: minmax(0, 1fr) auto;
    margin-top: 8px;
}

body.profile-garage .customer-inline-form :is(input, select, textarea) {
    background: #fff;
    border: 1px solid #cfd9e8;
    border-radius: 8px;
    color: var(--text);
    font: inherit;
    font-size: .82rem;
    min-height: 36px;
    min-width: 0;
    padding: 7px 9px;
    width: 100%;
}

body.profile-garage .customer-inline-form textarea {
    grid-column: 1 / -1;
    min-height: 86px;
    resize: vertical;
}

body.profile-garage .customer-inline-form textarea + button {
    grid-column: 1 / -1;
}

body.profile-garage .customer-inline-form button {
    min-height: 36px;
    padding: 7px 12px !important;
}

body.profile-garage .customer-document-grid {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 12px 0;
}

body.profile-garage .customer-document-item {
    background: #f6f8fc;
    border: 1px solid #e2e7ef;
    border-radius: 10px;
    min-width: 0;
    padding: 9px 10px;
}

body.profile-garage .customer-document-group-title {
    color: #42516a;
    font-size: .72rem;
    font-weight: 900;
    grid-column: 1 / -1;
    margin-top: 4px;
    text-transform: uppercase;
}

body.profile-garage .customer-document-wide {
    grid-column: span 2;
}

body.profile-garage .lead-estimate-summary {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 13px 0;
}

body.profile-garage .lead-estimate-summary > div {
    background: rgba(255, 255, 255, .84);
    border: 1px solid #e1e6f5;
    border-radius: 12px;
    min-width: 0;
    padding: 10px;
}

body.profile-garage .lead-estimate-summary small,
body.profile-garage .lead-estimate-summary strong {
    display: block;
}

body.profile-garage .lead-estimate-summary small,
body.profile-garage .panel-muted-copy,
body.profile-garage .lead-estimate-contractor {
    color: var(--muted);
    font-size: .78rem;
}

body.profile-garage .lead-estimate-summary strong {
    font-size: 1rem;
    margin-top: 3px;
}

body.profile-garage .lead-estimate-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    position: relative;
}

body.profile-garage .estimate-workspace-delete {
    position: relative;
}

body.profile-garage .estimate-workspace-delete > summary {
    list-style: none;
}

body.profile-garage .estimate-workspace-delete > summary::-webkit-details-marker {
    display: none;
}

body.profile-garage .estimate-danger-trigger {
    align-items: center;
    background: #fff4f5;
    border: 1px solid #ffcbd1;
    border-radius: 10px;
    color: #b52839;
    cursor: pointer;
    display: inline-flex;
    font-size: .78rem;
    font-weight: 850;
    gap: 7px;
    min-height: 41px;
    padding: 9px 12px;
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
    white-space: nowrap;
}

body.profile-garage .estimate-danger-trigger:hover,
body.profile-garage .estimate-workspace-delete[open] > .estimate-danger-trigger {
    background: #ffe8eb;
    border-color: #f5aeb8;
    box-shadow: 0 8px 20px rgba(181, 40, 57, .12);
}

body.profile-garage .estimate-workspace-confirm {
    background: #fff;
    border: 1px solid #f2c5cb;
    border-radius: 14px;
    box-shadow: 0 18px 48px rgba(31, 43, 68, .2);
    color: var(--text);
    padding: 13px;
    width: min(350px, calc(100vw - 34px));
    left: 50%;
    position: fixed;
    right: auto;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 91;
}

body.profile-garage .estimate-workspace-delete[open]::before {
    background: rgba(20, 31, 55, .42);
    content: "";
    inset: 0;
    position: fixed;
    z-index: 90;
}

body.profile-garage .estimate-workspace-confirm strong,
body.profile-garage .estimate-workspace-confirm p {
    display: block;
}

body.profile-garage .estimate-workspace-confirm p {
    color: var(--muted);
    font-size: .75rem;
    line-height: 1.35;
    margin: 5px 0 11px;
}

body.profile-garage .estimate-workspace-confirm > div {
    display: flex;
    gap: 7px;
    justify-content: flex-end;
}

body.profile-garage .estimate-workspace-confirm form {
    margin: 0;
}

body.profile-garage .estimate-workspace-confirm button {
    min-height: 36px;
    padding: 7px 11px !important;
}

body.profile-garage .estimate-workspace-clear {
    margin-top: 3px;
}

body.profile-garage .estimate-workspace-clear .estimate-danger-trigger {
    font-size: .7rem;
    min-height: 34px;
    padding: 6px 9px;
}

body.profile-garage .primary-panel-link,
body.profile-garage .lead-estimate-create button,
body.profile-garage .estimate-page button:not(.secondary-button) {
    background: linear-gradient(135deg, #4f5df5, #6959dd);
    border: 0;
    border-radius: 11px;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font-weight: 800;
    justify-content: center;
    padding: 11px 16px;
    text-decoration: none;
}

body.profile-garage .lead-estimate-create {
    align-items: end;
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

body.profile-garage .lead-estimate-create label {
    color: var(--muted);
    display: grid;
    flex: 1;
    font-size: .76rem;
    gap: 5px;
}

body.profile-garage .lead-estimate-create select {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    min-height: 42px;
    padding: 8px 10px;
}

body.profile-garage .estimate-upload-link {
    align-items: center;
    background: #f2f4ff;
    border: 1px solid #d6dcff;
    border-radius: 10px;
    color: #3e4fd1;
    display: inline-flex;
    font-size: .78rem;
    font-weight: 850;
    gap: 7px;
    justify-content: center;
    min-height: 41px;
    padding: 9px 12px;
    text-decoration: none;
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
    white-space: nowrap;
}

body.profile-garage .estimate-upload-link:hover {
    background: #e9edff;
    border-color: #bac4ff;
    box-shadow: 0 8px 20px rgba(62, 79, 209, .12);
    transform: translateY(-1px);
}

body.profile-garage .estimate-upload-link-empty {
    margin-top: 10px;
}

body.profile-garage .estimate-import-links {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.profile-garage .estimate-import-links .estimate-upload-link {
    min-width: 0;
    width: 100%;
}

body.profile-garage .estimate-paste-link {
    background: #eef9f6;
    border-color: #c5e9df;
    color: #16745e;
}

body.profile-garage .estimate-paste-link:hover {
    background: #e2f5ef;
    border-color: #9bd7c6;
    box-shadow: 0 8px 20px rgba(22, 116, 94, .12);
}

body.profile-garage .estimate-import-page {
    margin: 0 auto;
    max-width: 920px;
}

body.profile-garage .estimate-import-hero {
    background: linear-gradient(135deg, #1b2b4b, #4f5fd8);
    border-radius: 24px;
    box-shadow: 0 18px 42px rgba(39, 57, 110, .2);
    color: #fff;
    margin-bottom: 16px;
    overflow: hidden;
    padding: clamp(24px, 5vw, 42px);
    position: relative;
}

body.profile-garage .estimate-import-hero::after {
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 50%;
    content: "";
    height: 210px;
    position: absolute;
    right: -60px;
    top: -115px;
    width: 210px;
}

body.profile-garage .estimate-import-hero .back-link,
body.profile-garage .estimate-import-hero p {
    color: rgba(255, 255, 255, .78);
}

body.profile-garage .estimate-import-hero h1 {
    font-size: clamp(2rem, 5vw, 3.2rem);
    margin: 5px 0 7px;
}

body.profile-garage .estimate-import-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 14px 38px rgba(31, 49, 84, .1);
    padding: clamp(16px, 4vw, 28px);
}

body.profile-garage .estimate-import-step {
    align-items: center;
    display: flex;
    gap: 11px;
    margin-bottom: 18px;
}

body.profile-garage .estimate-import-step > span {
    align-items: center;
    background: linear-gradient(135deg, #5263ec, #7258df);
    border-radius: 11px;
    color: #fff;
    display: flex;
    font-size: 1rem;
    font-weight: 900;
    height: 38px;
    justify-content: center;
    width: 38px;
}

body.profile-garage .estimate-import-step strong,
body.profile-garage .estimate-import-step small {
    display: block;
}

body.profile-garage .estimate-import-step small,
body.profile-garage .estimate-import-contractor small {
    color: var(--muted);
    font-size: .73rem;
    margin-top: 2px;
}

body.profile-garage .estimate-import-form {
    display: grid;
    gap: 12px;
}

body.profile-garage .estimate-import-form > label:not(.estimate-file-picker) {
    color: var(--muted);
    display: grid;
    font-size: .75rem;
    gap: 5px;
}

body.profile-garage .estimate-import-form select {
    background: #fff;
    border: 1px solid #cfd9e8;
    border-radius: 11px;
    color: var(--text);
    min-height: 45px;
    padding: 9px 34px 9px 11px;
}

body.profile-garage .estimate-file-picker {
    background: #f5f7ff;
    border: 1.5px dashed #b9c3f5;
    border-radius: 15px;
    cursor: pointer;
    display: block;
    padding: 9px;
    transition: background .18s ease, border-color .18s ease;
}

body.profile-garage .estimate-file-picker:hover,
body.profile-garage .estimate-file-picker:focus-within {
    background: #eef1ff;
    border-color: #6675e8;
}

body.profile-garage .estimate-file-picker input {
    height: 1px;
    opacity: 0;
    overflow: hidden;
    position: absolute;
    width: 1px;
}

body.profile-garage .estimate-file-picker > span {
    align-items: center;
    background: #fff;
    border: 1px solid #e0e5f4;
    border-radius: 11px;
    color: #4151d2;
    display: grid;
    gap: 2px 9px;
    grid-template-columns: 28px minmax(0, 1fr);
    padding: 12px;
}

body.profile-garage .estimate-file-picker svg {
    grid-row: 1 / 3;
}

body.profile-garage .estimate-file-picker small {
    color: var(--muted);
    font-size: .7rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.profile-garage .estimate-file-picker small span {
    color: #4151d2;
    font-weight: 800;
}

body.profile-garage .estimate-import-submit {
    align-items: center;
    background: linear-gradient(135deg, #4f5df5, #6959dd);
    border: 0;
    border-radius: 11px;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font-weight: 850;
    gap: 7px;
    justify-content: center;
    min-height: 46px;
    padding: 10px 17px;
}

body.profile-garage .estimate-import-submit:disabled {
    cursor: not-allowed;
    opacity: .5;
}

body.profile-garage .estimate-import-explainer {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 16px;
}

body.profile-garage .estimate-import-explainer > div,
body.profile-garage .estimate-import-contractor {
    background: #f7f8fc;
    border: 1px solid #e3e7f0;
    border-radius: 11px;
    padding: 10px;
}

body.profile-garage .estimate-import-explainer b,
body.profile-garage .estimate-import-explainer span,
body.profile-garage .estimate-import-contractor strong {
    display: block;
}

body.profile-garage .estimate-import-explainer b {
    font-size: .76rem;
}

body.profile-garage .estimate-import-explainer span {
    color: var(--muted);
    font-size: .68rem;
    line-height: 1.35;
    margin-top: 3px;
}

body.profile-garage .estimate-import-notice {
    border-radius: 12px;
    font-size: .82rem;
    margin-bottom: 12px;
    padding: 11px 13px;
}

body.profile-garage .estimate-import-notice.is-error {
    background: #fff0f1;
    border: 1px solid #ffcbd0;
    color: #a92635;
}

body.profile-garage .estimate-import-notice.is-success {
    background: #e9f8f1;
    border: 1px solid #bee8d4;
    color: #137456;
}

body.profile-garage .estimate-import-audit-state {
    border: 1px solid;
    border-radius: 13px;
    display: grid;
    gap: 3px;
    margin-bottom: 14px;
    padding: 12px 14px;
}

body.profile-garage .estimate-import-audit-state strong,
body.profile-garage .estimate-import-audit-state span {
    display: block;
}

body.profile-garage .estimate-import-audit-state span {
    font-size: .76rem;
    line-height: 1.4;
}

body.profile-garage .estimate-import-audit-state.is-corrected {
    background: #fff8e7;
    border-color: #f1d28a;
    color: #76510b;
}

body.profile-garage .estimate-import-audit-state.is-clean {
    background: #eaf8f1;
    border-color: #b9e4cf;
    color: #126c51;
}

body.profile-garage .estimate-import-audit-state.is-blocked {
    background: #fff0f1;
    border-color: #ffcbd0;
    color: #a92635;
}

body.profile-garage .estimate-import-audit-totals {
    display: grid;
    gap: 9px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0 0 15px;
}

body.profile-garage .estimate-import-audit-totals > div {
    background: #f7f8fc;
    border: 1px solid #e2e7f0;
    border-radius: 12px;
    min-width: 0;
    padding: 11px 12px;
}

body.profile-garage .estimate-import-audit-totals dt {
    color: var(--muted);
    font-size: .68rem;
    font-weight: 800;
}

body.profile-garage .estimate-import-audit-totals dd {
    color: var(--text);
    font-size: 1.13rem;
    font-weight: 900;
    margin: 4px 0 0;
}

body.profile-garage .estimate-import-audit-totals small {
    color: var(--muted);
    display: block;
    font-size: .65rem;
    line-height: 1.35;
    margin-top: 3px;
}

body.profile-garage .estimate-import-audit-list,
body.profile-garage .estimate-import-blockers {
    display: grid;
    gap: 8px;
    margin-bottom: 14px;
}

body.profile-garage .estimate-import-audit-list article {
    align-items: start;
    background: #fffdf7;
    border: 1px solid #eadfc1;
    border-radius: 11px;
    display: grid;
    gap: 5px 10px;
    grid-template-columns: auto minmax(0, 1fr);
    padding: 10px;
}

body.profile-garage .estimate-import-audit-list article > b,
body.profile-garage .estimate-import-blockers b {
    background: #e9edff;
    border-radius: 7px;
    color: #4050c4;
    font-size: .7rem;
    padding: 5px 7px;
}

body.profile-garage .estimate-import-audit-list strong,
body.profile-garage .estimate-import-audit-list p {
    display: block;
}

body.profile-garage .estimate-import-audit-list strong {
    font-size: .78rem;
}

body.profile-garage .estimate-import-audit-list p {
    color: var(--muted);
    font-size: .7rem;
    line-height: 1.35;
    margin: 2px 0 0;
}

body.profile-garage .estimate-import-audit-list small {
    color: #76510b;
    font-size: .68rem;
    font-weight: 750;
    grid-column: 2;
}

body.profile-garage .estimate-import-blockers > div {
    align-items: center;
    background: #fff4f5;
    border: 1px solid #ffd5d9;
    border-radius: 11px;
    display: flex;
    gap: 9px;
    padding: 10px;
}

body.profile-garage .estimate-import-blockers span {
    color: #842331;
    font-size: .72rem;
    line-height: 1.35;
}

body.profile-garage .estimate-import-confirm-form {
    margin-top: 4px;
}

body.profile-garage .estimate-import-source-note,
body.profile-garage .estimate-import-formula-count {
    color: var(--muted);
    font-size: .69rem;
    line-height: 1.4;
    margin: 0;
}

body.profile-garage .estimate-import-formula-count {
    margin-top: 10px;
    text-align: center;
}

body.profile-garage .estimate-import-restart {
    align-items: center;
    background: #fff;
    border: 1px solid #d3dbea;
    border-radius: 10px;
    color: #3d4b68;
    display: inline-flex;
    font-size: .76rem;
    font-weight: 800;
    justify-content: center;
    min-height: 43px;
    padding: 9px 13px;
    text-decoration: none;
    width: 100%;
}

body.profile-garage .estimate-text-form {
    gap: 14px;
}

body.profile-garage .estimate-text-label > span {
    color: var(--text);
    font-size: .8rem;
    font-weight: 850;
}

body.profile-garage .estimate-text-form .estimate-text-label .estimate-text-input {
    background: #fbfcff;
    border: 1px solid #cfd9e8;
    border-radius: 14px;
    color: var(--text);
    font: inherit;
    font-size: .95rem;
    line-height: 1.48;
    min-height: 360px;
    padding: 14px;
    resize: vertical;
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
    width: 100%;
}

body.profile-garage .estimate-text-form .estimate-text-label .estimate-text-input:focus {
    background: #fff;
    border-color: #6675e8;
    box-shadow: 0 0 0 3px rgba(82, 99, 236, .12);
    outline: 0;
}

body.profile-garage .estimate-text-rules {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 16px;
}

body.profile-garage .estimate-text-rules > div {
    background: #f7f8fc;
    border: 1px solid #e3e7f0;
    border-radius: 11px;
    min-width: 0;
    padding: 10px;
}

body.profile-garage .estimate-text-rules :is(b, code, span) {
    display: block;
}

body.profile-garage .estimate-text-rules b {
    font-size: .76rem;
}

body.profile-garage .estimate-text-rules code {
    color: #4151d2;
    font-family: inherit;
    font-size: .72rem;
    font-weight: 800;
    margin-top: 5px;
    overflow-wrap: anywhere;
}

body.profile-garage .estimate-text-rules span {
    color: var(--muted);
    font-size: .68rem;
    line-height: 1.35;
    margin-top: 4px;
}

body.profile-garage .estimate-file-card > a small {
    color: #526079;
    font-size: .68rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.profile-garage .estimate-page {
    margin: 0 auto;
    max-width: 1440px;
}

body.profile-garage .estimate-hero {
    background: linear-gradient(135deg, #1b2b4b, #4f5fd8);
    border-radius: 24px;
    color: #fff;
    margin-bottom: 18px;
    overflow: visible;
    padding: clamp(22px, 4vw, 42px);
    position: relative;
}

body.profile-garage .estimate-hero .back-link,
body.profile-garage .estimate-hero p,
body.profile-garage .estimate-hero small {
    color: rgba(255, 255, 255, .78);
}

body.profile-garage .estimate-hero h1 {
    font-size: clamp(2rem, 5vw, 3.3rem);
    margin: 4px 0;
}

body.profile-garage .estimate-hero-row,
body.profile-garage .estimate-toolbar,
body.profile-garage .estimate-stage-head,
body.profile-garage .estimate-section-head,
body.profile-garage .estimate-savebar,
body.profile-garage .estimate-actions-panel,
body.profile-garage .estimate-grand-total,
body.profile-garage .estimate-balance-row {
    align-items: center;
    display: flex;
    justify-content: space-between;
}

body.profile-garage .estimate-hero-meta {
    align-items: flex-end;
    display: grid;
    gap: 6px;
    justify-items: end;
}

body.profile-garage .estimate-status {
    background: rgba(255, 255, 255, .15);
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 999px;
    padding: 7px 12px;
}

body.profile-garage .estimate-form,
body.profile-garage .estimate-actions-panel,
body.profile-garage .estimate-contract-panel,
body.profile-garage .estimate-version-history {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 12px 34px rgba(31, 49, 84, .08);
}

body.profile-garage .estimate-files-panel,
body.profile-garage .contract-form {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 12px 34px rgba(31, 49, 84, .08);
    margin-top: 14px;
    padding: 16px;
}

body.profile-garage .estimate-files-panel h2 {
    font-size: 1rem;
    margin: 0 0 10px;
}

body.profile-garage .estimate-file-list {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

body.profile-garage .estimate-file-card {
    background: #f6f8fc;
    border: 1px solid #e0e5ef;
    border-radius: 11px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 34px;
    min-width: 0;
    position: relative;
}

body.profile-garage .estimate-file-card > a {
    display: grid;
    gap: 3px;
    min-width: 0;
    padding: 11px;
    text-decoration: none;
}

body.profile-garage .estimate-file-list span {
    color: var(--muted);
    font-size: .72rem;
}

body.profile-garage .estimate-file-delete {
    align-self: center;
    margin-right: 6px;
    position: relative;
}

body.profile-garage .estimate-file-delete summary {
    align-items: center;
    background: #fff0f1;
    border: 1px solid #ffcbd0;
    border-radius: 8px;
    color: #c62838;
    cursor: pointer;
    display: flex;
    height: 30px;
    justify-content: center;
    list-style: none;
    width: 30px;
}

body.profile-garage .estimate-file-delete summary::-webkit-details-marker {
    display: none;
}

body.profile-garage .estimate-file-delete-confirm {
    background: #fff;
    border: 1px solid #f0b8be;
    border-radius: 11px;
    box-shadow: 0 14px 36px rgba(55, 25, 30, .18);
    display: grid;
    gap: 9px;
    padding: 10px;
    position: absolute;
    right: 0;
    top: 36px;
    width: 220px;
    z-index: 8;
}

body.profile-garage .estimate-file-delete-confirm > div {
    display: flex;
    gap: 7px;
    justify-content: flex-end;
}

body.profile-garage .estimate-file-delete-confirm form {
    margin: 0;
}

body.profile-garage .estimate-file-delete-confirm button {
    min-height: 34px;
    padding: 7px 10px !important;
}

body.profile-garage .estimate-file-delete-confirm .danger-button {
    background: #c62838 !important;
    border: 1px solid #c62838 !important;
    color: #fff !important;
}

body.profile-garage .contract-form-page {
    margin: 0 auto;
    max-width: 1120px;
}

body.profile-garage .contract-total-badge {
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 14px;
    display: grid;
    gap: 4px;
    padding: 12px 16px;
}

body.profile-garage .contract-total-badge strong {
    font-size: 1.25rem;
}

body.profile-garage .contract-form {
    display: grid;
    gap: 14px;
}

body.profile-garage .contract-form > section {
    animation: contract-card-in .24s ease both;
    background: linear-gradient(145deg, #fbfcff, #f5f7fc);
    border: 1px solid #e2e7ef;
    border-radius: 14px;
    display: grid;
    gap: 10px;
    padding: 15px;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

body.profile-garage .contract-form > section:hover {
    border-color: #cfd7ef;
    box-shadow: 0 10px 24px rgba(38, 55, 92, .07);
}

body.profile-garage .contract-form h2 {
    align-items: center;
    display: flex;
    font-size: 1rem;
    gap: 8px;
    margin: 0;
}

body.profile-garage .contract-form h2::before {
    background: linear-gradient(180deg, #5968f1, #765ee4);
    border-radius: 999px;
    content: "";
    height: 18px;
    width: 4px;
}

body.profile-garage .contract-fields {
    display: grid;
    gap: 10px;
}

body.profile-garage .contract-fields-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.profile-garage .contract-fields-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.profile-garage .contract-form label {
    color: var(--muted);
    display: grid;
    font-size: .76rem;
    gap: 5px;
}

body.profile-garage .contract-form :is(input, select, textarea) {
    background: #fff;
    border: 1px solid #d7dfeb;
    border-radius: 10px;
    min-height: 42px;
    min-width: 0;
    padding: 9px 10px;
    width: 100%;
}

body.profile-garage .contract-form :is(input, select, textarea):focus {
    border-color: #7080f1;
    box-shadow: 0 0 0 3px rgba(88, 105, 236, .12);
    outline: 0;
}

body.profile-garage .contract-form textarea {
    min-height: 90px;
}

body.profile-garage .contract-form-help {
    color: var(--muted);
    font-size: .78rem;
    margin: 0;
}

body.profile-garage .contract-form .estimate-option {
    display: flex;
}

body.profile-garage .contract-form .estimate-option input {
    min-height: 18px;
    width: 18px;
}

body.profile-garage .contract-option-toggle {
    align-items: center;
    background: #fff;
    border: 1px solid #dfe5f1;
    border-radius: 12px;
    cursor: pointer;
    display: grid !important;
    gap: 9px !important;
    grid-template-columns: minmax(0, 1fr) 38px;
    max-width: 430px;
    padding: 10px 12px;
    position: relative;
}

body.profile-garage .contract-option-toggle > input {
    height: 1px;
    min-height: 0;
    opacity: 0;
    padding: 0;
    pointer-events: none;
    position: absolute;
    width: 1px;
}

body.profile-garage .contract-option-toggle > span:last-child {
    color: var(--text);
    display: grid;
    gap: 2px;
    min-width: 0;
    order: 1;
}

body.profile-garage .contract-option-toggle > .estimate-toggle-control {
    justify-self: end;
    order: 2;
}

body.profile-garage .contract-option-toggle small {
    color: var(--muted);
}

body.profile-garage .contract-option-toggle:has(input:checked) {
    background: #f1f4ff;
    border-color: #bdc7ff;
}

body.profile-garage .contract-conditional-fields {
    animation: contract-card-in .2s ease both;
    background: #eef2ff;
    border: 1px solid #d8dffe;
    border-radius: 12px;
    padding: 11px;
}

body.profile-garage .contract-conditional-fields[hidden] {
    display: none;
}

body.profile-garage .contract-customer-fields {
    animation: contract-card-in .2s ease both;
    display: grid;
    gap: 10px;
}

body.profile-garage .contract-customer-input-grid {
    grid-template-columns: minmax(0, 1fr);
}

body.profile-garage .contract-customer-section :is(input, textarea) {
    font-size: .93rem;
    min-height: 48px;
    padding: 11px 12px;
}

body.profile-garage .contract-form-actions {
    align-items: center;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 3px 2px;
}

body.profile-garage .contract-form-actions button {
    background: linear-gradient(135deg, #4f5df5, #6959dd);
    border: 0;
    border-radius: 11px;
    color: #fff;
    cursor: pointer;
    font-weight: 800;
    padding: 12px 18px;
    box-shadow: 0 9px 22px rgba(77, 88, 224, .24);
    transition: box-shadow .18s ease, transform .18s ease;
}

body.profile-garage .contract-form-actions button:hover {
    box-shadow: 0 12px 28px rgba(77, 88, 224, .3);
    transform: translateY(-1px);
}

body.profile-garage .contract-form-actions .contract-cancel-button {
    align-items: center;
    background: #f1f3ff !important;
    border: 1px solid #d7ddff !important;
    border-radius: 11px;
    color: #3c4bcf !important;
    display: inline-flex;
    font-weight: 800;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    text-decoration: none;
}

@keyframes contract-card-in {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    body.profile-garage .contract-form > section,
    body.profile-garage .contract-conditional-fields {
        animation: none;
    }
}

.estimate-preview-body {
    background: #eef1f6;
    color: #17233a;
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 28px;
}

.estimate-preview-sheet {
    background: #fff;
    box-shadow: 0 18px 50px rgba(24, 35, 56, .12);
    margin: 0 auto;
    max-width: 1120px;
    min-height: 800px;
    padding: 48px;
}

.estimate-preview-sheet > header {
    align-items: start;
    border-bottom: 3px solid #4e5ce7;
    display: flex;
    justify-content: space-between;
    padding-bottom: 22px;
}

.estimate-preview-sheet h1 {
    font-size: 2.6rem;
    margin: 3px 0;
}

.estimate-preview-sheet header p {
    color: #4e5ce7;
    font-weight: 800;
    margin: 0;
}

.estimate-preview-sheet dl {
    margin: 0;
}

.estimate-preview-sheet dl > div {
    display: flex;
    gap: 18px;
    justify-content: space-between;
    padding: 4px 0;
}

.estimate-preview-sheet dt {
    color: #65738a;
}

.estimate-preview-object {
    display: grid;
    gap: 4px;
    margin: 22px 0;
}

.estimate-preview-object span {
    color: #65738a;
    font-size: .78rem;
    text-transform: uppercase;
}

.estimate-preview-stage h2 {
    align-items: center;
    background: #1e2d4a;
    color: #fff;
    display: flex;
    font-size: 1.05rem;
    gap: 16px;
    justify-content: space-between;
    margin: 24px 0 10px;
    padding: 10px 12px;
}

.estimate-preview-stage h2 strong {
    color: inherit;
    font-size: .92em;
    white-space: nowrap;
}

.estimate-preview-stage h3 {
    color: #4e5ce7;
    font-size: .9rem;
    margin: 14px 0 7px;
}

.estimate-preview-stage table {
    border-collapse: collapse;
    font-size: .82rem;
    width: 100%;
}

.estimate-preview-stage th,
.estimate-preview-stage td {
    border: 1px solid #dce1ea;
    padding: 8px;
    text-align: right;
}

.estimate-preview-stage th:first-child,
.estimate-preview-stage td:first-child {
    text-align: left;
}

.estimate-preview-stage thead {
    background: #e9ecff;
}

.estimate-preview-total {
    border-top: 2px solid #dce1ea;
    margin-left: auto;
    margin-top: 26px;
    max-width: 390px;
    padding-top: 12px;
}

.estimate-preview-total .grand {
    color: #3e4bd4;
    font-size: 1.15rem;
    font-weight: 800;
}

body.profile-garage .estimate-form {
    padding: clamp(12px, 2vw, 22px);
}

body.profile-garage .estimate-toolbar small,
body.profile-garage .estimate-toolbar strong {
    display: block;
}

body.profile-garage .estimate-toolbar small {
    color: var(--muted);
    margin-top: 3px;
}

body.profile-garage .secondary-button,
body.profile-garage .estimate-section-head button,
body.profile-garage .estimate-remove-stage,
body.profile-garage [data-remove-item] {
    background: #eef1ff !important;
    border: 1px solid #d8ddff !important;
    color: #3947c8 !important;
}

body.profile-garage .estimate-stage {
    border: 1px solid #dce3ef;
    border-radius: 16px;
    margin-top: 16px;
    overflow: hidden;
}

body.profile-garage .estimate-stage-head {
    background: #f7f8fc;
    gap: 12px;
    padding: 12px;
}

body.profile-garage .estimate-stage-name {
    background: transparent;
    border: 0;
    color: #1c2940;
    font-size: 1.05rem;
    font-weight: 850;
    min-width: 0;
    width: 100%;
}

body.profile-garage .estimate-stage-subtotals {
    display: flex;
    flex: none;
    gap: 12px;
}

body.profile-garage .estimate-stage-subtotals span {
    color: var(--muted);
    font-size: .72rem;
    white-space: nowrap;
}

body.profile-garage .estimate-stage-subtotals b {
    color: var(--text);
    display: block;
    font-size: .85rem;
}

body.profile-garage .estimate-remove-stage,
body.profile-garage [data-remove-item] {
    border-radius: 9px !important;
    flex: none;
    min-height: 34px;
    padding: 5px 10px !important;
}

body.profile-garage .estimate-stage-columns,
body.profile-garage .estimate-commercial,
body.profile-garage .estimate-notes {
    display: grid;
    gap: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.profile-garage .estimate-section {
    min-width: 0;
    padding: 14px;
}

body.profile-garage .estimate-section + .estimate-section {
    border-left: 1px solid #e0e6ef;
}

body.profile-garage .estimate-section-head h2,
body.profile-garage .estimate-commercial-card h2,
body.profile-garage .estimate-contract-panel h2 {
    font-size: .98rem;
    margin: 0;
}

body.profile-garage .estimate-section-head button {
    border-radius: 9px !important;
    font-size: .75rem;
    padding: 7px 10px !important;
}

body.profile-garage .estimate-item {
    border-top: 1px solid #edf0f5;
    display: grid;
    gap: 8px;
    margin-top: 9px;
    padding-top: 9px;
}

body.profile-garage .estimate-extra-payment,
body.profile-garage .estimate-stage-payment,
body.profile-garage .estimate-discount-fields {
    display: grid;
    gap: 7px;
}

body.profile-garage :is(.estimate-extra-payment, .estimate-stage-payment, .estimate-discount-fields)[hidden] {
    display: none !important;
}

body.profile-garage .estimate-item-columns-header,
body.profile-garage .estimate-item-row {
    align-items: start;
    display: grid;
    gap: 6px;
    grid-template-columns: minmax(180px, 1.6fr) 58px 62px minmax(82px, .65fr) 78px 32px;
}

body.profile-garage .estimate-item-columns-header {
    color: var(--muted);
    font-size: .62rem;
    font-weight: 800;
    padding: 8px 0 0;
    text-transform: uppercase;
}

body.profile-garage .estimate-page :is(input, select, textarea) {
    background: #fff;
    border: 1px solid #d7dfeb;
    border-radius: 9px;
    min-height: 38px;
    min-width: 0;
    padding: 7px 9px;
    width: 100%;
}

body.profile-garage .estimate-item-name {
    line-height: 1.3;
    min-height: 40px;
    overflow: hidden;
    resize: none;
    white-space: pre-wrap;
    word-break: break-word;
}

body.profile-garage .estimate-item-name.is-scrollable {
    overflow-y: auto;
}

body.profile-garage .estimate-page label {
    color: var(--muted);
    display: grid;
    font-size: .73rem;
    gap: 4px;
}

body.profile-garage .estimate-item-row output {
    font-size: .86rem;
    font-weight: 850;
    text-align: right;
    white-space: nowrap;
}

body.profile-garage .estimate-commercial {
    gap: 14px;
    margin-top: 16px;
}

body.profile-garage .estimate-commercial-card,
body.profile-garage .estimate-notes > label {
    background: #f7f9fc;
    border: 1px solid #e0e6ef;
    border-radius: 14px;
    padding: 15px;
}

body.profile-garage .estimate-live-totals div {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
}

body.profile-garage .estimate-live-totals {
    font-size: .82rem;
    margin: 10px 0;
}

body.profile-garage .estimate-discount-fields,
body.profile-garage .estimate-extra-payment {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.profile-garage .estimate-discount-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.profile-garage .estimate-options-card {
    display: grid;
    gap: 10px;
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.profile-garage .estimate-options-heading {
    grid-column: 1 / -1;
}

body.profile-garage .estimate-options-heading p {
    color: var(--muted);
    font-size: .76rem;
    margin: 3px 0 0;
}

body.profile-garage .estimate-grand-total {
    border-top: 1px solid #dfe4ee;
    font-size: 1.15rem;
    margin-top: 14px;
    padding-top: 13px;
}

body.profile-garage .estimate-grand-total strong {
    color: #3d49d5;
    font-size: 1.45rem;
}

body.profile-garage .estimate-toggle {
    align-items: center;
    background: #fff;
    border: 1px solid #e0e6ef;
    border-radius: 11px;
    cursor: pointer;
    display: grid;
    font-size: .8rem;
    gap: 9px;
    grid-template-columns: minmax(0, 1fr) 38px;
    min-height: 54px;
    padding: 8px 10px;
    transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
}

body.profile-garage .estimate-toggle > input {
    height: 1px;
    min-height: 0;
    opacity: 0;
    padding: 0;
    pointer-events: none;
    position: absolute;
    width: 1px;
}

body.profile-garage .estimate-toggle-control {
    background: #cbd4e2;
    border-radius: 99px;
    flex: none;
    height: 20px;
    max-width: 34px;
    min-width: 34px;
    order: 2;
    position: relative;
    transition: background-color .18s ease;
    width: 34px !important;
}

body.profile-garage .estimate-toggle > span:last-child {
    min-width: 0;
    order: 1;
}

body.profile-garage .estimate-toggle:has(input:checked) {
    background: #f2f4ff;
    border-color: #c5ceff;
    box-shadow: 0 7px 18px rgba(68, 82, 209, .08);
}

body.profile-garage .estimate-toggle-control::after {
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(20, 35, 60, .28);
    content: "";
    height: 16px;
    left: 2px;
    position: absolute;
    top: 2px;
    transition: transform .18s ease;
    width: 16px;
}

body.profile-garage .estimate-toggle > input:checked + .estimate-toggle-control {
    background: #5265e8;
}

body.profile-garage .estimate-toggle > input:checked + .estimate-toggle-control::after {
    transform: translateX(14px);
}

body.profile-garage .estimate-toggle > input:focus-visible + .estimate-toggle-control {
    outline: 3px solid rgba(82, 101, 232, .2);
}

body.profile-garage .estimate-toggle strong,
body.profile-garage .estimate-toggle small {
    display: block;
}

body.profile-garage .estimate-toggle strong {
    color: var(--text);
    font-size: .79rem;
}

body.profile-garage .estimate-toggle small {
    color: var(--muted);
    font-size: .66rem;
    margin-top: 2px;
}

body.profile-garage .estimate-discount-fields,
body.profile-garage .estimate-extra-payment {
    background: #f2f5ff;
    border: 1px solid #dce3fb;
    border-radius: 11px;
    grid-column: 1 / -1;
    padding: 10px;
}

body.profile-garage .estimate-notes {
    gap: 14px;
    margin-top: 14px;
}

body.profile-garage .estimate-notes textarea {
    min-height: 78px;
}

body.profile-garage .estimate-savebar {
    background: #202d47;
    border-radius: 13px;
    color: #fff;
    gap: 12px;
    margin-top: 16px;
    padding: 11px 13px;
}

body.profile-garage .estimate-actions-panel,
body.profile-garage .estimate-contract-panel {
    gap: 12px;
    margin-top: 14px;
    padding: 16px;
}

body.profile-garage .estimate-actions-panel {
    backdrop-filter: blur(16px);
    background: rgba(255, 255, 255, .94);
    display: grid;
    padding: 10px;
    position: relative;
    z-index: 18;
}

body.profile-garage .estimate-workflow-status {
    align-items: center;
    background: #e9f8f1;
    border: 1px solid #bee8d4;
    border-radius: 11px;
    color: #137456;
    display: grid;
    font-size: .8rem;
    gap: 8px;
    grid-template-columns: 10px minmax(0, 1fr) auto;
    min-height: 38px;
    padding: 8px 11px;
}

body.profile-garage .estimate-workflow-status-icon {
    background: #20a879;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(32, 168, 121, .12);
    height: 8px;
    width: 8px;
}

body.profile-garage .estimate-workflow-status small {
    color: inherit;
    font-size: .7rem;
    opacity: .82;
    white-space: nowrap;
}

body.profile-garage .estimate-workflow-status.is-dirty {
    background: #fff7e8;
    border-color: #f3d49c;
    color: #8c5b07;
}

body.profile-garage .estimate-workflow-status.is-dirty .estimate-workflow-status-icon {
    background: #e6a325;
    box-shadow: 0 0 0 4px rgba(230, 163, 37, .14);
}

body.profile-garage .estimate-workflow-status.is-error {
    background: #fff0f1;
    border-color: #ffcbd0;
    color: #a92635;
}

body.profile-garage .estimate-workflow-status.is-error .estimate-workflow-status-icon {
    background: #d74454;
    box-shadow: 0 0 0 4px rgba(215, 68, 84, .13);
}

body.profile-garage .estimate-workflow-actions {
    align-items: stretch;
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-width: 0;
}

body.profile-garage .estimate-workflow-actions.has-version-action {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

body.profile-garage .estimate-action-slot {
    align-items: stretch;
    display: flex;
    min-height: 56px;
    min-width: 0;
}

body.profile-garage .estimate-action-slot > :is(a, button, form),
body.profile-garage .estimate-action-slot > form > button {
    width: 100%;
}

body.profile-garage .estimate-action-slot-state {
    display: grid;
    gap: 8px;
    grid-column: 1 / -1;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

body.profile-garage .estimate-action-slot-state > form {
    min-width: 0;
}

body.profile-garage .estimate-action-slot-export {
    grid-column: span 1;
}

body.profile-garage .estimate-version-save-hint {
    color: var(--muted);
    font-size: .72rem;
    margin: 0;
    text-align: center;
}

body.profile-garage .estimate-version-save-hint b {
    color: #3c4bcf;
}

body.profile-garage .estimate-actions-panel form {
    margin: 0;
}

body.profile-garage .estimate-action-button {
    align-items: center;
    border-radius: 10px !important;
    display: inline-flex !important;
    font-size: .78rem;
    gap: 7px;
    justify-content: center;
    min-height: 40px;
    padding: 8px 13px !important;
    text-decoration: none;
    transition: box-shadow .18s ease, opacity .18s ease, transform .18s ease;
    white-space: nowrap;
}

body.profile-garage .estimate-action-button:hover:not(:disabled) {
    box-shadow: 0 8px 20px rgba(48, 61, 150, .18);
    transform: translateY(-1px);
}

body.profile-garage .estimate-action-secondary {
    background: #f1f3ff !important;
    border: 1px solid #d7ddff !important;
    color: #3c4bcf !important;
}

body.profile-garage .estimate-action-success {
    background: linear-gradient(135deg, #168d68, #21aa7b) !important;
    color: #fff !important;
}

body.profile-garage .estimate-action-save {
    background: linear-gradient(135deg, #ef9e19, #dc7d0c) !important;
    color: #fff !important;
}

body.profile-garage .estimate-action-save.is-clean,
body.profile-garage .estimate-action-save.is-clean:disabled {
    background: #eef2f7 !important;
    border: 1px solid #d7dfeb !important;
    color: #66758a !important;
    opacity: 1;
}

body.profile-garage .estimate-action-button:disabled,
body.profile-garage [data-requires-clean].is-disabled {
    cursor: not-allowed;
    opacity: .5;
    pointer-events: none;
}

body.profile-garage .estimate-action-button[hidden] {
    display: none !important;
}

body.profile-garage .estimate-export-picker {
    align-items: center;
    background: #f5f7ff;
    border: 1px solid #dce2fb;
    border-radius: 12px;
    display: flex;
    gap: 8px;
    padding: 7px;
}

body.profile-garage .estimate-export-picker label {
    color: var(--muted);
    display: grid;
    font-size: .66rem;
    gap: 3px;
}

body.profile-garage .estimate-export-picker select {
    background: #fff;
    border: 1px solid #ccd6e8;
    border-radius: 9px;
    color: var(--text);
    min-height: 36px;
    padding: 6px 30px 6px 9px;
}

body.profile-garage .estimate-contract-panel {
    align-items: start;
    display: flex;
    flex-direction: column;
}

body.profile-garage .contract-type-picker {
    align-items: end;
    background: #f5f7fc;
    border: 1px solid #dfe5ef;
    border-radius: 13px;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 12px;
    width: 100%;
}

body.profile-garage .contract-type-picker label {
    color: var(--muted);
    display: grid;
    font-size: .73rem;
    gap: 5px;
    min-width: 0;
}

body.profile-garage .contract-type-picker select {
    background: #fff;
    border: 1px solid #cfd9e8;
    border-radius: 10px;
    color: var(--text);
    font: inherit;
    min-height: 42px;
    min-width: 0;
    padding: 9px 34px 9px 11px;
    width: 100%;
}

body.profile-garage .contract-type-picker button {
    min-height: 42px;
    white-space: nowrap;
}

body.profile-garage .estimate-version-history {
    margin-top: 14px;
    padding: 0;
}

body.profile-garage .estimate-version-history > summary {
    align-items: center;
    cursor: pointer;
    display: flex;
    font-weight: 800;
    gap: 8px;
    list-style: none;
    padding: 14px 16px;
}

body.profile-garage .estimate-version-history > summary::before {
    color: #5060e8;
    content: "›";
    font-size: 1.35rem;
    line-height: 1;
    transition: transform .18s ease;
}

body.profile-garage .estimate-version-history[open] > summary::before {
    transform: rotate(90deg);
}

body.profile-garage .estimate-version-history > summary::-webkit-details-marker,
body.profile-garage .estimate-version-delete > summary::-webkit-details-marker {
    display: none;
}

body.profile-garage .estimate-version-history > summary b {
    align-items: center;
    background: #eef1ff;
    border-radius: 999px;
    color: #4454d8;
    display: inline-flex;
    font-size: .72rem;
    height: 24px;
    justify-content: center;
    min-width: 24px;
}

body.profile-garage .estimate-version-list {
    display: grid;
    gap: 7px;
    padding: 0 14px 14px;
}

body.profile-garage .estimate-version-card {
    align-items: center;
    background: #f7f9fc;
    border: 1px solid #e0e6ef;
    border-radius: 12px;
    display: grid;
    gap: 10px;
    grid-template-columns: 54px minmax(0, 1fr) auto;
    padding: 9px;
    position: relative;
}

body.profile-garage .estimate-version-card.is-current {
    background: #f3f5ff;
    border-color: #cfd6ff;
}

body.profile-garage .estimate-version-number {
    align-items: center;
    background: #fff;
    border: 1px solid #dfe5ef;
    border-radius: 9px;
    display: grid;
    justify-items: center;
    padding: 4px;
}

body.profile-garage .estimate-version-number small,
body.profile-garage .estimate-version-info span {
    color: var(--muted);
    font-size: .65rem;
}

body.profile-garage .estimate-version-number strong {
    color: #4656dd;
    font-size: 1.05rem;
}

body.profile-garage .estimate-version-info {
    display: grid;
    gap: 3px;
}

body.profile-garage .estimate-version-actions {
    display: flex;
    gap: 6px;
}

body.profile-garage .estimate-version-actions form {
    margin: 0;
}

body.profile-garage .estimate-icon-button {
    align-items: center;
    background: #fff !important;
    border: 1px solid #d4dcf1 !important;
    border-radius: 9px !important;
    color: #3f55da !important;
    display: inline-flex;
    height: 34px;
    justify-content: center;
    padding: 0 !important;
    width: 34px;
}

body.profile-garage .estimate-icon-button.danger {
    background: #fff1f2 !important;
    border-color: #ffcbd0 !important;
    color: #c62838 !important;
    cursor: pointer;
    list-style: none;
}

body.profile-garage .estimate-version-delete {
    position: relative;
}

body.profile-garage .estimate-version-confirm {
    background: #fff;
    border: 1px solid #f1b9bf;
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(58, 23, 29, .2);
    display: grid;
    gap: 7px;
    padding: 11px;
    position: absolute;
    right: 0;
    top: 40px;
    width: 240px;
    z-index: 12;
}

body.profile-garage .estimate-version-confirm p {
    color: var(--muted);
    font-size: .72rem;
    margin: 0;
}

body.profile-garage .estimate-version-confirm > div {
    display: flex;
    gap: 7px;
    justify-content: flex-end;
}

body.profile-garage .estimate-version-confirm button {
    min-height: 34px;
    padding: 7px 10px !important;
}

body.profile-garage .estimate-version-confirm .danger-button {
    background: #c62838 !important;
    color: #fff !important;
}

body.profile-garage .estimate-mobile-tabs {
    display: none;
}

@media (max-width: 719px) {
    body.profile-garage .customer-document-grid {
        gap: 6px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.profile-garage .customer-document-item {
        padding: 7px 8px;
    }

    body.profile-garage .customer-document-item:has(.customer-inline-field[open]) {
        grid-column: 1 / -1;
    }

    body.profile-garage .customer-inline-field summary {
        gap: 5px;
        grid-template-columns: minmax(0, 1fr) 27px;
    }

    body.profile-garage .customer-inline-field summary > .lead-edit-icon {
        height: 27px;
        width: 27px;
    }

    body.profile-garage .customer-field-label {
        font-size: .58rem;
    }

    body.profile-garage .customer-field-copy strong {
        font-size: .75rem;
    }

    body.profile-garage .customer-inline-form {
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-garage .customer-inline-form textarea,
    body.profile-garage .customer-inline-form textarea + button {
        grid-column: auto;
    }

    body.profile-garage .customer-document-wide {
        grid-column: 1 / -1;
    }
    body.profile-garage .lead-estimate-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.profile-garage .lead-estimate-summary > div:last-child {
        grid-column: 1 / -1;
    }

    body.profile-garage .estimate-hero {
        border-radius: 14px;
        padding: 12px;
    }

    body.profile-garage .estimate-hero-row {
        align-items: start;
    }

    body.profile-garage .estimate-stage-head {
        align-items: start;
        flex-wrap: wrap;
        gap: 7px;
        padding: 8px;
    }

    body.profile-garage .estimate-stage-subtotals {
        order: 3;
        width: 100%;
    }

    body.profile-garage .estimate-mobile-tabs {
        background: #f1f3f8;
        display: grid;
        gap: 4px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: 4px;
    }

    body.profile-garage .estimate-mobile-tabs button {
        background: transparent !important;
        color: var(--muted) !important;
        font-size: .72rem;
        min-height: 32px;
        padding: 6px 4px !important;
    }

    body.profile-garage .estimate-mobile-tabs button.is-active {
        background: #fff !important;
        box-shadow: 0 2px 8px rgba(34, 48, 77, .1);
        color: #303dc6 !important;
    }

    body.profile-garage .estimate-stage-columns,
    body.profile-garage .estimate-commercial,
    body.profile-garage .estimate-notes {
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-garage .estimate-stage[data-mobile-section="MATERIALS"] .estimate-section-work,
    body.profile-garage .estimate-stage[data-mobile-section="WORK"] .estimate-section-materials {
        display: none;
    }

    body.profile-garage .estimate-section + .estimate-section {
        border-left: 0;
    }

    body.profile-garage .estimate-form {
        padding: 8px;
    }

    body.profile-garage .estimate-toolbar {
        align-items: start;
        gap: 8px;
    }

    body.profile-garage .estimate-toolbar button {
        font-size: .7rem;
        min-height: 32px;
        padding: 6px 8px !important;
    }

    body.profile-garage .estimate-stage {
        border-radius: 12px;
        margin-top: 10px;
    }

    body.profile-garage .estimate-stage-name {
        font-size: .88rem;
    }

    body.profile-garage .estimate-stage-subtotals {
        gap: 10px;
    }

    body.profile-garage .estimate-section {
        padding: 9px;
    }

    body.profile-garage .estimate-section-head h2 {
        font-size: .84rem;
    }

    body.profile-garage .estimate-item-columns-header {
        display: none;
    }

    body.profile-garage .estimate-item {
        gap: 4px;
        margin-top: 6px;
        padding-top: 6px;
    }

    body.profile-garage .estimate-item-row {
        gap: 5px;
        grid-template-columns: 54px 62px minmax(82px, 1fr) 32px;
    }

    body.profile-garage .estimate-item-name {
        grid-column: 1 / -1;
        grid-row: 1;
        min-height: 36px;
    }

    body.profile-garage .estimate-item-row output {
        color: #3445c7;
        font-size: .72rem;
        grid-column: 1 / 4;
        grid-row: 3;
        min-height: 14px;
        text-align: right;
    }

    body.profile-garage .estimate-item-row [data-remove-item] {
        grid-column: 4;
        grid-row: 2;
    }

    body.profile-garage .estimate-item-row [data-item-unit] {
        grid-column: 1;
        grid-row: 2;
    }

    body.profile-garage .estimate-item-row [data-item-quantity] {
        grid-column: 2;
        grid-row: 2;
    }

    body.profile-garage .estimate-item-row [data-item-price] {
        grid-column: 3;
        grid-row: 2;
    }

    body.profile-garage .estimate-page :is(input, select, textarea) {
        font-size: .72rem;
        min-height: 32px;
        padding: 5px 6px;
    }

    body.profile-garage .estimate-item-row [data-remove-item] {
        min-height: 32px;
        padding: 4px !important;
    }

    body.profile-garage .estimate-options-card {
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-garage .estimate-toggle {
        min-height: 48px;
        padding: 7px 8px;
    }

    body.profile-garage .estimate-discount-fields,
    body.profile-garage .estimate-extra-payment {
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-garage .estimate-commercial-card,
    body.profile-garage .estimate-notes > label {
        border-radius: 11px;
        padding: 10px;
    }

    body.profile-garage .estimate-actions-panel {
        gap: 7px;
        padding: 7px;
    }

    body.profile-garage .estimate-workflow-status {
        font-size: .7rem;
        grid-template-columns: 8px minmax(0, 1fr);
        min-height: 34px;
        padding: 7px 9px;
    }

    body.profile-garage .estimate-workflow-status small {
        display: none;
    }

    body.profile-garage .estimate-workflow-actions {
        display: grid;
        gap: 6px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.profile-garage .estimate-workflow-actions.has-version-action {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.profile-garage .estimate-action-slot {
        min-height: 42px;
        min-width: 0;
        width: 100%;
    }

    body.profile-garage .estimate-action-slot-preview {
        grid-column: 1;
    }

    body.profile-garage .estimate-action-slot-save {
        grid-column: 2;
    }

    body.profile-garage .estimate-action-slot-version {
        grid-column: 1 / -1;
    }

    body.profile-garage .estimate-action-slot-state {
        grid-column: 1 / -1;
    }

    body.profile-garage .estimate-action-slot-export {
        grid-column: 1 / -1;
    }

    body.profile-garage .estimate-action-slot-state button {
        width: 100%;
    }

    body.profile-garage .estimate-action-slot-state {
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-garage .estimate-version-save-hint {
        font-size: .66rem;
        line-height: 1.35;
        padding: 0 5px 2px;
    }

    body.profile-garage .estimate-action-button {
        font-size: .7rem;
        min-height: 36px;
        padding: 6px 8px !important;
    }

    body.profile-garage .estimate-export-picker {
        align-items: end;
        display: grid;
        grid-column: 1 / -1;
        grid-template-columns: minmax(0, 1fr) auto;
        width: 100%;
    }

    body.profile-garage .lead-estimate-actions {
        align-items: stretch;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
    }

    body.profile-garage .estimate-workspace-confirm {
        left: 50%;
        position: fixed;
        right: auto;
        top: 50%;
        transform: translate(-50%, -50%);
        width: calc(100vw - 24px);
    }

    body.profile-garage .estimate-export-picker label,
    body.profile-garage .estimate-export-picker select {
        width: 100%;
    }

    body.profile-garage .estimate-export-picker label > span {
        display: none;
    }

    body.profile-garage .estimate-export-picker button {
        width: auto;
    }

    body.profile-garage .contract-type-picker {
        align-items: stretch;
        grid-template-columns: minmax(0, 1fr);
        padding: 9px;
    }

    body.profile-garage .contract-type-picker button {
        width: 100%;
    }

    body.profile-garage .estimate-file-list {
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-garage .estimate-version-card {
        gap: 7px;
        grid-template-columns: 44px minmax(0, 1fr) auto;
        padding: 7px;
    }

    body.profile-garage .estimate-version-confirm {
        position: fixed;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        width: calc(100vw - 24px);
    }

    body.profile-garage .contract-fields-2,
    body.profile-garage .contract-fields-3 {
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-garage .contract-form-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    body.profile-garage .contract-form-actions :is(a, button) {
        text-align: center;
        width: 100%;
    }

    body.profile-garage .contract-customer-section :is(input, textarea) {
        font-size: 1rem;
        min-height: 46px;
    }

    body.profile-garage .lead-estimate-actions > .primary-panel-link {
        grid-column: 1 / -1;
        width: 100%;
    }

    body.profile-garage .estimate-upload-link {
        font-size: .72rem;
        min-height: 38px;
        padding: 7px 9px;
    }

    body.profile-garage .estimate-import-page {
        width: 100%;
    }

    body.profile-garage .estimate-import-hero {
        border-radius: 17px;
        margin-bottom: 10px;
        padding: 18px 16px;
    }

    body.profile-garage .estimate-import-hero h1 {
        font-size: 2rem;
    }

    body.profile-garage .estimate-import-card {
        border-radius: 14px;
        padding: 13px;
    }

    body.profile-garage .estimate-import-explainer {
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-garage .estimate-import-audit-totals {
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-garage .estimate-import-audit-list article {
        grid-template-columns: minmax(0, 1fr);
    }

    body.profile-garage .estimate-import-audit-list article > b {
        justify-self: start;
    }

    body.profile-garage .estimate-import-audit-list small {
        grid-column: 1;
    }

    body.profile-garage .estimate-text-rules {
        grid-template-columns: minmax(0, 1fr);
        margin-top: 10px;
    }

    body.profile-garage .estimate-text-rules > div {
        padding: 8px 9px;
    }

    body.profile-garage .estimate-text-form .estimate-text-label .estimate-text-input {
        font-size: 1rem;
        line-height: 1.4;
        min-height: 46vh;
        padding: 11px;
    }

    body.profile-garage .estimate-file-picker > span {
        padding: 10px;
    }

    body.profile-garage .estimate-file-picker small {
        line-height: 1.35;
        overflow: visible;
        text-overflow: clip;
        white-space: normal;
    }

    .estimate-preview-body {
        padding: 0;
    }

    .estimate-preview-sheet {
        box-shadow: none;
        padding: 18px 12px;
    }

    .estimate-preview-sheet > header {
        display: grid;
        gap: 12px;
    }

    .estimate-preview-stage {
        overflow-x: auto;
    }

    .estimate-preview-stage table {
        min-width: 680px;
    }
}

@media (min-width: 481px) and (max-width: 719px) {
    body.profile-garage .estimate-workflow-actions.has-version-action .estimate-action-slot-version {
        grid-column: 1;
    }

    body.profile-garage .estimate-workflow-actions.has-version-action .estimate-action-slot-export {
        grid-column: 2;
    }
}

/* Dashboard rich lead cards final cascade guards v1 */
body.profile-garage .attention-card-rich .attention-comment {
    background: #fff7df;
    border-color: #efd58f;
}

body.profile-garage .attention-card-rich .attention-quiz {
    background: #f2f6fc;
    border-color: #dce5f1;
}

body.profile-garage .attention-card-rich .attention-page {
    background: #fafbfe;
    border-color: #e1e7f0;
}

@media (max-width: 719px) {
    body.profile-garage .attention-facts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Estimate document archive and print center */
body.profile-garage .documents-nav-link {
    align-items: center;
    display: inline-flex;
    gap: 6px;
}

body.profile-garage .estimate-files-heading,
body.profile-garage .document-center-section-heading {
    align-items: center;
    display: flex;
    justify-content: space-between;
}

body.profile-garage .estimate-files-heading h2,
body.profile-garage .document-center-section-heading h2 {
    margin: 0;
}

body.profile-garage .estimate-files-heading > span,
body.profile-garage .document-count-badge {
    background: #eef0ff;
    border-radius: 999px;
    color: #4352d6;
    font-size: .72rem;
    font-weight: 850;
    padding: 5px 9px;
}

body.profile-garage .estimate-version-files-list {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

body.profile-garage .estimate-version-files-card {
    background: #f7f8fc;
    border: 1px solid #e0e5ef;
    border-radius: 14px;
    min-width: 0;
    padding: 11px;
}

body.profile-garage .estimate-version-files-card > header {
    align-items: center;
    display: flex;
    justify-content: space-between;
}

body.profile-garage .estimate-version-files-card > header div,
body.profile-garage .estimate-version-files-card > header small,
body.profile-garage .estimate-contract-file-row > div,
body.profile-garage .estimate-contract-file-row small {
    display: grid;
}

body.profile-garage .estimate-version-files-card > header small,
body.profile-garage .estimate-contract-file-row small {
    color: var(--muted);
    font-size: .62rem;
    font-weight: 750;
    text-transform: uppercase;
}

body.profile-garage .estimate-version-files-card > header > span {
    color: var(--muted);
    font-size: .68rem;
}

body.profile-garage .estimate-contract-file-actions {
    display: grid;
    gap: 6px;
    margin-top: 9px;
}

body.profile-garage .estimate-contract-file-row {
    align-items: center;
    background: #fff;
    border: 1px solid #e3e7f1;
    border-radius: 10px;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    min-width: 0;
    padding: 8px 9px;
}

body.profile-garage .estimate-print-button,
body.profile-garage .document-primary-button,
body.profile-garage .document-secondary-button,
body.profile-garage .document-success-button {
    align-items: center;
    border-radius: 9px;
    cursor: pointer;
    display: inline-flex;
    font-size: .72rem;
    font-weight: 850;
    gap: 6px;
    justify-content: center;
    min-height: 34px;
    padding: 7px 11px !important;
    text-decoration: none;
    white-space: nowrap;
}

body.profile-garage .estimate-print-button,
body.profile-garage .document-primary-button {
    background: linear-gradient(135deg, #4d5df2, #6557df);
    border: 1px solid transparent;
    color: #fff;
}

body.profile-garage .document-secondary-button {
    background: #fff;
    border: 1px solid #d8dfed;
    color: #263653;
}

body.profile-garage .document-success-button {
    background: #149b70;
    border: 1px solid #149b70;
    color: #fff;
}

body.profile-garage .estimate-print-state {
    border-radius: 999px;
    font-size: .66rem;
    font-weight: 850;
    padding: 6px 9px;
    white-space: nowrap;
}

body.profile-garage .estimate-print-state.is-pending {
    background: #fff2d6;
    color: #9c6500;
}

body.profile-garage .estimate-version-file-pills,
body.profile-garage .document-version-files {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 9px;
}

body.profile-garage .estimate-version-file-pill,
body.profile-garage .document-file-chip {
    align-items: center;
    background: #fff;
    border: 1px solid #dde3ee;
    border-radius: 9px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 29px;
    min-width: 150px;
    position: relative;
}

body.profile-garage .estimate-version-file-pill > a,
body.profile-garage .document-file-chip > a {
    align-items: center;
    display: grid;
    gap: 5px;
    grid-template-columns: minmax(0, 1fr) auto;
    min-width: 0;
    padding: 8px 9px;
    text-decoration: none;
}

body.profile-garage .estimate-version-file-pill > a span,
body.profile-garage .document-file-chip > a span {
    color: #3b4860;
    font-size: .7rem;
}

body.profile-garage .estimate-version-file-pill > a strong,
body.profile-garage .document-file-chip > a strong {
    color: #18243a;
    font-size: .7rem;
}

body.profile-garage .document-file-copy {
    display: grid;
    gap: 1px;
    min-width: 0;
}

body.profile-garage .document-file-copy > strong,
body.profile-garage .document-file-copy > small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.profile-garage .document-file-copy > small {
    color: var(--muted);
    font-size: .58rem;
}

body.profile-garage .document-file-format {
    background: #eef0ff;
    border-radius: 7px;
    color: #4252d6;
    font-size: .62rem;
    padding: 5px 6px;
    white-space: nowrap;
}

body.profile-garage .estimate-version-file-pill > a small {
    color: var(--muted);
    font-size: .62rem;
    margin-left: auto;
}

body.profile-garage .estimate-version-file-pill .estimate-file-delete,
body.profile-garage .document-file-chip .estimate-file-delete {
    margin: 0;
}

body.profile-garage .estimate-version-file-pill .estimate-file-delete summary,
body.profile-garage .document-file-chip .estimate-file-delete summary {
    height: 26px;
    width: 26px;
}

body.profile-garage .settings-analytics-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.profile-garage .settings-documents-card {
    grid-template-columns: 34px minmax(0, 1fr) auto;
    position: relative;
}

body.profile-garage .settings-documents-card .settings-card-icon {
    align-items: center;
    background: #eef0ff;
    border-radius: 10px;
    color: #4a59df;
    display: flex;
    grid-row: 1 / 3;
    justify-content: center;
}

body.profile-garage .settings-documents-card > strong,
body.profile-garage .settings-documents-card > span:not(.settings-card-icon) {
    grid-column: 2;
}

body.profile-garage .settings-card-counter {
    align-self: center;
    background: #e83f52;
    border-radius: 999px;
    color: #fff;
    grid-column: 3;
    grid-row: 1 / 3;
    justify-self: end;
    min-width: 27px;
    padding: 5px 7px;
    text-align: center;
}

body.profile-garage .document-center-page {
    display: grid;
    gap: 14px;
    margin: 0 auto;
    max-width: 1320px;
}

body.profile-garage .document-center-hero {
    align-items: end;
    background: linear-gradient(135deg, #1d2d4c, #4d5dd8);
    border-radius: 24px;
    color: #fff;
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 26px 30px;
}

body.profile-garage .document-center-hero .back-link {
    color: #fff;
    grid-column: 1 / -1;
}

body.profile-garage .document-center-hero h1 {
    font-size: clamp(2rem, 4vw, 3.35rem);
    margin: 3px 0 6px;
}

body.profile-garage .document-center-hero p {
    color: rgba(255, 255, 255, .78);
    margin: 0;
}

body.profile-garage .document-center-kpis {
    display: flex;
    gap: 8px;
}

body.profile-garage .document-center-kpis span {
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 13px;
    display: grid;
    font-size: .68rem;
    min-width: 120px;
    padding: 10px 12px;
}

body.profile-garage .document-center-kpis strong {
    font-size: 1.25rem;
}

body.profile-garage .document-center-notice {
    border-radius: 12px;
    padding: 11px 14px;
}

body.profile-garage .document-center-notice.is-success { background: #e8f8f1; color: #137456; }
body.profile-garage .document-center-notice.is-error { background: #fff0f1; color: #a92635; }

body.profile-garage .document-print-queue,
body.profile-garage .document-archive-section {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 12px 34px rgba(31, 49, 84, .08);
    padding: 16px;
}

body.profile-garage .document-print-list,
body.profile-garage .document-archive-list {
    display: grid;
    gap: 9px;
    margin-top: 12px;
}

body.profile-garage .document-print-card {
    align-items: center;
    background: #f8f9fc;
    border: 1px solid #e1e6ef;
    border-radius: 13px;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(0, 1fr) auto auto;
    padding: 11px;
}

body.profile-garage .document-print-card.is-pending { border-left: 4px solid #f1a313; }
body.profile-garage .document-print-main { align-items: center; display: flex; gap: 10px; min-width: 0; }
body.profile-garage .document-print-main h3 { font-size: .92rem; margin: 2px 0; }
body.profile-garage .document-print-main p { margin: 0; }
body.profile-garage .document-print-main small,
body.profile-garage .document-print-main span { color: var(--muted); font-size: .67rem; }
body.profile-garage .document-print-icon { align-items: center; background: #fff0cf; border-radius: 11px; color: #a86d00; display: flex; flex: 0 0 40px; height: 40px; justify-content: center; }
body.profile-garage .document-print-downloads,
body.profile-garage .document-print-actions { display: flex; gap: 6px; }
body.profile-garage .document-print-downloads a { background: #eef0ff; border-radius: 8px; color: #4252d6; font-size: .68rem; font-weight: 850; padding: 7px 9px; text-decoration: none; }

body.profile-garage .document-empty-state {
    align-items: center;
    background: #f7f8fb;
    border: 1px dashed #d7deea;
    border-radius: 12px;
    display: grid;
    justify-items: center;
    padding: 20px;
    text-align: center;
}
body.profile-garage .document-empty-state span { color: var(--muted); font-size: .75rem; margin-top: 3px; }

body.profile-garage .document-print-history { margin-top: 10px; }
body.profile-garage .document-print-history summary { color: #4050cf; cursor: pointer; font-size: .75rem; font-weight: 800; }
body.profile-garage .document-print-history > div { display: grid; gap: 5px; margin-top: 7px; }
body.profile-garage .document-print-history a { background: #f7f8fb; border-radius: 8px; display: flex; justify-content: space-between; padding: 8px; text-decoration: none; }
body.profile-garage .document-print-history span { color: var(--muted); font-size: .68rem; }

body.profile-garage .document-version-card {
    background: #f8f9fc;
    border: 1px solid #e0e5ef;
    border-radius: 14px;
    min-width: 0;
    padding: 11px;
}

body.profile-garage .document-version-card > header {
    align-items: center;
    display: grid;
    gap: 11px;
    grid-template-columns: 48px minmax(0, 1fr) auto;
}
body.profile-garage .document-version-number { background: #e9ecff; border-radius: 10px; display: grid; justify-items: center; padding: 7px; }
body.profile-garage .document-version-number small { color: #5965c9; font-size: .52rem; text-transform: uppercase; }
body.profile-garage .document-version-number strong { color: #3443c4; font-size: 1.15rem; }
body.profile-garage .document-version-title small,
body.profile-garage .document-version-title p,
body.profile-garage .document-version-total small { color: var(--muted); font-size: .66rem; }
body.profile-garage .document-version-title h3,
body.profile-garage .document-version-title p { margin: 2px 0 0; }
body.profile-garage .document-version-total { display: grid; justify-items: end; }
body.profile-garage .document-version-total strong { color: #3445c7; }

body.profile-garage .document-version-contracts { display: grid; gap: 6px; margin-top: 9px; }
body.profile-garage .document-version-contracts > div { align-items: center; background: #fff; border: 1px solid #e2e6ee; border-radius: 9px; display: grid; gap: 7px; grid-template-columns: minmax(0, 1fr) 96px 29px; padding: 8px; }
body.profile-garage .document-contract-copy { display: grid; min-width: 0; }
body.profile-garage .document-version-contracts small { color: var(--muted); font-size: .62rem; }
body.profile-garage .document-contract-number { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.profile-garage .document-contract-action { display: grid; justify-items: stretch; width: 96px; }
body.profile-garage .document-contract-action form,
body.profile-garage .document-contract-action :is(.estimate-print-button, .estimate-print-state) { margin: 0; width: 100%; }
body.profile-garage .document-contract-delete { justify-self: end; margin: 0; }
body.profile-garage .document-no-files { color: var(--muted); font-size: .7rem; padding: 8px 0; }
body.profile-garage .document-version-card > footer { align-items: center; border-top: 1px solid #e3e7ef; display: flex; gap: 7px; margin-top: 10px; padding-top: 9px; }
body.profile-garage .document-version-purge { margin-left: auto; position: relative; }
body.profile-garage .document-version-purge > summary { color: #bd2f40; cursor: pointer; font-size: .7rem; font-weight: 800; list-style: none; padding: 7px; }
body.profile-garage .document-purge-confirm { background: #fff; border: 1px solid #efb3ba; border-radius: 12px; bottom: 35px; box-shadow: 0 14px 36px rgba(55,25,30,.18); display: grid; gap: 7px; padding: 11px; position: absolute; right: 0; width: 260px; z-index: 10; }
body.profile-garage .document-purge-confirm p { color: var(--muted); font-size: .7rem; margin: 0; }
body.profile-garage .document-purge-confirm > div { display: flex; gap: 6px; }

@media (max-width: 719px) {
    body.profile-garage .settings-analytics-grid { grid-template-columns: minmax(0, 1fr); }
    body.profile-garage .document-center-page { width: 100%; }
    body.profile-garage .document-center-hero { border-radius: 16px; gap: 12px; grid-template-columns: minmax(0, 1fr); padding: 18px 15px; }
    body.profile-garage .document-center-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    body.profile-garage .document-center-kpis span { min-width: 0; }
    body.profile-garage .document-print-queue,
    body.profile-garage .document-archive-section { border-radius: 14px; padding: 10px; }
    body.profile-garage .document-print-card { align-items: stretch; grid-template-columns: minmax(0, 1fr); }
    body.profile-garage .document-print-downloads,
    body.profile-garage .document-print-actions { width: 100%; }
    body.profile-garage .document-print-actions > * { flex: 1 1 0; }
    body.profile-garage .document-print-actions :is(a, button) { width: 100%; }
    body.profile-garage .document-version-card > header { grid-template-columns: 42px minmax(0, 1fr); }
    body.profile-garage .document-version-total { align-items: center; grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr) auto; justify-items: start; }
    body.profile-garage .document-version-total strong { justify-self: end; }
    body.profile-garage .document-version-contracts > div { gap: 6px; grid-template-columns: minmax(0, 1fr) 84px 29px; }
    body.profile-garage .document-contract-action { width: 84px; }
    body.profile-garage .document-contract-number { font-size: .78rem; }
    body.profile-garage .document-contract-action :is(.estimate-print-button, .estimate-print-state) { font-size: .61rem; padding-inline: 5px; }
    body.profile-garage .document-version-files { display: grid; grid-template-columns: minmax(0, 1fr); }
    body.profile-garage .estimate-version-file-pill,
    body.profile-garage .document-file-chip { min-width: 0; }
    body.profile-garage .document-version-card > footer { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    body.profile-garage .document-version-card > footer > a { width: 100%; }
    body.profile-garage .document-version-purge { grid-column: 1 / -1; justify-self: end; }
    body.profile-garage .document-purge-confirm,
    body.profile-garage .estimate-file-delete-confirm { bottom: auto; position: fixed; right: 12px; top: 50%; transform: translateY(-50%); width: calc(100vw - 24px); }
    body.profile-garage .estimate-version-file-pills { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
