:root {
    color-scheme: light;
    --text: #172530;
    --muted: #657887;
    --line: #d8e2e7;
    --line-strong: #b9c8d2;
    --surface: #ffffff;
    --surface-soft: #e9eef5;
    --surface-tint: #e8f1fc;
    --blue: #276aaf;
    --teal: #205d9e;
    --green: #2e7654;
    --amber: #875f12;
    --red: #a54848;
    --shadow: 0 12px 30px rgba(24, 37, 48, 0.07);
    --estimate-warning-text: #845d00;
    --estimate-over-text: #c83232;
    --smart-history-border: rgba(32, 93, 158, .28);
    --smart-history-divider: rgba(32, 93, 158, .18);
    --smart-history-surface: linear-gradient(145deg, rgba(230, 240, 252, .8), rgba(249, 251, 254, .96));
    --smart-history-card: rgba(255, 255, 255, .78);
    --smart-history-card-hover: #ffffff;
    --smart-history-row: rgba(255, 255, 255, .34);
    --smart-history-warning-border: rgba(214, 158, 46, .35);
    --smart-history-warning-surface: rgba(255, 248, 225, .78);
    --smart-history-warning-text: #845d00;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text);
    background: var(--surface-soft);
}

a {
    color: var(--blue);
}

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

h1,
h2,
h3 {
    color: var(--text);
    letter-spacing: 0;
}

h1:focus {
    outline: none;
}

h2 {
    margin: 0 0 0.8rem;
    font-size: 1.05rem;
}

h3 {
    margin: 1rem 0 0.65rem;
    font-size: 0.95rem;
}

.content {
    width: min(1540px, 100%);
    padding: 1.55rem 1rem 2.4rem;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.1rem;
}

.page-header h1 {
    margin: 0;
    font-size: clamp(1.7rem, 2vw, 2.25rem);
    line-height: 1.2;
}

.page-header p {
    margin: 0.4rem 0 0;
    color: var(--muted);
    max-width: 62rem;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    justify-content: flex-end;
}

.icon-button,
.text-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.3rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-weight: 800;
    padding: 0.42rem 0.75rem;
    text-decoration: none;
}

.icon-shell {
    width: var(--icon-size, auto);
    height: var(--icon-size, auto);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    line-height: 0;
}

.icon-shell .icon {
    display: block;
    width: inherit;
    height: inherit;
    overflow: visible;
    stroke: currentColor;
}

.action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.action-icon,
.card-icon,
.contact-icon,
.metric-icon {
    color: currentColor;
}

.text-button:hover,
.icon-button:hover {
    border-color: var(--line-strong);
    background: #f7fafb;
}

.icon-button {
    width: 2.3rem;
    padding: 0;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.85rem;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
    gap: 0.85rem;
}

.grid-wide {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
    gap: 1rem;
}

.dashboard-layout,
.workspace-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.72fr);
    gap: 1rem;
    align-items: start;
}

.dashboard-command-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 1rem;
    align-items: start;
}

.dashboard-command-grid > .stack {
    display: contents;
}

.dashboard-card {
    min-width: 0;
    height: 100%;
}

.dashboard-span-4 {
    grid-column: span 4;
}

.dashboard-span-5 {
    grid-column: span 5;
}

.dashboard-span-6 {
    grid-column: span 6;
}

.dashboard-span-7 {
    grid-column: span 7;
}

.dashboard-span-8 {
    grid-column: span 8;
}

.record-list-layout {
    display: grid;
    gap: 1rem;
}

.board-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 0.36fr);
    gap: 1rem;
    align-items: start;
}

.panel,
.card-item {
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(24, 37, 48, 0.04);
}

.panel {
    padding: 1.05rem;
}

.card-item {
    padding: 0.85rem;
    overflow-wrap: anywhere;
}

.content-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.command-overlay {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    overflow: hidden;
    background: rgba(20, 33, 42, 0.62);
    backdrop-filter: blur(6px);
}

.command-modal {
    width: min(1480px, 100%);
    max-height: calc(100vh - 3rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(185, 200, 210, 0.84);
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 28px 70px rgba(12, 23, 31, 0.32);
}

.command-modal-medium {
    width: min(1040px, 100%);
}

.command-modal-wide {
    width: min(1560px, 100%);
}

.command-modal-xl {
    width: min(1560px, 100%);
}

.command-shell-header {
    flex: 0 0 auto;
    padding: 1.1rem 1.25rem 0.95rem;
    border-bottom: 1px solid var(--line);
}

.command-shell-hero,
.command-shell-timeline,
.command-shell-tabs {
    flex: 0 0 auto;
    padding-inline: 1.25rem;
}

.command-shell-hero {
    padding-top: 0.85rem;
}

.command-shell-timeline {
    padding-top: 0.15rem;
}

.command-shell-tabs {
    border-bottom: 1px solid var(--line);
}

.command-shell-body {
    min-height: 0;
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 1rem 1.25rem 1.25rem;
    scroll-behavior: smooth;
}

.command-shell-footer {
    flex: 0 0 auto;
    padding: 0.8rem 1.25rem;
    border-top: 1px solid var(--line);
    background: #fbfcfd;
}

/* A job can have a long customer/scope summary and many actions. Keeping each
   of those sections outside a shrinking flex body can leave only its padding
   visible. Scroll the complete job workspace as one document instead. */
.command-modal.job-command {
    display: block;
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-padding-block: 1rem;
}

.job-command .command-shell-body {
    overflow: visible;
}

.job-command .workspace-header {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 0.75rem;
}

.job-command .command-actions {
    justify-content: flex-start;
}

.job-command .command-close {
    margin-inline-start: auto;
}

.job-command .command-title-row h2,
.job-command .command-meta {
    overflow-wrap: anywhere;
}

.job-command .command-contact-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
}

@media (max-width: 980px) {
    .job-command .command-list-row,
    .job-command .command-body-grid.tab-focus-grid .command-card:not(.wide):not(.full) .command-list-row {
        grid-template-columns: minmax(0, 1fr);
        align-items: start;
    }

    .job-command .command-list-row .toolbar {
        max-width: 100%;
        justify-content: flex-start;
    }
}

.workspace-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
}

.workspace-header-leading {
    width: 5.6rem;
    height: 5.6rem;
    overflow: hidden;
    border-radius: 12px;
    background: var(--surface-soft);
}

.workspace-header-copy {
    min-width: 0;
}

.command-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: start;
    padding: 0.2rem 0.2rem 1rem;
    border-bottom: 1px solid var(--line);
}

.command-kicker {
    margin-bottom: 0.25rem;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
}

.command-title-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    align-items: center;
}

.command-title-row h2 {
    margin: 0;
    font-size: clamp(1.45rem, 2vw, 2rem);
}

.command-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.35rem;
    color: var(--muted);
    font-size: 0.84rem;
}

.command-meta > span:not(:first-child)::before,
.meta-separator::before {
    content: "\2022";
    margin-right: 0.45rem;
    color: #9aabb6;
}

.command-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    justify-content: flex-end;
}

.command-close {
    min-width: 2.35rem;
    padding-inline: 0.65rem;
    border-color: transparent;
}

.command-contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.7rem;
    margin: 0;
}

.command-contact-card {
    min-width: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.65rem;
    align-items: center;
    padding: 0.58rem 0.25rem;
    border: 0;
    background: transparent;
    color: var(--text);
}

.command-contact-card .contact-icon {
    color: var(--muted);
}

.command-contact-card span {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 900;
    text-transform: uppercase;
}

.command-contact-card strong {
    display: block;
    overflow-wrap: anywhere;
}

.copyable-meta {
    display: inline-flex;
    max-width: 100%;
    align-items: center;
    gap: 0.35rem;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.copyable-meta strong,
.copyable-meta span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.copyable-meta.compact {
    margin-top: 0.18rem;
    font-size: 0.78rem;
}

.copy-inline-button {
    width: 1.75rem;
    min-height: 1.75rem;
    height: 1.75rem;
    flex: 0 0 auto;
    border-radius: 7px;
}

.command-contact-card small {
    display: block;
    margin-top: 0.12rem;
    color: var(--muted);
    font-size: 0.72rem;
    overflow-wrap: anywhere;
}

.command-timeline {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
    gap: 0.45rem;
    margin: 0.75rem 0;
    padding: 0.9rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: linear-gradient(180deg, #ffffff, #f8fbfb);
}

.command-timeline-step {
    position: relative;
    display: grid;
    justify-items: center;
    gap: 0.25rem;
    min-width: 0;
    text-align: center;
}

.command-timeline-step::before {
    content: "";
    position: absolute;
    top: 0.7rem;
    left: calc(-50% + 0.75rem);
    width: calc(100% - 1.5rem);
    border-top: 2px solid #c9d6df;
}

.command-timeline-step:first-child::before {
    display: none;
}

.command-timeline-step .timeline-marker {
    position: relative;
    z-index: 1;
    width: 1.45rem;
    height: 1.45rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #b8c8d2;
    border-radius: 999px;
    background: #ffffff;
}

.command-timeline-step.complete .timeline-marker,
.command-timeline-step.current .timeline-marker {
    border-color: var(--teal);
    background: var(--teal);
    box-shadow: 0 0 0 4px rgba(32, 93, 158, 0.12);
}

.command-timeline-step.attention .timeline-marker {
    border-color: var(--amber);
    background: #fff7df;
}

.command-timeline-step.complete .timeline-marker,
.command-timeline-step.current .timeline-marker {
    color: #ffffff;
}

.command-timeline-step.pending .timeline-marker {
    color: #8194a1;
}

.workspace-tabs {
    display: flex;
    gap: 0.2rem;
    overflow-x: auto;
    scrollbar-width: thin;
}

.workspace-tab {
    position: relative;
    min-height: 2.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.65rem 0.8rem;
    color: #536775;
    font-size: 0.8rem;
    font-weight: 800;
    font-family: inherit;
    text-decoration: none;
    white-space: nowrap;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.workspace-tab::after {
    content: "";
    position: absolute;
    right: 0.75rem;
    bottom: 0;
    left: 0.75rem;
    height: 2px;
    border-radius: 2px;
    background: transparent;
}

.workspace-tab.active,
.workspace-tab:hover {
    color: var(--teal);
}

.workspace-tab.active::after {
    background: var(--teal);
}

.workspace-tab small {
    min-width: 1.25rem;
    padding: 0.08rem 0.32rem;
    border-radius: 999px;
    background: #eef3f5;
    color: #657887;
    text-align: center;
}

.workspace-tab-panel {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 0.85rem;
}

.workspace-tab-panel[hidden] {
    display: none;
}

[data-copy-text].copied {
    border-color: #91cbbd;
    background: #e7f6f1;
    color: #155f50;
}

.command-timeline-step strong {
    font-size: 0.72rem;
}

.command-timeline-step small {
    color: var(--muted);
    font-size: 0.68rem;
}

.command-body-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 0.85rem;
    align-items: start;
}

.command-body-grid.tab-focus-grid > * {
    grid-column: 1 / -1;
}

.command-card {
    grid-column: span 4;
    align-self: start;
    min-width: 0;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(24, 37, 48, 0.04);
}

.workspace-card-header {
    min-height: 3rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    padding: 0.78rem 0.9rem;
    border-bottom: 1px solid #edf2f4;
}

.workspace-card-header > a {
    font-size: 0.76rem;
    font-weight: 800;
    text-decoration: none;
}

.workspace-card-title {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.workspace-card-title .card-icon {
    color: var(--teal);
}

.workspace-card-title h3 {
    margin: 0;
    font-size: 0.88rem;
}

.workspace-card-body {
    padding: 0.85rem 0.9rem;
}

.command-card.wide {
    grid-column: span 8;
}

.command-card.full {
    grid-column: 1 / -1;
}

.command-card h3 {
    margin-top: 0;
}

.command-list {
    display: grid;
    gap: 0.55rem;
}

.command-list-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.6rem;
    align-items: center;
    padding: 0.55rem 0;
    border-bottom: 1px solid #edf2f4;
}

.command-list-row > :first-child,
.command-list-row .toolbar {
    min-width: 0;
}

.command-list-row > :first-child {
    overflow-wrap: anywhere;
}

/* Compact cards keep record actions below the label so the label never collapses into a vertical strip. */
.command-card:not(.wide):not(.full) .command-list-row {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
}

.command-card:not(.wide):not(.full) .command-list-row .toolbar {
    justify-content: flex-start;
}

.command-body-grid.tab-focus-grid .command-card:not(.wide):not(.full) .command-list-row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

.command-list-row:last-child {
    border-bottom: 0;
}

.command-list-link {
    color: var(--text);
    text-decoration: none;
}

.command-list-link:hover {
    background: var(--surface-tint);
}

.section-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.section-title h2,
.section-title h3 {
    margin-bottom: 0.25rem;
}

.section-title p {
    margin: 0;
    color: var(--muted);
}

.metric {
    min-height: 7.6rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-left: 4px solid var(--blue);
    border-top: 1px solid var(--line);
}

.metric.green {
    border-top-color: var(--green);
}

.metric.amber {
    border-top-color: #d7a331;
}

.metric.red {
    border-top-color: var(--red);
}

.metric-label,
.eyebrow {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0;
}

.metric-value {
    font-size: 2.1rem;
    font-weight: 900;
}

.metric-heading,
.section-heading-with-icon {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.metric-heading .metric-icon,
.section-heading-with-icon .icon-shell {
    color: var(--teal);
}

.quick-action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    gap: 0.55rem;
}

.quick-action {
    min-height: 4.6rem;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-content: center;
    align-items: center;
    gap: 0.12rem 0.55rem;
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
    color: var(--text);
    font-weight: 900;
    text-decoration: none;
}

.quick-action .icon-shell {
    grid-row: span 2;
    color: var(--teal);
}

.quick-action strong {
    font-size: 0.86rem;
}

.quick-action span:last-child {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
}

.package-history-row {
    padding: 0.9rem 1rem;
}

.financial-page {
    container-name: financial-page;
    container-type: inline-size;
    min-width: 0;
}

.financial-trust-note {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.financial-trust-note span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.financial-create-panel,
.financial-actions-panel,
.financial-action-card,
.baseline-callout {
    min-width: 0;
}

.financial-create-panel .section-title {
    align-items: flex-start;
}

.financial-form-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: start;
}

.financial-field-span-2 {
    grid-column: span 2;
}

.financial-form-surface label,
.financial-mini-form label {
    display: grid;
    min-width: 0;
    gap: 0.38rem;
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 800;
}

.financial-form-surface input:not([type="checkbox"]),
.financial-form-surface select,
.financial-form-surface textarea,
.financial-mini-form input:not([type="checkbox"]),
.financial-mini-form select,
.financial-mini-form textarea {
    width: 100%;
    min-width: 0;
    min-height: 2.65rem;
    padding: 0.58rem 0.68rem;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    outline: none;
    background: var(--surface);
    color: var(--text);
}

.financial-form-surface textarea,
.financial-mini-form textarea {
    min-height: 5.25rem;
    resize: vertical;
}

.financial-form-surface input:focus,
.financial-form-surface select:focus,
.financial-form-surface textarea:focus,
.financial-mini-form input:focus,
.financial-mini-form select:focus,
.financial-mini-form textarea:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(47, 126, 115, 0.12);
}

.financial-workspace {
    display: grid;
    grid-template-columns: minmax(260px, 0.72fr) minmax(0, 2.28fr);
    gap: 1rem;
    align-items: start;
}

.financial-workspace > * {
    min-width: 0;
}

.financial-kpis > *,
.financial-detail-stack,
.financial-project-header,
.financial-three-column > *,
.financial-page .section-title > div {
    min-width: 0;
}

.financial-page h1,
.financial-page h2,
.financial-page p,
.financial-project-row,
.financial-list-item > div {
    overflow-wrap: anywhere;
}

.financial-project-list {
    position: sticky;
    top: 1rem;
}

.financial-project-row {
    display: block;
    padding: 0.9rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    text-decoration: none;
    background: var(--surface);
}

.financial-project-row:hover,
.financial-project-row.selected {
    border-color: var(--teal);
    background: var(--surface-tint);
}

.financial-row-values,
.financial-position-grid,
.financial-profit-strip {
    display: grid;
    gap: 0.65rem;
}

.financial-row-values {
    grid-template-columns: 1fr 1fr;
    margin-top: 0.55rem;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
}

.financial-detail-stack {
    display: grid;
    gap: 1rem;
    min-width: 0;
}

.financial-status-stack,
.financial-list-value {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
}

.financial-position-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}

