/* —— Formulário tributo —— */
.tributo-form-toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

@media (min-width: 768px) {
  .tributo-form-toolbar {
    grid-template-columns: 1fr 1fr;
  }
}

.tributo-empty-state {
  padding: 2rem 1rem;
  text-align: center;
  color: #64748b;
  border-radius: 0.75rem;
  background: #f8fafc;
  border: 1px dashed #e2e8f0;
}

.tributo-root-card {
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
}

.tributo-root-head {
  padding: 0.9rem 1rem;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: #fff;
}

.tributo-root-head-row {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}

.tributo-root-code {
  flex-shrink: 0;
  min-width: 2.25rem;
  padding: 0.25rem 0.5rem;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  color: #1e40af;
  background: #fff;
  border-radius: 0.35rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.tributo-root-head-text {
  flex: 1;
  min-width: 0;
}

.tributo-root-title {
  font-weight: 600;
  font-size: 1.05rem;
  margin: 0;
  line-height: 1.35;
}

.tributo-root-meta {
  font-size: 0.8rem;
  opacity: 0.9;
  margin-top: 0.25rem;
}

.tributo-principal-fields {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

@media (max-width: 992px) {
  .tributo-principal-fields {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 576px) {
  .tributo-principal-fields {
    grid-template-columns: 1fr;
  }
}

.tributo-principal-fields label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin-bottom: 0.2rem;
}

.tributo-tree-section {
  padding: 0.75rem 0.5rem 1rem;
  background: #fafbfc;
}

.tributo-tree-section-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin: 0 0 0.65rem 0.25rem;
  font-weight: 600;
}

/* —— Árvore hierárquica —— */
.tree-toolbar {
  margin-bottom: 0.65rem;
}

.tree-scroll {
  overflow-x: auto;
}

.tree-root {
  position: relative;
  padding-left: 0.15rem;
}

.tree-empty {
  text-align: center;
  padding: 1.25rem;
  color: #94a3b8;
  font-size: 0.9rem;
  border: 1px dashed #cbd5e1;
  border-radius: 0.5rem;
  background: #fff;
}

.tree-node {
  position: relative;
  margin-bottom: 0.35rem;
}

.tree-node[data-depth="0"] > .tree-node-row {
  margin-left: 0;
}

.tree-node[data-depth="1"] > .tree-node-row {
  margin-left: 0.5rem;
}

.tree-node[data-depth="2"] > .tree-node-row {
  margin-left: 1rem;
}

.tree-node[data-depth="3"] > .tree-node-row {
  margin-left: 1.5rem;
}

.tree-node[data-depth="4"] > .tree-node-row {
  margin-left: 2rem;
}

/* Linha guia vertical entre níveis */
.tree-children {
  position: relative;
  margin-left: 0.85rem;
  padding-left: 0.65rem;
  border-left: 2px solid #cbd5e1;
}

.tree-children::before {
  content: "";
  position: absolute;
  left: -2px;
  top: 0;
  bottom: 0.5rem;
  width: 2px;
  background: linear-gradient(180deg, #94a3b8 0%, transparent 100%);
}

.tree-node-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.5rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.tree-node-row:hover {
  border-color: #93c5fd;
}

.tree-toggle {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: #64748b;
  padding: 0.1rem;
  line-height: 1;
  width: 1.25rem;
}

.tree-code {
  flex-shrink: 0;
  min-width: 2.5rem;
  padding: 0.2rem 0.45rem;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.82rem;
  font-weight: 700;
  color: #1e40af;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 0.35rem;
  text-align: center;
}

.tree-row-text {
  flex: 1;
  min-width: 0;
}

.tree-name-preview {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-meta {
  display: block;
  font-size: 0.72rem;
  color: #64748b;
}

.tree-level-hint {
  display: block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  font-weight: 600;
}

.tree-node--class > .tree-node-row {
  border-left: 3px solid #3b82f6;
}

.tree-node--faixa > .tree-node-row {
  border-left: 3px solid #10b981;
}

.tree-fields--class {
  grid-template-columns: 4.5rem 1fr 5.5rem;
}

.tree-fields--faixa {
  grid-template-columns: 4.5rem 1fr 5rem;
}

.tree-row-actions {
  display: flex;
  gap: 0.2rem;
  flex-shrink: 0;
}

.tree-row-actions .btn {
  padding: 0.15rem 0.4rem;
  line-height: 1;
}

.tree-node-body {
  margin: 0.35rem 0 0.5rem 0.85rem;
  padding: 0.65rem 0.75rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.45rem;
  border-top-left-radius: 0;
}

.tree-fields {
  display: grid;
  grid-template-columns: 4.5rem 1fr 5.5rem;
  gap: 0.5rem;
  align-items: end;
}

.tree-field label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin-bottom: 0.15rem;
}

.tree-field-name {
  grid-column: 2;
}

@media (max-width: 720px) {
  .tree-fields {
    grid-template-columns: 1fr 1fr;
  }
  .tree-field-code {
    grid-column: 1;
  }
  .tree-field-name {
    grid-column: 1 / -1;
  }
  .tree-field-value {
    grid-column: 2;
  }
}

.tree-interval-block {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px dashed #e2e8f0;
}

.tree-interval-check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: #475569;
  margin-bottom: 0.4rem;
  cursor: pointer;
}

.tree-interval-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  padding: 0.5rem;
  background: #f1f5f9;
  border-radius: 0.35rem;
}

.tree-interval-grid label {
  font-size: 0.68rem;
  color: #64748b;
  margin-bottom: 0.1rem;
}

@media (max-width: 480px) {
  .tree-node-row {
    flex-wrap: wrap;
  }
  .tree-interval-grid {
    grid-template-columns: 1fr;
  }
}
