/*
 * ESNO Workspace: calendar, sales pipeline and project workspace
 *
 * This stylesheet is intentionally isolated from the legacy cascade. It must be
 * loaded after styles.css. Existing DOM ids, data attributes and interaction
 * hooks remain the source of truth; this file changes presentation only.
 */

/* Shared focus and interaction language for these workspaces. */
.app-shell :is(
  #view-calendar,
  #view-pipeline,
  #view-projects,
  #calendarEventModal,
  #projectModal
) :is(button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--esno-focus) 34%, transparent);
  outline-offset: 2px;
  border-color: var(--esno-focus);
  box-shadow: 0 0 0 1px var(--esno-focus);
}

.app-shell :is(#view-calendar, #view-pipeline, #view-projects) {
  min-width: 0;
  color: var(--esno-ink);
  font-family: var(--font-workspace, "Avenir Next", "Arial Nova", Arial, ui-sans-serif, system-ui, sans-serif);
}

.app-shell :is(#view-calendar, #view-pipeline, #view-projects) button,
.app-shell :is(#calendarEventModal, #projectModal) button {
  min-height: 44px;
}

/* --------------------------------------------------------------------------
   Calendar
   -------------------------------------------------------------------------- */

.app-shell #view-calendar.active {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.app-shell #view-calendar .calendar-layout {
  display: block;
  min-width: 0;
}

.app-shell #view-calendar .calendar-panel {
  min-width: 0;
  padding: clamp(16px, 1.7vw, 24px);
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  border: 1px solid var(--esno-line);
  border-radius: var(--esno-radius-panel);
  background: var(--esno-surface);
  box-shadow: var(--esno-shadow-card);
}

.app-shell #view-calendar .calendar-scope-control {
  display: grid;
  grid-template-columns: max-content minmax(220px, 1fr) minmax(220px, 290px);
  align-items: center;
  gap: 14px;
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--esno-line);
  border-radius: var(--esno-radius-card);
  background: var(--esno-surface-muted);
}

.app-shell #view-calendar .calendar-scope-control > span {
  color: var(--esno-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.app-shell #view-calendar .calendar-scope-toggle {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(130px, max-content));
  justify-self: start;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--esno-line);
  border-radius: 12px;
  background: var(--esno-surface);
}

.app-shell #view-calendar .calendar-scope-toggle button {
  min-height: 38px;
  padding: 7px 14px;
  border-radius: 8px;
  background: transparent;
  color: var(--esno-muted);
  font-weight: 750;
  transition: color var(--esno-motion-fast) var(--esno-ease), background var(--esno-motion-fast) var(--esno-ease);
}

.app-shell #view-calendar .calendar-scope-toggle button.active {
  background: var(--esno-blue);
  color: #fff;
}

.app-shell #view-calendar .calendar-scope-control > label {
  display: grid;
  grid-template-columns: max-content minmax(130px, 1fr);
  align-items: center;
  gap: 10px;
  color: var(--esno-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.app-shell #view-calendar .calendar-scope-control select {
  min-height: 44px;
  border: 1px solid var(--esno-control-line);
  border-radius: var(--esno-radius-control);
  background: var(--esno-surface);
  color: var(--esno-ink);
  font-size: 13px;
  letter-spacing: normal;
  text-transform: none;
}

.app-shell #view-calendar .calendar-toolbar {
  display: grid;
  grid-template-columns: 44px minmax(170px, 1fr) 44px auto auto;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--esno-line);
}

.app-shell #view-calendar .calendar-toolbar > .ghost {
  display: inline-grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  padding: 0;
  border: 1px solid var(--esno-line);
  border-radius: var(--esno-radius-control);
  background: var(--esno-surface);
  color: var(--esno-ink);
  font-size: 20px;
}

.app-shell #view-calendar .calendar-toolbar > .ghost:hover {
  border-color: var(--esno-blue);
  background: var(--esno-blue-soft);
  color: var(--esno-blue);
}

.app-shell #view-calendar .calendar-toolbar > div:nth-child(2) {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.app-shell #view-calendar .calendar-toolbar h2 {
  overflow-wrap: anywhere;
  color: var(--esno-ink);
  font-size: clamp(18px, 1.7vw, 24px);
  font-weight: 750;
  letter-spacing: -.02em;
}

.app-shell #view-calendar .calendar-toolbar span {
  color: var(--esno-muted);
  font-size: 12px;
}

.app-shell #view-calendar #calendarTodayBtn {
  width: auto;
  min-width: 88px;
  padding-inline: 16px;
  font-size: 13px;
  font-weight: 750;
}

.app-shell #view-calendar .calendar-view-toggle {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(74px, 1fr));
  gap: 0;
  justify-self: end;
  overflow: hidden;
  border: 1px solid var(--esno-line);
  border-radius: var(--esno-radius-control);
  background: var(--esno-surface);
}

.app-shell #view-calendar .calendar-view-toggle button {
  min-height: 42px;
  padding: 8px 14px;
  border-radius: 0;
  background: transparent;
  color: var(--esno-muted);
  font-weight: 750;
}

.app-shell #view-calendar .calendar-view-toggle button.active {
  background: var(--esno-blue);
  color: #fff;
}

.app-shell #view-calendar .calendar-type-strip {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 12px 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  border-bottom: 1px solid var(--esno-line);
  scrollbar-width: thin;
}

.app-shell #view-calendar .calendar-type-strip > div {
  display: flex;
  gap: 7px;
}

.app-shell #view-calendar .calendar-filter-chip {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 6px 11px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--esno-blue-soft);
  color: var(--esno-blue);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.app-shell #view-calendar .calendar-filter-chip:hover {
  border-color: color-mix(in srgb, var(--esno-blue) 40%, var(--esno-line));
}

.app-shell #view-calendar .calendar-filter-chip.active {
  border-color: var(--esno-blue);
  background: var(--esno-blue);
  color: #fff;
}