.financial-position-value {
    min-width: 0;
}

.financial-position-value span,
.financial-list-item small,
.financial-list-value small {
    display: block;
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 700;
}

.financial-position-value strong {
    display: block;
    margin-top: 0.2rem;
    font-size: 1.05rem;
}

.financial-profit-strip {
    grid-template-columns: repeat(3, 1fr);
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    background: var(--fdc-color-success-soft);
    color: var(--green);
    font-size: 0.82rem;
}

.financial-profit-strip.amber { background: var(--fdc-color-warning-soft); color: var(--amber); }
.financial-profit-strip.red { background: var(--fdc-color-danger-soft); color: var(--red); }
.financial-profit-strip.blue { background: var(--fdc-color-info-soft); color: var(--blue); }
.financial-profit-strip strong { display: block; margin-top: 0.15rem; font-size: 1rem; }

.baseline-callout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 0.85fr);
    gap: 1.25rem;
    border-left: 4px solid var(--amber);
}

.baseline-form,
.financial-mini-form {
    display: grid;
    gap: 0.55rem;
}

.baseline-form {
    align-content: start;
}

.financial-mini-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 0.8rem;
    padding: 0.85rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-soft);
}

.financial-mini-form > button {
    width: fit-content;
    align-self: end;
}

.financial-approval-field {
    display: flex !important;
    grid-column: 1 / -1;
    align-items: center;
    gap: 0.55rem !important;
    min-height: 2.65rem;
}

.financial-approval-field input {
    width: 1.05rem;
    height: 1.05rem;
    accent-color: var(--teal);
}

.financial-three-column {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    align-items: start;
}

.financial-list-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--line);
}

.financial-list-item:last-child { border-bottom: 0; }
.compact-stack { gap: 0; }
.financial-inline-form { align-items: end; }
.financial-inline-form label { min-width: min(240px, 100%); }

.financial-empty-state {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 2rem;
}

.financial-empty-icon {
    display: grid;
    place-items: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 14px;
    color: var(--teal);
    background: var(--surface-tint);
}

@container financial-page (max-width: 1280px) {
    .financial-page > .page-header { display: grid; }
    .financial-page > .page-header .page-actions { justify-content: flex-start; }
    .financial-kpis,
    .financial-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .financial-workspace,
    .baseline-callout { grid-template-columns: 1fr; }
    .financial-project-list { position: static; }
    .financial-position-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .financial-three-column { grid-template-columns: 1fr; }
}

@container financial-page (max-width: 760px) {
    .financial-position-grid,
    .financial-profit-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .financial-inline-form { align-items: stretch; }
}

@container financial-page (max-width: 540px) {
    .financial-kpis,
    .financial-form-grid,
    .financial-mini-form,
    .financial-position-grid,
    .financial-profit-strip { grid-template-columns: 1fr; }
    .financial-field-span-2 { grid-column: auto; }
    .financial-empty-state { align-items: flex-start; padding: 1.25rem; }
    .financial-row-values { grid-template-columns: 1fr; }
}

@media (max-width: 1420px) {
    .financial-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .financial-position-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .financial-three-column { grid-template-columns: 1fr; }
}

@media (max-width: 850px) {
    .financial-workspace,
    .baseline-callout { grid-template-columns: 1fr; }
    .financial-project-list { position: static; }
    .financial-position-grid,
    .financial-profit-strip { grid-template-columns: 1fr 1fr; }
    .financial-inline-form { align-items: stretch; }
}

@media (max-width: 620px) {
    .financial-form-grid,
    .financial-mini-form,
    .financial-position-grid,
    .financial-profit-strip { grid-template-columns: 1fr; }
    .financial-field-span-2 { grid-column: auto; }
    .financial-empty-state { align-items: flex-start; padding: 1.25rem; }
    .financial-row-values { grid-template-columns: 1fr; }
}

.document-library-panel .card-item {
    border-radius: 8px;
}

.document-library-grid {
    display: grid;
    gap: 1rem;
}

.disabled-action {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.quick-action:hover {
    border-color: #a9c7e8;
    background: var(--surface-tint);
    color: #174a82;
}

.stack {
    display: grid;
    gap: 0.75rem;
}

.table-wrap {
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(24, 37, 48, 0.04);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 0.78rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0;
    background: #f8fbfc;
}

tbody tr:last-child td {
    border-bottom: none;
}

.selected-row td {
    background: var(--surface-tint);
}

.selected-card {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(32, 93, 158, 0.12);
}

.tech-panel {
    border-top: 4px solid var(--teal);
}

.tech-tone-1 {
    border-top-color: var(--teal);
}

.tech-tone-2 {
    border-top-color: var(--blue);
}

.tech-tone-3 {
    border-top-color: var(--green);
}

.tech-tone-4 {
    border-top-color: var(--amber);
}

.tech-tone-5 {
    border-top-color: #6c5c9c;
}

.tech-tone-6 {
    border-top-color: var(--red);
}

.status {
    display: inline-flex;
    align-items: center;
    min-height: 1.55rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    border: 1px solid #bfd5e4;
    background: #f0f7fb;
    color: #285d81;
    font-size: 0.78rem;
    font-weight: 800;
    white-space: nowrap;
}

.status.green {
    border-color: #a7d6c8;
    background: #edf8f4;
    color: #1b604f;
}

.status.amber {
    border-color: #ead095;
    background: #fff8e7;
    color: #76500f;
}

.status.red {
    border-color: #e7b6b6;
    background: #fff1f1;
    color: #8e3434;
}

.status.blue {
    border-color: #bdd4e5;
    background: #edf6fb;
    color: #275d82;
}

.status.gray {
    border-color: #d3dce3;
    background: #f3f6f8;
    color: #526370;
}

.muted {
    color: var(--muted);
}

.detail-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.75rem;
}

.detail-list div {
    min-width: 0;
    min-height: 4.25rem;
    display: grid;
    align-content: center;
    gap: 0.28rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.75rem;
    background: #fbfcfd;
    overflow-wrap: anywhere;
}

.detail-list strong,
.card-item strong,
.muted {
    overflow-wrap: anywhere;
}

.detail-list .eyebrow {
    display: block;
}

.media-row {
    display: grid;
    grid-template-columns: 4.5rem minmax(0, 1fr) auto auto;
    gap: 0.75rem;
    align-items: center;
}

.media-thumb-frame {
    align-items: center;
    background: var(--surface-subtle);
    border: 1px solid var(--line);
    border-radius: 6px;
    display: flex;
    height: 3.4rem;
    justify-content: center;
    overflow: hidden;
    width: 4.5rem;
}

.media-thumb {
    width: 4.5rem;
    height: 3.4rem;
    object-fit: cover;
}

.media-type-icon {
    color: var(--teal);
    display: inline-flex;
}

.media-statuses {
    justify-content: flex-end;
}

.media-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: flex-end;
}

.media-note {
    margin-top: 0.25rem;
}

.media-viewer {
    border-top: 1px solid var(--line);
    display: grid;
    gap: 0.85rem;
    margin-top: 1rem;
    padding-top: 1rem;
}

.media-preview-image,
.media-preview-player {
    background: #0f1f29;
    border: 1px solid var(--line);
    border-radius: 6px;
    display: block;
    max-height: min(62vh, 44rem);
    max-width: 100%;
    width: auto;
}

.media-preview-player {
    width: 100%;
}

.media-preview-audio {
    max-width: 100%;
    width: 34rem;
}

.job-media-preview-overlay {
    z-index: 80;
}

.job-media-preview-modal {
    width: min(1320px, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
}

.job-media-preview-header {
    align-items: flex-start;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.job-media-preview-header > :first-child {
    min-width: 0;
}

.job-media-preview-header .icon-button {
    flex: 0 0 auto;
    margin-left: auto;
}

.job-media-preview-body {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 1rem;
}

.job-media-preview-stage {
    align-items: center;
    background: #0f1f29;
    border: 1px solid var(--line);
    border-radius: 6px;
    display: flex;
    justify-content: center;
    min-height: min(68vh, 48rem);
    padding: 0.75rem;
    width: 100%;
}

.job-media-preview-stage .media-preview-image {
    max-height: min(66vh, 46rem);
    max-width: 100%;
}

.job-media-preview-stage .media-preview-player {
    max-height: min(66vh, 46rem);
}

.job-media-preview-footer {
    display: flex;
    justify-content: flex-end;
}

.timeline {
    display: grid;
    gap: 0.65rem;
}

.workflow-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
    padding: 0.85rem;
    margin-bottom: 1rem;
}

.workflow-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.8rem;
}

.workflow-heading .primary-button {
    white-space: nowrap;
}

.workflow-heading p {
    margin: 0.2rem 0 0;
    color: var(--muted);
    font-size: 0.86rem;
}

.workflow-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(98px, 1fr));
    gap: 0.45rem;
}

.workflow-step {
    min-height: 3.45rem;
    display: grid;
    align-content: center;
    gap: 0.18rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 0.48rem;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
}

.workflow-step span {
    min-width: 2.35rem;
    min-height: 1.28rem;
    width: fit-content;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    font-size: 0.68rem;
    padding: 0 0.35rem;
    white-space: nowrap;
}

.workflow-step.complete {
    border-color: #a7d6c8;
    background: #edf8f4;
    color: #1b604f;
}

.workflow-step.current {
    border-color: #bdd4e5;
    background: #edf6fb;
    color: #275d82;
}

.workflow-step.attention {
    border-color: #ead095;
    background: #fff8e7;
    color: #76500f;
}

.workflow-step.skipped,
.workflow-step.pending {
    background: #f4f7f8;
}

.generated-file {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f7fafb;
    padding: 0.75rem;
}

.timeline-item {
    position: relative;
    border-left: 3px solid var(--teal);
    padding: 0.1rem 0 0.65rem 0.75rem;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: -0.42rem;
    top: 0.28rem;
    width: 0.7rem;
    height: 0.7rem;
    border: 2px solid #ffffff;
    border-radius: 999px;
    background: var(--teal);
}

.notice {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.75rem;
    font-weight: 700;
}

.notice-error {
    border-color: #e2b4b4;
    background: #fff2f2;
    color: #8d3333;
}

.notice-ok {
    border-color: #a7d6c8;
    background: #edf8f4;
    color: #1b604f;
}

.notice-warning {
    border-color: #ead095;
    background: #fff8e7;
    color: #76500f;
}

.admin-form {
    display: grid;
    gap: 0.85rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0.85rem;
}

.customer-profile-editor {
    margin: 0.9rem 1rem 0;
}

