/* Install Schedule — design tokens (Apple-adjacent: calm, spacious, system fonts) */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-elevated: rgba(255, 255, 255, 0.72);
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --border: rgba(0, 0, 0, 0.06);
  --border-strong: rgba(0, 0, 0, 0.1);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.06);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --accent: #0071e3;
  --accent-soft: rgba(0, 113, 227, 0.12);
  --focus-ring: 0 0 0 3px rgba(0, 113, 227, 0.35);
  --grid-hour: 52px;
  --calendar-viewport-hour: 52px;
  --calendar-visible-hours: 9.5;
  --calendar-header-height: 36px;
  --time-col-width: 52px;
  --day-col-min: 112px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Segoe UI", system-ui, sans-serif;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* Location-specific accents (types will use per-calendar colors from settings later) */
[data-location="charlotte"] {
  --accent: #007aff;
  --accent-soft: rgba(0, 122, 255, 0.14);
  --today-column-bg: rgba(0, 122, 255, 0.07);
}

[data-location="dc"] {
  --accent: #ff9500;
  --accent-soft: rgba(255, 149, 0, 0.16);
  --today-column-bg: rgba(255, 149, 0, 0.08);
}

[data-location="raleigh"] {
  --accent: #34c759;
  --accent-soft: rgba(52, 199, 89, 0.14);
  --today-column-bg: rgba(52, 199, 89, 0.07);
}

[data-location="richmond"] {
  --accent: #9a6b4f;
  --accent-soft: rgba(154, 107, 79, 0.16);
  --today-column-bg: rgba(154, 107, 79, 0.08);
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text-primary);
}

.app-shell {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 20px 20px 32px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

@media (min-width: 768px) {
  .app-shell {
    padding: 28px 32px 40px;
  }
}

@media (min-width: 1200px) {
  .app-shell {
    padding: 28px 40px 40px;
  }
}

@media (min-width: 1800px) {
  .app-shell {
    padding: 32px 48px 44px;
  }

  :root {
    --day-col-min: 140px;
  }
}

@media (min-width: 2200px) {
  :root {
    --day-col-min: 168px;
  }
}

/* Top bar — desktop title only; hidden on mobile */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.brand {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 10px;
  min-width: 0;
}

.brand-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-sub {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 400;
  flex: 1 1 100%;
}

@media (min-width: 720px) {
  .brand-sub {
    flex: 0 1 auto;
  }
}

/* Segmented location control */
.location-switch {
  display: inline-flex;
  align-items: stretch;
  padding: 2px;
  background: rgba(120, 120, 128, 0.12);
  border-radius: 999px;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 420px;
}

.location-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.location-switch label {
  flex: 1;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 7px 8px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
  min-width: 0;
}

.location-switch label:hover {
  color: var(--text-primary);
}

.location-switch input:focus-visible + label {
  box-shadow: var(--focus-ring);
}

.location-switch input:checked + label {
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* Calendar chrome */
.calendar-chrome {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  overflow: hidden;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.calendar-toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.toolbar-primary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.toolbar-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
}

.toolbar-nav .btn-today {
  padding: 7px 10px;
  font-size: 13px;
  min-height: 36px;
}

.toolbar-range {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.view-switch-primary {
  flex: 1 1 auto;
  min-width: 0;
}

.view-switch-primary .btn-seg {
  flex: 1 1 0;
}

.toolbar-secondary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.toolbar-secondary #btn-new {
  flex-shrink: 0;
  white-space: nowrap;
}

.view-switch {
  display: inline-flex;
  align-items: stretch;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  overflow: hidden;
  max-width: 100%;
  box-shadow: var(--shadow-sm);
}

.view-switch .btn-seg {
  border-radius: 0;
  border: none;
  box-shadow: none;
  padding: 7px 10px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text-secondary);
  flex: 0 0 auto;
  white-space: nowrap;
  min-height: 36px;
}

.view-switch .btn-seg:hover {
  background: #f5f5f7;
  color: var(--text-primary);
}

.view-switch .btn-seg.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.view-switch .btn-seg:focus {
  outline: none;
  box-shadow: none;
}

.view-switch .btn-seg:focus-visible {
  box-shadow: var(--focus-ring);
}

.zoom-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.zoom-switch .btn {
  min-width: 0;
}

.zoom-switch .btn-icon {
  width: 32px;
  padding: 8px 0;
  font-size: 18px;
  line-height: 1;
}

.zoom-switch .btn-seg {
  padding: 7px 8px;
  font-size: 12px;
  border: none;
  box-shadow: none;
}

.zoom-switch .btn-seg.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.zoom-switch .btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.legend-collapsible {
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.legend-collapsible:not([open]) {
  border-bottom: none;
}

.legend-toggle {
  list-style: none;
  cursor: pointer;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  user-select: none;
}

.legend-toggle::-webkit-details-marker {
  display: none;
}

.legend-toggle::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  transition: transform 0.15s ease;
}

.legend-collapsible[open] .legend-toggle::before {
  transform: rotate(90deg);
}

@media (min-width: 900px) {
  .calendar-toolbar {
    padding: 12px 16px;
    gap: 10px;
  }

  .toolbar-range {
    font-size: 16px;
    flex: 0 1 auto;
    text-align: left;
  }

  .toolbar-nav {
    flex: 0 1 auto;
  }

  .view-switch-primary {
    flex: 0 1 auto;
  }
}

@media (max-width: 719px) {
  .app-shell {
    padding: 8px 10px 16px;
  }

  .calendar-toolbar {
    padding: 8px 10px;
    gap: 6px;
  }

  .toolbar-primary {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .toolbar-nav {
    width: 100%;
  }

  .toolbar-nav .btn-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
  }

  .toolbar-nav .btn-today {
    min-height: 40px;
    margin-left: auto;
  }

  .toolbar-range {
    font-size: 14px;
    white-space: normal;
    line-height: 1.25;
  }

  .view-switch-primary {
    width: 100%;
  }

  .view-switch .btn-seg {
    min-height: 40px;
    padding: 10px 8px;
  }

  .toolbar-secondary {
    gap: 6px;
  }

  .toolbar-secondary .location-switch {
    flex: 1 1 100%;
    max-width: none;
  }

  .toolbar-secondary .acting-as {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 13px;
  }

  .toolbar-secondary .acting-as select {
    max-width: 100%;
    min-height: 40px;
  }

  .toolbar-secondary #btn-settings {
    min-height: 40px;
  }

  .calendar-viewport,
  .calendar-scroll {
    max-height: none;
  }
}

.job-search {
  position: relative;
  min-width: 200px;
  max-width: 280px;
  flex: 1 1 200px;
}

