@font-face {
  font-family: "Source Sans 3";
  src: url("../fonts/SourceSans3-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Source Sans 3";
  src: url("../fonts/SourceSans3-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  overflow-anchor: none;
  --brand-primary: #17a187;
  --brand-accent: #bddacf;
  --surface-page: #f5f7f6;
  --surface-panel: #ffffff;
  --text-primary: #1a1f1e;
  --text-muted: #5c6b66;
  --border: #d5ddd9;
  --danger: #c0392b;
  --warning: #d97706;
  --success: #17a187;

  --bs-primary: var(--brand-primary);
  --bs-primary-rgb: 23, 161, 135;
  --bs-link-color: var(--brand-primary);
  --bs-link-hover-color: #128a74;
  --bs-body-bg: var(--surface-page);
  --bs-body-color: var(--text-primary);
  --bs-border-color: var(--border);
  --bs-success: var(--success);
  --bs-danger: var(--danger);
  --bs-warning: var(--warning);
}

html {
  scrollbar-gutter: stable;
  /* Paint the reserved scrollbar gutter so header/footer don't show a page-coloured strip. */
  background: var(--surface-panel);
}

body.fitflow-body {
  font-family: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--surface-page);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.fitflow-header {
  background: var(--surface-panel);
}

.fitflow-navbar .nav-link.active,
.fitflow-navbar .nav-link:hover {
  color: var(--brand-primary);
}

.fitflow-navbar button.nav-link {
  background: transparent;
  border: 0;
  font: inherit;
  cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
  .fitflow-navbar .nav-item.dropdown:hover > .dropdown-menu {
    display: block;
  }
}

.fitflow-app-title {
  font-weight: 700;
  color: var(--brand-primary);
  letter-spacing: 0.02em;
}

.fitflow-logo {
  max-height: 40px;
  width: auto;
}

.workbook-path-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  margin-left: 0.25rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  background: var(--surface-panel);
  color: var(--brand-primary);
  vertical-align: -0.2rem;
  cursor: pointer;
}

.workbook-path-copy:hover,
.workbook-path-copy.is-copied {
  background: var(--brand-accent);
  border-color: var(--brand-primary);
}

.project-details {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  margin-bottom: 1rem;
}

.project-details-main {
  flex: 1 1 22rem;
  min-width: 0;
}

.project-site-address {
  flex: 0 0 auto;
  width: max-content;
  max-width: min(22rem, calc(100% - 1.5rem));
  margin-left: auto;
  margin-right: 1.5rem;
  margin-bottom: 0;
  text-align: left;
  overflow-wrap: anywhere;
}

@media (max-width: 48rem) {
  .project-site-address {
    flex-basis: 100%;
    max-width: calc(100% - 1.5rem);
    margin-left: 0;
  }
}

.fitflow-main {
  flex: 1;
}

.fitflow-panel,
.card.fitflow-panel {
  background: var(--surface-panel);
  border-color: var(--border);
}

.fitflow-footer {
  background: var(--surface-panel);
}

.btn-primary {
  --bs-btn-bg: var(--brand-primary);
  --bs-btn-border-color: var(--brand-primary);
  --bs-btn-hover-bg: #128a74;
  --bs-btn-hover-border-color: #128a74;
}

.form-control::placeholder {
  color: #c5d0cc;
  font-style: italic;
  opacity: 1;
}

.form-control::-webkit-input-placeholder {
  color: #c5d0cc;
  font-style: italic;
}

.form-control:focus::placeholder {
  color: transparent;
  opacity: 0;
}

.form-control:focus::-webkit-input-placeholder {
  color: transparent;
  opacity: 0;
}

.form-label:has(+ input[required])::after,
.form-label:has(+ textarea[required])::after,
.form-label:has(+ select[required])::after {
  content: " *";
  color: var(--danger);
  font-weight: 700;
}

.field-multi {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
}

.req-star {
  color: var(--danger);
  font-weight: 700;
}

.fitflow-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.fitflow-auth-card {
  max-width: 420px;
  width: 100%;
  background: var(--surface-panel);
  border-color: var(--border);
}

.pm-picker-search {
  position: relative;
}

.pm-picker-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  max-height: 16rem;
  overflow: auto;
  background: var(--surface-panel);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  box-shadow: 0 8px 20px rgba(26, 31, 30, 0.12);
}