.customer-profile-editor .panel-heading-row {
    align-items: flex-start;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.customer-profile-editor .panel-heading-row h2,
.customer-profile-editor .panel-heading-row p {
    margin: 0.15rem 0 0;
}

.customer-profile-editor .section-heading {
    border-bottom: 1px solid var(--line);
    padding-bottom: 0.4rem;
}

.customer-profile-editor .wide-field {
    grid-column: 1 / -1;
}

.customer-profile-editor .form-grid {
    align-items: start;
}

.customer-profile-editor .form-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

@media (max-width: 720px) {
    .customer-profile-editor {
        margin-inline: 0.65rem;
    }
}

/* Smart Estimating keeps the desktop builder dense enough for pricing work
   while retaining the card hierarchy used by AI Reporting and Financials. */
.estimating-page { container-name: estimating-page; container-type: inline-size; min-width: 0; }
.financial-subnav { display: flex; gap: .3rem; padding: .3rem; width: fit-content; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 4px 14px rgba(24, 37, 48, .04); }
.financial-subnav button { min-height: 2.4rem; border: 0; background: transparent; color: var(--muted); padding: .55rem .8rem; border-radius: 7px; font-weight: 800; cursor: pointer; }
.financial-subnav button:hover { background: var(--surface-soft); color: var(--text); }
.financial-subnav button.active { background: var(--teal); color: var(--fdc-color-on-accent); box-shadow: 0 5px 14px rgba(32, 93, 158, .2); }
.financial-subnav button span { display: inline-flex; align-items: center; justify-content: center; min-width: 1.35rem; margin-left: .35rem; padding: .05rem .35rem; border-radius: 999px; background: rgba(101, 120, 135, .12); font-size: .72rem; }
.financial-subnav button.active span { background: rgba(255, 255, 255, .18); }
.estimating-catalog-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 390px); gap: 1rem; align-items: start; }
.estimating-catalog-panel { min-height: 22rem; }
.estimating-side-stack { display: grid; gap: 1rem; }
.estimating-form-card { padding: 1rem; }
.estimating-form-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.estimating-form-heading h3 { margin: .18rem 0 0; font-size: 1.02rem; }
.estimating-form-heading > .icon-shell { width: 2.35rem; height: 2.35rem; border-radius: 9px; background: var(--surface-tint); color: var(--teal); }
.estimating-form { display: grid; gap: .75rem; }
.estimating-form label,
.estimating-field { display: grid; gap: .38rem; color: var(--text); font-size: .78rem; font-weight: 800; }
.estimating-form input,
.estimating-form select,
.estimating-field input,
.estimating-field textarea { width: 100%; min-width: 0; min-height: 2.65rem; padding: .58rem .68rem; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--text); outline: none; }
.estimating-form input:focus,
.estimating-form select:focus,
.estimating-field input:focus,
.estimating-field textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(32, 93, 158, .12); }
.estimating-field textarea { min-height: 6rem; resize: vertical; }
.estimating-code-grid { display: grid; grid-template-columns: minmax(86px, .65fr) minmax(0, 1.35fr); gap: .65rem; }
.estimating-cost-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.estimating-submit { width: 100%; min-height: 2.65rem; }
.estimating-empty-state { min-height: 15rem; align-content: center; }
.estimating-builder { display: grid; grid-template-columns: minmax(220px, .72fr) minmax(480px, 1.8fr) minmax(250px, .72fr); gap: 1rem; align-items: start; min-width: 0; }
.estimating-builder > * { min-width: 0; }
.estimating-list { padding: .75rem; display: grid; gap: .45rem; max-height: calc(100vh - 220px); overflow-y: auto; overflow-x: hidden; }
.estimating-list .section-title { padding: .35rem .4rem .7rem; }
.estimating-list-item { display: flex; justify-content: space-between; gap: .75rem; width: 100%; min-width: 0; text-align: left; border: 1px solid transparent; border-radius: 11px; background: transparent; padding: .8rem; color: var(--text); }
.estimating-list-item:hover { background: var(--surface-soft); }
.estimating-list-item.active { background: var(--surface-tint); border-color: rgba(32, 93, 158, .28); }
.estimating-list-item span { display: grid; gap: .18rem; min-width: 0; }
.estimating-list-item span:first-child { overflow: hidden; }
.estimating-list-item span:last-child { flex: 0 0 auto; text-align: right; }
.estimating-list-item strong,
.estimating-list-item small { overflow-wrap: anywhere; }
.estimating-list-item small, .estimate-line-card span, .estimate-line-card small { color: var(--muted); }
.estimating-lines { min-width: 0; }
.estimating-lines .section-title select { width: auto; min-width: 130px; }
.estimate-section { margin-top: 1rem; }
.estimate-section > h3 { color: var(--muted); font-size: .76rem; letter-spacing: .08em; text-transform: uppercase; margin-bottom: .45rem; }
.estimate-line-card { display: flex; justify-content: space-between; gap: 1rem; padding: .85rem 0; border-bottom: 1px solid var(--line); }
.estimate-line-card > div { display: grid; gap: .2rem; }
.estimate-line-card > div:last-child { min-width: 110px; text-align: right; }
.estimate-add-line { background: var(--surface-soft); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; margin-top: 1.2rem; }
.estimating-summary { position: sticky; top: 1rem; display: grid; gap: .8rem; }
.estimating-summary > h2 { font-size: 2rem; margin: 0; }
.estimate-budget-health { display: grid; gap: .42rem; border: 1px solid var(--line); border-radius: 12px; padding: .8rem; background: var(--surface-soft); }
.estimate-budget-health > div:first-child { display: flex; justify-content: space-between; gap: 1rem; }
.estimate-budget-health small { color: var(--muted); }
.estimate-budget-track { height: .55rem; overflow: hidden; border-radius: 999px; background: var(--line); }
.estimate-budget-track span { display: block; height: 100%; border-radius: inherit; background: #1ca58a; }
.estimate-budget-health.warning .estimate-budget-track span { background: #d69e2e; }
.estimate-budget-health.over .estimate-budget-track span { background: #dc4c4c; }
.estimate-budget-health.warning strong { color: var(--estimate-warning-text); }
.estimate-budget-health.over strong { color: var(--estimate-over-text); }
.estimate-budget-health.unset strong, .estimate-budget-health.unset small { color: var(--muted); }
.estimating-summary dl { margin: 0; display: grid; }
.estimating-summary dl div { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.estimating-summary dl .total { font-weight: 800; color: var(--teal); border-bottom: 0; }
.estimating-summary button, .estimating-summary a { width: 100%; justify-content: center; }
.estimate-summary-kpis { padding: .15rem .8rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.estimate-summary-details { border-top: 1px solid var(--line); padding-top: .7rem; }
.estimate-summary-details > summary { color: var(--teal); font-size: .78rem; font-weight: 850; cursor: pointer; }
.estimate-summary-details > dl { margin-top: .45rem; }
.smart-history-workspace { display: grid; gap: .72rem; margin-top: 1rem; padding: .9rem; border: 1px solid var(--smart-history-border); border-radius: 14px; background: var(--smart-history-surface); color: var(--text); }
.smart-history-workspace.empty { border-color: var(--line); background: var(--surface-soft); }
.smart-history-overview { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.smart-history-controls { display: grid; justify-items: end; gap: .3rem; flex: 0 0 auto; }
.smart-history-controls button { min-height: 2.15rem; padding: .4rem .65rem; white-space: nowrap; }
.smart-history-controls small { color: var(--muted); font-size: .66rem; }
.smart-history-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.smart-history-heading > div { display: grid; gap: .16rem; }
.smart-history-heading > .icon-shell { color: var(--teal); }
.smart-history-heading p, .smart-history-recommendation p { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.smart-history-warning { display: flex; align-items: flex-start; gap: .45rem; padding: .6rem .65rem; border: 1px solid var(--smart-history-warning-border); border-radius: 9px; background: var(--smart-history-warning-surface); color: var(--smart-history-warning-text); font-size: .76rem; font-weight: 750; }
.smart-history-details { border-top: 1px solid var(--smart-history-divider); padding-top: .65rem; }
.smart-history-details > summary { display: flex; align-items: center; justify-content: space-between; gap: .8rem; color: var(--teal); font-size: .8rem; font-weight: 850; cursor: pointer; }
.smart-history-details > summary span:last-child { color: var(--muted); font-size: .7rem; font-weight: 700; }
.smart-history-detail-body { display: grid; gap: .85rem; margin-top: .8rem; }
.smart-history-recommendation { display: grid; gap: .65rem; padding: .85rem; border: 1px solid var(--smart-history-border); border-radius: 12px; background: var(--smart-history-card); color: var(--text); }
.smart-history-recommendation > div:first-child { display: flex; align-items: flex-start; justify-content: space-between; gap: .6rem; }
.smart-history-recommendation > div:first-child > div { display: grid; gap: .15rem; min-width: 0; }
.smart-history-recommendation > div:first-child small { color: var(--muted); }
.smart-history-assembly-check { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .2rem .8rem; padding: .62rem .68rem; border-radius: 9px; background: var(--surface-soft); }
.smart-history-assembly-check > span { color: var(--muted); font-size: .72rem; font-weight: 800; text-transform: uppercase; }
.smart-history-assembly-check > strong { text-align: right; }
.smart-history-assembly-check > small { grid-column: 1 / -1; color: var(--muted); }
.smart-history-components { display: grid; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.smart-history-component { display: grid; grid-template-columns: minmax(110px, 1.2fr) repeat(3, minmax(78px, 1fr)); gap: .5rem; align-items: center; padding: .58rem .65rem; border-top: 1px solid var(--line); font-size: .76rem; }
.smart-history-component:not(.header) { background: var(--smart-history-row); }
.smart-history-component.header { border-top: 0; background: var(--surface-soft); color: var(--muted); font-size: .66rem; font-weight: 850; text-transform: uppercase; }
.smart-history-component.unsupported { color: var(--muted); }
.smart-history-component > small { grid-column: 1 / -1; color: var(--muted); }
.smart-history-recommendation details { display: grid; gap: .4rem; }
.smart-history-recommendation summary { color: var(--teal); font-size: .76rem; font-weight: 850; cursor: pointer; }
.smart-history-comparable { display: flex; align-items: flex-start; justify-content: space-between; gap: .7rem; margin-top: .38rem; padding: .55rem; border: 1px solid var(--line); border-radius: 9px; background: var(--smart-history-card); color: var(--text); text-decoration: none; }
.smart-history-comparable:hover { border-color: var(--smart-history-border); background: var(--smart-history-card-hover); color: var(--text); }
.smart-history-comparable span { display: grid; gap: .14rem; min-width: 0; }
.smart-history-comparable span:last-child { flex: 0 0 auto; text-align: right; }
.smart-history-comparable small { color: var(--muted); overflow-wrap: anywhere; }
.smart-history-decision { display: flex; align-items: center; gap: .4rem; color: var(--teal); font-size: .74rem; font-weight: 850; }
.smart-history-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; }
.smart-history-actions button { width: auto; min-height: 2.2rem; padding: .42rem .5rem; font-size: .72rem; }
.form-grid.compact { gap: .65rem; }
.full-label { display: grid; gap: .35rem; margin-top: .7rem; }

@container estimating-page (max-width: 1050px) {
    .estimating-page > .page-header { display: grid; }
    .estimating-page > .page-header .page-actions { justify-content: flex-start; }
    .estimating-catalog-layout,
    .estimating-builder { grid-template-columns: 1fr; }
    .estimating-catalog-panel { min-height: auto; }
    .estimating-list { max-height: none; }
    .estimating-summary { position: static; grid-column: auto; grid-template-columns: 1fr; }
    .smart-history-overview,
    .smart-history-details > summary { align-items: flex-start; flex-direction: column; }
    .smart-history-controls { width: 100%; justify-items: stretch; }
    .smart-history-controls .status { width: fit-content; }
}

@media (max-width: 1420px) {
    .estimating-builder { grid-template-columns: minmax(190px, .65fr) minmax(0, 1.4fr); }
    .estimating-summary { position: static; grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .estimating-summary .estimate-budget-health,
    .estimating-summary dl,
    .estimating-summary details,
    .estimating-summary > p { grid-column: 1 / -1; }
}

@media (max-width: 820px) {
    .estimating-catalog-layout, .estimating-builder { grid-template-columns: 1fr; }
    .estimating-catalog-panel { min-height: auto; }
    .estimating-empty-state { min-height: 10rem; }
    .estimating-list { max-height: none; }
    .estimating-summary { grid-column: auto; grid-template-columns: 1fr; }
    .estimate-line-card { align-items: flex-start; }
    .smart-history-overview, .smart-history-details > summary { align-items: flex-start; flex-direction: column; }
    .smart-history-controls { width: 100%; justify-items: stretch; }
    .smart-history-controls .status { width: fit-content; }
    .smart-history-component { grid-template-columns: 1.2fr repeat(3, minmax(64px, 1fr)); font-size: .7rem; }
}

@media (max-width: 520px) {
    .financial-subnav { width: 100%; }
    .financial-subnav button { flex: 1 1 0; }
    .estimating-code-grid,
    .estimating-cost-grid { grid-template-columns: 1fr; }
    .estimating-form-card { padding: .85rem; }
    .smart-history-component { grid-template-columns: 1fr auto; }
    .smart-history-component.header { display: none; }
    .smart-history-component > span:nth-of-type(1)::before { content: "Current · "; color: var(--muted); }
    .smart-history-component > span:nth-of-type(2)::before { content: "Historical · "; color: var(--muted); }
    .smart-history-component > span:nth-of-type(3) { grid-column: 1 / -1; }
}

.admin-form label {
    display: grid;
    gap: 0.35rem;
    color: var(--text);
    font-weight: 800;
}

.admin-form input,
.admin-form select,
.admin-form textarea {
    min-width: 0;
    min-height: 2.55rem;
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    padding: 0.55rem 0.65rem;
    color: var(--text);
    background: #ffffff;
    font-weight: 400;
}

.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus {
    border-color: var(--teal);
    outline: 3px solid rgba(32, 93, 158, 0.16);
}

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

.check-row input {
    width: 1rem;
    min-height: 1rem;
}

.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.45rem;
}

.permission-grid .check-row {
    display: grid;
    min-height: 2.35rem;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
    color: #314250;
    font-weight: 800;
    gap: 0.45rem;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.55rem;
}

.feature-grid label {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.45rem;
    min-height: 2.35rem;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
    color: #314250;
    font-weight: 800;
}

.feature-grid input {
    width: 1rem;
    min-height: 1rem;
}

.share-action-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.65fr);
    gap: 1rem;
}

.copy-field {
    display: grid;
    gap: 0.35rem;
    min-width: min(100%, 22rem);
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
}

.copy-field input {
    min-height: 2.4rem;
}

.copy-value-row {
    display: flex;
    align-items: stretch;
    gap: 0.45rem;
}

.copy-value-row input {
    flex: 1 1 auto;
    min-width: 0;
}

.copy-value-row .text-button {
    flex: 0 0 auto;
}

.portal-link-field {
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-tint);
}

.share-link-message-stack {
    display: grid;
    gap: 0.8rem;
}

.secure-link-field {
    min-width: 0;
}

.message-editor,
.message-draft-panel {
    display: grid;
    gap: 0.65rem;
    padding: 0.85rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-tint);
}

.message-editor-label,
.message-draft-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.message-editor-label {
    color: var(--text);
}

.message-editor-label .icon-shell {
    color: var(--teal);
}

.message-editor-label small {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 700;
}

.message-editor textarea,
.message-draft-panel textarea {
    min-height: 7.5rem;
    resize: vertical;
}

.message-draft-header > div {
    display: grid;
    gap: 0.16rem;
}

.message-draft-header strong {
    color: var(--text);
}

.section-heading {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0;
}

.quote-builder-form {
    gap: 1rem;
}

.checkbox-row {
    align-items: center;
    display: flex;
    flex-direction: row;
    gap: 0.55rem;
    min-height: 2.55rem;
}

.checkbox-row input {
    min-height: auto;
    width: auto;
}

.toggle-row {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: row;
    gap: 0.75rem;
    min-height: 3.25rem;
    padding: 0.55rem 0.7rem;
    position: relative;
}

.toggle-row input {
    height: 1px;
    inset: 0 auto auto 0;
    margin: 0;
    min-height: 0;
    opacity: 0;
    padding: 0;
    pointer-events: none;
    position: absolute;
    width: 1px;
}

.toggle-track {
    background: #dce6ec;
    border: 1px solid #b8c8d2;
    border-radius: 999px;
    display: inline-flex;
    flex: 0 0 auto;
    height: 1.55rem;
    padding: 0.15rem;
    transition: background 0.18s ease, border-color 0.18s ease;
    width: 2.85rem;
}

.toggle-knob {
    background: #ffffff;
    border-radius: 999px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.22);
    display: block;
    height: 1.15rem;
    transition: transform 0.18s ease;
    width: 1.15rem;
}

.toggle-row input:checked + .toggle-track {
    background: var(--teal);
    border-color: var(--teal);
}

.toggle-row input:checked + .toggle-track .toggle-knob {
    transform: translateX(1.25rem);
}

.toggle-row input:focus-visible + .toggle-track {
    outline: 3px solid rgba(32, 93, 158, 0.24);
    outline-offset: 2px;
}

.toggle-row small {
    color: var(--muted);
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    margin-top: 0.1rem;
}

input:disabled,
select:disabled,
textarea:disabled {
    background: #eef3f6;
    color: var(--fdc-color-text-muted);
    cursor: not-allowed;
}

.quote-builder-block {
    display: grid;
    gap: 0.55rem;
}

.quote-line-scroll,
.detail-table-wrap {
    overflow-x: auto;
}

.quote-line-grid {
    display: grid;
    grid-template-columns: 7rem minmax(16rem, 2fr) 5rem 6rem 7rem 5rem 6rem 5rem 7rem minmax(14rem, 1.2fr) 3.25rem;
    gap: 0.45rem;
    min-width: 1260px;
    align-items: start;
}

.quote-line-row {
    display: contents;
}

.quote-source-grid {
    display: grid;
    grid-template-columns: minmax(8rem, 1fr) minmax(12rem, 1.4fr) 7rem minmax(12rem, 1.4fr);
    gap: 0.45rem;
    align-items: start;
}

.quote-line-heading {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0;
}

.quote-line-add {
    justify-self: start;
}

.quote-line-remove {
    min-height: 2.55rem;
    width: 2.75rem;
    border: 1px solid #e0b2b2;
    border-radius: 8px;
    background: #fff7f7;
    color: #8d3333;
    font-weight: 900;
}

.quote-line-remove:hover:not(:disabled) {
    border-color: #d08d8d;
    background: #fff0f0;
}

.quote-line-remove:disabled {
    border-color: var(--line);
    background: #f7fafb;
    color: var(--muted);
    opacity: 0.65;
    cursor: not-allowed;
}

.quote-detail-panel {
    min-width: 0;
}

.quote-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: 0.85rem;
}

.quote-detail-header p {
    margin: 0.2rem 0 0;
}

.quote-grand-total {
    color: var(--text);
    font-size: 1.35rem;
    font-weight: 900;
    white-space: nowrap;
}

.compact-table th,
.compact-table td {
    padding: 0.55rem;
}

.source-list {
    display: grid;
    gap: 0.2rem;
}

.source-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.25rem 0.75rem;
    padding: 0.65rem 0;
    border-top: 1px solid var(--line);
}

.source-item:first-child {
    border-top: none;
}

.source-item a,
.source-item p,
.source-item .muted {
    grid-column: 1 / -1;
}

.source-item p {
    margin: 0;
}

.primary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.55rem;
    border: 1px solid var(--teal);
    border-radius: 8px;
    background: var(--teal);
    color: #ffffff;
    font-weight: 900;
    padding: 0.55rem 0.85rem;
    text-decoration: none;
}

.primary-button:hover {
    border-color: #174a82;
    background: #174a82;
    color: #ffffff;
}

.danger-button {
    border-color: #d7a2a2;
    background: #fff5f5;
    color: #8d3333;
}

.danger-button:hover {
    border-color: #c98484;
    background: #ffeeee;
    color: #7a2929;
}

.disabled-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.3rem;
    border: 1px dashed var(--line-strong);
    border-radius: 8px;
    background: #f5f8f9;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 900;
    padding: 0.42rem 0.75rem;
    cursor: default;
}

.disabled-action-primary {
    min-height: 2.55rem;
    border-color: #aebfd4;
    background: #e8f1fc;
    color: #4a6989;
}

.compact-button {
    min-height: 2.35rem;
    padding: 0.45rem 0.7rem;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fbfc;
}

.filter-bar input,
.filter-bar select {
    min-height: 2.35rem;
    min-width: min(16rem, 100%);
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: #ffffff;
    padding: 0.45rem 0.6rem;
}

.collapsible-card > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    cursor: pointer;
    list-style: none;
}

.collapsible-card > summary::-webkit-details-marker {
    display: none;
}

.collapsible-card > summary::after {
    content: "+";
    width: 1.8rem;
    height: 1.8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--teal);
    font-weight: 900;
}

.collapsible-card[open] > summary::after {
    content: "-";
}

.collapsible-card .admin-form {
    margin-top: 1rem;
}

.empty-state {
    display: grid;
    gap: 0.45rem;
    align-content: center;
    min-height: 8rem;
    padding: 1rem;
    border: 1px dashed #bfd0d9;
    border-radius: 8px;
    background: #f8fbfc;
}

.empty-state strong {
    color: var(--text);
}

.empty-state p {
    margin: 0;
    color: var(--muted);
}

.detail-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 1rem 0 0.75rem;
}

.detail-tab {
    min-height: 2rem;
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.62rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #f8fbfc;
    color: #344858;
    font-size: 0.78rem;
    font-weight: 900;
}

