.dashboard-insight-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 18px 0;
}

.dashboard-insight-metrics article {
  min-height: 126px;
  border: 1px solid var(--pc-card-border);
}

.dashboard-insight-metrics span,
.dashboard-insight-metrics small,
.panel-note,
.status-grid small { color: var(--pc-text-muted); }

.dashboard-insight-metrics strong { font-size: clamp(1.5rem, 2.4vw, 2.15rem); }

.form-error {
  min-height: 1.3em;
  margin: 0;
  color: var(--pc-danger);
  font-size: .9rem;
  font-weight: 700;
}

.form-error:empty { min-height: 0; }

[aria-invalid="true"] { border-color: var(--pc-danger) !important; }

.sidebar a[aria-current="page"] { box-shadow: inset 3px 0 0 currentColor; }

.lead-whatsapp-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid #13a86b;
  border-radius: 11px;
  color: #fff;
  background: #16a86d;
  font-size: .86rem;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 7px 16px rgba(22, 168, 109, .2);
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}

.lead-whatsapp-button:hover {
  color: #fff;
  background: #0d8f5b;
  transform: translateY(-1px);
  box-shadow: 0 9px 20px rgba(13, 143, 91, .28);
}

.lead-whatsapp-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex: 0 0 auto;
}

.lead-whatsapp-unavailable {
  color: var(--pc-text-muted);
  font-size: .82rem;
  font-weight: 700;
}

/* Os cartões usam apenas a barra inferior; os antigos quadrados decorativos foram removidos. */
.metrics article::before {
  display: none !important;
  content: none !important;
}

.notification-center {
  position: relative;
  flex: 0 0 auto;
}

.notification-bell {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  min-height: 46px;
  padding: 0;
  border: 1px solid var(--pc-card-border);
  border-radius: 15px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 8px 22px rgba(31, 55, 90, .1);
}

.notification-bell svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 2px solid var(--panel);
  border-radius: 999px;
  color: #fff;
  background: var(--pc-danger);
  font-size: 10px;
  font-weight: 900;
  line-height: 16px;
}

.notification-panel {
  position: absolute;
  z-index: 100;
  top: calc(100% + 10px);
  right: 0;
  width: min(390px, calc(100vw - 28px));
  max-height: min(560px, calc(100vh - 110px));
  overflow: hidden;
  border: 1px solid var(--pc-card-border);
  border-radius: 18px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 24px 60px rgba(15, 23, 42, .2);
}

.notification-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--pc-card-border);
}

.notification-panel header div {
  display: grid;
  gap: 2px;
}

.notification-panel header small,
.notification-item time {
  color: var(--pc-text-muted);
}

button.notification-clear {
  width: auto;
  min-height: 32px;
  padding: 6px 9px;
  color: var(--pc-text-muted);
  background: transparent;
  box-shadow: none;
  font-size: .76rem;
}

.notification-list {
  max-height: 470px;
  overflow-y: auto;
}

.notification-item {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr);
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid color-mix(in srgb, var(--pc-card-border) 74%, transparent);
}

.notification-item > span {
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.notification-item.error > span { background: var(--pc-danger); }
.notification-item p { margin: 0 0 5px; font-size: .86rem; font-weight: 700; line-height: 1.4; }
.notification-item time { font-size: .7rem; }
.notification-empty { padding: 34px 20px; color: var(--pc-text-muted); text-align: center; font-size: .86rem; }

.form-validation-summary {
  display: none;
  grid-column: 1 / -1;
  margin: 0;
  color: var(--pc-danger);
  font-size: .9rem;
  font-weight: 800;
}

.form-validation-summary:not(:empty) { display: block; }

label:has(> [aria-invalid="true"]),
label:has(.input-action-row [aria-invalid="true"]) {
  color: var(--pc-danger) !important;
}

.field-error-message {
  display: block;
  margin-top: 5px;
  color: var(--pc-danger);
  font-size: .76rem;
  font-weight: 800;
  line-height: 1.25;
}

.table-wrap th .table-sort-button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  width: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  color: inherit !important;
  background: transparent !important;
  box-shadow: none !important;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}

.table-wrap th .table-sort-button:hover {
  color: inherit !important;
  background: transparent !important;
  box-shadow: none !important;
  transform: none !important;
}

.table-wrap th .table-sort-button span {
  color: var(--pc-text-muted);
  font-size: .95rem;
  line-height: 1;
}

.table-wrap th .table-sort-button.active,
.table-wrap th .table-sort-button.active span { color: inherit !important; }

.period-filter-form {
  grid-template-columns: minmax(150px, 220px) minmax(150px, 220px) auto auto auto;
}

.period-filter-form button {
  width: auto;
  min-height: 42px;
  grid-column: auto;
  white-space: nowrap;
}

.lead-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  min-width: 245px;
}

.lead-contact-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  margin: 0;
  padding: 7px 10px;
  border: 1px solid var(--pc-card-border);
  border-radius: 10px;
  color: var(--pc-text-muted);
  background: var(--surface, #fff);
  cursor: pointer;
  white-space: nowrap;
}

.lead-contact-check:has(input:checked) {
  border-color: #15803d;
  color: #087a45;
  background: #ecfdf3;
}

.lead-contact-check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #15803d;
}

.lead-contact-check span { font-size: .78rem; font-weight: 800; }

:root[data-theme="dark"] .lead-contact-check:has(input:checked) {
  color: #86efac;
  background: #123c2a;
}

.toast {
  display: none !important;
}

@media (max-width: 920px) {
  .topbar-actions {
    grid-template-columns: 42px 42px minmax(0, 1fr) !important;
  }

  .notification-bell {
    width: 42px;
    height: 42px;
    min-height: 42px;
    border-radius: 12px;
  }

  .notification-panel {
    position: fixed;
    top: 72px;
    right: 12px;
    left: 12px;
    width: auto;
  }

  .period-filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .period-filter-form label { grid-column: auto; }
  .period-filter-form button { width: 100%; }
  .lead-row-actions { min-width: 0; flex-wrap: wrap; }
}

@media (max-width: 520px) {
  .period-filter-form { grid-template-columns: 1fr; }
  .period-filter-form label { grid-column: auto; }
  .lead-row-actions { width: 100%; }
  .lead-row-actions .lead-whatsapp-button,
  .lead-contact-check { flex: 1 1 100%; justify-content: center; }
}

@media (forced-colors: active) {
  .health-badge, .badge, button, input, select, textarea { border: 1px solid ButtonText; }
}
