/* ======================================================
   PROCORE-INSPIRED DESIGN SYSTEM – CUSTOM PROPERTIES
   ====================================================== */
:root {
  --cmt-orange: #f44d00;
  --cmt-orange-light: rgba(244, 77, 0, 0.08);
  --cmt-orange-hover: #d94400;
  --cmt-navy: #1b2438;
  --cmt-surface: #f4f5f7;
  --cmt-card-radius: 0.75rem;
  --cmt-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --cmt-shadow: 0 4px 12px rgba(0, 0, 0, 0.07);
  --cmt-sidebar-font-size: 0.875rem;
}

img {
  object-fit: cover;
  max-height: 220px;
}

/* ======================================================
   LAYOUT
   ====================================================== */
.global-app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.global-sidebar {
  width: 240px;
  background: #fff;
  border-right: 1px solid var(--sidebar-border-color, var(--bs-border-color));
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.04);
  position: sticky;
  top: 0;
  height: 100vh;
  align-self: flex-start;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ======================================================
   SIDEBAR NAVIGATION
   ====================================================== */
.global-sidebar .nav-link {
  color: var(--sidebar-link-color, #5f6d7e);
  border-radius: 0.5rem;
  font-size: var(--cmt-sidebar-font-size);
  font-weight: 500;
  padding: 0.55rem 0.75rem;
  border-left: 3px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  line-height: 1.4;
}

.global-sidebar .nav-link i {
  font-size: 1rem;
  width: 1.1rem;
  text-align: center;
  opacity: 0.75;
}

.global-sidebar .nav-link:hover {
  background: var(--sidebar-link-hover-bg, #f1f3f5);
  color: var(--sidebar-link-hover-color, #1a1a2e);
}

.global-sidebar .nav-link:hover i {
  opacity: 1;
}

.global-sidebar .nav-link.active {
  background: var(--cmt-orange-light);
  color: var(--cmt-orange) !important;
  border-left-color: var(--cmt-orange);
  font-weight: 600;
}

.global-sidebar .nav-link.active i {
  opacity: 1;
  color: var(--cmt-orange);
}

/* Section labels */
.global-sidebar-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--sidebar-link-color, #9aa5b4);
  padding: 0.35rem 0.75rem 0.2rem;
  opacity: 0.75;
  user-select: none;
}

.global-sidebar .global-sidebar-brand {
  border-color: var(--sidebar-border-color, var(--bs-border-color)) !important;
}

.global-sidebar .global-brand-link {
  color: var(--sidebar-brand-color, var(--bs-dark));
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.global-sidebar .global-sidebar-admin-toggle {
  border: 0;
  background: transparent;
}

.global-sidebar .global-sidebar-admin-caret {
  font-size: 0.75rem;
  transition: transform 0.18s ease;
}

.global-sidebar .global-sidebar-admin-toggle[aria-expanded='true'] .global-sidebar-admin-caret {
  transform: rotate(180deg);
}

.global-sidebar .global-sidebar-sub-link {
  font-size: 0.85rem;
}

.global-sidebar .global-sidebar-user {
  border-color: var(--sidebar-border-color, var(--bs-border-color)) !important;
  color: var(--sidebar-link-color, var(--bs-secondary-color));
  font-size: 0.875rem;
}

.global-sidebar .global-sidebar-user-toggle {
  color: var(--sidebar-link-hover-color, var(--bs-dark));
  border: 1px solid var(--sidebar-border-color, var(--bs-border-color));
  background: transparent;
  font-size: 0.875rem;
}

.global-sidebar .global-sidebar-user-toggle:hover,
.global-sidebar .global-sidebar-user-toggle:focus {
  background: var(--sidebar-link-hover-bg, var(--bs-light));
  color: var(--sidebar-link-hover-color, var(--bs-dark));
  border-color: var(--sidebar-border-color, var(--bs-border-color));
}

.global-sidebar .global-sidebar-user .btn-outline-secondary {
  color: var(--sidebar-link-hover-color, var(--bs-dark));
  border-color: var(--sidebar-border-color, var(--bs-border-color));
  font-size: 0.8rem;
}

.global-sidebar .global-sidebar-user .btn-outline-secondary:hover {
  background: var(--sidebar-link-hover-bg, var(--bs-light));
  color: var(--sidebar-link-hover-color, var(--bs-dark));
  border-color: var(--sidebar-border-color, var(--bs-border-color));
}

.global-brand-link,
.global-navbar-brand {
  display: inline-flex;
  align-items: center;
}

.global-brand-logo {
  display: block;
  max-height: 38px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
}

.app-settings-logo-preview {
  max-height: 64px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
}

.app-settings-favicon-preview {
  height: 28px;
  width: 28px;
  object-fit: contain;
}

/* ======================================================
   MAIN CONTENT AREA
   ====================================================== */
.global-app-main {
  flex: 1;
  min-width: 0;
}

.global-top-header {
  z-index: 1020;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

.global-page-content {
  flex: 1 0 auto;
}

/* ======================================================
   DARK BACKGROUND SUPPORT
   ====================================================== */
.app-background-contrast-dark {
  color: #fff;
}

.app-background-contrast-dark .text-muted {
  color: rgba(255, 255, 255, 0.8) !important;
}

.app-background-contrast-dark a:not(.btn):not(.dropdown-item):not(.nav-link):not(.page-link) {
  color: #cfe2ff;
}

.app-background-contrast-dark .card,
.app-background-contrast-dark .modal-content,
.app-background-contrast-dark .dropdown-menu,
.app-background-contrast-dark .list-group-item,
.app-background-contrast-dark table,
.app-background-contrast-dark .table {
  color: var(--bs-body-color);
}

.app-background-contrast-dark .card .text-muted,
.app-background-contrast-dark .modal-content .text-muted,
.app-background-contrast-dark .dropdown-menu .text-muted,
.app-background-contrast-dark .list-group-item .text-muted,
.app-background-contrast-dark table .text-muted,
.app-background-contrast-dark .table .text-muted {
  color: var(--bs-secondary-color) !important;
}

/* ======================================================
   CARDS – PROCORE STYLE
   ====================================================== */
.card.shadow-sm {
  box-shadow: var(--cmt-shadow-sm) !important;
}

.card.rounded-3 {
  border-radius: var(--cmt-card-radius) !important;
}

/* House cards – floating grid tiles */
.house-card {
  background: #ffffff;
  border-radius: var(--cmt-card-radius);
  box-shadow: var(--cmt-shadow-sm);
  border: 1px solid rgba(15, 23, 42, 0.06);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  position: relative;
  overflow: hidden;
}

.house-card .card-body {
  padding: 1rem 1.1rem;
}

.house-card:hover,
.house-card:focus-within {
  transform: translateY(-4px);
  box-shadow: var(--cmt-shadow);
  border-color: rgba(15, 23, 42, 0.12);
}

.house-card .stretched-link::after {
  /* Ensure the stretched link doesn't hide inner content hover */
  z-index: 0;
}

.house-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #1e2b3a;
}

.card-header {
  font-size: 0.875rem;
}

.card-header strong {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e2b3a;
}

/* ======================================================
   STAT CARDS
   ====================================================== */
.stat-card .display-6 {
  font-weight: 800;
  line-height: 1.1;
  font-size: 2rem;
}

.stat-card .small {
  letter-spacing: 0.02em;
  font-weight: 500;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.stat-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border-radius: var(--cmt-card-radius) !important;
}

a .stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--cmt-shadow) !important;
}

/* Stat card orange top accent */
.stat-card::before {
  content: '';
  display: block;
  height: 3px;
  background: var(--cmt-orange);
  border-radius: var(--cmt-card-radius) var(--cmt-card-radius) 0 0;
  margin: 0;
}

.dashboard-page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

.dashboard-metric-link {
  color: inherit;
}

/* ======================================================
   PROJECT PLANNER
   ====================================================== */
.planner-alert-card {
  border-color: rgba(15, 23, 42, 0.08) !important;
}

.planner-board {
  --planner-cell-width: 24px;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: max-content;
  min-width: 980px;
}

.planner-board-scroller {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(23, 32, 51, 0.35) rgba(15, 23, 42, 0.08);
  padding-bottom: 0.1rem;
}

.planner-board-scroller::-webkit-scrollbar {
  height: 10px;
}

.planner-board-scroller::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.08);
  border-radius: 999px;
}

