/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #f1f5f9;
  color: #1e293b;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.app-header {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 16px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.header-container {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.portal-back {
  display: block;
  font-size: 0.75rem;
  color: #64748b;
  text-decoration: none;
  font-weight: 600;
  margin-bottom: 2px;
}
.portal-back:hover {
  color: #3b82f6;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 2rem;
}

.brand-logo h1 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
}

.tagline {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 500;
}

/* Main Layout */
.main-container {
  max-width: 1300px;
  margin: 24px auto;
  padding: 0 16px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 24px;
  align-items: start;
}

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

/* Form Panel */
.form-panel {
  background: #ffffff;
  border-radius: 16px;
  padding: 24px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.panel-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
}

.btn-secondary-sm {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-secondary-sm:hover {
  background: #e2e8f0;
}

.form-group-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
  width: 100%;
}

.form-field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
}

.form-field input,
.form-field select {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  outline: none;
  background: #f8fafc;
  color: #1e293b;
  transition: all 0.2s;
}

.form-field input:focus,
.form-field select:focus {
  border-color: #3b82f6;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.readonly-highlight {
  background: #f1f5f9 !important;
  color: #334155 !important;
  font-weight: 600;
  font-size: 0.8rem !important;
}

.form-divider {
  border: 0;
  border-top: 1px solid #e2e8f0;
  margin: 16px 0 12px 0;
}

.form-panel h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  margin-bottom: 12px;
  font-weight: 700;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.btn-primary {
  flex: 1;
  background: #0284c7;
  color: #ffffff;
  border: none;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 12px 18px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
  transition: all 0.2s;
}
.btn-primary:hover {
  background: #0369a1;
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid #cbd5e1;
  color: #64748b;
  font-weight: 600;
  padding: 12px 16px;
  border-radius: 10px;
  cursor: pointer;
}
.btn-outline:hover {
  background: #f8fafc;
}

/* Preview Panel */
.preview-panel {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  padding: 24px;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}

.preview-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  background: #f8fafc;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.toolbar-title {
  display: flex;
  flex-direction: column;
}

.toolbar-title span:first-child {
  font-size: 0.9rem;
  font-weight: 700;
  color: #0f172a;
}

.preview-hint {
  font-size: 0.75rem;
  color: #64748b;
}

.btn-pro-trigger {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #b45309;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-pro-trigger:hover {
  background: #fef3c7;
}

/* Estilização Oficial da Nota Promissória */
.print-sheet-a4 {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.promissoria-item {
  background: #fffdfa;
  border: 3px double #1e3a5f;
  border-radius: 4px;
  padding: 16px 20px;
  position: relative;
  box-shadow: 0 4px 10px rgba(0,0,0,0.04);
}

.promissoria-header-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #1e3a5f;
  padding-bottom: 8px;
  margin-bottom: 14px;
}

.promissoria-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.4rem;
  letter-spacing: 2px;
  font-weight: 800;
  color: #1e3a5f;
  text-transform: uppercase;
}

.promissoria-meta-boxes {
  display: flex;
  gap: 16px;
}

.meta-box {
  background: #f1f5f9;
  border: 1px solid #94a3b8;
  padding: 4px 10px;
  border-radius: 4px;
  text-align: center;
}

.meta-box .label {
  font-size: 0.65rem;
  font-weight: 700;
  color: #475569;
  display: block;
  text-transform: uppercase;
}

.meta-box .value {
  font-family: 'Courier Prime', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
}

.promissoria-body {
  font-size: 0.95rem;
  line-height: 1.9;
  color: #1e293b;
  text-align: justify;
  margin-bottom: 18px;
}

.dotted-line {
  border-bottom: 1px dashed #64748b;
  padding: 0 4px;
  font-weight: 700;
  color: #0f172a;
}

.promissoria-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 24px;
  padding-top: 10px;
}

.sig-box {
  text-align: center;
}

.sig-line {
  border-top: 1px solid #334155;
  margin-bottom: 6px;
}

.sig-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #0f172a;
}

.sig-doc {
  font-size: 0.75rem;
  color: #64748b;
}

.sig-address {
  font-size: 0.7rem;
  color: #64748b;
}

.promissoria-canhoto {
  border-top: 1px dashed #94a3b8;
  margin-top: 14px;
  padding-top: 10px;
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #64748b;
}

/* Marca d'água free */
.watermark-free-notice {
  text-align: center;
  font-size: 0.7rem;
  color: #94a3b8;
  margin-top: 10px;
  border-top: 1px dotted #cbd5e1;
  padding-top: 4px;
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 32px 16px;
  color: #64748b;
  font-size: 0.8rem;
  border-top: 1px solid #e2e8f0;
  margin-top: 48px;
  background: #ffffff;
}

.disclaimer {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 4px;
}

/* Regras de Impressão */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .no-print,
  .app-header,
  .form-panel,
  .preview-toolbar,
  .app-footer,
  .ad-slot-container {
    display: none !important;
  }

  .main-container {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .workspace-grid {
    display: block !important;
  }

  .preview-panel {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  .print-sheet-a4 {
    gap: 16mm;
  }

  .promissoria-item {
    page-break-inside: avoid;
    break-inside: avoid;
    border: 2px solid #000000 !important;
    background: #ffffff !important;
    box-shadow: none !important;
    margin-bottom: 8mm;
  }

  @page {
    size: A4 portrait;
    margin: 10mm;
  }
}
