/* =========================================================
   Sistema de Indicação de Certificado Digital
   Paleta: Azul-marinho profundo + Verde esmeralda
   Tipografia: Fraunces (display) + Inter Tight (UI)
   ========================================================= */

:root {
  --navy-900: #0F1B33;
  --navy-800: #1A2B4A;
  --navy-700: #243A5E;
  --navy-100: #E8ECF4;
  --emerald-500: #10B981;
  --emerald-600: #059669;
  --emerald-50: #ECFDF5;
  --amber-500: #F59E0B;
  --amber-50: #FFFBEB;
  --rose-500: #E11D48;
  --rose-50: #FFF1F2;
  --slate-900: #0F172A;
  --slate-700: #334155;
  --slate-500: #64748B;
  --slate-300: #CBD5E1;
  --slate-200: #E2E8F0;
  --slate-100: #F1F5F9;
  --offwhite: #F8F7F4;
  --white: #FFFFFF;

  --shadow-sm: 0 1px 2px 0 rgba(15, 27, 51, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(15, 27, 51, 0.08), 0 2px 4px -2px rgba(15, 27, 51, 0.04);
  --shadow-lg: 0 12px 32px -8px rgba(15, 27, 51, 0.12), 0 4px 12px -4px rgba(15, 27, 51, 0.06);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter Tight', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--offwhite);
  color: var(--slate-900);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* ---------- Tipografia ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--navy-900);
  line-height: 1.15;
}

h1 { font-size: clamp(2rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.25rem; font-weight: 600; }

.eyebrow {
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--emerald-600);
  margin-bottom: 0.5rem;
}

p { color: var(--slate-700); }

a { color: var(--emerald-600); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout containers ---------- */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
}

.container--narrow { max-width: 720px; }

/* ---------- Header ---------- */
.site-header {
  background: var(--navy-900);
  color: var(--white);
  padding: 1.25rem 0;
  border-bottom: 3px solid var(--emerald-500);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0;
  padding-bottom: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--white);
}

.brand:hover { text-decoration: none; }

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--emerald-500);
  display: grid;
  place-items: center;
  color: var(--navy-900);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
}

.brand-text {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
}

.brand-text small {
  display: block;
  font-family: var(--font-body);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.7;
  font-weight: 500;
}

/* ---------- Hero do formulário ---------- */
.hero {
  text-align: center;
  padding: 3rem 0 1.5rem;
}

.hero p {
  max-width: 520px;
  margin: 1rem auto 0;
  font-size: 1.05rem;
}

/* ---------- Card ---------- */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 2rem;
  border: 1px solid var(--slate-200);
}

.card--padded { padding: 2.5rem; }

@media (max-width: 640px) {
  .card, .card--padded { padding: 1.5rem; }
}

/* ---------- Formulário ---------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.form-grid .full { grid-column: 1 / -1; }

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

.field { display: flex; flex-direction: column; gap: 0.4rem; }

.field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--slate-700);
  letter-spacing: 0.01em;
}

.field label .req { color: var(--rose-500); }

.field input,
.field select,
.field textarea {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.75rem 0.9rem;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--slate-900);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--navy-700);
  box-shadow: 0 0 0 3px rgba(36, 58, 94, 0.12);
}

.field textarea { resize: vertical; min-height: 80px; }

.field .hint { font-size: 0.78rem; color: var(--slate-500); }

.field.error input,
.field.error select { border-color: var(--rose-500); }

.field.error .hint { color: var(--rose-500); }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.85rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
}

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

.btn--primary {
  background: var(--emerald-500);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}

.btn--primary:hover { background: var(--emerald-600); text-decoration: none; }

.btn--dark {
  background: var(--navy-800);
  color: var(--white);
}

.btn--dark:hover { background: var(--navy-700); text-decoration: none; }

.btn--ghost {
  background: transparent;
  color: var(--navy-800);
  border: 1.5px solid var(--slate-300);
}

.btn--ghost:hover { background: var(--slate-100); text-decoration: none; }

.btn--lg { padding: 1rem 2rem; font-size: 1.05rem; }

.btn--block { width: 100%; }

.btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-row {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

/* ---------- Painel da certificadora: cards de status ---------- */
.status-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}

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