.planner-board-scroller::-webkit-scrollbar-thumb {
  background: rgba(23, 32, 51, 0.35);
  border-radius: 999px;
}

.planner-board-header {
  display: grid;
  grid-template-columns: minmax(420px, 1fr);
  gap: 0.5rem;
  align-items: center;
}

.planner-board-header {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
  padding: 0 0.75rem;
}

.planner-row {
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 0.7rem;
  box-shadow: var(--cmt-shadow-sm);
  overflow: visible;
}

.planner-time-scale {
  padding: 0.25rem 0 0.35rem;
  background: #fff;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  width: calc(var(--planner-week-count, 1) * var(--planner-cell-width));
}

.planner-time-scale-shell {
  z-index: 4;
  background: #fff;
  display: flex;
  overflow: hidden;
}

.planner-time-scale-label-col {
  flex: 0 0 220px;
  background: #fff;
  border-right: 1px solid rgba(15, 23, 42, 0.08);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.planner-time-scale-scroller {
  overflow-x: auto;
  overflow-y: hidden;
  -ms-overflow-style: none;
  scrollbar-width: none;
  flex: 1 1 0;
  min-width: 0;
}

.planner-time-scale-scroller::-webkit-scrollbar {
  display: none;
}

.planner-row-conflict {
  border-color: rgba(220, 53, 69, 0.35);
  background: linear-gradient(90deg, rgba(220, 53, 69, 0.06), rgba(255, 255, 255, 0));
}

.planner-row-cell {
  min-width: 0;
}

.planner-row-summary {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(420px, 1fr);
  gap: 0;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0;
  min-height: 30px;
}

.planner-row-summary:hover {
  background: rgba(15, 23, 42, 0.02);
}

.planner-row-summary-static {
  cursor: default;
}

.planner-row-draft {
  border-color: rgba(13, 110, 253, 0.3);
  box-shadow: 0 0 0 1px rgba(13, 110, 253, 0.08), var(--cmt-shadow-sm);
}

.planner-row-draft .planner-row-summary-activity {
  pointer-events: none;
  z-index: 1;
}

.planner-row-draft .planner-row-summary-timeline {
  z-index: 2;
}

.planner-row-summary-activity {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.planner-row-summary-activity {
  font-weight: 700;
  color: #172033;
  position: sticky;
  left: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  min-height: 30px;
  padding: 0 0.8rem;
  flex: 0 0 220px;
  width: 220px;
  background: #fff;
  border-right: 1px solid rgba(15, 23, 42, 0.08);
}

.planner-row-summary-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
}

.planner-row-summary-weeks {
  flex: 0 0 auto;
  font-size: 0.68rem;
  font-weight: 700;
  color: #6b7280;
  margin-left: 0.45rem;
}

.planner-row-summary-activity-wrap {
  min-width: 0;
  display: flex;
  min-height: 30px;
  overflow: visible;
}

.planner-row-summary-timeline {
  flex: 0 0 calc(var(--planner-week-count, 1) * var(--planner-cell-width));
  display: block;
  position: relative;
  width: calc(var(--planner-week-count, 1) * var(--planner-cell-width));
}

.planner-row-summary-timeline .planner-timeline-track {
  width: 100%;
  min-height: 30px;
  height: 100%;
  border-radius: 0;
  border: 0;
  background-image: linear-gradient(
    to right,
    rgba(15, 23, 42, 0.08) 1px,
    transparent 1px
  );
  background-size: calc(100% / var(--planner-week-count, 1)) 100%;
  background-repeat: repeat-x;
}

.planner-row-summary-timeline .planner-timeline-bar {
  height: 100%;
  border-radius: 0;
  margin: 0;
  opacity: 0.92;
  display: flex;
  align-items: center;
  justify-content: center;
}

.planner-timeline-bar-week-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  max-width: calc(100% - 16px);
  padding: 0 0.2rem;
  font-size: 0.56rem;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  text-shadow: 0 1px 1px rgba(15, 23, 42, 0.35);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  z-index: 2;
}

