/* ================================================================
   Grupo Vital — Consulta de Beneficiários
   Paleta: Verde escuro #1b6b4b | Verde médio #2a845f | Fundo #f2f6f4
   ================================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --green-dark: #1b6b4b;
  --green-darker: #145539;
  --green-medium: #2a845f;
  --green-light: #e8f5ef;
  --green-border: #b8ddc9;
  --surface: #ffffff;
  --bg: #f2f6f4;
  --text: #1e3028;
  --text-muted: #5a7066;
  --border: #cdddd5;
  --danger: #c53030;
  --danger-bg: #fff5f5;
  --success-color: #166534;
  --success-bg: #dcfce7;
  --error-color: #991b1b;
  --error-bg: #fee2e2;
  --warning-color: #92400e;
  --warning-bg: #fef3c7;
  --shadow: 0 2px 14px rgba(27, 107, 75, 0.11);
  --shadow-sm: 0 1px 6px rgba(27, 107, 75, 0.09);
  --radius: 10px;
  --radius-sm: 7px;
  --brand-900: #0a5b45;
  --brand-800: #0c7f5f;
  --brand-700: #13906c;
  --ink-950: #143532;
  --ink-800: #2a5550;
  --ink-700: #4d6f6b;
  --surface-100: #f4f8f6;
  --surface-200: #f7fbf9;
  --surface-300: #dcece5;
  --accent-500: #f19a2a;
  --accent-600: #da8314;
  --accent-200: rgba(241, 154, 42, 0.16);
  --success-600: #1f7a54;
  --danger-600: #8e2f2f;
  --shadow: 0 20px 46px rgba(10, 91, 69, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Manrope', sans-serif;
  color: var(--ink-950);
  background:
    radial-gradient(circle at top right, rgba(19, 144, 108, 0.23), transparent 32%),
    radial-gradient(circle at bottom left, rgba(241, 154, 42, 0.14), transparent 34%),
    linear-gradient(135deg, #eff8f4 0%, #f7fbf9 48%, #f2f8f6 100%);
}

/* ─── HEADER ─────────────────────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(90deg, var(--brand-900), var(--brand-800));
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.header-inner {
  width: min(1400px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
  text-decoration: none;
}

.logo-icon {
  display: inline-flex;
  align-items: center;
}

.logo-icon img {
  height: 3rem;
  width: auto;
}

.logo-wordmark {
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.06em;
  text-transform: lowercase;
}

.page-title {
  font-size: 2rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.85);
  margin-left: auto;
  white-space: nowrap;
}

.logout-btn {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #ffffff;
  padding: 6px 15px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.2s;
  flex-shrink: 0;
}

.logout-btn:hover {
  background: rgba(255, 255, 255, 0.26);
}

/* ─── VIEWS ──────────────────────────────────────────────────────────────── */

.view {
  min-height: calc(100vh - 60px);
}

/* ─── LOGIN ──────────────────────────────────────────────────────────────── */

.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 60px);
  padding: 2rem 1rem;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2.5rem 2.5rem 2rem;
  width: 100%;
  max-width: 430px;
  box-shadow: var(--shadow);
  text-align: center;
}

.login-brand-icon {
  width: 64px;
  height: 64px;
  background: var(--green-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
}

.login-card h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  text-align: center;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 13.5px;
  margin-bottom: 2rem;
  line-height: 1.5;
  text-align: center;
}

/* ─── FORM ELEMENTS ──────────────────────────────────────────────────────── */

.form-group {
  margin-bottom: 1rem;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-group input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  appearance: none;
}

.form-group input:focus {
  border-color: var(--green-medium);
  box-shadow: 0 0 0 3px rgba(42, 132, 95, 0.14);
}

textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  min-height: 200px;
  line-height: 1.6;
}

textarea:focus {
  border-color: var(--green-medium);
  box-shadow: 0 0 0 3px rgba(42, 132, 95, 0.14);
}

/* ─── BUTTONS ────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  transition: background 0.18s, border-color 0.18s, opacity 0.18s;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--green-dark);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--green-darker);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--border);
}

.btn-secondary:hover {
  background: #e4ece7;
}

.btn-outline {
  background: transparent;
  color: var(--green-dark);
  border: 1.5px solid var(--green-dark);
}

.btn-outline:hover {
  background: var(--green-light);
}

.btn-danger {
  background: #b42318;
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: #912018;
}

.btn-full {
  width: 100%;
  padding: 11px 18px;
  font-size: 14.5px;
  margin-top: 4px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
}

/* ─── MESSAGES ───────────────────────────────────────────────────────────── */