.app-shell #view-calendar .calendar-weekdays,
.app-shell #view-calendar .calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  min-width: 0;
}

.app-shell #view-calendar .calendar-weekdays {
  border-right: 1px solid var(--esno-line);
  border-bottom: 1px solid var(--esno-line);
  border-left: 1px solid var(--esno-line);
  background: var(--esno-surface-muted);
}

.app-shell #view-calendar .calendar-weekdays > span,
.app-shell #view-calendar .calendar-weekday-cell {
  min-width: 0;
  padding: 11px 8px;
  border-right: 1px solid var(--esno-line);
  color: var(--esno-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .05em;
  text-align: center;
  text-transform: uppercase;
}

.app-shell #view-calendar .calendar-weekdays > :last-child,
.app-shell #view-calendar .calendar-weekday-cell:last-child {
  border-right: 0;
}

.app-shell #view-calendar .calendar-grid:not(.calendar-grid-week) {
  border-right: 1px solid var(--esno-line);
  border-bottom: 1px solid var(--esno-line);
  border-left: 1px solid var(--esno-line);
}

.app-shell #view-calendar .calendar-day {
  position: relative;
  min-height: clamp(104px, 10vw, 146px);
  padding: 9px;
  border: 0;
  border-right: 1px solid var(--esno-line);
  border-bottom: 1px solid var(--esno-line);
  border-radius: 0;
  background: var(--esno-surface);
  color: var(--esno-ink);
  transition: background var(--esno-motion-fast) var(--esno-ease), box-shadow var(--esno-motion-fast) var(--esno-ease);
}

.app-shell #view-calendar .calendar-day:nth-child(7n) {
  border-right: 0;
}

.app-shell #view-calendar .calendar-day:hover {
  background: var(--esno-surface-muted);
  box-shadow: inset 0 0 0 1px var(--esno-blue);
}

.app-shell #view-calendar .calendar-day.selected {
  background: var(--esno-blue-soft);
  box-shadow: inset 0 0 0 2px var(--esno-blue);
}

.app-shell #view-calendar .calendar-day.outside {
  background: color-mix(in srgb, var(--esno-surface-muted) 82%, var(--esno-canvas));
  color: var(--esno-muted);
}

.app-shell #view-calendar .calendar-day-number {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: inherit;
  font-size: 12px;
  font-weight: 800;
}

.app-shell #view-calendar .calendar-day.today .calendar-day-number {
  background: var(--esno-blue);
  color: #fff;
}

.app-shell #view-calendar .calendar-day-events {
  gap: 4px;
  min-width: 0;
}

.app-shell #view-calendar .calendar-chip,
.app-shell #view-calendar .calendar-week-all-day-event,
.app-shell #view-calendar .calendar-week-event {
  min-width: 0;
  border: 1px solid color-mix(in srgb, var(--esno-blue) 24%, var(--esno-line));
  border-left: 3px solid var(--esno-blue);
  border-radius: 7px;
  background: var(--esno-blue-soft);
  color: var(--esno-blue);
  font-size: 11px;
  font-weight: 750;
}

.app-shell #view-calendar .calendar-chip {
  padding: 4px 6px;
}

.app-shell #view-calendar .calendar-chip-reminder {
  border-color: color-mix(in srgb, var(--esno-warning) 30%, var(--esno-line));
  border-left-color: var(--esno-warning);
  background: var(--esno-warning-soft);
  color: var(--esno-warning);
}

.app-shell #view-calendar .calendar-chip-task {
  border-color: color-mix(in srgb, var(--esno-success) 30%, var(--esno-line));
  border-left-color: var(--esno-success);
  background: var(--esno-success-soft);
  color: var(--esno-success);
}

.app-shell #view-calendar .calendar-chip.done,
.app-shell #view-calendar .calendar-week-event.done,
.app-shell #view-calendar .calendar-week-all-day-event.done {
  text-decoration: line-through;
  opacity: .68;
}

.app-shell #view-calendar .calendar-weekdays-week,
.app-shell #view-calendar .calendar-grid-week {
  grid-template-columns: 72px repeat(7, minmax(128px, 1fr));
  min-width: 980px;
}

.app-shell #view-calendar .calendar-grid-week {
  max-height: min(70vh, 760px);
  overflow: auto;
  border: 1px solid var(--esno-line);
  border-top: 0;
  scrollbar-gutter: stable;
}

.app-shell #view-calendar .calendar-grid-week .calendar-week-time-axis,
.app-shell #view-calendar .calendar-grid-week .calendar-week-day {
  border-color: var(--esno-line);
  background: var(--esno-surface);
}

.app-shell #view-calendar .calendar-week-time-axis span,
.app-shell #view-calendar .calendar-week-slots {
  border-color: var(--esno-line);
}

/* Calendar editor retains the existing focus and save lifecycle. */
.app-shell #calendarEventModal .modal-backdrop {
  background: var(--esno-scrim);
}

.app-shell #calendarEventModal .calendar-dialog {
  width: min(1020px, calc(100vw - 48px));
  height: min(900px, calc(100dvh - 56px));
  max-height: calc(100dvh - 56px);
  border: 1px solid var(--esno-line);
  border-radius: var(--esno-radius-panel);
  background: var(--esno-surface);
  color: var(--esno-ink);
  box-shadow: var(--esno-shadow-overlay);
}

.app-shell #calendarEventModal .calendar-modal-head {
  padding: 18px 20px;
  border-color: var(--esno-line);
  background: var(--esno-surface);
}

.app-shell #calendarEventModal .modal-eyebrow {
  color: var(--esno-blue);
}

.app-shell #calendarEventModal .calendar-modal-head h2 {
  color: var(--esno-ink);
  font-size: 22px;
  letter-spacing: -.02em;
}

.app-shell #calendarEventModal .calendar-modal-head p {
  color: var(--esno-muted);
}