.detail-tab.active {
    border-color: #acc8e7;
    background: #e8f1fc;
    color: #174a82;
}

.dispatch-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.85rem;
}

.dispatch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
    gap: 0.85rem;
}

.dispatch-column {
    min-height: 20rem;
    background: #ffffff;
}

.dispatch-column-header {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: 0.75rem;
}

.dispatch-card {
    display: grid;
    gap: 0.45rem;
    padding: 0.8rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
    text-decoration: none;
}

.dispatch-card:hover {
    border-color: #a9c7e8;
    background: var(--surface-tint);
}

.record-grid {
    display: grid;
    gap: 0.75rem;
}

.record-card {
    display: grid;
    gap: 0.35rem;
    padding: 0.85rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.record-card.selected {
    border-color: #8db6df;
    background: var(--surface-tint);
    box-shadow: 0 0 0 3px rgba(32, 93, 158, 0.1);
}

.record-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.placeholder-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.45fr);
    gap: 1rem;
    align-items: stretch;
}

.placeholder-panel {
    display: grid;
    gap: 0.85rem;
}

.placeholder-list {
    display: grid;
    gap: 0.55rem;
}

.placeholder-list li {
    padding: 0.7rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
}

.integration-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
    gap: 0.85rem;
}

.integration-card {
    display: grid;
    gap: 0.55rem;
    padding: 0.95rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 1rem;
    align-items: start;
}

.settings-control-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.85rem;
}

.settings-tile {
    min-width: 0;
    min-height: 7.25rem;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
        "icon copy status"
        "icon copy arrow";
    gap: 0.35rem 0.75rem;
    align-items: start;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--text);
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(24, 37, 48, 0.04);
}

.settings-tile:hover {
    border-color: #9abde3;
    background: var(--surface-tint);
    box-shadow: 0 8px 20px rgba(24, 37, 48, 0.08);
}

.settings-tile-icon {
    grid-area: icon;
    width: 2.55rem;
    height: 2.55rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #c1d5eb;
    border-radius: 8px;
    background: var(--surface-tint);
    color: var(--teal);
}

.settings-tile-copy {
    grid-area: copy;
    min-width: 0;
    display: grid;
    gap: 0.3rem;
}

.settings-tile-copy strong {
    font-size: 0.95rem;
}

.settings-tile-copy > span {
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.45;
}

.settings-tile > .status {
    grid-area: status;
}

.settings-tile-arrow {
    grid-area: arrow;
    align-self: end;
    justify-self: end;
    color: #70828f;
}

.settings-branding-panel {
    grid-column: span 2;
}

.settings-branding-panel .form-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.settings-branding-panel input[type="file"] {
    padding: 0.5rem;
}

@media (max-width: 1180px) {
    .grid-wide,
    .dashboard-layout,
    .workspace-layout,
    .board-layout,
    .share-action-layout,
    .placeholder-hero {
        grid-template-columns: 1fr;
    }

    .command-card,
    .command-card.wide {
        grid-column: span 6;
    }

    .settings-branding-panel {
        grid-column: span 1;
    }

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

    .dashboard-span-4,
    .dashboard-span-5,
    .dashboard-span-6,
    .dashboard-span-7,
    .dashboard-span-8 {
        grid-column: span 1;
    }
}

@media (max-width: 720px) {
    .content {
        padding-inline: 0.75rem;
    }

    .page-header,
    .quote-detail-header,
    .workflow-heading {
        display: grid;
    }

    .page-actions {
        justify-content: flex-start;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .command-overlay {
        padding: 0.7rem;
    }

    .command-modal {
        max-height: calc(100vh - 1.4rem);
        border-radius: 10px;
    }

    .command-header,
    .workspace-header {
        grid-template-columns: 1fr;
    }

    .command-actions {
        justify-content: flex-start;
    }

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

    .command-timeline-step::before {
        display: none;
    }

    .command-shell-header,
    .command-shell-hero,
    .command-shell-timeline,
    .command-shell-tabs,
    .command-shell-body {
        padding-inline: 0.85rem;
    }

    .command-body-grid,
    .command-card,
    .command-card.wide {
        grid-column: 1 / -1;
    }

    .dashboard-command-grid {
        grid-template-columns: 1fr;
    }
}

.invoice-actions,
.quote-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.75rem;
}

.login-shell {
    min-height: 100vh;
    min-height: 100dvh;
    color: var(--fdc-color-text);
    background: var(--fdc-color-background);
    background-image: none;
}

:root[data-theme="dark"] .login-shell {
    background: radial-gradient(ellipse at 4% 0%, #203f68, transparent 52%), #0d1626;
}

.login-page {
    width: min(1120px, calc(100% - 2rem));
    margin: 0 auto;
    padding: var(--fdc-space-8) 0 var(--fdc-space-10);
}

/* The invite and recovery screens share the same contained split-auth rhythm
   as sign-in, without carrying the decorative image into security steps. */
.login-page:not(.login-page-signin) {
    display: flex;
    flex-direction: column;
    min-height: calc(100dvh - 2rem);
    margin-block: 1rem;
    padding: clamp(1.25rem, 3vw, 2.5rem);
    border: 1px solid var(--fdc-color-border);
    border-radius: 1.5rem;
    background: var(--fdc-color-surface);
    box-shadow: var(--fdc-shadow-lg);
}

.login-page:not(.login-page-signin) > .login-brand {
    margin-bottom: clamp(1.5rem, 4vh, 3rem);
}

.login-page:not(.login-page-signin) .login-grid {
    flex: 1;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 440px);
    gap: clamp(1rem, 3vw, 3rem);
    align-items: stretch;
}

.login-page:not(.login-page-signin) .login-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    padding: clamp(1.5rem, 4vw, 3.5rem);
    border: 1px solid var(--fdc-color-border);
    border-radius: 1.1rem;
    background: var(--fdc-color-accent-soft);
}

.login-page:not(.login-page-signin) .login-copy h1 {
    font-size: clamp(2rem, 3.6vw, 3rem);
}

.login-page:not(.login-page-signin) .login-panel {
    align-self: center;
    width: 100%;
    padding: clamp(1.5rem, 3vw, 2.5rem);
    border: 0;
    background: var(--fdc-color-surface);
    box-shadow: none;
}

.login-page-signin {
    width: min(1480px, calc(100% - 2rem));
    min-height: calc(100dvh - 2rem);
    display: flex;
    flex-direction: column;
    margin-block: 1rem;
    padding: clamp(1.25rem, 4vw, 3.5rem);
    border: 1px solid #cbd9e9;
    border-radius: 1.5rem;
    background:
        linear-gradient(90deg, rgba(250, 251, 253, .97) 0%, rgba(247, 249, 251, .91) 36%, rgba(245, 247, 250, .62) 68%, rgba(242, 245, 249, .4) 100%),
        url('/assets/northvault-login-architecture.png') center center / cover no-repeat;
    box-shadow: 0 18px 50px rgba(30, 65, 108, .12);
}

:root[data-theme="dark"] .login-page-signin {
    border-color: #345477;
    background:
        linear-gradient(90deg, rgba(7, 20, 39, .94) 0%, rgba(10, 28, 51, .89) 39%, rgba(12, 36, 64, .72) 70%, rgba(8, 23, 43, .78) 100%),
        url('/assets/northvault-login-architecture.png') center center / cover no-repeat;
}

.login-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--fdc-space-4);
    min-height: 9.5rem;
    margin-bottom: clamp(2rem, 6vh, 4rem);
    padding: 1.25rem clamp(1.25rem, 3vw, 2.25rem);
    border-radius: 1.5rem;
    background:
        radial-gradient(ellipse 34rem 10rem at 31% 60%, rgba(126, 198, 244, .5), transparent 78%),
        linear-gradient(112deg, #123e72 0%, #397fba 54%, #175a96 100%);
    box-shadow: 0 20px 44px rgba(20, 54, 99, .18);
}

