html, body {
    font-family: var(--cw-font-sans);
}

a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ── Page layout utilities ─────────────────────────────── */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--cw-ink-muted);
    margin: 0 0 16px;
}

/* minmax(0,1fr) rather than 1fr: a bare 1fr floors at the value's min-content width, so a full
   email address in a <dd> pushes the grid wider than its container at any viewport. */
.detail-grid {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 4px 20px;
    margin: 0;
}

.detail-grid dt {
    font-weight: 600;
    font-size: 14px;
    color: var(--cw-ink-muted);
}

.detail-grid dd {
    font-size: 14px;
    color: var(--cw-ink);
    margin: 0;
    overflow-wrap: anywhere; /* emails and long addresses have no break opportunities */
}

.form-actions {
    display: flex;
    flex-wrap: wrap; /* lets .submit-notice take its own row above the buttons */
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-bottom: 3rem;
}

/* Validation recap shown beside the submit button (SubmitValidationNotice) */
.submit-notice {
    flex: 1 1 100%;
    padding: 10px 16px;
    background: var(--cw-danger-bg);
    border: 1px solid var(--cw-red-100);
    border-radius: 6px;
    color: var(--cw-red-700);
    font-size: 13px;
}
.submit-notice ul { margin: 4px 0 0; padding-left: 20px; }
.submit-notice li { margin: 2px 0; }

.form-actions--sticky {
    position: sticky;
    bottom: 0;
    z-index: 40; /* below the app bar (--cw-z-sticky: 50) and form dropdowns (200/300) */
    background: var(--cw-surface-0);
    border-top: 1px solid var(--cw-line);
    padding: 12px 0;
}

/* ── Form layout utilities (Complex Job + shared sections) ── */
.form-section    { scroll-margin-top: calc(var(--cw-appbar-h, 56px) + 64px); } /* app bar + section jump bar */
/* Intrinsic, not breakpoint-driven: auto-fit drops a column whenever the tracks stop fitting,
   so these reflow off the container's own width. The min(100%, X) guard is what keeps them from
   overflowing when the container is narrower than the track floor. */
