/*
 * Agency Jobs clean Table/Cards presentation v1.
 * Cards mode uses the original renderer unchanged.
 */

#jobs-list:not(.jobs-grid) .agency-jobs-date-grid {
  display: block;
}

.agency-job-table-head,
.agency-job-table-summary {
  grid-template-columns:
    minmax(105px, .75fr)
    minmax(150px, 1.2fr)
    minmax(135px, 1fr)
    minmax(120px, .9fr)
    minmax(112px, .75fr)
    minmax(108px, .75fr)
    82px;
}

.agency-job-table-head {
  display: grid;
  gap: 14px;
  align-items: center;
  margin: 0 0 8px;
  padding: 0 18px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.agency-job-table-entry {
  grid-column: 1 / -1;
  min-width: 0;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
  transition:
    border-color .18s ease,
    box-shadow .18s ease;
}

.agency-job-table-entry:hover {
  border-color: rgba(59, 130, 246, .3);
  box-shadow: 0 6px 18px rgba(16, 33, 63, .06);
}

.agency-job-table-summary {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 14px;
  align-items: center;
  padding: 15px 18px;
  border: 0;
  background: transparent;
  color: var(--navy);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.agency-job-table-summary:hover,
.agency-job-table-summary:focus-visible {
  background: rgba(241, 245, 249, .72);
  outline: none;
}

.agency-job-table-entry.is-open
.agency-job-table-summary {
  border-bottom: 1px solid var(--border);
  background: rgba(248, 250, 252, .9);
}

.agency-job-table-cell {
  min-width: 0;
}

.agency-job-table-value {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agency-job-table-ref .agency-job-table-value {
  color: var(--blue);
  font-family: monospace;
  font-size: 11px;
}

.agency-job-table-client .agency-job-table-value {
  font-weight: 800;
}

.agency-job-table-date .agency-job-table-value,
.agency-job-table-coverage .agency-job-table-value {
  color: var(--text-muted);
}

.agency-job-table-date
.agency-job-table-value {
  white-space: normal;
}

.agency-job-table-date-count {
  display: block;
  margin-top: 3px;
  color: #94a3b8;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.2;
}

.agency-job-table-mobile-label {
  display: none;
}

.agency-job-table-status-value {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.agency-job-table-status-value::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.agency-job-table-status-value.status-pending_review {
  background: #fff7e8;
  color: #d97706;
}

.agency-job-table-status-value.status-approved_now_broadcasting {
  background: #e8f2ff;
  color: #3b82f6;
}

.agency-job-table-status-value.status-partially_filled {
  background: #fff7d6;
  color: #b7791f;
}

.agency-job-table-status-value.status-filled,
.agency-job-table-status-value.status-completed {
  background: #dcfce7;
  color: #059669;
}

.agency-job-table-status-value.status-cannot_fulfil,
.agency-job-table-status-value.status-cancelled {
  background: #fee2e2;
  color: #ef4444;
}

.agency-job-table-open {
  display: inline-flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.agency-job-table-chevron {
  color: #94a3b8;
  font-size: 15px;
  transition: transform .2s ease;
}

.agency-job-table-entry.is-open
.agency-job-table-chevron {
  transform: rotate(180deg);
}

.agency-job-table-detail {
  min-width: 0;
  overflow: hidden;
}

.agency-job-table-detail[hidden] {
  display: none !important;
}

/* Neutral expanded-card edge v4 */
.agency-job-table-detail > .job-card {
  margin: 0 12px 12px;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border) !important;
  border-radius: 12px;
}

.agency-job-table-summary.agency-job-table-flash-target {
  animation: agency-job-table-target-flash 1.55s ease;
}

@keyframes agency-job-table-target-flash {
  0%,
  100% {
    background: transparent;
    box-shadow: none;
  }

  18%,
  58% {
    background: rgba(59, 130, 246, .14);
    box-shadow:
      inset 4px 0 0 rgba(59, 130, 246, .7);
  }
}


/*
 * Persistent unread-response guidance v3.
 *
 * The existing booking-group attention state leads the user
 * through each nested layer until the actual unread responses
 * are opened:
 *
 * closed group -> outer booking pulse
 * open group   -> compact table-row pulse
 * open row     -> Broadcast pending action pulse
 */
/* Unread table-row ring v4 */
.booking-group.booking-group-attention[open]
.agency-job-table-entry:not(.is-open) {
  animation:
    agency-unread-row-guidance
    1.05s
    ease-in-out
    infinite;
}

.booking-group.booking-group-attention[open]
.agency-job-table-entry.is-open
button[onclick^="openBroadcastDrawer"] {
  animation:
    agency-unread-action-guidance
    .8s
    ease-in-out
    infinite;
}

@keyframes agency-unread-row-guidance {
  0%,
  100% {
    border-color: rgba(249, 115, 22, .42);
    box-shadow:
      inset 0 0 0 1px rgba(249, 115, 22, .3),
      0 0 4px 0 rgba(249, 115, 22, .16);
  }

  50% {
    border-color: rgba(249, 115, 22, .9);
    box-shadow:
      inset 0 0 0 2px rgba(249, 115, 22, .72),
      0 0 13px 3px rgba(249, 115, 22, .26);
  }
}

@keyframes agency-unread-action-guidance {
  0%,
  100% {
    border-color: rgba(249, 115, 22, .45);
    background: rgba(255, 247, 237, .72);
    color: #c2410c;
    box-shadow:
      0 0 0 0 rgba(249, 115, 22, 0);
  }

  50% {
    border-color: rgba(249, 115, 22, .9);
    background: rgba(255, 237, 213, 1);
    color: #9a3412;
    box-shadow:
      0 0 11px 3px rgba(249, 115, 22, .28);
  }
}

@media (max-width: 1180px) and (min-width: 761px) {
  .agency-job-table-head,
  .agency-job-table-summary {
    grid-template-columns:
      minmax(105px, .75fr)
      minmax(145px, 1.2fr)
      minmax(115px, .9fr)
      minmax(105px, .8fr)
      minmax(108px, .8fr)
      75px;
  }

  .agency-job-table-head-client,
  .agency-job-table-client {
    display: none;
  }
}

@media (max-width: 760px) {
  .agency-job-table-head {
    display: none;
  }

  .agency-job-table-entry {
    border-radius: 12px;
  }

  .agency-job-table-summary {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 14px;
    padding: 14px;
  }

  .agency-job-table-mobile-label {
    display: block;
    margin-bottom: 3px;
    color: #94a3b8;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: .055em;
    text-transform: uppercase;
  }

  .agency-job-table-ref,
  .agency-job-table-client,
  .agency-job-table-role,
  .agency-job-table-date,
  .agency-job-table-coverage {
    grid-column: 1;
  }

  .agency-job-table-client {
    grid-row: 2;
  }

  .agency-job-table-role {
    grid-row: 3;
  }

  .agency-job-table-date {
    grid-row: 4;
  }

  .agency-job-table-coverage {
    grid-row: 5;
  }

  .agency-job-table-status {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
  }

  .agency-job-table-open {
    grid-column: 2;
    grid-row: 5;
    align-self: end;
  }

  .agency-job-table-status
  .agency-job-table-mobile-label {
    display: none;
  }

  .agency-job-table-detail > .job-card {
    margin: 0 6px 8px;
  }
}


/*
 * All Jobs three-state Date sorting v1
 */
.agency-job-table-date-sort {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

.agency-job-table-date-sort:hover {
  color: var(--blue);
}

.agency-job-table-date-sort:focus-visible {
  border-radius: 4px;
  outline: 2px solid rgba(59, 130, 246, .45);
  outline-offset: 3px;
}

.agency-job-table-date-sort-arrow {
  color: var(--blue);
  font-size: 13px;
  line-height: 1;
}