.login-page-signin .login-header {
    min-height: 0;
    margin-bottom: 1.25rem;
    padding: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.login-page-signin .login-brand > small { color: var(--fdc-color-text-muted); }
:root[data-theme="dark"] .login-page-signin .login-brand > small { color: #d4e3f4; }

.login-brand {
    display: grid;
    justify-items: start;
    gap: 0.1rem;
    color: var(--fdc-color-text);
    font-size: 1.125rem;
    font-weight: 700;
}

.login-brand .northvault-wordmark {
    display: block;
    position: relative;
    width: min(29rem, 68vw);
    height: 5.65rem;
    flex: none;
    overflow: hidden;
    background: transparent;
}

.brand-artwork-dark { display: none; }
:root[data-theme="dark"] .brand-artwork-light { display: none; }
:root[data-theme="dark"] .brand-artwork-dark { display: block; }
:root[data-theme="dark"] .login-brand { color: #f3f7fd; }

.login-brand .northvault-wordmark img {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: auto;
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 3px 8px rgba(3, 20, 44, .24));
}

.login-brand > small { color: #dae7f6; font-size: .8rem; line-height: 1.25; letter-spacing: .02em; }

.login-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
    gap: clamp(2rem, 5vw, 5rem);
    align-items: center;
}

.login-page-signin .login-grid { flex: 1; }

.login-benefits {
    display: flex;
    align-items: stretch;
    gap: 1rem;
    margin-top: clamp(3rem, 8vh, 6rem);
}

.login-benefits > div {
    min-width: 7.5rem;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: .55rem;
    padding: .4rem .9rem;
    border-right: 1px solid rgba(91, 126, 163, .28);
    color: #276aaf;
    text-align: center;
}

.login-benefits > div:last-child { border-right: 0; }
.login-benefits span { color: #294460; font-size: .72rem; font-weight: 850; line-height: 1.25; letter-spacing: .035em; text-transform: uppercase; }
:root[data-theme="dark"] .login-benefits > div { border-color: rgba(185, 214, 245, .24); color: #9bcaff; }
:root[data-theme="dark"] .login-benefits span { color: #dae7f7; }

.login-copy h1 {
    max-width: 15ch;
    margin: 0;
    font-size: clamp(2.25rem, 4.6vw, 4.25rem);
    line-height: 1.08;
    letter-spacing: -0.035em;
}

.login-copy p:not(.eyebrow) {
    max-width: 42rem;
    margin: 1.2rem 0 0;
    color: var(--fdc-color-text-secondary);
    font-size: 1.05rem;
    line-height: 1.6;
}

.login-panel {
    display: grid;
    gap: var(--fdc-space-6);
    min-width: 0;
    padding: var(--fdc-space-8);
    border: 1px solid var(--line);
    border-radius: var(--fdc-radius-xl);
    background: var(--fdc-color-surface);
    box-shadow: var(--fdc-shadow-lg);
}

.login-panel h2 {
    margin-bottom: 0.2rem;
    font-size: 1.6rem;
    letter-spacing: -0.02em;
}

.login-panel-heading .muted {
    margin: var(--fdc-space-2) 0 0;
    line-height: 1.6;
}

.login-access-icon {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    margin-bottom: var(--fdc-space-5);
    border: 1px solid var(--fdc-color-border);
    border-radius: var(--fdc-radius-md);
    background: var(--fdc-color-accent-soft);
    color: var(--fdc-color-accent);
}

.login-help {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--fdc-space-3);
    padding-top: var(--fdc-space-4);
    border-top: 1px solid var(--fdc-color-border);
    font-size: 0.8125rem;
}

.login-help a {
    display: inline-flex;
    align-items: center;
    gap: var(--fdc-space-1);
    min-height: var(--fdc-tap-target);
    color: var(--fdc-color-text-secondary);
    text-underline-offset: 0.25em;
}

.login-help a:hover {
    color: var(--fdc-color-accent);
}

.login-help a:focus-visible {
    outline: 2px solid var(--fdc-color-accent);
    outline-offset: 4px;
}

.login-form {
    display: grid;
    gap: 0.85rem;
}

.login-subcontractor-entry {
    display: grid;
    gap: .8rem;
    padding: 1.1rem;
    border: 1px solid var(--fdc-color-border);
    border-radius: var(--fdc-radius-md);
    background: var(--fdc-color-background-secondary);
}
.login-subcontractor-entry p { margin: .35rem 0 0; color: var(--fdc-color-text-secondary); line-height: 1.5; }
.login-subcontractor-entry .fdc-button { min-height: 44px; width: 100%; justify-content: center; white-space: normal; text-align: center; }

.login-form > label {
    display: grid;
    gap: 0.35rem;
    color: var(--text);
    font-weight: 800;
}

.login-form input:not(.fdc-field) {
    min-height: 2.75rem;
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    padding: 0.65rem 0.75rem;
    color: var(--text);
    background: var(--fdc-color-surface-interactive);
}

.login-form input:focus {
    border-color: var(--teal);
    outline: 3px solid rgba(32, 93, 158, 0.2);
}

.login-form button:not(.fdc-button) {
    min-height: 2.75rem;
    border: 1px solid var(--teal);
    border-radius: 8px;
    background: var(--teal);
    color: var(--fdc-color-on-accent);
    font-weight: 900;
}

.pilot-access {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--line);
}

@media (max-width: 900px) {
    .grid-wide,
    .dashboard-layout,
    .workspace-layout,
    .board-layout,
    .placeholder-hero,
    .login-grid {
        grid-template-columns: 1fr;
    }

    .login-grid {
        max-width: 36rem;
        margin-inline: auto;
    }

    .login-page:not(.login-page-signin) .login-grid {
        width: 100%;
        max-width: 42rem;
        grid-template-columns: minmax(0, 1fr);
    }

    .login-page:not(.login-page-signin) .login-copy { padding: 1.75rem; }

    .login-page:not(.login-page-signin) .login-panel { padding: 1.5rem .5rem; }

    .login-page-signin {
        background-position: center, 58% center;
    }

    .login-page-signin .login-grid { align-items: start; }

    .login-benefits { margin-top: 2rem; }

    .login-copy h1 {
        font-size: 2.25rem;
        max-width: 20ch;
    }

    .login-panel {
        padding: var(--fdc-space-6);
    }
}

@media (max-width: 640px) {
    .login-page:not(.login-page-signin) {
        width: min(calc(100% - 1rem), 34rem);
        min-height: calc(100dvh - 1rem);
        margin-block: .5rem;
        padding: 1rem;
        border-radius: 1rem;
    }

    .login-page:not(.login-page-signin) .login-copy { padding: 1.25rem; }

    .login-page:not(.login-page-signin) .login-panel { padding: 1.25rem .25rem; }

    .login-page-signin {
        width: min(calc(100% - 1rem), 34rem);
        min-height: calc(100dvh - 1rem);
        margin-block: .5rem;
        padding: 1.1rem;
        border-radius: 1.1rem;
        background-image:
            linear-gradient(90deg, rgba(250, 251, 253, .97) 0%, rgba(247, 249, 251, .91) 36%, rgba(245, 247, 250, .62) 68%, rgba(242, 245, 249, .4) 100%),
            url('/assets/northvault-login-architecture.png');
        background-position: center, 70% center;
    }

    :root[data-theme="dark"] .login-page-signin {
        background-image:
            linear-gradient(90deg, rgba(7, 20, 39, .94) 0%, rgba(10, 28, 51, .89) 39%, rgba(12, 36, 64, .72) 70%, rgba(8, 23, 43, .78) 100%),
            url('/assets/northvault-login-architecture.png');
        background-position: center, 70% center;
    }

    .login-page-signin .login-header {
        flex-direction: column-reverse;
        align-items: stretch;
        gap: .25rem;
        margin-bottom: var(--fdc-space-6);
        padding: 0;
        border-radius: 0;
    }

    .login-page-signin .login-header .fdc-theme-switch {
        align-self: flex-end;
    }

    .login-brand .northvault-wordmark {
        width: min(22rem, calc(100vw - 4rem));
        height: 4.75rem;
    }

    .login-page-signin .login-grid {
        gap: var(--fdc-space-6);
    }

    .login-page-signin .login-copy h1 {
        font-size: 1.875rem;
    }

    .login-page-signin .login-copy p:not(.eyebrow) {
        display: none;
    }

    .login-benefits { display: none; }

    .page-header {
        flex-direction: column;
    }

    .page-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .media-row {
        grid-template-columns: 4.5rem minmax(0, 1fr);
    }

    .media-statuses,
    .media-actions {
        grid-column: 2;
        justify-content: flex-start;
    }

    .pilot-access {
        align-items: flex-start;
        flex-direction: column;
    }

    .quote-source-grid {
        grid-template-columns: 1fr;
    }

    .quote-detail-header {
        flex-direction: column;
    }
}

/* Schedule / Dispatch command board */
.dispatch-page-header { margin-bottom: .8rem; }
.dispatch-loading { min-height: 12rem; display: grid; place-items: center; color: var(--muted); }
.dispatch-live-region:empty { display: none; }
.dispatch-live-region { margin: 0; }
.dispatch-command-bar { display: grid; gap: .8rem; margin-bottom: .65rem; padding: .8rem; }
.dispatch-date-navigation { display: grid; grid-template-columns: auto auto minmax(220px, 1fr) auto; align-items: center; gap: .55rem; }
.dispatch-date-form { display: flex; gap: .35rem; align-items: center; }
.dispatch-date-form input { min-height: 2.3rem; }
.dispatch-date-title { display: grid; justify-items: center; line-height: 1.2; }
.dispatch-date-title strong { font-size: 1.05rem; }
.dispatch-date-title span, .dispatch-date-title a { color: var(--teal); font-size: .76rem; font-weight: 900; text-decoration: none; }
.dispatch-view-switch { display: grid; grid-template-columns: repeat(3, minmax(80px, 1fr)); padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.dispatch-view-switch a { display: grid; place-items: center; min-height: 2.25rem; border-radius: 7px; color: var(--text); font-weight: 900; text-decoration: none; }
.dispatch-view-switch a.active { background: var(--fdc-color-accent); color: var(--fdc-color-on-accent); box-shadow: 0 4px 12px rgba(46,102,137,.2); }
.dispatch-filter-form { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(165px, auto) minmax(145px, auto) auto auto; gap: .45rem; align-items: center; }
.dispatch-filter-form select, .dispatch-filter-form input { width: 100%; min-height: 2.3rem; }
.dispatch-search { display: flex; align-items: center; gap: .45rem; border: 1px solid var(--line); border-radius: 8px; padding: 0 .65rem; background: var(--surface); }
.dispatch-search input { border: 0; outline: 0; background: transparent; }
.dispatch-board-summary { display: flex; flex-wrap: wrap; gap: .45rem; margin: 0 0 .65rem; color: var(--muted); font-size: .76rem; }
.dispatch-board-summary span { padding: .28rem .55rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.dispatch-unassigned { padding: 0; overflow: hidden; margin-bottom: .65rem; }
.dispatch-unassigned-heading { width: 100%; display: grid; grid-template-columns: auto 1fr auto; gap: .65rem; align-items: center; padding: .72rem .85rem; border: 0; background: var(--surface); color: var(--text); text-align: left; cursor: pointer; }
.dispatch-unassigned-heading > span:nth-child(2), .dispatch-tech-cell > span:last-child { display: grid; gap: .08rem; }
.dispatch-unassigned-heading small, .dispatch-tech-cell small { color: var(--muted); font-size: .72rem; }
.dispatch-unassigned-list { display: flex; gap: .55rem; overflow-x: auto; padding: 0 .85rem .85rem; min-height: 4.5rem; }
.dispatch-unassigned.collapsed .dispatch-unassigned-list { display: none; }
.dispatch-unassigned.collapsed .dispatch-unassigned-heading svg { transform: rotate(180deg); }
.dispatch-avatar { width: 2.25rem; height: 2.25rem; flex: 0 0 auto; display: grid; place-items: center; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-soft); color: var(--text); font-size: .72rem; font-weight: 950; }
.dispatch-avatar.unassigned { border-style: dashed; }
.dispatch-day-shell { padding: 0; overflow: hidden; }
.dispatch-day-scroll { overflow: auto; max-height: min(68vh, 840px); }
.dispatch-day-board { display: grid; grid-template-columns: 250px var(--dispatch-timeline-width, 1080px); min-width: var(--dispatch-board-min-width, 1330px); background: var(--surface); }
.dispatch-tech-heading, .dispatch-time-heading { position: sticky; top: 0; z-index: 12; min-height: 2.8rem; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); }
.dispatch-tech-heading { left: 0; z-index: 14; display: flex; align-items: center; padding: 0 .85rem; border-right: 1px solid var(--line); color: var(--muted); font-size: .72rem; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.dispatch-time-heading { display: grid; }
.dispatch-time-heading span { display: flex; align-items: center; padding-left: .45rem; border-left: 1px solid var(--line); color: var(--muted); font-size: .7rem; font-weight: 800; }
.dispatch-tech-cell { position: sticky; left: 0; z-index: 8; display: flex; align-items: center; gap: .65rem; min-height: 7.3rem; padding: .75rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); }
.dispatch-time-lane { position: relative; display: grid; min-height: 7.3rem; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, color-mix(in srgb, var(--surface-soft) 42%, transparent), transparent); }
.dispatch-hour-cell { border-left: 1px dashed var(--line); min-width: 0; }
.dispatch-lane-empty { position: absolute; inset: 0; display: grid; place-items: center; color: color-mix(in srgb, var(--muted) 65%, transparent); font-size: .72rem; pointer-events: none; }
.dispatch-time-lane.is-drop-target, .dispatch-unassigned-list.is-drop-target { background: color-mix(in srgb, var(--teal) 12%, var(--surface)); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--teal) 55%, transparent); }
.dispatch-block { position: absolute; top: .65rem; bottom: .65rem; z-index: 4; min-width: 125px; display: flex; flex-direction: column; gap: .22rem; overflow: hidden; padding: .62rem .72rem .58rem .82rem; border: 1px solid color-mix(in srgb, var(--blue) 32%, var(--line)); border-radius: 9px; background: color-mix(in srgb, var(--surface) 92%, var(--blue)); color: var(--text); box-shadow: 0 6px 18px rgba(24,37,48,.08); text-decoration: none; cursor: grab; }
.dispatch-block:hover, .dispatch-block:focus-visible { z-index: 7; border-color: var(--blue); box-shadow: 0 9px 22px rgba(24,37,48,.16); outline: none; }
.dispatch-block.selected { box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 24%, transparent), 0 9px 22px rgba(24,37,48,.16); }
.dispatch-block.has-conflict { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.dispatch-block.is-dragging { opacity: .52; cursor: grabbing; }
.dispatch-block.is-saving { opacity: .68; cursor: progress; }
.dispatch-block.is-saving::after {
    position: absolute;
    z-index: 25;
    inset: 0;
    display: grid;
    place-items: center;
    border-radius: inherit;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    color: var(--text);
    content: "Saving…";
    font-size: .7rem;
    font-weight: 900;
    letter-spacing: .015em;
}
.dispatch-block.is-resizing { z-index: 10; box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 28%, transparent); }
.dispatch-block.compact { position: relative; inset: auto; min-width: 250px; width: min(340px, 76vw); min-height: 4.7rem; }
.dispatch-block.compact .dispatch-block-address, .dispatch-block.compact .dispatch-resize-handle { display: none; }
.dispatch-block-accent { position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--blue); }
.dispatch-block-time { color: var(--muted); font-size: .7rem; font-weight: 800; }
.dispatch-block strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; }
.dispatch-block-address { display: flex; gap: .22rem; align-items: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .68rem; }
.dispatch-block-meta { display: flex; gap: .3rem; margin-top: auto; }
.dispatch-block-meta .status { padding: .12rem .35rem; font-size: .6rem; }
.dispatch-resize-handle { position: absolute; top: 0; right: 0; bottom: 0; width: 9px; cursor: ew-resize; }
.dispatch-resize-handle { touch-action: none; }
.dispatch-now-line { position: absolute; top: 0; bottom: 0; z-index: 9; width: 2px; background: #3978bc; pointer-events: none; }
.dispatch-now-line::before { content: ""; position: absolute; top: -.2rem; left: -.25rem; width: .55rem; height: .55rem; border-radius: 999px; background: #3978bc; }
.dispatch-now-line span { position: absolute; top: .25rem; left: .35rem; padding: .1rem .25rem; border-radius: 4px; background: #3978bc; color: #ffffff; font-size: .62rem; font-weight: 950; white-space: nowrap; }
.dispatch-drag-guide { position: absolute; top: 0; bottom: 0; z-index: 18; width: 2px; background: var(--teal); pointer-events: none; }
.dispatch-drag-guide::before { content: ""; position: absolute; top: -.18rem; left: -.28rem; width: .62rem; height: .62rem; border-radius: 999px; background: var(--teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 20%, transparent); }
.dispatch-drag-guide > span { position: absolute; top: .55rem; left: 50%; padding: .24rem .42rem; border-radius: 6px; background: var(--teal); color: #052a29; box-shadow: 0 5px 14px rgba(5, 42, 41, .2); font-size: .66rem; font-weight: 950; line-height: 1; white-space: nowrap; transform: translateX(-50%); }
.dispatch-board-help { display: flex; align-items: center; gap: .4rem; margin: 0; padding: .62rem .8rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .72rem; }
.dispatch-empty-compact { display: grid; place-items: center; min-height: 3.4rem; padding: .6rem; color: var(--muted); font-size: .75rem; }
.tone-1 .dispatch-block-accent, .dispatch-avatar.tone-1, .dispatch-month-job.tone-1 { --tone: #3488f5; }
.tone-2 .dispatch-block-accent, .dispatch-avatar.tone-2, .dispatch-month-job.tone-2 { --tone: #43b85d; }
.tone-3 .dispatch-block-accent, .dispatch-avatar.tone-3, .dispatch-month-job.tone-3 { --tone: #8b5cf6; }
.tone-4 .dispatch-block-accent, .dispatch-avatar.tone-4, .dispatch-month-job.tone-4 { --tone: #6984d8; }
.tone-5 .dispatch-block-accent, .dispatch-avatar.tone-5, .dispatch-month-job.tone-5 { --tone: #f59e42; }
.tone-6 .dispatch-block-accent, .dispatch-avatar.tone-6, .dispatch-month-job.tone-6 { --tone: #e15b91; }
.dispatch-block[class*="tone-"] .dispatch-block-accent { background: var(--tone); }
.dispatch-avatar[class*="tone-"] { border-color: color-mix(in srgb, var(--tone) 55%, var(--line)); background: color-mix(in srgb, var(--tone) 13%, var(--surface)); color: var(--tone); }
.dispatch-week { padding: 0; overflow: hidden; }
.dispatch-week-scroll { overflow-x: auto; }
.dispatch-week-resource-grid { display: grid; grid-template-columns: minmax(175px, .8fr) repeat(7, minmax(132px, 1fr)); min-width: 1120px; }
.dispatch-week-corner, .dispatch-week-column-heading { position: sticky; top: 0; z-index: 2; min-height: 4.3rem; padding: .62rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface-soft); }
.dispatch-week-corner { left: 0; z-index: 4; display: flex; align-items: center; color: var(--muted); font-size: .69rem; font-weight: 950; letter-spacing: .06em; text-transform: uppercase; }
.dispatch-week-column-heading { display: grid; grid-template-columns: 1fr auto; gap: .08rem .35rem; }
.dispatch-week-column-heading span { color: var(--muted); font-size: .68rem; font-weight: 900; text-transform: uppercase; }
.dispatch-week-column-heading strong { grid-row: span 2; font-size: 1.15rem; }
.dispatch-week-column-heading small { color: var(--muted); font-size: .67rem; }
.dispatch-week-column-heading.today { background: color-mix(in srgb, var(--teal) 11%, var(--surface)); color: var(--teal); }
.dispatch-week-technician { position: sticky; left: 0; z-index: 3; display: flex; gap: .58rem; align-items: center; min-height: 8.1rem; padding: .68rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); }
.dispatch-week-technician > span:last-child { display: grid; gap: .14rem; min-width: 0; }
.dispatch-week-technician strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .79rem; }
.dispatch-week-technician small { color: var(--muted); font-size: .64rem; }
.dispatch-week-capacity { position: relative; display: flex; flex-direction: column; gap: .32rem; min-height: 8.1rem; padding: .58rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; transition: background .14s ease, box-shadow .14s ease; }
.dispatch-week-capacity:hover, .dispatch-week-capacity:focus-visible { background: color-mix(in srgb, var(--blue) 6%, var(--surface)); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--blue) 55%, transparent); }
.dispatch-week-capacity.has-conflict { box-shadow: inset 0 0 0 2px color-mix(in srgb, #dc2626 70%, transparent); }
.dispatch-utilization { height: 4px; overflow: hidden; border-radius: 999px; background: var(--line); }
.dispatch-utilization > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--blue)); }
.dispatch-week-capacity-summary { display: flex; align-items: baseline; justify-content: space-between; }
.dispatch-week-capacity-summary strong { font-size: .92rem; }
.dispatch-week-capacity-summary small, .dispatch-week-open, .dispatch-week-more { color: var(--muted); font-size: .62rem; }
.dispatch-week-compact-job { display: grid; gap: .05rem; overflow: hidden; padding: .25rem .32rem; border-left: 3px solid var(--blue); border-radius: 4px; background: color-mix(in srgb, var(--blue) 8%, var(--surface)); font-size: .64rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.dispatch-week-compact-job time { color: var(--muted); font-size: .58rem; font-weight: 700; }
.dispatch-week-conflict { color: #dc2626; font-size: .61rem; font-weight: 950; text-transform: uppercase; }
.dispatch-month { padding: 0; overflow: hidden; }
.dispatch-month-weekdays, .dispatch-month-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.dispatch-month-weekdays { border-bottom: 1px solid var(--line); background: var(--surface-soft); }
.dispatch-month-weekdays span { padding: .55rem; color: var(--muted); font-size: .7rem; font-weight: 900; text-align: center; text-transform: uppercase; }
.dispatch-month-day { min-height: 8.7rem; padding: .42rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.dispatch-month-day:nth-child(7n) { border-right: 0; }
.dispatch-month-day.outside { background: color-mix(in srgb, var(--surface-soft) 62%, var(--surface)); opacity: .72; }
.dispatch-month-day.today { box-shadow: inset 0 0 0 2px var(--teal); }
.dispatch-month-day > header { display: flex; align-items: center; justify-content: space-between; gap: .3rem; }
.dispatch-month-date { display: grid; place-items: center; width: 1.7rem; height: 1.7rem; margin: 0 0 .2rem auto; border-radius: 999px; color: var(--text); font-size: .74rem; font-weight: 900; text-decoration: none; }
.dispatch-month-count { color: var(--muted); font-size: .6rem; font-weight: 850; }
.dispatch-month-load { display: block; height: 3px; margin-bottom: .32rem; overflow: hidden; border-radius: 999px; background: var(--line); }
.dispatch-month-load > span { display: block; height: 100%; border-radius: inherit; background: var(--teal); }
.dispatch-month-day.today .dispatch-month-date { background: var(--teal); color: var(--fdc-color-on-accent); }
.dispatch-month-job { display: flex; gap: .3rem; align-items: center; margin-bottom: .25rem; padding: .28rem .35rem; border-left: 3px solid var(--tone); border-radius: 4px; background: color-mix(in srgb, var(--tone) 10%, var(--surface)); color: var(--text); font-size: .65rem; text-decoration: none; }
.dispatch-month-job strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dispatch-month-more { font-size: .67rem; font-weight: 850; text-decoration: none; }

:root[data-theme="dark"] .dispatch-block { background: color-mix(in srgb, var(--surface) 88%, var(--blue)); box-shadow: 0 7px 18px rgba(0,0,0,.23); }
:root[data-theme="dark"] .dispatch-time-lane { background: linear-gradient(180deg, rgba(21,45,61,.55), rgba(15,35,47,.25)); }
:root[data-theme="dark"] .dispatch-search input { color: var(--text); }

@media (min-width: 1100px) {
    .dispatch-command-bar { grid-template-columns: minmax(440px, 1.25fr) minmax(260px, .7fr); }
    .dispatch-filter-form { grid-column: 1 / -1; }
}

@media (max-width: 820px) {
    .dispatch-date-navigation { grid-template-columns: auto 1fr auto; }
    .dispatch-date-form { grid-column: 1 / -1; grid-row: 2; justify-content: center; }
    .dispatch-date-title { grid-column: 2; grid-row: 1; }
    .dispatch-filter-form { grid-template-columns: 1fr 1fr; }
    .dispatch-search { grid-column: 1 / -1; }
    .dispatch-day-scroll { max-height: none; overflow: visible; }
    .dispatch-day-board { grid-template-columns: 1fr; min-width: 0; }
    .dispatch-tech-heading, .dispatch-time-heading { display: none; }
    .dispatch-tech-cell { position: relative; left: auto; z-index: 1; min-height: 3.8rem; border-right: 0; background: var(--surface-soft); }
    .dispatch-time-lane { display: grid; gap: .45rem; min-height: 2.5rem; padding: .55rem; }
    .dispatch-hour-cell, .dispatch-now-line, .dispatch-lane-empty { display: none; }
    .dispatch-time-lane .dispatch-block { position: relative; inset: auto !important; width: 100% !important; min-height: 5.3rem; }
    .dispatch-resize-handle { display: none; }
    .dispatch-board-help { display: none; }
    .dispatch-month { overflow-x: auto; }
    .dispatch-month-weekdays, .dispatch-month-grid { min-width: 720px; }
}

@media (max-width: 540px) {
    .dispatch-page-header { align-items: stretch; }
    .dispatch-page-header .page-actions, .dispatch-page-header .action-button { width: 100%; }
    .dispatch-filter-form { grid-template-columns: 1fr; }
    .dispatch-search, .dispatch-filter-form > * { grid-column: 1; }
    .dispatch-view-switch { order: -1; }
    .dispatch-unassigned-list { flex-direction: column; overflow: visible; }
    .dispatch-block.compact { width: 100%; min-width: 0; }
}

/* Schedule visual system: resource-led dispatch on desktop, chronological cards on phones. */
.dispatch-page-header {
    align-items: center;
    margin-bottom: 1rem;
}

.dispatch-page-header h1 {
    margin: .12rem 0 .18rem;
    font-size: clamp(2rem, 4vw, 2.75rem);
    letter-spacing: -.035em;
}

.dispatch-header-context {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .45rem .8rem;
    margin: 0;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 700;
}

.dispatch-header-context span {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

.dispatch-header-context i,
.dispatch-summary-ready i,
.dispatch-tech-state i {
    width: .48rem;
    height: .48rem;
    border-radius: 999px;
    background: var(--teal);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--teal) 13%, transparent);
}

.dispatch-command-bar {
    gap: .95rem 1.1rem;
    margin-bottom: .85rem;
    padding: 1rem;
    border-radius: 16px;
    box-shadow: 0 12px 34px rgba(31, 52, 67, .07);
}

.dispatch-date-navigation {
    grid-template-columns: auto minmax(150px, auto) minmax(250px, 1fr) auto;
    gap: .7rem;
}

.dispatch-date-navigation > .icon-button {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 11px;
}

.dispatch-date-form {
    padding: .22rem;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-soft);
}

.dispatch-date-form input {
    min-height: 2.25rem;
    border: 0;
    background: transparent;
    font-weight: 800;
}

.dispatch-date-form .text-button {
    min-height: 2.15rem;
    border-radius: 8px;
    background: var(--surface);
}

.dispatch-date-title strong {
    font-size: 1.12rem;
    letter-spacing: -.01em;
}

.dispatch-view-switch {
    align-self: center;
    padding: 4px;
    border-radius: 12px;
}

.dispatch-view-switch a {
    min-height: 2.65rem;
    border-radius: 9px;
    font-size: .84rem;
}

.dispatch-filter-form {
    padding-top: .85rem;
    border-top: 1px solid var(--line);
}

.dispatch-filter-form select,
.dispatch-filter-form input {
    min-height: 2.7rem;
    border-radius: 10px;
}

.dispatch-search {
    min-height: 2.7rem;
    border-radius: 10px;
    background: var(--surface-soft);
}

.dispatch-board-summary {
    gap: .55rem;
    margin-bottom: .85rem;
}

.dispatch-board-summary span {
    display: inline-flex;
    align-items: center;
    gap: .33rem;
    padding: .42rem .72rem;
    border-radius: 999px;
    font-size: .73rem;
    font-weight: 750;
    box-shadow: 0 4px 12px rgba(31, 52, 67, .04);
}

.dispatch-board-summary strong {
    color: var(--text);
    font-size: .79rem;
}

.dispatch-summary-ready {
    margin-left: auto;
    color: color-mix(in srgb, var(--teal) 82%, var(--text));
}

.dispatch-unassigned {
    margin-bottom: .85rem;
    border-radius: 16px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--blue) 5%, var(--surface)), var(--surface));
    box-shadow: 0 10px 28px rgba(31, 52, 67, .06);
}

.dispatch-unassigned-heading {
    grid-template-columns: auto 1fr auto auto;
    padding: .92rem 1rem;
    background: transparent;
}

.dispatch-unassigned-heading strong {
    font-size: .88rem;
}

.dispatch-unassigned-count {
    display: grid;
    place-items: center;
    min-width: 1.8rem;
    height: 1.8rem;
    padding: 0 .4rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--blue) 13%, var(--surface));
    color: var(--blue);
    font-size: .72rem;
    font-weight: 950;
}