@media (min-width: 1200px) {
  .job-search {
    max-width: 360px;
    flex: 1 1 280px;
  }
}

@media (min-width: 1800px) {
  .job-search {
    max-width: 420px;
  }
}

.job-search-input,
.job-search input[type="search"] {
  width: 100%;
  font: inherit;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.job-search input[type="search"]::-webkit-search-cancel-button {
  cursor: pointer;
}

.job-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  max-height: min(320px, 50vh);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 6px;
}

.job-search-empty {
  margin: 8px 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.job-search-hit {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
  font: inherit;
  color: var(--text-primary);
}

.job-search-hit:hover,
.job-search-hit.is-active {
  background: var(--accent-soft);
}

.job-search-hit-main {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.job-search-hit-meta {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.35;
}

.event-block.is-search-highlight,
.month-event-pill.is-search-highlight {
  outline: 3px solid rgba(255, 214, 10, 0.95);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(255, 214, 10, 0.28), 0 8px 28px rgba(0, 0, 0, 0.18);
  z-index: 30;
  animation: search-highlight-pulse 0.9s ease-in-out 2;
}

@keyframes search-highlight-pulse {
  0%,
  100% {
    outline-color: rgba(255, 214, 10, 0.95);
  }
  50% {
    outline-color: rgba(255, 255, 255, 0.95);
  }
}

.btn {
  appearance: none;
  border: none;
  background: var(--surface);
  color: var(--text-primary);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.btn:hover {
  background: #fafafa;
}

.btn:active {
  transform: scale(0.98);
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring), var(--shadow-sm);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.btn-primary:hover {
  filter: brightness(1.05);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 18px;
  line-height: 1;
}

.chip {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

/* Legend (event types — colors will be settings-driven per location) */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 8px 12px 10px;
  background: var(--surface);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-lead-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #ffd60a;
  border: 1.5px solid rgba(0, 0, 0, 0.22);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.type-scheduled {
  background: var(--type-scheduled, #007aff);
}

.type-tentative {
  background: var(--type-tentative, #af52de);
}

.type-survey {
  background: var(--type-survey, #ff9500);
}

.type-delivery {
  background: var(--type-delivery, #34c759);
}

.type-blocked {
  background: var(--type-blocked, #ffd60a);
}

.type-task {
  background: var(--type-task, #8e8e93);
}

/* Scroll grid + off-view event hints */
.calendar-viewport {
  position: relative;
  flex: 1 1 auto;
  min-height: 280px;
  max-height: min(
    calc(var(--calendar-visible-hours) * var(--calendar-viewport-hour) + var(--calendar-header-height)),
    calc(100vh - 200px)
  );
  display: flex;
  flex-direction: column;
}

.calendar-scroll {
  overflow-x: auto;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(
    calc(var(--calendar-visible-hours) * var(--calendar-viewport-hour) + var(--calendar-header-height)),
    calc(100vh - 200px)
  );
  -webkit-overflow-scrolling: touch;
}

body[data-calendar-view="month"] .calendar-viewport,
body[data-calendar-view="month"] .calendar-scroll {
  max-height: min(72vh, 840px);
}

.calendar-hint {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 12;
  padding: 10px 14px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #1d1d1f;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

.calendar-hint-top {
  top: 0;
  background: linear-gradient(180deg, rgba(255, 204, 77, 0.98) 0%, rgba(255, 204, 77, 0.55) 45%, transparent 100%);
}

.calendar-hint-bottom {
  bottom: 0;
  background: linear-gradient(0deg, rgba(255, 204, 77, 0.98) 0%, rgba(255, 204, 77, 0.55) 45%, transparent 100%);
}

.calendar-hint.is-visible {
  opacity: 1;
}

.calendar-grid {
  display: grid;
  grid-template-columns: var(--time-col-width) repeat(7, minmax(var(--day-col-min), 1fr));
  min-width: 720px;
}

.calendar-grid.calendar-grid--day {
  min-width: 360px;
}

.calendar-grid.calendar-grid--day .day-header .day-name {
  font-size: 14px;
}

.calendar-grid.calendar-grid--day .day-header .day-num {
  font-size: 12px;
  font-weight: 500;
  opacity: 0.9;
}

.corner-cell {
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--surface);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.day-header {
  padding: 5px 4px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
  position: sticky;
  top: 0;
  z-index: 2;
}

.day-header.is-today {
  background: var(--today-column-bg, rgba(0, 122, 255, 0.07));
}

.day-header--link {
  cursor: pointer;
}

.day-header.is-weekend-collapsed {
  padding-left: 2px;
  padding-right: 2px;
}

.day-header.is-weekend-collapsed .day-name {
  font-size: 9px;
  letter-spacing: 0;
}

.day-header.is-weekend-collapsed .day-num {
  font-size: 12px;
}

.day-track.is-weekend-collapsed {
  background: rgba(0, 0, 0, 0.02);
}

.day-header--link:hover {
  background: rgba(0, 122, 255, 0.1);
}

.day-header--link:hover .day-name {
  color: var(--accent);
}

.day-header.is-today .day-name {
  color: var(--accent);
}

.day-name {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  line-height: 1.2;
}

.day-num {
  display: block;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 1px;
  color: var(--text-primary);
  line-height: 1.15;
}

.time-slot {
  height: var(--grid-hour);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: relative;
}

.time-slot:nth-child(7n + 2) {
  /* subtle column zebra for readability */
  background: rgba(0, 0, 0, 0.015);
}

.time-label {
  position: sticky;
  left: 0;
  z-index: 2;
  height: var(--grid-hour);
  padding: 0 6px 0 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding-top: 4px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  transform: translateY(-1px);
}

.time-label span {
  line-height: 1;
}

/* Week view — full-color event card; field status uses .event-field-status frosted chip */
.event-block {
  position: absolute;
  left: 4px;
  right: 4px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  line-height: 1.35;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  z-index: 1;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.event-block.calendar-event-dimmed,
.month-event-pill.calendar-event-dimmed,
.today-card.calendar-event-dimmed {
  opacity: 0.34;
  filter: saturate(0.45);
}

.event-block.calendar-event-dimmed:hover,
.month-event-pill.calendar-event-dimmed:hover,
.today-card.calendar-event-dimmed:hover {
  opacity: 0.55;
}

.event-block--narrow:not(.is-dragging):not(.is-resizing):hover {
  left: 4px !important;
  right: 4px !important;
  width: auto !important;
  z-index: 35;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.22);
  overflow: visible;
}

.event-block--narrow:not(.is-dragging):not(.is-resizing):hover .event-block-main {
  overflow: visible;
}

.event-block--narrow:not(.is-dragging):not(.is-resizing):hover .event-block-text {
  overflow: visible;
}

.event-block--narrow:not(.is-dragging):not(.is-resizing):hover .event-title,
.event-block--narrow:not(.is-dragging):not(.is-resizing):hover .event-meta {
  white-space: normal;
  overflow: visible;
}

.event-block:not(.event-block--compact):not(.is-dragging):not(.is-resizing):hover {
  transform: scale(1.01);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
}

.event-block.is-dragging,
.event-block.is-resizing {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  z-index: 20;
  opacity: 0.96;
}

/* While dragging across columns, span full track width so the card is easy to place */
.event-block.is-dragging {
  left: 4px !important;
  right: 4px !important;
  width: auto !important;
}

.event-block.event-assign-incomplete::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 7px;
  height: 100%;
  pointer-events: none;
  z-index: 3;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  /* High-contrast white checkerboard (readable on any event color) */
  background: repeating-linear-gradient(
    -45deg,
    #ffffff,
    #ffffff 4px,
    rgba(255, 255, 255, 0.58) 4px,
    rgba(255, 255, 255, 0.58) 8px
  );
  box-shadow: -1px 0 0 rgba(0, 0, 0, 0.12);
}

.event-block-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.event-block-main {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 8px 10px 4px;
  cursor: grab;
  touch-action: none;
}

.event-block-body {
  height: 100%;
  min-height: 0;
}

.event-block-text {
  min-width: 0;
}

.event-block.is-dragging .event-block-main {
  cursor: grabbing;
}

.event-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-block .event-meta {
  font-size: 11px;
  font-weight: 400;
  opacity: 0.92;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-assignees {
  margin-top: 6px;
  min-height: 22px;
}

.crew-avatars {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.crew-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.93);
  color: rgba(0, 0, 0, 0.78);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  flex-shrink: 0;
}

.crew-avatar--lead::after {
  content: "";
  position: absolute;
  top: -3px;
  left: 50%;
  transform: translateX(-50%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ffd60a;
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.crew-avatar--pm {
  border-radius: 5px;
}

.crew-avatar--more {
  background: rgba(255, 255, 255, 0.82);
  font-size: 8px;
}

.crew-avatar-inner {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}

.crew-empty {
  opacity: 0.8;
  font-size: 11px;
  font-weight: 500;
}

/* Short events — crew rail on the right (PM square + stacked tech circles) */
.event-block--compact .event-block-main {
  padding: 5px 6px 3px;
}

.event-block--compact .event-block-body {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 5px;
}

.event-block--compact .event-block-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.event-block--compact .event-assignees {
  margin-top: 0;
  min-height: 0;
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  align-self: flex-start;
}

.event-block--compact.event-assign-incomplete .event-assignees {
  margin-right: 4px;
}

.event-block--compact .crew-avatars {
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 2px;
  align-items: center;
}

.event-block--compact .crew-avatar {
  width: 17px;
  height: 17px;
}

.event-block--compact .crew-avatar--pm {
  border-radius: 4px;
}

.event-block--compact .crew-avatar-inner {
  font-size: 7px;
}

.event-block--compact .crew-avatar--lead::after {
  width: 5px;
  height: 5px;
  top: -2px;
}

.event-block--compact .crew-empty {
  font-size: 9px;
}

.event-block--compact .event-field-status {
  margin-top: 3px;
  padding: 2px 5px;
  font-size: 8px;
  letter-spacing: 0.04em;
}

.event-block--ultra-compact .event-block-main {
  padding: 4px 5px 2px;
}

.event-block--ultra-compact .event-meta,
.event-block--ultra-compact .event-field-status {
  display: none;
}

.event-block--ultra-compact .crew-avatar {
  width: 15px;
  height: 15px;
}

.event-block--ultra-compact .crew-avatar-inner {
  font-size: 6px;
}

/* Compact hover — reveal full crew, unclip text, show hidden meta on ultra-short cards */
.event-block--compact:not(.is-dragging):not(.is-resizing):hover,
.event-block--compact.event-block--crew-expanded:not(.is-dragging):not(.is-resizing) {
  z-index: 34;
  overflow: visible;
  transform: translateY(-1px);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.2);
}

.event-block--compact:not(.is-dragging):not(.is-resizing):hover .event-block-main,
.event-block--compact.event-block--crew-expanded:not(.is-dragging):not(.is-resizing) .event-block-main {
  overflow: visible;
}

.event-block--compact:not(.is-dragging):not(.is-resizing):hover .event-block-text,
.event-block--compact.event-block--crew-expanded .event-block-text {
  overflow: visible;
}

.event-block--compact:not(.is-dragging):not(.is-resizing):hover .event-title,
.event-block--compact:not(.is-dragging):not(.is-resizing):hover .event-meta,
.event-block--compact.event-block--crew-expanded .event-title,
.event-block--compact.event-block--crew-expanded .event-meta {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.event-block--ultra-compact:not(.is-dragging):not(.is-resizing):hover .event-meta,
.event-block--ultra-compact:not(.is-dragging):not(.is-resizing):hover .event-field-status,
.event-block--ultra-compact.event-block--crew-expanded .event-meta,
.event-block--ultra-compact.event-block--crew-expanded .event-field-status {
  display: block;
}

.event-block--compact.event-block--crew-expanded .event-assignees {
  position: absolute;
  right: 5px;
  top: 4px;
  z-index: 4;
  padding: 4px 5px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
}

.event-block--compact.event-block--crew-expanded.event-assign-incomplete .event-assignees {
  right: 10px;
}

.event-block--compact.event-block--crew-expanded .crew-avatars {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  max-width: 112px;
}

.event-block--compact.event-block--crew-expanded .crew-avatar {
  width: 22px;
  height: 22px;
}

.event-block--compact.event-block--crew-expanded .crew-avatar--pm {
  border-radius: 5px;
}

.event-block--compact.event-block--crew-expanded .crew-avatar-inner {
  font-size: 9px;
}

.event-block--compact.event-block--crew-expanded .crew-avatar--lead::after {
  width: 6px;
  height: 6px;
  top: -2px;
}

.event-block--compact.event-block--crew-expanded .crew-empty {
  font-size: 11px;
}

.event-resize-handle {
  flex-shrink: 0;
  height: 10px;
  margin-top: auto;
  cursor: ns-resize;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.35));
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.event-resize-handle:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.5));
}

.calendar-scroll.is-panning {
  cursor: grabbing;
  user-select: none;
}

.calendar-scroll {
  cursor: default;
}

.event-scheduled {
  background: linear-gradient(145deg, var(--type-scheduled, #007aff), var(--type-scheduled-end, #004d9e));
}

.event-tentative {
  background: linear-gradient(145deg, var(--type-tentative, #af52de), var(--type-tentative-end, #6d3aad));
}

.event-survey {
  background: linear-gradient(145deg, var(--type-survey, #ff9500), var(--type-survey-end, #9e5c00));
}

.event-delivery {
  background: linear-gradient(145deg, var(--type-delivery, #34c759), var(--type-delivery-end, #207a37));
}

.event-blocked {
  background: linear-gradient(145deg, var(--type-blocked, #ffd60a), var(--type-blocked-end, #9a8200));
  color: #1d1d1f;
  border-color: rgba(0, 0, 0, 0.12);
}

.event-blocked .event-meta,
.event-blocked .event-title,
.event-blocked .event-field-status {
  color: #1d1d1f;
}

.event-blocked .event-field-status {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(0, 0, 0, 0.1);
}

.event-task {
  background: linear-gradient(145deg, var(--type-task, #8e8e93), var(--type-task-end, #57575c));
}

.month-event-pill.event-blocked {
  color: #1d1d1f;
}

/** Same-tech spacing warning (per market min gap not met) */
.event-block.event-tech-gap-violation {
  background: linear-gradient(145deg, #d32f2f, #8b0000) !important;
  border-color: rgba(255, 255, 255, 0.35);
}

.event-block.event-tech-gap-violation:not(.is-dragging):not(.is-resizing):hover {
  box-shadow: 0 4px 16px rgba(139, 0, 0, 0.35);
}

.calendar-grid.calendar-grid--month {
  grid-template-columns: repeat(7, minmax(92px, 1fr));
  min-width: 680px;
}

.month-weekday-h {
  padding: 10px 6px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  background: #fafafa;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 2;
}

.month-weekday-h:nth-child(7n) {
  border-right: none;
}

.month-day-cell {
  position: relative;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 6px 6px 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 104px;
  cursor: pointer;
}

.month-day-cell:hover {
  background: rgba(0, 122, 255, 0.05);
}

.month-day-cell.is-other-month {
  background: rgba(0, 0, 0, 0.02);
}

.month-day-cell.is-other-month .month-day-num {
  color: var(--text-tertiary);
  opacity: 0.85;
}

.month-day-cell.is-today {
  background: var(--today-column-bg, rgba(0, 122, 255, 0.07));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}

.month-day-num {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 6px;
  flex-shrink: 0;
}

.month-day-events {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.month-event-pill {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  border-radius: 4px;
  padding: 5px 7px;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  line-height: 1.25;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  transition: filter 0.12s ease, transform 0.12s ease;
}

.month-event-pill:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.month-event-pill.event-assign-incomplete {
  position: relative;
}

.month-event-pill.event-assign-incomplete::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 7px;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  border-radius: 0 4px 4px 0;
  background: repeating-linear-gradient(
    -45deg,
    #ffffff,
    #ffffff 4px,
    rgba(255, 255, 255, 0.58) 4px,
    rgba(255, 255, 255, 0.58) 8px
  );
  box-shadow: -1px 0 0 rgba(0, 0, 0, 0.12);
}

.month-event-pill--warn {
  outline: 2px solid rgba(198, 40, 40, 0.95);
  outline-offset: 0;
}

.helper-text {
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: center;
}

.helper-text kbd {
  font: inherit;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
}

.calendar-grid {
  display: grid;
}

/* Week body: sticky time ruler + day tracks */
.time-ruler {
  position: sticky;
  left: 0;
  z-index: 2;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.time-ruler-label {
  position: absolute;
  left: 0;
  right: 0;
  width: 100%;
  text-align: right;
  padding-right: 6px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-tertiary);
  line-height: 1;
  transform: translateY(-5px);
}

.day-track {
  position: relative;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.day-track.is-today {
  background: var(--today-column-bg, rgba(0, 122, 255, 0.07));
}

.now-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 2px solid #ff3b30;
  pointer-events: none;
  z-index: 15;
  filter: drop-shadow(0 0 4px rgba(255, 59, 48, 0.35));
}

.now-line::before {
  content: "";
  position: absolute;
  left: 0;
  top: -5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff3b30;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.92);
}

.day-track-slot-hover {
  position: absolute;
  left: 0;
  right: 0;
  height: calc(var(--grid-hour) / 2);
  background: var(--calendar-slot-hover, rgba(0, 122, 255, 0.22));
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.08s ease;
}

.day-track-slot-hover.is-visible {
  opacity: 1;
}

.hour-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 1px solid var(--border);
  pointer-events: none;
}

.acting-as {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.acting-as select {
  font: inherit;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  min-width: 160px;
}

.my-jobs-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.my-jobs-filter input {
  margin: 0;
  cursor: pointer;
}

.btn-danger {
  background: #fff1f2;
  color: #be123c;
  border-color: rgba(190, 18, 60, 0.25);
}

.btn-danger:hover {
  background: #ffe4e6;
}

/* Modal */
#modal-root,
#viewer-root {
  position: relative;
  z-index: 100;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 101;
  opacity: 0;
  transition: opacity 0.22s ease;
}

.modal-backdrop.is-open {
  opacity: 1;
}

.modal-sheet {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, calc(-50% + 12px)) scale(0.985);
  width: min(640px, calc(100vw - 32px));
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  z-index: 102;
  overflow: hidden;
  opacity: 0;
  transition:
    opacity 0.24s ease,
    transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-sheet.is-open {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

@media (prefers-reduced-motion: reduce) {
  .modal-backdrop,
  .modal-sheet {
    transition: none;
  }

  .modal-backdrop {
    opacity: 1;
  }

  .modal-sheet {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

.modal-sheet-wide {
  width: min(960px, calc(100vw - 32px));
}

@media (min-width: 1100px) {
  .modal-sheet-wide {
    width: min(1120px, calc(100vw - 48px));
  }
}

@media (min-width: 1600px) {
  .modal-sheet-wide {
    width: min(1280px, calc(100vw - 64px));
  }
}

.unsaved-prompt-backdrop {
  z-index: 103;
}

.unsaved-prompt-sheet {
  z-index: 104;
  width: min(520px, calc(100vw - 32px));
  max-height: none;
}

.unsaved-prompt-body {
  padding: 24px 20px 20px;
  text-align: center;
}

.unsaved-prompt-msg {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-primary);
}

.unsaved-prompt-foot {
  flex-wrap: wrap;
  gap: 8px;
}

.unsaved-prompt-foot .btn {
  flex: 1 1 auto;
  min-width: 140px;
}

.series-scope-backdrop {
  z-index: 105;
}

.series-scope-sheet {
  z-index: 106;
}

.series-scope-blurb {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.45;
}

.series-scope-foot {
  flex-direction: column;
  align-items: stretch;
}

.series-scope-foot .btn {
  width: 100%;
}

.series-info-banner {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-elevated));
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
}

.series-info-banner p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

.series-detached-label {
  color: var(--text-secondary);
}

.recurrence-fieldset {
  min-width: 0;
}

.recurrence-fieldset .recurrence-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
  min-width: 0;
}

.recurrence-fieldset .recurrence-options[hidden] {
  display: none;
}

.recurrence-preview {
  margin: 0;
  font-size: 13px;
  grid-column: 1 / -1;
  word-break: break-word;
}

@media (max-width: 560px) {
  .recurrence-fieldset .recurrence-options {
    grid-template-columns: 1fr;
  }
}

.create-job-prompt-backdrop {
  z-index: 103;
}

.create-job-prompt-sheet {
  z-index: 104;
  width: min(420px, calc(100vw - 32px));
  max-height: none;
}

.create-job-prompt-body {
  padding: 24px 20px 8px;
  text-align: center;
}

.create-job-prompt-msg {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.create-job-prompt-meta {
  margin: 8px 0 0;
  font-size: 13px;
}

.create-job-prompt-foot {
  gap: 8px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: #fafafa;
}

.modal-foot-spacer {
  flex: 1;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
  min-width: 0;
}

.form-grid fieldset {
  min-width: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > span:first-child,
.field legend {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.field input,
.field select,
.field textarea {
  font: inherit;
  font-size: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
}

.field textarea {
  resize: vertical;
  min-height: 88px;
}

.amount-thousands-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.amount-thousands-wrap select {
  flex: 1;
  min-width: 0;
}

.amount-thousands-suffix {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.amount-field--disabled > span:first-child,
.amount-field--disabled .amount-thousands-suffix {
  color: var(--text-tertiary);
}

.amount-field--disabled .amount-thousands-wrap select:disabled {
  background: #f5f5f7;
  color: var(--text-tertiary);
  cursor: not-allowed;
}

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

@media (min-width: 900px) {
  .modal-sheet .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .modal-sheet-wide .form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .modal-sheet .field-span-2,
  .modal-sheet-wide .field-span-2 {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .field-span-2 {
    grid-column: span 1;
  }

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

.muted {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.distance-readout {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-primary);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #f5f5f7;
  border: 1px solid var(--border);
}

.address-readout {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
}

.address-maps-link {
  color: var(--accent, #0071e3);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-word;
}

.address-field .address-maps-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}

.address-field .address-maps-link:hover {
  text-decoration: underline;
}

.distance-readout .address-maps-link {
  font-weight: 500;
}

.check-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 14px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--text-primary);
}

.reminder-checks,
.job-type-checks,
.asset-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
  margin-top: 6px;
}

.assign-checks {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}

.assign-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0;
}

.assign-row-main {
  flex: 1;
  min-width: 0;
}

.assign-lead-pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.assign-lead-pick input {
  flex-shrink: 0;
}

.assign-lead-pick input:disabled {
  cursor: not-allowed;
}

.assign-row:has(.assign-lead-pick input:disabled) .assign-lead-pick {
  opacity: 0.45;
  cursor: not-allowed;
}

.assign-slot-counter {
  margin: 6px 0 2px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.assign-slot-counter.assign-slot-counter--low {
  color: #b45309;
}

.job-type-fieldset,
.assets-fieldset,
.assign-fieldset,
.forms-fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 0;
}

.audit-details {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0;
  margin: 0;
  align-self: start;
}

.audit-summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  padding: 12px 14px;
  list-style: none;
  color: var(--text-primary);
  user-select: none;
}

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

.audit-summary::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid var(--text-tertiary);
  margin-right: 8px;
  transform: translateY(-1px);
  transition: transform 0.15s ease;
}

.audit-details[open] .audit-summary::before {
  transform: rotate(90deg) translateY(-1px);
}

.audit-summary:hover {
  background: rgba(0, 0, 0, 0.03);
}

.contact2-details {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0;
  margin: 0;
  align-self: start;
}

.contact2-summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  padding: 12px 14px;
  list-style: none;
  color: var(--text-primary);
  user-select: none;
}

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

.contact2-summary::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid var(--text-tertiary);
  margin-right: 8px;
  transform: translateY(-1px);
  transition: transform 0.15s ease;
}

.contact2-details[open] .contact2-summary::before {
  transform: rotate(90deg) translateY(-1px);
}

.contact2-summary:hover {
  background: rgba(0, 0, 0, 0.03);
}

.contact2-fields-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
  padding: 0 14px 14px;
}

@media (max-width: 560px) {
  .contact2-fields-inner {
    grid-template-columns: 1fr;
  }
}

.audit-trail {
  margin-top: 0;
  padding: 0 14px 12px;
  max-height: 220px;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.audit-line {
  margin: 0 0 10px;
}

.audit-line:last-child {
  margin-bottom: 0;
}

.audit-line strong {
  color: var(--text-primary);
  font-weight: 600;
}

.audit-empty {
  margin: 0;
}

.form-links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.form-link-card {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: #fafafa;
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
  line-height: 1.3;
}

.form-link-card:hover {
  background: var(--accent-soft);
  border-color: rgba(0, 0, 0, 0.08);
}

.form-links-note {
  margin-top: 10px;
  margin-bottom: 0;
}

.forms-fieldset code,
.drive-block code {
  font-size: 11px;
  word-break: break-word;
}

.drive-block .drive-folder-name-preview,
.drive-block code.drive-folder-name-preview {
  padding: 3px 8px;
  background: #f5f5f7;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.upload-field input[type="file"] {
  font-size: 13px;
}

.list-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.file-chips {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.file-chips li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.file-chip {
  font: inherit;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  cursor: pointer;
}

.link-btn {
  font: inherit;
  font-size: 12px;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}

.event-form-simple[hidden],
.event-form-install[hidden] {
  display: none !important;
}

/* Let install fields participate in the parent .form-grid (full-width description, etc.) */
.event-form-install,
.event-form-install-core,
.event-form-extended,
.event-form-install-tail {
  display: contents;
}

.event-form-description {
  grid-column: 1 / -1;
}

.event-form-description textarea {
  width: 100%;
  box-sizing: border-box;
}

.tech-quick-open {
  margin-bottom: 14px;
}

.tech-file-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tech-file-links .btn {
  flex: 1 1 160px;
}

.attachment-bucket + .attachment-bucket {
  margin-top: 4px;
}

.attachment-bucket-blurb {
  margin: 4px 0 10px;
  font-size: 13px;
  line-height: 1.4;
}

.attachment-upload {
  margin-bottom: 10px;
}

.attachment-gallery-empty {
  margin: 0;
  font-size: 13px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: #f5f5f7;
  border: 1px dashed var(--border-strong);
}

.attachment-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.attachment-gallery-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.attachment-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #f5f5f7;
  cursor: pointer;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.attachment-thumb:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.attachment-thumb:focus-visible {
  outline: 2px solid var(--accent, #0071e3);
  outline-offset: 2px;
}

.attachment-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.attachment-thumb-badge {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.attachment-gallery-caption {
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-secondary);
  word-break: break-word;
}

.attachment-remove {
  align-self: flex-start;
}

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

  .tech-file-links .btn {
    flex: 1 1 100%;
  }
}

.field-status-banner {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid var(--border);
  font-size: 14px;
}

.tech-field-comms {
  margin-bottom: 16px;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.02);
}

.tech-field-comms-title {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
}

.tech-field-comms-blurb {
  margin: 0 0 12px;
  font-size: 13px;
}

.tech-field-comms-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tech-field-comms-actions .btn.is-phase-active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(0, 113, 227, 0.12);
}

.tech-field-comms-actions .btn:focus {
  outline: none;
}

.tech-field-comms-actions .btn:focus-visible {
  box-shadow: var(--focus-ring), var(--shadow-sm);
}

.tech-field-comms-actions .btn:active {
  transform: scale(0.98);
}

.event-field-status {
  display: inline-block;
  align-self: flex-start;
  margin-top: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.94);
  color: rgba(0, 0, 0, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.14);
  backdrop-filter: blur(10px) saturate(1.15);
  -webkit-backdrop-filter: blur(10px) saturate(1.15);
}

.event-field-status--in-transit {
  color: #9a3412;
  border-left: 3px solid #ea580c;
}

.event-field-status--in-progress,
.event-field-status--working {
  color: #1e40af;
  border-left: 3px solid #2563eb;
}

.event-field-status--complete {
  color: #166534;
  border-left: 3px solid #16a34a;
}

.event-field-status--lunch {
  color: #854d0e;
  border-left: 3px solid #ca8a04;
}

.crew-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.eta-pick-backdrop {
  z-index: 110;
}

.eta-pick-sheet {
  z-index: 111;
  max-width: 420px;
}

.eta-pick-lead {
  margin: 0 0 12px;
}

.eta-pick-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.eta-pick-btn {
  width: 100%;
  justify-content: center;
}

.eta-pick-btn:active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.eta-pick-btn:focus {
  outline: none;
  box-shadow: var(--focus-ring), var(--shadow-sm);
}

.eta-pick-btn:focus-visible {
  box-shadow: var(--focus-ring), var(--shadow-sm);
}

.job-detail-hover-tip {
  position: fixed;
  z-index: 45;
  max-width: min(320px, calc(100vw - 24px));
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  pointer-events: none;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-primary);
}

.job-detail-hover-tip.is-visible {
  opacity: 1;
}

.job-detail-hover-section + .job-detail-hover-section {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.job-detail-hover-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.job-detail-hover-body {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-secondary);
}

.context-menu {
  position: fixed;
  display: none;
  flex-direction: column;
  min-width: 220px;
  max-width: 280px;
  padding: 6px;
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  z-index: 200;
}

.context-menu--assign {
  padding: 0;
  min-width: 240px;
}

.context-menu-head {
  font-size: 13px;
  font-weight: 600;
  padding: 10px 12px 6px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
}

.context-menu-meta {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.02);
  border-bottom: 1px solid var(--border);
}

.context-menu-checks {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  max-height: 280px;
  overflow-y: auto;
}

.context-menu-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  color: var(--text-primary);
}

.context-menu-check > span {
  flex: 1;
  min-width: 0;
}

.context-menu-lead-btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-tertiary);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}

.context-menu-lead-btn:hover:not(:disabled) {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(0, 0, 0, 0.08);
}

.context-menu-lead-btn.is-active {
  background: #fff8dc;
  color: #b45309;
  border-color: rgba(180, 83, 9, 0.35);
}

.context-menu-lead-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.context-menu-check:hover {
  background: var(--accent-soft);
}

.context-menu-check input {
  flex-shrink: 0;
}

.context-menu-empty {
  margin: 8px 10px;
  font-size: 12px;
}

.context-menu.is-open {
  display: flex;
}

.context-menu button {
  font: inherit;
  font-size: 13px;
  text-align: left;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  color: var(--text-primary);
}

.context-menu button:hover {
  background: var(--accent-soft);
}

.viewer {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: #000;
  display: flex;
  flex-direction: column;
}

.viewer-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(30, 30, 30, 0.92);
  color: #f5f5f7;
}

.viewer-head .viewer-title {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-count {
  font-size: 12px;
  opacity: 0.85;
}

.viewer-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  touch-action: pan-y;
}

.viewer-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.viewer-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

.viewer-foot {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 12px;
  background: rgba(30, 30, 30, 0.92);
}

#toast-bar {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 400;
  max-width: min(480px, calc(100vw - 32px));
  pointer-events: none;
}

#toast-bar.is-visible {
  pointer-events: auto;
}

.toast {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  padding: 14px 16px;
}

.toast p {
  margin: 0 0 8px;
  font-size: 13px;
}

.toast p:last-of-type {
  margin-bottom: 12px;
}

.toast-simple {
  padding: 12px 16px;
}

.toast-simple p {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}

.toast-success {
  border-left: 4px solid var(--accent);
}

.toast-error {
  border-left: 4px solid #d14343;
}

.toast-reminders .toast-reminder-row {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.toast-reminders .toast-reminder-row:first-of-type {
  margin-top: 8px;
  padding-top: 0;
  border-top: none;
}

.toast-reminder-preview {
  font-size: 12px;
  margin-bottom: 8px !important;
}

.reminder-blurb {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.45;
}

.settings-collapsible {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 16px;
}

.settings-collapsible-toggle {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  font-size: 15px;
  font-weight: 600;
  user-select: none;
}

.settings-collapsible-toggle::-webkit-details-marker {
  display: none;
}

.settings-collapsible-toggle::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  transition: transform 0.15s ease;
}

.settings-collapsible[open] .settings-collapsible-toggle::before {
  transform: rotate(90deg);
}

.settings-collapsible-body {
  padding: 0 12px 12px;
  border-top: 1px solid var(--border);
}

.settings-section-title {
  margin: 20px 0 10px;
  font-size: 15px;
  font-weight: 600;
}

.settings-section-title:first-child {
  margin-top: 0;
}

.settings-catalog-blurb {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.45;
}

.catalog-editor {
  margin-bottom: 8px;
}

.catalog-editor-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.catalog-editor-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.catalog-label-input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-primary);
}

.catalog-editor-add {
  display: flex;
  gap: 8px;
  align-items: center;
}

.catalog-editor-add input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.catalog-del {
  flex-shrink: 0;
  font-size: 12px;
  padding: 6px 10px;
}

.color-loc-block {
  margin-bottom: 16px;
}

.color-loc-block h4 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.color-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 13px;
}

.color-row-gradient {
  margin-left: 10px;
  padding: 4px 0 4px 10px;
  border-left: 2px solid var(--border);
  margin-bottom: 10px;
}

.color-override-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
}

.color-override-check input {
  margin: 0;
}

.color-row-gradient .grad-end-picker:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  background: #fafafa;
  font-weight: 600;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 16px;
}

.inline-form h4 {
  width: 100%;
  margin: 0 0 4px;
  font-size: 13px;
}

.inline-form input,
.inline-form select {
  font: inherit;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
}

.mini-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 8px;
  font-size: 12px;
}