.form-grid-2     { display: grid; gap: 16px;
                   grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.form-grid-3     { display: grid; gap: 16px;
                   grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.form-grid-2 > *,
.form-grid-3 > * { min-width: 0; }

/* Mixed fixed/fr address rows — the hard 80px track is what breaks them when narrow. */
.addr-grid { display: grid; gap: 16px; grid-template-columns: 2fr 1fr 80px; }
.city-grid { display: grid; gap: 16px; grid-template-columns: 3fr 80px 1fr; }
.addr-grid > *, .city-grid > * { min-width: 0; }
@media (max-width: 1024px) { .addr-grid, .city-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width:  640px) { .addr-grid, .city-grid { grid-template-columns: 1fr; } }
.radio-row       { display: flex; gap: 24px; flex-wrap: wrap; }
.radio-option    { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.field-hint      { font-size: 12px; color: var(--cw-ink-muted); margin: 4px 0 0; }
.field-label-sub { font-size: 11px; color: var(--cw-ink-muted); display: block; }
.info-list       { font-size: 13px; margin: 0 0 12px; padding-left: 20px; line-height: 1.6; }
.input-with-btn  { display: flex; gap: 8px; }
.input-with-btn > .cw-input { flex: 1; }

/* Collapsed request-type / priority reference (Complex Job form) */
.request-help          { margin: 0 0 16px; }
.request-help summary  { font-size: 13px; font-weight: 600; color: var(--cw-blue-500);
                         cursor: pointer; list-style: none; padding: 4px 0;
                         display: inline-flex; align-items: center; gap: 6px; }
.request-help summary::-webkit-details-marker { display: none; }
.request-help summary::before { content: "\25B8"; font-size: 11px; transition: transform var(--cw-dur-fast) var(--cw-ease-out); }
.request-help[open] summary::before { transform: rotate(90deg); }
.request-help summary:focus-visible { outline: none; box-shadow: var(--cw-focus-ring); border-radius: var(--cw-radius-sm); }
.request-help .info-list { margin-top: 8px; }

/* Quote Lines table (EditJob) */
.cw-table-lines { width: 100%; border-collapse: collapse; margin-bottom: 12px; font-size: 13px; }
/* Unlike .cw-table this one doesn't nowrap, so width:100% would let auto layout crush the
   number columns instead of scrolling. Give it a floor when it's inside a scroll wrapper. */
.table-scroll .cw-table-lines { min-width: 720px; }
.cw-table-lines th, .cw-table-lines td { padding: 4px 8px; }
.cw-table-lines th { text-align: left; }
.cw-table-lines .num { text-align: right; }

/* ── Wizard stepper (QuickQuote, DiagnosticService) ───── */
/* 7 steps + 6 connectors, each step holding a fixed 28px circle. Scrolls rather than wrapping;
   the label is hidden at ≤1024 so it compacts to numbered circles. Only the state colours stay
   inline on the markup, since they're computed per step. */
.wiz-steps {
    display: flex;
    gap: 0;
    margin-bottom: 32px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.wiz-step { flex: 1; flex-shrink: 0; text-align: center; }

.wiz-step__dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    margin: 0 auto 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.wiz-step__label { font-size: 11px; white-space: nowrap; }

.wiz-step__line { flex: 1; min-width: 8px; height: 2px; margin-top: 13px; }

/* ── Request-type colored text ────────────────────────── */
.rt-install { color: var(--cw-blue-700); font-weight: 600; font-size: 13px; }
.rt-diag    { color: var(--cw-warning);  font-weight: 600; font-size: 13px; }
.rt-service { color: var(--cw-red-700);  font-weight: 600; font-size: 13px; }

/* ── Dashboard ────────────────────────────────────────── */
.dash-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.dash-kpi {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #fff;
    border: 1px solid var(--cw-line);
    border-radius: var(--cw-radius-md);
    padding: 20px;
    border-left: 4px solid;
    box-shadow: var(--cw-shadow-1);
}

.dash-kpi--clickable { cursor: pointer; transition: box-shadow .12s ease, transform .12s ease; }
.dash-kpi--clickable:hover { box-shadow: var(--cw-shadow-2); transform: translateY(-1px); }
.dash-kpi--active { box-shadow: 0 0 0 2px var(--cw-blue-500), var(--cw-shadow-1); }

.dash-kpi--red   { border-left-color: var(--cw-red-500); }
.dash-kpi--amber { border-left-color: #f59500; }
.dash-kpi--blue  { border-left-color: var(--cw-blue-500); }
.dash-kpi--green { border-left-color: var(--cw-success); }

.dash-kpi--red   .dash-kpi__icon { color: var(--cw-red-500); }
.dash-kpi--amber .dash-kpi__icon { color: #f59500; }
.dash-kpi--blue  .dash-kpi__icon { color: var(--cw-blue-500); }
.dash-kpi--green .dash-kpi__icon { color: var(--cw-success); }

.dash-kpi__icon { flex-shrink: 0; }

.dash-kpi__number {
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
    color: var(--cw-ink);
    letter-spacing: -0.02em;
}

.dash-kpi__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--cw-ink-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dash-section {
    margin-bottom: 24px;
}

/* ── TSM Start (landing) ──────────────────────────────── */
.tsm-start {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    gap: 32px;
}

.tsm-start__heading {
    font-size: 22px;
    font-weight: 700;
    color: var(--cw-ink);
    margin: 0;
}

.tsm-start__choices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    gap: 20px;
    width: 100%;
    max-width: 920px;
}

.tsm-choice {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 28px 24px;
    background: #fff;
    border: 2px solid var(--cw-line);
    border-radius: var(--cw-radius-md);
    box-shadow: var(--cw-shadow-1);
    cursor: pointer;
    text-align: left;
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
}

.tsm-choice:hover {
    border-color: var(--cw-blue-500);
    box-shadow: var(--cw-shadow-2);
}

.tsm-choice__icon { color: var(--cw-blue-500); }
.tsm-choice__title { font-size: 16px; font-weight: 700; color: var(--cw-ink); }
.tsm-choice__desc  { font-size: 14px; color: var(--cw-ink-muted); }

/* ── Scrollable table wrapper ─────────────────────────── */
/* No min-width floor: `white-space: nowrap` already stops the table shrinking below its own
   min-content width, so a blanket floor only forced *narrow* tables (4–8 column admin lists)
   to scroll sideways for no reason. Tables that genuinely want a floor opt in with --wide. */
.table-scroll { overflow-x: auto; overscroll-behavior-x: contain; }
.table-scroll .cw-table { min-width: 0; white-space: nowrap; }
.table-scroll .cw-table td,
.table-scroll .cw-table th { white-space: nowrap; }

.table-scroll--wide .cw-table { min-width: 1080px; }

/* Pin the identifier column (job number) so it stays readable while scrolling right.
   The opaque backgrounds are required — components.css's `th` background and
   `tbody tr:hover` would otherwise bleed through the pinned cell. */
.table-scroll--pin .cw-table > thead th:first-child,
.table-scroll--pin .cw-table > tbody td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--cw-surface-0);
    box-shadow: inset -1px 0 0 var(--cw-line); /* border-right doesn't survive border-collapse */
}

.table-scroll--pin .cw-table > thead th:first-child {
    z-index: 2;
    background: var(--cw-surface-1);
}

.table-scroll--pin .cw-table > tbody tr:hover > td:first-child {
    background: var(--cw-surface-1);
}

/* ── Sortable + filterable column headers ─────────────── */
/* Promoted out of UserList.razor.css so the shared header components can use them: scoped CSS
   compiles with a b-xxxx attribute and would not match markup rendered by another component. */

/* Zero the th padding and move it onto the button so the whole header cell is clickable.
   Font styles inherit from .cw-table th. */
.cw-table th.sortable {
    padding: 0;
}

.th-sort {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    padding: 12px 16px; /* matches .cw-table th padding */
    background: none;
    border: 0;
    cursor: pointer;
    font: inherit;
    font-weight: inherit;
    color: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
    text-align: left;
}

.th-sort:hover { color: var(--cw-ink); }

.th-sort:focus-visible {
    outline: none;
    box-shadow: var(--cw-focus-ring);
}

/* Not sortable: same box, no button affordance. */
.th-sort--static { cursor: default; }

.th-sort__caret {
    color: var(--cw-blue-500);
    font-size: 10px;
    line-height: 1;
}

/* A header cell carrying both controls. The sort button no longer spans the full width. */
.cw-table th.sortable.has-filter { white-space: nowrap; }
.cw-table th.sortable.has-filter .th-sort { width: auto; padding-right: 4px; }

.th-filter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-right: 8px;
    vertical-align: middle;
    background: none;
    border: 0;
    border-radius: var(--cw-radius-sm);
    color: var(--cw-ink-muted);
    cursor: pointer;
}

.th-filter:hover {
    background: var(--cw-surface-2);
    color: var(--cw-ink);
}

.th-filter:focus-visible {
    outline: none;
    box-shadow: var(--cw-focus-ring);
}

.th-filter--on { color: var(--cw-blue-500); }

/* Third, redundant signal that a column is filtered — the funnel alone is easy to miss in a
   15-column table. */
.cw-table th.is-filtered { box-shadow: inset 0 -2px 0 var(--cw-blue-500); }

/* ── Column filter popover ────────────────────────────── */
/* Lives in the top layer via popover="auto", because .table-scroll is overflow-x:auto and CSS
   forces the other axis to auto too — an in-flow dropdown would be clipped on both axes and
   would grow a spurious vertical scrollbar. position:fixed is the fallback for the same reason. */
.cw-filter-pop {
    position: fixed;
    margin: 0;
    inset: auto; /* undo the UA stylesheet's popover centering */
    min-width: 232px;
    max-width: 320px;
    max-height: 340px;
    overflow: auto;
    padding: 12px;
    background: var(--cw-surface-0);
    border: 1px solid var(--cw-line);
    border-radius: var(--cw-radius-md);
    box-shadow: var(--cw-shadow-3);
    z-index: var(--cw-z-modal);

    /* The panel is a <th> descendant, so it inherits uppercase, letter-spacing, bold and (inside
       .table-scroll) nowrap. Without these four resets it renders as unreadable tracked caps on
       a single line. */
    white-space: normal;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 400;
    font-size: var(--cw-text-sm);
    line-height: 1.45;
    color: var(--cw-ink);
    text-align: left;
}

.cw-filter-pop::backdrop { background: transparent; }

.cw-filter-pop__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.cw-filter-pop__title {
    font-weight: 700;
    font-size: var(--cw-text-sm);
}

.cw-filter-pop__opts {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 216px;
    overflow-y: auto;
    margin: 0 -4px;
}

.cw-filter-pop__opt {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px;
    min-height: 32px;
    border-radius: var(--cw-radius-sm);
    cursor: pointer;
}

.cw-filter-pop__opt:hover { background: var(--cw-surface-1); }

.cw-filter-pop__opt-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.cw-filter-pop__count {
    margin-left: auto;
    padding-left: 8px;
    color: var(--cw-ink-muted);
    font-variant-numeric: tabular-nums;
}

.cw-filter-pop__bulk {
    display: flex;
    gap: 4px;
    margin-bottom: 4px;
}

.cw-filter-pop__empty {
    padding: 8px 4px;
    color: var(--cw-ink-muted);
}

/* ── Active filter bar ────────────────────────────────── */
.cw-filterbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
    font-size: var(--cw-text-sm);
    color: var(--cw-ink-muted);
}

.cw-filterbar__count { font-variant-numeric: tabular-nums; }

.cw-filterbar__chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 4px 3px 10px;
    background: var(--cw-blue-50, var(--cw-surface-1));
    border: 1px solid var(--cw-line);
    border-radius: var(--cw-radius-pill);
    color: var(--cw-ink);
}