.dispatch-unassigned-list {
    gap: .75rem;
    padding: 0 1rem 1rem;
}

.dispatch-avatar {
    position: relative;
    overflow: hidden;
    width: 2.5rem;
    height: 2.5rem;
    border-width: 2px;
    box-shadow: 0 5px 14px rgba(31, 52, 67, .11);
}

.dispatch-avatar-small { width: 2rem; height: 2rem; }
.dispatch-avatar-medium { width: 2.5rem; height: 2.5rem; }
.dispatch-avatar-large { width: 4rem; height: 4rem; font-size: .94rem; }
.compact-editor { margin-top: .9rem; padding: .8rem; border: 1px solid var(--line); border-radius: .85rem; background: var(--surface-soft); }
.compact-editor > summary { cursor: pointer; font-weight: 700; }
input.is-derived-value { background: var(--surface-soft); color: var(--text-secondary); }
.dispatch-avatar img { width: 100%; height: 100%; display: block; object-fit: cover; }
.dispatch-avatar.unassigned { box-shadow: none; }

.dispatch-day-shell,
.dispatch-week,
.dispatch-month {
    border-radius: 16px;
    box-shadow: 0 14px 38px rgba(31, 52, 67, .07);
}

.dispatch-day-board {
    grid-template-columns: 250px var(--dispatch-timeline-width, 1080px);
    min-width: var(--dispatch-board-min-width, 1330px);
}

.dispatch-tech-heading,
.dispatch-time-heading {
    min-height: 3.3rem;
    background: color-mix(in srgb, var(--surface) 91%, transparent);
}

.dispatch-time-heading span {
    justify-content: center;
    padding: 0;
    font-size: .72rem;
}

.dispatch-tech-cell {
    gap: .8rem;
    min-height: 9.5rem;
    padding: .95rem 1rem;
    background: linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--surface-soft) 65%, var(--surface)));
}

.dispatch-tech-copy {
    min-width: 0;
    gap: .18rem !important;
}

.dispatch-tech-copy strong {
    overflow: hidden;
    color: var(--text);
    font-size: .9rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dispatch-tech-state {
    display: inline-flex;
    align-items: center;
    gap: .38rem;
    margin-top: .22rem;
    color: color-mix(in srgb, var(--teal) 84%, var(--text));
    font-size: .66rem;
    font-weight: 850;
}

.dispatch-tech-state i { width: .38rem; height: .38rem; box-shadow: none; }
.dispatch-tech-state i { background: var(--tone, var(--teal)); }

.dispatch-time-lane {
    min-height: 9.5rem;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--surface-soft) 55%, transparent), transparent 70%),
        var(--surface);
}

.dispatch-hour-cell { border-left: 1px dashed color-mix(in srgb, var(--line) 82%, transparent); }