.app-shell #calendarEventModal .calendar-scheduler {
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, .75fr);
  background: var(--esno-canvas);
}

.app-shell #calendarEventModal .calendar-activity-form {
  gap: 14px;
  padding: 20px;
  border-color: var(--esno-line);
  background: var(--esno-surface);
}

.app-shell #calendarEventModal :is(input, select, textarea) {
  min-height: 44px;
  border: 1px solid var(--esno-control-line);
  border-radius: var(--esno-radius-control);
  background: var(--esno-surface);
  color: var(--esno-ink);
}

.app-shell #calendarEventModal .calendar-title-input {
  min-height: 50px;
  font-size: 20px;
}

.app-shell #calendarEventModal .calendar-activity-buttons {
  gap: 6px;
}

.app-shell #calendarEventModal .calendar-activity-type-button {
  min-width: 44px;
  min-height: 40px;
  border: 1px solid var(--esno-line);
  border-radius: 9px;
  background: var(--esno-surface);
  color: var(--esno-copy);
}

.app-shell #calendarEventModal .calendar-activity-type-button.active {
  border-color: var(--esno-blue);
  background: var(--esno-blue-soft);
  color: var(--esno-blue);
  box-shadow: inset 0 0 0 1px var(--esno-blue);
}

.app-shell #calendarEventModal .calendar-linked-line {
  color: var(--esno-muted);
  font-size: 13px;
}

.app-shell #calendarEventModal .calendar-activity-form textarea[name="notes"] {
  min-height: 112px;
  background: var(--esno-surface);
}

.app-shell #calendarEventModal .calendar-team-field {
  padding: 14px;
  border: 1px solid var(--esno-line);
  border-radius: var(--esno-radius-card);
  background: var(--esno-surface-muted);
}

.app-shell #calendarEventModal .calendar-member-option {
  min-height: 44px;
  border-color: var(--esno-line);
  background: var(--esno-surface);
}

.app-shell #calendarEventModal .calendar-member-option:has(input:checked) {
  border-color: var(--esno-blue);
  background: var(--esno-blue-soft);
}

.app-shell #calendarEventModal .calendar-day-preview {
  background: var(--esno-surface-muted);
}

.app-shell #calendarEventModal .calendar-preview-head,
.app-shell #calendarEventModal .calendar-modal-actions {
  border-color: var(--esno-line);
  background: var(--esno-surface);
}

.app-shell #calendarEventModal .calendar-preview-item {
  border: 1px solid var(--esno-line);
  border-left: 4px solid var(--esno-blue);
  border-radius: 10px;
  background: var(--esno-surface);
  color: var(--esno-ink);
}

/* --------------------------------------------------------------------------
   Pipeline and project board
   -------------------------------------------------------------------------- */

.app-shell :is(#view-pipeline, #view-projects).crm-board-view.active {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.app-shell :is(#view-pipeline, #view-projects) .crm-board-hero {
  display: grid;
  grid-template-columns: minmax(250px, .82fr) minmax(500px, 1.18fr);
  align-items: end;
  gap: 24px;
  padding: 22px 24px;
  border: 1px solid var(--esno-line);
  border-radius: var(--esno-radius-panel);
  background: var(--esno-surface);
  box-shadow: var(--esno-shadow-card);
}

