:root {
  --main-blue: #2563eb;
  --main-accent: #00bcd4;
  --main-dark: #222;
  --main-gray: #f4f4f4;
  --main-border: #e5e7eb;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--main-gray);
  color: var(--main-dark);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app-main-shell {
  min-width: 0;
}

.btn-main {
  font-weight: 700;
  background: #1d4ed8;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.35em 1.2em;
  font-size: 1em;
  height: 38px;
  min-width: 100px;
  transition: background 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 8px 0 rgba(60,120,255,0.10);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-main:hover, .btn-main:focus {
  background: #1749b1;
  box-shadow: 0 4px 16px 0 rgba(60,120,255,0.16);
}

.btn-secondary {
  background: transparent;
  color: #6b7280;
  border: none;
  border-radius: 8px;
  padding: 0.35em 1.2em;
  font-size: 1em;
  font-weight: 500;
  height: 38px;
  min-width: 100px;
  transition: background 0.15s, color 0.15s;
  box-shadow: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-secondary:hover, .btn-secondary:focus {
  background: #f3f4f6;
  color: #374151;
  text-decoration: underline;
}

.table-row {
  transition: background 0.2s;
}
.table-row:hover {
  background: #f7fafd;
}
table {
  border-collapse: collapse;
}
thead tr {
  border-bottom: 2px solid #e5e7eb;
}
tbody tr {
  border-bottom: 1px solid #e5e7eb;
}
td, th {
  border: none;
  font-size: 0.98rem;
  color: #444;
  padding-top: 0.55em;
  padding-bottom: 0.55em;
}
th {
  font-size: 0.88rem;
  color: #8a8a8a;
  font-weight: 500;
  padding-top: 0.35em;
  padding-bottom: 0.35em;
}

@media (max-width: 1024px) {
  .sidebar { width: 60px; }
  .sidebar .text { display: none; }
}

@media (max-width: 768px) {
  .btn-main, .btn-secondary {
    width: 100%;
    min-width: auto;
    height: 44px;
    font-size: 1rem;
  }
  input[type="text"], input[type="date"], select {
    height: 44px;
    font-size: 1rem;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
  }
  .table-row, .btn-main, .btn-secondary {
    -webkit-tap-highlight-color: transparent;
  }
  .table-row {
    min-height: 60px;
  }
}

.stat-card {
  background: white;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 1px 8px 0 rgba(0,0,0,0.03);
  border: 0;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--main-blue);
  width: 100%;
}
@media (min-width: 1024px) {
  .stat-card::before {
    top: 0;
    bottom: 0;
    left: 0;
    right: auto;
    width: 4px;
    height: 100%;
    background: var(--main-blue);
  }
  .stat-cyan::before { background: #06b6d4; }
  .stat-orange::before { background: #f59e42; }
  .stat-purple::before { background: #a78bfa; }
  .stat-blue::before { background: #2563eb; }
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px 0 rgba(0,0,0,0.08);
}
.stat-card-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
  margin: 0 0 0.5rem;
  line-height: 1.2;
}
.stat-card-value {
  font-size: 2rem;
  font-weight: 700;
  color: #111827;
  margin: 0;
  line-height: 1;
}
.stat-card-group {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(37,99,235,0.07);
}
.stat-card-group svg {
  width: 24px;
  height: 24px;
  stroke-width: 1.5;
}
.stat-blue .stat-card-group { background: rgba(37,99,235,0.07); }
.stat-blue .stat-card-group svg { stroke: #2563eb; }
.stat-cyan .stat-card-group { background: rgba(6,182,212,0.07); }
.stat-cyan .stat-card-group svg { stroke: #06b6d4; }
.stat-orange .stat-card-group { background: rgba(245,158,66,0.07); }
.stat-orange .stat-card-group svg { stroke: #f59e42; }
.stat-purple .stat-card-group { background: rgba(167,139,250,0.07); }
.stat-purple .stat-card-group svg { stroke: #a78bfa; }

.leads-dashboard {
  --leads-panel-bg: #fff;
  --leads-muted: #6b7280;
  --leads-text: #111827;
  --leads-soft: #f8fafc;
  --leads-line: #e5e7eb;
  --leads-ring: rgba(37,99,235,0.18);
}

.leads-dashboard__header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--leads-panel-bg);
  border: 1px solid var(--leads-line);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 1px 8px 0 rgba(0,0,0,0.03);
}

.leads-dashboard__header-copy {
  min-width: 0;
}

.leads-dashboard__eyebrow {
  margin: 0 0 0.25rem;
  color: #2563eb;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.leads-dashboard__title {
  margin: 0;
  color: var(--leads-text);
  font-size: 1.75rem;
  line-height: 1.1;
  font-weight: 800;
}

.leads-dashboard__subtitle {
  margin: 0.45rem 0 0;
  color: var(--leads-muted);
  font-size: 0.95rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.leads-dashboard__period-range {
  display: inline;
  color: #374151;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.leads-dashboard__header-meta {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  min-height: 44px;
  border-radius: 8px;
  background: var(--leads-soft);
  padding: 0.65rem 0.8rem;
}

.leads-dashboard__meta-label {
  color: var(--leads-muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.leads-dashboard__meta-value {
  color: var(--leads-text);
  font-size: 0.95rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.leads-dashboard__panel {
  background: var(--leads-panel-bg);
  border: 1px solid var(--leads-line);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 1px 8px 0 rgba(0,0,0,0.03);
}

.leads-dashboard__section-head,
.leads-dashboard__table-head {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.leads-dashboard__section-title {
  margin: 0;
  color: var(--leads-text);
  font-size: 1rem;
  line-height: 1.25;
  font-weight: 800;
}

.leads-dashboard__section-note {
  color: var(--leads-muted);
  font-size: 0.875rem;
  line-height: 1.35;
}

.leads-dashboard__periods {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.15rem;
  scrollbar-width: thin;
}

.leads-dashboard__period-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 44px;
  border: 1px solid var(--leads-line);
  border-radius: 8px;
  background: #fff;
  color: #374151;
  padding: 0.55rem 0.85rem;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.leads-dashboard__period-link:hover,
.leads-dashboard__period-link:focus {
  border-color: #93c5fd;
  color: #1d4ed8;
  box-shadow: 0 0 0 3px var(--leads-ring);
  outline: none;
}

.leads-dashboard__period-link--active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

.leads-dashboard__filters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}

.leads-dashboard__field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.leads-dashboard__label {
  margin-bottom: 0.35rem;
  color: var(--leads-muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.leads-dashboard__control {
  width: 100%;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f3f4f6;
  color: var(--leads-text);
  padding: 0.55rem 0.75rem;
  font-size: 1rem;
  outline: none;
}

.leads-dashboard__control:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px var(--leads-ring);
}

.leads-dashboard__actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
  align-self: end;
}

.leads-dashboard__action {
  min-height: 44px;
  width: 100%;
}

.leads-dashboard__kpis {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.leads-dashboard__kpi {
  border-radius: 8px;
  padding: 1.1rem;
}

.leads-dashboard__kpi-name {
  margin: 0 0 0.25rem;
  color: var(--leads-text);
  font-size: 1.05rem;
  line-height: 1.2;
  font-weight: 800;
}

.leads-dashboard__kpi-count {
  margin: 0;
  color: var(--leads-muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.leads-dashboard__analytics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.leads-dashboard__analytics > * {
  min-width: 0;
}

.leads-dashboard__chart {
  position: relative;
  min-height: 285px;
  padding: 1.25rem 0.25rem 1.6rem;
}

.leads-dashboard__chart-svg {
  display: block;
  width: 100%;
  height: 240px;
  overflow: visible;
}

.leads-dashboard__chart-grid {
  stroke: #e5e7eb;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.leads-dashboard__chart-grid--base {
  stroke: #cbd5e1;
}

.leads-dashboard__chart-area {
  fill: url("#lead-chart-fill");
}

.leads-dashboard__chart-area--total {
  fill: url("#lead-chart-total-fill");
}

.leads-dashboard__chart-line {
  fill: none;
  stroke: url("#lead-chart-line");
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 5;
  vector-effect: non-scaling-stroke;
}

.leads-dashboard__chart-line--total {
  stroke: url("#lead-chart-total-line");
  stroke-width: 4;
}

.leads-dashboard__chart-marker {
  fill: #fff;
  stroke: #2563eb;
  stroke-width: 4;
  vector-effect: non-scaling-stroke;
}

.leads-dashboard__chart-values,
.leads-dashboard__chart-axis {
  position: absolute;
  left: 0.25rem;
  right: 0.25rem;
  pointer-events: none;
}

.leads-dashboard__chart-values {
  top: 0;
  height: 1rem;
}

.leads-dashboard__chart-axis {
  bottom: 0;
  height: 1.2rem;
}

.leads-dashboard__chart-value,
.leads-dashboard__chart-label {
  position: absolute;
  transform: translateX(-50%);
  color: var(--leads-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.leads-dashboard__chart-value {
  color: #374151;
  font-weight: 800;
}

.leads-dashboard__group-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
  border: 1px solid var(--leads-line);
  border-radius: 8px;
  background: #f9fafb;
  padding: 0.25rem;
}

.leads-dashboard__group-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  min-height: 38px;
  border-radius: 6px;
  color: #4b5563;
  padding: 0.45rem 0.7rem;
  font-size: 0.875rem;
  font-weight: 800;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.leads-dashboard__group-link:hover,
.leads-dashboard__group-link:focus {
  color: #1d4ed8;
  box-shadow: 0 0 0 3px var(--leads-ring);
  outline: none;
}

.leads-dashboard__group-link--active {
  background: #fff;
  color: #1d4ed8;
  box-shadow: 0 1px 5px 0 rgba(15,23,42,0.08);
}

.leads-dashboard__sources {
  display: grid;
  gap: 0.75rem;
}

.leads-dashboard__sources--legend {
  grid-template-columns: 1fr;
  gap: 0.55rem;
}

.leads-dashboard__source {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "main percent"
    "bar bar";
  gap: 0.45rem 0.75rem;
  min-height: 58px;
  border: 1px solid var(--leads-line);
  border-radius: 8px;
  padding: 0.75rem;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.leads-dashboard__source--legend {
  grid-template-areas: "main percent";
  align-items: center;
  min-height: 52px;
  border-left: 4px solid var(--source-color, #2563eb);
  padding: 0.65rem 0.75rem;
}

.leads-dashboard__source:hover,
.leads-dashboard__source:focus {
  border-color: #93c5fd;
  background: #f8fbff;
  box-shadow: 0 0 0 3px var(--leads-ring);
  outline: none;
}

.leads-dashboard__source--active {
  border-color: #2563eb;
  background: #eff6ff;
}

.leads-dashboard__source-main {
  grid-area: main;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}

.leads-dashboard__source-name {
  color: var(--leads-text);
  font-size: 0.92rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leads-dashboard__source--legend .leads-dashboard__source-name {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.leads-dashboard__source-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  background: var(--source-color, #2563eb);
  flex: 0 0 auto;
}

.leads-dashboard__source-count,
.leads-dashboard__source-percent {
  color: var(--leads-muted);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.leads-dashboard__source-percent {
  grid-area: percent;
}

.leads-dashboard__source-bar {
  grid-area: bar;
  height: 8px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}

.leads-dashboard__source-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--source-color, #2563eb);
}

.leads-dashboard__clear-link {
  color: #2563eb;
  font-size: 0.875rem;
  font-weight: 800;
  text-decoration: underline;
}

.leads-dashboard__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  border: 1px dashed var(--leads-line);
  border-radius: 8px;
  background: #f9fafb;
  color: var(--leads-muted);
  padding: 1rem;
  text-align: center;
}

.leads-dashboard__mobile-card {
  display: block;
  background: #fff;
  border: 1px solid #f3f4f6;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 1px 8px 0 rgba(0,0,0,0.03);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.leads-dashboard__mobile-card:hover,
.leads-dashboard__mobile-card:focus {
  border-color: #bfdbfe;
  box-shadow: 0 4px 16px 0 rgba(0,0,0,0.08);
  outline: none;
}

.leads-dashboard__source-badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 28px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1e40af;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 640px) {
  .leads-dashboard__header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem;
  }

  .leads-dashboard__header-meta {
    width: auto;
    min-width: 190px;
  }

  .leads-dashboard__filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .leads-dashboard__actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .leads-dashboard__kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .leads-dashboard__sources--legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .leads-dashboard__panel {
    padding: 1.25rem;
  }

  .leads-dashboard__section-head,
  .leads-dashboard__table-head {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .leads-dashboard__filters {
    grid-template-columns: repeat(5, minmax(0, 1fr)) auto;
    align-items: end;
  }

  .leads-dashboard__actions {
    min-width: 220px;
  }

  .leads-dashboard__kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .leads-dashboard__analytics {
    grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
  }

  .leads-dashboard__group-switch {
    width: auto;
    min-width: 190px;
  }

  .leads-dashboard__sources--legend {
    grid-template-columns: 1fr;
  }

  .leads-dashboard__chart-label,
  .leads-dashboard__chart-value {
    font-size: 0.65rem;
  }
}

@media (min-width: 1280px) {
  .leads-dashboard__kpis {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

audio {
  background: rgba(255,255,255,0.7);
  border-radius: 12px;
  box-shadow: 0 2px 8px 0 rgba(60,120,255,0.08);
  border: none;
  padding: 2px 8px;
  height: 38px;
  width: 120px;
  outline: none;
  transition: background 0.15s;
}
audio:hover {
  background: rgba(243,244,246,0.95);
}
audio::-webkit-media-controls-panel {
  background: transparent;
  border-radius: 12px;
}
@media (max-width: 768px) {
  audio {
    width: 100%;
    height: 44px;
  }
}
