/* ==========================================
   GESTOR DE LEADS — ENCANTE-SE PERSONAGENS
   Design System & Components
========================================== */

/* ---------- IMPORTS ---------- */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* ---------- DESIGN TOKENS (LIGHT — default) ---------- */
:root {
  /* Backgrounds */
  --bg-primary: #F3F6F9;
  --bg-secondary: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F8FAFC;
  --bg-surface: #F1F5F9;
  --bg-input: #F1F5F9;
  --bg-modal: #FFFFFF;
  --bg-header: #9dd4a0;
  --verde-eventos: #29a0d3;
  --branco: #FFFFFF;

  /* Text */
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --text-header: #FFFFFF;

  /* Accents */
  --accent: #3376C2;
  --accent-hover: #215D9E;
  --success: #16A34A;
  --warning: #CA8A04;
  --danger: #DC2626;
  --novo: #7C3AED;

  /* Borders & Shadows (light-specific) */
  --border-color: rgba(0,0,0,0.08);
  --shadow-card: 0 2px 12px rgba(0,0,0,0.04);
  --shadow-lg: 0 5px 20px rgba(0,0,0,0.12);

  /* Dimensions */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --header-height: 56px;
  --sombra-leve: 0 2px 4px rgba(0, 0, 0, 0.05);
  --animacao: all 0.3s ease;
  --header-control-bg: rgba(255, 255, 255, 0.16);
  --header-control-bg-hover: rgba(255, 255, 255, 0.24);
  --header-control-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);

  /* Transitions */
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);

  color-scheme: light;
}

/* ---------- DARK THEME ---------- */
[data-theme="dark"],
body.dark-mode {
  --bg-primary: #0B1120;
  --bg-secondary: #0F172A;
  --bg-card: #141B2D;
  --bg-card-hover: #1A2340;
  --bg-surface: #1E293B;
  --bg-input: #1E293B;
  --bg-modal: #111827;
  --bg-header: #29a0d3;

  --text-primary: #E8EAED;
  --text-secondary: #8B95A5;
  --text-muted: #4B5563;
  --text-header: #E8EAED;

  --accent: #3B82F6;
  --accent-hover: #2563EB;
  --success: #22C55E;
  --warning: #EAB308;
  --danger: #EF4444;
  --novo: #8B5CF6;

  --border-color: rgba(255,255,255,0.05);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.5);

  color-scheme: dark;
}

/* ---------- RESET ---------- */
*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
}

html { font-size: 14px; }

body {
  font-family: 'Poppins', sans-serif !important;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}
input, button, textarea, select {
  font-family: 'Poppins', sans-serif !important;
}

body.modal-open { overflow: hidden; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- LAYOUT ---------- */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.barra-topo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  color: var(--branco);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--sombra-leve);
  background-color: var(--verde-eventos);
}

.barra-topo .titulo {
  font-weight: 600;
  font-size: 16px;
  color: var(--branco);
}

.titulo--header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.barra-topo-left {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
}

.barra-topo-left {
  left: 20px;
}

.barra-topo-right {
  position: absolute;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
}

.barra-topo .btn-voltar {
  position: absolute;
  left: 20px;
  color: var(--branco);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
}

.btn-voltar--static {
  position: static !important;
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--header-control-bg);
  padding: 2px 8px;
  border-radius: 20px;
}

.header-control-btn {
  background: transparent;
  border: none;
  color: var(--branco);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--animacao);
  border-radius: 999px;
}

.header-control-btn:hover,
.header-control-btn:focus-visible {
  background: var(--header-control-bg-hover);
  outline: none;
}

.header-control-btn--compact {
  padding: 2px;
}

.zoom-controls button {
  padding: 2px;
}

.zoom-controls button i,
.header-icon-btn i {
  font-size: 18px;
}

.header-control-label,
#btn-zoom-reset {
  font-size: 10px;
  font-weight: 700;
  opacity: 0.8;
  user-select: none;
  cursor: pointer;
  padding: 4px 6px;
}

.header-icon-btn {
  width: 34px;
  height: 34px;
  background: var(--header-control-bg);
}

.barra-topo a,
.barra-topo a:hover {
  color: var(--branco);
  text-decoration: none;
}

.barra-topo button {
  -webkit-appearance: none;
  appearance: none;
  font: inherit;
}

