:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --border: #dbe4ef;
  --primary: #0ea5a3;
  --primary-2: #2563eb;
  --accent: #14b8a6;
  --success: #22c55e;
  --warning: #f59e0b;
  --info: #3b82f6;
  --shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

body {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #f8fbff 0%, #edf3f9 100%);
  color: var(--text);
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: min(1200px, 92%);
  margin: 0 auto;
  padding: 28px 0 40px;
}

/* =========================
   CABEÇALHO
   ========================= */
.site-header {
  width: 100%;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
}

.site-header__inner {
  width: min(1200px, 92%);
  margin: 0 auto;
  padding: 18px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 260px;
}

.site-brand__logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  flex: 0 0 auto;
}

.site-brand__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.site-brand__name {
  font-size: 1.8rem;
  font-weight: 900;
  line-height: 1;
  color: #0f766e;
}

.site-brand__subtitle {
  font-size: 0.98rem;
  line-height: 1.25;
  color: #475569;
}

.site-brand__tagline {
  font-size: 0.88rem;
  line-height: 1.25;
  color: var(--primary);
  font-weight: 700;
  margin-top: 2px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.site-nav a {
  padding: 0.62rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: #334155;
  font-weight: 700;
  transition: 0.2s ease;
}

.site-nav a:hover {
  background: #eef6f6;
  border-color: #cbe7e6;
  transform: translateY(-1px);
}

/* =========================
   HERO CARD
   ========================= */
.hero-card {
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 24px;
  padding: 34px 38px;
  border-top: 5px solid var(--accent);
}

.hero-card--compact {
  padding: 28px 34px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  background: rgba(20, 184, 166, 0.1);
  color: #0f766e;
  border: 1px solid rgba(20, 184, 166, 0.2);
  font-size: 0.85rem;
  font-weight: 700;
}

.hero-card h1 {
  margin: 14px 0 12px;
  font-size: clamp(2rem, 4.2vw, 3.4rem);
  line-height: 1.08;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.hero-card p {
  margin: 0;
  max-width: 900px;
  font-size: 1.06rem;
  line-height: 1.55;
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 0.95rem 1.15rem;
  font-weight: 800;
  cursor: pointer;
  transition: 0.2s ease;
  color: #0f172a;
  background: #e2e8f0;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.14);
}

.btn.secondary {
  background: #ffffff;
  color: #0f172a;
  border-color: var(--border);
}

/* =========================
   GRIDS / CARDS
   ========================= */
.feature-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-top: 24px;
}

.cards,
.grid-3 {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-top: 24px;
}

.card,
.panel,
.auth-card {
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 22px;
}

.card,
.auth-card {
  padding: 22px;
}

.card h3,
.auth-card h2,
.panel h2,
.panel h1 {
  margin-top: 0;
}

.card h3 {
  margin-bottom: 8px;
  color: #0f172a;
  font-size: 1.12rem;
}

.card p,
.muted {
  color: var(--muted);
  line-height: 1.55;
}

.panel {
  padding: 24px;
}

/* =========================
   BADGES
   ========================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 0.33rem 0.7rem;
  background: #eef2ff;
  border: 1px solid var(--border);
  font-size: 0.82rem;
  color: #334155;
  font-weight: 700;
}

.badge.success {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #047857;
}

.badge.warning {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #b45309;
}

.badge.info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

/* =========================
   FORMULÁRIOS / PAINÉIS
   ========================= */
.auth-grid,
.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-weight: 700;
  font-size: 0.95rem;
  color: #0f172a;
}

input,
select,
textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  padding: 0.95rem 1rem;
  outline: none;
  transition: 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

/* =========================
   STAT CARDS
   ========================= */
.stats-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-top: 22px;
}

.stat-card {
  padding: 18px;
  border-radius: 18px;
  background: #f8fafc;
  border: 1px solid var(--border);
}

.stat-card h3 {
  margin: 0 0 10px;
  font-size: 0.98rem;
  color: #475569;
}

.stat-card p {
  margin: 0;
  font-size: 2rem;
  line-height: 1;
  font-weight: 900;
  color: #0f172a;
}

/* =========================
   MENSAGENS
   ========================= */
.message {
  padding: 0.95rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
  margin: 12px 0 16px;
}

.message.success {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #047857;
}

.message.error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.message.info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

/* =========================
   TABELA
   ========================= */
.table-wrap {
  overflow-x: auto;
  margin-top: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 0.9rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

tr:hover td {
  background: #f8fafc;
}

/* =========================
   PREVIEW DO CONTRATO
   ========================= */
.preview-panel {
  background: #ffffff;
}

.preview-panel h2,
.preview-panel p,
.preview-panel label {
  color: #0f172a;
}

.preview-text {
  white-space: pre-wrap;
  background: #f8fafc;
  color: #0f172a;
  border-radius: 14px;
  padding: 18px;
  border: 1px solid #dbe3ef;
  line-height: 1.7;
  font-family: Georgia, "Times New Roman", serif;
  min-height: 520px;
  max-height: calc(100vh - 220px);
  overflow: auto;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  flex-wrap: wrap;
}

.small {
  font-size: 0.92rem;
}

#emptyState {
  display: none;
  margin-top: 18px;
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  color: var(--muted);
  background: #ffffff;
}

