/* ============================================================
   AHI · Dashboard - Entrevista de Desligamento
   Paleta inspirada no manual de marca:
   - Navy (logo): #1F2D4A
   - Areia clara / fundo: #F6F7F9
   - Branco: #FFFFFF
   ============================================================ */

:root {
  --ahi-navy: #1f2d4a;
  --ahi-navy-700: #2a3a5c;
  --ahi-navy-100: #e6e9f1;
  --ahi-accent: #3b82f6;

  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e5e8ee;
  --border-strong: #cfd5e0;

  --text: #1a2236;
  --text-muted: #5b6478;
  --text-soft: #8a93a6;

  --success: #16a34a;
  --success-bg: #dcfce7;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --info: #2563eb;
  --info-bg: #dbeafe;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(31, 45, 74, 0.06);
  --shadow-md: 0 6px 24px rgba(31, 45, 74, 0.08);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

/* ----------- Topbar ----------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar__inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

/* O arquivo "Vertical" da AHI traz, na verdade, o layout horizontal
   (símbolo à esquerda + texto à direita), com menos espaço em branco. */
.logo-wrap {
  display: flex;
  align-items: center;
  height: 64px;
  overflow: hidden;
}

.logo {
  height: 120px;
  width: auto;
  display: block;
}

.topbar__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ahi-navy);
  background: var(--ahi-navy-100);
  padding: 6px 12px;
  border-radius: 999px;
}

/* ----------- Container ----------- */
.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 32px;
}

/* ----------- Page head ----------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.page-head h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--ahi-navy);
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.page-head__sub {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

/* ----------- Buttons ----------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease, transform 0.05s ease;
}

.btn--primary {
  background: var(--ahi-navy);
  color: #fff;
}

.btn--primary:hover {
  background: var(--ahi-navy-700);
}

.btn--primary:active {
  transform: translateY(1px);
}

.btn__spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn.is-loading .btn__spinner {
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ----------- Filters ----------- */
.filters {
  background: var(--surface);
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field--grow {
  grid-column: span 1;
}

.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field input,
.field select {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus,
.field select:focus {
  border-color: var(--ahi-navy);
  box-shadow: 0 0 0 3px rgba(31, 45, 74, 0.1);
}

/* ----------- Stats ----------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.stat::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--ahi-navy);
}

.stat--ok::before {
  background: var(--success);
}
.stat--info::before {
  background: var(--info);
}
.stat--warn::before {
  background: var(--danger);
}

.stat__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat__value {
  font-size: 32px;
  font-weight: 700;
  color: var(--ahi-navy);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.stat__hint {
  font-size: 13px;
  color: var(--text-soft);
}

/* ----------- Card / Table ----------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.card__head h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--ahi-navy);
  margin: 0;
}

.card__meta {
  font-size: 13px;
  color: var(--text-muted);
}

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table thead th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 12px 22px;
  background: #fafbfc;
  border-bottom: 1px solid var(--border);
}

.table th.num,
.table td.num {
  text-align: right;
}

.table tbody td {
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr:hover {
  background: #fafbfc;
}

.table .empty td {
  text-align: center;
  color: var(--text-soft);
  padding: 40px 22px;
  font-style: italic;
}

.recipient {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.recipient strong {
  color: var(--text);
  font-weight: 500;
}

.recipient small {
  color: var(--text-soft);
  font-size: 12px;
}

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.01em;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge--delivered {
  color: var(--success);
  background: var(--success-bg);
}
.badge--processed {
  color: var(--info);
  background: var(--info-bg);
}
.badge--not_delivered {
  color: var(--danger);
  background: var(--danger-bg);
}
.badge--unknown {
  color: var(--text-muted);
  background: var(--ahi-navy-100);
}

/* Link-style button inside table */
.row-action {
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--ahi-navy);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.row-action:hover {
  background: var(--ahi-navy-100);
}

/* ----------- Footnote ----------- */
.footnote {
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-soft);
}

.footnote code {
  background: var(--surface);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--ahi-navy);
  font-size: 12px;
}

/* ----------- Toast ----------- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--ahi-navy);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  max-width: 380px;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.is-error {
  background: var(--danger);
}

/* ----------- Modal ----------- */
.modal {
  border: none;
  padding: 0;
  background: transparent;
  max-width: 640px;
  width: 92%;
}

.modal::backdrop {
  background: rgba(31, 45, 74, 0.4);
  backdrop-filter: blur(2px);
}

.modal__inner {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
}

.modal__head h3 {
  margin: 0;
  font-size: 16px;
  color: var(--ahi-navy);
}

.modal__close {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
}

.modal__body {
  padding: 22px;
  max-height: 60vh;
  overflow-y: auto;
}

.event-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.event-list li {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fafbfc;
}

.event-list .event__type {
  font-weight: 600;
  color: var(--ahi-navy);
  text-transform: capitalize;
}

.event-list .event__time {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-soft);
}

/* ----------- Responsive ----------- */
@media (max-width: 900px) {
  .stats,
  .filters {
    grid-template-columns: repeat(2, 1fr);
  }
  .page-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .container,
  .topbar__inner {
    padding: 20px;
  }
}

@media (max-width: 540px) {
  .stats,
  .filters {
    grid-template-columns: 1fr;
  }
  .logo-wrap {
    height: 48px;
  }
  .logo {
    height: 88px;
  }
}
