/* ── Página ──────────────────────────────────────────────────────── */
.gr-pag {
  display: flex;
  flex-direction: column;
  height: 100%;
  font-family: var(--fonte-ui, system-ui, sans-serif);
}

.gr-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  flex-shrink: 0;
}

.gr-titulo {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}

.gr-acoes-topo {
  display: flex;
  gap: 8px;
}

.gr-msg {
  margin: 6px 16px 0;
  font-size: 0.82rem;
  padding: 4px 10px;
  border-radius: 4px;
}

.gr-ok  { background: #dcfce7; color: #166534; }
.gr-err { background: #fee2e2; color: #991b1b; }

/* ── Corpo ───────────────────────────────────────────────────────── */
.gr-corpo {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.gr-canvas-cont {
  flex: 1;
  overflow: auto;
  background: #f1f5f9;
  border-right: 1px solid #e2e8f0;
}

/* ── SVG ─────────────────────────────────────────────────────────── */
.gr-svg {
  display: block;
  cursor: default;
  background: #ffffff;
}

.gr-svg-drag {
  cursor: grabbing;
}

/* Arestas */
.gr-aresta {
  fill: none;
  stroke: #94a3b8;
  stroke-width: 1.5;
  stroke-dasharray: none;
}

/* Nós */
.gr-rect {
  fill: #f1f5f9;
  stroke: #94a3b8;
  stroke-width: 1.5;
  cursor: grab;
}

.gr-rect-0 {
  fill: #dbeafe;
  stroke: #3b82f6;
  stroke-width: 2;
}

.gr-rect-1 {
  fill: #dcfce7;
  stroke: #22c55e;
  stroke-width: 1.5;
}

.gr-rect-2 {
  fill: #fef9c3;
  stroke: #eab308;
  stroke-width: 1.5;
}

.gr-rect-sel {
  stroke-width: 3;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.18));
}

.gr-rect-0.gr-rect-sel { stroke: #1d4ed8; }
.gr-rect-1.gr-rect-sel { stroke: #15803d; }
.gr-rect-2.gr-rect-sel { stroke: #a16207; }

/* Texto dos nós */
.gr-t-cod {
  font-size: 11px;
  font-weight: 700;
  fill: #1e293b;
  font-family: monospace;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.gr-t-des {
  font-size: 10px;
  fill: #475569;
  font-family: system-ui, sans-serif;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.gr-t-editor {
  font-size: 9px;
  font-weight: 700;
  fill: #2563eb;
  font-family: monospace;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

/* ── Painel lateral ──────────────────────────────────────────────── */
.gr-painel-cont {
  width: 200px;
  flex-shrink: 0;
  background: #ffffff;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.gr-painel {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gr-painel-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e2e8f0;
}

.gr-painel-cod {
  font-size: 0.9rem;
  font-weight: 700;
  color: #1e293b;
  font-family: monospace;
}

.gr-painel-des {
  font-size: 0.82rem;
  color: #475569;
}

.gr-painel-pai {
  font-size: 0.75rem;
  color: #94a3b8;
  margin: 0;
}

.gr-acoes-painel {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gr-painel-vazio {
  padding: 20px 12px;
  color: #94a3b8;
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  text-align: center;
}

.gr-painel-vazio p { margin: 0; }

/* ── Formulário ──────────────────────────────────────────────────── */
.gr-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gr-input {
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  padding: 5px 8px;
  font-size: 0.82rem;
  width: 100%;
  box-sizing: border-box;
  outline: none;
}

.gr-input:focus { border-color: #3b82f6; }

.gr-form-btns {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

/* ── Botões ──────────────────────────────────────────────────────── */
.gr-btn-pri {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 5px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.gr-btn-pri:hover { background: #1d4ed8; }

.gr-btn-sec {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  padding: 5px 10px;
  font-size: 0.82rem;
  cursor: pointer;
}

.gr-btn-sec:hover { background: #e2e8f0; }

.gr-btn-edit,
.gr-btn-add {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  padding: 5px 8px;
  font-size: 0.8rem;
  cursor: pointer;
  text-align: left;
}

.gr-btn-edit:hover { background: #dbeafe; border-color: #93c5fd; }
.gr-btn-add:hover  { background: #dcfce7; border-color: #86efac; }

.gr-btn-del {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fca5a5;
  border-radius: 5px;
  padding: 5px 8px;
  font-size: 0.8rem;
  cursor: pointer;
  text-align: left;
}

.gr-btn-del:hover { background: #fee2e2; }

.gr-btn-ok {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  flex: 1;
}

.gr-btn-ok:hover { background: #1d4ed8; }

.gr-btn-cancel {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 0.8rem;
  cursor: pointer;
  flex: 1;
}

.gr-btn-cancel:hover { background: #e2e8f0; }

.gr-estado {
  padding: 20px;
  color: #64748b;
  font-size: 0.9rem;
}