.app-shell :is(#view-pipeline, #view-projects) .crm-board-eyebrow {
  color: var(--esno-blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.app-shell :is(#view-pipeline, #view-projects) .crm-board-hero h2 {
  margin: 5px 0 0;
  color: var(--esno-ink);
  font-size: clamp(24px, 2vw, 32px);
  font-weight: 750;
  letter-spacing: -.03em;
}

.app-shell :is(#view-pipeline, #view-projects) .crm-board-hero p {
  max-width: 620px;
  margin: 8px 0 0;
  color: var(--esno-muted);
  font-size: 14px;
  line-height: 1.5;
}

.app-shell :is(#view-pipeline, #view-projects) .crm-board-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.app-shell :is(#view-pipeline, #view-projects) .crm-board-metrics > span {
  display: grid;
  align-content: center;
  gap: 3px;
  min-width: 0;
  min-height: 78px;
  padding: 12px 13px;
  border: 1px solid var(--esno-line);
  border-left: 4px solid var(--esno-blue);
  border-radius: 11px;
  background: var(--esno-surface-muted);
}

.app-shell :is(#view-pipeline, #view-projects) .crm-board-metrics > span:nth-child(2) {
  border-left-color: var(--esno-yellow);
}

.app-shell :is(#view-pipeline, #view-projects) .crm-board-metrics > span:nth-child(4) {
  border-left-color: var(--esno-success);
}

.app-shell :is(#view-pipeline, #view-projects) .crm-board-metrics > span.needs-attention {
  border-color: color-mix(in srgb, var(--esno-warning) 34%, var(--esno-line));
  border-left-color: var(--esno-warning);
  background: var(--esno-warning-soft);
}

.app-shell :is(#view-pipeline, #view-projects) .crm-board-metrics strong {
  overflow: hidden;
  color: var(--esno-ink);
  font-size: clamp(17px, 1.5vw, 23px);
  font-weight: 750;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-shell :is(#view-pipeline, #view-projects) .crm-board-metrics small {
  overflow: hidden;
  color: var(--esno-muted);
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-shell :is(#view-pipeline, #view-projects) .crm-board-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(170px, .35fr) minmax(180px, .38fr) auto;
  align-items: end;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--esno-line);
  border-radius: var(--esno-radius-card);
  background: var(--esno-surface);
  box-shadow: 0 6px 18px rgb(16 43 56 / 4%);
}

.app-shell :is(#view-pipeline, #view-projects) .crm-board-toolbar label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--esno-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.app-shell :is(#view-pipeline, #view-projects) .crm-board-toolbar :is(input, select) {
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--esno-control-line);
  border-radius: var(--esno-radius-control);
  background-color: var(--esno-surface);
  color: var(--esno-ink);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
}

.app-shell :is(#view-pipeline, #view-projects) .crm-board-search input {
  padding-left: 40px;
  background-color: var(--esno-surface);
}

.app-shell :is(#view-pipeline, #view-projects) .crm-board-result {
  align-self: center;
  justify-self: end;
  padding: 23px 3px 0 8px;
  color: var(--esno-muted);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.app-shell :is(#view-pipeline, #view-projects) .pipeline-board {
  display: grid;
  grid-template-columns: repeat(7, minmax(286px, 1fr));
  gap: 12px;
  min-width: 0;
  padding: 2px 2px 15px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-padding-inline: 2px;
  scrollbar-color: color-mix(in srgb, var(--esno-blue) 42%, var(--esno-line)) transparent;
  scrollbar-width: thin;
}

.app-shell :is(#view-pipeline, #view-projects) .pipeline-column {
  --stage-accent: var(--esno-blue);
  min-width: 0;
  min-height: clamp(470px, 62vh, 680px);
  overflow: clip;
  border: 1px solid var(--esno-line);
  border-top: 4px solid var(--stage-accent);
  border-radius: var(--esno-radius-card);
  background: color-mix(in srgb, var(--esno-surface-muted) 86%, var(--esno-canvas));
  box-shadow: 0 5px 18px rgb(16 43 56 / 4%);
}

.app-shell :is(#view-pipeline, #view-projects) .pipeline-column-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 72px;
  padding: 12px;
  border-bottom: 1px solid var(--esno-line);
  background: var(--esno-surface);
}

.app-shell :is(#view-pipeline, #view-projects) .pipeline-stage-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid color-mix(in srgb, var(--stage-accent) 42%, var(--esno-line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--stage-accent) 10%, var(--esno-surface));
  color: var(--stage-accent);
  font-family: inherit;
  font-size: 11px;
  font-weight: 850;
}

.app-shell #view-projects .project-stage-in_montage .pipeline-stage-icon {
  font-size: 0;
}

.app-shell #view-projects .project-stage-in_montage .pipeline-stage-icon::before {
  content: "M";
  font-size: 11px;
}

.app-shell :is(#view-pipeline, #view-projects) .pipeline-column-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.app-shell :is(#view-pipeline, #view-projects) .pipeline-column-title strong {
  overflow: hidden;
  color: var(--esno-ink);
  font-size: 13px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-shell :is(#view-pipeline, #view-projects) .pipeline-column-title small {
  color: var(--esno-muted);
  font-size: 11px;
  font-weight: 650;
}

.app-shell :is(#view-pipeline, #view-projects) .pipeline-column-head em {
  min-width: 28px;
  padding: 4px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--stage-accent) 12%, var(--esno-surface));
  color: var(--stage-accent);
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
  text-align: center;
}

.app-shell :is(#view-pipeline, #view-projects) .pipeline-card-stack {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 390px;
  padding: 10px;
}

.app-shell :is(#view-pipeline, #view-projects) .pipeline-empty {
  display: grid;
  place-items: center;
  min-height: 104px;
  padding: 18px;
  border: 1px dashed var(--esno-line);
  border-radius: 11px;
  background: color-mix(in srgb, var(--esno-surface) 62%, transparent);
  color: var(--esno-muted);
  font-size: 12px;
  text-align: center;
}

.app-shell :is(#view-pipeline, #view-projects) .lead-card {
  position: relative;
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--esno-line);
  border-left: 3px solid var(--stage-accent);
  border-radius: 12px;
  background: var(--esno-surface);
  color: var(--esno-ink);
  box-shadow: 0 4px 14px rgb(16 43 56 / 5%);
  transition: transform var(--esno-motion-fast) var(--esno-ease), border-color var(--esno-motion-fast) var(--esno-ease), box-shadow var(--esno-motion-fast) var(--esno-ease);
}

.app-shell :is(#view-pipeline, #view-projects) .lead-card:hover {
  border-color: color-mix(in srgb, var(--esno-blue) 38%, var(--esno-line));
  border-left-color: var(--stage-accent);
  box-shadow: 0 10px 24px rgb(16 43 56 / 9%);
  transform: translateY(-1px);
}

.app-shell :is(#view-pipeline, #view-projects) .lead-card.attention-required {
  border-color: color-mix(in srgb, var(--esno-warning) 45%, var(--esno-line));
  border-left-color: var(--esno-warning);
  background: color-mix(in srgb, var(--esno-warning-soft) 38%, var(--esno-surface));
}

.app-shell :is(#view-pipeline, #view-projects) .lead-card-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.app-shell :is(#view-pipeline, #view-projects) .lead-card-top > strong {
  overflow: hidden;
  color: var(--esno-ink);
  font-size: 12px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-shell :is(#view-pipeline, #view-projects) .drag-handle,
.app-shell :is(#view-pipeline, #view-projects) .crm-readonly-mark {
  color: var(--esno-muted);
}

.app-shell #view-pipeline .lead-card-toggle {
  display: grid;
  place-items: center;
  width: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border: 1px solid var(--esno-line);
  border-radius: 9px;
  background: var(--esno-surface);
  color: var(--esno-copy);
}

.app-shell :is(#view-pipeline, #view-projects) .crm-card-value-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.app-shell :is(#view-pipeline, #view-projects) .crm-card-value-row h3 {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--esno-ink);
  font-size: 15px;
  font-weight: 750;
  line-height: 1.3;
}

.app-shell :is(#view-pipeline, #view-projects) .crm-card-value-row > strong {
  flex: 0 0 auto;
  color: var(--esno-blue);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.app-shell :is(#view-pipeline, #view-projects) .lead-address,
.app-shell :is(#view-pipeline, #view-projects) .row-sub {
  overflow-wrap: anywhere;
  color: var(--esno-muted);
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-line;
}

.app-shell :is(#view-pipeline, #view-projects) .attention-badge {
  width: fit-content;
  max-width: 100%;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--esno-warning-soft);
  color: var(--esno-warning);
  font-size: 10px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.app-shell #view-pipeline .crm-card-next {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  padding: 9px;
  border-radius: 10px;
  background: var(--esno-blue-soft);
  color: var(--esno-blue);
}

.app-shell #view-pipeline .crm-card-next.overdue {
  background: var(--esno-warning-soft);
  color: var(--esno-warning);
}

.app-shell #view-pipeline .crm-card-next > span:last-child {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.app-shell #view-pipeline .crm-card-next small {
  color: var(--esno-muted);
  font-size: 9px;
}