/* =========================
   RODAPÉ
   ========================= */
.site-footer {
  width: min(1200px, 92%);
  margin: 40px auto 24px;
  background: #ffffff;
  color: #0f172a;
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.site-footer__line {
  display: none;
}

.site-footer__content {
  padding: 18px 24px 20px;
}

.site-footer__brand {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 4px;
}

.site-footer__info {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #475569;
  margin-bottom: 2px;
}

.site-footer__city {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #475569;
}

/* =========================
   RESPONSIVO
   ========================= */
@media (max-width: 900px) {
  .site-header__inner {
    align-items: flex-start;
  }

  .site-brand {
    width: 100%;
  }

  .site-brand__logo {
    width: 58px;
    height: 58px;
  }

  .site-brand__name {
    font-size: 1.45rem;
  }

  .site-brand__subtitle {
    font-size: 0.88rem;
  }

  .site-nav {
    width: 100%;
  }

  .hero-card {
    padding: 24px;
  }

  .hero-card h1 {
    font-size: clamp(1.75rem, 7vw, 2.7rem);
  }

  .hero-card p {
    font-size: 0.98rem;
  }

  .auth-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 20px;
  }

  .stat-card p {
    font-size: 1.7rem;
  }

  .site-footer {
    width: 100%;
    border-radius: 0;
    margin-left: 0;
    margin-right: 0;
  }

  .container {
    width: min(1200px, 92%);
  }
}

/* =========================
   IMPRESSÃO
   ========================= */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }

  .site-header,
  .site-footer,
  .no-print,
  .secondary {
    display: none !important;
  }

  .content-grid {
    grid-template-columns: 1fr !important;
  }

  .panel {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
  }

  .preview-panel {
    background: #fff !important;
    color: #000 !important;
  }

  .preview-text {
    max-height: none !important;
    min-height: auto !important;
    border: none !important;
    padding: 0 !important;
  }
}

@media (max-width: 768px) {
  .container {
    width: 100%;
    padding: 14px 12px 28px;
  }

  .site-header__inner {
    width: 100%;
    padding: 14px 12px;
    gap: 12px;
  }

  .site-brand {
    min-width: 0;
    gap: 10px;
  }

  .site-brand__logo {
    width: 52px;
    height: 52px;
  }

  .site-brand__name {
    font-size: 1.35rem;
  }

  .site-brand__subtitle {
    font-size: 0.82rem;
    line-height: 1.2;
  }

  .site-brand__tagline {
    font-size: 0.78rem;
  }

  .site-nav {
    width: 100%;
    justify-content: flex-start;
    gap: 8px;
    margin-top: 4px;
  }

  .site-nav a {
    padding: 0.48rem 0.72rem;
    font-size: 0.9rem;
  }

  .hero-card {
    padding: 20px 16px 22px;
    border-radius: 18px;
  }

  .hero-card--compact {
    padding: 18px 16px;
  }

  .hero-card h1 {
    font-size: clamp(1.55rem, 6vw, 2.15rem);
    line-height: 1.08;
    margin: 12px 0 10px;
  }

  .hero-card p {
    font-size: 0.96rem;
    line-height: 1.5;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-top: 16px;
  }

  .btn {
    width: 100%;
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
  }

  .feature-grid,
  .cards,
  .auth-grid,
  .content-grid,
  .stats-grid,
  .form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .card,
  .auth-card,
  .panel {
    padding: 16px;
    border-radius: 18px;
  }

  .card h3 {
    font-size: 1rem;
  }

  .card p,
  .muted,
  .hero-card p {
    font-size: 0.94rem;
  }

  .badge {
    font-size: 0.76rem;
    padding: 0.28rem 0.58rem;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-card h3 {
    font-size: 0.88rem;
  }

  .stat-card p {
    font-size: 1.45rem;
  }

  .table-wrap {
    margin-top: 12px;
  }

  th,
  td {
    padding: 0.75rem 0.55rem;
    font-size: 0.9rem;
  }

  .preview-text {
    min-height: 280px;
    max-height: 380px;
    padding: 14px;
    font-size: 0.95rem;
  }

  .site-footer {
    width: 100%;
    border-radius: 0;
    margin: 28px 0 0;
  }

  .site-footer__content {
    padding: 14px 14px 16px;
  }

  .site-footer__brand {
    font-size: 0.95rem;
  }

  .site-footer__info,
  .site-footer__city {
    font-size: 0.85rem;
    line-height: 1.45;
  }
}