/* Dashboard-specific styles, layered on shared.css. */

.dash-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
}
.dash-header h1 {
  margin: 0;
  color: var(--accent);
  font-size: 22px;
}
.filters {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.filters label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: var(--text-muted);
  gap: 4px;
}
.filters select {
  background: var(--surface-muted);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
}
.filters .count {
  color: var(--text-muted);
  font-size: 13px;
  margin-left: auto;
}
.filters .checkbox-label {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
}
.filters .checkbox-label input {
  margin: 0;
}

.sourced-tag {
  display: inline-block;
  font-size: 12px;
  color: var(--text-muted);
  padding: 2px 8px;
  background: var(--surface-muted);
  border-radius: 99px;
}
.sourced-tag.direct {
  font-style: italic;
}

.split {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 960px) {
  .split { grid-template-columns: 1fr; }
}

.list.card,
.detail.card {
  padding: 0;
  max-width: none;
  /* overflow-x: auto so the table can scroll horizontally when the list pane
     is narrower than the table's natural width (happens when chips widen a
     column past what the pane can hold) — previously `overflow: hidden`
     silently clipped the rightmost column (Submitted). */
  overflow-x: auto;
  overflow-y: hidden;
}

.subs {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.subs th,
.subs td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.subs th {
  background: var(--surface-muted);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.subs tbody tr {
  cursor: pointer;
}
.subs tbody tr:hover {
  background: var(--surface-muted);
}
.subs tbody tr.selected {
  background: rgba(109, 222, 58, 0.08);
}
.subs td.loading,
.subs td.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 24px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}
.badge.status-pending       { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.badge.status-under_review  { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.badge.status-changes_requested { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.badge.status-approved      { background: rgba(109, 222, 58, 0.15); color: var(--accent); }
.badge.status-rejected      { background: rgba(229, 72, 77, 0.15); color: var(--danger); }
.badge.status-complete      { background: rgba(109, 222, 58, 0.15); color: var(--accent); }
.badge.stage-coordinator    { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; }
.badge.stage-supervisor     { background: rgba(59, 130, 246, 0.15); color: #93c5fd; }
.badge.stage-manager        { background: rgba(168, 85, 247, 0.15); color: #c4b5fd; }
.badge.stage-owner          { background: rgba(109, 222, 58, 0.15); color: var(--accent); }
.badge.agreement-signed     { background: rgba(109, 222, 58, 0.15); color: var(--accent); }
.badge.agreement-not_signed { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.badge.agreement-declined   { background: rgba(229, 72, 77, 0.15); color: var(--danger); }
.badge.agreement-expired    { background: rgba(249, 115, 22, 0.15); color: #fb923c; }
.badge.agreement-abandoned  { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; }

.detail {
  padding: 20px !important;
  min-height: 300px;
}
.detail .empty {
  color: var(--text-muted);
  text-align: center;
  padding: 80px 20px;
}
.detail h2 {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 18px;
}
.detail .sub {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 16px;
}
.detail .section {
  margin-top: 18px;
}
.detail .section h3 {
  margin: 0 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.detail .kv {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 4px 12px;
  font-size: 13px;
}
.detail .kv dt {
  color: var(--text-muted);
}
.detail .kv dd {
  margin: 0;
}
.detail .doc-link {
  display: inline-block;
  padding: 6px 12px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  margin-right: 8px;
}
.detail .doc-link:hover {
  border-color: var(--accent);
}
.detail .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.detail .tag {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px;
}
.detail .audit-row {
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}
.detail .audit-row:last-child {
  border-bottom: none;
}
.detail .audit-row .who {
  color: var(--text);
}

/* Action bar (approve/reject/escalate/note) */
.action-bar {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px !important;
  margin-top: 0;
}
.action-bar h3 {
  margin-top: 0 !important;
}
.action-bar textarea {
  width: 100%;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  resize: vertical;
  min-height: 60px;
}
.action-bar textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(109, 222, 58, 0.2);
}
.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.action-buttons .button {
  padding: 6px 12px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}
.action-buttons .button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}
.action-buttons .button.primary {
  background: var(--accent);
  color: #0f1419;
  border-color: var(--accent);
  font-weight: 600;
}
.action-buttons .button.primary:hover:not(:disabled) {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #0f1419;
}
.action-buttons .button.danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
  font-weight: 600;
}
.action-buttons .button.danger:hover:not(:disabled) {
  background: #c1272d;
  color: #fff;
}
.action-buttons .button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
#action-status {
  margin-top: 8px;
  font-size: 13px;
}
#action-status.error { color: var(--danger); }
#action-status.success { color: var(--accent); }

.reveal-btn {
  margin-left: 8px;
  padding: 2px 8px;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
}
.reveal-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}
.reveal-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.audit-action {
  color: var(--accent);
  font-weight: 500;
}
.audit-extra {
  color: var(--text-muted);
  font-size: 11px;
}
.audit-note {
  margin-top: 4px;
  padding: 6px 10px;
  background: var(--surface);
  border-left: 2px solid var(--accent);
  border-radius: 0 4px 4px 0;
  color: var(--text);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.muted-tag {
  color: var(--text-muted);
}
.row-sub {
  font-size: 11px;
  color: var(--text-muted);
}
.row-sourced {
  font-size: 12px;
}
.row-owner {
  font-size: 12px;
  white-space: nowrap;
}
.row-missing {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
  /* Keep "missing: W9 COI" on a single line — without this, the chips wrap
     below the "missing:" label when the cell is sized to the status-badge
     width. Forces the Status column to widen to fit. */
  white-space: nowrap;
}
.missing-chip-sm {
  display: inline-block;
  background: rgba(229, 72, 77, 0.15);
  color: var(--danger-chip);
  border: 1px solid rgba(229, 72, 77, 0.4);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  margin-right: 4px;
}

/* HubSpot status chip — tri-state. Rendered in the Sourced By cell of the
   list (below the coordinator/direct label) and in the detail panel header.
   Same compact size as .missing-chip-sm so chips line up visually when both
   appear in the same row. */
.row-hubspot {
  margin-top: 3px;
}
.hs-chip {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.hs-chip-ok {
  background: rgba(109, 222, 58, 0.15);
  color: var(--accent);
  border: 1px solid rgba(109, 222, 58, 0.4);
}
.hs-chip-emailed {
  background: rgba(245, 184, 0, 0.15);
  color: #f5b800;
  border: 1px solid rgba(245, 184, 0, 0.4);
}
.hs-chip-missing {
  background: rgba(229, 72, 77, 0.15);
  color: var(--danger-chip);
  border: 1px solid rgba(229, 72, 77, 0.4);
}
.missing-banner {
  margin: 12px 0;
  padding: 10px 14px;
  background: rgba(229, 72, 77, 0.1);
  border: 1px solid rgba(229, 72, 77, 0.3);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
}
.resubmitted-meta {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 400;
}
.resubmitted-meta-sm {
  font-size: 11px;
}
.resubmitted-arrow {
  color: #d6973a;
  font-weight: 600;
}
.row-resubmitted-meta {
  margin-top: 4px;
}
.row-agreement {
  margin-top: 4px;
}

/* Modal — destructive-action confirmation (currently: reject) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 24px;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
.modal h2 {
  margin: 0 0 12px;
  font-size: 18px;
  color: var(--text);
}
.modal p {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}
.modal-checks {
  border: none;
  padding: 0;
  margin: 0 0 16px;
}
.modal-checks legend {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 8px;
  font-weight: 600;
}
.modal-checks label {
  display: block;
  font-size: 14px;
  color: var(--text);
  margin: 6px 0;
  cursor: pointer;
}
.modal-checks input[type="checkbox"] {
  margin-right: 8px;
  vertical-align: middle;
}
.modal-checks input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.modal-warn {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
  margin: 0 0 20px;
  line-height: 1.5;
}
.modal-buttons {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}
.modal-buttons .button {
  padding: 10px 16px;
  min-height: 44px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}
.modal-buttons .button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}
.modal-buttons .button.danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
  font-weight: 600;
}
.modal-buttons .button.danger:hover:not(:disabled) {
  background: #c1272d;
  color: #fff;
  border-color: #c1272d;
}
.modal-buttons .button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