.app-shell #view-pipeline .crm-card-next strong {
  overflow: hidden;
  color: var(--esno-ink);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-shell :is(#view-pipeline, #view-projects) .crm-card-footer,
.app-shell #view-projects .project-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--esno-muted);
  font-size: 10px;
}

.app-shell :is(#view-pipeline, #view-projects) .crm-avatar {
  border-color: var(--esno-surface);
  background: var(--esno-nav);
}

.app-shell :is(#view-pipeline, #view-projects) .crm-avatar:nth-child(2) {
  background: var(--esno-blue);
}

.app-shell :is(#view-pipeline, #view-projects) .crm-avatar:nth-child(3) {
  background: var(--esno-success);
}

.app-shell :is(#view-pipeline, #view-projects) .crm-avatar-more {
  background: var(--esno-surface-muted);
  color: var(--esno-ink);
}

.app-shell :is(#view-pipeline, #view-projects) .lead-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.app-shell :is(#view-pipeline, #view-projects) .lead-card-meta > span {
  max-width: 100%;
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--esno-surface-muted);
  color: var(--esno-copy);
  font-size: 10px;
  overflow-wrap: anywhere;
}

.app-shell :is(#view-pipeline, #view-projects) .lead-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--esno-line);
}

.app-shell :is(#view-pipeline, #view-projects) .lead-card-actions button,
.app-shell :is(#view-pipeline, #view-projects) .lead-card-actions select {
  min-height: 38px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 750;
}

.app-shell :is(#view-pipeline, #view-projects) .lead-card-actions .ghost {
  border: 1px solid var(--esno-line);
  background: var(--esno-surface);
  color: var(--esno-ink);
}

.app-shell :is(#view-pipeline, #view-projects) .lead-card-actions .primary {
  border: 1px solid var(--esno-primary);
  background: var(--esno-primary);
  color: #fff;
}

[data-theme="dark"] .app-shell :is(#view-pipeline, #view-projects) .lead-card-actions .primary {
  color: var(--esno-nav-deep);
}

.app-shell :is(#view-pipeline, #view-projects) .lead-card-actions .danger {
  border: 1px solid color-mix(in srgb, var(--esno-danger) 36%, var(--esno-line));
  background: var(--esno-danger-soft);
  color: var(--esno-danger);
}

.app-shell :is(#view-pipeline, #view-projects) .crm-stage-select {
  flex: 1 1 100%;
}

.app-shell :is(#view-pipeline, #view-projects) .crm-stage-select select {
  width: 100%;
  border: 1px solid var(--esno-control-line);
  background: var(--esno-surface);
  color: var(--esno-ink);
}

.app-shell #view-projects .project-health {
  margin-left: auto;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--esno-success-soft);
  color: var(--esno-success);
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

.app-shell #view-projects .project-health-attention {
  background: var(--esno-warning-soft);
  color: var(--esno-warning);
}

.app-shell #view-projects .project-health-risk {
  background: var(--esno-danger-soft);
  color: var(--esno-danger);
}

.app-shell #view-projects .project-health-done {
  background: var(--esno-surface-muted);
  color: var(--esno-muted);
}

.app-shell #view-projects .project-progress {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--esno-surface-muted);
}

.app-shell #view-projects .project-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--esno-blue);
}

.app-shell :is(#view-pipeline, #view-projects) .pipeline-column.drag-over {
  border-color: var(--stage-accent);
  background: color-mix(in srgb, var(--stage-accent) 7%, var(--esno-surface));
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--stage-accent) 34%, transparent);
}

.app-shell :is(#view-pipeline, #view-projects) .lead-card.dragging {
  opacity: .58;
  transform: scale(.985);
}

/* --------------------------------------------------------------------------
   Project drawer
   -------------------------------------------------------------------------- */

.app-shell #projectModal {
  place-items: stretch end;
  padding: 12px 0 12px 12px;
}

.app-shell #projectModal .modal-backdrop {
  background: var(--esno-scrim);
}

.app-shell #projectModal .project-dialog.crm-record-dialog {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(980px, calc(100vw - 32px));
  height: calc(100dvh - 24px);
  max-height: none;
  overflow: hidden;
  border: 1px solid var(--esno-line);
  border-right: 0;
  border-radius: var(--esno-radius-panel) 0 0 var(--esno-radius-panel);
  background: var(--esno-canvas);
  color: var(--esno-ink);
  box-shadow: var(--esno-shadow-overlay);
  animation: esno-project-drawer-in var(--esno-motion-panel) var(--esno-ease) both;
}

.app-shell #projectModal .crm-record-head {
  position: relative;
  top: auto;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--esno-line);
  background: var(--esno-surface);
}

.app-shell #projectModal .crm-record-head > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.app-shell #projectModal .crm-record-head h2 {
  color: var(--esno-ink);
  font-size: clamp(21px, 2.2vw, 28px);
  font-weight: 750;
  letter-spacing: -.025em;
  overflow-wrap: anywhere;
}

.app-shell #projectModal .crm-record-head p {
  max-width: 620px;
  color: var(--esno-muted);
  font-size: 13px;
  line-height: 1.45;
}