.planner-timeline-bar-draft,
.planner-timeline-bar-inline-edit {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 12px;
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
}

.planner-inline-edit-form {
  margin-top: 0.35rem;
}

.planner-dragging,
.planner-dragging * {
  cursor: grabbing !important;
  user-select: none !important;
}

.planner-bar-grip {
  position: absolute;
  inset: 0.2rem 0.7rem;
  border-radius: 999px;
  z-index: 2;
  cursor: grab;
  touch-action: none;
}

.planner-bar-handle {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 18px;
  border: 0;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.15);
  z-index: 3;
  padding: 0;
  touch-action: none;
}

.planner-bar-handle-start {
  left: 4px;
  cursor: ew-resize;
}

.planner-bar-handle-end {
  right: 4px;
  cursor: ew-resize;
}

#progBoard .planner-bar-grip {
  inset: 0.2rem 0.7rem;
  border: 0;
  background: transparent;
}

#progBoard .planner-bar-handle {
  width: 8px;
  height: 18px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.18);
}

#progBoard .planner-bar-handle-start {
  left: 0;
}

#progBoard .planner-bar-handle-end {
  right: 0;
}

#progBoard .planner-bar-handle:focus-visible {
  outline: 2px solid rgba(15, 23, 42, 0.4);
  outline-offset: 1px;
}

.planner-row-details {
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  padding: 0.7rem 0.8rem 0.8rem;
}

.planner-row-details-grid {
  display: grid;
  grid-template-columns: minmax(140px, 0.9fr) minmax(150px, 1fr) minmax(110px, 0.7fr) minmax(110px, 0.7fr) minmax(80px, 0.5fr);
  gap: 0.6rem;
  align-items: start;
}

.planner-row-details-grid-draft {
  grid-template-columns: minmax(220px, 1.5fr) minmax(140px, 0.8fr) minmax(160px, 1fr) minmax(140px, 0.8fr) minmax(140px, 0.8fr);
}

#progBoard .planner-row-details-grid-draft {
  grid-template-columns: minmax(220px, 1.4fr) minmax(150px, 0.9fr) minmax(170px, 1fr) minmax(120px, 0.7fr) minmax(130px, 0.8fr) minmax(90px, 0.5fr);
}

.planner-row-title {
  font-weight: 700;
  color: #172033;
}

.planner-row-meta {
  line-height: 1.4;
}

.planner-timeline-header {
  display: grid;
  gap: 0;
  font-size: 0.62rem;
  color: #6b7280;
  margin-bottom: 0.2rem;
}

.planner-timeline-header span {
  text-align: center;
  padding: 0.08rem 0;
  border-right: 1px solid rgba(15, 23, 42, 0.05);
}

.planner-timeline-header span.planner-current-week {
  background: rgba(244, 77, 0, 0.14);
  color: #a43a08;
  font-weight: 700;
}

.planner-time-scale .planner-timeline-header {
  margin-bottom: 0;
}

.planner-timeline-track {
  display: grid;
  gap: 0;
  min-height: 16px;
  align-items: center;
  background-color: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 0.45rem;
  overflow: hidden;
  position: relative;
}

.planner-board.planner-has-current-week .planner-row-summary-timeline .planner-timeline-track::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--planner-cell-width) * var(--planner-current-week-index, 0));
  width: var(--planner-cell-width);
  background: rgba(244, 77, 0, 0.12);
  pointer-events: none;
  z-index: 0;
}

.planner-timeline-track > * {
  min-width: 0;
  position: relative;
  z-index: 1;
}

.planner-timeline-bar {
  height: 8px;
  border-radius: 999px;
  align-self: center;
  margin: 0 1px;
}

.planner-board[data-zoom='week'] {
  --planner-cell-width: 24px;
}

.planner-time-scale-shell[data-zoom='week'] {
  --planner-cell-width: 24px;
}

.planner-board[data-zoom='month'] {
  --planner-cell-width: 12px;
}

.planner-time-scale-shell[data-zoom='month'] {
  --planner-cell-width: 12px;
}

.planner-board[data-zoom='month'] .planner-timeline-header {
  font-size: 0.58rem;
}

.planner-time-scale-shell[data-zoom='month'] .planner-timeline-header {
  font-size: 0.58rem;
}

.planner-board[data-zoom='month'] .planner-timeline-track {
  min-height: 14px;
}

.planner-board[data-zoom='month'] .planner-timeline-bar {
  height: 7px;
}

.planner-board[data-zoom='month'] .planner-row-summary-timeline .planner-timeline-bar {
  height: 100%;
}