.pm-picker-option,
.pm-picker-empty {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.45rem 0.75rem;
  color: var(--text-primary);
}

.pm-picker-option {
  cursor: pointer;
}

.pm-picker-option:hover,
.pm-picker-option.is-active {
  background: var(--brand-accent);
}

.pm-picker-empty {
  color: var(--text-muted);
}

.pm-picker-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  min-height: 2.5rem;
  margin-top: 0.5rem;
  padding: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  background: var(--surface-page);
}

.pm-picker-selected:empty::before {
  content: "No PMs selected";
  color: var(--text-muted);
  font-size: 0.875rem;
  padding-left: 0.25rem;
}

.pm-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.35rem 0.15rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-panel);
}

.pm-chip-remove {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 0.25rem;
  cursor: pointer;
}

.pm-chip-remove:hover {
  color: var(--danger);
}

.fitflow-measure-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}

.fitflow-measure-group-label {
  margin: 0 0 0.35rem;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.fitflow-measures {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.fitflow-measure {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 7.5rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  background: var(--surface-page);
  cursor: help;
}

.fitflow-measure-label {
  color: var(--text-muted);
  font-size: 0.75rem;
  white-space: nowrap;
  text-decoration: underline dotted;
  text-underline-offset: 0.15em;
}

.fitflow-measure-value {
  font-weight: 700;
}

.fitflow-measure-value .fitflow-measure-badge {
  box-sizing: border-box;
  height: 1.5em;
  padding: 0 0.45em;
  font-size: 1em;
  font-weight: 600;
  line-height: calc(1.5em - 2px);
  vertical-align: top;
  border: 1px solid transparent;
}

.fitflow-measure-value .fitflow-measure-badge.is-positive {
  background: #fdecef;
  border-color: #f3c2ce;
  color: #9a3d55;
}

.fitflow-measure-value .fitflow-measure-badge.is-negative {
  background: #e5f6ee;
  border-color: #b7e4cf;
  color: #146b48;
}

.badge.fitflow-status-pending {
  color: #fff;
  background-color: var(--warning);
}

.badge.fitflow-status-approved {
  color: #0f5132;
  background-color: #d1e7dd;
}

@media (min-width: 1200px) {
  .fitflow-measure-groups {
    flex-wrap: nowrap;
  }

  .fitflow-measure-groups > section {
    flex: 1 1 0;
    min-width: 0;
  }

  .fitflow-measure-groups > section:last-child {
    flex-grow: 1.35;
  }

  .fitflow-measures {
    flex-wrap: nowrap;
  }

  .fitflow-measure {
    flex: 1 1 0;
    min-width: 0;
    padding: 0.35rem 0.3rem;
  }
}

.tooltip {
  --bs-tooltip-max-width: 18rem;
}

.fitflow-disabled-action {
  cursor: not-allowed;
}

.package-progress-open {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-weight: 700;
  line-height: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dashed;
  text-decoration-color: var(--text-muted);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.package-progress-open:hover,
.package-progress-open.is-open {
  color: var(--text-muted);
  text-decoration-style: solid;
  text-decoration-color: var(--text-muted);
}

.package-progress-open:has(.badge) {
  text-decoration: none;
}

.package-progress-pop {
  position: fixed;
  z-index: 1040;
  padding: 0.5rem;
  background: var(--surface-panel);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  box-shadow: 0 0.35rem 1rem rgba(16, 24, 20, 0.14);
}

.package-progress-line {
  display: inline-block;
  max-width: 8rem;
  vertical-align: middle;
}

.package-progress-note {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.package-progress input[name="rooms_completed"] {
  width: 4rem;
}

.fitflow-disabled-action > .btn,
.fitflow-disabled-action > .btn:disabled {
  pointer-events: none;
  color: var(--text-muted);
  background-color: #e7ecea;
  border-color: var(--border);
  opacity: 1;
  box-shadow: none;
}

.fitflow-th {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  white-space: nowrap;
}

.fitflow-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  padding: 0;
  border: 1px solid var(--text-muted);
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  flex: 0 0 auto;
}

.fitflow-help:hover,
.fitflow-help:focus-visible {
  color: var(--brand-primary);
  border-color: var(--brand-primary);
}

.fitflow-fitter-name {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.fitflow-insurance-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  line-height: 1;
  cursor: help;
}

.fitflow-insurance-icon--expiring {
  color: var(--warning);
}

.fitflow-insurance-icon--expired,
.fitflow-insurance-icon--missing {
  color: var(--danger);
}

.table thead a.sort-header {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-primary);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.table thead a.sort-header:hover,
.table thead a.sort-header:focus,
.table thead a.sort-header:focus-visible {
  color: var(--text-primary);
  text-decoration: none;
}

.table thead a.sort-header:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

.sort-mark {
  display: inline-flex;
  flex: 0 0 8px;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  width: 8px;
  height: 10px;
}

.sort-mark .sort-up,
.sort-mark .sort-down {
  display: block;
  width: 0;
  height: 0;
  margin: 0 auto;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  opacity: 0.35;
}

.sort-mark .sort-up {
  border-bottom: 4px solid var(--text-muted);
}

.sort-mark .sort-down {
  border-top: 4px solid var(--text-muted);
}

.table thead a.sort-header:hover .sort-mark .sort-up,
.table thead a.sort-header:hover .sort-mark .sort-down {
  opacity: 0.7;
}

.table thead a.sort-header.is-asc .sort-up,
.table thead a.sort-header.is-desc .sort-down {
  opacity: 1;
  border-bottom-color: var(--text-primary);
  border-top-color: var(--text-primary);
}

.alert.fitflow-notice {
  border-width: 1px;
  border-style: solid;
}

.alert.fitflow-notice-debug,
.alert.fitflow-notice-info {
  background: #e7f1f8;
  border-color: #7eb0cc;
  color: #0d3c5c;
}

.alert.fitflow-notice-success {
  background: #d8f3ec;
  border-color: #5fbfa8;
  color: #0d5c4d;
}

.alert.fitflow-notice-warning {
  background: #fff4d6;
  border-color: #e0b84a;
  color: #6b4a08;
}

.alert.fitflow-notice-error {
  background: #fde2e0;
  border-color: #e08a84;
  color: var(--danger);
  font-weight: 700;
}

.alert.fitflow-notice a {
  color: inherit;
  text-decoration: underline;
}

th.progress-notes-col,
td.progress-notes-col {
  white-space: nowrap;
}

th.progress-notes-col,
td.progress-notes-col {
  width: 1%;
  text-align: center;
}

.progress-notes-open {
  color: var(--text-muted);
  line-height: 0;
  vertical-align: middle;
}

.progress-notes-open .is-filled {
  display: none;
}

.progress-notes-open.has-notes {
  color: var(--brand-primary);
}

.progress-notes-open.has-notes .is-empty {
  display: none;
}

.progress-notes-open.has-notes .is-filled {
  display: inline;
}

table.table.cols-locked > :is(thead, tbody) > tr > :is(th, td) {
  overflow-wrap: anywhere;
}

.table-copy-wrap {
  position: relative;
}

.table-copy-slot {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 0.2rem;
}

.table-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  background: var(--surface-panel);
  color: var(--brand-primary);
  cursor: pointer;
}

.table-copy-btn:hover,
.table-copy-btn:focus-visible {
  background: var(--brand-accent);
  border-color: var(--brand-primary);
  outline: none;
}

.table-copy-toast {
  position: fixed;
  z-index: 2000;
  transform: translate(-50%, calc(-100% - 8px));
  margin: 0;
  padding: 0.2rem 0.45rem;
  background: var(--text-primary);
  color: #fff;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(26, 31, 30, 0.18);
  animation: table-copy-toast 1.6s ease forwards;
}

@keyframes table-copy-toast {
  0% { opacity: 1; }
  75% { opacity: 1; }
  100% { opacity: 0; }
}

.role-summary {
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  background: var(--surface-page);
  color: var(--text-muted);
}

.role-summary .fw-bold {
  color: var(--text-primary);
}

.role-summary ul {
  color: var(--text-muted);
}

@media (max-width: 576px) {
  .fitflow-logo {
    max-height: 32px;
  }
  .fitflow-app-title {
    font-size: 1rem;
  }
}
