.booking-group {
  margin-bottom: 16px;
  border: 1.5px solid var(--border);
  border-radius: 16px;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.booking-group[open] {
  box-shadow: var(--shadow-md);
}

.booking-group-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 18px;
  cursor: pointer;
  list-style: none;
}

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

.booking-group-summary:focus-visible {
  outline: 3px solid rgba(245, 166, 35, 0.25);
  outline-offset: -3px;
}

.booking-group-main {
  min-width: 0;
}

.booking-group-ref {
  display: inline-flex;
  margin-bottom: 6px;
  padding: 3px 8px;
  border-radius: 5px;
  background: var(--amber-light);
  color: var(--amber-dim);
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
}

.booking-group-title {
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
}

.booking-group-meta {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.booking-group-side {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
}

.booking-group-status {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--blue-light);
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.booking-group-status.pending_review {
  background: var(--amber-light);
  color: var(--amber-dim);
}

.booking-group-status.partially_filled {
  background: var(--orange-light);
  color: var(--orange);
}

.booking-group-status.filled,
.booking-group-status.completed {
  background: var(--green-light);
  color: var(--green);
}

.booking-group-status.cancelled,
.booking-group-status.cannot_fulfil {
  background: var(--red-light);
  color: var(--red);
}

.booking-group-chevron {
  color: var(--text-dim);
  font-size: 17px;
  transition: transform 0.18s ease;
}

.booking-group[open] .booking-group-chevron {
  transform: none;
}

.booking-group-body {
  padding: 14px;
  border-top: 1px solid var(--border);
  background: #c7e5ef;
}

.booking-group-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 0 12px;
}

.booking-group-action {
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--border-mid);
  border-radius: 9px;
  background: var(--bg-card);
  color: var(--text);
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.booking-group-action.primary {
  border-color: var(--navy);
  background: var(--navy);
  color: white;
}

.booking-group-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.booking-group-role-count {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

.booking-group-children .job-card {
  margin-bottom: 10px;
  box-shadow: none;
}

.booking-group-children .job-card:last-child {
  margin-bottom: 0;
}

.grouped-booking-builder {
  margin: 18px 0;
  padding: 14px;
  border: 1px solid var(--border-mid);
  border-radius: 12px;
  background: var(--bg);
}

.grouped-booking-builder-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.grouped-booking-builder-title > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.grouped-booking-builder-title strong {
  color: var(--text);
  font-size: 13px;
}

.grouped-booking-builder-title span {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.4;
}

.grouped-booking-builder-title button,
.grouped-booking-draft-role button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--border-mid);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--navy);
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.grouped-booking-empty {
  padding: 10px 11px;
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.5;
}

.grouped-booking-draft-role {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-card);
}

.grouped-booking-draft-role > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.grouped-booking-draft-role strong,
.grouped-booking-draft-role span,
.grouped-booking-draft-role small {
  overflow-wrap: anywhere;
}

.grouped-booking-draft-role strong {
  color: var(--text);
  font-size: 12px;
}

.grouped-booking-draft-role span {
  color: var(--text-muted);
  font-size: 11px;
}

.grouped-booking-draft-role small {
  color: var(--text-dim);
  font-size: 10px;
  line-height: 1.45;
}

.grouped-booking-draft-role button {
  color: var(--red);
}

.grouped-booking-preview-role {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border-mid);
  border-radius: 10px;
  background: var(--bg);
}

.grouped-booking-preview-role-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.grouped-booking-preview-role-heading span {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.grouped-booking-preview-role-heading strong {
  color: var(--text);
  font-size: 13px;
  text-align: right;
}

.grouped-booking-preview-row {
  display: grid;
  grid-template-columns: minmax(92px, 0.38fr) minmax(0, 1fr);
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  line-height: 1.45;
}

.grouped-booking-preview-row:last-child {
  border-bottom: 0;
}

.grouped-booking-preview-row strong {
  color: var(--text-muted);
}

.grouped-booking-preview-row span {
  color: var(--text);
  overflow-wrap: anywhere;
}

.grouped-booking-rate-overlay {
  position: fixed;
  z-index: 10050;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(6, 22, 48, 0.66);
  backdrop-filter: blur(4px);
}

.grouped-booking-rate-dialog {
  width: min(720px, 100%);
  max-height: min(820px, calc(100vh - 40px));
  overflow: auto;
  border-radius: 18px;
  background: var(--bg-card);
  box-shadow: 0 28px 80px rgba(6, 22, 48, 0.28);
}

.grouped-booking-rate-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.grouped-booking-rate-heading span {
  color: var(--amber-dim);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.grouped-booking-rate-heading h2 {
  margin: 4px 0 5px;
  color: var(--text);
  font-size: 21px;
}

.grouped-booking-rate-heading p {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.grouped-booking-rate-heading button {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg);
  color: var(--text-muted);
  font: inherit;
  font-size: 20px;
  cursor: pointer;
}

.grouped-booking-rate-list {
  display: grid;
  gap: 10px;
  padding: 16px 20px;
}

.grouped-booking-rate-role {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--bg);
}

.grouped-booking-rate-role-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.grouped-booking-rate-role-title span {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.grouped-booking-rate-role-title strong {
  color: var(--text);
  font-size: 14px;
  text-align: right;
}

.grouped-booking-rate-client {
  margin: 7px 0 11px;
  color: var(--text-muted);
  font-size: 11px;
}

.grouped-booking-rate-role label > span {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
}

.grouped-booking-rate-input {
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--border-mid);
  border-radius: 9px;
  background: var(--bg-card);
}

.grouped-booking-rate-input > span {
  padding-left: 12px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 800;
}

.grouped-booking-rate-input input {
  width: 100%;
  min-width: 0;
  padding: 10px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
}

.grouped-booking-rate-input:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.12);
}