.app-shell #projectModal .modal-eyebrow,
.app-shell #projectModal .project-panel-head .eyebrow {
  color: var(--esno-blue);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.app-shell #projectModal .crm-record-head > button {
  flex: 0 0 auto;
  border: 1px solid var(--esno-line);
  background: var(--esno-surface);
  color: var(--esno-ink);
}

.app-shell #projectModal .project-workspace-tabs {
  position: relative;
  top: auto;
  z-index: 2;
  display: flex;
  gap: 5px;
  min-width: 0;
  padding: 8px 24px;
  overflow-x: auto;
  border-bottom: 1px solid var(--esno-line);
  background: var(--esno-surface);
  scrollbar-width: thin;
}

.app-shell #projectModal .project-workspace-tabs button {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--esno-copy);
  font-size: 12px;
  font-weight: 750;
}

.app-shell #projectModal .project-workspace-tabs button:hover:not(:disabled) {
  background: var(--esno-surface-muted);
}

.app-shell #projectModal .project-workspace-tabs button.active {
  border-color: var(--esno-primary);
  background: var(--esno-primary);
  color: #fff;
}

[data-theme="dark"] .app-shell #projectModal .project-workspace-tabs button.active {
  color: var(--esno-nav-deep);
}

.app-shell #projectModal .project-workspace-tabs button:disabled {
  opacity: .48;
}

.app-shell #projectModal .project-workspace-panel {
  min-height: 0;
  padding: 22px 24px 30px;
  overflow: auto;
  background: var(--esno-canvas);
  scrollbar-gutter: stable;
}

.app-shell #projectModal .project-workspace-panel.hidden {
  display: none;
}

.app-shell #projectModal #projectForm,
.app-shell #projectModal .project-panel-head,
.app-shell #projectModal .workforce-balance-cards,
.app-shell #projectModal .workforce-table-wrap,
.app-shell #projectModal .project-image-dropzone,
.app-shell #projectModal .project-image-card,
.app-shell #projectModal .project-acceptance-form,
.app-shell #projectModal .project-report-section {
  border-color: var(--esno-line);
}

.app-shell #projectModal #projectForm {
  --project-form-padding: clamp(17px, 2vw, 24px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: var(--project-form-padding);
  border: 1px solid var(--esno-line);
  border-radius: var(--esno-radius-panel);
  background: var(--esno-surface);
  box-shadow: var(--esno-shadow-card);
}

.app-shell #projectModal #projectForm > label,
.app-shell #projectModal .project-acceptance-form label,
.app-shell #projectModal .project-signature-card > label {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
  color: var(--esno-copy);
  font-size: 12px;
  font-weight: 750;
}

.app-shell #projectModal :is(input, select, textarea) {
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--esno-control-line);
  border-radius: var(--esno-radius-control);
  background: var(--esno-surface);
  color: var(--esno-ink);
}

.app-shell #projectModal select[multiple] {
  min-height: 126px;
}

.app-shell #projectModal textarea {
  min-height: 116px;
  resize: vertical;
}

.app-shell #projectModal #projectForm > .action-row {
  position: sticky;
  bottom: -30px;
  z-index: 2;
  margin: 6px calc(-1 * var(--project-form-padding)) calc(-1 * var(--project-form-padding));
  padding: 14px var(--project-form-padding);
  border-top: 1px solid var(--esno-line);
  background: var(--esno-surface);
}

.app-shell #projectModal .project-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding: 18px 20px;
  border: 1px solid var(--esno-line);
  border-radius: var(--esno-radius-card);
  background: var(--esno-surface);
}

.app-shell #projectModal .project-panel-head h3 {
  margin: 3px 0 0;
  color: var(--esno-ink);
  font-size: 20px;
  letter-spacing: -.015em;
}

.app-shell #projectModal .project-panel-head p:not(.eyebrow) {
  margin: 5px 0 0;
  color: var(--esno-muted);
  font-size: 13px;
  line-height: 1.5;
}

.app-shell #projectModal .workforce-balance-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.app-shell #projectModal .workforce-balance-cards > span {
  display: grid;
  gap: 3px;
  padding: 14px;
  border: 1px solid var(--esno-line);
  border-radius: var(--esno-radius-card);
  background: var(--esno-surface);
}

.app-shell #projectModal .workforce-balance-cards small {
  color: var(--esno-muted);
}

.app-shell #projectModal .workforce-balance-cards strong {
  color: var(--esno-ink);
  font-size: 20px;
}

.app-shell #projectModal .workforce-table-wrap {
  overflow: auto;
  border: 1px solid var(--esno-line);
  border-radius: var(--esno-radius-card);
  background: var(--esno-surface);
}

.app-shell #projectModal .workforce-table th {
  color: var(--esno-muted);
  background: var(--esno-surface-muted);
}

.app-shell #projectModal .workforce-table td {
  border-color: var(--esno-line);
  color: var(--esno-copy);
}

.app-shell #projectModal .project-image-upload-button {
  min-height: 44px;
  border: 1px solid var(--esno-primary);
  border-radius: var(--esno-radius-control);
  background: var(--esno-primary);
  color: #fff;
}

[data-theme="dark"] .app-shell #projectModal .project-image-upload-button {
  color: var(--esno-nav-deep);
}

.app-shell #projectModal .project-image-dropzone {
  min-height: 132px;
  border: 1px dashed var(--esno-control-line);
  border-radius: var(--esno-radius-panel);
  background: var(--esno-surface);
  color: var(--esno-copy);
}

.app-shell #projectModal .project-image-dropzone:hover,
.app-shell #projectModal .project-image-dropzone.drag-over {
  border-color: var(--esno-blue);
  background: var(--esno-blue-soft);
}

.app-shell #projectModal .project-image-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.app-shell #projectModal .project-image-card {
  border: 1px solid var(--esno-line);
  border-radius: var(--esno-radius-card);
  background: var(--esno-surface);
  box-shadow: 0 6px 18px rgb(16 43 56 / 5%);
}