.dispatch-block {
    top: .75rem;
    bottom: auto;
    box-sizing: border-box;
    height: 5.8rem;
    max-height: calc(100% - 1.5rem);
    gap: .2rem;
    min-width: 0;
    padding: .66rem .7rem .6rem .88rem;
    border-radius: 12px;
    box-shadow: 0 9px 22px rgba(31, 52, 67, .12);
    isolation: isolate;
    transition: width .16s ease, height .16s ease, top .16s ease, transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.dispatch-block:not(.compact) .dispatch-block-title,
.dispatch-block:not(.compact) .dispatch-block-job,
.dispatch-block:not(.compact) .dispatch-block-address,
.dispatch-block:not(.compact) .dispatch-block-menu {
    display: none;
}

.dispatch-block:not(.compact) .dispatch-block-topline {
    min-height: 1.15rem;
}

.dispatch-block:not(.compact) .dispatch-block-meta {
    margin-top: auto;
}

[data-schedule-card][data-schedule-draggable="true"] {
    cursor: grab;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-drag: none;
}

[data-schedule-card][data-schedule-draggable="true"]:active,
[data-schedule-card].is-dragging {
    cursor: grabbing;
}

.dispatch-day-scroll {
    scrollbar-gutter: stable;
}

.dispatch-block[class*="tone-"] {
    border-color: color-mix(in srgb, var(--tone) 32%, var(--line));
    background: linear-gradient(135deg, color-mix(in srgb, var(--tone) 8%, var(--surface)), var(--surface));
}

.dispatch-block.tone-1 { --tone: #3488f5; }
.dispatch-block.tone-2 { --tone: #43b85d; }
.dispatch-block.tone-3 { --tone: #8b5cf6; }
.dispatch-block.tone-4 { --tone: #6984d8; }
.dispatch-block.tone-5 { --tone: #f59e42; }
.dispatch-block.tone-6 { --tone: #e15b91; }

.dispatch-block:hover,
.dispatch-block:focus-visible {
    transform: translateY(-2px);
    border-color: var(--tone, var(--blue));
    box-shadow: 0 14px 28px rgba(31, 52, 67, .17);
}

.dispatch-block:not(.compact) .dispatch-block-address {
    display: none;
}

@media (hover: hover) and (min-width: 821px) {
    .dispatch-block:not(.compact):not(.is-dragging):not(.is-resizing):hover,
    .dispatch-block:not(.compact):not(.is-dragging):not(.is-resizing):focus-visible {
        top: .35rem;
        width: max(var(--dispatch-card-width, 0px), min(310px, 42vw)) !important;
        height: 8.8rem;
        max-height: calc(100% - .7rem);
        z-index: 20;
        overflow: hidden;
        cursor: pointer;
    }

    .dispatch-block:not(.compact):hover .dispatch-block-title,
    .dispatch-block:not(.compact):focus-visible .dispatch-block-title {
        display: -webkit-box;
        overflow: hidden;
        text-overflow: clip;
        white-space: normal;
        overflow-wrap: anywhere;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    .dispatch-block:not(.compact):hover .dispatch-block-job,
    .dispatch-block:not(.compact):focus-visible .dispatch-block-job {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .dispatch-block:not(.compact):hover .dispatch-block-address,
    .dispatch-block:not(.compact):focus-visible .dispatch-block-address {
        display: -webkit-box;
        overflow: hidden;
        white-space: normal;
        overflow-wrap: anywhere;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    .dispatch-block:not(.compact):hover .dispatch-block-menu,
    .dispatch-block:not(.compact):focus-visible .dispatch-block-menu {
        display: inline-grid;
        width: 1.1rem;
        opacity: 1;
        visibility: visible;
    }
}

.dispatch-block.is-dragging,
.dispatch-block.is-resizing {
    top: .75rem !important;
    width: var(--dispatch-card-width, 120px) !important;
    height: 5.8rem !important;
    min-width: 0 !important;
    overflow: hidden !important;
}

.dispatch-block.is-dragging .dispatch-block-address,
.dispatch-block.is-resizing .dispatch-block-address {
    display: none !important;
}

.dispatch-block.compact {
    width: min(390px, 80vw);
    height: auto;
    max-height: none;
    min-height: 7.15rem;
}

.dispatch-block.compact .dispatch-block-address { display: flex; }
.dispatch-block-topline { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: .3rem; }
.dispatch-block-time { display: inline-flex; min-width: 0; align-items: center; gap: .3rem; overflow: hidden; color: var(--muted); font-size: .67rem; font-weight: 850; text-overflow: ellipsis; white-space: nowrap; }
.dispatch-block-time i { width: .46rem; height: .46rem; flex: 0 0 auto; border-radius: 999px; background: var(--tone, var(--blue)); }
.dispatch-block-menu { display: inline-grid; width: 0; flex: 0 0 auto; overflow: hidden; place-items: center; color: var(--muted); opacity: 0; visibility: hidden; transition: width .14s ease, opacity .14s ease; }
.dispatch-block.compact .dispatch-block-menu { width: 1.1rem; opacity: 1; visibility: visible; }
.dispatch-block-title { min-width: 0; font-size: .84rem !important; letter-spacing: -.01em; }
.dispatch-block-job { overflow: hidden; color: var(--tone, var(--blue)); font-size: .69rem; font-weight: 850; text-overflow: ellipsis; white-space: nowrap; }
:root[data-theme="dark"] .dispatch-block-job { color: color-mix(in srgb, var(--tone, var(--blue)) 80%, white); }
.dispatch-block-address { min-width: 0; margin-top: .05rem; font-size: .66rem; line-height: 1.25; }
.dispatch-block-meta { min-width: 0; flex: 0 0 auto; flex-wrap: wrap; gap: .28rem; overflow: hidden; }
.dispatch-block-meta .status { max-width: 100%; padding: .15rem .4rem; overflow: hidden; border-radius: 6px; font-size: .56rem; text-overflow: ellipsis; white-space: nowrap; }
.dispatch-block-accent { border-radius: inherit 0 0 inherit; }

.dispatch-drag-preview {
    position: fixed !important;
    inset: 0 auto auto 0 !important;
    z-index: 9999 !important;
    display: grid !important;
    gap: .14rem !important;
    width: min(245px, calc(100vw - 2rem)) !important;
    height: auto !important;
    min-height: 4.75rem !important;
    max-height: none !important;
    overflow: hidden !important;
    padding: .7rem .8rem .68rem .95rem !important;
    border: 1px solid color-mix(in srgb, var(--tone, var(--blue)) 45%, var(--line)) !important;
    border-left: 4px solid var(--tone, var(--blue)) !important;
    border-radius: 12px !important;
    background: var(--surface) !important;
    color: var(--text) !important;
    pointer-events: none !important;
    opacity: .98 !important;
    box-shadow: 0 14px 34px rgba(31, 52, 67, .24) !important;
    transition: none !important;
}

.dispatch-drag-preview strong,
.dispatch-drag-preview span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dispatch-drag-preview strong { font-size: .8rem; }
.dispatch-drag-preview span { color: var(--muted); font-size: .68rem; font-weight: 750; }

.dispatch-now-line {
    z-index: 3;
    width: 1px;
    background: color-mix(in srgb, var(--teal) 62%, transparent);
}

.dispatch-now-line::before { opacity: .8; }
.dispatch-now-line span { background: color-mix(in srgb, var(--teal) 82%, white); }
.dispatch-drag-guide { z-index: 30; width: 3px; background: var(--teal); box-shadow: 0 0 0 1px color-mix(in srgb, var(--teal) 25%, transparent); }

.dispatch-lane-empty {
    color: color-mix(in srgb, var(--muted) 52%, transparent);
    font-weight: 750;
}

.dispatch-week-resource-grid {
    grid-template-columns: minmax(215px, .9fr) repeat(7, minmax(145px, 1fr));
    min-width: 1230px;
}

.dispatch-week-corner,
.dispatch-week-column-heading {
    min-height: 4.8rem;
    padding: .75rem;
}

.dispatch-week-technician,
.dispatch-week-capacity {
    min-height: 9rem;
}

.dispatch-week-technician { gap: .75rem; padding: .85rem; }
.dispatch-week-technician strong { font-size: .84rem; }
.dispatch-week-capacity { gap: .42rem; padding: .72rem; background: var(--surface); }
.dispatch-week-capacity.is-drop-target,
.dispatch-month-day.is-drop-target {
    background: color-mix(in srgb, var(--teal) 12%, var(--surface));
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--teal) 58%, transparent);
}
.dispatch-week-compact-job {
    padding: .38rem .42rem;
    border-left-color: var(--tone, var(--blue));
    border-radius: 7px;
    background: color-mix(in srgb, var(--tone, var(--blue)) 10%, var(--surface));
    color: var(--text);
    text-decoration: none;
    cursor: grab;
}

.dispatch-month-day {
    min-height: 10rem;
    padding: .58rem;
    background: var(--surface);
}

.dispatch-month-job {
    padding: .38rem .45rem;
    border-radius: 7px;
    cursor: grab;
}

.schedule-slot-dialog {
    width: min(680px, calc(100vw - 2rem));
    max-height: min(720px, calc(100vh - 2rem));
    overflow: auto;
    padding: 1.2rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 24px 80px rgba(12, 30, 42, .32);
}

.schedule-slot-dialog::backdrop {
    background: rgba(10, 25, 36, .64);
    backdrop-filter: blur(4px);
}

.schedule-slot-dialog h3 { margin: 0 0 .35rem; }
.schedule-slot-dialog > p { margin: 0 0 1rem; color: var(--muted); }
.schedule-slot-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .5rem; max-height: 430px; overflow: auto; padding: .15rem; }
.schedule-slot-option { min-height: 2.5rem; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); color: var(--text); font-weight: 850; cursor: pointer; }
.schedule-slot-option:hover, .schedule-slot-option:focus-visible { border-color: var(--teal); background: color-mix(in srgb, var(--teal) 10%, var(--surface)); outline: none; }
.schedule-slot-empty { grid-column: 1 / -1; padding: 1rem; border-radius: 10px; background: var(--surface-soft); color: var(--muted); }
.schedule-slot-actions { display: flex; justify-content: flex-end; margin-top: 1rem; }

.technician-color-form {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: .7rem;
    margin-top: -.35rem;
    padding: .75rem 1rem 1rem;
    border: 1px solid var(--line);
    border-top: 0;
    border-radius: 0 0 14px 14px;
    background: var(--surface-soft);
}
.technician-color-form label { display: grid; flex: 1; gap: .3rem; font-size: .72rem; font-weight: 850; }
.technician-color-form select { min-height: 2.25rem; border: 1px solid color-mix(in srgb, var(--technician-color) 62%, var(--line)); border-radius: 8px; background: var(--surface); box-shadow: inset 5px 0 0 var(--technician-color); }

.technician-photo-settings {
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}

.section-title.compact { align-items: flex-start; margin-bottom: .85rem; }
.section-title.compact h3 { margin: 0 0 .22rem; }
.section-title.compact p { max-width: 720px; margin: 0; }
.technician-photo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: .8rem; }
.technician-profile-settings-card { display: grid; align-content: start; }
.technician-photo-card { display: grid; gap: .8rem; padding: 1rem; border: 1px solid var(--line); border-radius: 14px 14px 0 0; background: linear-gradient(145deg, var(--surface), var(--surface-soft)); }
.technician-photo-identity { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.technician-photo-identity > div { display: grid; gap: .1rem; min-width: 0; }
.technician-photo-identity strong,
.technician-photo-identity span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.technician-photo-identity span { color: var(--muted); font-size: .74rem; }
.technician-photo-identity small { color: var(--blue); font-size: .68rem; font-weight: 800; }
.technician-photo-picker { display: grid; gap: .35rem; color: var(--text); font-size: .74rem; font-weight: 850; }
.technician-photo-picker input { width: 100%; padding: .55rem; border: 1px dashed var(--line-strong, var(--line)); border-radius: 10px; background: var(--surface); font-size: .72rem; }
.technician-photo-crop-dialog { width: min(540px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); overflow: auto; padding: 1.1rem; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--text); box-shadow: 0 24px 80px rgba(12, 30, 42, .32); }
.technician-photo-crop-dialog::backdrop { background: rgba(10, 25, 36, .72); backdrop-filter: blur(5px); }
.technician-photo-crop-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.technician-photo-crop-header h3 { margin: .15rem 0 .25rem; }
.technician-photo-crop-header p { margin: 0; color: var(--muted); font-size: .82rem; }
.technician-photo-crop-stage { position: relative; width: min(420px, 100%); aspect-ratio: 1; margin: 0 auto; overflow: hidden; border-radius: 14px; background: #102330; box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); }
.technician-photo-crop-stage canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.technician-photo-crop-stage canvas.is-positioning { cursor: grabbing; }
.technician-photo-crop-boundary { position: absolute; inset: 4px; border: 3px dashed rgba(255,255,255,.92); border-radius: 999px; box-shadow: 0 0 0 999px rgba(4, 17, 26, .32); pointer-events: none; }
.technician-photo-zoom { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: .8rem; margin: 1rem auto; width: min(420px, 100%); font-size: .78rem; font-weight: 850; }
.technician-photo-zoom input { width: 100%; accent-color: var(--teal); }
.technician-photo-crop-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .6rem; }
.technician-photo-crop-actions .text-button { margin-right: auto; }

@media (min-width: 1100px) {
    .dispatch-command-bar { grid-template-columns: minmax(590px, 1.45fr) minmax(300px, .65fr); }
}

@media (max-width: 820px) {
    .dispatch-command-bar { padding: .8rem; }
    .dispatch-date-navigation { grid-template-columns: auto 1fr auto; }
    .dispatch-date-form { grid-column: 1 / -1; grid-row: 2; width: 100%; }
    .dispatch-date-form label { flex: 1; }
    .dispatch-date-form input { width: 100%; }
    .dispatch-date-title { grid-column: 2; grid-row: 1; }
    .dispatch-filter-form { grid-template-columns: 1fr 1fr; }
    .dispatch-search { grid-column: 1 / -1; }
    .dispatch-summary-ready { margin-left: 0; }
    .dispatch-day-shell { border: 0; box-shadow: none; background: transparent; }
    .dispatch-day-board { grid-template-columns: 1fr; min-width: 0; gap: .7rem; background: transparent; }
    .dispatch-tech-cell { min-height: 4.7rem; border: 1px solid var(--line); border-radius: 14px 14px 0 0; box-shadow: 0 8px 22px rgba(31, 52, 67, .06); }
    .dispatch-time-lane { gap: .62rem; min-height: 3rem; margin-top: -.7rem; padding: 1rem .7rem .7rem; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 14px 14px; background: var(--surface); }
    .dispatch-time-lane .dispatch-block { min-height: 7.2rem; padding: .8rem .85rem .72rem 1rem; }
    .dispatch-block-title { font-size: .92rem !important; }
}

@media (max-width: 540px) {
    .dispatch-page-header { gap: .8rem; }
    .dispatch-page-header .page-actions { display: grid; grid-template-columns: 1fr auto; }
    .dispatch-page-header .action-button { width: auto; }
    .dispatch-command-bar { gap: .75rem; padding: .7rem; border-radius: 14px; }
    .dispatch-view-switch { order: -1; }
    .dispatch-filter-form { grid-template-columns: 1fr; padding-top: .7rem; }
    .dispatch-filter-form > * { grid-column: 1; }
    .dispatch-board-summary { display: grid; grid-template-columns: 1fr 1fr; }
    .dispatch-board-summary span { justify-content: center; }
    .dispatch-summary-ready { display: none !important; }
    .dispatch-unassigned-heading { grid-template-columns: auto 1fr auto auto; padding: .78rem; }
    .dispatch-unassigned-heading small { display: none; }
    .dispatch-unassigned-list { padding: 0 .7rem .7rem; }
    .dispatch-avatar-large { width: 3.5rem; height: 3.5rem; }
    .dispatch-tech-cell { padding: .72rem .8rem; }
    .dispatch-block.compact { min-height: 7.2rem; }
    .technician-photo-grid { grid-template-columns: 1fr; }
    .technician-photo-crop-dialog { padding: .85rem; border-radius: 14px; }
    .technician-photo-crop-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .technician-photo-crop-actions .text-button { grid-column: 1 / -1; margin: 0; }
}

/* Passwordless customer portal */
.customer-portal-layout { min-height: 100vh; background: #f3f6fa; color: #162936; }
.customer-portal-page { --portal-primary: #205d9e; --portal-accent: #276aaf; width: min(1120px, calc(100% - 2rem)); margin: 0 auto; padding: 1.25rem 0 2rem; }
.customer-portal-header { min-height: 4.6rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; padding: 0.85rem 1rem; border: 1px solid #d6e1e4; border-radius: 8px; background: #ffffff; }
.portal-brand { min-width: 0; display: flex; align-items: center; gap: 0.75rem; color: #162936; text-decoration: none; }
.portal-brand img { width: 3.25rem; height: 3.25rem; object-fit: contain; }
.portal-brand span { min-width: 0; display: grid; }
.portal-brand strong { overflow-wrap: anywhere; font-size: 1rem; }
.portal-brand small, .portal-document-list small { color: #617584; }
.portal-support { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 0.75rem; }
.portal-support a { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--portal-accent); font-size: 0.84rem; text-decoration: none; }
.portal-package-hero { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.5rem; border-radius: 8px; background: var(--portal-primary); color: #ffffff; }
.portal-package-hero h1 { margin: 0.2rem 0 0.45rem; color: #ffffff; font-size: clamp(1.65rem, 4vw, 2.25rem); letter-spacing: 0; }
.portal-eyebrow { color: inherit; font-size: 0.7rem; font-weight: 800; letter-spacing: 0; text-transform: uppercase; }
.portal-package-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 0.45rem 0.85rem; font-size: 0.84rem; }
.portal-status, .portal-record-status { display: inline-flex; align-items: center; min-height: 1.55rem; padding: 0.15rem 0.55rem; border: 1px solid currentColor; border-radius: 999px; font-size: 0.72rem; font-weight: 800; }
.portal-primary-action { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; min-height: 2.65rem; padding: 0.55rem 0.85rem; border-radius: 6px; background: #ffffff; color: var(--portal-primary); font-weight: 800; text-decoration: none; }
.portal-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; margin: 1rem 0; }
.portal-summary-grid > div { min-width: 0; display: grid; grid-template-columns: auto 1fr; gap: 0.18rem 0.55rem; padding: 0.9rem; border: 1px solid #d6e1e4; border-radius: 8px; background: #ffffff; }
.portal-summary-grid .icon-shell { grid-row: 1 / span 2; color: var(--portal-accent); }
.portal-summary-grid span { color: #617584; font-size: 0.72rem; font-weight: 800; text-transform: uppercase; }
.portal-summary-grid strong { overflow-wrap: anywhere; font-size: 0.87rem; }
.portal-note, .portal-feedback-prepared { display: flex; align-items: flex-start; gap: 0.7rem; margin-bottom: 1rem; padding: 0.9rem 1rem; border: 1px solid #c9dce4; border-radius: 8px; background: #edf6fa; }
.portal-note .icon-shell, .portal-feedback-prepared .icon-shell { color: var(--portal-accent); }
.portal-note p, .portal-feedback-prepared p { margin: 0.2rem 0 0; color: #526b7a; }
.portal-content-section, .portal-status-card { padding: 1.15rem; border: 1px solid #d6e1e4; border-radius: 8px; background: #ffffff; }
.portal-section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 0.85rem; }
.portal-section-heading .portal-eyebrow { color: var(--portal-primary); }
.portal-section-heading h2 { margin: 0.12rem 0 0; font-size: 1.15rem; }
.portal-section-heading > span { color: #617584; font-size: 0.8rem; }
.portal-document-list { display: grid; gap: 0.55rem; }
.portal-document-list article { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.75rem; padding: 0.75rem; border: 1px solid #dce5e7; border-radius: 6px; }
.portal-document-list article > div { min-width: 0; display: grid; }
.portal-document-list strong { overflow-wrap: anywhere; }
.portal-document-icon { width: 2.35rem; height: 2.35rem; display: inline-grid; place-items: center; border-radius: 6px; background: #edf5f3; color: var(--portal-primary); }
.portal-record-status { color: var(--portal-primary); }
.portal-empty, .portal-access-error { display: grid; justify-items: center; gap: 0.45rem; padding-block: 2.5rem; text-align: center; }
.portal-empty p, .portal-access-error p { max-width: 38rem; margin: 0; color: #617584; }
.portal-access-error { margin-top: 5rem; }
.portal-feedback-prepared { align-items: center; margin-top: 1rem; background: #f4f7f8; }
.portal-feedback-prepared > div { flex: 1; }
.portal-feedback-prepared > span { color: #617584; font-size: 0.75rem; font-weight: 800; }
.portal-feedback-success { border-color: #a7d6c8; background: #edf8f4; }
.portal-feedback-form { margin-top: 1rem; padding: 1.15rem; border: 1px solid #d6e1e4; border-radius: 8px; background: #ffffff; }
.portal-feedback-form form { display: grid; gap: 0.85rem; }
.portal-feedback-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.portal-feedback-form label { display: grid; gap: 0.35rem; color: #314957; font-size: 0.8rem; font-weight: 800; }
.portal-feedback-form select, .portal-feedback-form textarea { width: 100%; border: 1px solid #bdccd2; border-radius: 6px; background: #ffffff; color: #162936; font: inherit; font-weight: 400; padding: 0.65rem 0.7rem; }
.portal-submit-button { width: fit-content; display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; min-height: 2.65rem; border: 0; border-radius: 6px; background: var(--portal-primary); color: #ffffff; font-weight: 800; padding: 0.6rem 0.9rem; }
.portal-form-error { padding: 0.65rem 0.75rem; border: 1px solid #efb5b5; border-radius: 6px; background: #fff1f1; color: #8d2424; font-size: 0.82rem; }
.portal-change-order-section { margin-bottom: 1rem; border-top: 4px solid var(--portal-accent); }
.portal-change-order-list { display: grid; gap: 1rem; }
.portal-change-order-card { overflow: hidden; border: 1px solid #cbdade; border-radius: 8px; background: #fff; }
.portal-change-order-card > header { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem; background: #f1f7f6; }
.portal-change-order-card h3 { margin: .15rem 0 0; font-size: 1.08rem; }
.portal-change-order-total { color: var(--portal-primary); font-size: 1.2rem; white-space: nowrap; }
.portal-change-order-summary { display: grid; grid-template-columns: minmax(0, 2fr) repeat(2, minmax(8rem, 1fr)); gap: .85rem; padding: 1rem; border-bottom: 1px solid #dce5e7; }
.portal-change-order-summary > div { display: grid; align-content: start; gap: .25rem; }
.portal-change-order-summary span { color: #617584; font-size: .7rem; font-weight: 800; text-transform: uppercase; }
.portal-change-order-summary p { margin: 0; white-space: pre-wrap; }
.portal-change-order-lines { display: grid; padding: .25rem 1rem .75rem; }
.portal-change-order-lines > div { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(6rem, auto); gap: .8rem; padding: .65rem 0; border-bottom: 1px solid #e5ecee; }
.portal-change-order-lines > div > strong { text-align: right; }
.portal-change-order-grand-total { color: var(--portal-primary); font-size: 1rem; }
.portal-change-order-terms { margin: 0 1rem 1rem; padding: .7rem .8rem; border-radius: 6px; background: #f5f7f8; }
.portal-change-order-terms summary { cursor: pointer; color: #314957; font-weight: 800; }
.portal-change-order-terms p { margin: .65rem 0 0; white-space: pre-wrap; }
.portal-change-order-receipt { display: flex; gap: .65rem; margin: 0 1rem 1rem; padding: .8rem; border: 1px solid #a7d6c8; border-radius: 7px; background: #edf8f4; color: #225d4c; }
.portal-change-order-receipt p { margin: .2rem 0 0; }
.portal-change-order-form { display: grid; gap: .85rem; padding: 1rem; border-top: 1px solid #dce5e7; background: #fbfcfc; }
.portal-change-order-form label { display: grid; gap: .35rem; color: #314957; font-size: .8rem; font-weight: 800; }
.portal-change-order-form input:not([type="checkbox"]), .portal-change-order-form textarea { width: 100%; border: 1px solid #bdccd2; border-radius: 6px; background: #fff; color: #162936; font: inherit; font-weight: 400; padding: .65rem .7rem; }
.portal-change-order-acknowledgment { grid-template-columns: auto minmax(0, 1fr) !important; align-items: start; padding: .75rem; border: 1px solid #cbdade; border-radius: 6px; background: #fff; }
.portal-change-order-acknowledgment input { width: 1.1rem; height: 1.1rem; margin-top: .05rem; }
.portal-change-order-actions { display: flex; justify-content: flex-end; gap: .65rem; }
.portal-decline-button { min-height: 2.65rem; border: 1px solid #9e3a3a; border-radius: 6px; background: #fff; color: #8d2424; font-weight: 800; padding: .6rem .9rem; }
.customer-portal-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.25rem 0.25rem 0; color: #617584; font-size: 0.78rem; }
.customer-portal-footer nav { display: flex; flex-wrap: wrap; gap: 0.8rem; }
.customer-portal-footer a { color: var(--portal-accent); }
.portal-link-grid { display: grid; grid-template-columns: minmax(0, 1fr) 11rem; gap: 1rem; align-items: start; }
.portal-qr-block { display: grid; justify-items: center; gap: 0.55rem; }
.portal-qr-preview { width: 10rem; height: 10rem; border: 1px solid var(--line); border-radius: 6px; background: #ffffff; padding: 0.35rem; image-rendering: pixelated; }
.access-grant-list { display: grid; gap: 0.55rem; }
.compact-feature-grid { margin-top: 1.25rem; }

@media (max-width: 760px) {
    .customer-portal-page { width: min(100% - 1rem, 1120px); padding-top: 0.5rem; }
    .customer-portal-header, .portal-package-hero, .customer-portal-footer { align-items: flex-start; flex-direction: column; }
    .portal-support { justify-content: flex-start; }
    .portal-primary-action { width: 100%; }
    .portal-summary-grid { grid-template-columns: 1fr; }
    .portal-document-list article { grid-template-columns: auto minmax(0, 1fr); }
    .portal-record-status { grid-column: 2; width: fit-content; }
    .portal-link-grid { grid-template-columns: 1fr; }
    .portal-feedback-grid { grid-template-columns: 1fr; }
    .portal-submit-button { width: 100%; }
    .portal-change-order-card > header { align-items: flex-start; flex-direction: column; }
    .portal-change-order-summary { grid-template-columns: 1fr; }
    .portal-change-order-lines > div { grid-template-columns: minmax(0, 1fr) auto; }
    .portal-change-order-lines > div small { grid-column: 1; }
    .portal-change-order-lines > div strong { grid-column: 2; grid-row: 1 / span 2; }
    .portal-change-order-actions { flex-direction: column-reverse; }
    .portal-decline-button { width: 100%; }
}

/* Office dark theme */
:root[data-theme="dark"] {
    color-scheme: dark;
    --text: #e7f0f3;
    --muted: #a9b9c1;
    --line: #344855;
    --line-strong: #4a6170;
    --surface: #182943;
    --surface-soft: #0d1626;
    --surface-tint: #213d61;
    --blue: #9bcaff;
    --teal: #91c5ff;
    --green: #83c69a;
    --amber: #e1bd6e;
    --red: #e08b8b;
    --shadow: 0 16px 36px rgba(0, 0, 0, 0.24);
    --estimate-warning-text: #f0d991;
    --estimate-over-text: #f0b7b7;
    --smart-history-border: #426797;
    --smart-history-divider: #34567c;
    --smart-history-surface: linear-gradient(145deg, #1c3555, #192b43);
    --smart-history-card: #203350;
    --smart-history-card-hover: #29496e;
    --smart-history-row: #192d49;
    --smart-history-warning-border: #8c7436;
    --smart-history-warning-surface: #3c3420;
    --smart-history-warning-text: #f0d991;
}

.address-assist {
    position: relative;
    display: grid;
    gap: .35rem;
    min-width: 0;
    color: var(--text);
    font-weight: 800;
}
.form-grid > .address-assist.wide-field { grid-column: 1 / -1; }
.address-assist-input { position: relative; min-width: 0; }
.address-assist-progress { position: absolute; top: 50%; right: .7rem; translate: 0 -50%; color: var(--muted); font-size: .7rem; font-weight: 750; pointer-events: none; }
.address-assist-results { position: absolute; z-index: 50; top: 100%; left: 0; right: 0; display: grid; overflow: hidden; margin-top: .25rem; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); box-shadow: 0 16px 35px rgba(19, 42, 55, .18); }
.address-assist-progress[hidden],
.address-assist-results[hidden],
.address-assist-notice[hidden] { display: none; }
.address-assist-results button { display: grid; gap: .12rem; width: 100%; padding: .7rem .75rem; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.address-assist-results button:hover,
.address-assist-results button:focus-visible { background: var(--surface-tint); outline: none; }
.address-assist-results button span { color: var(--muted); font-size: .73rem; font-weight: 600; }
.address-assist-results > small { justify-self: end; padding: .42rem .7rem; color: var(--muted); font-size: .66rem; }
.address-assist-notice { color: var(--muted); font-weight: 650; }

:root[data-theme="dark"] body,
:root[data-theme="dark"] .customer-portal-layout {
    background: var(--surface-soft);
    color: var(--text);
}

/* NavMenu uses CSS isolation, so its :root-prefixed dark selectors cannot
   match the document root after scoping. Keep the theme overrides global. */
:root[data-theme="dark"] .sidebar .portal-brand {
    border-color: #304350;
    background: transparent;
}

:root[data-theme="dark"] .sidebar .portal-brand a,
:root[data-theme="dark"] .sidebar .nav-link:hover {
    color: #edf4f6;
}

:root[data-theme="dark"] .sidebar .portal-brand a small,
:root[data-theme="dark"] .sidebar .nav-section,
:root[data-theme="dark"] .sidebar .nav-link,
:root[data-theme="dark"] .sidebar .nav-link .nav-icon {
    color: #aebdc5;
}

:root[data-theme="dark"] .sidebar .nav-link.active {
    background: #213f67;
    color: #edf5ff;
}

:root[data-theme="dark"] .sidebar .nav-link.active .nav-icon {
    color: #9bcaff;
}

:root[data-theme="dark"] .sidebar {
    background: linear-gradient(165deg, #192c48 0%, #14243b 55%, #101d31 100%);
}

:root[data-theme="dark"] .app-topbar {
    background: linear-gradient(105deg, rgba(26, 45, 72, .96), rgba(20, 36, 59, .94) 52%, rgba(31, 55, 86, .96));
}

:root[data-theme="dark"] .sidebar .nav-link:hover {
    background: #29466b;
}

:root[data-theme="dark"] .primary-button {
    color: #091d36;
}

:root[data-theme="dark"] .primary-button:hover {
    border-color: #abd4ff;
    background: #abd4ff;
    color: #091d36;
}

/* The dashboard keeps its existing information hierarchy in both themes. */
:root[data-theme="dark"] .dashboard-page {
    --mission-night: #0f2239;
    --mission-night-elevated: #172d4b;
    --mission-night-border: rgba(177, 210, 245, .18);
    --mission-night-muted: #b7c9df;
    --mission-teal: #91c5ff;
}

:root[data-theme="dark"] .dashboard-page .mission-hero {
    border-color: #365579;
    background:
        radial-gradient(circle at 12% 18%, rgba(77, 144, 216, .24), transparent 27rem),
        radial-gradient(circle at 93% 110%, rgba(35, 79, 128, .36), transparent 25rem),
        linear-gradient(138deg, #132a47 0%, #0f2239 58%, #0c1b30 100%);
    color: #f1f6ff;
    box-shadow: 0 24px 62px rgba(2, 10, 23, .28);
}

:root[data-theme="dark"] .dashboard-page .mission-hero h1,
:root[data-theme="dark"] .dashboard-page .mission-pulse-header strong,
:root[data-theme="dark"] .dashboard-page .mission-pulse-grid strong,
:root[data-theme="dark"] .dashboard-page .coverage-ring span {
    color: #f1f6ff;
}

:root[data-theme="dark"] .dashboard-page .mission-pulse {
    background: rgba(255, 255, 255, .055);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035);
}

:root[data-theme="dark"] .dashboard-page .mission-date {
    border-left-color: rgba(185, 214, 245, .22);
}

:root[data-theme="dark"] .dashboard-page .live-status {
    border-color: rgba(145, 197, 255, .25);
    background: rgba(145, 197, 255, .1);
}

:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .card-item,
:root[data-theme="dark"] .content-card,
:root[data-theme="dark"] .table-wrap,
:root[data-theme="dark"] .workspace-card,
:root[data-theme="dark"] .record-card,
:root[data-theme="dark"] .dispatch-column,
:root[data-theme="dark"] .customer-portal-header,
:root[data-theme="dark"] .portal-content-section,
:root[data-theme="dark"] .portal-status-card,
:root[data-theme="dark"] .portal-feedback-form {
    border-color: var(--line);
    background: var(--surface);
}

:root[data-theme="dark"] .command-modal,
:root[data-theme="dark"] .command-shell-header,
:root[data-theme="dark"] .command-shell-hero,
:root[data-theme="dark"] .command-shell-timeline,
:root[data-theme="dark"] .command-shell-tabs,
:root[data-theme="dark"] .command-shell-body,
:root[data-theme="dark"] .command-shell-footer,
:root[data-theme="dark"] .command-card,
:root[data-theme="dark"] .integration-card,
:root[data-theme="dark"] .settings-tile {
    border-color: var(--line);
    background: var(--surface);
}

:root[data-theme="dark"] .text-button,
:root[data-theme="dark"] .icon-button,
:root[data-theme="dark"] .filter-bar,
:root[data-theme="dark"] .quick-action,
:root[data-theme="dark"] .empty-state,
:root[data-theme="dark"] .workflow-panel,
:root[data-theme="dark"] .generated-file,
:root[data-theme="dark"] .detail-tab,
:root[data-theme="dark"] .permission-grid .check-row,
:root[data-theme="dark"] .feature-grid label,
:root[data-theme="dark"] .dispatch-card,
:root[data-theme="dark"] .record-card,
:root[data-theme="dark"] .portal-document-list article {
    border-color: var(--line);
    background: #203350;
    color: var(--text);
}

:root[data-theme="dark"] .text-button:hover,
:root[data-theme="dark"] .icon-button:hover,
:root[data-theme="dark"] .dispatch-card:hover,
:root[data-theme="dark"] .quick-action:hover,
:root[data-theme="dark"] .settings-tile:hover,
:root[data-theme="dark"] .command-list-link:hover {
    border-color: #6e9ed0;
    background: #29496e;
    color: #f2fbfc;
}

:root[data-theme="dark"] .admin-form input,
:root[data-theme="dark"] .admin-form select,
:root[data-theme="dark"] .admin-form textarea,
:root[data-theme="dark"] .filter-bar input,
:root[data-theme="dark"] .filter-bar select,
:root[data-theme="dark"] .global-search input,
:root[data-theme="dark"] .portal-feedback-form select,
:root[data-theme="dark"] .portal-feedback-form textarea,
:root[data-theme="dark"] .portal-change-order-form input:not([type="checkbox"]),
:root[data-theme="dark"] .portal-change-order-form textarea {
    border-color: var(--line-strong);
    background: #14243b;
    color: var(--text);
}

:root[data-theme="dark"] input:disabled,
:root[data-theme="dark"] select:disabled,
:root[data-theme="dark"] textarea:disabled {
    background: #1d304c;
    color: #9eafb8;
}

:root[data-theme="dark"] .message-editor,
:root[data-theme="dark"] .message-draft-panel,
:root[data-theme="dark"] .portal-link-field,
:root[data-theme="dark"] .portal-note,
:root[data-theme="dark"] .portal-feedback-prepared {
    border-color: #42658c;
    background: #1d3656;
}

:root[data-theme="dark"] table th {
    border-color: var(--line);
    background: #203350;
    color: #c9d9df;
}

:root[data-theme="dark"] table td,
:root[data-theme="dark"] .workspace-card-header,
:root[data-theme="dark"] .dispatch-column-header,
:root[data-theme="dark"] .detail-list div {
    border-color: var(--line);
}

:root[data-theme="dark"] .detail-list div,
:root[data-theme="dark"] .record-card.selected,
:root[data-theme="dark"] .detail-tab.active {
    background: #23466d;
}

:root[data-theme="dark"] .detail-tab.active {
    border-color: #729fd0;
    color: #e3f1ff;
}

:root[data-theme="dark"] .command-timeline {
    border-color: var(--line);
    background: linear-gradient(180deg, #1d303a, #172832);
}

:root[data-theme="dark"] .command-timeline-step::before {
    border-color: #49616e;
}

:root[data-theme="dark"] .command-timeline-step .timeline-marker {
    border-color: #526976;
    background: #172832;
}

:root[data-theme="dark"] .command-timeline-step.attention .timeline-marker {
    border-color: #a98942;
    background: #423920;
}

:root[data-theme="dark"] .workspace-tab {
    color: #aebfc8;
}

:root[data-theme="dark"] .workspace-tab small {
    background: #2a3c47;
    color: #c4d3da;
}

:root[data-theme="dark"] .workflow-step {
    border-color: var(--line);
    background: #1c303b;
    color: #b7c7cf;
}

:root[data-theme="dark"] .workflow-step.complete {
    border-color: #3f846f;
    background: #173b32;
    color: #b8ead9;
}

:root[data-theme="dark"] .workflow-step.current {
    border-color: #477893;
    background: #1d3644;
    color: #b9ddf1;
}

:root[data-theme="dark"] .workflow-step.attention {
    border-color: #90783d;
    background: #3d3520;
    color: #f0d991;
}

:root[data-theme="dark"] .workflow-step.skipped,
:root[data-theme="dark"] .workflow-step.pending {
    background: #22333e;
    color: #b4c2c9;
}

:root[data-theme="dark"] .settings-tile-icon {
    border-color: #527eaf;
    background: #203f67;
    color: #9bcaff;
}

:root[data-theme="dark"] .settings-tile-arrow {
    color: #aabdc6;
}

:root[data-theme="dark"] .command-list-row,
:root[data-theme="dark"] .workspace-card-header {
    border-color: var(--line);
}

:root[data-theme="dark"] .media-thumb {
    border-color: var(--line);
    background: #1b2c36;
}

:root[data-theme="dark"] .placeholder-list li {
    border-color: var(--line);
    background: #203350;
}

:root[data-theme="dark"] .status {
    border-color: #477893;
    background: #1d3644;
    color: #b8dcf1;
}

:root[data-theme="dark"] .status.green,
:root[data-theme="dark"] .notice-ok {
    border-color: #397c67;
    background: #173b32;
    color: #b5ead8;
}

:root[data-theme="dark"] .status.amber,
:root[data-theme="dark"] .notice-warning {
    border-color: #8c7436;
    background: #3c3420;
    color: #f0d991;
}

:root[data-theme="dark"] .status.red,
:root[data-theme="dark"] .notice-error {
    border-color: #855050;
    background: #412a2d;
    color: #f0b7b7;
}

:root[data-theme="dark"] .status.blue {
    border-color: #477893;
    background: #1d3644;
    color: #b8dcf1;
}

:root[data-theme="dark"] .status.gray,
:root[data-theme="dark"] .disabled-action {
    border-color: #526671;
    background: #22333e;
    color: #b4c2c9;
}

:root[data-theme="dark"] .customer-portal-layout,
:root[data-theme="dark"] .portal-brand,
:root[data-theme="dark"] .portal-brand a {
    color: var(--text);
}

:root[data-theme="dark"] .portal-package-hero {
    background: var(--portal-primary);
}

:root[data-theme="dark"] .portal-primary-action {
    background: #f3f7fd;
    color: var(--portal-primary);
}

@media (max-width: 640px) {
    .copy-value-row,
    .message-draft-header,
    .message-editor-label {
        align-items: stretch;
        flex-direction: column;
    }

    .copy-value-row .text-button,
    .message-draft-header .text-button {
        width: 100%;
    }
}
.portal-live-sync {
    align-items: center;
    display: flex;
    gap: .65rem;
    margin-bottom: .8rem;
    min-height: 2.6rem;
    padding: .55rem .75rem;
}

.portal-live-sync[hidden] {
    display: none;
}

.portal-live-sync [data-live-sync-message] {
    flex: 1;
}

.portal-live-sync[data-mode="updating"] .portal-live-sync-icon {
    animation: portal-live-sync-spin .9s linear infinite;
}

.portal-live-sync[data-mode="available"] {
    border-color: var(--warning, #d79b35);
}

.portal-live-sync[data-mode="offline"] {
    opacity: .82;
}

@keyframes portal-live-sync-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .portal-live-sync[data-mode="updating"] .portal-live-sync-icon {
        animation: none;
    }
}