.barra-topo i.ph {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

body.dark-mode .barra-topo {
  background-color: var(--azul-eventos) !important;
  color: white !important;
}

body.dark-mode .barra-topo * {
  color: white !important;
}

/* ---------- MAIN CONTENT ---------- */
.main-content {
  padding: 24px;
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.filters-single-row {
  display: flex;
  gap: 24px;
  align-items: flex-end;
  width: 100%;
}

.filters-side-top {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.input-col--wide {
  flex: 2;
}

.input-col--phone {
  flex: 1.5;
}

.input-col--sort {
  flex: 1;
  max-width: 250px;
}

.toolbar-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.toolbar-side {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  flex: 1;
}

/* ---------- CLEAN FILTERS ---------- */
.toolbar-clean {
  margin-bottom: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.status-tab {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.status-tab:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.status-tab.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.status-tab-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(51, 118, 194, 0.12);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}

.status-tab.active .status-tab-badge {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.date-filters {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-label {
  font-size: 0.82rem;
  color: var(--text-primary);
  font-weight: 600;
}

.clean-input {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.85rem;
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

.clean-input:focus {
  outline: none;
  border-color: var(--accent);
}

.clean-input.date-input {
  width: auto;
  min-width: 130px;
}

.input-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toolbar-stats-clean {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: right;
}

.settings-panel {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  border-radius: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.settings-trigger-btn,
.client-logs-trigger-btn {
  box-shadow: var(--shadow-card);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.settings-trigger-btn {
  border: none;
  background: var(--header-control-bg);
  color: var(--branco);
  box-shadow: none;
}

.client-logs-trigger-btn {
  min-height: 40px;
  padding: 0 14px;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.client-logs-trigger-btn:hover,
.client-logs-trigger-btn:focus-visible,
.client-logs-trigger-btn:active {
  text-decoration: none;
}

.settings-trigger-btn i,
.client-logs-trigger-btn i {
  font-size: 22px;
  line-height: 1;
}

.client-logs-trigger-btn span {
  line-height: 1;
}

.settings-trigger-btn:hover,
.settings-trigger-btn:focus-visible {
  color: var(--branco);
  background: var(--header-control-bg-hover);
  transform: none;
}

.client-logs-trigger-btn:hover,
.client-logs-trigger-btn:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.settings-section {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  min-height: 56px;
}

.settings-section + .settings-section {
  border-left: 1px solid var(--border-color);
}

.luisa-control {
  display: inline-flex;
}

.luisa-test-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.settings-section--action {
  justify-content: center;
}

.btn-ignored-contacts {
  min-height: 40px;
  white-space: nowrap;
  border: 0;
  box-shadow: none;
  background: transparent;
}

.settings-modal {
  max-width: 640px;
}

.settings-modal-header {
  justify-content: flex-start;
}

.settings-modal-header .modal-title-row {
  text-align: left;
}

.settings-modal-body {
  padding: 0;
}

.settings-panel--modal {
  width: 100%;
  display: flex;
  flex-direction: column;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.settings-panel--modal .settings-section {
  width: 100%;
  justify-content: space-between;
  padding: 18px 24px;
}

.settings-panel--modal .settings-section + .settings-section {
  border-left: 0;
  border-top: 1px solid var(--border-color);
}

.settings-panel--modal .luisa-test-control,
.settings-panel--modal .luisa-timeout-control {
  align-items: center;
  gap: 14px;
}

.settings-panel--modal .luisa-test-input {
  width: 220px;
  min-width: 220px;
}

.settings-panel--modal .settings-section--action {
  justify-content: flex-end;
}

.settings-panel--modal .btn-ignored-contacts {
  min-width: 220px;
}

.client-logs-modal {
  max-width: 1220px;
}

.client-logs-page-shell {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.client-logs-page-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 18px;
  padding: 24px;
  border-radius: 24px;
  border: 1px solid var(--border-color);
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--success) 20%, transparent) 0%, transparent 38%),
    linear-gradient(145deg, var(--bg-card) 0%, color-mix(in srgb, var(--bg-card) 90%, var(--bg-primary)) 100%);
  box-shadow: var(--shadow-card);
}

.client-logs-page-title {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.client-logs-page-title h1 {
  font-size: 1.8rem;
  line-height: 1.15;
}

.client-logs-page-subtitle {
  max-width: 760px;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.client-logs-modal-header {
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.client-logs-title-row {
  text-align: left;
}

.client-logs-eyebrow {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.client-logs-subtitle {
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  max-width: 720px;
}

.client-logs-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 1px;
}

.client-logs-modal-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.client-logs-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: end;
}

.client-logs-toolbar .input-col {
  min-width: 0;
}

.client-logs-toolbar .input-col--sort {
  max-width: none;
}

.client-logs-toolbar-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.client-logs-counter {
  display: inline-flex;
  align-items: center;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
}

.client-logs-feedback {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--warning) 28%, var(--border-color));
  background: color-mix(in srgb, var(--warning) 10%, var(--bg-secondary));
  color: var(--text-secondary);
  font-size: 0.84rem;
}

.client-logs-grid {
  display: grid;
  --client-log-card-min-width: 340px;
  --client-log-card-gap: 16px;
  --client-log-card-padding: 18px;
  grid-template-columns: repeat(auto-fill, minmax(var(--client-log-card-min-width), 1fr));
  gap: var(--client-log-card-gap);
}

.client-log-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: var(--client-log-card-padding);
  border-radius: 18px;
  border: 1px solid var(--border-color);
  background: linear-gradient(180deg, var(--bg-card) 0%, color-mix(in srgb, var(--bg-card) 88%, var(--bg-primary)) 100%);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: all var(--transition);
}

.client-log-card:hover,
.client-log-card:focus-visible {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  outline: none;
}

.client-log-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.client-log-card-headline {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.client-log-card-received {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  flex-shrink: 0;
  min-width: 150px;
}

.client-log-card-received-value {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-word;
}

.client-log-card-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-primary);
}

.client-log-card-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.client-log-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}

.client-log-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 700;
}

.client-log-badge--success {
  background: color-mix(in srgb, var(--success) 14%, var(--bg-secondary));
  color: var(--success);
}

.client-log-badge--warning {
  background: color-mix(in srgb, var(--warning) 14%, var(--bg-secondary));
  color: var(--warning);
}

.client-log-badge--danger {
  background: color-mix(in srgb, var(--danger) 14%, var(--bg-secondary));
  color: var(--danger);
}

.client-log-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.client-log-meta--compact {
  gap: 8px 10px;
}

.client-log-meta-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.client-log-meta-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.client-log-meta-value {
  font-size: 0.84rem;
  color: var(--text-primary);
  word-break: break-word;
}

.client-log-content-wrap {
  border-radius: 14px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  overflow: visible;
}

.client-log-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.client-log-tab {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 18px 18px 0 18px;
  border: 1px solid #d6dde6;
  background: #eef2f6;
  color: #5b6573;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition), background-color var(--transition), color var(--transition);
}

.client-log-tab:hover,
.client-log-tab:focus-visible {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  border-color: #bcc7d4;
  background: #e7ecf2;
}

.client-log-tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.client-log-tab--informacoes-computador {
  background: #eef2f6;
  border-color: #d6dde6;
}

.client-log-tab--geral {
  background: #eef2f6;
  border-color: #d6dde6;
}

.client-log-tab--ifood {
  background: #eef2f6;
  border-color: #d6dde6;
}

.client-log-tab--nfe {
  background: #eef2f6;
  border-color: #d6dde6;
}

.client-log-tab--nfse {
  background: #eef2f6;
  border-color: #d6dde6;
}

.client-log-tab--ncms {
  background: #eef2f6;
  border-color: #d6dde6;
}

.client-log-tab--config-json {
  background: #eef2f6;
  border-color: #d6dde6;
}

.client-log-content-wrap--modal {
  background: var(--bg-secondary);
}

.client-log-content-wrap--empty {
  min-height: 220px;
}

.client-log-content-wrap--informacoes-computador {
  background: #f4f8ff;
  border-color: #d7e5ff;
}

.client-log-content-wrap--geral {
  background: #f6fbf5;
  border-color: #d7ead2;
}

.client-log-content-wrap--ifood {
  background: #fff8f1;
  border-color: #f4dfc8;
}

.client-log-content-wrap--nfe {
  background: #f8f5ff;
  border-color: #e1d8f6;
}

.client-log-content-wrap--nfse {
  background: #fff5f7;
  border-color: #f2d7df;
}

.client-log-content-wrap--ncms {
  background: #f3fbfb;
  border-color: #cfe8e8;
}

.client-log-content-wrap--config-json {
  background: #f7f7f9;
  border-color: #dcdfe6;
}

.client-log-content-wrap--modal .client-log-content-body {
  background: color-mix(in srgb, #ffffff 82%, transparent);
}

.client-log-content-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.client-log-content-subtitle {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  word-break: break-word;
}

.client-logs-list-view.hidden {
  display: none;
}

.client-log-detail-view-container.hidden {
  display: none;
}

.client-log-detail-page {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.client-log-detail-page-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 18px;
  padding: 8px 0 2px;
}

.client-log-detail-page-title {
  text-align: center;
}

.client-log-detail-title-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.client-log-detail-page-title h2 {
  margin: 0;
  font-size: clamp(1.35rem, 2.2vw, 1.85rem);
  color: var(--text-primary);
}

.client-log-detail-received-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 10%, var(--bg-secondary));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border-color));
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.client-log-detail-page-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.client-log-packages {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.client-log-content-body {
  display: flex;
  flex-direction: column;
}

.client-log-search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 12px;
  flex-shrink: 0;
  position: sticky;
  top: 68px;
  z-index: 20;
  background: color-mix(in srgb, var(--bg-secondary) 94%, #ffffff);
  border-bottom: 1px solid color-mix(in srgb, var(--border-color) 72%, transparent);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(8px);
  border-radius: 12px 12px 0 0;
}

.client-log-search-input {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.8rem;
}

.client-log-search-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.client-log-search-nav {
  min-height: 34px;
  min-width: 42px;
  padding: 0 10px;
  white-space: nowrap;
  font-size: 0.82rem;
}

.client-log-download-btn {
  min-width: 42px;
  padding: 0;
}

.client-log-download-btn i {
  font-size: 1rem;
  line-height: 1;
}

.client-log-search-meta {
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
}

.client-log-search-empty {
  margin: 10px 12px 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--warning) 10%, var(--bg-secondary));
  color: var(--text-secondary);
  font-size: 0.8rem;
  flex-shrink: 0;
}

.client-log-search-empty.hidden {
  display: none;
}

.client-log-analysis-panel {
  margin: 12px 12px 0;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  background: color-mix(in srgb, var(--bg-secondary) 90%, #eef2f7);
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

.client-log-analysis-header {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 14px;
}

.client-log-analysis-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.client-log-analysis-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.client-log-analysis-description {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.8rem;
  line-height: 1.5;
}

.client-log-analysis-description code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.78rem;
}

.client-log-analysis-trigger {
  min-height: 36px;
  white-space: nowrap;
}

.client-log-analysis-summary {
  flex: 1;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.client-log-analysis-summary--success {
  color: #166534;
  background: #ecfdf3;
  border-color: #b7ebc6;
}

.client-log-analysis-summary--warning {
  color: #92400e;
  background: #fff7e8;
  border-color: #f3d3a1;
}

.client-log-analysis-summary--error {
  color: #b42318;
  background: #fff1f3;
  border-color: #f7c5cc;
}

.client-log-analysis-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.client-log-analysis-actions--single {
  justify-content: flex-end;
  flex-shrink: 0;
}

.client-log-analysis-download {
  min-height: 36px;
}

.config-download-modal {
  width: min(640px, calc(100vw - 32px));
  border-radius: 20px;
  overflow: hidden;
}

.config-download-modal-header {
  padding: 18px 22px 8px !important;
}

.config-download-modal-header .modal-title-row {
  width: 100%;
  text-align: center;
}

.config-download-modal-header h2 {
  max-width: 520px;
  margin: 0 auto;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 600;
}

.config-download-modal-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding-top: 4px;
}

.config-download-actions {
  display: flex;
  justify-content: center;
  padding-top: 0;
}

.client-log-analysis-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.client-log-analysis-card {
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  padding: 12px;
}

.client-log-analysis-card h4 {
  margin: 0 0 8px;
  font-size: 0.82rem;
  color: var(--text-primary);
}

.client-log-analysis-list {
  list-style: disc;
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.client-log-analysis-item {
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.client-log-analysis-item::marker {
  color: currentColor;
}

.client-log-analysis-item--error {
  color: #b42318;
}

.client-log-analysis-item--warning {
  color: #92400e;
}

.client-log-analysis-item--info {
  color: var(--text-secondary);
}

.client-log-analysis-item--muted {
  color: var(--text-muted);
}

.client-log-content {
  margin: 0;
  padding: 14px 12px 10px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  line-height: 1.28;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: visible;
}

.client-log-json-line {
  display: block;
  position: relative;
  border-radius: 10px;
  margin: 0;
}

.client-log-json-line-text {
  display: block;
  line-height: inherit;
}

.client-log-json-token--key {
  color: #1d4ed8;
  font-weight: 700;
}

.client-log-json-token--string {
  color: #047857;
}

.client-log-json-token--number {
  color: #b45309;
}

.client-log-json-token--boolean {
  color: #7c3aed;
  font-weight: 700;
}

.client-log-json-token--null {
  color: #6b7280;
  font-style: italic;
}

.client-log-json-token--punctuation {
  color: #94a3b8;
}

.client-log-json-line--error {
  margin: 2px -8px;
  padding: 6px 8px 6px 54px;
  background: linear-gradient(90deg, rgba(220, 38, 38, 0.12), rgba(220, 38, 38, 0.03));
  box-shadow: inset 3px 0 0 #dc2626;
}

.client-log-json-line-marker {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.client-log-content::-webkit-scrollbar {
  width: 10px;
}

.client-log-content::-webkit-scrollbar-track {
  background: transparent;
}

.client-log-content::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 28%, transparent);
  border: 2px solid transparent;
  background-clip: padding-box;
}

.client-log-line-label {
  font-weight: 700;
  color: var(--text-primary);
}

.client-log-line-value {
  font-weight: 400;
  color: var(--text-secondary);
}

.client-log-highlight {
  padding: 0 2px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--warning) 28%, transparent);
  color: var(--text-primary);
}

.client-log-highlight--active {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent);
}