.cw-filterbar__chip-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    background: none;
    border: 0;
    border-radius: var(--cw-radius-pill);
    color: var(--cw-ink-muted);
    cursor: pointer;
    line-height: 1;
}

.cw-filterbar__chip-x:hover { background: var(--cw-surface-2); color: var(--cw-ink); }

.cw-filterbar__chip-x:focus-visible {
    outline: none;
    box-shadow: var(--cw-focus-ring);
}

/* ── Table pagination ─────────────────────────────────── */
.cw-pager {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 12px 0;
    font-size: var(--cw-text-sm);
    color: var(--cw-ink-muted);
}

.cw-pager__pages { font-variant-numeric: tabular-nums; }

/* ── Calendar ─────────────────────────────────────────── */
.cal-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.cal-nav-title {
    font-size: var(--cw-text-xl);
    font-weight: 700;
    flex: 1;
    text-align: center;
    color: var(--cw-blue-700);
}

.cal-legend {
    display: flex;
    align-items: center;
    gap: 20px;
}

.cal-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--cw-ink-muted);
    font-weight: 500;
}

.cal-status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.cal-status-dot--pending  { background: var(--cw-line); border: 1.5px solid var(--cw-gray); }
.cal-status-dot--active   { background: var(--cw-blue-500); }
.cal-status-dot--complete { background: var(--cw-success); }