.error-msg {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fed7d7;
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-size: 13px;
  margin-bottom: 1rem;
  display: none;
  text-align: left;
}

.error-msg.visible {
  display: block;
}

/* ─── APP CONTAINER ──────────────────────────────────────────────────────── */

.container {
  max-width: 1340px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* ─── INFO CARD ──────────────────────────────────────────────────────────── */

.info-card {
  background:
    linear-gradient(130deg, rgba(12, 127, 95, 0.9), rgba(19, 144, 108, 0.84)),
    linear-gradient(45deg, rgba(241, 154, 42, 0.08), transparent 45%);
  color: #fff;
  border-radius: 24px;
  padding: 34px;
  box-shadow: var(--shadow);
  margin: 10px 0 30px 0;
}

.info-card h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.7rem;
  color: #fff;
}

.info-card ol {
  padding-left: 1.25rem;
}

.info-card li {
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.55;
  margin-bottom: 4px;
}

.info-card strong {
  color: #fff;
  font-weight: 700;
}

/* ─── TABS ───────────────────────────────────────────────────────────────── */

.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 5px;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
  width: fit-content;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}

.tab-btn:hover {
  background: var(--bg);
  color: var(--text);
}

.tab-btn.active {
  background: var(--green-dark);
  color: #fff;
}

.tab-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── MAIN GRID ──────────────────────────────────────────────────────────── */

.main-grid {
  display: grid;
  grid-template-columns: 370px 1fr;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 920px) {
  .main-grid {
    grid-template-columns: 1fr;
  }

  .page-title {
    display: none;
  }
}

/* ─── PANELS ─────────────────────────────────────────────────────────────── */

.panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  border-bottom: 1.5px solid var(--border);
  background: var(--bg);
  gap: 10px;
}

.panel-header h3 {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.055em;
}

.panel-body {
  padding: 1.25rem;
}

.hint-text {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 0.75rem;
  line-height: 1.45;
}

.input-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.item-count {
  font-size: 12.5px;
  color: var(--text-muted);
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ─── EMPTY STATE ─────────────────────────────────────────────────────────── */

.empty-state {
  padding: 3.5rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
}

.empty-icon {
  margin-bottom: 1rem;
  display: flex;
  justify-content: center;
}

.empty-state p {
  font-size: 13.5px;
}

.empty-sub {
  font-size: 12px !important;
  color: #9ab4aa;
  margin-top: 4px;
}

/* ─── STATS ROW ──────────────────────────────────────────────────────────── */

.stats-row {
  display: flex;
  gap: 0;
  border-bottom: 1.5px solid var(--border);
  background: var(--bg);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 22px;
  gap: 2px;
  flex: 1;
}

.stat-divider {
  width: 1px;
  background: var(--border);
  margin: 10px 0;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.stat-value.success {
  color: var(--success-color);
}

.stat-value.error {
  color: var(--error-color);
}

.stat-value.warning {
  color: var(--warning-color);
}

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

/* ─── PROGRESS ───────────────────────────────────────────────────────────── */

.progress-wrapper {
  padding: 1.1rem 1.25rem;
  border-top: 1.5px solid var(--border);
  background: var(--bg);
}

.progress-track {
  height: 5px;
  background: var(--green-border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 7px;
}

.progress-fill {
  height: 100%;
  background: var(--green-dark);
  border-radius: 999px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-text {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* ─── RESULTS TABLE ──────────────────────────────────────────────────────── */

.table-wrapper {
  overflow-x: auto;
  max-height: 520px;
  overflow-y: auto;
}

/* Custom scrollbar for table */
.table-wrapper::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

.table-wrapper::-webkit-scrollbar-track {
  background: var(--bg);
}

.table-wrapper::-webkit-scrollbar-thumb {
  background: var(--green-border);
  border-radius: 999px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
  background: #8db8a4;
}

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

.results-table th {
  background: var(--bg);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 9px 14px;
  text-align: left;
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

.results-table td {
  padding: 8px 14px;
  border-bottom: 1px solid #edf2ef;
  color: var(--text);
  vertical-align: middle;
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.results-table tr:hover td {
  background: #f7fbf9;
}

/* ─── BADGES ─────────────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success-color);
}

.badge-error {
  background: var(--error-bg);
  color: var(--error-color);
}

.badge-pending {
  background: var(--warning-bg);
  color: var(--warning-color);
}