.client-log-content.hidden {
  display: none;
}

.client-logs-empty {
  padding: 42px 20px;
  border-radius: 18px;
  border: 1px dashed var(--border-color);
  background: var(--bg-surface);
  text-align: center;
}

.client-logs-empty h3 {
  margin-bottom: 6px;
  font-size: 1.02rem;
}

.client-logs-empty p {
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.luisa-status-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.luisa-status-label {
  font-size: 0.64rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.luisa-test-input {
  width: 150px;
  min-width: 150px;
  padding: 8px 12px;
  border-radius: 999px;
}

.btn-luisa-test-save {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
}

.luisa-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.luisa-status-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
}

.luisa-status-badge[data-state="active"] {
  background: #e8f5e9;
  color: #2e7d32;
  border-color: #c8e6c9;
}

.luisa-status-badge[data-state="inactive"] {
  background: #ffebee;
  color: #c62828;
  border-color: #ffcdd2;
}

.luisa-status-badge[data-state="loading"] {
  background: #eef2ff;
  color: #4f46e5;
  border-color: #c7d2fe;
}

.luisa-status-badge[data-state="error"] {
  background: #fff7ed;
  color: #c2410c;
  border-color: #fdba74;
}

[data-theme="dark"] .luisa-status-badge[data-state="active"],
body.dark-mode .luisa-status-badge[data-state="active"] {
  background: rgba(34, 197, 94, 0.16);
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.3);
}

