.dashboard-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 2rem 5rem;
}

.dashboard-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 2rem;
}

.export-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
}

.export-button {
  display: inline-block;
  padding: 0.6rem 1.25rem;
  border: 1.5px solid var(--navy);
  border-radius: 8px;
  color: var(--navy);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.88rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.export-button:hover {
  background: var(--navy);
  color: var(--white);
}

.export-remaining {
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.dashboard-heading h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.75rem, 3.5vw, 2.25rem);
  color: var(--ink);
}

.dashboard-heading h1 .highlight {
  color: var(--gold);
}

.dashboard-heading p {
  margin: 0;
  color: var(--ink-muted);
}

.start-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.35rem;
  margin: -0.5rem 0 1.5rem;
  padding: 0.75rem 1rem;
  background: #0a1930;
  color: #f4f6f8;
  border-radius: 10px;
  font-size: 0.88rem;
}

.start-strip strong {
  color: #d4af37;
}

@media (max-width: 768px) {
  .start-strip {
    margin-top: 0;
    font-size: 0.82rem;
  }
}

/* Filter bar */

.filter-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr) auto;
  gap: 1.25rem;
  align-items: end;
  background: var(--white);
  border-radius: 12px;
  padding: 1.75rem;
  box-shadow: 0 1px 2px rgba(16, 33, 61, 0.05);
  border: 1px solid #e7eaf0;
  margin-bottom: 2.5rem;
}

.filter-field {
  display: flex;
  flex-direction: column;
}

.filter-search {
  grid-column: 1 / -1;
}

.filter-field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 0.4rem;
}

.filter-field input,
.filter-field select {
  padding: 0.65rem 0.85rem;
  border: 1.5px solid #dbe1ea;
  border-radius: 10px;
  font-size: 0.92rem;
  font-family: inherit;
  color: var(--ink);
  background: var(--white);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.filter-field input:focus,
.filter-field select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}

.filter-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-submit {
  padding: 0.65rem 1.75rem;
  font-size: 0.92rem;
  white-space: nowrap;
}

.filter-reset {
  text-align: center;
  font-size: 0.82rem;
  color: var(--ink-muted);
  text-decoration: none;
}

.filter-reset:hover {
  color: var(--teal);
  text-decoration: underline;
}

/* Table */

.table-wrapper {
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(16, 33, 61, 0.05);
  border: 1px solid #e7eaf0;
  overflow-x: auto;
}

.leads-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table-wrapper .leads-table {
  min-width: 760px;
}

.leads-cards {
  display: none;
}

