.card, .metric, .line-card, .empty, .reminder {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.card, .line-card, .empty, .reminder {
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}
.card > :last-child,
.line-card > :last-child,
.empty > :last-child,
.reminder > :last-child,
.modal > :last-child { margin-bottom: 0; }
.metric { padding: var(--space-3) var(--space-4); min-height: 88px; }
.metric-label, .eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}
.metric-value, .summary-total strong, .quote-summary .summary-total {
  margin: var(--space-1) 0 0;
  font-size: 1.375rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.metric.good .metric-value, .good, .profit-good { color: var(--good); }
.metric.bad .metric-value, .bad, .profit-bad { color: var(--bad); }
.summary-row, .est-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-4);
  margin: 0 0 var(--space-2);
  font-variant-numeric: tabular-nums;
}
.summary-row span:last-child,
.summary-row strong {
  text-align: right;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.quote-summary h2 { font-size: 1.0625rem; margin-bottom: var(--space-3); }
.guidance, .callout, .banner-internal, .reminder {
  padding: var(--space-3);
  border-radius: var(--radius);
}
.guidance, .callout, .banner-internal { margin: 0 0 var(--space-3); }
.guidance { background: var(--accent-2); }
.callout, .reminder { background: var(--warn-bg); color: #3e2c10; border: 1px solid #ead9b0; }
.banner-internal {
  background: var(--accent-2);
  color: var(--ink);
  border: 1px solid var(--line);
}
.hint { color: var(--muted); font-size: 0.875rem; line-height: 1.45; }
.field { display: flex; flex-direction: column; gap: var(--space-1); margin: 0; min-width: 0; }
.field label, legend { font-weight: 600; }
.req { color: var(--bad); font-weight: 500; }
.input, .search-hit, .menu-btn {
  min-height: var(--control);
  width: 100%;
  border: 1px solid var(--input-line);
  border-radius: var(--radius);
  background: white;
  padding: var(--space-2) var(--space-3);
  line-height: 1.25;
}
select.input { padding-right: var(--space-6); }
textarea.input { min-height: 6rem; resize: vertical; line-height: 1.45; }
.input:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.input[aria-invalid="true"] { border-color: var(--bad); }
.field-error { color: var(--bad); margin: 0; font-size: 0.875rem; }
.btn, .menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control);
  padding: var(--space-2) var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius);
  text-decoration: none;
  background: white;
  cursor: pointer;
  font-weight: 600;
  width: auto;
  line-height: 1.2;
}
.menu-btn { width: auto; }
.btn-primary { background: var(--accent); color: white; }
.btn-secondary { background: white; border-color: var(--input-line); color: var(--ink); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent); padding-left: var(--space-2); padding-right: var(--space-2); }
.btn-danger { background: var(--bad); color: white; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2px 8px;
  min-height: 1.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  background: white;
  line-height: 1.2;
  white-space: nowrap;
}
.status-draft { background: #f3f1ec; }
.status-sent { background: var(--accent-2); }
.status-accepted, .status-scheduled { background: #e7f0ea; }
.status-completed { background: var(--good-bg); color: var(--good); }
.status-declined, .status-cancelled { background: var(--bad-bg); color: var(--bad); }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table caption { text-align: left; margin: 0 0 var(--space-2); }
.data-table th, .data-table td {
  text-align: left;
  vertical-align: top;
  padding: var(--space-3) var(--space-2);
  border-top: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.data-table th {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.data-table .num,
.data-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  overflow-wrap: normal;
}
.data-table .row-actions { flex-wrap: nowrap; }
.line-card h3 { margin-bottom: var(--space-3); }
.line-total { font-variant-numeric: tabular-nums; font-weight: 600; margin: var(--space-2) 0; }
.search-results { display: flex; flex-direction: column; gap: var(--space-1); }
.search-hit { text-align: left; width: 100%; background: white; cursor: pointer; }
.checkline { display: flex; gap: var(--space-2); align-items: center; min-height: var(--control); }
.plain-list { margin: 0; padding-left: 1.125rem; }
.plain-list li { margin: 0 0 var(--space-1); overflow-wrap: anywhere; }
.follow-list { list-style: none; padding: 0; margin: 0; }
.follow-list li {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: var(--space-2) var(--space-4);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--line);
  align-items: baseline;
}
.follow-list li .hint { grid-column: 1 / -1; margin: 0; }
.empty { max-width: 36rem; }
.empty h2 { font-size: 1.125rem; }
.pager { display: flex; gap: var(--space-3); align-items: center; margin-top: var(--space-4); }
.modal {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-5);
  max-width: 32rem;
  width: calc(100% - var(--space-6));
  max-height: 90vh;
  overflow: auto;
  background: var(--card);
}
.modal::backdrop { background: rgba(20, 32, 51, 0.48); }
.logo-preview, .est-logo { max-height: 72px; width: auto; background: white; }
#toasts { position: fixed; right: var(--space-4); bottom: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); z-index: 40; }
.toast {
  background: var(--navy);
  color: white;
  padding: var(--space-3) var(--space-4);
  margin: 0;
  max-width: 22rem;
  border-radius: var(--radius);
}
details summary { cursor: pointer; min-height: var(--control); display: flex; align-items: center; }
.reminder { display: flex; justify-content: space-between; gap: var(--space-4); align-items: center; flex-wrap: wrap; }
.reminder p { margin: 0; }

@media (max-width: 720px) {
  .data-table thead { display: none; }
  .data-table tr {
    display: block;
    border: 1px solid var(--line);
    margin-bottom: var(--space-3);
    padding: var(--space-2) var(--space-3);
    background: white;
    border-radius: var(--radius);
  }
  .data-table td, .data-table th[scope="row"] {
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
    border: 0;
    padding: var(--space-2) 0;
    text-align: left;
  }
  .data-table .num { text-align: right; }
  .data-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.75rem;
    flex: none;
    max-width: 40%;
  }
  .follow-list li { grid-template-columns: 1fr; }
}