[data-theme="dark"] .luisa-status-badge[data-state="inactive"],
body.dark-mode .luisa-status-badge[data-state="inactive"] {
  background: rgba(239, 68, 68, 0.16);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}

[data-theme="dark"] .luisa-status-badge[data-state="loading"],
body.dark-mode .luisa-status-badge[data-state="loading"] {
  background: rgba(99, 102, 241, 0.18);
  color: #c7d2fe;
  border-color: rgba(99, 102, 241, 0.32);
}

[data-theme="dark"] .luisa-status-badge[data-state="error"],
body.dark-mode .luisa-status-badge[data-state="error"] {
  background: rgba(249, 115, 22, 0.16);
  color: #fdba74;
  border-color: rgba(249, 115, 22, 0.3);
}

.luisa-switch {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.luisa-switch:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.luisa-switch:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.28);
  outline-offset: 4px;
  border-radius: 999px;
}

.luisa-switch-track {
  width: 52px;
  height: 28px;
  border-radius: 999px;
  background: #e5e7eb;
  border: 1px solid rgba(148, 163, 184, 0.28);
  padding: 2px;
  display: inline-flex;
  align-items: center;
  transition: background-color 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
  box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.08);
}

.luisa-switch-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.18);
  transform: translateX(0);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.luisa-switch[aria-checked="true"] .luisa-switch-track {
  background: #00d84f;
  border-color: rgba(0, 180, 72, 0.38);
}