/* ── Week grid ──────────────────────────────────────── */
.cal-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-top: 1px solid var(--cw-line);
    border-left: 1px solid var(--cw-line);
    min-height: 420px;
}

.cal-week-col {
    border-right: 1px solid var(--cw-line);
    display: flex;
    flex-direction: column;
    background: var(--cw-surface-0);
}

.cal-week-col--today {
    background: #f0f7ff;
}

.cal-week-hdr {
    padding: 10px 8px 8px;
    text-align: center;
    border-bottom: 1px solid var(--cw-line);
    background: var(--cw-surface-1);
}

.cal-week-hdr--today {
    background: var(--cw-blue-100);
}

.cal-week-dow {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--cw-ink-muted);
    margin-bottom: 4px;
}

.cal-week-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    font-size: 22px;
    font-weight: 700;
    color: var(--cw-ink);
    border-radius: 50%;
}

.cal-week-num--today {
    background: var(--cw-blue-500);
    color: #fff;
}

.cal-week-body {
    padding: 8px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cal-no-jobs {
    font-size: 12px;
    color: var(--cw-ink-muted);
    font-style: italic;
    padding-top: 4px;
}

.cal-job-card {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border-radius: var(--cw-radius-sm);
    font-size: 12px;
    text-align: left;
    cursor: pointer;
    border: 1px solid;
    line-height: 1.4;
    transition: filter var(--cw-dur-fast);
}
.cal-job-card:hover { filter: brightness(0.93); }

.cal-job-card--pending {
    background: #fff;
    border-color: var(--cw-line);
    color: var(--cw-ink);
}
.cal-job-card--active {
    background: var(--cw-blue-50);
    border-color: var(--cw-blue-200);
    color: var(--cw-ink);
}
.cal-job-card--complete {
    background: var(--cw-success-bg);
    border-color: #a5d6a7;
    color: var(--cw-ink);
}

.cal-job-type  { margin-bottom: 3px; }

.cal-job-title {
    font-weight: 700;
    font-size: 13px;
    color: var(--cw-blue-700);
}

.cal-job-customer {
    color: var(--cw-ink-soft);
    font-size: 12px;
    margin-top: 1px;
}

.cal-job-addr {
    color: var(--cw-ink-muted);
    font-size: 11px;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-job-installer {
    display: flex;
    align-items: center;
    gap: 3px;
    color: var(--cw-ink-muted);
    font-size: 11px;
    margin-top: 5px;
}

/* ── Calendar agenda (mobile) ──────────────────────────── */
.cal-agenda {
    display: flex;
    flex-direction: column;
}

.cal-agenda-day {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--cw-line);
}
.cal-agenda-day:last-child { border-bottom: none; }
.cal-agenda-day--today { background: #f0f7ff; }

.cal-agenda-date {
    flex-shrink: 0;
    width: 44px;
    text-align: center;
}
.cal-agenda-dow {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--cw-ink-muted);
}
.cal-agenda-num {
    font-size: 20px;
    font-weight: 700;
    color: var(--cw-ink);
}

.cal-agenda-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    justify-content: center;
}

