:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --ink: #1f2933;
  --muted: #6b7280;
  --brand: #d5303e;      /* vermelho (rede empresarial) */
  --brand-dark: #a51f2b;
  --border: #e5e7eb;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.06);
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

/* Topbar */
.topbar {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  padding: 28px 20px;
}
.brand { display: flex; align-items: center; gap: 16px; max-width: 1120px; margin: 0 auto; }
.brand .logo { font-size: 40px; }
.brand h1 { margin: 0; font-size: 26px; letter-spacing: .5px; }
.brand p { margin: 2px 0 0; opacity: .9; font-size: 14px; }

/* Container */
.container { max-width: 1120px; margin: 0 auto; padding: 28px 20px 40px; }

.category { margin-bottom: 34px; }
.cat-title {
  font-size: 15px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--muted); margin: 0 0 14px; font-weight: 700;
  border-left: 4px solid var(--brand); padding-left: 10px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}

/* Cards */
.card {
  position: relative;
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s;
  font: inherit; color: inherit;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--brand); }
.card-icon { font-size: 26px; }
.card-label { font-weight: 700; font-size: 15px; }
.card-desc { font-size: 12.5px; color: var(--muted); }
.badge {
  margin-top: 6px; font-size: 10.5px; color: var(--brand-dark);
  background: #fdecee; border: 1px solid #f6c9ce; padding: 2px 8px; border-radius: 999px;
}

/* Footer */
.foot { text-align: center; color: var(--muted); font-size: 12.5px; padding: 20px; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.55);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50;
}
/* O atributo [hidden] precisa vencer o display:flex acima, senao o modal
   fica sempre visivel (bug: parecia um upload que nao fecha). */
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--surface); border-radius: 18px; width: 100%; max-width: 480px;
  padding: 26px; box-shadow: var(--shadow); position: relative;
  max-height: 90vh; overflow-y: auto;
}
.modal-close {
  position: absolute; top: 14px; right: 14px; border: none; background: transparent;
  font-size: 18px; cursor: pointer; color: var(--muted);
}
.modal-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.modal-icon { font-size: 34px; }
.modal-head h3 { margin: 0; font-size: 20px; }
.modal-head p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }

/* Form */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; font: inherit; background: #fff;
}
.field input[type=file] { padding: 8px; background: #fafafa; }
.field textarea { min-height: 90px; resize: vertical; font-family: ui-monospace, monospace; font-size: 13px; }
.field .hint { color: var(--muted); font-size: 11.5px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(213,48,62,.15);
}

.btn-primary {
  width: 100%; padding: 13px; border: none; border-radius: 10px; cursor: pointer;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 15px;
  transition: background .12s;
}
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:disabled { opacity: .6; cursor: progress; }

.error {
  background: #fdecee; border: 1px solid #f6c9ce; color: var(--brand-dark);
  padding: 10px 12px; border-radius: 10px; font-size: 13px; margin-bottom: 12px;
}
.json-result {
  background: #0f172a; color: #e2e8f0; padding: 14px; border-radius: 10px;
  font-family: ui-monospace, monospace; font-size: 12px; white-space: pre-wrap;
  word-break: break-word; max-height: 320px; overflow: auto; margin-bottom: 12px;
}

@media (max-width: 520px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