.luisa-switch[aria-checked="true"] .luisa-switch-thumb {
  transform: translateX(24px);
}

.luisa-switch:hover:not(:disabled) .luisa-switch-track {
  box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.08);
}

[data-theme="dark"] .luisa-switch-track,
body.dark-mode .luisa-switch-track {
  background: rgba(226, 232, 240, 0.18);
  border-color: rgba(148, 163, 184, 0.22);
}

[data-theme="dark"] .luisa-switch-thumb,
body.dark-mode .luisa-switch-thumb {
  background: #f8fafc;
}

[data-theme="dark"] .luisa-switch[aria-checked="true"] .luisa-switch-track,
body.dark-mode .luisa-switch[aria-checked="true"] .luisa-switch-track {
  background: #00c946;
  border-color: rgba(74, 222, 128, 0.34);
}

/* ---------- CARD GRID ---------- */
.leads-grid {
  --lead-card-min-width: 380px;
  --lead-card-gap: 16px;
  --lead-card-padding: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--lead-card-min-width), 1fr));
  gap: var(--lead-card-gap);
}

/* ---------- LEAD CARD ---------- */
.lead-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--lead-card-padding);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lead-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.lead-card.card--new {
  border-left: 3px solid var(--novo);
  animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
  0%, 100% { border-left-color: var(--novo); }
  50% { border-left-color: rgba(139, 92, 246, 0.3); }
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--badge-color) 15%, transparent);
  color: var(--badge-color);
  letter-spacing: 0.02em;
}

.card-body { flex: 1; }

.card-name {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.card-cycle-badge,
.card-status-badge,
.card-inactivity-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
}

.card-cycle-badge {
  padding: 4px 9px;
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
}

