/* CORES E TEMAS */
:root {
  color-scheme: light;
  --navy: #0a2540;
  --blue: #0070f3;
  --red: #e63946;
  --bg: #f8f9fa;
  --panel: #ffffff;
  --text: #374151;
  --heading: #0a2540;
  --muted: #6b7280;
  --border: #e2e8f0;
  --soft: #f9fafb;
  --hover: #f0f7ff;
  --insight: #eff6ff;
  --insight-border: #dbeafe;
  --input: #f9fafb;
  --table-head: #0a2540;
}

html.dark {
  color-scheme: dark;
  --bg: #111827;
  --panel: #1f2937;
  --text: #d1d5db;
  --heading: #ffffff;
  --muted: #9ca3af;
  --border: #374151;
  --soft: #273244;
  --hover: #374151;
  --insight: #17263e;
  --insight-border: #28446c;
  --input: #374151;
  --table-head: #111827;
}

/* GERAL */
* { box-sizing: border-box; }

body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  overflow: hidden;
  font-family: "Inter", sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
}

button, input, select, textarea { font: inherit; }
button, .import-button { cursor: pointer; }
button { color: inherit; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
[hidden] { display: none !important; }
a { color: var(--blue); text-decoration: none; }
h2, h3 { color: var(--heading); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.dark ::-webkit-scrollbar-thumb { background: #475569; }

/* LATERAL E LOGO */
.sidebar {
  width: 288px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--border);
  box-shadow: 4px 0 24px rgb(0 0 0 / 2%);
  z-index: 30;
}

.logo-area {
  min-height: 190px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  transition: background-color 0.2s, border-color 0.2s;
}

.logo-area img {
  width: 100%;
  max-width: 256px;
  height: 160px;
  object-fit: contain;
  background: transparent;
  filter: none;
}

html.dark .logo-area img { filter: url("#logo-dark-filter"); }
.logo-fallback { text-align: center; color: #0a2540; }
.dark .logo-fallback { color: #93c5fd; }

.logo-fallback strong {
  display: block;
  font-size: 36px;
  font-weight: 800;
  letter-spacing: 4px;
}

.logo-fallback span {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--red);
}

.dark .logo-fallback span { color: #fb7185; }

/* IMPORTAÇÃO */
.import-area { padding: 24px 24px 8px; }

.import-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: 8px;
  background: #0a2540;
  color: #fff;
  font-weight: 500;
  box-shadow: 0 1px 2px rgb(0 0 0 / 5%);
}

.import-button:hover { background: #113255; }
.dark .import-button { background: #2563eb; }
.import-button i { font-size: 20px; }
.import-button:focus-within { outline: 3px solid var(--blue); outline-offset: 3px; }
#excel-file { position: absolute; width: 1px; height: 1px; opacity: 0; }

.import-help {
  margin: 8px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.sheet-panel {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--soft);
}

.sheet-panel label { font-size: 12px; font-weight: 600; }
.sheet-panel button { width: 100%; margin-top: 10px; }

/* FILTROS */
.filters { padding: 24px; flex: 1; overflow-y: auto; }

.filters-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.field { margin-bottom: 20px; }

.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 14px;
  font-weight: 500;
  color: var(--heading);
}

input, select {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input);
  color: var(--text);
}

.search-wrap { position: relative; }

.search-wrap i {
  position: absolute;
  top: 50%;
  left: 11px;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 18px;
}

.search-wrap input { padding-left: 36px; }

.sidebar-action {
  width: 100%;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font-weight: 500;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.sidebar-action:hover { background: var(--soft); border-color: var(--border); }
.clear-filters { color: var(--red); }
.clear-data { margin-top: 14px; color: var(--muted); font-size: 12px; }

/* CABEÇALHO */
main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.header {
  padding: 20px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

h1 {
  margin: 0;
  color: var(--heading);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.subtitle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.subtitle i { color: var(--red); }
.header-actions { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }

.button {
  padding: 9px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--soft);
  color: var(--heading);
  font-size: 13px;
  font-weight: 500;
}

.button:hover { background: var(--hover); }

.theme-toggle {
  width: 40px;
  height: 40px;
  padding: 0;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e2e8f0;
  border-radius: 50%;
  background: #fff;
  color: #0a2540;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.theme-toggle:hover { background: #f8fafc; border-color: #cbd5e1; }
.dark .theme-toggle { background: #1f2937; border-color: #374151; color: #facc15; }
.dark .theme-toggle:hover { background: #273244; border-color: #475569; }
.theme-toggle svg { display: block; pointer-events: none; }

.user-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 16px 6px 6px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--soft);
  color: var(--heading);
  font-weight: 500;
}

.avatar {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #0a2540;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.content { flex: 1; min-height: 0; overflow-y: auto; padding: 32px; }

.library-warning {
  margin-bottom: 20px;
  padding: 14px;
  border: 1px solid #f5d58a;
  border-radius: 8px;
  background: #fff7df;
  color: #85500a;
  line-height: 1.6;
}

/* INSIGHTS */
.insights {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px;
  margin-bottom: 24px;
  border: 1px solid var(--insight-border);
  border-radius: 12px;
  background: var(--insight);
  box-shadow: 0 1px 2px rgb(0 0 0 / 3%);
}

.insight-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
  background: #dbeafe;
  color: #0070f3;
  font-size: 23px;
}

.dark .insight-icon { background: #1e3a5f; color: #60a5fa; }
.insight-body { flex: 1; min-width: 0; }

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
}

.section-title i { color: var(--blue); font-size: 20px; }
#insights-container { color: var(--text); line-height: 1.7; }
#insights-container ul { margin: 0; padding-left: 18px; }
#insights-container li + li { margin-top: 5px; }

/* INDICADORES */
.kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.kpi {
  position: relative;
  overflow: hidden;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 1px 2px rgb(0 0 0 / 4%);
}

.kpi::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--blue);
}

.kpi.red::after { background: var(--red); }
.kpi.navy::after { background: #0a2540; }
.dark .kpi.navy::after { background: #3b82f6; }
.kpi.green::after { background: #22c55e; }

.kpi-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.kpi-label { margin: 0; font-weight: 500; color: var(--muted); }

.kpi-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 5px;
  background: var(--insight);
  color: var(--blue);
  font-size: 21px;
}

.kpi.green .kpi-icon { color: #16a34a; }
.kpi-value { margin: 0; color: var(--heading); font-size: 30px; font-weight: 700; }
.quality-value { display: flex; align-items: flex-end; gap: 8px; }
.quality-note { padding-bottom: 5px; font-size: 10px; color: var(--muted); }

/* CONTADORES DE CONTATOS */
.contact-summary { margin: 0 0 28px; }
.contact-summary-title { margin: 0 0 12px; font-size: 16px; color: var(--heading); }

.contact-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.contact-summary-card {
  padding: 16px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--heading);
}

.contact-summary-card[aria-pressed="true"] {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
  background: var(--insight);
}

.contact-summary-card span {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.contact-summary-card i { font-size: 20px; color: var(--blue); }
.contact-summary-card strong { display: block; margin-top: 10px; font-size: 26px; }
.contact-summary-note { margin: 12px 0 0; font-size: 11px; color: var(--muted); line-height: 1.6; }

/* GRÁFICOS */
.charts-row, .lower-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 24px;
  margin-bottom: 32px;
}

.card {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 1px 2px rgb(0 0 0 / 4%);
}

.chart-help { margin: 0 0 16px; color: var(--muted); font-size: 12px; }
.chart-area { position: relative; height: 250px; }
.chart-area canvas { cursor: pointer; }

.lower-row > .card:first-child {
  display: grid;
  grid-template-rows: auto auto 420px;
  align-content: start;
}

.lower-row > .card:first-child .porte-chart {
  position: relative;
  width: 100%;
  height: 420px;
  min-height: 0;
}

.porte-chart canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

/* TABELA */
.table-card { min-width: 0; padding: 0; overflow: hidden; }

.table-heading {
  padding: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--border);
}

.table-heading-left { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.table-heading .section-title { margin: 0; }

.table-count {
  padding: 5px 12px;
  border-radius: 99px;
  background: var(--insight);
  color: var(--blue);
  font-size: 12px;
  font-weight: 500;
}

.export-button {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 6px;
  background: #16a34a;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
}

.export-button:hover { background: #15803d; }
.table-scroll { position: relative; max-height: 450px; overflow: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  white-space: nowrap;
  font-size: 13px;
}

thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--table-head);
  color: #fff;
}

th { padding: 16px 18px; font-size: 11px; text-transform: uppercase; font-weight: 600; }

th button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  text-transform: inherit;
}

th button:hover { color: #93c5fd; }
.sort-icon { color: #9ca3af; font-size: 15px; }
td { padding: 13px 18px; border-bottom: 1px solid var(--border); color: var(--muted); }
tbody tr:nth-child(even) { background: var(--soft); }
tbody tr:hover { background: var(--hover); }
.company-name { color: var(--heading); font-weight: 500; }

.priority-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 4px 6px;
  border-radius: 4px;
  background: #ffedd5;
  color: #c2410c;
  font-size: 10px;
  font-weight: 700;
}

.segment-badge {
  display: inline-block;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--soft);
  color: var(--text);
  font-size: 12px;
}

.score-badge { display: inline-block; padding: 5px 10px; border-radius: 4px; font-size: 12px; font-weight: 700; }
.score-badge.high { background: #ffedd5; color: #c2410c; }
.score-badge.medium { background: #dbeafe; color: #1d4ed8; }
.score-badge.low { background: #e5e7eb; color: #4b5563; }

.status-select {
  width: auto;
  min-width: 135px;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}

.status-0 { background: #e5e7eb; color: #4b5563; }
.status-1 { background: #dbeafe; color: #1d4ed8; }
.status-2 { background: #dcfce7; color: #15803d; }
.status-3 { background: #f3e8ff; color: #7e22ce; }
.status-4 { background: #fee2e2; color: #b91c1c; }

/* CONTATOS DO PIPELINE */
.contact-actions {
  display: grid;
  grid-template-columns: max-content max-content;
  align-items: start;
  column-gap: 24px;
  row-gap: 8px;
}

.contact-column { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.whatsapp-column { grid-column: 1; grid-row: 1; }
.email-column { grid-column: 2; grid-row: 1; }

.contact-title {
  display: inline-block;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--soft);
  color: var(--heading);
  font-size: 12px;
  font-weight: 600;
}

.contact-column a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 0;
  color: var(--blue);
  white-space: nowrap;
}

.contact-column a i { font-size: 22px; flex-shrink: 0; }
.contact-column .whatsapp { color: #16a34a; }
.contact-column a:hover .contact-link-text { text-decoration: underline; }
.contact-link-text { font-size: 12px; font-weight: 500; }
.no-contact, .contact-invalid { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }

.table-empty { padding: 45px 20px; text-align: center; color: var(--muted); }
.table-empty > i { font-size: 48px; color: #94a3b8; }
.table-empty p { margin: 12px 0 0; }
.table-empty p + p { margin-top: 6px; font-size: 12px; }

/* ACOMPANHAMENTO COMERCIAL */
.company-follow {
  display: block;
  margin-top: 8px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--insight);
  color: var(--blue);
  font-size: 11px;
}

.actions-panel { margin-bottom: 32px; }

.actions-heading, .crm-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.actions-heading h2, .crm-heading h2 { flex: 1; margin: 0; }
.actions-tabs { display: flex; flex-wrap: wrap; gap: 10px; }

.actions-tabs button {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--soft);
  color: var(--heading);
}

.actions-tabs button[aria-pressed="true"] {
  border-color: var(--blue);
  background: var(--insight);
}

.actions-tabs strong { margin-left: 8px; }
.actions-help, .actions-empty { color: var(--muted); font-size: 12px; line-height: 1.6; }

.action-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
}

.action-info { min-width: 0; }
.action-info strong { display: block; color: var(--heading); }
.action-info > span { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.action-note { margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }
.action-item > button { flex-shrink: 0; }
.backup-import { cursor: pointer; }

.crm-dialog {
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100dvh - 40px);
  padding: 24px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
}

.crm-dialog::backdrop { background: rgb(0 0 0 / 65%); }
.crm-dialog h2 { font-size: 20px; overflow-wrap: anywhere; }
#crm-contacts { overflow-x: auto; padding-bottom: 8px; margin-bottom: 20px; }

.crm-dialog textarea {
  width: 100%;
  resize: vertical;
  min-height: 100px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input);
  color: var(--text);
}

.crm-buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.crm-buttons button[type="submit"] { background: var(--blue); color: white; }
.crm-history { padding: 0; margin: 0; list-style: none; }
.history-item { padding: 12px 0; border-top: 1px solid var(--border); }
.history-item time { color: var(--muted); font-size: 11px; }
.history-item p { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }

/* RODAPÉ E AVISOS */
.footer {
  padding: 12px 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  background: #0a2540;
  color: #d1d5db;
  font-size: 12px;
}

.dark .footer { background: #030712; }

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
  max-width: min(440px, calc(100vw - 40px));
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-left: 4px solid #22c55e;
  border-radius: 8px;
  background: var(--panel);
  color: var(--heading);
  box-shadow: 0 8px 30px rgb(0 0 0 / 15%);
  font-size: 13px;
  line-height: 1.6;
}

.toast.erro { border-left-color: var(--red); }
.mobile-filters, .close-filters, .backdrop { display: none; }

/* RESPONSIVIDADE */
@media (min-width: 1536px) {
  .kpis { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 16px; }
  .kpi { padding: 18px; }
  .kpi-label { font-size: 13px; }
}

@media (max-width: 1100px) {
  .header { flex-wrap: wrap; }
  .header-actions { gap: 10px; }
  .charts-row, .lower-row { grid-template-columns: 1fr; }
}

@media (max-width: 767px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(288px, 88vw);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 60;
  }

  body.filters-open .sidebar { transform: translateX(0); }

  body.filters-open .backdrop {
    display: block;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: rgb(0 0 0 / 50%);
    z-index: 50;
  }

  .mobile-filters { display: inline-flex; margin-bottom: 12px; }

  .close-filters {
    display: block;
    padding: 12px;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: var(--panel);
    color: var(--heading);
    text-align: right;
  }

  .header { padding: 16px; gap: 14px; }
  h1 { font-size: 16px; }
  .subtitle { font-size: 12px; }
  .header-actions { width: 100%; justify-content: flex-end; }
  .content { padding: 16px; }
  .insights { gap: 12px; padding: 16px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
  .kpi { padding: 15px; }
  .kpi-label { font-size: 12px; }
  .kpi-value { font-size: 27px; }
  .quality-note { display: none; }
  .charts-row, .lower-row { gap: 18px; margin-bottom: 24px; }
  .lower-row > .card:first-child { grid-template-rows: auto auto 320px; }
  .lower-row > .card:first-child .porte-chart { height: 320px; }
  .contact-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer { padding: 12px 16px; }
  .action-item { align-items: flex-start; flex-direction: column; }
  .crm-dialog { padding: 18px; }
  .actions-heading h2 { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* IMPRESSÃO */
@media print {
  @page { size: A4; margin: 10mm; }

  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    box-shadow: none !important;
  }

  html, body {
    height: auto !important;
    overflow: visible !important;
    display: block !important;
    background: #fff !important;
    color: #111 !important;
  }

  main { display: block; }

  .sidebar, .backdrop, .mobile-filters, .header-actions,
  .footer, .toast, .export-button, .library-warning,
  .crm-dialog, .company-follow, .actions-heading .button,
  .actions-tabs, .action-item > button {
    display: none !important;
  }

  .header { padding: 0 0 15px; }
  .content { padding: 15px 0 0; overflow: visible; }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .charts-row, .lower-row { display: block; }
  .charts-row > .card, .lower-row > .card { margin-bottom: 18px; }
  .card, .kpi, .insights, .contact-summary-card, .action-item { break-inside: avoid; }
  .table-card, .actions-panel { break-inside: auto; }
  .table-scroll { overflow: visible; max-height: none; }
  .chart-area { height: 200px; }
  .lower-row > .card:first-child { grid-template-rows: auto auto 260px; }
  .lower-row > .card:first-child .porte-chart { height: 260px; min-height: 0; }
  thead { position: static; display: table-header-group; }
  tr { break-inside: avoid; }
  table { white-space: normal; font-size: 10px; }
  th, td { padding: 7px; }
  .status-select { min-width: 0; max-width: 110px; font-size: 10px; }
  .contact-summary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}