/* Costs page — Lead Orders + Operating Costs in one scroll.
   Mirrors the Carriers page's shell + header pattern so the visual
   language stays consistent across business-data pages. */

.costs-page {
  padding: 32px 28px;
  overflow-y: auto;
}

.costs-shell {
  max-width: 1180px;
  margin: 0 auto;
}

/* ── Page header ── */

.costs-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.costs-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 6px;
  letter-spacing: 0.01em;
}

.costs-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
  max-width: 560px;
}

.costs-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}

/* ── Section (Lead Orders + Operating Costs share styling) ── */

.costs-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 24px;
  margin-bottom: 28px;
}

.costs-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.costs-section-title-wrap {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.costs-section-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.costs-section-count {
  font-size: 12px;
  color: var(--text-muted);
}

.costs-section-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* ── Vendor manager ── */

.costs-vendor-manager {
  border: 1px solid var(--border, rgba(0,0,0,0.1));
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
  background: var(--bg-warm, rgba(0,0,0,0.02));
}

.costs-vendor-manager-head h3 {
  font-size: 14px;
  margin: 0 0 2px;
}

.costs-vendor-manager-head p {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 10px;
}

.costs-vendor-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.costs-vendor-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-top: 1px solid var(--border, rgba(0,0,0,0.07));
}

.costs-vendor-name { flex: 1; font-size: 13px; }

.costs-vendor-uses {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.costs-vendor-row .btn-ghost {
  font-size: 12px;
  padding: 3px 9px;
}

.costs-vendor-empty {
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 0;
}

/* ── Filter chips ── */

.filter-chips {
  display: inline-flex;
  background: var(--bg-warm, rgba(0,0,0,0.04));
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.filter-chip {
  background: transparent;
  border: 0;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  text-transform: capitalize;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color var(--speed, 0.15s), color var(--speed, 0.15s);
}

.filter-chip:hover { color: var(--text); }
.filter-chip.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

/* ── Table ── */

.costs-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.costs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.costs-table thead {
  background: var(--bg-warm, rgba(0,0,0,0.03));
}

.costs-table th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.costs-table th.num,
.costs-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* The "Linked" header's ⓘ sits inline with its label rather than wrapping to
   its own line — the header row is already tight on width. */
.costs-table th.num .card-info {
  display: inline-flex;
  vertical-align: middle;
  margin-left: 2px;
  width: 14px;
  height: 14px;
}

/* Marks a Received count that is auto-derived from linked records (rather than
   a manually preset batch size). */
.costs-received-auto {
  color: var(--text-dim);
  font-size: 11px;
  margin-left: 2px;
}

/* The count, with how far through it the agent is set small beneath. */
.costs-received {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.25;
}
.costs-received-detail {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}

.costs-table th.actions,
.costs-table td.actions {
  text-align: right;
  white-space: nowrap;
}

.costs-table td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.costs-table tbody tr:last-child td { border-bottom: 0; }

.costs-table tbody tr:hover {
  background: var(--bg-warm, rgba(0,0,0,0.02));
}

.cost-freq-suffix {
  color: var(--text-muted);
  font-size: 11px;
  margin-left: 3px;
}

/* ── Status pills ── */

.status-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 10px;
  background: var(--bg-warm);
  color: var(--text-muted);
}

.status-pill.status-active {
  background: rgba(34, 134, 58, 0.10);
  color: #226a3a;
}

.status-pill.status-completed {
  background: rgba(100, 100, 120, 0.10);
  color: #555a72;
}

.status-pill.status-cancelled {
  background: rgba(138, 74, 64, 0.10);
  color: #8a4a40;
}

/* ── Row action buttons (edit / delete / etc.) ── */

.icon-btn {
  background: transparent;
  border: 0;
  font: inherit;
  font-size: 14px;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  margin-left: 4px;
  transition: background-color var(--speed, 0.15s), color var(--speed, 0.15s);
}

.icon-btn:hover:not(:disabled) {
  background: var(--bg-warm);
  color: var(--text);
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.link-btn {
  background: transparent;
  border: 0;
  font: inherit;
  font-size: 12px;
  color: var(--gold, #b5893a);
  padding: 4px 8px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
}

.link-btn:hover { text-decoration: underline; }

/* ── Editor (inline add/edit form) ── */

.costs-editor {
  background: var(--bg-warm, rgba(0,0,0,0.02));
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
  margin-bottom: 16px;
}

.costs-editor-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 14px;
}

.costs-editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px 16px;
}

.costs-editor-grid label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  gap: 4px;
}

.costs-editor-grid label.full {
  grid-column: 1 / -1;
}

.costs-editor-grid input,
.costs-editor-grid select,
.costs-editor-grid textarea {
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  width: 100%;
  box-sizing: border-box;
  transition: border-color var(--speed, 0.15s);
}

.costs-editor-grid input:focus,
.costs-editor-grid select:focus,
.costs-editor-grid textarea:focus {
  outline: none;
  border-color: var(--gold, #b5893a);
}

.costs-editor-grid textarea {
  resize: vertical;
  min-height: 56px;
}

.costs-editor-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}

/* Inline editing row override — the row's full width becomes the editor */
.costs-row-editing > td {
  padding: 0;
  background: transparent;
}
.costs-row-editing .costs-editor {
  margin: 8px 0;
  border-radius: 8px;
}

/* ── Empty state ── */

.costs-empty {
  padding: 32px 24px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--bg-warm, rgba(0,0,0,0.02));
}

.costs-empty-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 6px;
}

.costs-empty-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