.card-cycle-period {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.card-status-badge {
  padding: 4px 10px;
  background: rgba(34, 197, 94, 0.14);
  color: #15803d;
}

.card-status-badge--closed {
  background: rgba(100, 116, 139, 0.16);
  color: #475569;
}

.card-inactivity-badge {
  padding: 0;
  background: transparent;
  color: var(--text-primary);
  border: none;
  box-shadow: none;
  border-radius: 0;
  justify-content: flex-start;
  font-size: 0.75rem;
  font-weight: 500;
}

.card-inactivity-badge--closed {
  background: transparent;
  color: #475569;
  border: none;
  box-shadow: none;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-bottom: 10px;
}

.meta-item {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.card-resumo {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-responsavel {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--accent);
  background: rgba(59,130,246,0.1);
  padding: 2px 8px;
  border-radius: 4px;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}

.time-container {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.time-summary-row {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.time-label {
  font-size: 0.6rem;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}

.card-time {
  font-size: 0.75rem;
  color: var(--text-primary);
  font-weight: 500;
}

.card-actions {
  display: flex;
  gap: 4px;
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--transition);
  color: var(--text-secondary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.btn-icon:hover {
  background: var(--bg-surface);
  border-color: var(--accent);
}

.btn-icon--primary {
  background: rgba(59,130,246,0.12);
  border-color: rgba(59,130,246,0.2);
  color: var(--accent);
}

.btn-icon--primary:hover {
  background: rgba(59,130,246,0.25);
}

/* ---------- MODAL ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 200ms ease;
  padding: 24px;
}

.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 820px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 300ms ease;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.modal::-webkit-scrollbar {
  display: none;
}

.lead-detail-modal {
  max-width: 980px;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.modal-header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  position: relative;
}

.modal-title-row {
  text-align: center;
  flex: 1;
}

.modal-title-row h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0;
}

.modal-badges {
  display: flex;
  gap: 8px;
}

.modal-close {
  position: absolute;
  right: 12px;
  top: 12px;
  background: transparent;
  border: none;
  color: var(--danger);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.modal-close:hover {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  color: var(--danger);
}

.modal:not(.ignored-contacts-modal) .modal-header {
  padding: 10px 18px;
}

.modal:not(.ignored-contacts-modal) .modal-close {
  top: 8px;
}

.modal-body { padding: 24px; }

.ignored-contacts-modal {
  max-width: 760px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ignored-contacts-modal .modal-header {
  padding: 10px 18px;
}

.ignored-contacts-modal .modal-close {
  top: 8px;
}

.ignored-contacts-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.ignored-contact-form {
  display: grid;
  grid-template-columns: minmax(320px, 1.8fr) minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.ignored-contact-name-col {
  position: relative;
}

.ignored-contact-counter {
  display: inline-block;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
}

.ignored-contact-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 260px;
  overflow-y: auto;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  box-shadow: var(--shadow-lg);
}

.ignored-contact-search-item {
  border: none;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color var(--transition);
}

.ignored-contact-search-item:hover {
  background: var(--bg-surface);
}

.ignored-contact-search-item strong {
  display: block;
  font-size: 0.84rem;
  color: var(--text-primary);
}

.ignored-contact-search-item span {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.ignored-contact-add {
  min-height: 40px;
}

.ignored-contact-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.ignored-contact-helper {
  margin-top: -2px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-align: center;
}

.ignored-contact-list-search {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}

.ignored-contact-list-search .clean-input {
  flex: 1;
  max-width: 860px;
}

.ignored-contact-empty--filter {
  margin-top: -6px;
}

.ignored-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  box-shadow: var(--shadow-card);
}

.ignored-toggle-copy {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.ignored-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.ignored-toggle-ui {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #e5e7eb;
  border: 1px solid rgba(148, 163, 184, 0.28);
  transition: background-color 0.22s ease, border-color 0.22s ease;
}

.ignored-toggle-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
  transition: transform 0.22s ease;
}

.ignored-toggle input:checked + .ignored-toggle-ui {
  background: #00d84f;
  border-color: rgba(0, 180, 72, 0.38);
}

.ignored-toggle input:checked + .ignored-toggle-ui::after {
  transform: translateX(20px);
}

.ignored-contact-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 380px;
  overflow-y: auto;
}

.ignored-contact-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
}

.ignored-contact-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ignored-contact-copy strong {
  font-size: 0.95rem;
  color: var(--text-primary);
}

.ignored-contact-copy span {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.ignored-contact-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ignored-contact-role {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(49, 120, 198, 0.12);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
}

.ignored-contact-role.muted {
  background: rgba(148, 163, 184, 0.16);
  color: var(--text-secondary);
}

.ignored-contact-remove {
  flex-shrink: 0;
}

.ignored-contact-empty {
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 28px 18px;
  text-align: center;
  color: var(--text-secondary);
}

.ignored-contact-empty h3 {
  color: var(--text-primary);
  font-size: 1rem;
  margin-bottom: 6px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 24px;
  margin-bottom: 12px;
}

.detail-section h4 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text-primary);
  display: block;
  text-align: center;
}

.detail-section--info {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-section--content {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  gap: 18px;
}

.detail-section--full {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.detail-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5px 0;
  gap: 4px;
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-row .label {
  font-size: 0.95rem;
  color: var(--text-muted);
  white-space: nowrap;
  text-align: center;
}

.detail-row .value {
  font-size: 1.05rem;
  color: var(--text-primary);
  text-align: center;
  font-weight: 500;
}

.detail-row .value.highlight {
  color: var(--success);
  font-weight: 600;
}

.detail-row .value a { color: var(--accent); }

.detail-block { margin-bottom: 12px; }
.detail-block .label {
  font-size: 0.95rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.value-block {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-secondary);
  background: var(--bg-surface);
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.detail-media-section {
  margin-top: auto;
  min-height: 180px;
  display: flex;
  align-items: flex-end;
}

.detail-media-section--empty {
  justify-content: center;
  align-items: center;
}

.detail-media-scroll {
  min-height: 116px;
}

.action-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.action-group {
  flex: 1;
  min-width: 140px;
}

.action-group label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input-text, .input-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: inherit;
  transition: border-color var(--transition);
  resize: vertical;
}

.input-text:focus, .input-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.modal-footer {
  padding: 10px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------- BUTTONS ---------- */
.btn {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.btn--primary {
  background: var(--accent);
  color: white;
}
.btn--primary:hover { background: var(--accent-hover); }

.btn--secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.btn--secondary:hover { background: var(--bg-surface); }

.btn--success {
  background: var(--success);
  color: white;
}
.btn--success:hover { filter: brightness(1.1); }

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}
.btn--ghost:hover { background: var(--bg-surface); }

.btn--feedback {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border: none;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
  font-weight: 600;
}
.btn--feedback:hover {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.45);
  transform: translateY(-1px);
}
.btn--feedback:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.25);
}
[data-theme="dark"] .btn--feedback {
  box-shadow: 0 2px 10px rgba(139, 92, 246, 0.4);
}

.btn[disabled],
.btn-status[disabled] {
  opacity: 0.65;
  cursor: wait;
  pointer-events: none;
  transform: none !important;
  box-shadow: none !important;
}

/* ---------- EMPTY / ERROR STATE ---------- */
.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.7;
}

.empty-state h3 {
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  max-width: 360px;
  margin-bottom: 20px;
}

/* ---------- SKELETON ---------- */
.lead-card.skeleton {
  pointer-events: none;
}

.skeleton-line {
  background: linear-gradient(90deg, var(--bg-surface) 25%, rgba(255,255,255,0.05) 50%, var(--bg-surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
  margin-bottom: 10px;
}

.skeleton-line--sm { width: 40%; height: 14px; }
.skeleton-line--md { width: 60%; height: 14px; }
.skeleton-line--lg { width: 75%; height: 18px; }
.skeleton-line--xl { width: 100%; height: 36px; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- TOAST ---------- */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 2000;
  transform: translate(-50%, calc(-50% + 20px));
  opacity: 0;
  transition: all 300ms ease;
  max-width: min(90vw, 420px);
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.toast--show { transform: translate(-50%, -50%); opacity: 1; }
.toast--success { background: var(--success); color: white; }
.toast--error { background: var(--danger); color: white; }

/* ---------- LOAD MORE ---------- */
.load-more-wrapper {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  padding: 24px 0;
}

.rodape {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  text-align: center;
  padding: 8px 0;
  font-size: 11px;
  font-weight: 600;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

.hidden { display: none !important; }

/* ---------- MODAL CONTAINER ---------- */
#modal-container { display: contents; }
#modal-container.active { display: contents; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
  .barra-topo {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 14px;
  }
  .barra-topo-left,
  .barra-topo-right {
    position: static !important;
    transform: none;
    width: 100%;
    justify-content: center;
  }
  .barra-topo .titulo {
    order: 2;
    text-align: center;
    width: 100%;
  }
}

@media (max-width: 640px) {
  .barra-topo-left,
  .barra-topo-right {
    gap: 12px !important;
    flex-wrap: wrap;
    justify-content: center;
  }
  .barra-topo .titulo {
    font-size: 14px;
    line-height: 1.3;
  }
}

@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .detail-grid { grid-template-columns: 1fr; }
  .filters-single-row { flex-wrap: wrap; }
  .filters-side-top {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }
  .settings-trigger-btn {
    margin-left: auto;
  }
  .client-logs-modal-header {
    flex-direction: column;
  }
  .client-logs-header-actions {
    width: 100%;
    justify-content: space-between;
  }
  .client-logs-page-header {
    flex-direction: column;
  }
  .client-log-detail-page-header {
    grid-template-columns: 1fr;
  }
  .client-log-detail-page-title {
    text-align: left;
  }
  .client-log-detail-page-meta {
    align-items: flex-start;
    padding-top: 0;
  }
  .client-logs-toolbar {
    grid-template-columns: 1fr;
  }
  .client-log-meta {
    grid-template-columns: 1fr;
  }
  .client-log-card-header {
    flex-direction: column;
  }
  .client-log-card-received {
    min-width: 0;
  }
  .client-log-search-row {
    flex-direction: column;
    align-items: stretch;
  }
  .client-log-tabs {
    flex-direction: column;
  }
  .client-log-tab {
    width: 100%;
    border-radius: 16px;
    text-align: left;
  }
  .client-log-search-actions {
    width: 100%;
  }
  .client-log-search-nav {
    flex: 1;
  }
  .client-log-analysis-header {
    flex-direction: column;
  }
  .client-log-analysis-trigger {
    width: 100%;
  }
  .client-log-analysis-grid {
    grid-template-columns: 1fr;
  }
  .client-log-search-meta {
    white-space: normal;
  }
  .settings-panel {
    flex-wrap: wrap;
    width: 100%;
  }
  .settings-section--action {
    margin-left: auto;
  }
}

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; padding: 12px; gap: 8px; }
  .search-box { max-width: 100%; order: -1; width: 100%; }
  .filter-group { width: 100%; overflow-x: auto; }
  .leads-grid { grid-template-columns: 1fr; }
  .main,
  .main-content { padding: 18px 14px 24px; }
  .lead-card { padding: 16px; }
  .action-row { flex-direction: column; }
  .filters-single-row {
    flex-direction: column;
    align-items: stretch !important;
    gap: 14px !important;
  }
  .filters-side-top {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .settings-trigger-btn,
  .client-logs-trigger-btn {
    width: 100%;
    border-radius: 14px;
  }
  .settings-panel {
    flex-direction: column;
    width: 100%;
  }
  .client-logs-grid {
    grid-template-columns: 1fr;
  }
  .client-logs-header-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .client-logs-counter {
    width: 100%;
    justify-content: center;
  }
  .settings-panel--modal .settings-section {
    padding: 16px 18px;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
  .settings-panel--modal .luisa-test-input,
  .settings-panel--modal .btn-ignored-contacts {
    width: 100%;
    min-width: 0;
  }
  .settings-section {
    width: 100%;
    justify-content: space-between;
  }
  .settings-section + .settings-section {
    border-left: 0;
    border-top: 1px solid var(--border-color);
  }
  .toolbar-meta-row {
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar-side {
    margin-left: 0;
    justify-content: flex-start;
    flex-direction: column;
    align-items: stretch;
  }
  .btn-ignored-contacts {
    width: 100%;
    justify-content: center;
  }
  .input-col--sort {
    max-width: none;
  }
  .toolbar-stats-clean {
    margin-left: 0;
    text-align: left;
  }
  .status-tabs { flex-wrap: wrap; }
  .card-header-row,
  .card-footer,
  .actions-container {
    flex-direction: column;
    align-items: flex-start !important;
  }
  .ignored-contact-form {
    grid-template-columns: 1fr;
  }
  .ignored-contact-toggles {
    flex-direction: column;
  }
  .ignored-toggle {
    justify-content: space-between;
  }
  .ignored-contact-item {
    flex-direction: column;
    align-items: flex-start;
  }
  .ignored-contact-remove {
    width: 100%;
    justify-content: center;
  }
}

.btn-status {
  padding: 6px 14px;
  font-size: 0.75rem;
  border-radius: 12px;
  font-weight: 600;
  transition: all var(--transition);
  border: 1px solid var(--border-color);
  cursor: pointer;
}

.btn-status:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.btn-status[data-newstatus="verificado"] {
  background: #e3f2fd;
  color: #1565c0;
  border-color: #bbdefb;
}

[data-theme="dark"] .btn-status[data-newstatus="verificado"],
body.dark-mode .btn-status[data-newstatus="verificado"] {
  background: #0d47a1;
  color: #bbdefb;
  border-color: #1565c0;
}

.btn-status[data-newstatus="recente"],
.btn-status.btn-status--success {
  background: #e8f5e9;
  color: #2e7d32;
  border-color: #c8e6c9;
}

[data-theme="dark"] .btn-status[data-newstatus="recente"],
[data-theme="dark"] .btn-status.btn-status--success,
body.dark-mode .btn-status[data-newstatus="recente"],
body.dark-mode .btn-status.btn-status--success {
  background: #1b5e20;
  color: #a5d6a7;
  border-color: #2e7d32;
}

.btn-status[data-newstatus="arquivado"] {
  background: #ffebee;
  color: #c62828;
  border-color: #ffcdd2;
}

[data-theme="dark"] .btn-status[data-newstatus="arquivado"],
body.dark-mode .btn-status[data-newstatus="arquivado"] {
  background: #b71c1c;
  color: #ffcdd2;
  border-color: #c62828;
}