.planner-timeline-bar-house {
  background: linear-gradient(90deg, #0d6efd, #5b8def);
}

.planner-timeline-bar-house-planning {
  background: linear-gradient(90deg, #6c757d, #adb5bd);
}

.planner-timeline-bar-site {
  background: linear-gradient(90deg, #f44d00, #ff8a4c);
}

.planner-timeline-track-house {
  background-color: rgba(13, 110, 253, 0.06);
}

.planner-timeline-track-site {
  background-color: rgba(244, 77, 0, 0.06);
}

@media (max-width: 991.98px) {
  .planner-board {
    min-width: 980px;
  }

  .planner-board-header {
    grid-template-columns: 1fr;
  }

  .planner-time-scale-label-col {
    flex: 0 0 140px;
  }

  .planner-time-scale-shell {
    top: 56px;
    z-index: 1019;
  }

  .planner-row-summary {
    grid-template-columns: 1fr;
  }

  .planner-row-summary-activity {
    flex: 0 0 140px;
    width: 140px;
  }

  .planner-row-summary-activity-wrap {
    min-height: 30px;
  }

  .planner-row-details {
    position: sticky;
    left: 0;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }

  .planner-row-details-grid {
    grid-template-columns: 1fr;
  }

  .planner-row-details-grid-draft {
    grid-template-columns: 1fr;
  }
}

.dashboard-metric-card {
  border: 1px solid rgba(15, 23, 42, 0.06) !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.98) 100%);
}

.dashboard-metric-card .card-body {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.9rem;
  align-items: center;
  padding: 1rem 1rem 1.05rem;
}

.dashboard-metric-icon {
  width: 2.75rem;
  height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.9rem;
  background: rgba(27, 36, 56, 0.06);
  color: #1b2438;
  font-size: 1.15rem;
}

.dashboard-metric-copy {
  min-width: 0;
}

.dashboard-metric-meta {
  color: var(--bs-secondary-color);
  font-size: 0.8rem;
  line-height: 1.35;
}

.dashboard-metric-card .display-6 {
  margin-bottom: 0;
}

.dashboard-metric-card-notifications {
  cursor: pointer;
}

.dashboard-main-grid {
  display: grid;
  gap: 1rem;
}

.dashboard-panel {
  border: 1px solid rgba(15, 23, 42, 0.06) !important;
}

.dashboard-page .card-header {
  padding: 0.95rem 1rem;
}

.dashboard-page .card-body {
  padding: 1rem;
}

.dashboard-page .dashboard-data-table thead th {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  white-space: nowrap;
  border-top: 0;
}

.dashboard-page .dashboard-data-table tbody td {
  padding-top: 0.8rem;
  padding-bottom: 0.8rem;
}

.dashboard-page .dashboard-data-table .badge {
  font-size: 0.68rem;
}

.dashboard-progress-toolbar .form-control {
  min-width: 220px;
}

@media (min-width: 992px) {
  .dashboard-summary-grid {
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 0.95fr) minmax(0, 1.2fr);
  }

  .dashboard-main-grid {
    grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.92fr);
    align-items: start;
  }

  .dashboard-panel-forecast {
    grid-column: 1;
    grid-row: 1;
  }

  .dashboard-panel-tasks {
    grid-column: 2;
    grid-row: 1 / span 2;
    position: sticky;
    top: 1rem;
  }

  .dashboard-panel-progress {
    grid-column: 1;
    grid-row: 2;
  }

  .dashboard-main-grid-no-tasks {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-main-grid-no-tasks .dashboard-panel-progress {
    grid-column: 1;
    grid-row: 2;
  }
}

@media (min-width: 1200px) {
  .dashboard-page .dashboard-data-table tbody td {
    font-size: 0.92rem;
  }
}

/* ======================================================
   TABLES – PROCORE STYLE
   ====================================================== */
.table thead th {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7c93;
  background-color: #f8f9fc;
  border-bottom: 2px solid #e8ecf1;
  white-space: nowrap;
}

.table-hover tbody tr {
  transition: background-color 0.1s ease;
  cursor: pointer;
}

.table-hover tbody tr:hover {
  background-color: #f8f9fc !important;
  transform: none;
  box-shadow: none;
}

/* ======================================================
   PAGE HEADING AREA
   ====================================================== */
.global-page-content h1.h4 {
  font-weight: 700;
  font-size: 1.2rem;
  color: #1e2b3a;
  letter-spacing: -0.01em;
}

.house-action-buttons .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Dashboard forecast row fill – let the tr gradient show through td cells */
.house-forecast-fill > td {
  background-color: transparent !important;
  box-shadow: none !important;
}

.drawing-tag-chip {
  cursor: pointer;
}

.site-drawing-masonry {
  column-gap: 1rem;
  row-gap: 1rem;
  width: 100%;
  column-count: 1;
}

.site-drawing-masonry-item {
  display: inline-block;
  width: 100%;
  margin: 0 0 1rem 0;
  break-inside: avoid;
  page-break-inside: avoid;
}

.site-drawing-masonry-card {
  overflow: hidden;
  background-color: var(--bs-white);
  box-shadow: var(--cmt-shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.site-drawing-masonry-item:hover .site-drawing-masonry-card,
.site-drawing-masonry-item:focus-within .site-drawing-masonry-card {
  transform: translateY(-4px);
  box-shadow: var(--cmt-shadow);
}

.site-drawing-media-link {
  display: block;
  text-decoration: none;
  color: inherit;
  background-color: var(--bs-white);
  padding: 0.5rem;
}

.site-drawing-media-link:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: -2px;
}

.site-drawing-thumbnail-image {
  display: block;
  width: 100%;
  height: auto;
  background: var(--bs-white);
  border-radius: 0.375rem;
}

.site-drawing-thumbnail-canvas {
  display: block;
  width: 100%;
  height: auto;
  background: var(--bs-white);
}

.site-drawing-thumbnail-pdf-wrap {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 210 / 297;
  min-height: 240px;
  overflow: hidden;
  background: var(--bs-white);
}

.site-drawing-thumbnail-pdf-wrap::before,
.site-drawing-thumbnail-pdf-wrap::after {
  content: '';
  position: absolute;
  background: var(--bs-white);
  pointer-events: none;
  z-index: 2;
}

.site-drawing-thumbnail-pdf-wrap::before {
  top: 0;
  right: 0;
  width: 12px;
  height: 100%;
}

.site-drawing-thumbnail-pdf-wrap::after {
  left: 0;
  right: 0;
  bottom: 0;
  height: 12px;
}

.site-drawing-thumbnail-pdf {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--bs-white);
  pointer-events: none;
}

.site-drawing-detail-pdf {
  display: block;
  width: 100%;
  height: 82vh;
  min-height: 620px;
  background: var(--bs-white);
}

.site-drawing-pdf-stage {
  position: relative;
  width: 100%;
  height: 82vh;
  min-height: 400px;
  overflow: auto;
  background: var(--bs-white);
}

.site-drawing-detail-pdf-canvas {
  display: block;
  width: 100%;
  height: auto;
  background: var(--bs-white);
  transform-origin: top left;
}

.site-drawing-detail-image {
  display: block;
  width: 100%;
  max-height: none;
  object-fit: contain;
  background: var(--bs-white);
  transform-origin: center center;
  transition: transform 0.08s linear;
  user-select: none;
  -webkit-user-drag: none;
}

.site-drawing-image-stage {
  position: relative;
  overflow: hidden;
  background: var(--bs-white);
  cursor: default;
}