.app-shell #projectModal .project-image-preview {
  background: var(--esno-surface-muted);
}

.app-shell #projectModal .project-acceptance-form {
  display: grid;
  gap: 18px;
  padding: clamp(17px, 2vw, 24px);
  border: 1px solid var(--esno-line);
  border-radius: var(--esno-radius-panel);
  background: var(--esno-surface);
  box-shadow: var(--esno-shadow-card);
}

.app-shell #projectModal .project-acceptance-meta,
.app-shell #projectModal .project-signature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.app-shell #projectModal .project-acceptance-options {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.app-shell #projectModal .project-acceptance-options legend {
  margin-bottom: 9px;
  color: var(--esno-ink);
  font-size: 13px;
  font-weight: 750;
}

.app-shell #projectModal .project-acceptance-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--esno-line);
  border-radius: var(--esno-radius-card);
  background: var(--esno-surface-muted);
  color: var(--esno-copy);
}

.app-shell #projectModal .project-acceptance-option:has(input:checked) {
  border-color: var(--esno-blue);
  background: var(--esno-blue-soft);
  box-shadow: inset 0 0 0 1px var(--esno-blue);
}

.app-shell #projectModal .project-acceptance-option.success:has(input:checked) {
  border-color: var(--esno-success-line);
  background: var(--esno-success-soft);
}

.app-shell #projectModal .project-acceptance-option.damage:has(input:checked) {
  border-color: color-mix(in srgb, var(--esno-danger) 48%, var(--esno-line));
  background: var(--esno-danger-soft);
}

.app-shell #projectModal .project-acceptance-option input {
  width: 20px;
  min-height: 20px;
  margin-top: 2px;
  accent-color: var(--esno-blue);
}

.app-shell #projectModal .project-signature-card {
  padding: 16px;
  border: 1px solid var(--esno-line);
  border-radius: var(--esno-radius-card);
  background: var(--esno-surface-muted);
}

.app-shell #projectModal .project-signature-canvas {
  border: 1px solid var(--esno-control-line);
  border-radius: var(--esno-radius-control);
  background: #fff;
}

.app-shell #projectModal .project-report-section {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--esno-line);
  border-radius: var(--esno-radius-panel);
  background: var(--esno-surface);
}

.app-shell #projectModal .project-report-item {
  border-color: var(--esno-line);
  border-radius: var(--esno-radius-control);
  background: var(--esno-surface-muted);
}

.app-shell #projectModal .action-row .primary,
.app-shell #projectModal .project-acceptance-actions .primary {
  border: 1px solid var(--esno-primary);
  background: var(--esno-primary);
  color: #fff;
}

[data-theme="dark"] .app-shell #projectModal .action-row .primary,
[data-theme="dark"] .app-shell #projectModal .project-acceptance-actions .primary {
  color: var(--esno-nav-deep);
}

.app-shell #projectModal .action-row .ghost,
.app-shell #projectModal .project-acceptance-actions .ghost {
  border: 1px solid var(--esno-line);
  background: var(--esno-surface);
  color: var(--esno-ink);
}

@keyframes esno-project-drawer-in {
  from {
    opacity: 0;
    transform: translateX(10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* --------------------------------------------------------------------------
   Responsive behavior
   -------------------------------------------------------------------------- */

@media (max-width: 1280px) {
  .app-shell :is(#view-pipeline, #view-projects) .crm-board-hero {
    grid-template-columns: 1fr;
  }

  .app-shell :is(#view-pipeline, #view-projects) .crm-board-toolbar {
    grid-template-columns: minmax(220px, 1fr) repeat(2, minmax(150px, .45fr));
  }

  .app-shell :is(#view-pipeline, #view-projects) .crm-board-result {
    grid-column: 1 / -1;
    justify-self: start;
    padding: 0 2px;
  }
}

@media (max-width: 980px) {
  .app-shell #view-calendar .calendar-scope-control {
    grid-template-columns: max-content minmax(220px, 1fr);
  }

  .app-shell #view-calendar .calendar-scope-control > label {
    grid-column: 1 / -1;
  }

  .app-shell #view-calendar .calendar-panel {
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }

  .app-shell #view-calendar .calendar-weekdays:not(.calendar-weekdays-week),
  .app-shell #view-calendar .calendar-grid:not(.calendar-grid-week) {
    min-width: 760px;
  }

  .app-shell #calendarEventModal .calendar-scheduler {
    grid-template-columns: minmax(0, 1fr) minmax(250px, .62fr);
  }

  .app-shell #calendarEventModal .calendar-field-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-shell #calendarEventModal .calendar-time-separator {
    display: none;
  }

  .app-shell :is(#view-pipeline, #view-projects) .crm-board-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-shell :is(#view-pipeline, #view-projects) .pipeline-board {
    grid-template-columns: repeat(7, minmax(280px, calc(52vw - 18px)));
    scroll-snap-type: x proximity;
  }

  .app-shell :is(#view-pipeline, #view-projects) .pipeline-column {
    scroll-snap-align: start;
  }
}

