:root {
  --bg-body: #f5f7fb;
  --bg-card: #ffffff;
  --border-soft: #e1e5ef;
  --text-main: #1f2933;
  --text-muted: #6b7280;
  --primary: #00b39f; /* vibe Fresh */
  --primary-dark: #009782;
  --danger: #e53e3e;
  --success: #22c55e;
  --warning: #f59e0b;
  --radius-md: 8px;
  --shadow-soft: 0 4px 12px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg-body);
  color: var(--text-main);
}

/* Layout */

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: linear-gradient(90deg, #00b39f, #00a1e0);
  color: #fff;
  padding: 18px 32px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
  position: relative;
}

.topbar::after {
  content: "";
  position: absolute;
  inset-inline: 24px;
  bottom: 6px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
}

.topbar-title {
  font-size: 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  text-shadow: 0 1px 2px rgba(15, 23, 42, 0.35);
}

.topbar-subtitle {
  font-size: 13px;
  opacity: 0.95;
  margin-top: 4px;
}

.topbar-user {
  font-size: 13px;
  margin-top: 4px;
}

.topbar-user a {
  color: #e0f7ff;
  text-decoration: none;
}

.topbar-user a:hover {
  text-decoration: underline;
}

.app-main {
  padding: 16px 24px 32px;
}

.section-title {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
}

.chart-caption {
  margin-top: 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* Cards */

.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-soft);
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.14);
}

.card-body {
  padding: 16px 18px;
}

.card + .card {
  margin-top: 16px;
}

/* Filtros */

.filters-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: flex-end;
}

.filters-form .field {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  color: var(--text-muted);
}

.filters-form label {
  margin-bottom: 4px;
}

.filters-form input,
.filters-form select {
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-soft);
  font-size: 13px;
  min-width: 140px;
}

.filters-actions {
  display: flex;
  gap: 8px;
}

/* Buttons */

.btn {
  border-radius: 999px;
  border: none;
  cursor: pointer;
  padding: 6px 14px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  transition: background 0.12s ease-out, transform 0.05s ease-out;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-link {
  background: transparent;
  color: var(--primary-dark);
  text-decoration: none;
  padding: 0;
}

/* KPIs */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.kpi-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-soft);
  padding: 12px 16px;
  font-size: 13px;
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
}

.kpi-label {
  color: var(--text-muted);
}

.kpi-value {
  font-size: 22px;
  font-weight: 600;
  margin-top: 2px;
}

/* Distribuição */

.badge-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.pill {
  border-radius: 999px;
  padding: 3px 8px;
  border: 1px solid var(--border-soft);
  font-size: 12px;
  background: #f9fafb;
}

/* Tabela */

.table-wrapper {
  margin-top: 16px;
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
}

th,
td {
  border: 1px solid var(--border-soft);
  padding: 6px 8px;
  text-align: left;
  white-space: nowrap;
}

th {
  background: #f3f4f6;
  font-weight: 600;
}

tbody tr:nth-child(even) {
  background: #f9fafb;
}

tbody tr:hover {
  background: #eef2ff;
  cursor: default;
}

/* Badges status */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}

.badge-status-sent {
  background: #e0f2fe;
  color: #1d4ed8;
}

.badge-status-responded {
  background: #dcfce7;
  color: #15803d;
}

.badge-status-error {
  background: #fee2e2;
  color: #b91c1c;
}

.badge-resp-sim {
  background: #dcfce7;
  color: #166534;
}

.badge-resp-nao {
  background: #fee2e2;
  color: #b91c1c;
}

/* Login */

.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top left, #00b39f22, transparent 55%),
    radial-gradient(circle at bottom right, #00a1e022, transparent 55%),
    var(--bg-body);
}

.login-card {
  width: 340px;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-soft);
  padding: 20px 22px;
}

.login-title {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 600;
}

.login-subtitle {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.login-form .field {
  margin-bottom: 10px;
}

.login-form label {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
}

.login-form input {
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-soft);
  font-size: 13px;
}

.login-error {
  background: #fee2e2;
  color: #b91c1c;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  margin-bottom: 10px;
}

/* Gráfico */

.chart-and-legend {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 520px;     
  margin: 8px auto 0;   
}

.chart-container {
  max-width: 260px;
  width: 260px;
  margin: 0 auto;
}

.chart-container canvas {
  width: 100% !important;
  height: auto !important;
  max-height: 260px;
  display: block;
  margin: 0 auto;
}

.chart-legend {
  width: 100%;
  font-size: 13px;
}

/* Foco inputs */

.filters-form input:focus,
.filters-form select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  border-color: var(--primary);
}

/* Responsivo */

@media (max-width: 768px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .app-main {
    padding: 12px 12px 20px;
  }

  .kpi-row {
    grid-template-columns: 1fr; /* em celular, fica 1 por linha */
  }
}