.site-drawing-image-stage.is-zoomed {
  cursor: grab;
}

.site-drawing-image-stage.is-dragging {
  cursor: grabbing;
}

.site-drawing-image-content {
  position: relative;
  transform-origin: center center;
}

.site-drawing-task-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.site-drawing-task-marker {
  position: absolute;
  transform: translate(-50%, -100%);
  border: 0;
  padding: 0;
  margin: 0;
  background: none;
  pointer-events: auto;
  cursor: pointer;
  z-index: 5;
}

.site-drawing-task-marker-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  display: block;
  background: var(--bs-primary);
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.site-drawing-task-marker-label {
  display: inline-block;
  margin-top: 4px;
  background: rgba(27, 36, 56, 0.92);
  color: #fff;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.site-drawing-image-stage.is-picking-location {
  cursor: crosshair;
}

.site-drawing-pick-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
}

.site-drawing-pick-confirm {
  position: absolute;
  pointer-events: auto;
  --inv-scale: 1;
}

.site-drawing-pick-dot {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%) scale(var(--inv-scale));
  width: 14px;
  height: 14px;
  border-radius: 999px;
  display: block;
  background: var(--bs-success);
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.site-drawing-pick-card {
  position: absolute;
  left: 0;
  top: 12px;
  transform: translate(-50%, 0) scale(var(--inv-scale));
  transform-origin: top center;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--bs-border-color);
  border-radius: 0.75rem;
  padding: 0.55rem 0.65rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  min-width: 180px;
}

.site-drawing-pick-title {
  font-weight: 700;
  font-size: 0.85rem;
  color: #1e2b3a;
}

.site-task-location-picker-stage {
  position: relative;
  min-height: 320px;
  height: 82vh;
  max-height: 82vh;
  overflow: auto;
  padding: 0;
  background: var(--bs-light);
  cursor: default;
}

.site-task-location-picker-media {
  position: relative;
  display: inline-block;
  max-width: none;
}

.site-task-location-picker-image {
  display: block;
  max-width: none;
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
  background: var(--bs-white);
  user-select: none;
  -webkit-user-drag: none;
}

.site-task-location-picker-pdf {
  display: block;
  width: 100%;
  min-width: 300px;
  height: 82vh;
  min-height: 420px;
  border: 0;
  background: var(--bs-white);
  pointer-events: none;
}

.site-task-location-picker-overlay {
  position: absolute;
  inset: 0;
  border: 0;
  background: transparent;
  cursor: crosshair;
  padding: 0;
  margin: 0;
}

.site-task-location-picker-marker {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 3px solid #fff;
  background: var(--bs-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 3;
  display: none;
}

.site-task-location-preview-wrap {
  position: relative;
  display: inline-block;
  width: min(100%, 320px);
  overflow: hidden;
  border-radius: 0.5rem;
  border: 1px solid var(--bs-border-color);
  background: var(--bs-white);
}

.site-task-location-preview-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: none !important;
  object-fit: contain !important;
  display: block;
}

.site-task-location-preview-marker {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--bs-primary);
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.site-task-location-picker-stage.is-zoomed { cursor: grab; }
.site-task-location-picker-stage.is-panning { cursor: grabbing; }

@media (max-width: 767.98px) {
  .site-drawing-detail-pdf {
    height: 72vh;
    min-height: 460px;
  }

  .site-task-location-picker-pdf {
    height: 52vh;
    min-height: 320px;
  }
}

@media (min-width: 768px) {
  .site-drawing-masonry {
    column-count: 2;
  }
}

@media (min-width: 992px) {
  .site-drawing-masonry {
    column-count: 3;
  }
}

.programme-builder-table th,
.programme-builder-table td {
  vertical-align: middle;
}

.programme-chart-card {
  padding: 1rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 1rem;
  background: #fff;
}

.programme-chart-empty-state {
  border: 1px dashed var(--bs-border-color);
  border-radius: 0.85rem;
  padding: 1rem;
  text-align: center;
  color: var(--bs-secondary-color);
  background: var(--bs-light);
}

.programme-chart {
  overflow-x: auto;
  position: relative;
}

.programme-chart-grid {
  display: grid;
  grid-template-columns: minmax(170px, 220px) repeat(var(--programme-weeks), minmax(44px, 1fr));
  gap: 0.65rem 0.85rem;
  align-items: center;
  min-width: max-content;
}

.programme-chart-spacer {
  min-height: 1px;
  position: sticky;
  left: 0;
  z-index: 4;
  background: #fff;
}

.programme-chart-header {
  min-height: 2rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--bs-secondary-color);
  text-align: center;
}

.programme-chart-header-current {
  color: #dc3545;
  font-weight: 700;
}

.programme-chart-stage-label {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  gap: 6px;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.9rem;
  background: #fff;
  position: sticky;
  left: 0;
  z-index: 3;
  box-shadow: 0.5rem 0 0.75rem -0.75rem rgba(15, 23, 42, 0.18);
}

.programme-chart-stage-label small {
  color: var(--bs-secondary-color);
}

.programme-chart-track {
  grid-column: 2 / -1;
  display: grid;
  grid-template-columns: repeat(var(--programme-weeks), minmax(44px, 1fr));
  position: relative;
  gap: 0;
  min-height: 3rem;
  padding: 0.25rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.9rem;
  background-image: repeating-linear-gradient(
    to right,
    rgba(13, 110, 253, 0.06) 0,
    rgba(13, 110, 253, 0.06) calc(100% / var(--programme-weeks)),
    rgba(13, 110, 253, 0.12) calc(100% / var(--programme-weeks)),
    rgba(13, 110, 253, 0.12) calc((100% / var(--programme-weeks)) + 1px)
  );
  background-color: #fff;
}

.programme-chart-current-week-marker {
  position: absolute;
  top: 0.25rem;
  bottom: 0.25rem;
  width: calc(100% / var(--programme-weeks));
  background: rgba(220, 53, 69, 0.28);
  border-left: 2px solid rgba(220, 53, 69, 0.65);
  border-right: 2px solid rgba(220, 53, 69, 0.65);
  border-radius: 0.45rem;
  pointer-events: none;
  z-index: 2;
}