.loc-cell {
  max-width: 220px;
}

/* —— Role-based Today view + job summary —— */

.brand {
  position: relative;
}

.sync-status-chip {
  display: inline-block;
  margin-left: 10px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.05);
  border-radius: 999px;
  vertical-align: middle;
  transition: opacity 0.35s ease;
}

.sync-status-chip--error {
  color: #fff;
  background: var(--danger, #ff3b30);
}

body[data-app-view="list"] .calendar-viewport,
body[data-app-view="list"] .legend-collapsible,
body[data-app-view="list"] #zoom-switch {
  display: none !important;
}

body[data-app-view="list"] .today-viewport {
  display: flex !important;
}

body[data-app-view="calendar"] .today-viewport {
  display: none !important;
}

body[data-role="technician"] .legend-collapsible {
  display: none;
}

.today-viewport {
  display: none;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 4px 16px;
}

.today-header {
  padding: 4px 4px 0;
}

.today-title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.today-subtitle {
  margin: 6px 0 0;
  font-size: 15px;
}

.list-day-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.list-day-label {
  flex: 1 1 auto;
  text-align: center;
  min-width: 0;
}

.list-day-nav .btn-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.today-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.today-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  text-align: left;
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
  font: inherit;
  color: inherit;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.today-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: -16px -18px 0;
  padding: 12px 18px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  color: #fff;
}

