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

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

.app-header {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 16px 24px;
}

.header-container {
  max-width: 1200px;
  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;
}
.portal-back:hover { color: #2563eb; }

.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;
}

.main-container {
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 16px;
}

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

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

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

.builder-panel h2, .preview-header h2 {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 16px;
}

/* Presets Bar */
.presets-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.preset-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.preset-btn:hover {
  background: #e2e8f0;
}

.pro-preset {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #b45309;
}

.rule-block {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 16px;
}

.rule-block h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 10px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

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

textarea, input[type="text"], input[type="url"], input[type="number"] {
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  outline: none;
  font-family: inherit;
  font-size: 0.9rem;
}

textarea {
  font-family: monospace;
  font-size: 0.85rem;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  cursor: pointer;
}

.form-group-row {
  display: flex;
  gap: 12px;
}
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

/* Testador */
.tester-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 16px;
  margin-top: 20px;
}

.tester-box h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: #1e40af;
  margin-bottom: 4px;
}

.tester-box p {
  font-size: 0.8rem;
  color: #475569;
  margin-bottom: 10px;
}

.test-input-row {
  display: flex;
  gap: 8px;
}

.test-input-row input {
  flex: 1;
}

.btn-test {
  background: #1e40af;
  color: white;
  border: none;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
}

.test-feedback {
  margin-top: 10px;
  font-size: 0.85rem;
  font-weight: 700;
}

.test-feedback.blocked {
  color: #dc2626;
  background: #fee2e2;
  padding: 6px 12px;
  border-radius: 6px;
}

.test-feedback.allowed {
  color: #059669;
  background: #d1fae5;
  padding: 6px 12px;
  border-radius: 6px;
}

/* Preview Output */
.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.code-actions {
  display: flex;
  gap: 8px;
}

.btn-copy {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-primary {
  background: #2563eb;
  color: #ffffff;
  border: none;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
}

.code-editor-box {
  background: #0f172a;
  color: #38bdf8;
  padding: 18px;
  border-radius: 12px;
  font-family: 'Courier Prime', monospace;
  font-size: 0.88rem;
  line-height: 1.6;
  white-space: pre-wrap;
  min-height: 380px;
  max-height: 550px;
  overflow-y: auto;
}

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