.status-card {
  background: var(--white);
  border: 2px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  transition: border-color 0.15s, background 0.15s;
}

.status-card.done {
  background: var(--emerald-50);
  border-color: var(--emerald-500);
}

.status-card h4 {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--slate-700);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.status-card.done h4 { color: var(--emerald-600); }

.status-card .check {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--slate-300);
  font-size: 12px;
  color: transparent;
}

.status-card.done .check {
  background: var(--emerald-500);
  border-color: var(--emerald-500);
  color: var(--white);
}

.status-card .timestamp {
  font-size: 0.8rem;
  color: var(--slate-500);
  margin-top: 0.4rem;
}

/* ---------- Cliente info card ---------- */
.client-info {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem 2rem;
  margin-top: 1rem;
}

@media (max-width: 640px) {
  .client-info { grid-template-columns: 1fr; }
}

.info-line .label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--slate-500);
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.info-line .value {
  font-size: 1rem;
  color: var(--slate-900);
  font-weight: 500;
}

/* ---------- KPIs admin ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

.kpi {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
}

.kpi .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--slate-500);
  font-weight: 600;
}

.kpi .value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 500;
  color: var(--navy-900);
  line-height: 1.1;
  margin-top: 0.5rem;
}

.kpi .value.success { color: var(--emerald-600); }
.kpi .value.amber { color: var(--amber-500); }

.kpi .sub {
  font-size: 0.8rem;
  color: var(--slate-500);
  margin-top: 0.25rem;
}

/* ---------- Funil ---------- */
.funnel {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  margin: 2rem 0;
}

@media (max-width: 700px) {
  .funnel { grid-template-columns: repeat(2, 1fr); }
}

.funnel-step {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
  border: 1px solid var(--slate-200);
  position: relative;
}

.funnel-step .count {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 500;
  color: var(--navy-900);
}

.funnel-step .name {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--slate-500);
  font-weight: 600;
  margin-top: 0.25rem;
}

.funnel-step.active { background: var(--navy-800); }
.funnel-step.active .count { color: var(--white); }
.funnel-step.active .name { color: var(--emerald-500); }

/* ---------- Tabela admin ---------- */
.table-wrap {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-toolbar {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--slate-200);
  background: var(--slate-100);
  flex-wrap: wrap;
  align-items: center;
}

.table-toolbar select,
.table-toolbar input {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  background: var(--white);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--slate-200);
  vertical-align: middle;
}

th {
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--slate-500);
  background: var(--slate-100);
}

tbody tr:hover { background: var(--slate-100); }

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

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge--novo { background: var(--slate-200); color: var(--slate-700); }
.badge--contatado { background: #DBEAFE; color: #1E40AF; }
.badge--agendado { background: var(--amber-50); color: var(--amber-500); }
.badge--emitido { background: var(--emerald-50); color: var(--emerald-600); }
.badge--pago { background: var(--navy-800); color: var(--white); }

/* ---------- Tela de sucesso (cliente) ---------- */
.success {
  text-align: center;
  padding: 2rem 0;
}

.success-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--emerald-50);
  color: var(--emerald-500);
  display: grid;
  place-items: center;
  font-size: 2.5rem;
  margin: 0 auto 1.5rem;
}

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--slate-500);
  font-size: 0.85rem;
  margin-top: auto;
}

/* ---------- Helpers ---------- */
.text-muted { color: var(--slate-500); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-2 { margin-bottom: 1rem; }
.hidden { display: none !important; }

/* ---------- Login overlay (admin) ---------- */
.login-overlay {
  position: fixed;
  inset: 0;
  background: var(--navy-900);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 1rem;
}

.login-box {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  max-width: 380px;
  width: 100%;
  text-align: center;
}

.login-box h2 { margin-bottom: 0.5rem; }
.login-box p { margin-bottom: 1.5rem; }
