/* Emergency overrides of the design system. See apps/web/static/ds/README.md. Keep this file empty. */

/* The detailed install chip (CalendarGrid, local: apps/web/templates/ds/LOCAL.md): the Install schedule's chip as
   main drew it, "Customer · #job", roof type, days and PM, then the address, each line wrapping, tinted by roof type
   (the legend's swatch the same). */
.so-calg__inst--detail { gap: var(--border-hairline); padding: var(--space-1) var(--space-chip); }
.so-calg__inst--detail .so-calg__inst-top { align-items: flex-start; overflow: visible; }
.so-calg__inst-line { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.so-calg__inst--detail > .so-calg__inst-line { color: var(--ink); }
.so-calg__roofkey { flex: none; display: inline-block; width: var(--space-3); height: var(--space-3); border-radius: var(--radius-tight); }
.so-calg__inst--detail[data-roof="shingle"], .so-calg__roofkey[data-roof="shingle"] { background: var(--stage-4-tint); box-shadow: inset 0 0 0 var(--border-hairline) var(--stage-4); }
.so-calg__inst--detail[data-roof="metal"], .so-calg__roofkey[data-roof="metal"] { background: var(--stage-6-tint); box-shadow: inset 0 0 0 var(--border-hairline) var(--stage-6); }
.so-calg__inst--detail[data-roof="tile"], .so-calg__roofkey[data-roof="tile"] { background: var(--stage-2-tint); box-shadow: inset 0 0 0 var(--border-hairline) var(--stage-2); }
.so-calg__inst--detail[data-roof="flat"], .so-calg__roofkey[data-roof="flat"] { background: var(--accent-tint); box-shadow: inset 0 0 0 var(--border-hairline) var(--accent); }
.so-calg__inst--detail[data-roof="none"], .so-calg__roofkey[data-roof="none"] { background: var(--raised); box-shadow: none; outline: var(--border-hairline) dashed var(--muted); outline-offset: calc(var(--border-hairline) * -1); }
.so-calg__inst--detail:hover { filter: brightness(0.97); }
/* The Production calendar's tones on the same detailed chip, main's colours: amber next action, orange overdue, blue
   install (the legend's swatch the same). */
.so-calg__inst--detail[data-tone="next"], .so-calg__inst--detail[data-tone="next"]:hover, .so-calg__roofkey[data-tone="next"] { background: var(--urgency-elevated-tint); box-shadow: inset 0 0 0 var(--border-hairline) var(--urgency-elevated); outline: none; color: var(--ink); }
.so-calg__inst--detail[data-tone="overdue"], .so-calg__inst--detail[data-tone="overdue"]:hover, .so-calg__roofkey[data-tone="overdue"] { background: var(--urgency-high-tint); box-shadow: inset 0 0 0 var(--border-hairline) var(--urgency-high); outline: none; color: var(--ink); }
.so-calg__inst--detail[data-tone="install"], .so-calg__inst--detail[data-tone="install"]:hover, .so-calg__roofkey[data-tone="install"] { background: var(--stage-6-tint); box-shadow: inset 0 0 0 var(--border-hairline) var(--stage-6); outline: none; color: var(--ink); }

/* US federal holidays on every calendar, more obvious than the system's grey hatch: the same hatch in the attention
   tint, and the holiday's name as an attention-tinted label (the legend's hatch the same). */
.so-calg__cell.is-holiday, .so-calg__allday.is-holiday, .so-calg--allday-only .so-calg__allday.is-holiday { background: repeating-linear-gradient(135deg, var(--attention-tint) 0 var(--hatch-band), var(--surface) var(--hatch-band) calc(2 * var(--hatch-band))); }
.so-calg__pday.is-holiday, button.so-calg__pday.is-holiday, .so-pcal__day.is-holiday, .so-calg__pholiday { background: repeating-linear-gradient(135deg, var(--attention-tint) 0 var(--hatch-band-fine), var(--ground) var(--hatch-band-fine) calc(2 * var(--hatch-band-fine))); }
.so-calg__hatch, .so-calf__hatch { background: repeating-linear-gradient(135deg, var(--attention-tint) 0 var(--hatch-band-fine), var(--surface) var(--hatch-band-fine) calc(2 * var(--hatch-band-fine))); box-shadow: inset 0 0 0 var(--border-hairline) var(--attention); }
.so-calg__holiday { background: var(--attention-tint); box-shadow: inset 0 0 0 var(--border-hairline) var(--attention); color: var(--on-attention-tint); font-weight: var(--type-weight-medium); }
.so-calg__pholiday { color: var(--on-attention-tint); font-weight: var(--type-weight-medium); }

/* Filters toggle count always visible (Roger, 2026-11-02): the system hides so-listpage__count while the rail is
   expanded; keep the number next to Filters so an applied search is still obvious when the rail is open. */
.so-listpage__toggle[aria-expanded="true"] .so-listpage__count { display: inline-flex; }

/* The development copy's banner (local, LOCAL.md): a thin bar fixed across the top of every page, as main had it,
   instead of the header's Dev marker, so the header is the same in production and development. base.html sets
   --so-shell-top to its height on the root; the body starts under it. */
.so-devbanner { position: fixed; top: 0; right: 0; left: 0; z-index: calc(var(--z-header) + 1); display: flex; align-items: center; justify-content: center; height: var(--space-6); padding: 0 var(--space-3); background: var(--attention-tint); color: var(--on-attention-tint); border-bottom: var(--border-hairline) solid var(--attention); font-size: var(--type-size-xs); line-height: var(--type-leading-xs); font-weight: var(--type-weight-medium); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body:has(> .so-devbanner) { padding-top: var(--so-shell-top, var(--space-6)); }

/* The photo viewer at the size of the screen (Laura Barberis, Ryan Beck, Roger, 2026-11-04). The system's PhotoViewer
   holds the photo to a 340px, 4:3 box and scales it without clipping, so a zoomed photo spilled over its own bar and
   covered the zoom buttons. Here the viewer fills the screen less a margin (all of it on a phone), the photo fills the
   stage, and the stage clips the zoomed photo. static/web/photo-viewer.js adds wheel and pinch zoom, double-click,
   drag to pan and swipe. Request the same in the design system's PhotoViewer. */
:is(#job-photo-viewer, #gallery-photo-viewer) .so-dialog--bare { width: calc(100vw - var(--space-8)); height: calc(100dvh - var(--space-8)); }
:is(#job-photo-viewer, #gallery-photo-viewer) .so-viewer { height: 100%; }
:is(#job-photo-viewer, #gallery-photo-viewer) .so-viewer__bar { position: relative; z-index: 2; background: var(--surface); }
:is(#job-photo-viewer, #gallery-photo-viewer) .so-viewer__stage { flex: 1 1 auto; min-height: 0; padding: var(--space-2) var(--space-14); }
:is(#job-photo-viewer, #gallery-photo-viewer) .so-viewer__nav { z-index: 1; }
:is(#job-photo-viewer, #gallery-photo-viewer) .so-viewer__img { max-width: none; width: 100%; height: 100%; aspect-ratio: auto; overflow: hidden; background: none; touch-action: none; cursor: zoom-in; }
:is(#job-photo-viewer, #gallery-photo-viewer) .so-viewer__img.is-zoomed { cursor: grab; }
:is(#job-photo-viewer, #gallery-photo-viewer) .so-viewer__img.is-panning { cursor: grabbing; }
:is(#job-photo-viewer, #gallery-photo-viewer) .so-viewer__img > img { user-select: none; -webkit-user-drag: none; will-change: transform; }
@media (max-width: 639px) {
  :is(#job-photo-viewer, #gallery-photo-viewer) .so-dialog--bare { width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  :is(#job-photo-viewer, #gallery-photo-viewer) .so-viewer { border-radius: 0; }
  :is(#job-photo-viewer, #gallery-photo-viewer) .so-viewer__stage { padding: 0; }
}

/* The markup tool at screen size too (Jefte, 2026-11-04: "the markup window is quite small"): the canvas fills the
   frame and the frame clips it, so photo-viewer.js can zoom and pan it while a one-finger or mouse drag still draws. */
#job-photo-markup .so-dialog--bare { width: calc(100vw - var(--space-8)); height: calc(100dvh - var(--space-8)); }
#job-photo-markup .so-markup-wrap { height: 100%; min-height: 0; }
#job-photo-markup .so-markup-wrap > p:empty { display: none; }
#job-photo-markup .so-viewer { flex: 1 1 auto; min-height: 0; }
#job-photo-markup .so-viewer__stage { flex: 1 1 auto; min-height: 0; padding: var(--space-2); }
#job-photo-markup .so-viewer__img { display: flex; align-items: center; justify-content: center; max-width: none; width: 100%; height: 100%; aspect-ratio: auto; overflow: hidden; background: none; touch-action: none; }
#job-photo-markup .so-viewer__img.is-pannable, #job-photo-markup .so-viewer__img.is-pannable canvas { cursor: grab !important; }
#job-photo-markup .so-viewer__img.is-panning, #job-photo-markup .so-viewer__img.is-panning canvas { cursor: grabbing !important; }
#job-photo-markup .so-viewer__img > canvas { will-change: transform; }
@media (max-width: 639px) {
  #job-photo-markup .so-dialog--bare { width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  #job-photo-markup .so-viewer { border-radius: 0; }
  #job-photo-markup .so-viewer__stage { padding: 0; }
}

/* The star on a photo tile (local, LOCAL.md): a solid chip like the read-only indicator, so it shows on any photo,
   amber when the photo is the property photo. As a ghost IconButton it was nearly invisible on light photos. */
.so-photo__tile-action .so-iconbtn { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-menu); }
.so-photo__tile-action .so-iconbtn:hover { background: var(--raised); }
.so-photo__tile-action .so-iconbtn[aria-pressed="true"], .so-photo__tile-action .so-iconbtn[aria-pressed="true"]:hover { background: var(--urgency-elevated); color: var(--on-accent); }

/* The guided tour (local, LOCAL.md: ds_tour, static/web/training-tour.js): a Popover's markup fixed beside the step's
   target, above the popovers and the header, and a ring around the target in the accent. The runtime sets top and left. */
.so-tour { position: fixed; top: 0; left: 0; z-index: calc(var(--z-popover) + 1); box-shadow: var(--shadow-dialog), inset 0 0 0 var(--border-hairline) var(--line); }
.so-tour[hidden], .so-tour-ring[hidden] { display: none; }
.so-tour__count { margin: 0 0 var(--space-0_5); color: var(--muted); }
.so-tour__text { margin: 0; }
.so-tour-ring { position: fixed; top: 0; left: 0; z-index: calc(var(--z-popover) + 1); pointer-events: none; border-radius: var(--radius-control); outline: var(--focus-ring-width) solid var(--accent); outline-offset: var(--space-1); box-shadow: 0 0 0 calc(var(--space-1) + var(--focus-ring-width) + var(--space-1)) var(--accent-tint); }
/* Below the desktop breakpoint the callout is a bottom sheet (the system's bottom Drawer: full width, hairline top,
   rounded top corners, the dialog shadow, 44px foot Buttons sharing the row) sitting on the shell's sticky bottom bars;
   the runtime sets its bottom to their measured height and pads main by the sheet's, so the last target can scroll
   above it. */
.so-tour.so-tour--sheet { right: 0; width: 100%; max-width: none; border-radius: var(--radius-control) var(--radius-control) 0 0; box-shadow: var(--shadow-dialog), inset 0 var(--border-hairline) 0 var(--line); }
.so-tour--sheet .so-pop__body { max-height: var(--size-scroll-list); overflow-y: auto; overscroll-behavior: contain; }
.so-tour--sheet .so-tour__foot { padding: var(--space-3) var(--space-4); padding-bottom: max(var(--space-3), env(safe-area-inset-bottom)); }
.so-tour--sheet .so-tour__foot .so-btn { flex: 1 1 0; }
.so-tour-sheet-open main { padding-bottom: calc(var(--space-4) + var(--so-tour-sheet, 0px)); }

/* Person colours on the calendar (local, LOCAL.md): each shown calendar's appointments take a tint and a left edge
   in that person's colour, and the calendar list draws the same chip as its key beside the name. Eight slots from the
   existing hue and tint pairs; ds_calendar_* set data-person 1 to 8. */
[data-person="1"] { --so-person: var(--stage-6); --so-person-tint: var(--stage-6-tint); }
[data-person="2"] { --so-person: var(--stage-2); --so-person-tint: var(--stage-2-tint); }
[data-person="3"] { --so-person: var(--stage-3); --so-person-tint: var(--stage-3-tint); }
[data-person="4"] { --so-person: var(--stage-4); --so-person-tint: var(--stage-4-tint); }
[data-person="5"] { --so-person: var(--stage-5); --so-person-tint: var(--stage-5-tint); }
[data-person="6"] { --so-person: var(--accent); --so-person-tint: var(--accent-tint); }
[data-person="7"] { --so-person: var(--stage-1); --so-person-tint: var(--stage-1-tint); }
[data-person="8"] { --so-person: var(--stage-7); --so-person-tint: var(--stage-7-tint); }
.so-calg__ev[data-person], .so-calg__ev[data-person]:hover { background: var(--so-person-tint); color: var(--ink-on-tint); box-shadow: inset var(--space-1) 0 0 var(--so-person), inset 0 0 0 var(--border-hairline) var(--so-person); padding-left: calc(var(--space-chip) + var(--space-1)); }
.so-calg__ev[data-person]:hover { box-shadow: inset var(--space-1) 0 0 var(--so-person), inset 0 0 0 var(--focus-ring-width) var(--so-person); }
.so-calg__block[data-person] { padding-left: calc(var(--space-1_5) + var(--space-1)); }
.so-calg__ev[data-person] .so-calg__ini, .so-calg__ev[data-person] .so-calg__place { color: var(--muted-on-tint); }
.so-calg__prow[data-person] { box-shadow: inset var(--space-1) 0 0 var(--so-person); }
.so-calf__swatch { flex: none; width: var(--space-4); height: var(--space-3); margin-left: auto; border-radius: var(--radius-tight); background: var(--so-person-tint); box-shadow: inset var(--space-1) 0 0 var(--so-person), inset 0 0 0 var(--border-hairline) var(--so-person); }

/* NoteRow's Edit (ds_note_row on_edit, local: apps/web/templates/ds/LOCAL.md): Edit and Delete in a row under the
   note's author and date, so the text keeps the row's full width; while editing, the note's text in a Textarea with
   Save and Cancel under it (tokens only). The markup stays the system's (the actions after so-note__main); a grid puts
   them in the text's column, on a row of their own. */
.so-note { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: var(--space-3); row-gap: var(--space-2); align-items: start; }
.so-note__acts { grid-column: 2; display: flex; align-items: center; gap: var(--space-2); margin-left: 0; }
/* Delete opens the "Delete this note?" Dialog, so it takes the danger-outlined look, the system's opener of a
   destructive confirm (the Dialog's own Delete stays destructive). Delete is the action in its own form; Edit is not. */
.so-note__acts form .so-btn--outlined { background: var(--surface); border-color: var(--attention); color: var(--on-attention-tint); font-weight: var(--type-weight-regular); }
.so-note__acts form .so-btn--outlined:hover { background: var(--attention-tint); }
.so-note__acts form .so-btn--outlined:active { background: var(--attention-tint); border-color: var(--attention-hover); }
.so-note__acts[hidden], .so-note__body[hidden] { display: none; }
.so-note__edit { display: flex; flex-direction: column; gap: var(--space-2); max-width: 72ch; }
.so-note__edit[hidden] { display: none; }
/* The note opens at its full height (to most of the screen), the caret at the end rather than the text selected. */
.so-note__edit .so-textarea { field-sizing: content; max-height: 60vh; }
.so-note__edit-acts { display: flex; align-items: center; gap: var(--space-2); }
.so-note--phone .so-note__edit-acts .so-btn { height: var(--size-control-phone); }
/* Estimate, Ventilation step: the Meter runs the card's full width (Jefte, 2026-11-16), not the system's 560px. */
.so-meter.est-vent-meter { max-width: none; }
/* Ventilation calculator (Jefte, 2026-11-16): the Meter's track is red and its fill green with the amount provided;
   the Required NFVA figure and the Meter's Required tick are bold, red below target and green once met; the
   below/met Flash has a border in its tone; the empty-table note is a bold red warning. */
.so-meter.est-vent-meter .so-meter__track { background: var(--attention); }
.so-meter.est-vent-meter .so-meter__fill { background: var(--accent); }
.so-meter.est-vent-meter .so-meter__tick:last-child { font-weight: var(--type-weight-semibold); }
[data-vent-state="below"] .est-vent-required, [data-vent-state="below"] .so-meter.est-vent-meter .so-meter__tick:last-child { font-weight: var(--type-weight-semibold); color: var(--attention); }
[data-vent-state="met"] .est-vent-required, [data-vent-state="over"] .est-vent-required,
[data-vent-state="met"] .so-meter.est-vent-meter .so-meter__tick:last-child, [data-vent-state="over"] .so-meter.est-vent-meter .so-meter__tick:last-child { font-weight: var(--type-weight-semibold); color: var(--accent); }
.est-vent-flash > .so-flash { border: var(--border-hairline) solid; }
.est-vent-flash > .so-flash--attention { border-color: var(--attention); }
.est-vent-flash > .so-flash--positive { border-color: var(--accent); }
.est-vent-empty { font-weight: var(--type-weight-semibold); color: var(--attention); }
/* Selected vents: a ridge vent's Qty cell holds the stepper and its "max" line, taller than a row, so the row keeps
   breathing room above and below; the Qty column (the 5th) is centred, so "Qty" sits right over the number and the
   "max" line under the stepper (Jefte, 2026-11-16). */
[id^="ventilation-calculator-"] .so-table:has([data-vent-qty]) td { padding-top: var(--space-1_5); padding-bottom: var(--space-1_5); }
[id^="ventilation-calculator-"] .so-table:has([data-vent-qty]) th:nth-child(5),
[id^="ventilation-calculator-"] .so-table:has([data-vent-qty]) td:nth-child(5) { text-align: center; }
[id^="ventilation-calculator-"] .so-table:has([data-vent-qty]) td:nth-child(5) .so-table__two { align-items: center; }

/* Job page section tabs as a raised bar (local, LOCAL.md): Overview / Activity / Production / … sit on raised
   with hairline edges so the row reads as navigation against ground, not another line of body text. Full-bleed
   across the content column (the page's px-4 / desktop:px-8). The tablist drops its own bottom line; the current
   tab still shows the accent mark. */
#job-tabs {
  margin-inline: calc(-1 * var(--space-4));
  padding-inline: var(--space-4);
  background: var(--raised);
  border-block: var(--border-hairline) solid var(--line);
}
@media (min-width: 1024px) {
  #job-tabs {
    margin-inline: calc(-1 * var(--space-8));
    padding-inline: var(--space-8);
  }
}
#job-tabs .so-tablist { border-bottom: 0; }

/* Activity log to-do rows (local, LOCAL.md): TODO_ASSIGNED / updated / cleared / completed are change lines, and the
   system draws those muted so conversations carry the eye. Accent bar + tint beat .so-act--change's muted type/
   detail; tokens only. */
.so-act--log.so-act--change.so-act--todo {
  background: var(--accent-tint);
  border-left: var(--space-1) solid var(--accent);
  padding-left: calc(var(--space-3) - var(--space-1));
}
.so-act--log.so-act--change.so-act--todo .so-act__type {
  color: var(--accent);
  font-weight: var(--type-weight-semibold);
}
.so-act--log.so-act--change.so-act--todo .so-act__detail,
.so-act--log.so-act--change.so-act--todo .so-act__by {
  color: var(--ink);
}

/* ActivityRow Listen (local, LOCAL.md): Quo call recording control under the Expand affordance. */
.so-act__listen { margin-top: var(--space-2); }