.grouped-booking-rate-margin {
  margin-top: 8px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
}

.grouped-booking-rate-margin.is-invalid {
  color: var(--red);
}

.grouped-booking-rate-total {
  margin: 0 20px;
  padding: 14px;
  border: 1px solid rgba(16, 185, 129, 0.24);
  border-radius: 11px;
  background: var(--green-light);
}

.grouped-booking-rate-total span,
.grouped-booking-rate-total small {
  display: block;
  color: var(--text-muted);
  font-size: 10px;
}

.grouped-booking-rate-total strong {
  display: block;
  margin: 4px 0;
  color: var(--green);
  font-size: 22px;
}

.grouped-booking-rate-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 16px 20px 20px;
}

.grouped-booking-rate-actions button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--border-mid);
  border-radius: 9px;
  background: var(--bg-card);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.grouped-booking-rate-actions button.primary {
  border-color: var(--navy);
  background: var(--navy);
  color: white;
}

.grouped-booking-rate-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 620px) {
  .booking-group-summary {
    padding: 15px 14px;
  }

  .booking-group-side {
    gap: 5px;
  }

  .booking-group-title {
    font-size: 14px;
  }

  .grouped-booking-builder-title,
  .grouped-booking-draft-role {
    align-items: stretch;
    flex-direction: column;
  }

  .grouped-booking-builder-title button,
  .grouped-booking-draft-role button {
    width: 100%;
  }

  .grouped-booking-preview-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .grouped-booking-rate-overlay {
    align-items: end;
    padding: 0;
  }

  .grouped-booking-rate-dialog {
    max-height: 92vh;
    border-radius: 18px 18px 0 0;
  }

  .grouped-booking-rate-heading,
  .grouped-booking-rate-list {
    padding-right: 15px;
    padding-left: 15px;
  }

  .grouped-booking-rate-total {
    margin-right: 15px;
    margin-left: 15px;
  }

  .grouped-booking-rate-actions {
    padding-right: 15px;
    padding-left: 15px;
  }

  .grouped-booking-rate-actions button {
    flex: 1;
  }
}



/*
 * Keep job-card activity controls steady. The notification bell can
 * still pulse, but the Broadcasting/Worker Responses card control
 * should not flash while the Agency is reviewing jobs.
 */
.job-card .btn-flash {
  animation: none;
  box-shadow: none;
}

/* Multi-day grouped booking badge v1 */

.booking-group-type {
  display: inline-flex;
  align-items: center;
  margin: 0 0 6px 7px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--blue-light);
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.4;
  white-space: nowrap;
}

/* Ultra-faint double-V control v8 */

.booking-group-summary {
  position: relative;
  padding-bottom: 42px;
}

.booking-group-chevron {
  position: absolute;
  left: 50%;
  bottom: 7px;
  display: block;
  width: 40px;
  height: 27px;
  background: rgba(100, 116, 139, 0.18);
  -webkit-mask:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 26'%3E%3Cpath d='M4 4L18 15L32 4M4 11L18 22L32 11' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 26'%3E%3Cpath d='M4 4L18 15L32 4M4 11L18 22L32 11' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / contain no-repeat;
  filter: none;
  box-shadow: none;
  transform: translateX(-50%);
  transform-origin: center;
  pointer-events: none;
  transition:
    background 0.16s ease,
    transform 0.18s ease;
}

.booking-group-chevron::before,
.booking-group-chevron::after {
  content: none;
}

.booking-group[open]
.booking-group-chevron {
  transform:
    translateX(-50%)
    rotate(180deg);
}

.booking-group-summary:hover
.booking-group-chevron,
.booking-group-summary:focus-visible
.booking-group-chevron {
  background: rgba(71, 85, 105, 0.42);
  filter: none;
  box-shadow: none;
}


/* Multi-role badge colour distinction v1 */

.booking-group-type.multi-role {
  background: #f3e8ff;
  color: #7c3aed;
}


/* Agency worker-pay calculation modes v1 */
.grouped-booking-rate-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin: 12px 0;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card, #fff);
}

.grouped-booking-rate-mode button {
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.grouped-booking-rate-mode button.is-active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.grouped-booking-rate-margin {
  line-height: 1.5;
}
