.audit-link,
.audit-link-button {
  align-items: center;
  border: 1px solid rgba(161, 88, 37, 0.35);
  border-radius: 999px;
  color: #9c4f20;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 700;
  gap: 0.35rem;
  justify-content: center;
  letter-spacing: 0.01em;
  padding: 0.45rem 0.75rem;
  text-decoration: none;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.audit-link:hover,
.audit-link:focus-visible,
.audit-link-button:hover,
.audit-link-button:focus-visible {
  background: #a85825;
  border-color: #a85825;
  color: #fffaf3;
  transform: translateY(-1px);
}

.extraction-audit-header {
  align-items: end;
}

.extraction-audit-summary {
  align-items: center;
  display: flex;
  gap: 2rem;
  justify-content: space-between;
}

.audit-admin-note,
.audit-bounded-note,
.audit-unavailable-note {
  color: #6f655d;
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0;
}

.extraction-audit-list {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.extraction-audit-card {
  overflow: hidden;
}

.extraction-audit-card-header {
  align-items: start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.audit-hash {
  color: #786e66;
  font-size: 0.8rem;
  margin: 1rem 0 0;
  overflow-wrap: anywhere;
}

.audit-text-block {
  background: #f4efe6;
  border: 1px solid rgba(104, 83, 65, 0.14);
  border-radius: 0.75rem;
  margin-top: 1rem;
  max-height: 30rem;
  overflow: auto;
  padding: 1rem;
}

.audit-text-block pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.55;
  margin: 0 0 1rem;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.audit-text-block pre:last-child {
  margin-bottom: 0;
}

.extraction-audit-card-integrity_error,
.extraction-audit-card-historically_unavailable {
  border-left: 4px solid #b96d39;
}

.audit-pagination {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin: 1.5rem 0 3rem;
}

@media (max-width: 720px) {
  .extraction-audit-summary,
  .extraction-audit-card-header {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Shared operator guidance and the tablet layout override the compact mobile cards. */
body,
button,
input,
select,
textarea {
  font-family: var(--font-sans);
}

.inline-help,
.field-help,
.table-help {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.inline-help {
  margin: 0.45rem 0 0;
}

.field-help,
.table-help {
  display: block;
  margin: 0;
}

.filter-bar label small {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.35;
}

.table-help {
  margin: 0 0 0.55rem;
  padding: 0 0.2rem;
}

.table-shell[role="region"]:focus-visible {
  outline: 3px solid rgba(177, 77, 28, 0.32);
  outline-offset: 4px;
}

.document-state-help {
  max-width: 70rem;
  margin: -0.45rem 0 1rem;
}

.workflow-help h3 {
  margin: 0;
}

.crm-plan-panel .inline-help {
  max-width: 78ch;
}

@media (min-width: 768px) and (max-width: 1180px) {
  .topbar {
    padding: 1rem 1rem 0;
  }

  .page-shell {
    width: calc(100% - 2rem);
  }

  .panel-header,
  .panel-actions {
    flex-wrap: wrap;
  }

  .panel-actions {
    justify-content: flex-start;
    text-align: left;
  }

  .filter-bar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .filter-bar label:nth-child(2) {
    grid-column: span 2;
  }

  .bulk-action-bar {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .bulk-action-bar > div {
    flex: 1 1 100%;
    margin-right: 0;
  }

  .workflow-help {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .table-shell {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-gutter: stable;
  }

  /* app.css turns the tender list into cards below 960px; tablets keep the data grid. */
  .tender-list-shell {
    overflow-x: auto;
    overflow-y: hidden;
  }

  .tender-list-table {
    display: table;
    min-width: 1320px;
  }

  .tender-list-table thead {
    display: table-header-group;
  }

  .tender-list-table tbody {
    display: table-row-group;
  }

  .tender-list-table tr {
    display: table-row;
    overflow: visible;
    border: 0;
    border-radius: 0;
  }

  .tender-list-table td {
    display: table-cell;
    grid-template-columns: none;
    padding: 0.95rem 0.8rem;
    border-top: 1px solid var(--line);
  }

  .tender-list-table td::before {
    content: none;
  }

  .tender-list-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--panel-strong);
  }

  .tender-list-table th:first-child,
  .tender-list-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 3;
    background: var(--panel-strong);
  }

  .tender-list-table thead th:first-child {
    z-index: 4;
  }

  .tender-list-table .triage-actions {
    display: grid;
  }

  .tender-list-table .triage-actions form,
  .tender-list-table .triage-button,
  .tender-list-table .quick-crm-action form {
    width: 100%;
  }

  .detail-header {
    grid-template-columns: minmax(0, 1fr);
  }

  .detail-actions {
    gap: 0.55rem;
  }

  .activity-table {
    display: table;
    min-width: 760px;
  }
}