.programme-chart-bar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  min-width: 0;
  border-radius: 0.7rem;
  background: linear-gradient(135deg, #0d6efd, #3d8bfd);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  box-shadow: 0 0.35rem 0.9rem rgba(13, 110, 253, 0.2);
}

.programme-chart-bar-interactive {
  cursor: grab;
  touch-action: none;
}

.programme-chart-bar-interactive:active {
  cursor: grabbing;
}

.programme-chart-bar span {
  padding: 0.25rem 0.5rem;
  padding-right: 1.35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.programme-chart-handle {
  position: absolute;
  top: 0.2rem;
  bottom: 0.2rem;
  width: 0.55rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  box-shadow: inset 0 0 0 1px rgba(13, 110, 253, 0.12);
  cursor: ew-resize;
}

.programme-chart-handle-start {
  left: 0.18rem;
}

.programme-chart-handle-end {
  right: 0.18rem;
}

.programme-chart-handle::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 60%;
  transform: translate(-50%, -50%);
  background: rgba(13, 110, 253, 0.45);
  box-shadow: 4px 0 0 rgba(13, 110, 253, 0.45), -4px 0 0 rgba(13, 110, 253, 0.45);
}

body.programme-chart-dragging {
  user-select: none;
}

.house-details-name-badge {
  font-size: 0.95rem;
  padding: 0.45rem 0.7rem;
}

@media (max-width: 767.98px) {
  .programme-builder-table {
    min-width: 640px;
  }

  .house-details-card-header {
    align-items: center !important;
  }

  .house-details-card-title {
    width: 100%;
    text-align: center;
  }

  .house-progress-updates-table thead th.small {
    font-size: 0.62rem;
  }

  .house-programme-chart .programme-chart-grid {
    grid-template-columns: minmax(120px, 150px) repeat(var(--programme-weeks), minmax(34px, 1fr));
    gap: 0.4rem 0.55rem;
  }

  .house-programme-chart .programme-chart-header {
    min-height: 1.45rem;
    font-size: 0.65rem;
  }

  .house-programme-chart .programme-chart-stage-label {
    padding: 0.5rem 0.6rem;
    border-radius: 0.7rem;
  }

  .house-programme-chart .programme-chart-stage-label strong {
    font-size: 0.74rem;
    line-height: 1.1;
  }

  .house-programme-chart .programme-chart-track {
    grid-template-columns: repeat(var(--programme-weeks), minmax(34px, 1fr));
    min-height: 2.35rem;
    padding: 0.2rem;
    border-radius: 0.7rem;
  }

  .house-programme-chart .programme-chart-bar {
    font-size: 0.65rem;
    border-radius: 0.55rem;
  }

  .house-programme-chart .programme-chart-bar span {
    padding: 0.15rem 0.35rem;
  }
}

/* ========================================
   INLINE TAG FIELD SYSTEM (Mandatory Standard)
   ======================================== */

.tag-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  min-height: 52px;
  border-radius: 14px;
  border: 1px solid #dee2e6;
  background-color: #fff;
  cursor: text;
  position: relative;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tag-field:hover {
  border-color: #adb5bd;
}

.tag-field.focused {
  border-color: #0d6efd;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.tag-field-input {
  flex: 1;
  min-width: 140px;
  background: none;
  border: none;
  outline: none;
  caret-color: #0d6efd;
  font-size: 1rem;
  padding: 0;
  margin: 0;
}

/* Add button (mobile-friendly) */
.tag-field-add-button {
  background-color: #0d6efd;
  color: white;
  border: none;
  border-radius: 6px;
  width: 40px;
  height: 40px;
  min-width: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.25rem;
  transition: background-color 0.15s;
  flex-shrink: 0;
}

.tag-field-add-button:hover {
  background-color: #0b5ed7;
}

.tag-field-add-button:active {
  background-color: #0a58ca;
}

.tag-field-add-button:focus {
  outline: 2px solid #0d6efd;
  outline-offset: 2px;
}

/* Tags (chips) */
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid;
  font-size: 0.875rem;
  white-space: nowrap;
  animation: chipEnter 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes chipEnter {
  from {
    opacity: 0;
    transform: scale(0.7);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.tag-chip-label {
  font-weight: 500;
}

.tag-chip-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  background: none;
  border: none;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.tag-chip-remove:hover {
  opacity: 1;
}

/* Dropdown container */
.tag-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 0;
  overflow: hidden;
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  z-index: 99;
  transition: max-height 0.2s ease-out;
}

.tag-dropdown.open {
  max-height: 320px;
  overflow-y: auto;
}

.tag-dropdown-group-header {
  padding: 8px 12px 4px;
  color: #666;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  background-color: #f8f9fa;
}

.tag-dropdown-item {
  padding: 10px 12px;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background-color 0.1s, color 0.1s, border-color 0.1s;
}

.tag-dropdown-item:hover {
  background-color: #f8f9fa;
}

.tag-dropdown-item.active {
  background-color: #e7f3ff;
  border-left-width: 2px;
}

.tag-dropdown-item mark {
  background: none;
  font-weight: 600;
}

.tag-dropdown-empty {
  padding: 12px;
  text-align: center;
  color: #999;
  font-size: 0.875rem;
}

/* Footer */
footer {
  flex-shrink: 0;
}

footer a:hover {
  color: #0056b3 !important;
  text-decoration: underline !important;
}

/* Cookie Consent Banner */
.cookie-consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #1b2438 0%, #2d3d5a 100%);
  color: white;
  padding: 1.5rem 0;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
  z-index: 1050;
  transform: translateY(100%);
  transition: transform 0.3s ease-in-out;
}

.cookie-consent-banner.show {
  transform: translateY(0);
}