.leads-table thead th {
  text-align: left;
  background: var(--navy);
  color: var(--white);
  padding: 0.9rem 1.1rem;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.leads-table thead th:first-child {
  border-top-left-radius: 16px;
}

.leads-table thead th:last-child {
  border-top-right-radius: 16px;
}

.leads-table tbody td {
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid #eef1f5;
  color: var(--ink);
}

.leads-table tbody tr:hover {
  background: #f9fafc;
}

.leads-table tbody tr:last-child td {
  border-bottom: none;
}

.company-name {
  font-weight: 600;
}

.company-name a {
  color: var(--ink);
  text-decoration: none;
}

.company-name a:hover {
  color: var(--teal);
  text-decoration: underline;
}

/* Company detail page */

.back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.back-link:hover {
  color: var(--teal);
}

.detail-card {
  background: var(--white);
  border-radius: 12px;
  padding: 2.5rem;
  box-shadow: 0 1px 2px rgba(16, 33, 61, 0.05);
  border: 1px solid #e7eaf0;
}

.detail-header {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #eef1f5;
}

.detail-header h1 {
  margin: 0 0 0.3rem;
  font-size: 1.75rem;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.detail-subtitle {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.9rem;
}

.detail-header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.detail-header-actions .status-select {
  font-size: 0.85rem;
  padding: 0.4rem 1rem;
}

.detail-header-actions .favorite-toggle {
  font-size: 1.5rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.detail-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.detail-field-wide {
  grid-column: 1 / -1;
}

.detail-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
}

.detail-value {
  font-size: 0.98rem;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.detail-section-title {
  font-size: 1.3rem;
  color: var(--ink);
  margin: 0 0 1.25rem;
}

.nearby-list {
  list-style: none;
  margin: 0 0 2rem;
  padding: 0;
}

.nearby-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid #eef1f5;
}

.nearby-list a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.nearby-list a:hover {
  color: var(--teal);
}

.nearby-list span {
  color: var(--ink-muted);
  font-size: 0.88rem;
}

.digest-preview {
  max-width: 640px;
  margin-top: 2rem;
}

.digest-preview h2 {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
  color: var(--ink);
}

.ownership-banner {
  margin: 0 0 1.5rem;
  padding: 0.9rem 1.1rem;
  background: rgba(212, 175, 55, 0.14);
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 10px;
  color: #6a5414;
  font-size: 0.92rem;
}

.contract-list {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
}

.contract-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.6rem 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid #eef1f5;
}

.contract-list strong {
  display: block;
}

.contract-list span {
  display: block;
  color: var(--ink-muted);
  font-size: 0.88rem;
}

.contract-form {
  margin: 0 0 2.25rem;
}

.contract-types {
  margin: 0 0 1.15rem;
  padding: 0.9rem 1rem 1rem;
  border: 1px solid #e7eaf0;
  border-radius: 12px;
  background: #fafbfc;
}

.contract-types legend {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--navy);
  padding: 0 0.35rem;
}

.contract-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.45rem 0.75rem;
}

.contract-type-option {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}

.contract-type-option input {
  width: 16px;
  height: 16px;
  accent-color: #0a1930;
}

.contract-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.contract-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.agenda-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.25rem;
}

.agenda-tabs a {
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  border: 1px solid #d8dee8;
  color: var(--navy);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
}

.agenda-tabs a.is-active {
  background: #0a1930;
  border-color: #0a1930;
  color: #fff;
}

.agenda-row-soon td:nth-child(3) {
  color: #9a3412;
  font-weight: 700;
}

.agenda-row-upcoming td:nth-child(3) {
  color: #854d0e;
  font-weight: 600;
}

.agenda-row-expired td {
  opacity: 0.65;
}

.muted {
  color: var(--ink-muted);
  font-size: 0.82rem;
  margin-top: 0.15rem;
}

@media (max-width: 700px) {
  .contract-form-grid,
  .contract-type-grid {
    grid-template-columns: 1fr;
  }
}

.notes-form textarea {
  width: 100%;
  min-height: 120px;
  margin-bottom: 0.75rem;
  padding: 0.75rem 0.9rem;
  border: 1.5px solid #dbe1ea;
  border-radius: 10px;
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  resize: vertical;
}

.notes-form textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}

.note-mark {
  display: inline-block;
  margin-left: 0.35rem;
  color: var(--gold);
  font-size: 0.8rem;
}

.detail-note {
  margin-top: 1.25rem;
  color: var(--ink-muted);
  font-size: 0.9rem;
}

.contact-result-list {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
  display: grid;
  gap: 1rem;
}

.contact-result {
  border: 1px solid #e7eaf0;
  border-radius: 10px;
  padding: 1rem 1.15rem;
  background: #fbfcfe;
}

.contact-result-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.45rem;
}

.contact-result-head strong {
  color: var(--ink);
}