/* ═══════════════════════════════════════════════════════════
   Responsive tiers — two numbers, three tiers, no gap between them.

       ≤640px       phone     card lists replace tables, single-column forms
       641–1024px   tablet    iPad portrait/landscape, narrow laptop windows
       ≥1025px      desktop   persistent 250px sidebar

   The 1024/1025 boundary pairs with MainLayout.razor.css, which flips the
   sidebar between drawer and sticky column at the same number. Custom
   properties can't be used inside @media, so these stay literal values —
   this comment is the contract. Prefer intrinsic sizing (auto-fit +
   minmax(min(100%, X), 1fr)) over adding a fourth tier.
   ═══════════════════════════════════════════════════════════ */

/* Show one of a desktop/mobile pair. Default = desktop shown.
   Deliberately still at 640: tables stay tabular on a tablet. */
.cw-mobile-only { display: none; }

/* ── Tablet tier (≤1024px) ── */
@media (max-width: 1024px) {
    /* Escape hatch for the form sections that set grid-template-columns inline. Placed
       BEFORE the 640 block so source order lets the phone rule win — both are !important
       at equal specificity. Requires .cw-card__body; the two Admin editors that use a bare
       .cw-card are fixed directly in their own markup. */
    .cw-card__body [style*="grid-template-columns"] {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)) !important;
    }

    /* Job detail: a 2fr 1fr split leaves the Job Info column too narrow for email
       addresses even after the sidebar is reclaimed. !important beats the inline style. */
    .job-detail-grid { grid-template-columns: 1fr !important; }

    /* Calendar week grid can't usefully shrink below ~120px/day — let it scroll instead. */
    .cal-week { min-width: 840px; }

    /* Wizard steppers compact to numbered circles. */
    .wiz-step__label { display: none; }

    .dash-kpi { padding: 14px; gap: 12px; }
    .dash-kpi__number { font-size: 26px; }
}