.today-card.event-scheduled .today-card-head {
  background: linear-gradient(145deg, var(--type-scheduled, #007aff), var(--type-scheduled-end, #004d9e));
}

.today-card.event-tentative .today-card-head {
  background: linear-gradient(145deg, var(--type-tentative, #af52de), var(--type-tentative-end, #6d3aad));
}

.today-card.event-survey .today-card-head {
  background: linear-gradient(145deg, var(--type-survey, #ff9500), var(--type-survey-end, #9e5c00));
}

.today-card.event-delivery .today-card-head {
  background: linear-gradient(145deg, var(--type-delivery, #34c759), var(--type-delivery-end, #207a37));
}

.today-card.event-blocked .today-card-head {
  color: #1d1d1f;
  background: linear-gradient(145deg, var(--type-blocked, #ffd60a), var(--type-blocked-end, #9a8200));
}

.today-card.event-task .today-card-head {
  background: linear-gradient(145deg, var(--type-task, #8e8e93), var(--type-task-end, #57575c));
}

.today-card.event-scheduled .today-card-jobno,
.today-card.event-tentative .today-card-jobno,
.today-card.event-survey .today-card-jobno,
.today-card.event-delivery .today-card-jobno,
.today-card.event-task .today-card-jobno {
  color: rgba(255, 255, 255, 0.88);
}

.today-card.event-blocked .today-card-jobno {
  color: rgba(0, 0, 0, 0.55);
}

.today-card.event-assign-incomplete::after {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.today-card:hover {
  box-shadow: var(--shadow-md);
}

.today-card:active {
  transform: scale(0.995);
}

.today-card-customer {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.today-card-jobno {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.today-card-time {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.today-card-address {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
}

.today-card-contact {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-primary);
}

.today-card-contact a {
  color: var(--accent);
  text-decoration: none;
}

.today-card-contact a:active {
  opacity: 0.75;
}

.job-summary-line a {
  color: var(--accent);
  text-decoration: none;
}

.job-summary-line a:active {
  opacity: 0.75;
}

.today-card-meta {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.today-card-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.today-card-detail {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
}

.today-card-detail-label {
  font-weight: 600;
  color: var(--text-secondary);
}

.today-card-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
}

.today-card-actions .btn,
.today-card-actions a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.2;
  text-align: center;
  min-width: 0;
  box-sizing: border-box;
}

.today-card-actions .btn-notes--has-text {
  font-weight: 600;
}

.today-card-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.today-card-body:hover {
  opacity: 0.98;
}

.today-card-notes-preview {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
}

.installer-notes-sheet {
  width: min(520px, calc(100vw - 32px));
}

.installer-notes-modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.installer-notes-meta {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
}

.installer-notes-content {
  margin: 0;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: #f5f5f7;
  border: 1px solid var(--border);
  font-size: 16px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.installer-notes-content--empty {
  color: var(--text-secondary);
  font-style: italic;
  font-size: 15px;
}

.installer-notes-foot {
  flex-wrap: wrap;
  gap: 8px;
}

.installer-notes-foot .btn-maps {
  min-height: 40px;
  padding: 8px 14px;
  font-size: 14px;
}

.job-summary-hero {
  margin-bottom: 16px;
  padding: 16px 18px;
  background: linear-gradient(180deg, var(--accent-soft) 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.job-summary-customer {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.job-summary-line {
  margin: 0 0 8px;
  font-size: 15px;
  line-height: 1.45;
}

.job-summary-line:last-child {
  margin-bottom: 0;
}

.job-summary-notes {
  white-space: pre-wrap;
}

.job-summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.job-summary-actions .btn {
  min-height: 40px;
}

.modal-sheet--tech-read .event-form-install-core,
.modal-sheet--tech-read .event-form-install-tail,
.modal-sheet--tech-read .event-form-description,
.modal-sheet--tech-read .forms-fieldset,
.modal-sheet--tech-read .drive-block,
.modal-sheet--tech-read .reminder-checks,
.modal-sheet--tech-read .audit-details {
  display: none !important;
}

.modal-sheet--tech-read .tech-field-comms-blurb {
  display: none;
}

.modal-sheet--tech-read .modal-head h2 {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.event-title-primary {
  font-weight: 650;
}

@media (max-width: 768px) {
  body[data-app-view="list"] .calendar-toolbar {
    flex-wrap: wrap;
  }

  body[data-role="technician"] .toolbar-secondary {
    flex-wrap: wrap;
  }

  body[data-role="technician"] .job-search {
    order: 10;
    width: 100%;
  }

  .today-card-customer {
    font-size: 18px;
  }

  .modal-sheet {
    max-height: 96vh;
  }

  .job-summary-customer {
    font-size: 20px;
  }
}

/* New job — prior customer autofill */
.field-autofill-wrap {
  position: relative;
}

.field-hint {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.3;
}

.job-form-autofill {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% - 2px);
  z-index: 60;
  max-height: min(240px, 40vh);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 4px;
}

.job-form-autofill[hidden] {
  display: none !important;
}

.job-form-autofill-hit {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.job-form-autofill-hit:hover,
.job-form-autofill-hit:focus {
  background: var(--accent-soft);
  outline: none;
}

.job-form-autofill-hit-main {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.job-form-autofill-hit-meta {
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-secondary);
}

/* ——— Phone / tablet (≤1023px): Day default, List optional, compact chrome ——— */
body[data-mobile-layout="true"] {
  -webkit-text-size-adjust: 100%;
  min-height: 100dvh;
}

body[data-mobile-layout="true"] .app-shell {
  padding: 8px 10px max(16px, env(safe-area-inset-bottom));
  min-height: 100dvh;
}

body[data-mobile-layout="true"] .brand-sub {
  display: none;
}

.toolbar-secondary .sync-status-chip {
  flex-shrink: 0;
}

body[data-mobile-layout="true"] .sync-status-chip {
  font-size: 10px;
  padding: 2px 8px;
}

body[data-mobile-layout="true"] .brand-title {
  font-size: 18px;
}

body[data-mobile-layout="true"] .top-bar {
  display: none;
}

body[data-mobile-layout="true"] .location-switch label {
  font-size: 11px;
  padding: 8px 6px;
}

body[data-mobile-layout="true"] .calendar-chrome {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-md);
}

body[data-mobile-layout="true"] .job-search {
  display: none !important;
}

body[data-mobile-layout="true"] .acting-as {
  display: inline-flex !important;
}

body[data-mobile-layout="true"] .legend-collapsible {
  display: none;
}

body[data-mobile-layout="true"] .my-jobs-filter {
  font-size: 14px;
  min-height: 40px;
  align-items: center;
}

body[data-mobile-layout="true"] .my-jobs-filter input {
  width: 18px;
  height: 18px;
}

body[data-mobile-layout="true"] #btn-new {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 13px;
}

body[data-mobile-layout="true"][data-app-view="list"] .today-viewport {
  display: flex !important;
}

body[data-mobile-layout="true"][data-app-view="calendar"] .calendar-viewport {
  display: flex !important;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
}

body[data-mobile-layout="true"][data-app-view="calendar"] .calendar-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

body[data-mobile-layout="true"][data-app-view="list"] .calendar-viewport {
  display: none !important;
}

body[data-mobile-layout="true"] .today-list {
  gap: 10px;
}

body[data-mobile-layout="true"] .today-card {
  padding: 14px 16px;
  gap: 10px;
}

body[data-mobile-layout="true"] .today-card-head {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin: -14px -16px 0;
  padding: 12px 16px;
}

body[data-mobile-layout="true"] .today-card-customer {
  font-size: 19px;
}

body[data-mobile-layout="true"] .today-card-time {
  font-size: 17px;
}

body[data-mobile-layout="true"] .today-card-detail {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
}

body[data-mobile-layout="true"] .today-card-detail-label {
  font-weight: 600;
  color: var(--text-secondary);
}

body[data-mobile-layout="true"] .today-card-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
}

body[data-mobile-layout="true"] .today-card-actions .btn,
body[data-mobile-layout="true"] .today-card-actions a.btn {
  min-height: 44px;
  font-size: 13px;
  padding: 8px 10px;
}

/* Full-screen job sheet on narrow screens */
body[data-mobile-layout="true"] .modal-sheet {
  left: 0;
  top: auto;
  bottom: 0;
  width: 100%;
  max-width: none;
  height: 100dvh;
  max-height: 100dvh;
  border-radius: 0;
  transform: translateY(100%);
  padding-bottom: env(safe-area-inset-bottom);
}

body[data-mobile-layout="true"] .modal-sheet.is-open {
  transform: translateY(0);
}

body[data-mobile-layout="true"] .modal-sheet--tech-read .modal-body {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-bottom: 0;
}

body[data-mobile-layout="true"] .modal-sheet--tech-read .tech-field-comms {
  order: 99;
  position: sticky;
  bottom: 0;
  margin: 16px -18px 0;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
  background: var(--surface);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);
}

body[data-mobile-layout="true"] .tech-field-comms-actions .btn {
  flex: 1 1 calc(50% - 4px);
  min-height: 48px;
  font-size: 14px;
}

body[data-mobile-layout="true"] .job-summary-hero {
  padding: 14px 16px;
}

body[data-mobile-layout="true"] .job-summary-customer {
  font-size: 21px;
}

body[data-mobile-layout="true"] .job-summary-actions .btn {
  flex: 1 1 calc(50% - 4px);
  min-height: 48px;
}

body[data-mobile-layout="true"] .job-summary-actions .btn-primary {
  flex: 1 1 100%;
}

/* —— Sign-in screen —— */
.login-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--bg, #f2f2f7);
}

.login-screen[hidden],
.app-root[hidden],
.login-form[hidden] {
  display: none !important;
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 28px 24px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

.login-title {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 600;
}

.login-lead {
  margin: 0 0 20px;
  color: var(--text-muted, #6b7280);
  font-size: 14px;
  line-height: 1.45;
}

.login-mode-switch {
  display: flex;
  gap: 0;
  margin: 0 0 16px;
  width: 100%;
}

.login-mode-switch .btn-seg {
  flex: 1 1 50%;
  justify-content: center;
  min-height: 40px;
  border-radius: 0;
}

.login-mode-switch .btn-seg:first-child {
  border-radius: 8px 0 0 8px;
}

.login-mode-switch .btn-seg:last-child {
  border-radius: 0 8px 8px 0;
}

.login-link-btn {
  width: 100%;
  justify-content: center;
  background: none;
  border: none;
  color: var(--accent, #007aff);
  font-size: 14px;
  padding: 4px 0;
  cursor: pointer;
}

.login-link-btn:hover {
  text-decoration: underline;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}

.login-field input {
  padding: 10px 12px;
  font-size: 16px;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 8px;
}

.login-submit {
  width: 100%;
  justify-content: center;
  min-height: 44px;
}

.login-back {
  width: 100%;
  justify-content: center;
}

.login-error {
  margin: 0 0 12px;
  padding: 10px 12px;
  font-size: 13px;
  color: #b42318;
  background: #fef3f2;
  border-radius: 8px;
}

.login-hint {
  margin: 0;
  font-size: 13px;
}

.personal-settings-email {
  font-size: 14px;
  margin: 0 0 16px;
}