.cookie-consent-banner h5 {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.cookie-consent-banner p {
  line-height: 1.5;
}

.cookie-consent-banner a {
  color: white;
  font-weight: 500;
}

.cookie-consent-banner a:hover {
  color: rgba(255, 255, 255, 0.8);
}

.cookie-consent-banner .btn-light {
  background-color: rgba(255, 255, 255, 0.9);
  border: none;
  font-weight: 500;
}

.cookie-consent-banner .btn-light:hover {
  background-color: white;
  transform: translateY(-1px);
}

.cookie-consent-banner .btn-primary {
  background-color: #28a745;
  border: none;
  font-weight: 600;
}

.cookie-consent-banner .btn-primary:hover {
  background-color: #218838;
  transform: translateY(-1px);
}

/* Cookie Preferences Modal */
#cookiePreferencesModal .form-check-input {
  width: 3rem;
  height: 1.5rem;
  cursor: pointer;
}

#cookiePreferencesModal .form-check-input:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

#cookiePreferencesModal .card {
  border: 1px solid #dee2e6;
  transition: box-shadow 0.2s ease;
}

#cookiePreferencesModal .card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Responsive adjustments */
@media (max-width: 991px) {
  .global-app-shell {
    display: block;
  }

  .global-brand-logo {
    max-height: 32px;
    max-width: 150px;
  }

  .cookie-consent-banner {
    padding: 1rem 0;
  }
  
  .cookie-consent-banner .btn {
    width: 100%;
    margin-bottom: 0.5rem !important;
  }
}

.site-boundary-map {
  min-height: 520px;
}

.house-number-marker {
  min-width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 999px;
  background: #dc3545;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.12s ease, padding 0.12s ease, min-width 0.12s ease;
}

.house-number-marker .house-marker-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #fff;
}

.house-number-marker .house-marker-label {
  display: none;
}

.house-number-marker.show-label {
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: 14px;
}

.house-number-marker.show-label .house-marker-dot {
  display: none;
}

.house-number-marker.show-label .house-marker-label {
  display: inline;
}

.house-summary-row {
  cursor: pointer;
}

.house-summary-row:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: -2px;
}

.house-summary-row-expanded > td {
  font-weight: 600;
}

.houses-list-table thead th {
  font-size: 0.85rem;
}

.houses-list-table tbody td {
  font-size: 0.9rem;
}

.houses-list-table tbody tr:hover > td {
  background-color: rgba(13, 110, 253, 0.05);
}

.houses-mobile-card .btn {
  min-height: 48px;
}

@media (max-width: 767.98px) {
  .houses-page-summary,
  .houses-directory-title {
    display: none !important;
  }

  .houses-list-toolbar {
    margin-bottom: 0.75rem !important;
    gap: 0.5rem !important;
  }

  .houses-mobile-list-wrap {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
  }

  .houses-directory-card .houses-directory-header {
    padding-top: 0.4rem !important;
    padding-bottom: 0.35rem !important;
  }

  .houses-directory-card .houses-directory-header > div {
    gap: 0.35rem !important;
  }

  .houses-mobile-card {
    margin-bottom: 0.35rem;
  }

  .houses-mobile-card .card-body {
    gap: 0.5rem !important;
    padding: 0.65rem !important;
  }

  .houses-mobile-actions {
    display: flex !important;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.4rem !important;
  }

  .houses-mobile-actions .btn {
    flex: 1 1 calc(33.333% - 0.4rem);
    min-width: 0;
    min-height: 32px !important;
    padding: 0.25rem 0.55rem !important;
    font-size: 0.78rem !important;
  }
}

.house-preview-image {
  max-height: 200px;
  object-fit: cover;
}

.house-document-item .btn,
.house-task-item .btn {
  min-height: 40px;
}

.task-summary-row .badge {
  font-weight: 500;
}

.task-mobile-card .btn {
  min-height: 48px;
}

.house-site-plan-preview {
  overflow: hidden;
}

.house-site-plan-modal-thumbnail {
  max-width: 260px;
}

.house-site-plan-house-marker {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--bs-danger);
  border: 2px solid var(--bs-light);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 2;
}

.task-summary-row {
  cursor: pointer;
}

.task-summary-row:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: -2px;
}

.task-summary-row-expanded > td {
  font-weight: 600;
}

.progress-summary-row {
  cursor: pointer;
}

.progress-summary-row:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: -2px;
}

.progress-summary-row-expanded > td {
  font-weight: 600;
}

.house-progress-toggle-indicator {
  display: inline-flex;
  width: 1.25rem;
  height: 1.25rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--bs-border-color);
  border-radius: 999px;
  font-weight: 700;
  line-height: 1;
}

.house-progress-summary-row.progress-summary-row-expanded .house-progress-toggle-indicator {
  color: var(--bs-primary);
  border-color: var(--bs-primary);
  position: relative;
  font-size: 0;
}

.house-progress-summary-row.progress-summary-row-expanded .house-progress-toggle-indicator::before {
  font-size: 1rem;
  line-height: 1;
}

.task-plan-marker {
  position: absolute;
  display: none;
  transform: translate(-50%, -100%);
  pointer-events: none;
  z-index: 2;
}

.dv-marker {
  border: 0;
  padding: 0;
  margin: 0;
  background: none;
}

.task-plan-marker.dv-marker-interactive {
  pointer-events: auto;
  cursor: pointer;
}

.task-plan-marker.dv-marker-interactive:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: 2px;
}

.task-plan-marker-label {
  display: inline-block;
  background: var(--bs-dark);
  color: var(--bs-light);
  border-radius: 999px;
  font-size: 0.7rem;
  line-height: 1.2;
  padding: 0.2rem 0.45rem;
  white-space: nowrap;
}

.task-plan-marker-arrow {
  display: block;
  text-align: center;
  color: var(--bs-danger);
  font-size: 0.95rem;
  line-height: 0.8;
  margin-top: -0.1rem;
}

.document-preview-container {
  position: relative;
  display: inline-block;
  max-height: 62vh;
  background-color: #f5f5f5;
  border-radius: 0.375rem;
  border: 1px solid #ccc;
}

.document-preview-container img {
  display: block;
  max-height: 62vh;
  width: auto;
  border-radius: 0.375rem;
}

.document-task-marker {
  position: absolute;
  display: none;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  z-index: 10;
  pointer-events: auto;
  cursor: pointer;
  transition: z-index 0.2s ease;
  transform: translate(-50%, -100%);
}

.document-task-marker:hover {
  z-index: 11;
}