/* ── Phone tier (≤640px) ── */
@media (max-width: 640px) {
    .cw-mobile-only  { display: block; }
    .cw-desktop-only { display: none !important; }

    /* #5 Forms: collapse every multi-column grid inside a form card to a
       single column. Targets the inline `grid-template-columns` the form
       sections use, so we don't have to touch each inline style. */
    .cw-card__body [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    /* Class-based form grids (the inline-style selector above can't see them). */
    .form-grid-2, .form-grid-3 {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* Comfortable touch targets for form controls. */
    .cw-input, .cw-select, .cw-textarea, .cw-btn, .cw-chip {
        min-height: 44px;
    }

    .page-header { margin-bottom: 16px; }

    /* #7 Calendar: hide the 7-up week grid; the stacked agenda shows instead. */
    .cal-legend { flex-wrap: wrap; gap: 12px 20px; }

    .detail-grid { gap: 2px 12px; }
}
/* ===================== INLINE-EDITABLE JOB VIEW ===================== */
.cw-card--editing { border: 2px solid var(--cw-blue-500); box-shadow: var(--cw-shadow-2); }

.section-edit-footer {
    display: flex; justify-content: flex-end; gap: 8px;
    margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--cw-line);
}

.locked-tag {
    display: inline-block; font-size: 11px; font-weight: 600;
    letter-spacing: 0.04em; text-transform: uppercase;
    color: var(--cw-ink-muted); background: var(--cw-surface-2);
    border-radius: var(--cw-radius-sm); padding: 1px 6px; margin-left: 6px;
    vertical-align: 1px;
}

.save-indicator { font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.save-indicator::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.save-indicator--clean  { color: var(--cw-ink-muted); }
.save-indicator--clean::before  { background: var(--cw-success); }
.save-indicator--dirty  { color: var(--cw-warning); }
.save-indicator--dirty::before  { background: var(--cw-warning); }
.save-indicator--saved  { color: var(--cw-success); }
.save-indicator--saved::before  { background: var(--cw-success); }

.photo-thumb-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px; margin-top: 16px;
}
.photo-thumb {
    margin: 0; border: 1px solid var(--cw-line); border-radius: var(--cw-radius-md);
    overflow: hidden; background: var(--cw-surface-1);
}
.photo-thumb img { width: 100%; height: 96px; object-fit: cover; display: block; }
.photo-thumb figcaption {
    font-size: 11px; padding: 4px 6px; color: var(--cw-ink-muted);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.photo-thumb--file {
    min-height: 96px; display: flex; align-items: center; justify-content: center;
    text-align: center; font-size: 12px; padding: 8px;
}
.photo-owed {
    border: 2px dashed var(--cw-warning); background: var(--cw-warning-bg);
    color: var(--cw-warning); border-radius: var(--cw-radius-md);
    min-height: 96px; display: flex; align-items: center; justify-content: center;
    text-align: center; font-size: 12px; font-weight: 600; padding: 8px;
}

/* Attached-file rows inside a PhotoUploadList slot (one row per picked/saved file). */
.photo-attach-list { list-style: none; margin: 0 0 8px; padding: 0; max-width: 340px; }
.photo-attach-row {
    display: flex; align-items: center; gap: 8px; padding: 6px 8px; margin-bottom: 4px;
    border: 1px solid var(--cw-line); border-radius: var(--cw-radius-md);
    background: var(--cw-surface-1); font-size: 13px;
}
.photo-attach-name {
    flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.photo-attach-remove {
    flex: none; border: 0; background: none; cursor: pointer; padding: 0 4px;
    font-size: 18px; line-height: 1; color: var(--cw-ink-muted);
}
.photo-attach-remove:hover { color: var(--cw-danger, #c0392b); }