@media (max-width: 720px) {
  .app-shell #view-calendar .calendar-panel {
    padding: 12px;
    border-radius: var(--esno-radius-card);
  }

  .app-shell #view-calendar .calendar-scope-control {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 9px;
    padding: 11px;
  }

  .app-shell #view-calendar .calendar-scope-toggle {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .app-shell #view-calendar .calendar-scope-control > label {
    grid-column: auto;
    grid-template-columns: 1fr;
  }

  .app-shell #view-calendar .calendar-toolbar {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
  }

  .app-shell #view-calendar #calendarTodayBtn,
  .app-shell #view-calendar .calendar-view-toggle {
    grid-column: auto / span 1;
  }

  .app-shell #view-calendar #calendarTodayBtn {
    grid-column: 1 / 2;
    width: 100%;
  }

  .app-shell #view-calendar .calendar-view-toggle {
    grid-column: 2 / 4;
    justify-self: stretch;
  }

  .app-shell #calendarEventModal {
    place-items: stretch;
    padding: 0;
  }

  .app-shell #calendarEventModal .calendar-dialog {
    width: 100vw;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .app-shell #calendarEventModal .calendar-scheduler {
    grid-template-columns: 1fr;
  }

  .app-shell #calendarEventModal .calendar-day-preview {
    display: none;
  }

  .app-shell #calendarEventModal .calendar-activity-form {
    border-right: 0;
  }

  .app-shell :is(#view-pipeline, #view-projects) .crm-board-hero {
    gap: 16px;
    padding: 18px;
    border-radius: var(--esno-radius-card);
  }

  .app-shell :is(#view-pipeline, #view-projects) .crm-board-toolbar {
    grid-template-columns: 1fr;
  }

  .app-shell :is(#view-pipeline, #view-projects) .crm-board-result {
    grid-column: auto;
  }

  .app-shell :is(#view-pipeline, #view-projects) .pipeline-board {
    grid-template-columns: repeat(7, minmax(calc(100vw - 56px), 1fr));
    scroll-snap-type: x mandatory;
  }

  .app-shell #projectModal {
    padding: 0;
  }

  .app-shell #projectModal .project-dialog.crm-record-dialog {
    width: 100vw;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .app-shell #projectModal .crm-record-head {
    padding: 16px;
  }

  .app-shell #projectModal .project-workspace-tabs {
    padding-inline: 12px;
  }

  .app-shell #projectModal .project-workspace-panel {
    padding: 14px 12px calc(22px + env(safe-area-inset-bottom));
  }

  .app-shell #projectModal #projectForm {
    --project-form-padding: 16px;
    grid-template-columns: 1fr;
    padding: var(--project-form-padding);
    border-radius: var(--esno-radius-card);
  }

  .app-shell #projectModal #projectForm > .wide {
    grid-column: 1;
  }

  .app-shell #projectModal #projectForm > .action-row {
    bottom: calc(-22px - env(safe-area-inset-bottom));
    margin: 6px calc(-1 * var(--project-form-padding)) calc(-1 * var(--project-form-padding));
    padding: 12px var(--project-form-padding) calc(12px + env(safe-area-inset-bottom));
  }

  .app-shell #projectModal .project-panel-head {
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
  }

  .app-shell #projectModal .project-image-upload-button {
    justify-content: center;
  }

  .app-shell #projectModal .workforce-balance-cards,
  .app-shell #projectModal .project-acceptance-meta,
  .app-shell #projectModal .project-signature-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .app-shell #view-calendar .calendar-weekdays:not(.calendar-weekdays-week),
  .app-shell #view-calendar .calendar-grid:not(.calendar-grid-week) {
    min-width: 700px;
  }

  .app-shell #view-calendar .calendar-day {
    min-height: 96px;
  }

  .app-shell #calendarEventModal .calendar-modal-head {
    align-items: stretch;
    padding: 14px;
  }

  .app-shell #calendarEventModal .calendar-modal-head > button {
    width: 100%;
  }

  .app-shell #calendarEventModal .calendar-activity-form {
    padding: 14px 12px calc(18px + env(safe-area-inset-bottom));
  }

  .app-shell #calendarEventModal .calendar-field-row,
  .app-shell #calendarEventModal .calendar-field-row.compact {
    grid-template-columns: 1fr;
  }

  .app-shell #calendarEventModal .calendar-modal-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .app-shell #calendarEventModal .calendar-modal-actions .action-row,
  .app-shell #calendarEventModal .calendar-modal-actions button {
    width: 100%;
  }

  .app-shell :is(#view-pipeline, #view-projects) .crm-board-metrics {
    grid-template-columns: 1fr;
  }

  .app-shell :is(#view-pipeline, #view-projects) .crm-board-metrics > span {
    min-height: 68px;
  }

  .app-shell :is(#view-pipeline, #view-projects) .pipeline-board {
    grid-template-columns: repeat(7, minmax(calc(100vw - 42px), 1fr));
  }

  .app-shell :is(#view-pipeline, #view-projects) .lead-card-actions button {
    flex: 1 1 130px;
  }

  .app-shell #projectModal .crm-record-head {
    align-items: stretch;
    flex-direction: column;
  }

  .app-shell #projectModal .crm-record-head > button {
    width: 100%;
  }

  .app-shell #projectModal #projectForm > .action-row,
  .app-shell #projectModal .project-acceptance-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .app-shell #projectModal #projectForm > .action-row button,
  .app-shell #projectModal .project-acceptance-actions button {
    width: 100%;
  }
}

@media (max-width: 360px) {
  .app-shell #view-calendar .calendar-panel {
    padding-inline: 10px;
  }

  .app-shell #view-calendar .calendar-toolbar {
    gap: 6px;
  }

  .app-shell #view-calendar .calendar-toolbar h2 {
    font-size: 17px;
  }

  .app-shell :is(#view-pipeline, #view-projects) .crm-board-hero,
  .app-shell :is(#view-pipeline, #view-projects) .crm-board-toolbar {
    padding: 14px;
  }

  .app-shell :is(#view-pipeline, #view-projects) .pipeline-board {
    grid-template-columns: repeat(7, minmax(calc(100vw - 34px), 1fr));
  }

  .app-shell #projectModal .project-workspace-tabs button {
    padding-inline: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-shell :is(#view-calendar, #view-pipeline, #view-projects, #calendarEventModal, #projectModal) *,
  .app-shell :is(#view-calendar, #view-pipeline, #view-projects, #calendarEventModal, #projectModal) *::before,
  .app-shell :is(#view-calendar, #view-pipeline, #view-projects, #calendarEventModal, #projectModal) *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