.document-task-marker:focus {
  outline: none;
  box-shadow: none;
}

.document-task-marker-label {
  display: block;
  background: var(--bs-primary);
  color: var(--bs-light);
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  padding: 0.35rem 0.6rem;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
  text-align: center;
}

.document-task-marker-arrow {
  display: block;
  text-align: center;
  color: var(--bs-primary);
  font-size: 1rem;
  line-height: 0.6;
  margin-top: -0.3rem;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.document-task-marker:hover .document-task-marker-label {
  background: var(--bs-info);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.document-task-marker:hover .document-task-marker-arrow {
  color: var(--bs-info);
}

/* Mobile-First Responsive Design */
@media (max-width: 577px) {
  /* Typography - Optimize for small screens */
  h1, .h1 {
    font-size: 1.5rem !important;
  }

  h2, .h2 {
    font-size: 1.25rem !important;
  }

  h3, .h3 {
    font-size: 1.1rem !important;
  }

  h4, h5, .h4, .h5 {
    font-size: 1rem !important;
  }

  p, small, .small {
    font-size: 0.95rem !important;
    line-height: 1.4;
  }

  /* Button sizing - larger tap targets on mobile */
  .btn {
    min-height: 44px;
    padding: 0.5rem 1rem !important;
    font-size: 0.95rem !important;
    border-radius: 0.375rem;
  }

  .btn-sm {
    min-height: 36px;
    padding: 0.35rem 0.75rem !important;
    font-size: 0.85rem !important;
  }

  /* Spacing optimizations */
  .mb-1, .mb-2, .mb-3 {
    margin-bottom: 0.75rem !important;
  }

  .mt-1, .mt-2, .mt-3 {
    margin-top: 0.75rem !important;
  }

  .gap-2, .gap-3 {
    gap: 0.75rem !important;
  }

  .p-2, .p-3 {
    padding: 0.75rem !important;
  }

  .py-4 {
    padding-top: 0.5rem !important;
    padding-bottom: 0 !important;
  }

  /* Card adjustments */
  .card {
    margin-bottom: 1rem;
  }

  .card-body {
    padding: 0.25rem !important;
  }

  /* Table responsive */
  .table {
    font-size: 0.85rem;
    margin-bottom: 0;
  }

  .table thead th {
    font-size: 0.75rem;
    padding: 0.4rem 0.25rem;
    font-weight: 600;
  }

  .table td {
    padding: 0.4rem 0.25rem;
    vertical-align: middle;
  }

  /* Form elements */
  .form-control,
  .form-select {
    font-size: 16px;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
  }

  .form-check-input {
    width: 1.25rem;
    height: 1.25rem;
  }

  /* Modal adjustments */
  .modal-body {
    padding: 1rem !important;
  }

  .modal-header {
    padding: 1rem !important;
  }

  .modal-title {
    font-size: 1rem !important;
  }

  /* Image optimization */
  .house-preview-image {
    max-height: 250px;
    width: 100%;
    object-fit: cover;
  }

  /* Badge sizing */
  .badge {
    font-size: 0.75rem;
    padding: 0.35rem 0.65rem;
  }

  /* Flex layout optimizations */
  .flex-wrap {
    flex-wrap: wrap;
  }

  /* Container padding */
  main.container {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
    padding-top: 1rem !important;
  }

  /* Link buttons in tables */
  .border-bottom {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* Full-width modals on small screens */
  .modal-dialog {
    margin: 0.5rem !important;
  }

  .modal-fullscreen-xl-down {
    max-width: none;
  }

  /* Navbar optimizations */
  .navbar {
    padding: 0.5rem 0;
  }

  .navbar-brand {
    font-size: 1.1rem;
  }

  .nav-link {
    font-size: 0.95rem;
    padding: 0.5rem 0.75rem !important;
  }

  /* Hide unnecessary columns on mobile */
  @media (max-width: 639px) {
    .d-none.d-md-table-cell {
      display: none !important;
    }
  }
}

/* Small tablets and landscape phones */
@media (min-width: 576px) and (max-width: 767px) {
  .house-preview-image {
    max-height: 280px;
  }

  main.container {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  .btn {
    min-height: 40px;
  }
}

/* Tablet and up optimizations */
@media (min-width: 768px) {
  .document-preview-container {
    max-height: 500px;
  }

  .document-preview-container img {
    max-height: 500px;
  }

  .house-preview-image {
    max-height: 300px;
  }

  .table {
    font-size: 0.95rem;
  }

  /* Button sizing returns to normal on tablet+ */
  .btn {
    min-height: auto;
  }

  .btn-sm {
    min-height: auto;
  }
}

/* Large screens */
@media (min-width: 1200px) {
  .document-preview-container {
    max-height: 60vh;
  }

  .document-preview-container img {
    max-height: 60vh;
  }

  .house-preview-image {
    max-height: 350px;
  }
}

/* Floor Plan Canvas - Mobile Optimizations */
#createTaskPageFloorPlanCanvas,
#editTaskPageFloorPlanCanvas,
#createTaskFloorPlanCanvas {
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  scroll-behavior: smooth;
}

/* Ensure zoom buttons have adequate touch targets on mobile */
@media (max-width: 767.98px) {
  .btn-sm {
    min-height: 38px; /* Minimum touch target size */
    padding: 0.5rem 0.75rem;
  }
  
  /* Make floor plan canvas more mobile friendly */
  #createTaskPageFloorPlanCanvas,
  #editTaskPageFloorPlanCanvas,
  #createTaskFloorPlanCanvas {
    max-height: calc(100vh - 300px) !important;
  }
  
  /* Increase marker size on mobile for better visibility */
  #createTaskPageFloorPlanMarker,
  #editTaskPageFloorPlanMarker,
  #createTaskFloorPlanMarker {
    width: 24px !important;
    height: 24px !important;
  }
  
  /* Adjust marker labels for mobile */
  #createTaskPageFloorPlanMarkerLabel,
  #editTaskPageFloorPlanMarkerLabel,
  #createTaskFloorPlanMarkerLabel {
    font-size: 0.75rem !important;
    padding: 0.25rem 0.5rem !important;
  }
}
