.innobot-tree-dialog {
  box-sizing: border-box;
  --tree-surface: #fff;
  --tree-text: #153947;
  --tree-muted: #55717f;
  --tree-border: #c9dfe5;
  --tree-soft: #f2f8fa;
  background: var(--tree-surface);
  color: var(--tree-text);
  border: 1px solid var(--tree-border);
  border-radius: 20px;
  padding: 24px;
  width: min(880px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  box-shadow: 0 24px 80px #122f3e33;
}
.innobot-tree-dialog::backdrop {
  background: #102a3f80;
}
.tree-header,
.tree-toolbar,
.tree-footer,
.tree-footer > div {
  display: flex;
  align-items: center;
  gap: 12px;
}
.tree-header,
.tree-footer {
  justify-content: space-between;
}
.tree-header h2 {
  font-size: 22px;
  font-weight: 650;
  margin: 0 0 4px;
}
.tree-header p,
.tree-note,
.tree-summary,
.tree-status {
  color: var(--tree-muted);
  font-size: 14px;
  line-height: 1.6;
}
.tree-header p {
  margin: 0;
}
.tree-note {
  margin: 20px 0;
}
.tree-admission {
  font-size: 14px;
  line-height: 1.6;
  padding: 12px;
  border: 1px solid var(--tree-border);
  border-radius: 10px;
  background: var(--tree-soft);
}
.innobot-tree-dialog button,
.innobot-tree-dialog select,
.innobot-tree-dialog input {
  font: inherit;
  color: inherit;
  background: var(--tree-surface);
  border: 1px solid var(--tree-border);
  border-radius: 10px;
  min-height: 42px;
  padding: 9px 12px;
}
.innobot-tree-dialog button {
  cursor: pointer;
}
.innobot-tree-dialog :disabled {
  cursor: default;
  opacity: 0.55;
}
.innobot-tree-dialog :focus-visible {
  outline: 3px solid #008caa;
  outline-offset: 3px;
}
.tree-toolbar input {
  flex: 1;
  min-width: 0;
}
.tree-toolbar select {
  flex: 1;
  min-width: 0;
}
.tree-branches {
  border: 1px solid var(--tree-border);
  border-radius: 12px;
  margin-bottom: 12px;
}
.tree-branch {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 14px 12px calc(10px + var(--tree-depth) * 14px);
  border-bottom: 1px solid var(--tree-border);
}
.tree-branch:last-child {
  border: 0;
}
.tree-branch:hover {
  background: var(--tree-soft);
}
.tree-copy {
  flex: 1;
  min-width: 0;
}
.tree-copy strong,
.tree-copy small {
  display: block;
  overflow-wrap: anywhere;
}
.tree-copy strong {
  font-size: 14px;
  font-weight: 600;
}
.tree-copy small {
  color: var(--tree-muted);
  font-size: 12px;
  margin-top: 3px;
}
.tree-copy .tree-blocked {
  color: #9f3d32;
}
.innobot-tree-dialog .tree-fold {
  padding: 4px;
  width: 28px;
  min-width: 28px;
  min-height: 32px;
  border-color: transparent;
}
.tree-branch select {
  width: 110px;
  flex-shrink: 0;
}
.tree-scopes {
  display: flex;
  gap: 12px;
  border: 0;
  padding: 0;
  margin: 18px 0;
}
.tree-scopes legend {
  font-weight: 600;
  margin-bottom: 10px;
}
.tree-scope {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--tree-border);
  border-radius: 12px;
  cursor: pointer;
}
.tree-scope:has(input:checked) {
  background: var(--tree-soft);
  border-color: #00879b;
}
.tree-rights,
.tree-full-permissions {
  display: flex;
  gap: 18px;
  align-items: center;
}
.tree-rights label,
.tree-full-permissions label {
  display: flex;
  gap: 7px;
  align-items: center;
  cursor: pointer;
  font-size: 13px;
}
.tree-full-permissions {
  padding: 16px;
  border: 1px solid var(--tree-border);
  border-radius: 12px;
}
.innobot-tree-dialog input[type='checkbox'],
.innobot-tree-dialog input[type='radio'] {
  accent-color: #00879b;
  padding: 0;
  min-height: 20px;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  margin: 0;
}
.innobot-tree-dialog [hidden] {
  display: none !important;
}
.innobot-tree-dialog .tree-primary {
  color: white;
  background: #00879b;
  border-color: #00879b;
  font-weight: 600;
}
.tree-footer {
  position: sticky;
  bottom: -24px;
  background: var(--tree-surface);
  border-top: 1px solid var(--tree-border);
  margin-top: 20px;
  padding: 14px 0;
}
.tree-footer > div {
  flex-shrink: 0;
}
html.dark .innobot-tree-dialog {
  --tree-surface: #102c36;
  --tree-text: #e3f1f5;
  --tree-muted: #adc5cf;
  --tree-border: #365663;
  --tree-soft: #183a45;
}
html.dark .tree-copy .tree-blocked {
  color: #ffb2a9;
}
@media (max-width: 600px) {
  .tree-scopes {
    flex-direction: column;
    gap: 8px;
  }
  .tree-rights {
    gap: 10px;
  }
  .tree-rights label {
    flex-direction: column;
    gap: 3px;
    font-size: 11px;
  }
  .innobot-tree-dialog {
    padding: 18px;
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 14px;
  }
  .tree-toolbar,
  .tree-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .tree-toolbar input,
  .tree-toolbar select {
    width: 100%;
  }
  .tree-branch {
    padding-left: calc(6px + var(--tree-depth) * 6px);
    gap: 5px;
  }
  .tree-branch select {
    width: 90px;
    padding: 6px;
    font-size: 13px;
  }
  .tree-footer {
    bottom: -18px;
    gap: 4px;
  }
  .tree-footer > div {
    justify-content: flex-end;
  }
}