.contact-line {
  margin: 0.25rem 0;
  font-size: 0.95rem;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.contact-line a {
  color: var(--navy);
  font-weight: 600;
}

.contact-result .detail-note {
  margin-top: 0.7rem;
}

.match-pill {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.match-sure {
  background: rgba(46, 196, 182, 0.16);
  color: #1c8c81;
}

.match-likely {
  background: rgba(212, 175, 55, 0.18);
  color: #8a6d1c;
}

.match-possible {
  background: rgba(10, 25, 48, 0.08);
  color: var(--ink-muted);
}

.contact-locked {
  border: 1px dashed #cfd6e0;
  border-radius: 10px;
  padding: 1.15rem 1.2rem 1.25rem;
  background: #f7f8fb;
  margin-bottom: 0.5rem;
}

.contact-locked p:first-child {
  margin: 0 0 0.9rem;
  color: var(--ink);
}

.contact-locked .cta-button {
  display: inline-block;
  text-decoration: none;
}

@media (max-width: 768px) {
  .detail-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .detail-card {
    padding: 1.75rem 1.25rem;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }
}

.favorite-cell {
  color: var(--gold);
  font-size: 1.1rem;
  text-align: center;
}

.empty-row {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--ink-muted);
}

/* Status badges */

.status-badge {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.status-new {
  background: rgba(46, 196, 182, 0.15);
  color: #1c8c81;
}

.status-contacted {
  background: rgba(212, 175, 55, 0.18);
  color: #8a6d1c;
}

.status-interested {
  background: rgba(10, 25, 48, 0.1);
  color: var(--navy);
}

.status-client {
  background: var(--teal);
  color: var(--white);
}

.status-rejected {
  background: rgba(92, 107, 132, 0.15);
  color: var(--ink-muted);
}

.status-select {
  border: none;
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

.status-select:focus {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.favorite-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
  color: #c7cedb;
  transition: color 0.15s ease, transform 0.15s ease;
}

.favorite-toggle:hover {
  color: var(--gold-soft);
  transform: scale(1.15);
}

.favorite-toggle.is-favorite {
  color: var(--gold);
}

.favorite-toggle .star {
  pointer-events: none;
}

.inline-save-error {
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: #b3261e;
}

/* Pagination */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 2rem;
}

.pagination a {
  color: var(--teal);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.pagination a:hover {
  text-decoration: underline;
}

.pagination-status {
  color: var(--ink-muted);
  font-size: 0.88rem;
}

/* Responsive */

@media (max-width: 900px) {
  .filter-bar {
    grid-template-columns: repeat(2, 1fr);
  }

  .filter-actions {
    grid-column: span 2;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
  }
}

@media (max-width: 560px) {
  .filter-bar {
    grid-template-columns: 1fr;
  }

  .filter-actions {
    grid-column: span 1;
    flex-direction: column;
  }

  .filter-field input,
  .filter-field select,
  .filter-submit {
    font-size: 16px;
    min-height: 44px;
  }

  .dashboard-wrapper {
    padding: 1.5rem 1rem 4rem;
  }

  .table-wrapper {
    display: none;
  }

  .leads-cards {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .lead-card {
    background: var(--white);
    border: 1px solid #e7eaf0;
    border-radius: 12px;
    padding: 1rem 1.1rem;
  }

  .lead-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
  }

  .lead-card-name {
    font-weight: 700;
    color: var(--ink);
    text-decoration: none;
    overflow-wrap: anywhere;
  }

  .lead-card-name:hover {
    color: var(--teal);
  }

  .lead-card-meta {
    margin: 0.45rem 0 0.75rem;
    color: var(--ink-muted);
    font-size: 0.85rem;
    line-height: 1.45;
  }

  .lead-card .status-select {
    width: 100%;
    min-height: 44px;
    font-size: 0.9rem;
  }

  .lead-card .favorite-toggle,
  .detail-header-actions .favorite-toggle,
  .favorite-toggle {
    min-width: 44px;
    min-height: 44px;
    padding: 0;
  }

  .detail-header-actions {
    width: 100%;
  }

  .detail-header-actions .status-select {
    flex: 1;
    min-height: 44px;
  }

  .detail-card {
    padding: 1.25rem 1rem;
  }
}
